Don't try to type-check a copy construction of an exception

declaration with dependent type. Fixes PR10232 /
<rdar://problem/9700653>.

llvm-svn: 134515
This commit is contained in:
Douglas Gregor 2011-07-06 18:14:43 +00:00
parent 3b1da3604f
commit 750734c677
2 changed files with 18 additions and 1 deletions

View File

@ -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

View File

@ -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}}
}