blob: f57484e5069a93b0d589c96fa3f295502e1d92e1 [file] [log] [blame]
Douglas Gregorad323a82010-01-27 03:51:04 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s -Wnon-pod-varargs
Douglas Gregor396b7cd2008-11-03 17:51:48 +00002class X { };
3
4int& copycon(X x);
5float& copycon(...);
6
7void test_copycon(X x, X const xc, X volatile xv) {
8 int& i1 = copycon(x);
9 int& i2 = copycon(xc);
10 float& f1 = copycon(xv);
11}
12
13class A {
14public:
15 A(A&);
16};
17
18class B : public A { };
19
20short& copycon2(A a);
21int& copycon2(B b);
22float& copycon2(...);
23
24void test_copycon2(A a, const A ac, B b, B const bc, B volatile bv) {
25 int& i1 = copycon2(b);
Chris Lattner7e1848d2009-12-11 01:52:50 +000026 float& f1 = copycon2(bc); // expected-warning {{cannot pass object of non-POD type}}
27 float& f2 = copycon2(bv); // expected-warning {{cannot pass object of non-POD type}}
Douglas Gregor396b7cd2008-11-03 17:51:48 +000028 short& s1 = copycon2(a);
Chris Lattner7e1848d2009-12-11 01:52:50 +000029 float& f3 = copycon2(ac); // expected-warning {{cannot pass object of non-POD type}}
Douglas Gregor396b7cd2008-11-03 17:51:48 +000030}
31
32int& copycon3(A a);
33float& copycon3(...);
34
35void test_copycon3(B b, const B bc) {
36 int& i1 = copycon3(b);
Chris Lattner7e1848d2009-12-11 01:52:50 +000037 float& f1 = copycon3(bc); // expected-warning {{cannot pass object of non-POD type}}
Douglas Gregor396b7cd2008-11-03 17:51:48 +000038}
Douglas Gregor225c41e2008-11-03 19:09:14 +000039
Douglas Gregor225c41e2008-11-03 19:09:14 +000040class C : public B { };
41
42float& copycon4(A a);
43int& copycon4(B b);
44
45void test_copycon4(C c) {
46 int& i = copycon4(c);
47};