diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2010-03-10 17:45:58 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2010-03-10 17:45:58 +0000 |
commit | 27c39af73c0d7d0b97e57b3a905040d4cefc9708 (patch) | |
tree | 56c1dd85a159948815817b5a90bedb39cf9ad105 /test/SemaCXX | |
parent | d2e6cf1d1c6468396ec057119c32aa58b1ee5ac9 (diff) | |
download | FreeBSD-src-27c39af73c0d7d0b97e57b3a905040d4cefc9708.zip FreeBSD-src-27c39af73c0d7d0b97e57b3a905040d4cefc9708.tar.gz |
Update clang to r98164.
Diffstat (limited to 'test/SemaCXX')
68 files changed, 299 insertions, 261 deletions
diff --git a/test/SemaCXX/access-base-class.cpp b/test/SemaCXX/access-base-class.cpp index d0b0fb8..eeb5f1c 100644 --- a/test/SemaCXX/access-base-class.cpp +++ b/test/SemaCXX/access-base-class.cpp @@ -5,7 +5,7 @@ class A { }; class B : private A { }; // expected-note {{declared private here}} void f(B* b) { - A *a = b; // expected-error{{cannot cast 'class T1::B' to its private base class 'class T1::A'}} + A *a = b; // expected-error{{cannot cast 'T1::B' to its private base class 'T1::A'}} } } @@ -16,7 +16,7 @@ class A { }; class B : A { }; // expected-note {{implicitly declared private here}} void f(B* b) { - A *a = b; // expected-error {{cannot cast 'class T2::B' to its private base class 'class T2::A'}} + A *a = b; // expected-error {{cannot cast 'T2::B' to its private base class 'T2::A'}} } } @@ -69,7 +69,7 @@ namespace T6 { class C : public B { void f(C *c) { - A* a = c; // expected-error {{cannot cast 'class T6::C' to its private base class 'class T6::A'}} + A* a = c; // expected-error {{cannot cast 'T6::C' to its private base class 'T6::A'}} } }; diff --git a/test/SemaCXX/access-control-check.cpp b/test/SemaCXX/access-control-check.cpp index 783d4de..1db6704 100644 --- a/test/SemaCXX/access-control-check.cpp +++ b/test/SemaCXX/access-control-check.cpp @@ -11,5 +11,5 @@ class P { class N : M,P { N() {} - int PR() { return iP + PPR(); } // expected-error 2 {{private member of 'class P'}} + int PR() { return iP + PPR(); } // expected-error 2 {{private member of 'P'}} }; diff --git a/test/SemaCXX/aggregate-initialization.cpp b/test/SemaCXX/aggregate-initialization.cpp index 83f4179..708a8f2 100644 --- a/test/SemaCXX/aggregate-initialization.cpp +++ b/test/SemaCXX/aggregate-initialization.cpp @@ -22,10 +22,10 @@ struct NonAggr4 { virtual void f(); }; -NonAggr1 na1 = { 17 }; // expected-error{{non-aggregate type 'struct NonAggr1' cannot be initialized with an initializer list}} -NonAggr2 na2 = { 17 }; // expected-error{{non-aggregate type 'struct NonAggr2' cannot be initialized with an initializer list}} -NonAggr3 na3 = { 17 }; // expected-error{{non-aggregate type 'class NonAggr3' cannot be initialized with an initializer list}} -NonAggr4 na4 = { 17 }; // expected-error{{non-aggregate type 'struct NonAggr4' cannot be initialized with an initializer list}} +NonAggr1 na1 = { 17 }; // expected-error{{non-aggregate type 'NonAggr1' cannot be initialized with an initializer list}} +NonAggr2 na2 = { 17 }; // expected-error{{non-aggregate type 'NonAggr2' cannot be initialized with an initializer list}} +NonAggr3 na3 = { 17 }; // expected-error{{non-aggregate type 'NonAggr3' cannot be initialized with an initializer list}} +NonAggr4 na4 = { 17 }; // expected-error{{non-aggregate type 'NonAggr4' cannot be initialized with an initializer list}} // PR5817 typedef int type[][2]; @@ -60,10 +60,10 @@ struct C { void f() { A as1[1] = { }; - A as2[1] = { 1 }; // expected-error {{copying array element of type 'struct A' invokes deleted copy constructor}} + A as2[1] = { 1 }; // expected-error {{copying array element of type 'A' invokes deleted copy constructor}} B b1 = { }; - B b2 = { 1 }; // expected-error {{copying member subobject of type 'struct A' invokes deleted copy constructor}} + B b2 = { 1 }; // expected-error {{copying member subobject of type 'A' invokes deleted copy constructor}} C c1 = { 1 }; } diff --git a/test/SemaCXX/ambig-user-defined-conversions.cpp b/test/SemaCXX/ambig-user-defined-conversions.cpp index 5e0a2e3..7f67674 100644 --- a/test/SemaCXX/ambig-user-defined-conversions.cpp +++ b/test/SemaCXX/ambig-user-defined-conversions.cpp @@ -19,7 +19,7 @@ namespace test0 { const int Test1() { func(b1, f()); // expected-error {{call to 'func' is ambiguous}} - return f(); // expected-error {{conversion from 'struct test0::B' to 'int const' is ambiguous}} + return f(); // expected-error {{conversion from 'test0::B' to 'int const' is ambiguous}} } // This used to crash when comparing the two operands. diff --git a/test/SemaCXX/arrow-operator.cpp b/test/SemaCXX/arrow-operator.cpp index fd1ec01..29b23ed 100644 --- a/test/SemaCXX/arrow-operator.cpp +++ b/test/SemaCXX/arrow-operator.cpp @@ -16,7 +16,7 @@ struct C : A, B { struct D : A { }; -struct E; // expected-note {{forward declaration of 'struct E'}} +struct E; // expected-note {{forward declaration of 'E'}} void f(C &c, D& d, E& e) { c->f(); // expected-error{{use of overloaded operator '->' is ambiguous}} diff --git a/test/SemaCXX/attr-cxx0x.cpp b/test/SemaCXX/attr-cxx0x.cpp index 9924d1b..8fbf50c 100644 --- a/test/SemaCXX/attr-cxx0x.cpp +++ b/test/SemaCXX/attr-cxx0x.cpp @@ -2,7 +2,7 @@ int final_fail [[final]]; //expected-error {{'final' attribute only applies to virtual method or class types}} -struct [[final]] final_base { }; // expected-note {{'struct final_base' declared here}} +struct [[final]] final_base { }; // expected-note {{'final_base' declared here}} struct final_child : final_base { }; // expected-error {{derivation from 'final' struct final_base}} struct final_member { virtual void quux [[final]] (); }; // expected-note {{overridden virtual function is here}} diff --git a/test/SemaCXX/builtin-ptrtomember-overload-1.cpp b/test/SemaCXX/builtin-ptrtomember-overload-1.cpp index b1b0b98..f736394 100644 --- a/test/SemaCXX/builtin-ptrtomember-overload-1.cpp +++ b/test/SemaCXX/builtin-ptrtomember-overload-1.cpp @@ -41,6 +41,6 @@ void foo1(C1 c1, int A::* pmf) { void foo1(C1 c1, int E::* pmf) { int i = c1->*pmf; // expected-error {{use of overloaded operator '->*' is ambiguous}} \ - // expected-note {{because of ambiguity in conversion of 'struct C1' to 'struct E *'}} \ + // expected-note {{because of ambiguity in conversion of 'C1' to 'E *'}} \ // expected-note 4 {{built-in candidate operator}} } diff --git a/test/SemaCXX/cast-conversion.cpp b/test/SemaCXX/cast-conversion.cpp index 074e133..d68e789 100644 --- a/test/SemaCXX/cast-conversion.cpp +++ b/test/SemaCXX/cast-conversion.cpp @@ -13,9 +13,9 @@ struct B { }; int main () { - B(10); // expected-error {{functional-style cast from 'int' to 'struct B' is not allowed}} - (B)10; // expected-error {{C-style cast from 'int' to 'struct B' is not allowed}} - static_cast<B>(10); // expected-error {{static_cast from 'int' to 'struct B' is not allowed}} \\ + B(10); // expected-error {{functional-style cast from 'int' to 'B' is not allowed}} + (B)10; // expected-error {{C-style cast from 'int' to 'B' is not allowed}} + static_cast<B>(10); // expected-error {{static_cast from 'int' to 'B' is not allowed}} \\ // expected-warning {{expression result unused}} } diff --git a/test/SemaCXX/class-base-member-init.cpp b/test/SemaCXX/class-base-member-init.cpp index 67bc43c..1c6e790 100644 --- a/test/SemaCXX/class-base-member-init.cpp +++ b/test/SemaCXX/class-base-member-init.cpp @@ -8,7 +8,7 @@ public: struct D : S { D() : b1(0), b2(1), b1(0), S(), S() {} // expected-error {{multiple initializations given for non-static member 'b1'}} \ // expected-note {{previous initialization is here}} \ - // expected-error {{multiple initializations given for base 'class S'}} \ + // expected-error {{multiple initializations given for base 'S'}} \ // expected-note {{previous initialization is here}} int b1; diff --git a/test/SemaCXX/conditional-expr.cpp b/test/SemaCXX/conditional-expr.cpp index b961ff2..4fcb0bb 100644 --- a/test/SemaCXX/conditional-expr.cpp +++ b/test/SemaCXX/conditional-expr.cpp @@ -85,7 +85,7 @@ void test() // these are ambiguous BadBase bb; BadDerived bd; - (void)(i1 ? bb : bd); // expected-error {{conditional expression is ambiguous; 'struct BadBase' can be converted to 'struct BadDerived' and vice versa}} + (void)(i1 ? bb : bd); // expected-error {{conditional expression is ambiguous; 'BadBase' can be converted to 'BadDerived' and vice versa}} (void)(i1 ? bd : bb); // expected-error {{conditional expression is ambiguous}} // curiously enough (and a defect?), these are not // for rvalues, hierarchy takes precedence over other conversions @@ -106,19 +106,19 @@ void test() i1 = (i1 ? Base() : Derived()).trick(); i1 = (i1 ? Derived() : Base()).trick(); // should fail: const lost - (void)(i1 ? Base() : constder()); // expected-error {{incompatible operand types ('struct Base' and 'struct Derived const')}} - (void)(i1 ? constder() : Base()); // expected-error {{incompatible operand types ('struct Derived const' and 'struct Base')}} + (void)(i1 ? Base() : constder()); // expected-error {{incompatible operand types ('Base' and 'Derived const')}} + (void)(i1 ? constder() : Base()); // expected-error {{incompatible operand types ('Derived const' and 'Base')}} Priv priv; Fin fin; (void)(i1 ? Base() : Priv()); // expected-error{{private base class}} (void)(i1 ? Priv() : Base()); // expected-error{{private base class}} - (void)(i1 ? Base() : Fin()); // expected-error{{ambiguous conversion from derived class 'struct Fin' to base class 'struct Base'}} - (void)(i1 ? Fin() : Base()); // expected-error{{ambiguous conversion from derived class 'struct Fin' to base class 'struct Base'}} + (void)(i1 ? Base() : Fin()); // expected-error{{ambiguous conversion from derived class 'Fin' to base class 'Base':}} + (void)(i1 ? Fin() : Base()); // expected-error{{ambiguous conversion from derived class 'Fin' to base class 'Base':}} (void)(i1 ? base : priv); // expected-error {{private base class}} (void)(i1 ? priv : base); // expected-error {{private base class}} - (void)(i1 ? base : fin); // expected-error {{ambiguous conversion from derived class 'struct Fin' to base class 'struct Base'}} - (void)(i1 ? fin : base); // expected-error {{ambiguous conversion from derived class 'struct Fin' to base class 'struct Base'}} + (void)(i1 ? base : fin); // expected-error {{ambiguous conversion from derived class 'Fin' to base class 'Base':}} + (void)(i1 ? fin : base); // expected-error {{ambiguous conversion from derived class 'Fin' to base class 'Base':}} // b2.2 (non-hierarchy) i1 = i1 ? I() : i1; @@ -128,10 +128,10 @@ void test() // "the type [it] woud have if E2 were converted to an rvalue" vfn pfn = i1 ? F() : test; pfn = i1 ? test : F(); - (void)(i1 ? A() : B()); // expected-error {{conversion from 'struct B' to 'struct A' is ambiguous}} - (void)(i1 ? B() : A()); // expected-error {{conversion from 'struct B' to 'struct A' is ambiguous}} - (void)(i1 ? 1 : Ambig()); // expected-error {{conversion from 'struct Ambig' to 'int' is ambiguous}} - (void)(i1 ? Ambig() : 1); // expected-error {{conversion from 'struct Ambig' to 'int' is ambiguous}} + (void)(i1 ? A() : B()); // expected-error {{conversion from 'B' to 'A' is ambiguous}} + (void)(i1 ? B() : A()); // expected-error {{conversion from 'B' to 'A' is ambiguous}} + (void)(i1 ? 1 : Ambig()); // expected-error {{conversion from 'Ambig' to 'int' is ambiguous}} + (void)(i1 ? Ambig() : 1); // expected-error {{conversion from 'Ambig' to 'int' is ambiguous}} // By the way, this isn't an lvalue: &(i1 ? i1 : i2); // expected-error {{address expression must be an lvalue or a function designator}} diff --git a/test/SemaCXX/const-cast.cpp b/test/SemaCXX/const-cast.cpp index 220e6fa..50bd316 100644 --- a/test/SemaCXX/const-cast.cpp +++ b/test/SemaCXX/const-cast.cpp @@ -59,6 +59,6 @@ short *bad_const_cast_test(char const *volatile *const volatile *var) // Function pointers. f fp2 = const_cast<f>(fp1); // expected-error {{const_cast to 'f' (aka 'int (*)(int)'), which is not a reference, pointer-to-object, or pointer-to-data-member}} void (A::*mfn)() = 0; - (void)const_cast<void (A::*)()>(mfn); // expected-error {{const_cast to 'void (struct A::*)()', which is not a reference, pointer-to-object, or pointer-to-data-member}} + (void)const_cast<void (A::*)()>(mfn); // expected-error {{const_cast to 'void (A::*)()', which is not a reference, pointer-to-object, or pointer-to-data-member}} return **var3; } diff --git a/test/SemaCXX/constructor-initializer.cpp b/test/SemaCXX/constructor-initializer.cpp index 2efb7b9..96dfa8b 100644 --- a/test/SemaCXX/constructor-initializer.cpp +++ b/test/SemaCXX/constructor-initializer.cpp @@ -27,7 +27,7 @@ public: class E : public D, public B { public: - E() : B(), D() { } // expected-error{{base class initializer 'class B' names both a direct base class and an inherited virtual base class}} + E() : B(), D() { } // expected-error{{base class initializer 'B' names both a direct base class and an inherited virtual base class}} }; @@ -65,7 +65,7 @@ struct S : Y, virtual X { }; struct Z : S { - Z() : X(), S(), E() {} // expected-error {{type 'class E' is not a direct or virtual base of 'Z'}} + Z() : X(), S(), E() {} // expected-error {{type 'E' is not a direct or virtual base of 'Z'}} }; class U { @@ -104,13 +104,13 @@ struct M { // expected-note 2 {{candidate constructor (the implicit }; struct N : M { - N() : M(1), // expected-error {{no matching constructor for initialization of 'struct M'}} - m1(100) { } // expected-error {{no matching constructor for initialization of 'struct M'}} + N() : M(1), // expected-error {{no matching constructor for initialization of 'M'}} + m1(100) { } // expected-error {{no matching constructor for initialization of 'M'}} M m1; }; struct P : M { - P() { } // expected-error {{base class 'struct M'}} \ + P() { } // expected-error {{constructor for 'P' must explicitly initialize the base class 'M' which does not have a default constructor}} \ // expected-error {{member 'm'}} M m; // expected-note {{member is declared here}} }; diff --git a/test/SemaCXX/conversion-delete-expr.cpp b/test/SemaCXX/conversion-delete-expr.cpp index 2338778..862ae5a 100644 --- a/test/SemaCXX/conversion-delete-expr.cpp +++ b/test/SemaCXX/conversion-delete-expr.cpp @@ -11,7 +11,7 @@ struct D : B { void f (D d) { - delete d; // expected-error {{ambiguous conversion of delete expression of type 'struct D' to a pointer}} + delete d; // expected-error {{ambiguous conversion of delete expression of type 'D' to a pointer}} } // Test2 @@ -39,7 +39,7 @@ struct D2 : B2 { void f2 (D2 d) { - delete d; // expected-error {{ambiguous conversion of delete expression of type 'struct D2' to a pointer}} + delete d; // expected-error {{ambiguous conversion of delete expression of type 'D2' to a pointer}} } // Test4 @@ -56,7 +56,7 @@ struct D3 : A3, B3 { void f3 (D3 d) { - delete d; // expected-error {{mbiguous conversion of delete expression of type 'struct D3' to a pointer}} + delete d; // expected-error {{ambiguous conversion of delete expression of type 'D3' to a pointer}} } // Test5 diff --git a/test/SemaCXX/conversion-function.cpp b/test/SemaCXX/conversion-function.cpp index 4fef172..bca75c0 100644 --- a/test/SemaCXX/conversion-function.cpp +++ b/test/SemaCXX/conversion-function.cpp @@ -49,9 +49,9 @@ class A { }; class B : public A { public: - operator A&() const; // expected-warning{{conversion function converting 'class B' to its base class 'class A' will never be used}} - operator const void() const; // expected-warning{{conversion function converting 'class B' to 'void const' will never be used}} - operator const B(); // expected-warning{{conversion function converting 'class B' to itself will never be used}} + operator A&() const; // expected-warning{{conversion function converting 'B' to its base class 'A' will never be used}} + operator const void() const; // expected-warning{{conversion function converting 'B' to 'void const' will never be used}} + operator const B(); // expected-warning{{conversion function converting 'B' to itself will never be used}} }; // This used to crash Clang. @@ -63,7 +63,7 @@ struct Flop { // expected-note{{candidate is the implicit copy constructor}} struct Flip { operator Flop() const; // expected-note{{candidate function}} }; -Flop flop = Flip(); // expected-error {{conversion from 'struct Flip' to 'struct Flop' is ambiguous}} +Flop flop = Flip(); // expected-error {{conversion from 'Flip' to 'Flop' is ambiguous}} // This tests that we don't add the second conversion declaration to the list of user conversions struct C { @@ -88,7 +88,7 @@ public: }; void f(Yb& a) { - if (a) { } // expected-error {{conversion from 'class Yb' to 'bool' is ambiguous}} + if (a) { } // expected-error {{conversion from 'Yb' to 'bool' is ambiguous}} int i = a; // OK. calls XB::operator int(); char ch = a; // OK. calls Yb::operator char(); } diff --git a/test/SemaCXX/convert-to-bool.cpp b/test/SemaCXX/convert-to-bool.cpp index 4b5002e..4cd22e9 100644 --- a/test/SemaCXX/convert-to-bool.cpp +++ b/test/SemaCXX/convert-to-bool.cpp @@ -44,12 +44,12 @@ struct ExplicitConvToRef { void test_explicit_bool(ExplicitConvToBool ecb) { bool b1(ecb); // okay - bool b2 = ecb; // expected-error{{no viable conversion from 'struct ExplicitConvToBool' to 'bool'}} + bool b2 = ecb; // expected-error{{no viable conversion from 'ExplicitConvToBool' to 'bool'}} accepts_bool(ecb); // expected-error{{no matching function for call to}} } void test_explicit_conv_to_ref(ExplicitConvToRef ecr) { - int& i1 = ecr; // expected-error{{non-const lvalue reference to type 'int' cannot bind to a value of unrelated type 'struct ExplicitConvToRef'}} + int& i1 = ecr; // expected-error{{non-const lvalue reference to type 'int' cannot bind to a value of unrelated type 'ExplicitConvToRef'}} int& i2(ecr); // okay } @@ -61,7 +61,7 @@ struct C { }; void test_copy_init_conversions(C c) { - A &a = c; // expected-error{{no viable conversion from 'struct C' to 'struct A'}} + A &a = c; // expected-error{{no viable conversion from 'C' to 'A'}} B &b = b; // okay } diff --git a/test/SemaCXX/copy-assignment.cpp b/test/SemaCXX/copy-assignment.cpp index d7eb5cf..8cdb1be 100644 --- a/test/SemaCXX/copy-assignment.cpp +++ b/test/SemaCXX/copy-assignment.cpp @@ -94,6 +94,6 @@ void test() { int i; i = convertibleToInt; - i = a; // expected-error{{incompatible type assigning 'struct A', expected 'int'}} + i = a; // expected-error{{incompatible type assigning 'A', expected 'int'}} } diff --git a/test/SemaCXX/copy-initialization.cpp b/test/SemaCXX/copy-initialization.cpp index 2cf878a..3a63be0 100644 --- a/test/SemaCXX/copy-initialization.cpp +++ b/test/SemaCXX/copy-initialization.cpp @@ -9,7 +9,7 @@ public: class Y : public X { }; void f(Y y, int *ip, float *fp) { - X x1 = y; // expected-error{{no matching constructor for initialization of 'class X'}} + X x1 = y; // expected-error{{no matching constructor for initialization of 'X'}} X x2 = 0; X x3 = ip; X x4 = fp; // expected-error{{no viable conversion}} @@ -20,4 +20,4 @@ struct foo { }; // PR3600 -void test(const foo *P) { P->bar(); } // expected-error{{cannot initialize object parameter of type 'struct foo' with an expression of type 'struct foo const'}} +void test(const foo *P) { P->bar(); } // expected-error{{cannot initialize object parameter of type 'foo' with an expression of type 'foo const'}} diff --git a/test/SemaCXX/cstyle-cast.cpp b/test/SemaCXX/cstyle-cast.cpp index dbb1e4a..6a28f4c 100644 --- a/test/SemaCXX/cstyle-cast.cpp +++ b/test/SemaCXX/cstyle-cast.cpp @@ -122,12 +122,12 @@ void t_529_5_8() // Bad code below - (void)(C1*)((A*)0); // expected-error {{cannot cast 'struct A *' to 'struct C1 *' via virtual base 'struct B'}} - (void)(C1&)(*((A*)0)); // expected-error {{cannot cast 'struct A' to 'struct C1 &' via virtual base 'struct B'}} - (void)(D*)((A*)0); // expected-error {{cannot cast 'struct A *' to 'struct D *' via virtual base 'struct B'}} - (void)(D&)(*((A*)0)); // expected-error {{cannot cast 'struct A' to 'struct D &' via virtual base 'struct B'}} - (void)(H*)((A*)0); // expected-error {{ambiguous cast from base 'struct A' to derived 'struct H':\n struct A -> struct B -> struct G1 -> struct H\n struct A -> struct B -> struct G2 -> struct H}} - (void)(H&)(*((A*)0)); // expected-error {{ambiguous cast from base 'struct A' to derived 'struct H':\n struct A -> struct B -> struct G1 -> struct H\n struct A -> struct B -> struct G2 -> struct H}} + (void)(C1*)((A*)0); // expected-error {{cannot cast 'A *' to 'C1 *' via virtual base 'B'}} + (void)(C1&)(*((A*)0)); // expected-error {{cannot cast 'A' to 'C1 &' via virtual base 'B'}} + (void)(D*)((A*)0); // expected-error {{cannot cast 'A *' to 'D *' via virtual base 'B'}} + (void)(D&)(*((A*)0)); // expected-error {{cannot cast 'A' to 'D &' via virtual base 'B'}} + (void)(H*)((A*)0); // expected-error {{ambiguous cast from base 'A' to derived 'H':\n struct A -> struct B -> struct G1 -> struct H\n struct A -> struct B -> struct G2 -> struct H}} + (void)(H&)(*((A*)0)); // expected-error {{ambiguous cast from base 'A' to derived 'H':\n struct A -> struct B -> struct G1 -> struct H\n struct A -> struct B -> struct G2 -> struct H}} // TODO: Test DR427. This requires user-defined conversions, though. } @@ -141,7 +141,7 @@ void t_529_7() // Bad code below - (void)(Enum)((int*)0); // expected-error {{C-style cast from 'int *' to 'enum Enum' is not allowed}} + (void)(Enum)((int*)0); // expected-error {{C-style cast from 'int *' to 'Enum' is not allowed}} } // Void pointer to object pointer @@ -158,8 +158,8 @@ void t_529_9() (void)(int A::*)((int B::*)0); // Bad code below - (void)(int A::*)((int H::*)0); // expected-error {{ambiguous conversion from pointer to member of derived class 'struct H'}} - (void)(int A::*)((int F::*)0); // expected-error {{conversion from pointer to member of class 'struct F'}} + (void)(int A::*)((int H::*)0); // expected-error {{ambiguous conversion from pointer to member of derived class 'H' to pointer to member of base class 'A':}} + (void)(int A::*)((int F::*)0); // expected-error {{conversion from pointer to member of class 'F' to pointer to member of class 'A' via virtual base 'B' is not allowed}} } // -------- reinterpret_cast ----------- @@ -226,6 +226,6 @@ void memptrs() void (structure::*psf)() = 0; (void)(int (structure::*)())(psf); - (void)(void (structure::*)())(psi); // expected-error {{C-style cast from 'int const struct structure::*' to 'void (struct structure::*)()' is not allowed}} - (void)(int structure::*)(psf); // expected-error {{C-style cast from 'void (struct structure::*)()' to 'int struct structure::*' is not allowed}} + (void)(void (structure::*)())(psi); // expected-error {{C-style cast from 'int const structure::*' to 'void (structure::*)()' is not allowed}} + (void)(int structure::*)(psf); // expected-error {{C-style cast from 'void (structure::*)()' to 'int structure::*' is not allowed}} } diff --git a/test/SemaCXX/dcl_init_aggr.cpp b/test/SemaCXX/dcl_init_aggr.cpp index 461c60b..8b28663 100644 --- a/test/SemaCXX/dcl_init_aggr.cpp +++ b/test/SemaCXX/dcl_init_aggr.cpp @@ -13,9 +13,9 @@ struct NonAggregate { int a, b; }; -NonAggregate non_aggregate_test = { 1, 2 }; // expected-error{{non-aggregate type 'struct NonAggregate' cannot be initialized with an initializer list}} +NonAggregate non_aggregate_test = { 1, 2 }; // expected-error{{non-aggregate type 'NonAggregate' cannot be initialized with an initializer list}} -NonAggregate non_aggregate_test2[2] = { { 1, 2 }, { 3, 4 } }; // expected-error 2 {{initialization of non-aggregate type 'struct NonAggregate' with an initializer list}} +NonAggregate non_aggregate_test2[2] = { { 1, 2 }, { 3, 4 } }; // expected-error 2 {{initialization of non-aggregate type 'NonAggregate' with an initializer list}} // C++ [dcl.init.aggr]p3 @@ -51,7 +51,7 @@ struct TooFewError { // expected-error{{implicit default constructor for}} TooFewError too_few_okay = { 1, 1 }; TooFewError too_few_error = { 1 }; // expected-error{{no matching constructor}} -TooFewError too_few_okay2[2] = { 1, 1 }; // expected-note{{implicit default constructor for 'struct TooFewError' first required here}} +TooFewError too_few_okay2[2] = { 1, 1 }; // expected-note{{implicit default constructor for 'TooFewError' first required here}} TooFewError too_few_error2[2] = { 1 }; // expected-error{{no matching constructor}} NoDefaultConstructor too_few_error3[3] = { }; // expected-error {{no matching constructor}} diff --git a/test/SemaCXX/decl-init-ref.cpp b/test/SemaCXX/decl-init-ref.cpp index 2f7d8a4..7ae0439 100644 --- a/test/SemaCXX/decl-init-ref.cpp +++ b/test/SemaCXX/decl-init-ref.cpp @@ -21,9 +21,9 @@ extern B f(); const int& ri = (void)0; // expected-error {{reference to type 'int const' could not bind to an rvalue of type 'void'}} int main() { - const A& rca = f(); // expected-error {{reference initialization of type 'struct A const &' with initializer of type 'class B' is ambiguous}} - A& ra = f(); // expected-error {{non-const lvalue reference to type 'struct A' cannot bind to a temporary of type 'class B'}} + const A& rca = f(); // expected-error {{reference initialization of type 'A const &' with initializer of type 'B' is ambiguous}} + A& ra = f(); // expected-error {{non-const lvalue reference to type 'A' cannot bind to a temporary of type 'B'}} } struct PR6139 { A (&x)[1]; }; -PR6139 x = {{A()}}; // expected-error{{non-const lvalue reference to type 'struct A [1]' cannot bind to a temporary of type 'struct A'}} +PR6139 x = {{A()}}; // expected-error{{non-const lvalue reference to type 'A [1]' cannot bind to a temporary of type 'A'}} diff --git a/test/SemaCXX/decltype-overloaded-functions.cpp b/test/SemaCXX/decltype-overloaded-functions.cpp index 906e868..0aa49b0 100644 --- a/test/SemaCXX/decltype-overloaded-functions.cpp +++ b/test/SemaCXX/decltype-overloaded-functions.cpp @@ -9,4 +9,4 @@ template<typename T> struct S { }; struct K { void f(); void f(int); }; -S<K> b; // expected-note{{in instantiation of template class 'struct S<struct K>' requested here}} +S<K> b; // expected-note{{in instantiation of template class 'S<K>' requested here}} diff --git a/test/SemaCXX/default-assignment-operator.cpp b/test/SemaCXX/default-assignment-operator.cpp index 9c99ad5..baae03c 100644 --- a/test/SemaCXX/default-assignment-operator.cpp +++ b/test/SemaCXX/default-assignment-operator.cpp @@ -1,10 +1,10 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -class Base { // expected-error {{cannot define the implicit default assignment operator for 'class Base'}} +class Base { // expected-error {{cannot define the implicit default assignment operator for 'Base', because non-static reference member 'ref' can't use default assignment operator}} int &ref; // expected-note {{declared at}} }; -class X : Base { // // expected-error {{cannot define the implicit default assignment operator for 'class X'}} +class X : Base { // // expected-error {{cannot define the implicit default assignment operator for 'X', because non-static const member 'cint' can't use default assignment operator}} public: X(); const int cint; // expected-note {{declared at}} @@ -70,7 +70,7 @@ void i() { // Test5 -class E1 { // expected-error{{cannot define the implicit default assignment operator for 'class E1', because non-static const member 'a' can't use default assignment operator}} +class E1 { // expected-error{{cannot define the implicit default assignment operator for 'E1', because non-static const member 'a' can't use default assignment operator}} public: const int a; // expected-note{{declared at}} E1() : a(0) {} diff --git a/test/SemaCXX/default-constructor-initializers.cpp b/test/SemaCXX/default-constructor-initializers.cpp index 4269991..b40b133 100644 --- a/test/SemaCXX/default-constructor-initializers.cpp +++ b/test/SemaCXX/default-constructor-initializers.cpp @@ -4,12 +4,11 @@ struct X1 { // has no implicit default constructor X1(int); }; -struct X2 : X1 { // expected-note {{'struct X2' declared here}} \ - // expected-note {{'struct X2' declared here}} +struct X2 : X1 { // expected-note 2 {{'X2' declared here}} X2(int); }; -struct X3 : public X2 { // expected-error {{must explicitly initialize the base class 'struct X2'}} +struct X3 : public X2 { // expected-error {{implicit default constructor for 'X3' must explicitly initialize the base class 'X2' which does not have a default constructor}} }; X3 x3; // expected-note {{first required here}} diff --git a/test/SemaCXX/default2.cpp b/test/SemaCXX/default2.cpp index e674260..a0999c0 100644 --- a/test/SemaCXX/default2.cpp +++ b/test/SemaCXX/default2.cpp @@ -91,12 +91,12 @@ public: } void test_Z(const Z& z) { - Z z2(z); // expected-error{{no matching constructor for initialization of 'class Z'}} + Z z2(z); // expected-error{{no matching constructor for initialization of 'Z'}} } }; void test_Z(const Z& z) { - Z z2(z); // expected-error{{no matching constructor for initialization of 'class Z'}} + Z z2(z); // expected-error{{no matching constructor for initialization of 'Z'}} } struct ZZ { diff --git a/test/SemaCXX/deleted-function.cpp b/test/SemaCXX/deleted-function.cpp index d9df1bf..b3e1296 100644 --- a/test/SemaCXX/deleted-function.cpp +++ b/test/SemaCXX/deleted-function.cpp @@ -29,7 +29,7 @@ void test() { ov(1); ov(1.0); // expected-error {{call to deleted function 'ov'}} - WithDel dd; // expected-error {{call to deleted constructor of 'struct WithDel'}} + WithDel dd; // expected-error {{call to deleted constructor of 'WithDel'}} WithDel *d = 0; d->fn(); // expected-error {{attempt to use a deleted function}} int i = *d; // expected-error {{invokes a deleted function}} diff --git a/test/SemaCXX/derived-to-base-ambig.cpp b/test/SemaCXX/derived-to-base-ambig.cpp index cfcad79..9216e5b 100644 --- a/test/SemaCXX/derived-to-base-ambig.cpp +++ b/test/SemaCXX/derived-to-base-ambig.cpp @@ -6,7 +6,7 @@ class D : public B, public C { }; void f(D* d) { A* a; - a = d; // expected-error{{ambiguous conversion from derived class 'class D' to base class 'class A'}} expected-error{{incompatible type assigning 'class D *', expected 'class A *'}} + a = d; // expected-error{{ambiguous conversion from derived class 'D' to base class 'A':}} expected-error{{incompatible type assigning 'D *', expected 'A *'}} } class Object2 { }; @@ -20,7 +20,7 @@ class F2 : public E2, public A2 { }; void g(E2* e2, F2* f2) { Object2* o2; o2 = e2; - o2 = f2; // expected-error{{ambiguous conversion from derived class 'class F2' to base class 'class Object2'}} expected-error{{incompatible type assigning 'class F2 *', expected 'class Object2 *'}} + o2 = f2; // expected-error{{ambiguous conversion from derived class 'F2' to base class 'Object2':}} expected-error{{incompatible type assigning 'F2 *', expected 'Object2 *'}} } // Test that ambiguous/inaccessibility checking does not trigger too diff --git a/test/SemaCXX/destructor.cpp b/test/SemaCXX/destructor.cpp index ab3c809..7010d2e 100644 --- a/test/SemaCXX/destructor.cpp +++ b/test/SemaCXX/destructor.cpp @@ -32,7 +32,7 @@ struct E; typedef E E_typedef; struct E { - ~E_typedef(); // expected-error{{destructor cannot be declared using a typedef 'E_typedef' (aka 'struct E') of the class name}} + ~E_typedef(); // expected-error{{destructor cannot be declared using a typedef 'E_typedef' (aka 'E') of the class name}} }; struct F { diff --git a/test/SemaCXX/direct-initializer.cpp b/test/SemaCXX/direct-initializer.cpp index 6601a3d..d30642b 100644 --- a/test/SemaCXX/direct-initializer.cpp +++ b/test/SemaCXX/direct-initializer.cpp @@ -28,11 +28,11 @@ public: void g() { X x1(5); X x2(1.0, 3, 4.2); - X x3(1.0, 1.0); // expected-error{{no matching constructor for initialization of 'class X'}} + X x3(1.0, 1.0); // expected-error{{no matching constructor for initialization of 'X'}} Y y(1.0); X x4(3.14, y); - Z z; // expected-error{{no matching constructor for initialization of 'class Z'}} + Z z; // expected-error{{no matching constructor for initialization of 'Z'}} } struct Base { @@ -44,7 +44,7 @@ struct Derived : Base { }; void foo(const Derived cd, Derived d) { - int *pi = cd; // expected-error {{no viable conversion from 'struct Derived const' to 'int *'}} + int *pi = cd; // expected-error {{no viable conversion from 'Derived const' to 'int *'}} int *ppi = d; } diff --git a/test/SemaCXX/dynamic-cast.cpp b/test/SemaCXX/dynamic-cast.cpp index 53d0b9d..b73e8c5 100644 --- a/test/SemaCXX/dynamic-cast.cpp +++ b/test/SemaCXX/dynamic-cast.cpp @@ -8,7 +8,7 @@ struct D : private A {}; struct E : A {}; struct F : B, E {}; -struct Incomplete; // expected-note 2 {{forward declaration of 'struct Incomplete'}} +struct Incomplete; // expected-note 2 {{forward declaration of 'Incomplete'}} struct Poly { @@ -22,7 +22,7 @@ struct PolyDerived : Poly void basic_bad() { // ptr -> nonptr - (void)dynamic_cast<A>((A*)0); // expected-error {{'struct A' is not a reference or pointer}} + (void)dynamic_cast<A>((A*)0); // expected-error {{'A' is not a reference or pointer}} // nonptr -> ptr (void)dynamic_cast<A*>(0); // expected-error {{'int' is not a pointer}} // ptr -> noncls @@ -34,9 +34,9 @@ void basic_bad() // noncls -> ref (void)dynamic_cast<A&>(*((int*)0)); // expected-error {{'int' is not a class}} // ptr -> incomplete - (void)dynamic_cast<Incomplete*>((A*)0); // expected-error {{'struct Incomplete' is an incomplete type}} + (void)dynamic_cast<Incomplete*>((A*)0); // expected-error {{'Incomplete' is an incomplete type}} // incomplete -> ptr - (void)dynamic_cast<A*>((Incomplete*)0); // expected-error {{'struct Incomplete' is an incomplete type}} + (void)dynamic_cast<A*>((Incomplete*)0); // expected-error {{'Incomplete' is an incomplete type}} } void same() @@ -57,8 +57,8 @@ void up() //(void)dynamic_cast<A&>(*((D*)0)); // Ambiguous - (void)dynamic_cast<A*>((F*)0); // expected-error {{ambiguous conversion from derived class 'struct F' to base class 'struct A':\n struct F -> struct B -> struct A\n struct F -> struct E -> struct A}} - (void)dynamic_cast<A&>(*((F*)0)); // expected-error {{ambiguous conversion from derived class 'struct F' to base class 'struct A':\n struct F -> struct B -> struct A\n struct F -> struct E -> struct A}} + (void)dynamic_cast<A*>((F*)0); // expected-error {{ambiguous conversion from derived class 'F' to base class 'A':\n struct F -> struct B -> struct A\n struct F -> struct E -> struct A}} + (void)dynamic_cast<A&>(*((F*)0)); // expected-error {{ambiguous conversion from derived class 'F' to base class 'A':\n struct F -> struct B -> struct A\n struct F -> struct E -> struct A}} } void poly() @@ -69,6 +69,6 @@ void poly() (void)dynamic_cast<A&>(*((PolyDerived*)0)); // Not polymorphic source - (void)dynamic_cast<Poly*>((A*)0); // expected-error {{'struct A' is not polymorphic}} - (void)dynamic_cast<PolyDerived&>(*((A*)0)); // expected-error {{'struct A' is not polymorphic}} + (void)dynamic_cast<Poly*>((A*)0); // expected-error {{'A' is not polymorphic}} + (void)dynamic_cast<PolyDerived&>(*((A*)0)); // expected-error {{'A' is not polymorphic}} } diff --git a/test/SemaCXX/elaborated-type-specifier.cpp b/test/SemaCXX/elaborated-type-specifier.cpp index 8d2d67f..3cd3a1b 100644 --- a/test/SemaCXX/elaborated-type-specifier.cpp +++ b/test/SemaCXX/elaborated-type-specifier.cpp @@ -27,7 +27,7 @@ namespace NS { void test_X_elab(NS::X x) { struct S4 *s4 = 0; - x.test_elab2(s4); // expected-error{{cannot initialize a parameter of type 'struct NS::S4 *' with an lvalue of type 'struct S4 *'}} + x.test_elab2(s4); // expected-error{{cannot initialize a parameter of type 'NS::S4 *' with an lvalue of type 'struct S4 *'}} } namespace NS { diff --git a/test/SemaCXX/exception-spec.cpp b/test/SemaCXX/exception-spec.cpp index 291b359..782cf83 100644 --- a/test/SemaCXX/exception-spec.cpp +++ b/test/SemaCXX/exception-spec.cpp @@ -29,10 +29,10 @@ struct Incomplete; // expected-note 3 {{forward declaration}} // Exception spec must not have incomplete types, or pointers to them, except // void. void ic1() throw(void); // expected-error {{incomplete type 'void' is not allowed in exception specification}} -void ic2() throw(Incomplete); // expected-error {{incomplete type 'struct Incomplete' is not allowed in exception specification}} +void ic2() throw(Incomplete); // expected-error {{incomplete type 'Incomplete' is not allowed in exception specification}} void ic3() throw(void*); -void ic4() throw(Incomplete*); // expected-error {{pointer to incomplete type 'struct Incomplete' is not allowed in exception specification}} -void ic5() throw(Incomplete&); // expected-error {{reference to incomplete type 'struct Incomplete' is not allowed in exception specification}} +void ic4() throw(Incomplete*); // expected-error {{pointer to incomplete type 'Incomplete' is not allowed in exception specification}} +void ic5() throw(Incomplete&); // expected-error {{reference to incomplete type 'Incomplete' is not allowed in exception specification}} // Redeclarations typedef int INT; diff --git a/test/SemaCXX/exceptions.cpp b/test/SemaCXX/exceptions.cpp index 924b48a..2ed4bfe 100644 --- a/test/SemaCXX/exceptions.cpp +++ b/test/SemaCXX/exceptions.cpp @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -struct A; // expected-note 4 {{forward declaration of 'struct A'}} +struct A; // expected-note 4 {{forward declaration of 'A'}} struct Abstract { virtual void f() = 0; }; // expected-note {{pure virtual function 'f'}} @@ -11,9 +11,9 @@ void trys() { int i; // expected-error {{redefinition of 'i'}} } catch(float i) { } catch(void v) { // expected-error {{cannot catch incomplete type 'void'}} - } catch(A a) { // expected-error {{cannot catch incomplete type 'struct A'}} - } catch(A *a) { // expected-error {{cannot catch pointer to incomplete type 'struct A'}} - } catch(A &a) { // expected-error {{cannot catch reference to incomplete type 'struct A'}} + } catch(A a) { // expected-error {{cannot catch incomplete type 'A'}} + } catch(A *a) { // expected-warning {{ISO C++ forbids catching a pointer to incomplete type 'A'}} + } catch(A &a) { // expected-warning {{ISO C++ forbids catching a reference to incomplete type 'A'}} } catch(Abstract) { // expected-error {{variable type 'Abstract' is an abstract class}} } catch(...) { int j = i; // expected-error {{use of undeclared identifier 'i'}} @@ -29,7 +29,7 @@ void throws() { throw; throw 0; throw throw; // expected-error {{cannot throw object of incomplete type 'void'}} - throw (A*)0; // expected-error {{cannot throw pointer to object of incomplete type 'struct A'}} + throw (A*)0; // expected-error {{cannot throw pointer to object of incomplete type 'A'}} } void jumps() { diff --git a/test/SemaCXX/functional-cast.cpp b/test/SemaCXX/functional-cast.cpp index 0bef0cd..4e0486c 100644 --- a/test/SemaCXX/functional-cast.cpp +++ b/test/SemaCXX/functional-cast.cpp @@ -175,17 +175,17 @@ void t_529_5_8() // Bad code below typedef C1 *C1p; - (void)C1p((A*)0); // expected-error {{cannot cast 'struct A *' to 'C1p' (aka 'struct C1 *') via virtual base 'struct B'}} + (void)C1p((A*)0); // expected-error {{cannot cast 'A *' to 'C1p' (aka 'C1 *') via virtual base 'B'}} typedef C1 &C1r; - (void)C1r(*((A*)0)); // expected-error {{cannot cast 'struct A' to 'C1r' (aka 'struct C1 &') via virtual base 'struct B'}} + (void)C1r(*((A*)0)); // expected-error {{cannot cast 'A' to 'C1r' (aka 'C1 &') via virtual base 'B'}} typedef D *Dp; - (void)Dp((A*)0); // expected-error {{cannot cast 'struct A *' to 'Dp' (aka 'struct D *') via virtual base 'struct B'}} + (void)Dp((A*)0); // expected-error {{cannot cast 'A *' to 'Dp' (aka 'D *') via virtual base 'B'}} typedef D &Dr; - (void)Dr(*((A*)0)); // expected-error {{cannot cast 'struct A' to 'Dr' (aka 'struct D &') via virtual base 'struct B'}} + (void)Dr(*((A*)0)); // expected-error {{cannot cast 'A' to 'Dr' (aka 'D &') via virtual base 'B'}} typedef H *Hp; - (void)Hp((A*)0); // expected-error {{ambiguous cast from base 'struct A' to derived 'struct H':\n struct A -> struct B -> struct G1 -> struct H\n struct A -> struct B -> struct G2 -> struct H}} + (void)Hp((A*)0); // expected-error {{ambiguous cast from base 'A' to derived 'H':\n struct A -> struct B -> struct G1 -> struct H\n struct A -> struct B -> struct G2 -> struct H}} typedef H &Hr; - (void)Hr(*((A*)0)); // expected-error {{ambiguous cast from base 'struct A' to derived 'struct H':\n struct A -> struct B -> struct G1 -> struct H\n struct A -> struct B -> struct G2 -> struct H}} + (void)Hr(*((A*)0)); // expected-error {{ambiguous cast from base 'A' to derived 'H':\n struct A -> struct B -> struct G1 -> struct H\n struct A -> struct B -> struct G2 -> struct H}} // TODO: Test DR427. This requires user-defined conversions, though. } @@ -199,7 +199,7 @@ void t_529_7() // Bad code below - (void)Enum((int*)0); // expected-error {{functional-style cast from 'int *' to 'enum Enum' is not allowed}} + (void)Enum((int*)0); // expected-error {{functional-style cast from 'int *' to 'Enum' is not allowed}} } // Void pointer to object pointer @@ -219,8 +219,8 @@ void t_529_9() (void)Amp((int B::*)0); // Bad code below - (void)Amp((int H::*)0); // expected-error {{ambiguous conversion from pointer to member of derived class 'struct H'}} - (void)Amp((int F::*)0); // expected-error {{conversion from pointer to member of class 'struct F'}} + (void)Amp((int H::*)0); // expected-error {{ambiguous conversion from pointer to member of derived class 'H' to pointer to member of base class 'A':}} + (void)Amp((int F::*)0); // expected-error {{conversion from pointer to member of class 'F' to pointer to member of class 'A' via virtual base 'B' is not allowed}} } // -------- reinterpret_cast ----------- @@ -304,8 +304,8 @@ void memptrs() (void)structureimfp(psf); typedef void (structure::*structurevmfp)(); - (void)structurevmfp(psi); // expected-error {{functional-style cast from 'int const struct structure::*' to 'structurevmfp' (aka 'void (struct structure::*)()') is not allowed}} - (void)structureimp(psf); // expected-error {{functional-style cast from 'void (struct structure::*)()' to 'structureimp' (aka 'int struct structure::*') is not allowed}} + (void)structurevmfp(psi); // expected-error {{functional-style cast from 'int const structure::*' to 'structurevmfp' (aka 'void (structure::*)()') is not allowed}} + (void)structureimp(psf); // expected-error {{functional-style cast from 'void (structure::*)()' to 'structureimp' (aka 'int structure::*') is not allowed}} } // ---------------- misc ------------------ diff --git a/test/SemaCXX/illegal-member-initialization.cpp b/test/SemaCXX/illegal-member-initialization.cpp index be5f91d..3fb0b93 100644 --- a/test/SemaCXX/illegal-member-initialization.cpp +++ b/test/SemaCXX/illegal-member-initialization.cpp @@ -10,10 +10,10 @@ struct B { }; struct X { - X() { } // expected-error {{constructor for 'struct X' must explicitly initialize the reference member 'value'}} \ - // expected-error {{constructor for 'struct X' must explicitly initialize the const member 'cvalue'}} \ - // expected-error {{constructor for 'struct X' must explicitly initialize the reference member 'b'}} \ - // expected-error {{constructor for 'struct X' must explicitly initialize the const member 'cb'}} + X() { } // expected-error {{constructor for 'X' must explicitly initialize the reference member 'value'}} \ + // expected-error {{constructor for 'X' must explicitly initialize the const member 'cvalue'}} \ + // expected-error {{constructor for 'X' must explicitly initialize the reference member 'b'}} \ + // expected-error {{constructor for 'X' must explicitly initialize the const member 'cb'}} int &value; // expected-note{{declared at}} const int cvalue; // expected-note{{declared at}} B& b; // expected-note{{declared at}} diff --git a/test/SemaCXX/implicit-virtual-member-functions.cpp b/test/SemaCXX/implicit-virtual-member-functions.cpp index 1bb5adb..cb24501 100644 --- a/test/SemaCXX/implicit-virtual-member-functions.cpp +++ b/test/SemaCXX/implicit-virtual-member-functions.cpp @@ -9,7 +9,7 @@ struct B : A { // expected-error {{no suitable member 'operator delete' in 'B'}} void operator delete (void *, int); // expected-note {{'operator delete' declared here}} }; -void B::f() { // expected-note {{implicit default destructor for 'struct B' first required here}} +void B::f() { // expected-note {{implicit default destructor for 'B' first required here}} } struct C : A { // expected-error {{no suitable member 'operator delete' in 'C'}} @@ -17,11 +17,11 @@ struct C : A { // expected-error {{no suitable member 'operator delete' in 'C'}} void operator delete(void *, int); // expected-note {{'operator delete' declared here}} }; -C::C() { } // expected-note {{implicit default destructor for 'struct C' first required here}} +C::C() { } // expected-note {{implicit default destructor for 'C' first required here}} struct D : A { // expected-error {{no suitable member 'operator delete' in 'D'}} void operator delete(void *, int); // expected-note {{'operator delete' declared here}} -}; // expected-note {{implicit default destructor for 'struct D' first required here}} +}; // expected-note {{implicit default destructor for 'D' first required here}} void f() { new D; diff --git a/test/SemaCXX/incomplete-call.cpp b/test/SemaCXX/incomplete-call.cpp index 5bdaf82..d627c33 100644 --- a/test/SemaCXX/incomplete-call.cpp +++ b/test/SemaCXX/incomplete-call.cpp @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -struct A; // expected-note 14 {{forward declaration of 'struct A'}} +struct A; // expected-note 14 {{forward declaration of 'A'}} A f(); // expected-note {{note: 'f' declared here}} @@ -15,29 +15,29 @@ struct B { }; void g() { - f(); // expected-error {{calling 'f' with incomplete return type 'struct A'}} + f(); // expected-error {{calling 'f' with incomplete return type 'A'}} typedef A (*Func)(); Func fp; - fp(); // expected-error {{calling function with incomplete return type 'struct A'}} - ((Func)0)(); // expected-error {{calling function with incomplete return type 'struct A'}} + fp(); // expected-error {{calling function with incomplete return type 'A'}} + ((Func)0)(); // expected-error {{calling function with incomplete return type 'A'}} B b; - b.f(); // expected-error {{calling 'f' with incomplete return type 'struct A'}} + b.f(); // expected-error {{calling 'f' with incomplete return type 'A'}} - b.operator()(); // expected-error {{calling 'operator()' with incomplete return type 'struct A'}} - b.operator A(); // expected-error {{calling 'operator A' with incomplete return type 'struct A'}} - b.operator!(); // expected-error {{calling 'operator!' with incomplete return type 'struct A'}} + b.operator()(); // expected-error {{calling 'operator()' with incomplete return type 'A'}} + b.operator A(); // expected-error {{calling 'operator A' with incomplete return type 'A'}} + b.operator!(); // expected-error {{calling 'operator!' with incomplete return type 'A'}} - !b; // expected-error {{calling 'operator!' with incomplete return type 'struct A'}} - b(); // expected-error {{calling 'operator()' with incomplete return type 'struct A'}} - b++; // expected-error {{calling 'operator++' with incomplete return type 'struct A'}} - b[0]; // expected-error {{calling 'operator[]' with incomplete return type 'struct A'}} - b + 1; // expected-error {{calling 'operator+' with incomplete return type 'struct A'}} - b->f(); // expected-error {{calling 'operator->' with incomplete return type 'struct A'}} + !b; // expected-error {{calling 'operator!' with incomplete return type 'A'}} + b(); // expected-error {{calling 'operator()' with incomplete return type 'A'}} + b++; // expected-error {{calling 'operator++' with incomplete return type 'A'}} + b[0]; // expected-error {{calling 'operator[]' with incomplete return type 'A'}} + b + 1; // expected-error {{calling 'operator+' with incomplete return type 'A'}} + b->f(); // expected-error {{calling 'operator->' with incomplete return type 'A'}} A (B::*mfp)() = 0; - (b.*mfp)(); // expected-error {{calling function with incomplete return type 'struct A'}} + (b.*mfp)(); // expected-error {{calling function with incomplete return type 'A'}} } diff --git a/test/SemaCXX/inherit.cpp b/test/SemaCXX/inherit.cpp index aabed2b..a926c81 100644 --- a/test/SemaCXX/inherit.cpp +++ b/test/SemaCXX/inherit.cpp @@ -10,7 +10,7 @@ class B3 : virtual virtual A { }; // expected-error{{duplicate 'virtual' in base class C : public B1, private B2 { }; -class D; // expected-note {{forward declaration of 'class D'}} +class D; // expected-note {{forward declaration of 'D'}} class E : public D { }; // expected-error{{base class has incomplete type}} @@ -28,5 +28,5 @@ typedef G G_copy; typedef G G_copy_2; typedef G_copy G_copy_3; -class H : G_copy, A, G_copy_2, // expected-error{{base class 'G_copy' (aka 'class G') specified more than once as a direct base class}} - public G_copy_3 { }; // expected-error{{base class 'G_copy' (aka 'class G') specified more than once as a direct base class}} +class H : G_copy, A, G_copy_2, // expected-error{{base class 'G_copy' (aka 'G') specified more than once as a direct base class}} + public G_copy_3 { }; // expected-error{{base class 'G_copy' (aka 'G') specified more than once as a direct base class}} diff --git a/test/SemaCXX/member-name-lookup.cpp b/test/SemaCXX/member-name-lookup.cpp index 94296e1..0149169 100644 --- a/test/SemaCXX/member-name-lookup.cpp +++ b/test/SemaCXX/member-name-lookup.cpp @@ -35,11 +35,11 @@ struct D : B, C { }; void test_lookup(D d) { - d.a; // expected-error{{non-static member 'a' found in multiple base-class subobjects of type 'struct A'}} + d.a; // expected-error{{non-static member 'a' found in multiple base-class subobjects of type 'A':}} (void)d.b; // okay d.c; // expected-error{{member 'c' found in multiple base classes of different types}} d.d; // expected-error{{member 'd' found in multiple base classes of different types}} - d.f(0); // expected-error{{non-static member 'f' found in multiple base-class subobjects of type 'struct A'}} + d.f(0); // expected-error{{non-static member 'f' found in multiple base-class subobjects of type 'A':}} d.static_f(0); // okay D::E e = D::enumerator; // okay @@ -51,11 +51,11 @@ void test_lookup(D d) { } void D::test_lookup() { - a; // expected-error{{non-static member 'a' found in multiple base-class subobjects of type 'struct A'}} + a; // expected-error{{non-static member 'a' found in multiple base-class subobjects of type 'A':}} (void)b; // okay c; // expected-error{{member 'c' found in multiple base classes of different types}} d; // expected-error{{member 'd' found in multiple base classes of different types}} - f(0); // expected-error{{non-static member 'f' found in multiple base-class subobjects of type 'struct A'}} + f(0); // expected-error{{non-static member 'f' found in multiple base-class subobjects of type 'A':}} static_f(0); // okay E e = enumerator; // okay @@ -105,7 +105,7 @@ void test_virtual_lookup(D2 d2, G g) { D2::E3 e3; // expected-error{{member 'E3' found in multiple base classes of different types}} - g.a; // expected-error{{non-static member 'a' found in multiple base-class subobjects of type 'struct A'}} + g.a; // expected-error{{non-static member 'a' found in multiple base-class subobjects of type 'A':}} g.static_f(0); // okay } @@ -126,7 +126,7 @@ void D2::test_virtual_lookup() { } void G::test_virtual_lookup() { - a; // expected-error{{non-static member 'a' found in multiple base-class subobjects of type 'struct A'}} + a; // expected-error{{non-static member 'a' found in multiple base-class subobjects of type 'A':}} static_f(0); // okay } diff --git a/test/SemaCXX/member-pointer.cpp b/test/SemaCXX/member-pointer.cpp index d6050cd..92ae92d 100644 --- a/test/SemaCXX/member-pointer.cpp +++ b/test/SemaCXX/member-pointer.cpp @@ -34,11 +34,11 @@ void f() { pdid = pdi2; // Fail conversion due to ambiguity and virtuality. - int F::*pdif = pdi1; // expected-error {{ambiguous conversion from pointer to member of base class 'struct A' to pointer to member of derived class 'struct F'}} - int G::*pdig = pdi1; // expected-error {{conversion from pointer to member of class 'struct A' to pointer to member of class 'struct G' via virtual base 'struct D' is not allowed}} + int F::*pdif = pdi1; // expected-error {{ambiguous conversion from pointer to member of base class 'A' to pointer to member of derived class 'F':}} + int G::*pdig = pdi1; // expected-error {{conversion from pointer to member of class 'A' to pointer to member of class 'G' via virtual base 'D' is not allowed}} // Conversion to member of base. - pdi1 = pdid; // expected-error {{incompatible type assigning 'int struct D::*', expected 'int struct A::*'}} + pdi1 = pdid; // expected-error {{incompatible type assigning 'int D::*', expected 'int A::*'}} // Comparisons int (A::*pf2)(int, int); @@ -104,8 +104,8 @@ void h() { (hm.*pf)(); (phm->*pf)(); - (void)(hm->*pi); // expected-error {{left hand operand to ->* must be a pointer to class compatible with the right hand operand, but is 'struct HasMembers'}} - (void)(phm.*pi); // expected-error {{left hand operand to .* must be a class compatible with the right hand operand, but is 'struct HasMembers *'}} + (void)(hm->*pi); // expected-error {{left hand operand to ->* must be a pointer to class compatible with the right hand operand, but is 'HasMembers'}} + (void)(phm.*pi); // expected-error {{left hand operand to .* must be a class compatible with the right hand operand, but is 'HasMembers *'}} (void)(i.*pi); // expected-error {{left hand operand to .* must be a class compatible with the right hand operand, but is 'int'}} int *ptr; (void)(ptr->*pi); // expected-error {{left hand operand to ->* must be a pointer to class compatible with the right hand operand, but is 'int *'}} @@ -115,8 +115,8 @@ void h() { (void)(d.*pai); (void)(pd->*pai); F f, *ptrf = &f; - (void)(f.*pai); // expected-error {{left hand operand to .* must be a class compatible with the right hand operand, but is 'struct F'}} - (void)(ptrf->*pai); // expected-error {{left hand operand to ->* must be a pointer to class compatible with the right hand operand, but is 'struct F *'}} + (void)(f.*pai); // expected-error {{left hand operand to .* must be a class compatible with the right hand operand, but is 'F'}} + (void)(ptrf->*pai); // expected-error {{left hand operand to ->* must be a pointer to class compatible with the right hand operand, but is 'F *'}} (void)(hm.*i); // expected-error {{pointer-to-member}} (void)(phm->*i); // expected-error {{pointer-to-member}} diff --git a/test/SemaCXX/missing-members.cpp b/test/SemaCXX/missing-members.cpp index 9ec17f7..529ba10 100644 --- a/test/SemaCXX/missing-members.cpp +++ b/test/SemaCXX/missing-members.cpp @@ -9,7 +9,7 @@ namespace A { void f() { A::B::i; // expected-error {{no member named 'i' in namespace 'A::B'}} - A::B::C::i; // expected-error {{no member named 'i' in 'class A::B::C'}} + A::B::C::i; // expected-error {{no member named 'i' in 'A::B::C'}} ::i; // expected-error {{no member named 'i' in the global namespace}} } @@ -19,18 +19,18 @@ namespace B { void g() { A::B::D::E; // expected-error {{no member named 'D' in namespace 'A::B'}} - B::B::C::D; // expected-error {{no member named 'C' in 'class B::B'}} + B::B::C::D; // expected-error {{no member named 'C' in 'B::B'}} ::C::D; // expected-error {{no member named 'C' in the global namespace}} } int A::B::i = 10; // expected-error {{no member named 'i' in namespace 'A::B'}} -int A::B::C::i = 10; // expected-error {{no member named 'i' in 'class A::B::C'}} -int A::B::S::i = 10; // expected-error {{no member named 'i' in 'struct A::B::S'}} -int A::B::U::i = 10; // expected-error {{no member named 'i' in 'union A::B::U'}} +int A::B::C::i = 10; // expected-error {{no member named 'i' in 'A::B::C'}} +int A::B::S::i = 10; // expected-error {{no member named 'i' in 'A::B::S'}} +int A::B::U::i = 10; // expected-error {{no member named 'i' in 'A::B::U'}} using A::B::D; // expected-error {{no member named 'D' in namespace 'A::B'}} struct S : A::B::C { - using A::B::C::f; // expected-error {{no member named 'f' in 'class A::B::C'}} + using A::B::C::f; // expected-error {{no member named 'f' in 'A::B::C'}} }; diff --git a/test/SemaCXX/nested-name-spec.cpp b/test/SemaCXX/nested-name-spec.cpp index 247e91b..8657c0d 100644 --- a/test/SemaCXX/nested-name-spec.cpp +++ b/test/SemaCXX/nested-name-spec.cpp @@ -36,9 +36,9 @@ class C2 { int x; }; -void C2::m() const { } // expected-error{{out-of-line definition of 'm' does not match any declaration in 'class C2'}} +void C2::m() const { } // expected-error{{out-of-line definition of 'm' does not match any declaration in 'C2'}} -void C2::f(int) { } // expected-error{{out-of-line definition of 'f' does not match any declaration in 'class C2'}} +void C2::f(int) { } // expected-error{{out-of-line definition of 'f' does not match any declaration in 'C2'}} void C2::m() { x = 0; @@ -125,7 +125,7 @@ class Operators { operator bool(); }; -Operators Operators::operator+(const Operators&) { // expected-error{{out-of-line definition of 'operator+' does not match any declaration in 'class Operators'}} +Operators Operators::operator+(const Operators&) { // expected-error{{out-of-line definition of 'operator+' does not match any declaration in 'Operators'}} Operators ops; return ops; } @@ -149,7 +149,7 @@ void A::g(const int&) { } // expected-error{{out-of-line definition of 'g' does struct Struct { }; -void Struct::f() { } // expected-error{{out-of-line definition of 'f' does not match any declaration in 'struct Struct'}} +void Struct::f() { } // expected-error{{out-of-line definition of 'f' does not match any declaration in 'Struct'}} void global_func(int); void global_func2(int); @@ -164,8 +164,8 @@ void ::global_func2(int) { } // expected-error{{definition or redeclaration of ' void N::f() { } // okay -struct Y; // expected-note{{forward declaration of 'struct Y'}} -Y::foo y; // expected-error{{incomplete type 'struct Y' named in nested name specifier}} \ +struct Y; // expected-note{{forward declaration of 'Y'}} +Y::foo y; // expected-error{{incomplete type 'Y' named in nested name specifier}} \ // expected-error{{no type named 'foo' in}} X::X() : a(5) { } // expected-error{{use of undeclared identifier 'X'}} \ @@ -227,6 +227,6 @@ namespace test3 { // FIXME: this should really only trigger once class A; // expected-note 2 {{forward declaration}} void foo(const char *path) { - A::execute(path); // expected-error 2 {{incomplete type 'class test3::A' named in nested name specifier}} + A::execute(path); // expected-error 2 {{incomplete type 'test3::A' named in nested name specifier}} } } diff --git a/test/SemaCXX/new-delete.cpp b/test/SemaCXX/new-delete.cpp index 68323d8..ae77e70 100644 --- a/test/SemaCXX/new-delete.cpp +++ b/test/SemaCXX/new-delete.cpp @@ -8,7 +8,7 @@ struct S // expected-note {{candidate}} S(double, int); // expected-note 2 {{candidate}} S(float, int); // expected-note 2 {{candidate}} }; -struct T; // expected-note{{forward declaration of 'struct T'}} +struct T; // expected-note{{forward declaration of 'T'}} struct U { // A special new, to verify that the global version isn't used. @@ -60,15 +60,15 @@ void bad_news(int *ip) (void)new int[1][i]; // expected-error {{only the first dimension}} (void)new (int[1][i]); // expected-error {{only the first dimension}} (void)new (int[i]); // expected-error {{when type is in parentheses}} - (void)new int(*(S*)0); // expected-error {{no viable conversion from 'struct S' to 'int'}} + (void)new int(*(S*)0); // expected-error {{no viable conversion from 'S' to 'int'}} (void)new int(1, 2); // expected-error {{excess elements in scalar initializer}} (void)new S(1); // expected-error {{no matching constructor}} - (void)new S(1, 1); // expected-error {{call to constructor of 'struct S' is ambiguous}} + (void)new S(1, 1); // expected-error {{call to constructor of 'S' is ambiguous}} (void)new const int; // expected-error {{default initialization of an object of const type 'int const'}} (void)new float*(ip); // expected-error {{cannot initialize a new value of type 'float *' with an lvalue of type 'int *'}} // Undefined, but clang should reject it directly. (void)new int[-1]; // expected-error {{array size is negative}} - (void)new int[*(S*)0]; // expected-error {{array size expression must have integral or enumerated type, not 'struct S'}} + (void)new int[*(S*)0]; // expected-error {{array size expression must have integral or enumerated type, not 'S'}} (void)::S::new int; // expected-error {{expected unqualified-id}} (void)new (0, 0) int; // expected-error {{no matching function for call to 'operator new'}} (void)new (0L) int; // expected-error {{call to 'operator new' is ambiguous}} @@ -114,7 +114,7 @@ struct X2 { void test_delete_conv(X0 x0, X1 x1, X2 x2) { delete x0; // expected-error{{cannot delete}} delete x1; - delete x2; // expected-error{{ambiguous conversion of delete expression of type 'struct X2' to a pointer}} + delete x2; // expected-error{{ambiguous conversion of delete expression of type 'X2' to a pointer}} } // PR4782 @@ -199,7 +199,7 @@ struct X11 : X10 { // expected-error {{no suitable member 'operator delete' in ' }; void f() { - X11 x11; // expected-note {{implicit default destructor for 'struct X11' first required here}} + X11 x11; // expected-note {{implicit default destructor for 'X11' first required here}} } struct X12 { diff --git a/test/SemaCXX/offsetof.cpp b/test/SemaCXX/offsetof.cpp index f3dc52d..3283270 100644 --- a/test/SemaCXX/offsetof.cpp +++ b/test/SemaCXX/offsetof.cpp @@ -10,7 +10,7 @@ struct P { }; void f() { - int i = __builtin_offsetof(P, fieldThatPointsToANonPODType.m); // expected-warning{{offset of on non-POD type 'struct P'}} + int i = __builtin_offsetof(P, fieldThatPointsToANonPODType.m); // expected-warning{{offset of on non-POD type 'P'}} } struct Base { int x; }; diff --git a/test/SemaCXX/overload-call.cpp b/test/SemaCXX/overload-call.cpp index 77e0908..c286028 100644 --- a/test/SemaCXX/overload-call.cpp +++ b/test/SemaCXX/overload-call.cpp @@ -386,3 +386,23 @@ namespace DerivedToBase { float &fr = f0(C()); } } + +namespace PR6483 { + struct X0 { + operator const unsigned int & () const; + }; + + struct X1 { + operator unsigned int & () const; + }; + + void f0(const bool &); + void f1(bool &); // expected-note 2{{not viable}} + + void g(X0 x0, X1 x1) { + f0(x0); + f1(x0); // expected-error{{no matching function for call}} + f0(x1); + f1(x1); // expected-error{{no matching function for call}} + } +} diff --git a/test/SemaCXX/overload-member-call.cpp b/test/SemaCXX/overload-member-call.cpp index 77d9965..8016b11 100644 --- a/test/SemaCXX/overload-member-call.cpp +++ b/test/SemaCXX/overload-member-call.cpp @@ -78,11 +78,11 @@ namespace test1 { void foo(int n, const char *s, int t, ...); // expected-note {{candidate function not viable: requires at least 3 arguments, but 2 were provided}} void foo(int n, const char *s, int t, int u = 0); // expected-note {{candidate function not viable: requires at least 3 arguments, but 2 were provided}} - void bar(double d); //expected-note {{candidate function not viable: 'this' argument has type 'class test1::A const', but method is not marked const}} - void bar(int i); //expected-note {{candidate function not viable: 'this' argument has type 'class test1::A const', but method is not marked const}} + void bar(double d); //expected-note {{candidate function not viable: 'this' argument has type 'test1::A const', but method is not marked const}} + void bar(int i); //expected-note {{candidate function not viable: 'this' argument has type 'test1::A const', but method is not marked const}} - void baz(A &d); // expected-note {{candidate function not viable: 1st argument ('class test1::A const') would lose const qualifier}} - void baz(int i); // expected-note {{candidate function not viable: no known conversion from 'class test1::A const' to 'int' for 1st argument}} + void baz(A &d); // expected-note {{candidate function not viable: 1st argument ('test1::A const') would lose const qualifier}} + void baz(int i); // expected-note {{candidate function not viable: no known conversion from 'test1::A const' to 'int' for 1st argument}} }; void test() { diff --git a/test/SemaCXX/overloaded-operator.cpp b/test/SemaCXX/overloaded-operator.cpp index e07afe2..89f1814 100644 --- a/test/SemaCXX/overloaded-operator.cpp +++ b/test/SemaCXX/overloaded-operator.cpp @@ -38,7 +38,7 @@ bool operator==(A&, Z&); // expected-note 2{{candidate function}} void h(A a, const A ac, Z z) { make_A() == z; a == z; // expected-error{{use of overloaded operator '==' is ambiguous; candidates are:}} - ac == z; // expected-error{{invalid operands to binary expression ('struct A const' and 'struct Z')}} + ac == z; // expected-error{{invalid operands to binary expression ('A const' and 'Z')}} } struct B { @@ -172,7 +172,7 @@ void test_callable(Callable c, Callable2 c2, const Callable2& c2c, int &ir = c(1); float &fr = c(1, 3.14159, 17, 42); - c(); // expected-error{{no matching function for call to object of type 'struct Callable'; candidates are:}} + c(); // expected-error{{no matching function for call to object of type 'Callable'}} double &dr = c(1.0f); @@ -200,12 +200,12 @@ struct ConvertToFuncDerived : ConvertToFunc { }; void test_funcptr_call(ConvertToFunc ctf, ConvertToFuncDerived ctfd) { int &i1 = ctf(1.0f, 2.0); float &f1 = ctf((short int)1, 1.0f); - ctf((long int)17, 2.0); // expected-error{{error: call to object of type 'struct ConvertToFunc' is ambiguous; candidates are:}} + ctf((long int)17, 2.0); // expected-error{{call to object of type 'ConvertToFunc' is ambiguous}} ctf(); int &i2 = ctfd(1.0f, 2.0); float &f2 = ctfd((short int)1, 1.0f); - ctfd((long int)17, 2.0); // expected-error{{error: call to object of type 'struct ConvertToFuncDerived' is ambiguous; candidates are:}} + ctfd((long int)17, 2.0); // expected-error{{call to object of type 'ConvertToFuncDerived' is ambiguous}} ctfd(); } diff --git a/test/SemaCXX/qual-id-test.cpp b/test/SemaCXX/qual-id-test.cpp index 00dc662..54d41b8 100644 --- a/test/SemaCXX/qual-id-test.cpp +++ b/test/SemaCXX/qual-id-test.cpp @@ -48,7 +48,7 @@ namespace C a.A::sub::x(); a.A::B::base::x(); - a.bad::x(); // expected-error{{type 'struct bad' is not a direct or virtual base of ''A::sub''}} + a.bad::x(); // expected-error{{type 'bad' is not a direct or virtual base of ''A::sub''}} a->foo(); a->member::foo(); @@ -69,7 +69,7 @@ namespace C a->A::sub::x(); a->A::B::base::x(); - a->bad::x(); // expected-error{{type 'struct bad' is not a direct or virtual base of ''A::sub''}} + a->bad::x(); // expected-error{{type 'bad' is not a direct or virtual base of ''A::sub''}} (*a)->foo(); (*a)->member::foo(); diff --git a/test/SemaCXX/qualified-id-lookup.cpp b/test/SemaCXX/qualified-id-lookup.cpp index a187d49..abde62e 100644 --- a/test/SemaCXX/qualified-id-lookup.cpp +++ b/test/SemaCXX/qualified-id-lookup.cpp @@ -96,12 +96,12 @@ void test_a() { a::a::a::i = 4; } -struct Undef { // expected-note{{definition of 'struct Undef' is not complete until the closing '}'}} +struct Undef { // expected-note{{definition of 'Undef' is not complete until the closing '}'}} typedef int type; Undef::type member; - static int size = sizeof(Undef); // expected-error{{invalid application of 'sizeof' to an incomplete type 'struct Undef'}} + static int size = sizeof(Undef); // expected-error{{invalid application of 'sizeof' to an incomplete type 'Undef'}} int f(); }; diff --git a/test/SemaCXX/qualified-names-diag.cpp b/test/SemaCXX/qualified-names-diag.cpp index 86c1088..c8b5746 100644 --- a/test/SemaCXX/qualified-names-diag.cpp +++ b/test/SemaCXX/qualified-names-diag.cpp @@ -16,7 +16,7 @@ namespace foo { namespace bar { typedef int y; - struct incomplete; // expected-note{{forward declaration of 'struct bar::incomplete'}} + struct incomplete; // expected-note{{forward declaration of 'bar::incomplete'}} } void test() { foo::wibble::x a; diff --git a/test/SemaCXX/ref-init-ambiguous.cpp b/test/SemaCXX/ref-init-ambiguous.cpp index 976879e..8844162 100644 --- a/test/SemaCXX/ref-init-ambiguous.cpp +++ b/test/SemaCXX/ref-init-ambiguous.cpp @@ -14,15 +14,15 @@ struct C : B, A { }; void test(C c) { - const E2 &e2 = c; // expected-error {{reference initialization of type 'enum E2 const &' with initializer of type 'struct C' is ambiguous}} + const E2 &e2 = c; // expected-error {{reference initialization of type 'E2 const &' with initializer of type 'C' is ambiguous}} } void foo(const E2 &); const E2 & re(C c) { - foo(c); // expected-error {{reference initialization of type 'enum E2 const &' with initializer of type 'struct C' is ambiguous}} + foo(c); // expected-error {{reference initialization of type 'E2 const &' with initializer of type 'C' is ambiguous}} - return c; // expected-error {{reference initialization of type 'enum E2 const &' with initializer of type 'struct C' is ambiguous}} + return c; // expected-error {{reference initialization of type 'E2 const &' with initializer of type 'C' is ambiguous}} } diff --git a/test/SemaCXX/references.cpp b/test/SemaCXX/references.cpp index df8337b..f1f4ab9 100644 --- a/test/SemaCXX/references.cpp +++ b/test/SemaCXX/references.cpp @@ -73,7 +73,7 @@ class Test6 { struct C : B, A { }; void test7(C& c) { - A& a1 = c; // expected-error {{ambiguous conversion from derived class 'struct C' to base class 'struct A':}} + A& a1 = c; // expected-error {{ambiguous conversion from derived class 'C' to base class 'A':}} } // C++ [dcl.ref]p1, C++ [dcl.ref]p4 diff --git a/test/SemaCXX/reinterpret-cast.cpp b/test/SemaCXX/reinterpret-cast.cpp index f7ab80e..45d41e8 100644 --- a/test/SemaCXX/reinterpret-cast.cpp +++ b/test/SemaCXX/reinterpret-cast.cpp @@ -13,7 +13,7 @@ void self_conversion() int i = 0; (void)reinterpret_cast<int>(i); // expected-error {{reinterpret_cast from 'int' to 'int' is not allowed}} structure s; - (void)reinterpret_cast<structure>(s); // expected-error {{reinterpret_cast from 'struct structure' to 'struct structure' is not allowed}} + (void)reinterpret_cast<structure>(s); // expected-error {{reinterpret_cast from 'structure' to 'structure' is not allowed}} int *pi = 0; (void)reinterpret_cast<int*>(pi); } @@ -77,18 +77,18 @@ void memptrs() { const int structure::*psi = 0; (void)reinterpret_cast<const float structure::*>(psi); - (void)reinterpret_cast<int structure::*>(psi); // expected-error {{reinterpret_cast from 'int const struct structure::*' to 'int struct structure::*' casts away constness}} + (void)reinterpret_cast<int structure::*>(psi); // expected-error {{reinterpret_cast from 'int const structure::*' to 'int structure::*' casts away constness}} void (structure::*psf)() = 0; (void)reinterpret_cast<int (structure::*)()>(psf); - (void)reinterpret_cast<void (structure::*)()>(psi); // expected-error {{reinterpret_cast from 'int const struct structure::*' to 'void (struct structure::*)()' is not allowed}} - (void)reinterpret_cast<int structure::*>(psf); // expected-error {{reinterpret_cast from 'void (struct structure::*)()' to 'int struct structure::*' is not allowed}} + (void)reinterpret_cast<void (structure::*)()>(psi); // expected-error {{reinterpret_cast from 'int const structure::*' to 'void (structure::*)()' is not allowed}} + (void)reinterpret_cast<int structure::*>(psf); // expected-error {{reinterpret_cast from 'void (structure::*)()' to 'int structure::*' is not allowed}} // Cannot cast from integers to member pointers, not even the null pointer // literal. - (void)reinterpret_cast<void (structure::*)()>(0); // expected-error {{reinterpret_cast from 'int' to 'void (struct structure::*)()' is not allowed}} - (void)reinterpret_cast<int structure::*>(0); // expected-error {{reinterpret_cast from 'int' to 'int struct structure::*' is not allowed}} + (void)reinterpret_cast<void (structure::*)()>(0); // expected-error {{reinterpret_cast from 'int' to 'void (structure::*)()' is not allowed}} + (void)reinterpret_cast<int structure::*>(0); // expected-error {{reinterpret_cast from 'int' to 'int structure::*' is not allowed}} } // PR5545 diff --git a/test/SemaCXX/rval-references.cpp b/test/SemaCXX/rval-references.cpp index 2a7fb25..d5b465f 100644 --- a/test/SemaCXX/rval-references.cpp +++ b/test/SemaCXX/rval-references.cpp @@ -44,7 +44,7 @@ void f() { conv_to_not_int_rvalue cnir; not_int &&ni4 = cnir; // expected-error {{rvalue reference cannot bind to lvalue}} - not_int &ni5 = cnir; // expected-error{{non-const lvalue reference to type 'struct not_int' cannot bind to a value of unrelated type 'struct conv_to_not_int_rvalue'}} + not_int &ni5 = cnir; // expected-error{{non-const lvalue reference to type 'not_int' cannot bind to a value of unrelated type 'conv_to_not_int_rvalue'}} not_int &&ni6 = conv_to_not_int_rvalue(); @@ -83,5 +83,5 @@ MoveOnly returningNonEligible() { else if (0) // Copy from reference can't be elided return r; // expected-error {{call to deleted constructor}} else // Construction from different type can't be elided - return i; // expected-error {{no viable conversion from 'int' to 'struct MoveOnly'}} + return i; // expected-error {{no viable conversion from 'int' to 'MoveOnly'}} } diff --git a/test/SemaCXX/statements.cpp b/test/SemaCXX/statements.cpp index 852086e..0e27f46 100644 --- a/test/SemaCXX/statements.cpp +++ b/test/SemaCXX/statements.cpp @@ -15,3 +15,8 @@ void test2() { later: ; } + +namespace PR6536 { + struct A {}; + void a() { goto out; A x; out: return; } +} diff --git a/test/SemaCXX/static-assert.cpp b/test/SemaCXX/static-assert.cpp index 62208cd..516243e 100644 --- a/test/SemaCXX/static-assert.cpp +++ b/test/SemaCXX/static-assert.cpp @@ -18,13 +18,13 @@ template<int N> struct T { static_assert(N == 2, "N is not 2!"); // expected-error {{static_assert failed "N is not 2!"}} }; -T<1> t1; // expected-note {{in instantiation of template class 'struct T<1>' requested here}} +T<1> t1; // expected-note {{in instantiation of template class 'T<1>' requested here}} T<2> t2; template<typename T> struct S { static_assert(sizeof(T) > sizeof(char), "Type not big enough!"); // expected-error {{static_assert failed "Type not big enough!"}} }; -S<char> s1; // expected-note {{in instantiation of template class 'struct S<char>' requested here}} +S<char> s1; // expected-note {{in instantiation of template class 'S<char>' requested here}} S<int> s2; diff --git a/test/SemaCXX/static-cast-complete-type.cpp b/test/SemaCXX/static-cast-complete-type.cpp index 11bf22d..6d76f81 100644 --- a/test/SemaCXX/static-cast-complete-type.cpp +++ b/test/SemaCXX/static-cast-complete-type.cpp @@ -3,11 +3,11 @@ template<typename T> struct S { S(int); }; -struct T; // expected-note{{forward declaration of 'struct T'}} +struct T; // expected-note{{forward declaration of 'T'}} void f() { S<int> s0 = static_cast<S<int> >(0); S<void*> s1 = static_cast<S<void*> >(00); - (void)static_cast<T>(10); // expected-error{{'struct T' is an incomplete type}} + (void)static_cast<T>(10); // expected-error{{'T' is an incomplete type}} } diff --git a/test/SemaCXX/static-cast.cpp b/test/SemaCXX/static-cast.cpp index 4818b04..2630278 100644 --- a/test/SemaCXX/static-cast.cpp +++ b/test/SemaCXX/static-cast.cpp @@ -56,10 +56,10 @@ void t_529_2() // Bad code below (void)static_cast<void*>((const int*)0); // expected-error {{static_cast from 'int const *' to 'void *' is not allowed}} - (void)static_cast<A*>((E*)0); // expected-error {{private base class 'struct A'}} + (void)static_cast<A*>((E*)0); // expected-error {{cannot cast 'E' to its private base class 'A'}} (void)static_cast<A*>((H*)0); // expected-error {{ambiguous conversion}} (void)static_cast<int>((int*)0); // expected-error {{static_cast from 'int *' to 'int' is not allowed}} - (void)static_cast<A**>((B**)0); // expected-error {{static_cast from 'struct B **' to 'struct A **' is not allowed}} + (void)static_cast<A**>((B**)0); // expected-error {{static_cast from 'B **' to 'A **' is not allowed}} (void)static_cast<char&>(i); // expected-error {{non-const lvalue reference to type 'char' cannot be initialized with a value of type 'int'}} } @@ -80,18 +80,18 @@ void t_529_5_8() // Bad code below - (void)static_cast<C1*>((A*)0); // expected-error {{cannot cast 'struct A *' to 'struct C1 *' via virtual base 'struct B'}} - (void)static_cast<C1&>(*((A*)0)); // expected-error {{cannot cast 'struct A' to 'struct C1 &' via virtual base 'struct B'}} - (void)static_cast<D*>((A*)0); // expected-error {{cannot cast 'struct A *' to 'struct D *' via virtual base 'struct B'}} - (void)static_cast<D&>(*((A*)0)); // expected-error {{cannot cast 'struct A' to 'struct D &' via virtual base 'struct B'}} - (void)static_cast<B*>((const A*)0); // expected-error {{static_cast from 'struct A const *' to 'struct B *' casts away constness}} - (void)static_cast<B&>(*((const A*)0)); // expected-error {{static_cast from 'struct A const' to 'struct B &' casts away constness}} - (void)static_cast<E*>((A*)0); // expected-error {{cannot cast private base class 'struct A' to 'struct E'}} - (void)static_cast<E&>(*((A*)0)); // expected-error {{cannot cast private base class 'struct A' to 'struct E'}} - (void)static_cast<H*>((A*)0); // expected-error {{ambiguous cast from base 'struct A' to derived 'struct H':\n struct A -> struct B -> struct G1 -> struct H\n struct A -> struct B -> struct G2 -> struct H}} - (void)static_cast<H&>(*((A*)0)); // expected-error {{ambiguous cast from base 'struct A' to derived 'struct H':\n struct A -> struct B -> struct G1 -> struct H\n struct A -> struct B -> struct G2 -> struct H}} - (void)static_cast<E*>((B*)0); // expected-error {{static_cast from 'struct B *' to 'struct E *' is not allowed}} - (void)static_cast<E&>(*((B*)0)); // expected-error {{non-const lvalue reference to type 'struct E' cannot be initialized with a value of type 'struct B'}} + (void)static_cast<C1*>((A*)0); // expected-error {{cannot cast 'A *' to 'C1 *' via virtual base 'B'}} + (void)static_cast<C1&>(*((A*)0)); // expected-error {{cannot cast 'A' to 'C1 &' via virtual base 'B'}} + (void)static_cast<D*>((A*)0); // expected-error {{cannot cast 'A *' to 'D *' via virtual base 'B'}} + (void)static_cast<D&>(*((A*)0)); // expected-error {{cannot cast 'A' to 'D &' via virtual base 'B'}} + (void)static_cast<B*>((const A*)0); // expected-error {{static_cast from 'A const *' to 'B *' casts away constness}} + (void)static_cast<B&>(*((const A*)0)); // expected-error {{static_cast from 'A const' to 'B &' casts away constness}} + (void)static_cast<E*>((A*)0); // expected-error {{cannot cast private base class 'A' to 'E'}} + (void)static_cast<E&>(*((A*)0)); // expected-error {{cannot cast private base class 'A' to 'E'}} + (void)static_cast<H*>((A*)0); // expected-error {{ambiguous cast from base 'A' to derived 'H':\n struct A -> struct B -> struct G1 -> struct H\n struct A -> struct B -> struct G2 -> struct H}} + (void)static_cast<H&>(*((A*)0)); // expected-error {{ambiguous cast from base 'A' to derived 'H':\n struct A -> struct B -> struct G1 -> struct H\n struct A -> struct B -> struct G2 -> struct H}} + (void)static_cast<E*>((B*)0); // expected-error {{static_cast from 'B *' to 'E *' is not allowed}} + (void)static_cast<E&>(*((B*)0)); // expected-error {{non-const lvalue reference to type 'E' cannot be initialized with a value of type 'B'}} // TODO: Test inaccessible base in context where it's accessible, i.e. // member function and friend. @@ -108,7 +108,7 @@ void t_529_7() // Bad code below - (void)static_cast<Enum>((int*)0); // expected-error {{static_cast from 'int *' to 'enum Enum' is not allowed}} + (void)static_cast<Enum>((int*)0); // expected-error {{static_cast from 'int *' to 'Enum' is not allowed}} } // Void pointer to object pointer @@ -129,8 +129,8 @@ void t_529_9() (void)static_cast<int A::*>((int B::*)0); // Bad code below - (void)static_cast<int A::*>((int H::*)0); // expected-error {{ambiguous conversion from pointer to member of derived class 'struct H'}} - (void)static_cast<int A::*>((int F::*)0); // expected-error {{conversion from pointer to member of class 'struct F'}} + (void)static_cast<int A::*>((int H::*)0); // expected-error {{ambiguous conversion from pointer to member of derived class 'H' to pointer to member of base class 'A':}} + (void)static_cast<int A::*>((int F::*)0); // expected-error {{conversion from pointer to member of class 'F' to pointer to member of class 'A' via virtual base 'B' is not allowed}} } // PR 5261 - static_cast should instantiate template if possible @@ -181,3 +181,17 @@ struct X4 { // PR5897 - accept static_cast from const void* to const int (*)[1]. void PR5897() { (void)static_cast<const int(*)[1]>((const void*)0); } + +namespace PR6072 { + struct A { }; + struct B : A { void f(int); void f(); }; + struct C : B { }; + struct D { }; + + void f() { + (void)static_cast<void (A::*)()>(&B::f); + (void)static_cast<void (B::*)()>(&B::f); + (void)static_cast<void (C::*)()>(&B::f); + (void)static_cast<void (D::*)()>(&B::f); // expected-error{{static_cast from '<overloaded function type>' to 'void (PR6072::D::*)()' is not allowed}} + } +} diff --git a/test/SemaCXX/type-traits-incomplete.cpp b/test/SemaCXX/type-traits-incomplete.cpp index 0ef6917..f959821 100644 --- a/test/SemaCXX/type-traits-incomplete.cpp +++ b/test/SemaCXX/type-traits-incomplete.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -struct S; // expected-note{{forward declaration of 'struct S'}} +struct S; // expected-note{{forward declaration of 'S'}} void f() { - __is_pod(S); // expected-error{{incomplete type 'struct S' used in type trait expression}} + __is_pod(S); // expected-error{{incomplete type 'S' used in type trait expression}} } diff --git a/test/SemaCXX/typedef-redecl.cpp b/test/SemaCXX/typedef-redecl.cpp index 0d8dc84..c382539 100644 --- a/test/SemaCXX/typedef-redecl.cpp +++ b/test/SemaCXX/typedef-redecl.cpp @@ -11,10 +11,10 @@ struct X { }; struct Y; // expected-note{{previous definition is here}} -typedef int Y; // expected-error{{typedef redefinition with different types ('int' vs 'struct Y')}} +typedef int Y; // expected-error{{typedef redefinition with different types ('int' vs 'Y')}} typedef int Y2; // expected-note{{previous definition is here}} -struct Y2; // expected-error{{definition of type 'struct Y2' conflicts with typedef of the same name}} +struct Y2; // expected-error{{definition of type 'Y2' conflicts with typedef of the same name}} void f(); // expected-note{{previous definition is here}} typedef int f; // expected-error{{redefinition of 'f' as different kind of symbol}} diff --git a/test/SemaCXX/typeid.cpp b/test/SemaCXX/typeid.cpp index 7960cac..0e78ff4 100644 --- a/test/SemaCXX/typeid.cpp +++ b/test/SemaCXX/typeid.cpp @@ -18,7 +18,7 @@ void g() struct X; // expected-note 3{{forward declaration}} void g1(X &x) { - (void)typeid(X); // expected-error{{'typeid' of incomplete type 'struct X'}} - (void)typeid(X&); // expected-error{{'typeid' of incomplete type 'struct X'}} - (void)typeid(x); // expected-error{{'typeid' of incomplete type 'struct X'}} + (void)typeid(X); // expected-error{{'typeid' of incomplete type 'X'}} + (void)typeid(X&); // expected-error{{'typeid' of incomplete type 'X'}} + (void)typeid(x); // expected-error{{'typeid' of incomplete type 'X'}} } diff --git a/test/SemaCXX/unknown-type-name.cpp b/test/SemaCXX/unknown-type-name.cpp index 084a811..5f8d8ca 100644 --- a/test/SemaCXX/unknown-type-name.cpp +++ b/test/SemaCXX/unknown-type-name.cpp @@ -9,10 +9,10 @@ namespace N { } using namespace N; -foo::bar x; // expected-error{{no type named 'bar' in 'struct N::Wibble'}} +foo::bar x; // expected-error{{no type named 'bar' in 'N::Wibble'}} void f() { - foo::bar = 4; // expected-error{{no member named 'bar' in 'struct N::Wibble'}} + foo::bar = 4; // expected-error{{no member named 'bar' in 'N::Wibble'}} } template<typename T> diff --git a/test/SemaCXX/using-decl-templates.cpp b/test/SemaCXX/using-decl-templates.cpp index 8f2876c..5148ed5 100644 --- a/test/SemaCXX/using-decl-templates.cpp +++ b/test/SemaCXX/using-decl-templates.cpp @@ -13,7 +13,7 @@ template<typename T> struct B : A<T> { using A<double>::f; // expected-error{{using declaration refers into 'A<double>::', which is not a base class of 'B<int>'}} }; -B<int> a; // expected-note{{in instantiation of template class 'struct B<int>' requested here}} +B<int> a; // expected-note{{in instantiation of template class 'B<int>' requested here}} template<typename T> struct C : A<T> { using A<T>::f; diff --git a/test/SemaCXX/value-initialization.cpp b/test/SemaCXX/value-initialization.cpp index d6a86c4..16a7a1d 100644 --- a/test/SemaCXX/value-initialization.cpp +++ b/test/SemaCXX/value-initialization.cpp @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x -struct A { // expected-error {{implicit default constructor for 'struct A' must explicitly initialize the const member 'i'}} +struct A { // expected-error {{implicit default constructor for 'A' must explicitly initialize the const member 'i'}} const int i; // expected-note {{declared at}} virtual void f() { } }; diff --git a/test/SemaCXX/vararg-non-pod.cpp b/test/SemaCXX/vararg-non-pod.cpp index 5f95446..d31f1f7 100644 --- a/test/SemaCXX/vararg-non-pod.cpp +++ b/test/SemaCXX/vararg-non-pod.cpp @@ -15,7 +15,7 @@ void t1() { C c(10); - g(10, c); // expected-warning{{cannot pass object of non-POD type 'class C' through variadic function; call will abort at runtime}} + g(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic function; call will abort at runtime}} g(10, version); } @@ -23,10 +23,10 @@ void t2() { C c(10); - c.g(10, c); // expected-warning{{cannot pass object of non-POD type 'class C' through variadic method; call will abort at runtime}} + c.g(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic method; call will abort at runtime}} c.g(10, version); - C::h(10, c); // expected-warning{{cannot pass object of non-POD type 'class C' through variadic function; call will abort at runtime}} + C::h(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic function; call will abort at runtime}} C::h(10, version); } @@ -36,7 +36,7 @@ void t3() { C c(10); - block(10, c); // expected-warning{{cannot pass object of non-POD type 'class C' through variadic block; call will abort at runtime}} + block(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic block; call will abort at runtime}} block(10, version); } @@ -51,7 +51,7 @@ void t4() D d; - d(10, c); // expected-warning{{cannot pass object of non-POD type 'class C' through variadic method; call will abort at runtime}} + d(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic method; call will abort at runtime}} d(10, version); } @@ -63,8 +63,8 @@ void t5() { C c(10); - E e(10, c); // expected-warning{{cannot pass object of non-POD type 'class C' through variadic constructor; call will abort at runtime}} - (void)E(10, c); // expected-warning{{cannot pass object of non-POD type 'class C' through variadic constructor; call will abort at runtime}} + E e(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic constructor; call will abort at runtime}} + (void)E(10, c); // expected-warning{{cannot pass object of non-POD type 'C' through variadic constructor; call will abort at runtime}} } // PR5761: unevaluated operands and the non-POD warning @@ -85,6 +85,6 @@ Base &get_base(...); int eat_base(...); void test_typeid(Base &base) { - (void)typeid(get_base(base)); // expected-warning{{cannot pass object of non-POD type 'struct Base' through variadic function; call will abort at runtime}} + (void)typeid(get_base(base)); // expected-warning{{cannot pass object of non-POD type 'Base' through variadic function; call will abort at runtime}} (void)typeid(eat_base(base)); // okay } diff --git a/test/SemaCXX/vector-casts.cpp b/test/SemaCXX/vector-casts.cpp index 6ee619e..4bb5808 100644 --- a/test/SemaCXX/vector-casts.cpp +++ b/test/SemaCXX/vector-casts.cpp @@ -22,10 +22,10 @@ void f() { (void)reinterpret_cast<__v2si>(ll); (void)(__v2si)(ll); - (void)reinterpret_cast<S>(v2si); // expected-error {{reinterpret_cast from '__v2si' to 'struct S' is not allowed}} - (void)(S)v2si; // expected-error {{C-style cast from '__v2si' to 'struct S' is not allowed}} - (void)reinterpret_cast<__v2si>(s); // expected-error {{reinterpret_cast from 'struct S' to '__v2si' is not allowed}} - (void)(__v2si)s; // expected-error {{C-style cast from 'struct S' to '__v2si' is not allowed}} + (void)reinterpret_cast<S>(v2si); // expected-error {{reinterpret_cast from '__v2si' to 'S' is not allowed}} + (void)(S)v2si; // expected-error {{C-style cast from '__v2si' to 'S' is not allowed}} + (void)reinterpret_cast<__v2si>(s); // expected-error {{reinterpret_cast from 'S' to '__v2si' is not allowed}} + (void)(__v2si)s; // expected-error {{C-style cast from 'S' to '__v2si' is not allowed}} (void)reinterpret_cast<unsigned char>(v2si); // expected-error {{reinterpret_cast from vector '__v2si' to scalar 'unsigned char' of different size}} (void)(unsigned char)v2si; // expected-error {{C-style cast from vector '__v2si' to scalar 'unsigned char' of different size}} diff --git a/test/SemaCXX/virtual-member-functions-key-function.cpp b/test/SemaCXX/virtual-member-functions-key-function.cpp index 2e21fb7..97164d9 100644 --- a/test/SemaCXX/virtual-member-functions-key-function.cpp +++ b/test/SemaCXX/virtual-member-functions-key-function.cpp @@ -6,11 +6,11 @@ struct A { struct B : A { // expected-error {{no suitable member 'operator delete' in 'B'}} B() { } void operator delete(void *, int); // expected-note {{'operator delete' declared here}} -}; // expected-note {{implicit default destructor for 'struct B' first required here}} +}; // expected-note {{implicit default destructor for 'B' first required here}} struct C : A { // expected-error {{no suitable member 'operator delete' in 'C'}} void operator delete(void *, int); // expected-note {{'operator delete' declared here}} -}; // expected-note {{implicit default destructor for 'struct C' first required here}} +}; // expected-note {{implicit default destructor for 'C' first required here}} void f() { (void)new B; diff --git a/test/SemaCXX/virtual-override.cpp b/test/SemaCXX/virtual-override.cpp index 09cbfad..6887135 100644 --- a/test/SemaCXX/virtual-override.cpp +++ b/test/SemaCXX/virtual-override.cpp @@ -21,7 +21,7 @@ class A { }; class B : A { - virtual b* f(); // expected-error{{return type of virtual function 'f' is not covariant with the return type of the function it overrides ('struct T2::b *' is not derived from 'struct T2::a *')}} + virtual b* f(); // expected-error{{return type of virtual function 'f' is not covariant with the return type of the function it overrides ('T2::b *' is not derived from 'T2::a *')}} }; } @@ -36,7 +36,7 @@ class A { }; class B : A { - virtual b* f(); // expected-error{{invalid covariant return for virtual function: 'struct T3::a' is a private base class of 'struct T3::b'}} + virtual b* f(); // expected-error{{invalid covariant return for virtual function: 'T3::a' is a private base class of 'T3::b'}} }; } @@ -52,7 +52,7 @@ class A { }; class B : A { - virtual b* f(); // expected-error{{return type of virtual function 'f' is not covariant with the return type of the function it overrides (ambiguous conversion from derived class 'struct T4::b' to base class 'struct T4::a':\n\ + virtual b* f(); // expected-error{{return type of virtual function 'f' is not covariant with the return type of the function it overrides (ambiguous conversion from derived class 'T4::b' to base class 'T4::a':\n\ struct T4::b -> struct T4::a\n\ struct T4::b -> struct T4::a1 -> struct T4::a)}} }; @@ -70,7 +70,7 @@ class A { class B : A { virtual a* const f(); - virtual a* g(); // expected-error{{return type of virtual function 'g' is not covariant with the return type of the function it overrides ('struct T5::a *' has different qualifiers than 'struct T5::a *const')}} + virtual a* g(); // expected-error{{return type of virtual function 'g' is not covariant with the return type of the function it overrides ('T5::a *' has different qualifiers than 'T5::a *const')}} }; } @@ -86,7 +86,7 @@ class A { class B : A { virtual a* f(); - virtual const a* g(); // expected-error{{return type of virtual function 'g' is not covariant with the return type of the function it overrides (class type 'struct T6::a const *' is more qualified than class type 'struct T6::a *'}} + virtual const a* g(); // expected-error{{return type of virtual function 'g' is not covariant with the return type of the function it overrides (class type 'T6::a const *' is more qualified than class type 'T6::a *'}} }; } @@ -106,14 +106,14 @@ namespace T7 { namespace T8 { struct a { }; - struct b; // expected-note {{forward declaration of 'struct T8::b'}} + struct b; // expected-note {{forward declaration of 'T8::b'}} class A { virtual a *f(); }; class B : A { - b* f(); // expected-error {{return type of virtual function 'f' is not covariant with the return type of the function it overrides ('struct T8::b' is incomplete)}} + b* f(); // expected-error {{return type of virtual function 'f' is not covariant with the return type of the function it overrides ('T8::b' is incomplete)}} }; } @@ -129,7 +129,7 @@ namespace T9 { }; class B : A { - virtual b<int> *f(); // expected-note {{in instantiation of template class 'struct T9::b<int>' requested here}} + virtual b<int> *f(); // expected-note {{in instantiation of template class 'T9::b<int>' requested here}} }; } @@ -230,7 +230,7 @@ namespace type_dependent_covariance { }; template <int N, int M> struct X1 : X<N> { virtual TD<M>* f1(); // expected-error{{return type of virtual function 'f1' is not covariant with the return type of the function it overrides ('TD<1> *'}} - virtual D* f2(); // expected-error{{return type of virtual function 'f2' is not covariant with the return type of the function it overrides ('struct type_dependent_covariance::D *' is not derived from 'TB<1> *')}} + virtual D* f2(); // expected-error{{return type of virtual function 'f2' is not covariant with the return type of the function it overrides ('type_dependent_covariance::D *' is not derived from 'TB<1> *')}} }; X1<0, 0> good; @@ -260,7 +260,7 @@ namespace T11 { }; struct D : C { - virtual B&& f(); // expected-error {{virtual function 'f' has a different return type ('struct T11::B &&') than the function it overrides (which has return type 'struct T11::A &')}} + virtual B&& f(); // expected-error {{virtual function 'f' has a different return type ('T11::B &&') than the function it overrides (which has return type 'T11::A &')}} }; }; @@ -273,6 +273,6 @@ namespace T12 { }; struct D : C { - virtual B& f(); // expected-error {{virtual function 'f' has a different return type ('struct T12::B &') than the function it overrides (which has return type 'struct T12::A &&')}} + virtual B& f(); // expected-error {{virtual function 'f' has a different return type ('T12::B &') than the function it overrides (which has return type 'T12::A &&')}} }; }; diff --git a/test/SemaCXX/warn-reorder-ctor-initialization.cpp b/test/SemaCXX/warn-reorder-ctor-initialization.cpp index 35b32b2..2634202 100644 --- a/test/SemaCXX/warn-reorder-ctor-initialization.cpp +++ b/test/SemaCXX/warn-reorder-ctor-initialization.cpp @@ -9,9 +9,9 @@ public: complex() : s2(1), // expected-warning {{member 's2' will be initialized after}} s1(1) , // expected-note {{field s1}} s3(3), // expected-warning {{member 's3' will be initialized after}} - BB1(), // expected-note {{base 'struct BB1'}} \ - // expected-warning {{base class 'struct BB1' will be initialized after}} - BB() {} // expected-note {{base 'struct BB'}} + BB1(), // expected-note {{base 'BB1'}} \ + // expected-warning {{base class 'BB1' will be initialized after}} + BB() {} // expected-note {{base 'BB'}} int s1; int s2; int s3; @@ -44,14 +44,14 @@ struct C : public A, public B, private virtual V { struct D : public A, public B { - D() : A(), V() { } // expected-warning {{base class 'struct A' will be initialized after}} \ - // expected-note {{base 'struct V'}} + D() : A(), V() { } // expected-warning {{base class 'A' will be initialized after}} \ + // expected-note {{base 'V'}} }; struct E : public A, public B, private virtual V { - E() : A(), V() { } // expected-warning {{base class 'struct A' will be initialized after}} \ - // expected-note {{base 'struct V'}} + E() : A(), V() { } // expected-warning {{base class 'A' will be initialized after}} \ + // expected-note {{base 'V'}} }; @@ -64,13 +64,13 @@ struct B1 { }; struct F : public A1, public B1, private virtual V { - F() : A1(), V() { } // expected-warning {{base class 'struct A1' will be initialized after}} \ - // expected-note {{base 'struct V'}} + F() : A1(), V() { } // expected-warning {{base class 'A1' will be initialized after}} \ + // expected-note {{base 'V'}} }; struct X : public virtual A, virtual V, public virtual B { - X(): A(), V(), B() {} // expected-warning {{base class 'struct A' will be initialized after}} \ - // expected-note {{base 'struct V'}} + X(): A(), V(), B() {} // expected-warning {{base class 'A' will be initialized after}} \ + // expected-note {{base 'V'}} }; class Anon { |