https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54483
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution|--- |INVALID --- Comment #11 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Mitsuru Kariya from comment #9) > (In reply to Juisoo from comment #8) > > However, if I add another data member which is initialized with val by > > default, I still get the "undefined reference" error, see second attachment. > > The second testcase is reduced like below. > > ============== testcase ============== > struct A { > static constexpr float val = 0.08; > A(const float& = val) {} > }; > > int main() > { > A{}; > } > ============== testcase ============== > cf. http://melpon.org/wandbox/permlink/ZCbNwLlPQakWjluY You still need: constexpr float A::val;