[Bug libstdc++/51013] complex::{imag,real}() should maintain lvalue-returning extension in C++11
daniel.kruegler at googlemail dot com
gcc-bugzilla@gcc.gnu.org
Wed Nov 9 10:42:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51013
--- Comment #12 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2011-11-09 10:36:59 UTC ---
(In reply to comment #11)
> Can't you qualify the constexpr version with const&?
Yes.
> That wouldn't exactly
> match the signature in the standard, which is bad if someone tries to store
> &complex::real in a pointer-to-member variable. But otherwise it should act
> about the same as simply const.
>From the p.o.v of the standard library you don't break anything, because user
code cannot rely on the exact signatures of non-virtual member functions of
library components, 17.6.5.5 [member.functions] gives a lot of freedom to
implementations in this regard.
> (It is funny that for a constexpr bitset a, (~a)[0] is not constexpr :-/ )
I agree.
More information about the Gcc-bugs
mailing list