This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/58777] Taking address of variant/union member is not always a constant expression
- From: "lucdanton at free dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 18 Oct 2013 23:15:30 +0000
- Subject: [Bug c++/58777] Taking address of variant/union member is not always a constant expression
- Auto-submitted: auto-generated
- References: <bug-58777-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58777
--- Comment #2 from lucdanton at free dot fr ---
Not that I can think of: the same functions are used in non-constant
expressions as well. They *could* be made non-constexpr so as to avoid
advertising incomplete features, but the thing is some things do work in a
constant expression context.
E.g. static_assert( ref(f) == 42, "" ); works, and in the context of optional
values that make them useful as a literal type. In fact, things like *&ref(f)
== 42 are also accepted (through CTFE, too). I expect using the contained value
to be much more useful that using its address, until optional references at
least.