You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The underlying type of an enumeration is the non-atomic, unqualified
version of the specified type. Clang was rejecting such enumerations,
with a hard error, but now has the ability to downgrade the error into a
warning. Additionally, we diagnose (as a warning) dropping other
qualifiers. _Atomic is special given that an atomic type need not have
the same size as its non-atomic counterpart, and that the C++ version
of <stdatomic.h> defines _Atomic to std::atomic for easing cross-
language atomic use and std::atomic is an invalid enum base in C++.
(Note: we expose _Atomic in C++ even without including
<stdatomic,h>.)
Fixes#147736
Copy file name to clipboardExpand all lines: clang/test/C/C23/n3030.c
+16Lines changed: 16 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -91,3 +91,19 @@ enum e : short f = 0; // expected-error {{non-defining declaration of enumeratio
91
91
enumg : short { yyy } h=yyy;
92
92
93
93
enumee2 : typeof ((enumee3 : short { A })0, (short)0);
94
+
95
+
enumnot_actually_atomic : _Atomic(short) { // expected-error {{'_Atomic' qualifier ignored; operations involving the enumeration type will be non-atomic}}
96
+
Surprise
97
+
};
98
+
99
+
enumnot_actually_const : constint { // expected-warning {{'const' qualifier in enumeration underlying type ignored}}
100
+
SurpriseAgain
101
+
};
102
+
103
+
enumnot_actually_volatile : volatileint { // expected-warning {{'volatile' qualifier in enumeration underlying type ignored}}
104
+
SurpriseOnceMore
105
+
};
106
+
107
+
enumnot_acually_const_or_volatile : constvolatileint { // expected-warning {{'const' and 'volatile' qualifiers in enumeration underlying type ignored}}
0 commit comments