Issue 166784
Summary Using a designated-initializer-list as a template argument makes the function call ambiguous
Labels new issue
Assignees
Reporter ckwastra
    Test code ([CE](https://godbolt.org/z/a1xqKPxdd)):

```cpp
struct A {
  int a;
};
struct B {
  int b;
};
template <A> void f();
template <B> 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<A{.a = 42}>()); // 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<B{.b = 42}>()); // OK
```

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to