summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/stmtexpr-copy-init.cpp
blob: 8a460e36a2777c8390296abda0af4f3ad1ea343e (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
25
26
// RUN: %clang_cc1 -emit-llvm -o - %s
// rdar //8540501

struct A
{
  int i;
  A (int j) : i(j) {}
  A (const A &j) : i(j.i) {}
  A& operator= (const A &j) { i = j.i; return *this; }
};

A foo(int j)
{
  return ({ j ? A(1) : A(0); });
}

int main()
{
  return foo(1).i-1;
}

void foo2()
{
  A b = ({ A a(1); a; });
}

OpenPOWER on IntegriCloud