[Issue 23696] New: compilable/enumbase.c:3:8: error: expected identifier or ‘(’ before ‘:’ token
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Feb 12 15:16:01 UTC 2023
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 at puremagic.com
Reporter: ibuclaw at 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,
};
```
--
More information about the Digitalmars-d-bugs
mailing list