[PATCH] PR16225 - Assert-on-invalid: isa<LabelDecl>(D) && "declaration not instantiated in this scope"
Serge Pavlov
sepavloff at gmail.com
Thu Jun 6 01:05:56 PDT 2013
The part of the patch related to removing spurious messages is moved into separate
patch (http://llvm-reviews.chandlerc.com/D924).
http://llvm-reviews.chandlerc.com/D920
CHANGE SINCE LAST DIFF
http://llvm-reviews.chandlerc.com/D920?vs=2277&id=2289#toc
Files:
lib/Sema/SemaTemplateInstantiateDecl.cpp
test/SemaCXX/PR16225.cpp
Index: lib/Sema/SemaTemplateInstantiateDecl.cpp
===================================================================
--- lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -3550,6 +3550,9 @@
return cast<NamedDecl>((*Found->get<DeclArgumentPack *>())[PackIdx]);
}
+ 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));
Index: test/SemaCXX/PR16225.cpp
===================================================================
--- /dev/null
+++ test/SemaCXX/PR16225.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -verify %s
+
+template <typename T> void f();
+
+template<typename C> void g(C*) {
+ struct LocalStruct : UnknownBase<Mumble, C> { }; // expected-error {{unknown template name 'UnknownBase'}}
+ 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 'g<S>'}}
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D920.3.patch
Type: text/x-patch
Size: 1132 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130606/0630a485/attachment.bin>
More information about the cfe-commits
mailing list