https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54483
Mitsuru Kariya <kariya_mitsuru at hotmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kariya_mitsuru at hotmail dot com --- Comment #9 from Mitsuru Kariya <kariya_mitsuru at hotmail dot com> --- (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 I think that the testcase is ill-formed because the A::val is odr-used. When A's ctor is called with no argument, 1) The lvalue-to-rvalue conversion is not applied to A::val. (Since the ctor's parameter is a reference type.) 2) A::val is not a discarded-value expression. On the other hand, A::val is not odr-used in the first testcase. (Since the builtin unary - operator requires that its operand is a prvalue.) So, I think that this pr is fixed. (But I don't know whether this pr can be closed since I cannot find a test.)