Skip to content

Commit 4bb65fd

Browse files
committed
C++: Test that hasQualifiedName/3 ignores inline
1 parent 574a1d8 commit 4bb65fd

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

cpp/ql/test/library-tests/identifiers/qualified_names/qualifiedNames.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,26 @@ namespace templates {
5959
return getMember(tc, typedefC());
6060
}
6161
}
62+
63+
namespace std {
64+
inline namespace cpp17 {
65+
void functionInTwoNamespaces(); // BUG: should also show up in `std`
66+
class classInTwoNameSpaces { // BUG: should also show up in `std`
67+
};
68+
inline namespace implementation {
69+
namespace ns {
70+
void functionInFourNamespaces(); // BUG: should also show up the outer namespaces
71+
}
72+
}
73+
}
74+
}
75+
76+
// This code demonstrates that `functionInFourNamespaces` is indeed visible in
77+
// four name spaces.
78+
using void_fptr = void(*)();
79+
void_fptr ptrs[] = {
80+
std::ns::functionInFourNamespaces,
81+
std::cpp17::ns::functionInFourNamespaces,
82+
std::implementation::ns::functionInFourNamespaces,
83+
std::cpp17::implementation::ns::functionInFourNamespaces,
84+
};

cpp/ql/test/library-tests/identifiers/qualified_names/qualifiedNames.expected

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,10 @@
5252
| qualifiedNames.cpp:53:12:53:12 | getMember | templates::getMember | templates | | getMember | (not global) |
5353
| qualifiedNames.cpp:53:12:53:20 | getMember | templates::getMember | templates | | getMember | (not global) |
5454
| qualifiedNames.cpp:57:8:57:10 | use | templates::use | templates | | use | (not global) |
55+
| qualifiedNames.cpp:65:10:65:32 | functionInTwoNamespaces | std::cpp17::functionInTwoNamespaces | std::cpp17 | | functionInTwoNamespaces | (not global) |
56+
| qualifiedNames.cpp:66:11:66:11 | operator= | std::cpp17::classInTwoNameSpaces::operator= | std::cpp17 | classInTwoNameSpaces | operator= | (not global) |
57+
| qualifiedNames.cpp:66:11:66:11 | operator= | std::cpp17::classInTwoNameSpaces::operator= | std::cpp17 | classInTwoNameSpaces | operator= | (not global) |
58+
| qualifiedNames.cpp:66:11:66:30 | classInTwoNameSpaces | std::cpp17::classInTwoNameSpaces | std::cpp17 | | classInTwoNameSpaces | (not global) |
59+
| qualifiedNames.cpp:70:14:70:37 | functionInFourNamespaces | std::cpp17::implementation::ns::functionInFourNamespaces | std::cpp17::implementation::ns | | functionInFourNamespaces | (not global) |
60+
| qualifiedNames.cpp:78:7:78:15 | void_fptr | void_fptr | | | void_fptr | void_fptr |
61+
| qualifiedNames.cpp:79:11:79:14 | ptrs | ptrs | | | ptrs | ptrs |

0 commit comments

Comments
 (0)