http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57335
Bug ID: 57335 Summary: internal compiler error: in cxx_eval_bit_field_ref, at cp/semantics.c:6977 Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: chet.simpson at gmail dot com This error appears to be caused though the static_assert on a constexpr containing a union. prog.cpp: In function ‘int main()’: prog.cpp:29:48: in constexpr expansion of ‘BitsOrderCheck().BitsOrderCheck::IsLsbBottom()’ prog.cpp:29:58: internal compiler error: in cxx_eval_bit_field_ref, at cp/semantics.c:6977 Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-4.7/README.Bugs> for instructions. Preprocessed source stored into /home/nUBliJ/ccd38zvW.out file, please attach this to your bugreport. #include <stdint.h> #include <iostream> struct BitsOrderCheck { union Data { struct Bitfield { const unsigned char clear:7; const unsigned char set:1; }; const unsigned char byte; const Bitfield bits; constexpr Data() : byte(1) {} }; constexpr BitsOrderCheck() {} constexpr bool IsLsbBottom() const { return 1 == data_.bits.set; } const Data data_; }; int main() { static_assert(BitsOrderCheck().IsLsbBottom(), "blah"); std::cout << "LSB: " << BitsOrderCheck().IsLsbBottom() << std::endl; return 0; }