[clang] [clang] Add test for CWG156 "Name lookup for conversion functions" (PR #121654)

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 5 01:36:57 PST 2025


================
@@ -922,6 +922,49 @@ namespace cwg155 { // cwg155: dup 632
   // expected-warning at -1 {{braces around scalar initializer}}
 }
 
+namespace cwg156 { // cwg156: partial
+namespace ex1 {
+struct A {
+  operator int();
+} a;
+void foo() {
+  typedef int T;
+  a.operator T(); // T is found using unqualified lookup
+                  // after qualified lookup in A fails.
+}
+} // namespace ex1
+
+namespace ex2 {
+struct A {
+  typedef int T;
+  operator T();
+};
+struct B : A {
+  operator T();
+} b;
+void foo() {
+  b.A::operator T(); // FIXME: qualified lookup should find T in A.
+  // expected-error at -1 {{unknown type name 'T'}}
----------------
Endilll wrote:

It is similar to that issue in a sense that `T` needs to undergo a qualified lookup, but the lookup context is different (nested name specifier here, type of the object expression there).

> Do we want to take a crack at it?

Maybe, but not in this PR.

https://github.com/llvm/llvm-project/pull/121654


More information about the cfe-commits mailing list