| Issue |
174376
|
| Summary |
Direct-initialization, direct-list-initialization and copy-initialization compile where they should rather fail due to ambiguity
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
teledendo
|
Following [this stackoverflow discussion](https://stackoverflow.com/questions/79859075/clang-accepts-designated-initialization-where-gcc-msvc-reject-compiler-bug-or), I think clang should not compile the following snippet. Initializations of the variables `b1`, `b2`, and `b3` should not compile due to ambiguity between the three resolutions
- convert source to `double` via `operator double()`, then construct destination from ctor `B(double)`
- convert source to `B<double>` via `operator B<double>()`, then construct destination from implicitly-defined copy-ctor
- convert source to `B<double>` via `operator B<double>()`, then construct destination from implicitly-defined move-ctor
```template<class T>
struct B {
B(T);
operator T();
template<class U>
operator B<U>();
};
B<int> my_b(42);
// OK everywhere
B<double> b0 = my_b;
// Error on MSVC
B<double> b1(my_b);
B<double> b2 {my_b};
// Error on GCC/MSVC
B<double> b3 = {my_b};
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs