aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Parse/ParseDeclCXX.cpp2
-rw-r--r--test/CXX/class/class.mem/p2.cpp13
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp
index 771388fd60..27fed393d4 100644
--- a/lib/Parse/ParseDeclCXX.cpp
+++ b/lib/Parse/ParseDeclCXX.cpp
@@ -2065,7 +2065,7 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS,
DeclsInGroup.push_back(ThisDecl);
}
- if (DeclaratorInfo.isFunctionDeclarator() &&
+ if (ThisDecl && DeclaratorInfo.isFunctionDeclarator() &&
DeclaratorInfo.getDeclSpec().getStorageClassSpec()
!= DeclSpec::SCS_typedef) {
HandleMemberFunctionDeclDelays(DeclaratorInfo, ThisDecl);
diff --git a/test/CXX/class/class.mem/p2.cpp b/test/CXX/class/class.mem/p2.cpp
index bf7b3d49c9..02ef9d7bbc 100644
--- a/test/CXX/class/class.mem/p2.cpp
+++ b/test/CXX/class/class.mem/p2.cpp
@@ -73,3 +73,16 @@ namespace PR12629 {
static_assert(!noexcept(S().h()), "");
static_assert(noexcept(S::i()), "");
}
+
+namespace PR12688 {
+ struct S {
+ // FIXME: Producing one error saying this can't have the same name
+ // as the class because it's not a constructor, then producing
+ // another error saying this can't have a return type because
+ // it is a constructor, is redundant and inconsistent.
+ nonsense S() throw (more_nonsense); // \
+ // expected-error {{'nonsense'}} \
+ // expected-error {{has the same name as its class}} \
+ // expected-error {{constructor cannot have a return type}}
+ };
+}