Hi,
Here is a patch for a crash I am hitting with clang trunk.
It is caused by the rev 161316
Regards,
--
Olivier
>From 3e0558fcb0f7966685f7c420f09d8b6b66cdbefd Mon Sep 17 00:00:00 2001
From: Olivier Goffart <[email protected]>
Date: Thu, 6 Sep 2012 15:58:52 +0200
Subject: [PATCH] Fix crash while parsing invalid member functions
The call to MD->getParent()->hasAnyDependentBases() in
Sema::CheckOverrideControl would trigger an assert if the parent is not
properly defined, which might be the case when parsing invalid member
functions.
DeclCXX.h:610: const struct DefinitionData &clang::CXXRecordDecl::data()
const: Assertion `DefinitionData && "queried property of class with no
definition"' failed.
---
lib/Sema/SemaDeclCXX.cpp | 3 +++
test/SemaTemplate/nested-template.cpp | 5 +++++
2 files changed, 8 insertions(+)
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 2a221d8..318342e 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -1420,6 +1420,9 @@ bool Sema::ActOnAccessSpecifier(AccessSpecifier Access,
/// 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?
diff --git a/test/SemaTemplate/nested-template.cpp b/test/SemaTemplate/nested-template.cpp
index 7849bae..4750253 100644
--- a/test/SemaTemplate/nested-template.cpp
+++ b/test/SemaTemplate/nested-template.cpp
@@ -155,3 +155,8 @@ namespace PR10924 {
{
};
}
+
+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}}
+};
--
1.7.12
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits