blob: a56a886f55dbe7a2e0953bec8037fbf2e650f1be [file] [log] [blame]
Douglas Gregorf03d7c72008-11-05 15:29:30 +00001// RUN: clang -fsyntax-only -verify %s
Douglas Gregorf03d7c72008-11-05 15:29:30 +00002class X {
3public:
4 explicit X(const X&);
5 X(int*); // expected-note{{candidate function}}
6 explicit X(float*);
7};
8
9class Y : public X { };
10
11void f(Y y, int *ip, float *fp) {
Sebastian Redle4c452c2008-11-22 13:44:36 +000012 X x1 = y; // expected-error{{no matching constructor for initialization of 'x1'; candidate is:}}
Douglas Gregorf03d7c72008-11-05 15:29:30 +000013 X x2 = 0;
14 X x3 = ip;
Douglas Gregor61366e92008-12-24 00:01:03 +000015 X x4 = fp; // expected-error{{cannot initialize 'x4' with an lvalue of type 'float *'}}
Douglas Gregorf03d7c72008-11-05 15:29:30 +000016}
Douglas Gregor611a8c42009-02-19 00:52:42 +000017
18struct foo {
19 void bar();
20};
21
22// PR3600
23void test(const foo *P) { P->bar(); } // expected-error{{cannot initialize object parameter of type 'struct foo' with an expression of type 'struct foo const'}}