[PATCH] D136440: [clang] Do not hide base member using-decls with different template head.

Utkarsh Saxena via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 25 08:04:53 PDT 2022


usaxena95 added inline comments.


================
Comment at: clang/test/SemaTemplate/concepts-using-decl.cpp:112
+  expect<1>(baz{}.foo<Empty>()); // expected-error {{call to member function 'foo' is ambiguous}}
+}
+}
----------------
ilya-biryukov wrote:
> Could you also check that `requires` clauses and constraints in template parameters do not hide each other?
> ```
> template <IsEmpty T> ...
> // vs
> template <class T> requires IsEmpty<T> ...
> // vs
> template <class T> void foo() requires IsEmpty<T> ...
> ```
> Should not hide each other.
> 
> Another interesting case (that probably does not yet work):
> ```
> struct base { template <class T> void foo(); };
> struct derived : base { 
>   using base::foo; 
>   template <IsEmpty T> void foo();
> };
> ```
> ^^ `derived().foo<Empty>()` will probably produce an ambiguity now (as we don't have an explicit requires clause here). I don't think it's worth fixing now, but keeping a test for it with a FIXME seems reasonable.
The last test case would work though since we perform template head check if any template head is contrained. This is not ambiguous as overloading chooses the "most contrained" version.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136440/new/

https://reviews.llvm.org/D136440



More information about the cfe-commits mailing list