blob: 4c635c1a244781aaeb7a7eb5a7538a3dc8eaa332 [file] [log] [blame]
Richard Smith762bb9d2011-10-13 22:29:44 +00001// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
Fariborz Jahanian51bebc82009-09-23 20:55:32 +00002
Douglas Gregor8dde14e2011-01-24 16:14:37 +00003struct A {};
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
Chris Lattner58f9e132010-09-05 00:04:01 +000021const int& ri = (void)0; // expected-error {{reference to type 'const int' 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() {
Chris Lattner0c42bb62010-09-05 00:17:29 +000024 const A& rca = f(); // expected-error {{reference initialization of type 'const A &' with initializer of type 'B' is ambiguous}}
John McCall7c2342d2010-03-10 11:27:22 +000025 A& ra = f(); // expected-error {{non-const lvalue reference to type 'A' cannot bind to a temporary of type '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]; };
John McCall7c2342d2010-03-10 11:27:22 +000029PR6139 x = {{A()}}; // expected-error{{non-const lvalue reference to type 'A [1]' cannot bind to a temporary of type 'A'}}