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

            Bug ID: 83231
           Summary: ICE on constexpr evaluation
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: antoshkka at gmail dot com
  Target Milestone: ---

Following valid example 


struct GUID {
    unsigned long  Data1;
    unsigned char  Data2[ 4 ];
};

constexpr bool is_equal(GUID lhs, GUID rhs) {
    return lhs.Data1 == rhs.Data1
        && lhs.Data2[0] == rhs.Data2[0] && lhs.Data2[1] == rhs.Data2[1];
}

void guid_tests() {
    constexpr GUID some_guid =
    { 0x3bcac5a9, { 0xb5, 0xc5, 0xb1, 0x9b } };
    constexpr bool val = is_equal(some_guid, some_guid);
}


fails to cimpile and produces error message:


<source>: In function 'void guid_tests()':
14 : <source>:14:34:   in 'constexpr' expansion of 'is_equal(some_guid,
some_guid)'
14 : <source>:14:55: internal compiler error: in cxx_eval_bit_field_ref, at
cp/constexpr.c:2608
     constexpr bool val = is_equal(some_guid, some_guid);
                                                       ^
mmap: Cannot allocate memory
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler exited with result code 1


Build flags: --std=c++14 -O2

Reply via email to