This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/51013] complex::{imag,real}() should maintain lvalue-returning extension in C++11
- From: "marc.glisse at normalesup dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 08 Nov 2011 18:40:13 +0000
- Subject: [Bug libstdc++/51013] complex::{imag,real}() should maintain lvalue-returning extension in C++11
- Auto-submitted: auto-generated
- References: <bug-51013-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51013
--- Comment #11 from Marc Glisse <marc.glisse at normalesup dot org> 2011-11-08 18:40:13 UTC ---
(In reply to comment #10)
> (In reply to comment #8)
> > Once we have ref-qualifiers, it should be OK to add the non-const overload with
> > an lvalue ref-qualifier, though.
>
> I think you need to add a differently named function, because a function with
> ref-qualifier cannot coexist with other functions of the same name and the same
> parameter-type-list that do not have a ref-qualifier.
Can't you qualify the constexpr version with const&? 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.
I guess that's one more reason not to provide the extension...
(It is funny that for a constexpr bitset a, (~a)[0] is not constexpr :-/ )