Fix typedef in enum class (#4998)
This commit is contained in:
parent
89b47e725f
commit
bda9f707cc
|
@ -1802,7 +1802,7 @@ void Tokenizer::simplifyTypedefCpp()
|
|||
}
|
||||
}
|
||||
|
||||
simplifyType = simplifyType && !inEnumClass;
|
||||
simplifyType = simplifyType && (!inEnumClass || Token::simpleMatch(tok2->previous(), "="));
|
||||
|
||||
if (simplifyType) {
|
||||
mTypedefInfo.back().used = true;
|
||||
|
|
|
@ -3224,6 +3224,14 @@ private:
|
|||
"enum class E { A };\n";
|
||||
ASSERT_EQUALS("enum class E { A } ;", tok(code));
|
||||
}
|
||||
{
|
||||
const char code[] = "namespace N {\n"
|
||||
" struct S { enum E { E0 }; };\n"
|
||||
"}\n"
|
||||
"typedef N::S T;\n"
|
||||
"enum class E { a = T::E0; };\n";
|
||||
ASSERT_EQUALS("namespace N { struct S { enum E { E0 } ; } ; } enum class E { a = N :: S :: E0 ; } ;", tok(code));
|
||||
}
|
||||
{ // #11494
|
||||
const char code[] = "typedef struct S {} KEY;\n"
|
||||
"class C { enum E { KEY }; };\n";
|
||||
|
|
Loading…
Reference in New Issue