Skip to content

[Clang][Regression] CTAD failure for alias template with non-type template argument #167513

@MagentaTreehouse

Description

@MagentaTreehouse

Consider the following C++20 code:

template <class T, T>
struct A {};

template <class T>
using AA = A<T, T{}>;

AA<int> a;
AA b{a};

Error since Clang trunk:

<source>:8:4: error: no viable constructor or deduction guide for deduction of template arguments of 'AA'
    8 | AA b{a};
      |    ^
<source>:5:1: note: candidate template ignored: deduced type 'A<[...], int{}>' of 1st parameter does not match adjusted type 'A<[...], int{} aka 0>' of argument [with T = int]
    5 | using AA = A<T, T{}>;
      | ^
<source>:5:1: note: implicit deduction guide declared as 'template <class T> requires __is_deducible(AA, A<T, T{}>) AA(A<T, T{}>) -> A<T, T{}>'
<source>:5:1: note: candidate function template not viable: requires 0 arguments, but 1 was provided
<source>:5:1: note: implicit deduction guide declared as 'template <class T> requires __is_deducible(AA, A<T, T{}>) AA() -> A<T, T{}>'
1 error generated.

See https://compiler-explorer.com/z/jdeo8ajcc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions