aboutsummaryrefslogtreecommitdiff
path: root/SingleSource/UnitTests/conditional-gnu-ext-cxx.cpp
blob: e3ce2d45c9bc00dacc20f687938926278d1b7ee9 (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
27
28
29
30
31
32
33
34
35
36
// rdar://8453812
extern "C" void abort();

_Complex int getComplex(_Complex int val) {
  static int count;
  if (count++)
    abort();
  return val;
}

_Complex int cmplx_test() {
    _Complex int cond;
    _Complex int rhs;

    return getComplex(1+2i) ? : rhs;
}

// lvalue test
int global = 1;
void foo (int& lv) {
  ++lv;
}

int &cond() {
  static int count;
  if (count++)
    abort();
  return global;
}

int  main() {
    cmplx_test();
    int rhs = 10;
    foo (cond()? : rhs);
    return  global-2;
}