diff options
author | Roman Divacky <rdivacky@FreeBSD.org> | 2009-11-19 09:00:00 +0000 |
---|---|---|
committer | Roman Divacky <rdivacky@FreeBSD.org> | 2009-11-19 09:00:00 +0000 |
commit | f5bd02d290ff15268853e0456c130a1afa15e907 (patch) | |
tree | c7f5a7b6fd212399d821b83b22c1e6a42e8c4a0d /test/SemaCXX | |
parent | b3d5a323a5ca92ea73443499cee2f15db1ff0fb3 (diff) | |
download | src-f5bd02d290ff15268853e0456c130a1afa15e907.tar.gz src-f5bd02d290ff15268853e0456c130a1afa15e907.zip |
Update clang to r89337.
Notes
Notes:
svn path=/vendor/clang/dist/; revision=199512
Diffstat (limited to 'test/SemaCXX')
-rw-r--r-- | test/SemaCXX/abstract.cpp | 17 | ||||
-rw-r--r-- | test/SemaCXX/cxx-member-pointer-op.cpp | 21 | ||||
-rw-r--r-- | test/SemaCXX/overloaded-operator.cpp | 38 | ||||
-rw-r--r-- | test/SemaCXX/reinterpret-cast.cpp | 6 | ||||
-rw-r--r-- | test/SemaCXX/rval-references.cpp | 8 | ||||
-rw-r--r-- | test/SemaCXX/using-directive.cpp | 12 |
6 files changed, 90 insertions, 12 deletions
diff --git a/test/SemaCXX/abstract.cpp b/test/SemaCXX/abstract.cpp index 42b8d7febe65..3db607a365c0 100644 --- a/test/SemaCXX/abstract.cpp +++ b/test/SemaCXX/abstract.cpp @@ -138,3 +138,20 @@ namespace PR5222 { C c; } + +// PR5550 - instantiating template didn't track overridden methods +namespace PR5550 { + struct A { + virtual void a() = 0; + virtual void b() = 0; + }; + template<typename T> struct B : public A { + virtual void b(); + virtual void c() = 0; + }; + struct C : public B<int> { + virtual void a(); + virtual void c(); + }; + C x; +} diff --git a/test/SemaCXX/cxx-member-pointer-op.cpp b/test/SemaCXX/cxx-member-pointer-op.cpp new file mode 100644 index 000000000000..63b29c723e07 --- /dev/null +++ b/test/SemaCXX/cxx-member-pointer-op.cpp @@ -0,0 +1,21 @@ +// RUN: clang-cc -fsyntax-only -pedantic -verify %s + +struct C { + static int (C::* a); +}; + +typedef void (C::*pmfc)(); + +void g(pmfc) { + C *c; + c->*pmfc(); // expected-error {{invalid use of pointer to member type after ->*}} + C c1; + c1.*pmfc(); // expected-error {{invalid use of pointer to member type after .*}} + c->*(pmfc()); // expected-error {{invalid use of pointer to member type after ->*}} + c1.*((pmfc())); // expected-error {{invalid use of pointer to member type after .*}} +} + +int a(C* x) { + return x->*C::a; +} + diff --git a/test/SemaCXX/overloaded-operator.cpp b/test/SemaCXX/overloaded-operator.cpp index 7762667d1aba..16d37040f140 100644 --- a/test/SemaCXX/overloaded-operator.cpp +++ b/test/SemaCXX/overloaded-operator.cpp @@ -286,3 +286,41 @@ class RegAlloc { } int usepri[LastReg + 1]; }; + +// PR5546: Don't generate incorrect and ambiguous overloads for multi-level +// arrays. +namespace pr5546 +{ + enum { X }; + extern const char *const sMoveCommands[][2][2]; + const char* a() { return sMoveCommands[X][0][0]; } + const char* b() { return (*(sMoveCommands+X))[0][0]; } +} + +// PR5512 and its discussion +namespace pr5512 { + struct Y { + operator short(); + operator float(); + }; + void g_test(Y y) { + short s = 0; + // DR507, this should be ambiguous, but we special-case assignment + s = y; + // Note: DR507, this is ambiguous as specified + //s += y; + } + + struct S {}; + void operator +=(int&, S); + void f(S s) { + int i = 0; + i += s; + } + + struct A {operator int();}; + int a; + void b(A x) { + a += x; + } +} diff --git a/test/SemaCXX/reinterpret-cast.cpp b/test/SemaCXX/reinterpret-cast.cpp index 91b72cc02207..be960a3af8b5 100644 --- a/test/SemaCXX/reinterpret-cast.cpp +++ b/test/SemaCXX/reinterpret-cast.cpp @@ -88,3 +88,9 @@ void memptrs() (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}} } + +// PR5545 +class A; +class B; +void (A::*a)(); +void (B::*b)() = reinterpret_cast<void (B::*)()>(a); diff --git a/test/SemaCXX/rval-references.cpp b/test/SemaCXX/rval-references.cpp index a7d26bb4b0e1..5132c2a69beb 100644 --- a/test/SemaCXX/rval-references.cpp +++ b/test/SemaCXX/rval-references.cpp @@ -65,9 +65,9 @@ int&& should_not_warn(int&& i) { // But GCC 4.4 does // Test the return dance. This also tests IsReturnCopyElidable. struct MoveOnly { MoveOnly(); - MoveOnly(const MoveOnly&) = delete; - MoveOnly(MoveOnly&&); - MoveOnly(int&&); + MoveOnly(const MoveOnly&) = delete; // expected-note {{candidate function}} + MoveOnly(MoveOnly&&); // expected-note {{candidate function}} + MoveOnly(int&&); // expected-note {{candidate function}} }; MoveOnly returning() { @@ -87,5 +87,5 @@ MoveOnly returningNonEligible() { else if (0) // Copy from reference can't be elided return r; // expected-error {{incompatible type returning}} else // Construction from different type can't be elided - return i; // expected-error {{incompatible type returning}} + return i; // expected-error {{no viable conversion from 'int' to 'struct MoveOnly'}} } diff --git a/test/SemaCXX/using-directive.cpp b/test/SemaCXX/using-directive.cpp index 78ad04293bf4..3b67c7a5b61f 100644 --- a/test/SemaCXX/using-directive.cpp +++ b/test/SemaCXX/using-directive.cpp @@ -45,22 +45,18 @@ namespace A { using namespace E; // expected-error{{reference to 'E' is ambiguous}} } - struct K2 {}; // expected-note{{candidate found by name lookup is 'A::K2'}} + struct K2 {}; // expected-note 2{{candidate found by name lookup is 'A::K2'}} } -struct K2 {}; // expected-note{{candidate found by name lookup is 'K2'}} +struct K2 {}; // expected-note 2{{candidate found by name lookup is 'K2'}} using namespace A; void K1::foo() {} // okay -// FIXME: Do we want err_ovl_no_viable_function_in_init here? -struct K2 k2; // expected-error{{reference to 'K2' is ambiguous}} \ - expected-error{{incomplete type}} - -// FIXME: This case is incorrectly diagnosed! -//K2 k3; +struct K2 *k2; // expected-error{{reference to 'K2' is ambiguous}} +K2 *k3; // expected-error{{reference to 'K2' is ambiguous}} class X { // expected-note{{candidate found by name lookup is 'X'}} // FIXME: produce a suitable error message for this |