-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Closed
Labels
c23clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyVerified by a second party
Description
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
typeofoperators are applied to an expression, they yield the type of their operand. Otherwise, they designate the same type as the type name with any nestedtypeofspecifier evaluated.
Interestingly, typeof(expression) isn't broken!
https://gcc.godbolt.org/z/TGWYdhndo
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
Metadata
Metadata
Assignees
Labels
c23clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyVerified by a second party