Fix 9518 (Syntax error on valid C++) (#2424)
This commit is contained in:
parent
7da68bff7b
commit
5979eec2c0
|
@ -1811,7 +1811,7 @@ namespace {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (Token::Match(tok1->tokAt(-1), "class|struct|union|enum")) {
|
||||
if (Token::Match(tok1->tokAt(-1), "class|struct|union|enum|namespace")) {
|
||||
// fixme
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -68,6 +68,7 @@ private:
|
|||
TEST_CASE(simplifyUsing9381);
|
||||
TEST_CASE(simplifyUsing9385);
|
||||
TEST_CASE(simplifyUsing9388);
|
||||
TEST_CASE(simplifyUsing9518);
|
||||
}
|
||||
|
||||
std::string tok(const char code[], bool simplify = true, Settings::PlatformType type = Settings::Native, bool debugwarnings = true) {
|
||||
|
@ -619,6 +620,16 @@ private:
|
|||
ASSERT_EQUALS(exp, tok(code, false));
|
||||
}
|
||||
|
||||
void simplifyUsing9518() {
|
||||
const char code[] = "namespace a {\n"
|
||||
"using a = enum {};\n"
|
||||
"}";
|
||||
const char exp[] = "namespace a { "
|
||||
"enum a { } ; "
|
||||
"}";
|
||||
ASSERT_EQUALS(exp, tok(code, false));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
REGISTER_TEST(TestSimplifyUsing)
|
||||
|
|
Loading…
Reference in New Issue