[cfe-commits] r163337 - in /cfe/trunk: lib/Sema/SemaDeclCXX.cpp test/SemaTemplate/nested-template.cpp

Richard Smith richard-llvm at metafoo.co.uk
Thu Sep 6 11:32:18 PDT 2012


Author: rsmith
Date: Thu Sep  6 13:32:18 2012
New Revision: 163337

URL: http://llvm.org/viewvc/llvm-project?rev=163337&view=rev
Log:
Don't try to check override control for invalid member functions. Fixes a crash in a corner case. Patch by Olivier Goffart!

Modified:
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp
    cfe/trunk/test/SemaTemplate/nested-template.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=163337&r1=163336&r2=163337&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Sep  6 13:32:18 2012
@@ -1420,6 +1420,9 @@
 
 /// CheckOverrideControl - Check C++11 override control semantics.
 void Sema::CheckOverrideControl(Decl *D) {
+  if (D->isInvalidDecl())
+    return;
+
   const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(D);
 
   // Do we know which functions this declaration might be overriding?

Modified: cfe/trunk/test/SemaTemplate/nested-template.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/nested-template.cpp?rev=163337&r1=163336&r2=163337&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/nested-template.cpp (original)
+++ cfe/trunk/test/SemaTemplate/nested-template.cpp Thu Sep  6 13:32:18 2012
@@ -155,3 +155,8 @@
   {
   };
 }
+
+class Outer1 {
+    template <typename T> struct X;
+    template <typename T> int X<T>::func() {} //  expected-error{{out-of-line definition of 'func' from class 'X<T>' without definition}}
+};





More information about the cfe-commits mailing list