Debian Codegraph @

gcc/testsuite/g++.dg/cpp1y/constexpr-complex2.C

raw
1 // PR c++/119045
2 // { dg-do compile { target c++14 } }
3
4 constexpr float
5 foo ()
6 {
7 __complex__ float f {1, 2};
8 float s = __real__ f + __imag__ f;
9 float &r = __real__ f;
10 float &i = __imag__ f;
11 r = 42;
12 s += __real__ f;
13 i = 3;
14 s += __imag__ f;
15 return s;
16 }
17
18 static_assert (foo () == 48.0f, "");