[clang-cl] Ignore /Wv and /Wv:17 flags
[llvm-project.git] / clang / test / Parser / cxx-invalid-function-decl.cpp
blob2db27516eefab2e6157b34306caab952594f0fdc
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 // Check that "::new" and "::delete" in member initializer list are diagnosed
4 // correctly and don't lead to infinite loop on parsing.
6 // Error: X() (initializer on non-constructor), "::new" is skipped.
7 void f1() : X() ::new{}; // expected-error{{only constructors take base initializers}}
9 // Errors: first "::delete" and initializer on non-constructor, others skipped.
10 void f2() : ::delete, ::new, X() ::new ::delete{} // expected-error{{expected class member or base class name}}
11 // expected-error@-1{{only constructors take base initializers}}
13 // Errors: the '::' token, "::delete" and initializer on non-constructor, others skipped.
14 void f3() : ::, ::delete X(), ::new {}; // expected-error2{{expected class member or base class name}}
15 // expected-error@-1{{only constructors take base initializers}}
17 template <class T>
18 struct Base1 {
19 T x1;
20 Base1(T a1) : x1(a1) {}
23 template <class T>
24 struct Base2 {
25 T x2;
26 Base2(T a2) : x2(a2) {}
29 struct S : public Base1<int>, public Base2<float> {
30 int x;
32 // 1-st initializer is correct (just missing ','), 2-nd incorrect, skip other.
33 S() : ::Base1<int>(0) ::new, ::Base2<float>(1.0) ::delete x(2) {} // expected-error{{expected class member or base class name}}
34 // expected-error@-1{{missing ',' between base or member initializers}}
36 // 1-st and 2-nd are correct, errors: '::' and "::new", others skipped.
37 S(int a) : Base1<int>(a), ::Base2<float>(1.0), ::, // expected-error{{expected class member or base class name}}
38 ::new, ! ::delete, ::Base2<() x(3) {} // expected-error{{expected class member or base class name}}
40 // All initializers are correct, nothing to skip, diagnose 2 missing commas.
41 S(const S &) : Base1<int>(0) ::Base2<float>(1.0) x(2) {} // expected-error2{{missing ',' between base or member initializers}}