1 2020-09-22 Patrick Palka <ppalka@redhat.com>
4 * pt.c (corresponding_template_parameter): Define.
5 (keep_template_parm): Use it to adjust the given template
6 parameter to the corresponding in-scope one from ctx_parms.
8 2020-09-22 Nathan Sidwell <nathan@acm.org>
10 * cp-tree.h (xref_tag_from_type): Don't declare.
11 * decl.c (xref_tag_from_type): Delete.
12 * pt.c (lookup_template_class_1): Erroneously located class
13 definitions just give error_mark, don't try and inject it into the
16 2020-09-22 Jakub Jelinek <jakub@redhat.com>
19 * constexpr.c (cxx_eval_builtin_function_call): Return void_node for
20 calls to __sanitize_ptr_{sub,cmp} builtins.
22 2020-09-22 Nathan Sidwell <nathan@acm.org>
24 * pt.c (instantiate_class_template_1): Do not repush and unhide
27 2020-09-21 Marek Polacek <polacek@redhat.com>
31 * lambda.c (maybe_add_lambda_conv_op): Mark the conversion function
34 2020-09-21 Marek Polacek <polacek@redhat.com>
36 * pt.c (deduction_guides_for): Add a bool parameter. Set it.
37 (do_class_deduction): Warn when CTAD succeeds but the type doesn't
38 have any explicit deduction guides.
40 2020-09-21 Nathan Sidwell <nathan@acm.org>
42 * decl.c (xref_tag_1): Use IDENTIFIER_LAMBDA_P to detect lambdas.
43 * lambda.c (begin_lambda_type): Use ts_current to push the tag.
44 * name-lookup.h (enum tag_scope): Drop ts_lambda.
46 2020-09-21 Marek Polacek <polacek@redhat.com>
49 * decl.c (redeclaration_error_message): Detect a redeclaration of
52 2020-09-19 Sandra Loosemore <sandra@codesourcery.com>
54 * cp-gimplify.c (enum bc_t, bc_label): Move to c-family.
55 (begin_bc_block, finish_bc_block, get_bc_label): Likewise.
56 (genericize_cp_loop): Likewise.
57 (genericize_for_stmt, genericize_while_stmt): Likewise.
58 (genericize_do_stmt, genericize_switch_stmt): Likewise.
59 (genericize_continue_stmt, genericize_break_stmt): Likewise.
60 (genericize_omp_for_stmt): Likewise.
61 (cp_genericize_r): Call c_genericize_control_stmt instead of
62 above functions directly.
63 (cp_genericize): Call save_bc_state and restore_bc_state instead
64 of manipulating bc_label directly.
65 * cp-objcp-common.c (cxx_block_may_fallthru): Defer to
66 c_block_may_fallthru instead of handling SWITCH_STMT here.
67 (cp_common_init_ts): Move handling of loop and switch-related
68 statements to c-family.
69 * cp-tree.def (FOR_STMT, WHILE_STMT, DO_STMT): Move to c-family.
70 (BREAK_STMT, CONTINUE_STMT, SWITCH_STMT): Likewise.
71 * cp-tree.h (LABEL_DECL_BREAK, LABEL_DECL_CONTINUE): Likewise.
72 (WHILE_COND, WHILE_BODY): Likewise.
73 (DO_COND, DO_BODY): Likewise.
74 (FOR_INIT_STMT, FOR_COND, FOR_EXPR, FOR_BODY, FOR_SCOPE): Likewise.
75 (SWITCH_STMT_COND, SWITCH_STMT_BODY): Likewise.
76 (SWITCH_STMT_TYPE, SWITCH_STMT_SCOPE): Likewise.
77 (SWITCH_STMT_ALL_CASES_P, SWITCH_STMT_NO_BREAK_P): Likewise.
78 * cxx-pretty-print.c (cxx_pretty_printer::statement): Move code
79 to handle structured loop and switch tree nodes to c-family.
80 * dump.c (cp_dump_tree): Likewise.
82 2020-09-19 Patrick Palka <ppalka@redhat.com>
86 * constraint.cc (map_arguments): Call template_parm_to_arg
87 in the self-mapping case.
88 (finish_shorthand_constraint): No need to build a TREE_LIST
89 before calling template_parm_to_arg.
90 * pt.c (template_parm_to_arg): Rewrite to handle TEMPLATE_PARM_P
91 nodes as well as DECL_TEMPLATE_PARM_P nodes, and to make the
92 overlying TREE_LIST node optional.
93 (keep_template_parm): Don't record a BOUND_TEMPLATE_TEMPLATE_PARM,
94 instead record its corresponding TEMPLATE_TEMPLATE_PARM.
95 (convert_generic_types_to_packs): Don't call
98 2020-09-19 Patrick Palka <ppalka@redhat.com>
101 * constraint.cc (satisfy_atom): Pass true as the
102 manifestly_const_eval argument to maybe_constant_value.
104 2020-09-18 Jason Merrill <jason@redhat.com>
107 * decl.c (complete_vars): Only call layout_var_decl if completing
110 2020-09-18 Jason Merrill <jason@redhat.com>
112 * decl.c (complete_vars): Call layout_var_decl.
114 2020-09-17 Patrick Palka <ppalka@redhat.com>
118 * constraint.cc (tsubst_requires_expr): Use REQUIRES_EXPR_PARMS
119 and REQUIRES_EXPR_REQS. Use REQUIRES_EXPR_EXTRA_ARGS,
120 add_extra_args and build_extra_args to defer substitution until
121 we have all the template arguments.
122 (finish_requires_expr): Adjust the call to build_min so that
123 REQUIRES_EXPR_EXTRA_ARGS gets set to NULL_TREE.
124 * cp-tree.def (REQUIRES_EXPR): Give it a third operand.
125 * cp-tree.h (REQUIRES_EXPR_PARMS, REQUIRES_EXPR_REQS,
126 REQUIRES_EXPR_EXTRA_ARGS): Define.
127 (add_extra_args, build_extra_args): Declare.
129 2020-09-16 Nathan Sidwell <nathan@acm.org>
131 * cp-tree.h (cp_check_omp_declare_reduction): Return bool.
132 * semantics.c (cp_check_omp_declare_reduction): Return true on for
134 * pt.c (push_template_decl_real): OMP reductions do not get a
136 (tsubst_function_decl): Remove special casing for local decl omp
138 (tsubst_expr): Call instantiate_body for a local omp reduction.
139 (instantiate_body): Add nested_p parm, and deal with such
141 (instantiate_decl): Reject FUNCTION_SCOPE entities, adjust
142 instantiate_body call.
144 2020-09-16 Nathan Sidwell <nathan@acm.org>
146 * pt.c (instantiate_body): Remove 'nested' var, simplify
149 2020-09-16 Nathan Sidwell <nathan@acm.org>
151 * pt.c (instantiate_body): New, broken out of ..
152 (instantiate_decl): ... here. Call it.
154 2020-09-15 Nathan Sidwell <nathan@acm.org>
156 * pt.c (push_template_decl_real): OMP reductions retain a template
158 (tsubst_function_decl): Likewise.
160 2020-09-15 Tobias Burnus <tobias@codesourcery.com>
163 * cp-gimplify.c (cxx_omp_finish_clause): Add bool openacc arg.
164 * cp-tree.h (cxx_omp_finish_clause): Likewise
165 * semantics.c (handle_omp_for_class_iterator): Update call.
167 2020-09-14 Marek Polacek <polacek@redhat.com>
169 * pt.c (push_template_decl_real): Use VAR_OR_FUNCTION_DECL_P.
171 2020-09-14 Nathan Sidwell <nathan@acm.org>
173 * pt.c (push_template_decl_real): Don't attach a template head to
175 (tsubst_function_decl): Add support for headless local extern
177 (tsubst_decl): Add support for headless local extern decls.
179 2020-09-11 Nathan Sidwell <nathan@acm.org>
181 * decl.c (grokfndecl): Don't attach to local extern.
183 2020-09-11 Nathan Sidwell <nathan@acm.org>
185 * parser.c (cp_parser_objc_method_definition_list): Reimplement
186 loop, make sure we pop scope.
188 2020-09-11 Marek Polacek <polacek@redhat.com>
190 * cp-tree.h (LOOKUP_CONSTINIT): Remove.
191 (LOOKUP_REWRITTEN): Adjust.
192 * decl.c (duplicate_decls): Set DECL_DECLARED_CONSTINIT_P.
193 (check_initializer): Use DECL_DECLARED_CONSTINIT_P instead of
195 (cp_finish_decl): Don't set DECL_DECLARED_CONSTINIT_P. Use
196 DECL_DECLARED_CONSTINIT_P instead of LOOKUP_CONSTINIT.
197 (grokdeclarator): Set DECL_DECLARED_CONSTINIT_P.
198 * decl2.c (grokfield): Don't handle LOOKUP_CONSTINIT.
199 * parser.c (cp_parser_decomposition_declaration): Remove
200 LOOKUP_CONSTINIT handling.
201 (cp_parser_init_declarator): Likewise.
202 * pt.c (tsubst_expr): Likewise.
203 (instantiate_decl): Likewise.
204 * typeck2.c (store_init_value): Use DECL_DECLARED_CONSTINIT_P instead
207 2020-09-10 Nathan Sidwell <nathan@acm.org>
209 * cp-tree.h (TINFO_VAR_DECLARED_CONSTINIT): Replace with ...
210 (DECL_DECLARED_CONSTINIT_P): ... this.
211 * decl.c (start_decl): No need to retrofit_lang_decl for constinit
213 (cp_finish_decl): Use DECL_DECLARED_CONSTINIT_P.
214 * pt.c (tsubst_decl): No need to handle constinit flag
216 (tsubst_expr): Or here.
218 2020-09-10 Nathan Sidwell <nathan@acm.org>
220 * cp-tree.h (DECL_LOCAL_FUNCTION_P): Rename to ...
221 (DECL_LOCAL_DECL_P): ... here. Accept both fns and vars.
222 * decl.c (start_decl): Set DECL_LOCAL_DECL_P for local externs.
223 (omp_declare_variant_finalize_one): Use DECL_LOCAL_DECL_P.
224 (local_variable_p): Simplify.
225 * name-lookup.c (set_decl_context_in_fn): Assert DECL_LOCAL_DECL_P
226 is as expected. Simplify.
227 (do_pushdecl): Don't set decl_context_in_fn for friends.
228 (is_local_extern): Simplify.
229 * call.c (equal_functions): Use DECL_LOCAL_DECL_P.
230 * parser.c (cp_parser_postfix_expression): Likewise.
231 (cp_parser_omp_declare_reduction): Likewise.
232 * pt.c (check_default_tmpl_args): Likewise.
233 (tsubst_expr): Assert nested reduction function is local.
234 (type_dependent_expression_p): Use DECL_LOCAL_DECL_P.
235 * semantics.c (finish_call_expr): Likewise.
237 2020-09-09 Marek Polacek <polacek@redhat.com>
240 * decl.c (reshape_init): If we're initializing a char array from
241 a string-literal that is enclosed in braces, unwrap it.
242 * init.c (build_new_1): Don't handle string-initializers here.
243 (build_new): Handle new-expression with paren-init when the
244 array bound is known. Always pass string constants to build_new_1
245 enclosed in braces. Don't handle string-initializers in any
248 2020-09-09 Marek Polacek <polacek@redhat.com>
251 * decl.c (reshape_init_r): When initializing an aggregate member
252 with an initializer from an initializer-list, also consider
255 2020-09-09 Nathan Sidwell <nathan@acm.org>
257 * parser.c (cp_parser_omp_declare_reduction): Refactor to avoid
258 code duplication. Update DECL_TI_TEMPLATE's context.
259 * pt.c (tsubst_expr): For OMP reduction function, set context to
260 global_namespace before pushing.
261 (tsubst_omp_udr): Assert current_function_decl, add comment about
264 2020-09-09 Patrick Palka <ppalka@redhat.com>
267 * class.c (resolve_address_of_overloaded_function): Check
268 constraints_satisfied_p and perform return-type deduction via
269 maybe_instantiate_decl when considering non-template functions
271 * cp-tree.h (maybe_instantiate_decl): Declare.
272 * decl2.c (maybe_instantiate_decl): Remove static.
274 2020-09-04 Jason Merrill <jason@redhat.com>
276 * expr.c (mark_use): Use iloc_sentinel.
278 2020-09-03 Jakub Jelinek <jakub@redhat.com>
281 * constexpr.c (fundef_copies_table): Change type from
282 hash_map<tree, tree> * to decl_tree_map *.
284 2020-09-03 Marek Polacek <polacek@redhat.com>
287 * cp-tree.h (do_aggregate_paren_init): Declare.
288 * decl.c (do_aggregate_paren_init): New.
289 (grok_reference_init): Use it.
290 (check_initializer): Likewise.
291 * init.c (perform_member_init): Handle initializing an array from
292 a ()-list. Use do_aggregate_paren_init.
294 2020-09-03 Jakub Jelinek <jakub@redhat.com>
297 * constexpr.c (cxx_eval_outermost_constant_expr): Temporarily disable
298 flag_rounding_math during manifestly constant evaluation.
300 2020-09-01 Marek Polacek <polacek@redhat.com>
303 * init.c (build_new_1): Call reshape_init.
305 2020-09-01 Jakub Jelinek <jakub@redhat.com>
308 * semantics.c (handle_omp_array_sections_1): Test
309 DECL_ARRAY_PARAMETER_P only on PARM_DECLs.
311 2020-08-31 Marek Polacek <polacek@redhat.com>
312 Jason Merrill <jason@redhat.com>
315 * call.c (build_new_method_call_1): Use build_constructor_from_vec
316 instead of build_tree_list_vec + build_constructor_from_list.
317 * init.c (build_new_1): Handle new char[]{"foo"}. Use
318 build_constructor_from_vec instead of build_tree_list_vec +
319 build_constructor_from_list.
320 (build_new): Deduce the array size in new-expression if not
321 present. Handle ()-init. Handle initializing an array from
323 * parser.c (cp_parser_new_type_id): Leave [] alone.
324 (cp_parser_direct_new_declarator): Allow [].
325 * pt.c (type_dependent_expression_p): In a NEW_EXPR, consider
326 array types whose dimension has to be deduced type-dependent.
328 2020-08-27 Martin Liska <mliska@suse.cz>
330 * class.c (build_vtbl_initializer): Set exact argument of a vector
331 growth function to true.
332 * constraint.cc (get_mapped_args): Likewise.
333 * decl.c (cp_maybe_mangle_decomp): Likewise.
334 (cp_finish_decomp): Likewise.
335 * parser.c (cp_parser_omp_for_loop): Likewise.
336 * pt.c (canonical_type_parameter): Likewise.
337 * rtti.c (get_pseudo_ti_init): Likewise.
339 2020-08-26 Nathan Sidwell <nathan@acm.org>
341 * decl.c (poplevel): A local-binding tree list holds the name in
343 * name-lookup.c (update_local_overload): Add id to TREE_PURPOSE.
344 (lookup_name_1): Deal with local-binding error_mark_node marker.
345 (op_unqualified_lookup): Return error_mark_node for 'nothing
346 found'. Retain global binding, check class binding here.
347 (maybe_save_operator_binding): Reimplement to always cache a
349 (push_operator_bindings): Deal with 'ignore' marker.
351 2020-08-25 Tobias Burnus <tobias@codesourcery.com>
354 * semantics.c (handle_omp_array_sections_1): Talk about
355 array function parameter in the error message.
357 2020-08-25 Jakub Jelinek <jakub@redhat.com>
360 * cp-tree.h (build_trivial_dtor_call): Add bool argument defaulted
362 * call.c (build_trivial_dtor_call): Add NO_PTR_DEREF argument. If
363 instance is a pointer and NO_PTR_DEREF is true, clobber the pointer
364 rather than what it points to.
365 * semantics.c (finish_call_expr): Call build_trivial_dtor_call with
366 true as NO_PTR_DEREF.
368 2020-08-25 Jason Merrill <jason@redhat.com>
371 * optimize.c (populate_clone_array): Revert PR70462 change.
372 (maybe_clone_body): Likewise.
374 2020-08-24 Nathan Sidwell <nathan@acm.org>
376 * ptree.c (debug_overload): New.
378 2020-08-19 Jason Merrill <jason@redhat.com>
381 * cp-tree.h (push_tinst_level, push_tinst_level_loc): Declare.
382 * constraint.cc (satisfy_declaration_constraints):
383 Use add_outermost_template_args and push_tinst_level.
384 * pt.c (add_outermost_template_args): Handle getting
385 a TEMPLATE_DECL as the first argument.
386 (push_tinst_level, push_tinst_level_loc): No longer static.
387 (fn_type_unification): Check satisfaction before non-dependent
390 2020-08-18 Nathan Sidwell <nathan@acm.org>
392 * cp-tree.h (SET_TYPE_TEMPLTE_INFO): Do not deal with ALIAS templates.
393 * pt.c (lookup_template_class_1): Special-case alias template
394 template_info setting.
396 2020-08-18 Jason Merrill <jason@redhat.com>
399 * pt.c (tsubst_aggr_type): Rewrite in C++17, too.
400 (maybe_dependent_member_ref): Likewise.
401 (build_deduction_guide): Re-substitute template parms.
402 * cp-tree.h (struct push_nested_class_guard): New.
403 * constraint.cc (get_normalized_constraints_from_decl): Use it.
405 2020-08-18 Jason Merrill <jason@redhat.com>
408 * pt.c (maybe_dependent_member_ref): New.
409 (tsubst_copy) [CONST_DECL]: Use it.
410 [VAR_DECL]: Likewise.
411 (tsubst_aggr_type): Handle nested type.
413 2020-08-18 Nathan Sidwell <nathan@acm.org>
415 * name-lookup.c (qualify_lookup): Drop lambda checking here.
416 Reorder namespace & type checking.
417 (lookup_name_1): Do hidden lambda checking here.
419 2020-08-14 Nathan Sidwell <nathan@acm.org>
421 * name-lookup.h (lookup_name_real, lookup_name_nonclass): Rename
423 (lookup_name): ... these new overloads.
424 * name-lookup.c (identifier_type_value_1): Rename lookup_name_real
426 (lookup_name_real_1): Rename to ...
427 (lookup_name_1): ... here.
428 (lookup_name_real): Rename to ...
429 (lookup_name): ... here. Rename lookup_name_real_1 call.
430 (lookup_name_nonclass): Delete.
431 * call.c (build_operator_new_call): Rename lookup_name_real call.
432 (add_operator_candidates): Likewise.
433 (build_op_delete_call): Rename lookup_name_nonclass call.
434 * parser.c (cp_parser_lookup_name): Likewise.
435 * pt.c (tsubst_friend_class, lookup_init_capture_pack): Likewise.
436 (tsubst_expr): Likewise.
437 * semantics.c (capture_decltype): Likewise.
439 2020-08-14 Nathan Sidwell <nathan@acm.org>
441 * cp-tree.h (LOOKUP_HIDDEN): Delete.
442 (LOOKUP_PREFER_RVALUE): Adjust initializer.
443 * name-lookup.h (enum class LOOK_want): Add HIDDEN_FRIEND and
445 (lookup_name_real): Drop flags parm.
446 (lookup_qualified_name): Drop find_hidden parm.
447 * name-lookup.c (class name_lookup): Drop hidden field, adjust
449 (name_lookup::add_overload): Check want for hiddenness.
450 (name_lookup::process_binding): Likewise.
451 (name_lookup::search_unqualified): Likewise.
452 (identifier_type_value_1): Adjust lookup_name_real call.
453 (set_decl_namespace): Adjust name_lookup ctor.
454 (qualify_lookup): Drop flags parm, use want for hiddenness.
455 (lookup_qualified_name): Drop find_hidden parm.
456 (lookup_name_real_1): Drop flags parm, adjust qualify_lookup
458 (lookup_name_real): Drop flags parm.
459 (lookup_name_nonclass, lookup_name): Adjust lookup_name_real
461 (lookup_type_scope_1): Adjust qualify_lookup calls.
462 * call.c (build_operator_new_call): Adjust lookup_name_real call.
463 (add_operator_candidates): Likewise.
464 * coroutines.cc (morph_fn_to_coro): Adjust lookup_qualified_name
466 * parser.c (cp_parser_lookup_name): Adjust lookup_name_real calls.
467 * pt.c (check_explicit_specialization): Adjust
468 lookup_qualified_name call.
469 (deduction_guides_for): Likewise.
470 (tsubst_friend_class): Adjust lookup_name_real call.
471 (lookup_init_capture_pack): Likewise.
472 (tsubst_expr): Likewise, don't look in namespaces.
473 * semantics.c (capture_decltype): Adjust lookup_name_real. Don't
476 2020-08-14 Jason Merrill <jason@redhat.com>
480 * cp-tree.h (unsafe_return_slot_p): Declare.
481 * call.c (is_base_field_ref): Rename to unsafe_return_slot_p.
482 (build_over_call): Check unsafe_return_slot_p.
483 (build_special_member_call): Likewise.
484 * init.c (expand_default_init): Likewise.
485 * typeck2.c (split_nonconstant_init_1): Likewise.
487 2020-08-14 Nathan Sidwell <nathan@acm.org>
489 * cp-tree.h (LOOKUP_PREFER_TYPES, LOOKUP_PREFER_NAMESPACES)
490 (LOOKUP_NAMESPACES_ONLY, LOOKUP_TYPES_ONLY)
491 (LOOKUP_QUALIFIERS_ONL): Delete.
492 (LOOKUP_HIDDEN): Adjust.
493 * name-lookup.h (enum class LOOK_want): New.
494 (operator|, operator&): Overloads for it.
495 (lookup_name_real): Replace prefer_type & namespaces_only with
497 (lookup_qualified_name): Replace prefer_type with LOOK_want.
498 (lookup_name_prefer_type): Replace with ...
499 (lookup_name): ... this. New overload with LOOK_want parm.
500 * name-lookup.c (struct name_lookup): Replace flags with want and
501 hidden fields. Adjust constructors.
502 (name_lookyp::add_overload): Correct hidden stripping test. Update
503 for new LOOK_want type.
504 (name_lookup::process_binding): Likewise.
505 (name_lookup::search_unqualified): Use hidden flag.
506 (identifier_type_value_1): Adjust lookup_name_real call.
507 (set_decl_namespace): Adjust name_lookup ctor.
508 (lookup_flags): Delete.
509 (qualify_lookup): Add LOOK_want parm, adjust.
510 (lookup_qualified_name): Replace prefer_type parm with LOOK_want.
511 (lookup_name_real_1): Replace prefer_type and namespaces_only with
513 (lookup_name_real): Likewise.
514 (lookup_name_nonclass, lookup_name): Adjust lookup_name_real call.
515 (lookup_name_prefer_type): Rename to ...
516 (lookup_name): ... here. New overload with LOOK_want parm.
517 (lookup_type_scope_1): Adjust qualify_lookup calls.
518 * call.c (build_operator_new_call)
519 (add_operator_candidates): Adjust lookup_name_real calls.
520 * coroutines.cc (find_coro_traits_template_decl)
521 (find_coro_handle_template_decl, morph_fn_to_coro): Adjust
522 lookup_qualified_name calls.
523 * cp-objcp-common.c (identifier_global_tag): Likewise.
524 * decl.c (get_tuple_size, get_tuple_decomp_init): Likewise.
525 (lookup_and_check_tag): Use lookup_name overload.
526 * parser.c (cp_parser_userdef_numeric_literal): Adjust
527 lookup_qualified_name call.
528 (prefer_arg_type): Drop template_mem_access parm, return LOOK_want
530 (cp_parser_lookup_name): Adjust lookup_member, lookup_name_real
532 * pt.c (check_explicit_specialization): Adjust lookup_qualified_name
534 (tsubst_copy_and_build, tsubst_qualified_name): Likewise
535 (deduction_guides_for): Likewise.
536 (tsubst_friend_class): Adjust lookup_name_real call.
537 (lookup_init_capture, tsubst_expr): Likewise.
538 * rtti.c (emit_support_tinfos): Adjust lookup_qualified_name call.
539 * semantics.c (omp_reduction_lookup): Likewise.
540 (capture_decltype): Adjust lookup_name_real call.
542 2020-08-13 Nathan Sidwell <nathan@acm.org>
544 * name-lookup.h (enum class LOOK_where): New.
545 (operator|, operator&): Overloads for it.
546 (lookup_name_real): Replace NONCLASS & BLOCK_P parms with WHERE.
547 * name-lookup.c (identifier_type_value_w): Adjust
548 lookup_name_real call.
549 (lookup_name_real_1): Replace NONCLASS and BLOCK_P parameters
550 with WHERE bitmask. Don't search namespaces if not asked to.
551 (lookup_name_real): Adjust lookup_name_real_1 call.
552 (lookup_name_nonclass, lookup_name)
553 (lookup_name_prefer_type): Likewise.
554 * call.c (build_operator_new_call)
555 (add_operator_candidates): Adjust lookup_name_real calls.
556 * parser.c (cp_parser_lookup_name): Likewise.
557 * pt.c (tsubst_friend_class, lookup_init_capture_pack)
558 (tsubst_expr): Likewise.
559 * semantics.c (capture_decltype): Likewise.
561 2020-08-13 Marek Polacek <polacek@redhat.com>
564 * typeck.c (build_static_cast_1): Implement P1975R0 by allowing
565 static_cast to aggregate type.
567 2020-08-10 Jakub Jelinek <jakub@redhat.com>
570 * constexpr.c (cxx_eval_binary_expression): For SPACESHIP_EXPR, tail
571 call cxx_eval_constant_expression after genericize_spaceship to avoid
572 undesirable further VERIFY_CONSTANT.
574 2020-08-10 Patrick Palka <ppalka@redhat.com>
576 * pt.c (resolve_overloaded_unification): Drop functions with
577 unsatisfied constraints.
578 (resolve_nondeduced_context): Likewise.
580 2020-08-05 Patrick Palka <ppalka@redhat.com>
581 Jason Merrill <jason@redhat.com>
584 * constexpr.c (cxx_eval_vec_init_1): Truncate ctx->ctor and
585 then clear CONSTRUCTOR_NO_CLEARING on each appended element
586 initializer if we're initializing a previously zero-initialized
589 2020-08-04 Marek Polacek <polacek@redhat.com>
592 * parser.c (cp_parser_elaborated_type_specifier): Allow
593 'template' following ::.
595 2020-08-04 Nathan Sidwell <nathan@acm.org>
597 * parser.c (cp_parser_explicit_specialization): Refactor
598 to avoid leak of num_template_parameter_lists value.
600 2020-08-04 Patrick Palka <ppalka@redhat.com>
603 * init.c (sort_mem_initializers): Preserve TREE_TYPE of the
604 member initializer list node.
605 (emit_mem_initializers): Set input_location when performing each
606 member initialization.
607 * parser.c (cp_parser_mem_initializer): Attach the source
608 location of this initializer to a dummy EMPTY_CLASS_EXPR
609 within the TREE_TYPE of the list node.
610 * pt.c (tsubst_initializer_list): Preserve TREE_TYPE of the
611 member initializer list node.
613 2020-08-03 Marek Polacek <polacek@redhat.com>
615 * cp-tree.h (after_nsdmi_defaulted_late_checks): Remove.
617 2020-08-03 Marek Polacek <polacek@redhat.com>
621 * pt.c (check_default_tmpl_args): Also consider variable
624 2020-07-31 Jakub Jelinek <jakub@redhat.com>
627 * decl.c (finish_function): In constexpr functions use for C++14 and
628 later error instead of warning if no return statement is present and
629 diagnose it regardless of warn_return_type. Move the warn_return_type
630 diagnostics earlier in the function.
632 2020-07-31 Martin Sebor <msebor@redhat.com>
635 * class.c (build_base_path): Set no-warning bit on the synthesized
636 conditional expression in static_cast.
638 2020-07-31 Richard Biener <rguenther@suse.de>
641 * cp-objcp-common.h (LANG_HOOKS_FINALIZE_EARLY_DEBUG):
642 Define to c_common_finalize_early_debug.
644 2020-07-31 Patrick Palka <ppalka@redhat.com>
647 * constexpr.c (cxx_eval_constant_expression) <case CONST_DECL>:
648 Pass false to decl_constant_value and decl_really_constant_value
649 so that they don't unshare their result.
650 * cp-tree.h (decl_constant_value): New declaration with an added
652 (decl_really_constant_value): Add bool parameter defaulting to
653 true to existing declaration.
654 * init.c (constant_value_1): Add bool parameter which controls
655 whether to unshare the initializer before returning. Call
656 unshare_expr at most once.
657 (scalar_constant_value): Pass true to constant_value_1's new
659 (decl_really_constant_value): Add bool parameter and forward it
661 (decl_constant_value): Likewise, but instead define a new
662 overload with an added bool parameter.
664 2020-07-30 Patrick Palka <ppalka@redhat.com>
667 * pt.c (resolve_overloaded_unification): If the function
668 template specialization has a placeholder return type,
669 then instantiate it before attempting unification.
671 2020-07-30 Patrick Palka <ppalka@redhat.com>
674 * pt.c (alias_ctad_tweaks): Call remove_constraints before
675 calling set_constraints.
677 2020-07-30 Patrick Palka <ppalka@redhat.com>
680 * pt.c (reduce_template_parm_level): Propagate DECL_VIRTUAL_P
681 from the original TEMPLATE_PARM_DECL to the new lowered one.
683 2020-07-30 Patrick Palka <ppalka@redhat.com>
686 * constraint.cc (constraints_satisfied_p): Return true if
688 * pt.c (do_type_instantiation): Update a paragraph taken from
689 [temp.explicit] to reflect the latest specification. Don't
690 instantiate a member with unsatisfied constraints.
692 2020-07-29 Jason Merrill <jason@redhat.com>
695 * cp-tree.h (IMPLICIT_RVALUE_P): New.
696 (enum cp_lvalue_kind_flags): Add clk_implicit_rval.
697 (implicit_rvalue_p, set_implicit_rvalue_p): New.
698 * call.c (reference_binding): Check clk_implicit_rval.
699 (build_over_call): Adjust C++20 implicit move.
700 * coroutines.cc (finish_co_return_stmt): Simplify implicit move.
701 * except.c (build_throw): Adjust C++20 implicit move.
702 * pt.c (tsubst_copy_and_build) [STATIC_CAST_EXPR]: Propagate
704 * tree.c (lvalue_kind): Set clk_implicit_rval.
705 * typeck.c (treat_lvalue_as_rvalue_p): Overhaul.
706 (maybe_warn_pessimizing_move): Adjust.
707 (check_return_expr): Adjust C++20 implicit move.
709 2020-07-29 Jason Merrill <jason@redhat.com>
712 * call.c (build_over_call): Don't call a const ref
713 overload for implicit move.
715 2020-07-28 Nathan Sidwell <nathan@acm.org>
717 * cp-gimplify.c (cp_genericize_r): Set IMPORTED_DECL's context.
718 * cp-objcp-common.c (cp_pushdecl): Set decl's context.
719 * decl.c (grokfndecl): Make DECL_CONTEXT setting clearer.
721 2020-07-28 Nathan Sidwell <nathan@acm.org>
723 * class.c (fixup_type_variants): Copy TYPE_SIZE and
725 (finish_struct): Call it.
727 2020-07-28 Nathan Sidwell <nathan@acm.org>
729 * ptree.c (cxx_print_decl): Better indentation.
731 2020-07-28 Jakub Jelinek <jakub@redhat.com>
732 Mark Wielaard <mark@klomp.org>
735 * parser.c (cp_lexer_safe_previous_token): Don't call
736 cp_lexer_previous_token, instead inline it by hand and return NULL
737 instead of failing assertion if all previous tokens until the first
739 (cp_parser_error_1): Optimize - only call cp_lexer_safe_previous_token
740 if token->type is CPP_NAME. Use cp_lexer_safe_previous_token instead
741 of cp_lexer_previous_token for the missing_token_desc != RT_NONE
744 2020-07-27 Nathan Sidwell <nathan@acm.org>
746 * cp-tree.h (enum cp_tree_index): Add CPTI_AS_BASE_IDENTIFIER.
747 (as_base_identifier): Define.
748 * decl.c (initialize_predifined_identifiers): Initialize as_base
750 * class.c (layout_class_type): Name the as-base type. Zap
751 NSDMI its fields may have.
753 2020-07-22 Nathan Sidwell <nathan@acm.org>
755 * class.c (maybe_add_class_template_decl_list): Don't add CONST_DECLs.
757 2020-07-22 Nathan Sidwell <nathan@acm.org>
759 * typeck.c (structural_comptypes): [DECLTYPE_TYPE] break
761 [UNDERLYING_TYPE]: Use an if.
764 2020-07-22 Nathan Sidwell <nathan@acm.org>
766 * decl.c (decls_match): Move variables into scopes
768 (duplicate_decls): Use STRIP_TEMPLATE.
769 (build_typename_type): Move var decls to their assignments.
770 (begin_function_body): Likewise.
771 * decl2.c (get_guard): Likewise.
772 (mark_used): Use true for truthiness.
773 * error.c (dump_aggr_type): Hold the decl in a var called
776 2020-07-22 Nathan Sidwell <nathan@acm.org>
778 * cp-tree.h (struct tree_lambda_expr): Shrink
779 default_capture_mode & discriminator.
781 2020-07-22 Nathan Sidwell <nathan@acm.org>
783 * mangle.c (decl_is_template_id): Rename to ...
784 (maybe_template_info): ... here. Return the template info,
785 rather than use a pointer. Adjust all callers.
786 (find_substitution): Use template_args_equal, rather than
789 2020-07-22 Tobias Burnus <tobias@codesourcery.com>
791 * parser.c (cp_parser_omp_clause_hint): Require nonnegative hint.
792 (cp_parser_omp_critical): Permit hint(0) clause without named critical.
793 * pt.c (tsubst_expr): Re-check the latter for templates.
795 2020-07-21 Sunil K Pandey <skpgkp2@gmail.com>
798 * decl.c (cp_finish_decl): Call target hook
799 lower_local_decl_alignment to lower local decl alignment.
801 2020-07-21 Nathan Sidwell <nathan@acm.org>
803 * parser.c (cp_lexer_consume_token): Drop PRAGMA_EOL assert.
804 (cp_parser_skip_to_closing_parenthesis_1): Only pass start token
805 to pragma skipper if recovering.
806 (cp_parser_skip_to_pragma_eol): Only purge and change pragma
807 state when recovering.
809 2020-07-20 Jason Merrill <jason@redhat.com>
811 * pt.c (type_dependent_expression_p): A pseudo-dtor can be
813 * semantics.c (finish_call_expr): Use build_trivial_dtor_call for
815 (finish_pseudo_destructor_expr): Leave type NULL for dependent arg.
817 2020-07-20 Jason Merrill <jason@redhat.com>
819 * mangle.c (write_base_ref): New.
820 (write_expression): Use it for base field COMPONENT_REFs.
821 * pt.c (invalid_tparm_referent_p): Canonicalize the type
822 of array offsets. Allow subobjects.
824 2020-07-20 Jason Merrill <jason@redhat.com>
826 * pt.c (collect_ctor_idx_types): Add 'const' when deducing from
829 2020-07-17 Marek Polacek <polacek@redhat.com>
832 * decl.c (grokdeclarator): Detect cv-qual decltype(auto).
833 * pt.c (do_auto_deduction): Likewise.
835 2020-07-16 Iain Sandoe <iain@sandoe.co.uk>
842 * coroutines.cc (struct coro_ret_data): Delete.
843 (coro_maybe_expand_co_return): Delete.
844 (co_return_expander): Delete.
845 (expand_co_returns): Delete.
846 (co_await_find_in_subtree): Remove unused name.
847 (build_actor_fn): Remove unused parm, remove handling
848 for co_return expansion.
849 (register_await_info): Demote duplicate info message to a
851 (coro_make_frame_entry): Move closer to use site.
852 (struct susp_frame_data): Add fields for final suspend label
853 and a flag to indicate await expressions with initializers.
854 (captures_temporary): Delete.
855 (register_awaits): Remove unused code, update comments.
856 (find_any_await): New.
857 (tmp_target_expr_p): New.
858 (struct interesting): New.
859 (find_interesting_subtree): New.
860 (struct var_nest_node): New.
861 (flatten_await_stmt): New.
862 (handle_nested_conditionals): New.
863 (process_conditional): New.
864 (replace_statement_captures): Rename to...
865 (maybe_promote_temps): ... this.
866 (maybe_promote_captured_temps): Delete.
867 (analyze_expression_awaits): Check for await expressions with
868 initializers. Simplify handling for truth-and/or-if.
869 (expand_one_truth_if): Simplify (map cases that need expansion
871 (await_statement_walker): Handle CO_RETURN_EXPR. Simplify the
872 handling for truth-and/or-if expressions.
873 (register_local_var_uses): Ensure that we create names in the
874 implementation namespace.
875 (morph_fn_to_coro): Add final suspend label to suspend frame
876 callback data and remove it from the build_actor_fn call.
878 2020-07-16 Marek Polacek <polacek@redhat.com>
880 * call.c (convert_like): Remove macro and introduce a new
882 (convert_like_with_context): Likewise.
883 (convert_like_real): Rename to convert_like.
884 (convert_like_real_1): Rename to convert_like_internal. Call
885 convert_like instead of convert_like_real therein.
886 (perform_direct_initialization_if_possible): Call convert_like
887 instead of convert_like_real.
889 2020-07-16 Iain Sandoe <iain@sandoe.co.uk>
891 * coroutines.cc: Correct some spelling errors
894 2020-07-15 Nathan Sidwell <nathan@acm.org>
896 * parser.c (cp_parser_declaration): Avoid copying tokens.
897 (cp_parser_block_declaration): RAII token pointer.
899 2020-07-15 Nathan Sidwell <nathan@acm.org>
901 * parser.c (cp_parser_skip_to_closing_parenthesis_1): Deal with
902 meeting a deferred pragma.
903 (cp_parser_skip_to_end_of_statement): Likewise.
904 (cp_parser_skip_to_end_of_block_or_statement): Likewise.
905 (cp_parser_skip_to_pragma_eol): We should never meet EOF.
906 (cp_parser_omp_declare_simd): Likewise.
907 (cp_parser_omp_declare_reduction, cp_parser_oacc_routine)
908 (pragma_lex): Likewise.
910 2020-07-14 Marek Polacek <polacek@redhat.com>
915 * call.c (convert_like_real_1): Renamed from convert_like_real.
916 (convert_like_real): New wrapper for convert_like_real_1.
918 2020-07-14 Nathan Sidwell <nathan@acm.org>
920 * parser.c (cp_lexer_alloc): Do not deal with PCH here.
921 (cp_lexer_new_main): Deal with PCH here. Store the tokens directly
923 (cp_lexer_new_from_tokens): Assert last token isn't purged either.
924 (cp_lexer_get_preprocessor_token): Change first arg to flags, adjust.
925 (cp_parser_new): Pass the lexer in, don't create it here.
926 (cp_parser_translation_unit): Initialize access checks here.
927 (cp_parser_initial_pragma): First token is provided by caller,
928 don't deal with PCH stopping here. Adjust error message.
929 (c_parse_file): Adjust, change error message to avoid C++20 module
932 2020-07-14 Nathan Sidwell <nathan@acm.org>
934 * ptree.c (cxx_print_type): Add TYPEOF_TYPE and BASES.
936 2020-07-14 Nathan Sidwell <nathan@acm.org>
938 * class.c (build_base_field_1): Cache CLASSTYPE_AS_BASE.
939 (build_self_reference): Rename value -> decl.
940 (dump_class_hierarchy_1): Cache CLASSTYPE_AS_BASE.
942 2020-07-14 Marek Polacek <polacek@redhat.com>
945 * decl.c (grokdeclarator) <case cdk_function>: Check also
946 pointers/references/... to functions.
948 2020-07-14 Nathan Sidwell <nathan@acm.org>
950 * cp-tree.h: Correct some tree lang flag comments,
951 reformat some structure definitions. Note some structure
952 sizes. Clarify some comments.
953 (yyungetc): Delete. Not been a thing for some time.
954 * class.c (copy_fndecl_with_name): Comment.
955 (check_bases_and_members): Unnecessary {}.
956 (layout_class_type): Comment.
957 * cp-tree.def (UNBOUND_CLASS_TEMPLATE): Adjust comment.
958 * decl.c: Fix some formatting & whitespace issues.
959 (function_requirements_equivalent_p): Note why
960 substitutions are needed.
961 * decl2.c (no_linkage_error): Note that heroics about
962 'typedef struct { ... };' are no longer needed.
963 * method.c: Whitespace.
964 * name-lookup.c: Whitespace.
965 (add_decl_to_level): Reformat a line.
966 (print_binding_stack): Mark as DEBUG_FUNCTION.
967 (has_using_namespace_std_directive_p): Delete comment.
969 * ptree.c: Whitespace.
970 * rtti.c: Whitespace & comment.
972 * typeck.c (structural_comptypes): Add comment.
974 2020-07-13 Nathan Sidwell <nathan@acm.org>
976 * Make-lang.in (c++.disclean): Likewise.
978 2020-07-13 Marek Polacek <polacek@redhat.com>
981 * parser.c (cp_parser_enum_specifier): Commit to tentative parse
982 after we've seen an opening brace.
984 2020-07-10 Jason Merrill <jason@redhat.com>
986 * tree.c (structural_type_p): Allow unions.
987 * mangle.c (write_expression): Express unions with a designator.
989 2020-07-10 Jason Merrill <jason@redhat.com>
991 * pt.c (convert_nontype_argument): Handle REAL_TYPE.
992 (invalid_nontype_parm_type_p): Allow all structural types.
993 * tree.c (structural_type_p): Use SCALAR_TYPE_P.
995 2020-07-10 Jason Merrill <jason@redhat.com>
1000 * class.c (check_field_decls): An array of empty classes is not an
1002 (layout_empty_base_or_field): Handle explicit alignment.
1005 2020-07-09 Julian Brown <julian@codesourcery.com>
1006 Thomas Schwinge <thomas@codesourcery.com>
1009 * semantics.c (finish_omp_clauses): Likewise.
1011 2020-07-09 Patrick Palka <ppalka@redhat.com>
1014 * constexpr.c (potential_constant_expression_1) <case PARM_DECL>:
1015 Restore dependent_type_p check that guarded the call to
1016 is_really_empty_class.
1018 2020-07-08 Patrick Palka <ppalka@redhat.com>
1021 * constexpr.c (potential_constant_expression_1) <case PARM_DECL>:
1022 When processing_template_decl, check COMPLETE_TYPE_P before
1023 calling is_really_empty_class. Don't check dependent_type_p.
1025 2020-07-08 Marek Polacek <polacek@redhat.com>
1028 * parser.c (cp_parser_decltype): Print error about using decltype(auto)
1029 in C++11. Check that the token following "auto" is ")".
1031 2020-07-07 Patrick Palka <ppalka@redhat.com>
1034 * cxx-pretty-print.c (pp_cxx_unqualified_id): Check
1035 PRIMARY_TEMPLATE_P before printing the innermost template
1038 2020-07-07 Martin Sebor <msebor@redhat.com>
1041 * parser.c (class_decl_loc_t::diag_mismatched_tags): Print notes only
1042 if warning_at returns nonzero.
1044 2020-07-06 Martin Sebor <msebor@redhat.com>
1047 * call.c (build_over_call): Check calls only when tf_warning is set.
1049 2020-07-06 Nathan Sidwell <nathan@acm.org>
1051 * decl.c (push_library_fn): Return the decl pushdecl_toplevel returns.
1052 * except.c (verify_library_fn): Replace with ...
1053 (declare_library_fn_1): ... this fn. Always push the fn.
1054 (declare_library_fn): Call it.
1055 (build_throw): Call declare_library_fn_1.
1057 2020-07-06 Jonathan Wakely <jwakely@redhat.com>
1060 * parser.c (cp_parser_toplevel_declaration): Only do pedwarn for
1061 empty-declaration in C++98.
1063 2020-07-02 Jason Merrill <jason@redhat.com>
1064 Jakub Jelinek <jakub@redhat.com>
1066 * decl.c (grokfndecl): Allow consteval virtual.
1067 * search.c (check_final_overrider): Check consteval mismatch.
1068 * constexpr.c (cxx_eval_thunk_call): New.
1069 (cxx_eval_call_expression): Call it.
1070 * cvt.c (cp_get_fndecl_from_callee): Handle FDESC_EXPR.
1071 * decl2.c (mark_vtable_entries): Track vtables with consteval.
1072 (maybe_emit_vtables): Pass consteval_vtables through.
1073 (clear_consteval_vfns): Replace consteval with nullptr.
1074 (c_parse_final_cleanups): Call it.
1076 2020-07-01 Nathan Sidwell <nathan@acm.org>
1078 * class.c (copy_fndecl_with_name): Add additional predicate args, do
1079 not deduce them locally.
1080 (copy_operator_fn): Adjust copy_fndecl_with_name call.
1081 (build_clone): Add vtt and inherited predicate args. Pass through
1082 to copy_fndecl_with_name call.
1083 (build_cdtor_clones): Likewise, pass through to build_clone as
1085 (build_cdtor): Determine vtt and inherited here.
1086 * cp-tree.h (DECL_NEEDS_CTT_PARM_P): Delete.
1088 2020-06-30 Nathan Sidwell <nathan@acm.org>
1090 * cp-tree.h (copy_fndecl_with_name): Rename to ...
1091 (copy_operatorn_fn): ... this. Change arg type.
1092 (clone_function_decl): Rename to ...
1093 (clone_cdtor): ... this.
1094 * class.c (copy_fndecl_with_name): Make static.
1095 (copy_operator_fn): New wrapper.
1096 (build_clones): Rename to ...
1097 (build_cdtor_clones): ... this.
1098 (clone_function_decl): Rename to ...
1099 (clone_cdtor): ... this. Adjust build_clones calls.
1100 (clone_constructors_and_destructors): Adjust clone_function_decl
1102 * method.c (implicitly_declare_fn): Adjust copy_fndecl_with_name
1104 (lazily_declare_fn): Adjust clone_function_decl call.
1105 * pt.c (tsubst_function_decl): Likewise.
1106 (instantiate_template_1): Likewise.
1108 2020-06-30 Iain Sandoe <iain@sandoe.co.uk>
1110 * coroutines.cc (morph_fn_to_coro): Remove trailing
1111 space in a diagnostic.
1113 2020-06-30 Iain Sandoe <iain@sandoe.co.uk>
1115 * coroutines.cc (expand_one_await_expression): Remove
1116 code dealing with initial suspend.
1117 (build_actor_fn): Remove code special-casing initial
1118 and final suspend. Handle the final suspend and marking
1119 of the coroutine as done.
1120 (coro_rewrite_function_body): New.
1121 (bind_expr_find_in_subtree): Remove.
1122 (coro_body_contains_bind_expr_p): Remove.
1123 (morph_fn_to_coro): Split the rewrite of the original
1124 function into coro_rewrite_function_body and call it.
1126 2020-06-29 Marek Polacek <polacek@redhat.com>
1129 * decl.c (duplicate_decls): Make sure a concept or a variable
1130 template is unique in its declarative region.
1132 2020-06-29 Marek Polacek <polacek@redhat.com>
1135 * pt.c (collect_ctor_idx_types): Use TREE_TYPE.
1137 2020-06-28 Iain Sandoe <iain@sandoe.co.uk>
1140 * coroutines.cc (register_local_var_uses): Skip past
1143 2020-06-27 Iain Sandoe <iain@sandoe.co.uk>
1146 * coroutines.cc (get_awaitable_var): New helper.
1147 (build_co_await): Check more carefully before
1148 copying an awaitable.
1149 (expand_one_await_expression): No initializer
1150 is required when the awaitable is not a temp.
1151 (register_awaits): Remove handling that is now
1152 completed when the await expression is built.
1154 2020-06-27 Iain Sandoe <iain@sandoe.co.uk>
1156 * coroutines.cc (morph_fn_to_coro): Diagnose unavailable
1157 get_return_object_on_allocation_failure.
1159 2020-06-26 Iain Sandoe <iain@sandoe.co.uk>
1162 * coroutines.cc (struct coroutine_info):Add a field
1163 to hold computed p.return_void expressions.
1164 (coro_build_promise_expression): New.
1165 (get_coroutine_return_void_expr): New.
1166 (finish_co_yield_expr): Build the promise expression
1167 using coro_build_promise_expression.
1168 (finish_co_return_stmt): Likewise.
1169 (build_init_or_final_await): Likewise.
1170 (morph_fn_to_coro): Likewise, for several cases.
1172 2020-06-26 Iain Sandoe <iain@sandoe.co.uk>
1174 * coroutines.cc (morph_fn_to_coro): Handle error
1175 returns in building g-r-o-o-a-f expressions.
1177 2020-06-24 Nicholas Krause <xerofoify@gmail.com>
1180 * typeck2.c (cxx_incomplete_type_diagnostic): Add missing
1181 TYPE_EXPANSION_PACK check for diagnosing incomplete types in
1182 cxx_incomplete_type_diagnostic.
1184 2020-06-24 Iain Sandoe <iain@sandoe.co.uk>
1188 * coroutines.cc (act_des_fn): Copy function
1189 attributes onto the outlined coroutine helpers.
1191 2020-06-24 Jason Merrill <jason@redhat.com>
1193 * call.c (build_over_call): Only call build_base_path once.
1195 2020-06-24 Jason Merrill <jason@redhat.com>
1198 * call.c (build_over_call): Look up the overrider in base_binfo.
1199 * class.c (lookup_vfn_in_binfo): Look through BINFO_PRIMARY_P.
1201 2020-06-23 Jason Merrill <jason@redhat.com>
1204 Implement C++20 P2082R1, Fixing CTAD for aggregates.
1205 * cp-tree.h (TPARMS_PRIMARY_TEMPLATE): Split out from...
1206 (DECL_PRIMARY_TEMPLATE): ...here.
1207 (builtin_guide_p): Declare.
1208 * decl.c (reshape_init_class): Handle bases of a template.
1209 (reshape_init_r): An array with dependent bound takes a single
1211 * pt.c (tsubst_default_argument): Shortcut {}.
1212 (unify_pack_expansion): Allow omitted arguments to trailing pack.
1213 (builtin_guide_p): New.
1214 (collect_ctor_idx_types): Give a trailing pack a {} default
1215 argument. Handle arrays better.
1217 2020-06-23 Iain Sandoe <iain@sandoe.co.uk>
1220 * coroutines.cc (morph_fn_to_coro): Apply a cleanup to
1221 the get return object when the DTOR is non-trivial.
1223 2020-06-20 Iain Sandoe <iain@sandoe.co.uk>
1226 * coroutines.cc (morph_fn_to_coro): Update handling of
1227 get-return-object-on-allocation-fail and diagnose missing
1230 2020-06-20 Jason Merrill <jason@redhat.com>
1232 * call.c (joust): Only compare constraints for non-template
1233 candidates with matching parameters.
1234 * pt.c (tsubst_pack_expansion): Fix getting a type parameter
1236 (more_specialized_fn): Only compare constraints for candidates with
1237 matching parameters.
1239 2020-06-19 Jason Merrill <jason@redhat.com>
1241 * method.c (early_check_defaulted_comparison): Allow defaulting
1242 comparison outside class. Complain if non-member operator isn't a
1245 2020-06-18 Jason Merrill <jason@redhat.com>
1247 * method.c (early_check_defaulted_comparison): Check for &&.
1248 (build_comparison_op): Allow empty union. Diagnose non-category
1250 (common_comparison_type): Remove handling for non-category type.
1252 2020-06-18 Marek Polacek <polacek@redhat.com>
1255 * pt.c (finish_template_variable): Return if
1256 coerce_innermost_template_parms return error_mark_node.
1258 2020-06-18 Marek Polacek <polacek@redhat.com>
1261 * pt.c (tsubst_copy_and_build) <case NEW_EXPR>: Return error_mark_node
1262 if placement is erroneous.
1264 2020-06-17 Jonathan Wakely <jwakely@redhat.com>
1267 * parser.c (cp_parser_elaborated_type_specifier): Do not warn
1268 unless in a declaration.
1270 2020-06-17 Jason Merrill <jason@redhat.com>
1272 * cp-tree.h (copy_fndecl_with_name): Declare.
1273 * class.c (copy_fndecl_with_name): Split out from...
1274 (build_clone): ...here.
1275 (add_implicitly_declared_members): Add op== to TYPE_FIELDS.
1276 * method.c (implicitly_declare_fn): Use copy_fndecl_with_name.
1278 2020-06-17 Jason Merrill <jason@redhat.com>
1280 * call.c (build_new_op_1): Don't look for a CALL_EXPR when
1281 calling a consteval function.
1283 2020-06-17 Jason Merrill <jason@redhat.com>
1285 * decl2.c (grokfield): Pass SD_DEFAULTED and SD_DELETED.
1286 * decl.c (duplicate_decls): Reduce error for delete
1287 after earlier declaration to pedwarn.
1289 2020-06-17 Marek Polacek <polacek@redhat.com>
1292 * constexpr.c (maybe_fold_non_dependent_expr): New.
1293 * cp-tree.h (maybe_fold_non_dependent_expr): Declare.
1294 * typeck.c (cp_build_array_ref): Call maybe_fold_non_dependent_expr
1295 instead of maybe_constant_value.
1297 2020-06-16 Marek Polacek <polacek@redhat.com>
1300 * call.c (add_list_candidates): Return if a designated initializer
1301 is used with a non-aggregate.
1302 (implicit_conversion_error): Give an error for the case above.
1304 2020-06-16 Marek Polacek <polacek@redhat.com>
1307 * name-lookup.c (check_local_shadow): Check if types are
1308 non-null before calling same_type_p.
1310 2020-06-16 Jakub Jelinek <jakub@redhat.com>
1312 * semantics.c (handle_omp_for_class_iterator): Adjust
1313 c_omp_check_loop_iv_exprs caller.
1314 (finish_omp_for): Likewise. Don't call fold_build_cleanup_point_expr
1315 before calling c_finish_omp_for and c_omp_check_loop_iv, move it
1317 * pt.c (tsubst_omp_for_iterator): Handle non-rectangular loops.
1319 2020-06-16 Jakub Jelinek <jakub@redhat.com>
1321 * parser.c (cp_parser_omp_clause_schedule): Reject modifier separated
1322 from kind by comma rather than colon.
1324 2020-06-16 Patrick Palka <ppalka@redhat.com>
1326 * pt.c (perform_instantiation_time_access_checks): No need to
1328 * semantics.c (enforce_access): Verify that decl is not
1331 2020-06-16 Patrick Palka <ppalka@redhat.com>
1335 * cp-tree.h (qualified_typedef_usage_s): Delete.
1336 (qualified_typedef_usage_t): Delete.
1337 (deferred_access_check): Move up in file.
1338 (tree_template_info::typedefs_needing_access_checking): Delete.
1339 (tree_template_info::deferred_access_checks): New field.
1340 (TI_TYPEDEFS_NEEDING_ACCESS_CHECKING): Rename to ...
1341 (TI_DEFERRED_ACCESS_CHECKS): ... this, and adjust accordingly.
1342 * pt.c (perform_typedefs_access_check): Rename to ...
1343 (perform_instantiation_time_access_checks): ... this, and adjust
1344 accordingly. Remove unnecessary tree tests.
1345 (instantiate_class_template_1): Adjust accordingly.
1346 (instantiate_decl): Likewise.
1347 * semantics.c (enforce_access): Likewise.
1349 2020-06-16 Patrick Palka <ppalka@redhat.com>
1353 * call.c (enforce_access): Move to semantics.c.
1354 * cp-tree.h (enforce_access): Delete.
1355 (get_types_needing_access_check): Delete.
1356 (add_typedef_to_current_template_for_access_check): Delete.
1357 * decl.c (make_typename_type): Adjust accordingly. Use
1358 check_accessibility_of_qualified_id instead of directly using
1359 perform_or_defer_access_check.
1360 * parser.c (cp_parser_template_declaration_after_parameters):
1361 Don't push a dk_no_check access state when parsing a template.
1362 * pt.c (get_types_needing_access_check): Delete.
1363 (append_type_to_template_for_access_check_1): Delete.
1364 (perform_typedefs_access_check): Adjust. If type_decl is a
1365 FIELD_DECL, also check its DECL_CONTEXT for dependence. Use
1366 tsubst_copy instead of tsubst to substitute into type_decl so
1367 that we substitute into the DECL_CONTEXT of a FIELD_DECL.
1368 (append_type_to_template_for_access_check): Delete.
1369 * search.c (accessible_p): Remove the processing_template_decl
1371 * semantics.c (enforce_access): Moved from call.c. If we're
1372 parsing a template and the access check failed, add the check to
1373 TI_TYPEDEFS_NEEDING_ACCESS_CHECKING.
1374 (perform_or_defer_access_check): Adjust comment.
1375 (add_typedef_to_current_template_for_access_check): Delete.
1376 (check_accessibility_of_qualified_id): Adjust accordingly.
1377 Exit early if the scope is dependent.
1379 2020-06-11 Patrick Palka <ppalka@redhat.com>
1382 * constraint.cc (associate_classtype_constraints): If there is a
1383 discrepancy between the current template depth and the template
1384 depth of the original declaration, then adjust the template
1385 parameter depth within the current constraints appropriately.
1386 * pt.c (tsubst_friend_class): Substitute into and set the
1387 constraints on the injected declaration.
1389 2020-06-11 Iain Sandoe <iain@sandoe.co.uk>
1391 * coroutines.cc (instantiate_coro_traits): Pass a reference
1392 to lambda closure objects to traits instantiation.
1393 (morph_fn_to_coro): Likewise for promise parameter
1394 preview and allocator lookup.
1396 2020-06-10 Iain Sandoe <iain@sandoe.co.uk>
1399 * call.c (add_candidates): Use vec_safe_length() for
1400 testing the arguments list.
1401 (build_new_method_call_1): Use vec_safe_is_empty() when
1402 checking for an empty args list.
1404 2020-06-10 Marek Polacek <polacek@redhat.com>
1407 * parser.c (cp_parser_direct_declarator): Clear
1408 CP_PARSER_FLAGS_DELAY_NOEXCEPT if the declarator kind is not
1411 2020-06-09 Iain Sandoe <iain@sandoe.co.uk>
1414 * coroutines.cc (expand_one_await_expression): Build separate
1415 DTOR trees for the awaitable object on the destroy and resume
1418 2020-06-09 Jason Merrill <jason@redhat.com>
1421 * cp-gimplify.c (predeclare_vla): Only predeclare a VLA if it's
1422 wrapped in a pointer type.
1424 2020-06-05 Marek Polacek <polacek@redhat.com>
1427 * call.c (build_converted_constant_expr_internal): Allow
1428 list-initialization.
1430 2020-06-05 Iain Sandoe <iain@sandoe.co.uk>
1432 * cp-tree.def (CO_RETURN_EXPR): Correct the class
1433 to use tcc_statement.
1435 2020-06-05 Jason Merrill <jason@redhat.com>
1437 * error.c (dump_binary_op): Handle negative operand to
1440 2020-06-04 Jason Merrill <jason@redhat.com>
1443 * constexpr.c (cxx_eval_constant_expression) [OBJ_TYPE_REF]:
1444 Evaluate OBJ_TYPE_REF_EXPR.
1446 2020-06-04 Jason Merrill <jason@redhat.com>
1449 * class.c (lookup_vfn_in_binfo): New.
1450 * call.c (build_over_call): Use it.
1451 * cp-tree.h (resolves_to_fixed_type_p): Add default argument.
1452 (lookup_vfn_in_binfo): Declare.
1454 2020-06-04 Iain Sandoe <iain@sandoe.co.uk>
1457 * coroutines.cc (morph_fn_to_coro): Ensure that the get-
1458 return-object is constructed correctly; When it is not the
1459 final return value, pass it to the CTOR of the return type
1460 as an rvalue, per the standard comment.
1462 2020-06-04 Jakub Jelinek <jakub@redhat.com>
1466 * constexpr.c (cxx_eval_constant_expression): Diagnose CONVERT_EXPR
1467 conversions from pointer types to arithmetic types here...
1468 (cxx_eval_outermost_constant_expr): ... instead of here.
1470 2020-06-03 Mark Wielaard <mark@klomp.org>
1472 * parser.c (cp_lexer_safe_previous_token): New function.
1473 (cp_parser_error_1): Add name_hint if the previous token is
1474 a string literal and next token is a CPP_NAME and we have a
1475 missing header suggestion for the name.
1477 2020-06-03 Patrick Palka <ppalka@redhat.com>
1479 * pt.c (process_partial_specialization): Pass the full set of
1480 generic template arguments to strictly_subsumes.
1482 2020-06-03 Patrick Palka <ppalka@redhat.com>
1485 * pt.c (most_specialized_partial_spec): Reorganize the loop over
1486 DECL_TEMPLATE_SPECIALIZATIONS. Check constraints_satisfied_p on
1487 the original template declaration, not on the tsubsted one.
1489 2020-06-03 Iain Sandoe <iain@sandoe.co.uk>
1492 * coroutines.cc (finish_co_await_expr): Revise to allow for
1494 (finish_co_yield_expr): Likewise.
1496 2020-06-03 Jason Merrill <jason@redhat.com>
1499 * cp-tree.h (predeclare_vla): Declare.
1500 * cp-gimplify.c (predeclare_vla): Handle getting a decl.
1501 * pt.c (tsubst_expr) [DECL_EXPR]: Use it.
1503 2020-06-03 Tobias Burnus <tobias@codesourcery.com>
1505 * cp-gimplify.c (cxx_omp_predetermined_mapping): New.
1506 * cp-objcp-common.h (LANG_HOOKS_OMP_PREDETERMINED_MAPPING): Redfine.
1507 * cp-tree.h (cxx_omp_predetermined_mapping): Declare.
1509 2020-06-02 Jason Merrill <jason@redhat.com>
1512 * pt.c (tsubst_decl): Relax assert.
1514 2020-06-02 Iain Sandoe <iain@sandoe.co.uk>
1517 * coroutines.cc (build_co_await): Wrap the co_await expression
1518 in a TARGET_EXPR, where needed.
1519 (finish_co_yield_expr): Likewise.
1521 2020-06-02 Patrick Palka <ppalka@redhat.com>
1525 * pt.c (tsubst_function_decl): Don't do set_constraints when
1526 regenerating a lambda.
1527 (tsubst_lambda_expr): Substitute into the lambda's constraints
1528 and do set_constraints here.
1530 2020-06-01 Jason Merrill <jason@redhat.com>
1535 * class.c (build_vfn_ref): Revert 95311 change.
1536 * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call): Build a
1539 2020-06-01 Iain Sandoe <iain@sandoe.co.uk>
1542 * coroutines.cc (struct param_info): Remove rv_ref field.
1543 (build_actor_fn): Remove specifial rvalue ref handling.
1544 (morph_fn_to_coro): Likewise.
1546 2020-05-31 Iain Sandoe <iain@sandoe.co.uk>
1549 * coroutines.cc (morph_fn_to_coro): If we see an
1550 early fatal error, drop the erroneous function body.
1552 2020-05-31 Iain Sandoe <iain@sandoe.co.uk>
1554 * coroutines.cc (build_co_await): Remove unused
1556 (finish_co_await_expr): Likewise.
1557 (finish_co_yield_expr): Likewise; revise comment.
1559 2020-05-30 Iain Sandoe <iain@sandoe.co.uk>
1561 * coroutines.cc (morph_fn_to_coro): Revise initialization
1562 of the frame pointer to avoid an unused value.
1564 2020-05-30 Patrick Palka <ppalka@redhat.com>
1567 * constraint.cc (satisfaction_value): Accept INTEGER_CST of any
1570 2020-05-29 Patrick Palka <ppalka@redhat.com>
1571 Jason Merrill <jason@redhat.com>
1574 * class.c (add_method): Let special member function templates
1575 coexist if they are not equivalently constrained, or in a class
1578 2020-05-29 Jason Merrill <jason@redhat.com>
1581 * pt.c (process_template_parm): Set DECL_TEMPLATE_INFO
1582 on the DECL_TEMPLATE_RESULT.
1584 2020-05-29 Marek Polacek <polacek@redhat.com>
1587 * cp-gimplify.c (cp_fold) <case MODIFY_EXPR>: Don't set
1588 TREE_THIS_VOLATILE here.
1589 (cp_fold): Set it here along with TREE_NO_WARNING.
1591 2020-05-29 Jason Merrill <jason@redhat.com>
1595 * class.c (build_vfn_ref): Don't fold the INDIRECT_REF.
1597 2020-05-29 Patrick Palka <ppalka@redhat.com>
1602 * parser.c (cp_parser_requires_clause_expression): Temporarily
1603 increment processing_template_decl only if it is 0.
1604 (cp_parser_constraint_expression): Likewise.
1605 (cp_parser_requires_expression): Likewise.
1607 2020-05-29 Patrick Palka <ppalka@redhat.com>
1610 * constexpr.c (get_or_insert_ctor_field): Add limited support
1611 for RANGE_EXPR index lookups.
1613 2020-05-28 Jakub Jelinek <jakub@redhat.com>
1616 * decl.c (cp_finish_decomp): Call complete_type before checking
1619 2020-05-28 Jason Merrill <jason@redhat.com>
1622 * decl.c (cp_finish_decl): Revert r9-297 change.
1623 (check_static_variable_definition): Likewise.
1624 * constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
1625 * pt.c (instantiate_decl): Return early on type error.
1627 2020-05-27 Jason Merrill <jason@redhat.com>
1630 * decl.c (reshape_init_array_1): Don't reuse in overload context.
1632 2020-05-27 Jason Merrill <jason@redhat.com>
1635 * call.c (build_new_op_1): Suppress
1636 warn_zero_as_null_pointer_constant across comparison of <=> result
1639 2020-05-27 Jason Merrill <jason@redhat.com>
1642 * decl.c (grokdeclarator): Don't shift attributes in TYPENAME
1645 2020-05-27 Nathan Sidwell <nathan@acm.org>
1648 * pt.c (lookup_template_class_1): Restore alias template mutation.
1650 2020-05-26 Jakub Jelinek <jakub@redhat.com>
1653 * cp-gimplify.c: Include omp-general.h.
1654 (cp_genericize_r) <case OMP_DISTRIBUTE>: For class iteration
1655 variables in composite distribute parallel for, instantiate copy
1656 ctor of their types.
1658 2020-05-23 Patrick Palka <ppalka@redhat.com>
1661 * constexpr.c (cxx_eval_constant_expression)
1662 <case TEMPLATE_ID_EXPR>: Don't evaluate the concept when
1663 constexpr evaluation is uid-sensitive.
1665 2020-05-22 Jason Merrill <jason@redhat.com>
1667 * cp-gimplify.c (cp_gimplify_expr) [CALL_EXPR]: Don't preevaluate
1668 the function address if the call used operator syntax.
1670 2020-05-21 Jason Merrill <jason@redhat.com>
1673 * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call): For a virtual
1674 call, instrument the OBJ_TYPE_REF.
1676 * decl.c (compute_array_index_type_loc): Diagnose expressions
1677 in a template that can't be constant.
1678 * parser.c (cp_parser_direct_declarator): Don't check
1679 non-constant array bounds here.
1681 * cp-tree.h (is_rvalue_constant_expression): Declare.
1682 * constexpr.c (is_rvalue_constant_expression): New.
1683 * parser.c (cp_parser_constant_expression): Use it.
1684 * decl.c (cp_finish_decl): Try to treat a constexpr initializer in a
1685 template as constant.
1687 * typeck.c (build_x_modify_expr): Handle error_mark_node arguments.
1689 * decl.c (grokparms): Return NULL_TREE if any parms were erroneous.
1691 2020-05-21 Iain Sandoe <iain@sandoe.co.uk>
1693 * coroutines.cc (finish_co_return_stmt): Revert change to use
1696 2020-05-21 Patrick Palka <ppalka@redhat.com>
1699 * constexpr.c (constexpr_ctx::uid_sensitive): Remove field.
1700 (uid_sensitive_constexpr_evaluation_value): Define.
1701 (uid_sensitive_constexpr_evaluation_true_counter): Define.
1702 (uid_sensitive_constexpr_evaluation_p): Define.
1703 (uid_sensitive_constexpr_evaluation_sentinel): Define its
1705 (uid_sensitive_constexpr_evaluation_checker): Define its
1706 constructor and its evaluation_restricted_p method.
1707 (get_fundef_copy): Remove 'ctx' parameter. Use u_s_c_e_p
1708 instead of constexpr_ctx::uid_sensitive.
1709 (cxx_eval_call_expression): Use u_s_c_e_p instead, and test it
1710 last. Adjust call to get_fundef_copy.
1711 (instantiate_cx_fn_r): Test u_s_c_e_p so that we increment the
1712 counter if necessary.
1713 (cxx_eval_outermost_constant_expr): Remove 'uid_sensitive'
1714 parameter. Adjust function body accordingly.
1715 (maybe_constant_value): Remove 'uid_sensitive' parameter and
1716 adjust function body accordingly. Set up a
1717 uid_sensitive_constexpr_evaluation_checker, and use it to
1718 conditionally update the cv_cache.
1719 * cp-gimplify.c (cp_fold): Set up a
1720 uid_sensitive_constexpr_evaluation_checker, and use it to
1721 conditionally update the fold_cache.
1722 * cp-tree.h (maybe_constant_value): Update declaration.
1723 (struct uid_sensitive_constexpr_evaluation_sentinel): Define.
1724 (struct sensitive_constexpr_evaluation_checker): Define.
1725 * expr.c (fold_for_warn): Set up a
1726 uid_sensitive_constexpr_evaluation_sentinel before calling
1727 the folding subroutines. Drop all but the first argument to
1728 maybe_constant_value.
1730 2020-05-20 Marek Polacek <polacek@redhat.com>
1733 * parser.c (cp_parser_unqualified_id): Reject simple-template-id as
1734 the declarator-id of a destructor.
1735 (cp_parser_constructor_declarator_p): Reject simple-template-id as
1736 the declarator-id of a constructor.
1738 2020-05-20 Marek Polacek <polacek@redhat.com>
1742 * cp-tree.h (SD_DECOMPOSITION): New flag.
1743 * decl.c (duplicate_decls): Make sure a structured binding is unique
1744 in its declarative region.
1745 (start_decl): If INITIALIZED is SD_DECOMPOSITION, call
1746 fit_decomposition_lang_decl.
1747 (grokdeclarator): Compare INITIALIZED directly to SD_* flags.
1748 * parser.c (cp_parser_decomposition_declaration): Pass SD_DECOMPOSITION
1751 2020-05-20 Patrick Palka <ppalka@redhat.com>
1754 * typeck.c (structural_comptypes): Don't perform
1755 context-dependent resolution of TYPENAME_TYPEs when
1756 comparing_specializations.
1758 2020-05-19 Nathan Sidwell <nathan@acm.org>
1760 * pt.c (lookup_template_class_1): Do not reinit template_info of an
1763 2020-05-18 Martin Sebor <msebor@redhat.com>
1766 * call.c ((maybe_warn_class_memaccess): Use is_byte_access_type.
1767 * cp-tree.h (is_dummy_object): Return bool.
1768 (is_byte_access_type): Declare new function.
1769 * tree.c (is_dummy_object): Return bool.
1770 (is_byte_access_type): Define new function.
1772 2020-05-19 Patrick Palka <ppalka@redhat.com>
1775 * pt.c (init_template_processing): Enable sanitization for
1776 decl_specializations and type_specializations.
1779 * pt.c (fn_type_unification): Pass 'fn' instead of NULL_TREE as
1780 the 'in_decl' parameter to coerce_template_parms.
1782 2020-05-18 Marek Polacek <polacek@redhat.com>
1785 * typeck.c (cp_build_binary_op): Use fold_for_warn instead of
1788 2020-05-18 Marek Polacek <polacek@redhat.com>
1791 * cvt.c (cp_get_fndecl_from_callee): Return NULL_TREE if the function
1792 type is not INDIRECT_TYPE_P.
1793 * decl.c (omp_declare_variant_finalize_one): Call
1794 cp_get_callee_fndecl_nofold instead of looking for the function decl
1797 2020-05-18 Marek Polacek <polacek@redhat.com>
1800 * parser.c (cp_parser_has_attribute_expression): Sorry on a
1801 type-dependent argument.
1803 2020-05-18 Marek Polacek <polacek@redhat.com>
1807 * call.c (add_builtin_candidate) <case EQ_EXPR>: Create candidate
1808 operator functions when type is std::nullptr_t for ==/!=.
1809 * typeck.c (composite_pointer_type_r): Add a bool * parameter. Use it
1810 to maybe add "const" to the pointer type.
1811 (composite_pointer_type): Update the call to composite_pointer_type_r.
1812 (cp_build_binary_op): Turn two warning_at into error_at. Print the
1815 2020-05-18 Jason Merrill <jason@redhat.com>
1817 * call.c (build_over_call): Remove unnecessary
1818 cp_stabilize_reference.
1820 2020-05-18 Marek Polacek <polacek@redhat.com>
1822 * call.c (add_builtin_candidate): Don't create a builtin overload
1823 candidate for ++ when type is bool in C++17.
1825 2020-05-18 Marek Polacek <polacek@redhat.com>
1827 * cfns.h: Regenerated.
1829 2020-05-17 Iain Sandoe <iain@sandoe.co.uk>
1831 * coroutines.cc (morph_fn_to_coro): Initialize the gro variable.
1833 2020-05-16 Iain Sandoe <iain@sandoe.co.uk>
1835 * coroutines.cc (finish_co_return_stmt): Implement rules
1836 from [class.copy.elision] /3.
1838 2020-05-16 Patrick Palka <ppalka@redhat.com>
1841 * semantics.c (finish_decltype_type): Call
1842 instantiate_non_dependent_expr_sfinae on the expression.
1844 2020-05-15 Patrick Palka <ppalka@redhat.com>
1848 2020-04-07 Patrick Palka <ppalka@redhat.com>
1851 * typeck2.c (process_init_constructor_array): Propagate
1852 CONSTRUCTOR_PLACEHOLDER_BOUNDARY up from each element initializer to
1853 the array initializer.
1855 2020-05-15 Jason Merrill <jason@redhat.com>
1857 PR c++/93286 - ICE with __is_constructible and variadic template.
1858 * pt.c (tsubst_tree_list): New.
1859 (tsubst, tsubst_copy_and_build): Use it.
1860 * decl2.c (is_late_template_attribute): Handle error_mark_node args.
1862 2020-05-15 Nathan Sidwell <nathan@acm.org>
1864 * pt.c (template_args_equal): Fix thinkos in previous 'cleanup'.
1866 2020-05-14 Jason Merrill <jason@redhat.com>
1869 * pt.c (maybe_instantiate_noexcept): Change clone handling.
1871 2020-05-14 Patrick Palka <ppalka@redhat.com>
1874 * call.c (build_op_call): Pass complain to lookup_fnfields.
1875 (build_special_member_call): Likewise.
1876 * class.c (type_requires_array_cookie): Pass tf_warning_or_error
1878 * cp-tree.h (lookup_fnfields): Add tsubst_flags_t parameter.
1879 * except.c (build_throw): Pass tf_warning_or_error to
1881 * init.c (build_new_1): Pass complain to lookup_fnfields.
1882 * method.c (locate_fn_flags): Likewise.
1883 * name-lookup.c (lookup_name_real_1): Pass tf_warning_or_error
1885 * pt.c (tsubst_baselink): Pass complain to lookup_fnfields.
1886 * search.c (lookup_fnfields): New 'complain' parameter. Pass it
1889 2020-05-14 Nathan Sidwell <nathan@acm.org>
1891 * parser.c (cp_parser_diagnose_invalid_typename): Mention
1892 std=c++20 not 2a, reformat dependent binfo inform loops.
1894 * pt.c (tsubst_template_decl): Reorder and commonize some control
1897 * pt.c (tsubst_friend_function): Simplify control flow.
1899 * pt.c (lookup_template_class_1): Remove unnecessary else by
1900 simply grabbing TYPE_NAME earlier.
1902 * pt.c (push_template_decl_real): Adjust friend pushing logic.
1903 Reinit template type.
1905 * pt.c (build_template_decl): Init DECL_TEMPLATE_RESULT &
1907 (process_partial_specialization): ... not here ...
1908 (push_template_decl_real, add_inherited_template_parms)
1909 (build_deduction_guide): ... or here.
1911 2020-05-14 Jakub Jelinek <jakub@redhat.com>
1913 * cp-gimplify.c (cp_genericize_r): Set cfun->has_omp_target.
1915 2020-05-13 Patrick Palka <ppalka@redhat.com>
1918 * init.c (build_vec_delete_1): Just return error_mark_node if
1919 deallocate_expr is error_mark_node.
1920 (build_delete): Just return error_mark_node if do_delete is
1923 2020-05-13 Patrick Palka <ppalka@redhat.com>
1926 * constraint.cc (tsubst_requires_expr): Produce a new
1927 requires-expression when processing_template_decl, even if
1928 template arguments are not dependent.
1930 2020-05-13 Marek Polacek <polacek@redhat.com>
1933 * decl.c (duplicate_decls): Set DECL_HAS_DEPENDENT_EXPLICIT_SPEC_P.
1935 2020-05-13 Nathan Sidwell <nathan@acm.org>
1937 * pt.c (template_args_equal): Reorder category checking for
1940 * pt.c (perform_typedefs_access_check): Cache expensively
1941 calculated object references.
1942 (check_auto_in_tmpl_args): Just assert we do not get unexpected
1943 nodes, rather than silently do nothing.
1944 (append_type_to_template_for_access): Likewise, cache expensie
1947 * pt.c (canonical_type_parameter): Simplify.
1949 Formatting fixups & some simplifications.
1950 * pt.c (spec_hash_table): New typedef.
1951 (decl_specializations, type_specializations): Use it.
1952 (retrieve_specialization): Likewise.
1953 (register_specialization): Remove unnecessary casts.
1954 (push_template_decl_real): Reformat.
1955 (instantiate_class_template_1): Use more RAII.
1956 (make_argument_pack): Simplify.
1957 (instantiate_template_1): Use gcc_checking_assert for expensive
1959 (instantiate_decl): Likewise.
1960 (resolve_typename_type): Reformat comment.
1961 * semantics.c (struct deferred_access): Remove unnecessary GTY on
1963 (begin_class_definition): Fix formatting.
1965 2020-05-13 Jason Merrill <jason@redhat.com>
1967 * call.c, class.c, constexpr.c, constraint.cc, decl.c, init.c,
1968 lambda.c, lex.c, method.c, name-lookup.c, parser.c, pt.c, tree.c,
1969 typeck2.c: Change cxx2a to cxx20.
1971 2020-05-12 Marek Polacek <polacek@redhat.com>
1974 * parser.c (cp_parser_postfix_expression) <case CPP_OPEN_PAREN>: When
1975 looking for a block-scope function declaration, look through the whole
1976 set, not just the first function in the overload set.
1978 2020-05-12 Jakub Jelinek <jakub@redhat.com>
1981 * pt.c (tsubst_decl): Deal with DECL_OMP_PRIVATIZED_MEMBER for
1984 2020-05-11 Jason Merrill <jason@redhat.com>
1986 Resolve C++20 NB comment CA104
1987 * pt.c (determine_specialization): Compare constraints for
1988 specialization of member template of class instantiation.
1990 2020-05-11 Jason Merrill <jason@redhat.com>
1994 * tree.c (cp_walk_subtrees): Stop at typedefs.
1995 Handle TYPENAME_TYPE here.
1996 * pt.c (find_parameter_packs_r): Not here.
1997 (for_each_template_parm_r): Clear *walk_subtrees.
1998 * decl2.c (min_vis_r): Look through typedefs.
2000 2020-05-11 Jason Merrill <jason@redhat.com>
2002 * call.c (implicit_conversion_error): Split out from...
2003 (perform_implicit_conversion_flags): ...here.
2004 (build_converted_constant_expr_internal): Use it.
2006 2020-05-11 Jason Merrill <jason@redhat.com>
2009 * parser.c (inject_parm_decls): Set current_class_ptr here.
2010 (cp_parser_direct_declarator): And here.
2011 (cp_parser_late_return_type_opt): Not here.
2012 (cp_parser_noexcept_specification_opt): Nor here.
2013 (cp_parser_exception_specification_opt)
2014 (cp_parser_late_noexcept_specifier): Remove unneeded parameters.
2016 2020-05-11 Jason Merrill <jason@redhat.com>
2018 * decl.c (cxx_init_decl_processing): Call declare_weak for
2021 2020-05-11 Jason Merrill <jason@redhat.com>
2023 * pt.c (instantiate_class_template_1): Call tsubst_expr for
2024 STATIC_ASSERT member.
2025 * ptree.c (cxx_print_xnode): Handle STATIC_ASSERT.
2027 2020-05-11 Jason Merrill <jason@redhat.com>
2029 * pt.c (find_parameter_packs_r) [LAMBDA_EXPR]: Remove redundant
2030 walking of capture list.
2032 2020-05-11 Jason Merrill <jason@redhat.com>
2034 * cp-tree.h (LOOKUP_EXPLICIT_TMPL_ARGS): Remove.
2035 * call.c (build_new_function_call): Don't set it.
2036 (build_new_method_call_1): Likewise.
2037 (build_over_call): Check cand->explicit_targs instead.
2039 2020-05-11 Jason Merrill <jason@redhat.com>
2041 * decl.c (compute_array_index_type_loc): Stabilize before building
2044 2020-05-11 Jason Merrill <jason@redhat.com>
2046 * decl.c (grokdeclarator): Adjust deprecated_state here.
2047 (start_decl): Not here.
2049 2020-05-08 Iain Sandoe <iain@sandoe.co.uk>
2052 * coroutines.cc (build_actor_fn): Ensure that bind scopes
2053 are marked as having side-effects where necessary.
2054 (replace_statement_captures): Likewise.
2055 (morph_fn_to_coro): Likewise.
2057 2020-05-08 Nathan Sidwell <nathan@acm.org>
2059 * NEWS: Delete, it is so stale.
2061 * parser.c (cp_lexer_set_source_position_from_token): EOF has a
2064 2020-05-07 Iain Sandoe <iain@sandoe.co.uk>
2068 * coroutines.cc (morph_fn_to_coro): Set unformed outline
2069 functions to error_mark_node. For early error returns suppress
2070 warnings about missing ramp return values. Fix reinstatement
2071 of the function body on pre-existing initial error.
2072 * decl.c (finish_function): Use the normal error path for fails
2073 in the ramp function, do not try to compile the helpers if the
2076 2020-05-07 Marek Polacek <polacek@redhat.com>
2078 PR c++/94590 - Detect long double -> double narrowing.
2079 * typeck2.c (check_narrowing): Detect long double -> double
2080 narrowing even when double and long double have the same
2081 precision. Make it handle conversions to float too.
2083 2020-05-07 Marek Polacek <polacek@redhat.com>
2086 * parser.c (cp_parser_class_specifier_1): Check that the scope is
2087 nested inside current scope before pushing it.
2089 2020-05-07 Marek Polacek <polacek@redhat.com>
2092 * typeck2.c (check_narrowing): Consider T* to bool narrowing
2095 2020-05-07 Marek Polacek <polacek@redhat.com>
2097 * decl.c (grok_op_properties): Fix spelling of non-static.
2098 * typeck.c (build_class_member_access_expr): Likewise.
2100 2020-05-07 Richard Biener <rguenther@suse.de>
2103 * optimize.c (update_cloned_parm): Copy DECL_NOT_GIMPLE_REG_P.
2105 2020-05-06 Marek Polacek <polacek@redhat.com>
2108 * pt.c (tsubst_copy_and_build): Call type_dependent_expression_p_push
2109 instead of uses_template_parms. Move the warning_sentinels after the
2112 2020-05-06 Jakub Jelinek <jakub@redhat.com>
2115 * typeck.c (cp_strict_aliasing_warning): New function.
2116 (cp_build_indirect_ref_1, build_reinterpret_cast_1): Use
2117 it instead of strict_aliasing_warning.
2120 * method.c (defaulted_late_check): Don't call synthesize_method
2121 on constexpr sfk_comparison if it has been called on it already.
2123 2020-05-06 Nathan Sidwell <nathan@acm.org>
2126 * decl.c (grokdeclarator): Don't splice template attributes in
2127 parm context -- they can apply to the parm.
2129 2020-05-05 Iain Sandoe <iain@sandoe.co.uk>
2131 * coroutines.cc: Remove references to n4849 throughout.
2133 2020-05-05 Jason Merrill <jason@redhat.com>
2136 * pt.c (more_specialized_fn): Do consider parms with no deducible
2137 template parameters.
2139 2020-05-05 Jason Merrill <jason@redhat.com>
2142 * constexpr.c (potential_constant_expression_1): In a lambda
2143 function, consider a captured variable directly.
2145 2020-05-05 Iain Sandoe <iain@sandoe.co.uk>
2147 * coroutines.cc (transform_await_wrapper): Check that we have
2148 no unlowered co_yields.
2149 (captures_temporary): Likewise.
2150 (register_awaits): Likewise.
2152 2020-05-05 Nathan Sidwell <nathan@acm.org>
2155 * coroutines.cc (morph_fn_to_coro): Just check for
2157 * pt.c (tsubst_function_decl): Update lambda fn's this_ptr name.
2159 2020-05-05 Marek Polacek <polacek@redhat.com>
2160 Jason Merrill <jason@redhat.com>
2163 * parser.c (cp_parser_postfix_dot_deref_expression): If we have
2164 a type-dependent object of class type, stash it to
2165 parser->context->object_type. If the postfix expression doesn't have
2167 (cp_parser_class_name): Consider object scope too.
2168 (cp_parser_lookup_name): Remove code dealing with the case when
2169 object_type is unknown_type_node.
2171 2020-05-04 Patrick Palka <ppalka@redhat.com>
2174 * cp-gimplify.c (cp_fold) <case CALL_EXPR>: Move some variable
2175 declarations closer to their uses. Copy the CALL_EXPR only
2176 when one of its arguments has changed.
2177 <case TREE_VEC>: Instead of first collecting the folded
2178 arguments into a releasing_vec, just make a copy of the TREE_VEC
2179 as soon as folding changes one of its arguments.
2181 2020-05-04 Iain Sandoe <iain@sandoe.co.uk>
2183 * coroutines.cc (morph_fn_to_coro): Mark the coro.gro variable
2184 as artificial and ignored.
2186 2020-05-04 Nathan Sidwell <nathan@acm.org>
2188 pt.c (process_template_parm): Don't walk the template list twice,
2189 remember the final node instead.
2190 (end_template_parm_list): Refactor. Comment on why we do a pop
2193 PR c++/94827 -- don't save parms in nested requirement
2194 * constraint.cc (tsubst_nested_requirement): TYPE directly holds
2195 notmalized requirement.
2196 (finish_nested_requirement): Don't stash current tpl parms into
2198 (diagnose_nested_requirement): TYPE directly holds notmalized
2201 2020-05-01 Patrick Palka <ppalka@redhat.com>
2204 * cp-tree.h (check_accessibility_of_qualified_id): Add
2205 tsubst_flags_t parameter and change return type to bool.
2206 * parser.c (cp_parser_lookup_name): Pass tf_warning_to_error to
2207 check_accessibility_of_qualified_id.
2208 * pt.c (tsubst_qualified_id): Return error_mark_node if
2209 check_accessibility_of_qualified_id returns false.
2210 * semantics.c (check_accessibility_of_qualified_id): Add
2211 complain parameter. Pass complain instead of
2212 tf_warning_or_error to perform_or_defer_access_check. Return
2213 true unless perform_or_defer_access_check returns false.
2215 2020-05-01 Marek Polacek <polacek@redhat.com>
2218 * typeck2.c (process_init_constructor_record): Return PICFLAG_ERRONEOUS
2219 if an initializer element was erroneous.
2221 2020-05-01 Jason Merrill <jason@redhat.com>
2224 * init.c (get_nsdmi): Don't push_to_top_level for a local class.
2226 2020-05-01 Jason Merrill <jason@redhat.com>
2229 * decl.c (cp_finish_decl): Also clear TREE_READONLY if
2230 -fmerge-all-constants.
2232 2020-05-01 Jason Merrill <jason@redhat.com>
2235 * pt.c (tsubst_decl): Make sure DECL_VALUE_EXPR continues to have
2236 the same type as the variable.
2238 2020-04-30 Jason Merrill <jason@redhat.com>
2239 Nathan Sidwell <nathan@acm.org>
2242 * constraint.cc (map_arguments): If ARGS is null, it's a
2243 self-mapping of parms.
2244 (finish_nested_requirement): Do not pass argified
2245 current_template_parms to normalization.
2246 (tsubst_nested_requirement): Don't assert no template parms.
2248 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
2251 * coroutines.cc (transform_local_var_uses): Defer walking
2252 the DECL_INITIALs of BIND_EXPR vars until all the frame
2253 allocations have been made.
2255 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
2258 * coroutines.cc (register_awaits): Update target
2259 expressions for awaitable and suspend handle
2262 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
2265 * coroutines.cc (build_co_await): Account for variables
2266 with DECL_VALUE_EXPRs.
2267 (captures_temporary): Likewise.
2268 (register_awaits): Likewise.
2270 2020-04-29 Patrick Palka <ppalka@redhat.com>
2273 * pt.c (find_template_parameter_info::parm_list): New field.
2274 (keep_template_parm): Use the new field to build up the
2275 parameter list here instead of ...
2276 (find_template_parameters): ... here. Return ftpi.parm_list.
2278 2020-04-29 Jakub Jelinek <jakub@redhat.com>
2281 * class.c (build_base_field): Set DECL_FIELD_ABI_IGNORED on C++17 empty
2282 base artificial FIELD_DECLs.
2283 (layout_class_type): Set DECL_FIELD_ABI_IGNORED on empty class
2284 field_poverlapping_p FIELD_DECLs.
2286 2020-04-29 Patrick Palka <ppalka@redhat.com>
2289 * constraint.cc (satisfy_declaration_constraints): Use saved_t
2290 instead of t as the key to decl_satisfied_cache.
2293 * error.c (print_requires_expression_info): Print the dependent
2294 form of the parameter list with its template parameter mapping,
2295 rather than printing the substituted form.
2297 2020-04-28 Jason Merrill <jason@redhat.com>
2300 * decl.c (use_eh_spec_block): Check nothrow type after
2302 * pt.c (maybe_instantiate_noexcept): Call synthesize_method for
2303 DECL_MAYBE_DELETED fns here.
2304 * decl2.c (mark_used): Not here.
2305 * method.c (get_defaulted_eh_spec): Reject DECL_MAYBE_DELETED here.
2307 2020-04-28 Iain Sandoe <iain@sandoe.co.uk>
2310 * coroutines.cc (instantiate_coro_traits): Pass a reference to
2311 object type rather than a pointer type for 'this', for method
2313 (struct param_info): Add a field to hold that the parm is a lambda
2315 (morph_fn_to_coro): Check for lambda closure pointers in the
2316 args. Use a reference to *this when building the args list for the
2317 promise allocator lookup.
2319 2020-04-28 Iain Sandoe <iain@sandoe.co.uk>
2322 * coroutines.cc (coro_promise_type_found_p): Do not
2323 exclude non-classes here (this needs to be handled in the
2325 (morph_fn_to_coro): Allow for the case where the coroutine
2328 2020-04-27 Iain Sandoe <iain@sandoe.co.uk>
2331 * coroutines.cc (struct local_var_info): Add fields for static
2332 variables and those with DECL_VALUE_EXPR redirection.
2333 (transform_local_var_uses): Skip past typedefs and static vars
2334 and then account for redirected variables.
2335 (register_local_var_uses): Likewise.
2337 2020-04-27 Jason Merrill <jason@redhat.com>
2341 * decl.c (grokdeclarator): Move dependent attribute to decl.
2342 * decl2.c (splice_template_attributes): No longer static.
2344 2020-04-27 Patrick Palka <ppalka@redhat.com>
2347 * constexpr.c (cxx_eval_call_expression): Don't set new_obj if we're
2348 evaluating the target constructor of a delegating constructor.
2349 (cxx_eval_store_expression): Don't set TREE_READONLY if the LHS of the
2350 INIT_EXPR is '*this'.
2352 2020-04-26 Marek Polacek <polacek@redhat.com>
2355 * call.c (struct conversion): Add copy_init_p.
2356 (standard_conversion): Set copy_init_p in ck_base and ck_rvalue
2357 if FLAGS demands LOOKUP_ONLYCONVERTING.
2358 (convert_like_real) <case ck_base>: If copy_init_p is set, or
2359 LOOKUP_ONLYCONVERTING into FLAGS.
2361 2020-04-26 Iain Sandoe <iain@sandoe.co.uk>
2364 * coroutines.cc (morph_fn_to_coro): Ensure that
2365 unnamed function params have a usable and distinct
2368 2020-04-24 Jason Merrill <jason@redhat.com>
2371 * decl.c (redeclaration_error_message): Reject defaulted comparison
2372 operator that has been previously declared.
2374 2020-04-25 Patrick Palka <ppalka@redhat.com>
2376 * parser.c (cp_parser_diagnose_invalid_type_name): Suggest enabling
2377 concepts if the invalid identifier is 'requires'.
2379 2020-04-25 Jakub Jelinek <jakub@redhat.com>
2382 * semantics.c (finish_call_expr): When looking if all overloads
2383 are noreturn, use STRIP_TEMPLATE to look through TEMPLATE_DECLs.
2385 2020-04-24 Martin Liska <mliska@suse.cz>
2387 * coroutines.cc: Fix compilation error for release checking
2388 where we miss declaration of ‘coro_body_contains_bind_expr_p’.
2390 2020-04-23 Patrick Palka <ppalka@redhat.com>
2392 * tree.c (zero_init_expr_p): Use uses_template_parms instead of
2396 * pt.c (template_class_depth): Walk into the DECL_FRIEND_CONTEXT of a
2397 friend declaration rather than into its CP_DECL_CONTEXT.
2399 2020-04-23 Iain Sandoe <iain@sandoe.co.uk>
2402 * coroutines.cc (await_statement_expander): Simplify cases.
2403 (struct susp_frame_data): Add fields for truth and/or if
2404 cases, rename one field.
2405 (analyze_expression_awaits): New.
2406 (expand_one_truth_if): New.
2407 (add_var_to_bind): New helper.
2408 (coro_build_add_if_not_cond_break): New helper.
2409 (await_statement_walker): Handle conditional expressions,
2410 handle expansion of truth-and/or-if cases.
2411 (bind_expr_find_in_subtree): New, checking-only.
2412 (coro_body_contains_bind_expr_p): New, checking-only.
2413 (morph_fn_to_coro): Ensure that we have a top level bind
2416 2020-04-22 Jonathan Wakely <jwakely@redhat.com>
2418 PR translation/94698
2419 * class.c (check_field_decls): Change "define" to "declare" in
2420 -Weffc++ diagnostics.
2422 2020-04-22 Patrick Palka <ppalka@redhat.com>
2426 * constraint.cc (satisfy_declaration_constraints): If the inherited
2427 constructor points to an instantiation of a constructor template,
2428 remember and use its attached template arguments.
2430 2020-04-22 Jonathan Wakely <jwakely@redhat.com>
2432 PR translation/94698
2433 * class.c (check_field_decls): Change "override" to "define" in
2434 -Weffc++ diagnostics.
2436 2020-04-22 Iain Sandoe <iain@sandoe.co.uk>
2439 * coroutines.cc (struct param_info): Add a field to note that
2440 the param is 'this'.
2441 (morph_fn_to_coro): Convert this to a reference before using it
2442 in the promise parameter preview.
2444 2020-04-22 Jason Merrill <jason@redhat.com>
2447 * pt.c (register_parameter_specializations): If the instantiation is
2448 still a parameter pack, don't wrap it in a NONTYPE_ARGUMENT_PACK.
2449 (tsubst_pack_expansion, tsubst_expr): Adjust.
2451 2020-04-22 Martin Sebor <msebor@redhat.com>
2452 Jason Merrill <jason@redhat.com>
2455 * decl.c (reshape_init_array_1): Avoid stripping redundant trailing
2456 zero initializers...
2457 * mangle.c (write_expression): ...and handle them here even for
2458 pointers to members by calling zero_init_expr_p.
2459 * cp-tree.h (zero_init_expr_p): Declare.
2460 * tree.c (zero_init_expr_p): Define.
2461 (type_initializer_zero_p): Remove.
2462 * pt.c (tparm_obj_values): New hash_map.
2463 (get_template_parm_object): Store to it.
2464 (tparm_object_argument): New.
2466 2020-04-22 Patrick Palka <ppalka@redhat.com>
2469 * constraint.cc (diagnose_valid_expression): Check convert_to_void here
2470 as well as in tsubst_valid_expression_requirement.
2472 2020-04-21 Patrick Palka <ppalka@redhat.com>
2475 * constraint.cc (satisfy_declaration_constraints): Don't strip the
2476 inherited constructor if it already has template information.
2479 * pt.c (any_template_parm_r) <case IDENTIFIER_NODE>: New case. If this
2480 is a conversion operator, visit its TREE_TYPE.
2482 2020-04-21 Nathan Sidwell <nathan@acm.org>
2484 * pt.c (tsubst_copy_and_build) [POINTER_PLUS_EXPR]: Check for
2487 2020-04-21 Iain Sandoe <iain@sandoe.co.uk>
2490 * coroutines.cc (morph_fn_to_coro): Simplify return
2493 2020-04-17 Marek Polacek <polacek@redhat.com>
2496 * constexpr.c (cxx_eval_outermost_constant_expr): Return when T is
2497 a BRACE_ENCLOSED_INITIALIZER_P.
2498 (is_nondependent_constant_expression): Don't check
2499 BRACE_ENCLOSED_INITIALIZER_P.
2500 (is_nondependent_static_init_expression): Likewise.
2502 2020-04-20 Patrick Palka <ppalka@redhat.com>
2505 * cp-tree.h (lss_policy::lss_nop): New enumerator.
2506 * pt.c (local_specialization_stack::local_specialization_stack): Handle
2508 (local_specialization_stack::~local_specialization_stack): Likewise.
2509 (tsubst_pack_expansion): Use a local_specialization_stack instead of
2510 manually saving and restoring local_specializations. Conditionally
2511 replace local_specializations sooner, before the handling of the
2512 unsubstituted_packs case.
2514 2020-04-20 Marek Polacek <polacek@redhat.com>
2516 PR c++/94505 - bogus -Wparentheses warning with fold-expression.
2517 * pt.c (fold_expression): Add warning_sentinel for -Wparentheses
2518 before calling build_x_binary_op.
2520 2020-04-20 Marek Polacek <polacek@redhat.com>
2522 * coroutines.cc (captures_temporary): Don't assign the result of
2523 STRIP_NOPS to the same variable.
2525 2020-04-20 Nathan Sidwell <nathan@acm.org>
2527 PR c++/94454 - tpl-tpl-parms are not canonicalizable types
2528 * pt.c (canonical_type_parameter): Assert not a tpl-tpl-parm.
2529 (process_template_parm): tpl-tpl-parms are structural.
2530 (rewrite_template_parm): Propagate structuralness.
2532 PR c++/94454 - Expr pack expansion equality
2533 * tree.c (cp_tree_equal) [TEMPLATE_ID_EXPR, default]: Refactor.
2534 [EXPR_PACK_EXPANSION]: Add.
2536 PR c++/94454 Template Argument Hashing
2537 * pt.c (iterative_hash_template_arg): Strip nodes as
2538 template_args_equal does.
2539 [ARGUMENT_PACK_SELECT, TREE_VEC, CONSTRUCTOR]: Refactor.
2540 [node_class:TEMPLATE_TEMPLATE_PARM]: Hash by level & index.
2541 [node_class:default]: Refactor.
2543 2020-04-18 Patrick Palka <ppalka@redhat.com>
2546 * tree.c (cp_tree_equal) <case PARM_DECL>: Ignore
2547 comparing_specializations if the parameters' contexts are identical.
2550 * pt.c (splice_late_return_type): Propagate cv-qualifiers and
2551 PLACEHOLDER_TYPE_CONSTRAINTS from the original auto node to the new one.
2553 2020-04-17 Patrick Palka <ppalka@redhat.com>
2556 * lambda.c (lambda_capture_field_type): Avoid doing auto deduction if
2557 the explicit initializer has parameter packs.
2560 * parser.c (cp_parser_check_template_parameters): Before issuing a hard
2561 error, first try simulating an error instead.
2563 2020-04-17 Jakub Jelinek <jakub@redhat.com>
2566 * call.c (build_conditional_expr_1): Remove redundant assignment to
2569 2020-04-16 Patrick Palka <ppalka@redhat.com>
2572 * cvt.c (ocp_convert): If the result of scalar_constant_value is
2573 erroneous, ignore it and use the original expression.
2575 2020-04-16 Jakub Jelinek <jakub@redhat.com>
2578 * parser.c (cp_parser_simple_declaration): Fix up a pasto in
2581 2020-04-15 Jakub Jelinek <jakub@redhat.com>
2584 * parser.c (cp_parser_pragma) <case PRAGMA_OMP_REQUIRES>: Reject
2585 requires directive when not at file or namespace scope.
2587 2020-04-14 Iain Sandoe <iain@sandoe.co.uk>
2590 * coroutines.cc (build_actor_fn): Check that the target can
2591 support the resume tailcall before mandating it.
2593 2020-04-14 Patrick Palka <ppalka@redhat.com>
2596 * cxx-pretty-print.c (cxx_pretty_printer:simple_type_specifier)
2597 <case DECLTYPE_TYPE>: Handle DECLTYPE_TYPE here instead of ...
2598 (pp_cxx_type_specifier_seq) <case DECLTYPE_TYPE>: ... here.
2599 (cxx_pretty_printer::direct_abstract_declarator) <case DECLTYPE_TYPE>:
2603 * constexpr.c (replace_result_decl_data): New struct.
2604 (replace_result_decl_data_r): New function.
2605 (replace_result_decl): New function.
2606 (cxx_eval_call_expression): Use it.
2607 * tree.c (build_aggr_init_expr): Set the location of the AGGR_INIT_EXPR
2608 to that of its initializer.
2610 2020-04-13 Marek Polacek <polacek@redhat.com>
2613 * name-lookup.c (check_local_shadow): Add an inform call.
2615 2020-04-13 Patrick Palka <ppalka@redhat.com>
2618 * error.c (dump_scope): Pass TFF_NO_FUNCTION_ARGUMENTS to
2619 dump_function_decl when printing a function template instantiation as a
2623 * constexpr.c (get_or_insert_ctor_field): Set default value of parameter
2625 (cxx_eval_bare_aggregate): Use get_or_insert_ctor_field instead of
2626 assuming the the next index belongs at the end of the new CONSTRUCTOR.
2627 (cxx_eval_store_expression): Revert PR c++/78572 fix.
2629 2020-04-13 Nathan Sidwell <nathan@acm.org>
2631 PR c++/94426 lambdas with internal linkage are different to no-linkage
2632 * decl2.c (determine_visibility): A lambda's visibility is
2633 affected by its extra scope.
2634 * pt.c (instantiate_decl): Determine var's visibility before
2635 instantiating its initializer.
2636 * tree.c (no_linkage_check): Revert code looking at visibility of
2637 lambda's extra scope.
2639 2020-04-10 Iain Sandoe <iain@sandoe.co.uk>
2642 * coroutines.cc (co_await_expander): Remove.
2643 (expand_one_await_expression): New.
2644 (process_one_statement): New.
2645 (await_statement_expander): New.
2646 (build_actor_fn): Revise to use per-statement expander.
2647 (struct susp_frame_data): Reorder and comment.
2648 (register_awaits): Factor code.
2649 (replace_statement_captures): New, factored from...
2650 (maybe_promote_captured_temps):.. here.
2651 (await_statement_walker): Revise to process per statement.
2652 (morph_fn_to_coro): Use revised susp_frame_data layout.
2654 2020-04-10 Marek Polacek <polacek@redhat.com>
2657 * method.c (constructible_expr): In C++20, try using parenthesized
2658 initialization of aggregates to determine the result of
2661 2020-04-10 Bin Cheng <bin.cheng@linux.alibaba.com>
2663 * coroutines.cc (co_await_expander): Simplify.
2665 2020-04-09 Jason Merrill <jason@redhat.com>
2668 * constexpr.c (cxx_eval_constant_expression) [VAR_DECL]: Look at
2669 ctx->object and ctx->global->values first.
2671 2020-04-09 Marek Polacek <polacek@redhat.com>
2674 * call.c (initialize_reference): If the reference binding failed, maybe
2675 try initializing from { }.
2676 * decl.c (grok_reference_init): For T& t(e), set
2677 LOOKUP_AGGREGATE_PAREN_INIT but don't build up a constructor yet.
2679 2020-04-08 Iain Sandoe <iain@sandoe.co.uk>
2680 Jun Ma <JunMa@linux.alibaba.com>
2682 * coroutines.cc (maybe_promote_captured_temps): Add a cleanup
2683 expression, if needed, to any call from which we promoted
2684 temporaries captured by reference.
2686 2020-04-08 Marek Polacek <polacek@redhat.com>
2688 PR c++/94507 - ICE-on-invalid with lambda template.
2689 * pt.c (tsubst_lambda_expr): Cope when tsubst_template_decl or
2690 tsubst_function_decl returns error_mark_node.
2692 2020-04-08 Martin Liska <mliska@suse.cz>
2695 * decl.c (duplicate_decls): Duplicate also DECL_IS_REPLACEABLE_OPERATOR.
2696 (cxx_init_decl_processing): Mark replaceable all implicitly defined
2699 2020-04-08 Patrick Palka <ppalka@redhat.com>
2701 Core issues 1001 and 1322
2703 * pt.c (rebuild_function_or_method_type): Split function out from ...
2704 (tsubst_function_type): ... here.
2705 (maybe_rebuild_function_decl_type): New function.
2706 (tsubst_function_decl): Use it.
2708 2020-04-08 Jakub Jelinek <jakub@redhat.com>
2711 * decl.c (begin_destructor_body): For CLASSTYPE_VBASECLASSES class
2712 dtors, if CLASSTYPE_PRIMARY_BINFO is non-NULL, but not BINFO_VIRTUAL_P,
2713 look at CLASSTYPE_PRIMARY_BINFO of its BINFO_TYPE if it is not
2714 BINFO_VIRTUAL_P, and so on.
2716 2020-04-08 Marek Polacek <polacek@redhat.com>
2718 PR c++/94478 - ICE with defaulted comparison operator
2719 * method.c (early_check_defaulted_comparison): Give an error when the
2722 2020-04-08 Tobias Burnus <tobias@codesourcery.com>
2725 * paser.c (cp_parser_oacc_declare): Add check that variables
2726 are declared in the same scope as the directive.
2728 2020-04-07 Jason Merrill <jason@redhat.com>
2731 * parser.c (cp_parser_requires_expression): Use tentative_firewall.
2734 * parser.c (cp_parser_placeholder_type_specifier): Use
2737 2020-04-07 Iain Sandoe <iain@sandoe.co.uk>
2739 * coroutines.cc (maybe_promote_captured_temps): Ensure that
2740 reference capture placeholder vars are properly declared.
2742 2020-04-07 Patrick Palka <ppalka@redhat.com>
2745 * tree.c (replace_placeholders): Look through all handled components,
2746 not just COMPONENT_REFs.
2747 * typeck2.c (process_init_constructor_array): Propagate
2748 CONSTRUCTOR_PLACEHOLDER_BOUNDARY up from each element initializer to
2749 the array initializer.
2751 2020-04-07 Jakub Jelinek <jakub@redhat.com>
2754 * parser.c (cp_parser_omp_parallel): Set OMP_PARALLEL_COMBINED
2755 if cp_parser_omp_master succeeded.
2757 2020-04-06 Jason Merrill <jason@redhat.com>
2760 * decl.c (duplicate_decls): Fix handling of DECL_HIDDEN_FRIEND_P.
2762 2020-04-04 Marek Polacek <polacek@redhat.com>
2763 Jason Merrill <jason@redhat.com>
2765 PR c++/94155 - crash in gimplifier with paren init of aggregates.
2766 * init.c (build_vec_init): Fill in indexes.
2768 2020-04-04 Jason Merrill <jason@redhat.com>
2771 * mangle.c (write_expression): Skip IMPLICIT_CONV_EXPR.
2773 2020-04-04 Patrick Palka <ppalka@redhat.com>
2777 * constexpr.c (struct constexpr_ctx): New field 'parent'.
2778 (cxx_eval_bare_aggregate): Propagate CONSTRUCTOR_PLACEHOLDER_BOUNDARY
2779 flag from the original constructor to the reduced constructor.
2780 (lookup_placeholder): Prefer to return the outermost matching object
2781 by recursively calling lookup_placeholder on the 'parent' context,
2782 but don't cross CONSTRUCTOR_PLACEHOLDER_BOUNDARY constructors.
2783 (cxx_eval_constant_expression): Link the 'ctx' context to the 'new_ctx'
2784 context via 'new_ctx.parent' when being expanded without an explicit
2785 target. Don't call replace_placeholders.
2786 (cxx_eval_outermost_constant_expr): Initialize 'ctx.parent' to NULL.
2790 * constexpr.c (get_or_insert_ctor_field): Split out (while adding
2791 support for VECTOR_TYPEs, and optimizations for the common case)
2793 (cxx_eval_store_expression): ... here. Rename local variable
2794 'changed_active_union_member_p' to 'activated_union_member_p'. Record
2795 the sequence of indexes into 'indexes' that yields the subobject we're
2796 assigning to. Record the integer offsets of the constructor indexes
2797 we're assigning through into 'index_pos_hints'. After evaluating the
2798 initializer of the store expression, recompute 'valp' using 'indexes'
2799 and using 'index_pos_hints' as hints.
2800 (cxx_eval_bare_aggregate): Tweak comments. Use get_or_insert_ctor_field
2801 to recompute the constructor_elt pointer we're assigning through after
2802 evaluating each initializer.
2804 2020-04-04 Jason Merrill <jason@redhat.com>
2807 * constraint.cc (tsubst_valid_expression_requirement): Call
2810 2020-04-04 Jason Merrill <jason@redhat.com>
2813 * constexpr.c (maybe_constant_value): Use break_out_target_exprs.
2814 * expr.c (mark_use) [VIEW_CONVERT_EXPR]: Don't wrap a TARGET_EXPR in
2817 2020-04-04 Jakub Jelinek <jakub@redhat.com>
2820 * parser.c (cp_parser_omp_for_loop): Use
2821 protected_set_expr_location_if_unset.
2822 * cp-gimplify.c (genericize_if_stmt, genericize_cp_loop): Likewise.
2825 * pt.c (tsubst_expr) <case OMP_MASTER>: Clear
2826 omp_parallel_combined_clauses.
2828 2020-04-03 Jason Merrill <jason@redhat.com>
2831 * pt.c (complex_pack_expansion_r): New.
2832 (complex_alias_template_p): Use it.
2834 2020-03-31 Jason Merrill <jason@redhat.com>
2837 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Call
2838 replace_placeholders.
2839 * typeck2.c (store_init_value): Fix arguments to
2840 fold_non_dependent_expr.
2842 2020-03-31 Jason Merrill <jason@redhat.com>
2844 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Use
2847 2020-03-30 Jason Merrill <jason@redhat.com>
2850 * tree.c (cp_tree_equal) [CALL_EXPR]: Compare KOENIG_LOOKUP_P.
2851 (called_fns_equal): Check DECL_CONTEXT.
2853 2020-03-30 Jakub Jelinek <jakub@redhat.com>
2856 * semantics.c (add_stmt): Only set STMT_IS_FULL_EXPR_P on trees with
2857 STATEMENT_CODE_P code.
2859 2020-03-28 Patrick Palka <ppalka@redhat.com>
2862 * parser.c (cp_parser_requires_clause_opt): Diagnose and recover from
2863 "requires {" when "requires requires {" was probably intended.
2866 * constraint.cc (tsubst_compound_requirement): Always suppress errors
2867 from type_deducible_p and expression_convertible_p, as they're not
2868 substitution errors.
2869 (diagnose_atomic_constraint) <case INTEGER_CST>: Remove this case so
2870 that we diagnose INTEGER_CST expressions of non-bool type via the
2872 * cp-gimplify.c (cp_genericize_r) <case REQUIRES_EXPR>: New case.
2873 * parser.c (cp_parser_requires_expression): Always parse the requirement
2874 body as if we're processing a template, by temporarily incrementing
2875 processing_template_decl. Afterwards, if we're not actually in a
2876 template context, perform semantic processing to diagnose any invalid
2877 types and expressions.
2878 * pt.c (tsubst_copy_and_build) <case REQUIRES_EXPR>: Remove dead code.
2879 * semantics.c (finish_static_assert): Explain an assertion failure
2880 when the condition is a REQUIRES_EXPR like we do when it is a concept
2883 * constraint.cc (diagnose_compound_requirement): When diagnosing a
2884 compound requirement, maybe replay the satisfaction failure, subject to
2885 the current diagnosis depth.
2887 * constraint.cc (finish_constraint_binary_op): Set the location of EXPR
2888 as well as its range, because build_x_binary_op doesn't always do so.
2889 (current_constraint_diagnosis_depth): New.
2890 (concepts_diagnostics_max_depth_exceeded_p): New.
2891 (collect_operands_of_disjunction): New.
2892 (satisfy_disjunction): When diagnosing a satisfaction failure, maybe
2893 replay each branch of the disjunction, subject to the current diagnosis
2895 (diagnose_valid_expression): When diagnosing a satisfaction failure,
2896 maybe replay the substitution error, subject to the current diagnosis
2898 (diagnose_valid_type): Likewise.
2899 (diagnose_nested_requiremnet): Likewise.
2900 (diagnosing_failed_constraint::diagnosing_failed_constraint): Increment
2901 current_constraint_diagnosis_depth when diagnosing.
2902 (diagnosing_failed_constraint::~diagnosing_failed_constraint): Decrement
2903 current_constraint_diagnosis_depth when diagnosing.
2904 (diagnosing_failed_constraint::replay_errors_p): New static member
2906 (diagnose_constraints): Don't diagnose if concepts_diagnostics_max_depth
2907 is 0. Emit a one-off note to increase -fconcepts-diagnostics-depth if
2908 the limit was exceeded.
2909 * cp-tree.h (diagnosing_failed_constraint::replay_errors_p): Declare.
2911 2020-03-27 Nathan Sidwell <nathan@acm.org>
2914 * name-lookup.c (do_pushdecl): Look through cleanp levels.
2916 2020-03-27 Martin Sebor <msebor@redhat.com>
2921 * cp-tree.h (most_specialized_partial_spec): Declare.
2922 * parser.c (cp_parser_elaborated_type_specifier): Distinguish alias
2924 (specialization_of): New function.
2925 (cp_parser_check_class_key): Move code...
2926 (class_decl_loc_t::add): ...to here. Add parameters. Avoid issuing
2927 -Wredundant-tags on first-time declarations in other declarators.
2928 Correct handling of template specializations.
2929 (class_decl_loc_t::diag_mismatched_tags): Also expect to be called
2930 when -Wredundant-tags is enabled. Use primary template or partial
2931 specialization as the guide for uses of implicit instantiations.
2932 * pt.c (most_specialized_partial_spec): Declare extern.
2934 2020-03-27 Nathan Sidwell <nathan@acm.org>
2937 * name-lookup.c (push_namespace): Triage ambiguous lookups that
2940 2020-03-27 Jakub Jelinek <jakub@redhat.com>
2943 * call.c (set_flags_from_callee): Don't update
2944 cp_function_chain->can_throw or current_function_returns_abnormally
2945 if cp_unevaluated_operand.
2948 * cvt.c (ocp_convert): Handle COMPOUND_EXPR by recursion on the second
2949 operand and creating a new COMPOUND_EXPR if anything changed.
2951 2020-03-26 Marek Polacek <polacek@redhat.com>
2953 PR c++/94336 - template keyword accepted before destructor names.
2954 * parser.c (cp_parser_unqualified_id): Give an error when 'template'
2955 is followed by a destructor name.
2957 2020-03-27 Patrick Palka <ppalka@redhat.com>
2959 * decl.c (compute_array_index_type_loc): Remove redundant
2960 type_dependent_expression_p check that is subsumed by
2961 value_dependent_expression_p.
2962 * decl2.c (is_late_template_attribute): Likewise.
2963 * pt.c (uses_template_parms): Likewise.
2964 (dependent_template_arg_p): Likewise.
2966 2020-03-26 Marek Polacek <polacek@redhat.com>
2969 PR c++/94057 - template keyword in a typename-specifier.
2970 * parser.c (check_template_keyword_in_nested_name_spec): New.
2971 (cp_parser_nested_name_specifier_opt): Implement DR1710, optional
2972 'template'. Call check_template_keyword_in_nested_name_spec.
2973 (cp_parser_simple_type_specifier): Assume that a <
2974 following a qualified-id in a typename-specifier begins
2975 a template argument list.
2977 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
2979 * coroutines.cc (coro_init_identifiers): Initialize an identifier
2980 for the cororoutine handle 'address' method name.
2981 (struct coro_aw_data): Add fields to cover the continuations.
2982 (co_await_expander): Determine the kind of await_suspend in use.
2983 If we have the case that returns a continuation handle, then save
2984 this and make the target for 'scope exit without cleanup' be the
2985 continuation resume label.
2986 (expand_co_awaits): Remove.
2987 (struct suspend_point_info): Remove fields that kept the returned
2988 await_suspend handle type.
2989 (transform_await_expr): Remove code tracking continuation handles.
2990 (build_actor_fn): Add the continuation handle as an actor-function
2991 scope var. Build the symmetric transfer continuation point. Call
2992 the tree walk for co_await expansion directly, rather than via a
2993 trivial shim function.
2994 (register_await_info): Remove fields tracking continuation handles.
2995 (get_await_suspend_return_type): Remove.
2996 (register_awaits): Remove code tracking continuation handles.
2997 (morph_fn_to_coro): Remove code tracking continuation handles.
2999 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
3001 * coroutines.cc (co_await_expander): If we are expanding the
3002 initial await expression, set a boolean flag to show that we
3003 have now reached the initial await_resume() method call.
3004 (expand_co_awaits): Handle the 'initial await resume called' flag.
3005 (build_actor_fn): Insert the initial await expression into the
3006 start of the user-authored function-body. Handle the 'initial await
3007 resume called' flag.
3008 (morph_fn_to_coro): Initialise the 'initial await resume called'
3009 flag. Modify the unhandled exception catch clause to recognise
3010 exceptions that occur before the initial await_resume() and re-
3013 2020-03-26 Jakub Jelinek <jakub@redhat.com>
3016 * class.c (user_provided_p): Use STRIP_TEMPLATE instead of returning
3017 true for all TEMPLATE_DECLs.
3020 * cp-gimplify.c (cp_genericize_r): Handle STATEMENT_LIST.
3022 2020-03-25 Patrick Palka <ppalka@redhat.com>
3025 * parser.c (cp_parser_selection_statement) <case RID_IF>: Invalidate the
3026 current condition chain when the if-statement has a non-empty
3029 2020-03-25 Iain Sandoe <iain@sandoe.co.uk>
3032 * coroutines.cc (captures_temporary): Fix a missing dereference.
3034 2020-03-24 Marek Polacek <polacek@redhat.com>
3036 PR c++/94190 - wrong no post-decrement operator error in template.
3037 * call.c (convert_like_real): Use convert_from_reference on the result.
3039 2020-03-24 Jason Merrill <jason@redhat.com>
3042 * constraint.cc (constraint_satisfaction_value): Repeat noisily on
3044 (tsubst_nested_requirement): Likewise.
3045 (get_constraint_error_location): Allow missing context.
3046 (diagnose_atomic_constraint): Diagnose non-bool constraint here.
3047 (satisfy_atom): Not here. Only diagnose non-constant when noisy.
3049 2020-03-24 Jason Merrill <jason@redhat.com>
3051 * pt.c (any_template_parm_r): Look into the type of a non-type
3054 2020-03-24 Jason Merrill <jason@redhat.com>
3056 * cp-tree.h (cp_expr): When constructing from an expr and a
3057 location, call protected_set_expr_location.
3059 2020-03-23 Patrick Palka <ppalka@redhat.com>
3062 * except.c (maybe_noexcept_warning): Add TODO.
3063 * method.c (walk_field_subobs): Pass tf_none to expr_noexcept_p.
3065 2020-03-23 nathans <nathan@acm.org>
3068 * tree.c (cp_tree_equal) [SIZEOF_EXPR]: Detect argument pack
3071 2020-03-21 Patrick Palka <ppalka@redhat.com>
3074 * constexpr.c (reduced_constant_expression_p) [CONSTRUCTOR]: Properly
3075 handle unions without an initializer.
3076 (cxx_eval_component_reference): Emit a different diagnostic when the
3077 constructor element corresponding to a union member is NULL.
3078 (cxx_eval_bare_aggregate): When constructing a union, always set the
3079 active union member before evaluating the initializer. Relax assertion
3080 that verifies the index of the constructor element we're initializing
3081 hasn't been changed.
3082 (cxx_eval_store_expression): Diagnose changing the active union member
3083 while the union is in the process of being initialized. After setting
3084 an active union member, clear CONSTRUCTOR_NO_CLEARING on the underlying
3086 (cxx_eval_constant_expression) [PLACEHOLDER_EXPR]: Don't re-reduce a
3087 CONSTRUCTOR returned by lookup_placeholder.
3089 2020-03-20 Patrick Palka <ppalka@redhat.com>
3091 * cxx-pretty-print.c (pp_cxx_parameter_mapping): Make extern. Move
3092 the "[with ]" bits to here from ...
3093 (pp_cxx_atomic_constraint): ... here.
3094 * cxx-pretty-print.h (pp_cxx_parameter_mapping): Declare.
3095 * error.c (rebuild_concept_check): Delete.
3096 (print_concept_check_info): Print the dependent form of the constraint and the
3097 preferably substituted parameter mapping alongside it.
3099 2020-03-19 Jason Merrill <jason@redhat.com>
3102 * cp-gimplify.c (simple_empty_class_p): Look through
3103 SIMPLE_TARGET_EXPR_P.
3104 (cp_gimplify_expr) [MODIFY_EXPR]: Likewise.
3105 [RETURN_EXPR]: Avoid producing 'return *retval;'.
3106 * call.c (build_call_a): Strip TARGET_EXPR from empty class arg.
3107 * cp-tree.h (SIMPLE_TARGET_EXPR_P): Check that TARGET_EXPR_INITIAL
3110 2020-03-19 Jakub Jelinek <jakub@redhat.com>
3113 * parser.c (cp_parser_omp_var_list_no_open): Call process_outer_var_ref
3114 on outer_automatic_var_p decls.
3115 * cp-gimplify.c (cxx_omp_disregard_value_expr): Return true also for
3116 capture proxy decls.
3118 2020-03-18 Nathan Sidwell <nathan@acm.org>
3120 PR c++/94147 - mangling of lambdas assigned to globals
3121 * parser.c (cp_parser_init_declarator): Namespace-scope variables
3122 provide a lambda scope.
3123 * tree.c (no_linkage_check): Lambdas with a variable for extra
3124 scope have a linkage from the variable.
3126 2020-03-18 Jakub Jelinek <jakub@redhat.com>
3128 * constraint.cc (resolve_function_concept_check, subsumes_constraints,
3129 strictly_subsumes): Fix up duplicated word issue in a comment.
3130 * coroutines.cc (build_init_or_final_await, captures_temporary):
3132 * logic.cc (dnf_size_r, cnf_size_r): Likewise.
3133 * pt.c (append_type_to_template_for_access_check): Likewise.
3136 * decl.c (grokfndecl): Restore old diagnostics about deduction
3137 guide declared in different scope if in_namespace is NULL_TREE.
3139 2020-03-17 Jakub Jelinek <jakub@redhat.com>
3142 * parser.c (cp_parser_enum_specifier): Use temp_override for
3143 parser->colon_corrects_to_scope_p, replace goto out with return.
3144 If scoped enum or enum with underlying type is not followed by
3145 { or ;, call cp_parser_commit_to_tentative_parse before calling
3146 cp_parser_error and make sure to return error_mark_node instead of
3147 NULL_TREE. Formatting fixes.
3149 2020-03-17 Ville Voutilainen <ville.voutilainen@gmail.com>
3152 * method.c (assignable_expr): Use cp_unevaluated.
3153 (is_xible_helper): Push a non-deferred access check for
3154 the stub objects created by assignable_expr and constructible_expr.
3156 2020-03-17 Jakub Jelinek <jakub@redhat.com>
3158 * pt.c (tsubst): Fix up duplicated word issue in a diagnostic message.
3159 (lookup_template_class_1, tsubst_expr): Fix up duplicated word issue
3161 * parser.c (cp_parser_statement, cp_parser_linkage_specification,
3162 cp_parser_placeholder_type_specifier,
3163 cp_parser_constraint_requires_parens): Likewise.
3164 * name-lookup.c (suggest_alternative_in_explicit_scope): Likewise.
3166 2020-03-15 Iain Sandoe <iain@sandoe.co.uk>
3168 * coroutines.cc (co_await_expander): Fix indentation.
3170 2020-03-14 Jason Merrill <jason@redhat.com>
3173 * pt.c (process_partial_specialization): Error rather than crash on
3174 extra pack expansion.
3176 2020-03-14 Jason Merrill <jason@redhat.com>
3179 * pt.c (find_parameter_packs_r): [DECL_EXPR]: Walk
3180 DECL_ORIGINAL_TYPE of a typedef.
3182 2020-03-14 Jason Merrill <jason@redhat.com>
3185 * pt.c (build_deduction_guide): Clear cp_unevaluated_operand for
3186 substituting DECL_ARGUMENTS.
3188 2020-03-14 Jakub Jelinek <jakub@redhat.com>
3190 * logic.cc (formula::formula): Change "a an" to "an" in a comment.
3191 * parser.c (cp_debug_parser): Change "a an" to "an" in a string
3194 2020-03-13 Patrick Palka <ppalka@redhat.com>
3197 * call.c (build_over_call): Use a warning_sentinel to disable
3198 warn_deprecated_decl before calling build_addr_func.
3200 2020-03-12 Jakub Jelinek <jakub@redhat.com>
3203 * decl.c (reshape_init_array_1): Don't unshare constructor if there
3204 aren't any trailing zero elts, otherwise only unshare the first
3207 2020-03-11 Jason Merrill <jason@redhat.com>
3210 * constraint.cc (tsubst_parameter_mapping): Canonicalize type
3213 2020-03-11 Marek Polacek <polacek@redhat.com>
3214 Jason Merrill <jason@redhat.com>
3216 PR c++/94074 - wrong modifying const object error for COMPONENT_REF.
3217 * constexpr.c (cref_has_const_field): New function.
3218 (modifying_const_object_p): Consider a COMPONENT_REF
3219 const only if any of its fields are const.
3220 (cxx_eval_store_expression): Mark a CONSTRUCTOR of a const type
3221 as readonly after its initialization has been done.
3223 2020-03-10 Marek Polacek <polacek@redhat.com>
3225 PR c++/94124 - wrong conversion error with non-viable overload.
3226 * decl.c (reshape_init_array_1): Unshare a constructor if we
3227 stripped trailing zero-initializers.
3229 2020-03-10 Jason Merrill <jason@redhat.com>
3232 * pt.c (maybe_instantiate_noexcept): Always update clones.
3234 2020-03-10 Jason Merrill <jason@redhat.com>
3237 * pt.c (maybe_aggr_guide): Check BRACE_ENCLOSED_INITIALIZER_P.
3239 2020-03-10 Jason Merrill <jason@redhat.com>
3245 * cp-gimplify.c (cp_gimplify_init_expr): Partially revert patch for
3246 66139: Don't split_nonconstant_init. Remove pre_p parameter.
3248 2020-03-09 Marek Polacek <polacek@redhat.com>
3250 PR c++/92031 - bogus taking address of rvalue error.
3251 PR c++/91465 - ICE with template codes in check_narrowing.
3252 PR c++/93870 - wrong error when converting template non-type arg.
3253 PR c++/94068 - ICE with template codes in check_narrowing.
3254 * call.c (convert_like_real): Return IMPLICIT_CONV_EXPR
3255 in a template when not ck_identity and we're dealing with a class.
3256 (convert_like_real) <case ck_ref_bind>: Return IMPLICIT_CONV_EXPR
3257 in a template if we need a temporary.
3258 * decl.c (compute_array_index_type_loc): Remove
3259 instantiate_non_dependent_expr_sfinae call. Call
3260 fold_non_dependent_expr instead of maybe_constant_value.
3261 (build_explicit_specifier): Don't instantiate or create a sentinel
3262 before converting the expression.
3263 * except.c (build_noexcept_spec): Likewise.
3264 * pt.c (convert_nontype_argument): Don't build IMPLICIT_CONV_EXPR.
3265 Set IMPLICIT_CONV_EXPR_NONTYPE_ARG if that's what
3266 build_converted_constant_expr returned.
3267 * typeck2.c (check_narrowing): Call fold_non_dependent_expr instead
3268 of maybe_constant_value.
3270 2020-03-09 Jakub Jelinek <jakub@redhat.com>
3274 2019-10-11 Paolo Carlini <paolo.carlini@oracle.com>
3276 * constexpr.c (cxx_eval_constant_expression): Do not handle
3277 RROTATE_EXPR and LROTATE_EXPR.
3279 2020-03-09 Marek Polacek <polacek@redhat.com>
3281 PR c++/94050 - ABI issue with alignas on armv7hl.
3282 * class.c (layout_class_type): Don't replace a class's
3283 CLASSTYPE_AS_BASE if their TYPE_USER_ALIGN don't match.
3285 2020-03-09 Bin Cheng <bin.cheng@linux.alibaba.com>
3287 * coroutines.cc (build_actor_fn): Factor out code inserting the
3288 default return_void call to...
3289 (morph_fn_to_coro): ...here, also hoist local var declarations.
3291 2020-03-08 Patrick Palka <ppalka@redhat.com>
3294 * call.c (convert_like_real): Check complain before emitting an error
3295 about binding a bit-field to a reference.
3297 * cxx-pretty-print.c (cxx_pretty_printer::simple_type_specifier)
3298 [TYPENAME_TYPE]: Print the TYPENAME_TYPE_FULLNAME instead of the
3301 2020-03-06 Nathan Sidwell <nathan@acm.org>
3304 * mangle.c (find_substitution): Don't call same_type_p on template
3305 args that cannot match.
3307 2020-03-04 Martin Sebor <msebor@redhat.com>
3310 * tree.c (type_initializer_zero_p): Fail for structs initialized
3313 2020-03-04 Jason Merrill <jason@redhat.com>
3316 * init.c (perform_member_init): Don't do aggregate initialization of
3318 * constexpr.c (cx_check_missing_mem_inits): Don't enforce
3319 initialization of empty field.
3321 2020-03-04 Martin Liska <mliska@suse.cz>
3323 * method.c: Wrap array in ctor with braces in order
3324 to silent clang warnings.
3326 2020-03-03 Jason Merrill <jason@redhat.com>
3327 Marek Polacek <polacek@redhat.com>
3329 PR c++/90505 - mismatch in template argument deduction.
3330 * pt.c (tsubst): Don't reduce the template level of template
3331 parameters when tf_partial.
3333 2020-03-03 Jakub Jelinek <jakub@redhat.com>
3336 * constexpr.c (cxx_eval_constant_expression)
3337 <case TARGET_EXPR, case SAVE_EXPR>: Don't record anything if
3338 *non_constant_p is true.
3340 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
3342 * coroutines.cc (captures_temporary): Strip component_ref
3345 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
3347 * coroutines.cc (finish_co_await_expr): Build co_await_expr
3348 with unknown_type_node.
3349 (finish_co_yield_expr): Ditto.
3350 *pt.c (type_dependent_expression_p): Set co_await/yield_expr
3351 with unknown type as dependent.
3353 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
3355 * coroutines.cc (struct local_var_info): Adjust to remove the
3356 reference to the captured var, and just to note that this is a
3357 lambda capture proxy.
3358 (transform_local_var_uses): Handle lambda captures specially.
3359 (struct param_frame_data): Add a visited set.
3360 (register_param_uses): Also check for param uses in lambda
3362 (struct local_vars_frame_data): Remove captures list.
3363 (register_local_var_uses): Handle lambda capture proxies by
3364 noting and bypassing them.
3365 (morph_fn_to_coro): Update to remove lifetime extension of
3366 lambda capture-by-copy vars.
3368 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
3370 * coroutines.cc (build_co_await): Do not build frame
3371 awaitable proxy vars when the co_await expression is
3372 a function parameter or local var.
3373 (co_await_expander): Do not initialise a frame var with
3375 (transform_await_expr): Only substitute the awaitable
3376 frame var if it's needed.
3377 (register_awaits): Do not make frame copies for param
3378 or local vars that are awaitables.
3380 2020-02-28 Jason Merrill <jason@redhat.com>
3382 Implement P2092R0, Disambiguating Nested-Requirements
3383 * parser.c (cp_parser_requirement_parameter_list): Pass
3384 CP_PARSER_FLAGS_TYPENAME_OPTIONAL.
3386 * call.c (build_user_type_conversion_1): Don't look at the second
3387 conversion of a non-viable candidate.
3389 2020-02-28 Jakub Jelinek <jakub@redhat.com>
3391 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
3392 * typeck.c (cp_build_addr_expr_1): Allow taking address of immediate
3393 functions in unevaluated contexts.
3395 2020-02-27 Nathan Sidwell <nathan@acm.org>
3398 * pt.c (template_args_equal): Pass ARGUMENT_PACKS through to
3400 * tree.c (cp_tree_equal): Compare ARGUMENT_PACKS here,
3401 * typeck.c (comptypes): Assert we don't get any argument packs.
3403 * class.c (adjust_clone_args): Correct arg-checking assert.
3404 * typeck.c (comptypes): Assert not nulls.
3406 2020-02-26 Marek Polacek <polacek@redhat.com>
3408 PR c++/93789 - ICE with invalid array bounds.
3409 * decl.c (compute_array_index_type_loc): Don't use the folded
3410 size when folding cleared TREE_CONSTANT.
3412 2020-02-26 Iain Sandoe <iain@sandoe.co.uk>
3414 * class.c (classtype_has_non_deleted_copy_ctor): New.
3415 * coroutines.cc (struct param_info): Keep track of params
3416 that are references, and cache the original type and whether
3417 the DTOR is trivial.
3418 (build_actor_fn): Handle param copies always, and adjust the
3419 handling for references.
3420 (register_param_uses): Only handle uses here.
3421 (classtype_has_non_deleted_copy_ctor): New.
3422 (morph_fn_to_coro): Adjust param copy handling to match n4849
3423 by reordering ahead of the promise CTOR and always making a
3424 frame copy, even if the param is unused in the coroutine body.
3425 * cp-tree.h (classtype_has_non_deleted_copy_ctor): New.
3427 2020-02-26 Patrick Palka <ppalka@redhat.com>
3429 * constraint.cc (finish_constraint_binary_op): Set expr's location range
3430 to the range of its operands.
3431 (satisfy_atom): Pass MAP instead of ARGS to diagnose_atomic_constraint.
3432 (diagnose_trait_expr): Take the instantiated parameter mapping MAP
3433 instead of the corresponding template arguments ARGS and adjust body
3435 (diagnose_requires_expr): Likewise.
3436 (diagnose_atomic_constraint): Likewise. When printing an atomic
3437 constraint expression, print the instantiated parameter mapping
3439 * cxx-pretty-print.cc (cxx_pretty_printer::expression)
3440 [NONTYPE_ARGUMENT_PACK]: Print braces around a NONTYPE_ARGUMENT_PACK.
3441 (cxx_pretty_printer::type_id): Handle TYPE_ARGUMENT_PACK.
3443 2020-02-26 Marek Polacek <polacek@redhat.com>
3445 PR c++/93676 - value-init crash in template.
3446 * init.c (build_new_1): Don't call build_vec_init in a template.
3448 2020-02-26 Marek Polacek <polacek@redhat.com>
3450 PR c++/93862 - ICE with static_cast when converting from int[].
3451 * call.c (reference_compatible_p): No longer static.
3452 * cp-tree.h (reference_compatible_p): Declare.
3453 * typeck.c (build_static_cast_1): Use reference_compatible_p instead
3454 of reference_related_p.
3456 2020-02-26 Marek Polacek <polacek@redhat.com>
3458 PR c++/93803 - ICE with constexpr init and [[no_unique_address]].
3459 * constexpr.c (reduced_constant_expression_p): Don't crash on a null
3462 2020-02-24 Martin Sebor <msebor@redhat.com>
3465 * parser.c (cp_parser_check_class_key): Avoid issuing -Wredundant-tags
3466 in shared C/C++ code in headers.
3467 Remove a duplicate hunk of code.
3469 2020-02-24 Marek Polacek <polacek@redhat.com>
3471 PR c++/93869 - ICE with -Wmismatched-tags.
3472 * parser.c (cp_parser_check_class_key): Check class_key earlier.
3474 2020-02-24 Marek Polacek <polacek@redhat.com>
3476 PR c++/93712 - ICE with ill-formed array list-initialization.
3477 * call.c (next_conversion): Return NULL for ck_aggr.
3478 (build_aggr_conv): Set u.expr instead of u.next.
3479 (build_array_conv): Likewise.
3480 (build_complex_conv): Likewise.
3481 (conv_get_original_expr): Handle ck_aggr.
3483 2020-02-24 Jakub Jelinek <jakub@redhat.com>
3485 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
3486 * call.c (build_over_call): Don't evaluate immediate functions in
3487 unevaluated operands.
3489 2020-02-24 Jason Merrill <jason@redhat.com>
3491 P0780R2: Resolve lambda init-capture pack grammar.
3492 * parser.c (cp_parser_lambda_introducer): Expect &...x=y rather than
3495 2020-02-22 Marek Polacek <polacek@redhat.com>
3498 * decl.c (grokdeclarator): Use %qs in a diagnostic message.
3500 2020-02-21 Martin Sebor <msebor@redhat.com>
3502 PR gcov-profile/93753
3503 * class.c (check_flexarrays): Tighten up a test for potential members
3504 of anonymous structs or unions.
3506 2020-02-20 Martin Sebor <msebor@redhat.com>
3509 * parser.c (cp_parser_check_class_key): Only handle true C++ class-keys.
3511 2020-02-20 Martin Liska <mliska@suse.cz>
3513 PR translation/93841
3514 * config/or1k/or1k.opt: Remove superfluous word.
3515 * doc/invoke.texi: Likewise.
3517 2020-02-20 Martin Liska <mliska@suse.cz>
3519 PR translation/93838
3520 * parser.c (cp_parser_decl_specifier_seq): Remove trailing space.
3522 2020-02-19 Marek Polacek <polacek@redhat.com>
3524 PR c++/93169 - wrong-code with a non-constexpr constructor.
3525 * constexpr.c (cxx_eval_call_expression): Only set TREE_READONLY
3526 on constant CONSTRUCTORs.
3528 2020-02-15 Marek Polacek <polacek@redhat.com>
3530 PR c++/93710 - poor diagnostic for array initializer.
3531 * call.c (build_user_type_conversion_1): Use cp_expr_loc_or_input_loc
3534 2020-02-15 Jason Merrill <jason@redhat.com>
3537 * pt.c (any_template_parm_r): Look into lambda body.
3540 * pt.c (any_template_parm_r): Remove CONSTRUCTOR handling.
3542 2020-02-14 Jakub Jelinek <jakub@redhat.com>
3545 * class.c (enum_min_precision): Change prec type from int to int &.
3548 * cp-tree.h (enum cp_tree_index): Add CPTI_FALLBACK_DFLOAT32_TYPE,
3549 CPTI_FALLBACK_DFLOAT64_TYPE and CPTI_FALLBACK_DFLOAT128_TYPE.
3550 (fallback_dfloat32_type, fallback_dfloat64_type,
3551 fallback_dfloat128_type): Define.
3552 * mangle.c (write_builtin_type): Handle fallback_dfloat*_type like
3554 * rtti.c (emit_support_tinfos): Emit DFP typeinfos even when dfp
3555 is disabled for compatibility.
3557 2020-02-13 Jason Merrill <jason@redhat.com>
3560 * name-lookup.c (matching_fn_p): A function does not match a
3565 * tree.c (decl_linkage): Always lk_none for locals.
3567 2020-02-12 Jason Merrill <jason@redhat.com>
3571 * tree.c (cp_walk_subtrees): Walk CONSTRUCTOR types here.
3572 * pt.c (find_parameter_packs_r): Not here.
3574 2020-02-12 Iain Sandoe <iain@sandoe.co.uk>
3576 * coroutines.cc (build_actor_fn): Implement deallocation function
3577 selection per n4849, dcl.fct.def.coroutine bullet 12.
3578 (morph_fn_to_coro): Implement allocation function selection per
3579 n4849, dcl.fct.def.coroutine bullets 9 and 10.
3581 2020-02-12 Marek Polacek <polacek@redhat.com>
3583 PR c++/93684 - ICE-on-invalid with broken attribute.
3584 * parser.c (cp_parser_std_attribute): Peek a token first before
3587 2020-02-11 Jason Merrill <jason@redhat.com>
3590 * class.c (add_implicitly_declared_members): Use do_friend.
3591 * method.c (implicitly_declare_fn): Fix friend handling.
3592 (decl_remember_implicit_trigger_p): New.
3593 (synthesize_method): Use it.
3594 * decl2.c (mark_used): Use it.
3596 2020-02-11 Jason Merrill <jason@redhat.com>
3600 * constexpr.c (maybe_constant_value): Correct earlier change.
3601 (cxx_eval_binary_expression) [SPACESHIP_EXPR]: Pass lval through.
3602 * method.c (genericize_spaceship): Wrap result in TARGET_EXPR.
3604 2020-02-12 Patrick Palka <ppalka@redhat.com>
3608 * type-utils.h (find_type_usage): Refactor to take a tree * and to
3609 return a tree *, and update documentation accordingly.
3610 * pt.c (make_auto_1): Set AUTO_IS_DECLTYPE when building a
3611 decltype(auto) node.
3612 (make_constrained_decltype_auto): No need to explicitly set
3613 AUTO_IS_DECLTYPE anymore.
3614 (splice_late_return_type): Use find_type_usage to find and
3615 replace a possibly nested auto node instead of using is_auto.
3616 Check test for is_auto into an assert when deciding whether
3617 to late_return_type.
3618 (type_uses_auto): Adjust the call to find_type_usage.
3619 * parser.c (cp_parser_decltype): No need to explicitly set
3620 AUTO_IS_DECLTYPE anymore.
3622 * error.c (dump_decl) [CONCEPT_DECL]: Use dump_simple_decl.
3623 (dump_simple_decl): Handle standard concept definitions as well as
3624 variable concept definitions.
3626 2020-02-10 Jakub Jelinek <jakub@redhat.com>
3629 * error.c (dump_decl_name): Fix up last argument to strncmp.
3631 2020-02-10 Jason Merrill <jason@redhat.com>
3634 * tree.c (array_of_unknown_bound_p): New.
3635 * init.c (perform_member_init): Do nothing for flexible arrays.
3637 2020-02-09 Jakub Jelinek <jakub@redhat.com>
3640 * constexpr.c (cxx_eval_constant_expression): If obj is heap var with
3641 ARRAY_TYPE, use the element type. Punt if objtype after that is not
3644 2020-02-08 Jason Merrill <jason@redhat.com>
3647 * expr.c (fold_for_warn): Call maybe_constant_value.
3648 * constexpr.c (struct constexpr_ctx): Add uid_sensitive bit-field.
3649 (maybe_constant_value): Add uid_sensitive parm.
3650 (get_fundef_copy): Don't copy if it's true.
3651 (cxx_eval_call_expression): Don't instantiate if it's true.
3652 (cxx_eval_outermost_constant_expr): Likewise.
3655 * constexpr.c (maybe_constant_value): Don't unshare if the cached
3656 value is the same as the argument.
3658 * typeck.c (maybe_warn_about_returning_address_of_local): Add
3661 * typeck2.c (process_init_constructor): Also clear TREE_SIDE_EFFECTS
3664 2020-02-08 Jakub Jelinek <jakub@redhat.com>
3667 * constexpr.c (find_array_ctor_elt): If last element has no index,
3668 for flag_checking verify all elts have no index. If i is within the
3669 elts, return it directly, if it is right after the last elt, append
3670 if NULL index, otherwise force indexes on all elts.
3671 (cxx_eval_store_expression): Allow cep->index to be NULL.
3673 2020-02-07 Marek Polacek <polacek@redhat.com>
3675 PR c++/92947 - Paren init of aggregates in unevaluated context.
3676 * call.c (build_new_method_call_1): Don't check
3677 cp_unevaluated_operand. Check the return value of digest_init.
3679 2020-02-06 Jason Merrill <jason@redhat.com>
3682 * tree.c (cp_walk_subtrees): Walk into type template arguments.
3683 * cp-tree.h (TYPE_TEMPLATE_INFO_MAYBE_ALIAS): Use typedef_variant_p
3684 instead of TYPE_ALIAS_P.
3685 * pt.c (push_template_decl_real): Likewise.
3686 (find_parameter_packs_r): Likewise. Remove dead code.
3687 * error.c (find_typenames_r): Remove dead code.
3689 2020-02-06 Jason Merrill <jason@redhat.com>
3692 * parser.c (cp_parser_constraint_primary_expression): Do the main
3693 parse non-tentatively.
3695 2020-02-06 Marek Polacek <polacek@redhat.com>
3697 PR c++/93597 - ICE with lambda in operator function.
3698 * name-lookup.c (maybe_save_operator_binding): Check is_overloaded_fn.
3700 2020-02-05 Jason Merrill <jason@redhat.com>
3703 * pt.c (tsubst_decl) [PARM_DECL]: Check cp_unevaluated_operand in
3704 handling of TREE_CHAIN for empty pack.
3706 2020-02-05 Jakub Jelinek <jakub@redhat.com>
3709 * semantics.c (cp_build_vec_convert): Call decay_conversion on arg
3710 prior to passing it to c_build_vec_convert.
3712 2020-02-05 Marek Polacek <polacek@redhat.com>
3714 PR c++/93559 - ICE with CONSTRUCTOR flags verification.
3715 * decl.c (reshape_init_array_1): Don't reuse a CONSTRUCTOR with
3718 2020-02-05 Jason Merrill <jason@redhat.com>
3721 * decl.c (grokdeclarator): Reject field of current class type even
3724 2020-02-05 Bin Cheng <bin.cheng@linux.alibaba.com>
3726 * coroutines.cc (maybe_promote_captured_temps): Increase the index
3727 number for temporary variables' name.
3729 2020-02-05 Jun Ma <JunMa@linux.alibaba.com>
3731 * coroutines.cc (build_co_await): Call convert_from_reference
3732 to wrap co_await_expr with indirect_ref which avoid
3733 reference/non-reference type confusion.
3735 (co_await_expander): Sink to call_expr if await_resume
3736 is wrapped by indirect_ref.
3738 2020-02-04 Jason Merrill <jason@redhat.com>
3741 * constraint.cc (satisfy_declaration_constraints): Check return
3742 value of push_tinst_level.
3745 * constexpr.c (cxx_eval_array_reference): {}-initialize missing
3746 elements instead of value-initializing them.
3749 * init.c (perform_member_init): Simplify.
3750 * constexpr.c (cx_check_missing_mem_inits): Allow uninitialized
3752 (cxx_eval_vec_init_1): Handle CONSTRUCTOR.
3754 2020-02-04 Iain Sandoe <iain@sandoe.co.uk>
3756 * coroutines.cc (find_promise_type): Delete unused forward
3758 (struct coroutine_info): Add a bool for no promise type error.
3759 (coro_promise_type_found_p): Only emit the error for a missing
3760 promise once in each affected coroutine.
3762 2020-02-03 Jason Merrill <jason@redhat.com>
3765 * constexpr.c (cxx_eval_constant_expression) [PARM_DECL]: Don't
3766 defer loading the value of a reference.
3768 2020-02-03 Jason Merrill <jason@redhat.com>
3771 * constexpr.c (potential_constant_expression_1) [PARM_DECL]: Allow
3773 [COMPONENT_REF]: A member function reference doesn't use the object
3776 2020-02-03 Iain Sandoe <iain@sandoe.co.uk>
3779 * coroutines.cc (struct coroutine_info): Add a bool flag to note
3780 that we emitted an error for a bad function return type.
3781 (get_coroutine_info): Tolerate an unset info table in case of
3783 (find_coro_traits_template_decl): In case of error or if we didn't
3784 find a type template, note we emitted the error and suppress
3786 (find_coro_handle_template_decl): Likewise.
3787 (instantiate_coro_traits): Only check for error_mark_node in the
3788 return from lookup_qualified_name.
3789 (coro_promise_type_found_p): Reorder initialization so that we check
3790 for the traits and their usability before allocation of the info
3791 table. Check for a suitable return type and emit a diagnostic for
3792 here instead of relying on the lookup machinery. This allows the
3793 error to have a better location, and means we can suppress multiple
3795 (coro_function_valid_p): Re-check for a valid promise (and thus the
3796 traits) before proceeding. Tolerate missing info as a fatal error.
3798 2020-02-03 Jason Merrill <jason@redhat.com>
3801 * cp-gimplify.c (predeclare_vla): New.
3802 (cp_genericize_r) [NOP_EXPR]: Call it.
3804 2020-02-03 Jun Ma <JunMa@linux.alibaba.com>
3806 * coroutines.cc (transform_await_wrapper): Set actor funcion as
3807 new context of label_decl.
3808 (build_actor_fn): Fill new field of await_xform_data.
3810 2020-02-02 Marek Polacek <polacek@redhat.com>
3812 PR c++/93530 - ICE on invalid alignas in a template.
3813 * decl.c (grokdeclarator): Call cplus_decl_attributes instead of
3816 2020-01-31 Jason Merrill <jason@redhat.com>
3819 * semantics.c (process_outer_var_ref): Capture VLAs even in
3820 unevaluated context.
3823 * decl.c (reshape_init_array_1): Reuse a single CONSTRUCTOR with
3824 non-aggregate elements.
3825 (reshape_init_array): Add first_initializer_p parm.
3826 (reshape_init_r): Change first_initializer_p from bool to tree.
3827 (reshape_init): Pass init to it.
3830 * parser.c (cp_parser_initializer_list): Suppress location wrappers
3833 2020-01-29 Jason Merrill <jason@redhat.com>
3836 * pt.c (tsubst_copy_and_build) [EQ_EXPR]: Only suppress warnings if
3837 the expression was dependent before substitution.
3839 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
3841 * coroutines.cc (act_des_fn): New.
3842 (morph_fn_to_coro): Call act_des_fn to build actor/destroy decls.
3843 Access promise via actor function's frame pointer argument.
3844 (build_actor_fn, build_destroy_fn): Use frame pointer argument.
3846 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
3848 * coroutines.cc (co_await_expander): Handle type conversion case.
3850 2020-01-29 Jason Merrill <jason@redhat.com>
3855 * parser.c (cp_parser_type_specifier_seq): Don't parse attributes in
3856 a trailing return type.
3857 (cp_parser_lambda_declarator_opt): Parse C++11 attributes before
3860 2020-01-29 Marek Polacek <polacek@redhat.com>
3862 PR c++/91754 - Fix template arguments comparison with class NTTP.
3863 * pt.c (class_nttp_const_wrapper_p): New.
3864 (template_args_equal): See through class_nttp_const_wrapper_p
3867 2020-01-29 Marek Polacek <polacek@redhat.com>
3869 PR c++/92948 - Fix class NTTP with template arguments.
3870 * pt.c (convert_nontype_argument): Use IMPLICIT_CONV_EXPR when
3871 converting a value-dependent expression to a class type.
3872 (tsubst_copy) <case VIEW_CONVERT_EXPR>: Allow IMPLICIT_CONV_EXPR
3873 as the result of the tsubst_copy call.
3875 2020-01-29 Jakub Jelinek <jakub@redhat.com>
3878 * cp-gimplify.c (cxx_omp_predetermined_sharing): Return
3879 OMP_CLAUSE_DEFAULT_SHARED for typeinfo decls.
3881 2020-01-28 Jason Merrill <jason@redhat.com>
3884 * parser.c (cp_parser_lambda_expression): Clear in_discarded_stmt.
3888 * decl2.c (copy_linkage): Do copy DECL_ONE_ONLY and DECL_WEAK.
3891 * call.c (build_user_type_conversion_1): Allow a template conversion
3892 returning an rvalue reference to bind directly to an lvalue.
3895 * decl.c (grokdeclarator): Propagate eh spec from typedef.
3897 2020-01-28 Martin Liska <mliska@suse.cz>
3900 * pt.c (redeclare_class_template): Group couple of
3901 errors and inform messages with auto_diagnostic_group.
3903 2020-01-28 Martin Liska <mliska@suse.cz>
3906 * pt.c (redeclare_class_template): Use inform
3907 for the second location.
3909 2020-01-27 Jason Merrill <jason@redhat.com>
3912 * pt.c (tsubst_copy) [STRING_CST]: Don't use fold_convert.
3914 2020-01-27 Iain Sandoe <iain@sandoe.co.uk>
3917 * coroutines.cc (morph_fn_to_coro): Check the ramp return
3918 value when it is constructed from the 'get return object'.
3920 2020-01-27 Nathan Sidwell <nathan@acm.org>
3923 * name-lookup.c (is_ancestor): Allow CHILD to be a namespace alias.
3925 2020-01-26 Jason Merrill <jason@redhat.com>
3928 * except.c (maybe_noexcept_warning): Check DECL_IN_SYSTEM_HEADER and
3929 temporarily enable -Wsystem-headers. Change second warning to
3933 * semantics.c (finish_call_expr): Don't call
3934 instantiate_non_dependent_expr before warn_for_memset.
3936 2020-01-25 Marek Polacek <polacek@redhat.com>
3938 PR c++/93414 - poor diagnostic for dynamic_cast in constexpr context.
3939 * constexpr.c (cxx_eval_dynamic_cast_fn): Add a reference
3940 dynamic_cast diagnostic.
3942 2020-01-24 Jason Merrill <jason@redhat.com>
3944 PR c++/93400 - ICE with constrained friend.
3945 * constraint.cc (maybe_substitute_reqs_for): New.
3946 * decl.c (function_requirements_equivalent_p): Call it.
3947 * pt.c (tsubst_friend_function): Only substitute
3948 TEMPLATE_PARMS_CONSTRAINTS.
3949 (tsubst_template_parms): Copy constraints.
3951 2020-01-24 Jason Merrill <jason@redhat.com>
3953 PR c++/93279 - ICE with lambda in member operator.
3954 * name-lookup.c (maybe_save_operator_binding): Don't remember
3955 class-scope bindings.
3957 2020-01-24 Jason Merrill <jason@redhat.com>
3959 PR c++/93377 - ICE with member alias in constraint.
3960 * pt.c (any_template_parm_r): Look at template arguments for all
3961 aliases, not only alias templates.
3963 2020-01-24 Marek Polacek <polacek@redhat.com>
3965 PR c++/93299 - ICE in tsubst_copy with parenthesized expression.
3966 * pt.c (tsubst_copy): Handle a REF_PARENTHESIZED_P VIEW_CONVERT_EXPR.
3968 2020-01-24 Jason Merrill <jason@redhat.com>
3970 PR c++/92852 - ICE with generic lambda and reference var.
3971 * constexpr.c (maybe_constant_value): Likewise.
3973 2020-01-23 Paolo Carlini <paolo.carlini@oracle.com>
3976 * parser.c (cp_parser_nested_name_specifier_opt): Properly
3977 diagnose concept-ids.
3979 2020-01-23 Jason Merrill <jason@redhat.com>
3981 PR c++/93331 - ICE with __builtin_strchr.
3982 * constexpr.c (cxx_eval_builtin_function_call): Use the original
3983 argument if we didn't manage to extract a STRING_CST.
3985 PR c++/93345 - ICE with defaulted dtor and template.
3987 * decl.c (cxx_maybe_build_cleanup): Don't try to set
3988 throwing_cleanup in a template.
3990 2020-01-22 Marek Polacek <polacek@redhat.com>
3992 PR c++/92907 - noexcept does not consider "const" in member functions.
3993 * g++.dg/cpp0x/noexcept56.C: New test.
3995 2020-01-22 Marek Polacek <polacek@redhat.com>
3997 PR c++/93324 - ICE with -Wall on constexpr if.
3998 * semantics.c (is_std_constant_evaluated_p): Check fndecl.
4000 2020-01-22 Patrick Palka <ppalka@redhat.com>
4002 * constraint.cc (get_mapped_args): Avoid using auto_vec
4003 as a vector element. Release the vectors inside the lists
4005 * parser.c (cp_literal_operator_id): Free the buffer.
4007 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
4009 * coroutines.cc (finish_co_await_expr): Add error check on return
4010 value of build_co_await.
4011 (finish_co_yield_expr,): Ditto.
4013 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
4015 * coroutines.cc (lookup_awaitable_member): Lookup an awaitable member.
4016 (lookup_promise_method): Emit diagnostic when get NULL_TREE back only.
4017 (build_co_await): Use lookup_awaitable_member instead of lookup_member.
4019 2020-01-21 Jason Merrill <jason@redhat.com>
4021 PR c++/60855 - ICE with sizeof VLA capture.
4022 * lambda.c (is_lambda_ignored_entity): Don't look past VLA capture.
4024 PR c++/90732 - ICE with VLA capture and generic lambda.
4025 * pt.c (tsubst_lambda_expr): Repeat add_capture for VLAs.
4027 2020-01-21 Iain Sandoe <iain@sandoe.co.uk>
4028 Bin Cheng <bin.cheng@linux.alibaba.com>
4030 * coroutines.cc (coro_promise_type_found_p): Check for NULL return
4031 from complete_type_or_else.
4032 (register_param_uses): Likewise.
4033 (build_co_await): Do not try to use complete_type_or_else for void
4034 types, otherwise for incomplete types, check for NULL return from
4035 complete_type_or_else.
4037 2020-01-21 Jason Merrill <jason@redhat.com>
4039 PR c++/91476 - anon-namespace reference temp clash between TUs.
4040 * decl2.c (copy_linkage): Factor out of get_guard.
4041 * call.c (make_temporary_var_for_ref_to_temp): Use it.
4042 * decl.c (cp_finish_decomp): Use it.
4043 (cp_finish_decl): determine_visibility sooner.
4045 2020-01-21 Bin Cheng <bin.cheng@linux.alibaba.com>
4047 * coroutines.cc (finish_co_await_expr): Set return value flag.
4048 (finish_co_yield_expr, morph_fn_to_coro): Ditto.
4050 2020-01-19 Jason Merrill <jason@redhat.com>
4052 PR c++/33799 - destroy return value, take 2.
4053 * cp-tree.h (current_retval_sentinel): New macro.
4054 (struct language_function): Add throwing_cleanup bitfield.
4055 * decl.c (cxx_maybe_build_cleanup): Set it.
4056 * except.c (maybe_set_retval_sentinel)
4057 (maybe_splice_retval_cleanup): New functions.
4058 * parser.c (cp_parser_compound_statement): Call
4059 maybe_splice_retval_cleanup.
4060 * typeck.c (check_return_expr): Call maybe_set_retval_sentinel.
4062 * parser.c (cp_parser_lambda_body): Use cp_parser_function_body.
4064 2020-01-18 Jakub Jelinek <jakub@redhat.com>
4066 * coroutines.cc (get_fn_local_identifier): Fix NO_DOT_IN_LABEL
4067 but non-NO_DOLLAR_IN_LABEL case build.
4069 2020-01-18 Iain Sandoe <iain@sandoe.co.uk>
4071 * Make-lang.in: Add coroutines.o.
4072 * cp-tree.h (lang_decl-fn): coroutine_p, new bit.
4073 (DECL_COROUTINE_P): New.
4074 * lex.c (init_reswords): Enable keywords when the coroutine flag
4076 * operators.def (co_await): New operator.
4077 * call.c (add_builtin_candidates): Handle CO_AWAIT_EXPR.
4078 (op_error): Likewise.
4079 (build_new_op_1): Likewise.
4080 (build_new_function_call): Validate coroutine builtin arguments.
4081 * constexpr.c (potential_constant_expression_1): Handle
4082 CO_AWAIT_EXPR, CO_YIELD_EXPR, CO_RETURN_EXPR.
4083 * coroutines.cc: New file.
4084 * cp-objcp-common.c (cp_common_init_ts): Add CO_AWAIT_EXPR,
4085 CO_YIELD_EXPR, CO_RETRN_EXPR as TS expressions.
4086 * cp-tree.def (CO_AWAIT_EXPR, CO_YIELD_EXPR, (CO_RETURN_EXPR): New.
4087 * cp-tree.h (coro_validate_builtin_call): New.
4088 * decl.c (emit_coro_helper): New.
4089 (finish_function): Handle the case when a function is found to
4090 be a coroutine, perform the outlining and emit the outlined
4091 functions. Set a bit to signal that this is a coroutine component.
4092 * parser.c (enum required_token): New enumeration RT_CO_YIELD.
4093 (cp_parser_unary_expression): Handle co_await.
4094 (cp_parser_assignment_expression): Handle co_yield.
4095 (cp_parser_statement): Handle RID_CO_RETURN.
4096 (cp_parser_jump_statement): Handle co_return.
4097 (cp_parser_operator): Handle co_await operator.
4098 (cp_parser_yield_expression): New.
4099 (cp_parser_required_error): Handle RT_CO_YIELD.
4100 * pt.c (tsubst_copy): Handle CO_AWAIT_EXPR.
4101 (tsubst_expr): Handle CO_AWAIT_EXPR, CO_YIELD_EXPR and
4103 * tree.c (cp_walk_subtrees): Likewise.
4105 2020-01-17 Jason Merrill <jason@redhat.com>
4107 PR c++/92531 - ICE with noexcept(lambda).
4108 * pt.c (uses_template_parms): Don't try to enumerate all the
4111 2020-01-17 Jakub Jelinek <jakub@redhat.com>
4114 * parser.c (cp_parser_template_name): Look up deprecated attribute
4115 in DECL_TEMPLATE_RESULT or its type's attributes.
4117 2020-01-16 Jason Merrill <jason@redhat.com>
4119 PR c++/93286 - ICE with __is_constructible and variadic template.
4120 * pt.c (tsubst) [TREE_LIST]: Handle pack expansion.
4121 (tsubst_copy_and_build) [TRAIT_EXPR]: Always use tsubst for type2.
4123 PR c++/93280 - ICE with aggregate assignment and DMI.
4124 * init.c (get_nsdmi): Set TARGET_EXPR_DIRECT_INIT_P here.
4125 * typeck2.c (digest_nsdmi_init): Not here.
4127 2020-01-15 Paolo Carlini <paolo.carlini@oracle.com>
4130 * cp-tree.h (is_constrained_auto): New.
4131 * parser.c (cp_parser_maybe_commit_to_declaration): Correctly
4132 handle concept-check expressions; take a cp_decl_specifier_seq*
4134 (cp_parser_condition): Update call.
4135 (cp_parser_simple_declaration): Likewise.
4136 (cp_parser_placeholder_type_specifier): Correctly handle
4137 concept-check expressions.
4139 2020-01-15 Jason Merrill <jason@redhat.com>
4142 PR c++/33799 - destroy return value if local cleanup throws.
4143 * cp-tree.h (current_retval_sentinel): New macro.
4144 * decl.c (start_preparsed_function): Set up cleanup for retval.
4145 * typeck.c (check_return_expr): Set current_retval_sentinel.
4147 PR c++/93257 - consteval void function.
4148 * constexpr.c (verify_constant): Allow void_node.
4150 PR c++/92871 - bad code with xvalue and GNU ?: extension.
4151 * call.c (prevent_lifetime_extension): New.
4152 (build_conditional_expr_1): Use it.
4154 2020-01-14 Nathan Sidwell <nathan@acm.org>
4157 * pt.c (retrieve_specialization): Use get_template_info, not open
4161 * pt.c (retrieve_specialization): Get the TI from the decl or the
4162 classtype as appropriate.
4164 2020-01-14 David Malcolm <dmalcolm@redhat.com>
4166 * cp-gimplify.c (source_location_table_entry_hash::empty_zero_p):
4167 New static constant.
4168 * cp-tree.h (named_decl_hash::empty_zero_p): Likewise.
4169 (struct named_label_hash::empty_zero_p): Likewise.
4170 * decl2.c (mangled_decl_hash::empty_zero_p): Likewise.
4172 2020-01-14 Jason Merrill <jason@redhat.com>
4174 PR c++/92590 - wrong handling of inherited default ctor.
4175 * class.c (add_method): A constrained inherited ctor doesn't hide an
4176 implicit derived ctor.
4178 PR c++/92552 - ICE with inherited constrained default ctor.
4179 * pt.c (instantiate_class_template_1): Copy
4180 TYPE_HAS_USER_CONSTRUCTOR.
4181 PR c++/91930 - ICE with constrained inherited default ctor.
4182 * name-lookup.c (do_class_using_decl): Set TYPE_HAS_USER_CONSTRUCTOR
4183 for inherited constructor.
4184 PR c++/92594 - ICE with inherited trivial default ctor.
4185 * method.c (trivial_fn_p): Treat an inherited default constructor
4186 like a normal default constructor.
4188 PR c++/92594 - ICE with inherited trivial default ctor.
4189 * method.c (trivial_fn_p): Treat an inherited default constructor
4190 like a normal default constructor.
4192 PR c++/92009 - ICE with punning of typeid.
4193 * rtti.c (get_tinfo_desc): Call xref_basetypes.
4194 * constexpr.c (cxx_fold_indirect_ref): Don't strip
4197 2020-01-13 Jason Merrill <jason@redhat.com>
4199 PR c++/92746 - ICE with noexcept of function concept check.
4200 * except.c (check_noexcept_r): Handle concept-check.
4202 PR c++/92582 - ICE with member template as requirement.
4203 * pt.c (struct find_template_parameter_info): Add ctx_parms.
4204 (any_template_parm_r): Handle TEMPLATE_DECL.
4205 (find_template_parameters): Take parms instead of their depth.
4206 * constraint.cc (build_parameter_mapping): Pass them.
4208 PR c++/33799 - destroy return value if local cleanup throws.
4209 * cp-tree.h (current_retval_sentinel): New macro.
4210 * decl.c (start_preparsed_function): Set up cleanup for retval.
4211 * typeck.c (check_return_expr): Set current_retval_sentinel.
4213 PR c++/93238 - short right-shift with enum.
4214 * typeck.c (cp_build_binary_op): Use folded op1 for short_shift.
4216 2020-01-10 Jason Merrill <jason@redhat.com>
4218 * typeck.c (cp_build_binary_op): Restore short_shift code.
4220 PR c++/93143 - incorrect tree sharing with constexpr.
4221 * constexpr.c (cxx_eval_outermost_constant_expr): Don't assume
4222 CONSTRUCTORs are already unshared.
4224 PR c++/93173 - incorrect tree sharing.
4226 * cp-gimplify.c (cp_gimplify_init_expr, cp_gimplify_expr): Use
4227 copy_if_shared after cp_genericize_tree.
4228 * typeck2.c (split_nonconstant_init): Don't unshare here.
4230 2020-01-08 Jason Merrill <jason@redhat.com>
4232 * cp-gimplify.c (cp_gimplify_expr) [TARGET_EXPR]: Check
4233 TARGET_EXPR_DIRECT_INIT_P.
4234 * constexpr.c (cxx_eval_constant_expression): Likewise.
4236 2020-01-08 Jason Merrill <jason@redhat.com>
4238 PR c++/91369 - constexpr destructor and member initializer.
4239 * constexpr.c (cxx_eval_store_expression): Look through TARGET_EXPR
4240 when not preevaluating.
4242 2020-01-08 Jason Merrill <jason@redhat.com>
4244 * constexpr.c (cxx_eval_call_expression): Remove DECL_BY_REFERENCE
4247 2020-01-07 Paolo Carlini <paolo.carlini@oracle.com>
4249 * init.c (build_new): Add location_t parameter and use it throughout.
4250 (build_raw_new_expr): Likewise.
4251 * parser.c (cp_parser_new_expression): Pass the combined_loc.
4252 * pt.c (tsubst_copy_and_build): Adjust call.
4253 * cp-tree.h: Update declarations.
4255 2020-01-07 Jason Merrill <jason@redhat.com>
4257 PR c++/47877 - -fvisibility-inlines-hidden and member templates.
4258 * decl2.c (determine_visibility): -fvisibility-inlines-hidden beats
4259 explicit class visibility for a template.
4261 2020-01-07 Richard Sandiford <richard.sandiford@arm.com>
4263 * mangle.c (mangle_type_attribute_p): New function, split out from...
4264 (write_CV_qualifiers_for_type): ...here. Don't mangle attributes
4265 that contain a space.
4267 2020-01-07 Jakub Jelinek <jakub@redhat.com>
4270 * constexpr.c (struct constexpr_global_ctx): Add heap_alloc_count
4271 member, initialize it to zero in ctor.
4272 (cxx_eval_call_expression): Bump heap_dealloc_count when deleting
4273 a heap object. Don't cache calls to functions which allocate some
4274 heap objects and don't deallocate them or deallocate some heap
4275 objects they didn't allocate.
4277 2020-01-06 Jason Merrill <jason@redhat.com>
4279 PR c++/92552 - ICE with inherited constrained default ctor.
4280 * pt.c (instantiate_class_template_1): Copy
4281 TYPE_HAS_USER_CONSTRUCTOR.
4282 * class.c (one_inherited_ctor): Don't set it here.
4284 2020-01-06 Andrew Sutton <asutton@lock3software.com>
4286 PR c++/92739 - parsing requires clause with attributes.
4287 * parser.c (cp_parser_constraint_requires_parens): Exclude
4288 attributes as postfix expressions.
4290 2020-01-05 Jakub Jelinek <jakub@redhat.com>
4293 * parser.c (cp_parser_check_class_key): Disable access checks for the
4295 (cp_parser_maybe_warn_enum_key): Likewise. Return early if
4296 !warn_redundant_tags.
4298 2010-01-05 Jakub Jelinek <jakub@redhat.com>
4301 * cp-gimplify.c (cp_gimplify_init_expr): Don't look through
4302 TARGET_EXPR if it has been gimplified already.
4304 2020-01-03 Jason Merrill <jason@redhat.com>
4306 PR c++/93033 - incorrect tree node sharing with array init.
4307 * typeck2.c (split_nonconstant_init): Unshare non-decl.
4308 * cp-gimplify.c (cp_gimplify_init_expr): Only split if -fexceptions.
4310 2020-01-02 Jason Merrill <jason@redhat.com>
4312 * pt.c (invalid_nontype_parm_type_p): Reject class placeholder in
4315 2020-01-02 Jakub Jelinek <jakub@redhat.com>
4318 * cp-objcp-common.c (identifier_global_tag): Return NULL_TREE if name
4319 has not been found, rather than error_mark_node.
4321 2020-01-01 Jakub Jelinek <jakub@redhat.com>
4323 Update copyright years.
4325 Copyright (C) 2020 Free Software Foundation, Inc.
4327 Copying and distribution of this file, with or without modification,
4328 are permitted in any medium without royalty provided the copyright
4329 notice and this notice are preserved.