[Bug c++/105821] ICE for illegal constexpr-if

mpolacek at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jun 2 11:55:48 GMT 2022


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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |error-recovery
   Last reconfirmed|                            |2022-06-02
     Ever confirmed|0                           |1
                 CC|                            |mpolacek at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.  We issue an error:

105821.C: In function ‘int r()’:
105821.C:3:18: error: expected primary-expression before ‘)’ token
    3 |   if constexpr (a) {
      |                  ^

and then loop somewhere in

#1  0x0000000000efd84e in structural_comptypes (t1=<integer_type 0x7fffea2de5e8
int>, 
    t2=<integer_type 0x7fffea2de690 unsigned int>, strict=0) at
/home/mpolacek/src/gcc/gcc/cp/typeck.cc:1350
#2  0x0000000000eff02d in comptypes (t1=<integer_type 0x7fffea2de5e8 int>, 
    t2=<integer_type 0x7fffea2de690 unsigned int>, strict=0) at
/home/mpolacek/src/gcc/gcc/cp/typeck.cc:1553
#3  0x0000000000eff285 in same_type_ignoring_top_level_qualifiers_p (
    type1=<integer_type 0x7fffea2de5e8 int>, type2=<integer_type 0x7fffea2de690
unsigned int>)
    at /home/mpolacek/src/gcc/gcc/cp/typeck.cc:1596
#4  0x0000000000bd7531 in ocp_convert (type=<integer_type 0x7fffea2de5e8 int>, 
    expr=<trunc_div_expr 0x7fffdb601d48>, convtype=15, flags=1, complain=256)
    at /home/mpolacek/src/gcc/gcc/cp/cvt.cc:749
#5  0x0000000000bd6e59 in cp_convert (type=<integer_type 0x7fffea2de5e8 int>, 
    expr=<trunc_div_expr 0x7fffdb601d48>, complain=256) at
/home/mpolacek/src/gcc/gcc/cp/cvt.cc:642
#6  0x0000000000bd6ed3 in cp_convert_and_check (type=<integer_type
0x7fffea2de5e8 int>, 
    expr=<trunc_div_expr 0x7fffdb601d48>, complain=256) at
/home/mpolacek/src/gcc/gcc/cp/cvt.cc:661
#7  0x0000000000b14fac in convert_like_internal (convs=0x410ed40,
expr=<trunc_div_expr 0x7fffdb601d48>, 
    fn=<tree 0x0>, argnum=0, issue_conversion_warnings=true, c_cast_p=false,
complain=256)
    at /home/mpolacek/src/gcc/gcc/cp/call.cc:8404
#8  0x0000000000b15230 in convert_like (convs=0x410ed40, expr=<trunc_div_expr
0x7fffdb601d48>, 
    fn=<tree 0x0>, argnum=0, issue_conversion_warnings=true, c_cast_p=false,
complain=256)
    at /home/mpolacek/src/gcc/gcc/cp/call.cc:8459
#9  0x0000000000b152a3 in convert_like (convs=0x410ed40, expr=<trunc_div_expr
0x7fffdb601d48>, complain=256)
    at /home/mpolacek/src/gcc/gcc/cp/call.cc:8471
#10 0x0000000000b073c1 in build_converted_constant_expr_internal
(type=<integer_type 0x7fffea2de5e8 int>, 
    expr=<trunc_div_expr 0x7fffdb601d48>, flags=5, complain=256)
    at /home/mpolacek/src/gcc/gcc/cp/call.cc:4607
#11 0x0000000000b0748d in build_converted_constant_expr (type=<integer_type
0x7fffea2de5e8 int>, 
    expr=<trunc_div_expr 0x7fffdb601d48>, complain=256) at
/home/mpolacek/src/gcc/gcc/cp/call.cc:4639
#12 0x0000000000e01b0d in convert_nontype_argument (type=<integer_type
0x7fffea2de5e8 int>, 
    expr=<trunc_div_expr 0x7fffdb601d48>, complain=256) at
/home/mpolacek/src/gcc/gcc/cp/pt.cc:7375
#13 0x0000000000e06465 in convert_template_argument (parm=<parm_decl
0x7ffff7ffa080 g>, 
    arg=<trunc_div_expr 0x7fffdb601d48>, args=<tree_vec 0x7fffdb601e10>,
complain=256, i=0, 
    in_decl=<template_decl 0x7ffff7ffa180 r>) at
/home/mpolacek/src/gcc/gcc/cp/pt.cc:8657
#14 0x0000000000e07f5f in coerce_template_parms (parms=<tree_vec
0x7fffea422c30>, 
    args=<tree_vec 0x7fffdb601d98>, in_decl=<template_decl 0x7ffff7ffa180 r>,
complain=256, 
    require_all_args=false, use_default_args=false) at
/home/mpolacek/src/gcc/gcc/cp/pt.cc:9136
#15 0x0000000000e4c945 in fn_type_unification (fn=<template_decl 0x7ffff7ffa180
r>, 
    explicit_targs=<tree_vec 0x7fffdb601d98>, targs=<tree_vec 0x7fffdb601de8>,
args=0x7fffffffb9b0, nargs=0, 
    return_type=<tree 0x0>, strict=DEDUCE_CALL, flags=1, convs=0x410ed10,
explain_p=false, decltype_p=false)
    at /home/mpolacek/src/gcc/gcc/cp/pt.cc:21965
#16 0x0000000000b03952 in add_template_candidate_real
(candidates=0x7fffffffbdb0, 
    tmpl=<template_decl 0x7ffff7ffa180 r>, ctype=<tree 0x0>,
explicit_targs=<tree_vec 0x7fffdb601d98>, 
    first_arg=<tree 0x0>, arglist=0x7fffdd6a60a0, return_type=<tree 0x0>,
access_path=<tree 0x0>, 
    conversion_path=<tree 0x0>, flags=1, obj=<tree 0x0>, strict=DEDUCE_CALL,
shortcut_bad_convs=true, 
    complain=3) at /home/mpolacek/src/gcc/gcc/cp/call.cc:3555
#17 0x0000000000b03f04 in add_template_candidate (candidates=0x7fffffffbdb0, 
    tmpl=<template_decl 0x7ffff7ffa180 r>, ctype=<tree 0x0>,
explicit_targs=<tree_vec 0x7fffdb601d98>, 
    first_arg=<tree 0x0>, arglist=0x7fffdd6a60a0, return_type=<tree 0x0>,
access_path=<tree 0x0>, 
    conversion_path=<tree 0x0>, flags=1, strict=DEDUCE_CALL,
shortcut_bad_convs=true, complain=3)
    at /home/mpolacek/src/gcc/gcc/cp/call.cc:3643
#18 0x0000000000b0cf1e in add_candidates (fns=<overload 0x7fffea41e900>,
first_arg=<tree 0x0>, 
    args=0x7fffdd6a60a0, return_type=<tree 0x0>, explicit_targs=<tree_vec
0x7fffdb601d98>, 
    template_only=true, conversion_path=<tree 0x0>, access_path=<tree 0x0>,
flags=1, 
    candidates=0x7fffffffbdb0, complain=3) at
/home/mpolacek/src/gcc/gcc/cp/call.cc:6191
#19 0x0000000000b0772c in perform_overload_resolution (fn=<overload
0x7fffea41e900>, args=0x7fffdd6a60a0, 
    candidates=0x7fffffffbdb0, any_viable_p=0x7fffffffbdaf, complain=3)
    at /home/mpolacek/src/gcc/gcc/cp/call.cc:4725


More information about the Gcc-bugs mailing list