[Bug c++/105491] [10/11/12/13 Regression] Usage of __constinit with -std=c++11 does is rejected

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu May 5 14:48:37 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105491

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-05-05
   Target Milestone|---                         |10.4
            Summary|Usage of __constinit with   |[10/11/12/13 Regression]
                   |-std=c++11 does is rejected |Usage of __constinit with
                   |                            |-std=c++11 does is rejected
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |ppalka at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Related
class Message {
  virtual int GetMetadata();
};
class ProtobufCFileOptions : Message {
public:
  constexpr ProtobufCFileOptions(int);
  bool no_generate_;
  bool const_strings_;
  bool use_oneof_field_name_;
  bool gen_pack_helpers_;
  bool gen_init_helpers_;
};
constexpr ProtobufCFileOptions::ProtobufCFileOptions(int)
    : no_generate_(), const_strings_(), use_oneof_field_name_(),
      gen_pack_helpers_(), gen_init_helpers_() {}
struct ProtobufCFileOptionsDefaultTypeInternal {
  constexpr ProtobufCFileOptionsDefaultTypeInternal() : _instance({}) {}
  union {
    ProtobufCFileOptions _instance;
  };
};
constexpr ProtobufCFileOptionsDefaultTypeInternal
_ProtobufCFileOptions_default_instance_;
is rejected starting with r10-7313-gb599bf9d6d1e180d350b71e51e08a66a1bb1546a
when using -std=c++11 or -std=c++14.
Though, I don't see how it could be changing the active union member when there
is just one member...


More information about the Gcc-bugs mailing list