forked from OSchip/llvm-project
Fix to PR16225 (Assert-on-invalid: isa<LabelDecl>(D) && "declaration not instantiated in this scope")
Differential Revision: http://llvm-reviews.chandlerc.com/D920 llvm-svn: 188137
This commit is contained in:
parent
d3a039fed2
commit
074a518f03
|
@ -4063,6 +4063,9 @@ NamedDecl *Sema::FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D,
|
|||
isa<TemplateTemplateParmDecl>(D))
|
||||
return D;
|
||||
|
||||
if (D->isInvalidDecl())
|
||||
return 0;
|
||||
|
||||
// If we didn't find the decl, then we must have a label decl that hasn't
|
||||
// been found yet. Lazily instantiate it and return it now.
|
||||
assert(isa<LabelDecl>(D));
|
||||
|
|
|
@ -22,3 +22,16 @@ namespace PR16134 {
|
|||
template <class P> struct S // expected-error {{expected ';'}}
|
||||
template <> static S<Q>::f() // expected-error +{{}}
|
||||
}
|
||||
|
||||
namespace PR16225 {
|
||||
template <typename T> void f();
|
||||
template<typename C> void g(C*) {
|
||||
struct LocalStruct : UnknownBase<Mumble, C> { }; // expected-error {{unknown template name 'UnknownBase'}} \
|
||||
// expected-error {{use of undeclared identifier 'Mumble'}}
|
||||
f<LocalStruct>(); // expected-warning {{template argument uses local type 'LocalStruct'}}
|
||||
}
|
||||
struct S;
|
||||
void h() {
|
||||
g<S>(0); // expected-note {{in instantiation of function template specialization}}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue