Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s |
Fariborz Jahanian | 51bebc8 | 2009-09-23 20:55:32 +0000 | [diff] [blame] | 2 | |
John McCall | b1622a1 | 2010-01-06 09:43:14 +0000 | [diff] [blame] | 3 | struct A {}; // expected-note {{candidate is the implicit copy constructor}} |
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 | |
Douglas Gregor | 52bb5d2 | 2009-12-16 16:54:16 +0000 | [diff] [blame] | 21 | const int& ri = (void)0; // expected-error {{reference to type 'int const' 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() { |
John McCall | 7c2342d | 2010-03-10 11:27:22 +0000 | [diff] [blame] | 24 | const A& rca = f(); // expected-error {{reference initialization of type 'A const &' with initializer of type 'B' is ambiguous}} |
| 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'}} |