diff options
author | Roman Divacky <rdivacky@FreeBSD.org> | 2010-03-10 17:45:58 +0000 |
---|---|---|
committer | Roman Divacky <rdivacky@FreeBSD.org> | 2010-03-10 17:45:58 +0000 |
commit | a16e9ac1f192503038f49e0c52edd7dcb2ce023a (patch) | |
tree | 56c1dd85a159948815817b5a90bedb39cf9ad105 /test | |
parent | dd5132ce2569a1ef901c92772eb8581aa1705f25 (diff) | |
download | src-test2-a16e9ac1f192503038f49e0c52edd7dcb2ce023a.tar.gz src-test2-a16e9ac1f192503038f49e0c52edd7dcb2ce023a.zip |
Notes
Diffstat (limited to 'test')
136 files changed, 932 insertions, 489 deletions
diff --git a/test/Analysis/dead-stores.c b/test/Analysis/dead-stores.c index a00217442053..9a266c937939 100644 --- a/test/Analysis/dead-stores.c +++ b/test/Analysis/dead-stores.c @@ -1,8 +1,8 @@ -// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-dead-stores -fblocks -verify -Wno-unreachable-code %s -// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=basic -analyzer-check-dead-stores -fblocks -verify -Wno-unreachable-code %s -// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range -analyzer-check-dead-stores -fblocks -verify -Wno-unreachable-code %s -// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -analyzer-check-dead-stores -fblocks -verify -Wno-unreachable-code %s -// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -analyzer-check-dead-stores -fblocks -verify -Wno-unreachable-code %s +// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-dead-stores -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s +// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=basic -analyzer-check-dead-stores -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s +// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range -analyzer-check-dead-stores -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s +// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -analyzer-check-dead-stores -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s +// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -analyzer-check-dead-stores -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s void f1() { int k, y; @@ -377,7 +377,7 @@ void f24_A(int y) { // FIXME: One day this should be reported as dead since 'z = x + y' is dead. int x = (y > 2); // no-warning ^ { - int z = x + y; // FIXME: Eventually this should be reported as a dead store. + int z = x + y; // expected-warning{{Value stored to 'z' during its initialization is never read}} }(); } @@ -429,3 +429,17 @@ int f25_b(int y) { return z; } +int f26_nestedblocks() { + int z; + z = 1; + __block int y = 0; + ^{ + int k; + k = 1; // expected-warning{{Value stored to 'k' is never read}} + ^{ + y = z + 1; + }(); + }(); + return y; +} + diff --git a/test/Analysis/malloc.c b/test/Analysis/malloc.c index 3cce1b0d2ef4..21b6d46a245e 100644 --- a/test/Analysis/malloc.c +++ b/test/Analysis/malloc.c @@ -61,3 +61,9 @@ void pr6069() { void pr6293() { free(0); } + +void f7() { + char *x = (char*) malloc(4); + free(x); + x[0] = 'a'; // expected-warning{{Use dynamically allocated memory after it is freed.}} +} diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 245fe1f5f2a3..6bb5b6c3a0c2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -9,6 +9,7 @@ set(CLANG_TEST_DIRECTORIES "Driver" "FixIt" "Frontend" + "Headers" "Index" "Lexer" "Misc" diff --git a/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp b/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp index 7a6210007eb9..f9bac40c9ddb 100644 --- a/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp +++ b/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp @@ -57,9 +57,9 @@ void test3() { int i = Ints::zero; Numbers2::f(i); - Numbers2::g(i); // expected-error {{no viable conversion from 'int' to 'struct Numbers::Number' is possible}} + Numbers2::g(i); // expected-error {{no viable conversion from 'int' to 'Numbers::Number'}} float f = Floats::zero; Numbers2::f(f); - Numbers2::g(f); // expected-error {{no viable conversion from 'float' to 'struct Numbers::Number' is possible}} + Numbers2::g(f); // expected-error {{no viable conversion from 'float' to 'Numbers::Number'}} } diff --git a/test/CXX/class.access/class.friend/p1.cpp b/test/CXX/class.access/class.friend/p1.cpp index 22f77b095511..a06fb2e3e3c2 100644 --- a/test/CXX/class.access/class.friend/p1.cpp +++ b/test/CXX/class.access/class.friend/p1.cpp @@ -22,10 +22,10 @@ void test1() { S s; g()->f(); S::f(); - X::g(); // expected-error{{no member named 'g' in 'struct X'}} - X::S x_s; // expected-error{{no member named 'S' in 'struct X'}} + X::g(); // expected-error{{no member named 'g' in 'X'}} + X::S x_s; // expected-error{{no member named 'S' in 'X'}} X x; - x.g(); // expected-error{{no member named 'g' in 'struct X'}} + x.g(); // expected-error{{no member named 'g' in 'X'}} } // Test that we recurse through namespaces to find already declared names, but @@ -46,17 +46,17 @@ namespace N { g()->f(); S s; S::f(); - X::g(); // expected-error{{no member named 'g' in 'struct N::X'}} - X::S x_s; // expected-error{{no member named 'S' in 'struct N::X'}} + X::g(); // expected-error{{no member named 'g' in 'N::X'}} + X::S x_s; // expected-error{{no member named 'S' in 'N::X'}} X x; - x.g(); // expected-error{{no member named 'g' in 'struct N::X'}} + x.g(); // expected-error{{no member named 'g' in 'N::X'}} g2(); S2 s2; ::g2(); // expected-error{{no member named 'g2' in the global namespace}} ::S2 g_s2; // expected-error{{no member named 'S2' in the global namespace}} - X::g2(); // expected-error{{no member named 'g2' in 'struct N::X'}} - X::S2 x_s2; // expected-error{{no member named 'S2' in 'struct N::X'}} - x.g2(); // expected-error{{no member named 'g2' in 'struct N::X'}} + X::g2(); // expected-error{{no member named 'g2' in 'N::X'}} + X::S2 x_s2; // expected-error{{no member named 'S2' in 'N::X'}} + x.g2(); // expected-error{{no member named 'g2' in 'N::X'}} } } diff --git a/test/CXX/class/class.friend/p1.cpp b/test/CXX/class/class.friend/p1.cpp index 886fef5bc4f6..3ad4a5f08289 100644 --- a/test/CXX/class/class.friend/p1.cpp +++ b/test/CXX/class/class.friend/p1.cpp @@ -67,7 +67,7 @@ class A { class facet {}; }; -A::UndeclaredSoFar y; // expected-error {{no type named 'UndeclaredSoFar' in 'class A'}} +A::UndeclaredSoFar y; // expected-error {{no type named 'UndeclaredSoFar' in 'A'}} class PreDeclared; diff --git a/test/CXX/class/class.local/p2.cpp b/test/CXX/class/class.local/p2.cpp index 8d281a57e137..2b1359c3d8d3 100644 --- a/test/CXX/class/class.local/p2.cpp +++ b/test/CXX/class/class.local/p2.cpp @@ -7,5 +7,5 @@ void f() { B b; - A *a = &b; // expected-error{{cannot cast 'struct B' to its private base class 'struct A'}} + A *a = &b; // expected-error{{cannot cast 'B' to its private base class 'A'}} } diff --git a/test/CXX/class/class.union/p1.cpp b/test/CXX/class/class.union/p1.cpp index 87946484ec18..f53783eb5f3a 100644 --- a/test/CXX/class/class.union/p1.cpp +++ b/test/CXX/class/class.union/p1.cpp @@ -7,30 +7,30 @@ class Okay { }; class Virtual { - virtual void foo() { abort(); } // expected-note 3 {{because type 'class Virtual' has a virtual member function}} + virtual void foo() { abort(); } // expected-note 3 {{because type 'Virtual' has a virtual member function}} }; -class VirtualBase : virtual Okay { // expected-note 3 {{because type 'class VirtualBase' has a virtual base class}} +class VirtualBase : virtual Okay { // expected-note 3 {{because type 'VirtualBase' has a virtual base class}} }; class Ctor { - Ctor() { abort(); } // expected-note 3 {{because type 'class Ctor' has a user-declared constructor}} + Ctor() { abort(); } // expected-note 3 {{because type 'Ctor' has a user-declared constructor}} }; class Ctor2 { - Ctor2(); // expected-note 3 {{because type 'class Ctor2' has a user-declared constructor}} + Ctor2(); // expected-note 3 {{because type 'Ctor2' has a user-declared constructor}} }; class CopyCtor { - CopyCtor(CopyCtor &cc) { abort(); } // expected-note 3 {{because type 'class CopyCtor' has a user-declared copy constructor}} + CopyCtor(CopyCtor &cc) { abort(); } // expected-note 3 {{because type 'CopyCtor' has a user-declared copy constructor}} }; // FIXME: this should eventually trigger on the operator's declaration line -class CopyAssign { // expected-note 3 {{because type 'class CopyAssign' has a user-declared copy assignment operator}} +class CopyAssign { // expected-note 3 {{because type 'CopyAssign' has a user-declared copy assignment operator}} CopyAssign& operator=(CopyAssign& CA) { abort(); } }; class Dtor { - ~Dtor() { abort(); } // expected-note 3 {{because type 'class Dtor' has a user-declared destructor}} + ~Dtor() { abort(); } // expected-note 3 {{because type 'Dtor' has a user-declared destructor}} }; union U1 { @@ -46,25 +46,25 @@ union U1 { union U2 { struct { - Virtual v; // expected-note {{because type 'struct U2::<anonymous>' has a member with a non-trivial copy constructor}} + Virtual v; // expected-note {{because type 'U2::<anonymous>' has a member with a non-trivial copy constructor}} } m1; // expected-error {{union member 'm1' has a non-trivial copy constructor}} struct { - VirtualBase vbase; // expected-note {{because type 'struct U2::<anonymous>' has a member with a non-trivial copy constructor}} + VirtualBase vbase; // expected-note {{because type 'U2::<anonymous>' has a member with a non-trivial copy constructor}} } m2; // expected-error {{union member 'm2' has a non-trivial copy constructor}} struct { - Ctor ctor; // expected-note {{because type 'struct U2::<anonymous>' has a member with a non-trivial constructor}} + Ctor ctor; // expected-note {{because type 'U2::<anonymous>' has a member with a non-trivial constructor}} } m3; // expected-error {{union member 'm3' has a non-trivial constructor}} struct { - Ctor2 ctor2; // expected-note {{because type 'struct U2::<anonymous>' has a member with a non-trivial constructor}} + Ctor2 ctor2; // expected-note {{because type 'U2::<anonymous>' has a member with a non-trivial constructor}} } m3a; // expected-error {{union member 'm3a' has a non-trivial constructor}} struct { - CopyCtor copyctor; // expected-note {{because type 'struct U2::<anonymous>' has a member with a non-trivial copy constructor}} + CopyCtor copyctor; // expected-note {{because type 'U2::<anonymous>' has a member with a non-trivial copy constructor}} } m4; // expected-error {{union member 'm4' has a non-trivial copy constructor}} struct { - CopyAssign copyassign; // expected-note {{because type 'struct U2::<anonymous>' has a member with a non-trivial copy assignment operator}} + CopyAssign copyassign; // expected-note {{because type 'U2::<anonymous>' has a member with a non-trivial copy assignment operator}} } m5; // expected-error {{union member 'm5' has a non-trivial copy assignment operator}} struct { - Dtor dtor; // expected-note {{because type 'struct U2::<anonymous>' has a member with a non-trivial destructor}} + Dtor dtor; // expected-note {{because type 'U2::<anonymous>' has a member with a non-trivial destructor}} } m6; // expected-error {{union member 'm6' has a non-trivial destructor}} struct { Okay okay; @@ -72,19 +72,19 @@ union U2 { }; union U3 { - struct s1 : Virtual { // expected-note {{because type 'struct U3::s1' has a base class with a non-trivial copy constructor}} + struct s1 : Virtual { // expected-note {{because type 'U3::s1' has a base class with a non-trivial copy constructor}} } m1; // expected-error {{union member 'm1' has a non-trivial copy constructor}} - struct s2 : VirtualBase { // expected-note {{because type 'struct U3::s2' has a base class with a non-trivial copy constructor}} + struct s2 : VirtualBase { // expected-note {{because type 'U3::s2' has a base class with a non-trivial copy constructor}} } m2; // expected-error {{union member 'm2' has a non-trivial copy constructor}} - struct s3 : Ctor { // expected-note {{because type 'struct U3::s3' has a base class with a non-trivial constructor}} + struct s3 : Ctor { // expected-note {{because type 'U3::s3' has a base class with a non-trivial constructor}} } m3; // expected-error {{union member 'm3' has a non-trivial constructor}} - struct s3a : Ctor2 { // expected-note {{because type 'struct U3::s3a' has a base class with a non-trivial constructor}} + struct s3a : Ctor2 { // expected-note {{because type 'U3::s3a' has a base class with a non-trivial constructor}} } m3a; // expected-error {{union member 'm3a' has a non-trivial constructor}} - struct s4 : CopyCtor { // expected-note {{because type 'struct U3::s4' has a base class with a non-trivial copy constructor}} + struct s4 : CopyCtor { // expected-note {{because type 'U3::s4' has a base class with a non-trivial copy constructor}} } m4; // expected-error {{union member 'm4' has a non-trivial copy constructor}} - struct s5 : CopyAssign { // expected-note {{because type 'struct U3::s5' has a base class with a non-trivial copy assignment operator}} + struct s5 : CopyAssign { // expected-note {{because type 'U3::s5' has a base class with a non-trivial copy assignment operator}} } m5; // expected-error {{union member 'm5' has a non-trivial copy assignment operator}} - struct s6 : Dtor { // expected-note {{because type 'struct U3::s6' has a base class with a non-trivial destructor}} + struct s6 : Dtor { // expected-note {{because type 'U3::s6' has a base class with a non-trivial destructor}} } m6; // expected-error {{union member 'm6' has a non-trivial destructor}} struct s7 : Okay { } m7; diff --git a/test/CXX/conv/conv.mem/p4.cpp b/test/CXX/conv/conv.mem/p4.cpp index 1ecbc47ffbb8..42f6343e069e 100644 --- a/test/CXX/conv/conv.mem/p4.cpp +++ b/test/CXX/conv/conv.mem/p4.cpp @@ -19,8 +19,8 @@ namespace test0 { namespace test1 { struct Derived : private Base {}; // expected-note 2 {{declared private here}} void test() { - int (Derived::*d) = data_ptr; // expected-error {{cannot cast private base class 'struct Base' to 'struct test1::Derived'}} - int (Derived::*m)() = method_ptr; // expected-error {{cannot cast private base class 'struct Base' to 'struct test1::Derived'}} + int (Derived::*d) = data_ptr; // expected-error {{cannot cast private base class 'Base' to 'test1::Derived'}} + int (Derived::*m)() = method_ptr; // expected-error {{cannot cast private base class 'Base' to 'test1::Derived'}} } }; @@ -30,8 +30,8 @@ namespace test2 { struct B : Base {}; struct Derived : A, B {}; void test() { - int (Derived::*d) = data_ptr; // expected-error {{ambiguous conversion from pointer to member of base class 'struct Base' to pointer to member of derived class 'struct test2::Derived'}} - int (Derived::*m)() = method_ptr; // expected-error {{ambiguous conversion from pointer to member of base class 'struct Base' to pointer to member of derived class 'struct test2::Derived'}} + int (Derived::*d) = data_ptr; // expected-error {{ambiguous conversion from pointer to member of base class 'Base' to pointer to member of derived class 'test2::Derived':}} + int (Derived::*m)() = method_ptr; // expected-error {{ambiguous conversion from pointer to member of base class 'Base' to pointer to member of derived class 'test2::Derived':}} } } @@ -39,8 +39,8 @@ namespace test2 { namespace test3 { struct Derived : virtual Base {}; void test() { - int (Derived::*d) = data_ptr; // expected-error {{conversion from pointer to member of class 'struct Base' to pointer to member of class 'struct test3::Derived' via virtual base 'struct Base' is not allowed}} - int (Derived::*m)() = method_ptr; // expected-error {{conversion from pointer to member of class 'struct Base' to pointer to member of class 'struct test3::Derived' via virtual base 'struct Base' is not allowed}} + int (Derived::*d) = data_ptr; // expected-error {{conversion from pointer to member of class 'Base' to pointer to member of class 'test3::Derived' via virtual base 'Base' is not allowed}} + int (Derived::*m)() = method_ptr; // expected-error {{conversion from pointer to member of class 'Base' to pointer to member of class 'test3::Derived' via virtual base 'Base' is not allowed}} } } @@ -49,8 +49,8 @@ namespace test4 { struct A : Base {}; struct Derived : Base, virtual A {}; void test() { - int (Derived::*d) = data_ptr; // expected-error {{ambiguous conversion from pointer to member of base class 'struct Base' to pointer to member of derived class 'struct test4::Derived'}} - int (Derived::*m)() = method_ptr; // expected-error {{ambiguous conversion from pointer to member of base class 'struct Base' to pointer to member of derived class 'struct test4::Derived'}} + int (Derived::*d) = data_ptr; // expected-error {{ambiguous conversion from pointer to member of base class 'Base' to pointer to member of derived class 'test4::Derived':}} + int (Derived::*m)() = method_ptr; // expected-error {{ambiguous conversion from pointer to member of base class 'Base' to pointer to member of derived class 'test4::Derived':}} } } diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p9.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p9.cpp index 7bfb655db99b..f507eecb4223 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p9.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p9.cpp @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -verify %s -struct S; // expected-note {{forward declaration of 'struct S'}} +struct S; // expected-note {{forward declaration of 'S'}} extern S a; extern S f(); // expected-note {{'f' declared here}} extern void g(S a); // expected-note {{candidate function}} @@ -8,5 +8,5 @@ extern void g(S a); // expected-note {{candidate function}} void h() { // FIXME: This diagnostic could be better. g(a); // expected-error {{no matching function for call to 'g'}} - f(); // expected-error {{calling 'f' with incomplete return type 'struct S'}} + f(); // expected-error {{calling 'f' with incomplete return type 'S'}} } diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-examples.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-examples.cpp index 7c63a79de1c6..d757adf6986c 100644 --- a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-examples.cpp +++ b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-examples.cpp @@ -16,10 +16,10 @@ struct B : A { } b; // CHECK: example1 void example1() { - // CHECK: struct A &ra = + // CHECK: A &ra = // CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase> lvalue A &ra = b; - // CHECK: struct A const &rca = + // CHECK: A const &rca = // CHECK: ImplicitCastExpr{{.*}}'struct A const' <NoOp> // CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase> const A& rca = b; @@ -33,12 +33,12 @@ struct X { // CHECK: example2 void example2() { - // CHECK: struct A const &rca = + // CHECK: A const &rca = // CHECK: ImplicitCastExpr{{.*}}'struct A const' <NoOp> // CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase> - // CHECK: CallExpr{{.*}}struct B + // CHECK: CallExpr{{.*}}B const A &rca = f(); - // CHECK: struct A const &r = + // CHECK: A const &r = // CHECK: ImplicitCastExpr{{.*}}'struct A const' <NoOp> // CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase> // CHECK: CXXMemberCallExpr{{.*}}'struct B' diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp index d9c5d014014a..6a039b93ebfa 100644 --- a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp +++ b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp @@ -51,10 +51,10 @@ void bind_lvalue_to_lvalue(Base b, Derived d, Base &br1 = b; Base &br2 = d; Derived &dr1 = d; - Derived &dr2 = b; // expected-error{{non-const lvalue reference to type 'struct Derived' cannot bind to a value of unrelated type 'struct Base'}} + Derived &dr2 = b; // expected-error{{non-const lvalue reference to type 'Derived' cannot bind to a value of unrelated type 'Base'}} Base &br3 = bc; // expected-error{{drops qualifiers}} Base &br4 = dc; // expected-error{{drops qualifiers}} - Base &br5 = diamond; // expected-error{{ambiguous conversion from derived class 'struct Diamond' to base class 'struct Base'}} + Base &br5 = diamond; // expected-error{{ambiguous conversion from derived class 'Diamond' to base class 'Base':}} int &ir = i; long &lr = i; // expected-error{{non-const lvalue reference to type 'long' cannot bind to a value of unrelated type 'int'}} } @@ -64,8 +64,8 @@ void bind_lvalue_quals(volatile Base b, volatile Derived d, volatile const int ivc) { volatile Base &bvr1 = b; volatile Base &bvr2 = d; - volatile Base &bvr3 = bvc; // expected-error{{binding of reference to type 'struct Base volatile' to a value of type 'struct Base const volatile' drops qualifiers}} - volatile Base &bvr4 = dvc; // expected-error{{binding of reference to type 'struct Base volatile' to a value of type 'struct Derived const volatile' drops qualifiers}} + volatile Base &bvr3 = bvc; // expected-error{{binding of reference to type 'Base volatile' to a value of type 'Base const volatile' drops qualifiers}} + volatile Base &bvr4 = dvc; // expected-error{{binding of reference to type 'Base volatile' to a value of type 'Derived const volatile' drops qualifiers}} volatile int &ir = ivc; // expected-error{{binding of reference to type 'int volatile' to a value of type 'int const volatile' drops qualifiers}} @@ -74,17 +74,17 @@ void bind_lvalue_quals(volatile Base b, volatile Derived d, } void bind_lvalue_to_rvalue() { - Base &br1 = Base(); // expected-error{{non-const lvalue reference to type 'struct Base' cannot bind to a temporary of type 'struct Base'}} - Base &br2 = Derived(); // expected-error{{non-const lvalue reference to type 'struct Base' cannot bind to a temporary of type 'struct Derived'}} - const volatile Base &br3 = Base(); // expected-error{{volatile lvalue reference to type 'struct Base const volatile' cannot bind to a temporary of type 'struct Base'}} - const volatile Base &br4 = Derived(); // expected-error{{volatile lvalue reference to type 'struct Base const volatile' cannot bind to a temporary of type 'struct Derived'}} + Base &br1 = Base(); // expected-error{{non-const lvalue reference to type 'Base' cannot bind to a temporary of type 'Base'}} + Base &br2 = Derived(); // expected-error{{non-const lvalue reference to type 'Base' cannot bind to a temporary of type 'Derived'}} + const volatile Base &br3 = Base(); // expected-error{{volatile lvalue reference to type 'Base const volatile' cannot bind to a temporary of type 'Base'}} + const volatile Base &br4 = Derived(); // expected-error{{volatile lvalue reference to type 'Base const volatile' cannot bind to a temporary of type 'Derived'}} int &ir = 17; // expected-error{{non-const lvalue reference to type 'int' cannot bind to a temporary of type 'int'}} } void bind_lvalue_to_unrelated(Unrelated ur) { - Base &br1 = ur; // expected-error{{non-const lvalue reference to type 'struct Base' cannot bind to a value of unrelated type 'struct Unrelated'}} - const volatile Base &br2 = ur; // expected-error{{volatile lvalue reference to type 'struct Base const volatile' cannot bind to a value of unrelated type 'struct Unrelated'}} + Base &br1 = ur; // expected-error{{non-const lvalue reference to type 'Base' cannot bind to a value of unrelated type 'Unrelated'}} + const volatile Base &br2 = ur; // expected-error{{volatile lvalue reference to type 'Base const volatile' cannot bind to a value of unrelated type 'Unrelated'}} } void bind_lvalue_to_conv_lvalue() { @@ -97,7 +97,7 @@ void bind_lvalue_to_conv_lvalue() { void bind_lvalue_to_conv_lvalue_ambig(ConvertibleToBothDerivedRef both) { Derived &dr1 = both; - Base &br1 = both; // expected-error{{reference initialization of type 'struct Base &' with initializer of type 'struct ConvertibleToBothDerivedRef' is ambiguous}} + Base &br1 = both; // expected-error{{reference initialization of type 'Base &' with initializer of type 'ConvertibleToBothDerivedRef' is ambiguous}} } struct IntBitfield { @@ -118,8 +118,8 @@ void bind_const_lvalue_to_rvalue() { const Base &br3 = create<const Base>(); const Base &br4 = create<const Derived>(); - const Base &br5 = create<const volatile Base>(); // expected-error{{binding of reference to type 'struct Base const' to a value of type 'struct Base const volatile' drops qualifiers}} - const Base &br6 = create<const volatile Derived>(); // expected-error{{binding of reference to type 'struct Base const' to a value of type 'struct Derived const volatile' drops qualifiers}} + const Base &br5 = create<const volatile Base>(); // expected-error{{binding of reference to type 'Base const' to a value of type 'Base const volatile' drops qualifiers}} + const Base &br6 = create<const volatile Derived>(); // expected-error{{binding of reference to type 'Base const' to a value of type 'Derived const volatile' drops qualifiers}} const int &ir = create<int>(); } @@ -131,5 +131,5 @@ void bind_const_lvalue_to_class_conv_temporary() { } void bind_lvalue_to_conv_rvalue_ambig(ConvertibleToBothDerived both) { const Derived &dr1 = both; - const Base &br1 = both; // expected-error{{reference initialization of type 'struct Base const &' with initializer of type 'struct ConvertibleToBothDerived' is ambiguous}} + const Base &br1 = both; // expected-error{{reference initialization of type 'Base const &' with initializer of type 'ConvertibleToBothDerived' is ambiguous}} } diff --git a/test/CXX/dcl.decl/dcl.init/p6.cpp b/test/CXX/dcl.decl/dcl.init/p6.cpp index f627a199eca6..c542dac1db1d 100644 --- a/test/CXX/dcl.decl/dcl.init/p6.cpp +++ b/test/CXX/dcl.decl/dcl.init/p6.cpp @@ -5,11 +5,12 @@ // If a program calls for the default initialization of an object of a // const-qualified type T, T shall be a class type with a // user-provided default constructor. -struct NoUserDefault { }; +struct MakeNonPOD { MakeNonPOD(); }; +struct NoUserDefault : public MakeNonPOD { }; struct HasUserDefault { HasUserDefault(); }; void test_const_default_init() { - const NoUserDefault x1; // expected-error{{default initialization of an object of const type 'struct NoUserDefault const' requires a user-provided default constructor}} + const NoUserDefault x1; // expected-error{{default initialization of an object of const type 'NoUserDefault const' requires a user-provided default constructor}} const HasUserDefault x2; const int x3; // expected-error{{default initialization of an object of const type 'int const'}} } diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.mptr/p3.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.mptr/p3.cpp index 561e26b068f4..7e35788d898b 100644 --- a/test/CXX/dcl.decl/dcl.meaning/dcl.mptr/p3.cpp +++ b/test/CXX/dcl.decl/dcl.meaning/dcl.mptr/p3.cpp @@ -16,11 +16,11 @@ void f() { int b; A a(b); - int A::*ip = &A::s; // expected-error {{cannot initialize a variable of type 'int class A::*' with an rvalue of type 'int *'}} + int A::*ip = &A::s; // expected-error {{cannot initialize a variable of type 'int A::*' with an rvalue of type 'int *'}} a.*&A::s = 10; // expected-error{{right hand operand to .* has non pointer-to-member type 'int *'}} a.*&A::i = 10; // expected-error{{cannot form a pointer-to-member to member 'i' of reference type 'int &'}} - ft(a); // expected-note{{in instantiation of function template specialization 'ft<class A>' requested here}} + ft(a); // expected-note{{in instantiation of function template specialization 'ft<A>' requested here}} void A::*p = 0; // expected-error{{'p' declared as a member pointer to void}} } diff --git a/test/CodeCompletion/call.cpp b/test/CodeCompletion/call.cpp index 5467717bbc77..04d2a2f0c981 100644 --- a/test/CodeCompletion/call.cpp +++ b/test/CodeCompletion/call.cpp @@ -18,10 +18,10 @@ void f(); void test() { f(Y(), 0, 0); // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:19:9 %s -o - | FileCheck -check-prefix=CC1 %s - // CHECK-CC1: f(struct N::Y y, <#int ZZ#>) + // CHECK-CC1: f(N::Y y, <#int ZZ#>) // CHECK-CC1-NEXT: f(int i, <#int j#>, int k) // CHECK-CC1-NEXT: f(float x, <#float y#>) // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:19:13 %s -o - | FileCheck -check-prefix=CC2 %s - // CHECK-CC2-NOT: f(struct N::Y y, int ZZ) + // CHECK-CC2-NOT: f(N::Y y, int ZZ) // CHECK-CC2: f(int i, int j, <#int k#>) } diff --git a/test/CodeCompletion/enum-switch-case-qualified.cpp b/test/CodeCompletion/enum-switch-case-qualified.cpp index b9efcb43ed2b..e74ec9b5fe67 100644 --- a/test/CodeCompletion/enum-switch-case-qualified.cpp +++ b/test/CodeCompletion/enum-switch-case-qualified.cpp @@ -22,11 +22,11 @@ void test(enum N::C::Color color) { switch (color) { case // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:23:8 %s -o - | FileCheck -check-prefix=CC1 %s - // CHECK-CC1: Blue : [#enum M::N::C::Color#]N::C::Blue - // CHECK-CC1-NEXT: Green : [#enum M::N::C::Color#]N::C::Green - // CHECK-CC1-NEXT: Indigo : [#enum M::N::C::Color#]N::C::Indigo - // CHECK-CC1-NEXT: Orange : [#enum M::N::C::Color#]N::C::Orange - // CHECK-CC1-NEXT: Red : [#enum M::N::C::Color#]N::C::Red - // CHECK-CC1-NEXT: Violet : [#enum M::N::C::Color#]N::C::Violet - // CHECK-CC1: Yellow : [#enum M::N::C::Color#]N::C::Yellow + // CHECK-CC1: Blue : [#M::N::C::Color#]N::C::Blue + // CHECK-CC1-NEXT: Green : [#M::N::C::Color#]N::C::Green + // CHECK-CC1-NEXT: Indigo : [#M::N::C::Color#]N::C::Indigo + // CHECK-CC1-NEXT: Orange : [#M::N::C::Color#]N::C::Orange + // CHECK-CC1-NEXT: Red : [#M::N::C::Color#]N::C::Red + // CHECK-CC1-NEXT: Violet : [#M::N::C::Color#]N::C::Violet + // CHECK-CC1: Yellow : [#M::N::C::Color#]N::C::Yellow diff --git a/test/CodeCompletion/enum-switch-case.cpp b/test/CodeCompletion/enum-switch-case.cpp index 412f5f2f074d..2677f33f98f2 100644 --- a/test/CodeCompletion/enum-switch-case.cpp +++ b/test/CodeCompletion/enum-switch-case.cpp @@ -20,9 +20,9 @@ void test(enum N::Color color) { case // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:21:8 %s -o - | FileCheck -check-prefix=CC1 %s - // CHECK-CC1: Blue : [#enum N::Color#]N::Blue - // CHECK-CC1-NEXT: Green : [#enum N::Color#]N::Green - // CHECK-CC1-NEXT: Indigo : [#enum N::Color#]N::Indigo - // CHECK-CC1-NEXT: Orange : [#enum N::Color#]N::Orange - // CHECK-CC1-NEXT: Violet : [#enum N::Color#]N::Violet + // CHECK-CC1: Blue : [#N::Color#]N::Blue + // CHECK-CC1-NEXT: Green : [#N::Color#]N::Green + // CHECK-CC1-NEXT: Indigo : [#N::Color#]N::Indigo + // CHECK-CC1-NEXT: Orange : [#N::Color#]N::Orange + // CHECK-CC1-NEXT: Violet : [#N::Color#]N::Violet diff --git a/test/CodeGen/2010-03-09-DbgInfo.c b/test/CodeGen/2010-03-09-DbgInfo.c new file mode 100644 index 000000000000..04ee02e43719 --- /dev/null +++ b/test/CodeGen/2010-03-09-DbgInfo.c @@ -0,0 +1,2 @@ +// RUN: %clang -dA -S -O0 -g %s -o - | grep DW_TAG_variable +unsigned char ctable1[1] = { 0001 }; diff --git a/test/CodeGen/init.c b/test/CodeGen/init.c index f6b35361570a..13ffad173137 100644 --- a/test/CodeGen/init.c +++ b/test/CodeGen/init.c @@ -29,3 +29,14 @@ int f4() { static const int g4 = 12; return g4; } + +// PR6537 +typedef union vec3 { + struct { double x, y, z; }; + double component[3]; +} vec3; +vec3 f5(vec3 value) { + return (vec3) {{ + .x = value.x + }}; +} diff --git a/test/CodeGenCXX/2010-03-09-AnonAggregate.cpp b/test/CodeGenCXX/2010-03-09-AnonAggregate.cpp new file mode 100644 index 000000000000..99883d82636e --- /dev/null +++ b/test/CodeGenCXX/2010-03-09-AnonAggregate.cpp @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -g -S -o %t %s +// PR: 6554 +// More then one anonymous aggregates on one line creates chaos when MDNode uniquness is +// combined with RAUW operation. +// This test case causes crashes if malloc is configured to trip buffer overruns. +class MO { + + union { struct { union { int BA; } Val; int Offset; } OffsetedInfo; } Contents; + +}; + +class MO m; diff --git a/test/CodeGenCXX/PR6474.cpp b/test/CodeGenCXX/PR6474.cpp new file mode 100644 index 000000000000..68c09c9b95d5 --- /dev/null +++ b/test/CodeGenCXX/PR6474.cpp @@ -0,0 +1,31 @@ +// RUN: %clang_cc1 %s -emit-llvm + +namespace test0 { +template <typename T> struct X { + virtual void foo(); + virtual void bar(); + virtual void baz(); +}; + +template <typename T> void X<T>::foo() {} +template <typename T> void X<T>::bar() {} +template <typename T> void X<T>::baz() {} + +template <> void X<char>::foo() {} +template <> void X<char>::bar() {} +} + +namespace test1 { +template <typename T> struct X { + virtual void foo(); + virtual void bar(); + virtual void baz(); +}; + +template <typename T> void X<T>::foo() {} +template <typename T> void X<T>::bar() {} +template <typename T> void X<T>::baz() {} + +template <> void X<char>::bar() {} +template <> void X<char>::foo() {} +} diff --git a/test/CodeGenCXX/default-destructor-nested.cpp b/test/CodeGenCXX/default-destructor-nested.cpp new file mode 100644 index 000000000000..86942743d4e1 --- /dev/null +++ b/test/CodeGenCXX/default-destructor-nested.cpp @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 %s -emit-llvm-only +// PR6294 + +class A { + virtual ~A(); +}; +class B { + class C; +}; +class B::C : public A { + C(); +}; +B::C::C() {} diff --git a/test/CodeGenCXX/internal-linkage.cpp b/test/CodeGenCXX/internal-linkage.cpp index 1ae0f08f86ee..4263891e57f5 100644 --- a/test/CodeGenCXX/internal-linkage.cpp +++ b/test/CodeGenCXX/internal-linkage.cpp @@ -1,11 +1,11 @@ // RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s -struct Global { }; -template<typename T> struct X { }; +struct Global { Global(); }; +template<typename T> struct X { X(); }; namespace { - struct Anon { }; + struct Anon { Anon(); }; // CHECK: @_ZN12_GLOBAL__N_15anon0E = internal global Global anon0; diff --git a/test/CodeGenCXX/mangle-system-header.cpp b/test/CodeGenCXX/mangle-system-header.cpp index cb68bc197600..6716b58926d7 100644 --- a/test/CodeGenCXX/mangle-system-header.cpp +++ b/test/CodeGenCXX/mangle-system-header.cpp @@ -5,3 +5,7 @@ # 1 "fake_system_header.h" 1 3 4 // CHECK: define void @_ZdlPvS_( void operator delete (void*, void*) {} + +// PR6217 +// CHECK: define void @_Z3barv() +void bar() { } diff --git a/test/CodeGenCXX/nullptr.cpp b/test/CodeGenCXX/nullptr.cpp index 31bd47522ed4..ab63b432bdfa 100644 --- a/test/CodeGenCXX/nullptr.cpp +++ b/test/CodeGenCXX/nullptr.cpp @@ -1,7 +1,17 @@ -// RUN: %clang_cc1 -std=c++0x %s -emit-llvm -o %t +// RUN: %clang_cc1 -std=c++0x -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s int* a = nullptr; void f() { int* a = nullptr; } + +typedef decltype(nullptr) nullptr_t; + +nullptr_t get_nullptr(); + +struct X { }; +void g() { + // CHECK: call i8* @_Z11get_nullptrv() + int (X::*pmf)(int) = get_nullptr(); +} diff --git a/test/CodeGenCXX/virtual-base-destructor-call.cpp b/test/CodeGenCXX/virtual-base-destructor-call.cpp index b6e85e208b15..7de9dd2a6085 100644 --- a/test/CodeGenCXX/virtual-base-destructor-call.cpp +++ b/test/CodeGenCXX/virtual-base-destructor-call.cpp @@ -22,6 +22,11 @@ int main() { // CHECK: call void @_ZN14basic_iostreamIcED2Ev // CHECK: call void @_ZN9basic_iosD2Ev +// basic_iostream's base dtor calls its non-virtual base dtor. +// CHECK: define linkonce_odr void @_ZN14basic_iostreamIcED2Ev +// CHECK: call void @_ZN13basic_istreamIcED2Ev +// CHECK: } + // basic_iostream's deleting dtor calls its complete dtor, then // operator delete(). // CHECK: define linkonce_odr void @_ZN14basic_iostreamIcED0Ev @@ -40,11 +45,6 @@ int main() { // CHECK: call void @_ZN13basic_istreamIcED1Ev // CHECK: call void @_ZdlPv -// basic_iostream's base dtor calls its non-virtual base dtor. -// CHECK: define linkonce_odr void @_ZN14basic_iostreamIcED2Ev -// CHECK: call void @_ZN13basic_istreamIcED2Ev -// CHECK: } - // basic_istream's base dtor is a no-op. // CHECK: define linkonce_odr void @_ZN13basic_istreamIcED2Ev // CHECK-NOT: call diff --git a/test/CodeGenCXX/vtable-layout-abi-examples.cpp b/test/CodeGenCXX/vtable-layout-abi-examples.cpp index 2c6b7a48ccfe..a82fca736c79 100644 --- a/test/CodeGenCXX/vtable-layout-abi-examples.cpp +++ b/test/CodeGenCXX/vtable-layout-abi-examples.cpp @@ -187,3 +187,126 @@ struct D : public B, public C { void D::d() { } } + +namespace Test3 { + +// From http://www.codesourcery.com/public/cxx-abi/abi-examples.html#vtable-ctor + +struct V1 { + int v1; + virtual void f(); +}; + +struct V2 : virtual V1 { + int v2; + virtual void f(); +}; + +// CHECK: Vtable for 'Test3::C' (14 entries). +// CHECK-NEXT: 0 | vbase_offset (32) +// CHECK-NEXT: 1 | vbase_offset (16) +// CHECK-NEXT: 2 | offset_to_top (0) +// CHECK-NEXT: 3 | Test3::C RTTI +// CHECK-NEXT: -- (Test3::C, 0) vtable address -- +// CHECK-NEXT: 4 | void Test3::C::f() +// CHECK-NEXT: 5 | vcall_offset (-16) +// CHECK-NEXT: 6 | offset_to_top (-16) +// CHECK-NEXT: 7 | Test3::C RTTI +// CHECK-NEXT: -- (Test3::V1, 16) vtable address -- +// CHECK-NEXT: 8 | void Test3::C::f() +// CHECK-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset] +// CHECK-NEXT: 9 | vcall_offset (-32) +// CHECK-NEXT: 10 | vbase_offset (-16) +// CHECK-NEXT: 11 | offset_to_top (-32) +// CHECK-NEXT: 12 | Test3::C RTTI +// CHECK-NEXT: -- (Test3::V2, 32) vtable address -- +// CHECK-NEXT: 13 | void Test3::C::f() +// CHECK-NEXT: [this adjustment: 0 non-virtual, -32 vcall offset offset] + +// CHECK: Construction vtable for ('Test3::V2', 32) in 'Test3::C' (9 entries). +// CHECK-NEXT: 0 | vcall_offset (0) +// CHECK-NEXT: 1 | vbase_offset (-16) +// CHECK-NEXT: 2 | offset_to_top (0) +// CHECK-NEXT: 3 | Test3::V2 RTTI +// CHECK-NEXT: -- (Test3::V2, 32) vtable address -- +// CHECK-NEXT: 4 | void Test3::V2::f() +// CHECK-NEXT: 5 | vcall_offset (16) +// CHECK-NEXT: 6 | offset_to_top (16) +// CHECK-NEXT: 7 | Test3::V2 RTTI +// CHECK-NEXT: -- (Test3::V1, 16) vtable address -- +// CHECK-NEXT: 8 | void Test3::V2::f() +// CHECK-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset] +struct C : virtual V1, virtual V2 { + int c; + virtual void f(); +}; +void C::f() { } + +struct B { + int b; +}; + +// CHECK: Vtable for 'Test3::D' (15 entries). +// CHECK-NEXT: 0 | vbase_offset (40) +// CHECK-NEXT: 1 | vbase_offset (24) +// CHECK-NEXT: 2 | offset_to_top (0) +// CHECK-NEXT: 3 | Test3::D RTTI +// CHECK-NEXT: -- (Test3::C, 0) vtable address -- +// CHECK-NEXT: -- (Test3::D, 0) vtable address -- +// CHECK-NEXT: 4 | void Test3::C::f() +// CHECK-NEXT: 5 | void Test3::D::g() +// CHECK-NEXT: 6 | vcall_offset (-24) +// CHECK-NEXT: 7 | offset_to_top (-24) +// CHECK-NEXT: 8 | Test3::D RTTI +// CHECK-NEXT: -- (Test3::V1, 24) vtable address -- +// CHECK-NEXT: 9 | void Test3::C::f() +// CHECK-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset] +// CHECK-NEXT: 10 | vcall_offset (-40) +// CHECK-NEXT: 11 | vbase_offset (-16) +// CHECK-NEXT: 12 | offset_to_top (-40) +// CHECK-NEXT: 13 | Test3::D RTTI +// CHECK-NEXT: -- (Test3::V2, 40) vtable address -- +// CHECK-NEXT: 14 | void Test3::C::f() +// CHECK-NEXT: [this adjustment: 0 non-virtual, -32 vcall offset offset] + +// CHECK: Construction vtable for ('Test3::C', 0) in 'Test3::D' (14 entries). +// CHECK-NEXT: 0 | vbase_offset (40) +// CHECK-NEXT: 1 | vbase_offset (24) +// CHECK-NEXT: 2 | offset_to_top (0) +// CHECK-NEXT: 3 | Test3::C RTTI +// CHECK-NEXT: -- (Test3::C, 0) vtable address -- +// CHECK-NEXT: 4 | void Test3::C::f() +// CHECK-NEXT: 5 | vcall_offset (-24) +// CHECK-NEXT: 6 | offset_to_top (-24) +// CHECK-NEXT: 7 | Test3::C RTTI +// CHECK-NEXT: -- (Test3::V1, 24) vtable address -- +// CHECK-NEXT: 8 | void Test3::C::f() +// CHECK-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset] +// CHECK-NEXT: 9 | vcall_offset (-40) +// CHECK-NEXT: 10 | vbase_offset (-16) +// CHECK-NEXT: 11 | offset_to_top (-40) +// CHECK-NEXT: 12 | Test3::C RTTI +// CHECK-NEXT: -- (Test3::V2, 40) vtable address -- +// CHECK-NEXT: 13 | void Test3::C::f() +// CHECK-NEXT: [this adjustment: 0 non-virtual, -32 vcall offset offset] + +// CHECK: Construction vtable for ('Test3::V2', 40) in 'Test3::D' (9 entries). +// CHECK-NEXT: 0 | vcall_offset (0) +// CHECK-NEXT: 1 | vbase_offset (-16) +// CHECK-NEXT: 2 | offset_to_top (0) +// CHECK-NEXT: 3 | Test3::V2 RTTI +// CHECK-NEXT: -- (Test3::V2, 40) vtable address -- +// CHECK-NEXT: 4 | void Test3::V2::f() +// CHECK-NEXT: 5 | vcall_offset (16) +// CHECK-NEXT: 6 | offset_to_top (16) +// CHECK-NEXT: 7 | Test3::V2 RTTI +// CHECK-NEXT: -- (Test3::V1, 24) vtable address -- +// CHECK-NEXT: 8 | void Test3::V2::f() +// CHECK-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset] +struct D : B, C { + int d; + virtual void g(); +}; +void D::g() { } + +} diff --git a/test/CodeGenCXX/vtable-layout.cpp b/test/CodeGenCXX/vtable-layout.cpp index a65af6ed33da..5c783f1f23dc 100644 --- a/test/CodeGenCXX/vtable-layout.cpp +++ b/test/CodeGenCXX/vtable-layout.cpp @@ -1036,3 +1036,58 @@ struct C : A, virtual V, B { void C::g() { } } + +namespace Test26 { + +// Test that we generate the right number of entries in the C-in-D construction vtable, and that +// we don't mark A::a as unused. + +struct A { + virtual void a(); +}; + +struct B { + virtual void c(); +}; + +struct C : virtual A { + virtual void b(); +}; + +// CHECK: Vtable for 'Test26::D' (15 entries). +// CHECK-NEXT: 0 | vbase_offset (8) +// CHECK-NEXT: 1 | vbase_offset (8) +// CHECK-NEXT: 2 | vbase_offset (0) +// CHECK-NEXT: 3 | vcall_offset (0) +// CHECK-NEXT: 4 | offset_to_top (0) +// CHECK-NEXT: 5 | Test26::D RTTI +// CHECK-NEXT: -- (Test26::B, 0) vtable address -- +// CHECK-NEXT: -- (Test26::D, 0) vtable address -- +// CHECK-NEXT: 6 | void Test26::B::c() +// CHECK-NEXT: 7 | void Test26::D::d() +// CHECK-NEXT: 8 | vcall_offset (0) +// CHECK-NEXT: 9 | vbase_offset (0) +// CHECK-NEXT: 10 | vcall_offset (0) +// CHECK-NEXT: 11 | offset_to_top (-8) +// CHECK-NEXT: 12 | Test26::D RTTI +// CHECK-NEXT: -- (Test26::A, 8) vtable address -- +// CHECK-NEXT: -- (Test26::C, 8) vtable address -- +// CHECK-NEXT: 13 | void Test26::A::a() +// CHECK-NEXT: 14 | void Test26::C::b() + +// CHECK: Construction vtable for ('Test26::C', 8) in 'Test26::D' (7 entries). +// CHECK-NEXT: 0 | vcall_offset (0) +// CHECK-NEXT: 1 | vbase_offset (0) +// CHECK-NEXT: 2 | vcall_offset (0) +// CHECK-NEXT: 3 | offset_to_top (0) +// CHECK-NEXT: 4 | Test26::C RTTI +// CHECK-NEXT: -- (Test26::A, 8) vtable address -- +// CHECK-NEXT: -- (Test26::C, 8) vtable address -- +// CHECK-NEXT: 5 | void Test26::A::a() +// CHECK-NEXT: 6 | void Test26::C::b() +class D : virtual B, virtual C { + virtual void d(); +}; +void D::d() { } + +} diff --git a/test/CodeGenObjC/id-isa-codegen.m b/test/CodeGenObjC/id-isa-codegen.m index e893aaa4f3c2..e4f5fd9ab571 100644 --- a/test/CodeGenObjC/id-isa-codegen.m +++ b/test/CodeGenObjC/id-isa-codegen.m @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -emit-llvm -o - %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck -check-prefix LP64 %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -o - %s | FileCheck -check-prefix LP32 %s typedef struct objc_class *Class; @@ -63,4 +64,10 @@ id Test2() { ((id)cat)->isa = dynamicSubclass; } @end +// CHECK-LP64: %{{.*}} = load i8** % +// CHECK-NEXT: %{{.*}} = bitcast i8* %{{.*}} to i8** +// CHECK-NEXT: store i8* %{{.*}}, i8** %{{.*}} +// CHECK-LP32: %{{.*}} = load i8** % +// CHECK-NEXT: %{{.*}} = bitcast i8* %{{.*}} to i8** +// CHECK-NEXT: store i8* %{{.*}}, i8** %{{.*}} diff --git a/test/Driver/clang-g-opts.c b/test/Driver/clang-g-opts.c new file mode 100644 index 000000000000..4dbdf6167734 --- /dev/null +++ b/test/Driver/clang-g-opts.c @@ -0,0 +1,5 @@ +// RUN: %clang -S -v -o %t %s 2>&1 | not grep -w -- -g +// RUN: %clang -S -v -o %t %s -g 2>&1 | grep -w -- -g +// RUN: %clang -S -v -o %t %s -g0 2>&1 | not grep -w -- -g +// RUN: %clang -S -v -o %t %s -g -g0 2>&1 | not grep -w -- -g +// RUN: %clang -S -v -o %t %s -g0 -g 2>&1 | grep -w -- -g diff --git a/test/FixIt/typo.cpp b/test/FixIt/typo.cpp index c0570258c53b..efc9ba890c6f 100644 --- a/test/FixIt/typo.cpp +++ b/test/FixIt/typo.cpp @@ -31,12 +31,12 @@ bool test_string(std::string s) { std::basic_sting<char> b2; // expected-error{{no template named 'basic_sting' in namespace 'std'; did you mean 'basic_string'?}} (void)b1; (void)b2; - return s.fnd("hello") // expected-error{{no member named 'fnd' in 'class std::basic_string<char>'; did you mean 'find'?}} - == std::string::pos; // expected-error{{no member named 'pos' in 'class std::basic_string<char>'; did you mean 'npos'?}} + return s.fnd("hello") // expected-error{{no member named 'fnd' in 'std::basic_string<char>'; did you mean 'find'?}} + == std::string::pos; // expected-error{{no member named 'pos' in 'std::basic_string<char>'; did you mean 'npos'?}} } struct Base { }; -struct Derived : public Base { // expected-note{{base class 'struct Base' specified here}} +struct Derived : public Base { // expected-note{{base class 'Base' specified here}} int member; // expected-note 3{{'member' declared here}} Derived() : base(), // expected-error{{initializer 'base' does not name a non-static data member or base class; did you mean the base class 'Base'?}} diff --git a/test/Headers/typedef_guards.c b/test/Headers/typedef_guards.c new file mode 100644 index 000000000000..1aa667bb7e04 --- /dev/null +++ b/test/Headers/typedef_guards.c @@ -0,0 +1,28 @@ +// RUN: %clang -fsyntax-only -verify %s + +// NULL is rdefined in stddef.h +#define NULL ((void*) 0) + +// These are headers bundled with Clang. +#include <stdarg.h> +#include <stddef.h> + +#ifndef _VA_LIST +typedef __builtin_va_list va_list; +#endif + +#ifndef _SIZE_T +typedef __typeof__(sizeof(int)) size_t; +#endif + +#ifndef _WCHAR_T +typedef __typeof__(*L"") wchar_t; +#endif + +extern void foo(wchar_t x); +extern void bar(size_t x); +void *baz() { return NULL; } +void quz() { + va_list y; +} + diff --git a/test/Index/annotate-tokens.m b/test/Index/annotate-tokens.m new file mode 100644 index 000000000000..1badeb20be79 --- /dev/null +++ b/test/Index/annotate-tokens.m @@ -0,0 +1,49 @@ +@interface Foo +- (int)compare:(Foo*)other; +@end + +@implementation Foo +- (int)compare:(Foo*)other { + return 0; +} +@end + +// RUN: c-index-test -test-annotate-tokens=%s:1:1:9:5 %s | FileCheck %s +// CHECK: Punctuation: "@" [1:1 - 1:2] +// CHECK: Identifier: "interface" [1:2 - 1:11] +// CHECK: Identifier: "Foo" [1:12 - 1:15] ObjCInterfaceDecl=Foo:1:12 +// CHECK: Punctuation: "-" [2:1 - 2:2] ObjCInstanceMethodDecl=compare::2:1 +// CHECK: Punctuation: "(" [2:3 - 2:4] +// CHECK: Keyword: "int" [2:4 - 2:7] +// CHECK: Punctuation: ")" [2:7 - 2:8] +// CHECK: Identifier: "compare" [2:8 - 2:15] +// CHECK: Punctuation: ":" [2:15 - 2:16] +// CHECK: Punctuation: "(" [2:16 - 2:17] +// CHECK: Identifier: "Foo" [2:17 - 2:20] ObjCClassRef=Foo:1:12 +// CHECK: Punctuation: "*" [2:20 - 2:21] +// CHECK: Punctuation: ")" [2:21 - 2:22] +// CHECK: Identifier: "other" [2:22 - 2:27] ParmDecl=other:2:22 (Definition) +// CHECK: Punctuation: ";" [2:27 - 2:28] +// CHECK: Punctuation: "@" [3:1 - 3:2] +// CHECK: Identifier: "end" [3:2 - 3:5] +// CHECK: Punctuation: "@" [5:1 - 5:2] ObjCImplementationDecl=Foo:5:1 (Definition) +// CHECK: Identifier: "implementation" [5:2 - 5:16] +// CHECK: Identifier: "Foo" [5:17 - 5:20] +// CHECK: Punctuation: "-" [6:1 - 6:2] ObjCInstanceMethodDecl=compare::6:1 (Definition) +// CHECK: Punctuation: "(" [6:3 - 6:4] +// CHECK: Keyword: "int" [6:4 - 6:7] +// CHECK: Punctuation: ")" [6:7 - 6:8] +// CHECK: Identifier: "compare" [6:8 - 6:15] +// CHECK: Punctuation: ":" [6:15 - 6:16] +// CHECK: Punctuation: "(" [6:16 - 6:17] +// CHECK: Identifier: "Foo" [6:17 - 6:20] ObjCClassRef=Foo:1:12 +// CHECK: Punctuation: "*" [6:20 - 6:21] +// CHECK: Punctuation: ")" [6:21 - 6:22] +// CHECK: Identifier: "other" [6:22 - 6:27] ParmDecl=other:6:22 (Definition) +// CHECK: Punctuation: "{" [6:28 - 6:29] +// CHECK: Keyword: "return" [7:3 - 7:9] +// CHECK: Literal: "0" [7:10 - 7:11] +// CHECK: Punctuation: ";" [7:11 - 7:12] +// CHECK: Punctuation: "}" [8:1 - 8:2] +// CHECK: Punctuation: "@" [9:1 - 9:2] +// CHECK: Identifier: "end" [9:2 - 9:5] diff --git a/test/Index/c-index-getCursor-test.m b/test/Index/c-index-getCursor-test.m index 6a17e1c8417a..8341b80a673f 100644 --- a/test/Index/c-index-getCursor-test.m +++ b/test/Index/c-index-getCursor-test.m @@ -90,7 +90,9 @@ int main (int argc, const char * argv[]) { // CHECK: [31:27 - 33:9] ObjCInterfaceDecl=Baz:31:12 // CHECK: [33:9 - 33:16] ObjCIvarDecl=_anIVar:33:9 (Definition) // CHECK: [33:16 - 36:1] ObjCInterfaceDecl=Baz:31:12 -// CHECK: [36:1 - 36:21] ObjCInstanceMethodDecl=bazMethod:36:1 +// CHECK: [36:1 - 36:4] ObjCInstanceMethodDecl=bazMethod:36:1 +// CHECK: [36:4 - 36:7] ObjCClassRef=Foo:3:12 +// CHECK: [36:7 - 36:21] ObjCInstanceMethodDecl=bazMethod:36:1 // CHECK: [36:21 - 38:5] ObjCInterfaceDecl=Baz:31:12 // CHECK: [38:5 - 40:1] Invalid Cursor => NoDeclFound // CHECK: [40:1 - 41:3] EnumDecl=:40:1 (Definition) @@ -118,7 +120,9 @@ int main (int argc, const char * argv[]) { // CHECK: [47:4 - 47:6] VarDecl=c:47:12 (Definition) // CHECK: [47:6 - 47:10] ObjCProtocolRef=SubP:27:1 // CHECK: [47:10 - 47:16] VarDecl=c:47:12 (Definition) -// CHECK: [47:16 - 47:26] ObjCMessageExpr=fooC:8:1 +// CHECK: [47:16 - 47:17] ObjCMessageExpr=fooC:8:1 +// CHECK: [47:17 - 47:20] ObjCClassRef=Foo:3:12 +// CHECK: [47:20 - 47:26] ObjCMessageExpr=fooC:8:1 // CHECK: [47:26 - 47:27] UnexposedStmt= // CHECK: [47:27 - 48:2] UnexposedStmt= // CHECK: [48:2 - 48:4] TypeRef=id:0:0 diff --git a/test/Index/code-completion.cpp b/test/Index/code-completion.cpp index 7fd4376735a0..670b13f6344b 100644 --- a/test/Index/code-completion.cpp +++ b/test/Index/code-completion.cpp @@ -38,10 +38,10 @@ void test_overloaded() { // CHECK-MEMBER: FieldDecl:{ResultType float}{Text Y::}{TypedText member} // CHECK-MEMBER: FunctionDecl:{ResultType void}{Informative Y::}{TypedText memfunc}{LeftParen (}{Optional {Placeholder int i}}{RightParen )} // CHECK-MEMBER: FunctionDecl:{ResultType int}{TypedText operator int}{LeftParen (}{RightParen )}{Informative const} -// CHECK-MEMBER: FunctionDecl:{ResultType struct Z &}{TypedText operator=}{LeftParen (}{Placeholder struct Z const &}{RightParen )} -// CHECK-MEMBER: FunctionDecl:{ResultType struct X &}{Text X::}{TypedText operator=}{LeftParen (}{Placeholder struct X const &}{RightParen )} -// CHECK-MEMBER: FunctionDecl:{ResultType struct Y &}{Text Y::}{TypedText operator=}{LeftParen (}{Placeholder struct Y const &}{RightParen )} -// CHECK-MEMBER: EnumConstantDecl:{ResultType enum X::E}{Informative E::}{TypedText Val1} +// CHECK-MEMBER: FunctionDecl:{ResultType Z &}{TypedText operator=}{LeftParen (}{Placeholder Z const &}{RightParen )} +// CHECK-MEMBER: FunctionDecl:{ResultType X &}{Text X::}{TypedText operator=}{LeftParen (}{Placeholder X const &}{RightParen )} +// CHECK-MEMBER: FunctionDecl:{ResultType Y &}{Text Y::}{TypedText operator=}{LeftParen (}{Placeholder Y const &}{RightParen )} +// CHECK-MEMBER: EnumConstantDecl:{ResultType X::E}{Informative E::}{TypedText Val1} // CHECK-MEMBER: StructDecl:{TypedText X}{Text ::} // CHECK-MEMBER: StructDecl:{TypedText Y}{Text ::} // CHECK-MEMBER: StructDecl:{TypedText Z}{Text ::} @@ -49,6 +49,6 @@ void test_overloaded() { // CHECK-MEMBER: FunctionDecl:{ResultType void}{Informative Y::}{TypedText ~Y}{LeftParen (}{RightParen )} // CHECK-MEMBER: FunctionDecl:{ResultType void}{TypedText ~Z}{LeftParen (}{RightParen )} -// CHECK-OVERLOAD: NotImplemented:{ResultType int &}{Text overloaded}{LeftParen (}{Text struct Z z}{Comma , }{CurrentParameter int second}{RightParen )} +// CHECK-OVERLOAD: NotImplemented:{ResultType int &}{Text overloaded}{LeftParen (}{Text Z z}{Comma , }{CurrentParameter int second}{RightParen )} // CHECK-OVERLOAD: NotImplemented:{ResultType float &}{Text overloaded}{LeftParen (}{Text int i}{Comma , }{CurrentParameter long second}{RightParen )} // CHECK-OVERLOAD: NotImplemented:{ResultType double &}{Text overloaded}{LeftParen (}{Text float f}{Comma , }{CurrentParameter int second}{RightParen )} diff --git a/test/Parser/altivec.c b/test/Parser/altivec.c index 99544ea5c103..c2a32cfa390e 100644 --- a/test/Parser/altivec.c +++ b/test/Parser/altivec.c @@ -41,28 +41,28 @@ void f_a(vector int a); void f_a2(int b, vector int a); // These should have warnings. -__vector long vv_l; // expected-warning {{Use of "long" with "__vector" is deprecated}} -__vector signed long vv_sl; // expected-warning {{Use of "long" with "__vector" is deprecated}} -__vector unsigned long vv_ul; // expected-warning {{Use of "long" with "__vector" is deprecated}} -__vector long int vv_li; // expected-warning {{Use of "long" with "__vector" is deprecated}} -__vector signed long int vv_sli; // expected-warning {{Use of "long" with "__vector" is deprecated}} -__vector unsigned long int vv_uli; // expected-warning {{Use of "long" with "__vector" is deprecated}} -vector long v_l; // expected-warning {{Use of "long" with "__vector" is deprecated}} -vector signed long v_sl; // expected-warning {{Use of "long" with "__vector" is deprecated}} -vector unsigned long v_ul; // expected-warning {{Use of "long" with "__vector" is deprecated}} -vector long int v_li; // expected-warning {{Use of "long" with "__vector" is deprecated}} -vector signed long int v_sli; // expected-warning {{Use of "long" with "__vector" is deprecated}} -vector unsigned long int v_uli; // expected-warning {{Use of "long" with "__vector" is deprecated}} -__vector long double vv_ld; // expected-warning {{Use of "long" with "__vector" is deprecated}} expected-error {{cannot use "double" with "__vector"}} -vector long double v_ld; // expected-warning {{Use of "long" with "__vector" is deprecated}} expected-error {{cannot use "double" with "__vector"}} +__vector long vv_l; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +__vector signed long vv_sl; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +__vector unsigned long vv_ul; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +__vector long int vv_li; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +__vector signed long int vv_sli; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +__vector unsigned long int vv_uli; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +vector long v_l; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +vector signed long v_sl; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +vector unsigned long v_ul; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +vector long int v_li; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +vector signed long int v_sli; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +vector unsigned long int v_uli; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +__vector long double vv_ld; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}} +vector long double v_ld; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}} // These should have errors. -__vector double vv_d; // expected-error {{cannot use "double" with "__vector"}} -__vector double vv_d; // expected-error {{cannot use "double" with "__vector"}} -vector double v_d; // expected-error {{cannot use "double" with "__vector"}} -vector double v_d; // expected-error {{cannot use "double" with "__vector"}} -__vector long double vv_ld; // expected-warning {{Use of "long" with "__vector" is deprecated}} expected-error {{cannot use "double" with "__vector"}} -vector long double v_ld; // expected-warning {{Use of "long" with "__vector" is deprecated}} expected-error {{cannot use "double" with "__vector"}} +__vector double vv_d; // expected-error {{cannot use 'double' with '__vector'}} +__vector double vv_d; // expected-error {{cannot use 'double' with '__vector'}} +vector double v_d; // expected-error {{cannot use 'double' with '__vector'}} +vector double v_d; // expected-error {{cannot use 'double' with '__vector'}} +__vector long double vv_ld; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}} +vector long double v_ld; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}} void f() { __vector unsigned int v = {0,0,0,0}; diff --git a/test/Parser/cxx-altivec.cpp b/test/Parser/cxx-altivec.cpp index a26eee4ef487..3610c0e04930 100644 --- a/test/Parser/cxx-altivec.cpp +++ b/test/Parser/cxx-altivec.cpp @@ -43,26 +43,26 @@ void f_a(vector int a); void f_a2(int b, vector int a); // These should have warnings. -__vector long vv_l; // expected-warning {{Use of "long" with "__vector" is deprecated}} -__vector signed long vv_sl; // expected-warning {{Use of "long" with "__vector" is deprecated}} -__vector unsigned long vv_ul; // expected-warning {{Use of "long" with "__vector" is deprecated}} -__vector long int vv_li; // expected-warning {{Use of "long" with "__vector" is deprecated}} -__vector signed long int vv_sli; // expected-warning {{Use of "long" with "__vector" is deprecated}} -__vector unsigned long int vv_uli; // expected-warning {{Use of "long" with "__vector" is deprecated}} -vector long v_l; // expected-warning {{Use of "long" with "__vector" is deprecated}} -vector signed long v_sl; // expected-warning {{Use of "long" with "__vector" is deprecated}} -vector unsigned long v_ul; // expected-warning {{Use of "long" with "__vector" is deprecated}} -vector long int v_li; // expected-warning {{Use of "long" with "__vector" is deprecated}} -vector signed long int v_sli; // expected-warning {{Use of "long" with "__vector" is deprecated}} -vector unsigned long int v_uli; // expected-warning {{Use of "long" with "__vector" is deprecated}} -__vector long double vv_ld; // expected-warning {{Use of "long" with "__vector" is deprecated}} expected-error {{cannot use "double" with "__vector"}} -vector long double v_ld; // expected-warning {{Use of "long" with "__vector" is deprecated}} expected-error {{cannot use "double" with "__vector"}} +__vector long vv_l; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +__vector signed long vv_sl; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +__vector unsigned long vv_ul; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +__vector long int vv_li; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +__vector signed long int vv_sli; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +__vector unsigned long int vv_uli; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +vector long v_l; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +vector signed long v_sl; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +vector unsigned long v_ul; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +vector long int v_li; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +vector signed long int v_sli; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +vector unsigned long int v_uli; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +__vector long double vv_ld; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}} +vector long double v_ld; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}} // These should have errors. -__vector double vv_d1; // expected-error {{cannot use "double" with "__vector"}} -vector double v_d2; // expected-error {{cannot use "double" with "__vector"}} -__vector long double vv_ld3; // expected-warning {{Use of "long" with "__vector" is deprecated}} expected-error {{cannot use "double" with "__vector"}} -vector long double v_ld4; // expected-warning {{Use of "long" with "__vector" is deprecated}} expected-error {{cannot use "double" with "__vector"}} +__vector double vv_d1; // expected-error {{cannot use 'double' with '__vector'}} +vector double v_d2; // expected-error {{cannot use 'double' with '__vector'}} +__vector long double vv_ld3; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}} +vector long double v_ld4; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}} void f() { __vector unsigned int v = {0,0,0,0}; diff --git a/test/Sema/warn-missing-braces.c b/test/Sema/warn-missing-braces.c new file mode 100644 index 000000000000..07eb61aac003 --- /dev/null +++ b/test/Sema/warn-missing-braces.c @@ -0,0 +1,3 @@ +// RUN: %clang_cc1 -fsyntax-only -Wmissing-braces -verify %s + +int a[2][2] = { 0, 1, 2, 3 }; // expected-warning{{suggest braces}} expected-warning{{suggest braces}}
\ No newline at end of file diff --git a/test/SemaCXX/access-base-class.cpp b/test/SemaCXX/access-base-class.cpp index d0b0fb8ee223..eeb5f1c86fc3 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 783d4def5327..1db6704909df 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 83f4179d9136..708a8f256a3d 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 5e0a2e3766f8..7f676748740c 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 fd1ec0120a71..29b23edad3a1 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 9924d1bc5707..8fbf50c26ec1 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 b1b0b98b3c06..f736394a4caa 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 074e1330403d..d68e789c370f 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 67bc43c2e80b..1c6e79012ea5 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 b961ff2de910..4fcb0bb98dc0 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 220e6faeee3c..50bd3162780b 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 2efb7b9c2145..96dfa8ba5269 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 2338778ebaac..862ae5ae02bb 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 4fef172bd5a1..bca75c0b2fb5 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 4b5002e44a01..4cd22e90c0e0 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 d7eb5cf1e60d..8cdb1be48763 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 2cf878a84411..3a63be0970de 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 dbb1e4a18a2e..6a28f4c2c875 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 461c60b5bbc1..8b2866344462 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 2f7d8a4c77ef..7ae043925214 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 906e868a4282..0aa49b0cec90 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 9c99ad594458..baae03cf1347 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 4269991adecf..b40b133a5541 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 e674260680fc..a0999c0c4c62 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 d9df1bf5b05a..b3e129600421 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 cfcad7989aa2..9216e5b03798 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 ab3c809e00a8..7010d2e0d092 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 6601a3dd0d92..d30642b5c3ec 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 53d0b9d0189c..b73e8c57b9f3 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 8d2d67f705cd..3cd3a1bc2241 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 291b359dfdc4..782cf838569f 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 924b48aad26f..2ed4bfe88562 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 0bef0cd6be4c..4e0486c79ac2 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 be5f91d51ac8..3fb0b93fc4f6 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 1bb5adbb861f..cb245011a873 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 5bdaf829e64e..d627c33d8352 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 aabed2bff9e7..a926c812514c 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 94296e1132f1..01491693deac 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 d6050cd7337a..92ae92d710ce 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 9ec17f7b9933..529ba1023dcd 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 247e91b2eb39..8657c0dca0ae 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 68323d8d0756..ae77e704f501 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 f3dc52df4977..3283270847fd 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 77e0908ef46d..c286028c29af 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 77d9965ab796..8016b116812f 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 e07afe202031..89f181469fdf 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 00dc662d0670..54d41b81cab6 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 a187d4908cd4..abde62efceae 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 86c10888b8a2..c8b5746a39a6 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 976879ecd0ae..8844162052d9 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 df8337bec82c..f1f4ab9f9541 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 f7ab80e67fd0..45d41e84601a 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 2a7fb25c62a9..d5b465f0786e 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 852086ed9a94..0e27f4645af4 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 62208cd2aeeb..516243ec70e1 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 11bf22dfe899..6d76f813f8d9 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 4818b041ad08..2630278d9f6b 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 0ef6917c5911..f95982157900 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 0d8dc8487bf7..c382539e05f1 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 7960cac78310..0e78ff46a65c 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 084a81104d55..5f8d8caae698 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 8f2876ce4b32..5148ed5bcc71 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 d6a86c4c8cb5..16a7a1d0c9b9 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 5f95446d41f2..d31f1f7196aa 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 6ee619ef0647..4bb580843973 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 2e21fb7365e9..97164d93affc 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 09cbfadf9b37..688713582657 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 35b32b26a066..2634202172a2 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 { diff --git a/test/SemaObjC/blocks.m b/test/SemaObjC/blocks.m index 36292309732b..ddac7d1759ec 100644 --- a/test/SemaObjC/blocks.m +++ b/test/SemaObjC/blocks.m @@ -55,3 +55,15 @@ int foo9() { } } + +// rdar 7725203 +@class NSString; + +extern void NSLog(NSString *format, ...) __attribute__((format(__NSString__, 1, 2))); + +void foo10() { + void(^myBlock)(void) = ^{ + }; + NSLog(@"%@", myBlock); +} + diff --git a/test/SemaObjC/exprs.m b/test/SemaObjC/exprs.m index 33b144461f2b..3370bda0517a 100644 --- a/test/SemaObjC/exprs.m +++ b/test/SemaObjC/exprs.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -fsyntax-only -verify -Wno-unreachable-code +// RUN: %clang_cc1 %s -fsyntax-only -fblocks -verify -Wno-unreachable-code // rdar://6597252 Class test1(Class X) { @@ -19,3 +19,6 @@ void test2() { if (@encode(int) == "foo") { } // expected-warning {{result of comparison against @encode is unspecified}} } + +#define MAX(A,B) ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; }) +void (^foo)(int, int) = ^(int x, int y) { int z = MAX(x, y); }; diff --git a/test/SemaObjCXX/cstyle-cast.mm b/test/SemaObjCXX/cstyle-cast.mm index 4a211e319704..c4b176c975ee 100644 --- a/test/SemaObjCXX/cstyle-cast.mm +++ b/test/SemaObjCXX/cstyle-cast.mm @@ -18,7 +18,7 @@ void test1(X x) { I<P> *ip = (I<P>*)cft; - (id)x; // expected-error {{C-style cast from 'struct X' to 'id' is not allowed}} + (id)x; // expected-error {{C-style cast from 'X' to 'id' is not allowed}} id *pid = (id*)ccct; diff --git a/test/SemaObjCXX/vararg-non-pod.mm b/test/SemaObjCXX/vararg-non-pod.mm index 6ced8e426bc5..7e5c4c6c97a0 100644 --- a/test/SemaObjCXX/vararg-non-pod.mm +++ b/test/SemaObjCXX/vararg-non-pod.mm @@ -17,7 +17,7 @@ void t1(D *d) { C c(10); - [d g:10, c]; // expected-warning{{cannot pass object of non-POD type 'class C' through variadic method; call will abort at runtime}} + [d g:10, c]; // expected-warning{{cannot pass object of non-POD type 'C' through variadic method; call will abort at runtime}} [d g:10, version]; } diff --git a/test/SemaTemplate/class-template-id-2.cpp b/test/SemaTemplate/class-template-id-2.cpp index c492a365880c..d09f52476b31 100644 --- a/test/SemaTemplate/class-template-id-2.cpp +++ b/test/SemaTemplate/class-template-id-2.cpp @@ -4,7 +4,7 @@ namespace N { template<> class A<int> { }; - template<> class A<float>; // expected-note{{forward declaration of 'class N::A<float>'}} + template<> class A<float>; // expected-note{{forward declaration of 'N::A<float>'}} class B : public A<int> { }; } diff --git a/test/SemaTemplate/class-template-spec.cpp b/test/SemaTemplate/class-template-spec.cpp index efb00c7f3d25..c65802e5c869 100644 --- a/test/SemaTemplate/class-template-spec.cpp +++ b/test/SemaTemplate/class-template-spec.cpp @@ -20,7 +20,7 @@ int test_incomplete_specs(A<double, double> *a1, A<double> *a2) { (void)a1->x; // expected-error{{member access into incomplete type}} - (void)a2->x; // expected-error{{implicit instantiation of undefined template 'struct A<double, int>'}} + (void)a2->x; // expected-error{{implicit instantiation of undefined template 'A<double, int>'}} } typedef float FLOAT; diff --git a/test/SemaTemplate/default-expr-arguments.cpp b/test/SemaTemplate/default-expr-arguments.cpp index 3da43fa67502..d2cc45b0352b 100644 --- a/test/SemaTemplate/default-expr-arguments.cpp +++ b/test/SemaTemplate/default-expr-arguments.cpp @@ -11,17 +11,17 @@ template<typename T> void f1(T a, T b = 10) { } // expected-error{{no viable con template<typename T> void f2(T a, T b = T()) { } -template<typename T> void f3(T a, T b = T() + T()); // expected-error{{invalid operands to binary expression ('struct S' and 'struct S')}} +template<typename T> void f3(T a, T b = T() + T()); // expected-error{{invalid operands to binary expression ('S' and 'S')}} void g() { f1(10); - f1(S()); // expected-note{{in instantiation of default function argument expression for 'f1<struct S>' required here}} + f1(S()); // expected-note{{in instantiation of default function argument expression for 'f1<S>' required here}} f2(10); f2(S()); f3(10); - f3(S()); // expected-note{{in instantiation of default function argument expression for 'f3<struct S>' required here}} + f3(S()); // expected-note{{in instantiation of default function argument expression for 'f3<S>' required here}} } template<typename T> struct F { @@ -38,10 +38,10 @@ void g2() { void g3(F<int> f, F<struct S> s) { f.f(); - s.f(); // expected-note{{in instantiation of default function argument expression for 'f<struct S>' required here}} + s.f(); // expected-note{{in instantiation of default function argument expression for 'f<S>' required here}} F<int> f2; - F<S> s2; // expected-note{{in instantiation of default function argument expression for 'F<struct S>' required here}} + F<S> s2; // expected-note{{in instantiation of default function argument expression for 'F<S>' required here}} } template<typename T> struct G { diff --git a/test/SemaTemplate/dependent-base-classes.cpp b/test/SemaTemplate/dependent-base-classes.cpp index 08d4de542c6d..600115b56530 100644 --- a/test/SemaTemplate/dependent-base-classes.cpp +++ b/test/SemaTemplate/dependent-base-classes.cpp @@ -32,7 +32,7 @@ namespace PR6031 { template <class TT> struct FI2 { - C<typename FI2::type> a; // expected-error{{no type named 'type' in 'struct PR6031::FI2'}} \ + C<typename FI2::type> a; // expected-error{{no type named 'type' in 'FI2<TT>'}} \ // expected-error{{C++ requires a type specifier for all declarations}} }; @@ -58,7 +58,7 @@ namespace PR6031 { class NoDepBase::Nested nested; // expected-error{{'Nested' does not name a tag member in the specified scope}} typedef typename NoDepBase::template MemberTemplate<T>::type type; // expected-error{{'MemberTemplate' following the 'template' keyword does not refer to a template}} \ // FIXME: expected-error{{unqualified-id}} - return NoDepBase::a; // expected-error{{no member named 'a' in 'struct PR6031::NoDepBase'}} + return NoDepBase::a; // expected-error{{no member named 'a' in 'NoDepBase<T>'}} } }; } diff --git a/test/SemaTemplate/ext-vector-type.cpp b/test/SemaTemplate/ext-vector-type.cpp index 0e2debf22b99..3973102b92e7 100644 --- a/test/SemaTemplate/ext-vector-type.cpp +++ b/test/SemaTemplate/ext-vector-type.cpp @@ -20,7 +20,7 @@ int test_make2() { template<typename T, unsigned Length> struct make3 { - typedef T __attribute__((ext_vector_type(Length))) type; // expected-error{{invalid vector type 'struct s'}} + typedef T __attribute__((ext_vector_type(Length))) type; // expected-error{{invalid vector type 's'}} }; struct s {}; diff --git a/test/SemaTemplate/injected-class-name.cpp b/test/SemaTemplate/injected-class-name.cpp index 482eae14ba59..586be189b0ab 100644 --- a/test/SemaTemplate/injected-class-name.cpp +++ b/test/SemaTemplate/injected-class-name.cpp @@ -42,3 +42,9 @@ struct X1 { void f0(const X1<T, N>&); // expected-error{{redecl}} }; +namespace pr6326 { + template <class T> class A { + friend class A; + }; + template class A<int>; +} diff --git a/test/SemaTemplate/instantiate-cast.cpp b/test/SemaTemplate/instantiate-cast.cpp index 97d3dc30c56c..9669b2035a1f 100644 --- a/test/SemaTemplate/instantiate-cast.cpp +++ b/test/SemaTemplate/instantiate-cast.cpp @@ -23,7 +23,7 @@ struct Constructible { template<typename T, typename U> struct CStyleCast0 { void f(T t) { - (void)((U)t); // expected-error{{C-style cast from 'struct A' to 'int'}} + (void)((U)t); // expected-error{{C-style cast from 'A' to 'int' is not allowed}} } }; @@ -36,7 +36,7 @@ template struct CStyleCast0<A, int>; // expected-note{{instantiation}} template<typename T, typename U> struct StaticCast0 { void f(T t) { - (void)static_cast<U>(t); // expected-error{{static_cast from 'int' to 'struct A' is not allowed}} + (void)static_cast<U>(t); // expected-error{{static_cast from 'int' to 'A' is not allowed}} } }; @@ -89,7 +89,7 @@ template struct ConstCast0<int const *, float *>; // expected-note{{instantiatio template<typename T, typename U> struct FunctionalCast1 { void f(T t) { - (void)U(t); // expected-error{{functional-style cast from 'struct A' to 'int'}} + (void)U(t); // expected-error{{functional-style cast from 'A' to 'int' is not allowed}} } }; diff --git a/test/SemaTemplate/instantiate-complete.cpp b/test/SemaTemplate/instantiate-complete.cpp index 0ae13b972829..82cc320fd3c4 100644 --- a/test/SemaTemplate/instantiate-complete.cpp +++ b/test/SemaTemplate/instantiate-complete.cpp @@ -17,12 +17,12 @@ struct X { X<int> f() { return 0; } struct XField { - X<float(int)> xf; // expected-note{{in instantiation of template class 'struct X<float (int)>' requested here}} + X<float(int)> xf; // expected-note{{in instantiation of template class 'X<float (int)>' requested here}} }; void test_subscript(X<double> *ptr1, X<int(int)> *ptr2, int i) { (void)ptr1[i]; - (void)ptr2[i]; // expected-note{{in instantiation of template class 'struct X<int (int)>' requested here}} + (void)ptr2[i]; // expected-note{{in instantiation of template class 'X<int (int)>' requested here}} } void test_arith(X<signed char> *ptr1, X<unsigned char> *ptr2, @@ -30,13 +30,13 @@ void test_arith(X<signed char> *ptr1, X<unsigned char> *ptr2, (void)(ptr1 + 5); // FIXME: if I drop the ')' after void, below, it still parses (!) (void)(5 + ptr2); - (void)(ptr3 + 5); // expected-note{{in instantiation of template class 'struct X<char (char)>' requested here}} - (void)(5 + ptr4); // expected-note{{in instantiation of template class 'struct X<short (short)>' requested here}} + (void)(ptr3 + 5); // expected-note{{in instantiation of template class 'X<char (char)>' requested here}} + (void)(5 + ptr4); // expected-note{{in instantiation of template class 'X<short (short)>' requested here}} } void test_new() { (void)new X<float>(0); - (void)new X<float(float)>; // expected-note{{in instantiation of template class 'struct X<float (float)>' requested here}} + (void)new X<float(float)>; // expected-note{{in instantiation of template class 'X<float (float)>' requested here}} } void test_memptr(X<long> *p1, long X<long>::*pm1, diff --git a/test/SemaTemplate/instantiate-exception-spec.cpp b/test/SemaTemplate/instantiate-exception-spec.cpp index c418fe16e87f..d4f12df22ec2 100644 --- a/test/SemaTemplate/instantiate-exception-spec.cpp +++ b/test/SemaTemplate/instantiate-exception-spec.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s // FIXME: the "note" should be down at the call site! -template<typename T> void f1(T*) throw(T); // expected-error{{incomplete type 'struct Incomplete' is not allowed in exception specification}} \ +template<typename T> void f1(T*) throw(T); // expected-error{{incomplete type 'Incomplete' is not allowed in exception specification}} \ // expected-note{{instantiation of}} struct Incomplete; // expected-note{{forward}} diff --git a/test/SemaTemplate/instantiate-expr-1.cpp b/test/SemaTemplate/instantiate-expr-1.cpp index 37145b63b616..7af59fd2d11b 100644 --- a/test/SemaTemplate/instantiate-expr-1.cpp +++ b/test/SemaTemplate/instantiate-expr-1.cpp @@ -7,7 +7,7 @@ struct Bitfields { void test_Bitfields(Bitfields<0, 5> *b) { (void)sizeof(Bitfields<10, 5>); - (void)sizeof(Bitfields<0, 1>); // expected-note{{in instantiation of template class 'struct Bitfields<0, 1>' requested here}} + (void)sizeof(Bitfields<0, 1>); // expected-note{{in instantiation of template class 'Bitfields<0, 1>' requested here}} } template<int I, int J> @@ -17,7 +17,7 @@ struct BitfieldPlus { void test_BitfieldPlus() { (void)sizeof(BitfieldPlus<0, 1>); - (void)sizeof(BitfieldPlus<-5, 5>); // expected-note{{in instantiation of template class 'struct BitfieldPlus<-5, 5>' requested here}} + (void)sizeof(BitfieldPlus<-5, 5>); // expected-note{{in instantiation of template class 'BitfieldPlus<-5, 5>' requested here}} } template<int I, int J> @@ -28,8 +28,8 @@ struct BitfieldMinus { void test_BitfieldMinus() { (void)sizeof(BitfieldMinus<5, 1>); - (void)sizeof(BitfieldMinus<0, 1>); // expected-note{{in instantiation of template class 'struct BitfieldMinus<0, 1>' requested here}} - (void)sizeof(BitfieldMinus<5, 5>); // expected-note{{in instantiation of template class 'struct BitfieldMinus<5, 5>' requested here}} + (void)sizeof(BitfieldMinus<0, 1>); // expected-note{{in instantiation of template class 'BitfieldMinus<0, 1>' requested here}} + (void)sizeof(BitfieldMinus<5, 5>); // expected-note{{in instantiation of template class 'BitfieldMinus<5, 5>' requested here}} } template<int I, int J> @@ -40,7 +40,7 @@ struct BitfieldDivide { void test_BitfieldDivide() { (void)sizeof(BitfieldDivide<5, 1>); - (void)sizeof(BitfieldDivide<5, 0>); // expected-note{{in instantiation of template class 'struct BitfieldDivide<5, 0>' requested here}} + (void)sizeof(BitfieldDivide<5, 0>); // expected-note{{in instantiation of template class 'BitfieldDivide<5, 0>' requested here}} } template<typename T, T I, int J> @@ -64,9 +64,9 @@ struct BitfieldNeg2 { void test_BitfieldNeg() { (void)sizeof(BitfieldNeg<-5>); // okay - (void)sizeof(BitfieldNeg<5>); // expected-note{{in instantiation of template class 'struct BitfieldNeg<5>' requested here}} + (void)sizeof(BitfieldNeg<5>); // expected-note{{in instantiation of template class 'BitfieldNeg<5>' requested here}} (void)sizeof(BitfieldNeg2<int, -5>); // okay - (void)sizeof(BitfieldNeg2<int, 5>); // expected-note{{in instantiation of template class 'struct BitfieldNeg2<int, 5>' requested here}} + (void)sizeof(BitfieldNeg2<int, 5>); // expected-note{{in instantiation of template class 'BitfieldNeg2<int, 5>' requested here}} } template<typename T> diff --git a/test/SemaTemplate/instantiate-expr-4.cpp b/test/SemaTemplate/instantiate-expr-4.cpp index c5eb3cc53e7a..92915c7daf17 100644 --- a/test/SemaTemplate/instantiate-expr-4.cpp +++ b/test/SemaTemplate/instantiate-expr-4.cpp @@ -153,7 +153,7 @@ struct TypeId0 { if (ptr) return typeid(ptr); else - return typeid(T); // expected-error{{'typeid' of incomplete type 'struct Incomplete'}} + return typeid(T); // expected-error{{'typeid' of incomplete type 'Incomplete'}} } }; diff --git a/test/SemaTemplate/instantiate-field.cpp b/test/SemaTemplate/instantiate-field.cpp index d166e7e78e6a..60d4b21cac9e 100644 --- a/test/SemaTemplate/instantiate-field.cpp +++ b/test/SemaTemplate/instantiate-field.cpp @@ -20,9 +20,9 @@ void test1(const X<int> *xi) { } void test2(const X<float> *xf) { - (void)xf->x; // expected-note{{in instantiation of template class 'struct X<float>' requested here}} + (void)xf->x; // expected-note{{in instantiation of template class 'X<float>' requested here}} } void test3(const X<int(int)> *xf) { - (void)xf->x; // expected-note{{in instantiation of template class 'struct X<int (int)>' requested here}} + (void)xf->x; // expected-note{{in instantiation of template class 'X<int (int)>' requested here}} } diff --git a/test/SemaTemplate/instantiate-function-1.cpp b/test/SemaTemplate/instantiate-function-1.cpp index 144c630fce51..7b4c53cfe0d7 100644 --- a/test/SemaTemplate/instantiate-function-1.cpp +++ b/test/SemaTemplate/instantiate-function-1.cpp @@ -194,7 +194,7 @@ template struct IndirectGoto0<int>; // expected-note{{instantiation}} template<typename T> struct TryCatch0 { void f() { try { - } catch (T t) { // expected-error{{incomplete type}} \ + } catch (T t) { // expected-warning{{incomplete type}} \ // expected-error{{abstract class}} } catch (...) { } diff --git a/test/SemaTemplate/instantiate-member-class.cpp b/test/SemaTemplate/instantiate-member-class.cpp index 742abcc569c2..5d69b50a7606 100644 --- a/test/SemaTemplate/instantiate-member-class.cpp +++ b/test/SemaTemplate/instantiate-member-class.cpp @@ -28,14 +28,14 @@ void test_instantiation(X<double>::C *x, X<float>::D::F *f) { double &dr = x->foo(); float &fr = e->bar(); - f->foo(); // expected-error{{implicit instantiation of undefined member 'struct X<float>::D::F'}} + f->foo(); // expected-error{{implicit instantiation of undefined member 'X<float>::D::F'}} } X<void>::C *c3; // okay X<void>::D::E *e1; // okay -X<void>::D::E e2; // expected-note{{in instantiation of member class 'struct X<void>::D::E' requested here}} +X<void>::D::E e2; // expected-note{{in instantiation of member class 'X<void>::D::E' requested here}} // Redeclarations. namespace test1 { diff --git a/test/SemaTemplate/instantiate-member-expr.cpp b/test/SemaTemplate/instantiate-member-expr.cpp index 324363ce96dc..f3a60679d176 100644 --- a/test/SemaTemplate/instantiate-member-expr.cpp +++ b/test/SemaTemplate/instantiate-member-expr.cpp @@ -16,14 +16,14 @@ public: template <typename CHECKER> void registerCheck(CHECKER *check) { - Checkers.push_back(S<void *>()); // expected-note {{in instantiation of member function 'vector<struct S<void *> >::push_back' requested here}} + Checkers.push_back(S<void *>()); // expected-note {{in instantiation of member function 'vector<S<void *> >::push_back' requested here}} } }; class RetainReleaseChecker { }; void f(GRExprEngine& Eng) { - Eng.registerCheck(new RetainReleaseChecker); // expected-note {{in instantiation of function template specialization 'GRExprEngine::registerCheck<class RetainReleaseChecker>' requested here}} + Eng.registerCheck(new RetainReleaseChecker); // expected-note {{in instantiation of function template specialization 'GRExprEngine::registerCheck<RetainReleaseChecker>' requested here}} } // PR 5838 @@ -43,7 +43,7 @@ namespace test1 { int a; template<typename T> struct B : A<T> { void f() { - a = 0; // expected-error {{type 'struct test1::O' is not a direct or virtual base of ''B<int>''}} + a = 0; // expected-error {{type 'test1::O' is not a direct or virtual base of ''B<int>''}} } }; }; diff --git a/test/SemaTemplate/instantiate-method.cpp b/test/SemaTemplate/instantiate-method.cpp index a02fe5238c35..357ea2617759 100644 --- a/test/SemaTemplate/instantiate-method.cpp +++ b/test/SemaTemplate/instantiate-method.cpp @@ -20,7 +20,7 @@ void test(X<int> *xi, int *ip, X<int(int)> *xf) { } void test_bad() { - X<void> xv; // expected-note{{in instantiation of template class 'class X<void>' requested here}} + X<void> xv; // expected-note{{in instantiation of template class 'X<void>' requested here}} } template<typename T, typename U> @@ -36,7 +36,7 @@ void test_ovl(Overloading<int, long> *oil, int i, long l) { } void test_ovl_bad() { - Overloading<float, float> off; // expected-note{{in instantiation of template class 'class Overloading<float, float>' requested here}} + Overloading<float, float> off; // expected-note{{in instantiation of template class 'Overloading<float, float>' requested here}} } template<typename T> diff --git a/test/SemaTemplate/instantiate-static-var.cpp b/test/SemaTemplate/instantiate-static-var.cpp index fda2b9ea306b..e90ac5223d98 100644 --- a/test/SemaTemplate/instantiate-static-var.cpp +++ b/test/SemaTemplate/instantiate-static-var.cpp @@ -6,7 +6,7 @@ public: }; int array1[X<int, 2>::value == 5? 1 : -1]; -X<int, 0> xi0; // expected-note{{in instantiation of template class 'class X<int, 0>' requested here}} +X<int, 0> xi0; // expected-note{{in instantiation of template class 'X<int, 0>' requested here}} template<typename T> @@ -14,7 +14,7 @@ class Y { static const T value = 0; // expected-error{{'value' can only be initialized if it is a static const integral data member}} }; -Y<float> fy; // expected-note{{in instantiation of template class 'class Y<float>' requested here}} +Y<float> fy; // expected-note{{in instantiation of template class 'Y<float>' requested here}} // out-of-line static member variables diff --git a/test/SemaTemplate/instantiate-typedef.cpp b/test/SemaTemplate/instantiate-typedef.cpp index 977fd08cc36d..bb168a1c932e 100644 --- a/test/SemaTemplate/instantiate-typedef.cpp +++ b/test/SemaTemplate/instantiate-typedef.cpp @@ -11,6 +11,6 @@ add_pointer<float>::type test2(int * ptr) { return ptr; // expected-error{{cannot initialize return object of type 'add_pointer<float>::type' (aka 'float *') with an lvalue of type 'int *'}} } -add_pointer<int&>::type // expected-note{{in instantiation of template class 'struct add_pointer<int &>' requested here}} \ -// expected-error {{no type named 'type' in 'struct add_pointer<int &>'}} +add_pointer<int&>::type // expected-note{{in instantiation of template class 'add_pointer<int &>' requested here}} \ +// expected-error {{no type named 'type' in 'add_pointer<int &>'}} test3(); diff --git a/test/SemaTemplate/instantiation-backtrace.cpp b/test/SemaTemplate/instantiation-backtrace.cpp index 93f9a3552aa0..21456e902ae5 100644 --- a/test/SemaTemplate/instantiation-backtrace.cpp +++ b/test/SemaTemplate/instantiation-backtrace.cpp @@ -2,7 +2,7 @@ template<typename T> struct A; // expected-note 4{{template is declared here}} template<typename T> struct B : A<T*> { }; // expected-error{{implicit instantiation of undefined template}} \ -// expected-error{{implicit instantiation of undefined template 'struct A<X *>'}} +// expected-error{{implicit instantiation of undefined template 'A<X *>'}} template<typename T> struct C : B<T> { } ; // expected-note{{instantiation of template class}} @@ -19,14 +19,14 @@ void f() { typedef struct { } X; void g() { - (void)sizeof(B<X>); // expected-note{{in instantiation of template class 'struct B<X>' requested here}} + (void)sizeof(B<X>); // expected-note{{in instantiation of template class 'B<X>' requested here}} } template<typename T> -struct G : A<T>, // expected-error{{implicit instantiation of undefined template 'struct A<int>'}} - A<T*> // expected-error{{implicit instantiation of undefined template 'struct A<int *>'}} +struct G : A<T>, // expected-error{{implicit instantiation of undefined template 'A<int>'}} + A<T*> // expected-error{{implicit instantiation of undefined template 'A<int *>'}} { }; void h() { - (void)sizeof(G<int>); // expected-note{{in instantiation of template class 'struct G<int>' requested here}} + (void)sizeof(G<int>); // expected-note{{in instantiation of template class 'G<int>' requested here}} } diff --git a/test/SemaTemplate/metafun-apply.cpp b/test/SemaTemplate/metafun-apply.cpp index bb3c88ad3957..3a7408e28025 100644 --- a/test/SemaTemplate/metafun-apply.cpp +++ b/test/SemaTemplate/metafun-apply.cpp @@ -22,7 +22,7 @@ struct bogus { template<typename MetaFun, typename T> struct apply1 { - typedef typename MetaFun::template apply<T>::type type; // expected-note{{in instantiation of template class 'struct add_reference::apply<void>' requested here}} \ + typedef typename MetaFun::template apply<T>::type type; // expected-note{{in instantiation of template class 'add_reference::apply<void>' requested here}} \ // expected-error{{'apply' following the 'template' keyword does not refer to a template}} }; @@ -32,9 +32,9 @@ apply1<add_reference, int>::type ir = i; apply1<add_reference, float>::type fr = i; // expected-error{{non-const lvalue reference to type 'float' cannot bind to a value of unrelated type 'int'}} void test() { - apply1<add_reference, void>::type t; // expected-note{{in instantiation of template class 'struct apply1<struct add_reference, void>' requested here}} + apply1<add_reference, void>::type t; // expected-note{{in instantiation of template class 'apply1<add_reference, void>' requested here}} - apply1<bogus, int>::type t2; // expected-note{{in instantiation of template class 'struct apply1<struct bogus, int>' requested here}} + apply1<bogus, int>::type t2; // expected-note{{in instantiation of template class 'apply1<bogus, int>' requested here}} } diff --git a/test/SemaTemplate/temp_arg_nontype.cpp b/test/SemaTemplate/temp_arg_nontype.cpp index fdfd4e47b240..9c20f2a0eb1e 100644 --- a/test/SemaTemplate/temp_arg_nontype.cpp +++ b/test/SemaTemplate/temp_arg_nontype.cpp @@ -16,7 +16,7 @@ enum E { Enumerator = 17 }; A<E> *a5; // expected-error{{template argument for non-type template parameter must be an expression}} template<E Value> struct A1; // expected-note{{template parameter is declared here}} A1<Enumerator> *a6; // okay -A1<17> *a7; // expected-error{{non-type template argument of type 'int' cannot be converted to a value of type 'enum E'}} +A1<17> *a7; // expected-error{{non-type template argument of type 'int' cannot be converted to a value of type 'E'}} const long LongValue = 12345678; A<LongValue> *a8; @@ -32,7 +32,7 @@ public: X(int, int); operator int() const; }; -A<X(17, 42)> *a11; // expected-error{{non-type template argument of type 'class X' must have an integral or enumeration type}} +A<X(17, 42)> *a11; // expected-error{{non-type template argument of type 'X' must have an integral or enumeration type}} float f(float); @@ -59,8 +59,8 @@ volatile X * X_volatile_ptr; template<X const &AnX> struct A4; // expected-note 2{{template parameter is declared here}} X an_X; A4<an_X> *a15_1; // okay -A4<*X_volatile_ptr> *a15_2; // expected-error{{reference binding of non-type template parameter of type 'class X const &' to template argument of type 'class X volatile' ignores qualifiers}} -A4<y> *15_3; // expected-error{{non-type template parameter of reference type 'class X const &' cannot bind to template argument of type 'struct Y'}} \ +A4<*X_volatile_ptr> *a15_2; // expected-error{{reference binding of non-type template parameter of type 'X const &' to template argument of type 'X volatile' ignores qualifiers}} +A4<y> *15_3; // expected-error{{non-type template parameter of reference type 'X const &' cannot bind to template argument of type 'struct Y'}} \ // FIXME: expected-error{{expected unqualified-id}} template<int (&fr)(int)> struct A5; // expected-note 2{{template parameter is declared here}} @@ -83,14 +83,14 @@ struct Z { template<int (Z::*pmf)(int)> struct A6; // expected-note{{template parameter is declared here}} A6<&Z::foo> *a17_1; A6<&Z::bar> *a17_2; -A6<&Z::baz> *a17_3; // expected-error{{non-type template argument of type 'double (struct Z::*)(double)' cannot be converted to a value of type 'int (struct Z::*)(int)'}} +A6<&Z::baz> *a17_3; // expected-error{{non-type template argument of type 'double (Z::*)(double)' cannot be converted to a value of type 'int (Z::*)(int)'}} template<int Z::*pm> struct A7; // expected-note{{template parameter is declared here}} template<int Z::*pm> struct A7c; A7<&Z::int_member> *a18_1; A7c<&Z::int_member> *a18_2; -A7<&Z::float_member> *a18_3; // expected-error{{non-type template argument of type 'float struct Z::*' cannot be converted to a value of type 'int struct Z::*'}} +A7<&Z::float_member> *a18_3; // expected-error{{non-type template argument of type 'float Z::*' cannot be converted to a value of type 'int Z::*'}} A7c<(&Z::int_member)> *a18_3; // expected-error{{non-type template argument cannot be surrounded by parentheses}} template<unsigned char C> struct Overflow; // expected-note{{template parameter is declared here}} diff --git a/test/SemaTemplate/temp_arg_type.cpp b/test/SemaTemplate/temp_arg_type.cpp index a376900666d8..a1db3f8057ac 100644 --- a/test/SemaTemplate/temp_arg_type.cpp +++ b/test/SemaTemplate/temp_arg_type.cpp @@ -14,7 +14,7 @@ A<A<int> > *a6; // [temp.arg.type]p2 void f() { class X { }; - A<X> * a = 0; // expected-error{{template argument uses local type 'class X'}} + A<X> * a = 0; // expected-error{{template argument uses local type 'X'}} } struct { int x; } Unnamed; // expected-note{{unnamed type used in template argument was declared here}} diff --git a/test/SemaTemplate/typename-specifier-4.cpp b/test/SemaTemplate/typename-specifier-4.cpp index 0a6fef74c340..280a1b4c3957 100644 --- a/test/SemaTemplate/typename-specifier-4.cpp +++ b/test/SemaTemplate/typename-specifier-4.cpp @@ -99,3 +99,20 @@ namespace PR6268 { return Inner<U>(); } } + +namespace PR6463 { + struct B { typedef int type; }; // expected-note 2{{member found by ambiguous name lookup}} + struct C { typedef int type; }; // expected-note 2{{member found by ambiguous name lookup}} + + template<typename T> + struct A : B, C { + type& a(); // expected-error{{found in multiple base classes}} + int x; + }; + + // FIXME: Improve source location info here. + template<typename T> + typename A<T>::type& A<T>::a() { // expected-error{{found in multiple base classes}} + return x; // expected-error{{undeclared identifier}} + } +} diff --git a/test/SemaTemplate/typename-specifier.cpp b/test/SemaTemplate/typename-specifier.cpp index b968ea6ad544..42766a0620b8 100644 --- a/test/SemaTemplate/typename-specifier.cpp +++ b/test/SemaTemplate/typename-specifier.cpp @@ -16,7 +16,7 @@ namespace N { int i; typename N::A::type *ip1 = &i; -typename N::B::type *ip2 = &i; // expected-error{{no type named 'type' in 'struct N::B'}} +typename N::B::type *ip2 = &i; // expected-error{{no type named 'type' in 'N::B'}} typename N::C::type *ip3 = &i; // expected-error{{typename specifier refers to non-type member 'type'}} void test(double d) { @@ -33,8 +33,8 @@ void test(double d) { namespace N { template<typename T> struct X { - typedef typename T::type type; // expected-error {{no type named 'type' in 'struct N::B'}} \ - // expected-error {{no type named 'type' in 'struct B'}} \ + typedef typename T::type type; // expected-error {{no type named 'type' in 'N::B'}} \ + // expected-error {{no type named 'type' in 'B'}} \ // FIXME: location info for error above isn't very good \ // expected-error 2{{typename specifier refers to non-type member 'type'}} \ // expected-error{{type 'int' cannot be used prior to '::' because it has no members}} @@ -42,18 +42,18 @@ namespace N { } N::X<N::A>::type *ip4 = &i; -N::X<N::B>::type *ip5 = &i; // expected-note{{in instantiation of template class 'struct N::X<struct N::B>' requested here}} \ +N::X<N::B>::type *ip5 = &i; // expected-note{{in instantiation of template class 'N::X<N::B>' requested here}} \ // expected-error{{no type named 'type' in}} -N::X<N::C>::type *ip6 = &i; // expected-note{{in instantiation of template class 'struct N::X<struct N::C>' requested here}} \ +N::X<N::C>::type *ip6 = &i; // expected-note{{in instantiation of template class 'N::X<N::C>' requested here}} \ // expected-error{{no type named 'type' in}} -N::X<int>::type fail1; // expected-note{{in instantiation of template class 'struct N::X<int>' requested here}} \ +N::X<int>::type fail1; // expected-note{{in instantiation of template class 'N::X<int>' requested here}} \ // expected-error{{no type named 'type' in}} template<typename T> struct Y { - typedef typename N::X<T>::type *type; // expected-note{{in instantiation of template class 'struct N::X<struct B>' requested here}} \ - // expected-note{{in instantiation of template class 'struct N::X<struct C>' requested here}} + typedef typename N::X<T>::type *type; // expected-note{{in instantiation of template class 'N::X<B>' requested here}} \ + // expected-note{{in instantiation of template class 'N::X<C>' requested here}} }; struct A { @@ -69,7 +69,7 @@ struct C { }; ::Y<A>::type ip7 = &i; -::Y<B>::type ip8 = &i; // expected-note{{in instantiation of template class 'struct Y<struct B>' requested here}} \ +::Y<B>::type ip8 = &i; // expected-note{{in instantiation of template class 'Y<B>' requested here}} \ // expected-error{{no type named 'type' in}} -::Y<C>::type ip9 = &i; // expected-note{{in instantiation of template class 'struct Y<struct C>' requested here}} \ +::Y<C>::type ip9 = &i; // expected-note{{in instantiation of template class 'Y<C>' requested here}} \ // expected-error{{no type named 'type' in}} diff --git a/test/SemaTemplate/virtual-member-functions.cpp b/test/SemaTemplate/virtual-member-functions.cpp index 58ac08c0b21b..8df808d2569a 100644 --- a/test/SemaTemplate/virtual-member-functions.cpp +++ b/test/SemaTemplate/virtual-member-functions.cpp @@ -14,7 +14,7 @@ template<class T> int A<T>::a(T x) { } void f(A<int> x) { - x.anchor(); // expected-note{{in instantiation of member function 'PR5557::A<int>::anchor' requested here}} + x.anchor(); } template<typename T> @@ -52,4 +52,4 @@ T *HasOutOfLineKey<T>::f(float *fp) { return fp; // expected-error{{cannot initialize return object of type 'int *' with an lvalue of type 'float *'}} } -HasOutOfLineKey<int> out_of_line; // expected-note{{in instantiation of member function 'HasOutOfLineKey<int>::HasOutOfLineKey' requested here}} +HasOutOfLineKey<int> out_of_line; diff --git a/test/lit.cfg b/test/lit.cfg index 3565edc779b8..beb8ae03b4f6 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -97,18 +97,6 @@ if config.test_exec_root is None: ### -import re -site_exp = {} -for line in open(os.path.join(config.llvm_obj_root, 'test', 'site.exp')): - m = re.match('set ([^ ]+) "([^"]*)"', line) - if m: - site_exp[m.group(1)] = m.group(2) - -targets = set(site_exp['TARGETS_TO_BUILD'].split()) -def llvm_supports_target(name): - return name in targets -config.conditions['TARGET'] = llvm_supports_target - # Discover the 'clang' and 'clangcc' to use. import os |