blob: 2f7d8a4c77efda9b6481e9fe24ef1be5c8345b84 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
Fariborz Jahanian51bebc82009-09-23 20:55:32 +00002
John McCallb1622a12010-01-06 09:43:14 +00003struct A {}; // expected-note {{candidate is the implicit copy constructor}}
Fariborz Jahanian51bebc82009-09-23 20:55:32 +00004
5struct BASE {
6 operator A(); // expected-note {{candidate function}}
7};
8
9struct BASE1 {
10 operator A(); // expected-note {{candidate function}}
11};
12
13class B : public BASE , public BASE1
14{
15 public:
16 B();
17} b;
18
19extern B f();
20
Douglas Gregor52bb5d22009-12-16 16:54:16 +000021const int& ri = (void)0; // expected-error {{reference to type 'int const' could not bind to an rvalue of type 'void'}}
Fariborz Jahanian893f9552009-09-30 21:23:30 +000022
Fariborz Jahanian51bebc82009-09-23 20:55:32 +000023int main() {
Douglas Gregor18ef5e22009-12-18 05:02:21 +000024 const A& rca = f(); // expected-error {{reference initialization of type 'struct A const &' with initializer of type 'class B' is ambiguous}}
Douglas Gregor20093b42009-12-09 23:02:17 +000025 A& ra = f(); // expected-error {{non-const lvalue reference to type 'struct A' cannot bind to a temporary of type 'class B'}}
Fariborz Jahanian51bebc82009-09-23 20:55:32 +000026}
Douglas Gregor2c792812010-02-09 00:50:06 +000027
Douglas Gregore180ed22010-02-09 01:02:53 +000028struct PR6139 { A (&x)[1]; };
29PR6139 x = {{A()}}; // expected-error{{non-const lvalue reference to type 'struct A [1]' cannot bind to a temporary of type 'struct A'}}