https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108936
Bug ID: 108936
Summary: internal compiler error: in
type_has_nontrivial_copy_init, at cp/tree.cc:4525
Product: gcc
Version: 12.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: movaki1751 at vootin dot com
Target Milestone: ---
Created attachment 54538
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54538&action=edit
The attachment was generated with the "-freport-bug" option. It contains all
the required technical information and the preprocessed file
Trying to use "(union{short s;char c;}){1}.c != 1;" in a constexpr to determine
host byte order
Expected behavior:
error: accessing ā<unnamed union>::cā member instead of initialized ā<unnamed
union>::sā member in constant expression
6 | static constexpr bool BigEndianHost = (union{short s;char c;}){1}.c
!= 1;
Actual behavior:
internal compiler error: in type_has_nontrivial_copy_init, at cp/tree.cc:4525
6 | static constexpr bool BigEndianHost = (union{short s;char
c;}){1}.c != 1;
If i remove "template<bool BigEndianData = true>" from the example code (see
attachment), i get the expected behavior
The exact version of GCC, and other required information is in the attachment