Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/tokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2689,6 +2689,9 @@ namespace {
return false;
}

if (tok1->tokAt(-1)->tokType() == Token::eType || tok1->tokAt(-1)->tokType() == Token::eName)
return false;

if (Token::Match(tok1->tokAt(-1), "class|struct|union|enum|namespace")) {
// fixme
return false;
Expand Down
11 changes: 11 additions & 0 deletions test/testsimplifyusing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class TestSimplifyUsing : public TestFixture {
TEST_CASE(simplifyUsing35);
TEST_CASE(simplifyUsing36);
TEST_CASE(simplifyUsing37);
TEST_CASE(simplifyUsing38);

TEST_CASE(simplifyUsing8970);
TEST_CASE(simplifyUsing8971);
Expand Down Expand Up @@ -908,6 +909,16 @@ class TestSimplifyUsing : public TestFixture {
ASSERT_EQUALS("", errout_str());
}

void simplifyUsing38() {
const char code[] = "using std::begin;\n" // #14424
"using std::end;\n"
"Unknown begin;\n"
"int end;\n";
const char expected[] = "Unknown begin ; int end ;";
ASSERT_EQUALS(expected, tok(code));
ASSERT_EQUALS("", errout_str());
}

void simplifyUsing8970() {
const char code[] = "using V = std::vector<int>;\n"
"struct A {\n"
Expand Down
Loading