www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10534] New: Addition and subtraction of delegates allowed

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: callumenator gmail.com


--- Comment #0 from callumenator 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: -------
Jul 03 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10534


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2013-07-03 20:47:05 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2294

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 03 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10534



--- Comment #2 from github-bugzilla puremagic.com 2013-07-05 11:17:11 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/1fb7a33b2ca338628450428ba67d302616126b02
fix Issue 10534 - Addition and subtraction of delegates allowed

https://github.com/D-Programming-Language/dmd/commit/d9c710351028452533241e069bdde9034fc4cde8
Merge pull request #2294 from 9rnsr/fix10534

Issue 10534 - Addition and subtraction of delegates allowed

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 05 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10534


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


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