1 2020-11-09 Marek Polacek <polacek@redhat.com>
4 * parser.c (cp_parser_check_std_attribute): Return bool. Add a
5 location_t parameter. Return true if the attribute wasn't duplicated.
6 Give a warning instead of an error. Check more attributes.
7 (cp_parser_std_attribute_list): Don't add duplicated attributes to
8 the list. Pass location to cp_parser_check_std_attribute.
10 2020-11-09 Patrick Palka <ppalka@redhat.com>
12 * constraint.cc (norm_info::norm_info): Initialize orig_decl.
13 (norm_info::orig_decl): New data member.
14 (normalize_atom): When caching an atom for the first time,
15 compute a list of template parameters used in the targets of the
16 parameter mapping and store it in the TREE_TYPE of the mapping.
17 (get_normalized_constraints_from_decl): Set current_function_decl
18 appropriately when normalizing. As an optimization, don't
19 set up a push_nested_class_guard when decl has no constraints.
20 (sat_hasher::hash): Use this list to hash only the template
21 arguments that are relevant to the atom.
22 (satisfy_atom): Use this list to compare only the template
23 arguments that are relevant to the atom.
24 * pt.c (keep_template_parm): Do a sanity check on the parameter's
25 index when flag_checking.
27 2020-11-09 Patrick Palka <ppalka@redhat.com>
29 * cp-tree.h (ATOMIC_CONSTR_MAP_INSTANTIATED_P): Define this flag
31 * constraint.cc (sat_hasher::hash): Use hash_atomic_constraint
32 if the flag is set, otherwise keep using a pointer hash.
33 (sat_hasher::equal): Return false if the flag's setting differs
34 on two atoms. Call atomic_constraints_identical_p if the flag
35 is set, otherwise keep using a pointer equality test.
36 (satisfy_atom): After instantiating the parameter mapping, form
37 another ATOMIC_CONSTR using the instantiated mapping and query
38 the cache again. Cache the satisfaction value of both atoms.
39 (diagnose_atomic_constraint): Simplify now that the supplied
40 atom has an instantiated mapping.
42 2020-11-09 Patrick Palka <ppalka@redhat.com>
44 * constraint.cc (atom_cache): Define this deletable hash_table.
45 (normalize_atom): Use it to cache ATOMIC_CONSTRs when not
46 generating diagnostics.
47 (sat_hasher::hash): Use htab_hash_pointer instead of
48 hash_atomic_constraint.
49 (sat_hasher::equal): Test for pointer equality instead of
50 atomic_constraints_identical_p.
51 * cp-tree.h (struct atom_hasher): Moved and renamed from ...
52 * logic.cc (struct constraint_hash): ... here.
53 (clause::m_set): Adjust accordingly.
55 2020-11-09 Patrick Palka <ppalka@redhat.com>
58 * constraint.cc (tsubst_parameter_mapping): Also canonicalize
59 the type arguments of a TYPE_ARGUMENT_PACk.
61 2020-11-09 Jason Merrill <jason@redhat.com>
63 * pt.c (tsubst): Replace *_ARGUMENT_PACK code with
64 a call to tsubst_argument_pack.
66 2020-11-09 Jason Merrill <jason@redhat.com>
68 * class.c (handle_using_decl): Add an iloc_sentinel.
70 2020-11-09 Marek Polacek <polacek@redhat.com>
73 * parser.c (warn_about_ambiguous_parse): Handle the case when
74 there is no type in the decl-specifiers.
76 2020-11-09 Nathan Sidwell <nathan@acm.org>
78 * cp-tree.h (LOOKUP_FOUND_P): Add ENUMERAL_TYPE.
79 * name-lookup.c (class name_lookup): Add comments.
80 (name_lookup::adl_namespace_only): Replace with ...
81 (name_lookup::adl_class_fns): ... this and ...
82 (name_lookup::adl_namespace_fns): ... this.
83 (name_lookup::adl_namespace): Deal with inline nests here.
84 (name_lookup::adl_class): Complete the type here.
85 (name_lookup::adl_type): Call broken-out enum ..
86 (name_lookup::adl_enum): New. No need to call the namespace adl
88 (name_lookup::search_adl): Iterate over collected scopes here.
90 2020-11-09 Nathan Sidwell <nathan@acm.org>
92 * name-lookup.c (lookup_qualified_name): Expose an overload of a
93 singleton with known type.
94 (lookup_name_1): Just check the overload's type to expose it.
95 * parser.c (cp_parser_lookup_name): Do not do that check here.
97 2020-11-08 Iain Sandoe <iain@sandoe.co.uk>
99 * parser.c (cp_parser_objc_at_property_declaration): Handle
100 class keywords in @property attribute context.
102 2020-11-06 Marek Polacek <polacek@redhat.com>
105 * except.c (can_convert_eh): Change the return type to bool. If
106 the type TO and FROM are the same, return true.
108 2020-11-06 Iain Sandoe <iain@sandoe.co.uk>
110 * parser.c (cp_parser_objc_at_property_declaration):
111 Improve parsing fidelity. Associate better location info
112 with @property attributes. Clean up the interface to
113 objc_add_property_declaration ().
115 2020-11-06 Jakub Jelinek <jakub@redhat.com>
118 * decl.c (duplicate_decls): Propagate DECL_ATTRIBUTES and
119 DECL_PRESERVE_P from olddecl to its clones if any.
121 2020-11-06 Nathan Sidwell <nathan@acm.org>
123 * cp-tree.h (DECL_UNDECLARED_BUILTIN_P): Delete.
124 * cp-objcp-common.c (names_bultin_p): Rename
125 DECL_IS_BUILTIN->DECL_IS_UNDECLARED_BUILTIN.
126 * decl.c (decls_match): Likewise. Replace
127 DECL_UNDECLARED_BUILTIN_P with DECL_IS_UNDECLARED_BUILTIN.
128 (duplicate_decls): Likewise.
129 * decl2.c (collect_source_refs): Likewise.
130 * name-lookup.c (anticipated_builtin_p, print_binding_level)
131 (do_nonmember_using_decl): Likewise.
132 * pt.c (builtin_pack_fn_p): Likewise.
133 * typeck.c (error_args_num): Likewise.
135 2020-11-06 Nathan Sidwell <nathan@acm.org>
137 * parser.c (cp_parser_template_declaration): Adjust 'export' warning.
138 (cp_parser_explicit_specialization): Remove unneeded bool setting.
140 2020-11-06 Jan Hubicka <jh@suse.cz>
142 * tree.c (cp_fix_function_decl_p): Do not access ipa_ref_list dirrectly.
144 2020-11-06 Tobias Burnus <tobias@codesourcery.com>
146 * parser.c (cp_parser_omp_atomic): Add openacc parameter and update
148 (cp_parser_omp_construct): Update call.
150 2020-11-05 Marek Polacek <polacek@redhat.com>
152 * except.c (check_handlers_1): Add auto_diagnostic_group.
154 2020-11-05 Marek Polacek <polacek@redhat.com>
157 * pt.c (do_auto_deduction): If init is REFERENCE_REF_P, use its
160 2020-11-05 Marek Polacek <polacek@redhat.com>
163 * except.c (check_handlers_1): Use OPT_Wexceptions for the
164 warning. Use inform for the second part of the warning.
166 2020-11-05 Marek Polacek <polacek@redhat.com>
169 * cp-tree.h (enum cp_tree_index): Add CPTI_EXPLICIT_VOID_LIST.
170 (explicit_void_list_node): Define.
171 (PARENTHESIZED_LIST_P): New macro.
172 (struct cp_declarator): Add function::parens_loc.
173 * decl.c (cxx_init_decl_processing): Initialize explicit_void_list_node.
174 (grokparms): Also break when explicit_void_list_node.
175 * parser.c (make_call_declarator): New location_t parameter. Use it
176 to set declarator->u.function.parens_loc.
177 (cp_parser_lambda_declarator_opt): Pass UNKNOWN_LOCATION to
178 make_call_declarator.
179 (warn_about_ambiguous_parse): New function.
180 (cp_parser_init_declarator): Call warn_about_ambiguous_parse.
181 (cp_parser_declarator): Set *parenthesized_p to false rather than to
183 (cp_parser_direct_declarator): Create a location for the function's
184 parentheses and pass it to make_call_declarator.
185 (cp_parser_parameter_declaration_clause): Return explicit_void_list_node
187 (cp_parser_parameter_declaration_list): Set PARENTHESIZED_LIST_P
188 in the parameters tree.
190 2020-11-04 Jakub Jelinek <jakub@redhat.com>
193 * semantics.c (finish_omp_clauses): Look through array reductions to
194 find underlying decl to clear in the aligned_head bitmap. Use
195 DECL_UID (t) instead of DECL_UID (OMP_CLAUSE_DECL (c)) when clearing
196 in the bitmap. Only diagnose errors about allocate vars not being
197 privatized on the same construct on allocate clause if it has
198 a DECL_P OMP_CLAUSE_DECL.
200 2020-11-04 Iain Sandoe <iain@sandoe.co.uk>
202 * constexpr.c (potential_constant_expression_1): Handle
203 expressions known to be non-constant for Objective-C.
205 2020-11-03 Jason Merrill <jason@redhat.com>
207 * tree.c (is_byte_access_type): Don't use char_type_p.
209 2020-11-03 Jakub Jelinek <jakub@redhat.com>
212 * parser.c (cp_parser_init_declarator): Don't try to parse
213 C++17 deduction guides if there are any type specifiers even when
216 2020-11-03 Kamlesh Kumar <kamleshbhalui@gmail.com>
217 Jason Merrill <jason@redhat.com>
221 * pt.c (get_template_base): Consider closest base in template
222 deduction when base of base also matches.
224 2020-11-03 Nathan Sidwell <nathan@acm.org>
226 * pt.c (tsubst_expr): Simplify using decl instantiation, add
229 2020-11-03 Nathan Sidwell <nathan@acm.org>
231 * class.c (copy_fndecl_with_name): Always not top level.
232 (build_cdtor_clones): Add update_methods parm, use it to
233 conditionally update the method vec. Return void
234 (clone_cdtor): Adjust.
235 (clone_constructors_and_destructors): Adjust comment.
237 2020-11-03 Nathan Sidwell <nathan@acm.org>
239 * pt.c (primary_template_specialization_p): Use
240 VAR_OR_FUNCTION_DECL_P.
241 (tsubst_template_decl): Check for FUNCTION_DECL, not !TYPE && !VAR
242 for registering a specialization.
244 2020-11-03 Nathan Sidwell <nathan@acm.org>
246 * cp-tree.h (fixup_deferred_exception_variants): Declare.
247 * parser.c (cp_parser_class_specifier_1): Call it when
248 completing deferred parses rather than creating a variant.
249 (cp_parser_member_declaration): Move comment from ...
250 (cp_parser_noexcept_specification_opt): ... here. Refactor the
252 * tree.c (fixup_deferred_exception_variants): New.
254 2020-11-03 Nathan Sidwell <nathan@acm.org>
256 * pt.c (tsubst_lambda_expr): Reorder extra-scope handling to match
257 the non-template case.
258 (instantiate_body): Move a couple of declarations to their
261 2020-11-03 Nathan Sidwell <nathan@acm.org>
263 * decl.c (duplicate_decls): Return error_mark_node fo extern-c
266 2020-11-03 Marek Polacek <polacek@redhat.com>
268 * constexpr.c (potential_constant_expression_1): Treat
269 __PRETTY_FUNCTION__ inside a template function as
270 potentially-constant.
271 * pt.c (uses_template_parms): Call
272 instantiation_dependent_expression_p instead of
273 value_dependent_expression_p.
274 (instantiation_dependent_expression_p): Check
275 potential_constant_expression before calling
276 value_dependent_expression_p.
278 2020-11-03 Marek Polacek <polacek@redhat.com>
281 * init.c (build_new_1): Disable -Winit-list-lifetime for an unevaluated
284 2020-11-03 Nathan Sidwell <nathan@acm.org>
286 * tree.c (bind_template_template_parm): Mark the parm as a
288 (cp_tree_equal): Refactor CALL_EXPR. Use comp_template_args for
291 2020-11-03 Nathan Sidwell <nathan@acm.org>
293 * rtti.c (init_rtti_processing): Move var decl to its init.
294 (get_tinfo_decl): Likewise. Break out creation to called helper
296 (get_tinfo_decl_direct): ... here.
297 (build_dynamic_cast_1): Move var decls to their initializers.
298 (tinfo_base_init): Set decl's location to BUILTINS_LOCATION.
299 (get_tinfo_desc): Only push ABI namespace when needed. Set type's
302 2020-11-02 Nathan Sidwell <nathan@acm.org>
304 * decl.c (start_decl_1): Refactor declarations. Fixup some
306 (lookup_and_check_tag): Fixup some whitespace.
308 2020-11-02 Nathan Sidwell <nathan@acm.org>
310 * decl.c (duplicate_decls): Refactor some template & builtin
313 2020-11-02 Nathan Sidwell <nathan@acm.org>
315 * cp-tree.h (struct cxx_int_tree_map): Delete.
316 (struct cxx_int_tree_map_hasher): Delete.
317 * cp-gimplify.c (cxx_int_tree_map_hasher::equal): Delete.
318 (cxx_int_tree_map_hasher::hash): Delete.
320 2020-11-02 Patrick Palka <ppalka@redhat.com>
322 * class.c (finish_struct_1): Don't call clear_satisfaction_cache.
323 * constexpr.c (clear_cv_and_fold_caches): Likewise. Remove bool
325 * constraint.cc (clear_satisfaction_cache): Remove definition.
326 * cp-tree.h (clear_satisfaction_cache): Remove declaration.
327 (clear_cv_and_fold_caches): Remove bool parameter.
328 * typeck2.c (store_init_value): Remove argument to
329 clear_cv_and_fold_caches.
331 2020-11-01 Iain Sandoe <iain@sandoe.co.uk>
333 * parser.c (cp_parser_objc_at_property_declaration): Use any
334 exisiting syntax error to suppress complaints about a missing
335 closing parenthesis in parsing property attributes.
337 2020-10-30 Jakub Jelinek <jakub@redhat.com>
339 * semantics.c (finish_omp_clauses) <case OMP_CLAUSE_ALLOCATE>: Handle
340 non-static members in methods.
341 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_ALLOCATE.
343 2020-10-29 Marek Polacek <polacek@redhat.com>
347 * parser.c (cp_parser_type_id_1): Reject using auto as
348 a template-argument in C++20.
350 2020-10-29 Marek Polacek <polacek@redhat.com>
353 * pt.c (do_auto_deduction): Call resolve_nondeduced_context for
354 the elements of a { } list.
356 2020-10-29 Marek Polacek <polacek@redhat.com>
358 * typeck.c (do_warn_enum_conversions): Don't warn for SPACESHIP_EXPR.
359 (cp_build_binary_op): Reject float <=> enum or enum <=> float. Use
360 CP_INTEGRAL_TYPE_P instead of INTEGRAL_OR_ENUMERATION_TYPE_P.
362 2020-10-29 Patrick Palka <ppalka@redhat.com>
364 * constraint.cc (get_normalized_constraints): Remove 'args'
365 parameter. Pass NULL_TREE as the initial template arguments to
366 normalize_expression.
367 (get_normalized_constraints_from_info): Remove 'args' parameter
368 and adjust the call to get_normalized_constraints.
369 (get_normalized_constraints_from_decl): Remove 'args' local
370 variable and adjust call to get_normalized_constraints_from_info.
371 (normalize_concept_definition): Remove 'args' local variable
372 and adjust call to get_normalized_constraints.
373 (normalize_constraint_expression): Remove the two-parameter
374 overload. Remove 'args' parameter from the three-parameter
375 overload and update function comment accordingly. Remove
376 default argument from 'diag' parameter. Adjust call to
377 get_normalized_constraints.
378 (finish_nested_requirement): Adjust call to
379 normalize_constraint_expression.
380 (strictly_subsumes): Remove 'args' parameter. Adjust call to
381 get_normalized_constraints_from_info.
382 (weakly_subsumes): Likewise.
383 * cp-tree.h (strictly_subsumes): Remove 'args' parameter.
384 (weakly_subsumes): Likewise.
385 * pt.c (process_partial_specialization): Adjust call to
387 (is_compatible_template_arg): Adjust call to weakly_subsumes.
389 2020-10-29 Patrick Palka <ppalka@redhat.com>
392 * constraint.cc (normalize_concept_check): Don't call
393 tsubst_template_args when 'args' is NULL.
395 2020-10-29 Jason Merrill <jason@redhat.com>
398 * constexpr.c (cxx_eval_outermost_constant_expr): Revert to
399 original expression if evaluation sets non_constant_p.
401 2020-10-29 Jakub Jelinek <jakub@redhat.com>
402 Jason Merrill <jason@redhat.com>
405 * constexpr.c (cxx_bind_parameters_in_call): Set non_constant_args
406 if the parameter type has a non-trivial destructor.
407 (cxx_eval_call_expression): Only unshare arguments if we're
408 memoizing this evaluation.
410 2020-10-29 Jakub Jelinek <jakub@redhat.com>
413 * cp-tree.h (enum cp_tree_index): Add CPTI_HEAP_VEC_UNINIT_IDENTIFIER
414 and CPTI_HEAP_VEC_IDENTIFIER.
415 (heap_vec_uninit_identifier, heap_vec_identifier): Define.
416 * decl.c (initialize_predefined_identifiers): Initialize those
418 * constexpr.c (cxx_eval_call_expression): Reject array allocations
419 deallocated with non-array deallocation or non-array allocations
420 deallocated with array deallocation.
421 (non_const_var_error): Handle heap_vec_uninit_identifier and
422 heap_vec_identifier too.
423 (cxx_eval_constant_expression): Handle also heap_vec_uninit_identifier
424 and in that case during initialization replace it with
426 (find_heap_var_refs): Handle heap_vec_uninit_identifier and
427 heap_vec_identifier too.
429 2020-10-29 Nathan Sidwell <nathan@acm.org>
431 * pt.c (push_template_decl): Do not give function-scope entities
432 other than implicit typedefs a template header. Do not readd
433 template info to a redeclared template.
435 2020-10-28 Marek Polacek <polacek@redhat.com>
437 * decl.c (grokdeclarator): Offer a fix-it hint for the "unnecessary
438 parentheses in declaration" warning.
439 * parser.c (cp_parser_direct_declarator): When setting
440 declarator->parenthesized, use a location range.
442 2020-10-28 Marek Polacek <polacek@redhat.com>
445 * call.c (build_conditional_expr_1): Warn about the deprecated
446 enum/real type conversion in C++20. Also warn about a non-enumerated
447 and enumerated type in ?: when -Wenum-conversion is on.
448 * typeck.c (do_warn_enum_conversions): New function.
449 (cp_build_binary_op): Call it.
451 2020-10-28 Marek Polacek <polacek@redhat.com>
455 * pt.c (tsubst_copy_and_build): Call value_dependent_expression_p or
456 type_dependent_expression_p instead of type_dependent_expression_p_push.
457 But only call value_dependent_expression_p for expressions that are
458 potential_constant_expression.
460 2020-10-28 Marek Polacek <polacek@redhat.com>
463 * parser.c (cp_parser_class_name): Use parser->scope when
466 2020-10-28 Marek Polacek <polacek@redhat.com>
469 * parser.c (cp_parser_fold_expression): Return error_mark_node
470 if a left fold is preceded by an expression.
472 2020-10-28 Nathan Sidwell <nathan@acm.org>
474 * parser.c (cp_parser_omp_declare_reduction): Set
475 DECL_LOCAL_DECL_P before push_template_decl.
476 * pt.c (instantiate_body): Nested fns do not have template_info.
478 2020-10-28 Patrick Palka <ppalka@redhat.com>
481 * decl2.c (mark_used): Move up the constraints_satisfied_p check
482 so that we check constraints before calling maybe_instantiate_decl.
484 2020-10-28 Nathan Sidwell <nathan@acm.org>
486 * pt.c (push_template_decl): Refactor for some RAII.
488 2020-10-28 Jakub Jelinek <jakub@redhat.com>
490 * parser.c (cp_parser_omp_clause_name): Handle allocate.
491 (cp_parser_omp_clause_allocate): New function.
492 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_ALLOCATE.
493 (OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK,
494 OMP_PARALLEL_CLAUSE_MASK, OMP_SINGLE_CLAUSE_MASK,
495 OMP_TASK_CLAUSE_MASK, OMP_TASKGROUP_CLAUSE_MASK,
496 OMP_DISTRIBUTE_CLAUSE_MASK, OMP_TEAMS_CLAUSE_MASK,
497 OMP_TARGET_CLAUSE_MASK, OMP_TASKLOOP_CLAUSE_MASK): Add
498 PRAGMA_OMP_CLAUSE_ALLOCATE.
499 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_ALLOCATE.
500 * pt.c (tsubst_omp_clauses): Likewise.
502 2020-10-27 Nathan Sidwell <nathan@acm.org>
504 * cp-tree.h (struct lang_type): Delete nested_udts field.
505 (CLASSTYPE_NESTED_UTDS): Delete.
506 * name-lookup.h (binding_table, binding_entry): Delete typedefs.
507 (bt_foreach_proc): Likewise.
508 (struct binding_entry_s): Delete.
509 (SCOPE_DEFAULT_HT_SIZE, CLASS_SCOPE_HT_SIZE)
510 (NAMESPACE_ORDINARY_HT_SIZE, NAMESPACE_STD_HT_SIZE)
511 (GLOBAL_SCOPE_HT_SIZE): Delete.
512 (binding_table_foreach, binding_table_find): Delete declarations.
513 * name-lookup.c (ENTRY_INDEX): Delete.
514 (free_binding_entry): Delete.
515 (binding_entry_make, binding_entry_free): Delete.
516 (struct binding_table_s): Delete.
517 (binding_table_construct, binding_table_free): Delete.
518 (binding_table_new, binding_table_expand): Delete.
519 (binding_table_insert, binding_table_find): Delete.
520 (binding_table_foreach): Delete.
521 (maybe_process_template_type_declaration): Delete
522 CLASSTYPE_NESTED_UTDS insertion.
523 (do_pushtag): Likewise.
524 * decl2.c (bt_reset_linkage_1): Fold into reset_type_linkage_1.
525 (reset_type_linkage_2, bt_reset_linkage_2): Fold into
527 * pt.c (instantiate_class_template_1): Delete NESTED_UTDs comment.
528 (bt_instantiate_type_proc): Delete.
529 (do_type_instantiation): Instantiate implicit typedef fields.
530 Delete NESTED_UTD walk.
531 * search.c (lookup_field_r): Delete unreachable NESTED_UTD
534 2020-10-27 Nathan Sidwell <nathan@acm.org>
536 * parser.c (cp_parser_explicit_instantiation): Refactor some RAII.
537 * pt.c (bt_instantiate_type_proc): DATA is the tree, pass type to
538 do_type_instantiation.
539 (do_type_instantiation): Require T to be a type. Refactor for
542 2020-10-26 Ville Voutilainen <ville.voutilainen@gmail.com>
544 * cp-tree.h (CPTK_IS_NOTHROW_ASSIGNABLE): New.
545 (CPTK_IS_NOTHROW_CONSTRUCTIBLE): Likewise.
546 (is_nothrow_xible): Likewise.
547 * method.c (is_nothrow_xible): New.
548 (is_trivially_xible): Tweak.
549 * parser.c (cp_parser_primary_expression): Handle the new RID_*.
550 (cp_parser_trait_expr): Likewise.
551 * semantics.c (trait_expr_value): Handle the new RID_*.
552 (finish_trait_expr): Likewise.
554 2020-10-24 Marek Polacek <polacek@redhat.com>
557 * constexpr.c (cxx_eval_array_reference): Set up ctx->ctor if we
558 are initializing an aggregate. Call free_constructor on the new
559 CONSTRUCTOR if it isn't returned from cxx_eval_constant_expression.
561 2020-10-23 Marek Polacek <polacek@redhat.com>
564 * typeck.c (cp_build_binary_op): Implement -Wsizeof-array-div.
566 2020-10-22 Patrick Palka <ppalka@redhat.com>
569 * constexpr.c (init_subob_ctx): Don't punt on RANGE_EXPR
570 indexes, instead build a sub-aggregate initialization context
573 2020-10-22 Patrick Palka <ppalka@redhat.com>
576 * constexpr.c (cxx_eval_constant_expression)
577 <case EMPTY_CLASS_EXPR>: Lower it to a CONSTRUCTOR.
578 (potential_constant_expression_1) <case COMPOUND_EXPR>: Remove
579 now-redundant handling of COMPOUND_EXPR with EMPTY_CLASS_EXPR
581 <case EMPTY_CLASS_EXPR>: Return true instead of false.
583 2020-10-22 Patrick Palka <ppalka@redhat.com>
586 * decl.c (duplicate_decls): Return NULL_TREE if
587 DECL_TEMPLATE_PARM_P differ.
589 2020-10-20 Nathan Sidwell <nathan@acm.org>
591 * name-lookup.c (push_local_extern_decl_alias): Reconstextualize
592 alias' parm decls. Drop any default args.
594 2020-10-19 Iain Sandoe <iain@sandoe.co.uk>
597 * coroutines.cc (struct coroutine_info): Add a field to
598 record that we emitted a promise type error.
599 (coro_promise_type_found_p): Check for the case that the
600 promise type contains both return_void and return_value.
601 Emit an error if so, with information about the wrong
604 2020-10-16 Nathan Sidwell <nathan@acm.org>
607 * pt.c (push_template_decl): Check DECL_LANG_SPECIFIC in friend
610 2020-10-16 Nathan Sidwell <nathan@acm.org>
613 * parser.c (cp_parser_declaration): Make token2 point to EOF if
616 2020-10-15 Jason Merrill <jason@redhat.com>
619 * decl.c (copy_fn_p): Return false for a function that is neither a
620 constructor nor an assignment operator.
621 (move_signature_fn_p): Likewise.
623 2020-10-15 Marek Polacek <polacek@redhat.com>
627 * cxx-pretty-print.c (pp_cxx_type_specifier_seq): Handle OFFSET_TYPE.
628 (cxx_pretty_printer::abstract_declarator): Fix the printing of ')'.
629 (cxx_pretty_printer::direct_abstract_declarator): Handle OFFSET_TYPE.
630 (cxx_pretty_printer::type_id): Likewise. Print the abstract declarator
631 for pointers-to-members.
633 2020-10-14 Jason Merrill <jason@redhat.com>
636 * pt.c (check_for_bare_parameter_packs): Diagnose use of
639 2020-10-14 Nathan Sidwell <nathan@acm.org>
641 * cp-tree.h (struct lang_decl_fn): Adjust context comment.
642 (DECL_FRIEND_P): Replace with ...
643 (DECL_UNIQUE_FRIEND_P): ... this. Only for FUNCTION_DECLs.
644 (DECL_FRIEND_CONTEXT): Adjust.
645 * class.c (add_implicitly_declared_members): Detect friendly
646 spaceship from context.
647 * constraint.cc (remove_constraints): Use a checking assert.
648 (maybe_substitute_reqs_for): Use DECL_UNIQUE_FRIEND_P.
649 * decl.c (check_no_redeclaration_friend_default_args):
650 DECL_UNIQUE_FRIEND_P is signficant, not hiddenness.
651 (duplicate_decls): Adjust DECL_UNIQUE_FRIEND_P clearing.
652 (redeclaration_error_message): Use DECL_UNIQUE_FRIEND_P.
653 (start_preparsed_function): Correct in-class friend processing.
654 Refactor some initializers.
655 (grokmethod): Directly check friend decl-spec.
656 * decl2.c (grokfield): Check DECL_UNIQUE_FRIEND_P.
657 * friend.c (do_friend): Set DECL_UNIQUE_FRIEND_P first, remove
658 extraneous conditions. Don't re set it afterwards.
659 * name-lookup.c (lookup_elaborated_type_1): Simplify revealing
661 (do_pushtag): Likewise.
662 * pt.c (optimize_specialization_lookup_p): Check
663 DECL_UNIQUE_FRIEND_P.
664 (push_template_decl): Likewise. Drop unneeded friend setting.
665 (type_dependent_expression_p): Check DECL_UNIQUE_FRIEND_P.
667 2020-10-14 Nathan Sidwell <nathan@acm.org>
669 * name-lookup.c (push_local_extern_decl_alias): Push into alias's
670 namespace and use pushdecl.
671 (do_pushdecl_with_scope): Clarify behaviour.
673 2020-10-12 Martin Sebor <msebor@redhat.com>
676 * error.c (dump_type_suffix): Handle both the C and C++ forms of
679 2020-10-12 Martin Sebor <msebor@redhat.com>
683 * init.c (warn_placement_new_too_small): Call builtin_objsize instead
684 of duplicating what it does.
686 2020-10-08 Jason Merrill <jason@redhat.com>
690 * pt.c (tsubst_aggr_type): Don't build a TYPENAME_TYPE when
692 (tsubst_template_decl): Use tsubst_aggr_type.
694 2020-10-08 Patrick Palka <ppalka@redhat.com>
697 * constraint.cc (build_type_constraint): Temporarily increment
698 processing_template_decl before calling build_concept_check.
699 * pt.c (make_constrained_placeholder_type): Likewise.
701 2020-10-08 Patrick Palka <ppalka@redhat.com>
704 * parser.c (cp_parser_class_specifier_1): Move call to
705 associate_classtype_constraints from here to ...
706 (cp_parser_class_head): ... here.
707 * pt.c (is_compatible_template_arg): Correct documentation to
708 say "argument is _no_ more constrained than the parameter".
710 2020-10-07 Marek Polacek <polacek@redhat.com>
713 * pt.c (tsubst_copy_and_build) <case TEMPLATE_ID_EXPR>: Call
714 tsubst_copy_and_build explicitly instead of using the RECUR macro.
715 Handle a TEMPLATE_ID_EXPR with an IDENTIFIER_NODE as its operand.
716 <case CALL_EXPR>: Perform ADL for a TEMPLATE_ID_EXPR with an
717 IDENTIFIER_NODE as its operand.
719 2020-10-07 Patrick Palka <ppalka@redhat.com>
723 * tree.c (cp_tree_equal) <case ALIGNOF_EXPR>: Return false if
724 ALIGNOF_EXPR_STD_P differ.
726 2020-10-07 Nathan Sidwell <nathan@acm.org>
728 * cp-tree.h (struct language_function): Delete extern_decl_map.
729 (DECL_LOCAL_DECL_ALIAS): New.
730 * name-lookup.h (is_local_extern): Delete.
731 * name-lookup.c (set_local_extern_decl_linkage): Replace with ...
732 (push_local_extern_decl): ... this new function.
733 (do_pushdecl): Call new function after pushing new decl. Unhide
734 hidden non-functions.
735 (is_local_extern): Delete.
736 * decl.c (layout_var_decl): Do not allow VLA local externs.
737 * decl2.c (mark_used): Also mark DECL_LOCAL_DECL_ALIAS. Drop old
738 local-extern treatment.
739 * parser.c (cp_parser_oacc_declare): Deal with local extern aliases.
740 * pt.c (tsubst_expr): Adjust local extern instantiation.
741 * cp-gimplify.c (cp_genericize_r): Remap DECL_LOCAL_DECLs.
743 2020-10-07 Nathan Sidwell <nathan@acm.org>
745 * cp-tree.h (DECL_BUILTIN_P): Rename to ...
746 (DECL_UNDECLARED_BUILTIN_P): ... here.
747 * decl.c (duplicate_decls): Adjust.
748 * name-lookup.c (anticipated_builtin_p): Adjust.
749 (do_nonmember_using_decl): Likewise.
751 2020-10-07 Nathan Sidwell <nathan@acm.org>
753 * tree.c (build_cp_fntype_variant): Clear
754 TYPE_DEPENDENT_P_VALID if necessary.
756 2020-10-06 Marek Polacek <polacek@redhat.com>
759 * parser.c (cp_parser_direct_declarator): When checking if a
760 name is a function template declaration for the P0634R3 case,
761 look in uninstantiated templates too.
763 2020-10-05 Marek Polacek <polacek@redhat.com>
765 * cp-tree.h (NON_UNION_CLASS_TYPE_P): Fix typo in a comment.
767 2020-10-05 Richard Biener <rguenther@suse.de>
768 Jakub Jelinek <jakub@redhat.com>
771 * error.c (dump_expr): Handle TARGET_MEM_REF.
773 2020-10-05 Nathan Sidwell <nathan@acm.org>
775 * name-lookup.c (maybe_add_fuzzy_decl): New.
776 (maybe_add_fuzzy_binding): New.
777 (consider_binding_level): Use intermediate sortable vector for
780 2020-10-02 Marek Polacek <polacek@redhat.com>
783 * cxx-pretty-print.c (pp_cxx_template_argument_list): If the
784 argument is template_parm_object_p, print its DECL_INITIAL.
786 2020-10-02 Nathan Sidwell <nathan@acm.org>
788 * cp-tree.h (lang_decl_base): anticipated_p is not used for
790 (DECL_ANTICIPATED): Delete.
791 * decl.c (duplicate_decls): Delete DECL_ANTICIPATED_management,
793 (cxx_builtin_function): Drop DECL_ANTICIPATED setting.
794 (xref_tag_1): Drop DECL_ANTICIPATED assert.
795 * name-lookup.c (name_lookup::adl_class_only): Drop
796 DECL_ANTICIPATED check.
797 (name_lookup::search_adl): Always dedup.
798 (anticipated_builtin_p): Reimplement.
799 (do_pushdecl): Drop DECL_ANTICIPATED asserts & update.
800 (lookup_elaborated_type_1): Drop DECL_ANTICIPATED update.
801 (do_pushtag): Drop DECL_ANTICIPATED setting.
802 * pt.c (push_template_decl): Likewise.
803 (tsubst_friend_class): Likewise.
805 2020-10-02 Nathan Sidwell <nathan@acm.org>
807 * name-lookup.c (consider_decl): New, broken out of ...
808 (consider_binding_level): ... here. Iterate the hash table for
811 2020-10-02 Nathan Sidwell <nathan@acm.org>
813 * cp-tree.h (base_ctor_omit_inherited_parms): Declare.
814 * class.c (add_method): Refactor main loop, only pass fns to
815 ctor_omit_inherited_parms.
816 (build_cdtor_clones): Rename bool parms.
817 (clone_cdtor): Call base_ctor_omit_inherited_parms.
818 * method.c (base_ctor_omit_inherited_parms): New, broken out of
820 (ctor_omit_inherited_parms): ... here, call it with
821 DECL_CLONED_FUNCTION.
823 2020-10-02 Nathan Sidwell <nathan@acm.org>
825 * cp-tree.h (cp_fname_init): Delete declaration.
826 * decl.c (cp_fname_init): Merge into only caller ...
827 (cp_make_fname): ... here & refactor.
829 2020-10-02 Jason Merril <jason@redhat.com>
831 * call.c (build_operator_new_call): Set CALL_FROM_NEW_OR_DELETE_P.
832 (build_op_delete_call): Likewise.
833 * init.c (build_new_1, build_vec_delete_1, build_delete): Not here.
836 2020-10-02 Jason Merril <jason@redhat.com>
838 * lambda.c (call_from_lambda_thunk_p): New.
839 * cp-gimplify.c (cp_genericize_r): Use it.
840 * pt.c (tsubst_copy_and_build): Use it.
841 * typeck.c (check_return_expr): Use it.
842 * cp-tree.h: Declare it.
843 (CALL_FROM_NEW_OR_DELETE_P): Move to gcc/tree.h.
845 2020-10-01 Nathan Sidwell <nathan@acm.org>
847 * cp-tree.h (DECL_ANTICIPATED): Adjust comment.
848 (DECL_HIDDEN_P, TYPE_HIDDEN_P): Delete.
849 * tree.c (ovl_insert): Delete DECL_HIDDEN_P assert.
850 (ovl_skip_hidden): Likewise.
852 2020-10-01 Nathan Sidwell <nathan@acm.org>
854 * name-lookup.c (pushdecl_top_level): Assert incoming context is
855 null, add global_namespace context.
856 (pushdecl_top_level_and_finish): Likewise.
857 * pt.c (get_template_parm_object): Clear decl context before
859 * semantics.c (finish_compound_literal): Likewise.
861 2020-10-01 Nathan Sidwell <nathan@acm.org>
863 * decl.c (lookup_and_check_tag): Refactor.
865 2020-10-01 Jakub Jelinek <jakub@redhat.com>
868 * call.c (build_over_call): If obj_arg is non-NULL, return INIT_EXPR
869 setting obj_arg to call.
871 2020-10-01 Jakub Jelinek <jakub@redhat.com>
874 * constexpr.c (cxx_eval_call_expression): Don't VERIFY_CONSTANT the
877 2020-10-01 Marek Polacek <polacek@redhat.com>
880 * pt.c (do_class_deduction): Don't prune explicit deduction guides
881 in copy-list-initialization. In copy-list-initialization, if an
882 explicit deduction guide was selected, give an error.
884 2020-09-30 Nathan Sidwell <nathan@acm.org>
886 * cp-tree.h (struct lang_decl_fn): Remove hidden_friend_p.
887 (DECL_HIDDEN_FRIEND_P): Delete.
888 * call.c (add_function_candidate): Drop assert about anticipated
890 (build_new_op_1): Drop koenig lookup flagging for hidden friend.
891 * decl.c (duplicate_decls): Drop HIDDEN_FRIEND_P updating.
892 * name-lookup.c (do_pushdecl): Likewise.
893 (set_decl_namespace): Discover hiddenness from OVL_HIDDEN_P.
894 * pt.c (check_explicit_specialization): Record found_hidden
897 2020-09-29 Marek Polacek <polacek@redhat.com>
900 * call.c (ref_conv_binds_directly_p): New function.
901 * cp-tree.h (ref_conv_binds_directly_p): Declare.
902 * parser.c (warn_for_range_copy): New function.
903 (cp_convert_range_for): Call it.
905 2020-09-29 Nathan Sidwell <nathan@acm.org>
907 * cp-tree.h (ovl_insert): Change final parm to hidden-or-using
909 * name-lookup.h (HIDDEN_TYPE_BINDING_P): New.
910 (struct cxx_binding): Add type_is_hidden flag.
911 * tree.c (ovl_insert): Change using_p parm to using_or_hidden,
913 (ovl_skip_hidden): Assert we never see a naked hidden decl.
914 * decl.c (xref_tag_1): Delete unhiding friend from here (moved to
915 lookup_elaborated_type_1).
916 * name-lookup.c (STAT_TYPE_HIDDEN_P, STAT_DECL_HIDDEN_P): New.
917 (name_lookup::search_namespace_only): Check new hidden markers.
918 (cxx_binding_make): Clear HIDDEN_TYPE_BINDING_P.
919 (update_binding): Update new hidden markers.
920 (lookup_name_1): Check HIDDEN_TYPE_BINDING_P and simplify friend
922 (lookup_elaborated_type_1): Use new hidden markers. Reveal the
925 2020-09-29 Nathan Sidwell <nathan@acm.org>
927 * name-lookup.c (create_local_binding): Do not clear
928 INHERITED_VALUE_BINDING_P here.
929 (name_lookup::process_binding): Move done hidden-decl triage to ...
930 (name_lookup::search_namespace_only): ... here, its only caller.
931 (cxx_binding_make): Clear flags here.
932 (push_binding): Not here.
933 (pop_local_binding): RAII.
934 (update_binding): Refactor.
935 (do_pushdecl): Assert we're never revealing a local binding.
936 (do_pushdecl_with_scope): Directly call do_pushdecl.
937 (get_class_binding): Do not clear LOCAL_BINDING_P here.
938 * pt.c (push_template_decl): Set friend & anticipated before
941 2020-09-29 Nathan Sidwell <nathan@acm.org>
943 * name-lookup.c (update_binding): We never meet two implicit
945 (do_pushdecl): Adjust set_identifier_type_value_with_scope calls.
946 (set_identifier_type_value_with_scope): Do not update binding in
947 the namespace-case. Assert it is already there.
949 2020-09-25 Nathan Sidwell <nathan@acm.org>
951 * cp-tree.h (duplicate_decls): Replace 'is_friend' with 'hiding'
952 and add 'was_hidden'.
953 * name-lookup.h (pushdecl_namespace_level): Replace 'is_friend'
955 (pushdecl): Likewise.
956 (pushdecl_top_level): Drop is_friend parm.
957 * decl.c (check_no_redeclaration_friend_default_args): Rename parm
959 (duplicate_decls): Replace 'is_friend' with 'hiding'
960 and 'was_hidden'. Do minimal adjustments in body.
961 (cxx_builtin_function): Pass 'hiding' to pushdecl.
962 * friend.c (do_friend): Pass 'hiding' to pushdecl.
963 * name-lookup.c (supplement_binding_1): Drop defaulted arg to
965 (update_binding): Replace 'is_friend' with 'hiding'. Drop
966 defaulted arg to duplicate_decls.
967 (do_pushdecl): Replace 'is_friend' with 'hiding'. Assert no
968 surprise hidhing. Adjust duplicate_decls calls to inform of old
970 (pushdecl): Replace 'is_friend' with 'hiding'.
971 (set_identifier_type_value_with_scope): Adjust update_binding
973 (do_pushdecl_with_scope): Replace 'is_friend' with 'hiding'.
974 (pushdecl_outermost_localscope): Drop default arg to
975 do_pushdecl_with_scope.
976 (pushdecl_namespace_level): Replace 'is_friend' with 'hiding'.
977 (pushdecl_top_level): Drop is_friend parm.
978 * pt.c (register_specialization): Comment duplicate_decls call
980 (push_template_decl): Commont pushdecl_namespace_level.
981 (tsubst_friend_function, tsubst_friend_class): Likewise.
983 2020-09-25 Nathan Sidwell <nathan@acm.org>
985 * name-lookup.h (enum tag_scope): Replace with ...
986 (enum class TAG_how): ... this. Add HIDDEN_FRIEND value.
987 (lookup_type_scope): Replace with ...
988 (lookup_elaborated_type): ... this.
989 (pushtag): Use TAG_how, not tag_scope.
990 * cp-tree.h (xref_tag): Parameter is TAG_how, not tag_scope.
991 * decl.c (lookup_and_check_tag): Likewise. Adjust.
992 (xref_tag_1, xref_tag): Likewise. adjust.
993 (start_enum): Adjust lookup_and_check_tag call.
994 * name-lookup.c (lookup_type_scope_1): Rename to ...
995 (lookup_elaborated_type_1) ... here. Use TAG_how, not tag_scope.
996 (lookup_type_scope): Rename to ...
997 (lookup_elaborated_type): ... here. Use TAG_how, not tag_scope.
998 (do_pushtag): Use TAG_how, not tag_scope. Adjust.
1000 * parser.c (cp_parser_elaborated_type_specifier): Adjust.
1001 (cp_parser_class_head): Likewise.
1003 2020-09-25 Nathan Sidwell <nathan@acm.org>
1005 * cp-tree.h (DECL_BUILTIN_P): New.
1006 * decl.c (duplicate_decls): Use it. Do not treat omp-udr as a
1008 * name-lookup.c (anticipated_builtin): Use it.
1009 (set_decl_context_in_fn): Function-scope OMP UDRs have function context.
1010 (do_nonmember_using_decl): Use DECL_BUILTIN_P.
1011 * parser.c (cp_parser_omp_declare_reduction): Function-scope OMP
1012 UDRs have function context. Assert we never find a valid duplicate.
1013 * pt.c (tsubst_expr): Function-scope OMP UDRs have function context.
1015 2020-09-24 Nathan Sidwell <nathan@acm.org>
1017 * cp-tree.h (duplicate_decls): Default is_friend to false.
1018 (xref_tag): Default tag_scope & tpl_header_p to ts_current & false.
1019 (push_template_decl_real): Default is_friend to false. Rename to
1021 (push_template_decl): ... here. Delete original decl.
1022 * name-lookup.h (pushdecl_namespace_level): Default is_friend to
1024 (pushtag): Default tag_scope to ts_current.
1025 * coroutines.cc (morph_fn_to_coro): Drop default args to xref_tag.
1026 * decl.c (start_decl): Drop default args to duplicate_decls.
1027 (start_enum): Drop default arg to pushtag & xref_tag.
1028 (start_preparsed_function): Pass DECL_FRIEND_P to
1030 (grokmethod): Likewise.
1031 * friend.c (do_friend): Rename push_template_decl_real calls.
1032 * lambda.c (begin_lamnbda_type): Drop default args to xref_tag.
1033 (vla_capture_type): Likewise.
1034 * name-lookup.c (maybe_process_template_type_declaration): Rename
1035 push_template_decl_real call.
1036 (pushdecl_top_level_and_finish): Drop default arg to
1037 pushdecl_namespace_level.
1038 * pt.c (push_template_decl_real): Assert no surprising friend
1039 functions. Rename to ...
1040 (push_template_decl): ... here. Delete original function.
1041 (lookup_template_class_1): Drop default args from pushtag.
1042 (instantiate_class_template_1): Likewise.
1043 * ptree.c (debug_overload): Print hidden and using markers.
1044 * rtti.c (init_rtti_processing): Drop refault args from xref_tag.
1045 (build_dynamic_cast_1, tinfo_base_init): Likewise.
1046 * semantics.c (begin_class_definition): Drop default args to
1049 2020-09-24 Nathan Sidwell <nathan@acm.org>
1052 * pt.c (maybe_instantiate_noexcept): Local externs are never
1055 2020-09-23 Nathan Sidwell <nathan@acm.org>
1057 * name-lookup.h (typedef cxx_binding): Delete tdef.
1058 (typedef cp_binding_level): Likewise.
1059 (struct cxx_binding): Flags are bools.
1061 2020-09-23 Nathan Sidwell <nathan@acm.org>
1064 * pt.c (tsubst_copy) [FUNCTION_DECL,VAR_DECL]: Retrieve local
1065 specialization for DECL_LOCAL_P decls.
1067 2020-09-22 Patrick Palka <ppalka@redhat.com>
1070 * pt.c (corresponding_template_parameter): Define.
1071 (keep_template_parm): Use it to adjust the given template
1072 parameter to the corresponding in-scope one from ctx_parms.
1074 2020-09-22 Nathan Sidwell <nathan@acm.org>
1076 * cp-tree.h (xref_tag_from_type): Don't declare.
1077 * decl.c (xref_tag_from_type): Delete.
1078 * pt.c (lookup_template_class_1): Erroneously located class
1079 definitions just give error_mark, don't try and inject it into the
1082 2020-09-22 Jakub Jelinek <jakub@redhat.com>
1085 * constexpr.c (cxx_eval_builtin_function_call): Return void_node for
1086 calls to __sanitize_ptr_{sub,cmp} builtins.
1088 2020-09-22 Nathan Sidwell <nathan@acm.org>
1090 * pt.c (instantiate_class_template_1): Do not repush and unhide
1093 2020-09-21 Marek Polacek <polacek@redhat.com>
1097 * lambda.c (maybe_add_lambda_conv_op): Mark the conversion function
1100 2020-09-21 Marek Polacek <polacek@redhat.com>
1102 * pt.c (deduction_guides_for): Add a bool parameter. Set it.
1103 (do_class_deduction): Warn when CTAD succeeds but the type doesn't
1104 have any explicit deduction guides.
1106 2020-09-21 Nathan Sidwell <nathan@acm.org>
1108 * decl.c (xref_tag_1): Use IDENTIFIER_LAMBDA_P to detect lambdas.
1109 * lambda.c (begin_lambda_type): Use ts_current to push the tag.
1110 * name-lookup.h (enum tag_scope): Drop ts_lambda.
1112 2020-09-21 Marek Polacek <polacek@redhat.com>
1115 * decl.c (redeclaration_error_message): Detect a redeclaration of
1118 2020-09-19 Sandra Loosemore <sandra@codesourcery.com>
1120 * cp-gimplify.c (enum bc_t, bc_label): Move to c-family.
1121 (begin_bc_block, finish_bc_block, get_bc_label): Likewise.
1122 (genericize_cp_loop): Likewise.
1123 (genericize_for_stmt, genericize_while_stmt): Likewise.
1124 (genericize_do_stmt, genericize_switch_stmt): Likewise.
1125 (genericize_continue_stmt, genericize_break_stmt): Likewise.
1126 (genericize_omp_for_stmt): Likewise.
1127 (cp_genericize_r): Call c_genericize_control_stmt instead of
1128 above functions directly.
1129 (cp_genericize): Call save_bc_state and restore_bc_state instead
1130 of manipulating bc_label directly.
1131 * cp-objcp-common.c (cxx_block_may_fallthru): Defer to
1132 c_block_may_fallthru instead of handling SWITCH_STMT here.
1133 (cp_common_init_ts): Move handling of loop and switch-related
1134 statements to c-family.
1135 * cp-tree.def (FOR_STMT, WHILE_STMT, DO_STMT): Move to c-family.
1136 (BREAK_STMT, CONTINUE_STMT, SWITCH_STMT): Likewise.
1137 * cp-tree.h (LABEL_DECL_BREAK, LABEL_DECL_CONTINUE): Likewise.
1138 (WHILE_COND, WHILE_BODY): Likewise.
1139 (DO_COND, DO_BODY): Likewise.
1140 (FOR_INIT_STMT, FOR_COND, FOR_EXPR, FOR_BODY, FOR_SCOPE): Likewise.
1141 (SWITCH_STMT_COND, SWITCH_STMT_BODY): Likewise.
1142 (SWITCH_STMT_TYPE, SWITCH_STMT_SCOPE): Likewise.
1143 (SWITCH_STMT_ALL_CASES_P, SWITCH_STMT_NO_BREAK_P): Likewise.
1144 * cxx-pretty-print.c (cxx_pretty_printer::statement): Move code
1145 to handle structured loop and switch tree nodes to c-family.
1146 * dump.c (cp_dump_tree): Likewise.
1148 2020-09-19 Patrick Palka <ppalka@redhat.com>
1152 * constraint.cc (map_arguments): Call template_parm_to_arg
1153 in the self-mapping case.
1154 (finish_shorthand_constraint): No need to build a TREE_LIST
1155 before calling template_parm_to_arg.
1156 * pt.c (template_parm_to_arg): Rewrite to handle TEMPLATE_PARM_P
1157 nodes as well as DECL_TEMPLATE_PARM_P nodes, and to make the
1158 overlying TREE_LIST node optional.
1159 (keep_template_parm): Don't record a BOUND_TEMPLATE_TEMPLATE_PARM,
1160 instead record its corresponding TEMPLATE_TEMPLATE_PARM.
1161 (convert_generic_types_to_packs): Don't call
1162 template_parm_to_arg.
1164 2020-09-19 Patrick Palka <ppalka@redhat.com>
1167 * constraint.cc (satisfy_atom): Pass true as the
1168 manifestly_const_eval argument to maybe_constant_value.
1170 2020-09-18 Jason Merrill <jason@redhat.com>
1173 * decl.c (complete_vars): Only call layout_var_decl if completing
1176 2020-09-18 Jason Merrill <jason@redhat.com>
1178 * decl.c (complete_vars): Call layout_var_decl.
1180 2020-09-17 Patrick Palka <ppalka@redhat.com>
1184 * constraint.cc (tsubst_requires_expr): Use REQUIRES_EXPR_PARMS
1185 and REQUIRES_EXPR_REQS. Use REQUIRES_EXPR_EXTRA_ARGS,
1186 add_extra_args and build_extra_args to defer substitution until
1187 we have all the template arguments.
1188 (finish_requires_expr): Adjust the call to build_min so that
1189 REQUIRES_EXPR_EXTRA_ARGS gets set to NULL_TREE.
1190 * cp-tree.def (REQUIRES_EXPR): Give it a third operand.
1191 * cp-tree.h (REQUIRES_EXPR_PARMS, REQUIRES_EXPR_REQS,
1192 REQUIRES_EXPR_EXTRA_ARGS): Define.
1193 (add_extra_args, build_extra_args): Declare.
1195 2020-09-16 Nathan Sidwell <nathan@acm.org>
1197 * cp-tree.h (cp_check_omp_declare_reduction): Return bool.
1198 * semantics.c (cp_check_omp_declare_reduction): Return true on for
1200 * pt.c (push_template_decl_real): OMP reductions do not get a
1202 (tsubst_function_decl): Remove special casing for local decl omp
1204 (tsubst_expr): Call instantiate_body for a local omp reduction.
1205 (instantiate_body): Add nested_p parm, and deal with such
1207 (instantiate_decl): Reject FUNCTION_SCOPE entities, adjust
1208 instantiate_body call.
1210 2020-09-16 Nathan Sidwell <nathan@acm.org>
1212 * pt.c (instantiate_body): Remove 'nested' var, simplify
1215 2020-09-16 Nathan Sidwell <nathan@acm.org>
1217 * pt.c (instantiate_body): New, broken out of ..
1218 (instantiate_decl): ... here. Call it.
1220 2020-09-15 Nathan Sidwell <nathan@acm.org>
1222 * pt.c (push_template_decl_real): OMP reductions retain a template
1224 (tsubst_function_decl): Likewise.
1226 2020-09-15 Tobias Burnus <tobias@codesourcery.com>
1229 * cp-gimplify.c (cxx_omp_finish_clause): Add bool openacc arg.
1230 * cp-tree.h (cxx_omp_finish_clause): Likewise
1231 * semantics.c (handle_omp_for_class_iterator): Update call.
1233 2020-09-14 Marek Polacek <polacek@redhat.com>
1235 * pt.c (push_template_decl_real): Use VAR_OR_FUNCTION_DECL_P.
1237 2020-09-14 Nathan Sidwell <nathan@acm.org>
1239 * pt.c (push_template_decl_real): Don't attach a template head to
1241 (tsubst_function_decl): Add support for headless local extern
1243 (tsubst_decl): Add support for headless local extern decls.
1245 2020-09-11 Nathan Sidwell <nathan@acm.org>
1247 * decl.c (grokfndecl): Don't attach to local extern.
1249 2020-09-11 Nathan Sidwell <nathan@acm.org>
1251 * parser.c (cp_parser_objc_method_definition_list): Reimplement
1252 loop, make sure we pop scope.
1254 2020-09-11 Marek Polacek <polacek@redhat.com>
1256 * cp-tree.h (LOOKUP_CONSTINIT): Remove.
1257 (LOOKUP_REWRITTEN): Adjust.
1258 * decl.c (duplicate_decls): Set DECL_DECLARED_CONSTINIT_P.
1259 (check_initializer): Use DECL_DECLARED_CONSTINIT_P instead of
1261 (cp_finish_decl): Don't set DECL_DECLARED_CONSTINIT_P. Use
1262 DECL_DECLARED_CONSTINIT_P instead of LOOKUP_CONSTINIT.
1263 (grokdeclarator): Set DECL_DECLARED_CONSTINIT_P.
1264 * decl2.c (grokfield): Don't handle LOOKUP_CONSTINIT.
1265 * parser.c (cp_parser_decomposition_declaration): Remove
1266 LOOKUP_CONSTINIT handling.
1267 (cp_parser_init_declarator): Likewise.
1268 * pt.c (tsubst_expr): Likewise.
1269 (instantiate_decl): Likewise.
1270 * typeck2.c (store_init_value): Use DECL_DECLARED_CONSTINIT_P instead
1271 of LOOKUP_CONSTINIT.
1273 2020-09-10 Nathan Sidwell <nathan@acm.org>
1275 * cp-tree.h (TINFO_VAR_DECLARED_CONSTINIT): Replace with ...
1276 (DECL_DECLARED_CONSTINIT_P): ... this.
1277 * decl.c (start_decl): No need to retrofit_lang_decl for constinit
1279 (cp_finish_decl): Use DECL_DECLARED_CONSTINIT_P.
1280 * pt.c (tsubst_decl): No need to handle constinit flag
1282 (tsubst_expr): Or here.
1284 2020-09-10 Nathan Sidwell <nathan@acm.org>
1286 * cp-tree.h (DECL_LOCAL_FUNCTION_P): Rename to ...
1287 (DECL_LOCAL_DECL_P): ... here. Accept both fns and vars.
1288 * decl.c (start_decl): Set DECL_LOCAL_DECL_P for local externs.
1289 (omp_declare_variant_finalize_one): Use DECL_LOCAL_DECL_P.
1290 (local_variable_p): Simplify.
1291 * name-lookup.c (set_decl_context_in_fn): Assert DECL_LOCAL_DECL_P
1292 is as expected. Simplify.
1293 (do_pushdecl): Don't set decl_context_in_fn for friends.
1294 (is_local_extern): Simplify.
1295 * call.c (equal_functions): Use DECL_LOCAL_DECL_P.
1296 * parser.c (cp_parser_postfix_expression): Likewise.
1297 (cp_parser_omp_declare_reduction): Likewise.
1298 * pt.c (check_default_tmpl_args): Likewise.
1299 (tsubst_expr): Assert nested reduction function is local.
1300 (type_dependent_expression_p): Use DECL_LOCAL_DECL_P.
1301 * semantics.c (finish_call_expr): Likewise.
1303 2020-09-09 Marek Polacek <polacek@redhat.com>
1306 * decl.c (reshape_init): If we're initializing a char array from
1307 a string-literal that is enclosed in braces, unwrap it.
1308 * init.c (build_new_1): Don't handle string-initializers here.
1309 (build_new): Handle new-expression with paren-init when the
1310 array bound is known. Always pass string constants to build_new_1
1311 enclosed in braces. Don't handle string-initializers in any
1314 2020-09-09 Marek Polacek <polacek@redhat.com>
1317 * decl.c (reshape_init_r): When initializing an aggregate member
1318 with an initializer from an initializer-list, also consider
1321 2020-09-09 Nathan Sidwell <nathan@acm.org>
1323 * parser.c (cp_parser_omp_declare_reduction): Refactor to avoid
1324 code duplication. Update DECL_TI_TEMPLATE's context.
1325 * pt.c (tsubst_expr): For OMP reduction function, set context to
1326 global_namespace before pushing.
1327 (tsubst_omp_udr): Assert current_function_decl, add comment about
1330 2020-09-09 Patrick Palka <ppalka@redhat.com>
1333 * class.c (resolve_address_of_overloaded_function): Check
1334 constraints_satisfied_p and perform return-type deduction via
1335 maybe_instantiate_decl when considering non-template functions
1336 in the overload set.
1337 * cp-tree.h (maybe_instantiate_decl): Declare.
1338 * decl2.c (maybe_instantiate_decl): Remove static.
1340 2020-09-04 Jason Merrill <jason@redhat.com>
1342 * expr.c (mark_use): Use iloc_sentinel.
1344 2020-09-03 Jakub Jelinek <jakub@redhat.com>
1347 * constexpr.c (fundef_copies_table): Change type from
1348 hash_map<tree, tree> * to decl_tree_map *.
1350 2020-09-03 Marek Polacek <polacek@redhat.com>
1353 * cp-tree.h (do_aggregate_paren_init): Declare.
1354 * decl.c (do_aggregate_paren_init): New.
1355 (grok_reference_init): Use it.
1356 (check_initializer): Likewise.
1357 * init.c (perform_member_init): Handle initializing an array from
1358 a ()-list. Use do_aggregate_paren_init.
1360 2020-09-03 Jakub Jelinek <jakub@redhat.com>
1363 * constexpr.c (cxx_eval_outermost_constant_expr): Temporarily disable
1364 flag_rounding_math during manifestly constant evaluation.
1366 2020-09-01 Marek Polacek <polacek@redhat.com>
1369 * init.c (build_new_1): Call reshape_init.
1371 2020-09-01 Jakub Jelinek <jakub@redhat.com>
1374 * semantics.c (handle_omp_array_sections_1): Test
1375 DECL_ARRAY_PARAMETER_P only on PARM_DECLs.
1377 2020-08-31 Marek Polacek <polacek@redhat.com>
1378 Jason Merrill <jason@redhat.com>
1381 * call.c (build_new_method_call_1): Use build_constructor_from_vec
1382 instead of build_tree_list_vec + build_constructor_from_list.
1383 * init.c (build_new_1): Handle new char[]{"foo"}. Use
1384 build_constructor_from_vec instead of build_tree_list_vec +
1385 build_constructor_from_list.
1386 (build_new): Deduce the array size in new-expression if not
1387 present. Handle ()-init. Handle initializing an array from
1389 * parser.c (cp_parser_new_type_id): Leave [] alone.
1390 (cp_parser_direct_new_declarator): Allow [].
1391 * pt.c (type_dependent_expression_p): In a NEW_EXPR, consider
1392 array types whose dimension has to be deduced type-dependent.
1394 2020-08-27 Martin Liska <mliska@suse.cz>
1396 * class.c (build_vtbl_initializer): Set exact argument of a vector
1397 growth function to true.
1398 * constraint.cc (get_mapped_args): Likewise.
1399 * decl.c (cp_maybe_mangle_decomp): Likewise.
1400 (cp_finish_decomp): Likewise.
1401 * parser.c (cp_parser_omp_for_loop): Likewise.
1402 * pt.c (canonical_type_parameter): Likewise.
1403 * rtti.c (get_pseudo_ti_init): Likewise.
1405 2020-08-26 Nathan Sidwell <nathan@acm.org>
1407 * decl.c (poplevel): A local-binding tree list holds the name in
1409 * name-lookup.c (update_local_overload): Add id to TREE_PURPOSE.
1410 (lookup_name_1): Deal with local-binding error_mark_node marker.
1411 (op_unqualified_lookup): Return error_mark_node for 'nothing
1412 found'. Retain global binding, check class binding here.
1413 (maybe_save_operator_binding): Reimplement to always cache a
1415 (push_operator_bindings): Deal with 'ignore' marker.
1417 2020-08-25 Tobias Burnus <tobias@codesourcery.com>
1420 * semantics.c (handle_omp_array_sections_1): Talk about
1421 array function parameter in the error message.
1423 2020-08-25 Jakub Jelinek <jakub@redhat.com>
1426 * cp-tree.h (build_trivial_dtor_call): Add bool argument defaulted
1428 * call.c (build_trivial_dtor_call): Add NO_PTR_DEREF argument. If
1429 instance is a pointer and NO_PTR_DEREF is true, clobber the pointer
1430 rather than what it points to.
1431 * semantics.c (finish_call_expr): Call build_trivial_dtor_call with
1432 true as NO_PTR_DEREF.
1434 2020-08-25 Jason Merrill <jason@redhat.com>
1437 * optimize.c (populate_clone_array): Revert PR70462 change.
1438 (maybe_clone_body): Likewise.
1440 2020-08-24 Nathan Sidwell <nathan@acm.org>
1442 * ptree.c (debug_overload): New.
1444 2020-08-19 Jason Merrill <jason@redhat.com>
1447 * cp-tree.h (push_tinst_level, push_tinst_level_loc): Declare.
1448 * constraint.cc (satisfy_declaration_constraints):
1449 Use add_outermost_template_args and push_tinst_level.
1450 * pt.c (add_outermost_template_args): Handle getting
1451 a TEMPLATE_DECL as the first argument.
1452 (push_tinst_level, push_tinst_level_loc): No longer static.
1453 (fn_type_unification): Check satisfaction before non-dependent
1456 2020-08-18 Nathan Sidwell <nathan@acm.org>
1458 * cp-tree.h (SET_TYPE_TEMPLTE_INFO): Do not deal with ALIAS templates.
1459 * pt.c (lookup_template_class_1): Special-case alias template
1460 template_info setting.
1462 2020-08-18 Jason Merrill <jason@redhat.com>
1465 * pt.c (tsubst_aggr_type): Rewrite in C++17, too.
1466 (maybe_dependent_member_ref): Likewise.
1467 (build_deduction_guide): Re-substitute template parms.
1468 * cp-tree.h (struct push_nested_class_guard): New.
1469 * constraint.cc (get_normalized_constraints_from_decl): Use it.
1471 2020-08-18 Jason Merrill <jason@redhat.com>
1474 * pt.c (maybe_dependent_member_ref): New.
1475 (tsubst_copy) [CONST_DECL]: Use it.
1476 [VAR_DECL]: Likewise.
1477 (tsubst_aggr_type): Handle nested type.
1479 2020-08-18 Nathan Sidwell <nathan@acm.org>
1481 * name-lookup.c (qualify_lookup): Drop lambda checking here.
1482 Reorder namespace & type checking.
1483 (lookup_name_1): Do hidden lambda checking here.
1485 2020-08-14 Nathan Sidwell <nathan@acm.org>
1487 * name-lookup.h (lookup_name_real, lookup_name_nonclass): Rename
1489 (lookup_name): ... these new overloads.
1490 * name-lookup.c (identifier_type_value_1): Rename lookup_name_real
1492 (lookup_name_real_1): Rename to ...
1493 (lookup_name_1): ... here.
1494 (lookup_name_real): Rename to ...
1495 (lookup_name): ... here. Rename lookup_name_real_1 call.
1496 (lookup_name_nonclass): Delete.
1497 * call.c (build_operator_new_call): Rename lookup_name_real call.
1498 (add_operator_candidates): Likewise.
1499 (build_op_delete_call): Rename lookup_name_nonclass call.
1500 * parser.c (cp_parser_lookup_name): Likewise.
1501 * pt.c (tsubst_friend_class, lookup_init_capture_pack): Likewise.
1502 (tsubst_expr): Likewise.
1503 * semantics.c (capture_decltype): Likewise.
1505 2020-08-14 Nathan Sidwell <nathan@acm.org>
1507 * cp-tree.h (LOOKUP_HIDDEN): Delete.
1508 (LOOKUP_PREFER_RVALUE): Adjust initializer.
1509 * name-lookup.h (enum class LOOK_want): Add HIDDEN_FRIEND and
1510 HIDDEN_LAMBDA flags.
1511 (lookup_name_real): Drop flags parm.
1512 (lookup_qualified_name): Drop find_hidden parm.
1513 * name-lookup.c (class name_lookup): Drop hidden field, adjust
1515 (name_lookup::add_overload): Check want for hiddenness.
1516 (name_lookup::process_binding): Likewise.
1517 (name_lookup::search_unqualified): Likewise.
1518 (identifier_type_value_1): Adjust lookup_name_real call.
1519 (set_decl_namespace): Adjust name_lookup ctor.
1520 (qualify_lookup): Drop flags parm, use want for hiddenness.
1521 (lookup_qualified_name): Drop find_hidden parm.
1522 (lookup_name_real_1): Drop flags parm, adjust qualify_lookup
1524 (lookup_name_real): Drop flags parm.
1525 (lookup_name_nonclass, lookup_name): Adjust lookup_name_real
1527 (lookup_type_scope_1): Adjust qualify_lookup calls.
1528 * call.c (build_operator_new_call): Adjust lookup_name_real call.
1529 (add_operator_candidates): Likewise.
1530 * coroutines.cc (morph_fn_to_coro): Adjust lookup_qualified_name
1532 * parser.c (cp_parser_lookup_name): Adjust lookup_name_real calls.
1533 * pt.c (check_explicit_specialization): Adjust
1534 lookup_qualified_name call.
1535 (deduction_guides_for): Likewise.
1536 (tsubst_friend_class): Adjust lookup_name_real call.
1537 (lookup_init_capture_pack): Likewise.
1538 (tsubst_expr): Likewise, don't look in namespaces.
1539 * semantics.c (capture_decltype): Adjust lookup_name_real. Don't
1542 2020-08-14 Jason Merrill <jason@redhat.com>
1546 * cp-tree.h (unsafe_return_slot_p): Declare.
1547 * call.c (is_base_field_ref): Rename to unsafe_return_slot_p.
1548 (build_over_call): Check unsafe_return_slot_p.
1549 (build_special_member_call): Likewise.
1550 * init.c (expand_default_init): Likewise.
1551 * typeck2.c (split_nonconstant_init_1): Likewise.
1553 2020-08-14 Nathan Sidwell <nathan@acm.org>
1555 * cp-tree.h (LOOKUP_PREFER_TYPES, LOOKUP_PREFER_NAMESPACES)
1556 (LOOKUP_NAMESPACES_ONLY, LOOKUP_TYPES_ONLY)
1557 (LOOKUP_QUALIFIERS_ONL): Delete.
1558 (LOOKUP_HIDDEN): Adjust.
1559 * name-lookup.h (enum class LOOK_want): New.
1560 (operator|, operator&): Overloads for it.
1561 (lookup_name_real): Replace prefer_type & namespaces_only with
1563 (lookup_qualified_name): Replace prefer_type with LOOK_want.
1564 (lookup_name_prefer_type): Replace with ...
1565 (lookup_name): ... this. New overload with LOOK_want parm.
1566 * name-lookup.c (struct name_lookup): Replace flags with want and
1567 hidden fields. Adjust constructors.
1568 (name_lookyp::add_overload): Correct hidden stripping test. Update
1569 for new LOOK_want type.
1570 (name_lookup::process_binding): Likewise.
1571 (name_lookup::search_unqualified): Use hidden flag.
1572 (identifier_type_value_1): Adjust lookup_name_real call.
1573 (set_decl_namespace): Adjust name_lookup ctor.
1574 (lookup_flags): Delete.
1575 (qualify_lookup): Add LOOK_want parm, adjust.
1576 (lookup_qualified_name): Replace prefer_type parm with LOOK_want.
1577 (lookup_name_real_1): Replace prefer_type and namespaces_only with
1579 (lookup_name_real): Likewise.
1580 (lookup_name_nonclass, lookup_name): Adjust lookup_name_real call.
1581 (lookup_name_prefer_type): Rename to ...
1582 (lookup_name): ... here. New overload with LOOK_want parm.
1583 (lookup_type_scope_1): Adjust qualify_lookup calls.
1584 * call.c (build_operator_new_call)
1585 (add_operator_candidates): Adjust lookup_name_real calls.
1586 * coroutines.cc (find_coro_traits_template_decl)
1587 (find_coro_handle_template_decl, morph_fn_to_coro): Adjust
1588 lookup_qualified_name calls.
1589 * cp-objcp-common.c (identifier_global_tag): Likewise.
1590 * decl.c (get_tuple_size, get_tuple_decomp_init): Likewise.
1591 (lookup_and_check_tag): Use lookup_name overload.
1592 * parser.c (cp_parser_userdef_numeric_literal): Adjust
1593 lookup_qualified_name call.
1594 (prefer_arg_type): Drop template_mem_access parm, return LOOK_want
1596 (cp_parser_lookup_name): Adjust lookup_member, lookup_name_real
1598 * pt.c (check_explicit_specialization): Adjust lookup_qualified_name
1600 (tsubst_copy_and_build, tsubst_qualified_name): Likewise
1601 (deduction_guides_for): Likewise.
1602 (tsubst_friend_class): Adjust lookup_name_real call.
1603 (lookup_init_capture, tsubst_expr): Likewise.
1604 * rtti.c (emit_support_tinfos): Adjust lookup_qualified_name call.
1605 * semantics.c (omp_reduction_lookup): Likewise.
1606 (capture_decltype): Adjust lookup_name_real call.
1608 2020-08-13 Nathan Sidwell <nathan@acm.org>
1610 * name-lookup.h (enum class LOOK_where): New.
1611 (operator|, operator&): Overloads for it.
1612 (lookup_name_real): Replace NONCLASS & BLOCK_P parms with WHERE.
1613 * name-lookup.c (identifier_type_value_w): Adjust
1614 lookup_name_real call.
1615 (lookup_name_real_1): Replace NONCLASS and BLOCK_P parameters
1616 with WHERE bitmask. Don't search namespaces if not asked to.
1617 (lookup_name_real): Adjust lookup_name_real_1 call.
1618 (lookup_name_nonclass, lookup_name)
1619 (lookup_name_prefer_type): Likewise.
1620 * call.c (build_operator_new_call)
1621 (add_operator_candidates): Adjust lookup_name_real calls.
1622 * parser.c (cp_parser_lookup_name): Likewise.
1623 * pt.c (tsubst_friend_class, lookup_init_capture_pack)
1624 (tsubst_expr): Likewise.
1625 * semantics.c (capture_decltype): Likewise.
1627 2020-08-13 Marek Polacek <polacek@redhat.com>
1630 * typeck.c (build_static_cast_1): Implement P1975R0 by allowing
1631 static_cast to aggregate type.
1633 2020-08-10 Jakub Jelinek <jakub@redhat.com>
1636 * constexpr.c (cxx_eval_binary_expression): For SPACESHIP_EXPR, tail
1637 call cxx_eval_constant_expression after genericize_spaceship to avoid
1638 undesirable further VERIFY_CONSTANT.
1640 2020-08-10 Patrick Palka <ppalka@redhat.com>
1642 * pt.c (resolve_overloaded_unification): Drop functions with
1643 unsatisfied constraints.
1644 (resolve_nondeduced_context): Likewise.
1646 2020-08-05 Patrick Palka <ppalka@redhat.com>
1647 Jason Merrill <jason@redhat.com>
1650 * constexpr.c (cxx_eval_vec_init_1): Truncate ctx->ctor and
1651 then clear CONSTRUCTOR_NO_CLEARING on each appended element
1652 initializer if we're initializing a previously zero-initialized
1655 2020-08-04 Marek Polacek <polacek@redhat.com>
1658 * parser.c (cp_parser_elaborated_type_specifier): Allow
1659 'template' following ::.
1661 2020-08-04 Nathan Sidwell <nathan@acm.org>
1663 * parser.c (cp_parser_explicit_specialization): Refactor
1664 to avoid leak of num_template_parameter_lists value.
1666 2020-08-04 Patrick Palka <ppalka@redhat.com>
1669 * init.c (sort_mem_initializers): Preserve TREE_TYPE of the
1670 member initializer list node.
1671 (emit_mem_initializers): Set input_location when performing each
1672 member initialization.
1673 * parser.c (cp_parser_mem_initializer): Attach the source
1674 location of this initializer to a dummy EMPTY_CLASS_EXPR
1675 within the TREE_TYPE of the list node.
1676 * pt.c (tsubst_initializer_list): Preserve TREE_TYPE of the
1677 member initializer list node.
1679 2020-08-03 Marek Polacek <polacek@redhat.com>
1681 * cp-tree.h (after_nsdmi_defaulted_late_checks): Remove.
1683 2020-08-03 Marek Polacek <polacek@redhat.com>
1687 * pt.c (check_default_tmpl_args): Also consider variable
1690 2020-07-31 Jakub Jelinek <jakub@redhat.com>
1693 * decl.c (finish_function): In constexpr functions use for C++14 and
1694 later error instead of warning if no return statement is present and
1695 diagnose it regardless of warn_return_type. Move the warn_return_type
1696 diagnostics earlier in the function.
1698 2020-07-31 Martin Sebor <msebor@redhat.com>
1701 * class.c (build_base_path): Set no-warning bit on the synthesized
1702 conditional expression in static_cast.
1704 2020-07-31 Richard Biener <rguenther@suse.de>
1707 * cp-objcp-common.h (LANG_HOOKS_FINALIZE_EARLY_DEBUG):
1708 Define to c_common_finalize_early_debug.
1710 2020-07-31 Patrick Palka <ppalka@redhat.com>
1713 * constexpr.c (cxx_eval_constant_expression) <case CONST_DECL>:
1714 Pass false to decl_constant_value and decl_really_constant_value
1715 so that they don't unshare their result.
1716 * cp-tree.h (decl_constant_value): New declaration with an added
1718 (decl_really_constant_value): Add bool parameter defaulting to
1719 true to existing declaration.
1720 * init.c (constant_value_1): Add bool parameter which controls
1721 whether to unshare the initializer before returning. Call
1722 unshare_expr at most once.
1723 (scalar_constant_value): Pass true to constant_value_1's new
1725 (decl_really_constant_value): Add bool parameter and forward it
1726 to constant_value_1.
1727 (decl_constant_value): Likewise, but instead define a new
1728 overload with an added bool parameter.
1730 2020-07-30 Patrick Palka <ppalka@redhat.com>
1733 * pt.c (resolve_overloaded_unification): If the function
1734 template specialization has a placeholder return type,
1735 then instantiate it before attempting unification.
1737 2020-07-30 Patrick Palka <ppalka@redhat.com>
1740 * pt.c (alias_ctad_tweaks): Call remove_constraints before
1741 calling set_constraints.
1743 2020-07-30 Patrick Palka <ppalka@redhat.com>
1746 * pt.c (reduce_template_parm_level): Propagate DECL_VIRTUAL_P
1747 from the original TEMPLATE_PARM_DECL to the new lowered one.
1749 2020-07-30 Patrick Palka <ppalka@redhat.com>
1752 * constraint.cc (constraints_satisfied_p): Return true if
1754 * pt.c (do_type_instantiation): Update a paragraph taken from
1755 [temp.explicit] to reflect the latest specification. Don't
1756 instantiate a member with unsatisfied constraints.
1758 2020-07-29 Jason Merrill <jason@redhat.com>
1761 * cp-tree.h (IMPLICIT_RVALUE_P): New.
1762 (enum cp_lvalue_kind_flags): Add clk_implicit_rval.
1763 (implicit_rvalue_p, set_implicit_rvalue_p): New.
1764 * call.c (reference_binding): Check clk_implicit_rval.
1765 (build_over_call): Adjust C++20 implicit move.
1766 * coroutines.cc (finish_co_return_stmt): Simplify implicit move.
1767 * except.c (build_throw): Adjust C++20 implicit move.
1768 * pt.c (tsubst_copy_and_build) [STATIC_CAST_EXPR]: Propagate
1770 * tree.c (lvalue_kind): Set clk_implicit_rval.
1771 * typeck.c (treat_lvalue_as_rvalue_p): Overhaul.
1772 (maybe_warn_pessimizing_move): Adjust.
1773 (check_return_expr): Adjust C++20 implicit move.
1775 2020-07-29 Jason Merrill <jason@redhat.com>
1778 * call.c (build_over_call): Don't call a const ref
1779 overload for implicit move.
1781 2020-07-28 Nathan Sidwell <nathan@acm.org>
1783 * cp-gimplify.c (cp_genericize_r): Set IMPORTED_DECL's context.
1784 * cp-objcp-common.c (cp_pushdecl): Set decl's context.
1785 * decl.c (grokfndecl): Make DECL_CONTEXT setting clearer.
1787 2020-07-28 Nathan Sidwell <nathan@acm.org>
1789 * class.c (fixup_type_variants): Copy TYPE_SIZE and
1791 (finish_struct): Call it.
1793 2020-07-28 Nathan Sidwell <nathan@acm.org>
1795 * ptree.c (cxx_print_decl): Better indentation.
1797 2020-07-28 Jakub Jelinek <jakub@redhat.com>
1798 Mark Wielaard <mark@klomp.org>
1801 * parser.c (cp_lexer_safe_previous_token): Don't call
1802 cp_lexer_previous_token, instead inline it by hand and return NULL
1803 instead of failing assertion if all previous tokens until the first
1805 (cp_parser_error_1): Optimize - only call cp_lexer_safe_previous_token
1806 if token->type is CPP_NAME. Use cp_lexer_safe_previous_token instead
1807 of cp_lexer_previous_token for the missing_token_desc != RT_NONE
1810 2020-07-27 Nathan Sidwell <nathan@acm.org>
1812 * cp-tree.h (enum cp_tree_index): Add CPTI_AS_BASE_IDENTIFIER.
1813 (as_base_identifier): Define.
1814 * decl.c (initialize_predifined_identifiers): Initialize as_base
1816 * class.c (layout_class_type): Name the as-base type. Zap
1817 NSDMI its fields may have.
1819 2020-07-22 Nathan Sidwell <nathan@acm.org>
1821 * class.c (maybe_add_class_template_decl_list): Don't add CONST_DECLs.
1823 2020-07-22 Nathan Sidwell <nathan@acm.org>
1825 * typeck.c (structural_comptypes): [DECLTYPE_TYPE] break
1827 [UNDERLYING_TYPE]: Use an if.
1830 2020-07-22 Nathan Sidwell <nathan@acm.org>
1832 * decl.c (decls_match): Move variables into scopes
1834 (duplicate_decls): Use STRIP_TEMPLATE.
1835 (build_typename_type): Move var decls to their assignments.
1836 (begin_function_body): Likewise.
1837 * decl2.c (get_guard): Likewise.
1838 (mark_used): Use true for truthiness.
1839 * error.c (dump_aggr_type): Hold the decl in a var called
1842 2020-07-22 Nathan Sidwell <nathan@acm.org>
1844 * cp-tree.h (struct tree_lambda_expr): Shrink
1845 default_capture_mode & discriminator.
1847 2020-07-22 Nathan Sidwell <nathan@acm.org>
1849 * mangle.c (decl_is_template_id): Rename to ...
1850 (maybe_template_info): ... here. Return the template info,
1851 rather than use a pointer. Adjust all callers.
1852 (find_substitution): Use template_args_equal, rather than
1855 2020-07-22 Tobias Burnus <tobias@codesourcery.com>
1857 * parser.c (cp_parser_omp_clause_hint): Require nonnegative hint.
1858 (cp_parser_omp_critical): Permit hint(0) clause without named critical.
1859 * pt.c (tsubst_expr): Re-check the latter for templates.
1861 2020-07-21 Sunil K Pandey <skpgkp2@gmail.com>
1864 * decl.c (cp_finish_decl): Call target hook
1865 lower_local_decl_alignment to lower local decl alignment.
1867 2020-07-21 Nathan Sidwell <nathan@acm.org>
1869 * parser.c (cp_lexer_consume_token): Drop PRAGMA_EOL assert.
1870 (cp_parser_skip_to_closing_parenthesis_1): Only pass start token
1871 to pragma skipper if recovering.
1872 (cp_parser_skip_to_pragma_eol): Only purge and change pragma
1873 state when recovering.
1875 2020-07-20 Jason Merrill <jason@redhat.com>
1877 * pt.c (type_dependent_expression_p): A pseudo-dtor can be
1879 * semantics.c (finish_call_expr): Use build_trivial_dtor_call for
1881 (finish_pseudo_destructor_expr): Leave type NULL for dependent arg.
1883 2020-07-20 Jason Merrill <jason@redhat.com>
1885 * mangle.c (write_base_ref): New.
1886 (write_expression): Use it for base field COMPONENT_REFs.
1887 * pt.c (invalid_tparm_referent_p): Canonicalize the type
1888 of array offsets. Allow subobjects.
1890 2020-07-20 Jason Merrill <jason@redhat.com>
1892 * pt.c (collect_ctor_idx_types): Add 'const' when deducing from
1895 2020-07-17 Marek Polacek <polacek@redhat.com>
1898 * decl.c (grokdeclarator): Detect cv-qual decltype(auto).
1899 * pt.c (do_auto_deduction): Likewise.
1901 2020-07-16 Iain Sandoe <iain@sandoe.co.uk>
1908 * coroutines.cc (struct coro_ret_data): Delete.
1909 (coro_maybe_expand_co_return): Delete.
1910 (co_return_expander): Delete.
1911 (expand_co_returns): Delete.
1912 (co_await_find_in_subtree): Remove unused name.
1913 (build_actor_fn): Remove unused parm, remove handling
1914 for co_return expansion.
1915 (register_await_info): Demote duplicate info message to a
1917 (coro_make_frame_entry): Move closer to use site.
1918 (struct susp_frame_data): Add fields for final suspend label
1919 and a flag to indicate await expressions with initializers.
1920 (captures_temporary): Delete.
1921 (register_awaits): Remove unused code, update comments.
1922 (find_any_await): New.
1923 (tmp_target_expr_p): New.
1924 (struct interesting): New.
1925 (find_interesting_subtree): New.
1926 (struct var_nest_node): New.
1927 (flatten_await_stmt): New.
1928 (handle_nested_conditionals): New.
1929 (process_conditional): New.
1930 (replace_statement_captures): Rename to...
1931 (maybe_promote_temps): ... this.
1932 (maybe_promote_captured_temps): Delete.
1933 (analyze_expression_awaits): Check for await expressions with
1934 initializers. Simplify handling for truth-and/or-if.
1935 (expand_one_truth_if): Simplify (map cases that need expansion
1937 (await_statement_walker): Handle CO_RETURN_EXPR. Simplify the
1938 handling for truth-and/or-if expressions.
1939 (register_local_var_uses): Ensure that we create names in the
1940 implementation namespace.
1941 (morph_fn_to_coro): Add final suspend label to suspend frame
1942 callback data and remove it from the build_actor_fn call.
1944 2020-07-16 Marek Polacek <polacek@redhat.com>
1946 * call.c (convert_like): Remove macro and introduce a new
1948 (convert_like_with_context): Likewise.
1949 (convert_like_real): Rename to convert_like.
1950 (convert_like_real_1): Rename to convert_like_internal. Call
1951 convert_like instead of convert_like_real therein.
1952 (perform_direct_initialization_if_possible): Call convert_like
1953 instead of convert_like_real.
1955 2020-07-16 Iain Sandoe <iain@sandoe.co.uk>
1957 * coroutines.cc: Correct some spelling errors
1960 2020-07-15 Nathan Sidwell <nathan@acm.org>
1962 * parser.c (cp_parser_declaration): Avoid copying tokens.
1963 (cp_parser_block_declaration): RAII token pointer.
1965 2020-07-15 Nathan Sidwell <nathan@acm.org>
1967 * parser.c (cp_parser_skip_to_closing_parenthesis_1): Deal with
1968 meeting a deferred pragma.
1969 (cp_parser_skip_to_end_of_statement): Likewise.
1970 (cp_parser_skip_to_end_of_block_or_statement): Likewise.
1971 (cp_parser_skip_to_pragma_eol): We should never meet EOF.
1972 (cp_parser_omp_declare_simd): Likewise.
1973 (cp_parser_omp_declare_reduction, cp_parser_oacc_routine)
1974 (pragma_lex): Likewise.
1976 2020-07-14 Marek Polacek <polacek@redhat.com>
1981 * call.c (convert_like_real_1): Renamed from convert_like_real.
1982 (convert_like_real): New wrapper for convert_like_real_1.
1984 2020-07-14 Nathan Sidwell <nathan@acm.org>
1986 * parser.c (cp_lexer_alloc): Do not deal with PCH here.
1987 (cp_lexer_new_main): Deal with PCH here. Store the tokens directly
1989 (cp_lexer_new_from_tokens): Assert last token isn't purged either.
1990 (cp_lexer_get_preprocessor_token): Change first arg to flags, adjust.
1991 (cp_parser_new): Pass the lexer in, don't create it here.
1992 (cp_parser_translation_unit): Initialize access checks here.
1993 (cp_parser_initial_pragma): First token is provided by caller,
1994 don't deal with PCH stopping here. Adjust error message.
1995 (c_parse_file): Adjust, change error message to avoid C++20 module
1998 2020-07-14 Nathan Sidwell <nathan@acm.org>
2000 * ptree.c (cxx_print_type): Add TYPEOF_TYPE and BASES.
2002 2020-07-14 Nathan Sidwell <nathan@acm.org>
2004 * class.c (build_base_field_1): Cache CLASSTYPE_AS_BASE.
2005 (build_self_reference): Rename value -> decl.
2006 (dump_class_hierarchy_1): Cache CLASSTYPE_AS_BASE.
2008 2020-07-14 Marek Polacek <polacek@redhat.com>
2011 * decl.c (grokdeclarator) <case cdk_function>: Check also
2012 pointers/references/... to functions.
2014 2020-07-14 Nathan Sidwell <nathan@acm.org>
2016 * cp-tree.h: Correct some tree lang flag comments,
2017 reformat some structure definitions. Note some structure
2018 sizes. Clarify some comments.
2019 (yyungetc): Delete. Not been a thing for some time.
2020 * class.c (copy_fndecl_with_name): Comment.
2021 (check_bases_and_members): Unnecessary {}.
2022 (layout_class_type): Comment.
2023 * cp-tree.def (UNBOUND_CLASS_TEMPLATE): Adjust comment.
2024 * decl.c: Fix some formatting & whitespace issues.
2025 (function_requirements_equivalent_p): Note why
2026 substitutions are needed.
2027 * decl2.c (no_linkage_error): Note that heroics about
2028 'typedef struct { ... };' are no longer needed.
2029 * method.c: Whitespace.
2030 * name-lookup.c: Whitespace.
2031 (add_decl_to_level): Reformat a line.
2032 (print_binding_stack): Mark as DEBUG_FUNCTION.
2033 (has_using_namespace_std_directive_p): Delete comment.
2035 * ptree.c: Whitespace.
2036 * rtti.c: Whitespace & comment.
2038 * typeck.c (structural_comptypes): Add comment.
2040 2020-07-13 Nathan Sidwell <nathan@acm.org>
2042 * Make-lang.in (c++.disclean): Likewise.
2044 2020-07-13 Marek Polacek <polacek@redhat.com>
2047 * parser.c (cp_parser_enum_specifier): Commit to tentative parse
2048 after we've seen an opening brace.
2050 2020-07-10 Jason Merrill <jason@redhat.com>
2052 * tree.c (structural_type_p): Allow unions.
2053 * mangle.c (write_expression): Express unions with a designator.
2055 2020-07-10 Jason Merrill <jason@redhat.com>
2057 * pt.c (convert_nontype_argument): Handle REAL_TYPE.
2058 (invalid_nontype_parm_type_p): Allow all structural types.
2059 * tree.c (structural_type_p): Use SCALAR_TYPE_P.
2061 2020-07-10 Jason Merrill <jason@redhat.com>
2066 * class.c (check_field_decls): An array of empty classes is not an
2068 (layout_empty_base_or_field): Handle explicit alignment.
2071 2020-07-09 Julian Brown <julian@codesourcery.com>
2072 Thomas Schwinge <thomas@codesourcery.com>
2075 * semantics.c (finish_omp_clauses): Likewise.
2077 2020-07-09 Patrick Palka <ppalka@redhat.com>
2080 * constexpr.c (potential_constant_expression_1) <case PARM_DECL>:
2081 Restore dependent_type_p check that guarded the call to
2082 is_really_empty_class.
2084 2020-07-08 Patrick Palka <ppalka@redhat.com>
2087 * constexpr.c (potential_constant_expression_1) <case PARM_DECL>:
2088 When processing_template_decl, check COMPLETE_TYPE_P before
2089 calling is_really_empty_class. Don't check dependent_type_p.
2091 2020-07-08 Marek Polacek <polacek@redhat.com>
2094 * parser.c (cp_parser_decltype): Print error about using decltype(auto)
2095 in C++11. Check that the token following "auto" is ")".
2097 2020-07-07 Patrick Palka <ppalka@redhat.com>
2100 * cxx-pretty-print.c (pp_cxx_unqualified_id): Check
2101 PRIMARY_TEMPLATE_P before printing the innermost template
2104 2020-07-07 Martin Sebor <msebor@redhat.com>
2107 * parser.c (class_decl_loc_t::diag_mismatched_tags): Print notes only
2108 if warning_at returns nonzero.
2110 2020-07-06 Martin Sebor <msebor@redhat.com>
2113 * call.c (build_over_call): Check calls only when tf_warning is set.
2115 2020-07-06 Nathan Sidwell <nathan@acm.org>
2117 * decl.c (push_library_fn): Return the decl pushdecl_toplevel returns.
2118 * except.c (verify_library_fn): Replace with ...
2119 (declare_library_fn_1): ... this fn. Always push the fn.
2120 (declare_library_fn): Call it.
2121 (build_throw): Call declare_library_fn_1.
2123 2020-07-06 Jonathan Wakely <jwakely@redhat.com>
2126 * parser.c (cp_parser_toplevel_declaration): Only do pedwarn for
2127 empty-declaration in C++98.
2129 2020-07-02 Jason Merrill <jason@redhat.com>
2130 Jakub Jelinek <jakub@redhat.com>
2132 * decl.c (grokfndecl): Allow consteval virtual.
2133 * search.c (check_final_overrider): Check consteval mismatch.
2134 * constexpr.c (cxx_eval_thunk_call): New.
2135 (cxx_eval_call_expression): Call it.
2136 * cvt.c (cp_get_fndecl_from_callee): Handle FDESC_EXPR.
2137 * decl2.c (mark_vtable_entries): Track vtables with consteval.
2138 (maybe_emit_vtables): Pass consteval_vtables through.
2139 (clear_consteval_vfns): Replace consteval with nullptr.
2140 (c_parse_final_cleanups): Call it.
2142 2020-07-01 Nathan Sidwell <nathan@acm.org>
2144 * class.c (copy_fndecl_with_name): Add additional predicate args, do
2145 not deduce them locally.
2146 (copy_operator_fn): Adjust copy_fndecl_with_name call.
2147 (build_clone): Add vtt and inherited predicate args. Pass through
2148 to copy_fndecl_with_name call.
2149 (build_cdtor_clones): Likewise, pass through to build_clone as
2151 (build_cdtor): Determine vtt and inherited here.
2152 * cp-tree.h (DECL_NEEDS_CTT_PARM_P): Delete.
2154 2020-06-30 Nathan Sidwell <nathan@acm.org>
2156 * cp-tree.h (copy_fndecl_with_name): Rename to ...
2157 (copy_operatorn_fn): ... this. Change arg type.
2158 (clone_function_decl): Rename to ...
2159 (clone_cdtor): ... this.
2160 * class.c (copy_fndecl_with_name): Make static.
2161 (copy_operator_fn): New wrapper.
2162 (build_clones): Rename to ...
2163 (build_cdtor_clones): ... this.
2164 (clone_function_decl): Rename to ...
2165 (clone_cdtor): ... this. Adjust build_clones calls.
2166 (clone_constructors_and_destructors): Adjust clone_function_decl
2168 * method.c (implicitly_declare_fn): Adjust copy_fndecl_with_name
2170 (lazily_declare_fn): Adjust clone_function_decl call.
2171 * pt.c (tsubst_function_decl): Likewise.
2172 (instantiate_template_1): Likewise.
2174 2020-06-30 Iain Sandoe <iain@sandoe.co.uk>
2176 * coroutines.cc (morph_fn_to_coro): Remove trailing
2177 space in a diagnostic.
2179 2020-06-30 Iain Sandoe <iain@sandoe.co.uk>
2181 * coroutines.cc (expand_one_await_expression): Remove
2182 code dealing with initial suspend.
2183 (build_actor_fn): Remove code special-casing initial
2184 and final suspend. Handle the final suspend and marking
2185 of the coroutine as done.
2186 (coro_rewrite_function_body): New.
2187 (bind_expr_find_in_subtree): Remove.
2188 (coro_body_contains_bind_expr_p): Remove.
2189 (morph_fn_to_coro): Split the rewrite of the original
2190 function into coro_rewrite_function_body and call it.
2192 2020-06-29 Marek Polacek <polacek@redhat.com>
2195 * decl.c (duplicate_decls): Make sure a concept or a variable
2196 template is unique in its declarative region.
2198 2020-06-29 Marek Polacek <polacek@redhat.com>
2201 * pt.c (collect_ctor_idx_types): Use TREE_TYPE.
2203 2020-06-28 Iain Sandoe <iain@sandoe.co.uk>
2206 * coroutines.cc (register_local_var_uses): Skip past
2209 2020-06-27 Iain Sandoe <iain@sandoe.co.uk>
2212 * coroutines.cc (get_awaitable_var): New helper.
2213 (build_co_await): Check more carefully before
2214 copying an awaitable.
2215 (expand_one_await_expression): No initializer
2216 is required when the awaitable is not a temp.
2217 (register_awaits): Remove handling that is now
2218 completed when the await expression is built.
2220 2020-06-27 Iain Sandoe <iain@sandoe.co.uk>
2222 * coroutines.cc (morph_fn_to_coro): Diagnose unavailable
2223 get_return_object_on_allocation_failure.
2225 2020-06-26 Iain Sandoe <iain@sandoe.co.uk>
2228 * coroutines.cc (struct coroutine_info):Add a field
2229 to hold computed p.return_void expressions.
2230 (coro_build_promise_expression): New.
2231 (get_coroutine_return_void_expr): New.
2232 (finish_co_yield_expr): Build the promise expression
2233 using coro_build_promise_expression.
2234 (finish_co_return_stmt): Likewise.
2235 (build_init_or_final_await): Likewise.
2236 (morph_fn_to_coro): Likewise, for several cases.
2238 2020-06-26 Iain Sandoe <iain@sandoe.co.uk>
2240 * coroutines.cc (morph_fn_to_coro): Handle error
2241 returns in building g-r-o-o-a-f expressions.
2243 2020-06-24 Nicholas Krause <xerofoify@gmail.com>
2246 * typeck2.c (cxx_incomplete_type_diagnostic): Add missing
2247 TYPE_EXPANSION_PACK check for diagnosing incomplete types in
2248 cxx_incomplete_type_diagnostic.
2250 2020-06-24 Iain Sandoe <iain@sandoe.co.uk>
2254 * coroutines.cc (act_des_fn): Copy function
2255 attributes onto the outlined coroutine helpers.
2257 2020-06-24 Jason Merrill <jason@redhat.com>
2259 * call.c (build_over_call): Only call build_base_path once.
2261 2020-06-24 Jason Merrill <jason@redhat.com>
2264 * call.c (build_over_call): Look up the overrider in base_binfo.
2265 * class.c (lookup_vfn_in_binfo): Look through BINFO_PRIMARY_P.
2267 2020-06-23 Jason Merrill <jason@redhat.com>
2270 Implement C++20 P2082R1, Fixing CTAD for aggregates.
2271 * cp-tree.h (TPARMS_PRIMARY_TEMPLATE): Split out from...
2272 (DECL_PRIMARY_TEMPLATE): ...here.
2273 (builtin_guide_p): Declare.
2274 * decl.c (reshape_init_class): Handle bases of a template.
2275 (reshape_init_r): An array with dependent bound takes a single
2277 * pt.c (tsubst_default_argument): Shortcut {}.
2278 (unify_pack_expansion): Allow omitted arguments to trailing pack.
2279 (builtin_guide_p): New.
2280 (collect_ctor_idx_types): Give a trailing pack a {} default
2281 argument. Handle arrays better.
2283 2020-06-23 Iain Sandoe <iain@sandoe.co.uk>
2286 * coroutines.cc (morph_fn_to_coro): Apply a cleanup to
2287 the get return object when the DTOR is non-trivial.
2289 2020-06-20 Iain Sandoe <iain@sandoe.co.uk>
2292 * coroutines.cc (morph_fn_to_coro): Update handling of
2293 get-return-object-on-allocation-fail and diagnose missing
2296 2020-06-20 Jason Merrill <jason@redhat.com>
2298 * call.c (joust): Only compare constraints for non-template
2299 candidates with matching parameters.
2300 * pt.c (tsubst_pack_expansion): Fix getting a type parameter
2302 (more_specialized_fn): Only compare constraints for candidates with
2303 matching parameters.
2305 2020-06-19 Jason Merrill <jason@redhat.com>
2307 * method.c (early_check_defaulted_comparison): Allow defaulting
2308 comparison outside class. Complain if non-member operator isn't a
2311 2020-06-18 Jason Merrill <jason@redhat.com>
2313 * method.c (early_check_defaulted_comparison): Check for &&.
2314 (build_comparison_op): Allow empty union. Diagnose non-category
2316 (common_comparison_type): Remove handling for non-category type.
2318 2020-06-18 Marek Polacek <polacek@redhat.com>
2321 * pt.c (finish_template_variable): Return if
2322 coerce_innermost_template_parms return error_mark_node.
2324 2020-06-18 Marek Polacek <polacek@redhat.com>
2327 * pt.c (tsubst_copy_and_build) <case NEW_EXPR>: Return error_mark_node
2328 if placement is erroneous.
2330 2020-06-17 Jonathan Wakely <jwakely@redhat.com>
2333 * parser.c (cp_parser_elaborated_type_specifier): Do not warn
2334 unless in a declaration.
2336 2020-06-17 Jason Merrill <jason@redhat.com>
2338 * cp-tree.h (copy_fndecl_with_name): Declare.
2339 * class.c (copy_fndecl_with_name): Split out from...
2340 (build_clone): ...here.
2341 (add_implicitly_declared_members): Add op== to TYPE_FIELDS.
2342 * method.c (implicitly_declare_fn): Use copy_fndecl_with_name.
2344 2020-06-17 Jason Merrill <jason@redhat.com>
2346 * call.c (build_new_op_1): Don't look for a CALL_EXPR when
2347 calling a consteval function.
2349 2020-06-17 Jason Merrill <jason@redhat.com>
2351 * decl2.c (grokfield): Pass SD_DEFAULTED and SD_DELETED.
2352 * decl.c (duplicate_decls): Reduce error for delete
2353 after earlier declaration to pedwarn.
2355 2020-06-17 Marek Polacek <polacek@redhat.com>
2358 * constexpr.c (maybe_fold_non_dependent_expr): New.
2359 * cp-tree.h (maybe_fold_non_dependent_expr): Declare.
2360 * typeck.c (cp_build_array_ref): Call maybe_fold_non_dependent_expr
2361 instead of maybe_constant_value.
2363 2020-06-16 Marek Polacek <polacek@redhat.com>
2366 * call.c (add_list_candidates): Return if a designated initializer
2367 is used with a non-aggregate.
2368 (implicit_conversion_error): Give an error for the case above.
2370 2020-06-16 Marek Polacek <polacek@redhat.com>
2373 * name-lookup.c (check_local_shadow): Check if types are
2374 non-null before calling same_type_p.
2376 2020-06-16 Jakub Jelinek <jakub@redhat.com>
2378 * semantics.c (handle_omp_for_class_iterator): Adjust
2379 c_omp_check_loop_iv_exprs caller.
2380 (finish_omp_for): Likewise. Don't call fold_build_cleanup_point_expr
2381 before calling c_finish_omp_for and c_omp_check_loop_iv, move it
2383 * pt.c (tsubst_omp_for_iterator): Handle non-rectangular loops.
2385 2020-06-16 Jakub Jelinek <jakub@redhat.com>
2387 * parser.c (cp_parser_omp_clause_schedule): Reject modifier separated
2388 from kind by comma rather than colon.
2390 2020-06-16 Patrick Palka <ppalka@redhat.com>
2392 * pt.c (perform_instantiation_time_access_checks): No need to
2394 * semantics.c (enforce_access): Verify that decl is not
2397 2020-06-16 Patrick Palka <ppalka@redhat.com>
2401 * cp-tree.h (qualified_typedef_usage_s): Delete.
2402 (qualified_typedef_usage_t): Delete.
2403 (deferred_access_check): Move up in file.
2404 (tree_template_info::typedefs_needing_access_checking): Delete.
2405 (tree_template_info::deferred_access_checks): New field.
2406 (TI_TYPEDEFS_NEEDING_ACCESS_CHECKING): Rename to ...
2407 (TI_DEFERRED_ACCESS_CHECKS): ... this, and adjust accordingly.
2408 * pt.c (perform_typedefs_access_check): Rename to ...
2409 (perform_instantiation_time_access_checks): ... this, and adjust
2410 accordingly. Remove unnecessary tree tests.
2411 (instantiate_class_template_1): Adjust accordingly.
2412 (instantiate_decl): Likewise.
2413 * semantics.c (enforce_access): Likewise.
2415 2020-06-16 Patrick Palka <ppalka@redhat.com>
2419 * call.c (enforce_access): Move to semantics.c.
2420 * cp-tree.h (enforce_access): Delete.
2421 (get_types_needing_access_check): Delete.
2422 (add_typedef_to_current_template_for_access_check): Delete.
2423 * decl.c (make_typename_type): Adjust accordingly. Use
2424 check_accessibility_of_qualified_id instead of directly using
2425 perform_or_defer_access_check.
2426 * parser.c (cp_parser_template_declaration_after_parameters):
2427 Don't push a dk_no_check access state when parsing a template.
2428 * pt.c (get_types_needing_access_check): Delete.
2429 (append_type_to_template_for_access_check_1): Delete.
2430 (perform_typedefs_access_check): Adjust. If type_decl is a
2431 FIELD_DECL, also check its DECL_CONTEXT for dependence. Use
2432 tsubst_copy instead of tsubst to substitute into type_decl so
2433 that we substitute into the DECL_CONTEXT of a FIELD_DECL.
2434 (append_type_to_template_for_access_check): Delete.
2435 * search.c (accessible_p): Remove the processing_template_decl
2437 * semantics.c (enforce_access): Moved from call.c. If we're
2438 parsing a template and the access check failed, add the check to
2439 TI_TYPEDEFS_NEEDING_ACCESS_CHECKING.
2440 (perform_or_defer_access_check): Adjust comment.
2441 (add_typedef_to_current_template_for_access_check): Delete.
2442 (check_accessibility_of_qualified_id): Adjust accordingly.
2443 Exit early if the scope is dependent.
2445 2020-06-11 Patrick Palka <ppalka@redhat.com>
2448 * constraint.cc (associate_classtype_constraints): If there is a
2449 discrepancy between the current template depth and the template
2450 depth of the original declaration, then adjust the template
2451 parameter depth within the current constraints appropriately.
2452 * pt.c (tsubst_friend_class): Substitute into and set the
2453 constraints on the injected declaration.
2455 2020-06-11 Iain Sandoe <iain@sandoe.co.uk>
2457 * coroutines.cc (instantiate_coro_traits): Pass a reference
2458 to lambda closure objects to traits instantiation.
2459 (morph_fn_to_coro): Likewise for promise parameter
2460 preview and allocator lookup.
2462 2020-06-10 Iain Sandoe <iain@sandoe.co.uk>
2465 * call.c (add_candidates): Use vec_safe_length() for
2466 testing the arguments list.
2467 (build_new_method_call_1): Use vec_safe_is_empty() when
2468 checking for an empty args list.
2470 2020-06-10 Marek Polacek <polacek@redhat.com>
2473 * parser.c (cp_parser_direct_declarator): Clear
2474 CP_PARSER_FLAGS_DELAY_NOEXCEPT if the declarator kind is not
2477 2020-06-09 Iain Sandoe <iain@sandoe.co.uk>
2480 * coroutines.cc (expand_one_await_expression): Build separate
2481 DTOR trees for the awaitable object on the destroy and resume
2484 2020-06-09 Jason Merrill <jason@redhat.com>
2487 * cp-gimplify.c (predeclare_vla): Only predeclare a VLA if it's
2488 wrapped in a pointer type.
2490 2020-06-05 Marek Polacek <polacek@redhat.com>
2493 * call.c (build_converted_constant_expr_internal): Allow
2494 list-initialization.
2496 2020-06-05 Iain Sandoe <iain@sandoe.co.uk>
2498 * cp-tree.def (CO_RETURN_EXPR): Correct the class
2499 to use tcc_statement.
2501 2020-06-05 Jason Merrill <jason@redhat.com>
2503 * error.c (dump_binary_op): Handle negative operand to
2506 2020-06-04 Jason Merrill <jason@redhat.com>
2509 * constexpr.c (cxx_eval_constant_expression) [OBJ_TYPE_REF]:
2510 Evaluate OBJ_TYPE_REF_EXPR.
2512 2020-06-04 Jason Merrill <jason@redhat.com>
2515 * class.c (lookup_vfn_in_binfo): New.
2516 * call.c (build_over_call): Use it.
2517 * cp-tree.h (resolves_to_fixed_type_p): Add default argument.
2518 (lookup_vfn_in_binfo): Declare.
2520 2020-06-04 Iain Sandoe <iain@sandoe.co.uk>
2523 * coroutines.cc (morph_fn_to_coro): Ensure that the get-
2524 return-object is constructed correctly; When it is not the
2525 final return value, pass it to the CTOR of the return type
2526 as an rvalue, per the standard comment.
2528 2020-06-04 Jakub Jelinek <jakub@redhat.com>
2532 * constexpr.c (cxx_eval_constant_expression): Diagnose CONVERT_EXPR
2533 conversions from pointer types to arithmetic types here...
2534 (cxx_eval_outermost_constant_expr): ... instead of here.
2536 2020-06-03 Mark Wielaard <mark@klomp.org>
2538 * parser.c (cp_lexer_safe_previous_token): New function.
2539 (cp_parser_error_1): Add name_hint if the previous token is
2540 a string literal and next token is a CPP_NAME and we have a
2541 missing header suggestion for the name.
2543 2020-06-03 Patrick Palka <ppalka@redhat.com>
2545 * pt.c (process_partial_specialization): Pass the full set of
2546 generic template arguments to strictly_subsumes.
2548 2020-06-03 Patrick Palka <ppalka@redhat.com>
2551 * pt.c (most_specialized_partial_spec): Reorganize the loop over
2552 DECL_TEMPLATE_SPECIALIZATIONS. Check constraints_satisfied_p on
2553 the original template declaration, not on the tsubsted one.
2555 2020-06-03 Iain Sandoe <iain@sandoe.co.uk>
2558 * coroutines.cc (finish_co_await_expr): Revise to allow for
2560 (finish_co_yield_expr): Likewise.
2562 2020-06-03 Jason Merrill <jason@redhat.com>
2565 * cp-tree.h (predeclare_vla): Declare.
2566 * cp-gimplify.c (predeclare_vla): Handle getting a decl.
2567 * pt.c (tsubst_expr) [DECL_EXPR]: Use it.
2569 2020-06-03 Tobias Burnus <tobias@codesourcery.com>
2571 * cp-gimplify.c (cxx_omp_predetermined_mapping): New.
2572 * cp-objcp-common.h (LANG_HOOKS_OMP_PREDETERMINED_MAPPING): Redfine.
2573 * cp-tree.h (cxx_omp_predetermined_mapping): Declare.
2575 2020-06-02 Jason Merrill <jason@redhat.com>
2578 * pt.c (tsubst_decl): Relax assert.
2580 2020-06-02 Iain Sandoe <iain@sandoe.co.uk>
2583 * coroutines.cc (build_co_await): Wrap the co_await expression
2584 in a TARGET_EXPR, where needed.
2585 (finish_co_yield_expr): Likewise.
2587 2020-06-02 Patrick Palka <ppalka@redhat.com>
2591 * pt.c (tsubst_function_decl): Don't do set_constraints when
2592 regenerating a lambda.
2593 (tsubst_lambda_expr): Substitute into the lambda's constraints
2594 and do set_constraints here.
2596 2020-06-01 Jason Merrill <jason@redhat.com>
2601 * class.c (build_vfn_ref): Revert 95311 change.
2602 * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call): Build a
2605 2020-06-01 Iain Sandoe <iain@sandoe.co.uk>
2608 * coroutines.cc (struct param_info): Remove rv_ref field.
2609 (build_actor_fn): Remove specifial rvalue ref handling.
2610 (morph_fn_to_coro): Likewise.
2612 2020-05-31 Iain Sandoe <iain@sandoe.co.uk>
2615 * coroutines.cc (morph_fn_to_coro): If we see an
2616 early fatal error, drop the erroneous function body.
2618 2020-05-31 Iain Sandoe <iain@sandoe.co.uk>
2620 * coroutines.cc (build_co_await): Remove unused
2622 (finish_co_await_expr): Likewise.
2623 (finish_co_yield_expr): Likewise; revise comment.
2625 2020-05-30 Iain Sandoe <iain@sandoe.co.uk>
2627 * coroutines.cc (morph_fn_to_coro): Revise initialization
2628 of the frame pointer to avoid an unused value.
2630 2020-05-30 Patrick Palka <ppalka@redhat.com>
2633 * constraint.cc (satisfaction_value): Accept INTEGER_CST of any
2636 2020-05-29 Patrick Palka <ppalka@redhat.com>
2637 Jason Merrill <jason@redhat.com>
2640 * class.c (add_method): Let special member function templates
2641 coexist if they are not equivalently constrained, or in a class
2644 2020-05-29 Jason Merrill <jason@redhat.com>
2647 * pt.c (process_template_parm): Set DECL_TEMPLATE_INFO
2648 on the DECL_TEMPLATE_RESULT.
2650 2020-05-29 Marek Polacek <polacek@redhat.com>
2653 * cp-gimplify.c (cp_fold) <case MODIFY_EXPR>: Don't set
2654 TREE_THIS_VOLATILE here.
2655 (cp_fold): Set it here along with TREE_NO_WARNING.
2657 2020-05-29 Jason Merrill <jason@redhat.com>
2661 * class.c (build_vfn_ref): Don't fold the INDIRECT_REF.
2663 2020-05-29 Patrick Palka <ppalka@redhat.com>
2668 * parser.c (cp_parser_requires_clause_expression): Temporarily
2669 increment processing_template_decl only if it is 0.
2670 (cp_parser_constraint_expression): Likewise.
2671 (cp_parser_requires_expression): Likewise.
2673 2020-05-29 Patrick Palka <ppalka@redhat.com>
2676 * constexpr.c (get_or_insert_ctor_field): Add limited support
2677 for RANGE_EXPR index lookups.
2679 2020-05-28 Jakub Jelinek <jakub@redhat.com>
2682 * decl.c (cp_finish_decomp): Call complete_type before checking
2685 2020-05-28 Jason Merrill <jason@redhat.com>
2688 * decl.c (cp_finish_decl): Revert r9-297 change.
2689 (check_static_variable_definition): Likewise.
2690 * constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
2691 * pt.c (instantiate_decl): Return early on type error.
2693 2020-05-27 Jason Merrill <jason@redhat.com>
2696 * decl.c (reshape_init_array_1): Don't reuse in overload context.
2698 2020-05-27 Jason Merrill <jason@redhat.com>
2701 * call.c (build_new_op_1): Suppress
2702 warn_zero_as_null_pointer_constant across comparison of <=> result
2705 2020-05-27 Jason Merrill <jason@redhat.com>
2708 * decl.c (grokdeclarator): Don't shift attributes in TYPENAME
2711 2020-05-27 Nathan Sidwell <nathan@acm.org>
2714 * pt.c (lookup_template_class_1): Restore alias template mutation.
2716 2020-05-26 Jakub Jelinek <jakub@redhat.com>
2719 * cp-gimplify.c: Include omp-general.h.
2720 (cp_genericize_r) <case OMP_DISTRIBUTE>: For class iteration
2721 variables in composite distribute parallel for, instantiate copy
2722 ctor of their types.
2724 2020-05-23 Patrick Palka <ppalka@redhat.com>
2727 * constexpr.c (cxx_eval_constant_expression)
2728 <case TEMPLATE_ID_EXPR>: Don't evaluate the concept when
2729 constexpr evaluation is uid-sensitive.
2731 2020-05-22 Jason Merrill <jason@redhat.com>
2733 * cp-gimplify.c (cp_gimplify_expr) [CALL_EXPR]: Don't preevaluate
2734 the function address if the call used operator syntax.
2736 2020-05-21 Jason Merrill <jason@redhat.com>
2739 * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call): For a virtual
2740 call, instrument the OBJ_TYPE_REF.
2742 * decl.c (compute_array_index_type_loc): Diagnose expressions
2743 in a template that can't be constant.
2744 * parser.c (cp_parser_direct_declarator): Don't check
2745 non-constant array bounds here.
2747 * cp-tree.h (is_rvalue_constant_expression): Declare.
2748 * constexpr.c (is_rvalue_constant_expression): New.
2749 * parser.c (cp_parser_constant_expression): Use it.
2750 * decl.c (cp_finish_decl): Try to treat a constexpr initializer in a
2751 template as constant.
2753 * typeck.c (build_x_modify_expr): Handle error_mark_node arguments.
2755 * decl.c (grokparms): Return NULL_TREE if any parms were erroneous.
2757 2020-05-21 Iain Sandoe <iain@sandoe.co.uk>
2759 * coroutines.cc (finish_co_return_stmt): Revert change to use
2762 2020-05-21 Patrick Palka <ppalka@redhat.com>
2765 * constexpr.c (constexpr_ctx::uid_sensitive): Remove field.
2766 (uid_sensitive_constexpr_evaluation_value): Define.
2767 (uid_sensitive_constexpr_evaluation_true_counter): Define.
2768 (uid_sensitive_constexpr_evaluation_p): Define.
2769 (uid_sensitive_constexpr_evaluation_sentinel): Define its
2771 (uid_sensitive_constexpr_evaluation_checker): Define its
2772 constructor and its evaluation_restricted_p method.
2773 (get_fundef_copy): Remove 'ctx' parameter. Use u_s_c_e_p
2774 instead of constexpr_ctx::uid_sensitive.
2775 (cxx_eval_call_expression): Use u_s_c_e_p instead, and test it
2776 last. Adjust call to get_fundef_copy.
2777 (instantiate_cx_fn_r): Test u_s_c_e_p so that we increment the
2778 counter if necessary.
2779 (cxx_eval_outermost_constant_expr): Remove 'uid_sensitive'
2780 parameter. Adjust function body accordingly.
2781 (maybe_constant_value): Remove 'uid_sensitive' parameter and
2782 adjust function body accordingly. Set up a
2783 uid_sensitive_constexpr_evaluation_checker, and use it to
2784 conditionally update the cv_cache.
2785 * cp-gimplify.c (cp_fold): Set up a
2786 uid_sensitive_constexpr_evaluation_checker, and use it to
2787 conditionally update the fold_cache.
2788 * cp-tree.h (maybe_constant_value): Update declaration.
2789 (struct uid_sensitive_constexpr_evaluation_sentinel): Define.
2790 (struct sensitive_constexpr_evaluation_checker): Define.
2791 * expr.c (fold_for_warn): Set up a
2792 uid_sensitive_constexpr_evaluation_sentinel before calling
2793 the folding subroutines. Drop all but the first argument to
2794 maybe_constant_value.
2796 2020-05-20 Marek Polacek <polacek@redhat.com>
2799 * parser.c (cp_parser_unqualified_id): Reject simple-template-id as
2800 the declarator-id of a destructor.
2801 (cp_parser_constructor_declarator_p): Reject simple-template-id as
2802 the declarator-id of a constructor.
2804 2020-05-20 Marek Polacek <polacek@redhat.com>
2808 * cp-tree.h (SD_DECOMPOSITION): New flag.
2809 * decl.c (duplicate_decls): Make sure a structured binding is unique
2810 in its declarative region.
2811 (start_decl): If INITIALIZED is SD_DECOMPOSITION, call
2812 fit_decomposition_lang_decl.
2813 (grokdeclarator): Compare INITIALIZED directly to SD_* flags.
2814 * parser.c (cp_parser_decomposition_declaration): Pass SD_DECOMPOSITION
2817 2020-05-20 Patrick Palka <ppalka@redhat.com>
2820 * typeck.c (structural_comptypes): Don't perform
2821 context-dependent resolution of TYPENAME_TYPEs when
2822 comparing_specializations.
2824 2020-05-19 Nathan Sidwell <nathan@acm.org>
2826 * pt.c (lookup_template_class_1): Do not reinit template_info of an
2829 2020-05-18 Martin Sebor <msebor@redhat.com>
2832 * call.c ((maybe_warn_class_memaccess): Use is_byte_access_type.
2833 * cp-tree.h (is_dummy_object): Return bool.
2834 (is_byte_access_type): Declare new function.
2835 * tree.c (is_dummy_object): Return bool.
2836 (is_byte_access_type): Define new function.
2838 2020-05-19 Patrick Palka <ppalka@redhat.com>
2841 * pt.c (init_template_processing): Enable sanitization for
2842 decl_specializations and type_specializations.
2845 * pt.c (fn_type_unification): Pass 'fn' instead of NULL_TREE as
2846 the 'in_decl' parameter to coerce_template_parms.
2848 2020-05-18 Marek Polacek <polacek@redhat.com>
2851 * typeck.c (cp_build_binary_op): Use fold_for_warn instead of
2854 2020-05-18 Marek Polacek <polacek@redhat.com>
2857 * cvt.c (cp_get_fndecl_from_callee): Return NULL_TREE if the function
2858 type is not INDIRECT_TYPE_P.
2859 * decl.c (omp_declare_variant_finalize_one): Call
2860 cp_get_callee_fndecl_nofold instead of looking for the function decl
2863 2020-05-18 Marek Polacek <polacek@redhat.com>
2866 * parser.c (cp_parser_has_attribute_expression): Sorry on a
2867 type-dependent argument.
2869 2020-05-18 Marek Polacek <polacek@redhat.com>
2873 * call.c (add_builtin_candidate) <case EQ_EXPR>: Create candidate
2874 operator functions when type is std::nullptr_t for ==/!=.
2875 * typeck.c (composite_pointer_type_r): Add a bool * parameter. Use it
2876 to maybe add "const" to the pointer type.
2877 (composite_pointer_type): Update the call to composite_pointer_type_r.
2878 (cp_build_binary_op): Turn two warning_at into error_at. Print the
2881 2020-05-18 Jason Merrill <jason@redhat.com>
2883 * call.c (build_over_call): Remove unnecessary
2884 cp_stabilize_reference.
2886 2020-05-18 Marek Polacek <polacek@redhat.com>
2888 * call.c (add_builtin_candidate): Don't create a builtin overload
2889 candidate for ++ when type is bool in C++17.
2891 2020-05-18 Marek Polacek <polacek@redhat.com>
2893 * cfns.h: Regenerated.
2895 2020-05-17 Iain Sandoe <iain@sandoe.co.uk>
2897 * coroutines.cc (morph_fn_to_coro): Initialize the gro variable.
2899 2020-05-16 Iain Sandoe <iain@sandoe.co.uk>
2901 * coroutines.cc (finish_co_return_stmt): Implement rules
2902 from [class.copy.elision] /3.
2904 2020-05-16 Patrick Palka <ppalka@redhat.com>
2907 * semantics.c (finish_decltype_type): Call
2908 instantiate_non_dependent_expr_sfinae on the expression.
2910 2020-05-15 Patrick Palka <ppalka@redhat.com>
2914 2020-04-07 Patrick Palka <ppalka@redhat.com>
2917 * typeck2.c (process_init_constructor_array): Propagate
2918 CONSTRUCTOR_PLACEHOLDER_BOUNDARY up from each element initializer to
2919 the array initializer.
2921 2020-05-15 Jason Merrill <jason@redhat.com>
2923 PR c++/93286 - ICE with __is_constructible and variadic template.
2924 * pt.c (tsubst_tree_list): New.
2925 (tsubst, tsubst_copy_and_build): Use it.
2926 * decl2.c (is_late_template_attribute): Handle error_mark_node args.
2928 2020-05-15 Nathan Sidwell <nathan@acm.org>
2930 * pt.c (template_args_equal): Fix thinkos in previous 'cleanup'.
2932 2020-05-14 Jason Merrill <jason@redhat.com>
2935 * pt.c (maybe_instantiate_noexcept): Change clone handling.
2937 2020-05-14 Patrick Palka <ppalka@redhat.com>
2940 * call.c (build_op_call): Pass complain to lookup_fnfields.
2941 (build_special_member_call): Likewise.
2942 * class.c (type_requires_array_cookie): Pass tf_warning_or_error
2944 * cp-tree.h (lookup_fnfields): Add tsubst_flags_t parameter.
2945 * except.c (build_throw): Pass tf_warning_or_error to
2947 * init.c (build_new_1): Pass complain to lookup_fnfields.
2948 * method.c (locate_fn_flags): Likewise.
2949 * name-lookup.c (lookup_name_real_1): Pass tf_warning_or_error
2951 * pt.c (tsubst_baselink): Pass complain to lookup_fnfields.
2952 * search.c (lookup_fnfields): New 'complain' parameter. Pass it
2955 2020-05-14 Nathan Sidwell <nathan@acm.org>
2957 * parser.c (cp_parser_diagnose_invalid_typename): Mention
2958 std=c++20 not 2a, reformat dependent binfo inform loops.
2960 * pt.c (tsubst_template_decl): Reorder and commonize some control
2963 * pt.c (tsubst_friend_function): Simplify control flow.
2965 * pt.c (lookup_template_class_1): Remove unnecessary else by
2966 simply grabbing TYPE_NAME earlier.
2968 * pt.c (push_template_decl_real): Adjust friend pushing logic.
2969 Reinit template type.
2971 * pt.c (build_template_decl): Init DECL_TEMPLATE_RESULT &
2973 (process_partial_specialization): ... not here ...
2974 (push_template_decl_real, add_inherited_template_parms)
2975 (build_deduction_guide): ... or here.
2977 2020-05-14 Jakub Jelinek <jakub@redhat.com>
2979 * cp-gimplify.c (cp_genericize_r): Set cfun->has_omp_target.
2981 2020-05-13 Patrick Palka <ppalka@redhat.com>
2984 * init.c (build_vec_delete_1): Just return error_mark_node if
2985 deallocate_expr is error_mark_node.
2986 (build_delete): Just return error_mark_node if do_delete is
2989 2020-05-13 Patrick Palka <ppalka@redhat.com>
2992 * constraint.cc (tsubst_requires_expr): Produce a new
2993 requires-expression when processing_template_decl, even if
2994 template arguments are not dependent.
2996 2020-05-13 Marek Polacek <polacek@redhat.com>
2999 * decl.c (duplicate_decls): Set DECL_HAS_DEPENDENT_EXPLICIT_SPEC_P.
3001 2020-05-13 Nathan Sidwell <nathan@acm.org>
3003 * pt.c (template_args_equal): Reorder category checking for
3006 * pt.c (perform_typedefs_access_check): Cache expensively
3007 calculated object references.
3008 (check_auto_in_tmpl_args): Just assert we do not get unexpected
3009 nodes, rather than silently do nothing.
3010 (append_type_to_template_for_access): Likewise, cache expensie
3013 * pt.c (canonical_type_parameter): Simplify.
3015 Formatting fixups & some simplifications.
3016 * pt.c (spec_hash_table): New typedef.
3017 (decl_specializations, type_specializations): Use it.
3018 (retrieve_specialization): Likewise.
3019 (register_specialization): Remove unnecessary casts.
3020 (push_template_decl_real): Reformat.
3021 (instantiate_class_template_1): Use more RAII.
3022 (make_argument_pack): Simplify.
3023 (instantiate_template_1): Use gcc_checking_assert for expensive
3025 (instantiate_decl): Likewise.
3026 (resolve_typename_type): Reformat comment.
3027 * semantics.c (struct deferred_access): Remove unnecessary GTY on
3029 (begin_class_definition): Fix formatting.
3031 2020-05-13 Jason Merrill <jason@redhat.com>
3033 * call.c, class.c, constexpr.c, constraint.cc, decl.c, init.c,
3034 lambda.c, lex.c, method.c, name-lookup.c, parser.c, pt.c, tree.c,
3035 typeck2.c: Change cxx2a to cxx20.
3037 2020-05-12 Marek Polacek <polacek@redhat.com>
3040 * parser.c (cp_parser_postfix_expression) <case CPP_OPEN_PAREN>: When
3041 looking for a block-scope function declaration, look through the whole
3042 set, not just the first function in the overload set.
3044 2020-05-12 Jakub Jelinek <jakub@redhat.com>
3047 * pt.c (tsubst_decl): Deal with DECL_OMP_PRIVATIZED_MEMBER for
3050 2020-05-11 Jason Merrill <jason@redhat.com>
3052 Resolve C++20 NB comment CA104
3053 * pt.c (determine_specialization): Compare constraints for
3054 specialization of member template of class instantiation.
3056 2020-05-11 Jason Merrill <jason@redhat.com>
3060 * tree.c (cp_walk_subtrees): Stop at typedefs.
3061 Handle TYPENAME_TYPE here.
3062 * pt.c (find_parameter_packs_r): Not here.
3063 (for_each_template_parm_r): Clear *walk_subtrees.
3064 * decl2.c (min_vis_r): Look through typedefs.
3066 2020-05-11 Jason Merrill <jason@redhat.com>
3068 * call.c (implicit_conversion_error): Split out from...
3069 (perform_implicit_conversion_flags): ...here.
3070 (build_converted_constant_expr_internal): Use it.
3072 2020-05-11 Jason Merrill <jason@redhat.com>
3075 * parser.c (inject_parm_decls): Set current_class_ptr here.
3076 (cp_parser_direct_declarator): And here.
3077 (cp_parser_late_return_type_opt): Not here.
3078 (cp_parser_noexcept_specification_opt): Nor here.
3079 (cp_parser_exception_specification_opt)
3080 (cp_parser_late_noexcept_specifier): Remove unneeded parameters.
3082 2020-05-11 Jason Merrill <jason@redhat.com>
3084 * decl.c (cxx_init_decl_processing): Call declare_weak for
3087 2020-05-11 Jason Merrill <jason@redhat.com>
3089 * pt.c (instantiate_class_template_1): Call tsubst_expr for
3090 STATIC_ASSERT member.
3091 * ptree.c (cxx_print_xnode): Handle STATIC_ASSERT.
3093 2020-05-11 Jason Merrill <jason@redhat.com>
3095 * pt.c (find_parameter_packs_r) [LAMBDA_EXPR]: Remove redundant
3096 walking of capture list.
3098 2020-05-11 Jason Merrill <jason@redhat.com>
3100 * cp-tree.h (LOOKUP_EXPLICIT_TMPL_ARGS): Remove.
3101 * call.c (build_new_function_call): Don't set it.
3102 (build_new_method_call_1): Likewise.
3103 (build_over_call): Check cand->explicit_targs instead.
3105 2020-05-11 Jason Merrill <jason@redhat.com>
3107 * decl.c (compute_array_index_type_loc): Stabilize before building
3110 2020-05-11 Jason Merrill <jason@redhat.com>
3112 * decl.c (grokdeclarator): Adjust deprecated_state here.
3113 (start_decl): Not here.
3115 2020-05-08 Iain Sandoe <iain@sandoe.co.uk>
3118 * coroutines.cc (build_actor_fn): Ensure that bind scopes
3119 are marked as having side-effects where necessary.
3120 (replace_statement_captures): Likewise.
3121 (morph_fn_to_coro): Likewise.
3123 2020-05-08 Nathan Sidwell <nathan@acm.org>
3125 * NEWS: Delete, it is so stale.
3127 * parser.c (cp_lexer_set_source_position_from_token): EOF has a
3130 2020-05-07 Iain Sandoe <iain@sandoe.co.uk>
3134 * coroutines.cc (morph_fn_to_coro): Set unformed outline
3135 functions to error_mark_node. For early error returns suppress
3136 warnings about missing ramp return values. Fix reinstatement
3137 of the function body on pre-existing initial error.
3138 * decl.c (finish_function): Use the normal error path for fails
3139 in the ramp function, do not try to compile the helpers if the
3142 2020-05-07 Marek Polacek <polacek@redhat.com>
3144 PR c++/94590 - Detect long double -> double narrowing.
3145 * typeck2.c (check_narrowing): Detect long double -> double
3146 narrowing even when double and long double have the same
3147 precision. Make it handle conversions to float too.
3149 2020-05-07 Marek Polacek <polacek@redhat.com>
3152 * parser.c (cp_parser_class_specifier_1): Check that the scope is
3153 nested inside current scope before pushing it.
3155 2020-05-07 Marek Polacek <polacek@redhat.com>
3158 * typeck2.c (check_narrowing): Consider T* to bool narrowing
3161 2020-05-07 Marek Polacek <polacek@redhat.com>
3163 * decl.c (grok_op_properties): Fix spelling of non-static.
3164 * typeck.c (build_class_member_access_expr): Likewise.
3166 2020-05-07 Richard Biener <rguenther@suse.de>
3169 * optimize.c (update_cloned_parm): Copy DECL_NOT_GIMPLE_REG_P.
3171 2020-05-06 Marek Polacek <polacek@redhat.com>
3174 * pt.c (tsubst_copy_and_build): Call type_dependent_expression_p_push
3175 instead of uses_template_parms. Move the warning_sentinels after the
3178 2020-05-06 Jakub Jelinek <jakub@redhat.com>
3181 * typeck.c (cp_strict_aliasing_warning): New function.
3182 (cp_build_indirect_ref_1, build_reinterpret_cast_1): Use
3183 it instead of strict_aliasing_warning.
3186 * method.c (defaulted_late_check): Don't call synthesize_method
3187 on constexpr sfk_comparison if it has been called on it already.
3189 2020-05-06 Nathan Sidwell <nathan@acm.org>
3192 * decl.c (grokdeclarator): Don't splice template attributes in
3193 parm context -- they can apply to the parm.
3195 2020-05-05 Iain Sandoe <iain@sandoe.co.uk>
3197 * coroutines.cc: Remove references to n4849 throughout.
3199 2020-05-05 Jason Merrill <jason@redhat.com>
3202 * pt.c (more_specialized_fn): Do consider parms with no deducible
3203 template parameters.
3205 2020-05-05 Jason Merrill <jason@redhat.com>
3208 * constexpr.c (potential_constant_expression_1): In a lambda
3209 function, consider a captured variable directly.
3211 2020-05-05 Iain Sandoe <iain@sandoe.co.uk>
3213 * coroutines.cc (transform_await_wrapper): Check that we have
3214 no unlowered co_yields.
3215 (captures_temporary): Likewise.
3216 (register_awaits): Likewise.
3218 2020-05-05 Nathan Sidwell <nathan@acm.org>
3221 * coroutines.cc (morph_fn_to_coro): Just check for
3223 * pt.c (tsubst_function_decl): Update lambda fn's this_ptr name.
3225 2020-05-05 Marek Polacek <polacek@redhat.com>
3226 Jason Merrill <jason@redhat.com>
3229 * parser.c (cp_parser_postfix_dot_deref_expression): If we have
3230 a type-dependent object of class type, stash it to
3231 parser->context->object_type. If the postfix expression doesn't have
3233 (cp_parser_class_name): Consider object scope too.
3234 (cp_parser_lookup_name): Remove code dealing with the case when
3235 object_type is unknown_type_node.
3237 2020-05-04 Patrick Palka <ppalka@redhat.com>
3240 * cp-gimplify.c (cp_fold) <case CALL_EXPR>: Move some variable
3241 declarations closer to their uses. Copy the CALL_EXPR only
3242 when one of its arguments has changed.
3243 <case TREE_VEC>: Instead of first collecting the folded
3244 arguments into a releasing_vec, just make a copy of the TREE_VEC
3245 as soon as folding changes one of its arguments.
3247 2020-05-04 Iain Sandoe <iain@sandoe.co.uk>
3249 * coroutines.cc (morph_fn_to_coro): Mark the coro.gro variable
3250 as artificial and ignored.
3252 2020-05-04 Nathan Sidwell <nathan@acm.org>
3254 pt.c (process_template_parm): Don't walk the template list twice,
3255 remember the final node instead.
3256 (end_template_parm_list): Refactor. Comment on why we do a pop
3259 PR c++/94827 -- don't save parms in nested requirement
3260 * constraint.cc (tsubst_nested_requirement): TYPE directly holds
3261 notmalized requirement.
3262 (finish_nested_requirement): Don't stash current tpl parms into
3264 (diagnose_nested_requirement): TYPE directly holds notmalized
3267 2020-05-01 Patrick Palka <ppalka@redhat.com>
3270 * cp-tree.h (check_accessibility_of_qualified_id): Add
3271 tsubst_flags_t parameter and change return type to bool.
3272 * parser.c (cp_parser_lookup_name): Pass tf_warning_to_error to
3273 check_accessibility_of_qualified_id.
3274 * pt.c (tsubst_qualified_id): Return error_mark_node if
3275 check_accessibility_of_qualified_id returns false.
3276 * semantics.c (check_accessibility_of_qualified_id): Add
3277 complain parameter. Pass complain instead of
3278 tf_warning_or_error to perform_or_defer_access_check. Return
3279 true unless perform_or_defer_access_check returns false.
3281 2020-05-01 Marek Polacek <polacek@redhat.com>
3284 * typeck2.c (process_init_constructor_record): Return PICFLAG_ERRONEOUS
3285 if an initializer element was erroneous.
3287 2020-05-01 Jason Merrill <jason@redhat.com>
3290 * init.c (get_nsdmi): Don't push_to_top_level for a local class.
3292 2020-05-01 Jason Merrill <jason@redhat.com>
3295 * decl.c (cp_finish_decl): Also clear TREE_READONLY if
3296 -fmerge-all-constants.
3298 2020-05-01 Jason Merrill <jason@redhat.com>
3301 * pt.c (tsubst_decl): Make sure DECL_VALUE_EXPR continues to have
3302 the same type as the variable.
3304 2020-04-30 Jason Merrill <jason@redhat.com>
3305 Nathan Sidwell <nathan@acm.org>
3308 * constraint.cc (map_arguments): If ARGS is null, it's a
3309 self-mapping of parms.
3310 (finish_nested_requirement): Do not pass argified
3311 current_template_parms to normalization.
3312 (tsubst_nested_requirement): Don't assert no template parms.
3314 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
3317 * coroutines.cc (transform_local_var_uses): Defer walking
3318 the DECL_INITIALs of BIND_EXPR vars until all the frame
3319 allocations have been made.
3321 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
3324 * coroutines.cc (register_awaits): Update target
3325 expressions for awaitable and suspend handle
3328 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
3331 * coroutines.cc (build_co_await): Account for variables
3332 with DECL_VALUE_EXPRs.
3333 (captures_temporary): Likewise.
3334 (register_awaits): Likewise.
3336 2020-04-29 Patrick Palka <ppalka@redhat.com>
3339 * pt.c (find_template_parameter_info::parm_list): New field.
3340 (keep_template_parm): Use the new field to build up the
3341 parameter list here instead of ...
3342 (find_template_parameters): ... here. Return ftpi.parm_list.
3344 2020-04-29 Jakub Jelinek <jakub@redhat.com>
3347 * class.c (build_base_field): Set DECL_FIELD_ABI_IGNORED on C++17 empty
3348 base artificial FIELD_DECLs.
3349 (layout_class_type): Set DECL_FIELD_ABI_IGNORED on empty class
3350 field_poverlapping_p FIELD_DECLs.
3352 2020-04-29 Patrick Palka <ppalka@redhat.com>
3355 * constraint.cc (satisfy_declaration_constraints): Use saved_t
3356 instead of t as the key to decl_satisfied_cache.
3359 * error.c (print_requires_expression_info): Print the dependent
3360 form of the parameter list with its template parameter mapping,
3361 rather than printing the substituted form.
3363 2020-04-28 Jason Merrill <jason@redhat.com>
3366 * decl.c (use_eh_spec_block): Check nothrow type after
3368 * pt.c (maybe_instantiate_noexcept): Call synthesize_method for
3369 DECL_MAYBE_DELETED fns here.
3370 * decl2.c (mark_used): Not here.
3371 * method.c (get_defaulted_eh_spec): Reject DECL_MAYBE_DELETED here.
3373 2020-04-28 Iain Sandoe <iain@sandoe.co.uk>
3376 * coroutines.cc (instantiate_coro_traits): Pass a reference to
3377 object type rather than a pointer type for 'this', for method
3379 (struct param_info): Add a field to hold that the parm is a lambda
3381 (morph_fn_to_coro): Check for lambda closure pointers in the
3382 args. Use a reference to *this when building the args list for the
3383 promise allocator lookup.
3385 2020-04-28 Iain Sandoe <iain@sandoe.co.uk>
3388 * coroutines.cc (coro_promise_type_found_p): Do not
3389 exclude non-classes here (this needs to be handled in the
3391 (morph_fn_to_coro): Allow for the case where the coroutine
3394 2020-04-27 Iain Sandoe <iain@sandoe.co.uk>
3397 * coroutines.cc (struct local_var_info): Add fields for static
3398 variables and those with DECL_VALUE_EXPR redirection.
3399 (transform_local_var_uses): Skip past typedefs and static vars
3400 and then account for redirected variables.
3401 (register_local_var_uses): Likewise.
3403 2020-04-27 Jason Merrill <jason@redhat.com>
3407 * decl.c (grokdeclarator): Move dependent attribute to decl.
3408 * decl2.c (splice_template_attributes): No longer static.
3410 2020-04-27 Patrick Palka <ppalka@redhat.com>
3413 * constexpr.c (cxx_eval_call_expression): Don't set new_obj if we're
3414 evaluating the target constructor of a delegating constructor.
3415 (cxx_eval_store_expression): Don't set TREE_READONLY if the LHS of the
3416 INIT_EXPR is '*this'.
3418 2020-04-26 Marek Polacek <polacek@redhat.com>
3421 * call.c (struct conversion): Add copy_init_p.
3422 (standard_conversion): Set copy_init_p in ck_base and ck_rvalue
3423 if FLAGS demands LOOKUP_ONLYCONVERTING.
3424 (convert_like_real) <case ck_base>: If copy_init_p is set, or
3425 LOOKUP_ONLYCONVERTING into FLAGS.
3427 2020-04-26 Iain Sandoe <iain@sandoe.co.uk>
3430 * coroutines.cc (morph_fn_to_coro): Ensure that
3431 unnamed function params have a usable and distinct
3434 2020-04-24 Jason Merrill <jason@redhat.com>
3437 * decl.c (redeclaration_error_message): Reject defaulted comparison
3438 operator that has been previously declared.
3440 2020-04-25 Patrick Palka <ppalka@redhat.com>
3442 * parser.c (cp_parser_diagnose_invalid_type_name): Suggest enabling
3443 concepts if the invalid identifier is 'requires'.
3445 2020-04-25 Jakub Jelinek <jakub@redhat.com>
3448 * semantics.c (finish_call_expr): When looking if all overloads
3449 are noreturn, use STRIP_TEMPLATE to look through TEMPLATE_DECLs.
3451 2020-04-24 Martin Liska <mliska@suse.cz>
3453 * coroutines.cc: Fix compilation error for release checking
3454 where we miss declaration of ‘coro_body_contains_bind_expr_p’.
3456 2020-04-23 Patrick Palka <ppalka@redhat.com>
3458 * tree.c (zero_init_expr_p): Use uses_template_parms instead of
3462 * pt.c (template_class_depth): Walk into the DECL_FRIEND_CONTEXT of a
3463 friend declaration rather than into its CP_DECL_CONTEXT.
3465 2020-04-23 Iain Sandoe <iain@sandoe.co.uk>
3468 * coroutines.cc (await_statement_expander): Simplify cases.
3469 (struct susp_frame_data): Add fields for truth and/or if
3470 cases, rename one field.
3471 (analyze_expression_awaits): New.
3472 (expand_one_truth_if): New.
3473 (add_var_to_bind): New helper.
3474 (coro_build_add_if_not_cond_break): New helper.
3475 (await_statement_walker): Handle conditional expressions,
3476 handle expansion of truth-and/or-if cases.
3477 (bind_expr_find_in_subtree): New, checking-only.
3478 (coro_body_contains_bind_expr_p): New, checking-only.
3479 (morph_fn_to_coro): Ensure that we have a top level bind
3482 2020-04-22 Jonathan Wakely <jwakely@redhat.com>
3484 PR translation/94698
3485 * class.c (check_field_decls): Change "define" to "declare" in
3486 -Weffc++ diagnostics.
3488 2020-04-22 Patrick Palka <ppalka@redhat.com>
3492 * constraint.cc (satisfy_declaration_constraints): If the inherited
3493 constructor points to an instantiation of a constructor template,
3494 remember and use its attached template arguments.
3496 2020-04-22 Jonathan Wakely <jwakely@redhat.com>
3498 PR translation/94698
3499 * class.c (check_field_decls): Change "override" to "define" in
3500 -Weffc++ diagnostics.
3502 2020-04-22 Iain Sandoe <iain@sandoe.co.uk>
3505 * coroutines.cc (struct param_info): Add a field to note that
3506 the param is 'this'.
3507 (morph_fn_to_coro): Convert this to a reference before using it
3508 in the promise parameter preview.
3510 2020-04-22 Jason Merrill <jason@redhat.com>
3513 * pt.c (register_parameter_specializations): If the instantiation is
3514 still a parameter pack, don't wrap it in a NONTYPE_ARGUMENT_PACK.
3515 (tsubst_pack_expansion, tsubst_expr): Adjust.
3517 2020-04-22 Martin Sebor <msebor@redhat.com>
3518 Jason Merrill <jason@redhat.com>
3521 * decl.c (reshape_init_array_1): Avoid stripping redundant trailing
3522 zero initializers...
3523 * mangle.c (write_expression): ...and handle them here even for
3524 pointers to members by calling zero_init_expr_p.
3525 * cp-tree.h (zero_init_expr_p): Declare.
3526 * tree.c (zero_init_expr_p): Define.
3527 (type_initializer_zero_p): Remove.
3528 * pt.c (tparm_obj_values): New hash_map.
3529 (get_template_parm_object): Store to it.
3530 (tparm_object_argument): New.
3532 2020-04-22 Patrick Palka <ppalka@redhat.com>
3535 * constraint.cc (diagnose_valid_expression): Check convert_to_void here
3536 as well as in tsubst_valid_expression_requirement.
3538 2020-04-21 Patrick Palka <ppalka@redhat.com>
3541 * constraint.cc (satisfy_declaration_constraints): Don't strip the
3542 inherited constructor if it already has template information.
3545 * pt.c (any_template_parm_r) <case IDENTIFIER_NODE>: New case. If this
3546 is a conversion operator, visit its TREE_TYPE.
3548 2020-04-21 Nathan Sidwell <nathan@acm.org>
3550 * pt.c (tsubst_copy_and_build) [POINTER_PLUS_EXPR]: Check for
3553 2020-04-21 Iain Sandoe <iain@sandoe.co.uk>
3556 * coroutines.cc (morph_fn_to_coro): Simplify return
3559 2020-04-17 Marek Polacek <polacek@redhat.com>
3562 * constexpr.c (cxx_eval_outermost_constant_expr): Return when T is
3563 a BRACE_ENCLOSED_INITIALIZER_P.
3564 (is_nondependent_constant_expression): Don't check
3565 BRACE_ENCLOSED_INITIALIZER_P.
3566 (is_nondependent_static_init_expression): Likewise.
3568 2020-04-20 Patrick Palka <ppalka@redhat.com>
3571 * cp-tree.h (lss_policy::lss_nop): New enumerator.
3572 * pt.c (local_specialization_stack::local_specialization_stack): Handle
3574 (local_specialization_stack::~local_specialization_stack): Likewise.
3575 (tsubst_pack_expansion): Use a local_specialization_stack instead of
3576 manually saving and restoring local_specializations. Conditionally
3577 replace local_specializations sooner, before the handling of the
3578 unsubstituted_packs case.
3580 2020-04-20 Marek Polacek <polacek@redhat.com>
3582 PR c++/94505 - bogus -Wparentheses warning with fold-expression.
3583 * pt.c (fold_expression): Add warning_sentinel for -Wparentheses
3584 before calling build_x_binary_op.
3586 2020-04-20 Marek Polacek <polacek@redhat.com>
3588 * coroutines.cc (captures_temporary): Don't assign the result of
3589 STRIP_NOPS to the same variable.
3591 2020-04-20 Nathan Sidwell <nathan@acm.org>
3593 PR c++/94454 - tpl-tpl-parms are not canonicalizable types
3594 * pt.c (canonical_type_parameter): Assert not a tpl-tpl-parm.
3595 (process_template_parm): tpl-tpl-parms are structural.
3596 (rewrite_template_parm): Propagate structuralness.
3598 PR c++/94454 - Expr pack expansion equality
3599 * tree.c (cp_tree_equal) [TEMPLATE_ID_EXPR, default]: Refactor.
3600 [EXPR_PACK_EXPANSION]: Add.
3602 PR c++/94454 Template Argument Hashing
3603 * pt.c (iterative_hash_template_arg): Strip nodes as
3604 template_args_equal does.
3605 [ARGUMENT_PACK_SELECT, TREE_VEC, CONSTRUCTOR]: Refactor.
3606 [node_class:TEMPLATE_TEMPLATE_PARM]: Hash by level & index.
3607 [node_class:default]: Refactor.
3609 2020-04-18 Patrick Palka <ppalka@redhat.com>
3612 * tree.c (cp_tree_equal) <case PARM_DECL>: Ignore
3613 comparing_specializations if the parameters' contexts are identical.
3616 * pt.c (splice_late_return_type): Propagate cv-qualifiers and
3617 PLACEHOLDER_TYPE_CONSTRAINTS from the original auto node to the new one.
3619 2020-04-17 Patrick Palka <ppalka@redhat.com>
3622 * lambda.c (lambda_capture_field_type): Avoid doing auto deduction if
3623 the explicit initializer has parameter packs.
3626 * parser.c (cp_parser_check_template_parameters): Before issuing a hard
3627 error, first try simulating an error instead.
3629 2020-04-17 Jakub Jelinek <jakub@redhat.com>
3632 * call.c (build_conditional_expr_1): Remove redundant assignment to
3635 2020-04-16 Patrick Palka <ppalka@redhat.com>
3638 * cvt.c (ocp_convert): If the result of scalar_constant_value is
3639 erroneous, ignore it and use the original expression.
3641 2020-04-16 Jakub Jelinek <jakub@redhat.com>
3644 * parser.c (cp_parser_simple_declaration): Fix up a pasto in
3647 2020-04-15 Jakub Jelinek <jakub@redhat.com>
3650 * parser.c (cp_parser_pragma) <case PRAGMA_OMP_REQUIRES>: Reject
3651 requires directive when not at file or namespace scope.
3653 2020-04-14 Iain Sandoe <iain@sandoe.co.uk>
3656 * coroutines.cc (build_actor_fn): Check that the target can
3657 support the resume tailcall before mandating it.
3659 2020-04-14 Patrick Palka <ppalka@redhat.com>
3662 * cxx-pretty-print.c (cxx_pretty_printer:simple_type_specifier)
3663 <case DECLTYPE_TYPE>: Handle DECLTYPE_TYPE here instead of ...
3664 (pp_cxx_type_specifier_seq) <case DECLTYPE_TYPE>: ... here.
3665 (cxx_pretty_printer::direct_abstract_declarator) <case DECLTYPE_TYPE>:
3669 * constexpr.c (replace_result_decl_data): New struct.
3670 (replace_result_decl_data_r): New function.
3671 (replace_result_decl): New function.
3672 (cxx_eval_call_expression): Use it.
3673 * tree.c (build_aggr_init_expr): Set the location of the AGGR_INIT_EXPR
3674 to that of its initializer.
3676 2020-04-13 Marek Polacek <polacek@redhat.com>
3679 * name-lookup.c (check_local_shadow): Add an inform call.
3681 2020-04-13 Patrick Palka <ppalka@redhat.com>
3684 * error.c (dump_scope): Pass TFF_NO_FUNCTION_ARGUMENTS to
3685 dump_function_decl when printing a function template instantiation as a
3689 * constexpr.c (get_or_insert_ctor_field): Set default value of parameter
3691 (cxx_eval_bare_aggregate): Use get_or_insert_ctor_field instead of
3692 assuming the the next index belongs at the end of the new CONSTRUCTOR.
3693 (cxx_eval_store_expression): Revert PR c++/78572 fix.
3695 2020-04-13 Nathan Sidwell <nathan@acm.org>
3697 PR c++/94426 lambdas with internal linkage are different to no-linkage
3698 * decl2.c (determine_visibility): A lambda's visibility is
3699 affected by its extra scope.
3700 * pt.c (instantiate_decl): Determine var's visibility before
3701 instantiating its initializer.
3702 * tree.c (no_linkage_check): Revert code looking at visibility of
3703 lambda's extra scope.
3705 2020-04-10 Iain Sandoe <iain@sandoe.co.uk>
3708 * coroutines.cc (co_await_expander): Remove.
3709 (expand_one_await_expression): New.
3710 (process_one_statement): New.
3711 (await_statement_expander): New.
3712 (build_actor_fn): Revise to use per-statement expander.
3713 (struct susp_frame_data): Reorder and comment.
3714 (register_awaits): Factor code.
3715 (replace_statement_captures): New, factored from...
3716 (maybe_promote_captured_temps):.. here.
3717 (await_statement_walker): Revise to process per statement.
3718 (morph_fn_to_coro): Use revised susp_frame_data layout.
3720 2020-04-10 Marek Polacek <polacek@redhat.com>
3723 * method.c (constructible_expr): In C++20, try using parenthesized
3724 initialization of aggregates to determine the result of
3727 2020-04-10 Bin Cheng <bin.cheng@linux.alibaba.com>
3729 * coroutines.cc (co_await_expander): Simplify.
3731 2020-04-09 Jason Merrill <jason@redhat.com>
3734 * constexpr.c (cxx_eval_constant_expression) [VAR_DECL]: Look at
3735 ctx->object and ctx->global->values first.
3737 2020-04-09 Marek Polacek <polacek@redhat.com>
3740 * call.c (initialize_reference): If the reference binding failed, maybe
3741 try initializing from { }.
3742 * decl.c (grok_reference_init): For T& t(e), set
3743 LOOKUP_AGGREGATE_PAREN_INIT but don't build up a constructor yet.
3745 2020-04-08 Iain Sandoe <iain@sandoe.co.uk>
3746 Jun Ma <JunMa@linux.alibaba.com>
3748 * coroutines.cc (maybe_promote_captured_temps): Add a cleanup
3749 expression, if needed, to any call from which we promoted
3750 temporaries captured by reference.
3752 2020-04-08 Marek Polacek <polacek@redhat.com>
3754 PR c++/94507 - ICE-on-invalid with lambda template.
3755 * pt.c (tsubst_lambda_expr): Cope when tsubst_template_decl or
3756 tsubst_function_decl returns error_mark_node.
3758 2020-04-08 Martin Liska <mliska@suse.cz>
3761 * decl.c (duplicate_decls): Duplicate also DECL_IS_REPLACEABLE_OPERATOR.
3762 (cxx_init_decl_processing): Mark replaceable all implicitly defined
3765 2020-04-08 Patrick Palka <ppalka@redhat.com>
3767 Core issues 1001 and 1322
3769 * pt.c (rebuild_function_or_method_type): Split function out from ...
3770 (tsubst_function_type): ... here.
3771 (maybe_rebuild_function_decl_type): New function.
3772 (tsubst_function_decl): Use it.
3774 2020-04-08 Jakub Jelinek <jakub@redhat.com>
3777 * decl.c (begin_destructor_body): For CLASSTYPE_VBASECLASSES class
3778 dtors, if CLASSTYPE_PRIMARY_BINFO is non-NULL, but not BINFO_VIRTUAL_P,
3779 look at CLASSTYPE_PRIMARY_BINFO of its BINFO_TYPE if it is not
3780 BINFO_VIRTUAL_P, and so on.
3782 2020-04-08 Marek Polacek <polacek@redhat.com>
3784 PR c++/94478 - ICE with defaulted comparison operator
3785 * method.c (early_check_defaulted_comparison): Give an error when the
3788 2020-04-08 Tobias Burnus <tobias@codesourcery.com>
3791 * paser.c (cp_parser_oacc_declare): Add check that variables
3792 are declared in the same scope as the directive.
3794 2020-04-07 Jason Merrill <jason@redhat.com>
3797 * parser.c (cp_parser_requires_expression): Use tentative_firewall.
3800 * parser.c (cp_parser_placeholder_type_specifier): Use
3803 2020-04-07 Iain Sandoe <iain@sandoe.co.uk>
3805 * coroutines.cc (maybe_promote_captured_temps): Ensure that
3806 reference capture placeholder vars are properly declared.
3808 2020-04-07 Patrick Palka <ppalka@redhat.com>
3811 * tree.c (replace_placeholders): Look through all handled components,
3812 not just COMPONENT_REFs.
3813 * typeck2.c (process_init_constructor_array): Propagate
3814 CONSTRUCTOR_PLACEHOLDER_BOUNDARY up from each element initializer to
3815 the array initializer.
3817 2020-04-07 Jakub Jelinek <jakub@redhat.com>
3820 * parser.c (cp_parser_omp_parallel): Set OMP_PARALLEL_COMBINED
3821 if cp_parser_omp_master succeeded.
3823 2020-04-06 Jason Merrill <jason@redhat.com>
3826 * decl.c (duplicate_decls): Fix handling of DECL_HIDDEN_FRIEND_P.
3828 2020-04-04 Marek Polacek <polacek@redhat.com>
3829 Jason Merrill <jason@redhat.com>
3831 PR c++/94155 - crash in gimplifier with paren init of aggregates.
3832 * init.c (build_vec_init): Fill in indexes.
3834 2020-04-04 Jason Merrill <jason@redhat.com>
3837 * mangle.c (write_expression): Skip IMPLICIT_CONV_EXPR.
3839 2020-04-04 Patrick Palka <ppalka@redhat.com>
3843 * constexpr.c (struct constexpr_ctx): New field 'parent'.
3844 (cxx_eval_bare_aggregate): Propagate CONSTRUCTOR_PLACEHOLDER_BOUNDARY
3845 flag from the original constructor to the reduced constructor.
3846 (lookup_placeholder): Prefer to return the outermost matching object
3847 by recursively calling lookup_placeholder on the 'parent' context,
3848 but don't cross CONSTRUCTOR_PLACEHOLDER_BOUNDARY constructors.
3849 (cxx_eval_constant_expression): Link the 'ctx' context to the 'new_ctx'
3850 context via 'new_ctx.parent' when being expanded without an explicit
3851 target. Don't call replace_placeholders.
3852 (cxx_eval_outermost_constant_expr): Initialize 'ctx.parent' to NULL.
3856 * constexpr.c (get_or_insert_ctor_field): Split out (while adding
3857 support for VECTOR_TYPEs, and optimizations for the common case)
3859 (cxx_eval_store_expression): ... here. Rename local variable
3860 'changed_active_union_member_p' to 'activated_union_member_p'. Record
3861 the sequence of indexes into 'indexes' that yields the subobject we're
3862 assigning to. Record the integer offsets of the constructor indexes
3863 we're assigning through into 'index_pos_hints'. After evaluating the
3864 initializer of the store expression, recompute 'valp' using 'indexes'
3865 and using 'index_pos_hints' as hints.
3866 (cxx_eval_bare_aggregate): Tweak comments. Use get_or_insert_ctor_field
3867 to recompute the constructor_elt pointer we're assigning through after
3868 evaluating each initializer.
3870 2020-04-04 Jason Merrill <jason@redhat.com>
3873 * constraint.cc (tsubst_valid_expression_requirement): Call
3876 2020-04-04 Jason Merrill <jason@redhat.com>
3879 * constexpr.c (maybe_constant_value): Use break_out_target_exprs.
3880 * expr.c (mark_use) [VIEW_CONVERT_EXPR]: Don't wrap a TARGET_EXPR in
3883 2020-04-04 Jakub Jelinek <jakub@redhat.com>
3886 * parser.c (cp_parser_omp_for_loop): Use
3887 protected_set_expr_location_if_unset.
3888 * cp-gimplify.c (genericize_if_stmt, genericize_cp_loop): Likewise.
3891 * pt.c (tsubst_expr) <case OMP_MASTER>: Clear
3892 omp_parallel_combined_clauses.
3894 2020-04-03 Jason Merrill <jason@redhat.com>
3897 * pt.c (complex_pack_expansion_r): New.
3898 (complex_alias_template_p): Use it.
3900 2020-03-31 Jason Merrill <jason@redhat.com>
3903 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Call
3904 replace_placeholders.
3905 * typeck2.c (store_init_value): Fix arguments to
3906 fold_non_dependent_expr.
3908 2020-03-31 Jason Merrill <jason@redhat.com>
3910 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Use
3913 2020-03-30 Jason Merrill <jason@redhat.com>
3916 * tree.c (cp_tree_equal) [CALL_EXPR]: Compare KOENIG_LOOKUP_P.
3917 (called_fns_equal): Check DECL_CONTEXT.
3919 2020-03-30 Jakub Jelinek <jakub@redhat.com>
3922 * semantics.c (add_stmt): Only set STMT_IS_FULL_EXPR_P on trees with
3923 STATEMENT_CODE_P code.
3925 2020-03-28 Patrick Palka <ppalka@redhat.com>
3928 * parser.c (cp_parser_requires_clause_opt): Diagnose and recover from
3929 "requires {" when "requires requires {" was probably intended.
3932 * constraint.cc (tsubst_compound_requirement): Always suppress errors
3933 from type_deducible_p and expression_convertible_p, as they're not
3934 substitution errors.
3935 (diagnose_atomic_constraint) <case INTEGER_CST>: Remove this case so
3936 that we diagnose INTEGER_CST expressions of non-bool type via the
3938 * cp-gimplify.c (cp_genericize_r) <case REQUIRES_EXPR>: New case.
3939 * parser.c (cp_parser_requires_expression): Always parse the requirement
3940 body as if we're processing a template, by temporarily incrementing
3941 processing_template_decl. Afterwards, if we're not actually in a
3942 template context, perform semantic processing to diagnose any invalid
3943 types and expressions.
3944 * pt.c (tsubst_copy_and_build) <case REQUIRES_EXPR>: Remove dead code.
3945 * semantics.c (finish_static_assert): Explain an assertion failure
3946 when the condition is a REQUIRES_EXPR like we do when it is a concept
3949 * constraint.cc (diagnose_compound_requirement): When diagnosing a
3950 compound requirement, maybe replay the satisfaction failure, subject to
3951 the current diagnosis depth.
3953 * constraint.cc (finish_constraint_binary_op): Set the location of EXPR
3954 as well as its range, because build_x_binary_op doesn't always do so.
3955 (current_constraint_diagnosis_depth): New.
3956 (concepts_diagnostics_max_depth_exceeded_p): New.
3957 (collect_operands_of_disjunction): New.
3958 (satisfy_disjunction): When diagnosing a satisfaction failure, maybe
3959 replay each branch of the disjunction, subject to the current diagnosis
3961 (diagnose_valid_expression): When diagnosing a satisfaction failure,
3962 maybe replay the substitution error, subject to the current diagnosis
3964 (diagnose_valid_type): Likewise.
3965 (diagnose_nested_requiremnet): Likewise.
3966 (diagnosing_failed_constraint::diagnosing_failed_constraint): Increment
3967 current_constraint_diagnosis_depth when diagnosing.
3968 (diagnosing_failed_constraint::~diagnosing_failed_constraint): Decrement
3969 current_constraint_diagnosis_depth when diagnosing.
3970 (diagnosing_failed_constraint::replay_errors_p): New static member
3972 (diagnose_constraints): Don't diagnose if concepts_diagnostics_max_depth
3973 is 0. Emit a one-off note to increase -fconcepts-diagnostics-depth if
3974 the limit was exceeded.
3975 * cp-tree.h (diagnosing_failed_constraint::replay_errors_p): Declare.
3977 2020-03-27 Nathan Sidwell <nathan@acm.org>
3980 * name-lookup.c (do_pushdecl): Look through cleanp levels.
3982 2020-03-27 Martin Sebor <msebor@redhat.com>
3987 * cp-tree.h (most_specialized_partial_spec): Declare.
3988 * parser.c (cp_parser_elaborated_type_specifier): Distinguish alias
3990 (specialization_of): New function.
3991 (cp_parser_check_class_key): Move code...
3992 (class_decl_loc_t::add): ...to here. Add parameters. Avoid issuing
3993 -Wredundant-tags on first-time declarations in other declarators.
3994 Correct handling of template specializations.
3995 (class_decl_loc_t::diag_mismatched_tags): Also expect to be called
3996 when -Wredundant-tags is enabled. Use primary template or partial
3997 specialization as the guide for uses of implicit instantiations.
3998 * pt.c (most_specialized_partial_spec): Declare extern.
4000 2020-03-27 Nathan Sidwell <nathan@acm.org>
4003 * name-lookup.c (push_namespace): Triage ambiguous lookups that
4006 2020-03-27 Jakub Jelinek <jakub@redhat.com>
4009 * call.c (set_flags_from_callee): Don't update
4010 cp_function_chain->can_throw or current_function_returns_abnormally
4011 if cp_unevaluated_operand.
4014 * cvt.c (ocp_convert): Handle COMPOUND_EXPR by recursion on the second
4015 operand and creating a new COMPOUND_EXPR if anything changed.
4017 2020-03-26 Marek Polacek <polacek@redhat.com>
4019 PR c++/94336 - template keyword accepted before destructor names.
4020 * parser.c (cp_parser_unqualified_id): Give an error when 'template'
4021 is followed by a destructor name.
4023 2020-03-27 Patrick Palka <ppalka@redhat.com>
4025 * decl.c (compute_array_index_type_loc): Remove redundant
4026 type_dependent_expression_p check that is subsumed by
4027 value_dependent_expression_p.
4028 * decl2.c (is_late_template_attribute): Likewise.
4029 * pt.c (uses_template_parms): Likewise.
4030 (dependent_template_arg_p): Likewise.
4032 2020-03-26 Marek Polacek <polacek@redhat.com>
4035 PR c++/94057 - template keyword in a typename-specifier.
4036 * parser.c (check_template_keyword_in_nested_name_spec): New.
4037 (cp_parser_nested_name_specifier_opt): Implement DR1710, optional
4038 'template'. Call check_template_keyword_in_nested_name_spec.
4039 (cp_parser_simple_type_specifier): Assume that a <
4040 following a qualified-id in a typename-specifier begins
4041 a template argument list.
4043 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
4045 * coroutines.cc (coro_init_identifiers): Initialize an identifier
4046 for the cororoutine handle 'address' method name.
4047 (struct coro_aw_data): Add fields to cover the continuations.
4048 (co_await_expander): Determine the kind of await_suspend in use.
4049 If we have the case that returns a continuation handle, then save
4050 this and make the target for 'scope exit without cleanup' be the
4051 continuation resume label.
4052 (expand_co_awaits): Remove.
4053 (struct suspend_point_info): Remove fields that kept the returned
4054 await_suspend handle type.
4055 (transform_await_expr): Remove code tracking continuation handles.
4056 (build_actor_fn): Add the continuation handle as an actor-function
4057 scope var. Build the symmetric transfer continuation point. Call
4058 the tree walk for co_await expansion directly, rather than via a
4059 trivial shim function.
4060 (register_await_info): Remove fields tracking continuation handles.
4061 (get_await_suspend_return_type): Remove.
4062 (register_awaits): Remove code tracking continuation handles.
4063 (morph_fn_to_coro): Remove code tracking continuation handles.
4065 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
4067 * coroutines.cc (co_await_expander): If we are expanding the
4068 initial await expression, set a boolean flag to show that we
4069 have now reached the initial await_resume() method call.
4070 (expand_co_awaits): Handle the 'initial await resume called' flag.
4071 (build_actor_fn): Insert the initial await expression into the
4072 start of the user-authored function-body. Handle the 'initial await
4073 resume called' flag.
4074 (morph_fn_to_coro): Initialise the 'initial await resume called'
4075 flag. Modify the unhandled exception catch clause to recognise
4076 exceptions that occur before the initial await_resume() and re-
4079 2020-03-26 Jakub Jelinek <jakub@redhat.com>
4082 * class.c (user_provided_p): Use STRIP_TEMPLATE instead of returning
4083 true for all TEMPLATE_DECLs.
4086 * cp-gimplify.c (cp_genericize_r): Handle STATEMENT_LIST.
4088 2020-03-25 Patrick Palka <ppalka@redhat.com>
4091 * parser.c (cp_parser_selection_statement) <case RID_IF>: Invalidate the
4092 current condition chain when the if-statement has a non-empty
4095 2020-03-25 Iain Sandoe <iain@sandoe.co.uk>
4098 * coroutines.cc (captures_temporary): Fix a missing dereference.
4100 2020-03-24 Marek Polacek <polacek@redhat.com>
4102 PR c++/94190 - wrong no post-decrement operator error in template.
4103 * call.c (convert_like_real): Use convert_from_reference on the result.
4105 2020-03-24 Jason Merrill <jason@redhat.com>
4108 * constraint.cc (constraint_satisfaction_value): Repeat noisily on
4110 (tsubst_nested_requirement): Likewise.
4111 (get_constraint_error_location): Allow missing context.
4112 (diagnose_atomic_constraint): Diagnose non-bool constraint here.
4113 (satisfy_atom): Not here. Only diagnose non-constant when noisy.
4115 2020-03-24 Jason Merrill <jason@redhat.com>
4117 * pt.c (any_template_parm_r): Look into the type of a non-type
4120 2020-03-24 Jason Merrill <jason@redhat.com>
4122 * cp-tree.h (cp_expr): When constructing from an expr and a
4123 location, call protected_set_expr_location.
4125 2020-03-23 Patrick Palka <ppalka@redhat.com>
4128 * except.c (maybe_noexcept_warning): Add TODO.
4129 * method.c (walk_field_subobs): Pass tf_none to expr_noexcept_p.
4131 2020-03-23 nathans <nathan@acm.org>
4134 * tree.c (cp_tree_equal) [SIZEOF_EXPR]: Detect argument pack
4137 2020-03-21 Patrick Palka <ppalka@redhat.com>
4140 * constexpr.c (reduced_constant_expression_p) [CONSTRUCTOR]: Properly
4141 handle unions without an initializer.
4142 (cxx_eval_component_reference): Emit a different diagnostic when the
4143 constructor element corresponding to a union member is NULL.
4144 (cxx_eval_bare_aggregate): When constructing a union, always set the
4145 active union member before evaluating the initializer. Relax assertion
4146 that verifies the index of the constructor element we're initializing
4147 hasn't been changed.
4148 (cxx_eval_store_expression): Diagnose changing the active union member
4149 while the union is in the process of being initialized. After setting
4150 an active union member, clear CONSTRUCTOR_NO_CLEARING on the underlying
4152 (cxx_eval_constant_expression) [PLACEHOLDER_EXPR]: Don't re-reduce a
4153 CONSTRUCTOR returned by lookup_placeholder.
4155 2020-03-20 Patrick Palka <ppalka@redhat.com>
4157 * cxx-pretty-print.c (pp_cxx_parameter_mapping): Make extern. Move
4158 the "[with ]" bits to here from ...
4159 (pp_cxx_atomic_constraint): ... here.
4160 * cxx-pretty-print.h (pp_cxx_parameter_mapping): Declare.
4161 * error.c (rebuild_concept_check): Delete.
4162 (print_concept_check_info): Print the dependent form of the constraint and the
4163 preferably substituted parameter mapping alongside it.
4165 2020-03-19 Jason Merrill <jason@redhat.com>
4168 * cp-gimplify.c (simple_empty_class_p): Look through
4169 SIMPLE_TARGET_EXPR_P.
4170 (cp_gimplify_expr) [MODIFY_EXPR]: Likewise.
4171 [RETURN_EXPR]: Avoid producing 'return *retval;'.
4172 * call.c (build_call_a): Strip TARGET_EXPR from empty class arg.
4173 * cp-tree.h (SIMPLE_TARGET_EXPR_P): Check that TARGET_EXPR_INITIAL
4176 2020-03-19 Jakub Jelinek <jakub@redhat.com>
4179 * parser.c (cp_parser_omp_var_list_no_open): Call process_outer_var_ref
4180 on outer_automatic_var_p decls.
4181 * cp-gimplify.c (cxx_omp_disregard_value_expr): Return true also for
4182 capture proxy decls.
4184 2020-03-18 Nathan Sidwell <nathan@acm.org>
4186 PR c++/94147 - mangling of lambdas assigned to globals
4187 * parser.c (cp_parser_init_declarator): Namespace-scope variables
4188 provide a lambda scope.
4189 * tree.c (no_linkage_check): Lambdas with a variable for extra
4190 scope have a linkage from the variable.
4192 2020-03-18 Jakub Jelinek <jakub@redhat.com>
4194 * constraint.cc (resolve_function_concept_check, subsumes_constraints,
4195 strictly_subsumes): Fix up duplicated word issue in a comment.
4196 * coroutines.cc (build_init_or_final_await, captures_temporary):
4198 * logic.cc (dnf_size_r, cnf_size_r): Likewise.
4199 * pt.c (append_type_to_template_for_access_check): Likewise.
4202 * decl.c (grokfndecl): Restore old diagnostics about deduction
4203 guide declared in different scope if in_namespace is NULL_TREE.
4205 2020-03-17 Jakub Jelinek <jakub@redhat.com>
4208 * parser.c (cp_parser_enum_specifier): Use temp_override for
4209 parser->colon_corrects_to_scope_p, replace goto out with return.
4210 If scoped enum or enum with underlying type is not followed by
4211 { or ;, call cp_parser_commit_to_tentative_parse before calling
4212 cp_parser_error and make sure to return error_mark_node instead of
4213 NULL_TREE. Formatting fixes.
4215 2020-03-17 Ville Voutilainen <ville.voutilainen@gmail.com>
4218 * method.c (assignable_expr): Use cp_unevaluated.
4219 (is_xible_helper): Push a non-deferred access check for
4220 the stub objects created by assignable_expr and constructible_expr.
4222 2020-03-17 Jakub Jelinek <jakub@redhat.com>
4224 * pt.c (tsubst): Fix up duplicated word issue in a diagnostic message.
4225 (lookup_template_class_1, tsubst_expr): Fix up duplicated word issue
4227 * parser.c (cp_parser_statement, cp_parser_linkage_specification,
4228 cp_parser_placeholder_type_specifier,
4229 cp_parser_constraint_requires_parens): Likewise.
4230 * name-lookup.c (suggest_alternative_in_explicit_scope): Likewise.
4232 2020-03-15 Iain Sandoe <iain@sandoe.co.uk>
4234 * coroutines.cc (co_await_expander): Fix indentation.
4236 2020-03-14 Jason Merrill <jason@redhat.com>
4239 * pt.c (process_partial_specialization): Error rather than crash on
4240 extra pack expansion.
4242 2020-03-14 Jason Merrill <jason@redhat.com>
4245 * pt.c (find_parameter_packs_r): [DECL_EXPR]: Walk
4246 DECL_ORIGINAL_TYPE of a typedef.
4248 2020-03-14 Jason Merrill <jason@redhat.com>
4251 * pt.c (build_deduction_guide): Clear cp_unevaluated_operand for
4252 substituting DECL_ARGUMENTS.
4254 2020-03-14 Jakub Jelinek <jakub@redhat.com>
4256 * logic.cc (formula::formula): Change "a an" to "an" in a comment.
4257 * parser.c (cp_debug_parser): Change "a an" to "an" in a string
4260 2020-03-13 Patrick Palka <ppalka@redhat.com>
4263 * call.c (build_over_call): Use a warning_sentinel to disable
4264 warn_deprecated_decl before calling build_addr_func.
4266 2020-03-12 Jakub Jelinek <jakub@redhat.com>
4269 * decl.c (reshape_init_array_1): Don't unshare constructor if there
4270 aren't any trailing zero elts, otherwise only unshare the first
4273 2020-03-11 Jason Merrill <jason@redhat.com>
4276 * constraint.cc (tsubst_parameter_mapping): Canonicalize type
4279 2020-03-11 Marek Polacek <polacek@redhat.com>
4280 Jason Merrill <jason@redhat.com>
4282 PR c++/94074 - wrong modifying const object error for COMPONENT_REF.
4283 * constexpr.c (cref_has_const_field): New function.
4284 (modifying_const_object_p): Consider a COMPONENT_REF
4285 const only if any of its fields are const.
4286 (cxx_eval_store_expression): Mark a CONSTRUCTOR of a const type
4287 as readonly after its initialization has been done.
4289 2020-03-10 Marek Polacek <polacek@redhat.com>
4291 PR c++/94124 - wrong conversion error with non-viable overload.
4292 * decl.c (reshape_init_array_1): Unshare a constructor if we
4293 stripped trailing zero-initializers.
4295 2020-03-10 Jason Merrill <jason@redhat.com>
4298 * pt.c (maybe_instantiate_noexcept): Always update clones.
4300 2020-03-10 Jason Merrill <jason@redhat.com>
4303 * pt.c (maybe_aggr_guide): Check BRACE_ENCLOSED_INITIALIZER_P.
4305 2020-03-10 Jason Merrill <jason@redhat.com>
4311 * cp-gimplify.c (cp_gimplify_init_expr): Partially revert patch for
4312 66139: Don't split_nonconstant_init. Remove pre_p parameter.
4314 2020-03-09 Marek Polacek <polacek@redhat.com>
4316 PR c++/92031 - bogus taking address of rvalue error.
4317 PR c++/91465 - ICE with template codes in check_narrowing.
4318 PR c++/93870 - wrong error when converting template non-type arg.
4319 PR c++/94068 - ICE with template codes in check_narrowing.
4320 * call.c (convert_like_real): Return IMPLICIT_CONV_EXPR
4321 in a template when not ck_identity and we're dealing with a class.
4322 (convert_like_real) <case ck_ref_bind>: Return IMPLICIT_CONV_EXPR
4323 in a template if we need a temporary.
4324 * decl.c (compute_array_index_type_loc): Remove
4325 instantiate_non_dependent_expr_sfinae call. Call
4326 fold_non_dependent_expr instead of maybe_constant_value.
4327 (build_explicit_specifier): Don't instantiate or create a sentinel
4328 before converting the expression.
4329 * except.c (build_noexcept_spec): Likewise.
4330 * pt.c (convert_nontype_argument): Don't build IMPLICIT_CONV_EXPR.
4331 Set IMPLICIT_CONV_EXPR_NONTYPE_ARG if that's what
4332 build_converted_constant_expr returned.
4333 * typeck2.c (check_narrowing): Call fold_non_dependent_expr instead
4334 of maybe_constant_value.
4336 2020-03-09 Jakub Jelinek <jakub@redhat.com>
4340 2019-10-11 Paolo Carlini <paolo.carlini@oracle.com>
4342 * constexpr.c (cxx_eval_constant_expression): Do not handle
4343 RROTATE_EXPR and LROTATE_EXPR.
4345 2020-03-09 Marek Polacek <polacek@redhat.com>
4347 PR c++/94050 - ABI issue with alignas on armv7hl.
4348 * class.c (layout_class_type): Don't replace a class's
4349 CLASSTYPE_AS_BASE if their TYPE_USER_ALIGN don't match.
4351 2020-03-09 Bin Cheng <bin.cheng@linux.alibaba.com>
4353 * coroutines.cc (build_actor_fn): Factor out code inserting the
4354 default return_void call to...
4355 (morph_fn_to_coro): ...here, also hoist local var declarations.
4357 2020-03-08 Patrick Palka <ppalka@redhat.com>
4360 * call.c (convert_like_real): Check complain before emitting an error
4361 about binding a bit-field to a reference.
4363 * cxx-pretty-print.c (cxx_pretty_printer::simple_type_specifier)
4364 [TYPENAME_TYPE]: Print the TYPENAME_TYPE_FULLNAME instead of the
4367 2020-03-06 Nathan Sidwell <nathan@acm.org>
4370 * mangle.c (find_substitution): Don't call same_type_p on template
4371 args that cannot match.
4373 2020-03-04 Martin Sebor <msebor@redhat.com>
4376 * tree.c (type_initializer_zero_p): Fail for structs initialized
4379 2020-03-04 Jason Merrill <jason@redhat.com>
4382 * init.c (perform_member_init): Don't do aggregate initialization of
4384 * constexpr.c (cx_check_missing_mem_inits): Don't enforce
4385 initialization of empty field.
4387 2020-03-04 Martin Liska <mliska@suse.cz>
4389 * method.c: Wrap array in ctor with braces in order
4390 to silent clang warnings.
4392 2020-03-03 Jason Merrill <jason@redhat.com>
4393 Marek Polacek <polacek@redhat.com>
4395 PR c++/90505 - mismatch in template argument deduction.
4396 * pt.c (tsubst): Don't reduce the template level of template
4397 parameters when tf_partial.
4399 2020-03-03 Jakub Jelinek <jakub@redhat.com>
4402 * constexpr.c (cxx_eval_constant_expression)
4403 <case TARGET_EXPR, case SAVE_EXPR>: Don't record anything if
4404 *non_constant_p is true.
4406 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
4408 * coroutines.cc (captures_temporary): Strip component_ref
4411 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
4413 * coroutines.cc (finish_co_await_expr): Build co_await_expr
4414 with unknown_type_node.
4415 (finish_co_yield_expr): Ditto.
4416 *pt.c (type_dependent_expression_p): Set co_await/yield_expr
4417 with unknown type as dependent.
4419 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
4421 * coroutines.cc (struct local_var_info): Adjust to remove the
4422 reference to the captured var, and just to note that this is a
4423 lambda capture proxy.
4424 (transform_local_var_uses): Handle lambda captures specially.
4425 (struct param_frame_data): Add a visited set.
4426 (register_param_uses): Also check for param uses in lambda
4428 (struct local_vars_frame_data): Remove captures list.
4429 (register_local_var_uses): Handle lambda capture proxies by
4430 noting and bypassing them.
4431 (morph_fn_to_coro): Update to remove lifetime extension of
4432 lambda capture-by-copy vars.
4434 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
4436 * coroutines.cc (build_co_await): Do not build frame
4437 awaitable proxy vars when the co_await expression is
4438 a function parameter or local var.
4439 (co_await_expander): Do not initialise a frame var with
4441 (transform_await_expr): Only substitute the awaitable
4442 frame var if it's needed.
4443 (register_awaits): Do not make frame copies for param
4444 or local vars that are awaitables.
4446 2020-02-28 Jason Merrill <jason@redhat.com>
4448 Implement P2092R0, Disambiguating Nested-Requirements
4449 * parser.c (cp_parser_requirement_parameter_list): Pass
4450 CP_PARSER_FLAGS_TYPENAME_OPTIONAL.
4452 * call.c (build_user_type_conversion_1): Don't look at the second
4453 conversion of a non-viable candidate.
4455 2020-02-28 Jakub Jelinek <jakub@redhat.com>
4457 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
4458 * typeck.c (cp_build_addr_expr_1): Allow taking address of immediate
4459 functions in unevaluated contexts.
4461 2020-02-27 Nathan Sidwell <nathan@acm.org>
4464 * pt.c (template_args_equal): Pass ARGUMENT_PACKS through to
4466 * tree.c (cp_tree_equal): Compare ARGUMENT_PACKS here,
4467 * typeck.c (comptypes): Assert we don't get any argument packs.
4469 * class.c (adjust_clone_args): Correct arg-checking assert.
4470 * typeck.c (comptypes): Assert not nulls.
4472 2020-02-26 Marek Polacek <polacek@redhat.com>
4474 PR c++/93789 - ICE with invalid array bounds.
4475 * decl.c (compute_array_index_type_loc): Don't use the folded
4476 size when folding cleared TREE_CONSTANT.
4478 2020-02-26 Iain Sandoe <iain@sandoe.co.uk>
4480 * class.c (classtype_has_non_deleted_copy_ctor): New.
4481 * coroutines.cc (struct param_info): Keep track of params
4482 that are references, and cache the original type and whether
4483 the DTOR is trivial.
4484 (build_actor_fn): Handle param copies always, and adjust the
4485 handling for references.
4486 (register_param_uses): Only handle uses here.
4487 (classtype_has_non_deleted_copy_ctor): New.
4488 (morph_fn_to_coro): Adjust param copy handling to match n4849
4489 by reordering ahead of the promise CTOR and always making a
4490 frame copy, even if the param is unused in the coroutine body.
4491 * cp-tree.h (classtype_has_non_deleted_copy_ctor): New.
4493 2020-02-26 Patrick Palka <ppalka@redhat.com>
4495 * constraint.cc (finish_constraint_binary_op): Set expr's location range
4496 to the range of its operands.
4497 (satisfy_atom): Pass MAP instead of ARGS to diagnose_atomic_constraint.
4498 (diagnose_trait_expr): Take the instantiated parameter mapping MAP
4499 instead of the corresponding template arguments ARGS and adjust body
4501 (diagnose_requires_expr): Likewise.
4502 (diagnose_atomic_constraint): Likewise. When printing an atomic
4503 constraint expression, print the instantiated parameter mapping
4505 * cxx-pretty-print.cc (cxx_pretty_printer::expression)
4506 [NONTYPE_ARGUMENT_PACK]: Print braces around a NONTYPE_ARGUMENT_PACK.
4507 (cxx_pretty_printer::type_id): Handle TYPE_ARGUMENT_PACK.
4509 2020-02-26 Marek Polacek <polacek@redhat.com>
4511 PR c++/93676 - value-init crash in template.
4512 * init.c (build_new_1): Don't call build_vec_init in a template.
4514 2020-02-26 Marek Polacek <polacek@redhat.com>
4516 PR c++/93862 - ICE with static_cast when converting from int[].
4517 * call.c (reference_compatible_p): No longer static.
4518 * cp-tree.h (reference_compatible_p): Declare.
4519 * typeck.c (build_static_cast_1): Use reference_compatible_p instead
4520 of reference_related_p.
4522 2020-02-26 Marek Polacek <polacek@redhat.com>
4524 PR c++/93803 - ICE with constexpr init and [[no_unique_address]].
4525 * constexpr.c (reduced_constant_expression_p): Don't crash on a null
4528 2020-02-24 Martin Sebor <msebor@redhat.com>
4531 * parser.c (cp_parser_check_class_key): Avoid issuing -Wredundant-tags
4532 in shared C/C++ code in headers.
4533 Remove a duplicate hunk of code.
4535 2020-02-24 Marek Polacek <polacek@redhat.com>
4537 PR c++/93869 - ICE with -Wmismatched-tags.
4538 * parser.c (cp_parser_check_class_key): Check class_key earlier.
4540 2020-02-24 Marek Polacek <polacek@redhat.com>
4542 PR c++/93712 - ICE with ill-formed array list-initialization.
4543 * call.c (next_conversion): Return NULL for ck_aggr.
4544 (build_aggr_conv): Set u.expr instead of u.next.
4545 (build_array_conv): Likewise.
4546 (build_complex_conv): Likewise.
4547 (conv_get_original_expr): Handle ck_aggr.
4549 2020-02-24 Jakub Jelinek <jakub@redhat.com>
4551 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
4552 * call.c (build_over_call): Don't evaluate immediate functions in
4553 unevaluated operands.
4555 2020-02-24 Jason Merrill <jason@redhat.com>
4557 P0780R2: Resolve lambda init-capture pack grammar.
4558 * parser.c (cp_parser_lambda_introducer): Expect &...x=y rather than
4561 2020-02-22 Marek Polacek <polacek@redhat.com>
4564 * decl.c (grokdeclarator): Use %qs in a diagnostic message.
4566 2020-02-21 Martin Sebor <msebor@redhat.com>
4568 PR gcov-profile/93753
4569 * class.c (check_flexarrays): Tighten up a test for potential members
4570 of anonymous structs or unions.
4572 2020-02-20 Martin Sebor <msebor@redhat.com>
4575 * parser.c (cp_parser_check_class_key): Only handle true C++ class-keys.
4577 2020-02-20 Martin Liska <mliska@suse.cz>
4579 PR translation/93841
4580 * config/or1k/or1k.opt: Remove superfluous word.
4581 * doc/invoke.texi: Likewise.
4583 2020-02-20 Martin Liska <mliska@suse.cz>
4585 PR translation/93838
4586 * parser.c (cp_parser_decl_specifier_seq): Remove trailing space.
4588 2020-02-19 Marek Polacek <polacek@redhat.com>
4590 PR c++/93169 - wrong-code with a non-constexpr constructor.
4591 * constexpr.c (cxx_eval_call_expression): Only set TREE_READONLY
4592 on constant CONSTRUCTORs.
4594 2020-02-15 Marek Polacek <polacek@redhat.com>
4596 PR c++/93710 - poor diagnostic for array initializer.
4597 * call.c (build_user_type_conversion_1): Use cp_expr_loc_or_input_loc
4600 2020-02-15 Jason Merrill <jason@redhat.com>
4603 * pt.c (any_template_parm_r): Look into lambda body.
4606 * pt.c (any_template_parm_r): Remove CONSTRUCTOR handling.
4608 2020-02-14 Jakub Jelinek <jakub@redhat.com>
4611 * class.c (enum_min_precision): Change prec type from int to int &.
4614 * cp-tree.h (enum cp_tree_index): Add CPTI_FALLBACK_DFLOAT32_TYPE,
4615 CPTI_FALLBACK_DFLOAT64_TYPE and CPTI_FALLBACK_DFLOAT128_TYPE.
4616 (fallback_dfloat32_type, fallback_dfloat64_type,
4617 fallback_dfloat128_type): Define.
4618 * mangle.c (write_builtin_type): Handle fallback_dfloat*_type like
4620 * rtti.c (emit_support_tinfos): Emit DFP typeinfos even when dfp
4621 is disabled for compatibility.
4623 2020-02-13 Jason Merrill <jason@redhat.com>
4626 * name-lookup.c (matching_fn_p): A function does not match a
4631 * tree.c (decl_linkage): Always lk_none for locals.
4633 2020-02-12 Jason Merrill <jason@redhat.com>
4637 * tree.c (cp_walk_subtrees): Walk CONSTRUCTOR types here.
4638 * pt.c (find_parameter_packs_r): Not here.
4640 2020-02-12 Iain Sandoe <iain@sandoe.co.uk>
4642 * coroutines.cc (build_actor_fn): Implement deallocation function
4643 selection per n4849, dcl.fct.def.coroutine bullet 12.
4644 (morph_fn_to_coro): Implement allocation function selection per
4645 n4849, dcl.fct.def.coroutine bullets 9 and 10.
4647 2020-02-12 Marek Polacek <polacek@redhat.com>
4649 PR c++/93684 - ICE-on-invalid with broken attribute.
4650 * parser.c (cp_parser_std_attribute): Peek a token first before
4653 2020-02-11 Jason Merrill <jason@redhat.com>
4656 * class.c (add_implicitly_declared_members): Use do_friend.
4657 * method.c (implicitly_declare_fn): Fix friend handling.
4658 (decl_remember_implicit_trigger_p): New.
4659 (synthesize_method): Use it.
4660 * decl2.c (mark_used): Use it.
4662 2020-02-11 Jason Merrill <jason@redhat.com>
4666 * constexpr.c (maybe_constant_value): Correct earlier change.
4667 (cxx_eval_binary_expression) [SPACESHIP_EXPR]: Pass lval through.
4668 * method.c (genericize_spaceship): Wrap result in TARGET_EXPR.
4670 2020-02-12 Patrick Palka <ppalka@redhat.com>
4674 * type-utils.h (find_type_usage): Refactor to take a tree * and to
4675 return a tree *, and update documentation accordingly.
4676 * pt.c (make_auto_1): Set AUTO_IS_DECLTYPE when building a
4677 decltype(auto) node.
4678 (make_constrained_decltype_auto): No need to explicitly set
4679 AUTO_IS_DECLTYPE anymore.
4680 (splice_late_return_type): Use find_type_usage to find and
4681 replace a possibly nested auto node instead of using is_auto.
4682 Check test for is_auto into an assert when deciding whether
4683 to late_return_type.
4684 (type_uses_auto): Adjust the call to find_type_usage.
4685 * parser.c (cp_parser_decltype): No need to explicitly set
4686 AUTO_IS_DECLTYPE anymore.
4688 * error.c (dump_decl) [CONCEPT_DECL]: Use dump_simple_decl.
4689 (dump_simple_decl): Handle standard concept definitions as well as
4690 variable concept definitions.
4692 2020-02-10 Jakub Jelinek <jakub@redhat.com>
4695 * error.c (dump_decl_name): Fix up last argument to strncmp.
4697 2020-02-10 Jason Merrill <jason@redhat.com>
4700 * tree.c (array_of_unknown_bound_p): New.
4701 * init.c (perform_member_init): Do nothing for flexible arrays.
4703 2020-02-09 Jakub Jelinek <jakub@redhat.com>
4706 * constexpr.c (cxx_eval_constant_expression): If obj is heap var with
4707 ARRAY_TYPE, use the element type. Punt if objtype after that is not
4710 2020-02-08 Jason Merrill <jason@redhat.com>
4713 * expr.c (fold_for_warn): Call maybe_constant_value.
4714 * constexpr.c (struct constexpr_ctx): Add uid_sensitive bit-field.
4715 (maybe_constant_value): Add uid_sensitive parm.
4716 (get_fundef_copy): Don't copy if it's true.
4717 (cxx_eval_call_expression): Don't instantiate if it's true.
4718 (cxx_eval_outermost_constant_expr): Likewise.
4721 * constexpr.c (maybe_constant_value): Don't unshare if the cached
4722 value is the same as the argument.
4724 * typeck.c (maybe_warn_about_returning_address_of_local): Add
4727 * typeck2.c (process_init_constructor): Also clear TREE_SIDE_EFFECTS
4730 2020-02-08 Jakub Jelinek <jakub@redhat.com>
4733 * constexpr.c (find_array_ctor_elt): If last element has no index,
4734 for flag_checking verify all elts have no index. If i is within the
4735 elts, return it directly, if it is right after the last elt, append
4736 if NULL index, otherwise force indexes on all elts.
4737 (cxx_eval_store_expression): Allow cep->index to be NULL.
4739 2020-02-07 Marek Polacek <polacek@redhat.com>
4741 PR c++/92947 - Paren init of aggregates in unevaluated context.
4742 * call.c (build_new_method_call_1): Don't check
4743 cp_unevaluated_operand. Check the return value of digest_init.
4745 2020-02-06 Jason Merrill <jason@redhat.com>
4748 * tree.c (cp_walk_subtrees): Walk into type template arguments.
4749 * cp-tree.h (TYPE_TEMPLATE_INFO_MAYBE_ALIAS): Use typedef_variant_p
4750 instead of TYPE_ALIAS_P.
4751 * pt.c (push_template_decl_real): Likewise.
4752 (find_parameter_packs_r): Likewise. Remove dead code.
4753 * error.c (find_typenames_r): Remove dead code.
4755 2020-02-06 Jason Merrill <jason@redhat.com>
4758 * parser.c (cp_parser_constraint_primary_expression): Do the main
4759 parse non-tentatively.
4761 2020-02-06 Marek Polacek <polacek@redhat.com>
4763 PR c++/93597 - ICE with lambda in operator function.
4764 * name-lookup.c (maybe_save_operator_binding): Check is_overloaded_fn.
4766 2020-02-05 Jason Merrill <jason@redhat.com>
4769 * pt.c (tsubst_decl) [PARM_DECL]: Check cp_unevaluated_operand in
4770 handling of TREE_CHAIN for empty pack.
4772 2020-02-05 Jakub Jelinek <jakub@redhat.com>
4775 * semantics.c (cp_build_vec_convert): Call decay_conversion on arg
4776 prior to passing it to c_build_vec_convert.
4778 2020-02-05 Marek Polacek <polacek@redhat.com>
4780 PR c++/93559 - ICE with CONSTRUCTOR flags verification.
4781 * decl.c (reshape_init_array_1): Don't reuse a CONSTRUCTOR with
4784 2020-02-05 Jason Merrill <jason@redhat.com>
4787 * decl.c (grokdeclarator): Reject field of current class type even
4790 2020-02-05 Bin Cheng <bin.cheng@linux.alibaba.com>
4792 * coroutines.cc (maybe_promote_captured_temps): Increase the index
4793 number for temporary variables' name.
4795 2020-02-05 Jun Ma <JunMa@linux.alibaba.com>
4797 * coroutines.cc (build_co_await): Call convert_from_reference
4798 to wrap co_await_expr with indirect_ref which avoid
4799 reference/non-reference type confusion.
4801 (co_await_expander): Sink to call_expr if await_resume
4802 is wrapped by indirect_ref.
4804 2020-02-04 Jason Merrill <jason@redhat.com>
4807 * constraint.cc (satisfy_declaration_constraints): Check return
4808 value of push_tinst_level.
4811 * constexpr.c (cxx_eval_array_reference): {}-initialize missing
4812 elements instead of value-initializing them.
4815 * init.c (perform_member_init): Simplify.
4816 * constexpr.c (cx_check_missing_mem_inits): Allow uninitialized
4818 (cxx_eval_vec_init_1): Handle CONSTRUCTOR.
4820 2020-02-04 Iain Sandoe <iain@sandoe.co.uk>
4822 * coroutines.cc (find_promise_type): Delete unused forward
4824 (struct coroutine_info): Add a bool for no promise type error.
4825 (coro_promise_type_found_p): Only emit the error for a missing
4826 promise once in each affected coroutine.
4828 2020-02-03 Jason Merrill <jason@redhat.com>
4831 * constexpr.c (cxx_eval_constant_expression) [PARM_DECL]: Don't
4832 defer loading the value of a reference.
4834 2020-02-03 Jason Merrill <jason@redhat.com>
4837 * constexpr.c (potential_constant_expression_1) [PARM_DECL]: Allow
4839 [COMPONENT_REF]: A member function reference doesn't use the object
4842 2020-02-03 Iain Sandoe <iain@sandoe.co.uk>
4845 * coroutines.cc (struct coroutine_info): Add a bool flag to note
4846 that we emitted an error for a bad function return type.
4847 (get_coroutine_info): Tolerate an unset info table in case of
4849 (find_coro_traits_template_decl): In case of error or if we didn't
4850 find a type template, note we emitted the error and suppress
4852 (find_coro_handle_template_decl): Likewise.
4853 (instantiate_coro_traits): Only check for error_mark_node in the
4854 return from lookup_qualified_name.
4855 (coro_promise_type_found_p): Reorder initialization so that we check
4856 for the traits and their usability before allocation of the info
4857 table. Check for a suitable return type and emit a diagnostic for
4858 here instead of relying on the lookup machinery. This allows the
4859 error to have a better location, and means we can suppress multiple
4861 (coro_function_valid_p): Re-check for a valid promise (and thus the
4862 traits) before proceeding. Tolerate missing info as a fatal error.
4864 2020-02-03 Jason Merrill <jason@redhat.com>
4867 * cp-gimplify.c (predeclare_vla): New.
4868 (cp_genericize_r) [NOP_EXPR]: Call it.
4870 2020-02-03 Jun Ma <JunMa@linux.alibaba.com>
4872 * coroutines.cc (transform_await_wrapper): Set actor funcion as
4873 new context of label_decl.
4874 (build_actor_fn): Fill new field of await_xform_data.
4876 2020-02-02 Marek Polacek <polacek@redhat.com>
4878 PR c++/93530 - ICE on invalid alignas in a template.
4879 * decl.c (grokdeclarator): Call cplus_decl_attributes instead of
4882 2020-01-31 Jason Merrill <jason@redhat.com>
4885 * semantics.c (process_outer_var_ref): Capture VLAs even in
4886 unevaluated context.
4889 * decl.c (reshape_init_array_1): Reuse a single CONSTRUCTOR with
4890 non-aggregate elements.
4891 (reshape_init_array): Add first_initializer_p parm.
4892 (reshape_init_r): Change first_initializer_p from bool to tree.
4893 (reshape_init): Pass init to it.
4896 * parser.c (cp_parser_initializer_list): Suppress location wrappers
4899 2020-01-29 Jason Merrill <jason@redhat.com>
4902 * pt.c (tsubst_copy_and_build) [EQ_EXPR]: Only suppress warnings if
4903 the expression was dependent before substitution.
4905 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
4907 * coroutines.cc (act_des_fn): New.
4908 (morph_fn_to_coro): Call act_des_fn to build actor/destroy decls.
4909 Access promise via actor function's frame pointer argument.
4910 (build_actor_fn, build_destroy_fn): Use frame pointer argument.
4912 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
4914 * coroutines.cc (co_await_expander): Handle type conversion case.
4916 2020-01-29 Jason Merrill <jason@redhat.com>
4921 * parser.c (cp_parser_type_specifier_seq): Don't parse attributes in
4922 a trailing return type.
4923 (cp_parser_lambda_declarator_opt): Parse C++11 attributes before
4926 2020-01-29 Marek Polacek <polacek@redhat.com>
4928 PR c++/91754 - Fix template arguments comparison with class NTTP.
4929 * pt.c (class_nttp_const_wrapper_p): New.
4930 (template_args_equal): See through class_nttp_const_wrapper_p
4933 2020-01-29 Marek Polacek <polacek@redhat.com>
4935 PR c++/92948 - Fix class NTTP with template arguments.
4936 * pt.c (convert_nontype_argument): Use IMPLICIT_CONV_EXPR when
4937 converting a value-dependent expression to a class type.
4938 (tsubst_copy) <case VIEW_CONVERT_EXPR>: Allow IMPLICIT_CONV_EXPR
4939 as the result of the tsubst_copy call.
4941 2020-01-29 Jakub Jelinek <jakub@redhat.com>
4944 * cp-gimplify.c (cxx_omp_predetermined_sharing): Return
4945 OMP_CLAUSE_DEFAULT_SHARED for typeinfo decls.
4947 2020-01-28 Jason Merrill <jason@redhat.com>
4950 * parser.c (cp_parser_lambda_expression): Clear in_discarded_stmt.
4954 * decl2.c (copy_linkage): Do copy DECL_ONE_ONLY and DECL_WEAK.
4957 * call.c (build_user_type_conversion_1): Allow a template conversion
4958 returning an rvalue reference to bind directly to an lvalue.
4961 * decl.c (grokdeclarator): Propagate eh spec from typedef.
4963 2020-01-28 Martin Liska <mliska@suse.cz>
4966 * pt.c (redeclare_class_template): Group couple of
4967 errors and inform messages with auto_diagnostic_group.
4969 2020-01-28 Martin Liska <mliska@suse.cz>
4972 * pt.c (redeclare_class_template): Use inform
4973 for the second location.
4975 2020-01-27 Jason Merrill <jason@redhat.com>
4978 * pt.c (tsubst_copy) [STRING_CST]: Don't use fold_convert.
4980 2020-01-27 Iain Sandoe <iain@sandoe.co.uk>
4983 * coroutines.cc (morph_fn_to_coro): Check the ramp return
4984 value when it is constructed from the 'get return object'.
4986 2020-01-27 Nathan Sidwell <nathan@acm.org>
4989 * name-lookup.c (is_ancestor): Allow CHILD to be a namespace alias.
4991 2020-01-26 Jason Merrill <jason@redhat.com>
4994 * except.c (maybe_noexcept_warning): Check DECL_IN_SYSTEM_HEADER and
4995 temporarily enable -Wsystem-headers. Change second warning to
4999 * semantics.c (finish_call_expr): Don't call
5000 instantiate_non_dependent_expr before warn_for_memset.
5002 2020-01-25 Marek Polacek <polacek@redhat.com>
5004 PR c++/93414 - poor diagnostic for dynamic_cast in constexpr context.
5005 * constexpr.c (cxx_eval_dynamic_cast_fn): Add a reference
5006 dynamic_cast diagnostic.
5008 2020-01-24 Jason Merrill <jason@redhat.com>
5010 PR c++/93400 - ICE with constrained friend.
5011 * constraint.cc (maybe_substitute_reqs_for): New.
5012 * decl.c (function_requirements_equivalent_p): Call it.
5013 * pt.c (tsubst_friend_function): Only substitute
5014 TEMPLATE_PARMS_CONSTRAINTS.
5015 (tsubst_template_parms): Copy constraints.
5017 2020-01-24 Jason Merrill <jason@redhat.com>
5019 PR c++/93279 - ICE with lambda in member operator.
5020 * name-lookup.c (maybe_save_operator_binding): Don't remember
5021 class-scope bindings.
5023 2020-01-24 Jason Merrill <jason@redhat.com>
5025 PR c++/93377 - ICE with member alias in constraint.
5026 * pt.c (any_template_parm_r): Look at template arguments for all
5027 aliases, not only alias templates.
5029 2020-01-24 Marek Polacek <polacek@redhat.com>
5031 PR c++/93299 - ICE in tsubst_copy with parenthesized expression.
5032 * pt.c (tsubst_copy): Handle a REF_PARENTHESIZED_P VIEW_CONVERT_EXPR.
5034 2020-01-24 Jason Merrill <jason@redhat.com>
5036 PR c++/92852 - ICE with generic lambda and reference var.
5037 * constexpr.c (maybe_constant_value): Likewise.
5039 2020-01-23 Paolo Carlini <paolo.carlini@oracle.com>
5042 * parser.c (cp_parser_nested_name_specifier_opt): Properly
5043 diagnose concept-ids.
5045 2020-01-23 Jason Merrill <jason@redhat.com>
5047 PR c++/93331 - ICE with __builtin_strchr.
5048 * constexpr.c (cxx_eval_builtin_function_call): Use the original
5049 argument if we didn't manage to extract a STRING_CST.
5051 PR c++/93345 - ICE with defaulted dtor and template.
5053 * decl.c (cxx_maybe_build_cleanup): Don't try to set
5054 throwing_cleanup in a template.
5056 2020-01-22 Marek Polacek <polacek@redhat.com>
5058 PR c++/92907 - noexcept does not consider "const" in member functions.
5059 * g++.dg/cpp0x/noexcept56.C: New test.
5061 2020-01-22 Marek Polacek <polacek@redhat.com>
5063 PR c++/93324 - ICE with -Wall on constexpr if.
5064 * semantics.c (is_std_constant_evaluated_p): Check fndecl.
5066 2020-01-22 Patrick Palka <ppalka@redhat.com>
5068 * constraint.cc (get_mapped_args): Avoid using auto_vec
5069 as a vector element. Release the vectors inside the lists
5071 * parser.c (cp_literal_operator_id): Free the buffer.
5073 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
5075 * coroutines.cc (finish_co_await_expr): Add error check on return
5076 value of build_co_await.
5077 (finish_co_yield_expr,): Ditto.
5079 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
5081 * coroutines.cc (lookup_awaitable_member): Lookup an awaitable member.
5082 (lookup_promise_method): Emit diagnostic when get NULL_TREE back only.
5083 (build_co_await): Use lookup_awaitable_member instead of lookup_member.
5085 2020-01-21 Jason Merrill <jason@redhat.com>
5087 PR c++/60855 - ICE with sizeof VLA capture.
5088 * lambda.c (is_lambda_ignored_entity): Don't look past VLA capture.
5090 PR c++/90732 - ICE with VLA capture and generic lambda.
5091 * pt.c (tsubst_lambda_expr): Repeat add_capture for VLAs.
5093 2020-01-21 Iain Sandoe <iain@sandoe.co.uk>
5094 Bin Cheng <bin.cheng@linux.alibaba.com>
5096 * coroutines.cc (coro_promise_type_found_p): Check for NULL return
5097 from complete_type_or_else.
5098 (register_param_uses): Likewise.
5099 (build_co_await): Do not try to use complete_type_or_else for void
5100 types, otherwise for incomplete types, check for NULL return from
5101 complete_type_or_else.
5103 2020-01-21 Jason Merrill <jason@redhat.com>
5105 PR c++/91476 - anon-namespace reference temp clash between TUs.
5106 * decl2.c (copy_linkage): Factor out of get_guard.
5107 * call.c (make_temporary_var_for_ref_to_temp): Use it.
5108 * decl.c (cp_finish_decomp): Use it.
5109 (cp_finish_decl): determine_visibility sooner.
5111 2020-01-21 Bin Cheng <bin.cheng@linux.alibaba.com>
5113 * coroutines.cc (finish_co_await_expr): Set return value flag.
5114 (finish_co_yield_expr, morph_fn_to_coro): Ditto.
5116 2020-01-19 Jason Merrill <jason@redhat.com>
5118 PR c++/33799 - destroy return value, take 2.
5119 * cp-tree.h (current_retval_sentinel): New macro.
5120 (struct language_function): Add throwing_cleanup bitfield.
5121 * decl.c (cxx_maybe_build_cleanup): Set it.
5122 * except.c (maybe_set_retval_sentinel)
5123 (maybe_splice_retval_cleanup): New functions.
5124 * parser.c (cp_parser_compound_statement): Call
5125 maybe_splice_retval_cleanup.
5126 * typeck.c (check_return_expr): Call maybe_set_retval_sentinel.
5128 * parser.c (cp_parser_lambda_body): Use cp_parser_function_body.
5130 2020-01-18 Jakub Jelinek <jakub@redhat.com>
5132 * coroutines.cc (get_fn_local_identifier): Fix NO_DOT_IN_LABEL
5133 but non-NO_DOLLAR_IN_LABEL case build.
5135 2020-01-18 Iain Sandoe <iain@sandoe.co.uk>
5137 * Make-lang.in: Add coroutines.o.
5138 * cp-tree.h (lang_decl-fn): coroutine_p, new bit.
5139 (DECL_COROUTINE_P): New.
5140 * lex.c (init_reswords): Enable keywords when the coroutine flag
5142 * operators.def (co_await): New operator.
5143 * call.c (add_builtin_candidates): Handle CO_AWAIT_EXPR.
5144 (op_error): Likewise.
5145 (build_new_op_1): Likewise.
5146 (build_new_function_call): Validate coroutine builtin arguments.
5147 * constexpr.c (potential_constant_expression_1): Handle
5148 CO_AWAIT_EXPR, CO_YIELD_EXPR, CO_RETURN_EXPR.
5149 * coroutines.cc: New file.
5150 * cp-objcp-common.c (cp_common_init_ts): Add CO_AWAIT_EXPR,
5151 CO_YIELD_EXPR, CO_RETRN_EXPR as TS expressions.
5152 * cp-tree.def (CO_AWAIT_EXPR, CO_YIELD_EXPR, (CO_RETURN_EXPR): New.
5153 * cp-tree.h (coro_validate_builtin_call): New.
5154 * decl.c (emit_coro_helper): New.
5155 (finish_function): Handle the case when a function is found to
5156 be a coroutine, perform the outlining and emit the outlined
5157 functions. Set a bit to signal that this is a coroutine component.
5158 * parser.c (enum required_token): New enumeration RT_CO_YIELD.
5159 (cp_parser_unary_expression): Handle co_await.
5160 (cp_parser_assignment_expression): Handle co_yield.
5161 (cp_parser_statement): Handle RID_CO_RETURN.
5162 (cp_parser_jump_statement): Handle co_return.
5163 (cp_parser_operator): Handle co_await operator.
5164 (cp_parser_yield_expression): New.
5165 (cp_parser_required_error): Handle RT_CO_YIELD.
5166 * pt.c (tsubst_copy): Handle CO_AWAIT_EXPR.
5167 (tsubst_expr): Handle CO_AWAIT_EXPR, CO_YIELD_EXPR and
5169 * tree.c (cp_walk_subtrees): Likewise.
5171 2020-01-17 Jason Merrill <jason@redhat.com>
5173 PR c++/92531 - ICE with noexcept(lambda).
5174 * pt.c (uses_template_parms): Don't try to enumerate all the
5177 2020-01-17 Jakub Jelinek <jakub@redhat.com>
5180 * parser.c (cp_parser_template_name): Look up deprecated attribute
5181 in DECL_TEMPLATE_RESULT or its type's attributes.
5183 2020-01-16 Jason Merrill <jason@redhat.com>
5185 PR c++/93286 - ICE with __is_constructible and variadic template.
5186 * pt.c (tsubst) [TREE_LIST]: Handle pack expansion.
5187 (tsubst_copy_and_build) [TRAIT_EXPR]: Always use tsubst for type2.
5189 PR c++/93280 - ICE with aggregate assignment and DMI.
5190 * init.c (get_nsdmi): Set TARGET_EXPR_DIRECT_INIT_P here.
5191 * typeck2.c (digest_nsdmi_init): Not here.
5193 2020-01-15 Paolo Carlini <paolo.carlini@oracle.com>
5196 * cp-tree.h (is_constrained_auto): New.
5197 * parser.c (cp_parser_maybe_commit_to_declaration): Correctly
5198 handle concept-check expressions; take a cp_decl_specifier_seq*
5200 (cp_parser_condition): Update call.
5201 (cp_parser_simple_declaration): Likewise.
5202 (cp_parser_placeholder_type_specifier): Correctly handle
5203 concept-check expressions.
5205 2020-01-15 Jason Merrill <jason@redhat.com>
5208 PR c++/33799 - destroy return value if local cleanup throws.
5209 * cp-tree.h (current_retval_sentinel): New macro.
5210 * decl.c (start_preparsed_function): Set up cleanup for retval.
5211 * typeck.c (check_return_expr): Set current_retval_sentinel.
5213 PR c++/93257 - consteval void function.
5214 * constexpr.c (verify_constant): Allow void_node.
5216 PR c++/92871 - bad code with xvalue and GNU ?: extension.
5217 * call.c (prevent_lifetime_extension): New.
5218 (build_conditional_expr_1): Use it.
5220 2020-01-14 Nathan Sidwell <nathan@acm.org>
5223 * pt.c (retrieve_specialization): Use get_template_info, not open
5227 * pt.c (retrieve_specialization): Get the TI from the decl or the
5228 classtype as appropriate.
5230 2020-01-14 David Malcolm <dmalcolm@redhat.com>
5232 * cp-gimplify.c (source_location_table_entry_hash::empty_zero_p):
5233 New static constant.
5234 * cp-tree.h (named_decl_hash::empty_zero_p): Likewise.
5235 (struct named_label_hash::empty_zero_p): Likewise.
5236 * decl2.c (mangled_decl_hash::empty_zero_p): Likewise.
5238 2020-01-14 Jason Merrill <jason@redhat.com>
5240 PR c++/92590 - wrong handling of inherited default ctor.
5241 * class.c (add_method): A constrained inherited ctor doesn't hide an
5242 implicit derived ctor.
5244 PR c++/92552 - ICE with inherited constrained default ctor.
5245 * pt.c (instantiate_class_template_1): Copy
5246 TYPE_HAS_USER_CONSTRUCTOR.
5247 PR c++/91930 - ICE with constrained inherited default ctor.
5248 * name-lookup.c (do_class_using_decl): Set TYPE_HAS_USER_CONSTRUCTOR
5249 for inherited constructor.
5250 PR c++/92594 - ICE with inherited trivial default ctor.
5251 * method.c (trivial_fn_p): Treat an inherited default constructor
5252 like a normal default constructor.
5254 PR c++/92594 - ICE with inherited trivial default ctor.
5255 * method.c (trivial_fn_p): Treat an inherited default constructor
5256 like a normal default constructor.
5258 PR c++/92009 - ICE with punning of typeid.
5259 * rtti.c (get_tinfo_desc): Call xref_basetypes.
5260 * constexpr.c (cxx_fold_indirect_ref): Don't strip
5263 2020-01-13 Jason Merrill <jason@redhat.com>
5265 PR c++/92746 - ICE with noexcept of function concept check.
5266 * except.c (check_noexcept_r): Handle concept-check.
5268 PR c++/92582 - ICE with member template as requirement.
5269 * pt.c (struct find_template_parameter_info): Add ctx_parms.
5270 (any_template_parm_r): Handle TEMPLATE_DECL.
5271 (find_template_parameters): Take parms instead of their depth.
5272 * constraint.cc (build_parameter_mapping): Pass them.
5274 PR c++/33799 - destroy return value if local cleanup throws.
5275 * cp-tree.h (current_retval_sentinel): New macro.
5276 * decl.c (start_preparsed_function): Set up cleanup for retval.
5277 * typeck.c (check_return_expr): Set current_retval_sentinel.
5279 PR c++/93238 - short right-shift with enum.
5280 * typeck.c (cp_build_binary_op): Use folded op1 for short_shift.
5282 2020-01-10 Jason Merrill <jason@redhat.com>
5284 * typeck.c (cp_build_binary_op): Restore short_shift code.
5286 PR c++/93143 - incorrect tree sharing with constexpr.
5287 * constexpr.c (cxx_eval_outermost_constant_expr): Don't assume
5288 CONSTRUCTORs are already unshared.
5290 PR c++/93173 - incorrect tree sharing.
5292 * cp-gimplify.c (cp_gimplify_init_expr, cp_gimplify_expr): Use
5293 copy_if_shared after cp_genericize_tree.
5294 * typeck2.c (split_nonconstant_init): Don't unshare here.
5296 2020-01-08 Jason Merrill <jason@redhat.com>
5298 * cp-gimplify.c (cp_gimplify_expr) [TARGET_EXPR]: Check
5299 TARGET_EXPR_DIRECT_INIT_P.
5300 * constexpr.c (cxx_eval_constant_expression): Likewise.
5302 2020-01-08 Jason Merrill <jason@redhat.com>
5304 PR c++/91369 - constexpr destructor and member initializer.
5305 * constexpr.c (cxx_eval_store_expression): Look through TARGET_EXPR
5306 when not preevaluating.
5308 2020-01-08 Jason Merrill <jason@redhat.com>
5310 * constexpr.c (cxx_eval_call_expression): Remove DECL_BY_REFERENCE
5313 2020-01-07 Paolo Carlini <paolo.carlini@oracle.com>
5315 * init.c (build_new): Add location_t parameter and use it throughout.
5316 (build_raw_new_expr): Likewise.
5317 * parser.c (cp_parser_new_expression): Pass the combined_loc.
5318 * pt.c (tsubst_copy_and_build): Adjust call.
5319 * cp-tree.h: Update declarations.
5321 2020-01-07 Jason Merrill <jason@redhat.com>
5323 PR c++/47877 - -fvisibility-inlines-hidden and member templates.
5324 * decl2.c (determine_visibility): -fvisibility-inlines-hidden beats
5325 explicit class visibility for a template.
5327 2020-01-07 Richard Sandiford <richard.sandiford@arm.com>
5329 * mangle.c (mangle_type_attribute_p): New function, split out from...
5330 (write_CV_qualifiers_for_type): ...here. Don't mangle attributes
5331 that contain a space.
5333 2020-01-07 Jakub Jelinek <jakub@redhat.com>
5336 * constexpr.c (struct constexpr_global_ctx): Add heap_alloc_count
5337 member, initialize it to zero in ctor.
5338 (cxx_eval_call_expression): Bump heap_dealloc_count when deleting
5339 a heap object. Don't cache calls to functions which allocate some
5340 heap objects and don't deallocate them or deallocate some heap
5341 objects they didn't allocate.
5343 2020-01-06 Jason Merrill <jason@redhat.com>
5345 PR c++/92552 - ICE with inherited constrained default ctor.
5346 * pt.c (instantiate_class_template_1): Copy
5347 TYPE_HAS_USER_CONSTRUCTOR.
5348 * class.c (one_inherited_ctor): Don't set it here.
5350 2020-01-06 Andrew Sutton <asutton@lock3software.com>
5352 PR c++/92739 - parsing requires clause with attributes.
5353 * parser.c (cp_parser_constraint_requires_parens): Exclude
5354 attributes as postfix expressions.
5356 2020-01-05 Jakub Jelinek <jakub@redhat.com>
5359 * parser.c (cp_parser_check_class_key): Disable access checks for the
5361 (cp_parser_maybe_warn_enum_key): Likewise. Return early if
5362 !warn_redundant_tags.
5364 2010-01-05 Jakub Jelinek <jakub@redhat.com>
5367 * cp-gimplify.c (cp_gimplify_init_expr): Don't look through
5368 TARGET_EXPR if it has been gimplified already.
5370 2020-01-03 Jason Merrill <jason@redhat.com>
5372 PR c++/93033 - incorrect tree node sharing with array init.
5373 * typeck2.c (split_nonconstant_init): Unshare non-decl.
5374 * cp-gimplify.c (cp_gimplify_init_expr): Only split if -fexceptions.
5376 2020-01-02 Jason Merrill <jason@redhat.com>
5378 * pt.c (invalid_nontype_parm_type_p): Reject class placeholder in
5381 2020-01-02 Jakub Jelinek <jakub@redhat.com>
5384 * cp-objcp-common.c (identifier_global_tag): Return NULL_TREE if name
5385 has not been found, rather than error_mark_node.
5387 2020-01-01 Jakub Jelinek <jakub@redhat.com>
5389 Update copyright years.
5391 Copyright (C) 2020 Free Software Foundation, Inc.
5393 Copying and distribution of this file, with or without modification,
5394 are permitted in any medium without royalty provided the copyright
5395 notice and this notice are preserved.