@@ -101,6 +101,7 @@ class TestVarID : public TestFixture {
101101 TEST_CASE (varid67); // #11711 - NOT function pointer
102102 TEST_CASE (varid68); // #11740 - switch (str_chars(&strOut)[0])
103103 TEST_CASE (varid69);
104+ TEST_CASE (varid70); // #12660 - function
104105 TEST_CASE (varid_for_1);
105106 TEST_CASE (varid_for_2);
106107 TEST_CASE (varid_cpp_keywords_in_c_code);
@@ -1270,6 +1271,29 @@ class TestVarID : public TestFixture {
12701271 ASSERT_EQUALS (expected1, tokenize (code1, true ));
12711272 }
12721273
1274+ void varid70 () {
1275+ // isFunctionHead
1276+ const char code1[] = " int x = 1 ? (1 << 0) : 0;\n "
1277+ " void foo(bool init);\n "
1278+ " void init();\n " ;
1279+ const char expected1[] = " 1: int x@1 ; x@1 = 1 ? ( 1 << 0 ) : 0 ;\n "
1280+ " 2: void foo ( bool init@2 ) ;\n "
1281+ " 3: void init ( ) ;\n " ;
1282+ ASSERT_EQUALS (expected1, tokenize (code1, true ));
1283+
1284+ const char code2[] = " int x = 1 ? f(1 << 0) : 0;\n "
1285+ " void foo(bool init);\n "
1286+ " void init();\n " ;
1287+ const char expected2[] = " 1: int x@1 ; x@1 = 1 ? f ( 1 << 0 ) : 0 ;\n "
1288+ " 2: void foo ( bool init@2 ) ;\n "
1289+ " 3: void init ( ) ;\n " ;
1290+ ASSERT_EQUALS (expected2, tokenize (code2, true ));
1291+
1292+ const char code3[] = " extern void (*arr[10])(uint32_t some);\n " ;
1293+ const char expected3[] = " 1: extern void ( * arr@1 [ 10 ] ) ( uint32_t some@2 ) ;\n " ;
1294+ ASSERT_EQUALS (expected3, tokenize (code3, true ));
1295+ }
1296+
12731297 void varid_for_1 () {
12741298 const char code[] = " void foo(int a, int b) {\n "
12751299 " for (int a=1,b=2;;) {}\n "
0 commit comments