]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/SemaCXX/decl-init-ref.cpp
Update clang to r96341.
[FreeBSD/FreeBSD.git] / test / SemaCXX / decl-init-ref.cpp
1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
2
3 struct A {}; // expected-note {{candidate is the implicit copy constructor}}
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
21 const int& ri = (void)0; // expected-error {{reference to type 'int const' could not bind to an rvalue of type 'void'}}
22
23 int main() {
24         const A& rca = f(); // expected-error {{reference initialization of type 'struct A const &' with initializer of type 'class B' is ambiguous}}
25         A& ra = f(); // expected-error {{non-const lvalue reference to type 'struct A' cannot bind to a temporary of type 'class B'}}
26 }
27
28 struct PR6139 { A (&x)[1]; };
29 PR6139 x = {{A()}}; // expected-error{{non-const lvalue reference to type 'struct A [1]' cannot bind to a temporary of type 'struct A'}}