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

--- Comment #7 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Error is emitted here in potential_constant_expression_1, in cp/constexpr.c:
4306                  error_at (EXPR_LOC_OR_LOC (t, input_location),
4307                            "reinterpret_cast from integer to pointer");

With -m32 we have a CONVERT_EXPR with a location on line 20:

(gdb) call debug_tree (t)
 <convert_expr 0x7ffff19f4640
    type <pointer_type 0x7ffff19fa0a8
        type <record_type 0x7ffff19e57e0 Inner type_5 type_6 BLK
            size <integer_cst 0x7ffff19f2d50 constant 224>
            unit size <integer_cst 0x7ffff19f2d80 constant 28>
            align 32 symtab 0 alias set -1 canonical type 0x7ffff19e57e0 fields
<field_decl 0x7ffff19f8390 m_Class> context <record_type 0x7ffff19e5690 B>
            full-name "class B::Inner"
            X() X(constX&) this=(X&) n_parents=0 use_template=0
interface-unknown
            pointer_to_this <pointer_type 0x7ffff19fa0a8> reference_to_this
<reference_type 0x7ffff19e5f18> chain <type_decl 0x7ffff19e4ed8 Inner>>
        unsigned SI
        size <integer_cst 0x7ffff1891e58 constant 32>
        unit size <integer_cst 0x7ffff1891e70 constant 4>
        align 32 symtab 0 alias set -1 canonical type 0x7ffff19fa0a8>
    constant
    arg 0 <integer_cst 0x7ffff18b25b8 type <integer_type 0x7ffff18957e0 int>
constant 4>
    ../../src/gcc/testsuite/g++.dg/cpp0x/constexpr-reinterpret1.C:20:14 start:
../../src/gcc/testsuite/g++.dg/cpp0x/constexpr-reinterpret1.C:20:13 finish:
../../src/gcc/testsuite/g++.dg/cpp0x/constexpr-reinterpret1.C:20:24>


Without -m32, we're dealing with a NOP_EXPR with unknown location, hence the
use of input_location, which is at line 21:

(gdb) call debug_tree (t)
 <nop_expr 0x7ffff19f8900
    type <reference_type 0x7ffff19e9bd0
        type <record_type 0x7ffff19e9498 Inner type_5 type_6 BLK
            size <integer_cst 0x7ffff19f6ee8 constant 224>
            unit size <integer_cst 0x7ffff19f6f30 constant 28>
            align 32 symtab 0 alias set -1 canonical type 0x7ffff19e9498 fields
<field_decl 0x7ffff19ea980 m_Class> context <record_type 0x7ffff19e9348 B>
            full-name "class B::Inner"
            X() X(constX&) this=(X&) n_parents=0 use_template=0
interface-unknown
            pointer_to_this <pointer_type 0x7ffff19e9e70> reference_to_this
<reference_type 0x7ffff19e9bd0> chain <type_decl 0x7ffff19ea558 Inner>>
        unsigned DI
        size <integer_cst 0x7ffff1891e58 constant 64>
        unit size <integer_cst 0x7ffff1891e70 constant 8>
        align 64 symtab 0 alias set -1 canonical type 0x7ffff19e9bd0>
    constant
    arg 0 <integer_cst 0x7ffff19d6540 type <pointer_type 0x7ffff19e9e70>
constant 4>>

so this may well be fallout from my C++ expression ranges patch (r231293);
perhaps they both had unknown location previously?

Reply via email to