Issue |
146351
|
Summary |
[c23] `typeof(type-name)` in enumeration fixed underlying type is broken
|
Labels |
new issue
|
Assignees |
|
Reporter |
MisterDA
|
Setting a `typeof(type-name)` in an enumeration fixed underlying type is broken: an error is raised explaining that the identifiers are not declared, but we're in the process of declaring them. The bug is present in clang 20.1.0. GCC 15.1 doesn't have this bug.
See C23 6.7.3.6.p4 Typeof specifiers
> If the `typeof` operators are applied to an _expression_, they yield the type of their operand. Otherwise, they designate the same type as the type name with any nested `typeof` specifier evaluated.
Interestingly, `typeof(_expression_)` isn't broken!
https://gcc.godbolt.org/z/TGWYdhndo
```c
enum e : int {
E = 0,
};
enum f : typeof(int) {
F = 0, /* error: use of undeclared identifier 'F' */
};
int g = 0;
enum g : typeof(g) {
G = 0,
};
int main() {}
```
```
<source>:6:5: error: use of undeclared identifier 'F'
6 | F = 0,
| ^
1 error generated.
Compiler returned: 1
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs