diff options
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/CXX/temp/temp.param/p15-cxx0x.cpp | 2 | ||||
-rw-r--r-- | clang/test/SemaCXX/static-cast.cpp | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/clang/test/CXX/temp/temp.param/p15-cxx0x.cpp b/clang/test/CXX/temp/temp.param/p15-cxx0x.cpp index 59618d26368..ade192b3efa 100644 --- a/clang/test/CXX/temp/temp.param/p15-cxx0x.cpp +++ b/clang/test/CXX/temp/temp.param/p15-cxx0x.cpp @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s -template<typename T> struct X; +template<typename T> struct X; // expected-note {{'X' is incomplete}} template<int I> struct Y; X<X<int>> *x1; diff --git a/clang/test/SemaCXX/static-cast.cpp b/clang/test/SemaCXX/static-cast.cpp index 06fd8636e5d..b3fe49a88c6 100644 --- a/clang/test/SemaCXX/static-cast.cpp +++ b/clang/test/SemaCXX/static-cast.cpp @@ -9,8 +9,8 @@ struct F : public C1 {}; // Single path to B with virtual. struct G1 : public B {}; struct G2 : public B {}; struct H : public G1, public G2 {}; // Ambiguous path to B. -struct I; // Incomplete. -struct J; // Incomplete. +struct I; // Incomplete. expected-note {{'I' is incomplete}} +struct J; // Incomplete. expected-note {{'J' is incomplete}} enum Enum { En1, En2 }; enum Onom { On1, On2 }; @@ -92,9 +92,13 @@ void t_529_5_8() (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 {{static_cast from 'B *' to 'E *', which are not related by inheritance, is not allowed}} (void)static_cast<E&>(*((B*)0)); // expected-error {{non-const lvalue reference to type 'E' cannot bind to a value of unrelated type 'B'}} + + (void)static_cast<E*>((J*)0); // expected-error {{static_cast from 'J *' to 'E *', which are not related by inheritance, is not allowed}} + (void)static_cast<I*>((B*)0); // expected-error {{static_cast from 'B *' to 'I *', which are not related by inheritance, is not allowed}} + // TODO: Test inaccessible base in context where it's accessible, i.e. // member function and friend. |