1 2020-11-25 Martin Sebor <msebor@redhat.com>
4 * constraint.cc (debug_argument_list): Avoid -Wformat-diag.
5 * error.c (function_category): Same.
6 (print_template_differences): Same.
7 * logic.cc (debug): Same.
8 * name-lookup.c (lookup_using_decl): Same.
9 * parser.c (maybe_add_cast_fixit): Same.
10 (cp_parser_template_introduction): Same.
11 * typeck.c (access_failure_info::add_fixit_hint): Same.
13 2020-11-25 Thomas Schwinge <thomas@codesourcery.com>
15 * pt.c (tsubst_omp_clauses): Handle 'OMP_CLAUSE__CACHE_'.
16 (tsubst_expr): Handle 'OACC_CACHE'.
18 2020-11-24 Jason Merrill <jason@redhat.com>
21 * typeck2.c (store_init_value): Don't split_nonconstant_init in a
24 2020-11-24 Jakub Jelinek <jakub@redhat.com>
26 PR tree-optimization/96929
27 * constexpr.c (cxx_eval_binary_expression): For shifts by constant
28 with MSB set, emulate older wide_int_binop behavior to preserve
29 diagnostics and -fpermissive behavior.
31 2020-11-23 Nathan Sidwell <nathan@acm.org>
33 * module.cc: New dummy file.
34 * Make-lang.in: Add rules to build module.o
36 2020-11-23 Jozef Lawrynowicz <jozef.l@mittosystems.com>
38 * decl.c (start_decl): Set DECL_INITIAL for initialized decls
39 before attribute processing.
41 2020-11-23 Richard Sandiford <richard.sandiford@arm.com>
44 * pt.c (tsubst): Use verify_type_context to check the type
47 2020-11-21 Marek Polacek <polacek@redhat.com>
50 * parser.c (warn_for_range_copy): Warn when the loop variable is
51 initialized with a value of a different type resulting in a copy.
53 2020-11-21 Marek Polacek <polacek@redhat.com>
56 * constexpr.c (potential_constant_expression_1): Reject
57 LABEL_EXPRs that use non-artifical LABEL_DECLs.
59 2020-11-21 Marek Polacek <polacek@redhat.com>
62 * parser.c (warn_about_ambiguous_parse): Only assume "int" if we
63 actually saw any type-specifiers.
65 2020-11-21 Marek Polacek <polacek@redhat.com>
68 * parser.c (cp_parser_lambda_declarator_opt): Don't require ().
70 2020-11-21 Marek Polacek <polacek@redhat.com>
73 * constexpr.c (cxx_set_object_constness): New function.
74 (cxx_eval_call_expression): Set new_obj for destructors too.
75 Call cxx_set_object_constness to set/unset TREE_READONLY of
76 the object under construction/destruction.
78 2020-11-21 Aaron Sawdey <acsawdey@linux.ibm.com>
80 * error.c (dump_type): Handle opaque types.
81 (dump_type_prefix): Handle opaque types.
82 (dump_type_suffix): Handle opaque types.
83 (dump_expr): Handle opaque types.
84 * pt.c (tsubst): Allow opaque types in templates.
85 (unify): Allow opaque types in templates.
86 * typeck.c (structural_comptypes): Handle comparison
89 2020-11-20 Jakub Jelinek <jakub@redhat.com>
92 * Make-lang.in (c++.serial): Change from goal to a variable.
93 (.PHONY): Drop c++.serial and c++.prev.
94 (cc1plus$(exeext)): Depend on $(c++.serial) rather than c++.serial.
96 2020-11-19 Nathan Sidwell <nathan@acm.org>
98 * cp-tree.h (struct spec_entry): Moved from pt.c.
99 (walk_specializations, match_mergeable_specialization)
100 (get_mergeable_specialization_flags)
101 (add_mergeable_specialization): Declare.
102 * pt.c (struct spec_entry): Moved to cp-tree.h.
103 (walk_specializations, match_mergeable_specialization)
104 (get_mergeable_specialization_flags)
105 (add_mergeable_specialization): New.
107 2020-11-19 Nathan Sidwell <nathan@acm.org>
109 * cp-tree.h (struct constexpr_fundef): Moved from constexpr.c.
110 (maybe_save_constexpr_fundef): Declare.
111 (register_constexpr_fundef): Take constexpr_fundef object, return
113 * decl.c (mabe_save_function_definition): Delete, functionality
114 moved to maybe_save_constexpr_fundef.
115 (emit_coro_helper, finish_function): Adjust.
116 * constexpr.c (struct constexpr_fundef): Moved to cp-tree.h.
117 (constexpr_fundef_hasher::equal): Constify.
118 (constexpr_fundef_hasher::hash): Constify.
119 (retrieve_constexpr_fundef): Make non-static.
120 (maybe_save_constexpr_fundef): Break out checking and duplication
122 (register_constexpr_fundef): ... here. Just register the constexpr.
124 2020-11-19 Marek Polacek <polacek@redhat.com>
127 * init.c (build_new): When value-initializing an array new,
128 leave the INIT as an empty vector.
130 2020-11-19 Marek Polacek <polacek@redhat.com>
133 * pt.c (do_auto_deduction): Don't crash when the constructor has
136 2020-11-19 Nathan Sidwell <nathan@acm.org>
139 * decl.c (duplicate_decls): Relax new assert.
141 2020-11-18 Iain Sandoe <iain@sandoe.co.uk>
143 * parser.c (cp_parser_objc_valid_prefix_attributes): Check
144 for empty attributes.
146 2020-11-18 Jakub Jelinek <jakub@redhat.com>
148 * Make-lang.in (c++.serial): New goal.
149 (.PHONY): Add c++.serial c++.prev.
150 (cc1plus$(exeext)): Depend on c++.prev. Call LINK_PROGRESS.
152 2020-11-17 Nathan Sidwell <nathan@acm.org>
155 * decl.c (duplicate_decls): Deal with duplicated DECL_LOCAL_DECL_P
156 decls. Extend decl_lang_specific checking assert.
158 2020-11-17 Nathan Sidwell <nathan@acm.org>
160 * cp-tree.h (enum cp_tree_index): Reorder to place lazy fields
161 after newly-added CPTI_MODULE_HWM.
163 2020-11-17 Iain Sandoe <iain@sandoe.co.uk>
166 * parser.c (cp_parser_declaration): Remove checking assert.
168 2020-11-15 Jason Merrill <jason@redhat.com>
170 * decl.c (cp_finish_decl): Only check abstractness on definition.
171 (require_complete_types_for_parms): Check abstractness here.
172 (create_array_type_for_decl): Not here.
173 (grokdeclarator, grokparms, complete_vars): Not here.
174 * pt.c (tsubst, tsubst_arg_types, tsubst_function_type): Not here.
175 * typeck2.c (struct pending_abstract_type): Remove.
176 (struct abstract_type_hasher): Remove.
177 (abstract_pending_vars, complete_type_check_abstract): Remove.
178 (abstract_virtuals_error_sfinae): Handle arrays.
179 * call.c (conv_is_prvalue): Split out from...
180 (conv_binds_ref_to_prvalue): ...here.
181 (implicit_conversion_1): Rename from implicit_conversion.
182 (implicit_conversion): An abstract prvalue is bad.
183 (convert_like_internal): Don't complain if expr is already
186 2020-11-13 Jason Merrill <jason@redhat.com>
188 * cp-tree.h (USING_DECL_UNRELATED_P): New.
189 (CONST_DECL_USING_P): New.
190 * class.c (handle_using_decl): If USING_DECL_UNRELATED_P,
191 clone the CONST_DECL.
192 * name-lookup.c (supplement_binding_1): A clone hides its
194 (lookup_using_decl): Rewrite to separate lookup and validation.
195 (do_class_using_decl): Adjust.
196 (finish_nonmember_using_decl): Adjust.
197 * parser.c (make_location): Add cp_token overload.
198 (finish_using_decl): Split out from...
199 (cp_parser_using_declaration): ...here. Don't look through enums.
200 (cp_parser_using_enum): New.
201 (cp_parser_block_declaration): Call it.
202 (cp_parser_member_declaration): Call it.
203 * semantics.c (finish_id_expression_1): Handle enumerator
204 used from class scope.
206 2020-11-13 Vladimir N. Makarov <vmakarov@redhat.com>
208 * parser.c (cp_parser_asm_definition): Parse outputs for asm
211 2020-11-13 Iain Sandoe <iain@sandoe.co.uk>
214 * parser.c (cp_parser_objc_class_interface): Pass the
215 location of the class name to the interface declaration.
217 2020-11-13 Patrick Palka <ppalka@redhat.com>
219 * semantics.c (finish_compound_literal): Don't wrap the original
220 compound literal in a TARGET_EXPR when inside a template.
222 2020-11-12 Jakub Jelinek <jakub@redhat.com>
225 * constexpr.c (cxx_eval_constant_expression) <case CLEANUP_POINT_EXPR,
226 case TRY_FINALLY_EXPR, case CLEANUP_STMT>: Don't pass jump_target to
227 cxx_eval_constant_expression when evaluating the cleanups.
229 2020-11-11 Iain Sandoe <iain@sandoe.co.uk>
231 * parser.c (cp_parser_declaration): Unless we are compiling for
232 Ojective-C++, warn about and discard any attributes that prefix
233 a linkage specification.
235 2020-11-11 Patrick Palka <ppalka@redhat.com>
238 * mangle.c (write_expression): Mangle __alignof_ differently
239 from alignof when the ABI version is at least 15.
241 2020-11-11 Patrick Palka <ppalka@redhat.com>
244 * cp-tree.h (cxx_sizeof_or_alignof_expr): Add bool parameter.
245 * decl.c (fold_sizeof_expr): Pass false to
246 cxx_sizeof_or_alignof_expr.
247 * parser.c (cp_parser_unary_expression): Pass std_alignof to
248 cxx_sizeof_or_alignof_expr.
249 * pt.c (tsubst_copy): Pass false to cxx_sizeof_or_alignof_expr.
250 (tsubst_copy_and_build): Pass std_alignof to
251 cxx_sizeof_or_alignof_expr.
252 * typeck.c (cxx_alignof_expr): Add std_alignof bool parameter
253 and pass it to cxx_sizeof_or_alignof_type. Set ALIGNOF_EXPR_STD_P
255 (cxx_sizeof_or_alignof_expr): Add std_alignof bool parameter
256 and pass it to cxx_alignof_expr. Assert op is either
257 SIZEOF_EXPR or ALIGNOF_EXPR.
259 2020-11-11 Marek Polacek <polacek@redhat.com>
262 * pt.c (tsubst_qualified_id): Use EXPR_LOCATION of the qualified-id.
263 Use it to maybe_wrap_with_location the final expression.
265 2020-11-10 Marek Polacek <polacek@redhat.com>
268 * cp-tree.h (finish_static_assert): Adjust declaration.
269 * parser.c (cp_parser_static_assert): Pass false to
270 finish_static_assert.
271 * pt.c (tsubst_expr): Pass true to finish_static_assert.
272 * semantics.c (find_failing_clause_r): New function.
273 (find_failing_clause): New function.
274 (finish_static_assert): Add a bool parameter. Use
275 iloc_sentinel. Call contextual_conv_bool instead of
276 perform_implicit_conversion_flags. Don't check for INTEGER_CST before
277 calling integer_zerop. Call find_failing_clause and maybe use its
278 location. Print the original condition or the failing clause if
281 2020-11-10 Strager Neds <strager.nds@gmail.com>
283 * decl.c (duplicate_decls): Use new overload of
284 set_decl_section_name.
285 * method.c (use_thunk): Same.
286 * optimize.c (maybe_clone_body): Same.
287 * coroutines.cc (act_des_fn): Same.
289 2020-11-10 Jakub Jelinek <jakub@redhat.com>
292 * cvt.c (convert_to_void): Check (complain & tf_warning) in the outer
293 if rather than twice times in the inner one. Use warn_if_unused_value.
296 2020-11-10 Chung-Lin Tang <cltang@codesourcery.com>
298 * parser.c (cp_parser_omp_target_data): Add use of
299 new c_omp_adjust_map_clauses function. Add GOMP_MAP_ATTACH_DETACH as
300 handled map clause kind.
301 (cp_parser_omp_target_enter_data): Likewise.
302 (cp_parser_omp_target_exit_data): Likewise.
303 (cp_parser_omp_target): Likewise.
304 * semantics.c (handle_omp_array_sections): Adjust COMPONENT_REF case to
305 use GOMP_MAP_ATTACH_DETACH map kind for C_ORT_OMP region type. Fix
306 interaction between reference case and attach/detach.
307 (finish_omp_clauses): Adjust bitmap checks to allow struct decl and
308 same struct field access to co-exist on OpenMP construct.
310 2020-11-09 Marek Polacek <polacek@redhat.com>
313 * parser.c (cp_parser_check_std_attribute): Return bool. Add a
314 location_t parameter. Return true if the attribute wasn't duplicated.
315 Give a warning instead of an error. Check more attributes.
316 (cp_parser_std_attribute_list): Don't add duplicated attributes to
317 the list. Pass location to cp_parser_check_std_attribute.
319 2020-11-09 Patrick Palka <ppalka@redhat.com>
321 * constraint.cc (norm_info::norm_info): Initialize orig_decl.
322 (norm_info::orig_decl): New data member.
323 (normalize_atom): When caching an atom for the first time,
324 compute a list of template parameters used in the targets of the
325 parameter mapping and store it in the TREE_TYPE of the mapping.
326 (get_normalized_constraints_from_decl): Set current_function_decl
327 appropriately when normalizing. As an optimization, don't
328 set up a push_nested_class_guard when decl has no constraints.
329 (sat_hasher::hash): Use this list to hash only the template
330 arguments that are relevant to the atom.
331 (satisfy_atom): Use this list to compare only the template
332 arguments that are relevant to the atom.
333 * pt.c (keep_template_parm): Do a sanity check on the parameter's
334 index when flag_checking.
336 2020-11-09 Patrick Palka <ppalka@redhat.com>
338 * cp-tree.h (ATOMIC_CONSTR_MAP_INSTANTIATED_P): Define this flag
340 * constraint.cc (sat_hasher::hash): Use hash_atomic_constraint
341 if the flag is set, otherwise keep using a pointer hash.
342 (sat_hasher::equal): Return false if the flag's setting differs
343 on two atoms. Call atomic_constraints_identical_p if the flag
344 is set, otherwise keep using a pointer equality test.
345 (satisfy_atom): After instantiating the parameter mapping, form
346 another ATOMIC_CONSTR using the instantiated mapping and query
347 the cache again. Cache the satisfaction value of both atoms.
348 (diagnose_atomic_constraint): Simplify now that the supplied
349 atom has an instantiated mapping.
351 2020-11-09 Patrick Palka <ppalka@redhat.com>
353 * constraint.cc (atom_cache): Define this deletable hash_table.
354 (normalize_atom): Use it to cache ATOMIC_CONSTRs when not
355 generating diagnostics.
356 (sat_hasher::hash): Use htab_hash_pointer instead of
357 hash_atomic_constraint.
358 (sat_hasher::equal): Test for pointer equality instead of
359 atomic_constraints_identical_p.
360 * cp-tree.h (struct atom_hasher): Moved and renamed from ...
361 * logic.cc (struct constraint_hash): ... here.
362 (clause::m_set): Adjust accordingly.
364 2020-11-09 Patrick Palka <ppalka@redhat.com>
367 * constraint.cc (tsubst_parameter_mapping): Also canonicalize
368 the type arguments of a TYPE_ARGUMENT_PACk.
370 2020-11-09 Jason Merrill <jason@redhat.com>
372 * pt.c (tsubst): Replace *_ARGUMENT_PACK code with
373 a call to tsubst_argument_pack.
375 2020-11-09 Jason Merrill <jason@redhat.com>
377 * class.c (handle_using_decl): Add an iloc_sentinel.
379 2020-11-09 Marek Polacek <polacek@redhat.com>
382 * parser.c (warn_about_ambiguous_parse): Handle the case when
383 there is no type in the decl-specifiers.
385 2020-11-09 Nathan Sidwell <nathan@acm.org>
387 * cp-tree.h (LOOKUP_FOUND_P): Add ENUMERAL_TYPE.
388 * name-lookup.c (class name_lookup): Add comments.
389 (name_lookup::adl_namespace_only): Replace with ...
390 (name_lookup::adl_class_fns): ... this and ...
391 (name_lookup::adl_namespace_fns): ... this.
392 (name_lookup::adl_namespace): Deal with inline nests here.
393 (name_lookup::adl_class): Complete the type here.
394 (name_lookup::adl_type): Call broken-out enum ..
395 (name_lookup::adl_enum): New. No need to call the namespace adl
396 if it is class-scope.
397 (name_lookup::search_adl): Iterate over collected scopes here.
399 2020-11-09 Nathan Sidwell <nathan@acm.org>
401 * name-lookup.c (lookup_qualified_name): Expose an overload of a
402 singleton with known type.
403 (lookup_name_1): Just check the overload's type to expose it.
404 * parser.c (cp_parser_lookup_name): Do not do that check here.
406 2020-11-08 Iain Sandoe <iain@sandoe.co.uk>
408 * parser.c (cp_parser_objc_at_property_declaration): Handle
409 class keywords in @property attribute context.
411 2020-11-06 Marek Polacek <polacek@redhat.com>
414 * except.c (can_convert_eh): Change the return type to bool. If
415 the type TO and FROM are the same, return true.
417 2020-11-06 Iain Sandoe <iain@sandoe.co.uk>
419 * parser.c (cp_parser_objc_at_property_declaration):
420 Improve parsing fidelity. Associate better location info
421 with @property attributes. Clean up the interface to
422 objc_add_property_declaration ().
424 2020-11-06 Jakub Jelinek <jakub@redhat.com>
427 * decl.c (duplicate_decls): Propagate DECL_ATTRIBUTES and
428 DECL_PRESERVE_P from olddecl to its clones if any.
430 2020-11-06 Nathan Sidwell <nathan@acm.org>
432 * cp-tree.h (DECL_UNDECLARED_BUILTIN_P): Delete.
433 * cp-objcp-common.c (names_bultin_p): Rename
434 DECL_IS_BUILTIN->DECL_IS_UNDECLARED_BUILTIN.
435 * decl.c (decls_match): Likewise. Replace
436 DECL_UNDECLARED_BUILTIN_P with DECL_IS_UNDECLARED_BUILTIN.
437 (duplicate_decls): Likewise.
438 * decl2.c (collect_source_refs): Likewise.
439 * name-lookup.c (anticipated_builtin_p, print_binding_level)
440 (do_nonmember_using_decl): Likewise.
441 * pt.c (builtin_pack_fn_p): Likewise.
442 * typeck.c (error_args_num): Likewise.
444 2020-11-06 Nathan Sidwell <nathan@acm.org>
446 * parser.c (cp_parser_template_declaration): Adjust 'export' warning.
447 (cp_parser_explicit_specialization): Remove unneeded bool setting.
449 2020-11-06 Jan Hubicka <jh@suse.cz>
451 * tree.c (cp_fix_function_decl_p): Do not access ipa_ref_list dirrectly.
453 2020-11-06 Tobias Burnus <tobias@codesourcery.com>
455 * parser.c (cp_parser_omp_atomic): Add openacc parameter and update
457 (cp_parser_omp_construct): Update call.
459 2020-11-05 Marek Polacek <polacek@redhat.com>
461 * except.c (check_handlers_1): Add auto_diagnostic_group.
463 2020-11-05 Marek Polacek <polacek@redhat.com>
466 * pt.c (do_auto_deduction): If init is REFERENCE_REF_P, use its
469 2020-11-05 Marek Polacek <polacek@redhat.com>
472 * except.c (check_handlers_1): Use OPT_Wexceptions for the
473 warning. Use inform for the second part of the warning.
475 2020-11-05 Marek Polacek <polacek@redhat.com>
478 * cp-tree.h (enum cp_tree_index): Add CPTI_EXPLICIT_VOID_LIST.
479 (explicit_void_list_node): Define.
480 (PARENTHESIZED_LIST_P): New macro.
481 (struct cp_declarator): Add function::parens_loc.
482 * decl.c (cxx_init_decl_processing): Initialize explicit_void_list_node.
483 (grokparms): Also break when explicit_void_list_node.
484 * parser.c (make_call_declarator): New location_t parameter. Use it
485 to set declarator->u.function.parens_loc.
486 (cp_parser_lambda_declarator_opt): Pass UNKNOWN_LOCATION to
487 make_call_declarator.
488 (warn_about_ambiguous_parse): New function.
489 (cp_parser_init_declarator): Call warn_about_ambiguous_parse.
490 (cp_parser_declarator): Set *parenthesized_p to false rather than to
492 (cp_parser_direct_declarator): Create a location for the function's
493 parentheses and pass it to make_call_declarator.
494 (cp_parser_parameter_declaration_clause): Return explicit_void_list_node
496 (cp_parser_parameter_declaration_list): Set PARENTHESIZED_LIST_P
497 in the parameters tree.
499 2020-11-04 Jakub Jelinek <jakub@redhat.com>
502 * semantics.c (finish_omp_clauses): Look through array reductions to
503 find underlying decl to clear in the aligned_head bitmap. Use
504 DECL_UID (t) instead of DECL_UID (OMP_CLAUSE_DECL (c)) when clearing
505 in the bitmap. Only diagnose errors about allocate vars not being
506 privatized on the same construct on allocate clause if it has
507 a DECL_P OMP_CLAUSE_DECL.
509 2020-11-04 Iain Sandoe <iain@sandoe.co.uk>
511 * constexpr.c (potential_constant_expression_1): Handle
512 expressions known to be non-constant for Objective-C.
514 2020-11-03 Jason Merrill <jason@redhat.com>
516 * tree.c (is_byte_access_type): Don't use char_type_p.
518 2020-11-03 Jakub Jelinek <jakub@redhat.com>
521 * parser.c (cp_parser_init_declarator): Don't try to parse
522 C++17 deduction guides if there are any type specifiers even when
525 2020-11-03 Kamlesh Kumar <kamleshbhalui@gmail.com>
526 Jason Merrill <jason@redhat.com>
530 * pt.c (get_template_base): Consider closest base in template
531 deduction when base of base also matches.
533 2020-11-03 Nathan Sidwell <nathan@acm.org>
535 * pt.c (tsubst_expr): Simplify using decl instantiation, add
538 2020-11-03 Nathan Sidwell <nathan@acm.org>
540 * class.c (copy_fndecl_with_name): Always not top level.
541 (build_cdtor_clones): Add update_methods parm, use it to
542 conditionally update the method vec. Return void
543 (clone_cdtor): Adjust.
544 (clone_constructors_and_destructors): Adjust comment.
546 2020-11-03 Nathan Sidwell <nathan@acm.org>
548 * pt.c (primary_template_specialization_p): Use
549 VAR_OR_FUNCTION_DECL_P.
550 (tsubst_template_decl): Check for FUNCTION_DECL, not !TYPE && !VAR
551 for registering a specialization.
553 2020-11-03 Nathan Sidwell <nathan@acm.org>
555 * cp-tree.h (fixup_deferred_exception_variants): Declare.
556 * parser.c (cp_parser_class_specifier_1): Call it when
557 completing deferred parses rather than creating a variant.
558 (cp_parser_member_declaration): Move comment from ...
559 (cp_parser_noexcept_specification_opt): ... here. Refactor the
561 * tree.c (fixup_deferred_exception_variants): New.
563 2020-11-03 Nathan Sidwell <nathan@acm.org>
565 * pt.c (tsubst_lambda_expr): Reorder extra-scope handling to match
566 the non-template case.
567 (instantiate_body): Move a couple of declarations to their
570 2020-11-03 Nathan Sidwell <nathan@acm.org>
572 * decl.c (duplicate_decls): Return error_mark_node fo extern-c
575 2020-11-03 Marek Polacek <polacek@redhat.com>
577 * constexpr.c (potential_constant_expression_1): Treat
578 __PRETTY_FUNCTION__ inside a template function as
579 potentially-constant.
580 * pt.c (uses_template_parms): Call
581 instantiation_dependent_expression_p instead of
582 value_dependent_expression_p.
583 (instantiation_dependent_expression_p): Check
584 potential_constant_expression before calling
585 value_dependent_expression_p.
587 2020-11-03 Marek Polacek <polacek@redhat.com>
590 * init.c (build_new_1): Disable -Winit-list-lifetime for an unevaluated
593 2020-11-03 Nathan Sidwell <nathan@acm.org>
595 * tree.c (bind_template_template_parm): Mark the parm as a
597 (cp_tree_equal): Refactor CALL_EXPR. Use comp_template_args for
600 2020-11-03 Nathan Sidwell <nathan@acm.org>
602 * rtti.c (init_rtti_processing): Move var decl to its init.
603 (get_tinfo_decl): Likewise. Break out creation to called helper
605 (get_tinfo_decl_direct): ... here.
606 (build_dynamic_cast_1): Move var decls to their initializers.
607 (tinfo_base_init): Set decl's location to BUILTINS_LOCATION.
608 (get_tinfo_desc): Only push ABI namespace when needed. Set type's
611 2020-11-02 Nathan Sidwell <nathan@acm.org>
613 * decl.c (start_decl_1): Refactor declarations. Fixup some
615 (lookup_and_check_tag): Fixup some whitespace.
617 2020-11-02 Nathan Sidwell <nathan@acm.org>
619 * decl.c (duplicate_decls): Refactor some template & builtin
622 2020-11-02 Nathan Sidwell <nathan@acm.org>
624 * cp-tree.h (struct cxx_int_tree_map): Delete.
625 (struct cxx_int_tree_map_hasher): Delete.
626 * cp-gimplify.c (cxx_int_tree_map_hasher::equal): Delete.
627 (cxx_int_tree_map_hasher::hash): Delete.
629 2020-11-02 Patrick Palka <ppalka@redhat.com>
631 * class.c (finish_struct_1): Don't call clear_satisfaction_cache.
632 * constexpr.c (clear_cv_and_fold_caches): Likewise. Remove bool
634 * constraint.cc (clear_satisfaction_cache): Remove definition.
635 * cp-tree.h (clear_satisfaction_cache): Remove declaration.
636 (clear_cv_and_fold_caches): Remove bool parameter.
637 * typeck2.c (store_init_value): Remove argument to
638 clear_cv_and_fold_caches.
640 2020-11-01 Iain Sandoe <iain@sandoe.co.uk>
642 * parser.c (cp_parser_objc_at_property_declaration): Use any
643 exisiting syntax error to suppress complaints about a missing
644 closing parenthesis in parsing property attributes.
646 2020-10-30 Jakub Jelinek <jakub@redhat.com>
648 * semantics.c (finish_omp_clauses) <case OMP_CLAUSE_ALLOCATE>: Handle
649 non-static members in methods.
650 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_ALLOCATE.
652 2020-10-29 Marek Polacek <polacek@redhat.com>
656 * parser.c (cp_parser_type_id_1): Reject using auto as
657 a template-argument in C++20.
659 2020-10-29 Marek Polacek <polacek@redhat.com>
662 * pt.c (do_auto_deduction): Call resolve_nondeduced_context for
663 the elements of a { } list.
665 2020-10-29 Marek Polacek <polacek@redhat.com>
667 * typeck.c (do_warn_enum_conversions): Don't warn for SPACESHIP_EXPR.
668 (cp_build_binary_op): Reject float <=> enum or enum <=> float. Use
669 CP_INTEGRAL_TYPE_P instead of INTEGRAL_OR_ENUMERATION_TYPE_P.
671 2020-10-29 Patrick Palka <ppalka@redhat.com>
673 * constraint.cc (get_normalized_constraints): Remove 'args'
674 parameter. Pass NULL_TREE as the initial template arguments to
675 normalize_expression.
676 (get_normalized_constraints_from_info): Remove 'args' parameter
677 and adjust the call to get_normalized_constraints.
678 (get_normalized_constraints_from_decl): Remove 'args' local
679 variable and adjust call to get_normalized_constraints_from_info.
680 (normalize_concept_definition): Remove 'args' local variable
681 and adjust call to get_normalized_constraints.
682 (normalize_constraint_expression): Remove the two-parameter
683 overload. Remove 'args' parameter from the three-parameter
684 overload and update function comment accordingly. Remove
685 default argument from 'diag' parameter. Adjust call to
686 get_normalized_constraints.
687 (finish_nested_requirement): Adjust call to
688 normalize_constraint_expression.
689 (strictly_subsumes): Remove 'args' parameter. Adjust call to
690 get_normalized_constraints_from_info.
691 (weakly_subsumes): Likewise.
692 * cp-tree.h (strictly_subsumes): Remove 'args' parameter.
693 (weakly_subsumes): Likewise.
694 * pt.c (process_partial_specialization): Adjust call to
696 (is_compatible_template_arg): Adjust call to weakly_subsumes.
698 2020-10-29 Patrick Palka <ppalka@redhat.com>
701 * constraint.cc (normalize_concept_check): Don't call
702 tsubst_template_args when 'args' is NULL.
704 2020-10-29 Jason Merrill <jason@redhat.com>
707 * constexpr.c (cxx_eval_outermost_constant_expr): Revert to
708 original expression if evaluation sets non_constant_p.
710 2020-10-29 Jakub Jelinek <jakub@redhat.com>
711 Jason Merrill <jason@redhat.com>
714 * constexpr.c (cxx_bind_parameters_in_call): Set non_constant_args
715 if the parameter type has a non-trivial destructor.
716 (cxx_eval_call_expression): Only unshare arguments if we're
717 memoizing this evaluation.
719 2020-10-29 Jakub Jelinek <jakub@redhat.com>
722 * cp-tree.h (enum cp_tree_index): Add CPTI_HEAP_VEC_UNINIT_IDENTIFIER
723 and CPTI_HEAP_VEC_IDENTIFIER.
724 (heap_vec_uninit_identifier, heap_vec_identifier): Define.
725 * decl.c (initialize_predefined_identifiers): Initialize those
727 * constexpr.c (cxx_eval_call_expression): Reject array allocations
728 deallocated with non-array deallocation or non-array allocations
729 deallocated with array deallocation.
730 (non_const_var_error): Handle heap_vec_uninit_identifier and
731 heap_vec_identifier too.
732 (cxx_eval_constant_expression): Handle also heap_vec_uninit_identifier
733 and in that case during initialization replace it with
735 (find_heap_var_refs): Handle heap_vec_uninit_identifier and
736 heap_vec_identifier too.
738 2020-10-29 Nathan Sidwell <nathan@acm.org>
740 * pt.c (push_template_decl): Do not give function-scope entities
741 other than implicit typedefs a template header. Do not readd
742 template info to a redeclared template.
744 2020-10-28 Marek Polacek <polacek@redhat.com>
746 * decl.c (grokdeclarator): Offer a fix-it hint for the "unnecessary
747 parentheses in declaration" warning.
748 * parser.c (cp_parser_direct_declarator): When setting
749 declarator->parenthesized, use a location range.
751 2020-10-28 Marek Polacek <polacek@redhat.com>
754 * call.c (build_conditional_expr_1): Warn about the deprecated
755 enum/real type conversion in C++20. Also warn about a non-enumerated
756 and enumerated type in ?: when -Wenum-conversion is on.
757 * typeck.c (do_warn_enum_conversions): New function.
758 (cp_build_binary_op): Call it.
760 2020-10-28 Marek Polacek <polacek@redhat.com>
764 * pt.c (tsubst_copy_and_build): Call value_dependent_expression_p or
765 type_dependent_expression_p instead of type_dependent_expression_p_push.
766 But only call value_dependent_expression_p for expressions that are
767 potential_constant_expression.
769 2020-10-28 Marek Polacek <polacek@redhat.com>
772 * parser.c (cp_parser_class_name): Use parser->scope when
775 2020-10-28 Marek Polacek <polacek@redhat.com>
778 * parser.c (cp_parser_fold_expression): Return error_mark_node
779 if a left fold is preceded by an expression.
781 2020-10-28 Nathan Sidwell <nathan@acm.org>
783 * parser.c (cp_parser_omp_declare_reduction): Set
784 DECL_LOCAL_DECL_P before push_template_decl.
785 * pt.c (instantiate_body): Nested fns do not have template_info.
787 2020-10-28 Patrick Palka <ppalka@redhat.com>
790 * decl2.c (mark_used): Move up the constraints_satisfied_p check
791 so that we check constraints before calling maybe_instantiate_decl.
793 2020-10-28 Nathan Sidwell <nathan@acm.org>
795 * pt.c (push_template_decl): Refactor for some RAII.
797 2020-10-28 Jakub Jelinek <jakub@redhat.com>
799 * parser.c (cp_parser_omp_clause_name): Handle allocate.
800 (cp_parser_omp_clause_allocate): New function.
801 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_ALLOCATE.
802 (OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK,
803 OMP_PARALLEL_CLAUSE_MASK, OMP_SINGLE_CLAUSE_MASK,
804 OMP_TASK_CLAUSE_MASK, OMP_TASKGROUP_CLAUSE_MASK,
805 OMP_DISTRIBUTE_CLAUSE_MASK, OMP_TEAMS_CLAUSE_MASK,
806 OMP_TARGET_CLAUSE_MASK, OMP_TASKLOOP_CLAUSE_MASK): Add
807 PRAGMA_OMP_CLAUSE_ALLOCATE.
808 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_ALLOCATE.
809 * pt.c (tsubst_omp_clauses): Likewise.
811 2020-10-27 Nathan Sidwell <nathan@acm.org>
813 * cp-tree.h (struct lang_type): Delete nested_udts field.
814 (CLASSTYPE_NESTED_UTDS): Delete.
815 * name-lookup.h (binding_table, binding_entry): Delete typedefs.
816 (bt_foreach_proc): Likewise.
817 (struct binding_entry_s): Delete.
818 (SCOPE_DEFAULT_HT_SIZE, CLASS_SCOPE_HT_SIZE)
819 (NAMESPACE_ORDINARY_HT_SIZE, NAMESPACE_STD_HT_SIZE)
820 (GLOBAL_SCOPE_HT_SIZE): Delete.
821 (binding_table_foreach, binding_table_find): Delete declarations.
822 * name-lookup.c (ENTRY_INDEX): Delete.
823 (free_binding_entry): Delete.
824 (binding_entry_make, binding_entry_free): Delete.
825 (struct binding_table_s): Delete.
826 (binding_table_construct, binding_table_free): Delete.
827 (binding_table_new, binding_table_expand): Delete.
828 (binding_table_insert, binding_table_find): Delete.
829 (binding_table_foreach): Delete.
830 (maybe_process_template_type_declaration): Delete
831 CLASSTYPE_NESTED_UTDS insertion.
832 (do_pushtag): Likewise.
833 * decl2.c (bt_reset_linkage_1): Fold into reset_type_linkage_1.
834 (reset_type_linkage_2, bt_reset_linkage_2): Fold into
836 * pt.c (instantiate_class_template_1): Delete NESTED_UTDs comment.
837 (bt_instantiate_type_proc): Delete.
838 (do_type_instantiation): Instantiate implicit typedef fields.
839 Delete NESTED_UTD walk.
840 * search.c (lookup_field_r): Delete unreachable NESTED_UTD
843 2020-10-27 Nathan Sidwell <nathan@acm.org>
845 * parser.c (cp_parser_explicit_instantiation): Refactor some RAII.
846 * pt.c (bt_instantiate_type_proc): DATA is the tree, pass type to
847 do_type_instantiation.
848 (do_type_instantiation): Require T to be a type. Refactor for
851 2020-10-26 Ville Voutilainen <ville.voutilainen@gmail.com>
853 * cp-tree.h (CPTK_IS_NOTHROW_ASSIGNABLE): New.
854 (CPTK_IS_NOTHROW_CONSTRUCTIBLE): Likewise.
855 (is_nothrow_xible): Likewise.
856 * method.c (is_nothrow_xible): New.
857 (is_trivially_xible): Tweak.
858 * parser.c (cp_parser_primary_expression): Handle the new RID_*.
859 (cp_parser_trait_expr): Likewise.
860 * semantics.c (trait_expr_value): Handle the new RID_*.
861 (finish_trait_expr): Likewise.
863 2020-10-24 Marek Polacek <polacek@redhat.com>
866 * constexpr.c (cxx_eval_array_reference): Set up ctx->ctor if we
867 are initializing an aggregate. Call free_constructor on the new
868 CONSTRUCTOR if it isn't returned from cxx_eval_constant_expression.
870 2020-10-23 Marek Polacek <polacek@redhat.com>
873 * typeck.c (cp_build_binary_op): Implement -Wsizeof-array-div.
875 2020-10-22 Patrick Palka <ppalka@redhat.com>
878 * constexpr.c (init_subob_ctx): Don't punt on RANGE_EXPR
879 indexes, instead build a sub-aggregate initialization context
882 2020-10-22 Patrick Palka <ppalka@redhat.com>
885 * constexpr.c (cxx_eval_constant_expression)
886 <case EMPTY_CLASS_EXPR>: Lower it to a CONSTRUCTOR.
887 (potential_constant_expression_1) <case COMPOUND_EXPR>: Remove
888 now-redundant handling of COMPOUND_EXPR with EMPTY_CLASS_EXPR
890 <case EMPTY_CLASS_EXPR>: Return true instead of false.
892 2020-10-22 Patrick Palka <ppalka@redhat.com>
895 * decl.c (duplicate_decls): Return NULL_TREE if
896 DECL_TEMPLATE_PARM_P differ.
898 2020-10-20 Nathan Sidwell <nathan@acm.org>
900 * name-lookup.c (push_local_extern_decl_alias): Reconstextualize
901 alias' parm decls. Drop any default args.
903 2020-10-19 Iain Sandoe <iain@sandoe.co.uk>
906 * coroutines.cc (struct coroutine_info): Add a field to
907 record that we emitted a promise type error.
908 (coro_promise_type_found_p): Check for the case that the
909 promise type contains both return_void and return_value.
910 Emit an error if so, with information about the wrong
913 2020-10-16 Nathan Sidwell <nathan@acm.org>
916 * pt.c (push_template_decl): Check DECL_LANG_SPECIFIC in friend
919 2020-10-16 Nathan Sidwell <nathan@acm.org>
922 * parser.c (cp_parser_declaration): Make token2 point to EOF if
925 2020-10-15 Jason Merrill <jason@redhat.com>
928 * decl.c (copy_fn_p): Return false for a function that is neither a
929 constructor nor an assignment operator.
930 (move_signature_fn_p): Likewise.
932 2020-10-15 Marek Polacek <polacek@redhat.com>
936 * cxx-pretty-print.c (pp_cxx_type_specifier_seq): Handle OFFSET_TYPE.
937 (cxx_pretty_printer::abstract_declarator): Fix the printing of ')'.
938 (cxx_pretty_printer::direct_abstract_declarator): Handle OFFSET_TYPE.
939 (cxx_pretty_printer::type_id): Likewise. Print the abstract declarator
940 for pointers-to-members.
942 2020-10-14 Jason Merrill <jason@redhat.com>
945 * pt.c (check_for_bare_parameter_packs): Diagnose use of
948 2020-10-14 Nathan Sidwell <nathan@acm.org>
950 * cp-tree.h (struct lang_decl_fn): Adjust context comment.
951 (DECL_FRIEND_P): Replace with ...
952 (DECL_UNIQUE_FRIEND_P): ... this. Only for FUNCTION_DECLs.
953 (DECL_FRIEND_CONTEXT): Adjust.
954 * class.c (add_implicitly_declared_members): Detect friendly
955 spaceship from context.
956 * constraint.cc (remove_constraints): Use a checking assert.
957 (maybe_substitute_reqs_for): Use DECL_UNIQUE_FRIEND_P.
958 * decl.c (check_no_redeclaration_friend_default_args):
959 DECL_UNIQUE_FRIEND_P is signficant, not hiddenness.
960 (duplicate_decls): Adjust DECL_UNIQUE_FRIEND_P clearing.
961 (redeclaration_error_message): Use DECL_UNIQUE_FRIEND_P.
962 (start_preparsed_function): Correct in-class friend processing.
963 Refactor some initializers.
964 (grokmethod): Directly check friend decl-spec.
965 * decl2.c (grokfield): Check DECL_UNIQUE_FRIEND_P.
966 * friend.c (do_friend): Set DECL_UNIQUE_FRIEND_P first, remove
967 extraneous conditions. Don't re set it afterwards.
968 * name-lookup.c (lookup_elaborated_type_1): Simplify revealing
970 (do_pushtag): Likewise.
971 * pt.c (optimize_specialization_lookup_p): Check
972 DECL_UNIQUE_FRIEND_P.
973 (push_template_decl): Likewise. Drop unneeded friend setting.
974 (type_dependent_expression_p): Check DECL_UNIQUE_FRIEND_P.
976 2020-10-14 Nathan Sidwell <nathan@acm.org>
978 * name-lookup.c (push_local_extern_decl_alias): Push into alias's
979 namespace and use pushdecl.
980 (do_pushdecl_with_scope): Clarify behaviour.
982 2020-10-12 Martin Sebor <msebor@redhat.com>
985 * error.c (dump_type_suffix): Handle both the C and C++ forms of
988 2020-10-12 Martin Sebor <msebor@redhat.com>
992 * init.c (warn_placement_new_too_small): Call builtin_objsize instead
993 of duplicating what it does.
995 2020-10-08 Jason Merrill <jason@redhat.com>
999 * pt.c (tsubst_aggr_type): Don't build a TYPENAME_TYPE when
1001 (tsubst_template_decl): Use tsubst_aggr_type.
1003 2020-10-08 Patrick Palka <ppalka@redhat.com>
1006 * constraint.cc (build_type_constraint): Temporarily increment
1007 processing_template_decl before calling build_concept_check.
1008 * pt.c (make_constrained_placeholder_type): Likewise.
1010 2020-10-08 Patrick Palka <ppalka@redhat.com>
1013 * parser.c (cp_parser_class_specifier_1): Move call to
1014 associate_classtype_constraints from here to ...
1015 (cp_parser_class_head): ... here.
1016 * pt.c (is_compatible_template_arg): Correct documentation to
1017 say "argument is _no_ more constrained than the parameter".
1019 2020-10-07 Marek Polacek <polacek@redhat.com>
1022 * pt.c (tsubst_copy_and_build) <case TEMPLATE_ID_EXPR>: Call
1023 tsubst_copy_and_build explicitly instead of using the RECUR macro.
1024 Handle a TEMPLATE_ID_EXPR with an IDENTIFIER_NODE as its operand.
1025 <case CALL_EXPR>: Perform ADL for a TEMPLATE_ID_EXPR with an
1026 IDENTIFIER_NODE as its operand.
1028 2020-10-07 Patrick Palka <ppalka@redhat.com>
1032 * tree.c (cp_tree_equal) <case ALIGNOF_EXPR>: Return false if
1033 ALIGNOF_EXPR_STD_P differ.
1035 2020-10-07 Nathan Sidwell <nathan@acm.org>
1037 * cp-tree.h (struct language_function): Delete extern_decl_map.
1038 (DECL_LOCAL_DECL_ALIAS): New.
1039 * name-lookup.h (is_local_extern): Delete.
1040 * name-lookup.c (set_local_extern_decl_linkage): Replace with ...
1041 (push_local_extern_decl): ... this new function.
1042 (do_pushdecl): Call new function after pushing new decl. Unhide
1043 hidden non-functions.
1044 (is_local_extern): Delete.
1045 * decl.c (layout_var_decl): Do not allow VLA local externs.
1046 * decl2.c (mark_used): Also mark DECL_LOCAL_DECL_ALIAS. Drop old
1047 local-extern treatment.
1048 * parser.c (cp_parser_oacc_declare): Deal with local extern aliases.
1049 * pt.c (tsubst_expr): Adjust local extern instantiation.
1050 * cp-gimplify.c (cp_genericize_r): Remap DECL_LOCAL_DECLs.
1052 2020-10-07 Nathan Sidwell <nathan@acm.org>
1054 * cp-tree.h (DECL_BUILTIN_P): Rename to ...
1055 (DECL_UNDECLARED_BUILTIN_P): ... here.
1056 * decl.c (duplicate_decls): Adjust.
1057 * name-lookup.c (anticipated_builtin_p): Adjust.
1058 (do_nonmember_using_decl): Likewise.
1060 2020-10-07 Nathan Sidwell <nathan@acm.org>
1062 * tree.c (build_cp_fntype_variant): Clear
1063 TYPE_DEPENDENT_P_VALID if necessary.
1065 2020-10-06 Marek Polacek <polacek@redhat.com>
1068 * parser.c (cp_parser_direct_declarator): When checking if a
1069 name is a function template declaration for the P0634R3 case,
1070 look in uninstantiated templates too.
1072 2020-10-05 Marek Polacek <polacek@redhat.com>
1074 * cp-tree.h (NON_UNION_CLASS_TYPE_P): Fix typo in a comment.
1076 2020-10-05 Richard Biener <rguenther@suse.de>
1077 Jakub Jelinek <jakub@redhat.com>
1080 * error.c (dump_expr): Handle TARGET_MEM_REF.
1082 2020-10-05 Nathan Sidwell <nathan@acm.org>
1084 * name-lookup.c (maybe_add_fuzzy_decl): New.
1085 (maybe_add_fuzzy_binding): New.
1086 (consider_binding_level): Use intermediate sortable vector for
1089 2020-10-02 Marek Polacek <polacek@redhat.com>
1092 * cxx-pretty-print.c (pp_cxx_template_argument_list): If the
1093 argument is template_parm_object_p, print its DECL_INITIAL.
1095 2020-10-02 Nathan Sidwell <nathan@acm.org>
1097 * cp-tree.h (lang_decl_base): anticipated_p is not used for
1099 (DECL_ANTICIPATED): Delete.
1100 * decl.c (duplicate_decls): Delete DECL_ANTICIPATED_management,
1102 (cxx_builtin_function): Drop DECL_ANTICIPATED setting.
1103 (xref_tag_1): Drop DECL_ANTICIPATED assert.
1104 * name-lookup.c (name_lookup::adl_class_only): Drop
1105 DECL_ANTICIPATED check.
1106 (name_lookup::search_adl): Always dedup.
1107 (anticipated_builtin_p): Reimplement.
1108 (do_pushdecl): Drop DECL_ANTICIPATED asserts & update.
1109 (lookup_elaborated_type_1): Drop DECL_ANTICIPATED update.
1110 (do_pushtag): Drop DECL_ANTICIPATED setting.
1111 * pt.c (push_template_decl): Likewise.
1112 (tsubst_friend_class): Likewise.
1114 2020-10-02 Nathan Sidwell <nathan@acm.org>
1116 * name-lookup.c (consider_decl): New, broken out of ...
1117 (consider_binding_level): ... here. Iterate the hash table for
1120 2020-10-02 Nathan Sidwell <nathan@acm.org>
1122 * cp-tree.h (base_ctor_omit_inherited_parms): Declare.
1123 * class.c (add_method): Refactor main loop, only pass fns to
1124 ctor_omit_inherited_parms.
1125 (build_cdtor_clones): Rename bool parms.
1126 (clone_cdtor): Call base_ctor_omit_inherited_parms.
1127 * method.c (base_ctor_omit_inherited_parms): New, broken out of
1129 (ctor_omit_inherited_parms): ... here, call it with
1130 DECL_CLONED_FUNCTION.
1132 2020-10-02 Nathan Sidwell <nathan@acm.org>
1134 * cp-tree.h (cp_fname_init): Delete declaration.
1135 * decl.c (cp_fname_init): Merge into only caller ...
1136 (cp_make_fname): ... here & refactor.
1138 2020-10-02 Jason Merril <jason@redhat.com>
1140 * call.c (build_operator_new_call): Set CALL_FROM_NEW_OR_DELETE_P.
1141 (build_op_delete_call): Likewise.
1142 * init.c (build_new_1, build_vec_delete_1, build_delete): Not here.
1145 2020-10-02 Jason Merril <jason@redhat.com>
1147 * lambda.c (call_from_lambda_thunk_p): New.
1148 * cp-gimplify.c (cp_genericize_r): Use it.
1149 * pt.c (tsubst_copy_and_build): Use it.
1150 * typeck.c (check_return_expr): Use it.
1151 * cp-tree.h: Declare it.
1152 (CALL_FROM_NEW_OR_DELETE_P): Move to gcc/tree.h.
1154 2020-10-01 Nathan Sidwell <nathan@acm.org>
1156 * cp-tree.h (DECL_ANTICIPATED): Adjust comment.
1157 (DECL_HIDDEN_P, TYPE_HIDDEN_P): Delete.
1158 * tree.c (ovl_insert): Delete DECL_HIDDEN_P assert.
1159 (ovl_skip_hidden): Likewise.
1161 2020-10-01 Nathan Sidwell <nathan@acm.org>
1163 * name-lookup.c (pushdecl_top_level): Assert incoming context is
1164 null, add global_namespace context.
1165 (pushdecl_top_level_and_finish): Likewise.
1166 * pt.c (get_template_parm_object): Clear decl context before
1168 * semantics.c (finish_compound_literal): Likewise.
1170 2020-10-01 Nathan Sidwell <nathan@acm.org>
1172 * decl.c (lookup_and_check_tag): Refactor.
1174 2020-10-01 Jakub Jelinek <jakub@redhat.com>
1177 * call.c (build_over_call): If obj_arg is non-NULL, return INIT_EXPR
1178 setting obj_arg to call.
1180 2020-10-01 Jakub Jelinek <jakub@redhat.com>
1183 * constexpr.c (cxx_eval_call_expression): Don't VERIFY_CONSTANT the
1186 2020-10-01 Marek Polacek <polacek@redhat.com>
1189 * pt.c (do_class_deduction): Don't prune explicit deduction guides
1190 in copy-list-initialization. In copy-list-initialization, if an
1191 explicit deduction guide was selected, give an error.
1193 2020-09-30 Nathan Sidwell <nathan@acm.org>
1195 * cp-tree.h (struct lang_decl_fn): Remove hidden_friend_p.
1196 (DECL_HIDDEN_FRIEND_P): Delete.
1197 * call.c (add_function_candidate): Drop assert about anticipated
1199 (build_new_op_1): Drop koenig lookup flagging for hidden friend.
1200 * decl.c (duplicate_decls): Drop HIDDEN_FRIEND_P updating.
1201 * name-lookup.c (do_pushdecl): Likewise.
1202 (set_decl_namespace): Discover hiddenness from OVL_HIDDEN_P.
1203 * pt.c (check_explicit_specialization): Record found_hidden
1206 2020-09-29 Marek Polacek <polacek@redhat.com>
1209 * call.c (ref_conv_binds_directly_p): New function.
1210 * cp-tree.h (ref_conv_binds_directly_p): Declare.
1211 * parser.c (warn_for_range_copy): New function.
1212 (cp_convert_range_for): Call it.
1214 2020-09-29 Nathan Sidwell <nathan@acm.org>
1216 * cp-tree.h (ovl_insert): Change final parm to hidden-or-using
1218 * name-lookup.h (HIDDEN_TYPE_BINDING_P): New.
1219 (struct cxx_binding): Add type_is_hidden flag.
1220 * tree.c (ovl_insert): Change using_p parm to using_or_hidden,
1222 (ovl_skip_hidden): Assert we never see a naked hidden decl.
1223 * decl.c (xref_tag_1): Delete unhiding friend from here (moved to
1224 lookup_elaborated_type_1).
1225 * name-lookup.c (STAT_TYPE_HIDDEN_P, STAT_DECL_HIDDEN_P): New.
1226 (name_lookup::search_namespace_only): Check new hidden markers.
1227 (cxx_binding_make): Clear HIDDEN_TYPE_BINDING_P.
1228 (update_binding): Update new hidden markers.
1229 (lookup_name_1): Check HIDDEN_TYPE_BINDING_P and simplify friend
1231 (lookup_elaborated_type_1): Use new hidden markers. Reveal the
1234 2020-09-29 Nathan Sidwell <nathan@acm.org>
1236 * name-lookup.c (create_local_binding): Do not clear
1237 INHERITED_VALUE_BINDING_P here.
1238 (name_lookup::process_binding): Move done hidden-decl triage to ...
1239 (name_lookup::search_namespace_only): ... here, its only caller.
1240 (cxx_binding_make): Clear flags here.
1241 (push_binding): Not here.
1242 (pop_local_binding): RAII.
1243 (update_binding): Refactor.
1244 (do_pushdecl): Assert we're never revealing a local binding.
1245 (do_pushdecl_with_scope): Directly call do_pushdecl.
1246 (get_class_binding): Do not clear LOCAL_BINDING_P here.
1247 * pt.c (push_template_decl): Set friend & anticipated before
1250 2020-09-29 Nathan Sidwell <nathan@acm.org>
1252 * name-lookup.c (update_binding): We never meet two implicit
1254 (do_pushdecl): Adjust set_identifier_type_value_with_scope calls.
1255 (set_identifier_type_value_with_scope): Do not update binding in
1256 the namespace-case. Assert it is already there.
1258 2020-09-25 Nathan Sidwell <nathan@acm.org>
1260 * cp-tree.h (duplicate_decls): Replace 'is_friend' with 'hiding'
1261 and add 'was_hidden'.
1262 * name-lookup.h (pushdecl_namespace_level): Replace 'is_friend'
1264 (pushdecl): Likewise.
1265 (pushdecl_top_level): Drop is_friend parm.
1266 * decl.c (check_no_redeclaration_friend_default_args): Rename parm
1268 (duplicate_decls): Replace 'is_friend' with 'hiding'
1269 and 'was_hidden'. Do minimal adjustments in body.
1270 (cxx_builtin_function): Pass 'hiding' to pushdecl.
1271 * friend.c (do_friend): Pass 'hiding' to pushdecl.
1272 * name-lookup.c (supplement_binding_1): Drop defaulted arg to
1274 (update_binding): Replace 'is_friend' with 'hiding'. Drop
1275 defaulted arg to duplicate_decls.
1276 (do_pushdecl): Replace 'is_friend' with 'hiding'. Assert no
1277 surprise hidhing. Adjust duplicate_decls calls to inform of old
1279 (pushdecl): Replace 'is_friend' with 'hiding'.
1280 (set_identifier_type_value_with_scope): Adjust update_binding
1282 (do_pushdecl_with_scope): Replace 'is_friend' with 'hiding'.
1283 (pushdecl_outermost_localscope): Drop default arg to
1284 do_pushdecl_with_scope.
1285 (pushdecl_namespace_level): Replace 'is_friend' with 'hiding'.
1286 (pushdecl_top_level): Drop is_friend parm.
1287 * pt.c (register_specialization): Comment duplicate_decls call
1289 (push_template_decl): Commont pushdecl_namespace_level.
1290 (tsubst_friend_function, tsubst_friend_class): Likewise.
1292 2020-09-25 Nathan Sidwell <nathan@acm.org>
1294 * name-lookup.h (enum tag_scope): Replace with ...
1295 (enum class TAG_how): ... this. Add HIDDEN_FRIEND value.
1296 (lookup_type_scope): Replace with ...
1297 (lookup_elaborated_type): ... this.
1298 (pushtag): Use TAG_how, not tag_scope.
1299 * cp-tree.h (xref_tag): Parameter is TAG_how, not tag_scope.
1300 * decl.c (lookup_and_check_tag): Likewise. Adjust.
1301 (xref_tag_1, xref_tag): Likewise. adjust.
1302 (start_enum): Adjust lookup_and_check_tag call.
1303 * name-lookup.c (lookup_type_scope_1): Rename to ...
1304 (lookup_elaborated_type_1) ... here. Use TAG_how, not tag_scope.
1305 (lookup_type_scope): Rename to ...
1306 (lookup_elaborated_type): ... here. Use TAG_how, not tag_scope.
1307 (do_pushtag): Use TAG_how, not tag_scope. Adjust.
1308 (pushtag): Likewise.
1309 * parser.c (cp_parser_elaborated_type_specifier): Adjust.
1310 (cp_parser_class_head): Likewise.
1312 2020-09-25 Nathan Sidwell <nathan@acm.org>
1314 * cp-tree.h (DECL_BUILTIN_P): New.
1315 * decl.c (duplicate_decls): Use it. Do not treat omp-udr as a
1317 * name-lookup.c (anticipated_builtin): Use it.
1318 (set_decl_context_in_fn): Function-scope OMP UDRs have function context.
1319 (do_nonmember_using_decl): Use DECL_BUILTIN_P.
1320 * parser.c (cp_parser_omp_declare_reduction): Function-scope OMP
1321 UDRs have function context. Assert we never find a valid duplicate.
1322 * pt.c (tsubst_expr): Function-scope OMP UDRs have function context.
1324 2020-09-24 Nathan Sidwell <nathan@acm.org>
1326 * cp-tree.h (duplicate_decls): Default is_friend to false.
1327 (xref_tag): Default tag_scope & tpl_header_p to ts_current & false.
1328 (push_template_decl_real): Default is_friend to false. Rename to
1330 (push_template_decl): ... here. Delete original decl.
1331 * name-lookup.h (pushdecl_namespace_level): Default is_friend to
1333 (pushtag): Default tag_scope to ts_current.
1334 * coroutines.cc (morph_fn_to_coro): Drop default args to xref_tag.
1335 * decl.c (start_decl): Drop default args to duplicate_decls.
1336 (start_enum): Drop default arg to pushtag & xref_tag.
1337 (start_preparsed_function): Pass DECL_FRIEND_P to
1339 (grokmethod): Likewise.
1340 * friend.c (do_friend): Rename push_template_decl_real calls.
1341 * lambda.c (begin_lamnbda_type): Drop default args to xref_tag.
1342 (vla_capture_type): Likewise.
1343 * name-lookup.c (maybe_process_template_type_declaration): Rename
1344 push_template_decl_real call.
1345 (pushdecl_top_level_and_finish): Drop default arg to
1346 pushdecl_namespace_level.
1347 * pt.c (push_template_decl_real): Assert no surprising friend
1348 functions. Rename to ...
1349 (push_template_decl): ... here. Delete original function.
1350 (lookup_template_class_1): Drop default args from pushtag.
1351 (instantiate_class_template_1): Likewise.
1352 * ptree.c (debug_overload): Print hidden and using markers.
1353 * rtti.c (init_rtti_processing): Drop refault args from xref_tag.
1354 (build_dynamic_cast_1, tinfo_base_init): Likewise.
1355 * semantics.c (begin_class_definition): Drop default args to
1358 2020-09-24 Nathan Sidwell <nathan@acm.org>
1361 * pt.c (maybe_instantiate_noexcept): Local externs are never
1364 2020-09-23 Nathan Sidwell <nathan@acm.org>
1366 * name-lookup.h (typedef cxx_binding): Delete tdef.
1367 (typedef cp_binding_level): Likewise.
1368 (struct cxx_binding): Flags are bools.
1370 2020-09-23 Nathan Sidwell <nathan@acm.org>
1373 * pt.c (tsubst_copy) [FUNCTION_DECL,VAR_DECL]: Retrieve local
1374 specialization for DECL_LOCAL_P decls.
1376 2020-09-22 Patrick Palka <ppalka@redhat.com>
1379 * pt.c (corresponding_template_parameter): Define.
1380 (keep_template_parm): Use it to adjust the given template
1381 parameter to the corresponding in-scope one from ctx_parms.
1383 2020-09-22 Nathan Sidwell <nathan@acm.org>
1385 * cp-tree.h (xref_tag_from_type): Don't declare.
1386 * decl.c (xref_tag_from_type): Delete.
1387 * pt.c (lookup_template_class_1): Erroneously located class
1388 definitions just give error_mark, don't try and inject it into the
1391 2020-09-22 Jakub Jelinek <jakub@redhat.com>
1394 * constexpr.c (cxx_eval_builtin_function_call): Return void_node for
1395 calls to __sanitize_ptr_{sub,cmp} builtins.
1397 2020-09-22 Nathan Sidwell <nathan@acm.org>
1399 * pt.c (instantiate_class_template_1): Do not repush and unhide
1402 2020-09-21 Marek Polacek <polacek@redhat.com>
1406 * lambda.c (maybe_add_lambda_conv_op): Mark the conversion function
1409 2020-09-21 Marek Polacek <polacek@redhat.com>
1411 * pt.c (deduction_guides_for): Add a bool parameter. Set it.
1412 (do_class_deduction): Warn when CTAD succeeds but the type doesn't
1413 have any explicit deduction guides.
1415 2020-09-21 Nathan Sidwell <nathan@acm.org>
1417 * decl.c (xref_tag_1): Use IDENTIFIER_LAMBDA_P to detect lambdas.
1418 * lambda.c (begin_lambda_type): Use ts_current to push the tag.
1419 * name-lookup.h (enum tag_scope): Drop ts_lambda.
1421 2020-09-21 Marek Polacek <polacek@redhat.com>
1424 * decl.c (redeclaration_error_message): Detect a redeclaration of
1427 2020-09-19 Sandra Loosemore <sandra@codesourcery.com>
1429 * cp-gimplify.c (enum bc_t, bc_label): Move to c-family.
1430 (begin_bc_block, finish_bc_block, get_bc_label): Likewise.
1431 (genericize_cp_loop): Likewise.
1432 (genericize_for_stmt, genericize_while_stmt): Likewise.
1433 (genericize_do_stmt, genericize_switch_stmt): Likewise.
1434 (genericize_continue_stmt, genericize_break_stmt): Likewise.
1435 (genericize_omp_for_stmt): Likewise.
1436 (cp_genericize_r): Call c_genericize_control_stmt instead of
1437 above functions directly.
1438 (cp_genericize): Call save_bc_state and restore_bc_state instead
1439 of manipulating bc_label directly.
1440 * cp-objcp-common.c (cxx_block_may_fallthru): Defer to
1441 c_block_may_fallthru instead of handling SWITCH_STMT here.
1442 (cp_common_init_ts): Move handling of loop and switch-related
1443 statements to c-family.
1444 * cp-tree.def (FOR_STMT, WHILE_STMT, DO_STMT): Move to c-family.
1445 (BREAK_STMT, CONTINUE_STMT, SWITCH_STMT): Likewise.
1446 * cp-tree.h (LABEL_DECL_BREAK, LABEL_DECL_CONTINUE): Likewise.
1447 (WHILE_COND, WHILE_BODY): Likewise.
1448 (DO_COND, DO_BODY): Likewise.
1449 (FOR_INIT_STMT, FOR_COND, FOR_EXPR, FOR_BODY, FOR_SCOPE): Likewise.
1450 (SWITCH_STMT_COND, SWITCH_STMT_BODY): Likewise.
1451 (SWITCH_STMT_TYPE, SWITCH_STMT_SCOPE): Likewise.
1452 (SWITCH_STMT_ALL_CASES_P, SWITCH_STMT_NO_BREAK_P): Likewise.
1453 * cxx-pretty-print.c (cxx_pretty_printer::statement): Move code
1454 to handle structured loop and switch tree nodes to c-family.
1455 * dump.c (cp_dump_tree): Likewise.
1457 2020-09-19 Patrick Palka <ppalka@redhat.com>
1461 * constraint.cc (map_arguments): Call template_parm_to_arg
1462 in the self-mapping case.
1463 (finish_shorthand_constraint): No need to build a TREE_LIST
1464 before calling template_parm_to_arg.
1465 * pt.c (template_parm_to_arg): Rewrite to handle TEMPLATE_PARM_P
1466 nodes as well as DECL_TEMPLATE_PARM_P nodes, and to make the
1467 overlying TREE_LIST node optional.
1468 (keep_template_parm): Don't record a BOUND_TEMPLATE_TEMPLATE_PARM,
1469 instead record its corresponding TEMPLATE_TEMPLATE_PARM.
1470 (convert_generic_types_to_packs): Don't call
1471 template_parm_to_arg.
1473 2020-09-19 Patrick Palka <ppalka@redhat.com>
1476 * constraint.cc (satisfy_atom): Pass true as the
1477 manifestly_const_eval argument to maybe_constant_value.
1479 2020-09-18 Jason Merrill <jason@redhat.com>
1482 * decl.c (complete_vars): Only call layout_var_decl if completing
1485 2020-09-18 Jason Merrill <jason@redhat.com>
1487 * decl.c (complete_vars): Call layout_var_decl.
1489 2020-09-17 Patrick Palka <ppalka@redhat.com>
1493 * constraint.cc (tsubst_requires_expr): Use REQUIRES_EXPR_PARMS
1494 and REQUIRES_EXPR_REQS. Use REQUIRES_EXPR_EXTRA_ARGS,
1495 add_extra_args and build_extra_args to defer substitution until
1496 we have all the template arguments.
1497 (finish_requires_expr): Adjust the call to build_min so that
1498 REQUIRES_EXPR_EXTRA_ARGS gets set to NULL_TREE.
1499 * cp-tree.def (REQUIRES_EXPR): Give it a third operand.
1500 * cp-tree.h (REQUIRES_EXPR_PARMS, REQUIRES_EXPR_REQS,
1501 REQUIRES_EXPR_EXTRA_ARGS): Define.
1502 (add_extra_args, build_extra_args): Declare.
1504 2020-09-16 Nathan Sidwell <nathan@acm.org>
1506 * cp-tree.h (cp_check_omp_declare_reduction): Return bool.
1507 * semantics.c (cp_check_omp_declare_reduction): Return true on for
1509 * pt.c (push_template_decl_real): OMP reductions do not get a
1511 (tsubst_function_decl): Remove special casing for local decl omp
1513 (tsubst_expr): Call instantiate_body for a local omp reduction.
1514 (instantiate_body): Add nested_p parm, and deal with such
1516 (instantiate_decl): Reject FUNCTION_SCOPE entities, adjust
1517 instantiate_body call.
1519 2020-09-16 Nathan Sidwell <nathan@acm.org>
1521 * pt.c (instantiate_body): Remove 'nested' var, simplify
1524 2020-09-16 Nathan Sidwell <nathan@acm.org>
1526 * pt.c (instantiate_body): New, broken out of ..
1527 (instantiate_decl): ... here. Call it.
1529 2020-09-15 Nathan Sidwell <nathan@acm.org>
1531 * pt.c (push_template_decl_real): OMP reductions retain a template
1533 (tsubst_function_decl): Likewise.
1535 2020-09-15 Tobias Burnus <tobias@codesourcery.com>
1538 * cp-gimplify.c (cxx_omp_finish_clause): Add bool openacc arg.
1539 * cp-tree.h (cxx_omp_finish_clause): Likewise
1540 * semantics.c (handle_omp_for_class_iterator): Update call.
1542 2020-09-14 Marek Polacek <polacek@redhat.com>
1544 * pt.c (push_template_decl_real): Use VAR_OR_FUNCTION_DECL_P.
1546 2020-09-14 Nathan Sidwell <nathan@acm.org>
1548 * pt.c (push_template_decl_real): Don't attach a template head to
1550 (tsubst_function_decl): Add support for headless local extern
1552 (tsubst_decl): Add support for headless local extern decls.
1554 2020-09-11 Nathan Sidwell <nathan@acm.org>
1556 * decl.c (grokfndecl): Don't attach to local extern.
1558 2020-09-11 Nathan Sidwell <nathan@acm.org>
1560 * parser.c (cp_parser_objc_method_definition_list): Reimplement
1561 loop, make sure we pop scope.
1563 2020-09-11 Marek Polacek <polacek@redhat.com>
1565 * cp-tree.h (LOOKUP_CONSTINIT): Remove.
1566 (LOOKUP_REWRITTEN): Adjust.
1567 * decl.c (duplicate_decls): Set DECL_DECLARED_CONSTINIT_P.
1568 (check_initializer): Use DECL_DECLARED_CONSTINIT_P instead of
1570 (cp_finish_decl): Don't set DECL_DECLARED_CONSTINIT_P. Use
1571 DECL_DECLARED_CONSTINIT_P instead of LOOKUP_CONSTINIT.
1572 (grokdeclarator): Set DECL_DECLARED_CONSTINIT_P.
1573 * decl2.c (grokfield): Don't handle LOOKUP_CONSTINIT.
1574 * parser.c (cp_parser_decomposition_declaration): Remove
1575 LOOKUP_CONSTINIT handling.
1576 (cp_parser_init_declarator): Likewise.
1577 * pt.c (tsubst_expr): Likewise.
1578 (instantiate_decl): Likewise.
1579 * typeck2.c (store_init_value): Use DECL_DECLARED_CONSTINIT_P instead
1580 of LOOKUP_CONSTINIT.
1582 2020-09-10 Nathan Sidwell <nathan@acm.org>
1584 * cp-tree.h (TINFO_VAR_DECLARED_CONSTINIT): Replace with ...
1585 (DECL_DECLARED_CONSTINIT_P): ... this.
1586 * decl.c (start_decl): No need to retrofit_lang_decl for constinit
1588 (cp_finish_decl): Use DECL_DECLARED_CONSTINIT_P.
1589 * pt.c (tsubst_decl): No need to handle constinit flag
1591 (tsubst_expr): Or here.
1593 2020-09-10 Nathan Sidwell <nathan@acm.org>
1595 * cp-tree.h (DECL_LOCAL_FUNCTION_P): Rename to ...
1596 (DECL_LOCAL_DECL_P): ... here. Accept both fns and vars.
1597 * decl.c (start_decl): Set DECL_LOCAL_DECL_P for local externs.
1598 (omp_declare_variant_finalize_one): Use DECL_LOCAL_DECL_P.
1599 (local_variable_p): Simplify.
1600 * name-lookup.c (set_decl_context_in_fn): Assert DECL_LOCAL_DECL_P
1601 is as expected. Simplify.
1602 (do_pushdecl): Don't set decl_context_in_fn for friends.
1603 (is_local_extern): Simplify.
1604 * call.c (equal_functions): Use DECL_LOCAL_DECL_P.
1605 * parser.c (cp_parser_postfix_expression): Likewise.
1606 (cp_parser_omp_declare_reduction): Likewise.
1607 * pt.c (check_default_tmpl_args): Likewise.
1608 (tsubst_expr): Assert nested reduction function is local.
1609 (type_dependent_expression_p): Use DECL_LOCAL_DECL_P.
1610 * semantics.c (finish_call_expr): Likewise.
1612 2020-09-09 Marek Polacek <polacek@redhat.com>
1615 * decl.c (reshape_init): If we're initializing a char array from
1616 a string-literal that is enclosed in braces, unwrap it.
1617 * init.c (build_new_1): Don't handle string-initializers here.
1618 (build_new): Handle new-expression with paren-init when the
1619 array bound is known. Always pass string constants to build_new_1
1620 enclosed in braces. Don't handle string-initializers in any
1623 2020-09-09 Marek Polacek <polacek@redhat.com>
1626 * decl.c (reshape_init_r): When initializing an aggregate member
1627 with an initializer from an initializer-list, also consider
1630 2020-09-09 Nathan Sidwell <nathan@acm.org>
1632 * parser.c (cp_parser_omp_declare_reduction): Refactor to avoid
1633 code duplication. Update DECL_TI_TEMPLATE's context.
1634 * pt.c (tsubst_expr): For OMP reduction function, set context to
1635 global_namespace before pushing.
1636 (tsubst_omp_udr): Assert current_function_decl, add comment about
1639 2020-09-09 Patrick Palka <ppalka@redhat.com>
1642 * class.c (resolve_address_of_overloaded_function): Check
1643 constraints_satisfied_p and perform return-type deduction via
1644 maybe_instantiate_decl when considering non-template functions
1645 in the overload set.
1646 * cp-tree.h (maybe_instantiate_decl): Declare.
1647 * decl2.c (maybe_instantiate_decl): Remove static.
1649 2020-09-04 Jason Merrill <jason@redhat.com>
1651 * expr.c (mark_use): Use iloc_sentinel.
1653 2020-09-03 Jakub Jelinek <jakub@redhat.com>
1656 * constexpr.c (fundef_copies_table): Change type from
1657 hash_map<tree, tree> * to decl_tree_map *.
1659 2020-09-03 Marek Polacek <polacek@redhat.com>
1662 * cp-tree.h (do_aggregate_paren_init): Declare.
1663 * decl.c (do_aggregate_paren_init): New.
1664 (grok_reference_init): Use it.
1665 (check_initializer): Likewise.
1666 * init.c (perform_member_init): Handle initializing an array from
1667 a ()-list. Use do_aggregate_paren_init.
1669 2020-09-03 Jakub Jelinek <jakub@redhat.com>
1672 * constexpr.c (cxx_eval_outermost_constant_expr): Temporarily disable
1673 flag_rounding_math during manifestly constant evaluation.
1675 2020-09-01 Marek Polacek <polacek@redhat.com>
1678 * init.c (build_new_1): Call reshape_init.
1680 2020-09-01 Jakub Jelinek <jakub@redhat.com>
1683 * semantics.c (handle_omp_array_sections_1): Test
1684 DECL_ARRAY_PARAMETER_P only on PARM_DECLs.
1686 2020-08-31 Marek Polacek <polacek@redhat.com>
1687 Jason Merrill <jason@redhat.com>
1690 * call.c (build_new_method_call_1): Use build_constructor_from_vec
1691 instead of build_tree_list_vec + build_constructor_from_list.
1692 * init.c (build_new_1): Handle new char[]{"foo"}. Use
1693 build_constructor_from_vec instead of build_tree_list_vec +
1694 build_constructor_from_list.
1695 (build_new): Deduce the array size in new-expression if not
1696 present. Handle ()-init. Handle initializing an array from
1698 * parser.c (cp_parser_new_type_id): Leave [] alone.
1699 (cp_parser_direct_new_declarator): Allow [].
1700 * pt.c (type_dependent_expression_p): In a NEW_EXPR, consider
1701 array types whose dimension has to be deduced type-dependent.
1703 2020-08-27 Martin Liska <mliska@suse.cz>
1705 * class.c (build_vtbl_initializer): Set exact argument of a vector
1706 growth function to true.
1707 * constraint.cc (get_mapped_args): Likewise.
1708 * decl.c (cp_maybe_mangle_decomp): Likewise.
1709 (cp_finish_decomp): Likewise.
1710 * parser.c (cp_parser_omp_for_loop): Likewise.
1711 * pt.c (canonical_type_parameter): Likewise.
1712 * rtti.c (get_pseudo_ti_init): Likewise.
1714 2020-08-26 Nathan Sidwell <nathan@acm.org>
1716 * decl.c (poplevel): A local-binding tree list holds the name in
1718 * name-lookup.c (update_local_overload): Add id to TREE_PURPOSE.
1719 (lookup_name_1): Deal with local-binding error_mark_node marker.
1720 (op_unqualified_lookup): Return error_mark_node for 'nothing
1721 found'. Retain global binding, check class binding here.
1722 (maybe_save_operator_binding): Reimplement to always cache a
1724 (push_operator_bindings): Deal with 'ignore' marker.
1726 2020-08-25 Tobias Burnus <tobias@codesourcery.com>
1729 * semantics.c (handle_omp_array_sections_1): Talk about
1730 array function parameter in the error message.
1732 2020-08-25 Jakub Jelinek <jakub@redhat.com>
1735 * cp-tree.h (build_trivial_dtor_call): Add bool argument defaulted
1737 * call.c (build_trivial_dtor_call): Add NO_PTR_DEREF argument. If
1738 instance is a pointer and NO_PTR_DEREF is true, clobber the pointer
1739 rather than what it points to.
1740 * semantics.c (finish_call_expr): Call build_trivial_dtor_call with
1741 true as NO_PTR_DEREF.
1743 2020-08-25 Jason Merrill <jason@redhat.com>
1746 * optimize.c (populate_clone_array): Revert PR70462 change.
1747 (maybe_clone_body): Likewise.
1749 2020-08-24 Nathan Sidwell <nathan@acm.org>
1751 * ptree.c (debug_overload): New.
1753 2020-08-19 Jason Merrill <jason@redhat.com>
1756 * cp-tree.h (push_tinst_level, push_tinst_level_loc): Declare.
1757 * constraint.cc (satisfy_declaration_constraints):
1758 Use add_outermost_template_args and push_tinst_level.
1759 * pt.c (add_outermost_template_args): Handle getting
1760 a TEMPLATE_DECL as the first argument.
1761 (push_tinst_level, push_tinst_level_loc): No longer static.
1762 (fn_type_unification): Check satisfaction before non-dependent
1765 2020-08-18 Nathan Sidwell <nathan@acm.org>
1767 * cp-tree.h (SET_TYPE_TEMPLTE_INFO): Do not deal with ALIAS templates.
1768 * pt.c (lookup_template_class_1): Special-case alias template
1769 template_info setting.
1771 2020-08-18 Jason Merrill <jason@redhat.com>
1774 * pt.c (tsubst_aggr_type): Rewrite in C++17, too.
1775 (maybe_dependent_member_ref): Likewise.
1776 (build_deduction_guide): Re-substitute template parms.
1777 * cp-tree.h (struct push_nested_class_guard): New.
1778 * constraint.cc (get_normalized_constraints_from_decl): Use it.
1780 2020-08-18 Jason Merrill <jason@redhat.com>
1783 * pt.c (maybe_dependent_member_ref): New.
1784 (tsubst_copy) [CONST_DECL]: Use it.
1785 [VAR_DECL]: Likewise.
1786 (tsubst_aggr_type): Handle nested type.
1788 2020-08-18 Nathan Sidwell <nathan@acm.org>
1790 * name-lookup.c (qualify_lookup): Drop lambda checking here.
1791 Reorder namespace & type checking.
1792 (lookup_name_1): Do hidden lambda checking here.
1794 2020-08-14 Nathan Sidwell <nathan@acm.org>
1796 * name-lookup.h (lookup_name_real, lookup_name_nonclass): Rename
1798 (lookup_name): ... these new overloads.
1799 * name-lookup.c (identifier_type_value_1): Rename lookup_name_real
1801 (lookup_name_real_1): Rename to ...
1802 (lookup_name_1): ... here.
1803 (lookup_name_real): Rename to ...
1804 (lookup_name): ... here. Rename lookup_name_real_1 call.
1805 (lookup_name_nonclass): Delete.
1806 * call.c (build_operator_new_call): Rename lookup_name_real call.
1807 (add_operator_candidates): Likewise.
1808 (build_op_delete_call): Rename lookup_name_nonclass call.
1809 * parser.c (cp_parser_lookup_name): Likewise.
1810 * pt.c (tsubst_friend_class, lookup_init_capture_pack): Likewise.
1811 (tsubst_expr): Likewise.
1812 * semantics.c (capture_decltype): Likewise.
1814 2020-08-14 Nathan Sidwell <nathan@acm.org>
1816 * cp-tree.h (LOOKUP_HIDDEN): Delete.
1817 (LOOKUP_PREFER_RVALUE): Adjust initializer.
1818 * name-lookup.h (enum class LOOK_want): Add HIDDEN_FRIEND and
1819 HIDDEN_LAMBDA flags.
1820 (lookup_name_real): Drop flags parm.
1821 (lookup_qualified_name): Drop find_hidden parm.
1822 * name-lookup.c (class name_lookup): Drop hidden field, adjust
1824 (name_lookup::add_overload): Check want for hiddenness.
1825 (name_lookup::process_binding): Likewise.
1826 (name_lookup::search_unqualified): Likewise.
1827 (identifier_type_value_1): Adjust lookup_name_real call.
1828 (set_decl_namespace): Adjust name_lookup ctor.
1829 (qualify_lookup): Drop flags parm, use want for hiddenness.
1830 (lookup_qualified_name): Drop find_hidden parm.
1831 (lookup_name_real_1): Drop flags parm, adjust qualify_lookup
1833 (lookup_name_real): Drop flags parm.
1834 (lookup_name_nonclass, lookup_name): Adjust lookup_name_real
1836 (lookup_type_scope_1): Adjust qualify_lookup calls.
1837 * call.c (build_operator_new_call): Adjust lookup_name_real call.
1838 (add_operator_candidates): Likewise.
1839 * coroutines.cc (morph_fn_to_coro): Adjust lookup_qualified_name
1841 * parser.c (cp_parser_lookup_name): Adjust lookup_name_real calls.
1842 * pt.c (check_explicit_specialization): Adjust
1843 lookup_qualified_name call.
1844 (deduction_guides_for): Likewise.
1845 (tsubst_friend_class): Adjust lookup_name_real call.
1846 (lookup_init_capture_pack): Likewise.
1847 (tsubst_expr): Likewise, don't look in namespaces.
1848 * semantics.c (capture_decltype): Adjust lookup_name_real. Don't
1851 2020-08-14 Jason Merrill <jason@redhat.com>
1855 * cp-tree.h (unsafe_return_slot_p): Declare.
1856 * call.c (is_base_field_ref): Rename to unsafe_return_slot_p.
1857 (build_over_call): Check unsafe_return_slot_p.
1858 (build_special_member_call): Likewise.
1859 * init.c (expand_default_init): Likewise.
1860 * typeck2.c (split_nonconstant_init_1): Likewise.
1862 2020-08-14 Nathan Sidwell <nathan@acm.org>
1864 * cp-tree.h (LOOKUP_PREFER_TYPES, LOOKUP_PREFER_NAMESPACES)
1865 (LOOKUP_NAMESPACES_ONLY, LOOKUP_TYPES_ONLY)
1866 (LOOKUP_QUALIFIERS_ONL): Delete.
1867 (LOOKUP_HIDDEN): Adjust.
1868 * name-lookup.h (enum class LOOK_want): New.
1869 (operator|, operator&): Overloads for it.
1870 (lookup_name_real): Replace prefer_type & namespaces_only with
1872 (lookup_qualified_name): Replace prefer_type with LOOK_want.
1873 (lookup_name_prefer_type): Replace with ...
1874 (lookup_name): ... this. New overload with LOOK_want parm.
1875 * name-lookup.c (struct name_lookup): Replace flags with want and
1876 hidden fields. Adjust constructors.
1877 (name_lookyp::add_overload): Correct hidden stripping test. Update
1878 for new LOOK_want type.
1879 (name_lookup::process_binding): Likewise.
1880 (name_lookup::search_unqualified): Use hidden flag.
1881 (identifier_type_value_1): Adjust lookup_name_real call.
1882 (set_decl_namespace): Adjust name_lookup ctor.
1883 (lookup_flags): Delete.
1884 (qualify_lookup): Add LOOK_want parm, adjust.
1885 (lookup_qualified_name): Replace prefer_type parm with LOOK_want.
1886 (lookup_name_real_1): Replace prefer_type and namespaces_only with
1888 (lookup_name_real): Likewise.
1889 (lookup_name_nonclass, lookup_name): Adjust lookup_name_real call.
1890 (lookup_name_prefer_type): Rename to ...
1891 (lookup_name): ... here. New overload with LOOK_want parm.
1892 (lookup_type_scope_1): Adjust qualify_lookup calls.
1893 * call.c (build_operator_new_call)
1894 (add_operator_candidates): Adjust lookup_name_real calls.
1895 * coroutines.cc (find_coro_traits_template_decl)
1896 (find_coro_handle_template_decl, morph_fn_to_coro): Adjust
1897 lookup_qualified_name calls.
1898 * cp-objcp-common.c (identifier_global_tag): Likewise.
1899 * decl.c (get_tuple_size, get_tuple_decomp_init): Likewise.
1900 (lookup_and_check_tag): Use lookup_name overload.
1901 * parser.c (cp_parser_userdef_numeric_literal): Adjust
1902 lookup_qualified_name call.
1903 (prefer_arg_type): Drop template_mem_access parm, return LOOK_want
1905 (cp_parser_lookup_name): Adjust lookup_member, lookup_name_real
1907 * pt.c (check_explicit_specialization): Adjust lookup_qualified_name
1909 (tsubst_copy_and_build, tsubst_qualified_name): Likewise
1910 (deduction_guides_for): Likewise.
1911 (tsubst_friend_class): Adjust lookup_name_real call.
1912 (lookup_init_capture, tsubst_expr): Likewise.
1913 * rtti.c (emit_support_tinfos): Adjust lookup_qualified_name call.
1914 * semantics.c (omp_reduction_lookup): Likewise.
1915 (capture_decltype): Adjust lookup_name_real call.
1917 2020-08-13 Nathan Sidwell <nathan@acm.org>
1919 * name-lookup.h (enum class LOOK_where): New.
1920 (operator|, operator&): Overloads for it.
1921 (lookup_name_real): Replace NONCLASS & BLOCK_P parms with WHERE.
1922 * name-lookup.c (identifier_type_value_w): Adjust
1923 lookup_name_real call.
1924 (lookup_name_real_1): Replace NONCLASS and BLOCK_P parameters
1925 with WHERE bitmask. Don't search namespaces if not asked to.
1926 (lookup_name_real): Adjust lookup_name_real_1 call.
1927 (lookup_name_nonclass, lookup_name)
1928 (lookup_name_prefer_type): Likewise.
1929 * call.c (build_operator_new_call)
1930 (add_operator_candidates): Adjust lookup_name_real calls.
1931 * parser.c (cp_parser_lookup_name): Likewise.
1932 * pt.c (tsubst_friend_class, lookup_init_capture_pack)
1933 (tsubst_expr): Likewise.
1934 * semantics.c (capture_decltype): Likewise.
1936 2020-08-13 Marek Polacek <polacek@redhat.com>
1939 * typeck.c (build_static_cast_1): Implement P1975R0 by allowing
1940 static_cast to aggregate type.
1942 2020-08-10 Jakub Jelinek <jakub@redhat.com>
1945 * constexpr.c (cxx_eval_binary_expression): For SPACESHIP_EXPR, tail
1946 call cxx_eval_constant_expression after genericize_spaceship to avoid
1947 undesirable further VERIFY_CONSTANT.
1949 2020-08-10 Patrick Palka <ppalka@redhat.com>
1951 * pt.c (resolve_overloaded_unification): Drop functions with
1952 unsatisfied constraints.
1953 (resolve_nondeduced_context): Likewise.
1955 2020-08-05 Patrick Palka <ppalka@redhat.com>
1956 Jason Merrill <jason@redhat.com>
1959 * constexpr.c (cxx_eval_vec_init_1): Truncate ctx->ctor and
1960 then clear CONSTRUCTOR_NO_CLEARING on each appended element
1961 initializer if we're initializing a previously zero-initialized
1964 2020-08-04 Marek Polacek <polacek@redhat.com>
1967 * parser.c (cp_parser_elaborated_type_specifier): Allow
1968 'template' following ::.
1970 2020-08-04 Nathan Sidwell <nathan@acm.org>
1972 * parser.c (cp_parser_explicit_specialization): Refactor
1973 to avoid leak of num_template_parameter_lists value.
1975 2020-08-04 Patrick Palka <ppalka@redhat.com>
1978 * init.c (sort_mem_initializers): Preserve TREE_TYPE of the
1979 member initializer list node.
1980 (emit_mem_initializers): Set input_location when performing each
1981 member initialization.
1982 * parser.c (cp_parser_mem_initializer): Attach the source
1983 location of this initializer to a dummy EMPTY_CLASS_EXPR
1984 within the TREE_TYPE of the list node.
1985 * pt.c (tsubst_initializer_list): Preserve TREE_TYPE of the
1986 member initializer list node.
1988 2020-08-03 Marek Polacek <polacek@redhat.com>
1990 * cp-tree.h (after_nsdmi_defaulted_late_checks): Remove.
1992 2020-08-03 Marek Polacek <polacek@redhat.com>
1996 * pt.c (check_default_tmpl_args): Also consider variable
1999 2020-07-31 Jakub Jelinek <jakub@redhat.com>
2002 * decl.c (finish_function): In constexpr functions use for C++14 and
2003 later error instead of warning if no return statement is present and
2004 diagnose it regardless of warn_return_type. Move the warn_return_type
2005 diagnostics earlier in the function.
2007 2020-07-31 Martin Sebor <msebor@redhat.com>
2010 * class.c (build_base_path): Set no-warning bit on the synthesized
2011 conditional expression in static_cast.
2013 2020-07-31 Richard Biener <rguenther@suse.de>
2016 * cp-objcp-common.h (LANG_HOOKS_FINALIZE_EARLY_DEBUG):
2017 Define to c_common_finalize_early_debug.
2019 2020-07-31 Patrick Palka <ppalka@redhat.com>
2022 * constexpr.c (cxx_eval_constant_expression) <case CONST_DECL>:
2023 Pass false to decl_constant_value and decl_really_constant_value
2024 so that they don't unshare their result.
2025 * cp-tree.h (decl_constant_value): New declaration with an added
2027 (decl_really_constant_value): Add bool parameter defaulting to
2028 true to existing declaration.
2029 * init.c (constant_value_1): Add bool parameter which controls
2030 whether to unshare the initializer before returning. Call
2031 unshare_expr at most once.
2032 (scalar_constant_value): Pass true to constant_value_1's new
2034 (decl_really_constant_value): Add bool parameter and forward it
2035 to constant_value_1.
2036 (decl_constant_value): Likewise, but instead define a new
2037 overload with an added bool parameter.
2039 2020-07-30 Patrick Palka <ppalka@redhat.com>
2042 * pt.c (resolve_overloaded_unification): If the function
2043 template specialization has a placeholder return type,
2044 then instantiate it before attempting unification.
2046 2020-07-30 Patrick Palka <ppalka@redhat.com>
2049 * pt.c (alias_ctad_tweaks): Call remove_constraints before
2050 calling set_constraints.
2052 2020-07-30 Patrick Palka <ppalka@redhat.com>
2055 * pt.c (reduce_template_parm_level): Propagate DECL_VIRTUAL_P
2056 from the original TEMPLATE_PARM_DECL to the new lowered one.
2058 2020-07-30 Patrick Palka <ppalka@redhat.com>
2061 * constraint.cc (constraints_satisfied_p): Return true if
2063 * pt.c (do_type_instantiation): Update a paragraph taken from
2064 [temp.explicit] to reflect the latest specification. Don't
2065 instantiate a member with unsatisfied constraints.
2067 2020-07-29 Jason Merrill <jason@redhat.com>
2070 * cp-tree.h (IMPLICIT_RVALUE_P): New.
2071 (enum cp_lvalue_kind_flags): Add clk_implicit_rval.
2072 (implicit_rvalue_p, set_implicit_rvalue_p): New.
2073 * call.c (reference_binding): Check clk_implicit_rval.
2074 (build_over_call): Adjust C++20 implicit move.
2075 * coroutines.cc (finish_co_return_stmt): Simplify implicit move.
2076 * except.c (build_throw): Adjust C++20 implicit move.
2077 * pt.c (tsubst_copy_and_build) [STATIC_CAST_EXPR]: Propagate
2079 * tree.c (lvalue_kind): Set clk_implicit_rval.
2080 * typeck.c (treat_lvalue_as_rvalue_p): Overhaul.
2081 (maybe_warn_pessimizing_move): Adjust.
2082 (check_return_expr): Adjust C++20 implicit move.
2084 2020-07-29 Jason Merrill <jason@redhat.com>
2087 * call.c (build_over_call): Don't call a const ref
2088 overload for implicit move.
2090 2020-07-28 Nathan Sidwell <nathan@acm.org>
2092 * cp-gimplify.c (cp_genericize_r): Set IMPORTED_DECL's context.
2093 * cp-objcp-common.c (cp_pushdecl): Set decl's context.
2094 * decl.c (grokfndecl): Make DECL_CONTEXT setting clearer.
2096 2020-07-28 Nathan Sidwell <nathan@acm.org>
2098 * class.c (fixup_type_variants): Copy TYPE_SIZE and
2100 (finish_struct): Call it.
2102 2020-07-28 Nathan Sidwell <nathan@acm.org>
2104 * ptree.c (cxx_print_decl): Better indentation.
2106 2020-07-28 Jakub Jelinek <jakub@redhat.com>
2107 Mark Wielaard <mark@klomp.org>
2110 * parser.c (cp_lexer_safe_previous_token): Don't call
2111 cp_lexer_previous_token, instead inline it by hand and return NULL
2112 instead of failing assertion if all previous tokens until the first
2114 (cp_parser_error_1): Optimize - only call cp_lexer_safe_previous_token
2115 if token->type is CPP_NAME. Use cp_lexer_safe_previous_token instead
2116 of cp_lexer_previous_token for the missing_token_desc != RT_NONE
2119 2020-07-27 Nathan Sidwell <nathan@acm.org>
2121 * cp-tree.h (enum cp_tree_index): Add CPTI_AS_BASE_IDENTIFIER.
2122 (as_base_identifier): Define.
2123 * decl.c (initialize_predifined_identifiers): Initialize as_base
2125 * class.c (layout_class_type): Name the as-base type. Zap
2126 NSDMI its fields may have.
2128 2020-07-22 Nathan Sidwell <nathan@acm.org>
2130 * class.c (maybe_add_class_template_decl_list): Don't add CONST_DECLs.
2132 2020-07-22 Nathan Sidwell <nathan@acm.org>
2134 * typeck.c (structural_comptypes): [DECLTYPE_TYPE] break
2136 [UNDERLYING_TYPE]: Use an if.
2139 2020-07-22 Nathan Sidwell <nathan@acm.org>
2141 * decl.c (decls_match): Move variables into scopes
2143 (duplicate_decls): Use STRIP_TEMPLATE.
2144 (build_typename_type): Move var decls to their assignments.
2145 (begin_function_body): Likewise.
2146 * decl2.c (get_guard): Likewise.
2147 (mark_used): Use true for truthiness.
2148 * error.c (dump_aggr_type): Hold the decl in a var called
2151 2020-07-22 Nathan Sidwell <nathan@acm.org>
2153 * cp-tree.h (struct tree_lambda_expr): Shrink
2154 default_capture_mode & discriminator.
2156 2020-07-22 Nathan Sidwell <nathan@acm.org>
2158 * mangle.c (decl_is_template_id): Rename to ...
2159 (maybe_template_info): ... here. Return the template info,
2160 rather than use a pointer. Adjust all callers.
2161 (find_substitution): Use template_args_equal, rather than
2164 2020-07-22 Tobias Burnus <tobias@codesourcery.com>
2166 * parser.c (cp_parser_omp_clause_hint): Require nonnegative hint.
2167 (cp_parser_omp_critical): Permit hint(0) clause without named critical.
2168 * pt.c (tsubst_expr): Re-check the latter for templates.
2170 2020-07-21 Sunil K Pandey <skpgkp2@gmail.com>
2173 * decl.c (cp_finish_decl): Call target hook
2174 lower_local_decl_alignment to lower local decl alignment.
2176 2020-07-21 Nathan Sidwell <nathan@acm.org>
2178 * parser.c (cp_lexer_consume_token): Drop PRAGMA_EOL assert.
2179 (cp_parser_skip_to_closing_parenthesis_1): Only pass start token
2180 to pragma skipper if recovering.
2181 (cp_parser_skip_to_pragma_eol): Only purge and change pragma
2182 state when recovering.
2184 2020-07-20 Jason Merrill <jason@redhat.com>
2186 * pt.c (type_dependent_expression_p): A pseudo-dtor can be
2188 * semantics.c (finish_call_expr): Use build_trivial_dtor_call for
2190 (finish_pseudo_destructor_expr): Leave type NULL for dependent arg.
2192 2020-07-20 Jason Merrill <jason@redhat.com>
2194 * mangle.c (write_base_ref): New.
2195 (write_expression): Use it for base field COMPONENT_REFs.
2196 * pt.c (invalid_tparm_referent_p): Canonicalize the type
2197 of array offsets. Allow subobjects.
2199 2020-07-20 Jason Merrill <jason@redhat.com>
2201 * pt.c (collect_ctor_idx_types): Add 'const' when deducing from
2204 2020-07-17 Marek Polacek <polacek@redhat.com>
2207 * decl.c (grokdeclarator): Detect cv-qual decltype(auto).
2208 * pt.c (do_auto_deduction): Likewise.
2210 2020-07-16 Iain Sandoe <iain@sandoe.co.uk>
2217 * coroutines.cc (struct coro_ret_data): Delete.
2218 (coro_maybe_expand_co_return): Delete.
2219 (co_return_expander): Delete.
2220 (expand_co_returns): Delete.
2221 (co_await_find_in_subtree): Remove unused name.
2222 (build_actor_fn): Remove unused parm, remove handling
2223 for co_return expansion.
2224 (register_await_info): Demote duplicate info message to a
2226 (coro_make_frame_entry): Move closer to use site.
2227 (struct susp_frame_data): Add fields for final suspend label
2228 and a flag to indicate await expressions with initializers.
2229 (captures_temporary): Delete.
2230 (register_awaits): Remove unused code, update comments.
2231 (find_any_await): New.
2232 (tmp_target_expr_p): New.
2233 (struct interesting): New.
2234 (find_interesting_subtree): New.
2235 (struct var_nest_node): New.
2236 (flatten_await_stmt): New.
2237 (handle_nested_conditionals): New.
2238 (process_conditional): New.
2239 (replace_statement_captures): Rename to...
2240 (maybe_promote_temps): ... this.
2241 (maybe_promote_captured_temps): Delete.
2242 (analyze_expression_awaits): Check for await expressions with
2243 initializers. Simplify handling for truth-and/or-if.
2244 (expand_one_truth_if): Simplify (map cases that need expansion
2246 (await_statement_walker): Handle CO_RETURN_EXPR. Simplify the
2247 handling for truth-and/or-if expressions.
2248 (register_local_var_uses): Ensure that we create names in the
2249 implementation namespace.
2250 (morph_fn_to_coro): Add final suspend label to suspend frame
2251 callback data and remove it from the build_actor_fn call.
2253 2020-07-16 Marek Polacek <polacek@redhat.com>
2255 * call.c (convert_like): Remove macro and introduce a new
2257 (convert_like_with_context): Likewise.
2258 (convert_like_real): Rename to convert_like.
2259 (convert_like_real_1): Rename to convert_like_internal. Call
2260 convert_like instead of convert_like_real therein.
2261 (perform_direct_initialization_if_possible): Call convert_like
2262 instead of convert_like_real.
2264 2020-07-16 Iain Sandoe <iain@sandoe.co.uk>
2266 * coroutines.cc: Correct some spelling errors
2269 2020-07-15 Nathan Sidwell <nathan@acm.org>
2271 * parser.c (cp_parser_declaration): Avoid copying tokens.
2272 (cp_parser_block_declaration): RAII token pointer.
2274 2020-07-15 Nathan Sidwell <nathan@acm.org>
2276 * parser.c (cp_parser_skip_to_closing_parenthesis_1): Deal with
2277 meeting a deferred pragma.
2278 (cp_parser_skip_to_end_of_statement): Likewise.
2279 (cp_parser_skip_to_end_of_block_or_statement): Likewise.
2280 (cp_parser_skip_to_pragma_eol): We should never meet EOF.
2281 (cp_parser_omp_declare_simd): Likewise.
2282 (cp_parser_omp_declare_reduction, cp_parser_oacc_routine)
2283 (pragma_lex): Likewise.
2285 2020-07-14 Marek Polacek <polacek@redhat.com>
2290 * call.c (convert_like_real_1): Renamed from convert_like_real.
2291 (convert_like_real): New wrapper for convert_like_real_1.
2293 2020-07-14 Nathan Sidwell <nathan@acm.org>
2295 * parser.c (cp_lexer_alloc): Do not deal with PCH here.
2296 (cp_lexer_new_main): Deal with PCH here. Store the tokens directly
2298 (cp_lexer_new_from_tokens): Assert last token isn't purged either.
2299 (cp_lexer_get_preprocessor_token): Change first arg to flags, adjust.
2300 (cp_parser_new): Pass the lexer in, don't create it here.
2301 (cp_parser_translation_unit): Initialize access checks here.
2302 (cp_parser_initial_pragma): First token is provided by caller,
2303 don't deal with PCH stopping here. Adjust error message.
2304 (c_parse_file): Adjust, change error message to avoid C++20 module
2307 2020-07-14 Nathan Sidwell <nathan@acm.org>
2309 * ptree.c (cxx_print_type): Add TYPEOF_TYPE and BASES.
2311 2020-07-14 Nathan Sidwell <nathan@acm.org>
2313 * class.c (build_base_field_1): Cache CLASSTYPE_AS_BASE.
2314 (build_self_reference): Rename value -> decl.
2315 (dump_class_hierarchy_1): Cache CLASSTYPE_AS_BASE.
2317 2020-07-14 Marek Polacek <polacek@redhat.com>
2320 * decl.c (grokdeclarator) <case cdk_function>: Check also
2321 pointers/references/... to functions.
2323 2020-07-14 Nathan Sidwell <nathan@acm.org>
2325 * cp-tree.h: Correct some tree lang flag comments,
2326 reformat some structure definitions. Note some structure
2327 sizes. Clarify some comments.
2328 (yyungetc): Delete. Not been a thing for some time.
2329 * class.c (copy_fndecl_with_name): Comment.
2330 (check_bases_and_members): Unnecessary {}.
2331 (layout_class_type): Comment.
2332 * cp-tree.def (UNBOUND_CLASS_TEMPLATE): Adjust comment.
2333 * decl.c: Fix some formatting & whitespace issues.
2334 (function_requirements_equivalent_p): Note why
2335 substitutions are needed.
2336 * decl2.c (no_linkage_error): Note that heroics about
2337 'typedef struct { ... };' are no longer needed.
2338 * method.c: Whitespace.
2339 * name-lookup.c: Whitespace.
2340 (add_decl_to_level): Reformat a line.
2341 (print_binding_stack): Mark as DEBUG_FUNCTION.
2342 (has_using_namespace_std_directive_p): Delete comment.
2344 * ptree.c: Whitespace.
2345 * rtti.c: Whitespace & comment.
2347 * typeck.c (structural_comptypes): Add comment.
2349 2020-07-13 Nathan Sidwell <nathan@acm.org>
2351 * Make-lang.in (c++.disclean): Likewise.
2353 2020-07-13 Marek Polacek <polacek@redhat.com>
2356 * parser.c (cp_parser_enum_specifier): Commit to tentative parse
2357 after we've seen an opening brace.
2359 2020-07-10 Jason Merrill <jason@redhat.com>
2361 * tree.c (structural_type_p): Allow unions.
2362 * mangle.c (write_expression): Express unions with a designator.
2364 2020-07-10 Jason Merrill <jason@redhat.com>
2366 * pt.c (convert_nontype_argument): Handle REAL_TYPE.
2367 (invalid_nontype_parm_type_p): Allow all structural types.
2368 * tree.c (structural_type_p): Use SCALAR_TYPE_P.
2370 2020-07-10 Jason Merrill <jason@redhat.com>
2375 * class.c (check_field_decls): An array of empty classes is not an
2377 (layout_empty_base_or_field): Handle explicit alignment.
2380 2020-07-09 Julian Brown <julian@codesourcery.com>
2381 Thomas Schwinge <thomas@codesourcery.com>
2384 * semantics.c (finish_omp_clauses): Likewise.
2386 2020-07-09 Patrick Palka <ppalka@redhat.com>
2389 * constexpr.c (potential_constant_expression_1) <case PARM_DECL>:
2390 Restore dependent_type_p check that guarded the call to
2391 is_really_empty_class.
2393 2020-07-08 Patrick Palka <ppalka@redhat.com>
2396 * constexpr.c (potential_constant_expression_1) <case PARM_DECL>:
2397 When processing_template_decl, check COMPLETE_TYPE_P before
2398 calling is_really_empty_class. Don't check dependent_type_p.
2400 2020-07-08 Marek Polacek <polacek@redhat.com>
2403 * parser.c (cp_parser_decltype): Print error about using decltype(auto)
2404 in C++11. Check that the token following "auto" is ")".
2406 2020-07-07 Patrick Palka <ppalka@redhat.com>
2409 * cxx-pretty-print.c (pp_cxx_unqualified_id): Check
2410 PRIMARY_TEMPLATE_P before printing the innermost template
2413 2020-07-07 Martin Sebor <msebor@redhat.com>
2416 * parser.c (class_decl_loc_t::diag_mismatched_tags): Print notes only
2417 if warning_at returns nonzero.
2419 2020-07-06 Martin Sebor <msebor@redhat.com>
2422 * call.c (build_over_call): Check calls only when tf_warning is set.
2424 2020-07-06 Nathan Sidwell <nathan@acm.org>
2426 * decl.c (push_library_fn): Return the decl pushdecl_toplevel returns.
2427 * except.c (verify_library_fn): Replace with ...
2428 (declare_library_fn_1): ... this fn. Always push the fn.
2429 (declare_library_fn): Call it.
2430 (build_throw): Call declare_library_fn_1.
2432 2020-07-06 Jonathan Wakely <jwakely@redhat.com>
2435 * parser.c (cp_parser_toplevel_declaration): Only do pedwarn for
2436 empty-declaration in C++98.
2438 2020-07-02 Jason Merrill <jason@redhat.com>
2439 Jakub Jelinek <jakub@redhat.com>
2441 * decl.c (grokfndecl): Allow consteval virtual.
2442 * search.c (check_final_overrider): Check consteval mismatch.
2443 * constexpr.c (cxx_eval_thunk_call): New.
2444 (cxx_eval_call_expression): Call it.
2445 * cvt.c (cp_get_fndecl_from_callee): Handle FDESC_EXPR.
2446 * decl2.c (mark_vtable_entries): Track vtables with consteval.
2447 (maybe_emit_vtables): Pass consteval_vtables through.
2448 (clear_consteval_vfns): Replace consteval with nullptr.
2449 (c_parse_final_cleanups): Call it.
2451 2020-07-01 Nathan Sidwell <nathan@acm.org>
2453 * class.c (copy_fndecl_with_name): Add additional predicate args, do
2454 not deduce them locally.
2455 (copy_operator_fn): Adjust copy_fndecl_with_name call.
2456 (build_clone): Add vtt and inherited predicate args. Pass through
2457 to copy_fndecl_with_name call.
2458 (build_cdtor_clones): Likewise, pass through to build_clone as
2460 (build_cdtor): Determine vtt and inherited here.
2461 * cp-tree.h (DECL_NEEDS_CTT_PARM_P): Delete.
2463 2020-06-30 Nathan Sidwell <nathan@acm.org>
2465 * cp-tree.h (copy_fndecl_with_name): Rename to ...
2466 (copy_operatorn_fn): ... this. Change arg type.
2467 (clone_function_decl): Rename to ...
2468 (clone_cdtor): ... this.
2469 * class.c (copy_fndecl_with_name): Make static.
2470 (copy_operator_fn): New wrapper.
2471 (build_clones): Rename to ...
2472 (build_cdtor_clones): ... this.
2473 (clone_function_decl): Rename to ...
2474 (clone_cdtor): ... this. Adjust build_clones calls.
2475 (clone_constructors_and_destructors): Adjust clone_function_decl
2477 * method.c (implicitly_declare_fn): Adjust copy_fndecl_with_name
2479 (lazily_declare_fn): Adjust clone_function_decl call.
2480 * pt.c (tsubst_function_decl): Likewise.
2481 (instantiate_template_1): Likewise.
2483 2020-06-30 Iain Sandoe <iain@sandoe.co.uk>
2485 * coroutines.cc (morph_fn_to_coro): Remove trailing
2486 space in a diagnostic.
2488 2020-06-30 Iain Sandoe <iain@sandoe.co.uk>
2490 * coroutines.cc (expand_one_await_expression): Remove
2491 code dealing with initial suspend.
2492 (build_actor_fn): Remove code special-casing initial
2493 and final suspend. Handle the final suspend and marking
2494 of the coroutine as done.
2495 (coro_rewrite_function_body): New.
2496 (bind_expr_find_in_subtree): Remove.
2497 (coro_body_contains_bind_expr_p): Remove.
2498 (morph_fn_to_coro): Split the rewrite of the original
2499 function into coro_rewrite_function_body and call it.
2501 2020-06-29 Marek Polacek <polacek@redhat.com>
2504 * decl.c (duplicate_decls): Make sure a concept or a variable
2505 template is unique in its declarative region.
2507 2020-06-29 Marek Polacek <polacek@redhat.com>
2510 * pt.c (collect_ctor_idx_types): Use TREE_TYPE.
2512 2020-06-28 Iain Sandoe <iain@sandoe.co.uk>
2515 * coroutines.cc (register_local_var_uses): Skip past
2518 2020-06-27 Iain Sandoe <iain@sandoe.co.uk>
2521 * coroutines.cc (get_awaitable_var): New helper.
2522 (build_co_await): Check more carefully before
2523 copying an awaitable.
2524 (expand_one_await_expression): No initializer
2525 is required when the awaitable is not a temp.
2526 (register_awaits): Remove handling that is now
2527 completed when the await expression is built.
2529 2020-06-27 Iain Sandoe <iain@sandoe.co.uk>
2531 * coroutines.cc (morph_fn_to_coro): Diagnose unavailable
2532 get_return_object_on_allocation_failure.
2534 2020-06-26 Iain Sandoe <iain@sandoe.co.uk>
2537 * coroutines.cc (struct coroutine_info):Add a field
2538 to hold computed p.return_void expressions.
2539 (coro_build_promise_expression): New.
2540 (get_coroutine_return_void_expr): New.
2541 (finish_co_yield_expr): Build the promise expression
2542 using coro_build_promise_expression.
2543 (finish_co_return_stmt): Likewise.
2544 (build_init_or_final_await): Likewise.
2545 (morph_fn_to_coro): Likewise, for several cases.
2547 2020-06-26 Iain Sandoe <iain@sandoe.co.uk>
2549 * coroutines.cc (morph_fn_to_coro): Handle error
2550 returns in building g-r-o-o-a-f expressions.
2552 2020-06-24 Nicholas Krause <xerofoify@gmail.com>
2555 * typeck2.c (cxx_incomplete_type_diagnostic): Add missing
2556 TYPE_EXPANSION_PACK check for diagnosing incomplete types in
2557 cxx_incomplete_type_diagnostic.
2559 2020-06-24 Iain Sandoe <iain@sandoe.co.uk>
2563 * coroutines.cc (act_des_fn): Copy function
2564 attributes onto the outlined coroutine helpers.
2566 2020-06-24 Jason Merrill <jason@redhat.com>
2568 * call.c (build_over_call): Only call build_base_path once.
2570 2020-06-24 Jason Merrill <jason@redhat.com>
2573 * call.c (build_over_call): Look up the overrider in base_binfo.
2574 * class.c (lookup_vfn_in_binfo): Look through BINFO_PRIMARY_P.
2576 2020-06-23 Jason Merrill <jason@redhat.com>
2579 Implement C++20 P2082R1, Fixing CTAD for aggregates.
2580 * cp-tree.h (TPARMS_PRIMARY_TEMPLATE): Split out from...
2581 (DECL_PRIMARY_TEMPLATE): ...here.
2582 (builtin_guide_p): Declare.
2583 * decl.c (reshape_init_class): Handle bases of a template.
2584 (reshape_init_r): An array with dependent bound takes a single
2586 * pt.c (tsubst_default_argument): Shortcut {}.
2587 (unify_pack_expansion): Allow omitted arguments to trailing pack.
2588 (builtin_guide_p): New.
2589 (collect_ctor_idx_types): Give a trailing pack a {} default
2590 argument. Handle arrays better.
2592 2020-06-23 Iain Sandoe <iain@sandoe.co.uk>
2595 * coroutines.cc (morph_fn_to_coro): Apply a cleanup to
2596 the get return object when the DTOR is non-trivial.
2598 2020-06-20 Iain Sandoe <iain@sandoe.co.uk>
2601 * coroutines.cc (morph_fn_to_coro): Update handling of
2602 get-return-object-on-allocation-fail and diagnose missing
2605 2020-06-20 Jason Merrill <jason@redhat.com>
2607 * call.c (joust): Only compare constraints for non-template
2608 candidates with matching parameters.
2609 * pt.c (tsubst_pack_expansion): Fix getting a type parameter
2611 (more_specialized_fn): Only compare constraints for candidates with
2612 matching parameters.
2614 2020-06-19 Jason Merrill <jason@redhat.com>
2616 * method.c (early_check_defaulted_comparison): Allow defaulting
2617 comparison outside class. Complain if non-member operator isn't a
2620 2020-06-18 Jason Merrill <jason@redhat.com>
2622 * method.c (early_check_defaulted_comparison): Check for &&.
2623 (build_comparison_op): Allow empty union. Diagnose non-category
2625 (common_comparison_type): Remove handling for non-category type.
2627 2020-06-18 Marek Polacek <polacek@redhat.com>
2630 * pt.c (finish_template_variable): Return if
2631 coerce_innermost_template_parms return error_mark_node.
2633 2020-06-18 Marek Polacek <polacek@redhat.com>
2636 * pt.c (tsubst_copy_and_build) <case NEW_EXPR>: Return error_mark_node
2637 if placement is erroneous.
2639 2020-06-17 Jonathan Wakely <jwakely@redhat.com>
2642 * parser.c (cp_parser_elaborated_type_specifier): Do not warn
2643 unless in a declaration.
2645 2020-06-17 Jason Merrill <jason@redhat.com>
2647 * cp-tree.h (copy_fndecl_with_name): Declare.
2648 * class.c (copy_fndecl_with_name): Split out from...
2649 (build_clone): ...here.
2650 (add_implicitly_declared_members): Add op== to TYPE_FIELDS.
2651 * method.c (implicitly_declare_fn): Use copy_fndecl_with_name.
2653 2020-06-17 Jason Merrill <jason@redhat.com>
2655 * call.c (build_new_op_1): Don't look for a CALL_EXPR when
2656 calling a consteval function.
2658 2020-06-17 Jason Merrill <jason@redhat.com>
2660 * decl2.c (grokfield): Pass SD_DEFAULTED and SD_DELETED.
2661 * decl.c (duplicate_decls): Reduce error for delete
2662 after earlier declaration to pedwarn.
2664 2020-06-17 Marek Polacek <polacek@redhat.com>
2667 * constexpr.c (maybe_fold_non_dependent_expr): New.
2668 * cp-tree.h (maybe_fold_non_dependent_expr): Declare.
2669 * typeck.c (cp_build_array_ref): Call maybe_fold_non_dependent_expr
2670 instead of maybe_constant_value.
2672 2020-06-16 Marek Polacek <polacek@redhat.com>
2675 * call.c (add_list_candidates): Return if a designated initializer
2676 is used with a non-aggregate.
2677 (implicit_conversion_error): Give an error for the case above.
2679 2020-06-16 Marek Polacek <polacek@redhat.com>
2682 * name-lookup.c (check_local_shadow): Check if types are
2683 non-null before calling same_type_p.
2685 2020-06-16 Jakub Jelinek <jakub@redhat.com>
2687 * semantics.c (handle_omp_for_class_iterator): Adjust
2688 c_omp_check_loop_iv_exprs caller.
2689 (finish_omp_for): Likewise. Don't call fold_build_cleanup_point_expr
2690 before calling c_finish_omp_for and c_omp_check_loop_iv, move it
2692 * pt.c (tsubst_omp_for_iterator): Handle non-rectangular loops.
2694 2020-06-16 Jakub Jelinek <jakub@redhat.com>
2696 * parser.c (cp_parser_omp_clause_schedule): Reject modifier separated
2697 from kind by comma rather than colon.
2699 2020-06-16 Patrick Palka <ppalka@redhat.com>
2701 * pt.c (perform_instantiation_time_access_checks): No need to
2703 * semantics.c (enforce_access): Verify that decl is not
2706 2020-06-16 Patrick Palka <ppalka@redhat.com>
2710 * cp-tree.h (qualified_typedef_usage_s): Delete.
2711 (qualified_typedef_usage_t): Delete.
2712 (deferred_access_check): Move up in file.
2713 (tree_template_info::typedefs_needing_access_checking): Delete.
2714 (tree_template_info::deferred_access_checks): New field.
2715 (TI_TYPEDEFS_NEEDING_ACCESS_CHECKING): Rename to ...
2716 (TI_DEFERRED_ACCESS_CHECKS): ... this, and adjust accordingly.
2717 * pt.c (perform_typedefs_access_check): Rename to ...
2718 (perform_instantiation_time_access_checks): ... this, and adjust
2719 accordingly. Remove unnecessary tree tests.
2720 (instantiate_class_template_1): Adjust accordingly.
2721 (instantiate_decl): Likewise.
2722 * semantics.c (enforce_access): Likewise.
2724 2020-06-16 Patrick Palka <ppalka@redhat.com>
2728 * call.c (enforce_access): Move to semantics.c.
2729 * cp-tree.h (enforce_access): Delete.
2730 (get_types_needing_access_check): Delete.
2731 (add_typedef_to_current_template_for_access_check): Delete.
2732 * decl.c (make_typename_type): Adjust accordingly. Use
2733 check_accessibility_of_qualified_id instead of directly using
2734 perform_or_defer_access_check.
2735 * parser.c (cp_parser_template_declaration_after_parameters):
2736 Don't push a dk_no_check access state when parsing a template.
2737 * pt.c (get_types_needing_access_check): Delete.
2738 (append_type_to_template_for_access_check_1): Delete.
2739 (perform_typedefs_access_check): Adjust. If type_decl is a
2740 FIELD_DECL, also check its DECL_CONTEXT for dependence. Use
2741 tsubst_copy instead of tsubst to substitute into type_decl so
2742 that we substitute into the DECL_CONTEXT of a FIELD_DECL.
2743 (append_type_to_template_for_access_check): Delete.
2744 * search.c (accessible_p): Remove the processing_template_decl
2746 * semantics.c (enforce_access): Moved from call.c. If we're
2747 parsing a template and the access check failed, add the check to
2748 TI_TYPEDEFS_NEEDING_ACCESS_CHECKING.
2749 (perform_or_defer_access_check): Adjust comment.
2750 (add_typedef_to_current_template_for_access_check): Delete.
2751 (check_accessibility_of_qualified_id): Adjust accordingly.
2752 Exit early if the scope is dependent.
2754 2020-06-11 Patrick Palka <ppalka@redhat.com>
2757 * constraint.cc (associate_classtype_constraints): If there is a
2758 discrepancy between the current template depth and the template
2759 depth of the original declaration, then adjust the template
2760 parameter depth within the current constraints appropriately.
2761 * pt.c (tsubst_friend_class): Substitute into and set the
2762 constraints on the injected declaration.
2764 2020-06-11 Iain Sandoe <iain@sandoe.co.uk>
2766 * coroutines.cc (instantiate_coro_traits): Pass a reference
2767 to lambda closure objects to traits instantiation.
2768 (morph_fn_to_coro): Likewise for promise parameter
2769 preview and allocator lookup.
2771 2020-06-10 Iain Sandoe <iain@sandoe.co.uk>
2774 * call.c (add_candidates): Use vec_safe_length() for
2775 testing the arguments list.
2776 (build_new_method_call_1): Use vec_safe_is_empty() when
2777 checking for an empty args list.
2779 2020-06-10 Marek Polacek <polacek@redhat.com>
2782 * parser.c (cp_parser_direct_declarator): Clear
2783 CP_PARSER_FLAGS_DELAY_NOEXCEPT if the declarator kind is not
2786 2020-06-09 Iain Sandoe <iain@sandoe.co.uk>
2789 * coroutines.cc (expand_one_await_expression): Build separate
2790 DTOR trees for the awaitable object on the destroy and resume
2793 2020-06-09 Jason Merrill <jason@redhat.com>
2796 * cp-gimplify.c (predeclare_vla): Only predeclare a VLA if it's
2797 wrapped in a pointer type.
2799 2020-06-05 Marek Polacek <polacek@redhat.com>
2802 * call.c (build_converted_constant_expr_internal): Allow
2803 list-initialization.
2805 2020-06-05 Iain Sandoe <iain@sandoe.co.uk>
2807 * cp-tree.def (CO_RETURN_EXPR): Correct the class
2808 to use tcc_statement.
2810 2020-06-05 Jason Merrill <jason@redhat.com>
2812 * error.c (dump_binary_op): Handle negative operand to
2815 2020-06-04 Jason Merrill <jason@redhat.com>
2818 * constexpr.c (cxx_eval_constant_expression) [OBJ_TYPE_REF]:
2819 Evaluate OBJ_TYPE_REF_EXPR.
2821 2020-06-04 Jason Merrill <jason@redhat.com>
2824 * class.c (lookup_vfn_in_binfo): New.
2825 * call.c (build_over_call): Use it.
2826 * cp-tree.h (resolves_to_fixed_type_p): Add default argument.
2827 (lookup_vfn_in_binfo): Declare.
2829 2020-06-04 Iain Sandoe <iain@sandoe.co.uk>
2832 * coroutines.cc (morph_fn_to_coro): Ensure that the get-
2833 return-object is constructed correctly; When it is not the
2834 final return value, pass it to the CTOR of the return type
2835 as an rvalue, per the standard comment.
2837 2020-06-04 Jakub Jelinek <jakub@redhat.com>
2841 * constexpr.c (cxx_eval_constant_expression): Diagnose CONVERT_EXPR
2842 conversions from pointer types to arithmetic types here...
2843 (cxx_eval_outermost_constant_expr): ... instead of here.
2845 2020-06-03 Mark Wielaard <mark@klomp.org>
2847 * parser.c (cp_lexer_safe_previous_token): New function.
2848 (cp_parser_error_1): Add name_hint if the previous token is
2849 a string literal and next token is a CPP_NAME and we have a
2850 missing header suggestion for the name.
2852 2020-06-03 Patrick Palka <ppalka@redhat.com>
2854 * pt.c (process_partial_specialization): Pass the full set of
2855 generic template arguments to strictly_subsumes.
2857 2020-06-03 Patrick Palka <ppalka@redhat.com>
2860 * pt.c (most_specialized_partial_spec): Reorganize the loop over
2861 DECL_TEMPLATE_SPECIALIZATIONS. Check constraints_satisfied_p on
2862 the original template declaration, not on the tsubsted one.
2864 2020-06-03 Iain Sandoe <iain@sandoe.co.uk>
2867 * coroutines.cc (finish_co_await_expr): Revise to allow for
2869 (finish_co_yield_expr): Likewise.
2871 2020-06-03 Jason Merrill <jason@redhat.com>
2874 * cp-tree.h (predeclare_vla): Declare.
2875 * cp-gimplify.c (predeclare_vla): Handle getting a decl.
2876 * pt.c (tsubst_expr) [DECL_EXPR]: Use it.
2878 2020-06-03 Tobias Burnus <tobias@codesourcery.com>
2880 * cp-gimplify.c (cxx_omp_predetermined_mapping): New.
2881 * cp-objcp-common.h (LANG_HOOKS_OMP_PREDETERMINED_MAPPING): Redfine.
2882 * cp-tree.h (cxx_omp_predetermined_mapping): Declare.
2884 2020-06-02 Jason Merrill <jason@redhat.com>
2887 * pt.c (tsubst_decl): Relax assert.
2889 2020-06-02 Iain Sandoe <iain@sandoe.co.uk>
2892 * coroutines.cc (build_co_await): Wrap the co_await expression
2893 in a TARGET_EXPR, where needed.
2894 (finish_co_yield_expr): Likewise.
2896 2020-06-02 Patrick Palka <ppalka@redhat.com>
2900 * pt.c (tsubst_function_decl): Don't do set_constraints when
2901 regenerating a lambda.
2902 (tsubst_lambda_expr): Substitute into the lambda's constraints
2903 and do set_constraints here.
2905 2020-06-01 Jason Merrill <jason@redhat.com>
2910 * class.c (build_vfn_ref): Revert 95311 change.
2911 * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call): Build a
2914 2020-06-01 Iain Sandoe <iain@sandoe.co.uk>
2917 * coroutines.cc (struct param_info): Remove rv_ref field.
2918 (build_actor_fn): Remove specifial rvalue ref handling.
2919 (morph_fn_to_coro): Likewise.
2921 2020-05-31 Iain Sandoe <iain@sandoe.co.uk>
2924 * coroutines.cc (morph_fn_to_coro): If we see an
2925 early fatal error, drop the erroneous function body.
2927 2020-05-31 Iain Sandoe <iain@sandoe.co.uk>
2929 * coroutines.cc (build_co_await): Remove unused
2931 (finish_co_await_expr): Likewise.
2932 (finish_co_yield_expr): Likewise; revise comment.
2934 2020-05-30 Iain Sandoe <iain@sandoe.co.uk>
2936 * coroutines.cc (morph_fn_to_coro): Revise initialization
2937 of the frame pointer to avoid an unused value.
2939 2020-05-30 Patrick Palka <ppalka@redhat.com>
2942 * constraint.cc (satisfaction_value): Accept INTEGER_CST of any
2945 2020-05-29 Patrick Palka <ppalka@redhat.com>
2946 Jason Merrill <jason@redhat.com>
2949 * class.c (add_method): Let special member function templates
2950 coexist if they are not equivalently constrained, or in a class
2953 2020-05-29 Jason Merrill <jason@redhat.com>
2956 * pt.c (process_template_parm): Set DECL_TEMPLATE_INFO
2957 on the DECL_TEMPLATE_RESULT.
2959 2020-05-29 Marek Polacek <polacek@redhat.com>
2962 * cp-gimplify.c (cp_fold) <case MODIFY_EXPR>: Don't set
2963 TREE_THIS_VOLATILE here.
2964 (cp_fold): Set it here along with TREE_NO_WARNING.
2966 2020-05-29 Jason Merrill <jason@redhat.com>
2970 * class.c (build_vfn_ref): Don't fold the INDIRECT_REF.
2972 2020-05-29 Patrick Palka <ppalka@redhat.com>
2977 * parser.c (cp_parser_requires_clause_expression): Temporarily
2978 increment processing_template_decl only if it is 0.
2979 (cp_parser_constraint_expression): Likewise.
2980 (cp_parser_requires_expression): Likewise.
2982 2020-05-29 Patrick Palka <ppalka@redhat.com>
2985 * constexpr.c (get_or_insert_ctor_field): Add limited support
2986 for RANGE_EXPR index lookups.
2988 2020-05-28 Jakub Jelinek <jakub@redhat.com>
2991 * decl.c (cp_finish_decomp): Call complete_type before checking
2994 2020-05-28 Jason Merrill <jason@redhat.com>
2997 * decl.c (cp_finish_decl): Revert r9-297 change.
2998 (check_static_variable_definition): Likewise.
2999 * constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
3000 * pt.c (instantiate_decl): Return early on type error.
3002 2020-05-27 Jason Merrill <jason@redhat.com>
3005 * decl.c (reshape_init_array_1): Don't reuse in overload context.
3007 2020-05-27 Jason Merrill <jason@redhat.com>
3010 * call.c (build_new_op_1): Suppress
3011 warn_zero_as_null_pointer_constant across comparison of <=> result
3014 2020-05-27 Jason Merrill <jason@redhat.com>
3017 * decl.c (grokdeclarator): Don't shift attributes in TYPENAME
3020 2020-05-27 Nathan Sidwell <nathan@acm.org>
3023 * pt.c (lookup_template_class_1): Restore alias template mutation.
3025 2020-05-26 Jakub Jelinek <jakub@redhat.com>
3028 * cp-gimplify.c: Include omp-general.h.
3029 (cp_genericize_r) <case OMP_DISTRIBUTE>: For class iteration
3030 variables in composite distribute parallel for, instantiate copy
3031 ctor of their types.
3033 2020-05-23 Patrick Palka <ppalka@redhat.com>
3036 * constexpr.c (cxx_eval_constant_expression)
3037 <case TEMPLATE_ID_EXPR>: Don't evaluate the concept when
3038 constexpr evaluation is uid-sensitive.
3040 2020-05-22 Jason Merrill <jason@redhat.com>
3042 * cp-gimplify.c (cp_gimplify_expr) [CALL_EXPR]: Don't preevaluate
3043 the function address if the call used operator syntax.
3045 2020-05-21 Jason Merrill <jason@redhat.com>
3048 * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call): For a virtual
3049 call, instrument the OBJ_TYPE_REF.
3051 * decl.c (compute_array_index_type_loc): Diagnose expressions
3052 in a template that can't be constant.
3053 * parser.c (cp_parser_direct_declarator): Don't check
3054 non-constant array bounds here.
3056 * cp-tree.h (is_rvalue_constant_expression): Declare.
3057 * constexpr.c (is_rvalue_constant_expression): New.
3058 * parser.c (cp_parser_constant_expression): Use it.
3059 * decl.c (cp_finish_decl): Try to treat a constexpr initializer in a
3060 template as constant.
3062 * typeck.c (build_x_modify_expr): Handle error_mark_node arguments.
3064 * decl.c (grokparms): Return NULL_TREE if any parms were erroneous.
3066 2020-05-21 Iain Sandoe <iain@sandoe.co.uk>
3068 * coroutines.cc (finish_co_return_stmt): Revert change to use
3071 2020-05-21 Patrick Palka <ppalka@redhat.com>
3074 * constexpr.c (constexpr_ctx::uid_sensitive): Remove field.
3075 (uid_sensitive_constexpr_evaluation_value): Define.
3076 (uid_sensitive_constexpr_evaluation_true_counter): Define.
3077 (uid_sensitive_constexpr_evaluation_p): Define.
3078 (uid_sensitive_constexpr_evaluation_sentinel): Define its
3080 (uid_sensitive_constexpr_evaluation_checker): Define its
3081 constructor and its evaluation_restricted_p method.
3082 (get_fundef_copy): Remove 'ctx' parameter. Use u_s_c_e_p
3083 instead of constexpr_ctx::uid_sensitive.
3084 (cxx_eval_call_expression): Use u_s_c_e_p instead, and test it
3085 last. Adjust call to get_fundef_copy.
3086 (instantiate_cx_fn_r): Test u_s_c_e_p so that we increment the
3087 counter if necessary.
3088 (cxx_eval_outermost_constant_expr): Remove 'uid_sensitive'
3089 parameter. Adjust function body accordingly.
3090 (maybe_constant_value): Remove 'uid_sensitive' parameter and
3091 adjust function body accordingly. Set up a
3092 uid_sensitive_constexpr_evaluation_checker, and use it to
3093 conditionally update the cv_cache.
3094 * cp-gimplify.c (cp_fold): Set up a
3095 uid_sensitive_constexpr_evaluation_checker, and use it to
3096 conditionally update the fold_cache.
3097 * cp-tree.h (maybe_constant_value): Update declaration.
3098 (struct uid_sensitive_constexpr_evaluation_sentinel): Define.
3099 (struct sensitive_constexpr_evaluation_checker): Define.
3100 * expr.c (fold_for_warn): Set up a
3101 uid_sensitive_constexpr_evaluation_sentinel before calling
3102 the folding subroutines. Drop all but the first argument to
3103 maybe_constant_value.
3105 2020-05-20 Marek Polacek <polacek@redhat.com>
3108 * parser.c (cp_parser_unqualified_id): Reject simple-template-id as
3109 the declarator-id of a destructor.
3110 (cp_parser_constructor_declarator_p): Reject simple-template-id as
3111 the declarator-id of a constructor.
3113 2020-05-20 Marek Polacek <polacek@redhat.com>
3117 * cp-tree.h (SD_DECOMPOSITION): New flag.
3118 * decl.c (duplicate_decls): Make sure a structured binding is unique
3119 in its declarative region.
3120 (start_decl): If INITIALIZED is SD_DECOMPOSITION, call
3121 fit_decomposition_lang_decl.
3122 (grokdeclarator): Compare INITIALIZED directly to SD_* flags.
3123 * parser.c (cp_parser_decomposition_declaration): Pass SD_DECOMPOSITION
3126 2020-05-20 Patrick Palka <ppalka@redhat.com>
3129 * typeck.c (structural_comptypes): Don't perform
3130 context-dependent resolution of TYPENAME_TYPEs when
3131 comparing_specializations.
3133 2020-05-19 Nathan Sidwell <nathan@acm.org>
3135 * pt.c (lookup_template_class_1): Do not reinit template_info of an
3138 2020-05-18 Martin Sebor <msebor@redhat.com>
3141 * call.c ((maybe_warn_class_memaccess): Use is_byte_access_type.
3142 * cp-tree.h (is_dummy_object): Return bool.
3143 (is_byte_access_type): Declare new function.
3144 * tree.c (is_dummy_object): Return bool.
3145 (is_byte_access_type): Define new function.
3147 2020-05-19 Patrick Palka <ppalka@redhat.com>
3150 * pt.c (init_template_processing): Enable sanitization for
3151 decl_specializations and type_specializations.
3154 * pt.c (fn_type_unification): Pass 'fn' instead of NULL_TREE as
3155 the 'in_decl' parameter to coerce_template_parms.
3157 2020-05-18 Marek Polacek <polacek@redhat.com>
3160 * typeck.c (cp_build_binary_op): Use fold_for_warn instead of
3163 2020-05-18 Marek Polacek <polacek@redhat.com>
3166 * cvt.c (cp_get_fndecl_from_callee): Return NULL_TREE if the function
3167 type is not INDIRECT_TYPE_P.
3168 * decl.c (omp_declare_variant_finalize_one): Call
3169 cp_get_callee_fndecl_nofold instead of looking for the function decl
3172 2020-05-18 Marek Polacek <polacek@redhat.com>
3175 * parser.c (cp_parser_has_attribute_expression): Sorry on a
3176 type-dependent argument.
3178 2020-05-18 Marek Polacek <polacek@redhat.com>
3182 * call.c (add_builtin_candidate) <case EQ_EXPR>: Create candidate
3183 operator functions when type is std::nullptr_t for ==/!=.
3184 * typeck.c (composite_pointer_type_r): Add a bool * parameter. Use it
3185 to maybe add "const" to the pointer type.
3186 (composite_pointer_type): Update the call to composite_pointer_type_r.
3187 (cp_build_binary_op): Turn two warning_at into error_at. Print the
3190 2020-05-18 Jason Merrill <jason@redhat.com>
3192 * call.c (build_over_call): Remove unnecessary
3193 cp_stabilize_reference.
3195 2020-05-18 Marek Polacek <polacek@redhat.com>
3197 * call.c (add_builtin_candidate): Don't create a builtin overload
3198 candidate for ++ when type is bool in C++17.
3200 2020-05-18 Marek Polacek <polacek@redhat.com>
3202 * cfns.h: Regenerated.
3204 2020-05-17 Iain Sandoe <iain@sandoe.co.uk>
3206 * coroutines.cc (morph_fn_to_coro): Initialize the gro variable.
3208 2020-05-16 Iain Sandoe <iain@sandoe.co.uk>
3210 * coroutines.cc (finish_co_return_stmt): Implement rules
3211 from [class.copy.elision] /3.
3213 2020-05-16 Patrick Palka <ppalka@redhat.com>
3216 * semantics.c (finish_decltype_type): Call
3217 instantiate_non_dependent_expr_sfinae on the expression.
3219 2020-05-15 Patrick Palka <ppalka@redhat.com>
3223 2020-04-07 Patrick Palka <ppalka@redhat.com>
3226 * typeck2.c (process_init_constructor_array): Propagate
3227 CONSTRUCTOR_PLACEHOLDER_BOUNDARY up from each element initializer to
3228 the array initializer.
3230 2020-05-15 Jason Merrill <jason@redhat.com>
3232 PR c++/93286 - ICE with __is_constructible and variadic template.
3233 * pt.c (tsubst_tree_list): New.
3234 (tsubst, tsubst_copy_and_build): Use it.
3235 * decl2.c (is_late_template_attribute): Handle error_mark_node args.
3237 2020-05-15 Nathan Sidwell <nathan@acm.org>
3239 * pt.c (template_args_equal): Fix thinkos in previous 'cleanup'.
3241 2020-05-14 Jason Merrill <jason@redhat.com>
3244 * pt.c (maybe_instantiate_noexcept): Change clone handling.
3246 2020-05-14 Patrick Palka <ppalka@redhat.com>
3249 * call.c (build_op_call): Pass complain to lookup_fnfields.
3250 (build_special_member_call): Likewise.
3251 * class.c (type_requires_array_cookie): Pass tf_warning_or_error
3253 * cp-tree.h (lookup_fnfields): Add tsubst_flags_t parameter.
3254 * except.c (build_throw): Pass tf_warning_or_error to
3256 * init.c (build_new_1): Pass complain to lookup_fnfields.
3257 * method.c (locate_fn_flags): Likewise.
3258 * name-lookup.c (lookup_name_real_1): Pass tf_warning_or_error
3260 * pt.c (tsubst_baselink): Pass complain to lookup_fnfields.
3261 * search.c (lookup_fnfields): New 'complain' parameter. Pass it
3264 2020-05-14 Nathan Sidwell <nathan@acm.org>
3266 * parser.c (cp_parser_diagnose_invalid_typename): Mention
3267 std=c++20 not 2a, reformat dependent binfo inform loops.
3269 * pt.c (tsubst_template_decl): Reorder and commonize some control
3272 * pt.c (tsubst_friend_function): Simplify control flow.
3274 * pt.c (lookup_template_class_1): Remove unnecessary else by
3275 simply grabbing TYPE_NAME earlier.
3277 * pt.c (push_template_decl_real): Adjust friend pushing logic.
3278 Reinit template type.
3280 * pt.c (build_template_decl): Init DECL_TEMPLATE_RESULT &
3282 (process_partial_specialization): ... not here ...
3283 (push_template_decl_real, add_inherited_template_parms)
3284 (build_deduction_guide): ... or here.
3286 2020-05-14 Jakub Jelinek <jakub@redhat.com>
3288 * cp-gimplify.c (cp_genericize_r): Set cfun->has_omp_target.
3290 2020-05-13 Patrick Palka <ppalka@redhat.com>
3293 * init.c (build_vec_delete_1): Just return error_mark_node if
3294 deallocate_expr is error_mark_node.
3295 (build_delete): Just return error_mark_node if do_delete is
3298 2020-05-13 Patrick Palka <ppalka@redhat.com>
3301 * constraint.cc (tsubst_requires_expr): Produce a new
3302 requires-expression when processing_template_decl, even if
3303 template arguments are not dependent.
3305 2020-05-13 Marek Polacek <polacek@redhat.com>
3308 * decl.c (duplicate_decls): Set DECL_HAS_DEPENDENT_EXPLICIT_SPEC_P.
3310 2020-05-13 Nathan Sidwell <nathan@acm.org>
3312 * pt.c (template_args_equal): Reorder category checking for
3315 * pt.c (perform_typedefs_access_check): Cache expensively
3316 calculated object references.
3317 (check_auto_in_tmpl_args): Just assert we do not get unexpected
3318 nodes, rather than silently do nothing.
3319 (append_type_to_template_for_access): Likewise, cache expensie
3322 * pt.c (canonical_type_parameter): Simplify.
3324 Formatting fixups & some simplifications.
3325 * pt.c (spec_hash_table): New typedef.
3326 (decl_specializations, type_specializations): Use it.
3327 (retrieve_specialization): Likewise.
3328 (register_specialization): Remove unnecessary casts.
3329 (push_template_decl_real): Reformat.
3330 (instantiate_class_template_1): Use more RAII.
3331 (make_argument_pack): Simplify.
3332 (instantiate_template_1): Use gcc_checking_assert for expensive
3334 (instantiate_decl): Likewise.
3335 (resolve_typename_type): Reformat comment.
3336 * semantics.c (struct deferred_access): Remove unnecessary GTY on
3338 (begin_class_definition): Fix formatting.
3340 2020-05-13 Jason Merrill <jason@redhat.com>
3342 * call.c, class.c, constexpr.c, constraint.cc, decl.c, init.c,
3343 lambda.c, lex.c, method.c, name-lookup.c, parser.c, pt.c, tree.c,
3344 typeck2.c: Change cxx2a to cxx20.
3346 2020-05-12 Marek Polacek <polacek@redhat.com>
3349 * parser.c (cp_parser_postfix_expression) <case CPP_OPEN_PAREN>: When
3350 looking for a block-scope function declaration, look through the whole
3351 set, not just the first function in the overload set.
3353 2020-05-12 Jakub Jelinek <jakub@redhat.com>
3356 * pt.c (tsubst_decl): Deal with DECL_OMP_PRIVATIZED_MEMBER for
3359 2020-05-11 Jason Merrill <jason@redhat.com>
3361 Resolve C++20 NB comment CA104
3362 * pt.c (determine_specialization): Compare constraints for
3363 specialization of member template of class instantiation.
3365 2020-05-11 Jason Merrill <jason@redhat.com>
3369 * tree.c (cp_walk_subtrees): Stop at typedefs.
3370 Handle TYPENAME_TYPE here.
3371 * pt.c (find_parameter_packs_r): Not here.
3372 (for_each_template_parm_r): Clear *walk_subtrees.
3373 * decl2.c (min_vis_r): Look through typedefs.
3375 2020-05-11 Jason Merrill <jason@redhat.com>
3377 * call.c (implicit_conversion_error): Split out from...
3378 (perform_implicit_conversion_flags): ...here.
3379 (build_converted_constant_expr_internal): Use it.
3381 2020-05-11 Jason Merrill <jason@redhat.com>
3384 * parser.c (inject_parm_decls): Set current_class_ptr here.
3385 (cp_parser_direct_declarator): And here.
3386 (cp_parser_late_return_type_opt): Not here.
3387 (cp_parser_noexcept_specification_opt): Nor here.
3388 (cp_parser_exception_specification_opt)
3389 (cp_parser_late_noexcept_specifier): Remove unneeded parameters.
3391 2020-05-11 Jason Merrill <jason@redhat.com>
3393 * decl.c (cxx_init_decl_processing): Call declare_weak for
3396 2020-05-11 Jason Merrill <jason@redhat.com>
3398 * pt.c (instantiate_class_template_1): Call tsubst_expr for
3399 STATIC_ASSERT member.
3400 * ptree.c (cxx_print_xnode): Handle STATIC_ASSERT.
3402 2020-05-11 Jason Merrill <jason@redhat.com>
3404 * pt.c (find_parameter_packs_r) [LAMBDA_EXPR]: Remove redundant
3405 walking of capture list.
3407 2020-05-11 Jason Merrill <jason@redhat.com>
3409 * cp-tree.h (LOOKUP_EXPLICIT_TMPL_ARGS): Remove.
3410 * call.c (build_new_function_call): Don't set it.
3411 (build_new_method_call_1): Likewise.
3412 (build_over_call): Check cand->explicit_targs instead.
3414 2020-05-11 Jason Merrill <jason@redhat.com>
3416 * decl.c (compute_array_index_type_loc): Stabilize before building
3419 2020-05-11 Jason Merrill <jason@redhat.com>
3421 * decl.c (grokdeclarator): Adjust deprecated_state here.
3422 (start_decl): Not here.
3424 2020-05-08 Iain Sandoe <iain@sandoe.co.uk>
3427 * coroutines.cc (build_actor_fn): Ensure that bind scopes
3428 are marked as having side-effects where necessary.
3429 (replace_statement_captures): Likewise.
3430 (morph_fn_to_coro): Likewise.
3432 2020-05-08 Nathan Sidwell <nathan@acm.org>
3434 * NEWS: Delete, it is so stale.
3436 * parser.c (cp_lexer_set_source_position_from_token): EOF has a
3439 2020-05-07 Iain Sandoe <iain@sandoe.co.uk>
3443 * coroutines.cc (morph_fn_to_coro): Set unformed outline
3444 functions to error_mark_node. For early error returns suppress
3445 warnings about missing ramp return values. Fix reinstatement
3446 of the function body on pre-existing initial error.
3447 * decl.c (finish_function): Use the normal error path for fails
3448 in the ramp function, do not try to compile the helpers if the
3451 2020-05-07 Marek Polacek <polacek@redhat.com>
3453 PR c++/94590 - Detect long double -> double narrowing.
3454 * typeck2.c (check_narrowing): Detect long double -> double
3455 narrowing even when double and long double have the same
3456 precision. Make it handle conversions to float too.
3458 2020-05-07 Marek Polacek <polacek@redhat.com>
3461 * parser.c (cp_parser_class_specifier_1): Check that the scope is
3462 nested inside current scope before pushing it.
3464 2020-05-07 Marek Polacek <polacek@redhat.com>
3467 * typeck2.c (check_narrowing): Consider T* to bool narrowing
3470 2020-05-07 Marek Polacek <polacek@redhat.com>
3472 * decl.c (grok_op_properties): Fix spelling of non-static.
3473 * typeck.c (build_class_member_access_expr): Likewise.
3475 2020-05-07 Richard Biener <rguenther@suse.de>
3478 * optimize.c (update_cloned_parm): Copy DECL_NOT_GIMPLE_REG_P.
3480 2020-05-06 Marek Polacek <polacek@redhat.com>
3483 * pt.c (tsubst_copy_and_build): Call type_dependent_expression_p_push
3484 instead of uses_template_parms. Move the warning_sentinels after the
3487 2020-05-06 Jakub Jelinek <jakub@redhat.com>
3490 * typeck.c (cp_strict_aliasing_warning): New function.
3491 (cp_build_indirect_ref_1, build_reinterpret_cast_1): Use
3492 it instead of strict_aliasing_warning.
3495 * method.c (defaulted_late_check): Don't call synthesize_method
3496 on constexpr sfk_comparison if it has been called on it already.
3498 2020-05-06 Nathan Sidwell <nathan@acm.org>
3501 * decl.c (grokdeclarator): Don't splice template attributes in
3502 parm context -- they can apply to the parm.
3504 2020-05-05 Iain Sandoe <iain@sandoe.co.uk>
3506 * coroutines.cc: Remove references to n4849 throughout.
3508 2020-05-05 Jason Merrill <jason@redhat.com>
3511 * pt.c (more_specialized_fn): Do consider parms with no deducible
3512 template parameters.
3514 2020-05-05 Jason Merrill <jason@redhat.com>
3517 * constexpr.c (potential_constant_expression_1): In a lambda
3518 function, consider a captured variable directly.
3520 2020-05-05 Iain Sandoe <iain@sandoe.co.uk>
3522 * coroutines.cc (transform_await_wrapper): Check that we have
3523 no unlowered co_yields.
3524 (captures_temporary): Likewise.
3525 (register_awaits): Likewise.
3527 2020-05-05 Nathan Sidwell <nathan@acm.org>
3530 * coroutines.cc (morph_fn_to_coro): Just check for
3532 * pt.c (tsubst_function_decl): Update lambda fn's this_ptr name.
3534 2020-05-05 Marek Polacek <polacek@redhat.com>
3535 Jason Merrill <jason@redhat.com>
3538 * parser.c (cp_parser_postfix_dot_deref_expression): If we have
3539 a type-dependent object of class type, stash it to
3540 parser->context->object_type. If the postfix expression doesn't have
3542 (cp_parser_class_name): Consider object scope too.
3543 (cp_parser_lookup_name): Remove code dealing with the case when
3544 object_type is unknown_type_node.
3546 2020-05-04 Patrick Palka <ppalka@redhat.com>
3549 * cp-gimplify.c (cp_fold) <case CALL_EXPR>: Move some variable
3550 declarations closer to their uses. Copy the CALL_EXPR only
3551 when one of its arguments has changed.
3552 <case TREE_VEC>: Instead of first collecting the folded
3553 arguments into a releasing_vec, just make a copy of the TREE_VEC
3554 as soon as folding changes one of its arguments.
3556 2020-05-04 Iain Sandoe <iain@sandoe.co.uk>
3558 * coroutines.cc (morph_fn_to_coro): Mark the coro.gro variable
3559 as artificial and ignored.
3561 2020-05-04 Nathan Sidwell <nathan@acm.org>
3563 pt.c (process_template_parm): Don't walk the template list twice,
3564 remember the final node instead.
3565 (end_template_parm_list): Refactor. Comment on why we do a pop
3568 PR c++/94827 -- don't save parms in nested requirement
3569 * constraint.cc (tsubst_nested_requirement): TYPE directly holds
3570 notmalized requirement.
3571 (finish_nested_requirement): Don't stash current tpl parms into
3573 (diagnose_nested_requirement): TYPE directly holds notmalized
3576 2020-05-01 Patrick Palka <ppalka@redhat.com>
3579 * cp-tree.h (check_accessibility_of_qualified_id): Add
3580 tsubst_flags_t parameter and change return type to bool.
3581 * parser.c (cp_parser_lookup_name): Pass tf_warning_to_error to
3582 check_accessibility_of_qualified_id.
3583 * pt.c (tsubst_qualified_id): Return error_mark_node if
3584 check_accessibility_of_qualified_id returns false.
3585 * semantics.c (check_accessibility_of_qualified_id): Add
3586 complain parameter. Pass complain instead of
3587 tf_warning_or_error to perform_or_defer_access_check. Return
3588 true unless perform_or_defer_access_check returns false.
3590 2020-05-01 Marek Polacek <polacek@redhat.com>
3593 * typeck2.c (process_init_constructor_record): Return PICFLAG_ERRONEOUS
3594 if an initializer element was erroneous.
3596 2020-05-01 Jason Merrill <jason@redhat.com>
3599 * init.c (get_nsdmi): Don't push_to_top_level for a local class.
3601 2020-05-01 Jason Merrill <jason@redhat.com>
3604 * decl.c (cp_finish_decl): Also clear TREE_READONLY if
3605 -fmerge-all-constants.
3607 2020-05-01 Jason Merrill <jason@redhat.com>
3610 * pt.c (tsubst_decl): Make sure DECL_VALUE_EXPR continues to have
3611 the same type as the variable.
3613 2020-04-30 Jason Merrill <jason@redhat.com>
3614 Nathan Sidwell <nathan@acm.org>
3617 * constraint.cc (map_arguments): If ARGS is null, it's a
3618 self-mapping of parms.
3619 (finish_nested_requirement): Do not pass argified
3620 current_template_parms to normalization.
3621 (tsubst_nested_requirement): Don't assert no template parms.
3623 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
3626 * coroutines.cc (transform_local_var_uses): Defer walking
3627 the DECL_INITIALs of BIND_EXPR vars until all the frame
3628 allocations have been made.
3630 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
3633 * coroutines.cc (register_awaits): Update target
3634 expressions for awaitable and suspend handle
3637 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
3640 * coroutines.cc (build_co_await): Account for variables
3641 with DECL_VALUE_EXPRs.
3642 (captures_temporary): Likewise.
3643 (register_awaits): Likewise.
3645 2020-04-29 Patrick Palka <ppalka@redhat.com>
3648 * pt.c (find_template_parameter_info::parm_list): New field.
3649 (keep_template_parm): Use the new field to build up the
3650 parameter list here instead of ...
3651 (find_template_parameters): ... here. Return ftpi.parm_list.
3653 2020-04-29 Jakub Jelinek <jakub@redhat.com>
3656 * class.c (build_base_field): Set DECL_FIELD_ABI_IGNORED on C++17 empty
3657 base artificial FIELD_DECLs.
3658 (layout_class_type): Set DECL_FIELD_ABI_IGNORED on empty class
3659 field_poverlapping_p FIELD_DECLs.
3661 2020-04-29 Patrick Palka <ppalka@redhat.com>
3664 * constraint.cc (satisfy_declaration_constraints): Use saved_t
3665 instead of t as the key to decl_satisfied_cache.
3668 * error.c (print_requires_expression_info): Print the dependent
3669 form of the parameter list with its template parameter mapping,
3670 rather than printing the substituted form.
3672 2020-04-28 Jason Merrill <jason@redhat.com>
3675 * decl.c (use_eh_spec_block): Check nothrow type after
3677 * pt.c (maybe_instantiate_noexcept): Call synthesize_method for
3678 DECL_MAYBE_DELETED fns here.
3679 * decl2.c (mark_used): Not here.
3680 * method.c (get_defaulted_eh_spec): Reject DECL_MAYBE_DELETED here.
3682 2020-04-28 Iain Sandoe <iain@sandoe.co.uk>
3685 * coroutines.cc (instantiate_coro_traits): Pass a reference to
3686 object type rather than a pointer type for 'this', for method
3688 (struct param_info): Add a field to hold that the parm is a lambda
3690 (morph_fn_to_coro): Check for lambda closure pointers in the
3691 args. Use a reference to *this when building the args list for the
3692 promise allocator lookup.
3694 2020-04-28 Iain Sandoe <iain@sandoe.co.uk>
3697 * coroutines.cc (coro_promise_type_found_p): Do not
3698 exclude non-classes here (this needs to be handled in the
3700 (morph_fn_to_coro): Allow for the case where the coroutine
3703 2020-04-27 Iain Sandoe <iain@sandoe.co.uk>
3706 * coroutines.cc (struct local_var_info): Add fields for static
3707 variables and those with DECL_VALUE_EXPR redirection.
3708 (transform_local_var_uses): Skip past typedefs and static vars
3709 and then account for redirected variables.
3710 (register_local_var_uses): Likewise.
3712 2020-04-27 Jason Merrill <jason@redhat.com>
3716 * decl.c (grokdeclarator): Move dependent attribute to decl.
3717 * decl2.c (splice_template_attributes): No longer static.
3719 2020-04-27 Patrick Palka <ppalka@redhat.com>
3722 * constexpr.c (cxx_eval_call_expression): Don't set new_obj if we're
3723 evaluating the target constructor of a delegating constructor.
3724 (cxx_eval_store_expression): Don't set TREE_READONLY if the LHS of the
3725 INIT_EXPR is '*this'.
3727 2020-04-26 Marek Polacek <polacek@redhat.com>
3730 * call.c (struct conversion): Add copy_init_p.
3731 (standard_conversion): Set copy_init_p in ck_base and ck_rvalue
3732 if FLAGS demands LOOKUP_ONLYCONVERTING.
3733 (convert_like_real) <case ck_base>: If copy_init_p is set, or
3734 LOOKUP_ONLYCONVERTING into FLAGS.
3736 2020-04-26 Iain Sandoe <iain@sandoe.co.uk>
3739 * coroutines.cc (morph_fn_to_coro): Ensure that
3740 unnamed function params have a usable and distinct
3743 2020-04-24 Jason Merrill <jason@redhat.com>
3746 * decl.c (redeclaration_error_message): Reject defaulted comparison
3747 operator that has been previously declared.
3749 2020-04-25 Patrick Palka <ppalka@redhat.com>
3751 * parser.c (cp_parser_diagnose_invalid_type_name): Suggest enabling
3752 concepts if the invalid identifier is 'requires'.
3754 2020-04-25 Jakub Jelinek <jakub@redhat.com>
3757 * semantics.c (finish_call_expr): When looking if all overloads
3758 are noreturn, use STRIP_TEMPLATE to look through TEMPLATE_DECLs.
3760 2020-04-24 Martin Liska <mliska@suse.cz>
3762 * coroutines.cc: Fix compilation error for release checking
3763 where we miss declaration of ‘coro_body_contains_bind_expr_p’.
3765 2020-04-23 Patrick Palka <ppalka@redhat.com>
3767 * tree.c (zero_init_expr_p): Use uses_template_parms instead of
3771 * pt.c (template_class_depth): Walk into the DECL_FRIEND_CONTEXT of a
3772 friend declaration rather than into its CP_DECL_CONTEXT.
3774 2020-04-23 Iain Sandoe <iain@sandoe.co.uk>
3777 * coroutines.cc (await_statement_expander): Simplify cases.
3778 (struct susp_frame_data): Add fields for truth and/or if
3779 cases, rename one field.
3780 (analyze_expression_awaits): New.
3781 (expand_one_truth_if): New.
3782 (add_var_to_bind): New helper.
3783 (coro_build_add_if_not_cond_break): New helper.
3784 (await_statement_walker): Handle conditional expressions,
3785 handle expansion of truth-and/or-if cases.
3786 (bind_expr_find_in_subtree): New, checking-only.
3787 (coro_body_contains_bind_expr_p): New, checking-only.
3788 (morph_fn_to_coro): Ensure that we have a top level bind
3791 2020-04-22 Jonathan Wakely <jwakely@redhat.com>
3793 PR translation/94698
3794 * class.c (check_field_decls): Change "define" to "declare" in
3795 -Weffc++ diagnostics.
3797 2020-04-22 Patrick Palka <ppalka@redhat.com>
3801 * constraint.cc (satisfy_declaration_constraints): If the inherited
3802 constructor points to an instantiation of a constructor template,
3803 remember and use its attached template arguments.
3805 2020-04-22 Jonathan Wakely <jwakely@redhat.com>
3807 PR translation/94698
3808 * class.c (check_field_decls): Change "override" to "define" in
3809 -Weffc++ diagnostics.
3811 2020-04-22 Iain Sandoe <iain@sandoe.co.uk>
3814 * coroutines.cc (struct param_info): Add a field to note that
3815 the param is 'this'.
3816 (morph_fn_to_coro): Convert this to a reference before using it
3817 in the promise parameter preview.
3819 2020-04-22 Jason Merrill <jason@redhat.com>
3822 * pt.c (register_parameter_specializations): If the instantiation is
3823 still a parameter pack, don't wrap it in a NONTYPE_ARGUMENT_PACK.
3824 (tsubst_pack_expansion, tsubst_expr): Adjust.
3826 2020-04-22 Martin Sebor <msebor@redhat.com>
3827 Jason Merrill <jason@redhat.com>
3830 * decl.c (reshape_init_array_1): Avoid stripping redundant trailing
3831 zero initializers...
3832 * mangle.c (write_expression): ...and handle them here even for
3833 pointers to members by calling zero_init_expr_p.
3834 * cp-tree.h (zero_init_expr_p): Declare.
3835 * tree.c (zero_init_expr_p): Define.
3836 (type_initializer_zero_p): Remove.
3837 * pt.c (tparm_obj_values): New hash_map.
3838 (get_template_parm_object): Store to it.
3839 (tparm_object_argument): New.
3841 2020-04-22 Patrick Palka <ppalka@redhat.com>
3844 * constraint.cc (diagnose_valid_expression): Check convert_to_void here
3845 as well as in tsubst_valid_expression_requirement.
3847 2020-04-21 Patrick Palka <ppalka@redhat.com>
3850 * constraint.cc (satisfy_declaration_constraints): Don't strip the
3851 inherited constructor if it already has template information.
3854 * pt.c (any_template_parm_r) <case IDENTIFIER_NODE>: New case. If this
3855 is a conversion operator, visit its TREE_TYPE.
3857 2020-04-21 Nathan Sidwell <nathan@acm.org>
3859 * pt.c (tsubst_copy_and_build) [POINTER_PLUS_EXPR]: Check for
3862 2020-04-21 Iain Sandoe <iain@sandoe.co.uk>
3865 * coroutines.cc (morph_fn_to_coro): Simplify return
3868 2020-04-17 Marek Polacek <polacek@redhat.com>
3871 * constexpr.c (cxx_eval_outermost_constant_expr): Return when T is
3872 a BRACE_ENCLOSED_INITIALIZER_P.
3873 (is_nondependent_constant_expression): Don't check
3874 BRACE_ENCLOSED_INITIALIZER_P.
3875 (is_nondependent_static_init_expression): Likewise.
3877 2020-04-20 Patrick Palka <ppalka@redhat.com>
3880 * cp-tree.h (lss_policy::lss_nop): New enumerator.
3881 * pt.c (local_specialization_stack::local_specialization_stack): Handle
3883 (local_specialization_stack::~local_specialization_stack): Likewise.
3884 (tsubst_pack_expansion): Use a local_specialization_stack instead of
3885 manually saving and restoring local_specializations. Conditionally
3886 replace local_specializations sooner, before the handling of the
3887 unsubstituted_packs case.
3889 2020-04-20 Marek Polacek <polacek@redhat.com>
3891 PR c++/94505 - bogus -Wparentheses warning with fold-expression.
3892 * pt.c (fold_expression): Add warning_sentinel for -Wparentheses
3893 before calling build_x_binary_op.
3895 2020-04-20 Marek Polacek <polacek@redhat.com>
3897 * coroutines.cc (captures_temporary): Don't assign the result of
3898 STRIP_NOPS to the same variable.
3900 2020-04-20 Nathan Sidwell <nathan@acm.org>
3902 PR c++/94454 - tpl-tpl-parms are not canonicalizable types
3903 * pt.c (canonical_type_parameter): Assert not a tpl-tpl-parm.
3904 (process_template_parm): tpl-tpl-parms are structural.
3905 (rewrite_template_parm): Propagate structuralness.
3907 PR c++/94454 - Expr pack expansion equality
3908 * tree.c (cp_tree_equal) [TEMPLATE_ID_EXPR, default]: Refactor.
3909 [EXPR_PACK_EXPANSION]: Add.
3911 PR c++/94454 Template Argument Hashing
3912 * pt.c (iterative_hash_template_arg): Strip nodes as
3913 template_args_equal does.
3914 [ARGUMENT_PACK_SELECT, TREE_VEC, CONSTRUCTOR]: Refactor.
3915 [node_class:TEMPLATE_TEMPLATE_PARM]: Hash by level & index.
3916 [node_class:default]: Refactor.
3918 2020-04-18 Patrick Palka <ppalka@redhat.com>
3921 * tree.c (cp_tree_equal) <case PARM_DECL>: Ignore
3922 comparing_specializations if the parameters' contexts are identical.
3925 * pt.c (splice_late_return_type): Propagate cv-qualifiers and
3926 PLACEHOLDER_TYPE_CONSTRAINTS from the original auto node to the new one.
3928 2020-04-17 Patrick Palka <ppalka@redhat.com>
3931 * lambda.c (lambda_capture_field_type): Avoid doing auto deduction if
3932 the explicit initializer has parameter packs.
3935 * parser.c (cp_parser_check_template_parameters): Before issuing a hard
3936 error, first try simulating an error instead.
3938 2020-04-17 Jakub Jelinek <jakub@redhat.com>
3941 * call.c (build_conditional_expr_1): Remove redundant assignment to
3944 2020-04-16 Patrick Palka <ppalka@redhat.com>
3947 * cvt.c (ocp_convert): If the result of scalar_constant_value is
3948 erroneous, ignore it and use the original expression.
3950 2020-04-16 Jakub Jelinek <jakub@redhat.com>
3953 * parser.c (cp_parser_simple_declaration): Fix up a pasto in
3956 2020-04-15 Jakub Jelinek <jakub@redhat.com>
3959 * parser.c (cp_parser_pragma) <case PRAGMA_OMP_REQUIRES>: Reject
3960 requires directive when not at file or namespace scope.
3962 2020-04-14 Iain Sandoe <iain@sandoe.co.uk>
3965 * coroutines.cc (build_actor_fn): Check that the target can
3966 support the resume tailcall before mandating it.
3968 2020-04-14 Patrick Palka <ppalka@redhat.com>
3971 * cxx-pretty-print.c (cxx_pretty_printer:simple_type_specifier)
3972 <case DECLTYPE_TYPE>: Handle DECLTYPE_TYPE here instead of ...
3973 (pp_cxx_type_specifier_seq) <case DECLTYPE_TYPE>: ... here.
3974 (cxx_pretty_printer::direct_abstract_declarator) <case DECLTYPE_TYPE>:
3978 * constexpr.c (replace_result_decl_data): New struct.
3979 (replace_result_decl_data_r): New function.
3980 (replace_result_decl): New function.
3981 (cxx_eval_call_expression): Use it.
3982 * tree.c (build_aggr_init_expr): Set the location of the AGGR_INIT_EXPR
3983 to that of its initializer.
3985 2020-04-13 Marek Polacek <polacek@redhat.com>
3988 * name-lookup.c (check_local_shadow): Add an inform call.
3990 2020-04-13 Patrick Palka <ppalka@redhat.com>
3993 * error.c (dump_scope): Pass TFF_NO_FUNCTION_ARGUMENTS to
3994 dump_function_decl when printing a function template instantiation as a
3998 * constexpr.c (get_or_insert_ctor_field): Set default value of parameter
4000 (cxx_eval_bare_aggregate): Use get_or_insert_ctor_field instead of
4001 assuming the the next index belongs at the end of the new CONSTRUCTOR.
4002 (cxx_eval_store_expression): Revert PR c++/78572 fix.
4004 2020-04-13 Nathan Sidwell <nathan@acm.org>
4006 PR c++/94426 lambdas with internal linkage are different to no-linkage
4007 * decl2.c (determine_visibility): A lambda's visibility is
4008 affected by its extra scope.
4009 * pt.c (instantiate_decl): Determine var's visibility before
4010 instantiating its initializer.
4011 * tree.c (no_linkage_check): Revert code looking at visibility of
4012 lambda's extra scope.
4014 2020-04-10 Iain Sandoe <iain@sandoe.co.uk>
4017 * coroutines.cc (co_await_expander): Remove.
4018 (expand_one_await_expression): New.
4019 (process_one_statement): New.
4020 (await_statement_expander): New.
4021 (build_actor_fn): Revise to use per-statement expander.
4022 (struct susp_frame_data): Reorder and comment.
4023 (register_awaits): Factor code.
4024 (replace_statement_captures): New, factored from...
4025 (maybe_promote_captured_temps):.. here.
4026 (await_statement_walker): Revise to process per statement.
4027 (morph_fn_to_coro): Use revised susp_frame_data layout.
4029 2020-04-10 Marek Polacek <polacek@redhat.com>
4032 * method.c (constructible_expr): In C++20, try using parenthesized
4033 initialization of aggregates to determine the result of
4036 2020-04-10 Bin Cheng <bin.cheng@linux.alibaba.com>
4038 * coroutines.cc (co_await_expander): Simplify.
4040 2020-04-09 Jason Merrill <jason@redhat.com>
4043 * constexpr.c (cxx_eval_constant_expression) [VAR_DECL]: Look at
4044 ctx->object and ctx->global->values first.
4046 2020-04-09 Marek Polacek <polacek@redhat.com>
4049 * call.c (initialize_reference): If the reference binding failed, maybe
4050 try initializing from { }.
4051 * decl.c (grok_reference_init): For T& t(e), set
4052 LOOKUP_AGGREGATE_PAREN_INIT but don't build up a constructor yet.
4054 2020-04-08 Iain Sandoe <iain@sandoe.co.uk>
4055 Jun Ma <JunMa@linux.alibaba.com>
4057 * coroutines.cc (maybe_promote_captured_temps): Add a cleanup
4058 expression, if needed, to any call from which we promoted
4059 temporaries captured by reference.
4061 2020-04-08 Marek Polacek <polacek@redhat.com>
4063 PR c++/94507 - ICE-on-invalid with lambda template.
4064 * pt.c (tsubst_lambda_expr): Cope when tsubst_template_decl or
4065 tsubst_function_decl returns error_mark_node.
4067 2020-04-08 Martin Liska <mliska@suse.cz>
4070 * decl.c (duplicate_decls): Duplicate also DECL_IS_REPLACEABLE_OPERATOR.
4071 (cxx_init_decl_processing): Mark replaceable all implicitly defined
4074 2020-04-08 Patrick Palka <ppalka@redhat.com>
4076 Core issues 1001 and 1322
4078 * pt.c (rebuild_function_or_method_type): Split function out from ...
4079 (tsubst_function_type): ... here.
4080 (maybe_rebuild_function_decl_type): New function.
4081 (tsubst_function_decl): Use it.
4083 2020-04-08 Jakub Jelinek <jakub@redhat.com>
4086 * decl.c (begin_destructor_body): For CLASSTYPE_VBASECLASSES class
4087 dtors, if CLASSTYPE_PRIMARY_BINFO is non-NULL, but not BINFO_VIRTUAL_P,
4088 look at CLASSTYPE_PRIMARY_BINFO of its BINFO_TYPE if it is not
4089 BINFO_VIRTUAL_P, and so on.
4091 2020-04-08 Marek Polacek <polacek@redhat.com>
4093 PR c++/94478 - ICE with defaulted comparison operator
4094 * method.c (early_check_defaulted_comparison): Give an error when the
4097 2020-04-08 Tobias Burnus <tobias@codesourcery.com>
4100 * paser.c (cp_parser_oacc_declare): Add check that variables
4101 are declared in the same scope as the directive.
4103 2020-04-07 Jason Merrill <jason@redhat.com>
4106 * parser.c (cp_parser_requires_expression): Use tentative_firewall.
4109 * parser.c (cp_parser_placeholder_type_specifier): Use
4112 2020-04-07 Iain Sandoe <iain@sandoe.co.uk>
4114 * coroutines.cc (maybe_promote_captured_temps): Ensure that
4115 reference capture placeholder vars are properly declared.
4117 2020-04-07 Patrick Palka <ppalka@redhat.com>
4120 * tree.c (replace_placeholders): Look through all handled components,
4121 not just COMPONENT_REFs.
4122 * typeck2.c (process_init_constructor_array): Propagate
4123 CONSTRUCTOR_PLACEHOLDER_BOUNDARY up from each element initializer to
4124 the array initializer.
4126 2020-04-07 Jakub Jelinek <jakub@redhat.com>
4129 * parser.c (cp_parser_omp_parallel): Set OMP_PARALLEL_COMBINED
4130 if cp_parser_omp_master succeeded.
4132 2020-04-06 Jason Merrill <jason@redhat.com>
4135 * decl.c (duplicate_decls): Fix handling of DECL_HIDDEN_FRIEND_P.
4137 2020-04-04 Marek Polacek <polacek@redhat.com>
4138 Jason Merrill <jason@redhat.com>
4140 PR c++/94155 - crash in gimplifier with paren init of aggregates.
4141 * init.c (build_vec_init): Fill in indexes.
4143 2020-04-04 Jason Merrill <jason@redhat.com>
4146 * mangle.c (write_expression): Skip IMPLICIT_CONV_EXPR.
4148 2020-04-04 Patrick Palka <ppalka@redhat.com>
4152 * constexpr.c (struct constexpr_ctx): New field 'parent'.
4153 (cxx_eval_bare_aggregate): Propagate CONSTRUCTOR_PLACEHOLDER_BOUNDARY
4154 flag from the original constructor to the reduced constructor.
4155 (lookup_placeholder): Prefer to return the outermost matching object
4156 by recursively calling lookup_placeholder on the 'parent' context,
4157 but don't cross CONSTRUCTOR_PLACEHOLDER_BOUNDARY constructors.
4158 (cxx_eval_constant_expression): Link the 'ctx' context to the 'new_ctx'
4159 context via 'new_ctx.parent' when being expanded without an explicit
4160 target. Don't call replace_placeholders.
4161 (cxx_eval_outermost_constant_expr): Initialize 'ctx.parent' to NULL.
4165 * constexpr.c (get_or_insert_ctor_field): Split out (while adding
4166 support for VECTOR_TYPEs, and optimizations for the common case)
4168 (cxx_eval_store_expression): ... here. Rename local variable
4169 'changed_active_union_member_p' to 'activated_union_member_p'. Record
4170 the sequence of indexes into 'indexes' that yields the subobject we're
4171 assigning to. Record the integer offsets of the constructor indexes
4172 we're assigning through into 'index_pos_hints'. After evaluating the
4173 initializer of the store expression, recompute 'valp' using 'indexes'
4174 and using 'index_pos_hints' as hints.
4175 (cxx_eval_bare_aggregate): Tweak comments. Use get_or_insert_ctor_field
4176 to recompute the constructor_elt pointer we're assigning through after
4177 evaluating each initializer.
4179 2020-04-04 Jason Merrill <jason@redhat.com>
4182 * constraint.cc (tsubst_valid_expression_requirement): Call
4185 2020-04-04 Jason Merrill <jason@redhat.com>
4188 * constexpr.c (maybe_constant_value): Use break_out_target_exprs.
4189 * expr.c (mark_use) [VIEW_CONVERT_EXPR]: Don't wrap a TARGET_EXPR in
4192 2020-04-04 Jakub Jelinek <jakub@redhat.com>
4195 * parser.c (cp_parser_omp_for_loop): Use
4196 protected_set_expr_location_if_unset.
4197 * cp-gimplify.c (genericize_if_stmt, genericize_cp_loop): Likewise.
4200 * pt.c (tsubst_expr) <case OMP_MASTER>: Clear
4201 omp_parallel_combined_clauses.
4203 2020-04-03 Jason Merrill <jason@redhat.com>
4206 * pt.c (complex_pack_expansion_r): New.
4207 (complex_alias_template_p): Use it.
4209 2020-03-31 Jason Merrill <jason@redhat.com>
4212 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Call
4213 replace_placeholders.
4214 * typeck2.c (store_init_value): Fix arguments to
4215 fold_non_dependent_expr.
4217 2020-03-31 Jason Merrill <jason@redhat.com>
4219 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Use
4222 2020-03-30 Jason Merrill <jason@redhat.com>
4225 * tree.c (cp_tree_equal) [CALL_EXPR]: Compare KOENIG_LOOKUP_P.
4226 (called_fns_equal): Check DECL_CONTEXT.
4228 2020-03-30 Jakub Jelinek <jakub@redhat.com>
4231 * semantics.c (add_stmt): Only set STMT_IS_FULL_EXPR_P on trees with
4232 STATEMENT_CODE_P code.
4234 2020-03-28 Patrick Palka <ppalka@redhat.com>
4237 * parser.c (cp_parser_requires_clause_opt): Diagnose and recover from
4238 "requires {" when "requires requires {" was probably intended.
4241 * constraint.cc (tsubst_compound_requirement): Always suppress errors
4242 from type_deducible_p and expression_convertible_p, as they're not
4243 substitution errors.
4244 (diagnose_atomic_constraint) <case INTEGER_CST>: Remove this case so
4245 that we diagnose INTEGER_CST expressions of non-bool type via the
4247 * cp-gimplify.c (cp_genericize_r) <case REQUIRES_EXPR>: New case.
4248 * parser.c (cp_parser_requires_expression): Always parse the requirement
4249 body as if we're processing a template, by temporarily incrementing
4250 processing_template_decl. Afterwards, if we're not actually in a
4251 template context, perform semantic processing to diagnose any invalid
4252 types and expressions.
4253 * pt.c (tsubst_copy_and_build) <case REQUIRES_EXPR>: Remove dead code.
4254 * semantics.c (finish_static_assert): Explain an assertion failure
4255 when the condition is a REQUIRES_EXPR like we do when it is a concept
4258 * constraint.cc (diagnose_compound_requirement): When diagnosing a
4259 compound requirement, maybe replay the satisfaction failure, subject to
4260 the current diagnosis depth.
4262 * constraint.cc (finish_constraint_binary_op): Set the location of EXPR
4263 as well as its range, because build_x_binary_op doesn't always do so.
4264 (current_constraint_diagnosis_depth): New.
4265 (concepts_diagnostics_max_depth_exceeded_p): New.
4266 (collect_operands_of_disjunction): New.
4267 (satisfy_disjunction): When diagnosing a satisfaction failure, maybe
4268 replay each branch of the disjunction, subject to the current diagnosis
4270 (diagnose_valid_expression): When diagnosing a satisfaction failure,
4271 maybe replay the substitution error, subject to the current diagnosis
4273 (diagnose_valid_type): Likewise.
4274 (diagnose_nested_requiremnet): Likewise.
4275 (diagnosing_failed_constraint::diagnosing_failed_constraint): Increment
4276 current_constraint_diagnosis_depth when diagnosing.
4277 (diagnosing_failed_constraint::~diagnosing_failed_constraint): Decrement
4278 current_constraint_diagnosis_depth when diagnosing.
4279 (diagnosing_failed_constraint::replay_errors_p): New static member
4281 (diagnose_constraints): Don't diagnose if concepts_diagnostics_max_depth
4282 is 0. Emit a one-off note to increase -fconcepts-diagnostics-depth if
4283 the limit was exceeded.
4284 * cp-tree.h (diagnosing_failed_constraint::replay_errors_p): Declare.
4286 2020-03-27 Nathan Sidwell <nathan@acm.org>
4289 * name-lookup.c (do_pushdecl): Look through cleanp levels.
4291 2020-03-27 Martin Sebor <msebor@redhat.com>
4296 * cp-tree.h (most_specialized_partial_spec): Declare.
4297 * parser.c (cp_parser_elaborated_type_specifier): Distinguish alias
4299 (specialization_of): New function.
4300 (cp_parser_check_class_key): Move code...
4301 (class_decl_loc_t::add): ...to here. Add parameters. Avoid issuing
4302 -Wredundant-tags on first-time declarations in other declarators.
4303 Correct handling of template specializations.
4304 (class_decl_loc_t::diag_mismatched_tags): Also expect to be called
4305 when -Wredundant-tags is enabled. Use primary template or partial
4306 specialization as the guide for uses of implicit instantiations.
4307 * pt.c (most_specialized_partial_spec): Declare extern.
4309 2020-03-27 Nathan Sidwell <nathan@acm.org>
4312 * name-lookup.c (push_namespace): Triage ambiguous lookups that
4315 2020-03-27 Jakub Jelinek <jakub@redhat.com>
4318 * call.c (set_flags_from_callee): Don't update
4319 cp_function_chain->can_throw or current_function_returns_abnormally
4320 if cp_unevaluated_operand.
4323 * cvt.c (ocp_convert): Handle COMPOUND_EXPR by recursion on the second
4324 operand and creating a new COMPOUND_EXPR if anything changed.
4326 2020-03-26 Marek Polacek <polacek@redhat.com>
4328 PR c++/94336 - template keyword accepted before destructor names.
4329 * parser.c (cp_parser_unqualified_id): Give an error when 'template'
4330 is followed by a destructor name.
4332 2020-03-27 Patrick Palka <ppalka@redhat.com>
4334 * decl.c (compute_array_index_type_loc): Remove redundant
4335 type_dependent_expression_p check that is subsumed by
4336 value_dependent_expression_p.
4337 * decl2.c (is_late_template_attribute): Likewise.
4338 * pt.c (uses_template_parms): Likewise.
4339 (dependent_template_arg_p): Likewise.
4341 2020-03-26 Marek Polacek <polacek@redhat.com>
4344 PR c++/94057 - template keyword in a typename-specifier.
4345 * parser.c (check_template_keyword_in_nested_name_spec): New.
4346 (cp_parser_nested_name_specifier_opt): Implement DR1710, optional
4347 'template'. Call check_template_keyword_in_nested_name_spec.
4348 (cp_parser_simple_type_specifier): Assume that a <
4349 following a qualified-id in a typename-specifier begins
4350 a template argument list.
4352 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
4354 * coroutines.cc (coro_init_identifiers): Initialize an identifier
4355 for the cororoutine handle 'address' method name.
4356 (struct coro_aw_data): Add fields to cover the continuations.
4357 (co_await_expander): Determine the kind of await_suspend in use.
4358 If we have the case that returns a continuation handle, then save
4359 this and make the target for 'scope exit without cleanup' be the
4360 continuation resume label.
4361 (expand_co_awaits): Remove.
4362 (struct suspend_point_info): Remove fields that kept the returned
4363 await_suspend handle type.
4364 (transform_await_expr): Remove code tracking continuation handles.
4365 (build_actor_fn): Add the continuation handle as an actor-function
4366 scope var. Build the symmetric transfer continuation point. Call
4367 the tree walk for co_await expansion directly, rather than via a
4368 trivial shim function.
4369 (register_await_info): Remove fields tracking continuation handles.
4370 (get_await_suspend_return_type): Remove.
4371 (register_awaits): Remove code tracking continuation handles.
4372 (morph_fn_to_coro): Remove code tracking continuation handles.
4374 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
4376 * coroutines.cc (co_await_expander): If we are expanding the
4377 initial await expression, set a boolean flag to show that we
4378 have now reached the initial await_resume() method call.
4379 (expand_co_awaits): Handle the 'initial await resume called' flag.
4380 (build_actor_fn): Insert the initial await expression into the
4381 start of the user-authored function-body. Handle the 'initial await
4382 resume called' flag.
4383 (morph_fn_to_coro): Initialise the 'initial await resume called'
4384 flag. Modify the unhandled exception catch clause to recognise
4385 exceptions that occur before the initial await_resume() and re-
4388 2020-03-26 Jakub Jelinek <jakub@redhat.com>
4391 * class.c (user_provided_p): Use STRIP_TEMPLATE instead of returning
4392 true for all TEMPLATE_DECLs.
4395 * cp-gimplify.c (cp_genericize_r): Handle STATEMENT_LIST.
4397 2020-03-25 Patrick Palka <ppalka@redhat.com>
4400 * parser.c (cp_parser_selection_statement) <case RID_IF>: Invalidate the
4401 current condition chain when the if-statement has a non-empty
4404 2020-03-25 Iain Sandoe <iain@sandoe.co.uk>
4407 * coroutines.cc (captures_temporary): Fix a missing dereference.
4409 2020-03-24 Marek Polacek <polacek@redhat.com>
4411 PR c++/94190 - wrong no post-decrement operator error in template.
4412 * call.c (convert_like_real): Use convert_from_reference on the result.
4414 2020-03-24 Jason Merrill <jason@redhat.com>
4417 * constraint.cc (constraint_satisfaction_value): Repeat noisily on
4419 (tsubst_nested_requirement): Likewise.
4420 (get_constraint_error_location): Allow missing context.
4421 (diagnose_atomic_constraint): Diagnose non-bool constraint here.
4422 (satisfy_atom): Not here. Only diagnose non-constant when noisy.
4424 2020-03-24 Jason Merrill <jason@redhat.com>
4426 * pt.c (any_template_parm_r): Look into the type of a non-type
4429 2020-03-24 Jason Merrill <jason@redhat.com>
4431 * cp-tree.h (cp_expr): When constructing from an expr and a
4432 location, call protected_set_expr_location.
4434 2020-03-23 Patrick Palka <ppalka@redhat.com>
4437 * except.c (maybe_noexcept_warning): Add TODO.
4438 * method.c (walk_field_subobs): Pass tf_none to expr_noexcept_p.
4440 2020-03-23 nathans <nathan@acm.org>
4443 * tree.c (cp_tree_equal) [SIZEOF_EXPR]: Detect argument pack
4446 2020-03-21 Patrick Palka <ppalka@redhat.com>
4449 * constexpr.c (reduced_constant_expression_p) [CONSTRUCTOR]: Properly
4450 handle unions without an initializer.
4451 (cxx_eval_component_reference): Emit a different diagnostic when the
4452 constructor element corresponding to a union member is NULL.
4453 (cxx_eval_bare_aggregate): When constructing a union, always set the
4454 active union member before evaluating the initializer. Relax assertion
4455 that verifies the index of the constructor element we're initializing
4456 hasn't been changed.
4457 (cxx_eval_store_expression): Diagnose changing the active union member
4458 while the union is in the process of being initialized. After setting
4459 an active union member, clear CONSTRUCTOR_NO_CLEARING on the underlying
4461 (cxx_eval_constant_expression) [PLACEHOLDER_EXPR]: Don't re-reduce a
4462 CONSTRUCTOR returned by lookup_placeholder.
4464 2020-03-20 Patrick Palka <ppalka@redhat.com>
4466 * cxx-pretty-print.c (pp_cxx_parameter_mapping): Make extern. Move
4467 the "[with ]" bits to here from ...
4468 (pp_cxx_atomic_constraint): ... here.
4469 * cxx-pretty-print.h (pp_cxx_parameter_mapping): Declare.
4470 * error.c (rebuild_concept_check): Delete.
4471 (print_concept_check_info): Print the dependent form of the constraint and the
4472 preferably substituted parameter mapping alongside it.
4474 2020-03-19 Jason Merrill <jason@redhat.com>
4477 * cp-gimplify.c (simple_empty_class_p): Look through
4478 SIMPLE_TARGET_EXPR_P.
4479 (cp_gimplify_expr) [MODIFY_EXPR]: Likewise.
4480 [RETURN_EXPR]: Avoid producing 'return *retval;'.
4481 * call.c (build_call_a): Strip TARGET_EXPR from empty class arg.
4482 * cp-tree.h (SIMPLE_TARGET_EXPR_P): Check that TARGET_EXPR_INITIAL
4485 2020-03-19 Jakub Jelinek <jakub@redhat.com>
4488 * parser.c (cp_parser_omp_var_list_no_open): Call process_outer_var_ref
4489 on outer_automatic_var_p decls.
4490 * cp-gimplify.c (cxx_omp_disregard_value_expr): Return true also for
4491 capture proxy decls.
4493 2020-03-18 Nathan Sidwell <nathan@acm.org>
4495 PR c++/94147 - mangling of lambdas assigned to globals
4496 * parser.c (cp_parser_init_declarator): Namespace-scope variables
4497 provide a lambda scope.
4498 * tree.c (no_linkage_check): Lambdas with a variable for extra
4499 scope have a linkage from the variable.
4501 2020-03-18 Jakub Jelinek <jakub@redhat.com>
4503 * constraint.cc (resolve_function_concept_check, subsumes_constraints,
4504 strictly_subsumes): Fix up duplicated word issue in a comment.
4505 * coroutines.cc (build_init_or_final_await, captures_temporary):
4507 * logic.cc (dnf_size_r, cnf_size_r): Likewise.
4508 * pt.c (append_type_to_template_for_access_check): Likewise.
4511 * decl.c (grokfndecl): Restore old diagnostics about deduction
4512 guide declared in different scope if in_namespace is NULL_TREE.
4514 2020-03-17 Jakub Jelinek <jakub@redhat.com>
4517 * parser.c (cp_parser_enum_specifier): Use temp_override for
4518 parser->colon_corrects_to_scope_p, replace goto out with return.
4519 If scoped enum or enum with underlying type is not followed by
4520 { or ;, call cp_parser_commit_to_tentative_parse before calling
4521 cp_parser_error and make sure to return error_mark_node instead of
4522 NULL_TREE. Formatting fixes.
4524 2020-03-17 Ville Voutilainen <ville.voutilainen@gmail.com>
4527 * method.c (assignable_expr): Use cp_unevaluated.
4528 (is_xible_helper): Push a non-deferred access check for
4529 the stub objects created by assignable_expr and constructible_expr.
4531 2020-03-17 Jakub Jelinek <jakub@redhat.com>
4533 * pt.c (tsubst): Fix up duplicated word issue in a diagnostic message.
4534 (lookup_template_class_1, tsubst_expr): Fix up duplicated word issue
4536 * parser.c (cp_parser_statement, cp_parser_linkage_specification,
4537 cp_parser_placeholder_type_specifier,
4538 cp_parser_constraint_requires_parens): Likewise.
4539 * name-lookup.c (suggest_alternative_in_explicit_scope): Likewise.
4541 2020-03-15 Iain Sandoe <iain@sandoe.co.uk>
4543 * coroutines.cc (co_await_expander): Fix indentation.
4545 2020-03-14 Jason Merrill <jason@redhat.com>
4548 * pt.c (process_partial_specialization): Error rather than crash on
4549 extra pack expansion.
4551 2020-03-14 Jason Merrill <jason@redhat.com>
4554 * pt.c (find_parameter_packs_r): [DECL_EXPR]: Walk
4555 DECL_ORIGINAL_TYPE of a typedef.
4557 2020-03-14 Jason Merrill <jason@redhat.com>
4560 * pt.c (build_deduction_guide): Clear cp_unevaluated_operand for
4561 substituting DECL_ARGUMENTS.
4563 2020-03-14 Jakub Jelinek <jakub@redhat.com>
4565 * logic.cc (formula::formula): Change "a an" to "an" in a comment.
4566 * parser.c (cp_debug_parser): Change "a an" to "an" in a string
4569 2020-03-13 Patrick Palka <ppalka@redhat.com>
4572 * call.c (build_over_call): Use a warning_sentinel to disable
4573 warn_deprecated_decl before calling build_addr_func.
4575 2020-03-12 Jakub Jelinek <jakub@redhat.com>
4578 * decl.c (reshape_init_array_1): Don't unshare constructor if there
4579 aren't any trailing zero elts, otherwise only unshare the first
4582 2020-03-11 Jason Merrill <jason@redhat.com>
4585 * constraint.cc (tsubst_parameter_mapping): Canonicalize type
4588 2020-03-11 Marek Polacek <polacek@redhat.com>
4589 Jason Merrill <jason@redhat.com>
4591 PR c++/94074 - wrong modifying const object error for COMPONENT_REF.
4592 * constexpr.c (cref_has_const_field): New function.
4593 (modifying_const_object_p): Consider a COMPONENT_REF
4594 const only if any of its fields are const.
4595 (cxx_eval_store_expression): Mark a CONSTRUCTOR of a const type
4596 as readonly after its initialization has been done.
4598 2020-03-10 Marek Polacek <polacek@redhat.com>
4600 PR c++/94124 - wrong conversion error with non-viable overload.
4601 * decl.c (reshape_init_array_1): Unshare a constructor if we
4602 stripped trailing zero-initializers.
4604 2020-03-10 Jason Merrill <jason@redhat.com>
4607 * pt.c (maybe_instantiate_noexcept): Always update clones.
4609 2020-03-10 Jason Merrill <jason@redhat.com>
4612 * pt.c (maybe_aggr_guide): Check BRACE_ENCLOSED_INITIALIZER_P.
4614 2020-03-10 Jason Merrill <jason@redhat.com>
4620 * cp-gimplify.c (cp_gimplify_init_expr): Partially revert patch for
4621 66139: Don't split_nonconstant_init. Remove pre_p parameter.
4623 2020-03-09 Marek Polacek <polacek@redhat.com>
4625 PR c++/92031 - bogus taking address of rvalue error.
4626 PR c++/91465 - ICE with template codes in check_narrowing.
4627 PR c++/93870 - wrong error when converting template non-type arg.
4628 PR c++/94068 - ICE with template codes in check_narrowing.
4629 * call.c (convert_like_real): Return IMPLICIT_CONV_EXPR
4630 in a template when not ck_identity and we're dealing with a class.
4631 (convert_like_real) <case ck_ref_bind>: Return IMPLICIT_CONV_EXPR
4632 in a template if we need a temporary.
4633 * decl.c (compute_array_index_type_loc): Remove
4634 instantiate_non_dependent_expr_sfinae call. Call
4635 fold_non_dependent_expr instead of maybe_constant_value.
4636 (build_explicit_specifier): Don't instantiate or create a sentinel
4637 before converting the expression.
4638 * except.c (build_noexcept_spec): Likewise.
4639 * pt.c (convert_nontype_argument): Don't build IMPLICIT_CONV_EXPR.
4640 Set IMPLICIT_CONV_EXPR_NONTYPE_ARG if that's what
4641 build_converted_constant_expr returned.
4642 * typeck2.c (check_narrowing): Call fold_non_dependent_expr instead
4643 of maybe_constant_value.
4645 2020-03-09 Jakub Jelinek <jakub@redhat.com>
4649 2019-10-11 Paolo Carlini <paolo.carlini@oracle.com>
4651 * constexpr.c (cxx_eval_constant_expression): Do not handle
4652 RROTATE_EXPR and LROTATE_EXPR.
4654 2020-03-09 Marek Polacek <polacek@redhat.com>
4656 PR c++/94050 - ABI issue with alignas on armv7hl.
4657 * class.c (layout_class_type): Don't replace a class's
4658 CLASSTYPE_AS_BASE if their TYPE_USER_ALIGN don't match.
4660 2020-03-09 Bin Cheng <bin.cheng@linux.alibaba.com>
4662 * coroutines.cc (build_actor_fn): Factor out code inserting the
4663 default return_void call to...
4664 (morph_fn_to_coro): ...here, also hoist local var declarations.
4666 2020-03-08 Patrick Palka <ppalka@redhat.com>
4669 * call.c (convert_like_real): Check complain before emitting an error
4670 about binding a bit-field to a reference.
4672 * cxx-pretty-print.c (cxx_pretty_printer::simple_type_specifier)
4673 [TYPENAME_TYPE]: Print the TYPENAME_TYPE_FULLNAME instead of the
4676 2020-03-06 Nathan Sidwell <nathan@acm.org>
4679 * mangle.c (find_substitution): Don't call same_type_p on template
4680 args that cannot match.
4682 2020-03-04 Martin Sebor <msebor@redhat.com>
4685 * tree.c (type_initializer_zero_p): Fail for structs initialized
4688 2020-03-04 Jason Merrill <jason@redhat.com>
4691 * init.c (perform_member_init): Don't do aggregate initialization of
4693 * constexpr.c (cx_check_missing_mem_inits): Don't enforce
4694 initialization of empty field.
4696 2020-03-04 Martin Liska <mliska@suse.cz>
4698 * method.c: Wrap array in ctor with braces in order
4699 to silent clang warnings.
4701 2020-03-03 Jason Merrill <jason@redhat.com>
4702 Marek Polacek <polacek@redhat.com>
4704 PR c++/90505 - mismatch in template argument deduction.
4705 * pt.c (tsubst): Don't reduce the template level of template
4706 parameters when tf_partial.
4708 2020-03-03 Jakub Jelinek <jakub@redhat.com>
4711 * constexpr.c (cxx_eval_constant_expression)
4712 <case TARGET_EXPR, case SAVE_EXPR>: Don't record anything if
4713 *non_constant_p is true.
4715 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
4717 * coroutines.cc (captures_temporary): Strip component_ref
4720 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
4722 * coroutines.cc (finish_co_await_expr): Build co_await_expr
4723 with unknown_type_node.
4724 (finish_co_yield_expr): Ditto.
4725 *pt.c (type_dependent_expression_p): Set co_await/yield_expr
4726 with unknown type as dependent.
4728 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
4730 * coroutines.cc (struct local_var_info): Adjust to remove the
4731 reference to the captured var, and just to note that this is a
4732 lambda capture proxy.
4733 (transform_local_var_uses): Handle lambda captures specially.
4734 (struct param_frame_data): Add a visited set.
4735 (register_param_uses): Also check for param uses in lambda
4737 (struct local_vars_frame_data): Remove captures list.
4738 (register_local_var_uses): Handle lambda capture proxies by
4739 noting and bypassing them.
4740 (morph_fn_to_coro): Update to remove lifetime extension of
4741 lambda capture-by-copy vars.
4743 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
4745 * coroutines.cc (build_co_await): Do not build frame
4746 awaitable proxy vars when the co_await expression is
4747 a function parameter or local var.
4748 (co_await_expander): Do not initialise a frame var with
4750 (transform_await_expr): Only substitute the awaitable
4751 frame var if it's needed.
4752 (register_awaits): Do not make frame copies for param
4753 or local vars that are awaitables.
4755 2020-02-28 Jason Merrill <jason@redhat.com>
4757 Implement P2092R0, Disambiguating Nested-Requirements
4758 * parser.c (cp_parser_requirement_parameter_list): Pass
4759 CP_PARSER_FLAGS_TYPENAME_OPTIONAL.
4761 * call.c (build_user_type_conversion_1): Don't look at the second
4762 conversion of a non-viable candidate.
4764 2020-02-28 Jakub Jelinek <jakub@redhat.com>
4766 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
4767 * typeck.c (cp_build_addr_expr_1): Allow taking address of immediate
4768 functions in unevaluated contexts.
4770 2020-02-27 Nathan Sidwell <nathan@acm.org>
4773 * pt.c (template_args_equal): Pass ARGUMENT_PACKS through to
4775 * tree.c (cp_tree_equal): Compare ARGUMENT_PACKS here,
4776 * typeck.c (comptypes): Assert we don't get any argument packs.
4778 * class.c (adjust_clone_args): Correct arg-checking assert.
4779 * typeck.c (comptypes): Assert not nulls.
4781 2020-02-26 Marek Polacek <polacek@redhat.com>
4783 PR c++/93789 - ICE with invalid array bounds.
4784 * decl.c (compute_array_index_type_loc): Don't use the folded
4785 size when folding cleared TREE_CONSTANT.
4787 2020-02-26 Iain Sandoe <iain@sandoe.co.uk>
4789 * class.c (classtype_has_non_deleted_copy_ctor): New.
4790 * coroutines.cc (struct param_info): Keep track of params
4791 that are references, and cache the original type and whether
4792 the DTOR is trivial.
4793 (build_actor_fn): Handle param copies always, and adjust the
4794 handling for references.
4795 (register_param_uses): Only handle uses here.
4796 (classtype_has_non_deleted_copy_ctor): New.
4797 (morph_fn_to_coro): Adjust param copy handling to match n4849
4798 by reordering ahead of the promise CTOR and always making a
4799 frame copy, even if the param is unused in the coroutine body.
4800 * cp-tree.h (classtype_has_non_deleted_copy_ctor): New.
4802 2020-02-26 Patrick Palka <ppalka@redhat.com>
4804 * constraint.cc (finish_constraint_binary_op): Set expr's location range
4805 to the range of its operands.
4806 (satisfy_atom): Pass MAP instead of ARGS to diagnose_atomic_constraint.
4807 (diagnose_trait_expr): Take the instantiated parameter mapping MAP
4808 instead of the corresponding template arguments ARGS and adjust body
4810 (diagnose_requires_expr): Likewise.
4811 (diagnose_atomic_constraint): Likewise. When printing an atomic
4812 constraint expression, print the instantiated parameter mapping
4814 * cxx-pretty-print.cc (cxx_pretty_printer::expression)
4815 [NONTYPE_ARGUMENT_PACK]: Print braces around a NONTYPE_ARGUMENT_PACK.
4816 (cxx_pretty_printer::type_id): Handle TYPE_ARGUMENT_PACK.
4818 2020-02-26 Marek Polacek <polacek@redhat.com>
4820 PR c++/93676 - value-init crash in template.
4821 * init.c (build_new_1): Don't call build_vec_init in a template.
4823 2020-02-26 Marek Polacek <polacek@redhat.com>
4825 PR c++/93862 - ICE with static_cast when converting from int[].
4826 * call.c (reference_compatible_p): No longer static.
4827 * cp-tree.h (reference_compatible_p): Declare.
4828 * typeck.c (build_static_cast_1): Use reference_compatible_p instead
4829 of reference_related_p.
4831 2020-02-26 Marek Polacek <polacek@redhat.com>
4833 PR c++/93803 - ICE with constexpr init and [[no_unique_address]].
4834 * constexpr.c (reduced_constant_expression_p): Don't crash on a null
4837 2020-02-24 Martin Sebor <msebor@redhat.com>
4840 * parser.c (cp_parser_check_class_key): Avoid issuing -Wredundant-tags
4841 in shared C/C++ code in headers.
4842 Remove a duplicate hunk of code.
4844 2020-02-24 Marek Polacek <polacek@redhat.com>
4846 PR c++/93869 - ICE with -Wmismatched-tags.
4847 * parser.c (cp_parser_check_class_key): Check class_key earlier.
4849 2020-02-24 Marek Polacek <polacek@redhat.com>
4851 PR c++/93712 - ICE with ill-formed array list-initialization.
4852 * call.c (next_conversion): Return NULL for ck_aggr.
4853 (build_aggr_conv): Set u.expr instead of u.next.
4854 (build_array_conv): Likewise.
4855 (build_complex_conv): Likewise.
4856 (conv_get_original_expr): Handle ck_aggr.
4858 2020-02-24 Jakub Jelinek <jakub@redhat.com>
4860 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
4861 * call.c (build_over_call): Don't evaluate immediate functions in
4862 unevaluated operands.
4864 2020-02-24 Jason Merrill <jason@redhat.com>
4866 P0780R2: Resolve lambda init-capture pack grammar.
4867 * parser.c (cp_parser_lambda_introducer): Expect &...x=y rather than
4870 2020-02-22 Marek Polacek <polacek@redhat.com>
4873 * decl.c (grokdeclarator): Use %qs in a diagnostic message.
4875 2020-02-21 Martin Sebor <msebor@redhat.com>
4877 PR gcov-profile/93753
4878 * class.c (check_flexarrays): Tighten up a test for potential members
4879 of anonymous structs or unions.
4881 2020-02-20 Martin Sebor <msebor@redhat.com>
4884 * parser.c (cp_parser_check_class_key): Only handle true C++ class-keys.
4886 2020-02-20 Martin Liska <mliska@suse.cz>
4888 PR translation/93841
4889 * config/or1k/or1k.opt: Remove superfluous word.
4890 * doc/invoke.texi: Likewise.
4892 2020-02-20 Martin Liska <mliska@suse.cz>
4894 PR translation/93838
4895 * parser.c (cp_parser_decl_specifier_seq): Remove trailing space.
4897 2020-02-19 Marek Polacek <polacek@redhat.com>
4899 PR c++/93169 - wrong-code with a non-constexpr constructor.
4900 * constexpr.c (cxx_eval_call_expression): Only set TREE_READONLY
4901 on constant CONSTRUCTORs.
4903 2020-02-15 Marek Polacek <polacek@redhat.com>
4905 PR c++/93710 - poor diagnostic for array initializer.
4906 * call.c (build_user_type_conversion_1): Use cp_expr_loc_or_input_loc
4909 2020-02-15 Jason Merrill <jason@redhat.com>
4912 * pt.c (any_template_parm_r): Look into lambda body.
4915 * pt.c (any_template_parm_r): Remove CONSTRUCTOR handling.
4917 2020-02-14 Jakub Jelinek <jakub@redhat.com>
4920 * class.c (enum_min_precision): Change prec type from int to int &.
4923 * cp-tree.h (enum cp_tree_index): Add CPTI_FALLBACK_DFLOAT32_TYPE,
4924 CPTI_FALLBACK_DFLOAT64_TYPE and CPTI_FALLBACK_DFLOAT128_TYPE.
4925 (fallback_dfloat32_type, fallback_dfloat64_type,
4926 fallback_dfloat128_type): Define.
4927 * mangle.c (write_builtin_type): Handle fallback_dfloat*_type like
4929 * rtti.c (emit_support_tinfos): Emit DFP typeinfos even when dfp
4930 is disabled for compatibility.
4932 2020-02-13 Jason Merrill <jason@redhat.com>
4935 * name-lookup.c (matching_fn_p): A function does not match a
4940 * tree.c (decl_linkage): Always lk_none for locals.
4942 2020-02-12 Jason Merrill <jason@redhat.com>
4946 * tree.c (cp_walk_subtrees): Walk CONSTRUCTOR types here.
4947 * pt.c (find_parameter_packs_r): Not here.
4949 2020-02-12 Iain Sandoe <iain@sandoe.co.uk>
4951 * coroutines.cc (build_actor_fn): Implement deallocation function
4952 selection per n4849, dcl.fct.def.coroutine bullet 12.
4953 (morph_fn_to_coro): Implement allocation function selection per
4954 n4849, dcl.fct.def.coroutine bullets 9 and 10.
4956 2020-02-12 Marek Polacek <polacek@redhat.com>
4958 PR c++/93684 - ICE-on-invalid with broken attribute.
4959 * parser.c (cp_parser_std_attribute): Peek a token first before
4962 2020-02-11 Jason Merrill <jason@redhat.com>
4965 * class.c (add_implicitly_declared_members): Use do_friend.
4966 * method.c (implicitly_declare_fn): Fix friend handling.
4967 (decl_remember_implicit_trigger_p): New.
4968 (synthesize_method): Use it.
4969 * decl2.c (mark_used): Use it.
4971 2020-02-11 Jason Merrill <jason@redhat.com>
4975 * constexpr.c (maybe_constant_value): Correct earlier change.
4976 (cxx_eval_binary_expression) [SPACESHIP_EXPR]: Pass lval through.
4977 * method.c (genericize_spaceship): Wrap result in TARGET_EXPR.
4979 2020-02-12 Patrick Palka <ppalka@redhat.com>
4983 * type-utils.h (find_type_usage): Refactor to take a tree * and to
4984 return a tree *, and update documentation accordingly.
4985 * pt.c (make_auto_1): Set AUTO_IS_DECLTYPE when building a
4986 decltype(auto) node.
4987 (make_constrained_decltype_auto): No need to explicitly set
4988 AUTO_IS_DECLTYPE anymore.
4989 (splice_late_return_type): Use find_type_usage to find and
4990 replace a possibly nested auto node instead of using is_auto.
4991 Check test for is_auto into an assert when deciding whether
4992 to late_return_type.
4993 (type_uses_auto): Adjust the call to find_type_usage.
4994 * parser.c (cp_parser_decltype): No need to explicitly set
4995 AUTO_IS_DECLTYPE anymore.
4997 * error.c (dump_decl) [CONCEPT_DECL]: Use dump_simple_decl.
4998 (dump_simple_decl): Handle standard concept definitions as well as
4999 variable concept definitions.
5001 2020-02-10 Jakub Jelinek <jakub@redhat.com>
5004 * error.c (dump_decl_name): Fix up last argument to strncmp.
5006 2020-02-10 Jason Merrill <jason@redhat.com>
5009 * tree.c (array_of_unknown_bound_p): New.
5010 * init.c (perform_member_init): Do nothing for flexible arrays.
5012 2020-02-09 Jakub Jelinek <jakub@redhat.com>
5015 * constexpr.c (cxx_eval_constant_expression): If obj is heap var with
5016 ARRAY_TYPE, use the element type. Punt if objtype after that is not
5019 2020-02-08 Jason Merrill <jason@redhat.com>
5022 * expr.c (fold_for_warn): Call maybe_constant_value.
5023 * constexpr.c (struct constexpr_ctx): Add uid_sensitive bit-field.
5024 (maybe_constant_value): Add uid_sensitive parm.
5025 (get_fundef_copy): Don't copy if it's true.
5026 (cxx_eval_call_expression): Don't instantiate if it's true.
5027 (cxx_eval_outermost_constant_expr): Likewise.
5030 * constexpr.c (maybe_constant_value): Don't unshare if the cached
5031 value is the same as the argument.
5033 * typeck.c (maybe_warn_about_returning_address_of_local): Add
5036 * typeck2.c (process_init_constructor): Also clear TREE_SIDE_EFFECTS
5039 2020-02-08 Jakub Jelinek <jakub@redhat.com>
5042 * constexpr.c (find_array_ctor_elt): If last element has no index,
5043 for flag_checking verify all elts have no index. If i is within the
5044 elts, return it directly, if it is right after the last elt, append
5045 if NULL index, otherwise force indexes on all elts.
5046 (cxx_eval_store_expression): Allow cep->index to be NULL.
5048 2020-02-07 Marek Polacek <polacek@redhat.com>
5050 PR c++/92947 - Paren init of aggregates in unevaluated context.
5051 * call.c (build_new_method_call_1): Don't check
5052 cp_unevaluated_operand. Check the return value of digest_init.
5054 2020-02-06 Jason Merrill <jason@redhat.com>
5057 * tree.c (cp_walk_subtrees): Walk into type template arguments.
5058 * cp-tree.h (TYPE_TEMPLATE_INFO_MAYBE_ALIAS): Use typedef_variant_p
5059 instead of TYPE_ALIAS_P.
5060 * pt.c (push_template_decl_real): Likewise.
5061 (find_parameter_packs_r): Likewise. Remove dead code.
5062 * error.c (find_typenames_r): Remove dead code.
5064 2020-02-06 Jason Merrill <jason@redhat.com>
5067 * parser.c (cp_parser_constraint_primary_expression): Do the main
5068 parse non-tentatively.
5070 2020-02-06 Marek Polacek <polacek@redhat.com>
5072 PR c++/93597 - ICE with lambda in operator function.
5073 * name-lookup.c (maybe_save_operator_binding): Check is_overloaded_fn.
5075 2020-02-05 Jason Merrill <jason@redhat.com>
5078 * pt.c (tsubst_decl) [PARM_DECL]: Check cp_unevaluated_operand in
5079 handling of TREE_CHAIN for empty pack.
5081 2020-02-05 Jakub Jelinek <jakub@redhat.com>
5084 * semantics.c (cp_build_vec_convert): Call decay_conversion on arg
5085 prior to passing it to c_build_vec_convert.
5087 2020-02-05 Marek Polacek <polacek@redhat.com>
5089 PR c++/93559 - ICE with CONSTRUCTOR flags verification.
5090 * decl.c (reshape_init_array_1): Don't reuse a CONSTRUCTOR with
5093 2020-02-05 Jason Merrill <jason@redhat.com>
5096 * decl.c (grokdeclarator): Reject field of current class type even
5099 2020-02-05 Bin Cheng <bin.cheng@linux.alibaba.com>
5101 * coroutines.cc (maybe_promote_captured_temps): Increase the index
5102 number for temporary variables' name.
5104 2020-02-05 Jun Ma <JunMa@linux.alibaba.com>
5106 * coroutines.cc (build_co_await): Call convert_from_reference
5107 to wrap co_await_expr with indirect_ref which avoid
5108 reference/non-reference type confusion.
5110 (co_await_expander): Sink to call_expr if await_resume
5111 is wrapped by indirect_ref.
5113 2020-02-04 Jason Merrill <jason@redhat.com>
5116 * constraint.cc (satisfy_declaration_constraints): Check return
5117 value of push_tinst_level.
5120 * constexpr.c (cxx_eval_array_reference): {}-initialize missing
5121 elements instead of value-initializing them.
5124 * init.c (perform_member_init): Simplify.
5125 * constexpr.c (cx_check_missing_mem_inits): Allow uninitialized
5127 (cxx_eval_vec_init_1): Handle CONSTRUCTOR.
5129 2020-02-04 Iain Sandoe <iain@sandoe.co.uk>
5131 * coroutines.cc (find_promise_type): Delete unused forward
5133 (struct coroutine_info): Add a bool for no promise type error.
5134 (coro_promise_type_found_p): Only emit the error for a missing
5135 promise once in each affected coroutine.
5137 2020-02-03 Jason Merrill <jason@redhat.com>
5140 * constexpr.c (cxx_eval_constant_expression) [PARM_DECL]: Don't
5141 defer loading the value of a reference.
5143 2020-02-03 Jason Merrill <jason@redhat.com>
5146 * constexpr.c (potential_constant_expression_1) [PARM_DECL]: Allow
5148 [COMPONENT_REF]: A member function reference doesn't use the object
5151 2020-02-03 Iain Sandoe <iain@sandoe.co.uk>
5154 * coroutines.cc (struct coroutine_info): Add a bool flag to note
5155 that we emitted an error for a bad function return type.
5156 (get_coroutine_info): Tolerate an unset info table in case of
5158 (find_coro_traits_template_decl): In case of error or if we didn't
5159 find a type template, note we emitted the error and suppress
5161 (find_coro_handle_template_decl): Likewise.
5162 (instantiate_coro_traits): Only check for error_mark_node in the
5163 return from lookup_qualified_name.
5164 (coro_promise_type_found_p): Reorder initialization so that we check
5165 for the traits and their usability before allocation of the info
5166 table. Check for a suitable return type and emit a diagnostic for
5167 here instead of relying on the lookup machinery. This allows the
5168 error to have a better location, and means we can suppress multiple
5170 (coro_function_valid_p): Re-check for a valid promise (and thus the
5171 traits) before proceeding. Tolerate missing info as a fatal error.
5173 2020-02-03 Jason Merrill <jason@redhat.com>
5176 * cp-gimplify.c (predeclare_vla): New.
5177 (cp_genericize_r) [NOP_EXPR]: Call it.
5179 2020-02-03 Jun Ma <JunMa@linux.alibaba.com>
5181 * coroutines.cc (transform_await_wrapper): Set actor funcion as
5182 new context of label_decl.
5183 (build_actor_fn): Fill new field of await_xform_data.
5185 2020-02-02 Marek Polacek <polacek@redhat.com>
5187 PR c++/93530 - ICE on invalid alignas in a template.
5188 * decl.c (grokdeclarator): Call cplus_decl_attributes instead of
5191 2020-01-31 Jason Merrill <jason@redhat.com>
5194 * semantics.c (process_outer_var_ref): Capture VLAs even in
5195 unevaluated context.
5198 * decl.c (reshape_init_array_1): Reuse a single CONSTRUCTOR with
5199 non-aggregate elements.
5200 (reshape_init_array): Add first_initializer_p parm.
5201 (reshape_init_r): Change first_initializer_p from bool to tree.
5202 (reshape_init): Pass init to it.
5205 * parser.c (cp_parser_initializer_list): Suppress location wrappers
5208 2020-01-29 Jason Merrill <jason@redhat.com>
5211 * pt.c (tsubst_copy_and_build) [EQ_EXPR]: Only suppress warnings if
5212 the expression was dependent before substitution.
5214 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
5216 * coroutines.cc (act_des_fn): New.
5217 (morph_fn_to_coro): Call act_des_fn to build actor/destroy decls.
5218 Access promise via actor function's frame pointer argument.
5219 (build_actor_fn, build_destroy_fn): Use frame pointer argument.
5221 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
5223 * coroutines.cc (co_await_expander): Handle type conversion case.
5225 2020-01-29 Jason Merrill <jason@redhat.com>
5230 * parser.c (cp_parser_type_specifier_seq): Don't parse attributes in
5231 a trailing return type.
5232 (cp_parser_lambda_declarator_opt): Parse C++11 attributes before
5235 2020-01-29 Marek Polacek <polacek@redhat.com>
5237 PR c++/91754 - Fix template arguments comparison with class NTTP.
5238 * pt.c (class_nttp_const_wrapper_p): New.
5239 (template_args_equal): See through class_nttp_const_wrapper_p
5242 2020-01-29 Marek Polacek <polacek@redhat.com>
5244 PR c++/92948 - Fix class NTTP with template arguments.
5245 * pt.c (convert_nontype_argument): Use IMPLICIT_CONV_EXPR when
5246 converting a value-dependent expression to a class type.
5247 (tsubst_copy) <case VIEW_CONVERT_EXPR>: Allow IMPLICIT_CONV_EXPR
5248 as the result of the tsubst_copy call.
5250 2020-01-29 Jakub Jelinek <jakub@redhat.com>
5253 * cp-gimplify.c (cxx_omp_predetermined_sharing): Return
5254 OMP_CLAUSE_DEFAULT_SHARED for typeinfo decls.
5256 2020-01-28 Jason Merrill <jason@redhat.com>
5259 * parser.c (cp_parser_lambda_expression): Clear in_discarded_stmt.
5263 * decl2.c (copy_linkage): Do copy DECL_ONE_ONLY and DECL_WEAK.
5266 * call.c (build_user_type_conversion_1): Allow a template conversion
5267 returning an rvalue reference to bind directly to an lvalue.
5270 * decl.c (grokdeclarator): Propagate eh spec from typedef.
5272 2020-01-28 Martin Liska <mliska@suse.cz>
5275 * pt.c (redeclare_class_template): Group couple of
5276 errors and inform messages with auto_diagnostic_group.
5278 2020-01-28 Martin Liska <mliska@suse.cz>
5281 * pt.c (redeclare_class_template): Use inform
5282 for the second location.
5284 2020-01-27 Jason Merrill <jason@redhat.com>
5287 * pt.c (tsubst_copy) [STRING_CST]: Don't use fold_convert.
5289 2020-01-27 Iain Sandoe <iain@sandoe.co.uk>
5292 * coroutines.cc (morph_fn_to_coro): Check the ramp return
5293 value when it is constructed from the 'get return object'.
5295 2020-01-27 Nathan Sidwell <nathan@acm.org>
5298 * name-lookup.c (is_ancestor): Allow CHILD to be a namespace alias.
5300 2020-01-26 Jason Merrill <jason@redhat.com>
5303 * except.c (maybe_noexcept_warning): Check DECL_IN_SYSTEM_HEADER and
5304 temporarily enable -Wsystem-headers. Change second warning to
5308 * semantics.c (finish_call_expr): Don't call
5309 instantiate_non_dependent_expr before warn_for_memset.
5311 2020-01-25 Marek Polacek <polacek@redhat.com>
5313 PR c++/93414 - poor diagnostic for dynamic_cast in constexpr context.
5314 * constexpr.c (cxx_eval_dynamic_cast_fn): Add a reference
5315 dynamic_cast diagnostic.
5317 2020-01-24 Jason Merrill <jason@redhat.com>
5319 PR c++/93400 - ICE with constrained friend.
5320 * constraint.cc (maybe_substitute_reqs_for): New.
5321 * decl.c (function_requirements_equivalent_p): Call it.
5322 * pt.c (tsubst_friend_function): Only substitute
5323 TEMPLATE_PARMS_CONSTRAINTS.
5324 (tsubst_template_parms): Copy constraints.
5326 2020-01-24 Jason Merrill <jason@redhat.com>
5328 PR c++/93279 - ICE with lambda in member operator.
5329 * name-lookup.c (maybe_save_operator_binding): Don't remember
5330 class-scope bindings.
5332 2020-01-24 Jason Merrill <jason@redhat.com>
5334 PR c++/93377 - ICE with member alias in constraint.
5335 * pt.c (any_template_parm_r): Look at template arguments for all
5336 aliases, not only alias templates.
5338 2020-01-24 Marek Polacek <polacek@redhat.com>
5340 PR c++/93299 - ICE in tsubst_copy with parenthesized expression.
5341 * pt.c (tsubst_copy): Handle a REF_PARENTHESIZED_P VIEW_CONVERT_EXPR.
5343 2020-01-24 Jason Merrill <jason@redhat.com>
5345 PR c++/92852 - ICE with generic lambda and reference var.
5346 * constexpr.c (maybe_constant_value): Likewise.
5348 2020-01-23 Paolo Carlini <paolo.carlini@oracle.com>
5351 * parser.c (cp_parser_nested_name_specifier_opt): Properly
5352 diagnose concept-ids.
5354 2020-01-23 Jason Merrill <jason@redhat.com>
5356 PR c++/93331 - ICE with __builtin_strchr.
5357 * constexpr.c (cxx_eval_builtin_function_call): Use the original
5358 argument if we didn't manage to extract a STRING_CST.
5360 PR c++/93345 - ICE with defaulted dtor and template.
5362 * decl.c (cxx_maybe_build_cleanup): Don't try to set
5363 throwing_cleanup in a template.
5365 2020-01-22 Marek Polacek <polacek@redhat.com>
5367 PR c++/92907 - noexcept does not consider "const" in member functions.
5368 * g++.dg/cpp0x/noexcept56.C: New test.
5370 2020-01-22 Marek Polacek <polacek@redhat.com>
5372 PR c++/93324 - ICE with -Wall on constexpr if.
5373 * semantics.c (is_std_constant_evaluated_p): Check fndecl.
5375 2020-01-22 Patrick Palka <ppalka@redhat.com>
5377 * constraint.cc (get_mapped_args): Avoid using auto_vec
5378 as a vector element. Release the vectors inside the lists
5380 * parser.c (cp_literal_operator_id): Free the buffer.
5382 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
5384 * coroutines.cc (finish_co_await_expr): Add error check on return
5385 value of build_co_await.
5386 (finish_co_yield_expr,): Ditto.
5388 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
5390 * coroutines.cc (lookup_awaitable_member): Lookup an awaitable member.
5391 (lookup_promise_method): Emit diagnostic when get NULL_TREE back only.
5392 (build_co_await): Use lookup_awaitable_member instead of lookup_member.
5394 2020-01-21 Jason Merrill <jason@redhat.com>
5396 PR c++/60855 - ICE with sizeof VLA capture.
5397 * lambda.c (is_lambda_ignored_entity): Don't look past VLA capture.
5399 PR c++/90732 - ICE with VLA capture and generic lambda.
5400 * pt.c (tsubst_lambda_expr): Repeat add_capture for VLAs.
5402 2020-01-21 Iain Sandoe <iain@sandoe.co.uk>
5403 Bin Cheng <bin.cheng@linux.alibaba.com>
5405 * coroutines.cc (coro_promise_type_found_p): Check for NULL return
5406 from complete_type_or_else.
5407 (register_param_uses): Likewise.
5408 (build_co_await): Do not try to use complete_type_or_else for void
5409 types, otherwise for incomplete types, check for NULL return from
5410 complete_type_or_else.
5412 2020-01-21 Jason Merrill <jason@redhat.com>
5414 PR c++/91476 - anon-namespace reference temp clash between TUs.
5415 * decl2.c (copy_linkage): Factor out of get_guard.
5416 * call.c (make_temporary_var_for_ref_to_temp): Use it.
5417 * decl.c (cp_finish_decomp): Use it.
5418 (cp_finish_decl): determine_visibility sooner.
5420 2020-01-21 Bin Cheng <bin.cheng@linux.alibaba.com>
5422 * coroutines.cc (finish_co_await_expr): Set return value flag.
5423 (finish_co_yield_expr, morph_fn_to_coro): Ditto.
5425 2020-01-19 Jason Merrill <jason@redhat.com>
5427 PR c++/33799 - destroy return value, take 2.
5428 * cp-tree.h (current_retval_sentinel): New macro.
5429 (struct language_function): Add throwing_cleanup bitfield.
5430 * decl.c (cxx_maybe_build_cleanup): Set it.
5431 * except.c (maybe_set_retval_sentinel)
5432 (maybe_splice_retval_cleanup): New functions.
5433 * parser.c (cp_parser_compound_statement): Call
5434 maybe_splice_retval_cleanup.
5435 * typeck.c (check_return_expr): Call maybe_set_retval_sentinel.
5437 * parser.c (cp_parser_lambda_body): Use cp_parser_function_body.
5439 2020-01-18 Jakub Jelinek <jakub@redhat.com>
5441 * coroutines.cc (get_fn_local_identifier): Fix NO_DOT_IN_LABEL
5442 but non-NO_DOLLAR_IN_LABEL case build.
5444 2020-01-18 Iain Sandoe <iain@sandoe.co.uk>
5446 * Make-lang.in: Add coroutines.o.
5447 * cp-tree.h (lang_decl-fn): coroutine_p, new bit.
5448 (DECL_COROUTINE_P): New.
5449 * lex.c (init_reswords): Enable keywords when the coroutine flag
5451 * operators.def (co_await): New operator.
5452 * call.c (add_builtin_candidates): Handle CO_AWAIT_EXPR.
5453 (op_error): Likewise.
5454 (build_new_op_1): Likewise.
5455 (build_new_function_call): Validate coroutine builtin arguments.
5456 * constexpr.c (potential_constant_expression_1): Handle
5457 CO_AWAIT_EXPR, CO_YIELD_EXPR, CO_RETURN_EXPR.
5458 * coroutines.cc: New file.
5459 * cp-objcp-common.c (cp_common_init_ts): Add CO_AWAIT_EXPR,
5460 CO_YIELD_EXPR, CO_RETRN_EXPR as TS expressions.
5461 * cp-tree.def (CO_AWAIT_EXPR, CO_YIELD_EXPR, (CO_RETURN_EXPR): New.
5462 * cp-tree.h (coro_validate_builtin_call): New.
5463 * decl.c (emit_coro_helper): New.
5464 (finish_function): Handle the case when a function is found to
5465 be a coroutine, perform the outlining and emit the outlined
5466 functions. Set a bit to signal that this is a coroutine component.
5467 * parser.c (enum required_token): New enumeration RT_CO_YIELD.
5468 (cp_parser_unary_expression): Handle co_await.
5469 (cp_parser_assignment_expression): Handle co_yield.
5470 (cp_parser_statement): Handle RID_CO_RETURN.
5471 (cp_parser_jump_statement): Handle co_return.
5472 (cp_parser_operator): Handle co_await operator.
5473 (cp_parser_yield_expression): New.
5474 (cp_parser_required_error): Handle RT_CO_YIELD.
5475 * pt.c (tsubst_copy): Handle CO_AWAIT_EXPR.
5476 (tsubst_expr): Handle CO_AWAIT_EXPR, CO_YIELD_EXPR and
5478 * tree.c (cp_walk_subtrees): Likewise.
5480 2020-01-17 Jason Merrill <jason@redhat.com>
5482 PR c++/92531 - ICE with noexcept(lambda).
5483 * pt.c (uses_template_parms): Don't try to enumerate all the
5486 2020-01-17 Jakub Jelinek <jakub@redhat.com>
5489 * parser.c (cp_parser_template_name): Look up deprecated attribute
5490 in DECL_TEMPLATE_RESULT or its type's attributes.
5492 2020-01-16 Jason Merrill <jason@redhat.com>
5494 PR c++/93286 - ICE with __is_constructible and variadic template.
5495 * pt.c (tsubst) [TREE_LIST]: Handle pack expansion.
5496 (tsubst_copy_and_build) [TRAIT_EXPR]: Always use tsubst for type2.
5498 PR c++/93280 - ICE with aggregate assignment and DMI.
5499 * init.c (get_nsdmi): Set TARGET_EXPR_DIRECT_INIT_P here.
5500 * typeck2.c (digest_nsdmi_init): Not here.
5502 2020-01-15 Paolo Carlini <paolo.carlini@oracle.com>
5505 * cp-tree.h (is_constrained_auto): New.
5506 * parser.c (cp_parser_maybe_commit_to_declaration): Correctly
5507 handle concept-check expressions; take a cp_decl_specifier_seq*
5509 (cp_parser_condition): Update call.
5510 (cp_parser_simple_declaration): Likewise.
5511 (cp_parser_placeholder_type_specifier): Correctly handle
5512 concept-check expressions.
5514 2020-01-15 Jason Merrill <jason@redhat.com>
5517 PR c++/33799 - destroy return value if local cleanup throws.
5518 * cp-tree.h (current_retval_sentinel): New macro.
5519 * decl.c (start_preparsed_function): Set up cleanup for retval.
5520 * typeck.c (check_return_expr): Set current_retval_sentinel.
5522 PR c++/93257 - consteval void function.
5523 * constexpr.c (verify_constant): Allow void_node.
5525 PR c++/92871 - bad code with xvalue and GNU ?: extension.
5526 * call.c (prevent_lifetime_extension): New.
5527 (build_conditional_expr_1): Use it.
5529 2020-01-14 Nathan Sidwell <nathan@acm.org>
5532 * pt.c (retrieve_specialization): Use get_template_info, not open
5536 * pt.c (retrieve_specialization): Get the TI from the decl or the
5537 classtype as appropriate.
5539 2020-01-14 David Malcolm <dmalcolm@redhat.com>
5541 * cp-gimplify.c (source_location_table_entry_hash::empty_zero_p):
5542 New static constant.
5543 * cp-tree.h (named_decl_hash::empty_zero_p): Likewise.
5544 (struct named_label_hash::empty_zero_p): Likewise.
5545 * decl2.c (mangled_decl_hash::empty_zero_p): Likewise.
5547 2020-01-14 Jason Merrill <jason@redhat.com>
5549 PR c++/92590 - wrong handling of inherited default ctor.
5550 * class.c (add_method): A constrained inherited ctor doesn't hide an
5551 implicit derived ctor.
5553 PR c++/92552 - ICE with inherited constrained default ctor.
5554 * pt.c (instantiate_class_template_1): Copy
5555 TYPE_HAS_USER_CONSTRUCTOR.
5556 PR c++/91930 - ICE with constrained inherited default ctor.
5557 * name-lookup.c (do_class_using_decl): Set TYPE_HAS_USER_CONSTRUCTOR
5558 for inherited constructor.
5559 PR c++/92594 - ICE with inherited trivial default ctor.
5560 * method.c (trivial_fn_p): Treat an inherited default constructor
5561 like a normal default constructor.
5563 PR c++/92594 - ICE with inherited trivial default ctor.
5564 * method.c (trivial_fn_p): Treat an inherited default constructor
5565 like a normal default constructor.
5567 PR c++/92009 - ICE with punning of typeid.
5568 * rtti.c (get_tinfo_desc): Call xref_basetypes.
5569 * constexpr.c (cxx_fold_indirect_ref): Don't strip
5572 2020-01-13 Jason Merrill <jason@redhat.com>
5574 PR c++/92746 - ICE with noexcept of function concept check.
5575 * except.c (check_noexcept_r): Handle concept-check.
5577 PR c++/92582 - ICE with member template as requirement.
5578 * pt.c (struct find_template_parameter_info): Add ctx_parms.
5579 (any_template_parm_r): Handle TEMPLATE_DECL.
5580 (find_template_parameters): Take parms instead of their depth.
5581 * constraint.cc (build_parameter_mapping): Pass them.
5583 PR c++/33799 - destroy return value if local cleanup throws.
5584 * cp-tree.h (current_retval_sentinel): New macro.
5585 * decl.c (start_preparsed_function): Set up cleanup for retval.
5586 * typeck.c (check_return_expr): Set current_retval_sentinel.
5588 PR c++/93238 - short right-shift with enum.
5589 * typeck.c (cp_build_binary_op): Use folded op1 for short_shift.
5591 2020-01-10 Jason Merrill <jason@redhat.com>
5593 * typeck.c (cp_build_binary_op): Restore short_shift code.
5595 PR c++/93143 - incorrect tree sharing with constexpr.
5596 * constexpr.c (cxx_eval_outermost_constant_expr): Don't assume
5597 CONSTRUCTORs are already unshared.
5599 PR c++/93173 - incorrect tree sharing.
5601 * cp-gimplify.c (cp_gimplify_init_expr, cp_gimplify_expr): Use
5602 copy_if_shared after cp_genericize_tree.
5603 * typeck2.c (split_nonconstant_init): Don't unshare here.
5605 2020-01-08 Jason Merrill <jason@redhat.com>
5607 * cp-gimplify.c (cp_gimplify_expr) [TARGET_EXPR]: Check
5608 TARGET_EXPR_DIRECT_INIT_P.
5609 * constexpr.c (cxx_eval_constant_expression): Likewise.
5611 2020-01-08 Jason Merrill <jason@redhat.com>
5613 PR c++/91369 - constexpr destructor and member initializer.
5614 * constexpr.c (cxx_eval_store_expression): Look through TARGET_EXPR
5615 when not preevaluating.
5617 2020-01-08 Jason Merrill <jason@redhat.com>
5619 * constexpr.c (cxx_eval_call_expression): Remove DECL_BY_REFERENCE
5622 2020-01-07 Paolo Carlini <paolo.carlini@oracle.com>
5624 * init.c (build_new): Add location_t parameter and use it throughout.
5625 (build_raw_new_expr): Likewise.
5626 * parser.c (cp_parser_new_expression): Pass the combined_loc.
5627 * pt.c (tsubst_copy_and_build): Adjust call.
5628 * cp-tree.h: Update declarations.
5630 2020-01-07 Jason Merrill <jason@redhat.com>
5632 PR c++/47877 - -fvisibility-inlines-hidden and member templates.
5633 * decl2.c (determine_visibility): -fvisibility-inlines-hidden beats
5634 explicit class visibility for a template.
5636 2020-01-07 Richard Sandiford <richard.sandiford@arm.com>
5638 * mangle.c (mangle_type_attribute_p): New function, split out from...
5639 (write_CV_qualifiers_for_type): ...here. Don't mangle attributes
5640 that contain a space.
5642 2020-01-07 Jakub Jelinek <jakub@redhat.com>
5645 * constexpr.c (struct constexpr_global_ctx): Add heap_alloc_count
5646 member, initialize it to zero in ctor.
5647 (cxx_eval_call_expression): Bump heap_dealloc_count when deleting
5648 a heap object. Don't cache calls to functions which allocate some
5649 heap objects and don't deallocate them or deallocate some heap
5650 objects they didn't allocate.
5652 2020-01-06 Jason Merrill <jason@redhat.com>
5654 PR c++/92552 - ICE with inherited constrained default ctor.
5655 * pt.c (instantiate_class_template_1): Copy
5656 TYPE_HAS_USER_CONSTRUCTOR.
5657 * class.c (one_inherited_ctor): Don't set it here.
5659 2020-01-06 Andrew Sutton <asutton@lock3software.com>
5661 PR c++/92739 - parsing requires clause with attributes.
5662 * parser.c (cp_parser_constraint_requires_parens): Exclude
5663 attributes as postfix expressions.
5665 2020-01-05 Jakub Jelinek <jakub@redhat.com>
5668 * parser.c (cp_parser_check_class_key): Disable access checks for the
5670 (cp_parser_maybe_warn_enum_key): Likewise. Return early if
5671 !warn_redundant_tags.
5673 2010-01-05 Jakub Jelinek <jakub@redhat.com>
5676 * cp-gimplify.c (cp_gimplify_init_expr): Don't look through
5677 TARGET_EXPR if it has been gimplified already.
5679 2020-01-03 Jason Merrill <jason@redhat.com>
5681 PR c++/93033 - incorrect tree node sharing with array init.
5682 * typeck2.c (split_nonconstant_init): Unshare non-decl.
5683 * cp-gimplify.c (cp_gimplify_init_expr): Only split if -fexceptions.
5685 2020-01-02 Jason Merrill <jason@redhat.com>
5687 * pt.c (invalid_nontype_parm_type_p): Reject class placeholder in
5690 2020-01-02 Jakub Jelinek <jakub@redhat.com>
5693 * cp-objcp-common.c (identifier_global_tag): Return NULL_TREE if name
5694 has not been found, rather than error_mark_node.
5696 2020-01-01 Jakub Jelinek <jakub@redhat.com>
5698 Update copyright years.
5700 Copyright (C) 2020 Free Software Foundation, Inc.
5702 Copying and distribution of this file, with or without modification,
5703 are permitted in any medium without royalty provided the copyright
5704 notice and this notice are preserved.