[Bug c++/57588] [C++11] static constexpr in class fails to link
richard-gccbugzilla at metafoo dot co.uk
gcc-bugzilla@gcc.gnu.org
Mon Jul 1 06:20:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57588
Richard Smith <richard-gccbugzilla at metafoo dot co.uk> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |richard-gccbugzilla@metafoo
| |.co.uk
--- Comment #7 from Richard Smith <richard-gccbugzilla at metafoo dot co.uk> ---
(In reply to Jonathan Wakely from comment #6)
> (In reply to Daniel Krügler from comment #4)
> > I don't think that this correct here (In C++11 the rules became relaxed).
>
> It was post-C++11, but as a DR we should implement it, and I see you're
> right, the initialization of int_ uses the lvalue-to-rvalue conversion
> immediately so it isn't odr-used.
The mem-initializer in question is "int_(kLiteral)", or after performing
overload resolution, "int_(kLiteral.operator int())". This is an odr-use of
kLiteral, therefore a definition is required. There is no lvalue-to-rvalue
conversion here; 'Literal::operator int' returns an rvalue (and in any case,
kLiteral is not in the set of potential results of the expression).
More information about the Gcc-bugs
mailing list