Bug 3903 – Traits compiles as true for an array sum with wrong syntax

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-03-08T15:04:00Z
Last change time
2013-12-14T05:46:50Z
Keywords
pull, wrong-code
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2010-03-08T15:04:06Z
This compiles, but the traits has to return 'false' here: void main() { int[2] a = [1, 2]; assert( __traits(compiles, {return a + a;}) ); //auto r = a + a; // error } See also bug 3817 .
Comment #1 by k.hara.pg — 2013-12-14T03:21:21Z
Comment #2 by github-bugzilla — 2013-12-14T05:07:32Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/1cf3f37da10b8e126f082c3b2085980335854afd fix Issue 3903 - Traits compiles as true for an array sum with wrong syntax Check invalid binary operations of arrays in front-end. https://github.com/D-Programming-Language/dmd/commit/26fe9e0b93dbeafc3239cd0bf3bf1692e8b21da2 Merge pull request #2960 from 9rnsr/fix3903 Issue 3903 - Traits compiles as true for an array sum with wrong syntax