File tree 2 files changed +35
-23
lines changed
2 files changed +35
-23
lines changed Original file line number Diff line number Diff line change @@ -1126,4 +1126,39 @@ int test2() { return h{nullptr}; }
1126
1126
// expected-note@-2 {{subobject 'g' is not initialized}}
1127
1127
1128
1128
1129
+ }
1130
+
1131
+ namespace GH65985 {
1132
+
1133
+ int consteval operator " " _foo(unsigned long long V) {
1134
+ return 0 ;
1135
+ }
1136
+ int consteval operator " " _bar(unsigned long long V); // expected-note 3{{here}}
1137
+
1138
+ int consteval f () {
1139
+ return 0 ;
1140
+ }
1141
+
1142
+ int consteval g (); // expected-note {{here}}
1143
+
1144
+
1145
+ struct C {
1146
+ static const int a = 1_foo;
1147
+ static constexpr int b = 1_foo;
1148
+ static const int c = 1_bar; // expected-error {{call to consteval function 'GH65985::operator""_bar' is not a constant expression}} \
1149
+ // expected-note {{undefined function 'operator""_bar' cannot be used in a constant expression}} \
1150
+ // expected-error {{in-class initializer for static data member is not a constant expression}}
1151
+
1152
+ // FIXME: remove duplicate diagnostics
1153
+ static constexpr int d = 1_bar; // expected-error {{call to consteval function 'GH65985::operator""_bar' is not a constant expression}} \
1154
+ // expected-note {{undefined function 'operator""_bar' cannot be used in a constant expression}} \
1155
+ // expected-error {{constexpr variable 'd' must be initialized by a constant expression}} \
1156
+ // expected-note {{undefined function 'operator""_bar' cannot be used in a constant expression}}
1157
+
1158
+ static const int e = f();
1159
+ static const int f = g(); // expected-error {{call to consteval function 'GH65985::g' is not a constant expression}} \
1160
+ // expected-error {{in-class initializer for static data member is not a constant expression}} \
1161
+ // expected-note {{undefined function 'g' cannot be used in a constant expression}}
1162
+ };
1163
+
1129
1164
}
Original file line number Diff line number Diff line change @@ -330,26 +330,3 @@ struct S {
330
330
S s (0 ); // expected-note {{in the default initializer of 'j'}}
331
331
332
332
}
333
-
334
- namespace GH65985 {
335
-
336
- int consteval operator " " _foo(unsigned long long V) {
337
- return 0 ;
338
- }
339
- int consteval operator " " _bar(unsigned long long V); // expected-note 3{{here}}
340
-
341
- struct C {
342
- static const int a = 1_foo;
343
- static constexpr int b = 1_foo;
344
- static const int c = 1_bar; // expected-error {{call to consteval function 'GH65985::operator""_bar' is not a constant expression}} \
345
- // expected-note {{undefined function 'operator""_bar' cannot be used in a constant expression}} \
346
- // expected-error {{in-class initializer for static data member is not a constant expression}}
347
-
348
- // FIXME: remove duplicate diagnostics
349
- static constexpr int d = 1_bar; // expected-error {{call to consteval function 'GH65985::operator""_bar' is not a constant expression}} \
350
- // expected-note {{undefined function 'operator""_bar' cannot be used in a constant expression}} \
351
- // expected-error {{constexpr variable 'd' must be initialized by a constant expression}} \
352
- // expected-note {{undefined function 'operator""_bar' cannot be used in a constant expression}}
353
- };
354
-
355
- }
You can’t perform that action at this time.
0 commit comments