parent
282c195a6f
commit
328daeceb4
|
@ -5130,7 +5130,7 @@ void Tokenizer::setVarIdPass2()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tok2->str() == "{") {
|
if (tok2->str() == "{" && !Token::simpleMatch(tok2->previous(), "union")) {
|
||||||
if (tok2->strAt(-1) == ")")
|
if (tok2->strAt(-1) == ")")
|
||||||
setVarIdClassFunction(scopeName2 + classname, tok2, tok2->link(), thisClassVars, structMembers, mVarId);
|
setVarIdClassFunction(scopeName2 + classname, tok2, tok2->link(), thisClassVars, structMembers, mVarId);
|
||||||
tok2 = tok2->link();
|
tok2 = tok2->link();
|
||||||
|
|
|
@ -141,6 +141,7 @@ private:
|
||||||
TEST_CASE(varid_in_class23); // #11293
|
TEST_CASE(varid_in_class23); // #11293
|
||||||
TEST_CASE(varid_in_class24);
|
TEST_CASE(varid_in_class24);
|
||||||
TEST_CASE(varid_in_class25);
|
TEST_CASE(varid_in_class25);
|
||||||
|
TEST_CASE(varid_in_class26);
|
||||||
TEST_CASE(varid_namespace_1); // #7272
|
TEST_CASE(varid_namespace_1); // #7272
|
||||||
TEST_CASE(varid_namespace_2); // #7000
|
TEST_CASE(varid_namespace_2); // #7000
|
||||||
TEST_CASE(varid_namespace_3); // #8627
|
TEST_CASE(varid_namespace_3); // #8627
|
||||||
|
@ -2102,6 +2103,31 @@ private:
|
||||||
ASSERT_EQUALS(expected, tokenize(code, "test.cpp", &s));
|
ASSERT_EQUALS(expected, tokenize(code, "test.cpp", &s));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void varid_in_class26() {
|
||||||
|
const char *code{}, *expected{}; // #11334
|
||||||
|
code = "struct S {\n"
|
||||||
|
" union {\n"
|
||||||
|
" uint8_t u8[4];\n"
|
||||||
|
" uint32_t u32;\n"
|
||||||
|
" };\n"
|
||||||
|
" void f();\n"
|
||||||
|
"};\n"
|
||||||
|
"void S::f() {\n"
|
||||||
|
" u8[0] = 0;\n"
|
||||||
|
"}\n";
|
||||||
|
expected = "1: struct S {\n"
|
||||||
|
"2: union {\n"
|
||||||
|
"3: uint8_t u8@1 [ 4 ] ;\n"
|
||||||
|
"4: uint32_t u32@2 ;\n"
|
||||||
|
"5: } ;\n"
|
||||||
|
"6: void f ( ) ;\n"
|
||||||
|
"7: } ;\n"
|
||||||
|
"8: void S :: f ( ) {\n"
|
||||||
|
"9: u8@1 [ 0 ] = 0 ;\n"
|
||||||
|
"10: }\n";
|
||||||
|
ASSERT_EQUALS(expected, tokenize(code, "test.cpp"));
|
||||||
|
}
|
||||||
|
|
||||||
void varid_namespace_1() { // #7272
|
void varid_namespace_1() { // #7272
|
||||||
const char code[] = "namespace Blah {\n"
|
const char code[] = "namespace Blah {\n"
|
||||||
" struct foo { int x;};\n"
|
" struct foo { int x;};\n"
|
||||||
|
|
Loading…
Reference in New Issue