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

            Bug ID: 87506
           Summary: ICE with inherited constexpr constructor with const
                    argument
           Product: gcc
           Version: 8.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: patrick.a.moran at gmail dot com
  Target Milestone: ---

Created attachment 44777
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44777&action=edit
A reproduction of the issue described

I've attached what I believe is a minimal reproduction. It can be built with
> gcc --std=c++14 -c ice_repro.cpp

 * It reproduces with g++ 8.2.0 (I've confirmed it does not occur with 7.3.0)
 * It reproduces with a --std= of c++11, c++14, c++17, c++1z and c++2a
   * It uses constexpr, so it fails for uninterested reasons below C++11
 * No other command-line flags are needed
   * And I've not found any that cause the failure not to reproduce.
 * I found this on a Linux box (Ubuntu 14.04.1), but the gcc was built from
source and no headers are included in the reproduction.

The failure mode is an internal compiler error (full error message at the
bottom). Changing any of the following will cause the failure not to happen:

 * If you drop the constexpr from B::B(A)
 * If you change "constexpr B(const A) {}" to "constexpr B(A) {}"
 * If you use a built-in type like int as the tag argument instead of the
struct A
 * If you change the argument to B::B(A) to be any reference category

The full error message is:
> ice_repro.cpp: In function ‘void func()’:
> ice_repro.cpp:8:24:   in ‘constexpr’ expansion of ‘obj.C::C((A{}, A()))’
> ice_repro.cpp:8:24: internal compiler error: in adjust_temp_type, at 
> cp/constexpr.c:1255
>  void func() { C obj(A{}); }
>                         ^
> 0x58c00e adjust_temp_type
>         ../../gcc-8.2.0/gcc/cp/constexpr.c:1255
> 0x5ee55b cxx_bind_parameters_in_call
>         ../../gcc-8.2.0/gcc/cp/constexpr.c:1330
> 0x5ee55b cxx_eval_call_expression
>         ../../gcc-8.2.0/gcc/cp/constexpr.c:1602
> 0x5f08c4 cxx_eval_constant_expression
>         ../../gcc-8.2.0/gcc/cp/constexpr.c:4211
> 0x5ef958 cxx_eval_constant_expression
>         ../../gcc-8.2.0/gcc/cp/constexpr.c:4337
> 0x5ef958 cxx_eval_constant_expression
>         ../../gcc-8.2.0/gcc/cp/constexpr.c:4337
> 0x5f01d5 cxx_eval_constant_expression
>         ../../gcc-8.2.0/gcc/cp/constexpr.c:4689
> 0x5eef24 cxx_eval_call_expression
>         ../../gcc-8.2.0/gcc/cp/constexpr.c:1709
> 0x5f08c4 cxx_eval_constant_expression
>         ../../gcc-8.2.0/gcc/cp/constexpr.c:4211
> 0x5f39c9 cxx_eval_outermost_constant_expr
>         ../../gcc-8.2.0/gcc/cp/constexpr.c:4861
> 0x5f5ad8 maybe_constant_init_1
>         ../../gcc-8.2.0/gcc/cp/constexpr.c:5187
> 0x64105c expand_default_init
>         ../../gcc-8.2.0/gcc/cp/init.c:1918
> 0x64105c expand_aggr_init_1
>         ../../gcc-8.2.0/gcc/cp/init.c:2021
> 0x64143b build_aggr_init(tree_node*, tree_node*, int, int)
>         ../../gcc-8.2.0/gcc/cp/init.c:1761
> 0x60fb07 build_aggr_init_full_exprs
>         ../../gcc-8.2.0/gcc/cp/decl.c:6283
> 0x60fb07 check_initializer
>         ../../gcc-8.2.0/gcc/cp/decl.c:6432
> 0x61e62b cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
>         ../../gcc-8.2.0/gcc/cp/decl.c:7145
> 0x697710 cp_parser_init_declarator
>         ../../gcc-8.2.0/gcc/cp/parser.c:19749
> 0x69e488 cp_parser_simple_declaration
>         ../../gcc-8.2.0/gcc/cp/parser.c:13052
> 0x69f218 cp_parser_block_declaration
>         ../../gcc-8.2.0/gcc/cp/parser.c:12871
> Please submit a full bug report,
> with preprocessed source if appropriate.
> Please include the complete backtrace with any bug report.
> See <https://gcc.gnu.org/bugs/> for instructions.

Reply via email to