diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 8574de027..2dbdbd806 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -9102,8 +9102,8 @@ void Tokenizer::simplifyKeyword() } if (isCPP() && mSettings->standards.cpp >= Standards::CPP11) { - if (tok->str() == "constexpr") { - tok->str("const"); + while (tok->str() == "constexpr") { + tok->deleteThis(); } // final: diff --git a/test/testsimplifytokens.cpp b/test/testsimplifytokens.cpp index 63d9fbf07..39e6b475c 100644 --- a/test/testsimplifytokens.cpp +++ b/test/testsimplifytokens.cpp @@ -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("__forceinline int foo ( ) { }", true)); - ASSERT_EQUALS("", tok("constexpr int x = 3;", true)); + ASSERT_EQUALS("int foo ( ) { }", tok("constexpr int foo() { }", 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"));