| Issue |
114870
|
| Summary |
[clang][c++20] CTAD failue with deduction of returned object
|
| Labels |
|
| Assignees |
|
| Reporter |
Kaltxi
|
## Description
The following code causes a clang compilation error, while it compiles fine with MSVC:
```cpp
template <typename T> struct Wrapper {
T val;
};
template <typename T>
auto get_wrapper() -> Wrapper<T> {
return Wrapper{0};
}
template <typename T>
auto get_wrapper_designated() -> Wrapper<T> {
return Wrapper{.val = 0}; // <- this causes compilation error
}
auto main() -> int {
auto wrapped = get_wrapper<int>(); // compiles fine on both msvc and clang
auto wrapped_designated = get_wrapper_designated<int>(); // clang compilation error
return 0;
}
```
## Expected
Deduction succeeds on returned object and program compiles.
## Context
Windows 11
clang version 19.1.3
Target: x86_64-pc-windows-msvc
Thread model: posix
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs