Tokenizer: Do not remove 'constexpr'

This commit is contained in:
Daniel Marjamäki 2018-11-02 20:32:12 +01:00
parent e7d61f399a
commit 2f400b40ba
2 changed files with 3 additions and 3 deletions

View File

@ -9102,8 +9102,8 @@ void Tokenizer::simplifyKeyword()
} }
if (isCPP() && mSettings->standards.cpp >= Standards::CPP11) { if (isCPP() && mSettings->standards.cpp >= Standards::CPP11) {
while (tok->str() == "constexpr") { if (tok->str() == "constexpr") {
tok->deleteThis(); tok->str("const");
} }
// final: // final:

View File

@ -3272,7 +3272,7 @@ private:
ASSERT_EQUALS("int foo ( ) { }", tok("inline int foo ( ) { }", true)); ASSERT_EQUALS("int foo ( ) { }", tok("inline int foo ( ) { }", true));
ASSERT_EQUALS("int foo ( ) { }", tok("__inline int foo ( ) { }", true)); ASSERT_EQUALS("int foo ( ) { }", tok("__inline int foo ( ) { }", true));
ASSERT_EQUALS("int foo ( ) { }", tok("__forceinline int foo ( ) { }", true)); ASSERT_EQUALS("int foo ( ) { }", tok("__forceinline int foo ( ) { }", true));
ASSERT_EQUALS("int foo ( ) { }", tok("constexpr int foo() { }", true)); ASSERT_EQUALS("", tok("constexpr int x = 3;", true));
ASSERT_EQUALS("void f ( ) { int final [ 10 ] ; }", tok("void f() { int final[10]; }", true)); ASSERT_EQUALS("void f ( ) { int final [ 10 ] ; }", tok("void f() { int final[10]; }", true));
ASSERT_EQUALS("int * p ;", tok("int * __restrict p;", "test.c")); ASSERT_EQUALS("int * p ;", tok("int * __restrict p;", "test.c"));
ASSERT_EQUALS("int * * p ;", tok("int * __restrict__ * p;", "test.c")); ASSERT_EQUALS("int * * p ;", tok("int * __restrict__ * p;", "test.c"));