aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2011-09-04 20:24:20 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2011-09-04 20:24:20 +0000
commit87e96eb04ba26022e03263da9d75299ea72adb8f (patch)
treea4fd6d043133a4bc866a67747e2cefd01a3c0bd5
parent8f4fb190852d3f86787c7e2c3dfc1b96143197ae (diff)
PR10458: Last part of providing 'auto' type specifier as an extension in C++98: permit it within type-ids.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139103 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Parse/ParseDecl.cpp6
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p4.cpp3
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index ad649a3c22..4928bde002 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -2265,7 +2265,11 @@ bool Parser::ParseOptionalTypeSpecifier(DeclSpec &DS, bool& isInvalid,
// C++0x auto support.
case tok::kw_auto:
- if (!getLang().CPlusPlus0x)
+ // This is only called in situations where a storage-class specifier is
+ // illegal, so we can assume an auto type specifier was intended even in
+ // C++98. In C++98 mode, DeclSpec::Finish will produce an appropriate
+ // extension diagnostic.
+ if (!getLang().CPlusPlus)
return false;
isInvalid = DS.SetTypeSpecType(DeclSpec::TST_auto, Loc, PrevSpec, DiagID);
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p4.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p4.cpp
index 856c707a7f..d5d0952aa8 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p4.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p4.cpp
@@ -20,10 +20,7 @@ void f() {
for (; auto a = false; ) {
}
- // FIXME: support 'auto' error recovery here in pre-C++0x mode.
-#if __has_feature(cxx_auto_type)
new const auto (0);
-#endif
new (auto) (0.0);
int arr[] = {1, 2, 3};