aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-09-06 18:32:18 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-09-06 18:32:18 +0000
commitcddbc1d5872c96cd8c3ad3ddededa304757270d7 (patch)
treeb25173e56dfb650ec7c3dc0f9e1e80bdde92919f
parent9ed63f8b87b1f7d074d21cc1210fd28d93291bea (diff)
Don't try to check override control for invalid member functions. Fixes a crash in a corner case. Patch by Olivier Goffart!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163337 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaDeclCXX.cpp3
-rw-r--r--test/SemaTemplate/nested-template.cpp5
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 2a221d8e5d..318342ec76 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 7849bae4d5..47502536ca 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}}
+};