Fix #12008 debug: Executable scope 'x' with unknown function. (#5588)

This commit is contained in:
chrchr-github 2023-10-25 14:50:10 +02:00 committed by GitHub
parent 502d7ea6db
commit 80c5cb6690
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -1693,7 +1693,7 @@ void Tokenizer::simplifyTypedefCpp()
} else {
if (scope == 0 && !(classLevel > 1 && tok2 == spaceInfo[classLevel - 1].bodyEnd))
break;
--scope;
scope = std::max(scope - 1, 0);
}
}

View File

@ -3395,6 +3395,18 @@ private:
"void N::T::f(V*) {}\n"
"namespace N {}\n";
ASSERT_EQUALS("namespace N { struct S { } ; struct T { void f ( int * ) ; } ; } void N :: T :: f ( int * ) { }", tok(code));
code = "namespace N {\n" // #12008
" typedef char U;\n"
" typedef int V;\n"
" struct S {\n"
" S(V* v);\n"
" };\n"
"}\n"
"void f() {}\n"
"N::S::S(V* v) {}\n"
"namespace N {}\n";
ASSERT_EQUALS("namespace N { struct S { S ( int * v ) ; } ; } void f ( ) { } N :: S :: S ( int * v ) { }", tok(code));
}
void simplifyTypedef147() {