[Issue 10576] New: enforce/enforceEx overload for returntype

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jul 8 18:01:28 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10576

           Summary: enforce/enforceEx overload for returntype
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: admin at dav1d.de


--- Comment #0 from David <admin at dav1d.de> 2013-07-08 18:01:27 PDT ---
auto foo() { int invalid_value = 3; return 3; }
auto result = enforceEx!(Exception, 3)(foo());

Currently this code doesn't work as expected:
auto result = enforceEx!Exception(foo() != 3);

result would be a boolean instead of the result of 3. If there is an overload
which would take either a value to compare to or even a delagate (alias fun?)
this would make enforceEx much more useful.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list