summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/rv-cast3.C
blob: e7d5b6d3419eb622dab2396e1111baae1a6078a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// PR c++/51406
// { dg-do run }
// { dg-options "-std=c++0x" }

extern "C" int printf(const char *,...);
extern "C" void abort();

struct A { int a; A() : a(1) {} };
struct B { int b; B() : b(2) {} };
struct X : A, B {};

int main() {
    X x;
    int a=static_cast<A&&>(x).a;
    int b=static_cast<B&&>(x).b;
    // printf ("%d %d\n", a, b);
    if (a!=1 || b!=2) abort();
}