1 2020-10-23 Marek Polacek <polacek@redhat.com>
4 * typeck.c (cp_build_binary_op): Implement -Wsizeof-array-div.
6 2020-10-22 Patrick Palka <ppalka@redhat.com>
9 * constexpr.c (init_subob_ctx): Don't punt on RANGE_EXPR
10 indexes, instead build a sub-aggregate initialization context
13 2020-10-22 Patrick Palka <ppalka@redhat.com>
16 * constexpr.c (cxx_eval_constant_expression)
17 <case EMPTY_CLASS_EXPR>: Lower it to a CONSTRUCTOR.
18 (potential_constant_expression_1) <case COMPOUND_EXPR>: Remove
19 now-redundant handling of COMPOUND_EXPR with EMPTY_CLASS_EXPR
21 <case EMPTY_CLASS_EXPR>: Return true instead of false.
23 2020-10-22 Patrick Palka <ppalka@redhat.com>
26 * decl.c (duplicate_decls): Return NULL_TREE if
27 DECL_TEMPLATE_PARM_P differ.
29 2020-10-20 Nathan Sidwell <nathan@acm.org>
31 * name-lookup.c (push_local_extern_decl_alias): Reconstextualize
32 alias' parm decls. Drop any default args.
34 2020-10-19 Iain Sandoe <iain@sandoe.co.uk>
37 * coroutines.cc (struct coroutine_info): Add a field to
38 record that we emitted a promise type error.
39 (coro_promise_type_found_p): Check for the case that the
40 promise type contains both return_void and return_value.
41 Emit an error if so, with information about the wrong
44 2020-10-16 Nathan Sidwell <nathan@acm.org>
47 * pt.c (push_template_decl): Check DECL_LANG_SPECIFIC in friend
50 2020-10-16 Nathan Sidwell <nathan@acm.org>
53 * parser.c (cp_parser_declaration): Make token2 point to EOF if
56 2020-10-15 Jason Merrill <jason@redhat.com>
59 * decl.c (copy_fn_p): Return false for a function that is neither a
60 constructor nor an assignment operator.
61 (move_signature_fn_p): Likewise.
63 2020-10-15 Marek Polacek <polacek@redhat.com>
67 * cxx-pretty-print.c (pp_cxx_type_specifier_seq): Handle OFFSET_TYPE.
68 (cxx_pretty_printer::abstract_declarator): Fix the printing of ')'.
69 (cxx_pretty_printer::direct_abstract_declarator): Handle OFFSET_TYPE.
70 (cxx_pretty_printer::type_id): Likewise. Print the abstract declarator
71 for pointers-to-members.
73 2020-10-14 Jason Merrill <jason@redhat.com>
76 * pt.c (check_for_bare_parameter_packs): Diagnose use of
79 2020-10-14 Nathan Sidwell <nathan@acm.org>
81 * cp-tree.h (struct lang_decl_fn): Adjust context comment.
82 (DECL_FRIEND_P): Replace with ...
83 (DECL_UNIQUE_FRIEND_P): ... this. Only for FUNCTION_DECLs.
84 (DECL_FRIEND_CONTEXT): Adjust.
85 * class.c (add_implicitly_declared_members): Detect friendly
86 spaceship from context.
87 * constraint.cc (remove_constraints): Use a checking assert.
88 (maybe_substitute_reqs_for): Use DECL_UNIQUE_FRIEND_P.
89 * decl.c (check_no_redeclaration_friend_default_args):
90 DECL_UNIQUE_FRIEND_P is signficant, not hiddenness.
91 (duplicate_decls): Adjust DECL_UNIQUE_FRIEND_P clearing.
92 (redeclaration_error_message): Use DECL_UNIQUE_FRIEND_P.
93 (start_preparsed_function): Correct in-class friend processing.
94 Refactor some initializers.
95 (grokmethod): Directly check friend decl-spec.
96 * decl2.c (grokfield): Check DECL_UNIQUE_FRIEND_P.
97 * friend.c (do_friend): Set DECL_UNIQUE_FRIEND_P first, remove
98 extraneous conditions. Don't re set it afterwards.
99 * name-lookup.c (lookup_elaborated_type_1): Simplify revealing
101 (do_pushtag): Likewise.
102 * pt.c (optimize_specialization_lookup_p): Check
103 DECL_UNIQUE_FRIEND_P.
104 (push_template_decl): Likewise. Drop unneeded friend setting.
105 (type_dependent_expression_p): Check DECL_UNIQUE_FRIEND_P.
107 2020-10-14 Nathan Sidwell <nathan@acm.org>
109 * name-lookup.c (push_local_extern_decl_alias): Push into alias's
110 namespace and use pushdecl.
111 (do_pushdecl_with_scope): Clarify behaviour.
113 2020-10-12 Martin Sebor <msebor@redhat.com>
116 * error.c (dump_type_suffix): Handle both the C and C++ forms of
119 2020-10-12 Martin Sebor <msebor@redhat.com>
123 * init.c (warn_placement_new_too_small): Call builtin_objsize instead
124 of duplicating what it does.
126 2020-10-08 Jason Merrill <jason@redhat.com>
130 * pt.c (tsubst_aggr_type): Don't build a TYPENAME_TYPE when
132 (tsubst_template_decl): Use tsubst_aggr_type.
134 2020-10-08 Patrick Palka <ppalka@redhat.com>
137 * constraint.cc (build_type_constraint): Temporarily increment
138 processing_template_decl before calling build_concept_check.
139 * pt.c (make_constrained_placeholder_type): Likewise.
141 2020-10-08 Patrick Palka <ppalka@redhat.com>
144 * parser.c (cp_parser_class_specifier_1): Move call to
145 associate_classtype_constraints from here to ...
146 (cp_parser_class_head): ... here.
147 * pt.c (is_compatible_template_arg): Correct documentation to
148 say "argument is _no_ more constrained than the parameter".
150 2020-10-07 Marek Polacek <polacek@redhat.com>
153 * pt.c (tsubst_copy_and_build) <case TEMPLATE_ID_EXPR>: Call
154 tsubst_copy_and_build explicitly instead of using the RECUR macro.
155 Handle a TEMPLATE_ID_EXPR with an IDENTIFIER_NODE as its operand.
156 <case CALL_EXPR>: Perform ADL for a TEMPLATE_ID_EXPR with an
157 IDENTIFIER_NODE as its operand.
159 2020-10-07 Patrick Palka <ppalka@redhat.com>
163 * tree.c (cp_tree_equal) <case ALIGNOF_EXPR>: Return false if
164 ALIGNOF_EXPR_STD_P differ.
166 2020-10-07 Nathan Sidwell <nathan@acm.org>
168 * cp-tree.h (struct language_function): Delete extern_decl_map.
169 (DECL_LOCAL_DECL_ALIAS): New.
170 * name-lookup.h (is_local_extern): Delete.
171 * name-lookup.c (set_local_extern_decl_linkage): Replace with ...
172 (push_local_extern_decl): ... this new function.
173 (do_pushdecl): Call new function after pushing new decl. Unhide
174 hidden non-functions.
175 (is_local_extern): Delete.
176 * decl.c (layout_var_decl): Do not allow VLA local externs.
177 * decl2.c (mark_used): Also mark DECL_LOCAL_DECL_ALIAS. Drop old
178 local-extern treatment.
179 * parser.c (cp_parser_oacc_declare): Deal with local extern aliases.
180 * pt.c (tsubst_expr): Adjust local extern instantiation.
181 * cp-gimplify.c (cp_genericize_r): Remap DECL_LOCAL_DECLs.
183 2020-10-07 Nathan Sidwell <nathan@acm.org>
185 * cp-tree.h (DECL_BUILTIN_P): Rename to ...
186 (DECL_UNDECLARED_BUILTIN_P): ... here.
187 * decl.c (duplicate_decls): Adjust.
188 * name-lookup.c (anticipated_builtin_p): Adjust.
189 (do_nonmember_using_decl): Likewise.
191 2020-10-07 Nathan Sidwell <nathan@acm.org>
193 * tree.c (build_cp_fntype_variant): Clear
194 TYPE_DEPENDENT_P_VALID if necessary.
196 2020-10-06 Marek Polacek <polacek@redhat.com>
199 * parser.c (cp_parser_direct_declarator): When checking if a
200 name is a function template declaration for the P0634R3 case,
201 look in uninstantiated templates too.
203 2020-10-05 Marek Polacek <polacek@redhat.com>
205 * cp-tree.h (NON_UNION_CLASS_TYPE_P): Fix typo in a comment.
207 2020-10-05 Richard Biener <rguenther@suse.de>
208 Jakub Jelinek <jakub@redhat.com>
211 * error.c (dump_expr): Handle TARGET_MEM_REF.
213 2020-10-05 Nathan Sidwell <nathan@acm.org>
215 * name-lookup.c (maybe_add_fuzzy_decl): New.
216 (maybe_add_fuzzy_binding): New.
217 (consider_binding_level): Use intermediate sortable vector for
220 2020-10-02 Marek Polacek <polacek@redhat.com>
223 * cxx-pretty-print.c (pp_cxx_template_argument_list): If the
224 argument is template_parm_object_p, print its DECL_INITIAL.
226 2020-10-02 Nathan Sidwell <nathan@acm.org>
228 * cp-tree.h (lang_decl_base): anticipated_p is not used for
230 (DECL_ANTICIPATED): Delete.
231 * decl.c (duplicate_decls): Delete DECL_ANTICIPATED_management,
233 (cxx_builtin_function): Drop DECL_ANTICIPATED setting.
234 (xref_tag_1): Drop DECL_ANTICIPATED assert.
235 * name-lookup.c (name_lookup::adl_class_only): Drop
236 DECL_ANTICIPATED check.
237 (name_lookup::search_adl): Always dedup.
238 (anticipated_builtin_p): Reimplement.
239 (do_pushdecl): Drop DECL_ANTICIPATED asserts & update.
240 (lookup_elaborated_type_1): Drop DECL_ANTICIPATED update.
241 (do_pushtag): Drop DECL_ANTICIPATED setting.
242 * pt.c (push_template_decl): Likewise.
243 (tsubst_friend_class): Likewise.
245 2020-10-02 Nathan Sidwell <nathan@acm.org>
247 * name-lookup.c (consider_decl): New, broken out of ...
248 (consider_binding_level): ... here. Iterate the hash table for
251 2020-10-02 Nathan Sidwell <nathan@acm.org>
253 * cp-tree.h (base_ctor_omit_inherited_parms): Declare.
254 * class.c (add_method): Refactor main loop, only pass fns to
255 ctor_omit_inherited_parms.
256 (build_cdtor_clones): Rename bool parms.
257 (clone_cdtor): Call base_ctor_omit_inherited_parms.
258 * method.c (base_ctor_omit_inherited_parms): New, broken out of
260 (ctor_omit_inherited_parms): ... here, call it with
261 DECL_CLONED_FUNCTION.
263 2020-10-02 Nathan Sidwell <nathan@acm.org>
265 * cp-tree.h (cp_fname_init): Delete declaration.
266 * decl.c (cp_fname_init): Merge into only caller ...
267 (cp_make_fname): ... here & refactor.
269 2020-10-02 Jason Merril <jason@redhat.com>
271 * call.c (build_operator_new_call): Set CALL_FROM_NEW_OR_DELETE_P.
272 (build_op_delete_call): Likewise.
273 * init.c (build_new_1, build_vec_delete_1, build_delete): Not here.
276 2020-10-02 Jason Merril <jason@redhat.com>
278 * lambda.c (call_from_lambda_thunk_p): New.
279 * cp-gimplify.c (cp_genericize_r): Use it.
280 * pt.c (tsubst_copy_and_build): Use it.
281 * typeck.c (check_return_expr): Use it.
282 * cp-tree.h: Declare it.
283 (CALL_FROM_NEW_OR_DELETE_P): Move to gcc/tree.h.
285 2020-10-01 Nathan Sidwell <nathan@acm.org>
287 * cp-tree.h (DECL_ANTICIPATED): Adjust comment.
288 (DECL_HIDDEN_P, TYPE_HIDDEN_P): Delete.
289 * tree.c (ovl_insert): Delete DECL_HIDDEN_P assert.
290 (ovl_skip_hidden): Likewise.
292 2020-10-01 Nathan Sidwell <nathan@acm.org>
294 * name-lookup.c (pushdecl_top_level): Assert incoming context is
295 null, add global_namespace context.
296 (pushdecl_top_level_and_finish): Likewise.
297 * pt.c (get_template_parm_object): Clear decl context before
299 * semantics.c (finish_compound_literal): Likewise.
301 2020-10-01 Nathan Sidwell <nathan@acm.org>
303 * decl.c (lookup_and_check_tag): Refactor.
305 2020-10-01 Jakub Jelinek <jakub@redhat.com>
308 * call.c (build_over_call): If obj_arg is non-NULL, return INIT_EXPR
309 setting obj_arg to call.
311 2020-10-01 Jakub Jelinek <jakub@redhat.com>
314 * constexpr.c (cxx_eval_call_expression): Don't VERIFY_CONSTANT the
317 2020-10-01 Marek Polacek <polacek@redhat.com>
320 * pt.c (do_class_deduction): Don't prune explicit deduction guides
321 in copy-list-initialization. In copy-list-initialization, if an
322 explicit deduction guide was selected, give an error.
324 2020-09-30 Nathan Sidwell <nathan@acm.org>
326 * cp-tree.h (struct lang_decl_fn): Remove hidden_friend_p.
327 (DECL_HIDDEN_FRIEND_P): Delete.
328 * call.c (add_function_candidate): Drop assert about anticipated
330 (build_new_op_1): Drop koenig lookup flagging for hidden friend.
331 * decl.c (duplicate_decls): Drop HIDDEN_FRIEND_P updating.
332 * name-lookup.c (do_pushdecl): Likewise.
333 (set_decl_namespace): Discover hiddenness from OVL_HIDDEN_P.
334 * pt.c (check_explicit_specialization): Record found_hidden
337 2020-09-29 Marek Polacek <polacek@redhat.com>
340 * call.c (ref_conv_binds_directly_p): New function.
341 * cp-tree.h (ref_conv_binds_directly_p): Declare.
342 * parser.c (warn_for_range_copy): New function.
343 (cp_convert_range_for): Call it.
345 2020-09-29 Nathan Sidwell <nathan@acm.org>
347 * cp-tree.h (ovl_insert): Change final parm to hidden-or-using
349 * name-lookup.h (HIDDEN_TYPE_BINDING_P): New.
350 (struct cxx_binding): Add type_is_hidden flag.
351 * tree.c (ovl_insert): Change using_p parm to using_or_hidden,
353 (ovl_skip_hidden): Assert we never see a naked hidden decl.
354 * decl.c (xref_tag_1): Delete unhiding friend from here (moved to
355 lookup_elaborated_type_1).
356 * name-lookup.c (STAT_TYPE_HIDDEN_P, STAT_DECL_HIDDEN_P): New.
357 (name_lookup::search_namespace_only): Check new hidden markers.
358 (cxx_binding_make): Clear HIDDEN_TYPE_BINDING_P.
359 (update_binding): Update new hidden markers.
360 (lookup_name_1): Check HIDDEN_TYPE_BINDING_P and simplify friend
362 (lookup_elaborated_type_1): Use new hidden markers. Reveal the
365 2020-09-29 Nathan Sidwell <nathan@acm.org>
367 * name-lookup.c (create_local_binding): Do not clear
368 INHERITED_VALUE_BINDING_P here.
369 (name_lookup::process_binding): Move done hidden-decl triage to ...
370 (name_lookup::search_namespace_only): ... here, its only caller.
371 (cxx_binding_make): Clear flags here.
372 (push_binding): Not here.
373 (pop_local_binding): RAII.
374 (update_binding): Refactor.
375 (do_pushdecl): Assert we're never revealing a local binding.
376 (do_pushdecl_with_scope): Directly call do_pushdecl.
377 (get_class_binding): Do not clear LOCAL_BINDING_P here.
378 * pt.c (push_template_decl): Set friend & anticipated before
381 2020-09-29 Nathan Sidwell <nathan@acm.org>
383 * name-lookup.c (update_binding): We never meet two implicit
385 (do_pushdecl): Adjust set_identifier_type_value_with_scope calls.
386 (set_identifier_type_value_with_scope): Do not update binding in
387 the namespace-case. Assert it is already there.
389 2020-09-25 Nathan Sidwell <nathan@acm.org>
391 * cp-tree.h (duplicate_decls): Replace 'is_friend' with 'hiding'
392 and add 'was_hidden'.
393 * name-lookup.h (pushdecl_namespace_level): Replace 'is_friend'
395 (pushdecl): Likewise.
396 (pushdecl_top_level): Drop is_friend parm.
397 * decl.c (check_no_redeclaration_friend_default_args): Rename parm
399 (duplicate_decls): Replace 'is_friend' with 'hiding'
400 and 'was_hidden'. Do minimal adjustments in body.
401 (cxx_builtin_function): Pass 'hiding' to pushdecl.
402 * friend.c (do_friend): Pass 'hiding' to pushdecl.
403 * name-lookup.c (supplement_binding_1): Drop defaulted arg to
405 (update_binding): Replace 'is_friend' with 'hiding'. Drop
406 defaulted arg to duplicate_decls.
407 (do_pushdecl): Replace 'is_friend' with 'hiding'. Assert no
408 surprise hidhing. Adjust duplicate_decls calls to inform of old
410 (pushdecl): Replace 'is_friend' with 'hiding'.
411 (set_identifier_type_value_with_scope): Adjust update_binding
413 (do_pushdecl_with_scope): Replace 'is_friend' with 'hiding'.
414 (pushdecl_outermost_localscope): Drop default arg to
415 do_pushdecl_with_scope.
416 (pushdecl_namespace_level): Replace 'is_friend' with 'hiding'.
417 (pushdecl_top_level): Drop is_friend parm.
418 * pt.c (register_specialization): Comment duplicate_decls call
420 (push_template_decl): Commont pushdecl_namespace_level.
421 (tsubst_friend_function, tsubst_friend_class): Likewise.
423 2020-09-25 Nathan Sidwell <nathan@acm.org>
425 * name-lookup.h (enum tag_scope): Replace with ...
426 (enum class TAG_how): ... this. Add HIDDEN_FRIEND value.
427 (lookup_type_scope): Replace with ...
428 (lookup_elaborated_type): ... this.
429 (pushtag): Use TAG_how, not tag_scope.
430 * cp-tree.h (xref_tag): Parameter is TAG_how, not tag_scope.
431 * decl.c (lookup_and_check_tag): Likewise. Adjust.
432 (xref_tag_1, xref_tag): Likewise. adjust.
433 (start_enum): Adjust lookup_and_check_tag call.
434 * name-lookup.c (lookup_type_scope_1): Rename to ...
435 (lookup_elaborated_type_1) ... here. Use TAG_how, not tag_scope.
436 (lookup_type_scope): Rename to ...
437 (lookup_elaborated_type): ... here. Use TAG_how, not tag_scope.
438 (do_pushtag): Use TAG_how, not tag_scope. Adjust.
440 * parser.c (cp_parser_elaborated_type_specifier): Adjust.
441 (cp_parser_class_head): Likewise.
443 2020-09-25 Nathan Sidwell <nathan@acm.org>
445 * cp-tree.h (DECL_BUILTIN_P): New.
446 * decl.c (duplicate_decls): Use it. Do not treat omp-udr as a
448 * name-lookup.c (anticipated_builtin): Use it.
449 (set_decl_context_in_fn): Function-scope OMP UDRs have function context.
450 (do_nonmember_using_decl): Use DECL_BUILTIN_P.
451 * parser.c (cp_parser_omp_declare_reduction): Function-scope OMP
452 UDRs have function context. Assert we never find a valid duplicate.
453 * pt.c (tsubst_expr): Function-scope OMP UDRs have function context.
455 2020-09-24 Nathan Sidwell <nathan@acm.org>
457 * cp-tree.h (duplicate_decls): Default is_friend to false.
458 (xref_tag): Default tag_scope & tpl_header_p to ts_current & false.
459 (push_template_decl_real): Default is_friend to false. Rename to
461 (push_template_decl): ... here. Delete original decl.
462 * name-lookup.h (pushdecl_namespace_level): Default is_friend to
464 (pushtag): Default tag_scope to ts_current.
465 * coroutines.cc (morph_fn_to_coro): Drop default args to xref_tag.
466 * decl.c (start_decl): Drop default args to duplicate_decls.
467 (start_enum): Drop default arg to pushtag & xref_tag.
468 (start_preparsed_function): Pass DECL_FRIEND_P to
470 (grokmethod): Likewise.
471 * friend.c (do_friend): Rename push_template_decl_real calls.
472 * lambda.c (begin_lamnbda_type): Drop default args to xref_tag.
473 (vla_capture_type): Likewise.
474 * name-lookup.c (maybe_process_template_type_declaration): Rename
475 push_template_decl_real call.
476 (pushdecl_top_level_and_finish): Drop default arg to
477 pushdecl_namespace_level.
478 * pt.c (push_template_decl_real): Assert no surprising friend
479 functions. Rename to ...
480 (push_template_decl): ... here. Delete original function.
481 (lookup_template_class_1): Drop default args from pushtag.
482 (instantiate_class_template_1): Likewise.
483 * ptree.c (debug_overload): Print hidden and using markers.
484 * rtti.c (init_rtti_processing): Drop refault args from xref_tag.
485 (build_dynamic_cast_1, tinfo_base_init): Likewise.
486 * semantics.c (begin_class_definition): Drop default args to
489 2020-09-24 Nathan Sidwell <nathan@acm.org>
492 * pt.c (maybe_instantiate_noexcept): Local externs are never
495 2020-09-23 Nathan Sidwell <nathan@acm.org>
497 * name-lookup.h (typedef cxx_binding): Delete tdef.
498 (typedef cp_binding_level): Likewise.
499 (struct cxx_binding): Flags are bools.
501 2020-09-23 Nathan Sidwell <nathan@acm.org>
504 * pt.c (tsubst_copy) [FUNCTION_DECL,VAR_DECL]: Retrieve local
505 specialization for DECL_LOCAL_P decls.
507 2020-09-22 Patrick Palka <ppalka@redhat.com>
510 * pt.c (corresponding_template_parameter): Define.
511 (keep_template_parm): Use it to adjust the given template
512 parameter to the corresponding in-scope one from ctx_parms.
514 2020-09-22 Nathan Sidwell <nathan@acm.org>
516 * cp-tree.h (xref_tag_from_type): Don't declare.
517 * decl.c (xref_tag_from_type): Delete.
518 * pt.c (lookup_template_class_1): Erroneously located class
519 definitions just give error_mark, don't try and inject it into the
522 2020-09-22 Jakub Jelinek <jakub@redhat.com>
525 * constexpr.c (cxx_eval_builtin_function_call): Return void_node for
526 calls to __sanitize_ptr_{sub,cmp} builtins.
528 2020-09-22 Nathan Sidwell <nathan@acm.org>
530 * pt.c (instantiate_class_template_1): Do not repush and unhide
533 2020-09-21 Marek Polacek <polacek@redhat.com>
537 * lambda.c (maybe_add_lambda_conv_op): Mark the conversion function
540 2020-09-21 Marek Polacek <polacek@redhat.com>
542 * pt.c (deduction_guides_for): Add a bool parameter. Set it.
543 (do_class_deduction): Warn when CTAD succeeds but the type doesn't
544 have any explicit deduction guides.
546 2020-09-21 Nathan Sidwell <nathan@acm.org>
548 * decl.c (xref_tag_1): Use IDENTIFIER_LAMBDA_P to detect lambdas.
549 * lambda.c (begin_lambda_type): Use ts_current to push the tag.
550 * name-lookup.h (enum tag_scope): Drop ts_lambda.
552 2020-09-21 Marek Polacek <polacek@redhat.com>
555 * decl.c (redeclaration_error_message): Detect a redeclaration of
558 2020-09-19 Sandra Loosemore <sandra@codesourcery.com>
560 * cp-gimplify.c (enum bc_t, bc_label): Move to c-family.
561 (begin_bc_block, finish_bc_block, get_bc_label): Likewise.
562 (genericize_cp_loop): Likewise.
563 (genericize_for_stmt, genericize_while_stmt): Likewise.
564 (genericize_do_stmt, genericize_switch_stmt): Likewise.
565 (genericize_continue_stmt, genericize_break_stmt): Likewise.
566 (genericize_omp_for_stmt): Likewise.
567 (cp_genericize_r): Call c_genericize_control_stmt instead of
568 above functions directly.
569 (cp_genericize): Call save_bc_state and restore_bc_state instead
570 of manipulating bc_label directly.
571 * cp-objcp-common.c (cxx_block_may_fallthru): Defer to
572 c_block_may_fallthru instead of handling SWITCH_STMT here.
573 (cp_common_init_ts): Move handling of loop and switch-related
574 statements to c-family.
575 * cp-tree.def (FOR_STMT, WHILE_STMT, DO_STMT): Move to c-family.
576 (BREAK_STMT, CONTINUE_STMT, SWITCH_STMT): Likewise.
577 * cp-tree.h (LABEL_DECL_BREAK, LABEL_DECL_CONTINUE): Likewise.
578 (WHILE_COND, WHILE_BODY): Likewise.
579 (DO_COND, DO_BODY): Likewise.
580 (FOR_INIT_STMT, FOR_COND, FOR_EXPR, FOR_BODY, FOR_SCOPE): Likewise.
581 (SWITCH_STMT_COND, SWITCH_STMT_BODY): Likewise.
582 (SWITCH_STMT_TYPE, SWITCH_STMT_SCOPE): Likewise.
583 (SWITCH_STMT_ALL_CASES_P, SWITCH_STMT_NO_BREAK_P): Likewise.
584 * cxx-pretty-print.c (cxx_pretty_printer::statement): Move code
585 to handle structured loop and switch tree nodes to c-family.
586 * dump.c (cp_dump_tree): Likewise.
588 2020-09-19 Patrick Palka <ppalka@redhat.com>
592 * constraint.cc (map_arguments): Call template_parm_to_arg
593 in the self-mapping case.
594 (finish_shorthand_constraint): No need to build a TREE_LIST
595 before calling template_parm_to_arg.
596 * pt.c (template_parm_to_arg): Rewrite to handle TEMPLATE_PARM_P
597 nodes as well as DECL_TEMPLATE_PARM_P nodes, and to make the
598 overlying TREE_LIST node optional.
599 (keep_template_parm): Don't record a BOUND_TEMPLATE_TEMPLATE_PARM,
600 instead record its corresponding TEMPLATE_TEMPLATE_PARM.
601 (convert_generic_types_to_packs): Don't call
602 template_parm_to_arg.
604 2020-09-19 Patrick Palka <ppalka@redhat.com>
607 * constraint.cc (satisfy_atom): Pass true as the
608 manifestly_const_eval argument to maybe_constant_value.
610 2020-09-18 Jason Merrill <jason@redhat.com>
613 * decl.c (complete_vars): Only call layout_var_decl if completing
616 2020-09-18 Jason Merrill <jason@redhat.com>
618 * decl.c (complete_vars): Call layout_var_decl.
620 2020-09-17 Patrick Palka <ppalka@redhat.com>
624 * constraint.cc (tsubst_requires_expr): Use REQUIRES_EXPR_PARMS
625 and REQUIRES_EXPR_REQS. Use REQUIRES_EXPR_EXTRA_ARGS,
626 add_extra_args and build_extra_args to defer substitution until
627 we have all the template arguments.
628 (finish_requires_expr): Adjust the call to build_min so that
629 REQUIRES_EXPR_EXTRA_ARGS gets set to NULL_TREE.
630 * cp-tree.def (REQUIRES_EXPR): Give it a third operand.
631 * cp-tree.h (REQUIRES_EXPR_PARMS, REQUIRES_EXPR_REQS,
632 REQUIRES_EXPR_EXTRA_ARGS): Define.
633 (add_extra_args, build_extra_args): Declare.
635 2020-09-16 Nathan Sidwell <nathan@acm.org>
637 * cp-tree.h (cp_check_omp_declare_reduction): Return bool.
638 * semantics.c (cp_check_omp_declare_reduction): Return true on for
640 * pt.c (push_template_decl_real): OMP reductions do not get a
642 (tsubst_function_decl): Remove special casing for local decl omp
644 (tsubst_expr): Call instantiate_body for a local omp reduction.
645 (instantiate_body): Add nested_p parm, and deal with such
647 (instantiate_decl): Reject FUNCTION_SCOPE entities, adjust
648 instantiate_body call.
650 2020-09-16 Nathan Sidwell <nathan@acm.org>
652 * pt.c (instantiate_body): Remove 'nested' var, simplify
655 2020-09-16 Nathan Sidwell <nathan@acm.org>
657 * pt.c (instantiate_body): New, broken out of ..
658 (instantiate_decl): ... here. Call it.
660 2020-09-15 Nathan Sidwell <nathan@acm.org>
662 * pt.c (push_template_decl_real): OMP reductions retain a template
664 (tsubst_function_decl): Likewise.
666 2020-09-15 Tobias Burnus <tobias@codesourcery.com>
669 * cp-gimplify.c (cxx_omp_finish_clause): Add bool openacc arg.
670 * cp-tree.h (cxx_omp_finish_clause): Likewise
671 * semantics.c (handle_omp_for_class_iterator): Update call.
673 2020-09-14 Marek Polacek <polacek@redhat.com>
675 * pt.c (push_template_decl_real): Use VAR_OR_FUNCTION_DECL_P.
677 2020-09-14 Nathan Sidwell <nathan@acm.org>
679 * pt.c (push_template_decl_real): Don't attach a template head to
681 (tsubst_function_decl): Add support for headless local extern
683 (tsubst_decl): Add support for headless local extern decls.
685 2020-09-11 Nathan Sidwell <nathan@acm.org>
687 * decl.c (grokfndecl): Don't attach to local extern.
689 2020-09-11 Nathan Sidwell <nathan@acm.org>
691 * parser.c (cp_parser_objc_method_definition_list): Reimplement
692 loop, make sure we pop scope.
694 2020-09-11 Marek Polacek <polacek@redhat.com>
696 * cp-tree.h (LOOKUP_CONSTINIT): Remove.
697 (LOOKUP_REWRITTEN): Adjust.
698 * decl.c (duplicate_decls): Set DECL_DECLARED_CONSTINIT_P.
699 (check_initializer): Use DECL_DECLARED_CONSTINIT_P instead of
701 (cp_finish_decl): Don't set DECL_DECLARED_CONSTINIT_P. Use
702 DECL_DECLARED_CONSTINIT_P instead of LOOKUP_CONSTINIT.
703 (grokdeclarator): Set DECL_DECLARED_CONSTINIT_P.
704 * decl2.c (grokfield): Don't handle LOOKUP_CONSTINIT.
705 * parser.c (cp_parser_decomposition_declaration): Remove
706 LOOKUP_CONSTINIT handling.
707 (cp_parser_init_declarator): Likewise.
708 * pt.c (tsubst_expr): Likewise.
709 (instantiate_decl): Likewise.
710 * typeck2.c (store_init_value): Use DECL_DECLARED_CONSTINIT_P instead
713 2020-09-10 Nathan Sidwell <nathan@acm.org>
715 * cp-tree.h (TINFO_VAR_DECLARED_CONSTINIT): Replace with ...
716 (DECL_DECLARED_CONSTINIT_P): ... this.
717 * decl.c (start_decl): No need to retrofit_lang_decl for constinit
719 (cp_finish_decl): Use DECL_DECLARED_CONSTINIT_P.
720 * pt.c (tsubst_decl): No need to handle constinit flag
722 (tsubst_expr): Or here.
724 2020-09-10 Nathan Sidwell <nathan@acm.org>
726 * cp-tree.h (DECL_LOCAL_FUNCTION_P): Rename to ...
727 (DECL_LOCAL_DECL_P): ... here. Accept both fns and vars.
728 * decl.c (start_decl): Set DECL_LOCAL_DECL_P for local externs.
729 (omp_declare_variant_finalize_one): Use DECL_LOCAL_DECL_P.
730 (local_variable_p): Simplify.
731 * name-lookup.c (set_decl_context_in_fn): Assert DECL_LOCAL_DECL_P
732 is as expected. Simplify.
733 (do_pushdecl): Don't set decl_context_in_fn for friends.
734 (is_local_extern): Simplify.
735 * call.c (equal_functions): Use DECL_LOCAL_DECL_P.
736 * parser.c (cp_parser_postfix_expression): Likewise.
737 (cp_parser_omp_declare_reduction): Likewise.
738 * pt.c (check_default_tmpl_args): Likewise.
739 (tsubst_expr): Assert nested reduction function is local.
740 (type_dependent_expression_p): Use DECL_LOCAL_DECL_P.
741 * semantics.c (finish_call_expr): Likewise.
743 2020-09-09 Marek Polacek <polacek@redhat.com>
746 * decl.c (reshape_init): If we're initializing a char array from
747 a string-literal that is enclosed in braces, unwrap it.
748 * init.c (build_new_1): Don't handle string-initializers here.
749 (build_new): Handle new-expression with paren-init when the
750 array bound is known. Always pass string constants to build_new_1
751 enclosed in braces. Don't handle string-initializers in any
754 2020-09-09 Marek Polacek <polacek@redhat.com>
757 * decl.c (reshape_init_r): When initializing an aggregate member
758 with an initializer from an initializer-list, also consider
761 2020-09-09 Nathan Sidwell <nathan@acm.org>
763 * parser.c (cp_parser_omp_declare_reduction): Refactor to avoid
764 code duplication. Update DECL_TI_TEMPLATE's context.
765 * pt.c (tsubst_expr): For OMP reduction function, set context to
766 global_namespace before pushing.
767 (tsubst_omp_udr): Assert current_function_decl, add comment about
770 2020-09-09 Patrick Palka <ppalka@redhat.com>
773 * class.c (resolve_address_of_overloaded_function): Check
774 constraints_satisfied_p and perform return-type deduction via
775 maybe_instantiate_decl when considering non-template functions
777 * cp-tree.h (maybe_instantiate_decl): Declare.
778 * decl2.c (maybe_instantiate_decl): Remove static.
780 2020-09-04 Jason Merrill <jason@redhat.com>
782 * expr.c (mark_use): Use iloc_sentinel.
784 2020-09-03 Jakub Jelinek <jakub@redhat.com>
787 * constexpr.c (fundef_copies_table): Change type from
788 hash_map<tree, tree> * to decl_tree_map *.
790 2020-09-03 Marek Polacek <polacek@redhat.com>
793 * cp-tree.h (do_aggregate_paren_init): Declare.
794 * decl.c (do_aggregate_paren_init): New.
795 (grok_reference_init): Use it.
796 (check_initializer): Likewise.
797 * init.c (perform_member_init): Handle initializing an array from
798 a ()-list. Use do_aggregate_paren_init.
800 2020-09-03 Jakub Jelinek <jakub@redhat.com>
803 * constexpr.c (cxx_eval_outermost_constant_expr): Temporarily disable
804 flag_rounding_math during manifestly constant evaluation.
806 2020-09-01 Marek Polacek <polacek@redhat.com>
809 * init.c (build_new_1): Call reshape_init.
811 2020-09-01 Jakub Jelinek <jakub@redhat.com>
814 * semantics.c (handle_omp_array_sections_1): Test
815 DECL_ARRAY_PARAMETER_P only on PARM_DECLs.
817 2020-08-31 Marek Polacek <polacek@redhat.com>
818 Jason Merrill <jason@redhat.com>
821 * call.c (build_new_method_call_1): Use build_constructor_from_vec
822 instead of build_tree_list_vec + build_constructor_from_list.
823 * init.c (build_new_1): Handle new char[]{"foo"}. Use
824 build_constructor_from_vec instead of build_tree_list_vec +
825 build_constructor_from_list.
826 (build_new): Deduce the array size in new-expression if not
827 present. Handle ()-init. Handle initializing an array from
829 * parser.c (cp_parser_new_type_id): Leave [] alone.
830 (cp_parser_direct_new_declarator): Allow [].
831 * pt.c (type_dependent_expression_p): In a NEW_EXPR, consider
832 array types whose dimension has to be deduced type-dependent.
834 2020-08-27 Martin Liska <mliska@suse.cz>
836 * class.c (build_vtbl_initializer): Set exact argument of a vector
837 growth function to true.
838 * constraint.cc (get_mapped_args): Likewise.
839 * decl.c (cp_maybe_mangle_decomp): Likewise.
840 (cp_finish_decomp): Likewise.
841 * parser.c (cp_parser_omp_for_loop): Likewise.
842 * pt.c (canonical_type_parameter): Likewise.
843 * rtti.c (get_pseudo_ti_init): Likewise.
845 2020-08-26 Nathan Sidwell <nathan@acm.org>
847 * decl.c (poplevel): A local-binding tree list holds the name in
849 * name-lookup.c (update_local_overload): Add id to TREE_PURPOSE.
850 (lookup_name_1): Deal with local-binding error_mark_node marker.
851 (op_unqualified_lookup): Return error_mark_node for 'nothing
852 found'. Retain global binding, check class binding here.
853 (maybe_save_operator_binding): Reimplement to always cache a
855 (push_operator_bindings): Deal with 'ignore' marker.
857 2020-08-25 Tobias Burnus <tobias@codesourcery.com>
860 * semantics.c (handle_omp_array_sections_1): Talk about
861 array function parameter in the error message.
863 2020-08-25 Jakub Jelinek <jakub@redhat.com>
866 * cp-tree.h (build_trivial_dtor_call): Add bool argument defaulted
868 * call.c (build_trivial_dtor_call): Add NO_PTR_DEREF argument. If
869 instance is a pointer and NO_PTR_DEREF is true, clobber the pointer
870 rather than what it points to.
871 * semantics.c (finish_call_expr): Call build_trivial_dtor_call with
872 true as NO_PTR_DEREF.
874 2020-08-25 Jason Merrill <jason@redhat.com>
877 * optimize.c (populate_clone_array): Revert PR70462 change.
878 (maybe_clone_body): Likewise.
880 2020-08-24 Nathan Sidwell <nathan@acm.org>
882 * ptree.c (debug_overload): New.
884 2020-08-19 Jason Merrill <jason@redhat.com>
887 * cp-tree.h (push_tinst_level, push_tinst_level_loc): Declare.
888 * constraint.cc (satisfy_declaration_constraints):
889 Use add_outermost_template_args and push_tinst_level.
890 * pt.c (add_outermost_template_args): Handle getting
891 a TEMPLATE_DECL as the first argument.
892 (push_tinst_level, push_tinst_level_loc): No longer static.
893 (fn_type_unification): Check satisfaction before non-dependent
896 2020-08-18 Nathan Sidwell <nathan@acm.org>
898 * cp-tree.h (SET_TYPE_TEMPLTE_INFO): Do not deal with ALIAS templates.
899 * pt.c (lookup_template_class_1): Special-case alias template
900 template_info setting.
902 2020-08-18 Jason Merrill <jason@redhat.com>
905 * pt.c (tsubst_aggr_type): Rewrite in C++17, too.
906 (maybe_dependent_member_ref): Likewise.
907 (build_deduction_guide): Re-substitute template parms.
908 * cp-tree.h (struct push_nested_class_guard): New.
909 * constraint.cc (get_normalized_constraints_from_decl): Use it.
911 2020-08-18 Jason Merrill <jason@redhat.com>
914 * pt.c (maybe_dependent_member_ref): New.
915 (tsubst_copy) [CONST_DECL]: Use it.
916 [VAR_DECL]: Likewise.
917 (tsubst_aggr_type): Handle nested type.
919 2020-08-18 Nathan Sidwell <nathan@acm.org>
921 * name-lookup.c (qualify_lookup): Drop lambda checking here.
922 Reorder namespace & type checking.
923 (lookup_name_1): Do hidden lambda checking here.
925 2020-08-14 Nathan Sidwell <nathan@acm.org>
927 * name-lookup.h (lookup_name_real, lookup_name_nonclass): Rename
929 (lookup_name): ... these new overloads.
930 * name-lookup.c (identifier_type_value_1): Rename lookup_name_real
932 (lookup_name_real_1): Rename to ...
933 (lookup_name_1): ... here.
934 (lookup_name_real): Rename to ...
935 (lookup_name): ... here. Rename lookup_name_real_1 call.
936 (lookup_name_nonclass): Delete.
937 * call.c (build_operator_new_call): Rename lookup_name_real call.
938 (add_operator_candidates): Likewise.
939 (build_op_delete_call): Rename lookup_name_nonclass call.
940 * parser.c (cp_parser_lookup_name): Likewise.
941 * pt.c (tsubst_friend_class, lookup_init_capture_pack): Likewise.
942 (tsubst_expr): Likewise.
943 * semantics.c (capture_decltype): Likewise.
945 2020-08-14 Nathan Sidwell <nathan@acm.org>
947 * cp-tree.h (LOOKUP_HIDDEN): Delete.
948 (LOOKUP_PREFER_RVALUE): Adjust initializer.
949 * name-lookup.h (enum class LOOK_want): Add HIDDEN_FRIEND and
951 (lookup_name_real): Drop flags parm.
952 (lookup_qualified_name): Drop find_hidden parm.
953 * name-lookup.c (class name_lookup): Drop hidden field, adjust
955 (name_lookup::add_overload): Check want for hiddenness.
956 (name_lookup::process_binding): Likewise.
957 (name_lookup::search_unqualified): Likewise.
958 (identifier_type_value_1): Adjust lookup_name_real call.
959 (set_decl_namespace): Adjust name_lookup ctor.
960 (qualify_lookup): Drop flags parm, use want for hiddenness.
961 (lookup_qualified_name): Drop find_hidden parm.
962 (lookup_name_real_1): Drop flags parm, adjust qualify_lookup
964 (lookup_name_real): Drop flags parm.
965 (lookup_name_nonclass, lookup_name): Adjust lookup_name_real
967 (lookup_type_scope_1): Adjust qualify_lookup calls.
968 * call.c (build_operator_new_call): Adjust lookup_name_real call.
969 (add_operator_candidates): Likewise.
970 * coroutines.cc (morph_fn_to_coro): Adjust lookup_qualified_name
972 * parser.c (cp_parser_lookup_name): Adjust lookup_name_real calls.
973 * pt.c (check_explicit_specialization): Adjust
974 lookup_qualified_name call.
975 (deduction_guides_for): Likewise.
976 (tsubst_friend_class): Adjust lookup_name_real call.
977 (lookup_init_capture_pack): Likewise.
978 (tsubst_expr): Likewise, don't look in namespaces.
979 * semantics.c (capture_decltype): Adjust lookup_name_real. Don't
982 2020-08-14 Jason Merrill <jason@redhat.com>
986 * cp-tree.h (unsafe_return_slot_p): Declare.
987 * call.c (is_base_field_ref): Rename to unsafe_return_slot_p.
988 (build_over_call): Check unsafe_return_slot_p.
989 (build_special_member_call): Likewise.
990 * init.c (expand_default_init): Likewise.
991 * typeck2.c (split_nonconstant_init_1): Likewise.
993 2020-08-14 Nathan Sidwell <nathan@acm.org>
995 * cp-tree.h (LOOKUP_PREFER_TYPES, LOOKUP_PREFER_NAMESPACES)
996 (LOOKUP_NAMESPACES_ONLY, LOOKUP_TYPES_ONLY)
997 (LOOKUP_QUALIFIERS_ONL): Delete.
998 (LOOKUP_HIDDEN): Adjust.
999 * name-lookup.h (enum class LOOK_want): New.
1000 (operator|, operator&): Overloads for it.
1001 (lookup_name_real): Replace prefer_type & namespaces_only with
1003 (lookup_qualified_name): Replace prefer_type with LOOK_want.
1004 (lookup_name_prefer_type): Replace with ...
1005 (lookup_name): ... this. New overload with LOOK_want parm.
1006 * name-lookup.c (struct name_lookup): Replace flags with want and
1007 hidden fields. Adjust constructors.
1008 (name_lookyp::add_overload): Correct hidden stripping test. Update
1009 for new LOOK_want type.
1010 (name_lookup::process_binding): Likewise.
1011 (name_lookup::search_unqualified): Use hidden flag.
1012 (identifier_type_value_1): Adjust lookup_name_real call.
1013 (set_decl_namespace): Adjust name_lookup ctor.
1014 (lookup_flags): Delete.
1015 (qualify_lookup): Add LOOK_want parm, adjust.
1016 (lookup_qualified_name): Replace prefer_type parm with LOOK_want.
1017 (lookup_name_real_1): Replace prefer_type and namespaces_only with
1019 (lookup_name_real): Likewise.
1020 (lookup_name_nonclass, lookup_name): Adjust lookup_name_real call.
1021 (lookup_name_prefer_type): Rename to ...
1022 (lookup_name): ... here. New overload with LOOK_want parm.
1023 (lookup_type_scope_1): Adjust qualify_lookup calls.
1024 * call.c (build_operator_new_call)
1025 (add_operator_candidates): Adjust lookup_name_real calls.
1026 * coroutines.cc (find_coro_traits_template_decl)
1027 (find_coro_handle_template_decl, morph_fn_to_coro): Adjust
1028 lookup_qualified_name calls.
1029 * cp-objcp-common.c (identifier_global_tag): Likewise.
1030 * decl.c (get_tuple_size, get_tuple_decomp_init): Likewise.
1031 (lookup_and_check_tag): Use lookup_name overload.
1032 * parser.c (cp_parser_userdef_numeric_literal): Adjust
1033 lookup_qualified_name call.
1034 (prefer_arg_type): Drop template_mem_access parm, return LOOK_want
1036 (cp_parser_lookup_name): Adjust lookup_member, lookup_name_real
1038 * pt.c (check_explicit_specialization): Adjust lookup_qualified_name
1040 (tsubst_copy_and_build, tsubst_qualified_name): Likewise
1041 (deduction_guides_for): Likewise.
1042 (tsubst_friend_class): Adjust lookup_name_real call.
1043 (lookup_init_capture, tsubst_expr): Likewise.
1044 * rtti.c (emit_support_tinfos): Adjust lookup_qualified_name call.
1045 * semantics.c (omp_reduction_lookup): Likewise.
1046 (capture_decltype): Adjust lookup_name_real call.
1048 2020-08-13 Nathan Sidwell <nathan@acm.org>
1050 * name-lookup.h (enum class LOOK_where): New.
1051 (operator|, operator&): Overloads for it.
1052 (lookup_name_real): Replace NONCLASS & BLOCK_P parms with WHERE.
1053 * name-lookup.c (identifier_type_value_w): Adjust
1054 lookup_name_real call.
1055 (lookup_name_real_1): Replace NONCLASS and BLOCK_P parameters
1056 with WHERE bitmask. Don't search namespaces if not asked to.
1057 (lookup_name_real): Adjust lookup_name_real_1 call.
1058 (lookup_name_nonclass, lookup_name)
1059 (lookup_name_prefer_type): Likewise.
1060 * call.c (build_operator_new_call)
1061 (add_operator_candidates): Adjust lookup_name_real calls.
1062 * parser.c (cp_parser_lookup_name): Likewise.
1063 * pt.c (tsubst_friend_class, lookup_init_capture_pack)
1064 (tsubst_expr): Likewise.
1065 * semantics.c (capture_decltype): Likewise.
1067 2020-08-13 Marek Polacek <polacek@redhat.com>
1070 * typeck.c (build_static_cast_1): Implement P1975R0 by allowing
1071 static_cast to aggregate type.
1073 2020-08-10 Jakub Jelinek <jakub@redhat.com>
1076 * constexpr.c (cxx_eval_binary_expression): For SPACESHIP_EXPR, tail
1077 call cxx_eval_constant_expression after genericize_spaceship to avoid
1078 undesirable further VERIFY_CONSTANT.
1080 2020-08-10 Patrick Palka <ppalka@redhat.com>
1082 * pt.c (resolve_overloaded_unification): Drop functions with
1083 unsatisfied constraints.
1084 (resolve_nondeduced_context): Likewise.
1086 2020-08-05 Patrick Palka <ppalka@redhat.com>
1087 Jason Merrill <jason@redhat.com>
1090 * constexpr.c (cxx_eval_vec_init_1): Truncate ctx->ctor and
1091 then clear CONSTRUCTOR_NO_CLEARING on each appended element
1092 initializer if we're initializing a previously zero-initialized
1095 2020-08-04 Marek Polacek <polacek@redhat.com>
1098 * parser.c (cp_parser_elaborated_type_specifier): Allow
1099 'template' following ::.
1101 2020-08-04 Nathan Sidwell <nathan@acm.org>
1103 * parser.c (cp_parser_explicit_specialization): Refactor
1104 to avoid leak of num_template_parameter_lists value.
1106 2020-08-04 Patrick Palka <ppalka@redhat.com>
1109 * init.c (sort_mem_initializers): Preserve TREE_TYPE of the
1110 member initializer list node.
1111 (emit_mem_initializers): Set input_location when performing each
1112 member initialization.
1113 * parser.c (cp_parser_mem_initializer): Attach the source
1114 location of this initializer to a dummy EMPTY_CLASS_EXPR
1115 within the TREE_TYPE of the list node.
1116 * pt.c (tsubst_initializer_list): Preserve TREE_TYPE of the
1117 member initializer list node.
1119 2020-08-03 Marek Polacek <polacek@redhat.com>
1121 * cp-tree.h (after_nsdmi_defaulted_late_checks): Remove.
1123 2020-08-03 Marek Polacek <polacek@redhat.com>
1127 * pt.c (check_default_tmpl_args): Also consider variable
1130 2020-07-31 Jakub Jelinek <jakub@redhat.com>
1133 * decl.c (finish_function): In constexpr functions use for C++14 and
1134 later error instead of warning if no return statement is present and
1135 diagnose it regardless of warn_return_type. Move the warn_return_type
1136 diagnostics earlier in the function.
1138 2020-07-31 Martin Sebor <msebor@redhat.com>
1141 * class.c (build_base_path): Set no-warning bit on the synthesized
1142 conditional expression in static_cast.
1144 2020-07-31 Richard Biener <rguenther@suse.de>
1147 * cp-objcp-common.h (LANG_HOOKS_FINALIZE_EARLY_DEBUG):
1148 Define to c_common_finalize_early_debug.
1150 2020-07-31 Patrick Palka <ppalka@redhat.com>
1153 * constexpr.c (cxx_eval_constant_expression) <case CONST_DECL>:
1154 Pass false to decl_constant_value and decl_really_constant_value
1155 so that they don't unshare their result.
1156 * cp-tree.h (decl_constant_value): New declaration with an added
1158 (decl_really_constant_value): Add bool parameter defaulting to
1159 true to existing declaration.
1160 * init.c (constant_value_1): Add bool parameter which controls
1161 whether to unshare the initializer before returning. Call
1162 unshare_expr at most once.
1163 (scalar_constant_value): Pass true to constant_value_1's new
1165 (decl_really_constant_value): Add bool parameter and forward it
1166 to constant_value_1.
1167 (decl_constant_value): Likewise, but instead define a new
1168 overload with an added bool parameter.
1170 2020-07-30 Patrick Palka <ppalka@redhat.com>
1173 * pt.c (resolve_overloaded_unification): If the function
1174 template specialization has a placeholder return type,
1175 then instantiate it before attempting unification.
1177 2020-07-30 Patrick Palka <ppalka@redhat.com>
1180 * pt.c (alias_ctad_tweaks): Call remove_constraints before
1181 calling set_constraints.
1183 2020-07-30 Patrick Palka <ppalka@redhat.com>
1186 * pt.c (reduce_template_parm_level): Propagate DECL_VIRTUAL_P
1187 from the original TEMPLATE_PARM_DECL to the new lowered one.
1189 2020-07-30 Patrick Palka <ppalka@redhat.com>
1192 * constraint.cc (constraints_satisfied_p): Return true if
1194 * pt.c (do_type_instantiation): Update a paragraph taken from
1195 [temp.explicit] to reflect the latest specification. Don't
1196 instantiate a member with unsatisfied constraints.
1198 2020-07-29 Jason Merrill <jason@redhat.com>
1201 * cp-tree.h (IMPLICIT_RVALUE_P): New.
1202 (enum cp_lvalue_kind_flags): Add clk_implicit_rval.
1203 (implicit_rvalue_p, set_implicit_rvalue_p): New.
1204 * call.c (reference_binding): Check clk_implicit_rval.
1205 (build_over_call): Adjust C++20 implicit move.
1206 * coroutines.cc (finish_co_return_stmt): Simplify implicit move.
1207 * except.c (build_throw): Adjust C++20 implicit move.
1208 * pt.c (tsubst_copy_and_build) [STATIC_CAST_EXPR]: Propagate
1210 * tree.c (lvalue_kind): Set clk_implicit_rval.
1211 * typeck.c (treat_lvalue_as_rvalue_p): Overhaul.
1212 (maybe_warn_pessimizing_move): Adjust.
1213 (check_return_expr): Adjust C++20 implicit move.
1215 2020-07-29 Jason Merrill <jason@redhat.com>
1218 * call.c (build_over_call): Don't call a const ref
1219 overload for implicit move.
1221 2020-07-28 Nathan Sidwell <nathan@acm.org>
1223 * cp-gimplify.c (cp_genericize_r): Set IMPORTED_DECL's context.
1224 * cp-objcp-common.c (cp_pushdecl): Set decl's context.
1225 * decl.c (grokfndecl): Make DECL_CONTEXT setting clearer.
1227 2020-07-28 Nathan Sidwell <nathan@acm.org>
1229 * class.c (fixup_type_variants): Copy TYPE_SIZE and
1231 (finish_struct): Call it.
1233 2020-07-28 Nathan Sidwell <nathan@acm.org>
1235 * ptree.c (cxx_print_decl): Better indentation.
1237 2020-07-28 Jakub Jelinek <jakub@redhat.com>
1238 Mark Wielaard <mark@klomp.org>
1241 * parser.c (cp_lexer_safe_previous_token): Don't call
1242 cp_lexer_previous_token, instead inline it by hand and return NULL
1243 instead of failing assertion if all previous tokens until the first
1245 (cp_parser_error_1): Optimize - only call cp_lexer_safe_previous_token
1246 if token->type is CPP_NAME. Use cp_lexer_safe_previous_token instead
1247 of cp_lexer_previous_token for the missing_token_desc != RT_NONE
1250 2020-07-27 Nathan Sidwell <nathan@acm.org>
1252 * cp-tree.h (enum cp_tree_index): Add CPTI_AS_BASE_IDENTIFIER.
1253 (as_base_identifier): Define.
1254 * decl.c (initialize_predifined_identifiers): Initialize as_base
1256 * class.c (layout_class_type): Name the as-base type. Zap
1257 NSDMI its fields may have.
1259 2020-07-22 Nathan Sidwell <nathan@acm.org>
1261 * class.c (maybe_add_class_template_decl_list): Don't add CONST_DECLs.
1263 2020-07-22 Nathan Sidwell <nathan@acm.org>
1265 * typeck.c (structural_comptypes): [DECLTYPE_TYPE] break
1267 [UNDERLYING_TYPE]: Use an if.
1270 2020-07-22 Nathan Sidwell <nathan@acm.org>
1272 * decl.c (decls_match): Move variables into scopes
1274 (duplicate_decls): Use STRIP_TEMPLATE.
1275 (build_typename_type): Move var decls to their assignments.
1276 (begin_function_body): Likewise.
1277 * decl2.c (get_guard): Likewise.
1278 (mark_used): Use true for truthiness.
1279 * error.c (dump_aggr_type): Hold the decl in a var called
1282 2020-07-22 Nathan Sidwell <nathan@acm.org>
1284 * cp-tree.h (struct tree_lambda_expr): Shrink
1285 default_capture_mode & discriminator.
1287 2020-07-22 Nathan Sidwell <nathan@acm.org>
1289 * mangle.c (decl_is_template_id): Rename to ...
1290 (maybe_template_info): ... here. Return the template info,
1291 rather than use a pointer. Adjust all callers.
1292 (find_substitution): Use template_args_equal, rather than
1295 2020-07-22 Tobias Burnus <tobias@codesourcery.com>
1297 * parser.c (cp_parser_omp_clause_hint): Require nonnegative hint.
1298 (cp_parser_omp_critical): Permit hint(0) clause without named critical.
1299 * pt.c (tsubst_expr): Re-check the latter for templates.
1301 2020-07-21 Sunil K Pandey <skpgkp2@gmail.com>
1304 * decl.c (cp_finish_decl): Call target hook
1305 lower_local_decl_alignment to lower local decl alignment.
1307 2020-07-21 Nathan Sidwell <nathan@acm.org>
1309 * parser.c (cp_lexer_consume_token): Drop PRAGMA_EOL assert.
1310 (cp_parser_skip_to_closing_parenthesis_1): Only pass start token
1311 to pragma skipper if recovering.
1312 (cp_parser_skip_to_pragma_eol): Only purge and change pragma
1313 state when recovering.
1315 2020-07-20 Jason Merrill <jason@redhat.com>
1317 * pt.c (type_dependent_expression_p): A pseudo-dtor can be
1319 * semantics.c (finish_call_expr): Use build_trivial_dtor_call for
1321 (finish_pseudo_destructor_expr): Leave type NULL for dependent arg.
1323 2020-07-20 Jason Merrill <jason@redhat.com>
1325 * mangle.c (write_base_ref): New.
1326 (write_expression): Use it for base field COMPONENT_REFs.
1327 * pt.c (invalid_tparm_referent_p): Canonicalize the type
1328 of array offsets. Allow subobjects.
1330 2020-07-20 Jason Merrill <jason@redhat.com>
1332 * pt.c (collect_ctor_idx_types): Add 'const' when deducing from
1335 2020-07-17 Marek Polacek <polacek@redhat.com>
1338 * decl.c (grokdeclarator): Detect cv-qual decltype(auto).
1339 * pt.c (do_auto_deduction): Likewise.
1341 2020-07-16 Iain Sandoe <iain@sandoe.co.uk>
1348 * coroutines.cc (struct coro_ret_data): Delete.
1349 (coro_maybe_expand_co_return): Delete.
1350 (co_return_expander): Delete.
1351 (expand_co_returns): Delete.
1352 (co_await_find_in_subtree): Remove unused name.
1353 (build_actor_fn): Remove unused parm, remove handling
1354 for co_return expansion.
1355 (register_await_info): Demote duplicate info message to a
1357 (coro_make_frame_entry): Move closer to use site.
1358 (struct susp_frame_data): Add fields for final suspend label
1359 and a flag to indicate await expressions with initializers.
1360 (captures_temporary): Delete.
1361 (register_awaits): Remove unused code, update comments.
1362 (find_any_await): New.
1363 (tmp_target_expr_p): New.
1364 (struct interesting): New.
1365 (find_interesting_subtree): New.
1366 (struct var_nest_node): New.
1367 (flatten_await_stmt): New.
1368 (handle_nested_conditionals): New.
1369 (process_conditional): New.
1370 (replace_statement_captures): Rename to...
1371 (maybe_promote_temps): ... this.
1372 (maybe_promote_captured_temps): Delete.
1373 (analyze_expression_awaits): Check for await expressions with
1374 initializers. Simplify handling for truth-and/or-if.
1375 (expand_one_truth_if): Simplify (map cases that need expansion
1377 (await_statement_walker): Handle CO_RETURN_EXPR. Simplify the
1378 handling for truth-and/or-if expressions.
1379 (register_local_var_uses): Ensure that we create names in the
1380 implementation namespace.
1381 (morph_fn_to_coro): Add final suspend label to suspend frame
1382 callback data and remove it from the build_actor_fn call.
1384 2020-07-16 Marek Polacek <polacek@redhat.com>
1386 * call.c (convert_like): Remove macro and introduce a new
1388 (convert_like_with_context): Likewise.
1389 (convert_like_real): Rename to convert_like.
1390 (convert_like_real_1): Rename to convert_like_internal. Call
1391 convert_like instead of convert_like_real therein.
1392 (perform_direct_initialization_if_possible): Call convert_like
1393 instead of convert_like_real.
1395 2020-07-16 Iain Sandoe <iain@sandoe.co.uk>
1397 * coroutines.cc: Correct some spelling errors
1400 2020-07-15 Nathan Sidwell <nathan@acm.org>
1402 * parser.c (cp_parser_declaration): Avoid copying tokens.
1403 (cp_parser_block_declaration): RAII token pointer.
1405 2020-07-15 Nathan Sidwell <nathan@acm.org>
1407 * parser.c (cp_parser_skip_to_closing_parenthesis_1): Deal with
1408 meeting a deferred pragma.
1409 (cp_parser_skip_to_end_of_statement): Likewise.
1410 (cp_parser_skip_to_end_of_block_or_statement): Likewise.
1411 (cp_parser_skip_to_pragma_eol): We should never meet EOF.
1412 (cp_parser_omp_declare_simd): Likewise.
1413 (cp_parser_omp_declare_reduction, cp_parser_oacc_routine)
1414 (pragma_lex): Likewise.
1416 2020-07-14 Marek Polacek <polacek@redhat.com>
1421 * call.c (convert_like_real_1): Renamed from convert_like_real.
1422 (convert_like_real): New wrapper for convert_like_real_1.
1424 2020-07-14 Nathan Sidwell <nathan@acm.org>
1426 * parser.c (cp_lexer_alloc): Do not deal with PCH here.
1427 (cp_lexer_new_main): Deal with PCH here. Store the tokens directly
1429 (cp_lexer_new_from_tokens): Assert last token isn't purged either.
1430 (cp_lexer_get_preprocessor_token): Change first arg to flags, adjust.
1431 (cp_parser_new): Pass the lexer in, don't create it here.
1432 (cp_parser_translation_unit): Initialize access checks here.
1433 (cp_parser_initial_pragma): First token is provided by caller,
1434 don't deal with PCH stopping here. Adjust error message.
1435 (c_parse_file): Adjust, change error message to avoid C++20 module
1438 2020-07-14 Nathan Sidwell <nathan@acm.org>
1440 * ptree.c (cxx_print_type): Add TYPEOF_TYPE and BASES.
1442 2020-07-14 Nathan Sidwell <nathan@acm.org>
1444 * class.c (build_base_field_1): Cache CLASSTYPE_AS_BASE.
1445 (build_self_reference): Rename value -> decl.
1446 (dump_class_hierarchy_1): Cache CLASSTYPE_AS_BASE.
1448 2020-07-14 Marek Polacek <polacek@redhat.com>
1451 * decl.c (grokdeclarator) <case cdk_function>: Check also
1452 pointers/references/... to functions.
1454 2020-07-14 Nathan Sidwell <nathan@acm.org>
1456 * cp-tree.h: Correct some tree lang flag comments,
1457 reformat some structure definitions. Note some structure
1458 sizes. Clarify some comments.
1459 (yyungetc): Delete. Not been a thing for some time.
1460 * class.c (copy_fndecl_with_name): Comment.
1461 (check_bases_and_members): Unnecessary {}.
1462 (layout_class_type): Comment.
1463 * cp-tree.def (UNBOUND_CLASS_TEMPLATE): Adjust comment.
1464 * decl.c: Fix some formatting & whitespace issues.
1465 (function_requirements_equivalent_p): Note why
1466 substitutions are needed.
1467 * decl2.c (no_linkage_error): Note that heroics about
1468 'typedef struct { ... };' are no longer needed.
1469 * method.c: Whitespace.
1470 * name-lookup.c: Whitespace.
1471 (add_decl_to_level): Reformat a line.
1472 (print_binding_stack): Mark as DEBUG_FUNCTION.
1473 (has_using_namespace_std_directive_p): Delete comment.
1475 * ptree.c: Whitespace.
1476 * rtti.c: Whitespace & comment.
1478 * typeck.c (structural_comptypes): Add comment.
1480 2020-07-13 Nathan Sidwell <nathan@acm.org>
1482 * Make-lang.in (c++.disclean): Likewise.
1484 2020-07-13 Marek Polacek <polacek@redhat.com>
1487 * parser.c (cp_parser_enum_specifier): Commit to tentative parse
1488 after we've seen an opening brace.
1490 2020-07-10 Jason Merrill <jason@redhat.com>
1492 * tree.c (structural_type_p): Allow unions.
1493 * mangle.c (write_expression): Express unions with a designator.
1495 2020-07-10 Jason Merrill <jason@redhat.com>
1497 * pt.c (convert_nontype_argument): Handle REAL_TYPE.
1498 (invalid_nontype_parm_type_p): Allow all structural types.
1499 * tree.c (structural_type_p): Use SCALAR_TYPE_P.
1501 2020-07-10 Jason Merrill <jason@redhat.com>
1506 * class.c (check_field_decls): An array of empty classes is not an
1508 (layout_empty_base_or_field): Handle explicit alignment.
1511 2020-07-09 Julian Brown <julian@codesourcery.com>
1512 Thomas Schwinge <thomas@codesourcery.com>
1515 * semantics.c (finish_omp_clauses): Likewise.
1517 2020-07-09 Patrick Palka <ppalka@redhat.com>
1520 * constexpr.c (potential_constant_expression_1) <case PARM_DECL>:
1521 Restore dependent_type_p check that guarded the call to
1522 is_really_empty_class.
1524 2020-07-08 Patrick Palka <ppalka@redhat.com>
1527 * constexpr.c (potential_constant_expression_1) <case PARM_DECL>:
1528 When processing_template_decl, check COMPLETE_TYPE_P before
1529 calling is_really_empty_class. Don't check dependent_type_p.
1531 2020-07-08 Marek Polacek <polacek@redhat.com>
1534 * parser.c (cp_parser_decltype): Print error about using decltype(auto)
1535 in C++11. Check that the token following "auto" is ")".
1537 2020-07-07 Patrick Palka <ppalka@redhat.com>
1540 * cxx-pretty-print.c (pp_cxx_unqualified_id): Check
1541 PRIMARY_TEMPLATE_P before printing the innermost template
1544 2020-07-07 Martin Sebor <msebor@redhat.com>
1547 * parser.c (class_decl_loc_t::diag_mismatched_tags): Print notes only
1548 if warning_at returns nonzero.
1550 2020-07-06 Martin Sebor <msebor@redhat.com>
1553 * call.c (build_over_call): Check calls only when tf_warning is set.
1555 2020-07-06 Nathan Sidwell <nathan@acm.org>
1557 * decl.c (push_library_fn): Return the decl pushdecl_toplevel returns.
1558 * except.c (verify_library_fn): Replace with ...
1559 (declare_library_fn_1): ... this fn. Always push the fn.
1560 (declare_library_fn): Call it.
1561 (build_throw): Call declare_library_fn_1.
1563 2020-07-06 Jonathan Wakely <jwakely@redhat.com>
1566 * parser.c (cp_parser_toplevel_declaration): Only do pedwarn for
1567 empty-declaration in C++98.
1569 2020-07-02 Jason Merrill <jason@redhat.com>
1570 Jakub Jelinek <jakub@redhat.com>
1572 * decl.c (grokfndecl): Allow consteval virtual.
1573 * search.c (check_final_overrider): Check consteval mismatch.
1574 * constexpr.c (cxx_eval_thunk_call): New.
1575 (cxx_eval_call_expression): Call it.
1576 * cvt.c (cp_get_fndecl_from_callee): Handle FDESC_EXPR.
1577 * decl2.c (mark_vtable_entries): Track vtables with consteval.
1578 (maybe_emit_vtables): Pass consteval_vtables through.
1579 (clear_consteval_vfns): Replace consteval with nullptr.
1580 (c_parse_final_cleanups): Call it.
1582 2020-07-01 Nathan Sidwell <nathan@acm.org>
1584 * class.c (copy_fndecl_with_name): Add additional predicate args, do
1585 not deduce them locally.
1586 (copy_operator_fn): Adjust copy_fndecl_with_name call.
1587 (build_clone): Add vtt and inherited predicate args. Pass through
1588 to copy_fndecl_with_name call.
1589 (build_cdtor_clones): Likewise, pass through to build_clone as
1591 (build_cdtor): Determine vtt and inherited here.
1592 * cp-tree.h (DECL_NEEDS_CTT_PARM_P): Delete.
1594 2020-06-30 Nathan Sidwell <nathan@acm.org>
1596 * cp-tree.h (copy_fndecl_with_name): Rename to ...
1597 (copy_operatorn_fn): ... this. Change arg type.
1598 (clone_function_decl): Rename to ...
1599 (clone_cdtor): ... this.
1600 * class.c (copy_fndecl_with_name): Make static.
1601 (copy_operator_fn): New wrapper.
1602 (build_clones): Rename to ...
1603 (build_cdtor_clones): ... this.
1604 (clone_function_decl): Rename to ...
1605 (clone_cdtor): ... this. Adjust build_clones calls.
1606 (clone_constructors_and_destructors): Adjust clone_function_decl
1608 * method.c (implicitly_declare_fn): Adjust copy_fndecl_with_name
1610 (lazily_declare_fn): Adjust clone_function_decl call.
1611 * pt.c (tsubst_function_decl): Likewise.
1612 (instantiate_template_1): Likewise.
1614 2020-06-30 Iain Sandoe <iain@sandoe.co.uk>
1616 * coroutines.cc (morph_fn_to_coro): Remove trailing
1617 space in a diagnostic.
1619 2020-06-30 Iain Sandoe <iain@sandoe.co.uk>
1621 * coroutines.cc (expand_one_await_expression): Remove
1622 code dealing with initial suspend.
1623 (build_actor_fn): Remove code special-casing initial
1624 and final suspend. Handle the final suspend and marking
1625 of the coroutine as done.
1626 (coro_rewrite_function_body): New.
1627 (bind_expr_find_in_subtree): Remove.
1628 (coro_body_contains_bind_expr_p): Remove.
1629 (morph_fn_to_coro): Split the rewrite of the original
1630 function into coro_rewrite_function_body and call it.
1632 2020-06-29 Marek Polacek <polacek@redhat.com>
1635 * decl.c (duplicate_decls): Make sure a concept or a variable
1636 template is unique in its declarative region.
1638 2020-06-29 Marek Polacek <polacek@redhat.com>
1641 * pt.c (collect_ctor_idx_types): Use TREE_TYPE.
1643 2020-06-28 Iain Sandoe <iain@sandoe.co.uk>
1646 * coroutines.cc (register_local_var_uses): Skip past
1649 2020-06-27 Iain Sandoe <iain@sandoe.co.uk>
1652 * coroutines.cc (get_awaitable_var): New helper.
1653 (build_co_await): Check more carefully before
1654 copying an awaitable.
1655 (expand_one_await_expression): No initializer
1656 is required when the awaitable is not a temp.
1657 (register_awaits): Remove handling that is now
1658 completed when the await expression is built.
1660 2020-06-27 Iain Sandoe <iain@sandoe.co.uk>
1662 * coroutines.cc (morph_fn_to_coro): Diagnose unavailable
1663 get_return_object_on_allocation_failure.
1665 2020-06-26 Iain Sandoe <iain@sandoe.co.uk>
1668 * coroutines.cc (struct coroutine_info):Add a field
1669 to hold computed p.return_void expressions.
1670 (coro_build_promise_expression): New.
1671 (get_coroutine_return_void_expr): New.
1672 (finish_co_yield_expr): Build the promise expression
1673 using coro_build_promise_expression.
1674 (finish_co_return_stmt): Likewise.
1675 (build_init_or_final_await): Likewise.
1676 (morph_fn_to_coro): Likewise, for several cases.
1678 2020-06-26 Iain Sandoe <iain@sandoe.co.uk>
1680 * coroutines.cc (morph_fn_to_coro): Handle error
1681 returns in building g-r-o-o-a-f expressions.
1683 2020-06-24 Nicholas Krause <xerofoify@gmail.com>
1686 * typeck2.c (cxx_incomplete_type_diagnostic): Add missing
1687 TYPE_EXPANSION_PACK check for diagnosing incomplete types in
1688 cxx_incomplete_type_diagnostic.
1690 2020-06-24 Iain Sandoe <iain@sandoe.co.uk>
1694 * coroutines.cc (act_des_fn): Copy function
1695 attributes onto the outlined coroutine helpers.
1697 2020-06-24 Jason Merrill <jason@redhat.com>
1699 * call.c (build_over_call): Only call build_base_path once.
1701 2020-06-24 Jason Merrill <jason@redhat.com>
1704 * call.c (build_over_call): Look up the overrider in base_binfo.
1705 * class.c (lookup_vfn_in_binfo): Look through BINFO_PRIMARY_P.
1707 2020-06-23 Jason Merrill <jason@redhat.com>
1710 Implement C++20 P2082R1, Fixing CTAD for aggregates.
1711 * cp-tree.h (TPARMS_PRIMARY_TEMPLATE): Split out from...
1712 (DECL_PRIMARY_TEMPLATE): ...here.
1713 (builtin_guide_p): Declare.
1714 * decl.c (reshape_init_class): Handle bases of a template.
1715 (reshape_init_r): An array with dependent bound takes a single
1717 * pt.c (tsubst_default_argument): Shortcut {}.
1718 (unify_pack_expansion): Allow omitted arguments to trailing pack.
1719 (builtin_guide_p): New.
1720 (collect_ctor_idx_types): Give a trailing pack a {} default
1721 argument. Handle arrays better.
1723 2020-06-23 Iain Sandoe <iain@sandoe.co.uk>
1726 * coroutines.cc (morph_fn_to_coro): Apply a cleanup to
1727 the get return object when the DTOR is non-trivial.
1729 2020-06-20 Iain Sandoe <iain@sandoe.co.uk>
1732 * coroutines.cc (morph_fn_to_coro): Update handling of
1733 get-return-object-on-allocation-fail and diagnose missing
1736 2020-06-20 Jason Merrill <jason@redhat.com>
1738 * call.c (joust): Only compare constraints for non-template
1739 candidates with matching parameters.
1740 * pt.c (tsubst_pack_expansion): Fix getting a type parameter
1742 (more_specialized_fn): Only compare constraints for candidates with
1743 matching parameters.
1745 2020-06-19 Jason Merrill <jason@redhat.com>
1747 * method.c (early_check_defaulted_comparison): Allow defaulting
1748 comparison outside class. Complain if non-member operator isn't a
1751 2020-06-18 Jason Merrill <jason@redhat.com>
1753 * method.c (early_check_defaulted_comparison): Check for &&.
1754 (build_comparison_op): Allow empty union. Diagnose non-category
1756 (common_comparison_type): Remove handling for non-category type.
1758 2020-06-18 Marek Polacek <polacek@redhat.com>
1761 * pt.c (finish_template_variable): Return if
1762 coerce_innermost_template_parms return error_mark_node.
1764 2020-06-18 Marek Polacek <polacek@redhat.com>
1767 * pt.c (tsubst_copy_and_build) <case NEW_EXPR>: Return error_mark_node
1768 if placement is erroneous.
1770 2020-06-17 Jonathan Wakely <jwakely@redhat.com>
1773 * parser.c (cp_parser_elaborated_type_specifier): Do not warn
1774 unless in a declaration.
1776 2020-06-17 Jason Merrill <jason@redhat.com>
1778 * cp-tree.h (copy_fndecl_with_name): Declare.
1779 * class.c (copy_fndecl_with_name): Split out from...
1780 (build_clone): ...here.
1781 (add_implicitly_declared_members): Add op== to TYPE_FIELDS.
1782 * method.c (implicitly_declare_fn): Use copy_fndecl_with_name.
1784 2020-06-17 Jason Merrill <jason@redhat.com>
1786 * call.c (build_new_op_1): Don't look for a CALL_EXPR when
1787 calling a consteval function.
1789 2020-06-17 Jason Merrill <jason@redhat.com>
1791 * decl2.c (grokfield): Pass SD_DEFAULTED and SD_DELETED.
1792 * decl.c (duplicate_decls): Reduce error for delete
1793 after earlier declaration to pedwarn.
1795 2020-06-17 Marek Polacek <polacek@redhat.com>
1798 * constexpr.c (maybe_fold_non_dependent_expr): New.
1799 * cp-tree.h (maybe_fold_non_dependent_expr): Declare.
1800 * typeck.c (cp_build_array_ref): Call maybe_fold_non_dependent_expr
1801 instead of maybe_constant_value.
1803 2020-06-16 Marek Polacek <polacek@redhat.com>
1806 * call.c (add_list_candidates): Return if a designated initializer
1807 is used with a non-aggregate.
1808 (implicit_conversion_error): Give an error for the case above.
1810 2020-06-16 Marek Polacek <polacek@redhat.com>
1813 * name-lookup.c (check_local_shadow): Check if types are
1814 non-null before calling same_type_p.
1816 2020-06-16 Jakub Jelinek <jakub@redhat.com>
1818 * semantics.c (handle_omp_for_class_iterator): Adjust
1819 c_omp_check_loop_iv_exprs caller.
1820 (finish_omp_for): Likewise. Don't call fold_build_cleanup_point_expr
1821 before calling c_finish_omp_for and c_omp_check_loop_iv, move it
1823 * pt.c (tsubst_omp_for_iterator): Handle non-rectangular loops.
1825 2020-06-16 Jakub Jelinek <jakub@redhat.com>
1827 * parser.c (cp_parser_omp_clause_schedule): Reject modifier separated
1828 from kind by comma rather than colon.
1830 2020-06-16 Patrick Palka <ppalka@redhat.com>
1832 * pt.c (perform_instantiation_time_access_checks): No need to
1834 * semantics.c (enforce_access): Verify that decl is not
1837 2020-06-16 Patrick Palka <ppalka@redhat.com>
1841 * cp-tree.h (qualified_typedef_usage_s): Delete.
1842 (qualified_typedef_usage_t): Delete.
1843 (deferred_access_check): Move up in file.
1844 (tree_template_info::typedefs_needing_access_checking): Delete.
1845 (tree_template_info::deferred_access_checks): New field.
1846 (TI_TYPEDEFS_NEEDING_ACCESS_CHECKING): Rename to ...
1847 (TI_DEFERRED_ACCESS_CHECKS): ... this, and adjust accordingly.
1848 * pt.c (perform_typedefs_access_check): Rename to ...
1849 (perform_instantiation_time_access_checks): ... this, and adjust
1850 accordingly. Remove unnecessary tree tests.
1851 (instantiate_class_template_1): Adjust accordingly.
1852 (instantiate_decl): Likewise.
1853 * semantics.c (enforce_access): Likewise.
1855 2020-06-16 Patrick Palka <ppalka@redhat.com>
1859 * call.c (enforce_access): Move to semantics.c.
1860 * cp-tree.h (enforce_access): Delete.
1861 (get_types_needing_access_check): Delete.
1862 (add_typedef_to_current_template_for_access_check): Delete.
1863 * decl.c (make_typename_type): Adjust accordingly. Use
1864 check_accessibility_of_qualified_id instead of directly using
1865 perform_or_defer_access_check.
1866 * parser.c (cp_parser_template_declaration_after_parameters):
1867 Don't push a dk_no_check access state when parsing a template.
1868 * pt.c (get_types_needing_access_check): Delete.
1869 (append_type_to_template_for_access_check_1): Delete.
1870 (perform_typedefs_access_check): Adjust. If type_decl is a
1871 FIELD_DECL, also check its DECL_CONTEXT for dependence. Use
1872 tsubst_copy instead of tsubst to substitute into type_decl so
1873 that we substitute into the DECL_CONTEXT of a FIELD_DECL.
1874 (append_type_to_template_for_access_check): Delete.
1875 * search.c (accessible_p): Remove the processing_template_decl
1877 * semantics.c (enforce_access): Moved from call.c. If we're
1878 parsing a template and the access check failed, add the check to
1879 TI_TYPEDEFS_NEEDING_ACCESS_CHECKING.
1880 (perform_or_defer_access_check): Adjust comment.
1881 (add_typedef_to_current_template_for_access_check): Delete.
1882 (check_accessibility_of_qualified_id): Adjust accordingly.
1883 Exit early if the scope is dependent.
1885 2020-06-11 Patrick Palka <ppalka@redhat.com>
1888 * constraint.cc (associate_classtype_constraints): If there is a
1889 discrepancy between the current template depth and the template
1890 depth of the original declaration, then adjust the template
1891 parameter depth within the current constraints appropriately.
1892 * pt.c (tsubst_friend_class): Substitute into and set the
1893 constraints on the injected declaration.
1895 2020-06-11 Iain Sandoe <iain@sandoe.co.uk>
1897 * coroutines.cc (instantiate_coro_traits): Pass a reference
1898 to lambda closure objects to traits instantiation.
1899 (morph_fn_to_coro): Likewise for promise parameter
1900 preview and allocator lookup.
1902 2020-06-10 Iain Sandoe <iain@sandoe.co.uk>
1905 * call.c (add_candidates): Use vec_safe_length() for
1906 testing the arguments list.
1907 (build_new_method_call_1): Use vec_safe_is_empty() when
1908 checking for an empty args list.
1910 2020-06-10 Marek Polacek <polacek@redhat.com>
1913 * parser.c (cp_parser_direct_declarator): Clear
1914 CP_PARSER_FLAGS_DELAY_NOEXCEPT if the declarator kind is not
1917 2020-06-09 Iain Sandoe <iain@sandoe.co.uk>
1920 * coroutines.cc (expand_one_await_expression): Build separate
1921 DTOR trees for the awaitable object on the destroy and resume
1924 2020-06-09 Jason Merrill <jason@redhat.com>
1927 * cp-gimplify.c (predeclare_vla): Only predeclare a VLA if it's
1928 wrapped in a pointer type.
1930 2020-06-05 Marek Polacek <polacek@redhat.com>
1933 * call.c (build_converted_constant_expr_internal): Allow
1934 list-initialization.
1936 2020-06-05 Iain Sandoe <iain@sandoe.co.uk>
1938 * cp-tree.def (CO_RETURN_EXPR): Correct the class
1939 to use tcc_statement.
1941 2020-06-05 Jason Merrill <jason@redhat.com>
1943 * error.c (dump_binary_op): Handle negative operand to
1946 2020-06-04 Jason Merrill <jason@redhat.com>
1949 * constexpr.c (cxx_eval_constant_expression) [OBJ_TYPE_REF]:
1950 Evaluate OBJ_TYPE_REF_EXPR.
1952 2020-06-04 Jason Merrill <jason@redhat.com>
1955 * class.c (lookup_vfn_in_binfo): New.
1956 * call.c (build_over_call): Use it.
1957 * cp-tree.h (resolves_to_fixed_type_p): Add default argument.
1958 (lookup_vfn_in_binfo): Declare.
1960 2020-06-04 Iain Sandoe <iain@sandoe.co.uk>
1963 * coroutines.cc (morph_fn_to_coro): Ensure that the get-
1964 return-object is constructed correctly; When it is not the
1965 final return value, pass it to the CTOR of the return type
1966 as an rvalue, per the standard comment.
1968 2020-06-04 Jakub Jelinek <jakub@redhat.com>
1972 * constexpr.c (cxx_eval_constant_expression): Diagnose CONVERT_EXPR
1973 conversions from pointer types to arithmetic types here...
1974 (cxx_eval_outermost_constant_expr): ... instead of here.
1976 2020-06-03 Mark Wielaard <mark@klomp.org>
1978 * parser.c (cp_lexer_safe_previous_token): New function.
1979 (cp_parser_error_1): Add name_hint if the previous token is
1980 a string literal and next token is a CPP_NAME and we have a
1981 missing header suggestion for the name.
1983 2020-06-03 Patrick Palka <ppalka@redhat.com>
1985 * pt.c (process_partial_specialization): Pass the full set of
1986 generic template arguments to strictly_subsumes.
1988 2020-06-03 Patrick Palka <ppalka@redhat.com>
1991 * pt.c (most_specialized_partial_spec): Reorganize the loop over
1992 DECL_TEMPLATE_SPECIALIZATIONS. Check constraints_satisfied_p on
1993 the original template declaration, not on the tsubsted one.
1995 2020-06-03 Iain Sandoe <iain@sandoe.co.uk>
1998 * coroutines.cc (finish_co_await_expr): Revise to allow for
2000 (finish_co_yield_expr): Likewise.
2002 2020-06-03 Jason Merrill <jason@redhat.com>
2005 * cp-tree.h (predeclare_vla): Declare.
2006 * cp-gimplify.c (predeclare_vla): Handle getting a decl.
2007 * pt.c (tsubst_expr) [DECL_EXPR]: Use it.
2009 2020-06-03 Tobias Burnus <tobias@codesourcery.com>
2011 * cp-gimplify.c (cxx_omp_predetermined_mapping): New.
2012 * cp-objcp-common.h (LANG_HOOKS_OMP_PREDETERMINED_MAPPING): Redfine.
2013 * cp-tree.h (cxx_omp_predetermined_mapping): Declare.
2015 2020-06-02 Jason Merrill <jason@redhat.com>
2018 * pt.c (tsubst_decl): Relax assert.
2020 2020-06-02 Iain Sandoe <iain@sandoe.co.uk>
2023 * coroutines.cc (build_co_await): Wrap the co_await expression
2024 in a TARGET_EXPR, where needed.
2025 (finish_co_yield_expr): Likewise.
2027 2020-06-02 Patrick Palka <ppalka@redhat.com>
2031 * pt.c (tsubst_function_decl): Don't do set_constraints when
2032 regenerating a lambda.
2033 (tsubst_lambda_expr): Substitute into the lambda's constraints
2034 and do set_constraints here.
2036 2020-06-01 Jason Merrill <jason@redhat.com>
2041 * class.c (build_vfn_ref): Revert 95311 change.
2042 * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call): Build a
2045 2020-06-01 Iain Sandoe <iain@sandoe.co.uk>
2048 * coroutines.cc (struct param_info): Remove rv_ref field.
2049 (build_actor_fn): Remove specifial rvalue ref handling.
2050 (morph_fn_to_coro): Likewise.
2052 2020-05-31 Iain Sandoe <iain@sandoe.co.uk>
2055 * coroutines.cc (morph_fn_to_coro): If we see an
2056 early fatal error, drop the erroneous function body.
2058 2020-05-31 Iain Sandoe <iain@sandoe.co.uk>
2060 * coroutines.cc (build_co_await): Remove unused
2062 (finish_co_await_expr): Likewise.
2063 (finish_co_yield_expr): Likewise; revise comment.
2065 2020-05-30 Iain Sandoe <iain@sandoe.co.uk>
2067 * coroutines.cc (morph_fn_to_coro): Revise initialization
2068 of the frame pointer to avoid an unused value.
2070 2020-05-30 Patrick Palka <ppalka@redhat.com>
2073 * constraint.cc (satisfaction_value): Accept INTEGER_CST of any
2076 2020-05-29 Patrick Palka <ppalka@redhat.com>
2077 Jason Merrill <jason@redhat.com>
2080 * class.c (add_method): Let special member function templates
2081 coexist if they are not equivalently constrained, or in a class
2084 2020-05-29 Jason Merrill <jason@redhat.com>
2087 * pt.c (process_template_parm): Set DECL_TEMPLATE_INFO
2088 on the DECL_TEMPLATE_RESULT.
2090 2020-05-29 Marek Polacek <polacek@redhat.com>
2093 * cp-gimplify.c (cp_fold) <case MODIFY_EXPR>: Don't set
2094 TREE_THIS_VOLATILE here.
2095 (cp_fold): Set it here along with TREE_NO_WARNING.
2097 2020-05-29 Jason Merrill <jason@redhat.com>
2101 * class.c (build_vfn_ref): Don't fold the INDIRECT_REF.
2103 2020-05-29 Patrick Palka <ppalka@redhat.com>
2108 * parser.c (cp_parser_requires_clause_expression): Temporarily
2109 increment processing_template_decl only if it is 0.
2110 (cp_parser_constraint_expression): Likewise.
2111 (cp_parser_requires_expression): Likewise.
2113 2020-05-29 Patrick Palka <ppalka@redhat.com>
2116 * constexpr.c (get_or_insert_ctor_field): Add limited support
2117 for RANGE_EXPR index lookups.
2119 2020-05-28 Jakub Jelinek <jakub@redhat.com>
2122 * decl.c (cp_finish_decomp): Call complete_type before checking
2125 2020-05-28 Jason Merrill <jason@redhat.com>
2128 * decl.c (cp_finish_decl): Revert r9-297 change.
2129 (check_static_variable_definition): Likewise.
2130 * constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
2131 * pt.c (instantiate_decl): Return early on type error.
2133 2020-05-27 Jason Merrill <jason@redhat.com>
2136 * decl.c (reshape_init_array_1): Don't reuse in overload context.
2138 2020-05-27 Jason Merrill <jason@redhat.com>
2141 * call.c (build_new_op_1): Suppress
2142 warn_zero_as_null_pointer_constant across comparison of <=> result
2145 2020-05-27 Jason Merrill <jason@redhat.com>
2148 * decl.c (grokdeclarator): Don't shift attributes in TYPENAME
2151 2020-05-27 Nathan Sidwell <nathan@acm.org>
2154 * pt.c (lookup_template_class_1): Restore alias template mutation.
2156 2020-05-26 Jakub Jelinek <jakub@redhat.com>
2159 * cp-gimplify.c: Include omp-general.h.
2160 (cp_genericize_r) <case OMP_DISTRIBUTE>: For class iteration
2161 variables in composite distribute parallel for, instantiate copy
2162 ctor of their types.
2164 2020-05-23 Patrick Palka <ppalka@redhat.com>
2167 * constexpr.c (cxx_eval_constant_expression)
2168 <case TEMPLATE_ID_EXPR>: Don't evaluate the concept when
2169 constexpr evaluation is uid-sensitive.
2171 2020-05-22 Jason Merrill <jason@redhat.com>
2173 * cp-gimplify.c (cp_gimplify_expr) [CALL_EXPR]: Don't preevaluate
2174 the function address if the call used operator syntax.
2176 2020-05-21 Jason Merrill <jason@redhat.com>
2179 * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call): For a virtual
2180 call, instrument the OBJ_TYPE_REF.
2182 * decl.c (compute_array_index_type_loc): Diagnose expressions
2183 in a template that can't be constant.
2184 * parser.c (cp_parser_direct_declarator): Don't check
2185 non-constant array bounds here.
2187 * cp-tree.h (is_rvalue_constant_expression): Declare.
2188 * constexpr.c (is_rvalue_constant_expression): New.
2189 * parser.c (cp_parser_constant_expression): Use it.
2190 * decl.c (cp_finish_decl): Try to treat a constexpr initializer in a
2191 template as constant.
2193 * typeck.c (build_x_modify_expr): Handle error_mark_node arguments.
2195 * decl.c (grokparms): Return NULL_TREE if any parms were erroneous.
2197 2020-05-21 Iain Sandoe <iain@sandoe.co.uk>
2199 * coroutines.cc (finish_co_return_stmt): Revert change to use
2202 2020-05-21 Patrick Palka <ppalka@redhat.com>
2205 * constexpr.c (constexpr_ctx::uid_sensitive): Remove field.
2206 (uid_sensitive_constexpr_evaluation_value): Define.
2207 (uid_sensitive_constexpr_evaluation_true_counter): Define.
2208 (uid_sensitive_constexpr_evaluation_p): Define.
2209 (uid_sensitive_constexpr_evaluation_sentinel): Define its
2211 (uid_sensitive_constexpr_evaluation_checker): Define its
2212 constructor and its evaluation_restricted_p method.
2213 (get_fundef_copy): Remove 'ctx' parameter. Use u_s_c_e_p
2214 instead of constexpr_ctx::uid_sensitive.
2215 (cxx_eval_call_expression): Use u_s_c_e_p instead, and test it
2216 last. Adjust call to get_fundef_copy.
2217 (instantiate_cx_fn_r): Test u_s_c_e_p so that we increment the
2218 counter if necessary.
2219 (cxx_eval_outermost_constant_expr): Remove 'uid_sensitive'
2220 parameter. Adjust function body accordingly.
2221 (maybe_constant_value): Remove 'uid_sensitive' parameter and
2222 adjust function body accordingly. Set up a
2223 uid_sensitive_constexpr_evaluation_checker, and use it to
2224 conditionally update the cv_cache.
2225 * cp-gimplify.c (cp_fold): Set up a
2226 uid_sensitive_constexpr_evaluation_checker, and use it to
2227 conditionally update the fold_cache.
2228 * cp-tree.h (maybe_constant_value): Update declaration.
2229 (struct uid_sensitive_constexpr_evaluation_sentinel): Define.
2230 (struct sensitive_constexpr_evaluation_checker): Define.
2231 * expr.c (fold_for_warn): Set up a
2232 uid_sensitive_constexpr_evaluation_sentinel before calling
2233 the folding subroutines. Drop all but the first argument to
2234 maybe_constant_value.
2236 2020-05-20 Marek Polacek <polacek@redhat.com>
2239 * parser.c (cp_parser_unqualified_id): Reject simple-template-id as
2240 the declarator-id of a destructor.
2241 (cp_parser_constructor_declarator_p): Reject simple-template-id as
2242 the declarator-id of a constructor.
2244 2020-05-20 Marek Polacek <polacek@redhat.com>
2248 * cp-tree.h (SD_DECOMPOSITION): New flag.
2249 * decl.c (duplicate_decls): Make sure a structured binding is unique
2250 in its declarative region.
2251 (start_decl): If INITIALIZED is SD_DECOMPOSITION, call
2252 fit_decomposition_lang_decl.
2253 (grokdeclarator): Compare INITIALIZED directly to SD_* flags.
2254 * parser.c (cp_parser_decomposition_declaration): Pass SD_DECOMPOSITION
2257 2020-05-20 Patrick Palka <ppalka@redhat.com>
2260 * typeck.c (structural_comptypes): Don't perform
2261 context-dependent resolution of TYPENAME_TYPEs when
2262 comparing_specializations.
2264 2020-05-19 Nathan Sidwell <nathan@acm.org>
2266 * pt.c (lookup_template_class_1): Do not reinit template_info of an
2269 2020-05-18 Martin Sebor <msebor@redhat.com>
2272 * call.c ((maybe_warn_class_memaccess): Use is_byte_access_type.
2273 * cp-tree.h (is_dummy_object): Return bool.
2274 (is_byte_access_type): Declare new function.
2275 * tree.c (is_dummy_object): Return bool.
2276 (is_byte_access_type): Define new function.
2278 2020-05-19 Patrick Palka <ppalka@redhat.com>
2281 * pt.c (init_template_processing): Enable sanitization for
2282 decl_specializations and type_specializations.
2285 * pt.c (fn_type_unification): Pass 'fn' instead of NULL_TREE as
2286 the 'in_decl' parameter to coerce_template_parms.
2288 2020-05-18 Marek Polacek <polacek@redhat.com>
2291 * typeck.c (cp_build_binary_op): Use fold_for_warn instead of
2294 2020-05-18 Marek Polacek <polacek@redhat.com>
2297 * cvt.c (cp_get_fndecl_from_callee): Return NULL_TREE if the function
2298 type is not INDIRECT_TYPE_P.
2299 * decl.c (omp_declare_variant_finalize_one): Call
2300 cp_get_callee_fndecl_nofold instead of looking for the function decl
2303 2020-05-18 Marek Polacek <polacek@redhat.com>
2306 * parser.c (cp_parser_has_attribute_expression): Sorry on a
2307 type-dependent argument.
2309 2020-05-18 Marek Polacek <polacek@redhat.com>
2313 * call.c (add_builtin_candidate) <case EQ_EXPR>: Create candidate
2314 operator functions when type is std::nullptr_t for ==/!=.
2315 * typeck.c (composite_pointer_type_r): Add a bool * parameter. Use it
2316 to maybe add "const" to the pointer type.
2317 (composite_pointer_type): Update the call to composite_pointer_type_r.
2318 (cp_build_binary_op): Turn two warning_at into error_at. Print the
2321 2020-05-18 Jason Merrill <jason@redhat.com>
2323 * call.c (build_over_call): Remove unnecessary
2324 cp_stabilize_reference.
2326 2020-05-18 Marek Polacek <polacek@redhat.com>
2328 * call.c (add_builtin_candidate): Don't create a builtin overload
2329 candidate for ++ when type is bool in C++17.
2331 2020-05-18 Marek Polacek <polacek@redhat.com>
2333 * cfns.h: Regenerated.
2335 2020-05-17 Iain Sandoe <iain@sandoe.co.uk>
2337 * coroutines.cc (morph_fn_to_coro): Initialize the gro variable.
2339 2020-05-16 Iain Sandoe <iain@sandoe.co.uk>
2341 * coroutines.cc (finish_co_return_stmt): Implement rules
2342 from [class.copy.elision] /3.
2344 2020-05-16 Patrick Palka <ppalka@redhat.com>
2347 * semantics.c (finish_decltype_type): Call
2348 instantiate_non_dependent_expr_sfinae on the expression.
2350 2020-05-15 Patrick Palka <ppalka@redhat.com>
2354 2020-04-07 Patrick Palka <ppalka@redhat.com>
2357 * typeck2.c (process_init_constructor_array): Propagate
2358 CONSTRUCTOR_PLACEHOLDER_BOUNDARY up from each element initializer to
2359 the array initializer.
2361 2020-05-15 Jason Merrill <jason@redhat.com>
2363 PR c++/93286 - ICE with __is_constructible and variadic template.
2364 * pt.c (tsubst_tree_list): New.
2365 (tsubst, tsubst_copy_and_build): Use it.
2366 * decl2.c (is_late_template_attribute): Handle error_mark_node args.
2368 2020-05-15 Nathan Sidwell <nathan@acm.org>
2370 * pt.c (template_args_equal): Fix thinkos in previous 'cleanup'.
2372 2020-05-14 Jason Merrill <jason@redhat.com>
2375 * pt.c (maybe_instantiate_noexcept): Change clone handling.
2377 2020-05-14 Patrick Palka <ppalka@redhat.com>
2380 * call.c (build_op_call): Pass complain to lookup_fnfields.
2381 (build_special_member_call): Likewise.
2382 * class.c (type_requires_array_cookie): Pass tf_warning_or_error
2384 * cp-tree.h (lookup_fnfields): Add tsubst_flags_t parameter.
2385 * except.c (build_throw): Pass tf_warning_or_error to
2387 * init.c (build_new_1): Pass complain to lookup_fnfields.
2388 * method.c (locate_fn_flags): Likewise.
2389 * name-lookup.c (lookup_name_real_1): Pass tf_warning_or_error
2391 * pt.c (tsubst_baselink): Pass complain to lookup_fnfields.
2392 * search.c (lookup_fnfields): New 'complain' parameter. Pass it
2395 2020-05-14 Nathan Sidwell <nathan@acm.org>
2397 * parser.c (cp_parser_diagnose_invalid_typename): Mention
2398 std=c++20 not 2a, reformat dependent binfo inform loops.
2400 * pt.c (tsubst_template_decl): Reorder and commonize some control
2403 * pt.c (tsubst_friend_function): Simplify control flow.
2405 * pt.c (lookup_template_class_1): Remove unnecessary else by
2406 simply grabbing TYPE_NAME earlier.
2408 * pt.c (push_template_decl_real): Adjust friend pushing logic.
2409 Reinit template type.
2411 * pt.c (build_template_decl): Init DECL_TEMPLATE_RESULT &
2413 (process_partial_specialization): ... not here ...
2414 (push_template_decl_real, add_inherited_template_parms)
2415 (build_deduction_guide): ... or here.
2417 2020-05-14 Jakub Jelinek <jakub@redhat.com>
2419 * cp-gimplify.c (cp_genericize_r): Set cfun->has_omp_target.
2421 2020-05-13 Patrick Palka <ppalka@redhat.com>
2424 * init.c (build_vec_delete_1): Just return error_mark_node if
2425 deallocate_expr is error_mark_node.
2426 (build_delete): Just return error_mark_node if do_delete is
2429 2020-05-13 Patrick Palka <ppalka@redhat.com>
2432 * constraint.cc (tsubst_requires_expr): Produce a new
2433 requires-expression when processing_template_decl, even if
2434 template arguments are not dependent.
2436 2020-05-13 Marek Polacek <polacek@redhat.com>
2439 * decl.c (duplicate_decls): Set DECL_HAS_DEPENDENT_EXPLICIT_SPEC_P.
2441 2020-05-13 Nathan Sidwell <nathan@acm.org>
2443 * pt.c (template_args_equal): Reorder category checking for
2446 * pt.c (perform_typedefs_access_check): Cache expensively
2447 calculated object references.
2448 (check_auto_in_tmpl_args): Just assert we do not get unexpected
2449 nodes, rather than silently do nothing.
2450 (append_type_to_template_for_access): Likewise, cache expensie
2453 * pt.c (canonical_type_parameter): Simplify.
2455 Formatting fixups & some simplifications.
2456 * pt.c (spec_hash_table): New typedef.
2457 (decl_specializations, type_specializations): Use it.
2458 (retrieve_specialization): Likewise.
2459 (register_specialization): Remove unnecessary casts.
2460 (push_template_decl_real): Reformat.
2461 (instantiate_class_template_1): Use more RAII.
2462 (make_argument_pack): Simplify.
2463 (instantiate_template_1): Use gcc_checking_assert for expensive
2465 (instantiate_decl): Likewise.
2466 (resolve_typename_type): Reformat comment.
2467 * semantics.c (struct deferred_access): Remove unnecessary GTY on
2469 (begin_class_definition): Fix formatting.
2471 2020-05-13 Jason Merrill <jason@redhat.com>
2473 * call.c, class.c, constexpr.c, constraint.cc, decl.c, init.c,
2474 lambda.c, lex.c, method.c, name-lookup.c, parser.c, pt.c, tree.c,
2475 typeck2.c: Change cxx2a to cxx20.
2477 2020-05-12 Marek Polacek <polacek@redhat.com>
2480 * parser.c (cp_parser_postfix_expression) <case CPP_OPEN_PAREN>: When
2481 looking for a block-scope function declaration, look through the whole
2482 set, not just the first function in the overload set.
2484 2020-05-12 Jakub Jelinek <jakub@redhat.com>
2487 * pt.c (tsubst_decl): Deal with DECL_OMP_PRIVATIZED_MEMBER for
2490 2020-05-11 Jason Merrill <jason@redhat.com>
2492 Resolve C++20 NB comment CA104
2493 * pt.c (determine_specialization): Compare constraints for
2494 specialization of member template of class instantiation.
2496 2020-05-11 Jason Merrill <jason@redhat.com>
2500 * tree.c (cp_walk_subtrees): Stop at typedefs.
2501 Handle TYPENAME_TYPE here.
2502 * pt.c (find_parameter_packs_r): Not here.
2503 (for_each_template_parm_r): Clear *walk_subtrees.
2504 * decl2.c (min_vis_r): Look through typedefs.
2506 2020-05-11 Jason Merrill <jason@redhat.com>
2508 * call.c (implicit_conversion_error): Split out from...
2509 (perform_implicit_conversion_flags): ...here.
2510 (build_converted_constant_expr_internal): Use it.
2512 2020-05-11 Jason Merrill <jason@redhat.com>
2515 * parser.c (inject_parm_decls): Set current_class_ptr here.
2516 (cp_parser_direct_declarator): And here.
2517 (cp_parser_late_return_type_opt): Not here.
2518 (cp_parser_noexcept_specification_opt): Nor here.
2519 (cp_parser_exception_specification_opt)
2520 (cp_parser_late_noexcept_specifier): Remove unneeded parameters.
2522 2020-05-11 Jason Merrill <jason@redhat.com>
2524 * decl.c (cxx_init_decl_processing): Call declare_weak for
2527 2020-05-11 Jason Merrill <jason@redhat.com>
2529 * pt.c (instantiate_class_template_1): Call tsubst_expr for
2530 STATIC_ASSERT member.
2531 * ptree.c (cxx_print_xnode): Handle STATIC_ASSERT.
2533 2020-05-11 Jason Merrill <jason@redhat.com>
2535 * pt.c (find_parameter_packs_r) [LAMBDA_EXPR]: Remove redundant
2536 walking of capture list.
2538 2020-05-11 Jason Merrill <jason@redhat.com>
2540 * cp-tree.h (LOOKUP_EXPLICIT_TMPL_ARGS): Remove.
2541 * call.c (build_new_function_call): Don't set it.
2542 (build_new_method_call_1): Likewise.
2543 (build_over_call): Check cand->explicit_targs instead.
2545 2020-05-11 Jason Merrill <jason@redhat.com>
2547 * decl.c (compute_array_index_type_loc): Stabilize before building
2550 2020-05-11 Jason Merrill <jason@redhat.com>
2552 * decl.c (grokdeclarator): Adjust deprecated_state here.
2553 (start_decl): Not here.
2555 2020-05-08 Iain Sandoe <iain@sandoe.co.uk>
2558 * coroutines.cc (build_actor_fn): Ensure that bind scopes
2559 are marked as having side-effects where necessary.
2560 (replace_statement_captures): Likewise.
2561 (morph_fn_to_coro): Likewise.
2563 2020-05-08 Nathan Sidwell <nathan@acm.org>
2565 * NEWS: Delete, it is so stale.
2567 * parser.c (cp_lexer_set_source_position_from_token): EOF has a
2570 2020-05-07 Iain Sandoe <iain@sandoe.co.uk>
2574 * coroutines.cc (morph_fn_to_coro): Set unformed outline
2575 functions to error_mark_node. For early error returns suppress
2576 warnings about missing ramp return values. Fix reinstatement
2577 of the function body on pre-existing initial error.
2578 * decl.c (finish_function): Use the normal error path for fails
2579 in the ramp function, do not try to compile the helpers if the
2582 2020-05-07 Marek Polacek <polacek@redhat.com>
2584 PR c++/94590 - Detect long double -> double narrowing.
2585 * typeck2.c (check_narrowing): Detect long double -> double
2586 narrowing even when double and long double have the same
2587 precision. Make it handle conversions to float too.
2589 2020-05-07 Marek Polacek <polacek@redhat.com>
2592 * parser.c (cp_parser_class_specifier_1): Check that the scope is
2593 nested inside current scope before pushing it.
2595 2020-05-07 Marek Polacek <polacek@redhat.com>
2598 * typeck2.c (check_narrowing): Consider T* to bool narrowing
2601 2020-05-07 Marek Polacek <polacek@redhat.com>
2603 * decl.c (grok_op_properties): Fix spelling of non-static.
2604 * typeck.c (build_class_member_access_expr): Likewise.
2606 2020-05-07 Richard Biener <rguenther@suse.de>
2609 * optimize.c (update_cloned_parm): Copy DECL_NOT_GIMPLE_REG_P.
2611 2020-05-06 Marek Polacek <polacek@redhat.com>
2614 * pt.c (tsubst_copy_and_build): Call type_dependent_expression_p_push
2615 instead of uses_template_parms. Move the warning_sentinels after the
2618 2020-05-06 Jakub Jelinek <jakub@redhat.com>
2621 * typeck.c (cp_strict_aliasing_warning): New function.
2622 (cp_build_indirect_ref_1, build_reinterpret_cast_1): Use
2623 it instead of strict_aliasing_warning.
2626 * method.c (defaulted_late_check): Don't call synthesize_method
2627 on constexpr sfk_comparison if it has been called on it already.
2629 2020-05-06 Nathan Sidwell <nathan@acm.org>
2632 * decl.c (grokdeclarator): Don't splice template attributes in
2633 parm context -- they can apply to the parm.
2635 2020-05-05 Iain Sandoe <iain@sandoe.co.uk>
2637 * coroutines.cc: Remove references to n4849 throughout.
2639 2020-05-05 Jason Merrill <jason@redhat.com>
2642 * pt.c (more_specialized_fn): Do consider parms with no deducible
2643 template parameters.
2645 2020-05-05 Jason Merrill <jason@redhat.com>
2648 * constexpr.c (potential_constant_expression_1): In a lambda
2649 function, consider a captured variable directly.
2651 2020-05-05 Iain Sandoe <iain@sandoe.co.uk>
2653 * coroutines.cc (transform_await_wrapper): Check that we have
2654 no unlowered co_yields.
2655 (captures_temporary): Likewise.
2656 (register_awaits): Likewise.
2658 2020-05-05 Nathan Sidwell <nathan@acm.org>
2661 * coroutines.cc (morph_fn_to_coro): Just check for
2663 * pt.c (tsubst_function_decl): Update lambda fn's this_ptr name.
2665 2020-05-05 Marek Polacek <polacek@redhat.com>
2666 Jason Merrill <jason@redhat.com>
2669 * parser.c (cp_parser_postfix_dot_deref_expression): If we have
2670 a type-dependent object of class type, stash it to
2671 parser->context->object_type. If the postfix expression doesn't have
2673 (cp_parser_class_name): Consider object scope too.
2674 (cp_parser_lookup_name): Remove code dealing with the case when
2675 object_type is unknown_type_node.
2677 2020-05-04 Patrick Palka <ppalka@redhat.com>
2680 * cp-gimplify.c (cp_fold) <case CALL_EXPR>: Move some variable
2681 declarations closer to their uses. Copy the CALL_EXPR only
2682 when one of its arguments has changed.
2683 <case TREE_VEC>: Instead of first collecting the folded
2684 arguments into a releasing_vec, just make a copy of the TREE_VEC
2685 as soon as folding changes one of its arguments.
2687 2020-05-04 Iain Sandoe <iain@sandoe.co.uk>
2689 * coroutines.cc (morph_fn_to_coro): Mark the coro.gro variable
2690 as artificial and ignored.
2692 2020-05-04 Nathan Sidwell <nathan@acm.org>
2694 pt.c (process_template_parm): Don't walk the template list twice,
2695 remember the final node instead.
2696 (end_template_parm_list): Refactor. Comment on why we do a pop
2699 PR c++/94827 -- don't save parms in nested requirement
2700 * constraint.cc (tsubst_nested_requirement): TYPE directly holds
2701 notmalized requirement.
2702 (finish_nested_requirement): Don't stash current tpl parms into
2704 (diagnose_nested_requirement): TYPE directly holds notmalized
2707 2020-05-01 Patrick Palka <ppalka@redhat.com>
2710 * cp-tree.h (check_accessibility_of_qualified_id): Add
2711 tsubst_flags_t parameter and change return type to bool.
2712 * parser.c (cp_parser_lookup_name): Pass tf_warning_to_error to
2713 check_accessibility_of_qualified_id.
2714 * pt.c (tsubst_qualified_id): Return error_mark_node if
2715 check_accessibility_of_qualified_id returns false.
2716 * semantics.c (check_accessibility_of_qualified_id): Add
2717 complain parameter. Pass complain instead of
2718 tf_warning_or_error to perform_or_defer_access_check. Return
2719 true unless perform_or_defer_access_check returns false.
2721 2020-05-01 Marek Polacek <polacek@redhat.com>
2724 * typeck2.c (process_init_constructor_record): Return PICFLAG_ERRONEOUS
2725 if an initializer element was erroneous.
2727 2020-05-01 Jason Merrill <jason@redhat.com>
2730 * init.c (get_nsdmi): Don't push_to_top_level for a local class.
2732 2020-05-01 Jason Merrill <jason@redhat.com>
2735 * decl.c (cp_finish_decl): Also clear TREE_READONLY if
2736 -fmerge-all-constants.
2738 2020-05-01 Jason Merrill <jason@redhat.com>
2741 * pt.c (tsubst_decl): Make sure DECL_VALUE_EXPR continues to have
2742 the same type as the variable.
2744 2020-04-30 Jason Merrill <jason@redhat.com>
2745 Nathan Sidwell <nathan@acm.org>
2748 * constraint.cc (map_arguments): If ARGS is null, it's a
2749 self-mapping of parms.
2750 (finish_nested_requirement): Do not pass argified
2751 current_template_parms to normalization.
2752 (tsubst_nested_requirement): Don't assert no template parms.
2754 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
2757 * coroutines.cc (transform_local_var_uses): Defer walking
2758 the DECL_INITIALs of BIND_EXPR vars until all the frame
2759 allocations have been made.
2761 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
2764 * coroutines.cc (register_awaits): Update target
2765 expressions for awaitable and suspend handle
2768 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
2771 * coroutines.cc (build_co_await): Account for variables
2772 with DECL_VALUE_EXPRs.
2773 (captures_temporary): Likewise.
2774 (register_awaits): Likewise.
2776 2020-04-29 Patrick Palka <ppalka@redhat.com>
2779 * pt.c (find_template_parameter_info::parm_list): New field.
2780 (keep_template_parm): Use the new field to build up the
2781 parameter list here instead of ...
2782 (find_template_parameters): ... here. Return ftpi.parm_list.
2784 2020-04-29 Jakub Jelinek <jakub@redhat.com>
2787 * class.c (build_base_field): Set DECL_FIELD_ABI_IGNORED on C++17 empty
2788 base artificial FIELD_DECLs.
2789 (layout_class_type): Set DECL_FIELD_ABI_IGNORED on empty class
2790 field_poverlapping_p FIELD_DECLs.
2792 2020-04-29 Patrick Palka <ppalka@redhat.com>
2795 * constraint.cc (satisfy_declaration_constraints): Use saved_t
2796 instead of t as the key to decl_satisfied_cache.
2799 * error.c (print_requires_expression_info): Print the dependent
2800 form of the parameter list with its template parameter mapping,
2801 rather than printing the substituted form.
2803 2020-04-28 Jason Merrill <jason@redhat.com>
2806 * decl.c (use_eh_spec_block): Check nothrow type after
2808 * pt.c (maybe_instantiate_noexcept): Call synthesize_method for
2809 DECL_MAYBE_DELETED fns here.
2810 * decl2.c (mark_used): Not here.
2811 * method.c (get_defaulted_eh_spec): Reject DECL_MAYBE_DELETED here.
2813 2020-04-28 Iain Sandoe <iain@sandoe.co.uk>
2816 * coroutines.cc (instantiate_coro_traits): Pass a reference to
2817 object type rather than a pointer type for 'this', for method
2819 (struct param_info): Add a field to hold that the parm is a lambda
2821 (morph_fn_to_coro): Check for lambda closure pointers in the
2822 args. Use a reference to *this when building the args list for the
2823 promise allocator lookup.
2825 2020-04-28 Iain Sandoe <iain@sandoe.co.uk>
2828 * coroutines.cc (coro_promise_type_found_p): Do not
2829 exclude non-classes here (this needs to be handled in the
2831 (morph_fn_to_coro): Allow for the case where the coroutine
2834 2020-04-27 Iain Sandoe <iain@sandoe.co.uk>
2837 * coroutines.cc (struct local_var_info): Add fields for static
2838 variables and those with DECL_VALUE_EXPR redirection.
2839 (transform_local_var_uses): Skip past typedefs and static vars
2840 and then account for redirected variables.
2841 (register_local_var_uses): Likewise.
2843 2020-04-27 Jason Merrill <jason@redhat.com>
2847 * decl.c (grokdeclarator): Move dependent attribute to decl.
2848 * decl2.c (splice_template_attributes): No longer static.
2850 2020-04-27 Patrick Palka <ppalka@redhat.com>
2853 * constexpr.c (cxx_eval_call_expression): Don't set new_obj if we're
2854 evaluating the target constructor of a delegating constructor.
2855 (cxx_eval_store_expression): Don't set TREE_READONLY if the LHS of the
2856 INIT_EXPR is '*this'.
2858 2020-04-26 Marek Polacek <polacek@redhat.com>
2861 * call.c (struct conversion): Add copy_init_p.
2862 (standard_conversion): Set copy_init_p in ck_base and ck_rvalue
2863 if FLAGS demands LOOKUP_ONLYCONVERTING.
2864 (convert_like_real) <case ck_base>: If copy_init_p is set, or
2865 LOOKUP_ONLYCONVERTING into FLAGS.
2867 2020-04-26 Iain Sandoe <iain@sandoe.co.uk>
2870 * coroutines.cc (morph_fn_to_coro): Ensure that
2871 unnamed function params have a usable and distinct
2874 2020-04-24 Jason Merrill <jason@redhat.com>
2877 * decl.c (redeclaration_error_message): Reject defaulted comparison
2878 operator that has been previously declared.
2880 2020-04-25 Patrick Palka <ppalka@redhat.com>
2882 * parser.c (cp_parser_diagnose_invalid_type_name): Suggest enabling
2883 concepts if the invalid identifier is 'requires'.
2885 2020-04-25 Jakub Jelinek <jakub@redhat.com>
2888 * semantics.c (finish_call_expr): When looking if all overloads
2889 are noreturn, use STRIP_TEMPLATE to look through TEMPLATE_DECLs.
2891 2020-04-24 Martin Liska <mliska@suse.cz>
2893 * coroutines.cc: Fix compilation error for release checking
2894 where we miss declaration of ‘coro_body_contains_bind_expr_p’.
2896 2020-04-23 Patrick Palka <ppalka@redhat.com>
2898 * tree.c (zero_init_expr_p): Use uses_template_parms instead of
2902 * pt.c (template_class_depth): Walk into the DECL_FRIEND_CONTEXT of a
2903 friend declaration rather than into its CP_DECL_CONTEXT.
2905 2020-04-23 Iain Sandoe <iain@sandoe.co.uk>
2908 * coroutines.cc (await_statement_expander): Simplify cases.
2909 (struct susp_frame_data): Add fields for truth and/or if
2910 cases, rename one field.
2911 (analyze_expression_awaits): New.
2912 (expand_one_truth_if): New.
2913 (add_var_to_bind): New helper.
2914 (coro_build_add_if_not_cond_break): New helper.
2915 (await_statement_walker): Handle conditional expressions,
2916 handle expansion of truth-and/or-if cases.
2917 (bind_expr_find_in_subtree): New, checking-only.
2918 (coro_body_contains_bind_expr_p): New, checking-only.
2919 (morph_fn_to_coro): Ensure that we have a top level bind
2922 2020-04-22 Jonathan Wakely <jwakely@redhat.com>
2924 PR translation/94698
2925 * class.c (check_field_decls): Change "define" to "declare" in
2926 -Weffc++ diagnostics.
2928 2020-04-22 Patrick Palka <ppalka@redhat.com>
2932 * constraint.cc (satisfy_declaration_constraints): If the inherited
2933 constructor points to an instantiation of a constructor template,
2934 remember and use its attached template arguments.
2936 2020-04-22 Jonathan Wakely <jwakely@redhat.com>
2938 PR translation/94698
2939 * class.c (check_field_decls): Change "override" to "define" in
2940 -Weffc++ diagnostics.
2942 2020-04-22 Iain Sandoe <iain@sandoe.co.uk>
2945 * coroutines.cc (struct param_info): Add a field to note that
2946 the param is 'this'.
2947 (morph_fn_to_coro): Convert this to a reference before using it
2948 in the promise parameter preview.
2950 2020-04-22 Jason Merrill <jason@redhat.com>
2953 * pt.c (register_parameter_specializations): If the instantiation is
2954 still a parameter pack, don't wrap it in a NONTYPE_ARGUMENT_PACK.
2955 (tsubst_pack_expansion, tsubst_expr): Adjust.
2957 2020-04-22 Martin Sebor <msebor@redhat.com>
2958 Jason Merrill <jason@redhat.com>
2961 * decl.c (reshape_init_array_1): Avoid stripping redundant trailing
2962 zero initializers...
2963 * mangle.c (write_expression): ...and handle them here even for
2964 pointers to members by calling zero_init_expr_p.
2965 * cp-tree.h (zero_init_expr_p): Declare.
2966 * tree.c (zero_init_expr_p): Define.
2967 (type_initializer_zero_p): Remove.
2968 * pt.c (tparm_obj_values): New hash_map.
2969 (get_template_parm_object): Store to it.
2970 (tparm_object_argument): New.
2972 2020-04-22 Patrick Palka <ppalka@redhat.com>
2975 * constraint.cc (diagnose_valid_expression): Check convert_to_void here
2976 as well as in tsubst_valid_expression_requirement.
2978 2020-04-21 Patrick Palka <ppalka@redhat.com>
2981 * constraint.cc (satisfy_declaration_constraints): Don't strip the
2982 inherited constructor if it already has template information.
2985 * pt.c (any_template_parm_r) <case IDENTIFIER_NODE>: New case. If this
2986 is a conversion operator, visit its TREE_TYPE.
2988 2020-04-21 Nathan Sidwell <nathan@acm.org>
2990 * pt.c (tsubst_copy_and_build) [POINTER_PLUS_EXPR]: Check for
2993 2020-04-21 Iain Sandoe <iain@sandoe.co.uk>
2996 * coroutines.cc (morph_fn_to_coro): Simplify return
2999 2020-04-17 Marek Polacek <polacek@redhat.com>
3002 * constexpr.c (cxx_eval_outermost_constant_expr): Return when T is
3003 a BRACE_ENCLOSED_INITIALIZER_P.
3004 (is_nondependent_constant_expression): Don't check
3005 BRACE_ENCLOSED_INITIALIZER_P.
3006 (is_nondependent_static_init_expression): Likewise.
3008 2020-04-20 Patrick Palka <ppalka@redhat.com>
3011 * cp-tree.h (lss_policy::lss_nop): New enumerator.
3012 * pt.c (local_specialization_stack::local_specialization_stack): Handle
3014 (local_specialization_stack::~local_specialization_stack): Likewise.
3015 (tsubst_pack_expansion): Use a local_specialization_stack instead of
3016 manually saving and restoring local_specializations. Conditionally
3017 replace local_specializations sooner, before the handling of the
3018 unsubstituted_packs case.
3020 2020-04-20 Marek Polacek <polacek@redhat.com>
3022 PR c++/94505 - bogus -Wparentheses warning with fold-expression.
3023 * pt.c (fold_expression): Add warning_sentinel for -Wparentheses
3024 before calling build_x_binary_op.
3026 2020-04-20 Marek Polacek <polacek@redhat.com>
3028 * coroutines.cc (captures_temporary): Don't assign the result of
3029 STRIP_NOPS to the same variable.
3031 2020-04-20 Nathan Sidwell <nathan@acm.org>
3033 PR c++/94454 - tpl-tpl-parms are not canonicalizable types
3034 * pt.c (canonical_type_parameter): Assert not a tpl-tpl-parm.
3035 (process_template_parm): tpl-tpl-parms are structural.
3036 (rewrite_template_parm): Propagate structuralness.
3038 PR c++/94454 - Expr pack expansion equality
3039 * tree.c (cp_tree_equal) [TEMPLATE_ID_EXPR, default]: Refactor.
3040 [EXPR_PACK_EXPANSION]: Add.
3042 PR c++/94454 Template Argument Hashing
3043 * pt.c (iterative_hash_template_arg): Strip nodes as
3044 template_args_equal does.
3045 [ARGUMENT_PACK_SELECT, TREE_VEC, CONSTRUCTOR]: Refactor.
3046 [node_class:TEMPLATE_TEMPLATE_PARM]: Hash by level & index.
3047 [node_class:default]: Refactor.
3049 2020-04-18 Patrick Palka <ppalka@redhat.com>
3052 * tree.c (cp_tree_equal) <case PARM_DECL>: Ignore
3053 comparing_specializations if the parameters' contexts are identical.
3056 * pt.c (splice_late_return_type): Propagate cv-qualifiers and
3057 PLACEHOLDER_TYPE_CONSTRAINTS from the original auto node to the new one.
3059 2020-04-17 Patrick Palka <ppalka@redhat.com>
3062 * lambda.c (lambda_capture_field_type): Avoid doing auto deduction if
3063 the explicit initializer has parameter packs.
3066 * parser.c (cp_parser_check_template_parameters): Before issuing a hard
3067 error, first try simulating an error instead.
3069 2020-04-17 Jakub Jelinek <jakub@redhat.com>
3072 * call.c (build_conditional_expr_1): Remove redundant assignment to
3075 2020-04-16 Patrick Palka <ppalka@redhat.com>
3078 * cvt.c (ocp_convert): If the result of scalar_constant_value is
3079 erroneous, ignore it and use the original expression.
3081 2020-04-16 Jakub Jelinek <jakub@redhat.com>
3084 * parser.c (cp_parser_simple_declaration): Fix up a pasto in
3087 2020-04-15 Jakub Jelinek <jakub@redhat.com>
3090 * parser.c (cp_parser_pragma) <case PRAGMA_OMP_REQUIRES>: Reject
3091 requires directive when not at file or namespace scope.
3093 2020-04-14 Iain Sandoe <iain@sandoe.co.uk>
3096 * coroutines.cc (build_actor_fn): Check that the target can
3097 support the resume tailcall before mandating it.
3099 2020-04-14 Patrick Palka <ppalka@redhat.com>
3102 * cxx-pretty-print.c (cxx_pretty_printer:simple_type_specifier)
3103 <case DECLTYPE_TYPE>: Handle DECLTYPE_TYPE here instead of ...
3104 (pp_cxx_type_specifier_seq) <case DECLTYPE_TYPE>: ... here.
3105 (cxx_pretty_printer::direct_abstract_declarator) <case DECLTYPE_TYPE>:
3109 * constexpr.c (replace_result_decl_data): New struct.
3110 (replace_result_decl_data_r): New function.
3111 (replace_result_decl): New function.
3112 (cxx_eval_call_expression): Use it.
3113 * tree.c (build_aggr_init_expr): Set the location of the AGGR_INIT_EXPR
3114 to that of its initializer.
3116 2020-04-13 Marek Polacek <polacek@redhat.com>
3119 * name-lookup.c (check_local_shadow): Add an inform call.
3121 2020-04-13 Patrick Palka <ppalka@redhat.com>
3124 * error.c (dump_scope): Pass TFF_NO_FUNCTION_ARGUMENTS to
3125 dump_function_decl when printing a function template instantiation as a
3129 * constexpr.c (get_or_insert_ctor_field): Set default value of parameter
3131 (cxx_eval_bare_aggregate): Use get_or_insert_ctor_field instead of
3132 assuming the the next index belongs at the end of the new CONSTRUCTOR.
3133 (cxx_eval_store_expression): Revert PR c++/78572 fix.
3135 2020-04-13 Nathan Sidwell <nathan@acm.org>
3137 PR c++/94426 lambdas with internal linkage are different to no-linkage
3138 * decl2.c (determine_visibility): A lambda's visibility is
3139 affected by its extra scope.
3140 * pt.c (instantiate_decl): Determine var's visibility before
3141 instantiating its initializer.
3142 * tree.c (no_linkage_check): Revert code looking at visibility of
3143 lambda's extra scope.
3145 2020-04-10 Iain Sandoe <iain@sandoe.co.uk>
3148 * coroutines.cc (co_await_expander): Remove.
3149 (expand_one_await_expression): New.
3150 (process_one_statement): New.
3151 (await_statement_expander): New.
3152 (build_actor_fn): Revise to use per-statement expander.
3153 (struct susp_frame_data): Reorder and comment.
3154 (register_awaits): Factor code.
3155 (replace_statement_captures): New, factored from...
3156 (maybe_promote_captured_temps):.. here.
3157 (await_statement_walker): Revise to process per statement.
3158 (morph_fn_to_coro): Use revised susp_frame_data layout.
3160 2020-04-10 Marek Polacek <polacek@redhat.com>
3163 * method.c (constructible_expr): In C++20, try using parenthesized
3164 initialization of aggregates to determine the result of
3167 2020-04-10 Bin Cheng <bin.cheng@linux.alibaba.com>
3169 * coroutines.cc (co_await_expander): Simplify.
3171 2020-04-09 Jason Merrill <jason@redhat.com>
3174 * constexpr.c (cxx_eval_constant_expression) [VAR_DECL]: Look at
3175 ctx->object and ctx->global->values first.
3177 2020-04-09 Marek Polacek <polacek@redhat.com>
3180 * call.c (initialize_reference): If the reference binding failed, maybe
3181 try initializing from { }.
3182 * decl.c (grok_reference_init): For T& t(e), set
3183 LOOKUP_AGGREGATE_PAREN_INIT but don't build up a constructor yet.
3185 2020-04-08 Iain Sandoe <iain@sandoe.co.uk>
3186 Jun Ma <JunMa@linux.alibaba.com>
3188 * coroutines.cc (maybe_promote_captured_temps): Add a cleanup
3189 expression, if needed, to any call from which we promoted
3190 temporaries captured by reference.
3192 2020-04-08 Marek Polacek <polacek@redhat.com>
3194 PR c++/94507 - ICE-on-invalid with lambda template.
3195 * pt.c (tsubst_lambda_expr): Cope when tsubst_template_decl or
3196 tsubst_function_decl returns error_mark_node.
3198 2020-04-08 Martin Liska <mliska@suse.cz>
3201 * decl.c (duplicate_decls): Duplicate also DECL_IS_REPLACEABLE_OPERATOR.
3202 (cxx_init_decl_processing): Mark replaceable all implicitly defined
3205 2020-04-08 Patrick Palka <ppalka@redhat.com>
3207 Core issues 1001 and 1322
3209 * pt.c (rebuild_function_or_method_type): Split function out from ...
3210 (tsubst_function_type): ... here.
3211 (maybe_rebuild_function_decl_type): New function.
3212 (tsubst_function_decl): Use it.
3214 2020-04-08 Jakub Jelinek <jakub@redhat.com>
3217 * decl.c (begin_destructor_body): For CLASSTYPE_VBASECLASSES class
3218 dtors, if CLASSTYPE_PRIMARY_BINFO is non-NULL, but not BINFO_VIRTUAL_P,
3219 look at CLASSTYPE_PRIMARY_BINFO of its BINFO_TYPE if it is not
3220 BINFO_VIRTUAL_P, and so on.
3222 2020-04-08 Marek Polacek <polacek@redhat.com>
3224 PR c++/94478 - ICE with defaulted comparison operator
3225 * method.c (early_check_defaulted_comparison): Give an error when the
3228 2020-04-08 Tobias Burnus <tobias@codesourcery.com>
3231 * paser.c (cp_parser_oacc_declare): Add check that variables
3232 are declared in the same scope as the directive.
3234 2020-04-07 Jason Merrill <jason@redhat.com>
3237 * parser.c (cp_parser_requires_expression): Use tentative_firewall.
3240 * parser.c (cp_parser_placeholder_type_specifier): Use
3243 2020-04-07 Iain Sandoe <iain@sandoe.co.uk>
3245 * coroutines.cc (maybe_promote_captured_temps): Ensure that
3246 reference capture placeholder vars are properly declared.
3248 2020-04-07 Patrick Palka <ppalka@redhat.com>
3251 * tree.c (replace_placeholders): Look through all handled components,
3252 not just COMPONENT_REFs.
3253 * typeck2.c (process_init_constructor_array): Propagate
3254 CONSTRUCTOR_PLACEHOLDER_BOUNDARY up from each element initializer to
3255 the array initializer.
3257 2020-04-07 Jakub Jelinek <jakub@redhat.com>
3260 * parser.c (cp_parser_omp_parallel): Set OMP_PARALLEL_COMBINED
3261 if cp_parser_omp_master succeeded.
3263 2020-04-06 Jason Merrill <jason@redhat.com>
3266 * decl.c (duplicate_decls): Fix handling of DECL_HIDDEN_FRIEND_P.
3268 2020-04-04 Marek Polacek <polacek@redhat.com>
3269 Jason Merrill <jason@redhat.com>
3271 PR c++/94155 - crash in gimplifier with paren init of aggregates.
3272 * init.c (build_vec_init): Fill in indexes.
3274 2020-04-04 Jason Merrill <jason@redhat.com>
3277 * mangle.c (write_expression): Skip IMPLICIT_CONV_EXPR.
3279 2020-04-04 Patrick Palka <ppalka@redhat.com>
3283 * constexpr.c (struct constexpr_ctx): New field 'parent'.
3284 (cxx_eval_bare_aggregate): Propagate CONSTRUCTOR_PLACEHOLDER_BOUNDARY
3285 flag from the original constructor to the reduced constructor.
3286 (lookup_placeholder): Prefer to return the outermost matching object
3287 by recursively calling lookup_placeholder on the 'parent' context,
3288 but don't cross CONSTRUCTOR_PLACEHOLDER_BOUNDARY constructors.
3289 (cxx_eval_constant_expression): Link the 'ctx' context to the 'new_ctx'
3290 context via 'new_ctx.parent' when being expanded without an explicit
3291 target. Don't call replace_placeholders.
3292 (cxx_eval_outermost_constant_expr): Initialize 'ctx.parent' to NULL.
3296 * constexpr.c (get_or_insert_ctor_field): Split out (while adding
3297 support for VECTOR_TYPEs, and optimizations for the common case)
3299 (cxx_eval_store_expression): ... here. Rename local variable
3300 'changed_active_union_member_p' to 'activated_union_member_p'. Record
3301 the sequence of indexes into 'indexes' that yields the subobject we're
3302 assigning to. Record the integer offsets of the constructor indexes
3303 we're assigning through into 'index_pos_hints'. After evaluating the
3304 initializer of the store expression, recompute 'valp' using 'indexes'
3305 and using 'index_pos_hints' as hints.
3306 (cxx_eval_bare_aggregate): Tweak comments. Use get_or_insert_ctor_field
3307 to recompute the constructor_elt pointer we're assigning through after
3308 evaluating each initializer.
3310 2020-04-04 Jason Merrill <jason@redhat.com>
3313 * constraint.cc (tsubst_valid_expression_requirement): Call
3316 2020-04-04 Jason Merrill <jason@redhat.com>
3319 * constexpr.c (maybe_constant_value): Use break_out_target_exprs.
3320 * expr.c (mark_use) [VIEW_CONVERT_EXPR]: Don't wrap a TARGET_EXPR in
3323 2020-04-04 Jakub Jelinek <jakub@redhat.com>
3326 * parser.c (cp_parser_omp_for_loop): Use
3327 protected_set_expr_location_if_unset.
3328 * cp-gimplify.c (genericize_if_stmt, genericize_cp_loop): Likewise.
3331 * pt.c (tsubst_expr) <case OMP_MASTER>: Clear
3332 omp_parallel_combined_clauses.
3334 2020-04-03 Jason Merrill <jason@redhat.com>
3337 * pt.c (complex_pack_expansion_r): New.
3338 (complex_alias_template_p): Use it.
3340 2020-03-31 Jason Merrill <jason@redhat.com>
3343 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Call
3344 replace_placeholders.
3345 * typeck2.c (store_init_value): Fix arguments to
3346 fold_non_dependent_expr.
3348 2020-03-31 Jason Merrill <jason@redhat.com>
3350 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Use
3353 2020-03-30 Jason Merrill <jason@redhat.com>
3356 * tree.c (cp_tree_equal) [CALL_EXPR]: Compare KOENIG_LOOKUP_P.
3357 (called_fns_equal): Check DECL_CONTEXT.
3359 2020-03-30 Jakub Jelinek <jakub@redhat.com>
3362 * semantics.c (add_stmt): Only set STMT_IS_FULL_EXPR_P on trees with
3363 STATEMENT_CODE_P code.
3365 2020-03-28 Patrick Palka <ppalka@redhat.com>
3368 * parser.c (cp_parser_requires_clause_opt): Diagnose and recover from
3369 "requires {" when "requires requires {" was probably intended.
3372 * constraint.cc (tsubst_compound_requirement): Always suppress errors
3373 from type_deducible_p and expression_convertible_p, as they're not
3374 substitution errors.
3375 (diagnose_atomic_constraint) <case INTEGER_CST>: Remove this case so
3376 that we diagnose INTEGER_CST expressions of non-bool type via the
3378 * cp-gimplify.c (cp_genericize_r) <case REQUIRES_EXPR>: New case.
3379 * parser.c (cp_parser_requires_expression): Always parse the requirement
3380 body as if we're processing a template, by temporarily incrementing
3381 processing_template_decl. Afterwards, if we're not actually in a
3382 template context, perform semantic processing to diagnose any invalid
3383 types and expressions.
3384 * pt.c (tsubst_copy_and_build) <case REQUIRES_EXPR>: Remove dead code.
3385 * semantics.c (finish_static_assert): Explain an assertion failure
3386 when the condition is a REQUIRES_EXPR like we do when it is a concept
3389 * constraint.cc (diagnose_compound_requirement): When diagnosing a
3390 compound requirement, maybe replay the satisfaction failure, subject to
3391 the current diagnosis depth.
3393 * constraint.cc (finish_constraint_binary_op): Set the location of EXPR
3394 as well as its range, because build_x_binary_op doesn't always do so.
3395 (current_constraint_diagnosis_depth): New.
3396 (concepts_diagnostics_max_depth_exceeded_p): New.
3397 (collect_operands_of_disjunction): New.
3398 (satisfy_disjunction): When diagnosing a satisfaction failure, maybe
3399 replay each branch of the disjunction, subject to the current diagnosis
3401 (diagnose_valid_expression): When diagnosing a satisfaction failure,
3402 maybe replay the substitution error, subject to the current diagnosis
3404 (diagnose_valid_type): Likewise.
3405 (diagnose_nested_requiremnet): Likewise.
3406 (diagnosing_failed_constraint::diagnosing_failed_constraint): Increment
3407 current_constraint_diagnosis_depth when diagnosing.
3408 (diagnosing_failed_constraint::~diagnosing_failed_constraint): Decrement
3409 current_constraint_diagnosis_depth when diagnosing.
3410 (diagnosing_failed_constraint::replay_errors_p): New static member
3412 (diagnose_constraints): Don't diagnose if concepts_diagnostics_max_depth
3413 is 0. Emit a one-off note to increase -fconcepts-diagnostics-depth if
3414 the limit was exceeded.
3415 * cp-tree.h (diagnosing_failed_constraint::replay_errors_p): Declare.
3417 2020-03-27 Nathan Sidwell <nathan@acm.org>
3420 * name-lookup.c (do_pushdecl): Look through cleanp levels.
3422 2020-03-27 Martin Sebor <msebor@redhat.com>
3427 * cp-tree.h (most_specialized_partial_spec): Declare.
3428 * parser.c (cp_parser_elaborated_type_specifier): Distinguish alias
3430 (specialization_of): New function.
3431 (cp_parser_check_class_key): Move code...
3432 (class_decl_loc_t::add): ...to here. Add parameters. Avoid issuing
3433 -Wredundant-tags on first-time declarations in other declarators.
3434 Correct handling of template specializations.
3435 (class_decl_loc_t::diag_mismatched_tags): Also expect to be called
3436 when -Wredundant-tags is enabled. Use primary template or partial
3437 specialization as the guide for uses of implicit instantiations.
3438 * pt.c (most_specialized_partial_spec): Declare extern.
3440 2020-03-27 Nathan Sidwell <nathan@acm.org>
3443 * name-lookup.c (push_namespace): Triage ambiguous lookups that
3446 2020-03-27 Jakub Jelinek <jakub@redhat.com>
3449 * call.c (set_flags_from_callee): Don't update
3450 cp_function_chain->can_throw or current_function_returns_abnormally
3451 if cp_unevaluated_operand.
3454 * cvt.c (ocp_convert): Handle COMPOUND_EXPR by recursion on the second
3455 operand and creating a new COMPOUND_EXPR if anything changed.
3457 2020-03-26 Marek Polacek <polacek@redhat.com>
3459 PR c++/94336 - template keyword accepted before destructor names.
3460 * parser.c (cp_parser_unqualified_id): Give an error when 'template'
3461 is followed by a destructor name.
3463 2020-03-27 Patrick Palka <ppalka@redhat.com>
3465 * decl.c (compute_array_index_type_loc): Remove redundant
3466 type_dependent_expression_p check that is subsumed by
3467 value_dependent_expression_p.
3468 * decl2.c (is_late_template_attribute): Likewise.
3469 * pt.c (uses_template_parms): Likewise.
3470 (dependent_template_arg_p): Likewise.
3472 2020-03-26 Marek Polacek <polacek@redhat.com>
3475 PR c++/94057 - template keyword in a typename-specifier.
3476 * parser.c (check_template_keyword_in_nested_name_spec): New.
3477 (cp_parser_nested_name_specifier_opt): Implement DR1710, optional
3478 'template'. Call check_template_keyword_in_nested_name_spec.
3479 (cp_parser_simple_type_specifier): Assume that a <
3480 following a qualified-id in a typename-specifier begins
3481 a template argument list.
3483 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
3485 * coroutines.cc (coro_init_identifiers): Initialize an identifier
3486 for the cororoutine handle 'address' method name.
3487 (struct coro_aw_data): Add fields to cover the continuations.
3488 (co_await_expander): Determine the kind of await_suspend in use.
3489 If we have the case that returns a continuation handle, then save
3490 this and make the target for 'scope exit without cleanup' be the
3491 continuation resume label.
3492 (expand_co_awaits): Remove.
3493 (struct suspend_point_info): Remove fields that kept the returned
3494 await_suspend handle type.
3495 (transform_await_expr): Remove code tracking continuation handles.
3496 (build_actor_fn): Add the continuation handle as an actor-function
3497 scope var. Build the symmetric transfer continuation point. Call
3498 the tree walk for co_await expansion directly, rather than via a
3499 trivial shim function.
3500 (register_await_info): Remove fields tracking continuation handles.
3501 (get_await_suspend_return_type): Remove.
3502 (register_awaits): Remove code tracking continuation handles.
3503 (morph_fn_to_coro): Remove code tracking continuation handles.
3505 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
3507 * coroutines.cc (co_await_expander): If we are expanding the
3508 initial await expression, set a boolean flag to show that we
3509 have now reached the initial await_resume() method call.
3510 (expand_co_awaits): Handle the 'initial await resume called' flag.
3511 (build_actor_fn): Insert the initial await expression into the
3512 start of the user-authored function-body. Handle the 'initial await
3513 resume called' flag.
3514 (morph_fn_to_coro): Initialise the 'initial await resume called'
3515 flag. Modify the unhandled exception catch clause to recognise
3516 exceptions that occur before the initial await_resume() and re-
3519 2020-03-26 Jakub Jelinek <jakub@redhat.com>
3522 * class.c (user_provided_p): Use STRIP_TEMPLATE instead of returning
3523 true for all TEMPLATE_DECLs.
3526 * cp-gimplify.c (cp_genericize_r): Handle STATEMENT_LIST.
3528 2020-03-25 Patrick Palka <ppalka@redhat.com>
3531 * parser.c (cp_parser_selection_statement) <case RID_IF>: Invalidate the
3532 current condition chain when the if-statement has a non-empty
3535 2020-03-25 Iain Sandoe <iain@sandoe.co.uk>
3538 * coroutines.cc (captures_temporary): Fix a missing dereference.
3540 2020-03-24 Marek Polacek <polacek@redhat.com>
3542 PR c++/94190 - wrong no post-decrement operator error in template.
3543 * call.c (convert_like_real): Use convert_from_reference on the result.
3545 2020-03-24 Jason Merrill <jason@redhat.com>
3548 * constraint.cc (constraint_satisfaction_value): Repeat noisily on
3550 (tsubst_nested_requirement): Likewise.
3551 (get_constraint_error_location): Allow missing context.
3552 (diagnose_atomic_constraint): Diagnose non-bool constraint here.
3553 (satisfy_atom): Not here. Only diagnose non-constant when noisy.
3555 2020-03-24 Jason Merrill <jason@redhat.com>
3557 * pt.c (any_template_parm_r): Look into the type of a non-type
3560 2020-03-24 Jason Merrill <jason@redhat.com>
3562 * cp-tree.h (cp_expr): When constructing from an expr and a
3563 location, call protected_set_expr_location.
3565 2020-03-23 Patrick Palka <ppalka@redhat.com>
3568 * except.c (maybe_noexcept_warning): Add TODO.
3569 * method.c (walk_field_subobs): Pass tf_none to expr_noexcept_p.
3571 2020-03-23 nathans <nathan@acm.org>
3574 * tree.c (cp_tree_equal) [SIZEOF_EXPR]: Detect argument pack
3577 2020-03-21 Patrick Palka <ppalka@redhat.com>
3580 * constexpr.c (reduced_constant_expression_p) [CONSTRUCTOR]: Properly
3581 handle unions without an initializer.
3582 (cxx_eval_component_reference): Emit a different diagnostic when the
3583 constructor element corresponding to a union member is NULL.
3584 (cxx_eval_bare_aggregate): When constructing a union, always set the
3585 active union member before evaluating the initializer. Relax assertion
3586 that verifies the index of the constructor element we're initializing
3587 hasn't been changed.
3588 (cxx_eval_store_expression): Diagnose changing the active union member
3589 while the union is in the process of being initialized. After setting
3590 an active union member, clear CONSTRUCTOR_NO_CLEARING on the underlying
3592 (cxx_eval_constant_expression) [PLACEHOLDER_EXPR]: Don't re-reduce a
3593 CONSTRUCTOR returned by lookup_placeholder.
3595 2020-03-20 Patrick Palka <ppalka@redhat.com>
3597 * cxx-pretty-print.c (pp_cxx_parameter_mapping): Make extern. Move
3598 the "[with ]" bits to here from ...
3599 (pp_cxx_atomic_constraint): ... here.
3600 * cxx-pretty-print.h (pp_cxx_parameter_mapping): Declare.
3601 * error.c (rebuild_concept_check): Delete.
3602 (print_concept_check_info): Print the dependent form of the constraint and the
3603 preferably substituted parameter mapping alongside it.
3605 2020-03-19 Jason Merrill <jason@redhat.com>
3608 * cp-gimplify.c (simple_empty_class_p): Look through
3609 SIMPLE_TARGET_EXPR_P.
3610 (cp_gimplify_expr) [MODIFY_EXPR]: Likewise.
3611 [RETURN_EXPR]: Avoid producing 'return *retval;'.
3612 * call.c (build_call_a): Strip TARGET_EXPR from empty class arg.
3613 * cp-tree.h (SIMPLE_TARGET_EXPR_P): Check that TARGET_EXPR_INITIAL
3616 2020-03-19 Jakub Jelinek <jakub@redhat.com>
3619 * parser.c (cp_parser_omp_var_list_no_open): Call process_outer_var_ref
3620 on outer_automatic_var_p decls.
3621 * cp-gimplify.c (cxx_omp_disregard_value_expr): Return true also for
3622 capture proxy decls.
3624 2020-03-18 Nathan Sidwell <nathan@acm.org>
3626 PR c++/94147 - mangling of lambdas assigned to globals
3627 * parser.c (cp_parser_init_declarator): Namespace-scope variables
3628 provide a lambda scope.
3629 * tree.c (no_linkage_check): Lambdas with a variable for extra
3630 scope have a linkage from the variable.
3632 2020-03-18 Jakub Jelinek <jakub@redhat.com>
3634 * constraint.cc (resolve_function_concept_check, subsumes_constraints,
3635 strictly_subsumes): Fix up duplicated word issue in a comment.
3636 * coroutines.cc (build_init_or_final_await, captures_temporary):
3638 * logic.cc (dnf_size_r, cnf_size_r): Likewise.
3639 * pt.c (append_type_to_template_for_access_check): Likewise.
3642 * decl.c (grokfndecl): Restore old diagnostics about deduction
3643 guide declared in different scope if in_namespace is NULL_TREE.
3645 2020-03-17 Jakub Jelinek <jakub@redhat.com>
3648 * parser.c (cp_parser_enum_specifier): Use temp_override for
3649 parser->colon_corrects_to_scope_p, replace goto out with return.
3650 If scoped enum or enum with underlying type is not followed by
3651 { or ;, call cp_parser_commit_to_tentative_parse before calling
3652 cp_parser_error and make sure to return error_mark_node instead of
3653 NULL_TREE. Formatting fixes.
3655 2020-03-17 Ville Voutilainen <ville.voutilainen@gmail.com>
3658 * method.c (assignable_expr): Use cp_unevaluated.
3659 (is_xible_helper): Push a non-deferred access check for
3660 the stub objects created by assignable_expr and constructible_expr.
3662 2020-03-17 Jakub Jelinek <jakub@redhat.com>
3664 * pt.c (tsubst): Fix up duplicated word issue in a diagnostic message.
3665 (lookup_template_class_1, tsubst_expr): Fix up duplicated word issue
3667 * parser.c (cp_parser_statement, cp_parser_linkage_specification,
3668 cp_parser_placeholder_type_specifier,
3669 cp_parser_constraint_requires_parens): Likewise.
3670 * name-lookup.c (suggest_alternative_in_explicit_scope): Likewise.
3672 2020-03-15 Iain Sandoe <iain@sandoe.co.uk>
3674 * coroutines.cc (co_await_expander): Fix indentation.
3676 2020-03-14 Jason Merrill <jason@redhat.com>
3679 * pt.c (process_partial_specialization): Error rather than crash on
3680 extra pack expansion.
3682 2020-03-14 Jason Merrill <jason@redhat.com>
3685 * pt.c (find_parameter_packs_r): [DECL_EXPR]: Walk
3686 DECL_ORIGINAL_TYPE of a typedef.
3688 2020-03-14 Jason Merrill <jason@redhat.com>
3691 * pt.c (build_deduction_guide): Clear cp_unevaluated_operand for
3692 substituting DECL_ARGUMENTS.
3694 2020-03-14 Jakub Jelinek <jakub@redhat.com>
3696 * logic.cc (formula::formula): Change "a an" to "an" in a comment.
3697 * parser.c (cp_debug_parser): Change "a an" to "an" in a string
3700 2020-03-13 Patrick Palka <ppalka@redhat.com>
3703 * call.c (build_over_call): Use a warning_sentinel to disable
3704 warn_deprecated_decl before calling build_addr_func.
3706 2020-03-12 Jakub Jelinek <jakub@redhat.com>
3709 * decl.c (reshape_init_array_1): Don't unshare constructor if there
3710 aren't any trailing zero elts, otherwise only unshare the first
3713 2020-03-11 Jason Merrill <jason@redhat.com>
3716 * constraint.cc (tsubst_parameter_mapping): Canonicalize type
3719 2020-03-11 Marek Polacek <polacek@redhat.com>
3720 Jason Merrill <jason@redhat.com>
3722 PR c++/94074 - wrong modifying const object error for COMPONENT_REF.
3723 * constexpr.c (cref_has_const_field): New function.
3724 (modifying_const_object_p): Consider a COMPONENT_REF
3725 const only if any of its fields are const.
3726 (cxx_eval_store_expression): Mark a CONSTRUCTOR of a const type
3727 as readonly after its initialization has been done.
3729 2020-03-10 Marek Polacek <polacek@redhat.com>
3731 PR c++/94124 - wrong conversion error with non-viable overload.
3732 * decl.c (reshape_init_array_1): Unshare a constructor if we
3733 stripped trailing zero-initializers.
3735 2020-03-10 Jason Merrill <jason@redhat.com>
3738 * pt.c (maybe_instantiate_noexcept): Always update clones.
3740 2020-03-10 Jason Merrill <jason@redhat.com>
3743 * pt.c (maybe_aggr_guide): Check BRACE_ENCLOSED_INITIALIZER_P.
3745 2020-03-10 Jason Merrill <jason@redhat.com>
3751 * cp-gimplify.c (cp_gimplify_init_expr): Partially revert patch for
3752 66139: Don't split_nonconstant_init. Remove pre_p parameter.
3754 2020-03-09 Marek Polacek <polacek@redhat.com>
3756 PR c++/92031 - bogus taking address of rvalue error.
3757 PR c++/91465 - ICE with template codes in check_narrowing.
3758 PR c++/93870 - wrong error when converting template non-type arg.
3759 PR c++/94068 - ICE with template codes in check_narrowing.
3760 * call.c (convert_like_real): Return IMPLICIT_CONV_EXPR
3761 in a template when not ck_identity and we're dealing with a class.
3762 (convert_like_real) <case ck_ref_bind>: Return IMPLICIT_CONV_EXPR
3763 in a template if we need a temporary.
3764 * decl.c (compute_array_index_type_loc): Remove
3765 instantiate_non_dependent_expr_sfinae call. Call
3766 fold_non_dependent_expr instead of maybe_constant_value.
3767 (build_explicit_specifier): Don't instantiate or create a sentinel
3768 before converting the expression.
3769 * except.c (build_noexcept_spec): Likewise.
3770 * pt.c (convert_nontype_argument): Don't build IMPLICIT_CONV_EXPR.
3771 Set IMPLICIT_CONV_EXPR_NONTYPE_ARG if that's what
3772 build_converted_constant_expr returned.
3773 * typeck2.c (check_narrowing): Call fold_non_dependent_expr instead
3774 of maybe_constant_value.
3776 2020-03-09 Jakub Jelinek <jakub@redhat.com>
3780 2019-10-11 Paolo Carlini <paolo.carlini@oracle.com>
3782 * constexpr.c (cxx_eval_constant_expression): Do not handle
3783 RROTATE_EXPR and LROTATE_EXPR.
3785 2020-03-09 Marek Polacek <polacek@redhat.com>
3787 PR c++/94050 - ABI issue with alignas on armv7hl.
3788 * class.c (layout_class_type): Don't replace a class's
3789 CLASSTYPE_AS_BASE if their TYPE_USER_ALIGN don't match.
3791 2020-03-09 Bin Cheng <bin.cheng@linux.alibaba.com>
3793 * coroutines.cc (build_actor_fn): Factor out code inserting the
3794 default return_void call to...
3795 (morph_fn_to_coro): ...here, also hoist local var declarations.
3797 2020-03-08 Patrick Palka <ppalka@redhat.com>
3800 * call.c (convert_like_real): Check complain before emitting an error
3801 about binding a bit-field to a reference.
3803 * cxx-pretty-print.c (cxx_pretty_printer::simple_type_specifier)
3804 [TYPENAME_TYPE]: Print the TYPENAME_TYPE_FULLNAME instead of the
3807 2020-03-06 Nathan Sidwell <nathan@acm.org>
3810 * mangle.c (find_substitution): Don't call same_type_p on template
3811 args that cannot match.
3813 2020-03-04 Martin Sebor <msebor@redhat.com>
3816 * tree.c (type_initializer_zero_p): Fail for structs initialized
3819 2020-03-04 Jason Merrill <jason@redhat.com>
3822 * init.c (perform_member_init): Don't do aggregate initialization of
3824 * constexpr.c (cx_check_missing_mem_inits): Don't enforce
3825 initialization of empty field.
3827 2020-03-04 Martin Liska <mliska@suse.cz>
3829 * method.c: Wrap array in ctor with braces in order
3830 to silent clang warnings.
3832 2020-03-03 Jason Merrill <jason@redhat.com>
3833 Marek Polacek <polacek@redhat.com>
3835 PR c++/90505 - mismatch in template argument deduction.
3836 * pt.c (tsubst): Don't reduce the template level of template
3837 parameters when tf_partial.
3839 2020-03-03 Jakub Jelinek <jakub@redhat.com>
3842 * constexpr.c (cxx_eval_constant_expression)
3843 <case TARGET_EXPR, case SAVE_EXPR>: Don't record anything if
3844 *non_constant_p is true.
3846 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
3848 * coroutines.cc (captures_temporary): Strip component_ref
3851 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
3853 * coroutines.cc (finish_co_await_expr): Build co_await_expr
3854 with unknown_type_node.
3855 (finish_co_yield_expr): Ditto.
3856 *pt.c (type_dependent_expression_p): Set co_await/yield_expr
3857 with unknown type as dependent.
3859 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
3861 * coroutines.cc (struct local_var_info): Adjust to remove the
3862 reference to the captured var, and just to note that this is a
3863 lambda capture proxy.
3864 (transform_local_var_uses): Handle lambda captures specially.
3865 (struct param_frame_data): Add a visited set.
3866 (register_param_uses): Also check for param uses in lambda
3868 (struct local_vars_frame_data): Remove captures list.
3869 (register_local_var_uses): Handle lambda capture proxies by
3870 noting and bypassing them.
3871 (morph_fn_to_coro): Update to remove lifetime extension of
3872 lambda capture-by-copy vars.
3874 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
3876 * coroutines.cc (build_co_await): Do not build frame
3877 awaitable proxy vars when the co_await expression is
3878 a function parameter or local var.
3879 (co_await_expander): Do not initialise a frame var with
3881 (transform_await_expr): Only substitute the awaitable
3882 frame var if it's needed.
3883 (register_awaits): Do not make frame copies for param
3884 or local vars that are awaitables.
3886 2020-02-28 Jason Merrill <jason@redhat.com>
3888 Implement P2092R0, Disambiguating Nested-Requirements
3889 * parser.c (cp_parser_requirement_parameter_list): Pass
3890 CP_PARSER_FLAGS_TYPENAME_OPTIONAL.
3892 * call.c (build_user_type_conversion_1): Don't look at the second
3893 conversion of a non-viable candidate.
3895 2020-02-28 Jakub Jelinek <jakub@redhat.com>
3897 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
3898 * typeck.c (cp_build_addr_expr_1): Allow taking address of immediate
3899 functions in unevaluated contexts.
3901 2020-02-27 Nathan Sidwell <nathan@acm.org>
3904 * pt.c (template_args_equal): Pass ARGUMENT_PACKS through to
3906 * tree.c (cp_tree_equal): Compare ARGUMENT_PACKS here,
3907 * typeck.c (comptypes): Assert we don't get any argument packs.
3909 * class.c (adjust_clone_args): Correct arg-checking assert.
3910 * typeck.c (comptypes): Assert not nulls.
3912 2020-02-26 Marek Polacek <polacek@redhat.com>
3914 PR c++/93789 - ICE with invalid array bounds.
3915 * decl.c (compute_array_index_type_loc): Don't use the folded
3916 size when folding cleared TREE_CONSTANT.
3918 2020-02-26 Iain Sandoe <iain@sandoe.co.uk>
3920 * class.c (classtype_has_non_deleted_copy_ctor): New.
3921 * coroutines.cc (struct param_info): Keep track of params
3922 that are references, and cache the original type and whether
3923 the DTOR is trivial.
3924 (build_actor_fn): Handle param copies always, and adjust the
3925 handling for references.
3926 (register_param_uses): Only handle uses here.
3927 (classtype_has_non_deleted_copy_ctor): New.
3928 (morph_fn_to_coro): Adjust param copy handling to match n4849
3929 by reordering ahead of the promise CTOR and always making a
3930 frame copy, even if the param is unused in the coroutine body.
3931 * cp-tree.h (classtype_has_non_deleted_copy_ctor): New.
3933 2020-02-26 Patrick Palka <ppalka@redhat.com>
3935 * constraint.cc (finish_constraint_binary_op): Set expr's location range
3936 to the range of its operands.
3937 (satisfy_atom): Pass MAP instead of ARGS to diagnose_atomic_constraint.
3938 (diagnose_trait_expr): Take the instantiated parameter mapping MAP
3939 instead of the corresponding template arguments ARGS and adjust body
3941 (diagnose_requires_expr): Likewise.
3942 (diagnose_atomic_constraint): Likewise. When printing an atomic
3943 constraint expression, print the instantiated parameter mapping
3945 * cxx-pretty-print.cc (cxx_pretty_printer::expression)
3946 [NONTYPE_ARGUMENT_PACK]: Print braces around a NONTYPE_ARGUMENT_PACK.
3947 (cxx_pretty_printer::type_id): Handle TYPE_ARGUMENT_PACK.
3949 2020-02-26 Marek Polacek <polacek@redhat.com>
3951 PR c++/93676 - value-init crash in template.
3952 * init.c (build_new_1): Don't call build_vec_init in a template.
3954 2020-02-26 Marek Polacek <polacek@redhat.com>
3956 PR c++/93862 - ICE with static_cast when converting from int[].
3957 * call.c (reference_compatible_p): No longer static.
3958 * cp-tree.h (reference_compatible_p): Declare.
3959 * typeck.c (build_static_cast_1): Use reference_compatible_p instead
3960 of reference_related_p.
3962 2020-02-26 Marek Polacek <polacek@redhat.com>
3964 PR c++/93803 - ICE with constexpr init and [[no_unique_address]].
3965 * constexpr.c (reduced_constant_expression_p): Don't crash on a null
3968 2020-02-24 Martin Sebor <msebor@redhat.com>
3971 * parser.c (cp_parser_check_class_key): Avoid issuing -Wredundant-tags
3972 in shared C/C++ code in headers.
3973 Remove a duplicate hunk of code.
3975 2020-02-24 Marek Polacek <polacek@redhat.com>
3977 PR c++/93869 - ICE with -Wmismatched-tags.
3978 * parser.c (cp_parser_check_class_key): Check class_key earlier.
3980 2020-02-24 Marek Polacek <polacek@redhat.com>
3982 PR c++/93712 - ICE with ill-formed array list-initialization.
3983 * call.c (next_conversion): Return NULL for ck_aggr.
3984 (build_aggr_conv): Set u.expr instead of u.next.
3985 (build_array_conv): Likewise.
3986 (build_complex_conv): Likewise.
3987 (conv_get_original_expr): Handle ck_aggr.
3989 2020-02-24 Jakub Jelinek <jakub@redhat.com>
3991 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
3992 * call.c (build_over_call): Don't evaluate immediate functions in
3993 unevaluated operands.
3995 2020-02-24 Jason Merrill <jason@redhat.com>
3997 P0780R2: Resolve lambda init-capture pack grammar.
3998 * parser.c (cp_parser_lambda_introducer): Expect &...x=y rather than
4001 2020-02-22 Marek Polacek <polacek@redhat.com>
4004 * decl.c (grokdeclarator): Use %qs in a diagnostic message.
4006 2020-02-21 Martin Sebor <msebor@redhat.com>
4008 PR gcov-profile/93753
4009 * class.c (check_flexarrays): Tighten up a test for potential members
4010 of anonymous structs or unions.
4012 2020-02-20 Martin Sebor <msebor@redhat.com>
4015 * parser.c (cp_parser_check_class_key): Only handle true C++ class-keys.
4017 2020-02-20 Martin Liska <mliska@suse.cz>
4019 PR translation/93841
4020 * config/or1k/or1k.opt: Remove superfluous word.
4021 * doc/invoke.texi: Likewise.
4023 2020-02-20 Martin Liska <mliska@suse.cz>
4025 PR translation/93838
4026 * parser.c (cp_parser_decl_specifier_seq): Remove trailing space.
4028 2020-02-19 Marek Polacek <polacek@redhat.com>
4030 PR c++/93169 - wrong-code with a non-constexpr constructor.
4031 * constexpr.c (cxx_eval_call_expression): Only set TREE_READONLY
4032 on constant CONSTRUCTORs.
4034 2020-02-15 Marek Polacek <polacek@redhat.com>
4036 PR c++/93710 - poor diagnostic for array initializer.
4037 * call.c (build_user_type_conversion_1): Use cp_expr_loc_or_input_loc
4040 2020-02-15 Jason Merrill <jason@redhat.com>
4043 * pt.c (any_template_parm_r): Look into lambda body.
4046 * pt.c (any_template_parm_r): Remove CONSTRUCTOR handling.
4048 2020-02-14 Jakub Jelinek <jakub@redhat.com>
4051 * class.c (enum_min_precision): Change prec type from int to int &.
4054 * cp-tree.h (enum cp_tree_index): Add CPTI_FALLBACK_DFLOAT32_TYPE,
4055 CPTI_FALLBACK_DFLOAT64_TYPE and CPTI_FALLBACK_DFLOAT128_TYPE.
4056 (fallback_dfloat32_type, fallback_dfloat64_type,
4057 fallback_dfloat128_type): Define.
4058 * mangle.c (write_builtin_type): Handle fallback_dfloat*_type like
4060 * rtti.c (emit_support_tinfos): Emit DFP typeinfos even when dfp
4061 is disabled for compatibility.
4063 2020-02-13 Jason Merrill <jason@redhat.com>
4066 * name-lookup.c (matching_fn_p): A function does not match a
4071 * tree.c (decl_linkage): Always lk_none for locals.
4073 2020-02-12 Jason Merrill <jason@redhat.com>
4077 * tree.c (cp_walk_subtrees): Walk CONSTRUCTOR types here.
4078 * pt.c (find_parameter_packs_r): Not here.
4080 2020-02-12 Iain Sandoe <iain@sandoe.co.uk>
4082 * coroutines.cc (build_actor_fn): Implement deallocation function
4083 selection per n4849, dcl.fct.def.coroutine bullet 12.
4084 (morph_fn_to_coro): Implement allocation function selection per
4085 n4849, dcl.fct.def.coroutine bullets 9 and 10.
4087 2020-02-12 Marek Polacek <polacek@redhat.com>
4089 PR c++/93684 - ICE-on-invalid with broken attribute.
4090 * parser.c (cp_parser_std_attribute): Peek a token first before
4093 2020-02-11 Jason Merrill <jason@redhat.com>
4096 * class.c (add_implicitly_declared_members): Use do_friend.
4097 * method.c (implicitly_declare_fn): Fix friend handling.
4098 (decl_remember_implicit_trigger_p): New.
4099 (synthesize_method): Use it.
4100 * decl2.c (mark_used): Use it.
4102 2020-02-11 Jason Merrill <jason@redhat.com>
4106 * constexpr.c (maybe_constant_value): Correct earlier change.
4107 (cxx_eval_binary_expression) [SPACESHIP_EXPR]: Pass lval through.
4108 * method.c (genericize_spaceship): Wrap result in TARGET_EXPR.
4110 2020-02-12 Patrick Palka <ppalka@redhat.com>
4114 * type-utils.h (find_type_usage): Refactor to take a tree * and to
4115 return a tree *, and update documentation accordingly.
4116 * pt.c (make_auto_1): Set AUTO_IS_DECLTYPE when building a
4117 decltype(auto) node.
4118 (make_constrained_decltype_auto): No need to explicitly set
4119 AUTO_IS_DECLTYPE anymore.
4120 (splice_late_return_type): Use find_type_usage to find and
4121 replace a possibly nested auto node instead of using is_auto.
4122 Check test for is_auto into an assert when deciding whether
4123 to late_return_type.
4124 (type_uses_auto): Adjust the call to find_type_usage.
4125 * parser.c (cp_parser_decltype): No need to explicitly set
4126 AUTO_IS_DECLTYPE anymore.
4128 * error.c (dump_decl) [CONCEPT_DECL]: Use dump_simple_decl.
4129 (dump_simple_decl): Handle standard concept definitions as well as
4130 variable concept definitions.
4132 2020-02-10 Jakub Jelinek <jakub@redhat.com>
4135 * error.c (dump_decl_name): Fix up last argument to strncmp.
4137 2020-02-10 Jason Merrill <jason@redhat.com>
4140 * tree.c (array_of_unknown_bound_p): New.
4141 * init.c (perform_member_init): Do nothing for flexible arrays.
4143 2020-02-09 Jakub Jelinek <jakub@redhat.com>
4146 * constexpr.c (cxx_eval_constant_expression): If obj is heap var with
4147 ARRAY_TYPE, use the element type. Punt if objtype after that is not
4150 2020-02-08 Jason Merrill <jason@redhat.com>
4153 * expr.c (fold_for_warn): Call maybe_constant_value.
4154 * constexpr.c (struct constexpr_ctx): Add uid_sensitive bit-field.
4155 (maybe_constant_value): Add uid_sensitive parm.
4156 (get_fundef_copy): Don't copy if it's true.
4157 (cxx_eval_call_expression): Don't instantiate if it's true.
4158 (cxx_eval_outermost_constant_expr): Likewise.
4161 * constexpr.c (maybe_constant_value): Don't unshare if the cached
4162 value is the same as the argument.
4164 * typeck.c (maybe_warn_about_returning_address_of_local): Add
4167 * typeck2.c (process_init_constructor): Also clear TREE_SIDE_EFFECTS
4170 2020-02-08 Jakub Jelinek <jakub@redhat.com>
4173 * constexpr.c (find_array_ctor_elt): If last element has no index,
4174 for flag_checking verify all elts have no index. If i is within the
4175 elts, return it directly, if it is right after the last elt, append
4176 if NULL index, otherwise force indexes on all elts.
4177 (cxx_eval_store_expression): Allow cep->index to be NULL.
4179 2020-02-07 Marek Polacek <polacek@redhat.com>
4181 PR c++/92947 - Paren init of aggregates in unevaluated context.
4182 * call.c (build_new_method_call_1): Don't check
4183 cp_unevaluated_operand. Check the return value of digest_init.
4185 2020-02-06 Jason Merrill <jason@redhat.com>
4188 * tree.c (cp_walk_subtrees): Walk into type template arguments.
4189 * cp-tree.h (TYPE_TEMPLATE_INFO_MAYBE_ALIAS): Use typedef_variant_p
4190 instead of TYPE_ALIAS_P.
4191 * pt.c (push_template_decl_real): Likewise.
4192 (find_parameter_packs_r): Likewise. Remove dead code.
4193 * error.c (find_typenames_r): Remove dead code.
4195 2020-02-06 Jason Merrill <jason@redhat.com>
4198 * parser.c (cp_parser_constraint_primary_expression): Do the main
4199 parse non-tentatively.
4201 2020-02-06 Marek Polacek <polacek@redhat.com>
4203 PR c++/93597 - ICE with lambda in operator function.
4204 * name-lookup.c (maybe_save_operator_binding): Check is_overloaded_fn.
4206 2020-02-05 Jason Merrill <jason@redhat.com>
4209 * pt.c (tsubst_decl) [PARM_DECL]: Check cp_unevaluated_operand in
4210 handling of TREE_CHAIN for empty pack.
4212 2020-02-05 Jakub Jelinek <jakub@redhat.com>
4215 * semantics.c (cp_build_vec_convert): Call decay_conversion on arg
4216 prior to passing it to c_build_vec_convert.
4218 2020-02-05 Marek Polacek <polacek@redhat.com>
4220 PR c++/93559 - ICE with CONSTRUCTOR flags verification.
4221 * decl.c (reshape_init_array_1): Don't reuse a CONSTRUCTOR with
4224 2020-02-05 Jason Merrill <jason@redhat.com>
4227 * decl.c (grokdeclarator): Reject field of current class type even
4230 2020-02-05 Bin Cheng <bin.cheng@linux.alibaba.com>
4232 * coroutines.cc (maybe_promote_captured_temps): Increase the index
4233 number for temporary variables' name.
4235 2020-02-05 Jun Ma <JunMa@linux.alibaba.com>
4237 * coroutines.cc (build_co_await): Call convert_from_reference
4238 to wrap co_await_expr with indirect_ref which avoid
4239 reference/non-reference type confusion.
4241 (co_await_expander): Sink to call_expr if await_resume
4242 is wrapped by indirect_ref.
4244 2020-02-04 Jason Merrill <jason@redhat.com>
4247 * constraint.cc (satisfy_declaration_constraints): Check return
4248 value of push_tinst_level.
4251 * constexpr.c (cxx_eval_array_reference): {}-initialize missing
4252 elements instead of value-initializing them.
4255 * init.c (perform_member_init): Simplify.
4256 * constexpr.c (cx_check_missing_mem_inits): Allow uninitialized
4258 (cxx_eval_vec_init_1): Handle CONSTRUCTOR.
4260 2020-02-04 Iain Sandoe <iain@sandoe.co.uk>
4262 * coroutines.cc (find_promise_type): Delete unused forward
4264 (struct coroutine_info): Add a bool for no promise type error.
4265 (coro_promise_type_found_p): Only emit the error for a missing
4266 promise once in each affected coroutine.
4268 2020-02-03 Jason Merrill <jason@redhat.com>
4271 * constexpr.c (cxx_eval_constant_expression) [PARM_DECL]: Don't
4272 defer loading the value of a reference.
4274 2020-02-03 Jason Merrill <jason@redhat.com>
4277 * constexpr.c (potential_constant_expression_1) [PARM_DECL]: Allow
4279 [COMPONENT_REF]: A member function reference doesn't use the object
4282 2020-02-03 Iain Sandoe <iain@sandoe.co.uk>
4285 * coroutines.cc (struct coroutine_info): Add a bool flag to note
4286 that we emitted an error for a bad function return type.
4287 (get_coroutine_info): Tolerate an unset info table in case of
4289 (find_coro_traits_template_decl): In case of error or if we didn't
4290 find a type template, note we emitted the error and suppress
4292 (find_coro_handle_template_decl): Likewise.
4293 (instantiate_coro_traits): Only check for error_mark_node in the
4294 return from lookup_qualified_name.
4295 (coro_promise_type_found_p): Reorder initialization so that we check
4296 for the traits and their usability before allocation of the info
4297 table. Check for a suitable return type and emit a diagnostic for
4298 here instead of relying on the lookup machinery. This allows the
4299 error to have a better location, and means we can suppress multiple
4301 (coro_function_valid_p): Re-check for a valid promise (and thus the
4302 traits) before proceeding. Tolerate missing info as a fatal error.
4304 2020-02-03 Jason Merrill <jason@redhat.com>
4307 * cp-gimplify.c (predeclare_vla): New.
4308 (cp_genericize_r) [NOP_EXPR]: Call it.
4310 2020-02-03 Jun Ma <JunMa@linux.alibaba.com>
4312 * coroutines.cc (transform_await_wrapper): Set actor funcion as
4313 new context of label_decl.
4314 (build_actor_fn): Fill new field of await_xform_data.
4316 2020-02-02 Marek Polacek <polacek@redhat.com>
4318 PR c++/93530 - ICE on invalid alignas in a template.
4319 * decl.c (grokdeclarator): Call cplus_decl_attributes instead of
4322 2020-01-31 Jason Merrill <jason@redhat.com>
4325 * semantics.c (process_outer_var_ref): Capture VLAs even in
4326 unevaluated context.
4329 * decl.c (reshape_init_array_1): Reuse a single CONSTRUCTOR with
4330 non-aggregate elements.
4331 (reshape_init_array): Add first_initializer_p parm.
4332 (reshape_init_r): Change first_initializer_p from bool to tree.
4333 (reshape_init): Pass init to it.
4336 * parser.c (cp_parser_initializer_list): Suppress location wrappers
4339 2020-01-29 Jason Merrill <jason@redhat.com>
4342 * pt.c (tsubst_copy_and_build) [EQ_EXPR]: Only suppress warnings if
4343 the expression was dependent before substitution.
4345 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
4347 * coroutines.cc (act_des_fn): New.
4348 (morph_fn_to_coro): Call act_des_fn to build actor/destroy decls.
4349 Access promise via actor function's frame pointer argument.
4350 (build_actor_fn, build_destroy_fn): Use frame pointer argument.
4352 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
4354 * coroutines.cc (co_await_expander): Handle type conversion case.
4356 2020-01-29 Jason Merrill <jason@redhat.com>
4361 * parser.c (cp_parser_type_specifier_seq): Don't parse attributes in
4362 a trailing return type.
4363 (cp_parser_lambda_declarator_opt): Parse C++11 attributes before
4366 2020-01-29 Marek Polacek <polacek@redhat.com>
4368 PR c++/91754 - Fix template arguments comparison with class NTTP.
4369 * pt.c (class_nttp_const_wrapper_p): New.
4370 (template_args_equal): See through class_nttp_const_wrapper_p
4373 2020-01-29 Marek Polacek <polacek@redhat.com>
4375 PR c++/92948 - Fix class NTTP with template arguments.
4376 * pt.c (convert_nontype_argument): Use IMPLICIT_CONV_EXPR when
4377 converting a value-dependent expression to a class type.
4378 (tsubst_copy) <case VIEW_CONVERT_EXPR>: Allow IMPLICIT_CONV_EXPR
4379 as the result of the tsubst_copy call.
4381 2020-01-29 Jakub Jelinek <jakub@redhat.com>
4384 * cp-gimplify.c (cxx_omp_predetermined_sharing): Return
4385 OMP_CLAUSE_DEFAULT_SHARED for typeinfo decls.
4387 2020-01-28 Jason Merrill <jason@redhat.com>
4390 * parser.c (cp_parser_lambda_expression): Clear in_discarded_stmt.
4394 * decl2.c (copy_linkage): Do copy DECL_ONE_ONLY and DECL_WEAK.
4397 * call.c (build_user_type_conversion_1): Allow a template conversion
4398 returning an rvalue reference to bind directly to an lvalue.
4401 * decl.c (grokdeclarator): Propagate eh spec from typedef.
4403 2020-01-28 Martin Liska <mliska@suse.cz>
4406 * pt.c (redeclare_class_template): Group couple of
4407 errors and inform messages with auto_diagnostic_group.
4409 2020-01-28 Martin Liska <mliska@suse.cz>
4412 * pt.c (redeclare_class_template): Use inform
4413 for the second location.
4415 2020-01-27 Jason Merrill <jason@redhat.com>
4418 * pt.c (tsubst_copy) [STRING_CST]: Don't use fold_convert.
4420 2020-01-27 Iain Sandoe <iain@sandoe.co.uk>
4423 * coroutines.cc (morph_fn_to_coro): Check the ramp return
4424 value when it is constructed from the 'get return object'.
4426 2020-01-27 Nathan Sidwell <nathan@acm.org>
4429 * name-lookup.c (is_ancestor): Allow CHILD to be a namespace alias.
4431 2020-01-26 Jason Merrill <jason@redhat.com>
4434 * except.c (maybe_noexcept_warning): Check DECL_IN_SYSTEM_HEADER and
4435 temporarily enable -Wsystem-headers. Change second warning to
4439 * semantics.c (finish_call_expr): Don't call
4440 instantiate_non_dependent_expr before warn_for_memset.
4442 2020-01-25 Marek Polacek <polacek@redhat.com>
4444 PR c++/93414 - poor diagnostic for dynamic_cast in constexpr context.
4445 * constexpr.c (cxx_eval_dynamic_cast_fn): Add a reference
4446 dynamic_cast diagnostic.
4448 2020-01-24 Jason Merrill <jason@redhat.com>
4450 PR c++/93400 - ICE with constrained friend.
4451 * constraint.cc (maybe_substitute_reqs_for): New.
4452 * decl.c (function_requirements_equivalent_p): Call it.
4453 * pt.c (tsubst_friend_function): Only substitute
4454 TEMPLATE_PARMS_CONSTRAINTS.
4455 (tsubst_template_parms): Copy constraints.
4457 2020-01-24 Jason Merrill <jason@redhat.com>
4459 PR c++/93279 - ICE with lambda in member operator.
4460 * name-lookup.c (maybe_save_operator_binding): Don't remember
4461 class-scope bindings.
4463 2020-01-24 Jason Merrill <jason@redhat.com>
4465 PR c++/93377 - ICE with member alias in constraint.
4466 * pt.c (any_template_parm_r): Look at template arguments for all
4467 aliases, not only alias templates.
4469 2020-01-24 Marek Polacek <polacek@redhat.com>
4471 PR c++/93299 - ICE in tsubst_copy with parenthesized expression.
4472 * pt.c (tsubst_copy): Handle a REF_PARENTHESIZED_P VIEW_CONVERT_EXPR.
4474 2020-01-24 Jason Merrill <jason@redhat.com>
4476 PR c++/92852 - ICE with generic lambda and reference var.
4477 * constexpr.c (maybe_constant_value): Likewise.
4479 2020-01-23 Paolo Carlini <paolo.carlini@oracle.com>
4482 * parser.c (cp_parser_nested_name_specifier_opt): Properly
4483 diagnose concept-ids.
4485 2020-01-23 Jason Merrill <jason@redhat.com>
4487 PR c++/93331 - ICE with __builtin_strchr.
4488 * constexpr.c (cxx_eval_builtin_function_call): Use the original
4489 argument if we didn't manage to extract a STRING_CST.
4491 PR c++/93345 - ICE with defaulted dtor and template.
4493 * decl.c (cxx_maybe_build_cleanup): Don't try to set
4494 throwing_cleanup in a template.
4496 2020-01-22 Marek Polacek <polacek@redhat.com>
4498 PR c++/92907 - noexcept does not consider "const" in member functions.
4499 * g++.dg/cpp0x/noexcept56.C: New test.
4501 2020-01-22 Marek Polacek <polacek@redhat.com>
4503 PR c++/93324 - ICE with -Wall on constexpr if.
4504 * semantics.c (is_std_constant_evaluated_p): Check fndecl.
4506 2020-01-22 Patrick Palka <ppalka@redhat.com>
4508 * constraint.cc (get_mapped_args): Avoid using auto_vec
4509 as a vector element. Release the vectors inside the lists
4511 * parser.c (cp_literal_operator_id): Free the buffer.
4513 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
4515 * coroutines.cc (finish_co_await_expr): Add error check on return
4516 value of build_co_await.
4517 (finish_co_yield_expr,): Ditto.
4519 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
4521 * coroutines.cc (lookup_awaitable_member): Lookup an awaitable member.
4522 (lookup_promise_method): Emit diagnostic when get NULL_TREE back only.
4523 (build_co_await): Use lookup_awaitable_member instead of lookup_member.
4525 2020-01-21 Jason Merrill <jason@redhat.com>
4527 PR c++/60855 - ICE with sizeof VLA capture.
4528 * lambda.c (is_lambda_ignored_entity): Don't look past VLA capture.
4530 PR c++/90732 - ICE with VLA capture and generic lambda.
4531 * pt.c (tsubst_lambda_expr): Repeat add_capture for VLAs.
4533 2020-01-21 Iain Sandoe <iain@sandoe.co.uk>
4534 Bin Cheng <bin.cheng@linux.alibaba.com>
4536 * coroutines.cc (coro_promise_type_found_p): Check for NULL return
4537 from complete_type_or_else.
4538 (register_param_uses): Likewise.
4539 (build_co_await): Do not try to use complete_type_or_else for void
4540 types, otherwise for incomplete types, check for NULL return from
4541 complete_type_or_else.
4543 2020-01-21 Jason Merrill <jason@redhat.com>
4545 PR c++/91476 - anon-namespace reference temp clash between TUs.
4546 * decl2.c (copy_linkage): Factor out of get_guard.
4547 * call.c (make_temporary_var_for_ref_to_temp): Use it.
4548 * decl.c (cp_finish_decomp): Use it.
4549 (cp_finish_decl): determine_visibility sooner.
4551 2020-01-21 Bin Cheng <bin.cheng@linux.alibaba.com>
4553 * coroutines.cc (finish_co_await_expr): Set return value flag.
4554 (finish_co_yield_expr, morph_fn_to_coro): Ditto.
4556 2020-01-19 Jason Merrill <jason@redhat.com>
4558 PR c++/33799 - destroy return value, take 2.
4559 * cp-tree.h (current_retval_sentinel): New macro.
4560 (struct language_function): Add throwing_cleanup bitfield.
4561 * decl.c (cxx_maybe_build_cleanup): Set it.
4562 * except.c (maybe_set_retval_sentinel)
4563 (maybe_splice_retval_cleanup): New functions.
4564 * parser.c (cp_parser_compound_statement): Call
4565 maybe_splice_retval_cleanup.
4566 * typeck.c (check_return_expr): Call maybe_set_retval_sentinel.
4568 * parser.c (cp_parser_lambda_body): Use cp_parser_function_body.
4570 2020-01-18 Jakub Jelinek <jakub@redhat.com>
4572 * coroutines.cc (get_fn_local_identifier): Fix NO_DOT_IN_LABEL
4573 but non-NO_DOLLAR_IN_LABEL case build.
4575 2020-01-18 Iain Sandoe <iain@sandoe.co.uk>
4577 * Make-lang.in: Add coroutines.o.
4578 * cp-tree.h (lang_decl-fn): coroutine_p, new bit.
4579 (DECL_COROUTINE_P): New.
4580 * lex.c (init_reswords): Enable keywords when the coroutine flag
4582 * operators.def (co_await): New operator.
4583 * call.c (add_builtin_candidates): Handle CO_AWAIT_EXPR.
4584 (op_error): Likewise.
4585 (build_new_op_1): Likewise.
4586 (build_new_function_call): Validate coroutine builtin arguments.
4587 * constexpr.c (potential_constant_expression_1): Handle
4588 CO_AWAIT_EXPR, CO_YIELD_EXPR, CO_RETURN_EXPR.
4589 * coroutines.cc: New file.
4590 * cp-objcp-common.c (cp_common_init_ts): Add CO_AWAIT_EXPR,
4591 CO_YIELD_EXPR, CO_RETRN_EXPR as TS expressions.
4592 * cp-tree.def (CO_AWAIT_EXPR, CO_YIELD_EXPR, (CO_RETURN_EXPR): New.
4593 * cp-tree.h (coro_validate_builtin_call): New.
4594 * decl.c (emit_coro_helper): New.
4595 (finish_function): Handle the case when a function is found to
4596 be a coroutine, perform the outlining and emit the outlined
4597 functions. Set a bit to signal that this is a coroutine component.
4598 * parser.c (enum required_token): New enumeration RT_CO_YIELD.
4599 (cp_parser_unary_expression): Handle co_await.
4600 (cp_parser_assignment_expression): Handle co_yield.
4601 (cp_parser_statement): Handle RID_CO_RETURN.
4602 (cp_parser_jump_statement): Handle co_return.
4603 (cp_parser_operator): Handle co_await operator.
4604 (cp_parser_yield_expression): New.
4605 (cp_parser_required_error): Handle RT_CO_YIELD.
4606 * pt.c (tsubst_copy): Handle CO_AWAIT_EXPR.
4607 (tsubst_expr): Handle CO_AWAIT_EXPR, CO_YIELD_EXPR and
4609 * tree.c (cp_walk_subtrees): Likewise.
4611 2020-01-17 Jason Merrill <jason@redhat.com>
4613 PR c++/92531 - ICE with noexcept(lambda).
4614 * pt.c (uses_template_parms): Don't try to enumerate all the
4617 2020-01-17 Jakub Jelinek <jakub@redhat.com>
4620 * parser.c (cp_parser_template_name): Look up deprecated attribute
4621 in DECL_TEMPLATE_RESULT or its type's attributes.
4623 2020-01-16 Jason Merrill <jason@redhat.com>
4625 PR c++/93286 - ICE with __is_constructible and variadic template.
4626 * pt.c (tsubst) [TREE_LIST]: Handle pack expansion.
4627 (tsubst_copy_and_build) [TRAIT_EXPR]: Always use tsubst for type2.
4629 PR c++/93280 - ICE with aggregate assignment and DMI.
4630 * init.c (get_nsdmi): Set TARGET_EXPR_DIRECT_INIT_P here.
4631 * typeck2.c (digest_nsdmi_init): Not here.
4633 2020-01-15 Paolo Carlini <paolo.carlini@oracle.com>
4636 * cp-tree.h (is_constrained_auto): New.
4637 * parser.c (cp_parser_maybe_commit_to_declaration): Correctly
4638 handle concept-check expressions; take a cp_decl_specifier_seq*
4640 (cp_parser_condition): Update call.
4641 (cp_parser_simple_declaration): Likewise.
4642 (cp_parser_placeholder_type_specifier): Correctly handle
4643 concept-check expressions.
4645 2020-01-15 Jason Merrill <jason@redhat.com>
4648 PR c++/33799 - destroy return value if local cleanup throws.
4649 * cp-tree.h (current_retval_sentinel): New macro.
4650 * decl.c (start_preparsed_function): Set up cleanup for retval.
4651 * typeck.c (check_return_expr): Set current_retval_sentinel.
4653 PR c++/93257 - consteval void function.
4654 * constexpr.c (verify_constant): Allow void_node.
4656 PR c++/92871 - bad code with xvalue and GNU ?: extension.
4657 * call.c (prevent_lifetime_extension): New.
4658 (build_conditional_expr_1): Use it.
4660 2020-01-14 Nathan Sidwell <nathan@acm.org>
4663 * pt.c (retrieve_specialization): Use get_template_info, not open
4667 * pt.c (retrieve_specialization): Get the TI from the decl or the
4668 classtype as appropriate.
4670 2020-01-14 David Malcolm <dmalcolm@redhat.com>
4672 * cp-gimplify.c (source_location_table_entry_hash::empty_zero_p):
4673 New static constant.
4674 * cp-tree.h (named_decl_hash::empty_zero_p): Likewise.
4675 (struct named_label_hash::empty_zero_p): Likewise.
4676 * decl2.c (mangled_decl_hash::empty_zero_p): Likewise.
4678 2020-01-14 Jason Merrill <jason@redhat.com>
4680 PR c++/92590 - wrong handling of inherited default ctor.
4681 * class.c (add_method): A constrained inherited ctor doesn't hide an
4682 implicit derived ctor.
4684 PR c++/92552 - ICE with inherited constrained default ctor.
4685 * pt.c (instantiate_class_template_1): Copy
4686 TYPE_HAS_USER_CONSTRUCTOR.
4687 PR c++/91930 - ICE with constrained inherited default ctor.
4688 * name-lookup.c (do_class_using_decl): Set TYPE_HAS_USER_CONSTRUCTOR
4689 for inherited constructor.
4690 PR c++/92594 - ICE with inherited trivial default ctor.
4691 * method.c (trivial_fn_p): Treat an inherited default constructor
4692 like a normal default constructor.
4694 PR c++/92594 - ICE with inherited trivial default ctor.
4695 * method.c (trivial_fn_p): Treat an inherited default constructor
4696 like a normal default constructor.
4698 PR c++/92009 - ICE with punning of typeid.
4699 * rtti.c (get_tinfo_desc): Call xref_basetypes.
4700 * constexpr.c (cxx_fold_indirect_ref): Don't strip
4703 2020-01-13 Jason Merrill <jason@redhat.com>
4705 PR c++/92746 - ICE with noexcept of function concept check.
4706 * except.c (check_noexcept_r): Handle concept-check.
4708 PR c++/92582 - ICE with member template as requirement.
4709 * pt.c (struct find_template_parameter_info): Add ctx_parms.
4710 (any_template_parm_r): Handle TEMPLATE_DECL.
4711 (find_template_parameters): Take parms instead of their depth.
4712 * constraint.cc (build_parameter_mapping): Pass them.
4714 PR c++/33799 - destroy return value if local cleanup throws.
4715 * cp-tree.h (current_retval_sentinel): New macro.
4716 * decl.c (start_preparsed_function): Set up cleanup for retval.
4717 * typeck.c (check_return_expr): Set current_retval_sentinel.
4719 PR c++/93238 - short right-shift with enum.
4720 * typeck.c (cp_build_binary_op): Use folded op1 for short_shift.
4722 2020-01-10 Jason Merrill <jason@redhat.com>
4724 * typeck.c (cp_build_binary_op): Restore short_shift code.
4726 PR c++/93143 - incorrect tree sharing with constexpr.
4727 * constexpr.c (cxx_eval_outermost_constant_expr): Don't assume
4728 CONSTRUCTORs are already unshared.
4730 PR c++/93173 - incorrect tree sharing.
4732 * cp-gimplify.c (cp_gimplify_init_expr, cp_gimplify_expr): Use
4733 copy_if_shared after cp_genericize_tree.
4734 * typeck2.c (split_nonconstant_init): Don't unshare here.
4736 2020-01-08 Jason Merrill <jason@redhat.com>
4738 * cp-gimplify.c (cp_gimplify_expr) [TARGET_EXPR]: Check
4739 TARGET_EXPR_DIRECT_INIT_P.
4740 * constexpr.c (cxx_eval_constant_expression): Likewise.
4742 2020-01-08 Jason Merrill <jason@redhat.com>
4744 PR c++/91369 - constexpr destructor and member initializer.
4745 * constexpr.c (cxx_eval_store_expression): Look through TARGET_EXPR
4746 when not preevaluating.
4748 2020-01-08 Jason Merrill <jason@redhat.com>
4750 * constexpr.c (cxx_eval_call_expression): Remove DECL_BY_REFERENCE
4753 2020-01-07 Paolo Carlini <paolo.carlini@oracle.com>
4755 * init.c (build_new): Add location_t parameter and use it throughout.
4756 (build_raw_new_expr): Likewise.
4757 * parser.c (cp_parser_new_expression): Pass the combined_loc.
4758 * pt.c (tsubst_copy_and_build): Adjust call.
4759 * cp-tree.h: Update declarations.
4761 2020-01-07 Jason Merrill <jason@redhat.com>
4763 PR c++/47877 - -fvisibility-inlines-hidden and member templates.
4764 * decl2.c (determine_visibility): -fvisibility-inlines-hidden beats
4765 explicit class visibility for a template.
4767 2020-01-07 Richard Sandiford <richard.sandiford@arm.com>
4769 * mangle.c (mangle_type_attribute_p): New function, split out from...
4770 (write_CV_qualifiers_for_type): ...here. Don't mangle attributes
4771 that contain a space.
4773 2020-01-07 Jakub Jelinek <jakub@redhat.com>
4776 * constexpr.c (struct constexpr_global_ctx): Add heap_alloc_count
4777 member, initialize it to zero in ctor.
4778 (cxx_eval_call_expression): Bump heap_dealloc_count when deleting
4779 a heap object. Don't cache calls to functions which allocate some
4780 heap objects and don't deallocate them or deallocate some heap
4781 objects they didn't allocate.
4783 2020-01-06 Jason Merrill <jason@redhat.com>
4785 PR c++/92552 - ICE with inherited constrained default ctor.
4786 * pt.c (instantiate_class_template_1): Copy
4787 TYPE_HAS_USER_CONSTRUCTOR.
4788 * class.c (one_inherited_ctor): Don't set it here.
4790 2020-01-06 Andrew Sutton <asutton@lock3software.com>
4792 PR c++/92739 - parsing requires clause with attributes.
4793 * parser.c (cp_parser_constraint_requires_parens): Exclude
4794 attributes as postfix expressions.
4796 2020-01-05 Jakub Jelinek <jakub@redhat.com>
4799 * parser.c (cp_parser_check_class_key): Disable access checks for the
4801 (cp_parser_maybe_warn_enum_key): Likewise. Return early if
4802 !warn_redundant_tags.
4804 2010-01-05 Jakub Jelinek <jakub@redhat.com>
4807 * cp-gimplify.c (cp_gimplify_init_expr): Don't look through
4808 TARGET_EXPR if it has been gimplified already.
4810 2020-01-03 Jason Merrill <jason@redhat.com>
4812 PR c++/93033 - incorrect tree node sharing with array init.
4813 * typeck2.c (split_nonconstant_init): Unshare non-decl.
4814 * cp-gimplify.c (cp_gimplify_init_expr): Only split if -fexceptions.
4816 2020-01-02 Jason Merrill <jason@redhat.com>
4818 * pt.c (invalid_nontype_parm_type_p): Reject class placeholder in
4821 2020-01-02 Jakub Jelinek <jakub@redhat.com>
4824 * cp-objcp-common.c (identifier_global_tag): Return NULL_TREE if name
4825 has not been found, rather than error_mark_node.
4827 2020-01-01 Jakub Jelinek <jakub@redhat.com>
4829 Update copyright years.
4831 Copyright (C) 2020 Free Software Foundation, Inc.
4833 Copying and distribution of this file, with or without modification,
4834 are permitted in any medium without royalty provided the copyright
4835 notice and this notice are preserved.