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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Seems define_aggregate actually fails in the #c0 case (exactly because it is
not surrounded by a consteval block), but it is done in tf_none evaluation and
ctx->quiet is true, so no error is emitted, just *non_constant_p is set and the
define_aggregate call is returned non-folded.
If it wasnt ctx->quiet, it would emit
5966            error_at (loc, "%<define_aggregate%> not evaluated from "
5967                           "%<consteval%> block");
diagnostics.
This is from
#0  eval_define_aggregate (loc=4611686018427410961, ctx=0x7fffffffafc0,
type=<record_type 0x7fffe62d3930 S>, rvec=<tree_vec 0x7fffe6359f90>,
call=<call_expr 0x7fffe62d9f80>, 
    non_constant_p=0x7fffffffb12f) at ../../gcc/cp/reflect.cc:5965
#1  0x000000000088091f in process_metafunction (ctx=0x7fffffffafc0,
fun=<function_decl 0x7fffe6325e00 define_aggregate>, call=<call_expr
0x7fffe62d9f80>, 
    non_constant_p=0x7fffffffb12f, overflow_p=0x7fffffffb12e,
jump_target=0x7fffffffaef8) at ../../gcc/cp/reflect.cc:7702
#2  0x0000000000492fd3 in cxx_eval_call_expression (ctx=0x7fffffffafc0,
t=<call_expr 0x7fffe62d9f80>, lval=vc_prvalue, non_constant_p=0x7fffffffb12f,
overflow_p=0x7fffffffb12e, 
    jump_target=0x7fffffffaef8) at ../../gcc/cp/constexpr.cc:4013
#3  0x00000000004aad73 in cxx_eval_constant_expression (ctx=0x7fffffffafc0,
t=<call_expr 0x7fffe62d9f80>, lval=vc_prvalue, non_constant_p=0x7fffffffb12f,
overflow_p=0x7fffffffb12e, 
    jump_target=0x7fffffffaef8) at ../../gcc/cp/constexpr.cc:9351
#4  0x00000000004b2d75 in cxx_eval_outermost_constant_expr (t=<call_expr
0x7fffe62d9f80>, allow_non_constant=true, strict=true,
manifestly_const_eval=mce_value::mce_true, 
    constexpr_dtor=false, object=<tree 0x0>) at ../../gcc/cp/constexpr.cc:10938
#5  0x00000000004b45d9 in maybe_constant_value (t=<call_expr 0x7fffe62d9f80>,
decl=<tree 0x0>, manifestly_const_eval=mce_value::mce_true) at
../../gcc/cp/constexpr.cc:11365
#6  0x00000000007c927b in convert_nontype_argument (type=<meta_type
0x7fffe99aa690 decltype(^^int)>, expr=<call_expr 0x7fffe62d9f80>, complain=0)
at ../../gcc/cp/pt.cc:7687
#7  0x00000000007ce70c in convert_template_argument (parm=<parm_decl
0x7fffe6339770 I>, arg=<call_expr 0x7fffe62d9f80>, args=<tree_vec
0x7fffe6355320>, complain=0, i=0, 
    in_decl=<tree 0x0>) at ../../gcc/cp/pt.cc:9012
#8  0x0000000000826dbb in type_unification_real (tparms=<tree_vec
0x7fffe63552c0>, full_targs=<tree_vec 0x7fffe6355320>, xparms=<tree_list
0x7fffe9816cd0>, xargs=0x7fffffffb670, 
    xnargs=0, subr=0, strict=DEDUCE_CALL, checks=Python Exception <class
'RuntimeError'>: Null type name.
0x7fffffffb570, explain_p=false) at ../../gcc/cp/pt.cc:24864
#9  0x0000000000823be4 in fn_type_unification (fn=<template_decl 0x7fffe63397f8
foo>, explicit_targs=<tree_vec 0x7fffe6355340>, targs=<tree_vec
0x7fffe6355320>, 
    args=0x7fffffffb670, nargs=0, return_type=<tree 0x0>, strict=DEDUCE_CALL,
flags=1, convs=0x504dbf0, explain_p=false, decltype_p=false) at
../../gcc/cp/pt.cc:23906
#10 0x000000000041173c in add_template_candidate_real
(candidates=0x7fffffffbb38, tmpl=<template_decl 0x7fffe63397f8 foo>,
ctype=<tree 0x0>, 
    explicit_targs=<tree_vec 0x7fffe6300e70>, first_arg=<tree 0x0>,
arglist=0x7fffe73d8c18, 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
../../gcc/cp/call.cc:3776
#11 0x0000000000411d2d in add_template_candidate (candidates=0x7fffffffbb38,
tmpl=<template_decl 0x7fffe63397f8 foo>, ctype=<tree 0x0>,
explicit_targs=<tree_vec 0x7fffe6300e70>, 
    first_arg=<tree 0x0>, arglist=0x7fffe73d8c18, return_type=<tree 0x0>,
access_path=<tree 0x0>, conversion_path=<tree 0x0>, flags=1,
strict=DEDUCE_CALL, shortcut_bad_convs=true, 
    complain=3) at ../../gcc/cp/call.cc:3866
#12 0x000000000041d60d in add_candidates (fns=<overload 0x7fffe6355300>,
first_arg=<tree 0x0>, args=0x7fffe73d8c18, return_type=<tree 0x0>, 
    explicit_targs=<tree_vec 0x7fffe6300e70>, template_only=true,
conversion_path=<tree 0x0>, access_path=<tree 0x0>, flags=1,
candidates=0x7fffffffbb38, complain=3)
    at ../../gcc/cp/call.cc:6957
#13 0x00000000004168de in perform_overload_resolution (fn=<overload
0x7fffe6355300>, args=0x7fffe73d8c18, candidates=0x7fffffffbb38,
any_viable_p=0x7fffffffbb37, complain=3)
    at ../../gcc/cp/call.cc:5184
#14 0x0000000000416c46 in build_new_function_call (fn=<template_id_expr
0x7fffe6356460>, args=Python Exception <class 'RuntimeError'>: Null type name.
0x7fffffffbd68, complain=3) at ../../gcc/cp/call.cc:5290
#15 0x00000000008a1eab in finish_call_expr (fn=<template_id_expr
0x7fffe6356460>, args=Python Exception <class 'RuntimeError'>: Null type name.
0x7fffffffbd68, disallow_virtual=false, koenig_p=false, complain=3)
    at ../../gcc/cp/semantics.cc:3544
#16 0x000000000070f4e5 in cp_parser_postfix_expression (parser=0x7ffff7fbb0d0,
address_p=false, cast_p=false, member_access_only_p=false, decltype_p=false,
pidk_return=0x0)
    at ../../gcc/cp/parser.cc:9144
#17 0x00000000007135b1 in cp_parser_unary_expression (parser=0x7ffff7fbb0d0,
pidk=0x0, address_p=false, cast_p=false, decltype_p=false) at
../../gcc/cp/parser.cc:10624
#18 0x0000000000714db9 in cp_parser_cast_expression (parser=0x7ffff7fbb0d0,
address_p=false, cast_p=false, decltype_p=false, pidk=0x0) at
../../gcc/cp/parser.cc:11539
#19 0x0000000000714ebc in cp_parser_binary_expression (parser=0x7ffff7fbb0d0,
cast_p=false, no_toplevel_fold_p=false, decltype_p=false,
prec=PREC_NOT_OPERATOR, pidk=0x0)
    at ../../gcc/cp/parser.cc:11642
#20 0x000000000071621b in cp_parser_assignment_expression
(parser=0x7ffff7fbb0d0, pidk=0x0, cast_p=false, decltype_p=false) at
../../gcc/cp/parser.cc:11995
#21 0x0000000000716a55 in cp_parser_expression (parser=0x7ffff7fbb0d0,
pidk=0x0, cast_p=false, decltype_p=false, warn_comma_p=false) at
../../gcc/cp/parser.cc:12192
#22 0x000000000071deb9 in cp_parser_expression_statement
(parser=0x7ffff7fbb0d0, in_statement_expr=<tree 0x0>) at
../../gcc/cp/parser.cc:14756
#23 0x000000000071d4e2 in cp_parser_statement (parser=0x7ffff7fbb0d0,
in_statement_expr=<tree 0x0>, in_compound=true, if_p=0x0, chain=0x0,
loc_after_labels=0x0)
    at ../../gcc/cp/parser.cc:14504
#24 0x000000000071e810 in cp_parser_statement_seq_opt (parser=0x7ffff7fbb0d0,
in_statement_expr=<tree 0x0>) at ../../gcc/cp/parser.cc:15019
#25 0x000000000071e380 in cp_parser_compound_statement (parser=0x7ffff7fbb0d0,
in_statement_expr=<tree 0x0>, bcs_flags=0, function_body=true) at
../../gcc/cp/parser.cc:14866
#26 0x000000000073e547 in cp_parser_function_body (parser=0x7ffff7fbb0d0,
in_function_try_block=false) at ../../gcc/cp/parser.cc:28820
#27 0x000000000071b3d1 in cp_parser_lambda_body (parser=0x7ffff7fbb0d0,
lambda_expr=<lambda_expr 0x7fffe6493af0>) at ../../gcc/cp/parser.cc:13739
#28 0x00000000007187db in cp_parser_lambda_expression (parser=0x7ffff7fbb0d0,
consteval_block_p=true) at ../../gcc/cp/parser.cc:12864
#29 0x0000000000726126 in cp_parser_consteval_block (parser=0x7ffff7fbb0d0,
member_p=false) at ../../gcc/cp/parser.cc:17745

Reply via email to