@@ -261,31 +261,26 @@ namespace SizeOf {
261261 }
262262
263263#if __cplusplus >= 201402L
264- constexpr int IgnoredRejected () { // ref -error {{never produces a constant expression}}
264+ constexpr int IgnoredRejected () { // both -error {{never produces a constant expression}}
265265 int n = 0 ;
266266 sizeof (int [n++]); // both-warning {{expression result unused}} \
267- // ref -note 2{{subexpression not valid in a constant expression}}
267+ // both -note 2{{subexpression not valid in a constant expression}}
268268 return n;
269269 }
270- // / FIXME: This is rejected because the parameter so sizeof() is not constant.
271- // / produce a proper diagnostic.
272270 static_assert (IgnoredRejected() == 0, ""); // both-error {{not an integral constant expression}} \
273- // ref -note {{in call to 'IgnoredRejected()'}}
271+ // both -note {{in call to 'IgnoredRejected()'}}
274272#endif
275273
276274
277275#if __cplusplus >= 202002L
278276 // / FIXME: The following code should be accepted.
279- consteval int foo (int n) { // ref-error {{consteval function never produces a constant expression}}
280- return sizeof (int [n]); // ref-note 3{{not valid in a constant expression}}
281- }
282- constinit int var = foo(5 ); // ref-error {{not a constant expression}} \
283- // ref-note 2{{in call to}} \
284- // ref-error {{does not have a constant initializer}} \
285- // ref-note {{required by 'constinit' specifier}} \
286- // expected-error {{is not a constant expression}} \
287- // expected-error {{does not have a constant initializer}} \
288- // expected-note {{required by 'constinit' specifier}} \
277+ consteval int foo (int n) { // both-error {{consteval function never produces a constant expression}}
278+ return sizeof (int [n]); // both-note 3{{not valid in a constant expression}}
279+ }
280+ constinit int var = foo(5 ); // both-error {{not a constant expression}} \
281+ // both-note 2{{in call to}} \
282+ // both-error {{does not have a constant initializer}} \
283+ // both-note {{required by 'constinit' specifier}}
289284
290285#endif
291286};
0 commit comments