aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Parse/ParseDeclCXX.cpp3
-rw-r--r--test/Parser/cxx-decl.cpp4
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp
index 2c5d142fd7..4f0c893b04 100644
--- a/lib/Parse/ParseDeclCXX.cpp
+++ b/lib/Parse/ParseDeclCXX.cpp
@@ -1015,6 +1015,9 @@ bool Parser::isValidAfterTypeSpecifier(bool CouldBeBitfield) {
case tok::l_square: // enum E [[]] x
// Note, no tok::kw_alignas here; alignas cannot appertain to a type.
return getLangOpts().CPlusPlus11 && NextToken().is(tok::l_square);
+ case tok::greater:
+ // template<class T = class X>
+ return getLangOpts().CPlusPlus;
}
return false;
}
diff --git a/test/Parser/cxx-decl.cpp b/test/Parser/cxx-decl.cpp
index 71fd7aae18..24ba127515 100644
--- a/test/Parser/cxx-decl.cpp
+++ b/test/Parser/cxx-decl.cpp
@@ -180,6 +180,10 @@ void test (DIE die, DIE *Die, DIE INT, DIE *FLOAT) {
FLOAT->foo();
}
+namespace PR15017 {
+ template<typename T = struct X { int i; }> struct S {}; // expected-error {{'PR15017::X' can not be defined in a type specifier}}
+}
+
// PR8380
extern "" // expected-error {{unknown linkage language}}
test6a { ;// expected-error {{C++ requires a type specifier for all declarations}} \