https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97456
--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> --- A bit reduced test-case: $ #include <complex> auto wrong(float &pos) -> int { auto a = std::complex(pos, pos); auto b = std::complex(0.0f, 0.0f); b = b + a; if (b == 0.0f) return 1; printf("%f\n", b.imag()); return 0; } float val2 = 1.710780f; float val3; int main(int argc, char **argv) { auto val = argc == 1 ? val2 : val3; printf("val is %f\n", val); return (wrong(val), wrong(val)); } It's not easy to bisect as it depends on definitions in complex.h.