February 12, 2023 [Issue 23700] New: compilable/test22842.c:64:24: error: expression in static assertion is not constant | ||||
---|---|---|---|---|
| ||||
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@puremagic.com Reporter: ibuclaw@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"); ``` -- |
Copyright © 1999-2021 by the D Language Foundation