Fix #11986 debug: Executable scope 'x' with unknown function. (#5463)

This commit is contained in:
chrchr-github 2023-09-20 17:18:00 +02:00 committed by GitHub
parent dc19916966
commit 57bbb17f3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

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

View File

@ -3377,6 +3377,16 @@ private:
"}\n"
"N::C::C(T*) : p(nullptr) {}\n";
ASSERT_EQUALS("namespace N { struct C { C ( int * ) ; void * p ; } ; } N :: C :: C ( int * ) : p ( nullptr ) { }", tok(code));
code = "namespace N {\n" // #11986
" typedef char U;\n"
" typedef int V;\n"
" struct S {};\n"
" struct T { void f(V*); };\n"
"}\n"
"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));
}
void simplifyTypedefFunction1() {