[Issue 23700] New: compilable/test22842.c:64:24: error: expression in static assertion is not constant
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Feb 12 15:33:21 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=23700
Issue ID: 23700
Summary: compilable/test22842.c:64:24: error: expression in
static assertion is not constant
Product: D
Version: D2
Hardware: All
OS: Linux
Status: NEW
Severity: major
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: ibuclaw at gdcproject.org
When compiling the test with `gcc -std=c11 -fsyntax-only`
compilable/test22842.c:64:24: error: expression in static assertion is not
constant
64 | _Static_assert(mint1() == -1, "1");
| ~~~~~~~~^~~~~
compilable/test22842.c: In function ‘mint3’:
compilable/test22842.c:80:18: warning: cast from pointer to integer of
different size [-Wpointer-to-int-cast]
80 | unsigned x = (unsigned)(p) & 1;
| ^
Test content:
```
// https://issues.dlang.org/show_bug.cgi?id=22876
int mint1()
{
int a = 0;
// dmd gives 1, other compilers -1
// bug disappears if the parentheses around (a) are removed
return - (a) - 1;
}
_Static_assert(mint1() == -1, "1");
```
--
More information about the Digitalmars-d-bugs
mailing list