@@ -549,6 +549,7 @@ class TestSymbolDatabase : public TestFixture {
549549 TEST_CASE(findFunction64); // overloaded operator()
550550 TEST_CASE(findFunction65);
551551 TEST_CASE(findFunction66); // #15104 - object passed for pointer to its class
552+ TEST_CASE(findFunction67); // #15305 - tag name same as function name
552553 TEST_CASE(findFunctionRef1);
553554 TEST_CASE(findFunctionRef2); // #13328
554555 TEST_CASE(findFunctionContainer);
@@ -9243,6 +9244,38 @@ class TestSymbolDatabase : public TestFixture {
92439244 }
92449245 }
92459246
9247+ void findFunction67() { // #15305 - tag name same as function name
9248+ {
9249+ GET_SYMBOL_DB_C("enum E { A };\n"
9250+ "void E(void);\n"
9251+ "int f(int x) {\n"
9252+ " return (enum E)x;\n"
9253+ "}\n");
9254+ const Token* tok = Token::findsimplematch(tokenizer.tokens(), "E {");
9255+ ASSERT(tok && !tok->function());
9256+ tok = Token::findsimplematch(tokenizer.tokens(), "E )");
9257+ ASSERT(tok && !tok->function());
9258+ tok = Token::findsimplematch(tokenizer.tokens(), "E ( ) ;");
9259+ ASSERT(tok && tok->function());
9260+ }
9261+ {
9262+ GET_SYMBOL_DB_C("struct S { int a; };\n"
9263+ "void S(void);\n");
9264+ const Token* tok = Token::findsimplematch(tokenizer.tokens(), "S {");
9265+ ASSERT(tok && !tok->function());
9266+ tok = Token::findsimplematch(tokenizer.tokens(), "S ( ) ;");
9267+ ASSERT(tok && tok->function());
9268+ }
9269+ {
9270+ GET_SYMBOL_DB_C("union U { int a; float b; };\n"
9271+ "void U(void);\n");
9272+ const Token* tok = Token::findsimplematch(tokenizer.tokens(), "U {");
9273+ ASSERT(tok && !tok->function());
9274+ tok = Token::findsimplematch(tokenizer.tokens(), "U ( ) ;");
9275+ ASSERT(tok && tok->function());
9276+ }
9277+ }
9278+
92469279 void findFunctionRef1() {
92479280 GET_SYMBOL_DB("struct X {\n"
92489281 " const std::vector<int> getInts() const & { return mInts; }\n"
0 commit comments