summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/initlist22.C
blob: 0855b59d5d50125d5d99bc3cb91e34f867de95dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Core issue 934
// { dg-options "-std=c++0x" }

int i;

int& r1{ i };			// OK, direct binding
int&& r2{ i };			// { dg-error "" } binding && to lvalue

int& r3{ };			// { dg-error "" } reference to temporary
int&& r4{ };			// OK, reference to temporary

struct A { int i; } a;

A& r5 { i };			// { dg-error "" } reference to temporary
A&& r6 { i };			// OK, aggregate initialization of temporary
A& r7 { a };			// { dg-error "" } invalid aggregate initializer for A
A&& r8 { a };			// { dg-error "" } invalid aggregate initializer for A

struct B { B(int); int i; } b(0);

B& r9 { i };			// { dg-error "" } reference to temporary
B&& r10 { i };			// OK, make temporary with B(int) constructor
B& r11 { b };			// { dg-error "" } reference to temporary
B&& r12 { b };			// OK, make temporary with copy constructor