Bug 10534 – Addition and subtraction of delegates allowed

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-07-03T19:01:00Z
Last change time
2013-07-05T11:17:24Z
Keywords
accepts-invalid, pull
Assigned to
nobody
Creator
callumenator

Comments

Comment #0 by callumenator — 2013-07-03T19:01:39Z
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.
Comment #1 by k.hara.pg — 2013-07-03T20:47:05Z
Comment #2 by github-bugzilla — 2013-07-05T11:17:11Z
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