Using a designated-initializer-list as a template argument makes the function call ambiguous
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Test code ([CE](https://godbolt.org/z/a1xqKPxdd)):
```cpp
struct A {
int a;
};
struct B {
int b;
};
template void f();
template void f();
// ✓ - GCC/Clang: OK
// ✗ - EDG:
// - error: expected an expression
// - error: expected a ")"
// ✗ - MSVC: https://developercommunity.visualstudio.com/t/Using-an-initializer-list-as-a-template/10994813
using T1 = decltype(f<{.a = 42}>());
using T2 = decltype(f()); // OK
// ✓ - GCC: OK
// ✗ - Clang:
// - error: call to 'f' is ambiguous
// - note: candidate function [with $0 = A{0}]
// - note: candidate function [with $0 = B{42}]
// ✗ - EDG/MSVC: same as for `T1` above
using T3 = decltype(f<{.b = 42}>());
using T4 = decltype(f()); // OK
```
Contributor guide
Assessment
This issue has not been assessed yet.