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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |error-recovery,
                   |                            |ice-on-invalid-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-03-16
                 CC|                            |msebor at gcc dot gnu.org
            Version|unknown                     |5.4.1
     Ever confirmed|0                           |1
      Known to fail|                            |5.4.0

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
The ICE is reproducible with 5.x but it's gone in 6.x and 7.0 (those fail to
compile the code due to what looks like a bug in the test case, hence
ice-on-invalid-code, error-recovery).

The GCC 5 ICE for the submitted test case is below:

t.C:19:1: error: non-constant condition for static assertion
 static_assert( simple_find( some_ints, 10 ) == static_cast<size_t>( 0 ), "" );
 ^
t.C:19:27: error: ‘constexpr size_t simple_find(const std::array<int, N>&,
const int&) [with long unsigned int N = 3ul; size_t = long unsigned int]’
called in a constant expression
 static_assert( simple_find( some_ints, 10 ) == static_cast<size_t>( 0 ), "" );
                           ^
t.C:6:18: note: ‘constexpr size_t simple_find(const std::array<int, N>&, const
int&) [with long unsigned int N = 3ul; size_t = long unsigned int]’ is not
usable as a constexpr function because:
 constexpr size_t simple_find(const std::array<int, N> &arg_array,
                  ^
t.C:6:18: sorry, unimplemented: unexpected AST of kind loop_expr
t.C:6:18: internal compiler error: in potential_constant_expression_1, at
cp/constexpr.c:4780
0x9ab300 potential_constant_expression_1
        /src/gcc/5-branch/gcc/cp/constexpr.c:4780
0x9a9a50 potential_constant_expression_1
        /src/gcc/5-branch/gcc/cp/constexpr.c:4376
0x9a9a50 potential_constant_expression_1
        /src/gcc/5-branch/gcc/cp/constexpr.c:4376
0x9aa7c3 potential_constant_expression_1
        /src/gcc/5-branch/gcc/cp/constexpr.c:4564
0x9a9a50 potential_constant_expression_1
        /src/gcc/5-branch/gcc/cp/constexpr.c:4376
0x9aa7c3 potential_constant_expression_1
        /src/gcc/5-branch/gcc/cp/constexpr.c:4564
0x9ab3d4 require_potential_rvalue_constant_expression(tree_node*)
        /src/gcc/5-branch/gcc/cp/constexpr.c:4821
0x99c9cc explain_invalid_constexpr_fn(tree_node*)
        /src/gcc/5-branch/gcc/cp/constexpr.c:853
0x99df02 cxx_eval_call_expression
        /src/gcc/5-branch/gcc/cp/constexpr.c:1271
0x9a5acf cxx_eval_constant_expression
        /src/gcc/5-branch/gcc/cp/constexpr.c:3331
0x99f55f cxx_eval_binary_expression
        /src/gcc/5-branch/gcc/cp/constexpr.c:1648
0x9a6b0a cxx_eval_constant_expression
        /src/gcc/5-branch/gcc/cp/constexpr.c:3600
0x9a7b35 cxx_eval_outermost_constant_expr
        /src/gcc/5-branch/gcc/cp/constexpr.c:3864
0x9a8191 cxx_constant_value(tree_node*, tree_node*)
        /src/gcc/5-branch/gcc/cp/constexpr.c:3953
0x91a03d finish_static_assert(tree_node*, tree_node*, unsigned int, bool)
        /src/gcc/5-branch/gcc/cp/semantics.c:7203
0x86bb74 cp_parser_static_assert
        /src/gcc/5-branch/gcc/cp/parser.c:12233
0x86ace6 cp_parser_block_declaration
        /src/gcc/5-branch/gcc/cp/parser.c:11478
0x86aa89 cp_parser_declaration
        /src/gcc/5-branch/gcc/cp/parser.c:11379
0x86a63e cp_parser_declaration_seq_opt
        /src/gcc/5-branch/gcc/cp/parser.c:11265
0x85db76 cp_parser_translation_unit
        /src/gcc/5-branch/gcc/cp/parser.c:4100
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

Reply via email to