Richard Smith | 762bb9d | 2011-10-13 22:29:44 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s |
Fariborz Jahanian | 51bebc8 | 2009-09-23 20:55:32 +0000 | [diff] [blame] | 2 | |
Douglas Gregor | 8dde14e | 2011-01-24 16:14:37 +0000 | [diff] [blame] | 3 | struct A {}; |
Fariborz Jahanian | 51bebc8 | 2009-09-23 20:55:32 +0000 | [diff] [blame] | 4 | |
| 5 | struct BASE { |
| 6 | operator A(); // expected-note {{candidate function}} |
| 7 | }; |
| 8 | |
| 9 | struct BASE1 { |
| 10 | operator A(); // expected-note {{candidate function}} |
| 11 | }; |
| 12 | |
| 13 | class B : public BASE , public BASE1 |
| 14 | { |
| 15 | public: |
| 16 | B(); |
| 17 | } b; |
| 18 | |
| 19 | extern B f(); |
| 20 | |
Chris Lattner | 58f9e13 | 2010-09-05 00:04:01 +0000 | [diff] [blame] | 21 | const int& ri = (void)0; // expected-error {{reference to type 'const int' could not bind to an rvalue of type 'void'}} |
Fariborz Jahanian | 893f955 | 2009-09-30 21:23:30 +0000 | [diff] [blame] | 22 | |
Fariborz Jahanian | 51bebc8 | 2009-09-23 20:55:32 +0000 | [diff] [blame] | 23 | int main() { |
Chris Lattner | 0c42bb6 | 2010-09-05 00:17:29 +0000 | [diff] [blame] | 24 | const A& rca = f(); // expected-error {{reference initialization of type 'const A &' with initializer of type 'B' is ambiguous}} |
John McCall | 7c2342d | 2010-03-10 11:27:22 +0000 | [diff] [blame] | 25 | A& ra = f(); // expected-error {{non-const lvalue reference to type 'A' cannot bind to a temporary of type 'B'}} |
Fariborz Jahanian | 51bebc8 | 2009-09-23 20:55:32 +0000 | [diff] [blame] | 26 | } |
Douglas Gregor | 2c79281 | 2010-02-09 00:50:06 +0000 | [diff] [blame] | 27 | |
Douglas Gregor | e180ed2 | 2010-02-09 01:02:53 +0000 | [diff] [blame] | 28 | struct PR6139 { A (&x)[1]; }; |
John McCall | 7c2342d | 2010-03-10 11:27:22 +0000 | [diff] [blame] | 29 | PR6139 x = {{A()}}; // expected-error{{non-const lvalue reference to type 'A [1]' cannot bind to a temporary of type 'A'}} |