diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index ad649a3c22509e2febc3ea17a8be578417196fe3..4928bde0022bf1d18b65e51550836c6d48b1f492 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/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/clang/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p4.cpp b/clang/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p4.cpp index 856c707a7fa4754081b920bdf76b95b2e2c5a069..d5d0952aa858b5fd15efde5f7d7f38b164a428a0 100644 --- a/clang/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p4.cpp +++ b/clang/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};