diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-07-06 18:14:43 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-07-06 18:14:43 +0000 |
commit | 750734c6778d9e9e8200bf0676addb77da713ac2 (patch) | |
tree | 268f9e1944774f4e97918e178c6607b6e71915e3 | |
parent | 3b1da3604f4bf510e30be768284e6693bafb8dc8 (diff) | |
download | bcm5719-llvm-750734c6778d9e9e8200bf0676addb77da713ac2.tar.gz bcm5719-llvm-750734c6778d9e9e8200bf0676addb77da713ac2.zip |
Don't try to type-check a copy construction of an exception
declaration with dependent type. Fixes PR10232 /
<rdar://problem/9700653>.
llvm-svn: 134515
-rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 2 | ||||
-rw-r--r-- | clang/test/SemaTemplate/instantiate-try-catch.cpp | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 368fd9259e3..f4fd20ef7b8 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -8046,7 +8046,7 @@ VarDecl *Sema::BuildExceptionDeclaration(Scope *S, ExDeclType, TInfo, SC_None, SC_None); ExDecl->setExceptionVariable(true); - if (!Invalid) { + if (!Invalid && !ExDeclType->isDependentType()) { if (const RecordType *recordType = ExDeclType->getAs<RecordType>()) { // C++ [except.handle]p16: // The object declared in an exception-declaration or, if the diff --git a/clang/test/SemaTemplate/instantiate-try-catch.cpp b/clang/test/SemaTemplate/instantiate-try-catch.cpp index 1c6c26f2586..f4ce0e17314 100644 --- a/clang/test/SemaTemplate/instantiate-try-catch.cpp +++ b/clang/test/SemaTemplate/instantiate-try-catch.cpp @@ -12,3 +12,20 @@ template struct TryCatch0<int&>; // okay template struct TryCatch0<int&&>; // expected-note{{instantiation}} template struct TryCatch0<int>; // expected-note{{instantiation}} + +namespace PR10232 { + template <typename T> + class Templated { + struct Exception { + private: + Exception(const Exception&); // expected-note{{declared private here}} + }; + void exception() { + try { + } catch(Exception e) { // expected-error{{calling a private constructor of class 'PR10232::Templated<int>::Exception'}} + } + } + }; + + template class Templated<int>; // expected-note{{in instantiation of member function 'PR10232::Templated<int>::exception' requested here}} +} |