llvm / llvm/llvm-project

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

Open
#167,513 5 comments 0 reactions 1 assignee Claimed by @mizvekov View on GitHub
clang:frontend
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Consider the following C++20 code:
```c++
template
struct A {};

template
using AA = A;

AA a;
AA b{a};
```

Error since Clang trunk:
```console
:8:4: error: no viable constructor or deduction guide for deduction of template arguments of 'AA'
8 | AA b{a};
| ^
: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;
| ^
:5:1: note: implicit deduction guide declared as 'template requires __is_deducible(AA, A) AA(A) -> A'
:5:1: note: candidate function template not viable: requires 0 arguments, but 1 was provided
:5:1: note: implicit deduction guide declared as 'template requires __is_deducible(AA, A) AA() -> A'
1 error generated.
```

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.