February 12, 2023 [Issue 23696] New: compilable/enumbase.c:3:8: error: expected identifier or ‘(’ before ‘:’ token | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23696 Issue ID: 23696 Summary: compilable/enumbase.c:3:8: error: expected identifier or ‘(’ before ‘:’ token 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/enumbase.c:3:8: error: expected identifier or ‘(’ before ‘:’ token 3 | enum E : char { A = 3, B }; | ^ compilable/enumbase.c:5:23: error: invalid application of ‘sizeof’ to incomplete type ‘enum E’ 5 | _Static_assert(sizeof(enum E) == 1, "1"); | ^~~~ compilable/enumbase.c:5:16: error: expression in static assertion is not an integer 5 | _Static_assert(sizeof(enum E) == 1, "1"); | ^~~~~~ compilable/enumbase.c:6:16: error: ‘A’ undeclared here (not in a function) 6 | _Static_assert(A == 3, "2"); | ^ compilable/enumbase.c:6:16: error: expression in static assertion is not an integer compilable/enumbase.c:11:7: error: expected identifier or ‘(’ before ‘:’ token 11 | enum L: long long { | ^ compilable/enumbase.c:15:7: error: expected identifier or ‘(’ before ‘:’ token 15 | enum U: unsigned long long { | ^ compilable/enumbase.c:19:8: error: expected identifier or ‘(’ before ‘:’ token 19 | enum U2: unsigned { | ^ compilable/enumbase.c:23:8: error: expected identifier or ‘(’ before ‘:’ token 23 | enum U3: unsigned long { | ^ Original test case: ``` // https://issues.dlang.org/show_bug.cgi?id=22631 enum E : char { A = 3, B }; _Static_assert(sizeof(enum E) == 1, "1"); _Static_assert(A == 3, "2"); // https://issues.dlang.org/show_bug.cgi?id=22705 enum L: long long { L_A = 1, }; enum U: unsigned long long { U_A = 1, }; enum U2: unsigned { U2_A = 1, }; enum U3: unsigned long { U3_A = 1, }; ``` -- |
Copyright © 1999-2021 by the D Language Foundation