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

--- Comment #14 from Orgad Shaneh <orgads at gmail dot com> ---
With 6.1, this doesn't only fail for static_assert. Even a simple function call
fails:

struct Bits {
    unsigned char a : 7;
    unsigned char b : 1;
    constexpr Bits() : a(0), b(0) {}
};

struct Foo
{
    constexpr Foo(int) { }

    constexpr bool b() const { return bits.b; }

private:
    Bits bits;
};

void func(bool) {}

void foo() {
    constexpr Foo foo(42);
    func(foo.b());
}


../test/foo.cpp: In function ‘void foo()’:
../test/foo.cpp:21:14:   in constexpr expansion of ‘foo.Foo::b()’
../test/foo.cpp:21:16: internal compiler error: in cxx_eval_bit_field_ref, at
cp/constexpr.c:2226
     func(foo.b());
                 ^
0x6fbb43 cxx_eval_bit_field_ref
        ../../src/gcc/cp/constexpr.c:2226
0x6fbb43 cxx_eval_constant_expression
        ../../src/gcc/cp/constexpr.c:3849
0x6fed08 cxx_eval_binary_expression
        ../../src/gcc/cp/constexpr.c:1725
0x6f9c52 cxx_eval_constant_expression
        ../../src/gcc/cp/constexpr.c:3806
0x6fed08 cxx_eval_binary_expression
        ../../src/gcc/cp/constexpr.c:1725
0x6f9c52 cxx_eval_constant_expression
        ../../src/gcc/cp/constexpr.c:3806
0x6fc651 cxx_eval_store_expression
        ../../src/gcc/cp/constexpr.c:3123
0x6fa39c cxx_eval_constant_expression
        ../../src/gcc/cp/constexpr.c:3633
0x6f9f88 cxx_eval_constant_expression
        ../../src/gcc/cp/constexpr.c:3645
0x6f92d2 cxx_eval_call_expression
        ../../src/gcc/cp/constexpr.c:1494
0x6fab6f cxx_eval_constant_expression
        ../../src/gcc/cp/constexpr.c:3556
0x6f9f08 cxx_eval_constant_expression
        ../../src/gcc/cp/constexpr.c:3901
0x6fd1f6 cxx_eval_outermost_constant_expr
        ../../src/gcc/cp/constexpr.c:4121
0x6feabc maybe_constant_value_1
        ../../src/gcc/cp/constexpr.c:4316
0x6feabc maybe_constant_value(tree_node*, tree_node*)
        ../../src/gcc/cp/constexpr.c:4340
0x5d6b11 build_over_call
        ../../src/gcc/cp/call.c:7561
0x5d879f build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, bool, int)
        ../../src/gcc/cp/call.c:4152
0x6acaca finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        ../../src/gcc/cp/semantics.c:2461
0x65eaf2 cp_parser_postfix_expression
        ../../src/gcc/cp/parser.c:6904
0x65cee2 cp_parser_unary_expression
        ../../src/gcc/cp/parser.c:7988

Reply via email to