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>'}}
+}
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>'}}
+}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits