@@ -195,10 +195,14 @@ void new_scopet::print_rec(std::ostream &out, unsigned indent) const
195195class Parser // NOLINT(readability/identifiers)
196196{
197197public:
198- explicit Parser (cpp_parsert &_cpp_parser):
199- lex(_cpp_parser.token_buffer),
200- parser(_cpp_parser),
201- max_errors(10 )
198+ explicit Parser (cpp_parsert &_cpp_parser)
199+ : lex(_cpp_parser.token_buffer),
200+ parser(_cpp_parser),
201+ max_errors(10 ),
202+ cpp11(
203+ config.cpp.cpp_standard == configt::cppt::cpp_standardt::CPP11 ||
204+ config.cpp.cpp_standard == configt::cppt::cpp_standardt::CPP14 ||
205+ config.cpp.cpp_standard == configt::cppt::cpp_standardt::CPP17)
202206 {
203207 root_scope.kind =new_scopet::kindt::NAMESPACE;
204208 current_scope=&root_scope;
@@ -408,6 +412,7 @@ class Parser // NOLINT(readability/identifiers)
408412 }
409413
410414 unsigned int max_errors;
415+ const bool cpp11;
411416};
412417
413418static bool is_identifier (int token)
@@ -1986,13 +1991,10 @@ bool Parser::optStorageSpec(cpp_storage_spect &storage_spec)
19861991{
19871992 int t=lex.LookAhead (0 );
19881993
1989- if (t==TOK_STATIC ||
1990- t==TOK_EXTERN ||
1991- (t == TOK_AUTO && !ansi_c_parser.cpp11 ) ||
1992- t==TOK_REGISTER ||
1993- t==TOK_MUTABLE ||
1994- t==TOK_GCC_ASM ||
1995- t==TOK_THREAD_LOCAL)
1994+ if (
1995+ t == TOK_STATIC || t == TOK_EXTERN || (t == TOK_AUTO && !cpp11) ||
1996+ t == TOK_REGISTER || t == TOK_MUTABLE || t == TOK_GCC_ASM ||
1997+ t == TOK_THREAD_LOCAL)
19961998 {
19971999 cpp_tokent tk;
19982000 lex.get_token (tk);
@@ -2730,7 +2732,7 @@ bool Parser::rConstructorDecl(
27302732
27312733 case TOK_DEFAULT: // C++0x
27322734 {
2733- if (!ansi_c_parser. cpp11 )
2735+ if (!cpp11)
27342736 {
27352737 SyntaxError ();
27362738 return false ;
@@ -2743,7 +2745,7 @@ bool Parser::rConstructorDecl(
27432745
27442746 case TOK_DELETE: // C++0x
27452747 {
2746- if (!ansi_c_parser. cpp11 )
2748+ if (!cpp11)
27472749 {
27482750 SyntaxError ();
27492751 return false ;
@@ -2907,7 +2909,7 @@ bool Parser::rDeclaratorWithInit(
29072909
29082910 if (lex.LookAhead (0 )==TOK_DEFAULT) // C++0x
29092911 {
2910- if (!ansi_c_parser. cpp11 )
2912+ if (!cpp11)
29112913 {
29122914 SyntaxError ();
29132915 return false ;
@@ -2919,7 +2921,7 @@ bool Parser::rDeclaratorWithInit(
29192921 }
29202922 else if (lex.LookAhead (0 )==TOK_DELETE) // C++0x
29212923 {
2922- if (!ansi_c_parser. cpp11 )
2924+ if (!cpp11)
29232925 {
29242926 SyntaxError ();
29252927 return false ;
0 commit comments