
cope with the case where a user-defined conversion is actually a copy construction, and therefore can be compared against other standard conversion sequences. While I called this a hack before, now I'm convinced that it's the right way to go. Compare overloads based on derived-to-base conversions that invoke copy constructors. Suppress user-defined conversions when attempting to call a user-defined conversion. llvm-svn: 58629
24 lines
294 B
C++
24 lines
294 B
C++
// RUN: clang -fsyntax-only -verify %s
|
|
class Z { };
|
|
|
|
class Y {
|
|
public:
|
|
Y(const Z&);
|
|
};
|
|
|
|
class X {
|
|
public:
|
|
X(int);
|
|
X(const Y&);
|
|
};
|
|
|
|
void f(X);
|
|
|
|
void g(short s, Y y, Z z) {
|
|
f(s);
|
|
f(1.0f);
|
|
f(y);
|
|
f(z); // expected-error{{incompatible type passing 'class Z', expected 'class X'}}
|
|
}
|
|
|