diff options
author | John McCall <rjmccall@apple.com> | 2010-08-17 07:23:57 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-08-17 07:23:57 +0000 |
commit | 3696dcb171a24bdc525e57c2eea7e6f25da4e61e (patch) | |
tree | 5babcab251af9ce69145d37e0201bdd7f107e47f /clang/test/SemaCXX/constructor-initializer.cpp | |
parent | 411dfad98175f541c460fc439d34e961e2f584d4 (diff) | |
download | bcm5719-llvm-3696dcb171a24bdc525e57c2eea7e6f25da4e61e.tar.gz bcm5719-llvm-3696dcb171a24bdc525e57c2eea7e6f25da4e61e.zip |
Don't try to initialize a reference with a constructed temporary if either
of the classes is invalid. A class is invalid if a base is invalid.
llvm-svn: 111227
Diffstat (limited to 'clang/test/SemaCXX/constructor-initializer.cpp')
-rw-r--r-- | clang/test/SemaCXX/constructor-initializer.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/constructor-initializer.cpp b/clang/test/SemaCXX/constructor-initializer.cpp index cf309f5597d..31d53302bf4 100644 --- a/clang/test/SemaCXX/constructor-initializer.cpp +++ b/clang/test/SemaCXX/constructor-initializer.cpp @@ -221,3 +221,17 @@ namespace PR7402 { S s(3); } } + +// <rdar://problem/8308215>: don't crash. +// Lots of questionable recovery here; errors can change. +namespace test3 { + class A : public std::exception {}; // expected-error {{undeclared identifier}} expected-error {{expected class name}} expected-note 3 {{candidate}} expected-note {{passing argument}} + class B : public A { + public: + B(const String& s, int e=0) // expected-error {{unknown type name}} + : A(e), m_String(s) , m_ErrorStr(__null) {} // expected-error {{no matching constructor}} expected-error {{does not name}} + B(const B& e) + : A(e), m_String(e.m_String), m_ErrorStr(__null) { // expected-error {{no viable conversion}} expected-error {{does not name}} + } + }; +} |