1*67e74705SXin Li // RUN: %clang_cc1 -pedantic -Wall -Wno-comment -verify -fcxx-exceptions -x c++ %s
2*67e74705SXin Li // RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits -x c++ -std=c++11 %s 2>&1 | FileCheck %s
3*67e74705SXin Li // RUN: cp %s %t
4*67e74705SXin Li // RUN: not %clang_cc1 -pedantic -Wall -Wno-comment -fcxx-exceptions -fixit -x c++ %t
5*67e74705SXin Li // RUN: %clang_cc1 -fsyntax-only -pedantic -Wall -Werror -Wno-comment -fcxx-exceptions -x c++ %t
6*67e74705SXin Li
7*67e74705SXin Li /* This is a test of the various code modification hints that are
8*67e74705SXin Li provided as part of warning or extension diagnostics. All of the
9*67e74705SXin Li warnings will be fixed by -fixit, and the resulting file should
10*67e74705SXin Li compile cleanly with -Werror -pedantic. */
11*67e74705SXin Li
12*67e74705SXin Li struct C1 {
13*67e74705SXin Li virtual void f();
14*67e74705SXin Li static void g();
15*67e74705SXin Li };
16*67e74705SXin Li struct C2 : virtual public virtual C1 { }; // expected-error{{duplicate}}
17*67e74705SXin Li
f()18*67e74705SXin Li virtual void C1::f() { } // expected-error{{'virtual' can only be specified inside the class definition}}
19*67e74705SXin Li
g()20*67e74705SXin Li static void C1::g() { } // expected-error{{'static' can only be specified inside the class definition}}
21*67e74705SXin Li
22*67e74705SXin Li template<int Value> struct CT { template<typename> struct Inner; }; // expected-note{{previous use is here}}
23*67e74705SXin Li
24*67e74705SXin Li CT<10 >> 2> ct; // expected-warning{{require parentheses}}
25*67e74705SXin Li
26*67e74705SXin Li class C3 {
27*67e74705SXin Li public:
28*67e74705SXin Li C3(C3, int i = 0); // expected-error{{copy constructor must pass its first argument by reference}}
29*67e74705SXin Li };
30*67e74705SXin Li
31*67e74705SXin Li struct CT<0> { }; // expected-error{{'template<>'}}
32*67e74705SXin Li
33*67e74705SXin Li template<> union CT<1> { }; // expected-error{{tag type}}
34*67e74705SXin Li
35*67e74705SXin Li struct CT<2>::Inner<int> { }; // expected-error 2{{'template<>'}}
36*67e74705SXin Li
37*67e74705SXin Li // Access declarations
38*67e74705SXin Li class A {
39*67e74705SXin Li protected:
40*67e74705SXin Li int foo();
41*67e74705SXin Li };
42*67e74705SXin Li
43*67e74705SXin Li class B : public A {
44*67e74705SXin Li A::foo; // expected-warning{{access declarations are deprecated}}
45*67e74705SXin Li };
46*67e74705SXin Li
47*67e74705SXin Li void f() throw(); // expected-note{{previous}}
48*67e74705SXin Li void f(); // expected-error{{missing exception specification}}
49*67e74705SXin Li
50*67e74705SXin Li namespace rdar7853795 {
51*67e74705SXin Li struct A {
52*67e74705SXin Li bool getNumComponents() const; // expected-note{{declared here}}
dumprdar7853795::A53*67e74705SXin Li void dump() const {
54*67e74705SXin Li getNumComponenets(); // expected-error{{use of undeclared identifier 'getNumComponenets'; did you mean 'getNumComponents'?}}
55*67e74705SXin Li }
56*67e74705SXin Li };
57*67e74705SXin Li }
58*67e74705SXin Li
59*67e74705SXin Li namespace rdar7796492 {
60*67e74705SXin Li struct A { int x, y; A(); };
61*67e74705SXin Li
A()62*67e74705SXin Li A::A()
63*67e74705SXin Li : x(1) y(2) { // expected-error{{missing ',' between base or member initializers}}
64*67e74705SXin Li }
65*67e74705SXin Li
66*67e74705SXin Li }
67*67e74705SXin Li
68*67e74705SXin Li // extra qualification on member
69*67e74705SXin Li class C {
70*67e74705SXin Li int C::foo(); // expected-error {{extra qualification}}
71*67e74705SXin Li };
72*67e74705SXin Li
73*67e74705SXin Li namespace rdar8488464 {
74*67e74705SXin Li int x = 0;
75*67e74705SXin Li int x1 &= 0; // expected-error {{invalid '&=' at end of declaration; did you mean '='?}}
76*67e74705SXin Li int x2 *= 0; // expected-error {{invalid '*=' at end of declaration; did you mean '='?}}
77*67e74705SXin Li int x3 += 0; // expected-error {{invalid '+=' at end of declaration; did you mean '='?}}
78*67e74705SXin Li int x4 -= 0; // expected-error {{invalid '-=' at end of declaration; did you mean '='?}}
79*67e74705SXin Li int x5 != 0; // expected-error {{invalid '!=' at end of declaration; did you mean '='?}}
80*67e74705SXin Li int x6 /= 0; // expected-error {{invalid '/=' at end of declaration; did you mean '='?}}
81*67e74705SXin Li int x7 %= 0; // expected-error {{invalid '%=' at end of declaration; did you mean '='?}}
82*67e74705SXin Li int x8 <= 0; // expected-error {{invalid '<=' at end of declaration; did you mean '='?}}
83*67e74705SXin Li int x9 <<= 0; // expected-error {{invalid '<<=' at end of declaration; did you mean '='?}}
84*67e74705SXin Li int x10 >= 0; // expected-error {{invalid '>=' at end of declaration; did you mean '='?}}
85*67e74705SXin Li int x11 >>= 0; // expected-error {{invalid '>>=' at end of declaration; did you mean '='?}}
86*67e74705SXin Li int x12 ^= 0; // expected-error {{invalid '^=' at end of declaration; did you mean '='?}}
87*67e74705SXin Li int x13 |= 0; // expected-error {{invalid '|=' at end of declaration; did you mean '='?}}
88*67e74705SXin Li int x14 == 0; // expected-error {{invalid '==' at end of declaration; did you mean '='?}}
89*67e74705SXin Li
f()90*67e74705SXin Li void f() {
91*67e74705SXin Li int x = 0;
92*67e74705SXin Li (void)x;
93*67e74705SXin Li int x1 &= 0; // expected-error {{invalid '&=' at end of declaration; did you mean '='?}}
94*67e74705SXin Li (void)x1;
95*67e74705SXin Li int x2 *= 0; // expected-error {{invalid '*=' at end of declaration; did you mean '='?}}
96*67e74705SXin Li (void)x2;
97*67e74705SXin Li int x3 += 0; // expected-error {{invalid '+=' at end of declaration; did you mean '='?}}
98*67e74705SXin Li (void)x3;
99*67e74705SXin Li int x4 -= 0; // expected-error {{invalid '-=' at end of declaration; did you mean '='?}}
100*67e74705SXin Li (void)x4;
101*67e74705SXin Li int x5 != 0; // expected-error {{invalid '!=' at end of declaration; did you mean '='?}}
102*67e74705SXin Li (void)x5;
103*67e74705SXin Li int x6 /= 0; // expected-error {{invalid '/=' at end of declaration; did you mean '='?}}
104*67e74705SXin Li (void)x6;
105*67e74705SXin Li int x7 %= 0; // expected-error {{invalid '%=' at end of declaration; did you mean '='?}}
106*67e74705SXin Li (void)x7;
107*67e74705SXin Li int x8 <= 0; // expected-error {{invalid '<=' at end of declaration; did you mean '='?}}
108*67e74705SXin Li (void)x8;
109*67e74705SXin Li int x9 <<= 0; // expected-error {{invalid '<<=' at end of declaration; did you mean '='?}}
110*67e74705SXin Li (void)x9;
111*67e74705SXin Li int x10 >= 0; // expected-error {{invalid '>=' at end of declaration; did you mean '='?}}
112*67e74705SXin Li (void)x10;
113*67e74705SXin Li int x11 >>= 0; // expected-error {{invalid '>>=' at end of declaration; did you mean '='?}}
114*67e74705SXin Li (void)x11;
115*67e74705SXin Li int x12 ^= 0; // expected-error {{invalid '^=' at end of declaration; did you mean '='?}}
116*67e74705SXin Li (void)x12;
117*67e74705SXin Li int x13 |= 0; // expected-error {{invalid '|=' at end of declaration; did you mean '='?}}
118*67e74705SXin Li (void)x13;
119*67e74705SXin Li int x14 == 0; // expected-error {{invalid '==' at end of declaration; did you mean '='?}}
120*67e74705SXin Li (void)x14;
121*67e74705SXin Li if (int x = 0) { (void)x; }
122*67e74705SXin Li if (int x1 &= 0) { (void)x1; } // expected-error {{invalid '&=' at end of declaration; did you mean '='?}}
123*67e74705SXin Li if (int x2 *= 0) { (void)x2; } // expected-error {{invalid '*=' at end of declaration; did you mean '='?}}
124*67e74705SXin Li if (int x3 += 0) { (void)x3; } // expected-error {{invalid '+=' at end of declaration; did you mean '='?}}
125*67e74705SXin Li if (int x4 -= 0) { (void)x4; } // expected-error {{invalid '-=' at end of declaration; did you mean '='?}}
126*67e74705SXin Li if (int x5 != 0) { (void)x5; } // expected-error {{invalid '!=' at end of declaration; did you mean '='?}}
127*67e74705SXin Li if (int x6 /= 0) { (void)x6; } // expected-error {{invalid '/=' at end of declaration; did you mean '='?}}
128*67e74705SXin Li if (int x7 %= 0) { (void)x7; } // expected-error {{invalid '%=' at end of declaration; did you mean '='?}}
129*67e74705SXin Li if (int x8 <= 0) { (void)x8; } // expected-error {{invalid '<=' at end of declaration; did you mean '='?}}
130*67e74705SXin Li if (int x9 <<= 0) { (void)x9; } // expected-error {{invalid '<<=' at end of declaration; did you mean '='?}}
131*67e74705SXin Li if (int x10 >= 0) { (void)x10; } // expected-error {{invalid '>=' at end of declaration; did you mean '='?}}
132*67e74705SXin Li if (int x11 >>= 0) { (void)x11; } // expected-error {{invalid '>>=' at end of declaration; did you mean '='?}}
133*67e74705SXin Li if (int x12 ^= 0) { (void)x12; } // expected-error {{invalid '^=' at end of declaration; did you mean '='?}}
134*67e74705SXin Li if (int x13 |= 0) { (void)x13; } // expected-error {{invalid '|=' at end of declaration; did you mean '='?}}
135*67e74705SXin Li if (int x14 == 0) { (void)x14; } // expected-error {{invalid '==' at end of declaration; did you mean '='?}}
136*67e74705SXin Li }
137*67e74705SXin Li }
138*67e74705SXin Li
139*67e74705SXin Li template <class A>
140*67e74705SXin Li class F1 {
141*67e74705SXin Li public:
142*67e74705SXin Li template <int B>
143*67e74705SXin Li class Iterator {
144*67e74705SXin Li };
145*67e74705SXin Li };
146*67e74705SXin Li
147*67e74705SXin Li template<class T>
148*67e74705SXin Li class F2 {
149*67e74705SXin Li typename F1<T>:: /*template*/ Iterator<0> Mypos; // expected-error {{use 'template' keyword to treat 'Iterator' as a dependent template name}}
150*67e74705SXin Li };
151*67e74705SXin Li
152*67e74705SXin Li template <class T>
f()153*67e74705SXin Li void f(){
154*67e74705SXin Li typename F1<T>:: /*template*/ Iterator<0> Mypos; // expected-error {{use 'template' keyword to treat 'Iterator' as a dependent template name}}
155*67e74705SXin Li }
156*67e74705SXin Li
157*67e74705SXin Li // Tests for &/* fixits radar 7113438.
158*67e74705SXin Li class AD {};
159*67e74705SXin Li class BD: public AD {};
160*67e74705SXin Li
test(BD & br)161*67e74705SXin Li void test (BD &br) {
162*67e74705SXin Li AD* aPtr;
163*67e74705SXin Li BD b;
164*67e74705SXin Li aPtr = b; // expected-error {{assigning to 'AD *' from incompatible type 'BD'; take the address with &}}
165*67e74705SXin Li aPtr = br; // expected-error {{assigning to 'AD *' from incompatible type 'BD'; take the address with &}}
166*67e74705SXin Li }
167*67e74705SXin Li
foo1() const168*67e74705SXin Li void foo1() const {} // expected-error {{non-member function cannot have 'const' qualifier}}
foo2()169*67e74705SXin Li void foo2() volatile {} // expected-error {{non-member function cannot have 'volatile' qualifier}}
foo3() const170*67e74705SXin Li void foo3() const volatile {} // expected-error {{non-member function cannot have 'const volatile' qualifier}}
171*67e74705SXin Li
172*67e74705SXin Li struct S { void f(int, char); };
173*67e74705SXin Li int itsAComma,
174*67e74705SXin Li itsAComma2 = 0,
175*67e74705SXin Li oopsAComma(42), // expected-error {{expected ';' at end of declaration}}
176*67e74705SXin Li AD oopsMoreCommas() {
177*67e74705SXin Li static int n = 0, // expected-error {{expected ';' at end of declaration}}
178*67e74705SXin Li static char c,
179*67e74705SXin Li &d = c, // expected-error {{expected ';' at end of declaration}}
180*67e74705SXin Li S s, // expected-error {{expected ';' at end of declaration}}
181*67e74705SXin Li s.f(n, d);
182*67e74705SXin Li AD ad, // expected-error {{expected ';' at end of declaration}}
183*67e74705SXin Li return ad;
184*67e74705SXin Li }
185*67e74705SXin Li struct MoreAccidentalCommas {
186*67e74705SXin Li int a : 5,
187*67e74705SXin Li b : 7,
188*67e74705SXin Li : 4, // expected-error {{expected ';' at end of declaration}}
189*67e74705SXin Li char c, // expected-error {{expected ';' at end of declaration}}
190*67e74705SXin Li double d, // expected-error {{expected ';' at end of declaration}}
191*67e74705SXin Li MoreAccidentalCommas *next, // expected-error {{expected ';' at end of declaration}}
192*67e74705SXin Li public:
193*67e74705SXin Li int k, // expected-error {{expected ';' at end of declaration}}
194*67e74705SXin Li friend void f(MoreAccidentalCommas) {}
195*67e74705SXin Li int k2, // expected-error {{expected ';' at end of declaration}}
196*67e74705SXin Li virtual void g(), // expected-error {{expected ';' at end of declaration}}
197*67e74705SXin Li };
198*67e74705SXin Li
199*67e74705SXin Li template<class T> struct Mystery;
200*67e74705SXin Li template<class T> typedef Mystery<T>::type getMysteriousThing() { // \
201*67e74705SXin Li expected-error {{function definition declared 'typedef'}} \
202*67e74705SXin Li expected-error {{missing 'typename' prior to dependent}}
203*67e74705SXin Li return Mystery<T>::get();
204*67e74705SXin Li }
205*67e74705SXin Li
206*67e74705SXin Li template<template<typename> Foo, // expected-error {{template template parameter requires 'class' after the parameter list}}
207*67e74705SXin Li template<typename> typename Bar, // expected-warning {{template template parameter using 'typename' is a C++1z extension}}
208*67e74705SXin Li template<typename> struct Baz> // expected-error {{template template parameter requires 'class' after the parameter list}}
209*67e74705SXin Li void func();
210*67e74705SXin Li
211*67e74705SXin Li namespace ShadowedTagType {
212*67e74705SXin Li class Foo {
213*67e74705SXin Li public:
214*67e74705SXin Li enum Bar { X, Y };
215*67e74705SXin Li void SetBar(Bar bar);
216*67e74705SXin Li Bar Bar(); // expected-note 2 {{enum 'Bar' is hidden by a non-type declaration of 'Bar' here}}
217*67e74705SXin Li private:
218*67e74705SXin Li Bar bar_; // expected-error {{must use 'enum' tag to refer to type 'Bar' in this scope}}
219*67e74705SXin Li };
SetBar(Bar bar)220*67e74705SXin Li void Foo::SetBar(Bar bar) { bar_ = bar; } // expected-error {{must use 'enum' tag to refer to type 'Bar' in this scope}}
221*67e74705SXin Li }
222*67e74705SXin Li
223*67e74705SXin Li #define NULL __null
224*67e74705SXin Li char c = NULL; // expected-warning {{implicit conversion of NULL constant to 'char'}}
225*67e74705SXin Li double dbl = NULL; // expected-warning {{implicit conversion of NULL constant to 'double'}}
226*67e74705SXin Li
227*67e74705SXin Li namespace arrow_suggest {
228*67e74705SXin Li
229*67e74705SXin Li template <typename T>
230*67e74705SXin Li class wrapped_ptr {
231*67e74705SXin Li public:
wrapped_ptr(T * ptr)232*67e74705SXin Li wrapped_ptr(T* ptr) : ptr_(ptr) {}
operator ->()233*67e74705SXin Li T* operator->() { return ptr_; }
234*67e74705SXin Li private:
235*67e74705SXin Li T *ptr_;
236*67e74705SXin Li };
237*67e74705SXin Li
238*67e74705SXin Li class Worker {
239*67e74705SXin Li public:
240*67e74705SXin Li void DoSomething();
241*67e74705SXin Li };
242*67e74705SXin Li
test()243*67e74705SXin Li void test() {
244*67e74705SXin Li wrapped_ptr<Worker> worker(new Worker);
245*67e74705SXin Li worker.DoSomething(); // expected-error {{no member named 'DoSomething' in 'arrow_suggest::wrapped_ptr<arrow_suggest::Worker>'; did you mean to use '->' instead of '.'?}}
246*67e74705SXin Li }
247*67e74705SXin Li
248*67e74705SXin Li } // namespace arrow_suggest
249*67e74705SXin Li
250*67e74705SXin Li // Make sure fixing namespace-qualified identifiers functions properly with
251*67e74705SXin Li // namespace-aware typo correction/
252*67e74705SXin Li namespace redecl_typo {
253*67e74705SXin Li namespace Foo {
254*67e74705SXin Li void BeEvil(); // expected-note {{'BeEvil' declared here}}
255*67e74705SXin Li }
256*67e74705SXin Li namespace Bar {
257*67e74705SXin Li namespace Foo {
258*67e74705SXin Li bool isGood(); // expected-note {{'Bar::Foo::isGood' declared here}}
259*67e74705SXin Li void beEvil();
260*67e74705SXin Li }
261*67e74705SXin Li }
isGood()262*67e74705SXin Li bool Foo::isGood() { // expected-error {{out-of-line definition of 'isGood' does not match any declaration in namespace 'redecl_typo::Foo'; did you mean 'Bar::Foo::isGood'?}}
263*67e74705SXin Li return true;
264*67e74705SXin Li }
beEvil()265*67e74705SXin Li void Foo::beEvil() {} // expected-error {{out-of-line definition of 'beEvil' does not match any declaration in namespace 'redecl_typo::Foo'; did you mean 'BeEvil'?}}
266*67e74705SXin Li }
267*67e74705SXin Li
268*67e74705SXin Li // Test behavior when a template-id is ended by a token which starts with '>'.
269*67e74705SXin Li namespace greatergreater {
270*67e74705SXin Li template<typename T> struct S { S(); S(T); };
271*67e74705SXin Li void f(S<int>=0); // expected-error {{a space is required between a right angle bracket and an equals sign (use '> =')}}
272*67e74705SXin Li
273*67e74705SXin Li // FIXME: The fix-its here overlap so -fixit mode can't apply the second one.
274*67e74705SXin Li //void f(S<S<int>>=S<int>());
275*67e74705SXin Li
276*67e74705SXin Li struct Shr {
277*67e74705SXin Li template<typename T> Shr(T);
278*67e74705SXin Li template<typename T> void operator >>=(T);
279*67e74705SXin Li };
280*67e74705SXin Li
281*67e74705SXin Li template<template<typename>> struct TemplateTemplateParam; // expected-error {{requires 'class'}}
282*67e74705SXin Li
283*67e74705SXin Li template<typename T> void t();
g()284*67e74705SXin Li void g() {
285*67e74705SXin Li void (*p)() = &t<int>;
286*67e74705SXin Li (void)(&t<int>==p); // expected-error {{use '> ='}}
287*67e74705SXin Li (void)(&t<int>>=p); // expected-error {{use '> >'}}
288*67e74705SXin Li (void)(&t<S<int>>>=p); // expected-error {{use '> >'}}
289*67e74705SXin Li (Shr)&t<S<int>>>>=p; // expected-error {{use '> >'}}
290*67e74705SXin Li
291*67e74705SXin Li // FIXME: We correct this to '&t<int> > >= p;' not '&t<int> >>= p;'
292*67e74705SXin Li //(Shr)&t<int>>>=p;
293*67e74705SXin Li
294*67e74705SXin Li // FIXME: The fix-its here overlap.
295*67e74705SXin Li //(void)(&t<S<int>>==p);
296*67e74705SXin Li }
297*67e74705SXin Li }
298*67e74705SXin Li
299*67e74705SXin Li class foo {
test()300*67e74705SXin Li static void test() {
301*67e74705SXin Li (void)&i; // expected-error{{must explicitly qualify name of member function when taking its address}}
302*67e74705SXin Li }
303*67e74705SXin Li int i();
304*67e74705SXin Li };
305*67e74705SXin Li
306*67e74705SXin Li namespace dtor_fixit {
307*67e74705SXin Li class foo {
~bar()308*67e74705SXin Li ~bar() { } // expected-error {{expected the class name after '~' to name a destructor}}
309*67e74705SXin Li // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:6-[[@LINE-1]]:9}:"foo"
310*67e74705SXin Li };
311*67e74705SXin Li
312*67e74705SXin Li class bar {
313*67e74705SXin Li ~bar();
314*67e74705SXin Li };
bar()315*67e74705SXin Li ~bar::bar() {} // expected-error {{'~' in destructor name should be after nested name specifier}}
316*67e74705SXin Li // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:4}:""
317*67e74705SXin Li // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:9-[[@LINE-2]]:9}:"~"
318*67e74705SXin Li }
319*67e74705SXin Li
320*67e74705SXin Li namespace PR5066 {
321*67e74705SXin Li template<typename T> struct X {};
322*67e74705SXin Li X<int *p> x; // expected-error {{type-id cannot have a name}}
323*67e74705SXin Li }
324*67e74705SXin Li
325*67e74705SXin Li namespace PR5898 {
326*67e74705SXin Li class A {
327*67e74705SXin Li public:
328*67e74705SXin Li const char *str();
329*67e74705SXin Li };
foo(A & x)330*67e74705SXin Li const char* foo(A &x)
331*67e74705SXin Li {
332*67e74705SXin Li return x.str.(); // expected-error {{unexpected '.' in function call; perhaps remove the '.'?}}
333*67e74705SXin Li }
bar(A x,const char * y)334*67e74705SXin Li bool bar(A x, const char *y) {
335*67e74705SXin Li return foo->(x) == y; // expected-error {{unexpected '->' in function call; perhaps remove the '->'?}}
336*67e74705SXin Li }
337*67e74705SXin Li }
338*67e74705SXin Li
339*67e74705SXin Li namespace PR15045 {
340*67e74705SXin Li class Cl0 {
341*67e74705SXin Li public:
342*67e74705SXin Li int a;
343*67e74705SXin Li };
344*67e74705SXin Li
f()345*67e74705SXin Li int f() {
346*67e74705SXin Li Cl0 c;
347*67e74705SXin Li return c->a; // expected-error {{member reference type 'PR15045::Cl0' is not a pointer; did you mean to use '.'?}}
348*67e74705SXin Li }
349*67e74705SXin Li }
350*67e74705SXin Li
351*67e74705SXin Li namespace curly_after_base_clause {
352*67e74705SXin Li struct A { void f(); };
353*67e74705SXin Li struct B : A // expected-error{{expected '{' after base class list}}
354*67e74705SXin Li // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:13-[[@LINE-1]]:13}:" {"
355*67e74705SXin Li int i;
356*67e74705SXin Li };
357*67e74705SXin Li struct C : A // expected-error{{expected '{' after base class list}}
358*67e74705SXin Li // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:13-[[@LINE-1]]:13}:" {"
359*67e74705SXin Li using A::f;
360*67e74705SXin Li };
361*67e74705SXin Li struct D : A // expected-error{{expected '{' after base class list}}
362*67e74705SXin Li // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:13-[[@LINE-1]]:13}:" {"
363*67e74705SXin Li protected:
364*67e74705SXin Li };
365*67e74705SXin Li struct E : A // expected-error{{expected '{' after base class list}}
366*67e74705SXin Li // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:13-[[@LINE-1]]:13}:" {"
367*67e74705SXin Li template<typename T> struct inner { };
368*67e74705SXin Li };
369*67e74705SXin Li struct F : A // expected-error{{expected '{' after base class list}}
370*67e74705SXin Li // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:13-[[@LINE-1]]:13}:" {"
371*67e74705SXin Li F() { }
372*67e74705SXin Li };
373*67e74705SXin Li #if __cplusplus >= 201103L
374*67e74705SXin Li struct G : A // expected-error{{expected '{' after base class list}}
375*67e74705SXin Li // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:13-[[@LINE-1]]:13}:" {"
376*67e74705SXin Li constexpr G(int) { }
377*67e74705SXin Li };
378*67e74705SXin Li struct H : A // expected-error{{expected '{' after base class list}}
379*67e74705SXin Li // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:13-[[@LINE-1]]:13}:" {"
380*67e74705SXin Li static_assert(true, "");
381*67e74705SXin Li };
382*67e74705SXin Li #endif
383*67e74705SXin Li }
384*67e74705SXin Li
385*67e74705SXin Li struct conversion_operator {
386*67e74705SXin Li conversion_operator::* const operator int(); // expected-error {{put the complete type after 'operator'}}
387*67e74705SXin Li // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:32}:""
388*67e74705SXin Li // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:44-[[@LINE-2]]:44}:" conversion_operator::* const"
389*67e74705SXin Li };
390*67e74705SXin Li
391*67e74705SXin Li struct const_zero_init {
392*67e74705SXin Li int a;
393*67e74705SXin Li };
394*67e74705SXin Li const const_zero_init czi; // expected-error {{default initialization of an object of const type 'const const_zero_init'}}
395*67e74705SXin Li // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:26-[[@LINE-1]]:26}:"{}"
396*67e74705SXin Li int use_czi = czi.a;
397*67e74705SXin Li
398