[llvm-dev] Clang/GCC overload resolution disagreement
David Blaikie via llvm-dev
llvm-dev at lists.llvm.org
Mon Aug 31 09:53:29 PDT 2020
Question's .probably more suitable for cfe-dev, rather than llvm-dev.
On Sun, Aug 30, 2020 at 2:53 PM TellowKrinkle via llvm-dev <
llvm-dev at lists.llvm.org> wrote:
> Given the following code:
>
> struct A {};
> struct B: public A {
> explicit B(A a) {}
> };
> struct C: public B {};
> B yay(const C& thing) {
> return B(thing);
> }
>
> Clang uses B’s copy constructor, while GCC refuses to compile, claiming an
> ambiguity between B’s copy constructor and the explicit B(A) constructor
>
> Which compiler is correct here?
>
> Live example: https://gcc.godbolt.org/z/3doW5d
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200831/1a18416f/attachment.html>
More information about the llvm-dev
mailing list