llvm-project/clang/test/SemaCXX/converting-constructor.cpp

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'}}
}