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++/57335] New: internal compiler error: in cxx_eval_bit_field_ref, at cp/semantics.c:6977


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;
}

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