Fixed #8824 (False positive: uninitialized variable (regression))
This commit is contained in:
parent
acf2035a53
commit
9741239b2f
|
@ -8741,7 +8741,7 @@ void Tokenizer::simplifyStructDecl()
|
|||
continue;
|
||||
// check for anonymous struct/union
|
||||
if (Token::Match(tok, "struct|union {")) {
|
||||
if (Token::Match(tok->next()->link(), "} *|&| %type% ,|;|[|(|{")) {
|
||||
if (Token::Match(tok->next()->link(), "} *|&| %type% ,|;|[|(|{|=")) {
|
||||
tok->insertToken("Anonymous" + MathLib::toString(count++));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3260,6 +3260,7 @@ private:
|
|||
ASSERT_EQUALS("enum Anonymous0 { x , y , z } ; enum Anonymous0 d ; d = x ;", tok("enum { x, y, z } d(x);", false));
|
||||
ASSERT_EQUALS("enum Anonymous0 { x , y , z } ; enum Anonymous0 e ; e = x ;", tok("enum { x, y, z } e{x};", false));
|
||||
ASSERT_EQUALS("struct Anonymous0 { int i ; } ; struct Anonymous0 f ; f = { 0 } ;", tok("struct { int i; } f{0};", false));
|
||||
ASSERT_EQUALS("struct Anonymous0 { } ; struct Anonymous0 x ; x = { 0 } ;", tok("struct {} x = {0};", false));
|
||||
ASSERT_EQUALS("enum G : short { x , y , z } ; enum G g ; g = x ;", tok("enum G : short { x, y, z } g(x);", false));
|
||||
ASSERT_EQUALS("enum H : short { x , y , z } ; enum H h ; h = x ;", tok("enum H : short { x, y, z } h{x};", false));
|
||||
ASSERT_EQUALS("enum class I : short { x , y , z } ; enum I i ; i = x ;", tok("enum class I : short { x, y, z } i(x);", false));
|
||||
|
|
Loading…
Reference in New Issue