[cfe-commits] r138601 - in /cfe/trunk: lib/Sema/SemaTemplate.cpp test/SemaTemplate/missing-class-keyword-crash.cpp
Matt Beaumont-Gay
matthewbg at google.com
Thu Aug 25 16:22:24 PDT 2011
Author: matthewbg
Date: Thu Aug 25 18:22:24 2011
New Revision: 138601
URL: http://llvm.org/viewvc/llvm-project?rev=138601&view=rev
Log:
Fix a crash-on-invalid.
Much to everyone's surprise, the default constructor for TypeResult produces
an instance with Invalid == false. This seems like a decision we may want to
revisit.
Added:
cfe/trunk/test/SemaTemplate/missing-class-keyword-crash.cpp
Modified:
cfe/trunk/lib/Sema/SemaTemplate.cpp
Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=138601&r1=138600&r2=138601&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Thu Aug 25 18:22:24 2011
@@ -2131,7 +2131,7 @@
QualType Result = CheckTemplateIdType(Template, TemplateLoc, TemplateArgs);
if (Result.isNull())
- return TypeResult();
+ return TypeResult(true);
// Check the tag kind
if (const RecordType *RT = Result->getAs<RecordType>()) {
Added: cfe/trunk/test/SemaTemplate/missing-class-keyword-crash.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/missing-class-keyword-crash.cpp?rev=138601&view=auto
==============================================================================
--- cfe/trunk/test/SemaTemplate/missing-class-keyword-crash.cpp (added)
+++ cfe/trunk/test/SemaTemplate/missing-class-keyword-crash.cpp Thu Aug 25 18:22:24 2011
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+class G {};
+template <Foo> // expected-error{{unknown type name 'Foo'}} \
+ // expected-note{{template parameter is declared here}}
+class Bar {};
+
+class Bar<G> blah_test; // expected-error{{template argument for non-type template parameter must be an expression}}
More information about the cfe-commits
mailing list