@@ -399,6 +399,7 @@ class TestSymbolDatabase: public TestFixture {
399399 TEST_CASE (findFunction32); // C: relax type matching
400400 TEST_CASE (findFunction33); // #9885 variadic function
401401 TEST_CASE (findFunction34); // #10061
402+ TEST_CASE (findFunction35);
402403 TEST_CASE (findFunctionContainer);
403404 TEST_CASE (findFunctionExternC);
404405 TEST_CASE (findFunctionGlobalScope); // ::foo
@@ -6238,6 +6239,29 @@ class TestSymbolDatabase: public TestFixture {
62386239 ASSERT_EQUALS (8 , foo->function ()->tokenDef ->linenr ());
62396240 }
62406241
6242+ void findFunction35 () {
6243+ GET_SYMBOL_DB (" namespace clangimport {\n "
6244+ " class AstNode {\n "
6245+ " public:\n "
6246+ " AstNode();\n "
6247+ " void createTokens();\n "
6248+ " };\n "
6249+ " }\n "
6250+ " ::clangimport::AstNode::AstNode() { }\n "
6251+ " void ::clangimport::AstNode::createTokens() { }" );
6252+ (void )db;
6253+ const Token *foo = Token::findsimplematch (tokenizer.tokens (), " AstNode ( ) { }" );
6254+ ASSERT (foo);
6255+ ASSERT (foo->function ());
6256+ ASSERT (foo->function ()->tokenDef );
6257+ ASSERT_EQUALS (4 , foo->function ()->tokenDef ->linenr ());
6258+ foo = Token::findsimplematch (tokenizer.tokens (), " createTokens ( ) { }" );
6259+ ASSERT (foo);
6260+ ASSERT (foo->function ());
6261+ ASSERT (foo->function ()->tokenDef );
6262+ ASSERT_EQUALS (5 , foo->function ()->tokenDef ->linenr ());
6263+ }
6264+
62416265 void findFunctionContainer () {
62426266 {
62436267 GET_SYMBOL_DB (" void dostuff(std::vector<int> v);\n "
0 commit comments