| Issue |
238720
|
| Summary |
Constructor with concept missed when compiling with -std=26
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
anders-wind
|
When compiled with clang-23.1.5 and using flags: `-std=c++26` the following fails to compile:
```
#include <type_traits>
struct S {
constexpr S(const auto... c)
requires (std::is_same_v<decltype(c), const char> && ...)
{}
};
constexpr auto f() { return S('a', 'b'); }
int main() {}
```
Compiler error:
```
<source>:9:29: error: no matching constructor for initialization of 'S'
9 | constexpr auto f() { return S('a', 'b'); }
| ^ ~~~~~~~~
<source>:3:8: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided
3 | struct S {
| ^
<source>:3:8: note: candidate constructor (the implicit move constructor) not viable: requires 1 argument, but 2 were provided
3 | struct S {
| ^
<source>:4:15: note: candidate template ignored: constraints not satisfied [with c:auto = <char, char>]
4 | constexpr S(const auto... c)
| ^
1 error generated.
ASM generation compiler returned: 1
<source>:9:29: error: no matching constructor for initialization of 'S'
9 | constexpr auto f() { return S('a', 'b'); }
| ^ ~~~~~~~~
<source>:3:8: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided
3 | struct S {
| ^
<source>:3:8: note: candidate constructor (the implicit move constructor) not viable: requires 1 argument, but 2 were provided
3 | struct S {
| ^
<source>:4:15: note: candidate template ignored: constraints not satisfied [with c:auto = <char, char>]
4 | constexpr S(const auto... c)
| ^
1 error generated.
Execution build compiler returned: 1
Build failed
```
Note that it works with flags `-std=c++23`. It also works with gcc-16 and `-std=c++26`
Godbolt link:
https://godbolt.org/z/YqGs37bh3
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs