1 // RUN: %clang_cc1 -fsyntax-only -pedantic -verify=expected,cxx17 -std=c++17 %s
2 // RUN: %clang_cc1 -fsyntax-only -pedantic -verify=expected,cxx20 -std=c++2a %s
4 // cxx17-warning@* 0+{{designated initializers are a C++20 extension}}
6 void f1(int i
[static 5]) { // expected-error{{C99}}
9 struct Point
{ int x
; int y
; int z
[]; }; // expected-warning{{flexible array members are a C99 feature}}
12 y
: 25 }; // expected-warning{{use of GNU old-style field designator extension}}
15 .x
= 17, // expected-warning {{mixture of designated and non-designated initializers in the same initializer list is a C99 extension}}
16 25 // expected-note {{first non-designated initializer}}
20 .x
= 17, // expected-note {{previous initialization is here}}
21 .x
= 18, // expected-warning {{initializer overrides prior initialization of this subobject}}
25 .x
= 17, // expected-warning {{mixture of designated and non-designated initializers in the same initializer list is a C99 extension}}
26 25, // expected-note {{first non-designated initializer}}
27 // expected-note@-1 {{previous initialization is here}}
28 .y
= 18, // expected-warning {{initializer overrides prior initialization of this subobject}}
31 int arr
[1] = {[0] = 0}; // expected-warning {{array designators are a C99 extension}}
33 struct Pt
{ int x
, y
; };
34 struct Rect
{ Pt tl
, br
; };
36 .tl
.x
= 0 // expected-warning {{nested designators are a C99 extension}}
56 // It's important that we reject this; we would not destroy the existing
57 // 'NonTrivial' object before overwriting it (and even calling its destructor
58 // would not necessarily be correct).
60 .s
= f(), // expected-note {{previous}}
61 .s
.b
= NonTrivial() // expected-error {{initializer would partially override prior initialization of object of type 'S' with non-trivial destruction}}
62 // expected-warning@-1 {{nested}}
65 // FIXME: It might be reasonable to accept this.
67 .s
= f(), // expected-note {{previous}}
68 .s
.a
= 0 // expected-error {{initializer would partially override prior initialization of object of type 'S' with non-trivial destruction}}
69 // expected-warning@-1 {{nested}}