[Bug c++/107958] Ambiguity with uniform initialization in overloaded operator and explicit constructor

2022-12-03 Thread nruslan_devel at yahoo dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107958 --- Comment #10 from Ruslan Nikolaev --- The latter example seems to work well for both gcc and clang. The behavior is also consistent for both explicit and implicit constructors. Thank you for clarifying that it was not a bug!

[Bug c++/107958] Ambiguity with uniform initialization in overloaded operator and explicit constructor

2022-12-03 Thread nruslan_devel at yahoo dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107958 --- Comment #9 from Ruslan Nikolaev --- Interestingly, if I change the code a little bit and have a pair in the constructor rather than two arguments, gcc seems to compile the code: #include #include struct PairPtr { PairPtr() {} P

[Bug c++/107958] Ambiguity with uniform initialization in overloaded operator and explicit constructor

2022-12-03 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107958 Andrew Pinski changed: What|Removed |Added Resolution|INVALID |DUPLICATE --- Comment #8 from Andrew Pi

[Bug c++/107958] Ambiguity with uniform initialization in overloaded operator and explicit constructor

2022-12-03 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107958 Andrew Pinski changed: What|Removed |Added Resolution|--- |INVALID Status|UNCONFIRMED

[Bug c++/107958] Ambiguity with uniform initialization in overloaded operator and explicit constructor

2022-12-03 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107958 --- Comment #6 from Andrew Pinski --- (In reply to Andrew Pinski from comment #4) > I think GCC and MSVC are correct here: > [over.match.list]/16.3.1.7 > . In copy-listinitialization, if an explicit constructor is chosen, the > initialization is

[Bug c++/107958] Ambiguity with uniform initialization in overloaded operator and explicit constructor

2022-12-03 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107958 --- Comment #5 from Andrew Pinski --- Actually I think there is some disagreement if dcl.init.list/3.4 (that is aggregate initialization) applies ... Because if I make the two fields private, then gcc (and MSVC) accepts it ...

[Bug c++/107958] Ambiguity with uniform initialization in overloaded operator and explicit constructor

2022-12-03 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107958 --- Comment #4 from Andrew Pinski --- I think GCC and MSVC are correct here: [over.match.list]/16.3.1.7 . In copy-listinitialization, if an explicit constructor is chosen, the initialization is ill-formed. [ Note: This differs from other situati

[Bug c++/107958] Ambiguity with uniform initialization in overloaded operator and explicit constructor

2022-12-03 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107958 --- Comment #3 from Andrew Pinski --- Obvious workaround is to do: p = PairPtr{ a, b };

[Bug c++/107958] Ambiguity with uniform initialization in overloaded operator and explicit constructor

2022-12-03 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107958 Andrew Pinski changed: What|Removed |Added See Also||https://gcc.gnu.org/bugzill

[Bug c++/107958] Ambiguity with uniform initialization in overloaded operator and explicit constructor

2022-12-03 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107958 --- Comment #1 from Andrew Pinski --- Note MSVC (with /std:c++latest) also rejects the source that is in comment #0 for the same reason as GCC: (39): error C2593: 'operator =' is ambiguous (25): note: could be 'PairPtr &PairPtr::operator =(cons