[Bug c++/86581] constexpr variable allows uninitialized member of anonymous struct inside union

2021-07-27 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86581

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||diagnostic

--- Comment #3 from Andrew Pinski  ---
GCC 10+ rejects it but does NOT say why though:
:6:13: error: 'V{V::{V{0}}}' is not a constant expression
6 | constexpr V v;
  | 


So keeping open for that.

(In reply to Ted Lyngmo from comment #2)
> Does this bug cover this case? This compiles with g++ but clang++ gives
> "error: constexpr union constructor does not initialize any member".

No.

[Bug c++/86581] constexpr variable allows uninitialized member of anonymous struct inside union

2019-08-14 Thread ted at lyncon dot se
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86581

Ted Lyngmo  changed:

   What|Removed |Added

 CC||ted at lyncon dot se

--- Comment #2 from Ted Lyngmo  ---
Does this bug cover this case? This compiles with g++ but clang++ gives "error:
constexpr union constructor does not initialize any member".

template 
union test {
constexpr test() noexcept {}
T member;
};

int main() {
test a;
}