mirror of
https://github.com/intel/llvm.git
synced 2026-02-03 10:39:35 +08:00
Mark a function declaration invalid if any of its parameter declarations
are invalid. Prevents a crash-on-invalid during template instantiation. I... really don't understand how this wasn't already present. llvm-svn: 101203
This commit is contained in:
@@ -3098,6 +3098,9 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
|
||||
assert(Param->getDeclContext() != NewFD && "Was set before ?");
|
||||
Param->setDeclContext(NewFD);
|
||||
Params.push_back(Param);
|
||||
|
||||
if (Param->isInvalidDecl())
|
||||
NewFD->setInvalidDecl();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -117,3 +117,13 @@ struct X3 {
|
||||
|
||||
|
||||
template struct X3<double>;
|
||||
|
||||
// Don't try to instantiate this, it's invalid.
|
||||
namespace test1 {
|
||||
template <class T> class A {};
|
||||
template <class T> class B {
|
||||
void foo(A<test1::Undeclared> &a) // expected-error {{no member named 'Undeclared' in namespace 'test1'}}
|
||||
{}
|
||||
};
|
||||
template class B<int>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user