[clang-cl] Ignore /Wv and /Wv:17 flags
[llvm-project.git] / clang / test / SemaCXX / constructor.cpp
blobd2133240cb14a47f8544f779706815809bbf7412
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 typedef int INT;
4 class Foo {
5 Foo();
6 (Foo)(float) { }
7 explicit Foo(int); // expected-note {{previous declaration is here}}
8 Foo(const Foo&);
10 ((Foo))(INT); // expected-error{{cannot be redeclared}}
12 Foo(Foo foo, int i = 17, int j = 42); // expected-error{{copy constructor must pass its first argument by reference}}
14 static Foo(short, short); // expected-error{{constructor cannot be declared 'static'}}
15 virtual Foo(double); // expected-error{{constructor cannot be declared 'virtual'}}
16 Foo(long) const; // expected-error{{'const' qualifier is not allowed on a constructor}}
18 int Foo(int, int); // expected-error{{constructor cannot have a return type}}
20 volatile Foo(float); // expected-error{{constructor cannot have a return type}}
23 Foo::Foo(const Foo&) { }
25 typedef struct {
26 int version;
27 } Anon;
28 extern const Anon anon;
29 extern "C" const Anon anon2;
31 // PR3188: The extern declaration complained about not having an appropriate
32 // constructor.
33 struct x;
34 extern x a;
36 // A similar case.
37 struct y {
38 y(int);
40 extern y b;
42 struct Length {
43 Length l() const { return *this; }
46 // <rdar://problem/6815988>
47 struct mmst_reg{
48 char mmst_reg[10];
51 // PR3948
52 namespace PR3948 {
53 // PR3948
54 class a {
55 public:
56 int b(int a());
58 int x();
59 void y() {
60 a z; z.b(x);
64 namespace A {
65 struct S {
66 S();
67 S(int);
68 void f1();
69 void f2();
70 operator int ();
71 ~S();
75 A::S::S() {}
77 void A::S::f1() {}
79 struct S {};
81 A::S::S(int) {}
83 void A::S::f2() {}
85 A::S::operator int() { return 1; }
87 A::S::~S() {}
89 namespace PR38286 {
90 // FIXME: It'd be nice to give more consistent diagnostics for these cases
91 // (but they're all failing for somewhat different reasons...).
92 template<typename> struct A;
93 template<typename T> A<T>::A() {} // expected-error {{incomplete type 'A' named in nested name specifier}}
94 /*FIXME: needed to recover properly from previous error*/;
95 template<typename> struct B;
96 template<typename T> void B<T>::f() {} // expected-error {{out-of-line definition of 'f' from class 'B<type-parameter-0-0>'}}
97 template<typename> struct C; // expected-note {{non-type declaration found}}
98 template<typename T> C<T>::~C() {} // expected-error {{identifier 'C' after '~' in destructor name does not name a type}}