[lld][WebAssembly] Reinstate mistakenly disabled test. NFC
[llvm-project.git] / clang / test / SemaCXX / decl-init-ref.cpp
blobe0ff2daf07928123256654236dfed10d0d0e1418
1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s -Wno-uninitialized
3 struct A {};
5 struct BASE {
6 operator A(); // expected-note {{candidate function}}
7 };
9 struct BASE1 {
10 operator A(); // expected-note {{candidate function}}
13 class B : public BASE , public BASE1
15 public:
16 B();
17 } b;
19 extern B f();
21 const int& ri = (void)0; // expected-error {{reference to type 'const int' could not bind to an rvalue of type 'void'}}
23 int main() {
24 const A& rca = f(); // expected-error {{reference initialization of type 'const A &' 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'}}
28 struct PR6139 { A (&x)[1]; };
29 PR6139 x = {{A()}}; // expected-error{{non-const lvalue reference to type 'A[1]' cannot bind to an initializer list temporary}}
31 struct PR6139b { A (&x)[1]; };
32 PR6139b y = {A()}; // expected-error{{non-const lvalue reference to type 'A[1]' cannot bind to a temporary of type 'A'}}
34 namespace PR16502 {
35 struct A { int &&temporary; int x, y; };
36 int f();
37 const A &c = { 10, ++c.temporary };
40 namespace IncompleteTest {
41 struct String;
42 // expected-error@+1 {{reference to incomplete type 'const IncompleteTest::String' could not bind to an lvalue of type 'const char[1]'}}
43 void takeString(const String& = "") {} // expected-note {{passing argument to parameter here}}
44 void test() {
45 takeString();