[llvm-dev] Clang/GCC overload resolution disagreement
TellowKrinkle via llvm-dev
llvm-dev at lists.llvm.org
Sun Aug 30 14:53:06 PDT 2020
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
More information about the llvm-dev
mailing list