[Issue 21590] New: assignment inside assert accepted if -checkaction=context is given

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jan 29 02:28:19 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=21590

          Issue ID: 21590
           Summary: assignment inside assert accepted if
                    -checkaction=context is given
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: kdevel at vogtner.de

```assgncnd.d
unittest {
   int a, b = 1;
   assert (a = b);
}
```

$ dmd -unittest -main -run assgncnd.d 
assgncnd.d(3): Error: assignment cannot be used as a condition, perhaps == was
meant?

$ dmd -unittest -checkaction=context -main -run assgncnd.d 
1 modules passed unittests

Tested DMD Versions:

2.095.0 bad
2.093.1 bad
2.090.1 good

--


More information about the Digitalmars-d-bugs mailing list