Skip to content

Commit 2f400b4

Browse files
committed
Tokenizer: Do not remove 'constexpr'
1 parent e7d61f3 commit 2f400b4

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

lib/tokenize.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9102,8 +9102,8 @@ void Tokenizer::simplifyKeyword()
91029102
}
91039103

91049104
if (isCPP() && mSettings->standards.cpp >= Standards::CPP11) {
9105-
while (tok->str() == "constexpr") {
9106-
tok->deleteThis();
9105+
if (tok->str() == "constexpr") {
9106+
tok->str("const");
91079107
}
91089108

91099109
// final:

test/testsimplifytokens.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3272,7 +3272,7 @@ class TestSimplifyTokens : public TestFixture {
32723272
ASSERT_EQUALS("int foo ( ) { }", tok("inline int foo ( ) { }", true));
32733273
ASSERT_EQUALS("int foo ( ) { }", tok("__inline int foo ( ) { }", true));
32743274
ASSERT_EQUALS("int foo ( ) { }", tok("__forceinline int foo ( ) { }", true));
3275-
ASSERT_EQUALS("int foo ( ) { }", tok("constexpr int foo() { }", true));
3275+
ASSERT_EQUALS("", tok("constexpr int x = 3;", true));
32763276
ASSERT_EQUALS("void f ( ) { int final [ 10 ] ; }", tok("void f() { int final[10]; }", true));
32773277
ASSERT_EQUALS("int * p ;", tok("int * __restrict p;", "test.c"));
32783278
ASSERT_EQUALS("int * * p ;", tok("int * __restrict__ * p;", "test.c"));

0 commit comments

Comments
 (0)