1 2020-12-21 Nathan Sidwell <nathan@acm.org>
3 * module.cc (create_dirs): Add logging.
4 (finish_module_processing): Unlink before rename.
6 2020-12-21 Nathan Sidwell <nathan@acm.org>
9 * mapper-client.cc: INCLUDE_STRING, INCLUDE_VECTOR.
10 (module_client::open_module_client): Avoid std::stoul.
11 * mapper-resolver.cc: INCLUDE_STRING, INCLUDE_VECTOR.
13 2020-12-18 Kwok Cheung Yeung <kcy@codesourcery.com>
15 * cp-lang.c (cxx_get_decl_init): New.
16 (cxx_omp_finish_decl_inits): New.
17 (LANG_HOOKS_GET_DECL_INIT): New.
18 (LANG_HOOKS_OMP_FINISH_DECL_INITS): New.
19 * cp-tree.h (dynamic_initializers): New.
20 * decl.c (dynamic_initializers): New.
21 * decl2.c (c_parse_final_cleanups): Add initializer entries
22 from vars to dynamic_initializers.
24 2020-12-18 Nathan Sidwell <nathan@acm.org>
26 * module.cc (O_CLOEXEC, O_BINARY): Add window's support.
27 (elf_in::defrost, module_state::do_import)
28 (finish_module_processing): Use O_BINARY.
30 2020-12-18 Jakub Jelinek <jakub@redhat.com>
33 * cp-gimplify.c (source_location_table_entry_hash::pch_nx): Override
34 static member functions from ggc_remove.
36 2020-12-18 Patrick Palka <ppalka@redhat.com>
38 * constraint.cc (satisfying_constraint): Move up definition
39 and give it bool type.
40 (failed_type_completion_count): Replace with ...
41 (failed_type_completions): ... this.
42 (note_failed_type_completion_for_satisfaction): Append the
43 supplied argument to failed_type_completions.
44 (some_type_complete_p): Define.
45 (sat_entry::maybe_unstable): Replace with ...
46 (sat_entry::ftc_begin, sat_entry::ftc_end): ... these.
47 (satisfaction_cache::ftc_count): Replace with ...
48 (satisfaction_cache::ftc_begin): ... this.
49 (satisfaction_cache::satisfaction_cache): Adjust accordingly.
50 (satisfaction_cache::get): Adjust accordingly, using
52 (satisfaction_cache::save): Adjust accordingly.
53 (satisfying_constraint_p): Remove unused function.
54 (satisfy_constraint): Set satisfying_constraint.
55 (satisfy_declaration_constraints): Likewise.
56 * decl.c (require_deduced_type): Call
57 note_failed_type_completion_for_satisfaction.
59 2020-12-18 Patrick Palka <ppalka@redhat.com>
61 * constraint.cc (sat_entry::evaluating): New member.
62 (satisfaction_cache::get): If entry->evaluating, diagnose
63 self-recursive satisfaction. Otherwise, set entry->evaluating
64 if we're not reusing a cached satisfaction result.
65 (satisfaction_cache::save): Clear entry->evaluating.
66 (satisfy_atom): Set up diagnosing_failed_constraint before the
69 2020-12-18 Patrick Palka <ppalka@redhat.com>
71 * constraint.cc (failed_type_completion_count): New.
72 (note_failed_type_completion_for_satisfaction): New.
73 (sat_entry::constr): Rename to ...
74 (sat_entry::atom): ... this.
75 (sat_entry::location): New member.
76 (sat_entry::maybe_unstable): New member.
77 (sat_entry::diagnose_instability): New member.
78 (struct sat_hasher): Adjust after the above renaming.
79 (get_satisfaction, save_satisfaction): Remove.
80 (satisfaction_cache): Rewrite completely.
81 (satisfy_atom): When instantiation of the parameter mapping
82 fails, set diagnose_instability. Propagate location from
83 inst_cache.entry to cache.entry if the secondary lookup
85 (satisfy_declaration_constraints): When
86 failed_type_completion_count differs before and after
87 satisfaction, then don't cache the satisfaction result.
88 * cp-tree.h (note_failed_type_completion_for_satisfaction):
90 * pt.c (tsubst) <case TYPENAME_TYPE>: Use
91 complete_type_or_maybe_complain instead of open-coding it.
92 * typeck.c (complete_type_or_maybe_complain): Call
93 note_failed_type_completion_for_satisfaction when type
96 2020-12-17 Nathan Sidwell <nathan@acm.org>
99 * module.cc (uintset<T>::hash::add): Use uintset (0u).MEMBER,
100 rather than uintset::MEMBER.
102 2020-12-17 Nathan Sidwell <nathan@acm.org>
105 * module.cc: Fix ::read, ::write result signedness comparisons.
107 2020-12-16 Nathan Sidwell <nathan@acm.org>
109 * mapper-resolver.cc: Remove early include of
110 sys/socket.h. Specify no CODY_NETWORKING instead.
111 * module.cc: Specify no CODY_NETWORKING.
113 2020-12-16 Nathan Sidwell <nathan@acm.org>
115 * parser.c (cp_parser_elaborated_type_specifier): Test
116 BOUND_TEMPLATE_TEMPLATE_PARM before checking for instantiation.
118 2020-12-16 Nathan Sidwell <nathan@acm.org>
120 * module.cc (dumper::push): Clangify offsetof use.
122 2020-12-16 Nathan Sidwell <nathan@acm.org>
124 * mapper-resolver.cc: #include sys/socket before system.h
125 due to poisoned bcopy use.
127 2020-12-16 Nathan Sidwell <nathan@acm.org>
129 * module.cc (loc_spans): Make spans a pointer, not inline.
132 2020-12-16 Nathan Sidwell <nathan@acm.org>
134 * mapper-client.cc: Include sys/socket.h before system.h.
136 2020-12-15 Patrick Palka <ppalka@redhat.com>
138 * pt.c (in_template_function): Inspect cfun->decl instead of
139 current_function_decl.
141 2020-12-15 Nathan Sidwell <nathan@acm.org>
143 * module.cc: Replace stubs with implementation.
145 2020-12-15 Nathan Sidwell <nathan@acm.org>
147 * Make-lang.in (CXX_AND_OBJCXX_OBJS): Add mapper-client &
149 * mapper-client.h: New.
150 * mapper-client.cc: New.
151 * mapper-resolver.cc: New.
153 2020-12-15 Nathan Sidwell <nathan@acm.org>
155 * name-lookup.c (do_namespace_alias): Set originating module
158 2020-12-11 Jason Merrill <jason@redhat.com>
161 * call.c (build_user_type_conversion_1): Avoid considering
162 conversion functions that return a clearly unsuitable type.
164 2020-12-11 Jason Merrill <jason@redhat.com>
166 * cp-tree.h (make_binding_vec): Add CXX_MEM_STAT_INFO.
168 2020-12-11 Nathan Sidwell <nathan@acm.org>
170 * config-lang.in (gtfiles): Add cp/module.cc.
171 * decl2.c (c_parse_final_cleanups): Add module support.
172 * lambda.c (record_lambda_scope): Call maybe_attach_decl.
173 * module.cc (maybe_attach_decl, lazy_load_specializations): Stubs.
174 (finish_module_procesing): Stub.
175 * pt.c (lookup_template_class_1): Lazy load specializations.
176 (instantiate_template_1): Likewise.
178 2020-12-11 Nathan Sidwell <nathan@acm.org>
180 * decl2.c (c_parse_final_cleanups): Refactor loop.
182 2020-12-11 Nathan Sidwell <nathan@acm.org>
184 * cp-tree.h (map_context_from, map_context_to): Declare.
185 * module.cc (map_context_from, map_context_to): Define.
186 * tree.c (cp_tree_equal): Check map_context_{from,to} for parm
187 context difference. Allow NON_LVALUE_EXPR and VIEW_CONVERT_EXPR
190 2020-12-11 Nathan Sidwell <nathan@acm.org>
192 * cp-lang.c (LANG_HOOKS_PREPROCESS_MAIN_FILE): Override.
193 (LANG_HOOKS_PREPROCESS_OPTIONS): Override.
194 (LANG_HOOKS_PREPROCESS_TOKEN): Override.
195 * cp-objcp-common.c (cp_register_dumps): Add module dump.
196 (cp_handle_option): New.
197 * cp-objcp-common.h (cp_handle_option): Declare.
198 (LANG_HOOKS_HANDLE_OPTION): Override.
199 * cp-tree.h (module_dump_id): Declare.
200 * module.cc (module_dump_id): Define.
201 (module_begin_main_file, handle_module_option)
202 (module_preproces_options): Stubs.
204 2020-12-11 Nathan Sidwell <nathan@acm.org>
206 * module.cc (lazy_specializations_p): Stub.
207 * name-lookup.h (append_imported_binding_slot)
208 (mergeable_namespacE_slots, lookup_class_binding)
209 (walk_module_binding, import_module_binding, set_module_binding)
210 (note_pending_specializations, load_pending_specializations)
211 (add_module_decl, add_imported_namespace): Declare.
212 (get_cxx_dialect_name): Declare.
213 (enum WMB_flags): New.
214 * name-lookup.c (append_imported_binding_slot)
215 (mergeable_namespacE_slots, lookup_class_binding)
216 (walk_module_binding, import_module_binding, set_module_binding)
217 (note_pending_specializations, load_pending_specializations)
218 (add_module_decl, add_imported_namespace): New.
219 (get_cxx_dialect_name): Make extern.
221 2020-12-11 Patrick Palka <ppalka@redhat.com>
224 * typeck.c (pointer_diff): Use complete_type_or_maybe_complain
225 instead of complete_type_or_else.
227 2020-12-10 Jason Merrill <jason@redhat.com>
229 * cp-tree.h (struct type_identity): New.
230 (make_temp_override): New.
231 * decl.c (grokdeclarator): Use it.
232 * except.c (maybe_noexcept_warning): Use it.
233 * parser.c (cp_parser_enum_specifier): Use it.
234 (cp_parser_parameter_declaration_clause): Use it.
235 (cp_parser_gnu_attributes_opt): Use it.
236 (cp_parser_std_attribute): Use it.
238 2020-12-10 Nathan Sidwell <nathan@acm.org>
240 * name-lookup.c (do_nonmember_using_decl): Add INSERT_P parm.
241 Deal with exporting using decls.
242 (finish_nonmember_using_decl): Examine BINDING_VECTOR.
244 2020-12-10 Nathan Sidwell <nathan@acm.org>
246 * cp-tree.h (visible_instantiation_path): Renamed.
247 * module.cc (get_originating_module_decl, lazy_load_binding)
248 (lazy_load_members, visible_instantiation_path): Stubs.
249 * name-lookup.c (STAT_TYPE_VISIBLE_P, STAT_VISIBLE): New.
250 (search_imported_binding_slot, init_global_partition)
251 (get_fixed_binding_slot): New.
252 (name_lookup::process_module_binding): New.
253 (name_lookup::search_namespace_only): Search BINDING_VECTOR.
254 (name_lookup::adl_namespace_fns): Likewise.
255 (name_lookip::search_adl): Search visible instantiation path.
256 (maybe_lazily_declare): Maybe lazy load members.
257 (implicitly_exporT_namespace): New.
258 (maybe_record_mergeable_decl): New.
259 (check_module_override): New.
260 (do_pushdecl): Deal with BINDING_VECTOR, check override.
261 (add_mergeable_namespace_entity): New.
262 (get_namespace_binding): Deal with BINDING_VECTOR.
263 (do_namespace_alias): Call set_originating_module.
264 (lookup_elaborated_type_1): Deal with BINDING_VECTOR.
265 (do_pushtag): Call set_originating_module.
266 (reuse_namespace): New.
267 (make_namespace_finish): Add FROM_IMPORT parm.
268 (push_namespace): Deal with BINDING_VECTOR & namespace reuse.
269 (maybe_save_operator_binding): Save when module CMI in play.
270 * name-lookup.h (add_mergeable_namespace_entity): Declare.
272 2020-12-10 Nathan Sidwell <nathan@acm.org>
274 * name-lookup.c: Include bitmap.h.
275 (enum binding_slots): New.
276 (maybe_add_fuzzy_binding): Return bool true if found.
277 (consider_binding_level): Add module support.
278 * module.cc (get_import_bitmap): Stub.
280 2020-12-10 Nathan Sidwell <nathan@acm.org>
282 * name-lookup.c (pop_local_binding): Check for IDENTIFIER_ANON_P.
283 (update_binding): Level may be null, don't add namespaces to
285 (newbinding_bookkeeping): New, broken out of ...
286 (do_pushdecl): ... here, call it. Don't push anonymous decls.
287 (pushdecl, add_using_namespace): Correct comments.
288 (do_push_nested_namespace): Remove assert.
289 (make_namespace, make_namespace_finish): New, broken out of ...
290 (push_namespace): ... here. Call them. Add namespace to level
293 2020-12-10 Nathan Sidwell <nathan@acm.org>
295 * error.c (dump_module_suffix): New.
296 (dump_aggr_type, dump_simple_decl, dump_function_name): Call it.
297 * ptree.c (cxx_print_decl): Print module information.
298 * module.cc (module_name, get_importing_module): Stubs.
300 2020-12-10 Nathan Sidwell <nathan@acm.org>
302 * name-lookup.h (set_class_bindings): Return vector, take signed
304 * name-lookup.c (maybe_lazily_declare): Break out ...
305 (get_class_binding): .. of here, call it.
306 (find_member_slot): Adjust get_class_bindings call.
307 (set_class_bindings): Allow -ve extra. Return the vector.
308 (set_identifier_type_value_with_scope): Remove checking assert.
309 (lookup_using_decl): Set decl's context.
310 (do_pushtag): Adjust set_identifier_type_value_with_scope handling.
312 2020-12-09 Nathan Sidwell <nathan@acm.org>
314 * parser.h (struct cp_token): Add main_source_p field.
315 * parser.c (cp_lexer_new_main): Pass thought module token filter.
317 (cp_lexer_get_preprocessor_token): Set main_source_p.
318 (enum module_parse): New.
319 (cp_parser_diagnose_invalid_type_name): Deal with unrecognized
321 (cp_parser_skip_to_closing_parenthesize_1): Skip module-directivres.
322 (cp_parser_skip_to_end_of_statement): Likewise.
323 (cp_parser_skiup_to_end_of_block_or_statement): Likewise.
324 (cp_parser_translation_unit): Add module parsing calls.
325 (cp_parser_module_name, cp_parser_module_declaration): New.
326 (cp_parser_import_declaration, cp_parser_module_export): New.
327 (cp_parser_declaration): Add module export detection.
328 (cp_parser_template_declaration): Adjust 'export' error message.
329 (cp_parser_function_definition_after_declarator): Add
330 module-specific logic.
331 * module.cc (import_module, declare_module)
332 (maybe_check_all_macros): Stubs.
334 2020-12-09 Marek Polacek <polacek@redhat.com>
337 * cxx-pretty-print.c (cxx_pretty_printer::simple_type_specifier): Handle
339 (pp_cxx_type_specifier_seq): Likewise.
340 (cxx_pretty_printer::type_id): Likewise.
342 2020-12-09 Nathan Sidwell <nathan@acm.org>
344 * decl.c (duplicate_decls): Add module-specific redeclaration
346 (cxx_init_decl_processing): Export the global namespace, maybe
348 (start_decl): Reject local-extern in a module, adjust linkage of
350 (xref_tag_1): Add module-specific redeclaration logic.
351 (start_enum): Likewise.
352 (finish_enum_value_list): Export unscoped members of an exported
354 (grokmethod): Implement p1779 linkage of in-class defined
356 * decl2.c (no_linkage_error): Imports are ok.
357 (c_parse_final_cleanups): Call fini_modules.
358 * lex.c (cxx_dup_lang_specific): Clear some module flags in the
360 * module.cc (module_kind): Define.
361 (module_may_redeclare, set_defining_module): Stubs.
362 (init_modules): Error on modules.
363 (fini_modules): Stub.
364 * rtti.c (push_abi_namespace): Save and reset module_kind.
365 (pop_abi_namespace): Restore module kind.
366 (build_dynamic_cast_1, tinfo_base_init): Adjust.
367 * semantics.c (begin_class_definition): Add module-specific logic.
368 (expand_or_defer_fn_1): Keep bodies of more fns when modules_p.
370 2020-12-09 Tobias Burnus <tobias@codesourcery.com>
372 * parser.c (cp_parser_omp_allocate): New.
373 (cp_parser_omp_construct, cp_parser_pragma): Call it.
375 2020-12-09 Jason Merrill <jason@redhat.com>
378 * cvt.c (maybe_warn_nodiscard): Check c_inhibit_evaluation_warnings.
380 2020-12-09 Jason Merrill <jason@redhat.com>
383 * init.c (expand_default_init): Pass tf_no_cleanup when building
384 a TARGET_EXPR to go on the RHS of an INIT_EXPR.
385 * typeck.c (cp_build_modify_expr): Likewise.
387 2020-12-08 Marek Polacek <polacek@redhat.com>
390 * constexpr.c (cxx_eval_dynamic_cast_fn): If the evaluating of vtable
391 yields a null pointer, give an error and return. Use objtype.
393 2020-12-08 Nathan Sidwell <nathan@acm.org>
395 * class.c (layout_class_type): Call set_instantiating_module.
396 (build_self_reference): Likewise.
397 * decl.c (grokfndecl): Call set_originating_module.
398 (grokvardecl): Likewise.
399 (grokdeclarator): Likewise.
400 * pt.c (maybe_new_partial_specialization): Call
401 set_instantiating_module, propagate DECL_MODULE_EXPORT_P.
402 (lookup_template_class_1): Likewise.
403 (tsubst_function_decl): Likewise.
404 (tsubst_decl, instantiate_template_1): Likewise.
405 (build_template_decl): Propagate module flags.
406 (tsubst_template_dcl): Likewise.
407 (finish_concept_definition): Call set_originating_module.
408 * module.cc (set_instantiating_module, set_originating_module): Stubs.
410 2020-12-08 Jason Merrill <jason@redhat.com>
413 * cp-tree.h (build_new_op): Add overload that omits some parms.
414 (genericize_spaceship): Add location_t parm.
415 * constexpr.c (cxx_eval_binary_expression): Pass it.
416 * cp-gimplify.c (genericize_spaceship): Pass it.
417 * method.c (genericize_spaceship): Handle class-type arguments.
418 (build_comparison_op): Fall back to op</== when appropriate.
420 2020-12-08 Jason Merrill <jason@redhat.com>
422 * call.c (build_new_op_1): Set *overload for ambiguity.
423 (build_new_method_call_1): Likewise.
425 2020-12-08 Bernd Edlinger <bernd.edlinger@hotmail.de>
427 * decl2.c: (is_atomic_expensive_p): New helper function.
428 (build_atomic_load_byte): Rename to...
429 (build_atomic_load_type): ... and add new parameter type.
430 (get_guard_cond): Skip the atomic here if that is expensive.
431 Use the correct type for the atomic load on certain targets.
433 2020-12-08 Nathan Sidwell <nathan@acm.org>
435 * cp-tree.h (struct tinst_level): Add path & visible fields.
436 (build_cdtor_clones): Declare.
437 (match_mergeable_specialization): Use a spec_entry, add insert parm.
438 * class.c (build_cdtor_clones): Externalize.
439 * pt.c (push_tinst_level_loc): Clear new fields.
440 (match_mergeable_specialization): Adjust API.
442 2020-12-08 Nathan Sidwell <nathan@acm.org>
444 * decl2.c (start_objects): Refactor and adjust for named module
446 (finish_objects): Likewise.
447 (generate_ctor_or_dtor_function): Likewise.
448 * module.cc (module_initializer_kind)
449 (module_add_import_initializers): Stubs.
451 2020-12-08 Nathan Sidwell <nathan@acm.org>
453 * Make-lang.in (MODULE_VERSION): Override when DEVPHASE not empty.
454 * module.cc: Comment.
456 2020-12-08 Nathan Sidwell <nathan@acm.org>
458 * cp-tree.h (mangle_module_substitution, mangle_identifier)
459 (mangle_module_global_init): Declare.
460 * mangle.c (struct globals): Add mod field.
461 (mangle_module_substitution, mangle_identifier)
462 (mangle_module_global_init): Define.
463 (write_module, maybe_write_module): New.
464 (write_name): Call it.
465 (start_mangling): Clear mod field.
466 (finish_mangling_internal): Adjust.
467 * module.cc (mangle_module, mangle_module_fini)
468 (get_originating_module): Stubs.
470 2020-12-08 Nathan Sidwell <nathan@acm.org>
472 * cp-tree.h (module_token_pre, module_token_cdtor)
473 (module_token_lang): Declare.
474 * lex.c: Include langhooks.
475 (struct module_token_filter): New.
476 * cp-tree.h (module_token_pre, module_token_cdtor)
477 (module_token_lang): Define.
478 * module.cc (get_module, preprocess_module, preprocessed_module):
481 2020-12-08 Nathan Sidwell <nathan@acm.org>
483 * Make-lang.in (MODULE_VERSION): Define.
484 * module.cc: Add includes.
486 2020-12-08 Jakub Jelinek <jakub@redhat.com>
489 * parser.c (cp_parser_omp_parallel): For parallel master with
490 -fopenmp-simd only, just call cp_parser_omp_master instead of
491 wrapping it in OMP_PARALLEL.
493 2020-12-07 Marek Polacek <polacek@redhat.com>
496 * decl.c (pop_switch): If SWITCH_STMT_TYPE is a scoped enum type,
497 set it to the type of SWITCH_STMT_COND.
499 2020-12-07 Nathan Sidwell <nathan@acm.org>
501 * cp-tree.h (build_cplus_array_type): Add defaulted DEP parm.
502 * tree.c (set_array_type_common): Add DEP parm.
503 (build_cplus_array_type): Add DEP parm, determine dependency if
504 needed. Mark dependency of new types.
505 (cp_build_qualified_type_real): Adjust array-building call, assert
506 no surprising dependency.
507 (strip_typedefs): Likewise.
509 2020-12-07 Nathan Sidwell <nathan@acm.org>
512 * typeck.c (structural_comptypes): Move early outs to comptype.
513 Always check template-alias match when comparing_specializations.
514 (comptypes): Do early out checking here.
516 2020-12-05 Patrick Palka <ppalka@redhat.com>
519 * constraint.cc (parameter_mapping_equivalent_p): Add some
520 sanity checks. Clarify comment.
521 (tsubst_nested_requirement): Always perform satisfaction
522 quietly first. If that yields an erroneous result, emit a
523 context message and replay satisfaction noisily with the
524 diagnostic normal form.
525 (finish_nested_requirement): Normalize the constraint-expression
526 twice, once with diagnostic information and once without. Store
527 them in a TREE_LIST within the TREE_TYPE.
528 (diagnose_nested_requirement): When replaying satisfaction, use
529 the diagnostic normal form instead of renormalizing on the spot.
531 2020-12-05 Patrick Palka <ppalka@redhat.com>
534 * constraint.cc (struct sat_info): Define.
535 (tsubst_nested_requirement): Pass a sat_info object to
537 (satisfy_constraint_r): Take a sat_info argument instead of
539 (satisfy_conjunction): Likewise.
540 (satisfy_disjunction): Likewise. Instead of first evaluating
541 each branch quietly, evaluate each branch only with
542 unsatisfaction diagnostics disabled. Exit early if evaluation
543 of a branch returns error_mark_node.
544 (satisfy_atom): Take a sat_info argument instead of subst_info.
545 Fix a comment. Check diagnose_unsatisfaction_p() instead of
546 noisy() before replaying a substitution failure.
547 (satisfy_constraint): Take a sat_info argument instead of
549 (satisfy_associated_constraints): Likewise.
550 (satisfy_constraint_expression): Likewise.
551 (satisfy_declaration_constraints): Likewise.
552 (constraint_satisfaction_value): Likewise and adjust
553 accordingly. Fix formatting.
554 (constraints_satisfied_p): Pass a sat_info object to
555 constraint_satisfaction_value.
556 (evaluate_concept_check): Pass a sat_info object to
557 satisfy_constraint_expression.
558 (diagnose_nested_requirement): Likewise.
559 (diagnose_constraints): Pass an appropriate sat_info object to
560 constraint_satisfaction_value.
562 2020-12-05 Jakub Jelinek <jakub@redhat.com>
565 * constexpr.c (cxx_union_active_member): New function.
566 (cxx_fold_indirect_ref_1): Add ctx argument, pass it through to
567 recursive call. Handle UNION_TYPE.
568 (cxx_fold_indirect_ref): Add ctx argument, pass it to recursive calls
569 and cxx_fold_indirect_ref_1.
570 (cxx_eval_indirect_ref): Adjust cxx_fold_indirect_ref calls.
572 2020-12-04 Jason Merrill <jason@redhat.com>
575 * pt.c (convert_template_argument): Handle equivalent placeholders.
576 (do_class_deduction): Look through EXPR_PACK_EXPANSION, too.
578 2020-12-04 Jason Merrill <jason@redhat.com>
580 * decl2.c (clear_consteval_vfns): Remove *.
581 * pt.c (do_auto_deduction): Remove *.
582 * parser.c (cp_parser_late_parsing_default_args): Change loop
585 2020-12-04 Nathan Sidwell <nathan@acm.org>
588 * cp-tree.h (comparing_typenames): Delete.
589 (cplus_build_array_type): Remove default parm.
590 * pt.c (comparing_typenames): Delete.
591 (spec_hasher::equal): Don't increment it.
592 * tree.c (set_array_type_canon): Remove dep parm.
593 (build_cplus_array_type): Remove dep parm changes.
594 (cp_build_qualified_type_real): Remove dependent array type
596 (strip_typedefs): Likewise.
597 * typeck.c (structural_comptypes): Revert comparing_typename
600 2020-12-04 Nathan Sidwell <nathan@acm.org>
602 * cp-tree.h: Add various inline module state predicates, and
603 declare the API that will be provided by modules.cc
605 2020-12-04 Jakub Jelinek <jakub@redhat.com>
608 * cp-gimplify.c (fold_builtin_source_location): Use 2 instead of 0
609 as last argument to cxx_printable_name.
611 2020-12-03 Jason Merrill <jason@redhat.com>
613 * cp-tree.h (releasing_vec::operator[]): Change parameter type to
616 2020-12-03 Nathan Sidwell <nathan@acm.org>
618 * cp-tree.h (OVL_EXPORT): New.
619 (class ovl_iterator): Add get_using, exporting_p.
620 * tree.c (ovl_insert): Extend using_or_hidden meaning to include
623 2020-12-03 Nathan Sidwell <nathan@acm.org>
625 * cp-tree.h (DECL_UNINSTANTIATED_TEMPLATE_FRIEND): New.
626 * pt.c (push_template_decl): Set it.
627 (tsubst_friend_function): Clear it.
629 2020-12-03 Nathan Sidwell <nathan@acm.org>
631 * cp-tree.h (make_unbound_class_template_raw): Declare.
632 (canonical_type_parameter): Declare.
633 * decl.c (make_unbound_class_template_raw): Break out of ...
634 (make_unboud_class_template): ... here. Call it.
635 * pt.c (canonical_type_parameter): Externalize. Refactor & set
636 structural_equality for type parms.
638 2020-12-03 Nathan Sidwell <nathan@acm.org>
641 * tree.c (build_cplus_array_type): Mark dependency of new variant.
642 (cp_build_qualified_type_real, strip_typedefs): Assert
643 TYPE_DEPENDENT_P_VALID, or not a dependent type.
645 2020-12-03 Jakub Jelinek <jakub@redhat.com>
648 * cp-tree.h (cp_build_bit_cast): Declare.
649 * cp-tree.def (BIT_CAST_EXPR): New tree code.
650 * cp-objcp-common.c (names_builtin_p): Handle RID_BUILTIN_BIT_CAST.
651 (cp_common_init_ts): Handle BIT_CAST_EXPR.
652 * cxx-pretty-print.c (cxx_pretty_printer::postfix_expression):
654 * parser.c (cp_parser_postfix_expression): Handle
655 RID_BUILTIN_BIT_CAST.
656 * semantics.c (cp_build_bit_cast): New function.
657 * tree.c (cp_tree_equal): Handle BIT_CAST_EXPR.
658 (cp_walk_subtrees): Likewise.
659 * pt.c (tsubst_copy): Likewise.
660 * constexpr.c (check_bit_cast_type, cxx_eval_bit_cast): New functions.
661 (cxx_eval_constant_expression): Handle BIT_CAST_EXPR.
662 (potential_constant_expression_1): Likewise.
663 * cp-gimplify.c (cp_genericize_r): Likewise.
665 2020-12-03 Jason Merrill <jason@redhat.com>
667 * parser.c (cp_parser_primary_expression): Distinguish
668 parms from vars in error.
669 (cp_parser_late_parsing_default_args): Pushdecl parms
672 2020-12-03 Jason Merrill <jason@redhat.com>
674 * name-lookup.c (begin_scope): Set immediate_fn_ctx_p.
675 * parser.c (cp_parser_late_parsing_default_args): Push
676 sk_function_parms scope.
678 2020-12-03 Peter Bergner <bergner@linux.ibm.com>
681 * typeck2.c (digest_init_r): Handle OPAQUE_TYPE as an aggregate type.
683 2020-12-02 Jakub Jelinek <jakub@redhat.com>
687 * cp-tree.h (source_location_current_p): Declare.
688 * tree.c (source_location_current_p): New function.
689 * call.c (immediate_invocation_p): New function.
690 (build_over_call): Use it to resolve LWG3396.
691 * constexpr.c (cxx_eval_builtin_function_call): Temporarily set
692 current_function_decl from ctx->call->fundef->decl if any.
693 * cp-gimplify.c (cp_genericize_r) <case CALL_EXPR>: Fold calls
694 to immediate function std::source_location::current ().
696 2020-12-02 Jason Merrill <jason@redhat.com>
698 * decl.c (grokdeclarator): Improve diagnostic for
699 disallowed CTAD placeholder.
701 2020-12-02 Jason Merrill <jason@redhat.com>
703 * decl.c (check_initializer): Also look through STMT_EXPR
706 2020-12-02 Nathan Sidwell <nathan@acm.org>
708 * cp-tree.h (comparing_typenames): Declare.
709 * pt.c (comparing_typenames): Define.
710 (spec_hasher::equal): Increment it around comparisons.
711 * typeck.c (structural_comptypes): Adjust TYPENAME resolution
714 2020-12-02 Marek Polacek <polacek@redhat.com>
717 * constexpr.c (fold_non_dependent_init): Add a tree parameter.
719 * cp-tree.h (fold_non_dependent_init): Add a tree parameter with
721 * typeck2.c (store_init_value): Call fold_non_dependent_expr
722 only when checking the initializer for constexpr variables.
723 Call fold_non_dependent_init instead of maybe_constant_init.
725 2020-12-02 Marek Polacek <polacek@redhat.com>
729 * pt.c (tsubst_copy_and_build) <case NEW_EXPR>: Return error_mark_node
730 if init is erroneous.
732 2020-12-02 Nathan Sidwell <nathan@acm.org>
734 * cp-tree.h (DECL_MODULE_PURVIEW_P, DECL_MODULE_IMPORT_P)
735 (DECL_MODULE_ENTITY_P): New.
736 (DECL_MODULE_PENDING_SPECIALIZATIONS_P): New.
737 (DECL_MODULE_PENDING_MEMBERS_P): New.
738 (DECL_MODULE_ATTACHMENTS_P): New.
739 (DECL_MODULE_EXPORT_P): New.
740 (struct lang_decl_base): Shrink sel field. Add new
741 module-specific fields.
743 2020-12-02 Nathan Sidwell <nathan@acm.org>
745 * cp-tree.h (DECL_TINFO_P): Also for TYPE_DECLs.
746 (get_tinfo_decl_direct): Declare.
747 (get_pseudo_tinfo_index, get_pseudo_tinfo_type): Declare.
748 * rtti.c (get_tinfo_decl_direct): Externalize.
749 (get_tinfo_desc): Set DECL_TINFO_P on the typedef.
750 (get_pseudo_tinfo_index, get_pseudo_tinfo_type): New.
752 2020-12-02 Nathan Sidwell <nathan@acm.org>
754 * cp-tree.h (maybe_add_lang_decl_raw, maybe_add_lang_type_raw):
756 * lex.c (maybe_add_lang_decl_raw, maybe_add_lang_type_raw):
757 Externalize, reformat.
759 2020-12-02 Nathan Sidwell <nathan@acm.org>
761 * cp-tree.h (build_cplus_array_type): Add defaulted DEP parm.
762 * tree.c (set_array_type_common): Add DEP parm.
763 (build_cplus_array_type): Add DEP parm, determine dependency if
765 (cp_build_qualified_type_real): Adjust array-building call.
766 (strip_typedefs): Likewise.
768 2020-12-02 Nathan Sidwell <nathan@acm.org>
770 * ptree.c (cxx_print_xnode): Increase binding-vector prefix size.
772 2020-12-02 Nathan Sidwell <nathan@acm.org>
774 * cp-tree.def (BINDING_VECTOR): New.
775 * name-lookup.h (struct binding_slot): New.
776 (BINDING_VECTOR_SLOTS_PER_CLUSTER): New.
777 (struct binding_index, struct binding_cluster): New.
778 (BINDING_VECTOR_ALLOC_CLUSTERS, BINDING_VECTOR_CLUSTER_BASE)
779 (BINDING_VECTOR_CLUSTER): New.
780 (struct tree_binding_vec): New.
781 (BINDING_VECTOR_NAME, BINDING_VECTOR_GLOBAL_DUPS_P)
782 (BINDING_VECTOR_PARTITION_DUPS_P): New.
783 (BINDING_BINDING_GLOBAL_P, BINDING_BINDING_PARTITION_P): New.
784 (BINDING_VECTOR_PENDING_SPECIALIZATIONS)
785 (BINDING_VECTOR_PENDING_IS_HEADER_P)
786 (BINDING_VECTOR_PENDING_IS_PARTITION_P): New.
787 * cp-tree.h (enum cp_tree_node_structure_enum): Add
788 TS_CP_BINDING_VECTOR.
789 (union lang_tree_node): Add binding_vec field.
790 (make_binding_vec): Declare.
791 (named_decl_hash::hash, named_decl_hash::equal): Check for binding
793 * decl.c (cp_tree_node_structure): Add BINDING_VECTOR case.
794 * ptree.c (cxx_print_xnode): Add BINDING_VECTOR case.
795 * tree.c (make_binding_vec): New.
797 2020-12-01 Ville Voutilainen <ville.voutilainen@gmail.com>
800 * cxx-pretty-print.c (pp_cxx_trait_expression):
801 Add support for __is_nothrow_{assignable,constructible}.
803 2020-12-01 Jakub Jelinek <jakub@redhat.com>
806 * parser.c (cp_parser_omp_depobj): Suppress location wrappers when
807 parsing depend clause.
809 2020-12-01 Nathan Sidwell <nathan@acm.org>
811 * lex.c (init_reswords): Maybe enable module keywords.
813 2020-12-01 Nathan Sidwell <nathan@acm.org>
815 * lang-specs.h: Add module-related options.
817 2020-12-01 Iain Sandoe <iain@sandoe.co.uk>
819 * parser.c (cp_parser_declaration): Add a not about where
820 attributes may be placed.
822 2020-11-27 Martin Sebor <msebor@redhat.com>
824 * error.c (add_quotes): Revert previous change and use pragma to
825 suppress -Wformat-diag.
827 2020-11-26 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
829 * g++spec.c (TIMELIB, TIME_LIBRARY): Remove.
830 (lang_specific_driver): Remove TIME_LIBRARY handling.
832 2020-11-26 Thomas Schwinge <thomas@codesourcery.com>
834 * parser.c (cp_parser_omp_var_list_no_open): Assert that array
835 section's 'low_bound', 'length' are not location wrapper nodes.
836 (cp_parser_oacc_all_clauses, cp_parser_oacc_cache): Instantiate
837 'auto_suppress_location_wrappers'.
839 2020-11-25 Martin Sebor <msebor@redhat.com>
842 * constraint.cc (debug_argument_list): Avoid -Wformat-diag.
843 * error.c (function_category): Same.
844 (print_template_differences): Same.
845 * logic.cc (debug): Same.
846 * name-lookup.c (lookup_using_decl): Same.
847 * parser.c (maybe_add_cast_fixit): Same.
848 (cp_parser_template_introduction): Same.
849 * typeck.c (access_failure_info::add_fixit_hint): Same.
851 2020-11-25 Thomas Schwinge <thomas@codesourcery.com>
853 * pt.c (tsubst_omp_clauses): Handle 'OMP_CLAUSE__CACHE_'.
854 (tsubst_expr): Handle 'OACC_CACHE'.
856 2020-11-24 Jason Merrill <jason@redhat.com>
859 * typeck2.c (store_init_value): Don't split_nonconstant_init in a
862 2020-11-24 Jakub Jelinek <jakub@redhat.com>
864 PR tree-optimization/96929
865 * constexpr.c (cxx_eval_binary_expression): For shifts by constant
866 with MSB set, emulate older wide_int_binop behavior to preserve
867 diagnostics and -fpermissive behavior.
869 2020-11-23 Nathan Sidwell <nathan@acm.org>
871 * module.cc: New dummy file.
872 * Make-lang.in: Add rules to build module.o
874 2020-11-23 Jozef Lawrynowicz <jozef.l@mittosystems.com>
876 * decl.c (start_decl): Set DECL_INITIAL for initialized decls
877 before attribute processing.
879 2020-11-23 Richard Sandiford <richard.sandiford@arm.com>
882 * pt.c (tsubst): Use verify_type_context to check the type
885 2020-11-21 Marek Polacek <polacek@redhat.com>
888 * parser.c (warn_for_range_copy): Warn when the loop variable is
889 initialized with a value of a different type resulting in a copy.
891 2020-11-21 Marek Polacek <polacek@redhat.com>
894 * constexpr.c (potential_constant_expression_1): Reject
895 LABEL_EXPRs that use non-artifical LABEL_DECLs.
897 2020-11-21 Marek Polacek <polacek@redhat.com>
900 * parser.c (warn_about_ambiguous_parse): Only assume "int" if we
901 actually saw any type-specifiers.
903 2020-11-21 Marek Polacek <polacek@redhat.com>
906 * parser.c (cp_parser_lambda_declarator_opt): Don't require ().
908 2020-11-21 Marek Polacek <polacek@redhat.com>
911 * constexpr.c (cxx_set_object_constness): New function.
912 (cxx_eval_call_expression): Set new_obj for destructors too.
913 Call cxx_set_object_constness to set/unset TREE_READONLY of
914 the object under construction/destruction.
916 2020-11-21 Aaron Sawdey <acsawdey@linux.ibm.com>
918 * error.c (dump_type): Handle opaque types.
919 (dump_type_prefix): Handle opaque types.
920 (dump_type_suffix): Handle opaque types.
921 (dump_expr): Handle opaque types.
922 * pt.c (tsubst): Allow opaque types in templates.
923 (unify): Allow opaque types in templates.
924 * typeck.c (structural_comptypes): Handle comparison
927 2020-11-20 Jakub Jelinek <jakub@redhat.com>
930 * Make-lang.in (c++.serial): Change from goal to a variable.
931 (.PHONY): Drop c++.serial and c++.prev.
932 (cc1plus$(exeext)): Depend on $(c++.serial) rather than c++.serial.
934 2020-11-19 Nathan Sidwell <nathan@acm.org>
936 * cp-tree.h (struct spec_entry): Moved from pt.c.
937 (walk_specializations, match_mergeable_specialization)
938 (get_mergeable_specialization_flags)
939 (add_mergeable_specialization): Declare.
940 * pt.c (struct spec_entry): Moved to cp-tree.h.
941 (walk_specializations, match_mergeable_specialization)
942 (get_mergeable_specialization_flags)
943 (add_mergeable_specialization): New.
945 2020-11-19 Nathan Sidwell <nathan@acm.org>
947 * cp-tree.h (struct constexpr_fundef): Moved from constexpr.c.
948 (maybe_save_constexpr_fundef): Declare.
949 (register_constexpr_fundef): Take constexpr_fundef object, return
951 * decl.c (mabe_save_function_definition): Delete, functionality
952 moved to maybe_save_constexpr_fundef.
953 (emit_coro_helper, finish_function): Adjust.
954 * constexpr.c (struct constexpr_fundef): Moved to cp-tree.h.
955 (constexpr_fundef_hasher::equal): Constify.
956 (constexpr_fundef_hasher::hash): Constify.
957 (retrieve_constexpr_fundef): Make non-static.
958 (maybe_save_constexpr_fundef): Break out checking and duplication
960 (register_constexpr_fundef): ... here. Just register the constexpr.
962 2020-11-19 Marek Polacek <polacek@redhat.com>
965 * init.c (build_new): When value-initializing an array new,
966 leave the INIT as an empty vector.
968 2020-11-19 Marek Polacek <polacek@redhat.com>
971 * pt.c (do_auto_deduction): Don't crash when the constructor has
974 2020-11-19 Nathan Sidwell <nathan@acm.org>
977 * decl.c (duplicate_decls): Relax new assert.
979 2020-11-18 Iain Sandoe <iain@sandoe.co.uk>
981 * parser.c (cp_parser_objc_valid_prefix_attributes): Check
982 for empty attributes.
984 2020-11-18 Jakub Jelinek <jakub@redhat.com>
986 * Make-lang.in (c++.serial): New goal.
987 (.PHONY): Add c++.serial c++.prev.
988 (cc1plus$(exeext)): Depend on c++.prev. Call LINK_PROGRESS.
990 2020-11-17 Nathan Sidwell <nathan@acm.org>
993 * decl.c (duplicate_decls): Deal with duplicated DECL_LOCAL_DECL_P
994 decls. Extend decl_lang_specific checking assert.
996 2020-11-17 Nathan Sidwell <nathan@acm.org>
998 * cp-tree.h (enum cp_tree_index): Reorder to place lazy fields
999 after newly-added CPTI_MODULE_HWM.
1001 2020-11-17 Iain Sandoe <iain@sandoe.co.uk>
1004 * parser.c (cp_parser_declaration): Remove checking assert.
1006 2020-11-15 Jason Merrill <jason@redhat.com>
1008 * decl.c (cp_finish_decl): Only check abstractness on definition.
1009 (require_complete_types_for_parms): Check abstractness here.
1010 (create_array_type_for_decl): Not here.
1011 (grokdeclarator, grokparms, complete_vars): Not here.
1012 * pt.c (tsubst, tsubst_arg_types, tsubst_function_type): Not here.
1013 * typeck2.c (struct pending_abstract_type): Remove.
1014 (struct abstract_type_hasher): Remove.
1015 (abstract_pending_vars, complete_type_check_abstract): Remove.
1016 (abstract_virtuals_error_sfinae): Handle arrays.
1017 * call.c (conv_is_prvalue): Split out from...
1018 (conv_binds_ref_to_prvalue): ...here.
1019 (implicit_conversion_1): Rename from implicit_conversion.
1020 (implicit_conversion): An abstract prvalue is bad.
1021 (convert_like_internal): Don't complain if expr is already
1024 2020-11-13 Jason Merrill <jason@redhat.com>
1026 * cp-tree.h (USING_DECL_UNRELATED_P): New.
1027 (CONST_DECL_USING_P): New.
1028 * class.c (handle_using_decl): If USING_DECL_UNRELATED_P,
1029 clone the CONST_DECL.
1030 * name-lookup.c (supplement_binding_1): A clone hides its
1032 (lookup_using_decl): Rewrite to separate lookup and validation.
1033 (do_class_using_decl): Adjust.
1034 (finish_nonmember_using_decl): Adjust.
1035 * parser.c (make_location): Add cp_token overload.
1036 (finish_using_decl): Split out from...
1037 (cp_parser_using_declaration): ...here. Don't look through enums.
1038 (cp_parser_using_enum): New.
1039 (cp_parser_block_declaration): Call it.
1040 (cp_parser_member_declaration): Call it.
1041 * semantics.c (finish_id_expression_1): Handle enumerator
1042 used from class scope.
1044 2020-11-13 Vladimir N. Makarov <vmakarov@redhat.com>
1046 * parser.c (cp_parser_asm_definition): Parse outputs for asm
1049 2020-11-13 Iain Sandoe <iain@sandoe.co.uk>
1052 * parser.c (cp_parser_objc_class_interface): Pass the
1053 location of the class name to the interface declaration.
1055 2020-11-13 Patrick Palka <ppalka@redhat.com>
1057 * semantics.c (finish_compound_literal): Don't wrap the original
1058 compound literal in a TARGET_EXPR when inside a template.
1060 2020-11-12 Jakub Jelinek <jakub@redhat.com>
1063 * constexpr.c (cxx_eval_constant_expression) <case CLEANUP_POINT_EXPR,
1064 case TRY_FINALLY_EXPR, case CLEANUP_STMT>: Don't pass jump_target to
1065 cxx_eval_constant_expression when evaluating the cleanups.
1067 2020-11-11 Iain Sandoe <iain@sandoe.co.uk>
1069 * parser.c (cp_parser_declaration): Unless we are compiling for
1070 Ojective-C++, warn about and discard any attributes that prefix
1071 a linkage specification.
1073 2020-11-11 Patrick Palka <ppalka@redhat.com>
1076 * mangle.c (write_expression): Mangle __alignof_ differently
1077 from alignof when the ABI version is at least 15.
1079 2020-11-11 Patrick Palka <ppalka@redhat.com>
1082 * cp-tree.h (cxx_sizeof_or_alignof_expr): Add bool parameter.
1083 * decl.c (fold_sizeof_expr): Pass false to
1084 cxx_sizeof_or_alignof_expr.
1085 * parser.c (cp_parser_unary_expression): Pass std_alignof to
1086 cxx_sizeof_or_alignof_expr.
1087 * pt.c (tsubst_copy): Pass false to cxx_sizeof_or_alignof_expr.
1088 (tsubst_copy_and_build): Pass std_alignof to
1089 cxx_sizeof_or_alignof_expr.
1090 * typeck.c (cxx_alignof_expr): Add std_alignof bool parameter
1091 and pass it to cxx_sizeof_or_alignof_type. Set ALIGNOF_EXPR_STD_P
1093 (cxx_sizeof_or_alignof_expr): Add std_alignof bool parameter
1094 and pass it to cxx_alignof_expr. Assert op is either
1095 SIZEOF_EXPR or ALIGNOF_EXPR.
1097 2020-11-11 Marek Polacek <polacek@redhat.com>
1100 * pt.c (tsubst_qualified_id): Use EXPR_LOCATION of the qualified-id.
1101 Use it to maybe_wrap_with_location the final expression.
1103 2020-11-10 Marek Polacek <polacek@redhat.com>
1106 * cp-tree.h (finish_static_assert): Adjust declaration.
1107 * parser.c (cp_parser_static_assert): Pass false to
1108 finish_static_assert.
1109 * pt.c (tsubst_expr): Pass true to finish_static_assert.
1110 * semantics.c (find_failing_clause_r): New function.
1111 (find_failing_clause): New function.
1112 (finish_static_assert): Add a bool parameter. Use
1113 iloc_sentinel. Call contextual_conv_bool instead of
1114 perform_implicit_conversion_flags. Don't check for INTEGER_CST before
1115 calling integer_zerop. Call find_failing_clause and maybe use its
1116 location. Print the original condition or the failing clause if
1119 2020-11-10 Strager Neds <strager.nds@gmail.com>
1121 * decl.c (duplicate_decls): Use new overload of
1122 set_decl_section_name.
1123 * method.c (use_thunk): Same.
1124 * optimize.c (maybe_clone_body): Same.
1125 * coroutines.cc (act_des_fn): Same.
1127 2020-11-10 Jakub Jelinek <jakub@redhat.com>
1130 * cvt.c (convert_to_void): Check (complain & tf_warning) in the outer
1131 if rather than twice times in the inner one. Use warn_if_unused_value.
1134 2020-11-10 Chung-Lin Tang <cltang@codesourcery.com>
1136 * parser.c (cp_parser_omp_target_data): Add use of
1137 new c_omp_adjust_map_clauses function. Add GOMP_MAP_ATTACH_DETACH as
1138 handled map clause kind.
1139 (cp_parser_omp_target_enter_data): Likewise.
1140 (cp_parser_omp_target_exit_data): Likewise.
1141 (cp_parser_omp_target): Likewise.
1142 * semantics.c (handle_omp_array_sections): Adjust COMPONENT_REF case to
1143 use GOMP_MAP_ATTACH_DETACH map kind for C_ORT_OMP region type. Fix
1144 interaction between reference case and attach/detach.
1145 (finish_omp_clauses): Adjust bitmap checks to allow struct decl and
1146 same struct field access to co-exist on OpenMP construct.
1148 2020-11-09 Marek Polacek <polacek@redhat.com>
1151 * parser.c (cp_parser_check_std_attribute): Return bool. Add a
1152 location_t parameter. Return true if the attribute wasn't duplicated.
1153 Give a warning instead of an error. Check more attributes.
1154 (cp_parser_std_attribute_list): Don't add duplicated attributes to
1155 the list. Pass location to cp_parser_check_std_attribute.
1157 2020-11-09 Patrick Palka <ppalka@redhat.com>
1159 * constraint.cc (norm_info::norm_info): Initialize orig_decl.
1160 (norm_info::orig_decl): New data member.
1161 (normalize_atom): When caching an atom for the first time,
1162 compute a list of template parameters used in the targets of the
1163 parameter mapping and store it in the TREE_TYPE of the mapping.
1164 (get_normalized_constraints_from_decl): Set current_function_decl
1165 appropriately when normalizing. As an optimization, don't
1166 set up a push_nested_class_guard when decl has no constraints.
1167 (sat_hasher::hash): Use this list to hash only the template
1168 arguments that are relevant to the atom.
1169 (satisfy_atom): Use this list to compare only the template
1170 arguments that are relevant to the atom.
1171 * pt.c (keep_template_parm): Do a sanity check on the parameter's
1172 index when flag_checking.
1174 2020-11-09 Patrick Palka <ppalka@redhat.com>
1176 * cp-tree.h (ATOMIC_CONSTR_MAP_INSTANTIATED_P): Define this flag
1178 * constraint.cc (sat_hasher::hash): Use hash_atomic_constraint
1179 if the flag is set, otherwise keep using a pointer hash.
1180 (sat_hasher::equal): Return false if the flag's setting differs
1181 on two atoms. Call atomic_constraints_identical_p if the flag
1182 is set, otherwise keep using a pointer equality test.
1183 (satisfy_atom): After instantiating the parameter mapping, form
1184 another ATOMIC_CONSTR using the instantiated mapping and query
1185 the cache again. Cache the satisfaction value of both atoms.
1186 (diagnose_atomic_constraint): Simplify now that the supplied
1187 atom has an instantiated mapping.
1189 2020-11-09 Patrick Palka <ppalka@redhat.com>
1191 * constraint.cc (atom_cache): Define this deletable hash_table.
1192 (normalize_atom): Use it to cache ATOMIC_CONSTRs when not
1193 generating diagnostics.
1194 (sat_hasher::hash): Use htab_hash_pointer instead of
1195 hash_atomic_constraint.
1196 (sat_hasher::equal): Test for pointer equality instead of
1197 atomic_constraints_identical_p.
1198 * cp-tree.h (struct atom_hasher): Moved and renamed from ...
1199 * logic.cc (struct constraint_hash): ... here.
1200 (clause::m_set): Adjust accordingly.
1202 2020-11-09 Patrick Palka <ppalka@redhat.com>
1205 * constraint.cc (tsubst_parameter_mapping): Also canonicalize
1206 the type arguments of a TYPE_ARGUMENT_PACk.
1208 2020-11-09 Jason Merrill <jason@redhat.com>
1210 * pt.c (tsubst): Replace *_ARGUMENT_PACK code with
1211 a call to tsubst_argument_pack.
1213 2020-11-09 Jason Merrill <jason@redhat.com>
1215 * class.c (handle_using_decl): Add an iloc_sentinel.
1217 2020-11-09 Marek Polacek <polacek@redhat.com>
1220 * parser.c (warn_about_ambiguous_parse): Handle the case when
1221 there is no type in the decl-specifiers.
1223 2020-11-09 Nathan Sidwell <nathan@acm.org>
1225 * cp-tree.h (LOOKUP_FOUND_P): Add ENUMERAL_TYPE.
1226 * name-lookup.c (class name_lookup): Add comments.
1227 (name_lookup::adl_namespace_only): Replace with ...
1228 (name_lookup::adl_class_fns): ... this and ...
1229 (name_lookup::adl_namespace_fns): ... this.
1230 (name_lookup::adl_namespace): Deal with inline nests here.
1231 (name_lookup::adl_class): Complete the type here.
1232 (name_lookup::adl_type): Call broken-out enum ..
1233 (name_lookup::adl_enum): New. No need to call the namespace adl
1234 if it is class-scope.
1235 (name_lookup::search_adl): Iterate over collected scopes here.
1237 2020-11-09 Nathan Sidwell <nathan@acm.org>
1239 * name-lookup.c (lookup_qualified_name): Expose an overload of a
1240 singleton with known type.
1241 (lookup_name_1): Just check the overload's type to expose it.
1242 * parser.c (cp_parser_lookup_name): Do not do that check here.
1244 2020-11-08 Iain Sandoe <iain@sandoe.co.uk>
1246 * parser.c (cp_parser_objc_at_property_declaration): Handle
1247 class keywords in @property attribute context.
1249 2020-11-06 Marek Polacek <polacek@redhat.com>
1252 * except.c (can_convert_eh): Change the return type to bool. If
1253 the type TO and FROM are the same, return true.
1255 2020-11-06 Iain Sandoe <iain@sandoe.co.uk>
1257 * parser.c (cp_parser_objc_at_property_declaration):
1258 Improve parsing fidelity. Associate better location info
1259 with @property attributes. Clean up the interface to
1260 objc_add_property_declaration ().
1262 2020-11-06 Jakub Jelinek <jakub@redhat.com>
1265 * decl.c (duplicate_decls): Propagate DECL_ATTRIBUTES and
1266 DECL_PRESERVE_P from olddecl to its clones if any.
1268 2020-11-06 Nathan Sidwell <nathan@acm.org>
1270 * cp-tree.h (DECL_UNDECLARED_BUILTIN_P): Delete.
1271 * cp-objcp-common.c (names_bultin_p): Rename
1272 DECL_IS_BUILTIN->DECL_IS_UNDECLARED_BUILTIN.
1273 * decl.c (decls_match): Likewise. Replace
1274 DECL_UNDECLARED_BUILTIN_P with DECL_IS_UNDECLARED_BUILTIN.
1275 (duplicate_decls): Likewise.
1276 * decl2.c (collect_source_refs): Likewise.
1277 * name-lookup.c (anticipated_builtin_p, print_binding_level)
1278 (do_nonmember_using_decl): Likewise.
1279 * pt.c (builtin_pack_fn_p): Likewise.
1280 * typeck.c (error_args_num): Likewise.
1282 2020-11-06 Nathan Sidwell <nathan@acm.org>
1284 * parser.c (cp_parser_template_declaration): Adjust 'export' warning.
1285 (cp_parser_explicit_specialization): Remove unneeded bool setting.
1287 2020-11-06 Jan Hubicka <jh@suse.cz>
1289 * tree.c (cp_fix_function_decl_p): Do not access ipa_ref_list dirrectly.
1291 2020-11-06 Tobias Burnus <tobias@codesourcery.com>
1293 * parser.c (cp_parser_omp_atomic): Add openacc parameter and update
1295 (cp_parser_omp_construct): Update call.
1297 2020-11-05 Marek Polacek <polacek@redhat.com>
1299 * except.c (check_handlers_1): Add auto_diagnostic_group.
1301 2020-11-05 Marek Polacek <polacek@redhat.com>
1304 * pt.c (do_auto_deduction): If init is REFERENCE_REF_P, use its
1307 2020-11-05 Marek Polacek <polacek@redhat.com>
1310 * except.c (check_handlers_1): Use OPT_Wexceptions for the
1311 warning. Use inform for the second part of the warning.
1313 2020-11-05 Marek Polacek <polacek@redhat.com>
1316 * cp-tree.h (enum cp_tree_index): Add CPTI_EXPLICIT_VOID_LIST.
1317 (explicit_void_list_node): Define.
1318 (PARENTHESIZED_LIST_P): New macro.
1319 (struct cp_declarator): Add function::parens_loc.
1320 * decl.c (cxx_init_decl_processing): Initialize explicit_void_list_node.
1321 (grokparms): Also break when explicit_void_list_node.
1322 * parser.c (make_call_declarator): New location_t parameter. Use it
1323 to set declarator->u.function.parens_loc.
1324 (cp_parser_lambda_declarator_opt): Pass UNKNOWN_LOCATION to
1325 make_call_declarator.
1326 (warn_about_ambiguous_parse): New function.
1327 (cp_parser_init_declarator): Call warn_about_ambiguous_parse.
1328 (cp_parser_declarator): Set *parenthesized_p to false rather than to
1330 (cp_parser_direct_declarator): Create a location for the function's
1331 parentheses and pass it to make_call_declarator.
1332 (cp_parser_parameter_declaration_clause): Return explicit_void_list_node
1334 (cp_parser_parameter_declaration_list): Set PARENTHESIZED_LIST_P
1335 in the parameters tree.
1337 2020-11-04 Jakub Jelinek <jakub@redhat.com>
1340 * semantics.c (finish_omp_clauses): Look through array reductions to
1341 find underlying decl to clear in the aligned_head bitmap. Use
1342 DECL_UID (t) instead of DECL_UID (OMP_CLAUSE_DECL (c)) when clearing
1343 in the bitmap. Only diagnose errors about allocate vars not being
1344 privatized on the same construct on allocate clause if it has
1345 a DECL_P OMP_CLAUSE_DECL.
1347 2020-11-04 Iain Sandoe <iain@sandoe.co.uk>
1349 * constexpr.c (potential_constant_expression_1): Handle
1350 expressions known to be non-constant for Objective-C.
1352 2020-11-03 Jason Merrill <jason@redhat.com>
1354 * tree.c (is_byte_access_type): Don't use char_type_p.
1356 2020-11-03 Jakub Jelinek <jakub@redhat.com>
1359 * parser.c (cp_parser_init_declarator): Don't try to parse
1360 C++17 deduction guides if there are any type specifiers even when
1363 2020-11-03 Kamlesh Kumar <kamleshbhalui@gmail.com>
1364 Jason Merrill <jason@redhat.com>
1368 * pt.c (get_template_base): Consider closest base in template
1369 deduction when base of base also matches.
1371 2020-11-03 Nathan Sidwell <nathan@acm.org>
1373 * pt.c (tsubst_expr): Simplify using decl instantiation, add
1376 2020-11-03 Nathan Sidwell <nathan@acm.org>
1378 * class.c (copy_fndecl_with_name): Always not top level.
1379 (build_cdtor_clones): Add update_methods parm, use it to
1380 conditionally update the method vec. Return void
1381 (clone_cdtor): Adjust.
1382 (clone_constructors_and_destructors): Adjust comment.
1384 2020-11-03 Nathan Sidwell <nathan@acm.org>
1386 * pt.c (primary_template_specialization_p): Use
1387 VAR_OR_FUNCTION_DECL_P.
1388 (tsubst_template_decl): Check for FUNCTION_DECL, not !TYPE && !VAR
1389 for registering a specialization.
1391 2020-11-03 Nathan Sidwell <nathan@acm.org>
1393 * cp-tree.h (fixup_deferred_exception_variants): Declare.
1394 * parser.c (cp_parser_class_specifier_1): Call it when
1395 completing deferred parses rather than creating a variant.
1396 (cp_parser_member_declaration): Move comment from ...
1397 (cp_parser_noexcept_specification_opt): ... here. Refactor the
1399 * tree.c (fixup_deferred_exception_variants): New.
1401 2020-11-03 Nathan Sidwell <nathan@acm.org>
1403 * pt.c (tsubst_lambda_expr): Reorder extra-scope handling to match
1404 the non-template case.
1405 (instantiate_body): Move a couple of declarations to their
1408 2020-11-03 Nathan Sidwell <nathan@acm.org>
1410 * decl.c (duplicate_decls): Return error_mark_node fo extern-c
1413 2020-11-03 Marek Polacek <polacek@redhat.com>
1415 * constexpr.c (potential_constant_expression_1): Treat
1416 __PRETTY_FUNCTION__ inside a template function as
1417 potentially-constant.
1418 * pt.c (uses_template_parms): Call
1419 instantiation_dependent_expression_p instead of
1420 value_dependent_expression_p.
1421 (instantiation_dependent_expression_p): Check
1422 potential_constant_expression before calling
1423 value_dependent_expression_p.
1425 2020-11-03 Marek Polacek <polacek@redhat.com>
1428 * init.c (build_new_1): Disable -Winit-list-lifetime for an unevaluated
1431 2020-11-03 Nathan Sidwell <nathan@acm.org>
1433 * tree.c (bind_template_template_parm): Mark the parm as a
1435 (cp_tree_equal): Refactor CALL_EXPR. Use comp_template_args for
1438 2020-11-03 Nathan Sidwell <nathan@acm.org>
1440 * rtti.c (init_rtti_processing): Move var decl to its init.
1441 (get_tinfo_decl): Likewise. Break out creation to called helper
1443 (get_tinfo_decl_direct): ... here.
1444 (build_dynamic_cast_1): Move var decls to their initializers.
1445 (tinfo_base_init): Set decl's location to BUILTINS_LOCATION.
1446 (get_tinfo_desc): Only push ABI namespace when needed. Set type's
1449 2020-11-02 Nathan Sidwell <nathan@acm.org>
1451 * decl.c (start_decl_1): Refactor declarations. Fixup some
1453 (lookup_and_check_tag): Fixup some whitespace.
1455 2020-11-02 Nathan Sidwell <nathan@acm.org>
1457 * decl.c (duplicate_decls): Refactor some template & builtin
1460 2020-11-02 Nathan Sidwell <nathan@acm.org>
1462 * cp-tree.h (struct cxx_int_tree_map): Delete.
1463 (struct cxx_int_tree_map_hasher): Delete.
1464 * cp-gimplify.c (cxx_int_tree_map_hasher::equal): Delete.
1465 (cxx_int_tree_map_hasher::hash): Delete.
1467 2020-11-02 Patrick Palka <ppalka@redhat.com>
1469 * class.c (finish_struct_1): Don't call clear_satisfaction_cache.
1470 * constexpr.c (clear_cv_and_fold_caches): Likewise. Remove bool
1472 * constraint.cc (clear_satisfaction_cache): Remove definition.
1473 * cp-tree.h (clear_satisfaction_cache): Remove declaration.
1474 (clear_cv_and_fold_caches): Remove bool parameter.
1475 * typeck2.c (store_init_value): Remove argument to
1476 clear_cv_and_fold_caches.
1478 2020-11-01 Iain Sandoe <iain@sandoe.co.uk>
1480 * parser.c (cp_parser_objc_at_property_declaration): Use any
1481 exisiting syntax error to suppress complaints about a missing
1482 closing parenthesis in parsing property attributes.
1484 2020-10-30 Jakub Jelinek <jakub@redhat.com>
1486 * semantics.c (finish_omp_clauses) <case OMP_CLAUSE_ALLOCATE>: Handle
1487 non-static members in methods.
1488 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_ALLOCATE.
1490 2020-10-29 Marek Polacek <polacek@redhat.com>
1494 * parser.c (cp_parser_type_id_1): Reject using auto as
1495 a template-argument in C++20.
1497 2020-10-29 Marek Polacek <polacek@redhat.com>
1500 * pt.c (do_auto_deduction): Call resolve_nondeduced_context for
1501 the elements of a { } list.
1503 2020-10-29 Marek Polacek <polacek@redhat.com>
1505 * typeck.c (do_warn_enum_conversions): Don't warn for SPACESHIP_EXPR.
1506 (cp_build_binary_op): Reject float <=> enum or enum <=> float. Use
1507 CP_INTEGRAL_TYPE_P instead of INTEGRAL_OR_ENUMERATION_TYPE_P.
1509 2020-10-29 Patrick Palka <ppalka@redhat.com>
1511 * constraint.cc (get_normalized_constraints): Remove 'args'
1512 parameter. Pass NULL_TREE as the initial template arguments to
1513 normalize_expression.
1514 (get_normalized_constraints_from_info): Remove 'args' parameter
1515 and adjust the call to get_normalized_constraints.
1516 (get_normalized_constraints_from_decl): Remove 'args' local
1517 variable and adjust call to get_normalized_constraints_from_info.
1518 (normalize_concept_definition): Remove 'args' local variable
1519 and adjust call to get_normalized_constraints.
1520 (normalize_constraint_expression): Remove the two-parameter
1521 overload. Remove 'args' parameter from the three-parameter
1522 overload and update function comment accordingly. Remove
1523 default argument from 'diag' parameter. Adjust call to
1524 get_normalized_constraints.
1525 (finish_nested_requirement): Adjust call to
1526 normalize_constraint_expression.
1527 (strictly_subsumes): Remove 'args' parameter. Adjust call to
1528 get_normalized_constraints_from_info.
1529 (weakly_subsumes): Likewise.
1530 * cp-tree.h (strictly_subsumes): Remove 'args' parameter.
1531 (weakly_subsumes): Likewise.
1532 * pt.c (process_partial_specialization): Adjust call to
1534 (is_compatible_template_arg): Adjust call to weakly_subsumes.
1536 2020-10-29 Patrick Palka <ppalka@redhat.com>
1539 * constraint.cc (normalize_concept_check): Don't call
1540 tsubst_template_args when 'args' is NULL.
1542 2020-10-29 Jason Merrill <jason@redhat.com>
1545 * constexpr.c (cxx_eval_outermost_constant_expr): Revert to
1546 original expression if evaluation sets non_constant_p.
1548 2020-10-29 Jakub Jelinek <jakub@redhat.com>
1549 Jason Merrill <jason@redhat.com>
1552 * constexpr.c (cxx_bind_parameters_in_call): Set non_constant_args
1553 if the parameter type has a non-trivial destructor.
1554 (cxx_eval_call_expression): Only unshare arguments if we're
1555 memoizing this evaluation.
1557 2020-10-29 Jakub Jelinek <jakub@redhat.com>
1560 * cp-tree.h (enum cp_tree_index): Add CPTI_HEAP_VEC_UNINIT_IDENTIFIER
1561 and CPTI_HEAP_VEC_IDENTIFIER.
1562 (heap_vec_uninit_identifier, heap_vec_identifier): Define.
1563 * decl.c (initialize_predefined_identifiers): Initialize those
1565 * constexpr.c (cxx_eval_call_expression): Reject array allocations
1566 deallocated with non-array deallocation or non-array allocations
1567 deallocated with array deallocation.
1568 (non_const_var_error): Handle heap_vec_uninit_identifier and
1569 heap_vec_identifier too.
1570 (cxx_eval_constant_expression): Handle also heap_vec_uninit_identifier
1571 and in that case during initialization replace it with
1572 heap_vec_identifier.
1573 (find_heap_var_refs): Handle heap_vec_uninit_identifier and
1574 heap_vec_identifier too.
1576 2020-10-29 Nathan Sidwell <nathan@acm.org>
1578 * pt.c (push_template_decl): Do not give function-scope entities
1579 other than implicit typedefs a template header. Do not readd
1580 template info to a redeclared template.
1582 2020-10-28 Marek Polacek <polacek@redhat.com>
1584 * decl.c (grokdeclarator): Offer a fix-it hint for the "unnecessary
1585 parentheses in declaration" warning.
1586 * parser.c (cp_parser_direct_declarator): When setting
1587 declarator->parenthesized, use a location range.
1589 2020-10-28 Marek Polacek <polacek@redhat.com>
1592 * call.c (build_conditional_expr_1): Warn about the deprecated
1593 enum/real type conversion in C++20. Also warn about a non-enumerated
1594 and enumerated type in ?: when -Wenum-conversion is on.
1595 * typeck.c (do_warn_enum_conversions): New function.
1596 (cp_build_binary_op): Call it.
1598 2020-10-28 Marek Polacek <polacek@redhat.com>
1602 * pt.c (tsubst_copy_and_build): Call value_dependent_expression_p or
1603 type_dependent_expression_p instead of type_dependent_expression_p_push.
1604 But only call value_dependent_expression_p for expressions that are
1605 potential_constant_expression.
1607 2020-10-28 Marek Polacek <polacek@redhat.com>
1610 * parser.c (cp_parser_class_name): Use parser->scope when
1613 2020-10-28 Marek Polacek <polacek@redhat.com>
1616 * parser.c (cp_parser_fold_expression): Return error_mark_node
1617 if a left fold is preceded by an expression.
1619 2020-10-28 Nathan Sidwell <nathan@acm.org>
1621 * parser.c (cp_parser_omp_declare_reduction): Set
1622 DECL_LOCAL_DECL_P before push_template_decl.
1623 * pt.c (instantiate_body): Nested fns do not have template_info.
1625 2020-10-28 Patrick Palka <ppalka@redhat.com>
1628 * decl2.c (mark_used): Move up the constraints_satisfied_p check
1629 so that we check constraints before calling maybe_instantiate_decl.
1631 2020-10-28 Nathan Sidwell <nathan@acm.org>
1633 * pt.c (push_template_decl): Refactor for some RAII.
1635 2020-10-28 Jakub Jelinek <jakub@redhat.com>
1637 * parser.c (cp_parser_omp_clause_name): Handle allocate.
1638 (cp_parser_omp_clause_allocate): New function.
1639 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_ALLOCATE.
1640 (OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK,
1641 OMP_PARALLEL_CLAUSE_MASK, OMP_SINGLE_CLAUSE_MASK,
1642 OMP_TASK_CLAUSE_MASK, OMP_TASKGROUP_CLAUSE_MASK,
1643 OMP_DISTRIBUTE_CLAUSE_MASK, OMP_TEAMS_CLAUSE_MASK,
1644 OMP_TARGET_CLAUSE_MASK, OMP_TASKLOOP_CLAUSE_MASK): Add
1645 PRAGMA_OMP_CLAUSE_ALLOCATE.
1646 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_ALLOCATE.
1647 * pt.c (tsubst_omp_clauses): Likewise.
1649 2020-10-27 Nathan Sidwell <nathan@acm.org>
1651 * cp-tree.h (struct lang_type): Delete nested_udts field.
1652 (CLASSTYPE_NESTED_UTDS): Delete.
1653 * name-lookup.h (binding_table, binding_entry): Delete typedefs.
1654 (bt_foreach_proc): Likewise.
1655 (struct binding_entry_s): Delete.
1656 (SCOPE_DEFAULT_HT_SIZE, CLASS_SCOPE_HT_SIZE)
1657 (NAMESPACE_ORDINARY_HT_SIZE, NAMESPACE_STD_HT_SIZE)
1658 (GLOBAL_SCOPE_HT_SIZE): Delete.
1659 (binding_table_foreach, binding_table_find): Delete declarations.
1660 * name-lookup.c (ENTRY_INDEX): Delete.
1661 (free_binding_entry): Delete.
1662 (binding_entry_make, binding_entry_free): Delete.
1663 (struct binding_table_s): Delete.
1664 (binding_table_construct, binding_table_free): Delete.
1665 (binding_table_new, binding_table_expand): Delete.
1666 (binding_table_insert, binding_table_find): Delete.
1667 (binding_table_foreach): Delete.
1668 (maybe_process_template_type_declaration): Delete
1669 CLASSTYPE_NESTED_UTDS insertion.
1670 (do_pushtag): Likewise.
1671 * decl2.c (bt_reset_linkage_1): Fold into reset_type_linkage_1.
1672 (reset_type_linkage_2, bt_reset_linkage_2): Fold into
1674 * pt.c (instantiate_class_template_1): Delete NESTED_UTDs comment.
1675 (bt_instantiate_type_proc): Delete.
1676 (do_type_instantiation): Instantiate implicit typedef fields.
1677 Delete NESTED_UTD walk.
1678 * search.c (lookup_field_r): Delete unreachable NESTED_UTD
1681 2020-10-27 Nathan Sidwell <nathan@acm.org>
1683 * parser.c (cp_parser_explicit_instantiation): Refactor some RAII.
1684 * pt.c (bt_instantiate_type_proc): DATA is the tree, pass type to
1685 do_type_instantiation.
1686 (do_type_instantiation): Require T to be a type. Refactor for
1689 2020-10-26 Ville Voutilainen <ville.voutilainen@gmail.com>
1691 * cp-tree.h (CPTK_IS_NOTHROW_ASSIGNABLE): New.
1692 (CPTK_IS_NOTHROW_CONSTRUCTIBLE): Likewise.
1693 (is_nothrow_xible): Likewise.
1694 * method.c (is_nothrow_xible): New.
1695 (is_trivially_xible): Tweak.
1696 * parser.c (cp_parser_primary_expression): Handle the new RID_*.
1697 (cp_parser_trait_expr): Likewise.
1698 * semantics.c (trait_expr_value): Handle the new RID_*.
1699 (finish_trait_expr): Likewise.
1701 2020-10-24 Marek Polacek <polacek@redhat.com>
1704 * constexpr.c (cxx_eval_array_reference): Set up ctx->ctor if we
1705 are initializing an aggregate. Call free_constructor on the new
1706 CONSTRUCTOR if it isn't returned from cxx_eval_constant_expression.
1708 2020-10-23 Marek Polacek <polacek@redhat.com>
1711 * typeck.c (cp_build_binary_op): Implement -Wsizeof-array-div.
1713 2020-10-22 Patrick Palka <ppalka@redhat.com>
1716 * constexpr.c (init_subob_ctx): Don't punt on RANGE_EXPR
1717 indexes, instead build a sub-aggregate initialization context
1720 2020-10-22 Patrick Palka <ppalka@redhat.com>
1723 * constexpr.c (cxx_eval_constant_expression)
1724 <case EMPTY_CLASS_EXPR>: Lower it to a CONSTRUCTOR.
1725 (potential_constant_expression_1) <case COMPOUND_EXPR>: Remove
1726 now-redundant handling of COMPOUND_EXPR with EMPTY_CLASS_EXPR
1728 <case EMPTY_CLASS_EXPR>: Return true instead of false.
1730 2020-10-22 Patrick Palka <ppalka@redhat.com>
1733 * decl.c (duplicate_decls): Return NULL_TREE if
1734 DECL_TEMPLATE_PARM_P differ.
1736 2020-10-20 Nathan Sidwell <nathan@acm.org>
1738 * name-lookup.c (push_local_extern_decl_alias): Reconstextualize
1739 alias' parm decls. Drop any default args.
1741 2020-10-19 Iain Sandoe <iain@sandoe.co.uk>
1744 * coroutines.cc (struct coroutine_info): Add a field to
1745 record that we emitted a promise type error.
1746 (coro_promise_type_found_p): Check for the case that the
1747 promise type contains both return_void and return_value.
1748 Emit an error if so, with information about the wrong
1751 2020-10-16 Nathan Sidwell <nathan@acm.org>
1754 * pt.c (push_template_decl): Check DECL_LANG_SPECIFIC in friend
1757 2020-10-16 Nathan Sidwell <nathan@acm.org>
1760 * parser.c (cp_parser_declaration): Make token2 point to EOF if
1763 2020-10-15 Jason Merrill <jason@redhat.com>
1766 * decl.c (copy_fn_p): Return false for a function that is neither a
1767 constructor nor an assignment operator.
1768 (move_signature_fn_p): Likewise.
1770 2020-10-15 Marek Polacek <polacek@redhat.com>
1774 * cxx-pretty-print.c (pp_cxx_type_specifier_seq): Handle OFFSET_TYPE.
1775 (cxx_pretty_printer::abstract_declarator): Fix the printing of ')'.
1776 (cxx_pretty_printer::direct_abstract_declarator): Handle OFFSET_TYPE.
1777 (cxx_pretty_printer::type_id): Likewise. Print the abstract declarator
1778 for pointers-to-members.
1780 2020-10-14 Jason Merrill <jason@redhat.com>
1783 * pt.c (check_for_bare_parameter_packs): Diagnose use of
1786 2020-10-14 Nathan Sidwell <nathan@acm.org>
1788 * cp-tree.h (struct lang_decl_fn): Adjust context comment.
1789 (DECL_FRIEND_P): Replace with ...
1790 (DECL_UNIQUE_FRIEND_P): ... this. Only for FUNCTION_DECLs.
1791 (DECL_FRIEND_CONTEXT): Adjust.
1792 * class.c (add_implicitly_declared_members): Detect friendly
1793 spaceship from context.
1794 * constraint.cc (remove_constraints): Use a checking assert.
1795 (maybe_substitute_reqs_for): Use DECL_UNIQUE_FRIEND_P.
1796 * decl.c (check_no_redeclaration_friend_default_args):
1797 DECL_UNIQUE_FRIEND_P is signficant, not hiddenness.
1798 (duplicate_decls): Adjust DECL_UNIQUE_FRIEND_P clearing.
1799 (redeclaration_error_message): Use DECL_UNIQUE_FRIEND_P.
1800 (start_preparsed_function): Correct in-class friend processing.
1801 Refactor some initializers.
1802 (grokmethod): Directly check friend decl-spec.
1803 * decl2.c (grokfield): Check DECL_UNIQUE_FRIEND_P.
1804 * friend.c (do_friend): Set DECL_UNIQUE_FRIEND_P first, remove
1805 extraneous conditions. Don't re set it afterwards.
1806 * name-lookup.c (lookup_elaborated_type_1): Simplify revealing
1808 (do_pushtag): Likewise.
1809 * pt.c (optimize_specialization_lookup_p): Check
1810 DECL_UNIQUE_FRIEND_P.
1811 (push_template_decl): Likewise. Drop unneeded friend setting.
1812 (type_dependent_expression_p): Check DECL_UNIQUE_FRIEND_P.
1814 2020-10-14 Nathan Sidwell <nathan@acm.org>
1816 * name-lookup.c (push_local_extern_decl_alias): Push into alias's
1817 namespace and use pushdecl.
1818 (do_pushdecl_with_scope): Clarify behaviour.
1820 2020-10-12 Martin Sebor <msebor@redhat.com>
1823 * error.c (dump_type_suffix): Handle both the C and C++ forms of
1826 2020-10-12 Martin Sebor <msebor@redhat.com>
1830 * init.c (warn_placement_new_too_small): Call builtin_objsize instead
1831 of duplicating what it does.
1833 2020-10-08 Jason Merrill <jason@redhat.com>
1837 * pt.c (tsubst_aggr_type): Don't build a TYPENAME_TYPE when
1839 (tsubst_template_decl): Use tsubst_aggr_type.
1841 2020-10-08 Patrick Palka <ppalka@redhat.com>
1844 * constraint.cc (build_type_constraint): Temporarily increment
1845 processing_template_decl before calling build_concept_check.
1846 * pt.c (make_constrained_placeholder_type): Likewise.
1848 2020-10-08 Patrick Palka <ppalka@redhat.com>
1851 * parser.c (cp_parser_class_specifier_1): Move call to
1852 associate_classtype_constraints from here to ...
1853 (cp_parser_class_head): ... here.
1854 * pt.c (is_compatible_template_arg): Correct documentation to
1855 say "argument is _no_ more constrained than the parameter".
1857 2020-10-07 Marek Polacek <polacek@redhat.com>
1860 * pt.c (tsubst_copy_and_build) <case TEMPLATE_ID_EXPR>: Call
1861 tsubst_copy_and_build explicitly instead of using the RECUR macro.
1862 Handle a TEMPLATE_ID_EXPR with an IDENTIFIER_NODE as its operand.
1863 <case CALL_EXPR>: Perform ADL for a TEMPLATE_ID_EXPR with an
1864 IDENTIFIER_NODE as its operand.
1866 2020-10-07 Patrick Palka <ppalka@redhat.com>
1870 * tree.c (cp_tree_equal) <case ALIGNOF_EXPR>: Return false if
1871 ALIGNOF_EXPR_STD_P differ.
1873 2020-10-07 Nathan Sidwell <nathan@acm.org>
1875 * cp-tree.h (struct language_function): Delete extern_decl_map.
1876 (DECL_LOCAL_DECL_ALIAS): New.
1877 * name-lookup.h (is_local_extern): Delete.
1878 * name-lookup.c (set_local_extern_decl_linkage): Replace with ...
1879 (push_local_extern_decl): ... this new function.
1880 (do_pushdecl): Call new function after pushing new decl. Unhide
1881 hidden non-functions.
1882 (is_local_extern): Delete.
1883 * decl.c (layout_var_decl): Do not allow VLA local externs.
1884 * decl2.c (mark_used): Also mark DECL_LOCAL_DECL_ALIAS. Drop old
1885 local-extern treatment.
1886 * parser.c (cp_parser_oacc_declare): Deal with local extern aliases.
1887 * pt.c (tsubst_expr): Adjust local extern instantiation.
1888 * cp-gimplify.c (cp_genericize_r): Remap DECL_LOCAL_DECLs.
1890 2020-10-07 Nathan Sidwell <nathan@acm.org>
1892 * cp-tree.h (DECL_BUILTIN_P): Rename to ...
1893 (DECL_UNDECLARED_BUILTIN_P): ... here.
1894 * decl.c (duplicate_decls): Adjust.
1895 * name-lookup.c (anticipated_builtin_p): Adjust.
1896 (do_nonmember_using_decl): Likewise.
1898 2020-10-07 Nathan Sidwell <nathan@acm.org>
1900 * tree.c (build_cp_fntype_variant): Clear
1901 TYPE_DEPENDENT_P_VALID if necessary.
1903 2020-10-06 Marek Polacek <polacek@redhat.com>
1906 * parser.c (cp_parser_direct_declarator): When checking if a
1907 name is a function template declaration for the P0634R3 case,
1908 look in uninstantiated templates too.
1910 2020-10-05 Marek Polacek <polacek@redhat.com>
1912 * cp-tree.h (NON_UNION_CLASS_TYPE_P): Fix typo in a comment.
1914 2020-10-05 Richard Biener <rguenther@suse.de>
1915 Jakub Jelinek <jakub@redhat.com>
1918 * error.c (dump_expr): Handle TARGET_MEM_REF.
1920 2020-10-05 Nathan Sidwell <nathan@acm.org>
1922 * name-lookup.c (maybe_add_fuzzy_decl): New.
1923 (maybe_add_fuzzy_binding): New.
1924 (consider_binding_level): Use intermediate sortable vector for
1927 2020-10-02 Marek Polacek <polacek@redhat.com>
1930 * cxx-pretty-print.c (pp_cxx_template_argument_list): If the
1931 argument is template_parm_object_p, print its DECL_INITIAL.
1933 2020-10-02 Nathan Sidwell <nathan@acm.org>
1935 * cp-tree.h (lang_decl_base): anticipated_p is not used for
1937 (DECL_ANTICIPATED): Delete.
1938 * decl.c (duplicate_decls): Delete DECL_ANTICIPATED_management,
1940 (cxx_builtin_function): Drop DECL_ANTICIPATED setting.
1941 (xref_tag_1): Drop DECL_ANTICIPATED assert.
1942 * name-lookup.c (name_lookup::adl_class_only): Drop
1943 DECL_ANTICIPATED check.
1944 (name_lookup::search_adl): Always dedup.
1945 (anticipated_builtin_p): Reimplement.
1946 (do_pushdecl): Drop DECL_ANTICIPATED asserts & update.
1947 (lookup_elaborated_type_1): Drop DECL_ANTICIPATED update.
1948 (do_pushtag): Drop DECL_ANTICIPATED setting.
1949 * pt.c (push_template_decl): Likewise.
1950 (tsubst_friend_class): Likewise.
1952 2020-10-02 Nathan Sidwell <nathan@acm.org>
1954 * name-lookup.c (consider_decl): New, broken out of ...
1955 (consider_binding_level): ... here. Iterate the hash table for
1958 2020-10-02 Nathan Sidwell <nathan@acm.org>
1960 * cp-tree.h (base_ctor_omit_inherited_parms): Declare.
1961 * class.c (add_method): Refactor main loop, only pass fns to
1962 ctor_omit_inherited_parms.
1963 (build_cdtor_clones): Rename bool parms.
1964 (clone_cdtor): Call base_ctor_omit_inherited_parms.
1965 * method.c (base_ctor_omit_inherited_parms): New, broken out of
1967 (ctor_omit_inherited_parms): ... here, call it with
1968 DECL_CLONED_FUNCTION.
1970 2020-10-02 Nathan Sidwell <nathan@acm.org>
1972 * cp-tree.h (cp_fname_init): Delete declaration.
1973 * decl.c (cp_fname_init): Merge into only caller ...
1974 (cp_make_fname): ... here & refactor.
1976 2020-10-02 Jason Merril <jason@redhat.com>
1978 * call.c (build_operator_new_call): Set CALL_FROM_NEW_OR_DELETE_P.
1979 (build_op_delete_call): Likewise.
1980 * init.c (build_new_1, build_vec_delete_1, build_delete): Not here.
1983 2020-10-02 Jason Merril <jason@redhat.com>
1985 * lambda.c (call_from_lambda_thunk_p): New.
1986 * cp-gimplify.c (cp_genericize_r): Use it.
1987 * pt.c (tsubst_copy_and_build): Use it.
1988 * typeck.c (check_return_expr): Use it.
1989 * cp-tree.h: Declare it.
1990 (CALL_FROM_NEW_OR_DELETE_P): Move to gcc/tree.h.
1992 2020-10-01 Nathan Sidwell <nathan@acm.org>
1994 * cp-tree.h (DECL_ANTICIPATED): Adjust comment.
1995 (DECL_HIDDEN_P, TYPE_HIDDEN_P): Delete.
1996 * tree.c (ovl_insert): Delete DECL_HIDDEN_P assert.
1997 (ovl_skip_hidden): Likewise.
1999 2020-10-01 Nathan Sidwell <nathan@acm.org>
2001 * name-lookup.c (pushdecl_top_level): Assert incoming context is
2002 null, add global_namespace context.
2003 (pushdecl_top_level_and_finish): Likewise.
2004 * pt.c (get_template_parm_object): Clear decl context before
2006 * semantics.c (finish_compound_literal): Likewise.
2008 2020-10-01 Nathan Sidwell <nathan@acm.org>
2010 * decl.c (lookup_and_check_tag): Refactor.
2012 2020-10-01 Jakub Jelinek <jakub@redhat.com>
2015 * call.c (build_over_call): If obj_arg is non-NULL, return INIT_EXPR
2016 setting obj_arg to call.
2018 2020-10-01 Jakub Jelinek <jakub@redhat.com>
2021 * constexpr.c (cxx_eval_call_expression): Don't VERIFY_CONSTANT the
2024 2020-10-01 Marek Polacek <polacek@redhat.com>
2027 * pt.c (do_class_deduction): Don't prune explicit deduction guides
2028 in copy-list-initialization. In copy-list-initialization, if an
2029 explicit deduction guide was selected, give an error.
2031 2020-09-30 Nathan Sidwell <nathan@acm.org>
2033 * cp-tree.h (struct lang_decl_fn): Remove hidden_friend_p.
2034 (DECL_HIDDEN_FRIEND_P): Delete.
2035 * call.c (add_function_candidate): Drop assert about anticipated
2037 (build_new_op_1): Drop koenig lookup flagging for hidden friend.
2038 * decl.c (duplicate_decls): Drop HIDDEN_FRIEND_P updating.
2039 * name-lookup.c (do_pushdecl): Likewise.
2040 (set_decl_namespace): Discover hiddenness from OVL_HIDDEN_P.
2041 * pt.c (check_explicit_specialization): Record found_hidden
2044 2020-09-29 Marek Polacek <polacek@redhat.com>
2047 * call.c (ref_conv_binds_directly_p): New function.
2048 * cp-tree.h (ref_conv_binds_directly_p): Declare.
2049 * parser.c (warn_for_range_copy): New function.
2050 (cp_convert_range_for): Call it.
2052 2020-09-29 Nathan Sidwell <nathan@acm.org>
2054 * cp-tree.h (ovl_insert): Change final parm to hidden-or-using
2056 * name-lookup.h (HIDDEN_TYPE_BINDING_P): New.
2057 (struct cxx_binding): Add type_is_hidden flag.
2058 * tree.c (ovl_insert): Change using_p parm to using_or_hidden,
2060 (ovl_skip_hidden): Assert we never see a naked hidden decl.
2061 * decl.c (xref_tag_1): Delete unhiding friend from here (moved to
2062 lookup_elaborated_type_1).
2063 * name-lookup.c (STAT_TYPE_HIDDEN_P, STAT_DECL_HIDDEN_P): New.
2064 (name_lookup::search_namespace_only): Check new hidden markers.
2065 (cxx_binding_make): Clear HIDDEN_TYPE_BINDING_P.
2066 (update_binding): Update new hidden markers.
2067 (lookup_name_1): Check HIDDEN_TYPE_BINDING_P and simplify friend
2069 (lookup_elaborated_type_1): Use new hidden markers. Reveal the
2072 2020-09-29 Nathan Sidwell <nathan@acm.org>
2074 * name-lookup.c (create_local_binding): Do not clear
2075 INHERITED_VALUE_BINDING_P here.
2076 (name_lookup::process_binding): Move done hidden-decl triage to ...
2077 (name_lookup::search_namespace_only): ... here, its only caller.
2078 (cxx_binding_make): Clear flags here.
2079 (push_binding): Not here.
2080 (pop_local_binding): RAII.
2081 (update_binding): Refactor.
2082 (do_pushdecl): Assert we're never revealing a local binding.
2083 (do_pushdecl_with_scope): Directly call do_pushdecl.
2084 (get_class_binding): Do not clear LOCAL_BINDING_P here.
2085 * pt.c (push_template_decl): Set friend & anticipated before
2088 2020-09-29 Nathan Sidwell <nathan@acm.org>
2090 * name-lookup.c (update_binding): We never meet two implicit
2092 (do_pushdecl): Adjust set_identifier_type_value_with_scope calls.
2093 (set_identifier_type_value_with_scope): Do not update binding in
2094 the namespace-case. Assert it is already there.
2096 2020-09-25 Nathan Sidwell <nathan@acm.org>
2098 * cp-tree.h (duplicate_decls): Replace 'is_friend' with 'hiding'
2099 and add 'was_hidden'.
2100 * name-lookup.h (pushdecl_namespace_level): Replace 'is_friend'
2102 (pushdecl): Likewise.
2103 (pushdecl_top_level): Drop is_friend parm.
2104 * decl.c (check_no_redeclaration_friend_default_args): Rename parm
2106 (duplicate_decls): Replace 'is_friend' with 'hiding'
2107 and 'was_hidden'. Do minimal adjustments in body.
2108 (cxx_builtin_function): Pass 'hiding' to pushdecl.
2109 * friend.c (do_friend): Pass 'hiding' to pushdecl.
2110 * name-lookup.c (supplement_binding_1): Drop defaulted arg to
2112 (update_binding): Replace 'is_friend' with 'hiding'. Drop
2113 defaulted arg to duplicate_decls.
2114 (do_pushdecl): Replace 'is_friend' with 'hiding'. Assert no
2115 surprise hidhing. Adjust duplicate_decls calls to inform of old
2117 (pushdecl): Replace 'is_friend' with 'hiding'.
2118 (set_identifier_type_value_with_scope): Adjust update_binding
2120 (do_pushdecl_with_scope): Replace 'is_friend' with 'hiding'.
2121 (pushdecl_outermost_localscope): Drop default arg to
2122 do_pushdecl_with_scope.
2123 (pushdecl_namespace_level): Replace 'is_friend' with 'hiding'.
2124 (pushdecl_top_level): Drop is_friend parm.
2125 * pt.c (register_specialization): Comment duplicate_decls call
2127 (push_template_decl): Commont pushdecl_namespace_level.
2128 (tsubst_friend_function, tsubst_friend_class): Likewise.
2130 2020-09-25 Nathan Sidwell <nathan@acm.org>
2132 * name-lookup.h (enum tag_scope): Replace with ...
2133 (enum class TAG_how): ... this. Add HIDDEN_FRIEND value.
2134 (lookup_type_scope): Replace with ...
2135 (lookup_elaborated_type): ... this.
2136 (pushtag): Use TAG_how, not tag_scope.
2137 * cp-tree.h (xref_tag): Parameter is TAG_how, not tag_scope.
2138 * decl.c (lookup_and_check_tag): Likewise. Adjust.
2139 (xref_tag_1, xref_tag): Likewise. adjust.
2140 (start_enum): Adjust lookup_and_check_tag call.
2141 * name-lookup.c (lookup_type_scope_1): Rename to ...
2142 (lookup_elaborated_type_1) ... here. Use TAG_how, not tag_scope.
2143 (lookup_type_scope): Rename to ...
2144 (lookup_elaborated_type): ... here. Use TAG_how, not tag_scope.
2145 (do_pushtag): Use TAG_how, not tag_scope. Adjust.
2146 (pushtag): Likewise.
2147 * parser.c (cp_parser_elaborated_type_specifier): Adjust.
2148 (cp_parser_class_head): Likewise.
2150 2020-09-25 Nathan Sidwell <nathan@acm.org>
2152 * cp-tree.h (DECL_BUILTIN_P): New.
2153 * decl.c (duplicate_decls): Use it. Do not treat omp-udr as a
2155 * name-lookup.c (anticipated_builtin): Use it.
2156 (set_decl_context_in_fn): Function-scope OMP UDRs have function context.
2157 (do_nonmember_using_decl): Use DECL_BUILTIN_P.
2158 * parser.c (cp_parser_omp_declare_reduction): Function-scope OMP
2159 UDRs have function context. Assert we never find a valid duplicate.
2160 * pt.c (tsubst_expr): Function-scope OMP UDRs have function context.
2162 2020-09-24 Nathan Sidwell <nathan@acm.org>
2164 * cp-tree.h (duplicate_decls): Default is_friend to false.
2165 (xref_tag): Default tag_scope & tpl_header_p to ts_current & false.
2166 (push_template_decl_real): Default is_friend to false. Rename to
2168 (push_template_decl): ... here. Delete original decl.
2169 * name-lookup.h (pushdecl_namespace_level): Default is_friend to
2171 (pushtag): Default tag_scope to ts_current.
2172 * coroutines.cc (morph_fn_to_coro): Drop default args to xref_tag.
2173 * decl.c (start_decl): Drop default args to duplicate_decls.
2174 (start_enum): Drop default arg to pushtag & xref_tag.
2175 (start_preparsed_function): Pass DECL_FRIEND_P to
2177 (grokmethod): Likewise.
2178 * friend.c (do_friend): Rename push_template_decl_real calls.
2179 * lambda.c (begin_lamnbda_type): Drop default args to xref_tag.
2180 (vla_capture_type): Likewise.
2181 * name-lookup.c (maybe_process_template_type_declaration): Rename
2182 push_template_decl_real call.
2183 (pushdecl_top_level_and_finish): Drop default arg to
2184 pushdecl_namespace_level.
2185 * pt.c (push_template_decl_real): Assert no surprising friend
2186 functions. Rename to ...
2187 (push_template_decl): ... here. Delete original function.
2188 (lookup_template_class_1): Drop default args from pushtag.
2189 (instantiate_class_template_1): Likewise.
2190 * ptree.c (debug_overload): Print hidden and using markers.
2191 * rtti.c (init_rtti_processing): Drop refault args from xref_tag.
2192 (build_dynamic_cast_1, tinfo_base_init): Likewise.
2193 * semantics.c (begin_class_definition): Drop default args to
2196 2020-09-24 Nathan Sidwell <nathan@acm.org>
2199 * pt.c (maybe_instantiate_noexcept): Local externs are never
2202 2020-09-23 Nathan Sidwell <nathan@acm.org>
2204 * name-lookup.h (typedef cxx_binding): Delete tdef.
2205 (typedef cp_binding_level): Likewise.
2206 (struct cxx_binding): Flags are bools.
2208 2020-09-23 Nathan Sidwell <nathan@acm.org>
2211 * pt.c (tsubst_copy) [FUNCTION_DECL,VAR_DECL]: Retrieve local
2212 specialization for DECL_LOCAL_P decls.
2214 2020-09-22 Patrick Palka <ppalka@redhat.com>
2217 * pt.c (corresponding_template_parameter): Define.
2218 (keep_template_parm): Use it to adjust the given template
2219 parameter to the corresponding in-scope one from ctx_parms.
2221 2020-09-22 Nathan Sidwell <nathan@acm.org>
2223 * cp-tree.h (xref_tag_from_type): Don't declare.
2224 * decl.c (xref_tag_from_type): Delete.
2225 * pt.c (lookup_template_class_1): Erroneously located class
2226 definitions just give error_mark, don't try and inject it into the
2229 2020-09-22 Jakub Jelinek <jakub@redhat.com>
2232 * constexpr.c (cxx_eval_builtin_function_call): Return void_node for
2233 calls to __sanitize_ptr_{sub,cmp} builtins.
2235 2020-09-22 Nathan Sidwell <nathan@acm.org>
2237 * pt.c (instantiate_class_template_1): Do not repush and unhide
2240 2020-09-21 Marek Polacek <polacek@redhat.com>
2244 * lambda.c (maybe_add_lambda_conv_op): Mark the conversion function
2247 2020-09-21 Marek Polacek <polacek@redhat.com>
2249 * pt.c (deduction_guides_for): Add a bool parameter. Set it.
2250 (do_class_deduction): Warn when CTAD succeeds but the type doesn't
2251 have any explicit deduction guides.
2253 2020-09-21 Nathan Sidwell <nathan@acm.org>
2255 * decl.c (xref_tag_1): Use IDENTIFIER_LAMBDA_P to detect lambdas.
2256 * lambda.c (begin_lambda_type): Use ts_current to push the tag.
2257 * name-lookup.h (enum tag_scope): Drop ts_lambda.
2259 2020-09-21 Marek Polacek <polacek@redhat.com>
2262 * decl.c (redeclaration_error_message): Detect a redeclaration of
2265 2020-09-19 Sandra Loosemore <sandra@codesourcery.com>
2267 * cp-gimplify.c (enum bc_t, bc_label): Move to c-family.
2268 (begin_bc_block, finish_bc_block, get_bc_label): Likewise.
2269 (genericize_cp_loop): Likewise.
2270 (genericize_for_stmt, genericize_while_stmt): Likewise.
2271 (genericize_do_stmt, genericize_switch_stmt): Likewise.
2272 (genericize_continue_stmt, genericize_break_stmt): Likewise.
2273 (genericize_omp_for_stmt): Likewise.
2274 (cp_genericize_r): Call c_genericize_control_stmt instead of
2275 above functions directly.
2276 (cp_genericize): Call save_bc_state and restore_bc_state instead
2277 of manipulating bc_label directly.
2278 * cp-objcp-common.c (cxx_block_may_fallthru): Defer to
2279 c_block_may_fallthru instead of handling SWITCH_STMT here.
2280 (cp_common_init_ts): Move handling of loop and switch-related
2281 statements to c-family.
2282 * cp-tree.def (FOR_STMT, WHILE_STMT, DO_STMT): Move to c-family.
2283 (BREAK_STMT, CONTINUE_STMT, SWITCH_STMT): Likewise.
2284 * cp-tree.h (LABEL_DECL_BREAK, LABEL_DECL_CONTINUE): Likewise.
2285 (WHILE_COND, WHILE_BODY): Likewise.
2286 (DO_COND, DO_BODY): Likewise.
2287 (FOR_INIT_STMT, FOR_COND, FOR_EXPR, FOR_BODY, FOR_SCOPE): Likewise.
2288 (SWITCH_STMT_COND, SWITCH_STMT_BODY): Likewise.
2289 (SWITCH_STMT_TYPE, SWITCH_STMT_SCOPE): Likewise.
2290 (SWITCH_STMT_ALL_CASES_P, SWITCH_STMT_NO_BREAK_P): Likewise.
2291 * cxx-pretty-print.c (cxx_pretty_printer::statement): Move code
2292 to handle structured loop and switch tree nodes to c-family.
2293 * dump.c (cp_dump_tree): Likewise.
2295 2020-09-19 Patrick Palka <ppalka@redhat.com>
2299 * constraint.cc (map_arguments): Call template_parm_to_arg
2300 in the self-mapping case.
2301 (finish_shorthand_constraint): No need to build a TREE_LIST
2302 before calling template_parm_to_arg.
2303 * pt.c (template_parm_to_arg): Rewrite to handle TEMPLATE_PARM_P
2304 nodes as well as DECL_TEMPLATE_PARM_P nodes, and to make the
2305 overlying TREE_LIST node optional.
2306 (keep_template_parm): Don't record a BOUND_TEMPLATE_TEMPLATE_PARM,
2307 instead record its corresponding TEMPLATE_TEMPLATE_PARM.
2308 (convert_generic_types_to_packs): Don't call
2309 template_parm_to_arg.
2311 2020-09-19 Patrick Palka <ppalka@redhat.com>
2314 * constraint.cc (satisfy_atom): Pass true as the
2315 manifestly_const_eval argument to maybe_constant_value.
2317 2020-09-18 Jason Merrill <jason@redhat.com>
2320 * decl.c (complete_vars): Only call layout_var_decl if completing
2323 2020-09-18 Jason Merrill <jason@redhat.com>
2325 * decl.c (complete_vars): Call layout_var_decl.
2327 2020-09-17 Patrick Palka <ppalka@redhat.com>
2331 * constraint.cc (tsubst_requires_expr): Use REQUIRES_EXPR_PARMS
2332 and REQUIRES_EXPR_REQS. Use REQUIRES_EXPR_EXTRA_ARGS,
2333 add_extra_args and build_extra_args to defer substitution until
2334 we have all the template arguments.
2335 (finish_requires_expr): Adjust the call to build_min so that
2336 REQUIRES_EXPR_EXTRA_ARGS gets set to NULL_TREE.
2337 * cp-tree.def (REQUIRES_EXPR): Give it a third operand.
2338 * cp-tree.h (REQUIRES_EXPR_PARMS, REQUIRES_EXPR_REQS,
2339 REQUIRES_EXPR_EXTRA_ARGS): Define.
2340 (add_extra_args, build_extra_args): Declare.
2342 2020-09-16 Nathan Sidwell <nathan@acm.org>
2344 * cp-tree.h (cp_check_omp_declare_reduction): Return bool.
2345 * semantics.c (cp_check_omp_declare_reduction): Return true on for
2347 * pt.c (push_template_decl_real): OMP reductions do not get a
2349 (tsubst_function_decl): Remove special casing for local decl omp
2351 (tsubst_expr): Call instantiate_body for a local omp reduction.
2352 (instantiate_body): Add nested_p parm, and deal with such
2354 (instantiate_decl): Reject FUNCTION_SCOPE entities, adjust
2355 instantiate_body call.
2357 2020-09-16 Nathan Sidwell <nathan@acm.org>
2359 * pt.c (instantiate_body): Remove 'nested' var, simplify
2362 2020-09-16 Nathan Sidwell <nathan@acm.org>
2364 * pt.c (instantiate_body): New, broken out of ..
2365 (instantiate_decl): ... here. Call it.
2367 2020-09-15 Nathan Sidwell <nathan@acm.org>
2369 * pt.c (push_template_decl_real): OMP reductions retain a template
2371 (tsubst_function_decl): Likewise.
2373 2020-09-15 Tobias Burnus <tobias@codesourcery.com>
2376 * cp-gimplify.c (cxx_omp_finish_clause): Add bool openacc arg.
2377 * cp-tree.h (cxx_omp_finish_clause): Likewise
2378 * semantics.c (handle_omp_for_class_iterator): Update call.
2380 2020-09-14 Marek Polacek <polacek@redhat.com>
2382 * pt.c (push_template_decl_real): Use VAR_OR_FUNCTION_DECL_P.
2384 2020-09-14 Nathan Sidwell <nathan@acm.org>
2386 * pt.c (push_template_decl_real): Don't attach a template head to
2388 (tsubst_function_decl): Add support for headless local extern
2390 (tsubst_decl): Add support for headless local extern decls.
2392 2020-09-11 Nathan Sidwell <nathan@acm.org>
2394 * decl.c (grokfndecl): Don't attach to local extern.
2396 2020-09-11 Nathan Sidwell <nathan@acm.org>
2398 * parser.c (cp_parser_objc_method_definition_list): Reimplement
2399 loop, make sure we pop scope.
2401 2020-09-11 Marek Polacek <polacek@redhat.com>
2403 * cp-tree.h (LOOKUP_CONSTINIT): Remove.
2404 (LOOKUP_REWRITTEN): Adjust.
2405 * decl.c (duplicate_decls): Set DECL_DECLARED_CONSTINIT_P.
2406 (check_initializer): Use DECL_DECLARED_CONSTINIT_P instead of
2408 (cp_finish_decl): Don't set DECL_DECLARED_CONSTINIT_P. Use
2409 DECL_DECLARED_CONSTINIT_P instead of LOOKUP_CONSTINIT.
2410 (grokdeclarator): Set DECL_DECLARED_CONSTINIT_P.
2411 * decl2.c (grokfield): Don't handle LOOKUP_CONSTINIT.
2412 * parser.c (cp_parser_decomposition_declaration): Remove
2413 LOOKUP_CONSTINIT handling.
2414 (cp_parser_init_declarator): Likewise.
2415 * pt.c (tsubst_expr): Likewise.
2416 (instantiate_decl): Likewise.
2417 * typeck2.c (store_init_value): Use DECL_DECLARED_CONSTINIT_P instead
2418 of LOOKUP_CONSTINIT.
2420 2020-09-10 Nathan Sidwell <nathan@acm.org>
2422 * cp-tree.h (TINFO_VAR_DECLARED_CONSTINIT): Replace with ...
2423 (DECL_DECLARED_CONSTINIT_P): ... this.
2424 * decl.c (start_decl): No need to retrofit_lang_decl for constinit
2426 (cp_finish_decl): Use DECL_DECLARED_CONSTINIT_P.
2427 * pt.c (tsubst_decl): No need to handle constinit flag
2429 (tsubst_expr): Or here.
2431 2020-09-10 Nathan Sidwell <nathan@acm.org>
2433 * cp-tree.h (DECL_LOCAL_FUNCTION_P): Rename to ...
2434 (DECL_LOCAL_DECL_P): ... here. Accept both fns and vars.
2435 * decl.c (start_decl): Set DECL_LOCAL_DECL_P for local externs.
2436 (omp_declare_variant_finalize_one): Use DECL_LOCAL_DECL_P.
2437 (local_variable_p): Simplify.
2438 * name-lookup.c (set_decl_context_in_fn): Assert DECL_LOCAL_DECL_P
2439 is as expected. Simplify.
2440 (do_pushdecl): Don't set decl_context_in_fn for friends.
2441 (is_local_extern): Simplify.
2442 * call.c (equal_functions): Use DECL_LOCAL_DECL_P.
2443 * parser.c (cp_parser_postfix_expression): Likewise.
2444 (cp_parser_omp_declare_reduction): Likewise.
2445 * pt.c (check_default_tmpl_args): Likewise.
2446 (tsubst_expr): Assert nested reduction function is local.
2447 (type_dependent_expression_p): Use DECL_LOCAL_DECL_P.
2448 * semantics.c (finish_call_expr): Likewise.
2450 2020-09-09 Marek Polacek <polacek@redhat.com>
2453 * decl.c (reshape_init): If we're initializing a char array from
2454 a string-literal that is enclosed in braces, unwrap it.
2455 * init.c (build_new_1): Don't handle string-initializers here.
2456 (build_new): Handle new-expression with paren-init when the
2457 array bound is known. Always pass string constants to build_new_1
2458 enclosed in braces. Don't handle string-initializers in any
2461 2020-09-09 Marek Polacek <polacek@redhat.com>
2464 * decl.c (reshape_init_r): When initializing an aggregate member
2465 with an initializer from an initializer-list, also consider
2468 2020-09-09 Nathan Sidwell <nathan@acm.org>
2470 * parser.c (cp_parser_omp_declare_reduction): Refactor to avoid
2471 code duplication. Update DECL_TI_TEMPLATE's context.
2472 * pt.c (tsubst_expr): For OMP reduction function, set context to
2473 global_namespace before pushing.
2474 (tsubst_omp_udr): Assert current_function_decl, add comment about
2477 2020-09-09 Patrick Palka <ppalka@redhat.com>
2480 * class.c (resolve_address_of_overloaded_function): Check
2481 constraints_satisfied_p and perform return-type deduction via
2482 maybe_instantiate_decl when considering non-template functions
2483 in the overload set.
2484 * cp-tree.h (maybe_instantiate_decl): Declare.
2485 * decl2.c (maybe_instantiate_decl): Remove static.
2487 2020-09-04 Jason Merrill <jason@redhat.com>
2489 * expr.c (mark_use): Use iloc_sentinel.
2491 2020-09-03 Jakub Jelinek <jakub@redhat.com>
2494 * constexpr.c (fundef_copies_table): Change type from
2495 hash_map<tree, tree> * to decl_tree_map *.
2497 2020-09-03 Marek Polacek <polacek@redhat.com>
2500 * cp-tree.h (do_aggregate_paren_init): Declare.
2501 * decl.c (do_aggregate_paren_init): New.
2502 (grok_reference_init): Use it.
2503 (check_initializer): Likewise.
2504 * init.c (perform_member_init): Handle initializing an array from
2505 a ()-list. Use do_aggregate_paren_init.
2507 2020-09-03 Jakub Jelinek <jakub@redhat.com>
2510 * constexpr.c (cxx_eval_outermost_constant_expr): Temporarily disable
2511 flag_rounding_math during manifestly constant evaluation.
2513 2020-09-01 Marek Polacek <polacek@redhat.com>
2516 * init.c (build_new_1): Call reshape_init.
2518 2020-09-01 Jakub Jelinek <jakub@redhat.com>
2521 * semantics.c (handle_omp_array_sections_1): Test
2522 DECL_ARRAY_PARAMETER_P only on PARM_DECLs.
2524 2020-08-31 Marek Polacek <polacek@redhat.com>
2525 Jason Merrill <jason@redhat.com>
2528 * call.c (build_new_method_call_1): Use build_constructor_from_vec
2529 instead of build_tree_list_vec + build_constructor_from_list.
2530 * init.c (build_new_1): Handle new char[]{"foo"}. Use
2531 build_constructor_from_vec instead of build_tree_list_vec +
2532 build_constructor_from_list.
2533 (build_new): Deduce the array size in new-expression if not
2534 present. Handle ()-init. Handle initializing an array from
2536 * parser.c (cp_parser_new_type_id): Leave [] alone.
2537 (cp_parser_direct_new_declarator): Allow [].
2538 * pt.c (type_dependent_expression_p): In a NEW_EXPR, consider
2539 array types whose dimension has to be deduced type-dependent.
2541 2020-08-27 Martin Liska <mliska@suse.cz>
2543 * class.c (build_vtbl_initializer): Set exact argument of a vector
2544 growth function to true.
2545 * constraint.cc (get_mapped_args): Likewise.
2546 * decl.c (cp_maybe_mangle_decomp): Likewise.
2547 (cp_finish_decomp): Likewise.
2548 * parser.c (cp_parser_omp_for_loop): Likewise.
2549 * pt.c (canonical_type_parameter): Likewise.
2550 * rtti.c (get_pseudo_ti_init): Likewise.
2552 2020-08-26 Nathan Sidwell <nathan@acm.org>
2554 * decl.c (poplevel): A local-binding tree list holds the name in
2556 * name-lookup.c (update_local_overload): Add id to TREE_PURPOSE.
2557 (lookup_name_1): Deal with local-binding error_mark_node marker.
2558 (op_unqualified_lookup): Return error_mark_node for 'nothing
2559 found'. Retain global binding, check class binding here.
2560 (maybe_save_operator_binding): Reimplement to always cache a
2562 (push_operator_bindings): Deal with 'ignore' marker.
2564 2020-08-25 Tobias Burnus <tobias@codesourcery.com>
2567 * semantics.c (handle_omp_array_sections_1): Talk about
2568 array function parameter in the error message.
2570 2020-08-25 Jakub Jelinek <jakub@redhat.com>
2573 * cp-tree.h (build_trivial_dtor_call): Add bool argument defaulted
2575 * call.c (build_trivial_dtor_call): Add NO_PTR_DEREF argument. If
2576 instance is a pointer and NO_PTR_DEREF is true, clobber the pointer
2577 rather than what it points to.
2578 * semantics.c (finish_call_expr): Call build_trivial_dtor_call with
2579 true as NO_PTR_DEREF.
2581 2020-08-25 Jason Merrill <jason@redhat.com>
2584 * optimize.c (populate_clone_array): Revert PR70462 change.
2585 (maybe_clone_body): Likewise.
2587 2020-08-24 Nathan Sidwell <nathan@acm.org>
2589 * ptree.c (debug_overload): New.
2591 2020-08-19 Jason Merrill <jason@redhat.com>
2594 * cp-tree.h (push_tinst_level, push_tinst_level_loc): Declare.
2595 * constraint.cc (satisfy_declaration_constraints):
2596 Use add_outermost_template_args and push_tinst_level.
2597 * pt.c (add_outermost_template_args): Handle getting
2598 a TEMPLATE_DECL as the first argument.
2599 (push_tinst_level, push_tinst_level_loc): No longer static.
2600 (fn_type_unification): Check satisfaction before non-dependent
2603 2020-08-18 Nathan Sidwell <nathan@acm.org>
2605 * cp-tree.h (SET_TYPE_TEMPLTE_INFO): Do not deal with ALIAS templates.
2606 * pt.c (lookup_template_class_1): Special-case alias template
2607 template_info setting.
2609 2020-08-18 Jason Merrill <jason@redhat.com>
2612 * pt.c (tsubst_aggr_type): Rewrite in C++17, too.
2613 (maybe_dependent_member_ref): Likewise.
2614 (build_deduction_guide): Re-substitute template parms.
2615 * cp-tree.h (struct push_nested_class_guard): New.
2616 * constraint.cc (get_normalized_constraints_from_decl): Use it.
2618 2020-08-18 Jason Merrill <jason@redhat.com>
2621 * pt.c (maybe_dependent_member_ref): New.
2622 (tsubst_copy) [CONST_DECL]: Use it.
2623 [VAR_DECL]: Likewise.
2624 (tsubst_aggr_type): Handle nested type.
2626 2020-08-18 Nathan Sidwell <nathan@acm.org>
2628 * name-lookup.c (qualify_lookup): Drop lambda checking here.
2629 Reorder namespace & type checking.
2630 (lookup_name_1): Do hidden lambda checking here.
2632 2020-08-14 Nathan Sidwell <nathan@acm.org>
2634 * name-lookup.h (lookup_name_real, lookup_name_nonclass): Rename
2636 (lookup_name): ... these new overloads.
2637 * name-lookup.c (identifier_type_value_1): Rename lookup_name_real
2639 (lookup_name_real_1): Rename to ...
2640 (lookup_name_1): ... here.
2641 (lookup_name_real): Rename to ...
2642 (lookup_name): ... here. Rename lookup_name_real_1 call.
2643 (lookup_name_nonclass): Delete.
2644 * call.c (build_operator_new_call): Rename lookup_name_real call.
2645 (add_operator_candidates): Likewise.
2646 (build_op_delete_call): Rename lookup_name_nonclass call.
2647 * parser.c (cp_parser_lookup_name): Likewise.
2648 * pt.c (tsubst_friend_class, lookup_init_capture_pack): Likewise.
2649 (tsubst_expr): Likewise.
2650 * semantics.c (capture_decltype): Likewise.
2652 2020-08-14 Nathan Sidwell <nathan@acm.org>
2654 * cp-tree.h (LOOKUP_HIDDEN): Delete.
2655 (LOOKUP_PREFER_RVALUE): Adjust initializer.
2656 * name-lookup.h (enum class LOOK_want): Add HIDDEN_FRIEND and
2657 HIDDEN_LAMBDA flags.
2658 (lookup_name_real): Drop flags parm.
2659 (lookup_qualified_name): Drop find_hidden parm.
2660 * name-lookup.c (class name_lookup): Drop hidden field, adjust
2662 (name_lookup::add_overload): Check want for hiddenness.
2663 (name_lookup::process_binding): Likewise.
2664 (name_lookup::search_unqualified): Likewise.
2665 (identifier_type_value_1): Adjust lookup_name_real call.
2666 (set_decl_namespace): Adjust name_lookup ctor.
2667 (qualify_lookup): Drop flags parm, use want for hiddenness.
2668 (lookup_qualified_name): Drop find_hidden parm.
2669 (lookup_name_real_1): Drop flags parm, adjust qualify_lookup
2671 (lookup_name_real): Drop flags parm.
2672 (lookup_name_nonclass, lookup_name): Adjust lookup_name_real
2674 (lookup_type_scope_1): Adjust qualify_lookup calls.
2675 * call.c (build_operator_new_call): Adjust lookup_name_real call.
2676 (add_operator_candidates): Likewise.
2677 * coroutines.cc (morph_fn_to_coro): Adjust lookup_qualified_name
2679 * parser.c (cp_parser_lookup_name): Adjust lookup_name_real calls.
2680 * pt.c (check_explicit_specialization): Adjust
2681 lookup_qualified_name call.
2682 (deduction_guides_for): Likewise.
2683 (tsubst_friend_class): Adjust lookup_name_real call.
2684 (lookup_init_capture_pack): Likewise.
2685 (tsubst_expr): Likewise, don't look in namespaces.
2686 * semantics.c (capture_decltype): Adjust lookup_name_real. Don't
2689 2020-08-14 Jason Merrill <jason@redhat.com>
2693 * cp-tree.h (unsafe_return_slot_p): Declare.
2694 * call.c (is_base_field_ref): Rename to unsafe_return_slot_p.
2695 (build_over_call): Check unsafe_return_slot_p.
2696 (build_special_member_call): Likewise.
2697 * init.c (expand_default_init): Likewise.
2698 * typeck2.c (split_nonconstant_init_1): Likewise.
2700 2020-08-14 Nathan Sidwell <nathan@acm.org>
2702 * cp-tree.h (LOOKUP_PREFER_TYPES, LOOKUP_PREFER_NAMESPACES)
2703 (LOOKUP_NAMESPACES_ONLY, LOOKUP_TYPES_ONLY)
2704 (LOOKUP_QUALIFIERS_ONL): Delete.
2705 (LOOKUP_HIDDEN): Adjust.
2706 * name-lookup.h (enum class LOOK_want): New.
2707 (operator|, operator&): Overloads for it.
2708 (lookup_name_real): Replace prefer_type & namespaces_only with
2710 (lookup_qualified_name): Replace prefer_type with LOOK_want.
2711 (lookup_name_prefer_type): Replace with ...
2712 (lookup_name): ... this. New overload with LOOK_want parm.
2713 * name-lookup.c (struct name_lookup): Replace flags with want and
2714 hidden fields. Adjust constructors.
2715 (name_lookyp::add_overload): Correct hidden stripping test. Update
2716 for new LOOK_want type.
2717 (name_lookup::process_binding): Likewise.
2718 (name_lookup::search_unqualified): Use hidden flag.
2719 (identifier_type_value_1): Adjust lookup_name_real call.
2720 (set_decl_namespace): Adjust name_lookup ctor.
2721 (lookup_flags): Delete.
2722 (qualify_lookup): Add LOOK_want parm, adjust.
2723 (lookup_qualified_name): Replace prefer_type parm with LOOK_want.
2724 (lookup_name_real_1): Replace prefer_type and namespaces_only with
2726 (lookup_name_real): Likewise.
2727 (lookup_name_nonclass, lookup_name): Adjust lookup_name_real call.
2728 (lookup_name_prefer_type): Rename to ...
2729 (lookup_name): ... here. New overload with LOOK_want parm.
2730 (lookup_type_scope_1): Adjust qualify_lookup calls.
2731 * call.c (build_operator_new_call)
2732 (add_operator_candidates): Adjust lookup_name_real calls.
2733 * coroutines.cc (find_coro_traits_template_decl)
2734 (find_coro_handle_template_decl, morph_fn_to_coro): Adjust
2735 lookup_qualified_name calls.
2736 * cp-objcp-common.c (identifier_global_tag): Likewise.
2737 * decl.c (get_tuple_size, get_tuple_decomp_init): Likewise.
2738 (lookup_and_check_tag): Use lookup_name overload.
2739 * parser.c (cp_parser_userdef_numeric_literal): Adjust
2740 lookup_qualified_name call.
2741 (prefer_arg_type): Drop template_mem_access parm, return LOOK_want
2743 (cp_parser_lookup_name): Adjust lookup_member, lookup_name_real
2745 * pt.c (check_explicit_specialization): Adjust lookup_qualified_name
2747 (tsubst_copy_and_build, tsubst_qualified_name): Likewise
2748 (deduction_guides_for): Likewise.
2749 (tsubst_friend_class): Adjust lookup_name_real call.
2750 (lookup_init_capture, tsubst_expr): Likewise.
2751 * rtti.c (emit_support_tinfos): Adjust lookup_qualified_name call.
2752 * semantics.c (omp_reduction_lookup): Likewise.
2753 (capture_decltype): Adjust lookup_name_real call.
2755 2020-08-13 Nathan Sidwell <nathan@acm.org>
2757 * name-lookup.h (enum class LOOK_where): New.
2758 (operator|, operator&): Overloads for it.
2759 (lookup_name_real): Replace NONCLASS & BLOCK_P parms with WHERE.
2760 * name-lookup.c (identifier_type_value_w): Adjust
2761 lookup_name_real call.
2762 (lookup_name_real_1): Replace NONCLASS and BLOCK_P parameters
2763 with WHERE bitmask. Don't search namespaces if not asked to.
2764 (lookup_name_real): Adjust lookup_name_real_1 call.
2765 (lookup_name_nonclass, lookup_name)
2766 (lookup_name_prefer_type): Likewise.
2767 * call.c (build_operator_new_call)
2768 (add_operator_candidates): Adjust lookup_name_real calls.
2769 * parser.c (cp_parser_lookup_name): Likewise.
2770 * pt.c (tsubst_friend_class, lookup_init_capture_pack)
2771 (tsubst_expr): Likewise.
2772 * semantics.c (capture_decltype): Likewise.
2774 2020-08-13 Marek Polacek <polacek@redhat.com>
2777 * typeck.c (build_static_cast_1): Implement P1975R0 by allowing
2778 static_cast to aggregate type.
2780 2020-08-10 Jakub Jelinek <jakub@redhat.com>
2783 * constexpr.c (cxx_eval_binary_expression): For SPACESHIP_EXPR, tail
2784 call cxx_eval_constant_expression after genericize_spaceship to avoid
2785 undesirable further VERIFY_CONSTANT.
2787 2020-08-10 Patrick Palka <ppalka@redhat.com>
2789 * pt.c (resolve_overloaded_unification): Drop functions with
2790 unsatisfied constraints.
2791 (resolve_nondeduced_context): Likewise.
2793 2020-08-05 Patrick Palka <ppalka@redhat.com>
2794 Jason Merrill <jason@redhat.com>
2797 * constexpr.c (cxx_eval_vec_init_1): Truncate ctx->ctor and
2798 then clear CONSTRUCTOR_NO_CLEARING on each appended element
2799 initializer if we're initializing a previously zero-initialized
2802 2020-08-04 Marek Polacek <polacek@redhat.com>
2805 * parser.c (cp_parser_elaborated_type_specifier): Allow
2806 'template' following ::.
2808 2020-08-04 Nathan Sidwell <nathan@acm.org>
2810 * parser.c (cp_parser_explicit_specialization): Refactor
2811 to avoid leak of num_template_parameter_lists value.
2813 2020-08-04 Patrick Palka <ppalka@redhat.com>
2816 * init.c (sort_mem_initializers): Preserve TREE_TYPE of the
2817 member initializer list node.
2818 (emit_mem_initializers): Set input_location when performing each
2819 member initialization.
2820 * parser.c (cp_parser_mem_initializer): Attach the source
2821 location of this initializer to a dummy EMPTY_CLASS_EXPR
2822 within the TREE_TYPE of the list node.
2823 * pt.c (tsubst_initializer_list): Preserve TREE_TYPE of the
2824 member initializer list node.
2826 2020-08-03 Marek Polacek <polacek@redhat.com>
2828 * cp-tree.h (after_nsdmi_defaulted_late_checks): Remove.
2830 2020-08-03 Marek Polacek <polacek@redhat.com>
2834 * pt.c (check_default_tmpl_args): Also consider variable
2837 2020-07-31 Jakub Jelinek <jakub@redhat.com>
2840 * decl.c (finish_function): In constexpr functions use for C++14 and
2841 later error instead of warning if no return statement is present and
2842 diagnose it regardless of warn_return_type. Move the warn_return_type
2843 diagnostics earlier in the function.
2845 2020-07-31 Martin Sebor <msebor@redhat.com>
2848 * class.c (build_base_path): Set no-warning bit on the synthesized
2849 conditional expression in static_cast.
2851 2020-07-31 Richard Biener <rguenther@suse.de>
2854 * cp-objcp-common.h (LANG_HOOKS_FINALIZE_EARLY_DEBUG):
2855 Define to c_common_finalize_early_debug.
2857 2020-07-31 Patrick Palka <ppalka@redhat.com>
2860 * constexpr.c (cxx_eval_constant_expression) <case CONST_DECL>:
2861 Pass false to decl_constant_value and decl_really_constant_value
2862 so that they don't unshare their result.
2863 * cp-tree.h (decl_constant_value): New declaration with an added
2865 (decl_really_constant_value): Add bool parameter defaulting to
2866 true to existing declaration.
2867 * init.c (constant_value_1): Add bool parameter which controls
2868 whether to unshare the initializer before returning. Call
2869 unshare_expr at most once.
2870 (scalar_constant_value): Pass true to constant_value_1's new
2872 (decl_really_constant_value): Add bool parameter and forward it
2873 to constant_value_1.
2874 (decl_constant_value): Likewise, but instead define a new
2875 overload with an added bool parameter.
2877 2020-07-30 Patrick Palka <ppalka@redhat.com>
2880 * pt.c (resolve_overloaded_unification): If the function
2881 template specialization has a placeholder return type,
2882 then instantiate it before attempting unification.
2884 2020-07-30 Patrick Palka <ppalka@redhat.com>
2887 * pt.c (alias_ctad_tweaks): Call remove_constraints before
2888 calling set_constraints.
2890 2020-07-30 Patrick Palka <ppalka@redhat.com>
2893 * pt.c (reduce_template_parm_level): Propagate DECL_VIRTUAL_P
2894 from the original TEMPLATE_PARM_DECL to the new lowered one.
2896 2020-07-30 Patrick Palka <ppalka@redhat.com>
2899 * constraint.cc (constraints_satisfied_p): Return true if
2901 * pt.c (do_type_instantiation): Update a paragraph taken from
2902 [temp.explicit] to reflect the latest specification. Don't
2903 instantiate a member with unsatisfied constraints.
2905 2020-07-29 Jason Merrill <jason@redhat.com>
2908 * cp-tree.h (IMPLICIT_RVALUE_P): New.
2909 (enum cp_lvalue_kind_flags): Add clk_implicit_rval.
2910 (implicit_rvalue_p, set_implicit_rvalue_p): New.
2911 * call.c (reference_binding): Check clk_implicit_rval.
2912 (build_over_call): Adjust C++20 implicit move.
2913 * coroutines.cc (finish_co_return_stmt): Simplify implicit move.
2914 * except.c (build_throw): Adjust C++20 implicit move.
2915 * pt.c (tsubst_copy_and_build) [STATIC_CAST_EXPR]: Propagate
2917 * tree.c (lvalue_kind): Set clk_implicit_rval.
2918 * typeck.c (treat_lvalue_as_rvalue_p): Overhaul.
2919 (maybe_warn_pessimizing_move): Adjust.
2920 (check_return_expr): Adjust C++20 implicit move.
2922 2020-07-29 Jason Merrill <jason@redhat.com>
2925 * call.c (build_over_call): Don't call a const ref
2926 overload for implicit move.
2928 2020-07-28 Nathan Sidwell <nathan@acm.org>
2930 * cp-gimplify.c (cp_genericize_r): Set IMPORTED_DECL's context.
2931 * cp-objcp-common.c (cp_pushdecl): Set decl's context.
2932 * decl.c (grokfndecl): Make DECL_CONTEXT setting clearer.
2934 2020-07-28 Nathan Sidwell <nathan@acm.org>
2936 * class.c (fixup_type_variants): Copy TYPE_SIZE and
2938 (finish_struct): Call it.
2940 2020-07-28 Nathan Sidwell <nathan@acm.org>
2942 * ptree.c (cxx_print_decl): Better indentation.
2944 2020-07-28 Jakub Jelinek <jakub@redhat.com>
2945 Mark Wielaard <mark@klomp.org>
2948 * parser.c (cp_lexer_safe_previous_token): Don't call
2949 cp_lexer_previous_token, instead inline it by hand and return NULL
2950 instead of failing assertion if all previous tokens until the first
2952 (cp_parser_error_1): Optimize - only call cp_lexer_safe_previous_token
2953 if token->type is CPP_NAME. Use cp_lexer_safe_previous_token instead
2954 of cp_lexer_previous_token for the missing_token_desc != RT_NONE
2957 2020-07-27 Nathan Sidwell <nathan@acm.org>
2959 * cp-tree.h (enum cp_tree_index): Add CPTI_AS_BASE_IDENTIFIER.
2960 (as_base_identifier): Define.
2961 * decl.c (initialize_predifined_identifiers): Initialize as_base
2963 * class.c (layout_class_type): Name the as-base type. Zap
2964 NSDMI its fields may have.
2966 2020-07-22 Nathan Sidwell <nathan@acm.org>
2968 * class.c (maybe_add_class_template_decl_list): Don't add CONST_DECLs.
2970 2020-07-22 Nathan Sidwell <nathan@acm.org>
2972 * typeck.c (structural_comptypes): [DECLTYPE_TYPE] break
2974 [UNDERLYING_TYPE]: Use an if.
2977 2020-07-22 Nathan Sidwell <nathan@acm.org>
2979 * decl.c (decls_match): Move variables into scopes
2981 (duplicate_decls): Use STRIP_TEMPLATE.
2982 (build_typename_type): Move var decls to their assignments.
2983 (begin_function_body): Likewise.
2984 * decl2.c (get_guard): Likewise.
2985 (mark_used): Use true for truthiness.
2986 * error.c (dump_aggr_type): Hold the decl in a var called
2989 2020-07-22 Nathan Sidwell <nathan@acm.org>
2991 * cp-tree.h (struct tree_lambda_expr): Shrink
2992 default_capture_mode & discriminator.
2994 2020-07-22 Nathan Sidwell <nathan@acm.org>
2996 * mangle.c (decl_is_template_id): Rename to ...
2997 (maybe_template_info): ... here. Return the template info,
2998 rather than use a pointer. Adjust all callers.
2999 (find_substitution): Use template_args_equal, rather than
3002 2020-07-22 Tobias Burnus <tobias@codesourcery.com>
3004 * parser.c (cp_parser_omp_clause_hint): Require nonnegative hint.
3005 (cp_parser_omp_critical): Permit hint(0) clause without named critical.
3006 * pt.c (tsubst_expr): Re-check the latter for templates.
3008 2020-07-21 Sunil K Pandey <skpgkp2@gmail.com>
3011 * decl.c (cp_finish_decl): Call target hook
3012 lower_local_decl_alignment to lower local decl alignment.
3014 2020-07-21 Nathan Sidwell <nathan@acm.org>
3016 * parser.c (cp_lexer_consume_token): Drop PRAGMA_EOL assert.
3017 (cp_parser_skip_to_closing_parenthesis_1): Only pass start token
3018 to pragma skipper if recovering.
3019 (cp_parser_skip_to_pragma_eol): Only purge and change pragma
3020 state when recovering.
3022 2020-07-20 Jason Merrill <jason@redhat.com>
3024 * pt.c (type_dependent_expression_p): A pseudo-dtor can be
3026 * semantics.c (finish_call_expr): Use build_trivial_dtor_call for
3028 (finish_pseudo_destructor_expr): Leave type NULL for dependent arg.
3030 2020-07-20 Jason Merrill <jason@redhat.com>
3032 * mangle.c (write_base_ref): New.
3033 (write_expression): Use it for base field COMPONENT_REFs.
3034 * pt.c (invalid_tparm_referent_p): Canonicalize the type
3035 of array offsets. Allow subobjects.
3037 2020-07-20 Jason Merrill <jason@redhat.com>
3039 * pt.c (collect_ctor_idx_types): Add 'const' when deducing from
3042 2020-07-17 Marek Polacek <polacek@redhat.com>
3045 * decl.c (grokdeclarator): Detect cv-qual decltype(auto).
3046 * pt.c (do_auto_deduction): Likewise.
3048 2020-07-16 Iain Sandoe <iain@sandoe.co.uk>
3055 * coroutines.cc (struct coro_ret_data): Delete.
3056 (coro_maybe_expand_co_return): Delete.
3057 (co_return_expander): Delete.
3058 (expand_co_returns): Delete.
3059 (co_await_find_in_subtree): Remove unused name.
3060 (build_actor_fn): Remove unused parm, remove handling
3061 for co_return expansion.
3062 (register_await_info): Demote duplicate info message to a
3064 (coro_make_frame_entry): Move closer to use site.
3065 (struct susp_frame_data): Add fields for final suspend label
3066 and a flag to indicate await expressions with initializers.
3067 (captures_temporary): Delete.
3068 (register_awaits): Remove unused code, update comments.
3069 (find_any_await): New.
3070 (tmp_target_expr_p): New.
3071 (struct interesting): New.
3072 (find_interesting_subtree): New.
3073 (struct var_nest_node): New.
3074 (flatten_await_stmt): New.
3075 (handle_nested_conditionals): New.
3076 (process_conditional): New.
3077 (replace_statement_captures): Rename to...
3078 (maybe_promote_temps): ... this.
3079 (maybe_promote_captured_temps): Delete.
3080 (analyze_expression_awaits): Check for await expressions with
3081 initializers. Simplify handling for truth-and/or-if.
3082 (expand_one_truth_if): Simplify (map cases that need expansion
3084 (await_statement_walker): Handle CO_RETURN_EXPR. Simplify the
3085 handling for truth-and/or-if expressions.
3086 (register_local_var_uses): Ensure that we create names in the
3087 implementation namespace.
3088 (morph_fn_to_coro): Add final suspend label to suspend frame
3089 callback data and remove it from the build_actor_fn call.
3091 2020-07-16 Marek Polacek <polacek@redhat.com>
3093 * call.c (convert_like): Remove macro and introduce a new
3095 (convert_like_with_context): Likewise.
3096 (convert_like_real): Rename to convert_like.
3097 (convert_like_real_1): Rename to convert_like_internal. Call
3098 convert_like instead of convert_like_real therein.
3099 (perform_direct_initialization_if_possible): Call convert_like
3100 instead of convert_like_real.
3102 2020-07-16 Iain Sandoe <iain@sandoe.co.uk>
3104 * coroutines.cc: Correct some spelling errors
3107 2020-07-15 Nathan Sidwell <nathan@acm.org>
3109 * parser.c (cp_parser_declaration): Avoid copying tokens.
3110 (cp_parser_block_declaration): RAII token pointer.
3112 2020-07-15 Nathan Sidwell <nathan@acm.org>
3114 * parser.c (cp_parser_skip_to_closing_parenthesis_1): Deal with
3115 meeting a deferred pragma.
3116 (cp_parser_skip_to_end_of_statement): Likewise.
3117 (cp_parser_skip_to_end_of_block_or_statement): Likewise.
3118 (cp_parser_skip_to_pragma_eol): We should never meet EOF.
3119 (cp_parser_omp_declare_simd): Likewise.
3120 (cp_parser_omp_declare_reduction, cp_parser_oacc_routine)
3121 (pragma_lex): Likewise.
3123 2020-07-14 Marek Polacek <polacek@redhat.com>
3128 * call.c (convert_like_real_1): Renamed from convert_like_real.
3129 (convert_like_real): New wrapper for convert_like_real_1.
3131 2020-07-14 Nathan Sidwell <nathan@acm.org>
3133 * parser.c (cp_lexer_alloc): Do not deal with PCH here.
3134 (cp_lexer_new_main): Deal with PCH here. Store the tokens directly
3136 (cp_lexer_new_from_tokens): Assert last token isn't purged either.
3137 (cp_lexer_get_preprocessor_token): Change first arg to flags, adjust.
3138 (cp_parser_new): Pass the lexer in, don't create it here.
3139 (cp_parser_translation_unit): Initialize access checks here.
3140 (cp_parser_initial_pragma): First token is provided by caller,
3141 don't deal with PCH stopping here. Adjust error message.
3142 (c_parse_file): Adjust, change error message to avoid C++20 module
3145 2020-07-14 Nathan Sidwell <nathan@acm.org>
3147 * ptree.c (cxx_print_type): Add TYPEOF_TYPE and BASES.
3149 2020-07-14 Nathan Sidwell <nathan@acm.org>
3151 * class.c (build_base_field_1): Cache CLASSTYPE_AS_BASE.
3152 (build_self_reference): Rename value -> decl.
3153 (dump_class_hierarchy_1): Cache CLASSTYPE_AS_BASE.
3155 2020-07-14 Marek Polacek <polacek@redhat.com>
3158 * decl.c (grokdeclarator) <case cdk_function>: Check also
3159 pointers/references/... to functions.
3161 2020-07-14 Nathan Sidwell <nathan@acm.org>
3163 * cp-tree.h: Correct some tree lang flag comments,
3164 reformat some structure definitions. Note some structure
3165 sizes. Clarify some comments.
3166 (yyungetc): Delete. Not been a thing for some time.
3167 * class.c (copy_fndecl_with_name): Comment.
3168 (check_bases_and_members): Unnecessary {}.
3169 (layout_class_type): Comment.
3170 * cp-tree.def (UNBOUND_CLASS_TEMPLATE): Adjust comment.
3171 * decl.c: Fix some formatting & whitespace issues.
3172 (function_requirements_equivalent_p): Note why
3173 substitutions are needed.
3174 * decl2.c (no_linkage_error): Note that heroics about
3175 'typedef struct { ... };' are no longer needed.
3176 * method.c: Whitespace.
3177 * name-lookup.c: Whitespace.
3178 (add_decl_to_level): Reformat a line.
3179 (print_binding_stack): Mark as DEBUG_FUNCTION.
3180 (has_using_namespace_std_directive_p): Delete comment.
3182 * ptree.c: Whitespace.
3183 * rtti.c: Whitespace & comment.
3185 * typeck.c (structural_comptypes): Add comment.
3187 2020-07-13 Nathan Sidwell <nathan@acm.org>
3189 * Make-lang.in (c++.disclean): Likewise.
3191 2020-07-13 Marek Polacek <polacek@redhat.com>
3194 * parser.c (cp_parser_enum_specifier): Commit to tentative parse
3195 after we've seen an opening brace.
3197 2020-07-10 Jason Merrill <jason@redhat.com>
3199 * tree.c (structural_type_p): Allow unions.
3200 * mangle.c (write_expression): Express unions with a designator.
3202 2020-07-10 Jason Merrill <jason@redhat.com>
3204 * pt.c (convert_nontype_argument): Handle REAL_TYPE.
3205 (invalid_nontype_parm_type_p): Allow all structural types.
3206 * tree.c (structural_type_p): Use SCALAR_TYPE_P.
3208 2020-07-10 Jason Merrill <jason@redhat.com>
3213 * class.c (check_field_decls): An array of empty classes is not an
3215 (layout_empty_base_or_field): Handle explicit alignment.
3218 2020-07-09 Julian Brown <julian@codesourcery.com>
3219 Thomas Schwinge <thomas@codesourcery.com>
3222 * semantics.c (finish_omp_clauses): Likewise.
3224 2020-07-09 Patrick Palka <ppalka@redhat.com>
3227 * constexpr.c (potential_constant_expression_1) <case PARM_DECL>:
3228 Restore dependent_type_p check that guarded the call to
3229 is_really_empty_class.
3231 2020-07-08 Patrick Palka <ppalka@redhat.com>
3234 * constexpr.c (potential_constant_expression_1) <case PARM_DECL>:
3235 When processing_template_decl, check COMPLETE_TYPE_P before
3236 calling is_really_empty_class. Don't check dependent_type_p.
3238 2020-07-08 Marek Polacek <polacek@redhat.com>
3241 * parser.c (cp_parser_decltype): Print error about using decltype(auto)
3242 in C++11. Check that the token following "auto" is ")".
3244 2020-07-07 Patrick Palka <ppalka@redhat.com>
3247 * cxx-pretty-print.c (pp_cxx_unqualified_id): Check
3248 PRIMARY_TEMPLATE_P before printing the innermost template
3251 2020-07-07 Martin Sebor <msebor@redhat.com>
3254 * parser.c (class_decl_loc_t::diag_mismatched_tags): Print notes only
3255 if warning_at returns nonzero.
3257 2020-07-06 Martin Sebor <msebor@redhat.com>
3260 * call.c (build_over_call): Check calls only when tf_warning is set.
3262 2020-07-06 Nathan Sidwell <nathan@acm.org>
3264 * decl.c (push_library_fn): Return the decl pushdecl_toplevel returns.
3265 * except.c (verify_library_fn): Replace with ...
3266 (declare_library_fn_1): ... this fn. Always push the fn.
3267 (declare_library_fn): Call it.
3268 (build_throw): Call declare_library_fn_1.
3270 2020-07-06 Jonathan Wakely <jwakely@redhat.com>
3273 * parser.c (cp_parser_toplevel_declaration): Only do pedwarn for
3274 empty-declaration in C++98.
3276 2020-07-02 Jason Merrill <jason@redhat.com>
3277 Jakub Jelinek <jakub@redhat.com>
3279 * decl.c (grokfndecl): Allow consteval virtual.
3280 * search.c (check_final_overrider): Check consteval mismatch.
3281 * constexpr.c (cxx_eval_thunk_call): New.
3282 (cxx_eval_call_expression): Call it.
3283 * cvt.c (cp_get_fndecl_from_callee): Handle FDESC_EXPR.
3284 * decl2.c (mark_vtable_entries): Track vtables with consteval.
3285 (maybe_emit_vtables): Pass consteval_vtables through.
3286 (clear_consteval_vfns): Replace consteval with nullptr.
3287 (c_parse_final_cleanups): Call it.
3289 2020-07-01 Nathan Sidwell <nathan@acm.org>
3291 * class.c (copy_fndecl_with_name): Add additional predicate args, do
3292 not deduce them locally.
3293 (copy_operator_fn): Adjust copy_fndecl_with_name call.
3294 (build_clone): Add vtt and inherited predicate args. Pass through
3295 to copy_fndecl_with_name call.
3296 (build_cdtor_clones): Likewise, pass through to build_clone as
3298 (build_cdtor): Determine vtt and inherited here.
3299 * cp-tree.h (DECL_NEEDS_CTT_PARM_P): Delete.
3301 2020-06-30 Nathan Sidwell <nathan@acm.org>
3303 * cp-tree.h (copy_fndecl_with_name): Rename to ...
3304 (copy_operatorn_fn): ... this. Change arg type.
3305 (clone_function_decl): Rename to ...
3306 (clone_cdtor): ... this.
3307 * class.c (copy_fndecl_with_name): Make static.
3308 (copy_operator_fn): New wrapper.
3309 (build_clones): Rename to ...
3310 (build_cdtor_clones): ... this.
3311 (clone_function_decl): Rename to ...
3312 (clone_cdtor): ... this. Adjust build_clones calls.
3313 (clone_constructors_and_destructors): Adjust clone_function_decl
3315 * method.c (implicitly_declare_fn): Adjust copy_fndecl_with_name
3317 (lazily_declare_fn): Adjust clone_function_decl call.
3318 * pt.c (tsubst_function_decl): Likewise.
3319 (instantiate_template_1): Likewise.
3321 2020-06-30 Iain Sandoe <iain@sandoe.co.uk>
3323 * coroutines.cc (morph_fn_to_coro): Remove trailing
3324 space in a diagnostic.
3326 2020-06-30 Iain Sandoe <iain@sandoe.co.uk>
3328 * coroutines.cc (expand_one_await_expression): Remove
3329 code dealing with initial suspend.
3330 (build_actor_fn): Remove code special-casing initial
3331 and final suspend. Handle the final suspend and marking
3332 of the coroutine as done.
3333 (coro_rewrite_function_body): New.
3334 (bind_expr_find_in_subtree): Remove.
3335 (coro_body_contains_bind_expr_p): Remove.
3336 (morph_fn_to_coro): Split the rewrite of the original
3337 function into coro_rewrite_function_body and call it.
3339 2020-06-29 Marek Polacek <polacek@redhat.com>
3342 * decl.c (duplicate_decls): Make sure a concept or a variable
3343 template is unique in its declarative region.
3345 2020-06-29 Marek Polacek <polacek@redhat.com>
3348 * pt.c (collect_ctor_idx_types): Use TREE_TYPE.
3350 2020-06-28 Iain Sandoe <iain@sandoe.co.uk>
3353 * coroutines.cc (register_local_var_uses): Skip past
3356 2020-06-27 Iain Sandoe <iain@sandoe.co.uk>
3359 * coroutines.cc (get_awaitable_var): New helper.
3360 (build_co_await): Check more carefully before
3361 copying an awaitable.
3362 (expand_one_await_expression): No initializer
3363 is required when the awaitable is not a temp.
3364 (register_awaits): Remove handling that is now
3365 completed when the await expression is built.
3367 2020-06-27 Iain Sandoe <iain@sandoe.co.uk>
3369 * coroutines.cc (morph_fn_to_coro): Diagnose unavailable
3370 get_return_object_on_allocation_failure.
3372 2020-06-26 Iain Sandoe <iain@sandoe.co.uk>
3375 * coroutines.cc (struct coroutine_info):Add a field
3376 to hold computed p.return_void expressions.
3377 (coro_build_promise_expression): New.
3378 (get_coroutine_return_void_expr): New.
3379 (finish_co_yield_expr): Build the promise expression
3380 using coro_build_promise_expression.
3381 (finish_co_return_stmt): Likewise.
3382 (build_init_or_final_await): Likewise.
3383 (morph_fn_to_coro): Likewise, for several cases.
3385 2020-06-26 Iain Sandoe <iain@sandoe.co.uk>
3387 * coroutines.cc (morph_fn_to_coro): Handle error
3388 returns in building g-r-o-o-a-f expressions.
3390 2020-06-24 Nicholas Krause <xerofoify@gmail.com>
3393 * typeck2.c (cxx_incomplete_type_diagnostic): Add missing
3394 TYPE_EXPANSION_PACK check for diagnosing incomplete types in
3395 cxx_incomplete_type_diagnostic.
3397 2020-06-24 Iain Sandoe <iain@sandoe.co.uk>
3401 * coroutines.cc (act_des_fn): Copy function
3402 attributes onto the outlined coroutine helpers.
3404 2020-06-24 Jason Merrill <jason@redhat.com>
3406 * call.c (build_over_call): Only call build_base_path once.
3408 2020-06-24 Jason Merrill <jason@redhat.com>
3411 * call.c (build_over_call): Look up the overrider in base_binfo.
3412 * class.c (lookup_vfn_in_binfo): Look through BINFO_PRIMARY_P.
3414 2020-06-23 Jason Merrill <jason@redhat.com>
3417 Implement C++20 P2082R1, Fixing CTAD for aggregates.
3418 * cp-tree.h (TPARMS_PRIMARY_TEMPLATE): Split out from...
3419 (DECL_PRIMARY_TEMPLATE): ...here.
3420 (builtin_guide_p): Declare.
3421 * decl.c (reshape_init_class): Handle bases of a template.
3422 (reshape_init_r): An array with dependent bound takes a single
3424 * pt.c (tsubst_default_argument): Shortcut {}.
3425 (unify_pack_expansion): Allow omitted arguments to trailing pack.
3426 (builtin_guide_p): New.
3427 (collect_ctor_idx_types): Give a trailing pack a {} default
3428 argument. Handle arrays better.
3430 2020-06-23 Iain Sandoe <iain@sandoe.co.uk>
3433 * coroutines.cc (morph_fn_to_coro): Apply a cleanup to
3434 the get return object when the DTOR is non-trivial.
3436 2020-06-20 Iain Sandoe <iain@sandoe.co.uk>
3439 * coroutines.cc (morph_fn_to_coro): Update handling of
3440 get-return-object-on-allocation-fail and diagnose missing
3443 2020-06-20 Jason Merrill <jason@redhat.com>
3445 * call.c (joust): Only compare constraints for non-template
3446 candidates with matching parameters.
3447 * pt.c (tsubst_pack_expansion): Fix getting a type parameter
3449 (more_specialized_fn): Only compare constraints for candidates with
3450 matching parameters.
3452 2020-06-19 Jason Merrill <jason@redhat.com>
3454 * method.c (early_check_defaulted_comparison): Allow defaulting
3455 comparison outside class. Complain if non-member operator isn't a
3458 2020-06-18 Jason Merrill <jason@redhat.com>
3460 * method.c (early_check_defaulted_comparison): Check for &&.
3461 (build_comparison_op): Allow empty union. Diagnose non-category
3463 (common_comparison_type): Remove handling for non-category type.
3465 2020-06-18 Marek Polacek <polacek@redhat.com>
3468 * pt.c (finish_template_variable): Return if
3469 coerce_innermost_template_parms return error_mark_node.
3471 2020-06-18 Marek Polacek <polacek@redhat.com>
3474 * pt.c (tsubst_copy_and_build) <case NEW_EXPR>: Return error_mark_node
3475 if placement is erroneous.
3477 2020-06-17 Jonathan Wakely <jwakely@redhat.com>
3480 * parser.c (cp_parser_elaborated_type_specifier): Do not warn
3481 unless in a declaration.
3483 2020-06-17 Jason Merrill <jason@redhat.com>
3485 * cp-tree.h (copy_fndecl_with_name): Declare.
3486 * class.c (copy_fndecl_with_name): Split out from...
3487 (build_clone): ...here.
3488 (add_implicitly_declared_members): Add op== to TYPE_FIELDS.
3489 * method.c (implicitly_declare_fn): Use copy_fndecl_with_name.
3491 2020-06-17 Jason Merrill <jason@redhat.com>
3493 * call.c (build_new_op_1): Don't look for a CALL_EXPR when
3494 calling a consteval function.
3496 2020-06-17 Jason Merrill <jason@redhat.com>
3498 * decl2.c (grokfield): Pass SD_DEFAULTED and SD_DELETED.
3499 * decl.c (duplicate_decls): Reduce error for delete
3500 after earlier declaration to pedwarn.
3502 2020-06-17 Marek Polacek <polacek@redhat.com>
3505 * constexpr.c (maybe_fold_non_dependent_expr): New.
3506 * cp-tree.h (maybe_fold_non_dependent_expr): Declare.
3507 * typeck.c (cp_build_array_ref): Call maybe_fold_non_dependent_expr
3508 instead of maybe_constant_value.
3510 2020-06-16 Marek Polacek <polacek@redhat.com>
3513 * call.c (add_list_candidates): Return if a designated initializer
3514 is used with a non-aggregate.
3515 (implicit_conversion_error): Give an error for the case above.
3517 2020-06-16 Marek Polacek <polacek@redhat.com>
3520 * name-lookup.c (check_local_shadow): Check if types are
3521 non-null before calling same_type_p.
3523 2020-06-16 Jakub Jelinek <jakub@redhat.com>
3525 * semantics.c (handle_omp_for_class_iterator): Adjust
3526 c_omp_check_loop_iv_exprs caller.
3527 (finish_omp_for): Likewise. Don't call fold_build_cleanup_point_expr
3528 before calling c_finish_omp_for and c_omp_check_loop_iv, move it
3530 * pt.c (tsubst_omp_for_iterator): Handle non-rectangular loops.
3532 2020-06-16 Jakub Jelinek <jakub@redhat.com>
3534 * parser.c (cp_parser_omp_clause_schedule): Reject modifier separated
3535 from kind by comma rather than colon.
3537 2020-06-16 Patrick Palka <ppalka@redhat.com>
3539 * pt.c (perform_instantiation_time_access_checks): No need to
3541 * semantics.c (enforce_access): Verify that decl is not
3544 2020-06-16 Patrick Palka <ppalka@redhat.com>
3548 * cp-tree.h (qualified_typedef_usage_s): Delete.
3549 (qualified_typedef_usage_t): Delete.
3550 (deferred_access_check): Move up in file.
3551 (tree_template_info::typedefs_needing_access_checking): Delete.
3552 (tree_template_info::deferred_access_checks): New field.
3553 (TI_TYPEDEFS_NEEDING_ACCESS_CHECKING): Rename to ...
3554 (TI_DEFERRED_ACCESS_CHECKS): ... this, and adjust accordingly.
3555 * pt.c (perform_typedefs_access_check): Rename to ...
3556 (perform_instantiation_time_access_checks): ... this, and adjust
3557 accordingly. Remove unnecessary tree tests.
3558 (instantiate_class_template_1): Adjust accordingly.
3559 (instantiate_decl): Likewise.
3560 * semantics.c (enforce_access): Likewise.
3562 2020-06-16 Patrick Palka <ppalka@redhat.com>
3566 * call.c (enforce_access): Move to semantics.c.
3567 * cp-tree.h (enforce_access): Delete.
3568 (get_types_needing_access_check): Delete.
3569 (add_typedef_to_current_template_for_access_check): Delete.
3570 * decl.c (make_typename_type): Adjust accordingly. Use
3571 check_accessibility_of_qualified_id instead of directly using
3572 perform_or_defer_access_check.
3573 * parser.c (cp_parser_template_declaration_after_parameters):
3574 Don't push a dk_no_check access state when parsing a template.
3575 * pt.c (get_types_needing_access_check): Delete.
3576 (append_type_to_template_for_access_check_1): Delete.
3577 (perform_typedefs_access_check): Adjust. If type_decl is a
3578 FIELD_DECL, also check its DECL_CONTEXT for dependence. Use
3579 tsubst_copy instead of tsubst to substitute into type_decl so
3580 that we substitute into the DECL_CONTEXT of a FIELD_DECL.
3581 (append_type_to_template_for_access_check): Delete.
3582 * search.c (accessible_p): Remove the processing_template_decl
3584 * semantics.c (enforce_access): Moved from call.c. If we're
3585 parsing a template and the access check failed, add the check to
3586 TI_TYPEDEFS_NEEDING_ACCESS_CHECKING.
3587 (perform_or_defer_access_check): Adjust comment.
3588 (add_typedef_to_current_template_for_access_check): Delete.
3589 (check_accessibility_of_qualified_id): Adjust accordingly.
3590 Exit early if the scope is dependent.
3592 2020-06-11 Patrick Palka <ppalka@redhat.com>
3595 * constraint.cc (associate_classtype_constraints): If there is a
3596 discrepancy between the current template depth and the template
3597 depth of the original declaration, then adjust the template
3598 parameter depth within the current constraints appropriately.
3599 * pt.c (tsubst_friend_class): Substitute into and set the
3600 constraints on the injected declaration.
3602 2020-06-11 Iain Sandoe <iain@sandoe.co.uk>
3604 * coroutines.cc (instantiate_coro_traits): Pass a reference
3605 to lambda closure objects to traits instantiation.
3606 (morph_fn_to_coro): Likewise for promise parameter
3607 preview and allocator lookup.
3609 2020-06-10 Iain Sandoe <iain@sandoe.co.uk>
3612 * call.c (add_candidates): Use vec_safe_length() for
3613 testing the arguments list.
3614 (build_new_method_call_1): Use vec_safe_is_empty() when
3615 checking for an empty args list.
3617 2020-06-10 Marek Polacek <polacek@redhat.com>
3620 * parser.c (cp_parser_direct_declarator): Clear
3621 CP_PARSER_FLAGS_DELAY_NOEXCEPT if the declarator kind is not
3624 2020-06-09 Iain Sandoe <iain@sandoe.co.uk>
3627 * coroutines.cc (expand_one_await_expression): Build separate
3628 DTOR trees for the awaitable object on the destroy and resume
3631 2020-06-09 Jason Merrill <jason@redhat.com>
3634 * cp-gimplify.c (predeclare_vla): Only predeclare a VLA if it's
3635 wrapped in a pointer type.
3637 2020-06-05 Marek Polacek <polacek@redhat.com>
3640 * call.c (build_converted_constant_expr_internal): Allow
3641 list-initialization.
3643 2020-06-05 Iain Sandoe <iain@sandoe.co.uk>
3645 * cp-tree.def (CO_RETURN_EXPR): Correct the class
3646 to use tcc_statement.
3648 2020-06-05 Jason Merrill <jason@redhat.com>
3650 * error.c (dump_binary_op): Handle negative operand to
3653 2020-06-04 Jason Merrill <jason@redhat.com>
3656 * constexpr.c (cxx_eval_constant_expression) [OBJ_TYPE_REF]:
3657 Evaluate OBJ_TYPE_REF_EXPR.
3659 2020-06-04 Jason Merrill <jason@redhat.com>
3662 * class.c (lookup_vfn_in_binfo): New.
3663 * call.c (build_over_call): Use it.
3664 * cp-tree.h (resolves_to_fixed_type_p): Add default argument.
3665 (lookup_vfn_in_binfo): Declare.
3667 2020-06-04 Iain Sandoe <iain@sandoe.co.uk>
3670 * coroutines.cc (morph_fn_to_coro): Ensure that the get-
3671 return-object is constructed correctly; When it is not the
3672 final return value, pass it to the CTOR of the return type
3673 as an rvalue, per the standard comment.
3675 2020-06-04 Jakub Jelinek <jakub@redhat.com>
3679 * constexpr.c (cxx_eval_constant_expression): Diagnose CONVERT_EXPR
3680 conversions from pointer types to arithmetic types here...
3681 (cxx_eval_outermost_constant_expr): ... instead of here.
3683 2020-06-03 Mark Wielaard <mark@klomp.org>
3685 * parser.c (cp_lexer_safe_previous_token): New function.
3686 (cp_parser_error_1): Add name_hint if the previous token is
3687 a string literal and next token is a CPP_NAME and we have a
3688 missing header suggestion for the name.
3690 2020-06-03 Patrick Palka <ppalka@redhat.com>
3692 * pt.c (process_partial_specialization): Pass the full set of
3693 generic template arguments to strictly_subsumes.
3695 2020-06-03 Patrick Palka <ppalka@redhat.com>
3698 * pt.c (most_specialized_partial_spec): Reorganize the loop over
3699 DECL_TEMPLATE_SPECIALIZATIONS. Check constraints_satisfied_p on
3700 the original template declaration, not on the tsubsted one.
3702 2020-06-03 Iain Sandoe <iain@sandoe.co.uk>
3705 * coroutines.cc (finish_co_await_expr): Revise to allow for
3707 (finish_co_yield_expr): Likewise.
3709 2020-06-03 Jason Merrill <jason@redhat.com>
3712 * cp-tree.h (predeclare_vla): Declare.
3713 * cp-gimplify.c (predeclare_vla): Handle getting a decl.
3714 * pt.c (tsubst_expr) [DECL_EXPR]: Use it.
3716 2020-06-03 Tobias Burnus <tobias@codesourcery.com>
3718 * cp-gimplify.c (cxx_omp_predetermined_mapping): New.
3719 * cp-objcp-common.h (LANG_HOOKS_OMP_PREDETERMINED_MAPPING): Redfine.
3720 * cp-tree.h (cxx_omp_predetermined_mapping): Declare.
3722 2020-06-02 Jason Merrill <jason@redhat.com>
3725 * pt.c (tsubst_decl): Relax assert.
3727 2020-06-02 Iain Sandoe <iain@sandoe.co.uk>
3730 * coroutines.cc (build_co_await): Wrap the co_await expression
3731 in a TARGET_EXPR, where needed.
3732 (finish_co_yield_expr): Likewise.
3734 2020-06-02 Patrick Palka <ppalka@redhat.com>
3738 * pt.c (tsubst_function_decl): Don't do set_constraints when
3739 regenerating a lambda.
3740 (tsubst_lambda_expr): Substitute into the lambda's constraints
3741 and do set_constraints here.
3743 2020-06-01 Jason Merrill <jason@redhat.com>
3748 * class.c (build_vfn_ref): Revert 95311 change.
3749 * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call): Build a
3752 2020-06-01 Iain Sandoe <iain@sandoe.co.uk>
3755 * coroutines.cc (struct param_info): Remove rv_ref field.
3756 (build_actor_fn): Remove specifial rvalue ref handling.
3757 (morph_fn_to_coro): Likewise.
3759 2020-05-31 Iain Sandoe <iain@sandoe.co.uk>
3762 * coroutines.cc (morph_fn_to_coro): If we see an
3763 early fatal error, drop the erroneous function body.
3765 2020-05-31 Iain Sandoe <iain@sandoe.co.uk>
3767 * coroutines.cc (build_co_await): Remove unused
3769 (finish_co_await_expr): Likewise.
3770 (finish_co_yield_expr): Likewise; revise comment.
3772 2020-05-30 Iain Sandoe <iain@sandoe.co.uk>
3774 * coroutines.cc (morph_fn_to_coro): Revise initialization
3775 of the frame pointer to avoid an unused value.
3777 2020-05-30 Patrick Palka <ppalka@redhat.com>
3780 * constraint.cc (satisfaction_value): Accept INTEGER_CST of any
3783 2020-05-29 Patrick Palka <ppalka@redhat.com>
3784 Jason Merrill <jason@redhat.com>
3787 * class.c (add_method): Let special member function templates
3788 coexist if they are not equivalently constrained, or in a class
3791 2020-05-29 Jason Merrill <jason@redhat.com>
3794 * pt.c (process_template_parm): Set DECL_TEMPLATE_INFO
3795 on the DECL_TEMPLATE_RESULT.
3797 2020-05-29 Marek Polacek <polacek@redhat.com>
3800 * cp-gimplify.c (cp_fold) <case MODIFY_EXPR>: Don't set
3801 TREE_THIS_VOLATILE here.
3802 (cp_fold): Set it here along with TREE_NO_WARNING.
3804 2020-05-29 Jason Merrill <jason@redhat.com>
3808 * class.c (build_vfn_ref): Don't fold the INDIRECT_REF.
3810 2020-05-29 Patrick Palka <ppalka@redhat.com>
3815 * parser.c (cp_parser_requires_clause_expression): Temporarily
3816 increment processing_template_decl only if it is 0.
3817 (cp_parser_constraint_expression): Likewise.
3818 (cp_parser_requires_expression): Likewise.
3820 2020-05-29 Patrick Palka <ppalka@redhat.com>
3823 * constexpr.c (get_or_insert_ctor_field): Add limited support
3824 for RANGE_EXPR index lookups.
3826 2020-05-28 Jakub Jelinek <jakub@redhat.com>
3829 * decl.c (cp_finish_decomp): Call complete_type before checking
3832 2020-05-28 Jason Merrill <jason@redhat.com>
3835 * decl.c (cp_finish_decl): Revert r9-297 change.
3836 (check_static_variable_definition): Likewise.
3837 * constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
3838 * pt.c (instantiate_decl): Return early on type error.
3840 2020-05-27 Jason Merrill <jason@redhat.com>
3843 * decl.c (reshape_init_array_1): Don't reuse in overload context.
3845 2020-05-27 Jason Merrill <jason@redhat.com>
3848 * call.c (build_new_op_1): Suppress
3849 warn_zero_as_null_pointer_constant across comparison of <=> result
3852 2020-05-27 Jason Merrill <jason@redhat.com>
3855 * decl.c (grokdeclarator): Don't shift attributes in TYPENAME
3858 2020-05-27 Nathan Sidwell <nathan@acm.org>
3861 * pt.c (lookup_template_class_1): Restore alias template mutation.
3863 2020-05-26 Jakub Jelinek <jakub@redhat.com>
3866 * cp-gimplify.c: Include omp-general.h.
3867 (cp_genericize_r) <case OMP_DISTRIBUTE>: For class iteration
3868 variables in composite distribute parallel for, instantiate copy
3869 ctor of their types.
3871 2020-05-23 Patrick Palka <ppalka@redhat.com>
3874 * constexpr.c (cxx_eval_constant_expression)
3875 <case TEMPLATE_ID_EXPR>: Don't evaluate the concept when
3876 constexpr evaluation is uid-sensitive.
3878 2020-05-22 Jason Merrill <jason@redhat.com>
3880 * cp-gimplify.c (cp_gimplify_expr) [CALL_EXPR]: Don't preevaluate
3881 the function address if the call used operator syntax.
3883 2020-05-21 Jason Merrill <jason@redhat.com>
3886 * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call): For a virtual
3887 call, instrument the OBJ_TYPE_REF.
3889 * decl.c (compute_array_index_type_loc): Diagnose expressions
3890 in a template that can't be constant.
3891 * parser.c (cp_parser_direct_declarator): Don't check
3892 non-constant array bounds here.
3894 * cp-tree.h (is_rvalue_constant_expression): Declare.
3895 * constexpr.c (is_rvalue_constant_expression): New.
3896 * parser.c (cp_parser_constant_expression): Use it.
3897 * decl.c (cp_finish_decl): Try to treat a constexpr initializer in a
3898 template as constant.
3900 * typeck.c (build_x_modify_expr): Handle error_mark_node arguments.
3902 * decl.c (grokparms): Return NULL_TREE if any parms were erroneous.
3904 2020-05-21 Iain Sandoe <iain@sandoe.co.uk>
3906 * coroutines.cc (finish_co_return_stmt): Revert change to use
3909 2020-05-21 Patrick Palka <ppalka@redhat.com>
3912 * constexpr.c (constexpr_ctx::uid_sensitive): Remove field.
3913 (uid_sensitive_constexpr_evaluation_value): Define.
3914 (uid_sensitive_constexpr_evaluation_true_counter): Define.
3915 (uid_sensitive_constexpr_evaluation_p): Define.
3916 (uid_sensitive_constexpr_evaluation_sentinel): Define its
3918 (uid_sensitive_constexpr_evaluation_checker): Define its
3919 constructor and its evaluation_restricted_p method.
3920 (get_fundef_copy): Remove 'ctx' parameter. Use u_s_c_e_p
3921 instead of constexpr_ctx::uid_sensitive.
3922 (cxx_eval_call_expression): Use u_s_c_e_p instead, and test it
3923 last. Adjust call to get_fundef_copy.
3924 (instantiate_cx_fn_r): Test u_s_c_e_p so that we increment the
3925 counter if necessary.
3926 (cxx_eval_outermost_constant_expr): Remove 'uid_sensitive'
3927 parameter. Adjust function body accordingly.
3928 (maybe_constant_value): Remove 'uid_sensitive' parameter and
3929 adjust function body accordingly. Set up a
3930 uid_sensitive_constexpr_evaluation_checker, and use it to
3931 conditionally update the cv_cache.
3932 * cp-gimplify.c (cp_fold): Set up a
3933 uid_sensitive_constexpr_evaluation_checker, and use it to
3934 conditionally update the fold_cache.
3935 * cp-tree.h (maybe_constant_value): Update declaration.
3936 (struct uid_sensitive_constexpr_evaluation_sentinel): Define.
3937 (struct sensitive_constexpr_evaluation_checker): Define.
3938 * expr.c (fold_for_warn): Set up a
3939 uid_sensitive_constexpr_evaluation_sentinel before calling
3940 the folding subroutines. Drop all but the first argument to
3941 maybe_constant_value.
3943 2020-05-20 Marek Polacek <polacek@redhat.com>
3946 * parser.c (cp_parser_unqualified_id): Reject simple-template-id as
3947 the declarator-id of a destructor.
3948 (cp_parser_constructor_declarator_p): Reject simple-template-id as
3949 the declarator-id of a constructor.
3951 2020-05-20 Marek Polacek <polacek@redhat.com>
3955 * cp-tree.h (SD_DECOMPOSITION): New flag.
3956 * decl.c (duplicate_decls): Make sure a structured binding is unique
3957 in its declarative region.
3958 (start_decl): If INITIALIZED is SD_DECOMPOSITION, call
3959 fit_decomposition_lang_decl.
3960 (grokdeclarator): Compare INITIALIZED directly to SD_* flags.
3961 * parser.c (cp_parser_decomposition_declaration): Pass SD_DECOMPOSITION
3964 2020-05-20 Patrick Palka <ppalka@redhat.com>
3967 * typeck.c (structural_comptypes): Don't perform
3968 context-dependent resolution of TYPENAME_TYPEs when
3969 comparing_specializations.
3971 2020-05-19 Nathan Sidwell <nathan@acm.org>
3973 * pt.c (lookup_template_class_1): Do not reinit template_info of an
3976 2020-05-18 Martin Sebor <msebor@redhat.com>
3979 * call.c ((maybe_warn_class_memaccess): Use is_byte_access_type.
3980 * cp-tree.h (is_dummy_object): Return bool.
3981 (is_byte_access_type): Declare new function.
3982 * tree.c (is_dummy_object): Return bool.
3983 (is_byte_access_type): Define new function.
3985 2020-05-19 Patrick Palka <ppalka@redhat.com>
3988 * pt.c (init_template_processing): Enable sanitization for
3989 decl_specializations and type_specializations.
3992 * pt.c (fn_type_unification): Pass 'fn' instead of NULL_TREE as
3993 the 'in_decl' parameter to coerce_template_parms.
3995 2020-05-18 Marek Polacek <polacek@redhat.com>
3998 * typeck.c (cp_build_binary_op): Use fold_for_warn instead of
4001 2020-05-18 Marek Polacek <polacek@redhat.com>
4004 * cvt.c (cp_get_fndecl_from_callee): Return NULL_TREE if the function
4005 type is not INDIRECT_TYPE_P.
4006 * decl.c (omp_declare_variant_finalize_one): Call
4007 cp_get_callee_fndecl_nofold instead of looking for the function decl
4010 2020-05-18 Marek Polacek <polacek@redhat.com>
4013 * parser.c (cp_parser_has_attribute_expression): Sorry on a
4014 type-dependent argument.
4016 2020-05-18 Marek Polacek <polacek@redhat.com>
4020 * call.c (add_builtin_candidate) <case EQ_EXPR>: Create candidate
4021 operator functions when type is std::nullptr_t for ==/!=.
4022 * typeck.c (composite_pointer_type_r): Add a bool * parameter. Use it
4023 to maybe add "const" to the pointer type.
4024 (composite_pointer_type): Update the call to composite_pointer_type_r.
4025 (cp_build_binary_op): Turn two warning_at into error_at. Print the
4028 2020-05-18 Jason Merrill <jason@redhat.com>
4030 * call.c (build_over_call): Remove unnecessary
4031 cp_stabilize_reference.
4033 2020-05-18 Marek Polacek <polacek@redhat.com>
4035 * call.c (add_builtin_candidate): Don't create a builtin overload
4036 candidate for ++ when type is bool in C++17.
4038 2020-05-18 Marek Polacek <polacek@redhat.com>
4040 * cfns.h: Regenerated.
4042 2020-05-17 Iain Sandoe <iain@sandoe.co.uk>
4044 * coroutines.cc (morph_fn_to_coro): Initialize the gro variable.
4046 2020-05-16 Iain Sandoe <iain@sandoe.co.uk>
4048 * coroutines.cc (finish_co_return_stmt): Implement rules
4049 from [class.copy.elision] /3.
4051 2020-05-16 Patrick Palka <ppalka@redhat.com>
4054 * semantics.c (finish_decltype_type): Call
4055 instantiate_non_dependent_expr_sfinae on the expression.
4057 2020-05-15 Patrick Palka <ppalka@redhat.com>
4061 2020-04-07 Patrick Palka <ppalka@redhat.com>
4064 * typeck2.c (process_init_constructor_array): Propagate
4065 CONSTRUCTOR_PLACEHOLDER_BOUNDARY up from each element initializer to
4066 the array initializer.
4068 2020-05-15 Jason Merrill <jason@redhat.com>
4070 PR c++/93286 - ICE with __is_constructible and variadic template.
4071 * pt.c (tsubst_tree_list): New.
4072 (tsubst, tsubst_copy_and_build): Use it.
4073 * decl2.c (is_late_template_attribute): Handle error_mark_node args.
4075 2020-05-15 Nathan Sidwell <nathan@acm.org>
4077 * pt.c (template_args_equal): Fix thinkos in previous 'cleanup'.
4079 2020-05-14 Jason Merrill <jason@redhat.com>
4082 * pt.c (maybe_instantiate_noexcept): Change clone handling.
4084 2020-05-14 Patrick Palka <ppalka@redhat.com>
4087 * call.c (build_op_call): Pass complain to lookup_fnfields.
4088 (build_special_member_call): Likewise.
4089 * class.c (type_requires_array_cookie): Pass tf_warning_or_error
4091 * cp-tree.h (lookup_fnfields): Add tsubst_flags_t parameter.
4092 * except.c (build_throw): Pass tf_warning_or_error to
4094 * init.c (build_new_1): Pass complain to lookup_fnfields.
4095 * method.c (locate_fn_flags): Likewise.
4096 * name-lookup.c (lookup_name_real_1): Pass tf_warning_or_error
4098 * pt.c (tsubst_baselink): Pass complain to lookup_fnfields.
4099 * search.c (lookup_fnfields): New 'complain' parameter. Pass it
4102 2020-05-14 Nathan Sidwell <nathan@acm.org>
4104 * parser.c (cp_parser_diagnose_invalid_typename): Mention
4105 std=c++20 not 2a, reformat dependent binfo inform loops.
4107 * pt.c (tsubst_template_decl): Reorder and commonize some control
4110 * pt.c (tsubst_friend_function): Simplify control flow.
4112 * pt.c (lookup_template_class_1): Remove unnecessary else by
4113 simply grabbing TYPE_NAME earlier.
4115 * pt.c (push_template_decl_real): Adjust friend pushing logic.
4116 Reinit template type.
4118 * pt.c (build_template_decl): Init DECL_TEMPLATE_RESULT &
4120 (process_partial_specialization): ... not here ...
4121 (push_template_decl_real, add_inherited_template_parms)
4122 (build_deduction_guide): ... or here.
4124 2020-05-14 Jakub Jelinek <jakub@redhat.com>
4126 * cp-gimplify.c (cp_genericize_r): Set cfun->has_omp_target.
4128 2020-05-13 Patrick Palka <ppalka@redhat.com>
4131 * init.c (build_vec_delete_1): Just return error_mark_node if
4132 deallocate_expr is error_mark_node.
4133 (build_delete): Just return error_mark_node if do_delete is
4136 2020-05-13 Patrick Palka <ppalka@redhat.com>
4139 * constraint.cc (tsubst_requires_expr): Produce a new
4140 requires-expression when processing_template_decl, even if
4141 template arguments are not dependent.
4143 2020-05-13 Marek Polacek <polacek@redhat.com>
4146 * decl.c (duplicate_decls): Set DECL_HAS_DEPENDENT_EXPLICIT_SPEC_P.
4148 2020-05-13 Nathan Sidwell <nathan@acm.org>
4150 * pt.c (template_args_equal): Reorder category checking for
4153 * pt.c (perform_typedefs_access_check): Cache expensively
4154 calculated object references.
4155 (check_auto_in_tmpl_args): Just assert we do not get unexpected
4156 nodes, rather than silently do nothing.
4157 (append_type_to_template_for_access): Likewise, cache expensie
4160 * pt.c (canonical_type_parameter): Simplify.
4162 Formatting fixups & some simplifications.
4163 * pt.c (spec_hash_table): New typedef.
4164 (decl_specializations, type_specializations): Use it.
4165 (retrieve_specialization): Likewise.
4166 (register_specialization): Remove unnecessary casts.
4167 (push_template_decl_real): Reformat.
4168 (instantiate_class_template_1): Use more RAII.
4169 (make_argument_pack): Simplify.
4170 (instantiate_template_1): Use gcc_checking_assert for expensive
4172 (instantiate_decl): Likewise.
4173 (resolve_typename_type): Reformat comment.
4174 * semantics.c (struct deferred_access): Remove unnecessary GTY on
4176 (begin_class_definition): Fix formatting.
4178 2020-05-13 Jason Merrill <jason@redhat.com>
4180 * call.c, class.c, constexpr.c, constraint.cc, decl.c, init.c,
4181 lambda.c, lex.c, method.c, name-lookup.c, parser.c, pt.c, tree.c,
4182 typeck2.c: Change cxx2a to cxx20.
4184 2020-05-12 Marek Polacek <polacek@redhat.com>
4187 * parser.c (cp_parser_postfix_expression) <case CPP_OPEN_PAREN>: When
4188 looking for a block-scope function declaration, look through the whole
4189 set, not just the first function in the overload set.
4191 2020-05-12 Jakub Jelinek <jakub@redhat.com>
4194 * pt.c (tsubst_decl): Deal with DECL_OMP_PRIVATIZED_MEMBER for
4197 2020-05-11 Jason Merrill <jason@redhat.com>
4199 Resolve C++20 NB comment CA104
4200 * pt.c (determine_specialization): Compare constraints for
4201 specialization of member template of class instantiation.
4203 2020-05-11 Jason Merrill <jason@redhat.com>
4207 * tree.c (cp_walk_subtrees): Stop at typedefs.
4208 Handle TYPENAME_TYPE here.
4209 * pt.c (find_parameter_packs_r): Not here.
4210 (for_each_template_parm_r): Clear *walk_subtrees.
4211 * decl2.c (min_vis_r): Look through typedefs.
4213 2020-05-11 Jason Merrill <jason@redhat.com>
4215 * call.c (implicit_conversion_error): Split out from...
4216 (perform_implicit_conversion_flags): ...here.
4217 (build_converted_constant_expr_internal): Use it.
4219 2020-05-11 Jason Merrill <jason@redhat.com>
4222 * parser.c (inject_parm_decls): Set current_class_ptr here.
4223 (cp_parser_direct_declarator): And here.
4224 (cp_parser_late_return_type_opt): Not here.
4225 (cp_parser_noexcept_specification_opt): Nor here.
4226 (cp_parser_exception_specification_opt)
4227 (cp_parser_late_noexcept_specifier): Remove unneeded parameters.
4229 2020-05-11 Jason Merrill <jason@redhat.com>
4231 * decl.c (cxx_init_decl_processing): Call declare_weak for
4234 2020-05-11 Jason Merrill <jason@redhat.com>
4236 * pt.c (instantiate_class_template_1): Call tsubst_expr for
4237 STATIC_ASSERT member.
4238 * ptree.c (cxx_print_xnode): Handle STATIC_ASSERT.
4240 2020-05-11 Jason Merrill <jason@redhat.com>
4242 * pt.c (find_parameter_packs_r) [LAMBDA_EXPR]: Remove redundant
4243 walking of capture list.
4245 2020-05-11 Jason Merrill <jason@redhat.com>
4247 * cp-tree.h (LOOKUP_EXPLICIT_TMPL_ARGS): Remove.
4248 * call.c (build_new_function_call): Don't set it.
4249 (build_new_method_call_1): Likewise.
4250 (build_over_call): Check cand->explicit_targs instead.
4252 2020-05-11 Jason Merrill <jason@redhat.com>
4254 * decl.c (compute_array_index_type_loc): Stabilize before building
4257 2020-05-11 Jason Merrill <jason@redhat.com>
4259 * decl.c (grokdeclarator): Adjust deprecated_state here.
4260 (start_decl): Not here.
4262 2020-05-08 Iain Sandoe <iain@sandoe.co.uk>
4265 * coroutines.cc (build_actor_fn): Ensure that bind scopes
4266 are marked as having side-effects where necessary.
4267 (replace_statement_captures): Likewise.
4268 (morph_fn_to_coro): Likewise.
4270 2020-05-08 Nathan Sidwell <nathan@acm.org>
4272 * NEWS: Delete, it is so stale.
4274 * parser.c (cp_lexer_set_source_position_from_token): EOF has a
4277 2020-05-07 Iain Sandoe <iain@sandoe.co.uk>
4281 * coroutines.cc (morph_fn_to_coro): Set unformed outline
4282 functions to error_mark_node. For early error returns suppress
4283 warnings about missing ramp return values. Fix reinstatement
4284 of the function body on pre-existing initial error.
4285 * decl.c (finish_function): Use the normal error path for fails
4286 in the ramp function, do not try to compile the helpers if the
4289 2020-05-07 Marek Polacek <polacek@redhat.com>
4291 PR c++/94590 - Detect long double -> double narrowing.
4292 * typeck2.c (check_narrowing): Detect long double -> double
4293 narrowing even when double and long double have the same
4294 precision. Make it handle conversions to float too.
4296 2020-05-07 Marek Polacek <polacek@redhat.com>
4299 * parser.c (cp_parser_class_specifier_1): Check that the scope is
4300 nested inside current scope before pushing it.
4302 2020-05-07 Marek Polacek <polacek@redhat.com>
4305 * typeck2.c (check_narrowing): Consider T* to bool narrowing
4308 2020-05-07 Marek Polacek <polacek@redhat.com>
4310 * decl.c (grok_op_properties): Fix spelling of non-static.
4311 * typeck.c (build_class_member_access_expr): Likewise.
4313 2020-05-07 Richard Biener <rguenther@suse.de>
4316 * optimize.c (update_cloned_parm): Copy DECL_NOT_GIMPLE_REG_P.
4318 2020-05-06 Marek Polacek <polacek@redhat.com>
4321 * pt.c (tsubst_copy_and_build): Call type_dependent_expression_p_push
4322 instead of uses_template_parms. Move the warning_sentinels after the
4325 2020-05-06 Jakub Jelinek <jakub@redhat.com>
4328 * typeck.c (cp_strict_aliasing_warning): New function.
4329 (cp_build_indirect_ref_1, build_reinterpret_cast_1): Use
4330 it instead of strict_aliasing_warning.
4333 * method.c (defaulted_late_check): Don't call synthesize_method
4334 on constexpr sfk_comparison if it has been called on it already.
4336 2020-05-06 Nathan Sidwell <nathan@acm.org>
4339 * decl.c (grokdeclarator): Don't splice template attributes in
4340 parm context -- they can apply to the parm.
4342 2020-05-05 Iain Sandoe <iain@sandoe.co.uk>
4344 * coroutines.cc: Remove references to n4849 throughout.
4346 2020-05-05 Jason Merrill <jason@redhat.com>
4349 * pt.c (more_specialized_fn): Do consider parms with no deducible
4350 template parameters.
4352 2020-05-05 Jason Merrill <jason@redhat.com>
4355 * constexpr.c (potential_constant_expression_1): In a lambda
4356 function, consider a captured variable directly.
4358 2020-05-05 Iain Sandoe <iain@sandoe.co.uk>
4360 * coroutines.cc (transform_await_wrapper): Check that we have
4361 no unlowered co_yields.
4362 (captures_temporary): Likewise.
4363 (register_awaits): Likewise.
4365 2020-05-05 Nathan Sidwell <nathan@acm.org>
4368 * coroutines.cc (morph_fn_to_coro): Just check for
4370 * pt.c (tsubst_function_decl): Update lambda fn's this_ptr name.
4372 2020-05-05 Marek Polacek <polacek@redhat.com>
4373 Jason Merrill <jason@redhat.com>
4376 * parser.c (cp_parser_postfix_dot_deref_expression): If we have
4377 a type-dependent object of class type, stash it to
4378 parser->context->object_type. If the postfix expression doesn't have
4380 (cp_parser_class_name): Consider object scope too.
4381 (cp_parser_lookup_name): Remove code dealing with the case when
4382 object_type is unknown_type_node.
4384 2020-05-04 Patrick Palka <ppalka@redhat.com>
4387 * cp-gimplify.c (cp_fold) <case CALL_EXPR>: Move some variable
4388 declarations closer to their uses. Copy the CALL_EXPR only
4389 when one of its arguments has changed.
4390 <case TREE_VEC>: Instead of first collecting the folded
4391 arguments into a releasing_vec, just make a copy of the TREE_VEC
4392 as soon as folding changes one of its arguments.
4394 2020-05-04 Iain Sandoe <iain@sandoe.co.uk>
4396 * coroutines.cc (morph_fn_to_coro): Mark the coro.gro variable
4397 as artificial and ignored.
4399 2020-05-04 Nathan Sidwell <nathan@acm.org>
4401 pt.c (process_template_parm): Don't walk the template list twice,
4402 remember the final node instead.
4403 (end_template_parm_list): Refactor. Comment on why we do a pop
4406 PR c++/94827 -- don't save parms in nested requirement
4407 * constraint.cc (tsubst_nested_requirement): TYPE directly holds
4408 notmalized requirement.
4409 (finish_nested_requirement): Don't stash current tpl parms into
4411 (diagnose_nested_requirement): TYPE directly holds notmalized
4414 2020-05-01 Patrick Palka <ppalka@redhat.com>
4417 * cp-tree.h (check_accessibility_of_qualified_id): Add
4418 tsubst_flags_t parameter and change return type to bool.
4419 * parser.c (cp_parser_lookup_name): Pass tf_warning_to_error to
4420 check_accessibility_of_qualified_id.
4421 * pt.c (tsubst_qualified_id): Return error_mark_node if
4422 check_accessibility_of_qualified_id returns false.
4423 * semantics.c (check_accessibility_of_qualified_id): Add
4424 complain parameter. Pass complain instead of
4425 tf_warning_or_error to perform_or_defer_access_check. Return
4426 true unless perform_or_defer_access_check returns false.
4428 2020-05-01 Marek Polacek <polacek@redhat.com>
4431 * typeck2.c (process_init_constructor_record): Return PICFLAG_ERRONEOUS
4432 if an initializer element was erroneous.
4434 2020-05-01 Jason Merrill <jason@redhat.com>
4437 * init.c (get_nsdmi): Don't push_to_top_level for a local class.
4439 2020-05-01 Jason Merrill <jason@redhat.com>
4442 * decl.c (cp_finish_decl): Also clear TREE_READONLY if
4443 -fmerge-all-constants.
4445 2020-05-01 Jason Merrill <jason@redhat.com>
4448 * pt.c (tsubst_decl): Make sure DECL_VALUE_EXPR continues to have
4449 the same type as the variable.
4451 2020-04-30 Jason Merrill <jason@redhat.com>
4452 Nathan Sidwell <nathan@acm.org>
4455 * constraint.cc (map_arguments): If ARGS is null, it's a
4456 self-mapping of parms.
4457 (finish_nested_requirement): Do not pass argified
4458 current_template_parms to normalization.
4459 (tsubst_nested_requirement): Don't assert no template parms.
4461 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
4464 * coroutines.cc (transform_local_var_uses): Defer walking
4465 the DECL_INITIALs of BIND_EXPR vars until all the frame
4466 allocations have been made.
4468 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
4471 * coroutines.cc (register_awaits): Update target
4472 expressions for awaitable and suspend handle
4475 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
4478 * coroutines.cc (build_co_await): Account for variables
4479 with DECL_VALUE_EXPRs.
4480 (captures_temporary): Likewise.
4481 (register_awaits): Likewise.
4483 2020-04-29 Patrick Palka <ppalka@redhat.com>
4486 * pt.c (find_template_parameter_info::parm_list): New field.
4487 (keep_template_parm): Use the new field to build up the
4488 parameter list here instead of ...
4489 (find_template_parameters): ... here. Return ftpi.parm_list.
4491 2020-04-29 Jakub Jelinek <jakub@redhat.com>
4494 * class.c (build_base_field): Set DECL_FIELD_ABI_IGNORED on C++17 empty
4495 base artificial FIELD_DECLs.
4496 (layout_class_type): Set DECL_FIELD_ABI_IGNORED on empty class
4497 field_poverlapping_p FIELD_DECLs.
4499 2020-04-29 Patrick Palka <ppalka@redhat.com>
4502 * constraint.cc (satisfy_declaration_constraints): Use saved_t
4503 instead of t as the key to decl_satisfied_cache.
4506 * error.c (print_requires_expression_info): Print the dependent
4507 form of the parameter list with its template parameter mapping,
4508 rather than printing the substituted form.
4510 2020-04-28 Jason Merrill <jason@redhat.com>
4513 * decl.c (use_eh_spec_block): Check nothrow type after
4515 * pt.c (maybe_instantiate_noexcept): Call synthesize_method for
4516 DECL_MAYBE_DELETED fns here.
4517 * decl2.c (mark_used): Not here.
4518 * method.c (get_defaulted_eh_spec): Reject DECL_MAYBE_DELETED here.
4520 2020-04-28 Iain Sandoe <iain@sandoe.co.uk>
4523 * coroutines.cc (instantiate_coro_traits): Pass a reference to
4524 object type rather than a pointer type for 'this', for method
4526 (struct param_info): Add a field to hold that the parm is a lambda
4528 (morph_fn_to_coro): Check for lambda closure pointers in the
4529 args. Use a reference to *this when building the args list for the
4530 promise allocator lookup.
4532 2020-04-28 Iain Sandoe <iain@sandoe.co.uk>
4535 * coroutines.cc (coro_promise_type_found_p): Do not
4536 exclude non-classes here (this needs to be handled in the
4538 (morph_fn_to_coro): Allow for the case where the coroutine
4541 2020-04-27 Iain Sandoe <iain@sandoe.co.uk>
4544 * coroutines.cc (struct local_var_info): Add fields for static
4545 variables and those with DECL_VALUE_EXPR redirection.
4546 (transform_local_var_uses): Skip past typedefs and static vars
4547 and then account for redirected variables.
4548 (register_local_var_uses): Likewise.
4550 2020-04-27 Jason Merrill <jason@redhat.com>
4554 * decl.c (grokdeclarator): Move dependent attribute to decl.
4555 * decl2.c (splice_template_attributes): No longer static.
4557 2020-04-27 Patrick Palka <ppalka@redhat.com>
4560 * constexpr.c (cxx_eval_call_expression): Don't set new_obj if we're
4561 evaluating the target constructor of a delegating constructor.
4562 (cxx_eval_store_expression): Don't set TREE_READONLY if the LHS of the
4563 INIT_EXPR is '*this'.
4565 2020-04-26 Marek Polacek <polacek@redhat.com>
4568 * call.c (struct conversion): Add copy_init_p.
4569 (standard_conversion): Set copy_init_p in ck_base and ck_rvalue
4570 if FLAGS demands LOOKUP_ONLYCONVERTING.
4571 (convert_like_real) <case ck_base>: If copy_init_p is set, or
4572 LOOKUP_ONLYCONVERTING into FLAGS.
4574 2020-04-26 Iain Sandoe <iain@sandoe.co.uk>
4577 * coroutines.cc (morph_fn_to_coro): Ensure that
4578 unnamed function params have a usable and distinct
4581 2020-04-24 Jason Merrill <jason@redhat.com>
4584 * decl.c (redeclaration_error_message): Reject defaulted comparison
4585 operator that has been previously declared.
4587 2020-04-25 Patrick Palka <ppalka@redhat.com>
4589 * parser.c (cp_parser_diagnose_invalid_type_name): Suggest enabling
4590 concepts if the invalid identifier is 'requires'.
4592 2020-04-25 Jakub Jelinek <jakub@redhat.com>
4595 * semantics.c (finish_call_expr): When looking if all overloads
4596 are noreturn, use STRIP_TEMPLATE to look through TEMPLATE_DECLs.
4598 2020-04-24 Martin Liska <mliska@suse.cz>
4600 * coroutines.cc: Fix compilation error for release checking
4601 where we miss declaration of ‘coro_body_contains_bind_expr_p’.
4603 2020-04-23 Patrick Palka <ppalka@redhat.com>
4605 * tree.c (zero_init_expr_p): Use uses_template_parms instead of
4609 * pt.c (template_class_depth): Walk into the DECL_FRIEND_CONTEXT of a
4610 friend declaration rather than into its CP_DECL_CONTEXT.
4612 2020-04-23 Iain Sandoe <iain@sandoe.co.uk>
4615 * coroutines.cc (await_statement_expander): Simplify cases.
4616 (struct susp_frame_data): Add fields for truth and/or if
4617 cases, rename one field.
4618 (analyze_expression_awaits): New.
4619 (expand_one_truth_if): New.
4620 (add_var_to_bind): New helper.
4621 (coro_build_add_if_not_cond_break): New helper.
4622 (await_statement_walker): Handle conditional expressions,
4623 handle expansion of truth-and/or-if cases.
4624 (bind_expr_find_in_subtree): New, checking-only.
4625 (coro_body_contains_bind_expr_p): New, checking-only.
4626 (morph_fn_to_coro): Ensure that we have a top level bind
4629 2020-04-22 Jonathan Wakely <jwakely@redhat.com>
4631 PR translation/94698
4632 * class.c (check_field_decls): Change "define" to "declare" in
4633 -Weffc++ diagnostics.
4635 2020-04-22 Patrick Palka <ppalka@redhat.com>
4639 * constraint.cc (satisfy_declaration_constraints): If the inherited
4640 constructor points to an instantiation of a constructor template,
4641 remember and use its attached template arguments.
4643 2020-04-22 Jonathan Wakely <jwakely@redhat.com>
4645 PR translation/94698
4646 * class.c (check_field_decls): Change "override" to "define" in
4647 -Weffc++ diagnostics.
4649 2020-04-22 Iain Sandoe <iain@sandoe.co.uk>
4652 * coroutines.cc (struct param_info): Add a field to note that
4653 the param is 'this'.
4654 (morph_fn_to_coro): Convert this to a reference before using it
4655 in the promise parameter preview.
4657 2020-04-22 Jason Merrill <jason@redhat.com>
4660 * pt.c (register_parameter_specializations): If the instantiation is
4661 still a parameter pack, don't wrap it in a NONTYPE_ARGUMENT_PACK.
4662 (tsubst_pack_expansion, tsubst_expr): Adjust.
4664 2020-04-22 Martin Sebor <msebor@redhat.com>
4665 Jason Merrill <jason@redhat.com>
4668 * decl.c (reshape_init_array_1): Avoid stripping redundant trailing
4669 zero initializers...
4670 * mangle.c (write_expression): ...and handle them here even for
4671 pointers to members by calling zero_init_expr_p.
4672 * cp-tree.h (zero_init_expr_p): Declare.
4673 * tree.c (zero_init_expr_p): Define.
4674 (type_initializer_zero_p): Remove.
4675 * pt.c (tparm_obj_values): New hash_map.
4676 (get_template_parm_object): Store to it.
4677 (tparm_object_argument): New.
4679 2020-04-22 Patrick Palka <ppalka@redhat.com>
4682 * constraint.cc (diagnose_valid_expression): Check convert_to_void here
4683 as well as in tsubst_valid_expression_requirement.
4685 2020-04-21 Patrick Palka <ppalka@redhat.com>
4688 * constraint.cc (satisfy_declaration_constraints): Don't strip the
4689 inherited constructor if it already has template information.
4692 * pt.c (any_template_parm_r) <case IDENTIFIER_NODE>: New case. If this
4693 is a conversion operator, visit its TREE_TYPE.
4695 2020-04-21 Nathan Sidwell <nathan@acm.org>
4697 * pt.c (tsubst_copy_and_build) [POINTER_PLUS_EXPR]: Check for
4700 2020-04-21 Iain Sandoe <iain@sandoe.co.uk>
4703 * coroutines.cc (morph_fn_to_coro): Simplify return
4706 2020-04-17 Marek Polacek <polacek@redhat.com>
4709 * constexpr.c (cxx_eval_outermost_constant_expr): Return when T is
4710 a BRACE_ENCLOSED_INITIALIZER_P.
4711 (is_nondependent_constant_expression): Don't check
4712 BRACE_ENCLOSED_INITIALIZER_P.
4713 (is_nondependent_static_init_expression): Likewise.
4715 2020-04-20 Patrick Palka <ppalka@redhat.com>
4718 * cp-tree.h (lss_policy::lss_nop): New enumerator.
4719 * pt.c (local_specialization_stack::local_specialization_stack): Handle
4721 (local_specialization_stack::~local_specialization_stack): Likewise.
4722 (tsubst_pack_expansion): Use a local_specialization_stack instead of
4723 manually saving and restoring local_specializations. Conditionally
4724 replace local_specializations sooner, before the handling of the
4725 unsubstituted_packs case.
4727 2020-04-20 Marek Polacek <polacek@redhat.com>
4729 PR c++/94505 - bogus -Wparentheses warning with fold-expression.
4730 * pt.c (fold_expression): Add warning_sentinel for -Wparentheses
4731 before calling build_x_binary_op.
4733 2020-04-20 Marek Polacek <polacek@redhat.com>
4735 * coroutines.cc (captures_temporary): Don't assign the result of
4736 STRIP_NOPS to the same variable.
4738 2020-04-20 Nathan Sidwell <nathan@acm.org>
4740 PR c++/94454 - tpl-tpl-parms are not canonicalizable types
4741 * pt.c (canonical_type_parameter): Assert not a tpl-tpl-parm.
4742 (process_template_parm): tpl-tpl-parms are structural.
4743 (rewrite_template_parm): Propagate structuralness.
4745 PR c++/94454 - Expr pack expansion equality
4746 * tree.c (cp_tree_equal) [TEMPLATE_ID_EXPR, default]: Refactor.
4747 [EXPR_PACK_EXPANSION]: Add.
4749 PR c++/94454 Template Argument Hashing
4750 * pt.c (iterative_hash_template_arg): Strip nodes as
4751 template_args_equal does.
4752 [ARGUMENT_PACK_SELECT, TREE_VEC, CONSTRUCTOR]: Refactor.
4753 [node_class:TEMPLATE_TEMPLATE_PARM]: Hash by level & index.
4754 [node_class:default]: Refactor.
4756 2020-04-18 Patrick Palka <ppalka@redhat.com>
4759 * tree.c (cp_tree_equal) <case PARM_DECL>: Ignore
4760 comparing_specializations if the parameters' contexts are identical.
4763 * pt.c (splice_late_return_type): Propagate cv-qualifiers and
4764 PLACEHOLDER_TYPE_CONSTRAINTS from the original auto node to the new one.
4766 2020-04-17 Patrick Palka <ppalka@redhat.com>
4769 * lambda.c (lambda_capture_field_type): Avoid doing auto deduction if
4770 the explicit initializer has parameter packs.
4773 * parser.c (cp_parser_check_template_parameters): Before issuing a hard
4774 error, first try simulating an error instead.
4776 2020-04-17 Jakub Jelinek <jakub@redhat.com>
4779 * call.c (build_conditional_expr_1): Remove redundant assignment to
4782 2020-04-16 Patrick Palka <ppalka@redhat.com>
4785 * cvt.c (ocp_convert): If the result of scalar_constant_value is
4786 erroneous, ignore it and use the original expression.
4788 2020-04-16 Jakub Jelinek <jakub@redhat.com>
4791 * parser.c (cp_parser_simple_declaration): Fix up a pasto in
4794 2020-04-15 Jakub Jelinek <jakub@redhat.com>
4797 * parser.c (cp_parser_pragma) <case PRAGMA_OMP_REQUIRES>: Reject
4798 requires directive when not at file or namespace scope.
4800 2020-04-14 Iain Sandoe <iain@sandoe.co.uk>
4803 * coroutines.cc (build_actor_fn): Check that the target can
4804 support the resume tailcall before mandating it.
4806 2020-04-14 Patrick Palka <ppalka@redhat.com>
4809 * cxx-pretty-print.c (cxx_pretty_printer:simple_type_specifier)
4810 <case DECLTYPE_TYPE>: Handle DECLTYPE_TYPE here instead of ...
4811 (pp_cxx_type_specifier_seq) <case DECLTYPE_TYPE>: ... here.
4812 (cxx_pretty_printer::direct_abstract_declarator) <case DECLTYPE_TYPE>:
4816 * constexpr.c (replace_result_decl_data): New struct.
4817 (replace_result_decl_data_r): New function.
4818 (replace_result_decl): New function.
4819 (cxx_eval_call_expression): Use it.
4820 * tree.c (build_aggr_init_expr): Set the location of the AGGR_INIT_EXPR
4821 to that of its initializer.
4823 2020-04-13 Marek Polacek <polacek@redhat.com>
4826 * name-lookup.c (check_local_shadow): Add an inform call.
4828 2020-04-13 Patrick Palka <ppalka@redhat.com>
4831 * error.c (dump_scope): Pass TFF_NO_FUNCTION_ARGUMENTS to
4832 dump_function_decl when printing a function template instantiation as a
4836 * constexpr.c (get_or_insert_ctor_field): Set default value of parameter
4838 (cxx_eval_bare_aggregate): Use get_or_insert_ctor_field instead of
4839 assuming the the next index belongs at the end of the new CONSTRUCTOR.
4840 (cxx_eval_store_expression): Revert PR c++/78572 fix.
4842 2020-04-13 Nathan Sidwell <nathan@acm.org>
4844 PR c++/94426 lambdas with internal linkage are different to no-linkage
4845 * decl2.c (determine_visibility): A lambda's visibility is
4846 affected by its extra scope.
4847 * pt.c (instantiate_decl): Determine var's visibility before
4848 instantiating its initializer.
4849 * tree.c (no_linkage_check): Revert code looking at visibility of
4850 lambda's extra scope.
4852 2020-04-10 Iain Sandoe <iain@sandoe.co.uk>
4855 * coroutines.cc (co_await_expander): Remove.
4856 (expand_one_await_expression): New.
4857 (process_one_statement): New.
4858 (await_statement_expander): New.
4859 (build_actor_fn): Revise to use per-statement expander.
4860 (struct susp_frame_data): Reorder and comment.
4861 (register_awaits): Factor code.
4862 (replace_statement_captures): New, factored from...
4863 (maybe_promote_captured_temps):.. here.
4864 (await_statement_walker): Revise to process per statement.
4865 (morph_fn_to_coro): Use revised susp_frame_data layout.
4867 2020-04-10 Marek Polacek <polacek@redhat.com>
4870 * method.c (constructible_expr): In C++20, try using parenthesized
4871 initialization of aggregates to determine the result of
4874 2020-04-10 Bin Cheng <bin.cheng@linux.alibaba.com>
4876 * coroutines.cc (co_await_expander): Simplify.
4878 2020-04-09 Jason Merrill <jason@redhat.com>
4881 * constexpr.c (cxx_eval_constant_expression) [VAR_DECL]: Look at
4882 ctx->object and ctx->global->values first.
4884 2020-04-09 Marek Polacek <polacek@redhat.com>
4887 * call.c (initialize_reference): If the reference binding failed, maybe
4888 try initializing from { }.
4889 * decl.c (grok_reference_init): For T& t(e), set
4890 LOOKUP_AGGREGATE_PAREN_INIT but don't build up a constructor yet.
4892 2020-04-08 Iain Sandoe <iain@sandoe.co.uk>
4893 Jun Ma <JunMa@linux.alibaba.com>
4895 * coroutines.cc (maybe_promote_captured_temps): Add a cleanup
4896 expression, if needed, to any call from which we promoted
4897 temporaries captured by reference.
4899 2020-04-08 Marek Polacek <polacek@redhat.com>
4901 PR c++/94507 - ICE-on-invalid with lambda template.
4902 * pt.c (tsubst_lambda_expr): Cope when tsubst_template_decl or
4903 tsubst_function_decl returns error_mark_node.
4905 2020-04-08 Martin Liska <mliska@suse.cz>
4908 * decl.c (duplicate_decls): Duplicate also DECL_IS_REPLACEABLE_OPERATOR.
4909 (cxx_init_decl_processing): Mark replaceable all implicitly defined
4912 2020-04-08 Patrick Palka <ppalka@redhat.com>
4914 Core issues 1001 and 1322
4916 * pt.c (rebuild_function_or_method_type): Split function out from ...
4917 (tsubst_function_type): ... here.
4918 (maybe_rebuild_function_decl_type): New function.
4919 (tsubst_function_decl): Use it.
4921 2020-04-08 Jakub Jelinek <jakub@redhat.com>
4924 * decl.c (begin_destructor_body): For CLASSTYPE_VBASECLASSES class
4925 dtors, if CLASSTYPE_PRIMARY_BINFO is non-NULL, but not BINFO_VIRTUAL_P,
4926 look at CLASSTYPE_PRIMARY_BINFO of its BINFO_TYPE if it is not
4927 BINFO_VIRTUAL_P, and so on.
4929 2020-04-08 Marek Polacek <polacek@redhat.com>
4931 PR c++/94478 - ICE with defaulted comparison operator
4932 * method.c (early_check_defaulted_comparison): Give an error when the
4935 2020-04-08 Tobias Burnus <tobias@codesourcery.com>
4938 * paser.c (cp_parser_oacc_declare): Add check that variables
4939 are declared in the same scope as the directive.
4941 2020-04-07 Jason Merrill <jason@redhat.com>
4944 * parser.c (cp_parser_requires_expression): Use tentative_firewall.
4947 * parser.c (cp_parser_placeholder_type_specifier): Use
4950 2020-04-07 Iain Sandoe <iain@sandoe.co.uk>
4952 * coroutines.cc (maybe_promote_captured_temps): Ensure that
4953 reference capture placeholder vars are properly declared.
4955 2020-04-07 Patrick Palka <ppalka@redhat.com>
4958 * tree.c (replace_placeholders): Look through all handled components,
4959 not just COMPONENT_REFs.
4960 * typeck2.c (process_init_constructor_array): Propagate
4961 CONSTRUCTOR_PLACEHOLDER_BOUNDARY up from each element initializer to
4962 the array initializer.
4964 2020-04-07 Jakub Jelinek <jakub@redhat.com>
4967 * parser.c (cp_parser_omp_parallel): Set OMP_PARALLEL_COMBINED
4968 if cp_parser_omp_master succeeded.
4970 2020-04-06 Jason Merrill <jason@redhat.com>
4973 * decl.c (duplicate_decls): Fix handling of DECL_HIDDEN_FRIEND_P.
4975 2020-04-04 Marek Polacek <polacek@redhat.com>
4976 Jason Merrill <jason@redhat.com>
4978 PR c++/94155 - crash in gimplifier with paren init of aggregates.
4979 * init.c (build_vec_init): Fill in indexes.
4981 2020-04-04 Jason Merrill <jason@redhat.com>
4984 * mangle.c (write_expression): Skip IMPLICIT_CONV_EXPR.
4986 2020-04-04 Patrick Palka <ppalka@redhat.com>
4990 * constexpr.c (struct constexpr_ctx): New field 'parent'.
4991 (cxx_eval_bare_aggregate): Propagate CONSTRUCTOR_PLACEHOLDER_BOUNDARY
4992 flag from the original constructor to the reduced constructor.
4993 (lookup_placeholder): Prefer to return the outermost matching object
4994 by recursively calling lookup_placeholder on the 'parent' context,
4995 but don't cross CONSTRUCTOR_PLACEHOLDER_BOUNDARY constructors.
4996 (cxx_eval_constant_expression): Link the 'ctx' context to the 'new_ctx'
4997 context via 'new_ctx.parent' when being expanded without an explicit
4998 target. Don't call replace_placeholders.
4999 (cxx_eval_outermost_constant_expr): Initialize 'ctx.parent' to NULL.
5003 * constexpr.c (get_or_insert_ctor_field): Split out (while adding
5004 support for VECTOR_TYPEs, and optimizations for the common case)
5006 (cxx_eval_store_expression): ... here. Rename local variable
5007 'changed_active_union_member_p' to 'activated_union_member_p'. Record
5008 the sequence of indexes into 'indexes' that yields the subobject we're
5009 assigning to. Record the integer offsets of the constructor indexes
5010 we're assigning through into 'index_pos_hints'. After evaluating the
5011 initializer of the store expression, recompute 'valp' using 'indexes'
5012 and using 'index_pos_hints' as hints.
5013 (cxx_eval_bare_aggregate): Tweak comments. Use get_or_insert_ctor_field
5014 to recompute the constructor_elt pointer we're assigning through after
5015 evaluating each initializer.
5017 2020-04-04 Jason Merrill <jason@redhat.com>
5020 * constraint.cc (tsubst_valid_expression_requirement): Call
5023 2020-04-04 Jason Merrill <jason@redhat.com>
5026 * constexpr.c (maybe_constant_value): Use break_out_target_exprs.
5027 * expr.c (mark_use) [VIEW_CONVERT_EXPR]: Don't wrap a TARGET_EXPR in
5030 2020-04-04 Jakub Jelinek <jakub@redhat.com>
5033 * parser.c (cp_parser_omp_for_loop): Use
5034 protected_set_expr_location_if_unset.
5035 * cp-gimplify.c (genericize_if_stmt, genericize_cp_loop): Likewise.
5038 * pt.c (tsubst_expr) <case OMP_MASTER>: Clear
5039 omp_parallel_combined_clauses.
5041 2020-04-03 Jason Merrill <jason@redhat.com>
5044 * pt.c (complex_pack_expansion_r): New.
5045 (complex_alias_template_p): Use it.
5047 2020-03-31 Jason Merrill <jason@redhat.com>
5050 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Call
5051 replace_placeholders.
5052 * typeck2.c (store_init_value): Fix arguments to
5053 fold_non_dependent_expr.
5055 2020-03-31 Jason Merrill <jason@redhat.com>
5057 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Use
5060 2020-03-30 Jason Merrill <jason@redhat.com>
5063 * tree.c (cp_tree_equal) [CALL_EXPR]: Compare KOENIG_LOOKUP_P.
5064 (called_fns_equal): Check DECL_CONTEXT.
5066 2020-03-30 Jakub Jelinek <jakub@redhat.com>
5069 * semantics.c (add_stmt): Only set STMT_IS_FULL_EXPR_P on trees with
5070 STATEMENT_CODE_P code.
5072 2020-03-28 Patrick Palka <ppalka@redhat.com>
5075 * parser.c (cp_parser_requires_clause_opt): Diagnose and recover from
5076 "requires {" when "requires requires {" was probably intended.
5079 * constraint.cc (tsubst_compound_requirement): Always suppress errors
5080 from type_deducible_p and expression_convertible_p, as they're not
5081 substitution errors.
5082 (diagnose_atomic_constraint) <case INTEGER_CST>: Remove this case so
5083 that we diagnose INTEGER_CST expressions of non-bool type via the
5085 * cp-gimplify.c (cp_genericize_r) <case REQUIRES_EXPR>: New case.
5086 * parser.c (cp_parser_requires_expression): Always parse the requirement
5087 body as if we're processing a template, by temporarily incrementing
5088 processing_template_decl. Afterwards, if we're not actually in a
5089 template context, perform semantic processing to diagnose any invalid
5090 types and expressions.
5091 * pt.c (tsubst_copy_and_build) <case REQUIRES_EXPR>: Remove dead code.
5092 * semantics.c (finish_static_assert): Explain an assertion failure
5093 when the condition is a REQUIRES_EXPR like we do when it is a concept
5096 * constraint.cc (diagnose_compound_requirement): When diagnosing a
5097 compound requirement, maybe replay the satisfaction failure, subject to
5098 the current diagnosis depth.
5100 * constraint.cc (finish_constraint_binary_op): Set the location of EXPR
5101 as well as its range, because build_x_binary_op doesn't always do so.
5102 (current_constraint_diagnosis_depth): New.
5103 (concepts_diagnostics_max_depth_exceeded_p): New.
5104 (collect_operands_of_disjunction): New.
5105 (satisfy_disjunction): When diagnosing a satisfaction failure, maybe
5106 replay each branch of the disjunction, subject to the current diagnosis
5108 (diagnose_valid_expression): When diagnosing a satisfaction failure,
5109 maybe replay the substitution error, subject to the current diagnosis
5111 (diagnose_valid_type): Likewise.
5112 (diagnose_nested_requiremnet): Likewise.
5113 (diagnosing_failed_constraint::diagnosing_failed_constraint): Increment
5114 current_constraint_diagnosis_depth when diagnosing.
5115 (diagnosing_failed_constraint::~diagnosing_failed_constraint): Decrement
5116 current_constraint_diagnosis_depth when diagnosing.
5117 (diagnosing_failed_constraint::replay_errors_p): New static member
5119 (diagnose_constraints): Don't diagnose if concepts_diagnostics_max_depth
5120 is 0. Emit a one-off note to increase -fconcepts-diagnostics-depth if
5121 the limit was exceeded.
5122 * cp-tree.h (diagnosing_failed_constraint::replay_errors_p): Declare.
5124 2020-03-27 Nathan Sidwell <nathan@acm.org>
5127 * name-lookup.c (do_pushdecl): Look through cleanp levels.
5129 2020-03-27 Martin Sebor <msebor@redhat.com>
5134 * cp-tree.h (most_specialized_partial_spec): Declare.
5135 * parser.c (cp_parser_elaborated_type_specifier): Distinguish alias
5137 (specialization_of): New function.
5138 (cp_parser_check_class_key): Move code...
5139 (class_decl_loc_t::add): ...to here. Add parameters. Avoid issuing
5140 -Wredundant-tags on first-time declarations in other declarators.
5141 Correct handling of template specializations.
5142 (class_decl_loc_t::diag_mismatched_tags): Also expect to be called
5143 when -Wredundant-tags is enabled. Use primary template or partial
5144 specialization as the guide for uses of implicit instantiations.
5145 * pt.c (most_specialized_partial_spec): Declare extern.
5147 2020-03-27 Nathan Sidwell <nathan@acm.org>
5150 * name-lookup.c (push_namespace): Triage ambiguous lookups that
5153 2020-03-27 Jakub Jelinek <jakub@redhat.com>
5156 * call.c (set_flags_from_callee): Don't update
5157 cp_function_chain->can_throw or current_function_returns_abnormally
5158 if cp_unevaluated_operand.
5161 * cvt.c (ocp_convert): Handle COMPOUND_EXPR by recursion on the second
5162 operand and creating a new COMPOUND_EXPR if anything changed.
5164 2020-03-26 Marek Polacek <polacek@redhat.com>
5166 PR c++/94336 - template keyword accepted before destructor names.
5167 * parser.c (cp_parser_unqualified_id): Give an error when 'template'
5168 is followed by a destructor name.
5170 2020-03-27 Patrick Palka <ppalka@redhat.com>
5172 * decl.c (compute_array_index_type_loc): Remove redundant
5173 type_dependent_expression_p check that is subsumed by
5174 value_dependent_expression_p.
5175 * decl2.c (is_late_template_attribute): Likewise.
5176 * pt.c (uses_template_parms): Likewise.
5177 (dependent_template_arg_p): Likewise.
5179 2020-03-26 Marek Polacek <polacek@redhat.com>
5182 PR c++/94057 - template keyword in a typename-specifier.
5183 * parser.c (check_template_keyword_in_nested_name_spec): New.
5184 (cp_parser_nested_name_specifier_opt): Implement DR1710, optional
5185 'template'. Call check_template_keyword_in_nested_name_spec.
5186 (cp_parser_simple_type_specifier): Assume that a <
5187 following a qualified-id in a typename-specifier begins
5188 a template argument list.
5190 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
5192 * coroutines.cc (coro_init_identifiers): Initialize an identifier
5193 for the cororoutine handle 'address' method name.
5194 (struct coro_aw_data): Add fields to cover the continuations.
5195 (co_await_expander): Determine the kind of await_suspend in use.
5196 If we have the case that returns a continuation handle, then save
5197 this and make the target for 'scope exit without cleanup' be the
5198 continuation resume label.
5199 (expand_co_awaits): Remove.
5200 (struct suspend_point_info): Remove fields that kept the returned
5201 await_suspend handle type.
5202 (transform_await_expr): Remove code tracking continuation handles.
5203 (build_actor_fn): Add the continuation handle as an actor-function
5204 scope var. Build the symmetric transfer continuation point. Call
5205 the tree walk for co_await expansion directly, rather than via a
5206 trivial shim function.
5207 (register_await_info): Remove fields tracking continuation handles.
5208 (get_await_suspend_return_type): Remove.
5209 (register_awaits): Remove code tracking continuation handles.
5210 (morph_fn_to_coro): Remove code tracking continuation handles.
5212 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
5214 * coroutines.cc (co_await_expander): If we are expanding the
5215 initial await expression, set a boolean flag to show that we
5216 have now reached the initial await_resume() method call.
5217 (expand_co_awaits): Handle the 'initial await resume called' flag.
5218 (build_actor_fn): Insert the initial await expression into the
5219 start of the user-authored function-body. Handle the 'initial await
5220 resume called' flag.
5221 (morph_fn_to_coro): Initialise the 'initial await resume called'
5222 flag. Modify the unhandled exception catch clause to recognise
5223 exceptions that occur before the initial await_resume() and re-
5226 2020-03-26 Jakub Jelinek <jakub@redhat.com>
5229 * class.c (user_provided_p): Use STRIP_TEMPLATE instead of returning
5230 true for all TEMPLATE_DECLs.
5233 * cp-gimplify.c (cp_genericize_r): Handle STATEMENT_LIST.
5235 2020-03-25 Patrick Palka <ppalka@redhat.com>
5238 * parser.c (cp_parser_selection_statement) <case RID_IF>: Invalidate the
5239 current condition chain when the if-statement has a non-empty
5242 2020-03-25 Iain Sandoe <iain@sandoe.co.uk>
5245 * coroutines.cc (captures_temporary): Fix a missing dereference.
5247 2020-03-24 Marek Polacek <polacek@redhat.com>
5249 PR c++/94190 - wrong no post-decrement operator error in template.
5250 * call.c (convert_like_real): Use convert_from_reference on the result.
5252 2020-03-24 Jason Merrill <jason@redhat.com>
5255 * constraint.cc (constraint_satisfaction_value): Repeat noisily on
5257 (tsubst_nested_requirement): Likewise.
5258 (get_constraint_error_location): Allow missing context.
5259 (diagnose_atomic_constraint): Diagnose non-bool constraint here.
5260 (satisfy_atom): Not here. Only diagnose non-constant when noisy.
5262 2020-03-24 Jason Merrill <jason@redhat.com>
5264 * pt.c (any_template_parm_r): Look into the type of a non-type
5267 2020-03-24 Jason Merrill <jason@redhat.com>
5269 * cp-tree.h (cp_expr): When constructing from an expr and a
5270 location, call protected_set_expr_location.
5272 2020-03-23 Patrick Palka <ppalka@redhat.com>
5275 * except.c (maybe_noexcept_warning): Add TODO.
5276 * method.c (walk_field_subobs): Pass tf_none to expr_noexcept_p.
5278 2020-03-23 nathans <nathan@acm.org>
5281 * tree.c (cp_tree_equal) [SIZEOF_EXPR]: Detect argument pack
5284 2020-03-21 Patrick Palka <ppalka@redhat.com>
5287 * constexpr.c (reduced_constant_expression_p) [CONSTRUCTOR]: Properly
5288 handle unions without an initializer.
5289 (cxx_eval_component_reference): Emit a different diagnostic when the
5290 constructor element corresponding to a union member is NULL.
5291 (cxx_eval_bare_aggregate): When constructing a union, always set the
5292 active union member before evaluating the initializer. Relax assertion
5293 that verifies the index of the constructor element we're initializing
5294 hasn't been changed.
5295 (cxx_eval_store_expression): Diagnose changing the active union member
5296 while the union is in the process of being initialized. After setting
5297 an active union member, clear CONSTRUCTOR_NO_CLEARING on the underlying
5299 (cxx_eval_constant_expression) [PLACEHOLDER_EXPR]: Don't re-reduce a
5300 CONSTRUCTOR returned by lookup_placeholder.
5302 2020-03-20 Patrick Palka <ppalka@redhat.com>
5304 * cxx-pretty-print.c (pp_cxx_parameter_mapping): Make extern. Move
5305 the "[with ]" bits to here from ...
5306 (pp_cxx_atomic_constraint): ... here.
5307 * cxx-pretty-print.h (pp_cxx_parameter_mapping): Declare.
5308 * error.c (rebuild_concept_check): Delete.
5309 (print_concept_check_info): Print the dependent form of the constraint and the
5310 preferably substituted parameter mapping alongside it.
5312 2020-03-19 Jason Merrill <jason@redhat.com>
5315 * cp-gimplify.c (simple_empty_class_p): Look through
5316 SIMPLE_TARGET_EXPR_P.
5317 (cp_gimplify_expr) [MODIFY_EXPR]: Likewise.
5318 [RETURN_EXPR]: Avoid producing 'return *retval;'.
5319 * call.c (build_call_a): Strip TARGET_EXPR from empty class arg.
5320 * cp-tree.h (SIMPLE_TARGET_EXPR_P): Check that TARGET_EXPR_INITIAL
5323 2020-03-19 Jakub Jelinek <jakub@redhat.com>
5326 * parser.c (cp_parser_omp_var_list_no_open): Call process_outer_var_ref
5327 on outer_automatic_var_p decls.
5328 * cp-gimplify.c (cxx_omp_disregard_value_expr): Return true also for
5329 capture proxy decls.
5331 2020-03-18 Nathan Sidwell <nathan@acm.org>
5333 PR c++/94147 - mangling of lambdas assigned to globals
5334 * parser.c (cp_parser_init_declarator): Namespace-scope variables
5335 provide a lambda scope.
5336 * tree.c (no_linkage_check): Lambdas with a variable for extra
5337 scope have a linkage from the variable.
5339 2020-03-18 Jakub Jelinek <jakub@redhat.com>
5341 * constraint.cc (resolve_function_concept_check, subsumes_constraints,
5342 strictly_subsumes): Fix up duplicated word issue in a comment.
5343 * coroutines.cc (build_init_or_final_await, captures_temporary):
5345 * logic.cc (dnf_size_r, cnf_size_r): Likewise.
5346 * pt.c (append_type_to_template_for_access_check): Likewise.
5349 * decl.c (grokfndecl): Restore old diagnostics about deduction
5350 guide declared in different scope if in_namespace is NULL_TREE.
5352 2020-03-17 Jakub Jelinek <jakub@redhat.com>
5355 * parser.c (cp_parser_enum_specifier): Use temp_override for
5356 parser->colon_corrects_to_scope_p, replace goto out with return.
5357 If scoped enum or enum with underlying type is not followed by
5358 { or ;, call cp_parser_commit_to_tentative_parse before calling
5359 cp_parser_error and make sure to return error_mark_node instead of
5360 NULL_TREE. Formatting fixes.
5362 2020-03-17 Ville Voutilainen <ville.voutilainen@gmail.com>
5365 * method.c (assignable_expr): Use cp_unevaluated.
5366 (is_xible_helper): Push a non-deferred access check for
5367 the stub objects created by assignable_expr and constructible_expr.
5369 2020-03-17 Jakub Jelinek <jakub@redhat.com>
5371 * pt.c (tsubst): Fix up duplicated word issue in a diagnostic message.
5372 (lookup_template_class_1, tsubst_expr): Fix up duplicated word issue
5374 * parser.c (cp_parser_statement, cp_parser_linkage_specification,
5375 cp_parser_placeholder_type_specifier,
5376 cp_parser_constraint_requires_parens): Likewise.
5377 * name-lookup.c (suggest_alternative_in_explicit_scope): Likewise.
5379 2020-03-15 Iain Sandoe <iain@sandoe.co.uk>
5381 * coroutines.cc (co_await_expander): Fix indentation.
5383 2020-03-14 Jason Merrill <jason@redhat.com>
5386 * pt.c (process_partial_specialization): Error rather than crash on
5387 extra pack expansion.
5389 2020-03-14 Jason Merrill <jason@redhat.com>
5392 * pt.c (find_parameter_packs_r): [DECL_EXPR]: Walk
5393 DECL_ORIGINAL_TYPE of a typedef.
5395 2020-03-14 Jason Merrill <jason@redhat.com>
5398 * pt.c (build_deduction_guide): Clear cp_unevaluated_operand for
5399 substituting DECL_ARGUMENTS.
5401 2020-03-14 Jakub Jelinek <jakub@redhat.com>
5403 * logic.cc (formula::formula): Change "a an" to "an" in a comment.
5404 * parser.c (cp_debug_parser): Change "a an" to "an" in a string
5407 2020-03-13 Patrick Palka <ppalka@redhat.com>
5410 * call.c (build_over_call): Use a warning_sentinel to disable
5411 warn_deprecated_decl before calling build_addr_func.
5413 2020-03-12 Jakub Jelinek <jakub@redhat.com>
5416 * decl.c (reshape_init_array_1): Don't unshare constructor if there
5417 aren't any trailing zero elts, otherwise only unshare the first
5420 2020-03-11 Jason Merrill <jason@redhat.com>
5423 * constraint.cc (tsubst_parameter_mapping): Canonicalize type
5426 2020-03-11 Marek Polacek <polacek@redhat.com>
5427 Jason Merrill <jason@redhat.com>
5429 PR c++/94074 - wrong modifying const object error for COMPONENT_REF.
5430 * constexpr.c (cref_has_const_field): New function.
5431 (modifying_const_object_p): Consider a COMPONENT_REF
5432 const only if any of its fields are const.
5433 (cxx_eval_store_expression): Mark a CONSTRUCTOR of a const type
5434 as readonly after its initialization has been done.
5436 2020-03-10 Marek Polacek <polacek@redhat.com>
5438 PR c++/94124 - wrong conversion error with non-viable overload.
5439 * decl.c (reshape_init_array_1): Unshare a constructor if we
5440 stripped trailing zero-initializers.
5442 2020-03-10 Jason Merrill <jason@redhat.com>
5445 * pt.c (maybe_instantiate_noexcept): Always update clones.
5447 2020-03-10 Jason Merrill <jason@redhat.com>
5450 * pt.c (maybe_aggr_guide): Check BRACE_ENCLOSED_INITIALIZER_P.
5452 2020-03-10 Jason Merrill <jason@redhat.com>
5458 * cp-gimplify.c (cp_gimplify_init_expr): Partially revert patch for
5459 66139: Don't split_nonconstant_init. Remove pre_p parameter.
5461 2020-03-09 Marek Polacek <polacek@redhat.com>
5463 PR c++/92031 - bogus taking address of rvalue error.
5464 PR c++/91465 - ICE with template codes in check_narrowing.
5465 PR c++/93870 - wrong error when converting template non-type arg.
5466 PR c++/94068 - ICE with template codes in check_narrowing.
5467 * call.c (convert_like_real): Return IMPLICIT_CONV_EXPR
5468 in a template when not ck_identity and we're dealing with a class.
5469 (convert_like_real) <case ck_ref_bind>: Return IMPLICIT_CONV_EXPR
5470 in a template if we need a temporary.
5471 * decl.c (compute_array_index_type_loc): Remove
5472 instantiate_non_dependent_expr_sfinae call. Call
5473 fold_non_dependent_expr instead of maybe_constant_value.
5474 (build_explicit_specifier): Don't instantiate or create a sentinel
5475 before converting the expression.
5476 * except.c (build_noexcept_spec): Likewise.
5477 * pt.c (convert_nontype_argument): Don't build IMPLICIT_CONV_EXPR.
5478 Set IMPLICIT_CONV_EXPR_NONTYPE_ARG if that's what
5479 build_converted_constant_expr returned.
5480 * typeck2.c (check_narrowing): Call fold_non_dependent_expr instead
5481 of maybe_constant_value.
5483 2020-03-09 Jakub Jelinek <jakub@redhat.com>
5487 2019-10-11 Paolo Carlini <paolo.carlini@oracle.com>
5489 * constexpr.c (cxx_eval_constant_expression): Do not handle
5490 RROTATE_EXPR and LROTATE_EXPR.
5492 2020-03-09 Marek Polacek <polacek@redhat.com>
5494 PR c++/94050 - ABI issue with alignas on armv7hl.
5495 * class.c (layout_class_type): Don't replace a class's
5496 CLASSTYPE_AS_BASE if their TYPE_USER_ALIGN don't match.
5498 2020-03-09 Bin Cheng <bin.cheng@linux.alibaba.com>
5500 * coroutines.cc (build_actor_fn): Factor out code inserting the
5501 default return_void call to...
5502 (morph_fn_to_coro): ...here, also hoist local var declarations.
5504 2020-03-08 Patrick Palka <ppalka@redhat.com>
5507 * call.c (convert_like_real): Check complain before emitting an error
5508 about binding a bit-field to a reference.
5510 * cxx-pretty-print.c (cxx_pretty_printer::simple_type_specifier)
5511 [TYPENAME_TYPE]: Print the TYPENAME_TYPE_FULLNAME instead of the
5514 2020-03-06 Nathan Sidwell <nathan@acm.org>
5517 * mangle.c (find_substitution): Don't call same_type_p on template
5518 args that cannot match.
5520 2020-03-04 Martin Sebor <msebor@redhat.com>
5523 * tree.c (type_initializer_zero_p): Fail for structs initialized
5526 2020-03-04 Jason Merrill <jason@redhat.com>
5529 * init.c (perform_member_init): Don't do aggregate initialization of
5531 * constexpr.c (cx_check_missing_mem_inits): Don't enforce
5532 initialization of empty field.
5534 2020-03-04 Martin Liska <mliska@suse.cz>
5536 * method.c: Wrap array in ctor with braces in order
5537 to silent clang warnings.
5539 2020-03-03 Jason Merrill <jason@redhat.com>
5540 Marek Polacek <polacek@redhat.com>
5542 PR c++/90505 - mismatch in template argument deduction.
5543 * pt.c (tsubst): Don't reduce the template level of template
5544 parameters when tf_partial.
5546 2020-03-03 Jakub Jelinek <jakub@redhat.com>
5549 * constexpr.c (cxx_eval_constant_expression)
5550 <case TARGET_EXPR, case SAVE_EXPR>: Don't record anything if
5551 *non_constant_p is true.
5553 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
5555 * coroutines.cc (captures_temporary): Strip component_ref
5558 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
5560 * coroutines.cc (finish_co_await_expr): Build co_await_expr
5561 with unknown_type_node.
5562 (finish_co_yield_expr): Ditto.
5563 *pt.c (type_dependent_expression_p): Set co_await/yield_expr
5564 with unknown type as dependent.
5566 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
5568 * coroutines.cc (struct local_var_info): Adjust to remove the
5569 reference to the captured var, and just to note that this is a
5570 lambda capture proxy.
5571 (transform_local_var_uses): Handle lambda captures specially.
5572 (struct param_frame_data): Add a visited set.
5573 (register_param_uses): Also check for param uses in lambda
5575 (struct local_vars_frame_data): Remove captures list.
5576 (register_local_var_uses): Handle lambda capture proxies by
5577 noting and bypassing them.
5578 (morph_fn_to_coro): Update to remove lifetime extension of
5579 lambda capture-by-copy vars.
5581 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
5583 * coroutines.cc (build_co_await): Do not build frame
5584 awaitable proxy vars when the co_await expression is
5585 a function parameter or local var.
5586 (co_await_expander): Do not initialise a frame var with
5588 (transform_await_expr): Only substitute the awaitable
5589 frame var if it's needed.
5590 (register_awaits): Do not make frame copies for param
5591 or local vars that are awaitables.
5593 2020-02-28 Jason Merrill <jason@redhat.com>
5595 Implement P2092R0, Disambiguating Nested-Requirements
5596 * parser.c (cp_parser_requirement_parameter_list): Pass
5597 CP_PARSER_FLAGS_TYPENAME_OPTIONAL.
5599 * call.c (build_user_type_conversion_1): Don't look at the second
5600 conversion of a non-viable candidate.
5602 2020-02-28 Jakub Jelinek <jakub@redhat.com>
5604 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
5605 * typeck.c (cp_build_addr_expr_1): Allow taking address of immediate
5606 functions in unevaluated contexts.
5608 2020-02-27 Nathan Sidwell <nathan@acm.org>
5611 * pt.c (template_args_equal): Pass ARGUMENT_PACKS through to
5613 * tree.c (cp_tree_equal): Compare ARGUMENT_PACKS here,
5614 * typeck.c (comptypes): Assert we don't get any argument packs.
5616 * class.c (adjust_clone_args): Correct arg-checking assert.
5617 * typeck.c (comptypes): Assert not nulls.
5619 2020-02-26 Marek Polacek <polacek@redhat.com>
5621 PR c++/93789 - ICE with invalid array bounds.
5622 * decl.c (compute_array_index_type_loc): Don't use the folded
5623 size when folding cleared TREE_CONSTANT.
5625 2020-02-26 Iain Sandoe <iain@sandoe.co.uk>
5627 * class.c (classtype_has_non_deleted_copy_ctor): New.
5628 * coroutines.cc (struct param_info): Keep track of params
5629 that are references, and cache the original type and whether
5630 the DTOR is trivial.
5631 (build_actor_fn): Handle param copies always, and adjust the
5632 handling for references.
5633 (register_param_uses): Only handle uses here.
5634 (classtype_has_non_deleted_copy_ctor): New.
5635 (morph_fn_to_coro): Adjust param copy handling to match n4849
5636 by reordering ahead of the promise CTOR and always making a
5637 frame copy, even if the param is unused in the coroutine body.
5638 * cp-tree.h (classtype_has_non_deleted_copy_ctor): New.
5640 2020-02-26 Patrick Palka <ppalka@redhat.com>
5642 * constraint.cc (finish_constraint_binary_op): Set expr's location range
5643 to the range of its operands.
5644 (satisfy_atom): Pass MAP instead of ARGS to diagnose_atomic_constraint.
5645 (diagnose_trait_expr): Take the instantiated parameter mapping MAP
5646 instead of the corresponding template arguments ARGS and adjust body
5648 (diagnose_requires_expr): Likewise.
5649 (diagnose_atomic_constraint): Likewise. When printing an atomic
5650 constraint expression, print the instantiated parameter mapping
5652 * cxx-pretty-print.cc (cxx_pretty_printer::expression)
5653 [NONTYPE_ARGUMENT_PACK]: Print braces around a NONTYPE_ARGUMENT_PACK.
5654 (cxx_pretty_printer::type_id): Handle TYPE_ARGUMENT_PACK.
5656 2020-02-26 Marek Polacek <polacek@redhat.com>
5658 PR c++/93676 - value-init crash in template.
5659 * init.c (build_new_1): Don't call build_vec_init in a template.
5661 2020-02-26 Marek Polacek <polacek@redhat.com>
5663 PR c++/93862 - ICE with static_cast when converting from int[].
5664 * call.c (reference_compatible_p): No longer static.
5665 * cp-tree.h (reference_compatible_p): Declare.
5666 * typeck.c (build_static_cast_1): Use reference_compatible_p instead
5667 of reference_related_p.
5669 2020-02-26 Marek Polacek <polacek@redhat.com>
5671 PR c++/93803 - ICE with constexpr init and [[no_unique_address]].
5672 * constexpr.c (reduced_constant_expression_p): Don't crash on a null
5675 2020-02-24 Martin Sebor <msebor@redhat.com>
5678 * parser.c (cp_parser_check_class_key): Avoid issuing -Wredundant-tags
5679 in shared C/C++ code in headers.
5680 Remove a duplicate hunk of code.
5682 2020-02-24 Marek Polacek <polacek@redhat.com>
5684 PR c++/93869 - ICE with -Wmismatched-tags.
5685 * parser.c (cp_parser_check_class_key): Check class_key earlier.
5687 2020-02-24 Marek Polacek <polacek@redhat.com>
5689 PR c++/93712 - ICE with ill-formed array list-initialization.
5690 * call.c (next_conversion): Return NULL for ck_aggr.
5691 (build_aggr_conv): Set u.expr instead of u.next.
5692 (build_array_conv): Likewise.
5693 (build_complex_conv): Likewise.
5694 (conv_get_original_expr): Handle ck_aggr.
5696 2020-02-24 Jakub Jelinek <jakub@redhat.com>
5698 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
5699 * call.c (build_over_call): Don't evaluate immediate functions in
5700 unevaluated operands.
5702 2020-02-24 Jason Merrill <jason@redhat.com>
5704 P0780R2: Resolve lambda init-capture pack grammar.
5705 * parser.c (cp_parser_lambda_introducer): Expect &...x=y rather than
5708 2020-02-22 Marek Polacek <polacek@redhat.com>
5711 * decl.c (grokdeclarator): Use %qs in a diagnostic message.
5713 2020-02-21 Martin Sebor <msebor@redhat.com>
5715 PR gcov-profile/93753
5716 * class.c (check_flexarrays): Tighten up a test for potential members
5717 of anonymous structs or unions.
5719 2020-02-20 Martin Sebor <msebor@redhat.com>
5722 * parser.c (cp_parser_check_class_key): Only handle true C++ class-keys.
5724 2020-02-20 Martin Liska <mliska@suse.cz>
5726 PR translation/93841
5727 * config/or1k/or1k.opt: Remove superfluous word.
5728 * doc/invoke.texi: Likewise.
5730 2020-02-20 Martin Liska <mliska@suse.cz>
5732 PR translation/93838
5733 * parser.c (cp_parser_decl_specifier_seq): Remove trailing space.
5735 2020-02-19 Marek Polacek <polacek@redhat.com>
5737 PR c++/93169 - wrong-code with a non-constexpr constructor.
5738 * constexpr.c (cxx_eval_call_expression): Only set TREE_READONLY
5739 on constant CONSTRUCTORs.
5741 2020-02-15 Marek Polacek <polacek@redhat.com>
5743 PR c++/93710 - poor diagnostic for array initializer.
5744 * call.c (build_user_type_conversion_1): Use cp_expr_loc_or_input_loc
5747 2020-02-15 Jason Merrill <jason@redhat.com>
5750 * pt.c (any_template_parm_r): Look into lambda body.
5753 * pt.c (any_template_parm_r): Remove CONSTRUCTOR handling.
5755 2020-02-14 Jakub Jelinek <jakub@redhat.com>
5758 * class.c (enum_min_precision): Change prec type from int to int &.
5761 * cp-tree.h (enum cp_tree_index): Add CPTI_FALLBACK_DFLOAT32_TYPE,
5762 CPTI_FALLBACK_DFLOAT64_TYPE and CPTI_FALLBACK_DFLOAT128_TYPE.
5763 (fallback_dfloat32_type, fallback_dfloat64_type,
5764 fallback_dfloat128_type): Define.
5765 * mangle.c (write_builtin_type): Handle fallback_dfloat*_type like
5767 * rtti.c (emit_support_tinfos): Emit DFP typeinfos even when dfp
5768 is disabled for compatibility.
5770 2020-02-13 Jason Merrill <jason@redhat.com>
5773 * name-lookup.c (matching_fn_p): A function does not match a
5778 * tree.c (decl_linkage): Always lk_none for locals.
5780 2020-02-12 Jason Merrill <jason@redhat.com>
5784 * tree.c (cp_walk_subtrees): Walk CONSTRUCTOR types here.
5785 * pt.c (find_parameter_packs_r): Not here.
5787 2020-02-12 Iain Sandoe <iain@sandoe.co.uk>
5789 * coroutines.cc (build_actor_fn): Implement deallocation function
5790 selection per n4849, dcl.fct.def.coroutine bullet 12.
5791 (morph_fn_to_coro): Implement allocation function selection per
5792 n4849, dcl.fct.def.coroutine bullets 9 and 10.
5794 2020-02-12 Marek Polacek <polacek@redhat.com>
5796 PR c++/93684 - ICE-on-invalid with broken attribute.
5797 * parser.c (cp_parser_std_attribute): Peek a token first before
5800 2020-02-11 Jason Merrill <jason@redhat.com>
5803 * class.c (add_implicitly_declared_members): Use do_friend.
5804 * method.c (implicitly_declare_fn): Fix friend handling.
5805 (decl_remember_implicit_trigger_p): New.
5806 (synthesize_method): Use it.
5807 * decl2.c (mark_used): Use it.
5809 2020-02-11 Jason Merrill <jason@redhat.com>
5813 * constexpr.c (maybe_constant_value): Correct earlier change.
5814 (cxx_eval_binary_expression) [SPACESHIP_EXPR]: Pass lval through.
5815 * method.c (genericize_spaceship): Wrap result in TARGET_EXPR.
5817 2020-02-12 Patrick Palka <ppalka@redhat.com>
5821 * type-utils.h (find_type_usage): Refactor to take a tree * and to
5822 return a tree *, and update documentation accordingly.
5823 * pt.c (make_auto_1): Set AUTO_IS_DECLTYPE when building a
5824 decltype(auto) node.
5825 (make_constrained_decltype_auto): No need to explicitly set
5826 AUTO_IS_DECLTYPE anymore.
5827 (splice_late_return_type): Use find_type_usage to find and
5828 replace a possibly nested auto node instead of using is_auto.
5829 Check test for is_auto into an assert when deciding whether
5830 to late_return_type.
5831 (type_uses_auto): Adjust the call to find_type_usage.
5832 * parser.c (cp_parser_decltype): No need to explicitly set
5833 AUTO_IS_DECLTYPE anymore.
5835 * error.c (dump_decl) [CONCEPT_DECL]: Use dump_simple_decl.
5836 (dump_simple_decl): Handle standard concept definitions as well as
5837 variable concept definitions.
5839 2020-02-10 Jakub Jelinek <jakub@redhat.com>
5842 * error.c (dump_decl_name): Fix up last argument to strncmp.
5844 2020-02-10 Jason Merrill <jason@redhat.com>
5847 * tree.c (array_of_unknown_bound_p): New.
5848 * init.c (perform_member_init): Do nothing for flexible arrays.
5850 2020-02-09 Jakub Jelinek <jakub@redhat.com>
5853 * constexpr.c (cxx_eval_constant_expression): If obj is heap var with
5854 ARRAY_TYPE, use the element type. Punt if objtype after that is not
5857 2020-02-08 Jason Merrill <jason@redhat.com>
5860 * expr.c (fold_for_warn): Call maybe_constant_value.
5861 * constexpr.c (struct constexpr_ctx): Add uid_sensitive bit-field.
5862 (maybe_constant_value): Add uid_sensitive parm.
5863 (get_fundef_copy): Don't copy if it's true.
5864 (cxx_eval_call_expression): Don't instantiate if it's true.
5865 (cxx_eval_outermost_constant_expr): Likewise.
5868 * constexpr.c (maybe_constant_value): Don't unshare if the cached
5869 value is the same as the argument.
5871 * typeck.c (maybe_warn_about_returning_address_of_local): Add
5874 * typeck2.c (process_init_constructor): Also clear TREE_SIDE_EFFECTS
5877 2020-02-08 Jakub Jelinek <jakub@redhat.com>
5880 * constexpr.c (find_array_ctor_elt): If last element has no index,
5881 for flag_checking verify all elts have no index. If i is within the
5882 elts, return it directly, if it is right after the last elt, append
5883 if NULL index, otherwise force indexes on all elts.
5884 (cxx_eval_store_expression): Allow cep->index to be NULL.
5886 2020-02-07 Marek Polacek <polacek@redhat.com>
5888 PR c++/92947 - Paren init of aggregates in unevaluated context.
5889 * call.c (build_new_method_call_1): Don't check
5890 cp_unevaluated_operand. Check the return value of digest_init.
5892 2020-02-06 Jason Merrill <jason@redhat.com>
5895 * tree.c (cp_walk_subtrees): Walk into type template arguments.
5896 * cp-tree.h (TYPE_TEMPLATE_INFO_MAYBE_ALIAS): Use typedef_variant_p
5897 instead of TYPE_ALIAS_P.
5898 * pt.c (push_template_decl_real): Likewise.
5899 (find_parameter_packs_r): Likewise. Remove dead code.
5900 * error.c (find_typenames_r): Remove dead code.
5902 2020-02-06 Jason Merrill <jason@redhat.com>
5905 * parser.c (cp_parser_constraint_primary_expression): Do the main
5906 parse non-tentatively.
5908 2020-02-06 Marek Polacek <polacek@redhat.com>
5910 PR c++/93597 - ICE with lambda in operator function.
5911 * name-lookup.c (maybe_save_operator_binding): Check is_overloaded_fn.
5913 2020-02-05 Jason Merrill <jason@redhat.com>
5916 * pt.c (tsubst_decl) [PARM_DECL]: Check cp_unevaluated_operand in
5917 handling of TREE_CHAIN for empty pack.
5919 2020-02-05 Jakub Jelinek <jakub@redhat.com>
5922 * semantics.c (cp_build_vec_convert): Call decay_conversion on arg
5923 prior to passing it to c_build_vec_convert.
5925 2020-02-05 Marek Polacek <polacek@redhat.com>
5927 PR c++/93559 - ICE with CONSTRUCTOR flags verification.
5928 * decl.c (reshape_init_array_1): Don't reuse a CONSTRUCTOR with
5931 2020-02-05 Jason Merrill <jason@redhat.com>
5934 * decl.c (grokdeclarator): Reject field of current class type even
5937 2020-02-05 Bin Cheng <bin.cheng@linux.alibaba.com>
5939 * coroutines.cc (maybe_promote_captured_temps): Increase the index
5940 number for temporary variables' name.
5942 2020-02-05 Jun Ma <JunMa@linux.alibaba.com>
5944 * coroutines.cc (build_co_await): Call convert_from_reference
5945 to wrap co_await_expr with indirect_ref which avoid
5946 reference/non-reference type confusion.
5948 (co_await_expander): Sink to call_expr if await_resume
5949 is wrapped by indirect_ref.
5951 2020-02-04 Jason Merrill <jason@redhat.com>
5954 * constraint.cc (satisfy_declaration_constraints): Check return
5955 value of push_tinst_level.
5958 * constexpr.c (cxx_eval_array_reference): {}-initialize missing
5959 elements instead of value-initializing them.
5962 * init.c (perform_member_init): Simplify.
5963 * constexpr.c (cx_check_missing_mem_inits): Allow uninitialized
5965 (cxx_eval_vec_init_1): Handle CONSTRUCTOR.
5967 2020-02-04 Iain Sandoe <iain@sandoe.co.uk>
5969 * coroutines.cc (find_promise_type): Delete unused forward
5971 (struct coroutine_info): Add a bool for no promise type error.
5972 (coro_promise_type_found_p): Only emit the error for a missing
5973 promise once in each affected coroutine.
5975 2020-02-03 Jason Merrill <jason@redhat.com>
5978 * constexpr.c (cxx_eval_constant_expression) [PARM_DECL]: Don't
5979 defer loading the value of a reference.
5981 2020-02-03 Jason Merrill <jason@redhat.com>
5984 * constexpr.c (potential_constant_expression_1) [PARM_DECL]: Allow
5986 [COMPONENT_REF]: A member function reference doesn't use the object
5989 2020-02-03 Iain Sandoe <iain@sandoe.co.uk>
5992 * coroutines.cc (struct coroutine_info): Add a bool flag to note
5993 that we emitted an error for a bad function return type.
5994 (get_coroutine_info): Tolerate an unset info table in case of
5996 (find_coro_traits_template_decl): In case of error or if we didn't
5997 find a type template, note we emitted the error and suppress
5999 (find_coro_handle_template_decl): Likewise.
6000 (instantiate_coro_traits): Only check for error_mark_node in the
6001 return from lookup_qualified_name.
6002 (coro_promise_type_found_p): Reorder initialization so that we check
6003 for the traits and their usability before allocation of the info
6004 table. Check for a suitable return type and emit a diagnostic for
6005 here instead of relying on the lookup machinery. This allows the
6006 error to have a better location, and means we can suppress multiple
6008 (coro_function_valid_p): Re-check for a valid promise (and thus the
6009 traits) before proceeding. Tolerate missing info as a fatal error.
6011 2020-02-03 Jason Merrill <jason@redhat.com>
6014 * cp-gimplify.c (predeclare_vla): New.
6015 (cp_genericize_r) [NOP_EXPR]: Call it.
6017 2020-02-03 Jun Ma <JunMa@linux.alibaba.com>
6019 * coroutines.cc (transform_await_wrapper): Set actor funcion as
6020 new context of label_decl.
6021 (build_actor_fn): Fill new field of await_xform_data.
6023 2020-02-02 Marek Polacek <polacek@redhat.com>
6025 PR c++/93530 - ICE on invalid alignas in a template.
6026 * decl.c (grokdeclarator): Call cplus_decl_attributes instead of
6029 2020-01-31 Jason Merrill <jason@redhat.com>
6032 * semantics.c (process_outer_var_ref): Capture VLAs even in
6033 unevaluated context.
6036 * decl.c (reshape_init_array_1): Reuse a single CONSTRUCTOR with
6037 non-aggregate elements.
6038 (reshape_init_array): Add first_initializer_p parm.
6039 (reshape_init_r): Change first_initializer_p from bool to tree.
6040 (reshape_init): Pass init to it.
6043 * parser.c (cp_parser_initializer_list): Suppress location wrappers
6046 2020-01-29 Jason Merrill <jason@redhat.com>
6049 * pt.c (tsubst_copy_and_build) [EQ_EXPR]: Only suppress warnings if
6050 the expression was dependent before substitution.
6052 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
6054 * coroutines.cc (act_des_fn): New.
6055 (morph_fn_to_coro): Call act_des_fn to build actor/destroy decls.
6056 Access promise via actor function's frame pointer argument.
6057 (build_actor_fn, build_destroy_fn): Use frame pointer argument.
6059 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
6061 * coroutines.cc (co_await_expander): Handle type conversion case.
6063 2020-01-29 Jason Merrill <jason@redhat.com>
6068 * parser.c (cp_parser_type_specifier_seq): Don't parse attributes in
6069 a trailing return type.
6070 (cp_parser_lambda_declarator_opt): Parse C++11 attributes before
6073 2020-01-29 Marek Polacek <polacek@redhat.com>
6075 PR c++/91754 - Fix template arguments comparison with class NTTP.
6076 * pt.c (class_nttp_const_wrapper_p): New.
6077 (template_args_equal): See through class_nttp_const_wrapper_p
6080 2020-01-29 Marek Polacek <polacek@redhat.com>
6082 PR c++/92948 - Fix class NTTP with template arguments.
6083 * pt.c (convert_nontype_argument): Use IMPLICIT_CONV_EXPR when
6084 converting a value-dependent expression to a class type.
6085 (tsubst_copy) <case VIEW_CONVERT_EXPR>: Allow IMPLICIT_CONV_EXPR
6086 as the result of the tsubst_copy call.
6088 2020-01-29 Jakub Jelinek <jakub@redhat.com>
6091 * cp-gimplify.c (cxx_omp_predetermined_sharing): Return
6092 OMP_CLAUSE_DEFAULT_SHARED for typeinfo decls.
6094 2020-01-28 Jason Merrill <jason@redhat.com>
6097 * parser.c (cp_parser_lambda_expression): Clear in_discarded_stmt.
6101 * decl2.c (copy_linkage): Do copy DECL_ONE_ONLY and DECL_WEAK.
6104 * call.c (build_user_type_conversion_1): Allow a template conversion
6105 returning an rvalue reference to bind directly to an lvalue.
6108 * decl.c (grokdeclarator): Propagate eh spec from typedef.
6110 2020-01-28 Martin Liska <mliska@suse.cz>
6113 * pt.c (redeclare_class_template): Group couple of
6114 errors and inform messages with auto_diagnostic_group.
6116 2020-01-28 Martin Liska <mliska@suse.cz>
6119 * pt.c (redeclare_class_template): Use inform
6120 for the second location.
6122 2020-01-27 Jason Merrill <jason@redhat.com>
6125 * pt.c (tsubst_copy) [STRING_CST]: Don't use fold_convert.
6127 2020-01-27 Iain Sandoe <iain@sandoe.co.uk>
6130 * coroutines.cc (morph_fn_to_coro): Check the ramp return
6131 value when it is constructed from the 'get return object'.
6133 2020-01-27 Nathan Sidwell <nathan@acm.org>
6136 * name-lookup.c (is_ancestor): Allow CHILD to be a namespace alias.
6138 2020-01-26 Jason Merrill <jason@redhat.com>
6141 * except.c (maybe_noexcept_warning): Check DECL_IN_SYSTEM_HEADER and
6142 temporarily enable -Wsystem-headers. Change second warning to
6146 * semantics.c (finish_call_expr): Don't call
6147 instantiate_non_dependent_expr before warn_for_memset.
6149 2020-01-25 Marek Polacek <polacek@redhat.com>
6151 PR c++/93414 - poor diagnostic for dynamic_cast in constexpr context.
6152 * constexpr.c (cxx_eval_dynamic_cast_fn): Add a reference
6153 dynamic_cast diagnostic.
6155 2020-01-24 Jason Merrill <jason@redhat.com>
6157 PR c++/93400 - ICE with constrained friend.
6158 * constraint.cc (maybe_substitute_reqs_for): New.
6159 * decl.c (function_requirements_equivalent_p): Call it.
6160 * pt.c (tsubst_friend_function): Only substitute
6161 TEMPLATE_PARMS_CONSTRAINTS.
6162 (tsubst_template_parms): Copy constraints.
6164 2020-01-24 Jason Merrill <jason@redhat.com>
6166 PR c++/93279 - ICE with lambda in member operator.
6167 * name-lookup.c (maybe_save_operator_binding): Don't remember
6168 class-scope bindings.
6170 2020-01-24 Jason Merrill <jason@redhat.com>
6172 PR c++/93377 - ICE with member alias in constraint.
6173 * pt.c (any_template_parm_r): Look at template arguments for all
6174 aliases, not only alias templates.
6176 2020-01-24 Marek Polacek <polacek@redhat.com>
6178 PR c++/93299 - ICE in tsubst_copy with parenthesized expression.
6179 * pt.c (tsubst_copy): Handle a REF_PARENTHESIZED_P VIEW_CONVERT_EXPR.
6181 2020-01-24 Jason Merrill <jason@redhat.com>
6183 PR c++/92852 - ICE with generic lambda and reference var.
6184 * constexpr.c (maybe_constant_value): Likewise.
6186 2020-01-23 Paolo Carlini <paolo.carlini@oracle.com>
6189 * parser.c (cp_parser_nested_name_specifier_opt): Properly
6190 diagnose concept-ids.
6192 2020-01-23 Jason Merrill <jason@redhat.com>
6194 PR c++/93331 - ICE with __builtin_strchr.
6195 * constexpr.c (cxx_eval_builtin_function_call): Use the original
6196 argument if we didn't manage to extract a STRING_CST.
6198 PR c++/93345 - ICE with defaulted dtor and template.
6200 * decl.c (cxx_maybe_build_cleanup): Don't try to set
6201 throwing_cleanup in a template.
6203 2020-01-22 Marek Polacek <polacek@redhat.com>
6205 PR c++/92907 - noexcept does not consider "const" in member functions.
6206 * g++.dg/cpp0x/noexcept56.C: New test.
6208 2020-01-22 Marek Polacek <polacek@redhat.com>
6210 PR c++/93324 - ICE with -Wall on constexpr if.
6211 * semantics.c (is_std_constant_evaluated_p): Check fndecl.
6213 2020-01-22 Patrick Palka <ppalka@redhat.com>
6215 * constraint.cc (get_mapped_args): Avoid using auto_vec
6216 as a vector element. Release the vectors inside the lists
6218 * parser.c (cp_literal_operator_id): Free the buffer.
6220 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
6222 * coroutines.cc (finish_co_await_expr): Add error check on return
6223 value of build_co_await.
6224 (finish_co_yield_expr,): Ditto.
6226 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
6228 * coroutines.cc (lookup_awaitable_member): Lookup an awaitable member.
6229 (lookup_promise_method): Emit diagnostic when get NULL_TREE back only.
6230 (build_co_await): Use lookup_awaitable_member instead of lookup_member.
6232 2020-01-21 Jason Merrill <jason@redhat.com>
6234 PR c++/60855 - ICE with sizeof VLA capture.
6235 * lambda.c (is_lambda_ignored_entity): Don't look past VLA capture.
6237 PR c++/90732 - ICE with VLA capture and generic lambda.
6238 * pt.c (tsubst_lambda_expr): Repeat add_capture for VLAs.
6240 2020-01-21 Iain Sandoe <iain@sandoe.co.uk>
6241 Bin Cheng <bin.cheng@linux.alibaba.com>
6243 * coroutines.cc (coro_promise_type_found_p): Check for NULL return
6244 from complete_type_or_else.
6245 (register_param_uses): Likewise.
6246 (build_co_await): Do not try to use complete_type_or_else for void
6247 types, otherwise for incomplete types, check for NULL return from
6248 complete_type_or_else.
6250 2020-01-21 Jason Merrill <jason@redhat.com>
6252 PR c++/91476 - anon-namespace reference temp clash between TUs.
6253 * decl2.c (copy_linkage): Factor out of get_guard.
6254 * call.c (make_temporary_var_for_ref_to_temp): Use it.
6255 * decl.c (cp_finish_decomp): Use it.
6256 (cp_finish_decl): determine_visibility sooner.
6258 2020-01-21 Bin Cheng <bin.cheng@linux.alibaba.com>
6260 * coroutines.cc (finish_co_await_expr): Set return value flag.
6261 (finish_co_yield_expr, morph_fn_to_coro): Ditto.
6263 2020-01-19 Jason Merrill <jason@redhat.com>
6265 PR c++/33799 - destroy return value, take 2.
6266 * cp-tree.h (current_retval_sentinel): New macro.
6267 (struct language_function): Add throwing_cleanup bitfield.
6268 * decl.c (cxx_maybe_build_cleanup): Set it.
6269 * except.c (maybe_set_retval_sentinel)
6270 (maybe_splice_retval_cleanup): New functions.
6271 * parser.c (cp_parser_compound_statement): Call
6272 maybe_splice_retval_cleanup.
6273 * typeck.c (check_return_expr): Call maybe_set_retval_sentinel.
6275 * parser.c (cp_parser_lambda_body): Use cp_parser_function_body.
6277 2020-01-18 Jakub Jelinek <jakub@redhat.com>
6279 * coroutines.cc (get_fn_local_identifier): Fix NO_DOT_IN_LABEL
6280 but non-NO_DOLLAR_IN_LABEL case build.
6282 2020-01-18 Iain Sandoe <iain@sandoe.co.uk>
6284 * Make-lang.in: Add coroutines.o.
6285 * cp-tree.h (lang_decl-fn): coroutine_p, new bit.
6286 (DECL_COROUTINE_P): New.
6287 * lex.c (init_reswords): Enable keywords when the coroutine flag
6289 * operators.def (co_await): New operator.
6290 * call.c (add_builtin_candidates): Handle CO_AWAIT_EXPR.
6291 (op_error): Likewise.
6292 (build_new_op_1): Likewise.
6293 (build_new_function_call): Validate coroutine builtin arguments.
6294 * constexpr.c (potential_constant_expression_1): Handle
6295 CO_AWAIT_EXPR, CO_YIELD_EXPR, CO_RETURN_EXPR.
6296 * coroutines.cc: New file.
6297 * cp-objcp-common.c (cp_common_init_ts): Add CO_AWAIT_EXPR,
6298 CO_YIELD_EXPR, CO_RETRN_EXPR as TS expressions.
6299 * cp-tree.def (CO_AWAIT_EXPR, CO_YIELD_EXPR, (CO_RETURN_EXPR): New.
6300 * cp-tree.h (coro_validate_builtin_call): New.
6301 * decl.c (emit_coro_helper): New.
6302 (finish_function): Handle the case when a function is found to
6303 be a coroutine, perform the outlining and emit the outlined
6304 functions. Set a bit to signal that this is a coroutine component.
6305 * parser.c (enum required_token): New enumeration RT_CO_YIELD.
6306 (cp_parser_unary_expression): Handle co_await.
6307 (cp_parser_assignment_expression): Handle co_yield.
6308 (cp_parser_statement): Handle RID_CO_RETURN.
6309 (cp_parser_jump_statement): Handle co_return.
6310 (cp_parser_operator): Handle co_await operator.
6311 (cp_parser_yield_expression): New.
6312 (cp_parser_required_error): Handle RT_CO_YIELD.
6313 * pt.c (tsubst_copy): Handle CO_AWAIT_EXPR.
6314 (tsubst_expr): Handle CO_AWAIT_EXPR, CO_YIELD_EXPR and
6316 * tree.c (cp_walk_subtrees): Likewise.
6318 2020-01-17 Jason Merrill <jason@redhat.com>
6320 PR c++/92531 - ICE with noexcept(lambda).
6321 * pt.c (uses_template_parms): Don't try to enumerate all the
6324 2020-01-17 Jakub Jelinek <jakub@redhat.com>
6327 * parser.c (cp_parser_template_name): Look up deprecated attribute
6328 in DECL_TEMPLATE_RESULT or its type's attributes.
6330 2020-01-16 Jason Merrill <jason@redhat.com>
6332 PR c++/93286 - ICE with __is_constructible and variadic template.
6333 * pt.c (tsubst) [TREE_LIST]: Handle pack expansion.
6334 (tsubst_copy_and_build) [TRAIT_EXPR]: Always use tsubst for type2.
6336 PR c++/93280 - ICE with aggregate assignment and DMI.
6337 * init.c (get_nsdmi): Set TARGET_EXPR_DIRECT_INIT_P here.
6338 * typeck2.c (digest_nsdmi_init): Not here.
6340 2020-01-15 Paolo Carlini <paolo.carlini@oracle.com>
6343 * cp-tree.h (is_constrained_auto): New.
6344 * parser.c (cp_parser_maybe_commit_to_declaration): Correctly
6345 handle concept-check expressions; take a cp_decl_specifier_seq*
6347 (cp_parser_condition): Update call.
6348 (cp_parser_simple_declaration): Likewise.
6349 (cp_parser_placeholder_type_specifier): Correctly handle
6350 concept-check expressions.
6352 2020-01-15 Jason Merrill <jason@redhat.com>
6355 PR c++/33799 - destroy return value if local cleanup throws.
6356 * cp-tree.h (current_retval_sentinel): New macro.
6357 * decl.c (start_preparsed_function): Set up cleanup for retval.
6358 * typeck.c (check_return_expr): Set current_retval_sentinel.
6360 PR c++/93257 - consteval void function.
6361 * constexpr.c (verify_constant): Allow void_node.
6363 PR c++/92871 - bad code with xvalue and GNU ?: extension.
6364 * call.c (prevent_lifetime_extension): New.
6365 (build_conditional_expr_1): Use it.
6367 2020-01-14 Nathan Sidwell <nathan@acm.org>
6370 * pt.c (retrieve_specialization): Use get_template_info, not open
6374 * pt.c (retrieve_specialization): Get the TI from the decl or the
6375 classtype as appropriate.
6377 2020-01-14 David Malcolm <dmalcolm@redhat.com>
6379 * cp-gimplify.c (source_location_table_entry_hash::empty_zero_p):
6380 New static constant.
6381 * cp-tree.h (named_decl_hash::empty_zero_p): Likewise.
6382 (struct named_label_hash::empty_zero_p): Likewise.
6383 * decl2.c (mangled_decl_hash::empty_zero_p): Likewise.
6385 2020-01-14 Jason Merrill <jason@redhat.com>
6387 PR c++/92590 - wrong handling of inherited default ctor.
6388 * class.c (add_method): A constrained inherited ctor doesn't hide an
6389 implicit derived ctor.
6391 PR c++/92552 - ICE with inherited constrained default ctor.
6392 * pt.c (instantiate_class_template_1): Copy
6393 TYPE_HAS_USER_CONSTRUCTOR.
6394 PR c++/91930 - ICE with constrained inherited default ctor.
6395 * name-lookup.c (do_class_using_decl): Set TYPE_HAS_USER_CONSTRUCTOR
6396 for inherited constructor.
6397 PR c++/92594 - ICE with inherited trivial default ctor.
6398 * method.c (trivial_fn_p): Treat an inherited default constructor
6399 like a normal default constructor.
6401 PR c++/92594 - ICE with inherited trivial default ctor.
6402 * method.c (trivial_fn_p): Treat an inherited default constructor
6403 like a normal default constructor.
6405 PR c++/92009 - ICE with punning of typeid.
6406 * rtti.c (get_tinfo_desc): Call xref_basetypes.
6407 * constexpr.c (cxx_fold_indirect_ref): Don't strip
6410 2020-01-13 Jason Merrill <jason@redhat.com>
6412 PR c++/92746 - ICE with noexcept of function concept check.
6413 * except.c (check_noexcept_r): Handle concept-check.
6415 PR c++/92582 - ICE with member template as requirement.
6416 * pt.c (struct find_template_parameter_info): Add ctx_parms.
6417 (any_template_parm_r): Handle TEMPLATE_DECL.
6418 (find_template_parameters): Take parms instead of their depth.
6419 * constraint.cc (build_parameter_mapping): Pass them.
6421 PR c++/33799 - destroy return value if local cleanup throws.
6422 * cp-tree.h (current_retval_sentinel): New macro.
6423 * decl.c (start_preparsed_function): Set up cleanup for retval.
6424 * typeck.c (check_return_expr): Set current_retval_sentinel.
6426 PR c++/93238 - short right-shift with enum.
6427 * typeck.c (cp_build_binary_op): Use folded op1 for short_shift.
6429 2020-01-10 Jason Merrill <jason@redhat.com>
6431 * typeck.c (cp_build_binary_op): Restore short_shift code.
6433 PR c++/93143 - incorrect tree sharing with constexpr.
6434 * constexpr.c (cxx_eval_outermost_constant_expr): Don't assume
6435 CONSTRUCTORs are already unshared.
6437 PR c++/93173 - incorrect tree sharing.
6439 * cp-gimplify.c (cp_gimplify_init_expr, cp_gimplify_expr): Use
6440 copy_if_shared after cp_genericize_tree.
6441 * typeck2.c (split_nonconstant_init): Don't unshare here.
6443 2020-01-08 Jason Merrill <jason@redhat.com>
6445 * cp-gimplify.c (cp_gimplify_expr) [TARGET_EXPR]: Check
6446 TARGET_EXPR_DIRECT_INIT_P.
6447 * constexpr.c (cxx_eval_constant_expression): Likewise.
6449 2020-01-08 Jason Merrill <jason@redhat.com>
6451 PR c++/91369 - constexpr destructor and member initializer.
6452 * constexpr.c (cxx_eval_store_expression): Look through TARGET_EXPR
6453 when not preevaluating.
6455 2020-01-08 Jason Merrill <jason@redhat.com>
6457 * constexpr.c (cxx_eval_call_expression): Remove DECL_BY_REFERENCE
6460 2020-01-07 Paolo Carlini <paolo.carlini@oracle.com>
6462 * init.c (build_new): Add location_t parameter and use it throughout.
6463 (build_raw_new_expr): Likewise.
6464 * parser.c (cp_parser_new_expression): Pass the combined_loc.
6465 * pt.c (tsubst_copy_and_build): Adjust call.
6466 * cp-tree.h: Update declarations.
6468 2020-01-07 Jason Merrill <jason@redhat.com>
6470 PR c++/47877 - -fvisibility-inlines-hidden and member templates.
6471 * decl2.c (determine_visibility): -fvisibility-inlines-hidden beats
6472 explicit class visibility for a template.
6474 2020-01-07 Richard Sandiford <richard.sandiford@arm.com>
6476 * mangle.c (mangle_type_attribute_p): New function, split out from...
6477 (write_CV_qualifiers_for_type): ...here. Don't mangle attributes
6478 that contain a space.
6480 2020-01-07 Jakub Jelinek <jakub@redhat.com>
6483 * constexpr.c (struct constexpr_global_ctx): Add heap_alloc_count
6484 member, initialize it to zero in ctor.
6485 (cxx_eval_call_expression): Bump heap_dealloc_count when deleting
6486 a heap object. Don't cache calls to functions which allocate some
6487 heap objects and don't deallocate them or deallocate some heap
6488 objects they didn't allocate.
6490 2020-01-06 Jason Merrill <jason@redhat.com>
6492 PR c++/92552 - ICE with inherited constrained default ctor.
6493 * pt.c (instantiate_class_template_1): Copy
6494 TYPE_HAS_USER_CONSTRUCTOR.
6495 * class.c (one_inherited_ctor): Don't set it here.
6497 2020-01-06 Andrew Sutton <asutton@lock3software.com>
6499 PR c++/92739 - parsing requires clause with attributes.
6500 * parser.c (cp_parser_constraint_requires_parens): Exclude
6501 attributes as postfix expressions.
6503 2020-01-05 Jakub Jelinek <jakub@redhat.com>
6506 * parser.c (cp_parser_check_class_key): Disable access checks for the
6508 (cp_parser_maybe_warn_enum_key): Likewise. Return early if
6509 !warn_redundant_tags.
6511 2010-01-05 Jakub Jelinek <jakub@redhat.com>
6514 * cp-gimplify.c (cp_gimplify_init_expr): Don't look through
6515 TARGET_EXPR if it has been gimplified already.
6517 2020-01-03 Jason Merrill <jason@redhat.com>
6519 PR c++/93033 - incorrect tree node sharing with array init.
6520 * typeck2.c (split_nonconstant_init): Unshare non-decl.
6521 * cp-gimplify.c (cp_gimplify_init_expr): Only split if -fexceptions.
6523 2020-01-02 Jason Merrill <jason@redhat.com>
6525 * pt.c (invalid_nontype_parm_type_p): Reject class placeholder in
6528 2020-01-02 Jakub Jelinek <jakub@redhat.com>
6531 * cp-objcp-common.c (identifier_global_tag): Return NULL_TREE if name
6532 has not been found, rather than error_mark_node.
6534 2020-01-01 Jakub Jelinek <jakub@redhat.com>
6536 Update copyright years.
6538 Copyright (C) 2020 Free Software Foundation, Inc.
6540 Copying and distribution of this file, with or without modification,
6541 are permitted in any medium without royalty provided the copyright
6542 notice and this notice are preserved.