[Issue 10534] New: Addition and subtraction of delegates allowed

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jul 3 19:01:40 PDT 2013


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

           Summary: Addition and subtraction of delegates allowed
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: callumenator at gmail.com


--- Comment #0 from callumenator at gmail.com 2013-07-03 19:01:39 PDT ---
DMD 2.063

void main()
{
  int delegate() a = ()=>5;
  int delegate() b = ()=>5;
  auto c1 = a+b; // passes (and will crash if c1() called)
  auto c2 = a-b; // passes (and will crash if c2() called)
  auto c3 = a/b; // a & b not of arithmetic type
  auto c4 = a*b; // a & b not of arithmetic type        
}

DMD properly rejects all arithmetic if delegates are typed as int function()'s.

-- 
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