[clang] Reland "[clang][Sema] Use original template pattern when declaring implicit deduction guides for nested template classes" (PR #69676)

Arthur Eubanks via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 1 09:21:27 PDT 2023


aeubanks wrote:

this breaks
```
$ cat /tmp/a2.ii
template <bool> struct enable_if;
template <class> struct A {

  template <class... B> struct C {
    C(B...);
    template <class A, enable_if<A::valueint> = 0>
    C(A);
  };

  template <class... B>
  C(B...) -> C<B...>;
};

int New;

struct S : A<int> {
  void f() { C{New}; }
};

$ clang -fsyntax-only -std=c++20 /tmp/a2.ii
/tmp/a2.ii:17:14: error: no matching constructor for initialization of 'C<>' (aka 'A<int>::C<>')                                                                                                                                                                                          
   17 |   void f() { C{New}; }                                                                                                                                                                                                                                                            
      |              ^~~~~~                                                                                                                                                                                                                                                               
/tmp/a2.ii:4:32: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const C<>' for 1st argument                                                                                                                                   
    4 |   template <class... B> struct C {                                                                                                                                                                                                                                                
      |                                ^                                                                                                                                                                                                                                                  
/tmp/a2.ii:4:32: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'C<>' for 1st argument                                                                                                                                         
    4 |   template <class... B> struct C {
      |                                ^
/tmp/a2.ii:7:5: note: candidate template ignored: substitution failure [with A = int]: type 'int' cannot be used prior to '::' because it has no members
    6 |     template <class A, enable_if<A::valueint> = 0>
      |                                  ~
    7 |     C(A);
      |     ^
/tmp/a2.ii:5:5: note: candidate constructor not viable: requires 0 arguments, but 1 was provided
    5 |     C(B...);
      |     ^
1 error generated.

```
is that intentional?

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


More information about the cfe-commits mailing list