This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/58777] Taking address of variant/union member is not always a constant expression


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]