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++/78550] New: [6/7 Regression] bit field and std::initializer_list


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

            Bug ID: 78550
           Summary: [6/7 Regression] bit field and std::initializer_list
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: trippels at gcc dot gnu.org
  Target Milestone: ---

Gavrilov Vladimir reported the following issue in a direct email to gcc-bugs:

markus@x4 tmp % cat map_bitfield.cpp
#include <map>
struct A {
  int i : 1;
};
std::map<int, A> ma{{1, {0}}};

markus@x4 tmp % g++ -c map_bitfield.cpp
map_bitfield.cpp:5:30: error: invalid initial value for member ‘i’
 std::map<int, A> ma{{1, {0}}};
                              ^

GCC-5 and other compilers accept this code.

A bit further reduced:

markus@x4 tmp % cat map_bitfield2.cpp
#include <initializer_list>
template <typename T> struct A { A(std::initializer_list<T>); };
struct B {
  int k : 1;
};
A<B> a{{0}};
markus@x4 tmp % g++ -c map_bitfield2.cpp
map_bitfield2.cpp:6:12: error: invalid initial value for member ‘k’
 A<B> a{{0}};
            ^

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