Skip to content

Commit 68e980c

Browse files
committed
Fix #14809 FP syntaxError for typedef involving std::size_t
1 parent 89da2d1 commit 68e980c

4 files changed

Lines changed: 4 additions & 9 deletions

File tree

lib/token.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ static const std::unordered_set<std::string> stdTypes = { "bool"
204204
, "int"
205205
, "long"
206206
, "short"
207-
, "size_t"
208207
, "void"
209208
, "wchar_t"
210209
, "signed"

test/testtoken.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,6 @@ class TestToken : public TestFixture {
10591059
standard_types.emplace_back("long");
10601060
standard_types.emplace_back("float");
10611061
standard_types.emplace_back("double");
1062-
standard_types.emplace_back("size_t");
10631062

10641063
for (auto test_op = standard_types.cbegin(); test_op != standard_types.cend(); ++test_op) {
10651064
auto tokensFrontBack = std::make_shared<TokensFrontBack>();
@@ -1488,8 +1487,6 @@ class TestToken : public TestFixture {
14881487
TokenList list_c{settingsDefault, Standards::Language::C};
14891488
auto tokensFrontBack = std::make_shared<TokensFrontBack>();
14901489
Token tok(list_c, std::move(tokensFrontBack));
1491-
tok.str("size_t"); // not treated as keyword in TokenList::isKeyword()
1492-
assert_tok(&tok, Token::Type::eType, /*l=*/ false, /*std=*/ true);
14931490
}
14941491
}
14951492

@@ -1506,17 +1503,13 @@ class TestToken : public TestFixture {
15061503
TokenList list_cpp{settingsDefault, Standards::Language::CPP};
15071504
auto tokensFrontBack = std::make_shared<TokensFrontBack>();
15081505
Token tok(list_cpp, std::move(tokensFrontBack));
1509-
tok.str("size_t");
1510-
assert_tok(&tok, Token::Type::eType, /*l=*/ false, /*std=*/ true);
15111506
}
15121507
}
15131508

15141509
void update_property_info_replace() const // #13743
15151510
{
15161511
auto tokensFrontBack = std::make_shared<TokensFrontBack>();
15171512
Token tok(list, std::move(tokensFrontBack));
1518-
tok.str("size_t");
1519-
assert_tok(&tok, Token::Type::eType, false, true);
15201513
tok.str("long");
15211514
assert_tok(&tok, Token::Type::eType, false, true);
15221515
}

test/testtokenize.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7845,6 +7845,9 @@ class TestTokenizer : public TestFixture {
78457845
"}\n"));
78467846

78477847
ignore_errout();
7848+
7849+
ASSERT_EQUALS("unsigned long s ;", tokenizeAndStringify("typedef std::size_t size_t;\n" // #14809
7850+
"size_t s;\n"));
78487851
}
78497852

78507853

test/testvarid.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2840,7 +2840,7 @@ class TestVarID : public TestFixture {
28402840
void varid_using() {
28412841
// #3648
28422842
const char code[] = "using std::size_t;";
2843-
const char expected[] = "1: using unsigned long ;\n";
2843+
const char expected[] = "1: ;\n";
28442844
ASSERT_EQUALS(expected, tokenize(code));
28452845
}
28462846

0 commit comments

Comments
 (0)