1 2020-09-23 Nathan Sidwell <nathan@acm.org>
3 * name-lookup.h (typedef cxx_binding): Delete tdef.
4 (typedef cp_binding_level): Likewise.
5 (struct cxx_binding): Flags are bools.
7 2020-09-23 Nathan Sidwell <nathan@acm.org>
10 * pt.c (tsubst_copy) [FUNCTION_DECL,VAR_DECL]: Retrieve local
11 specialization for DECL_LOCAL_P decls.
13 2020-09-22 Patrick Palka <ppalka@redhat.com>
16 * pt.c (corresponding_template_parameter): Define.
17 (keep_template_parm): Use it to adjust the given template
18 parameter to the corresponding in-scope one from ctx_parms.
20 2020-09-22 Nathan Sidwell <nathan@acm.org>
22 * cp-tree.h (xref_tag_from_type): Don't declare.
23 * decl.c (xref_tag_from_type): Delete.
24 * pt.c (lookup_template_class_1): Erroneously located class
25 definitions just give error_mark, don't try and inject it into the
28 2020-09-22 Jakub Jelinek <jakub@redhat.com>
31 * constexpr.c (cxx_eval_builtin_function_call): Return void_node for
32 calls to __sanitize_ptr_{sub,cmp} builtins.
34 2020-09-22 Nathan Sidwell <nathan@acm.org>
36 * pt.c (instantiate_class_template_1): Do not repush and unhide
39 2020-09-21 Marek Polacek <polacek@redhat.com>
43 * lambda.c (maybe_add_lambda_conv_op): Mark the conversion function
46 2020-09-21 Marek Polacek <polacek@redhat.com>
48 * pt.c (deduction_guides_for): Add a bool parameter. Set it.
49 (do_class_deduction): Warn when CTAD succeeds but the type doesn't
50 have any explicit deduction guides.
52 2020-09-21 Nathan Sidwell <nathan@acm.org>
54 * decl.c (xref_tag_1): Use IDENTIFIER_LAMBDA_P to detect lambdas.
55 * lambda.c (begin_lambda_type): Use ts_current to push the tag.
56 * name-lookup.h (enum tag_scope): Drop ts_lambda.
58 2020-09-21 Marek Polacek <polacek@redhat.com>
61 * decl.c (redeclaration_error_message): Detect a redeclaration of
64 2020-09-19 Sandra Loosemore <sandra@codesourcery.com>
66 * cp-gimplify.c (enum bc_t, bc_label): Move to c-family.
67 (begin_bc_block, finish_bc_block, get_bc_label): Likewise.
68 (genericize_cp_loop): Likewise.
69 (genericize_for_stmt, genericize_while_stmt): Likewise.
70 (genericize_do_stmt, genericize_switch_stmt): Likewise.
71 (genericize_continue_stmt, genericize_break_stmt): Likewise.
72 (genericize_omp_for_stmt): Likewise.
73 (cp_genericize_r): Call c_genericize_control_stmt instead of
74 above functions directly.
75 (cp_genericize): Call save_bc_state and restore_bc_state instead
76 of manipulating bc_label directly.
77 * cp-objcp-common.c (cxx_block_may_fallthru): Defer to
78 c_block_may_fallthru instead of handling SWITCH_STMT here.
79 (cp_common_init_ts): Move handling of loop and switch-related
80 statements to c-family.
81 * cp-tree.def (FOR_STMT, WHILE_STMT, DO_STMT): Move to c-family.
82 (BREAK_STMT, CONTINUE_STMT, SWITCH_STMT): Likewise.
83 * cp-tree.h (LABEL_DECL_BREAK, LABEL_DECL_CONTINUE): Likewise.
84 (WHILE_COND, WHILE_BODY): Likewise.
85 (DO_COND, DO_BODY): Likewise.
86 (FOR_INIT_STMT, FOR_COND, FOR_EXPR, FOR_BODY, FOR_SCOPE): Likewise.
87 (SWITCH_STMT_COND, SWITCH_STMT_BODY): Likewise.
88 (SWITCH_STMT_TYPE, SWITCH_STMT_SCOPE): Likewise.
89 (SWITCH_STMT_ALL_CASES_P, SWITCH_STMT_NO_BREAK_P): Likewise.
90 * cxx-pretty-print.c (cxx_pretty_printer::statement): Move code
91 to handle structured loop and switch tree nodes to c-family.
92 * dump.c (cp_dump_tree): Likewise.
94 2020-09-19 Patrick Palka <ppalka@redhat.com>
98 * constraint.cc (map_arguments): Call template_parm_to_arg
99 in the self-mapping case.
100 (finish_shorthand_constraint): No need to build a TREE_LIST
101 before calling template_parm_to_arg.
102 * pt.c (template_parm_to_arg): Rewrite to handle TEMPLATE_PARM_P
103 nodes as well as DECL_TEMPLATE_PARM_P nodes, and to make the
104 overlying TREE_LIST node optional.
105 (keep_template_parm): Don't record a BOUND_TEMPLATE_TEMPLATE_PARM,
106 instead record its corresponding TEMPLATE_TEMPLATE_PARM.
107 (convert_generic_types_to_packs): Don't call
108 template_parm_to_arg.
110 2020-09-19 Patrick Palka <ppalka@redhat.com>
113 * constraint.cc (satisfy_atom): Pass true as the
114 manifestly_const_eval argument to maybe_constant_value.
116 2020-09-18 Jason Merrill <jason@redhat.com>
119 * decl.c (complete_vars): Only call layout_var_decl if completing
122 2020-09-18 Jason Merrill <jason@redhat.com>
124 * decl.c (complete_vars): Call layout_var_decl.
126 2020-09-17 Patrick Palka <ppalka@redhat.com>
130 * constraint.cc (tsubst_requires_expr): Use REQUIRES_EXPR_PARMS
131 and REQUIRES_EXPR_REQS. Use REQUIRES_EXPR_EXTRA_ARGS,
132 add_extra_args and build_extra_args to defer substitution until
133 we have all the template arguments.
134 (finish_requires_expr): Adjust the call to build_min so that
135 REQUIRES_EXPR_EXTRA_ARGS gets set to NULL_TREE.
136 * cp-tree.def (REQUIRES_EXPR): Give it a third operand.
137 * cp-tree.h (REQUIRES_EXPR_PARMS, REQUIRES_EXPR_REQS,
138 REQUIRES_EXPR_EXTRA_ARGS): Define.
139 (add_extra_args, build_extra_args): Declare.
141 2020-09-16 Nathan Sidwell <nathan@acm.org>
143 * cp-tree.h (cp_check_omp_declare_reduction): Return bool.
144 * semantics.c (cp_check_omp_declare_reduction): Return true on for
146 * pt.c (push_template_decl_real): OMP reductions do not get a
148 (tsubst_function_decl): Remove special casing for local decl omp
150 (tsubst_expr): Call instantiate_body for a local omp reduction.
151 (instantiate_body): Add nested_p parm, and deal with such
153 (instantiate_decl): Reject FUNCTION_SCOPE entities, adjust
154 instantiate_body call.
156 2020-09-16 Nathan Sidwell <nathan@acm.org>
158 * pt.c (instantiate_body): Remove 'nested' var, simplify
161 2020-09-16 Nathan Sidwell <nathan@acm.org>
163 * pt.c (instantiate_body): New, broken out of ..
164 (instantiate_decl): ... here. Call it.
166 2020-09-15 Nathan Sidwell <nathan@acm.org>
168 * pt.c (push_template_decl_real): OMP reductions retain a template
170 (tsubst_function_decl): Likewise.
172 2020-09-15 Tobias Burnus <tobias@codesourcery.com>
175 * cp-gimplify.c (cxx_omp_finish_clause): Add bool openacc arg.
176 * cp-tree.h (cxx_omp_finish_clause): Likewise
177 * semantics.c (handle_omp_for_class_iterator): Update call.
179 2020-09-14 Marek Polacek <polacek@redhat.com>
181 * pt.c (push_template_decl_real): Use VAR_OR_FUNCTION_DECL_P.
183 2020-09-14 Nathan Sidwell <nathan@acm.org>
185 * pt.c (push_template_decl_real): Don't attach a template head to
187 (tsubst_function_decl): Add support for headless local extern
189 (tsubst_decl): Add support for headless local extern decls.
191 2020-09-11 Nathan Sidwell <nathan@acm.org>
193 * decl.c (grokfndecl): Don't attach to local extern.
195 2020-09-11 Nathan Sidwell <nathan@acm.org>
197 * parser.c (cp_parser_objc_method_definition_list): Reimplement
198 loop, make sure we pop scope.
200 2020-09-11 Marek Polacek <polacek@redhat.com>
202 * cp-tree.h (LOOKUP_CONSTINIT): Remove.
203 (LOOKUP_REWRITTEN): Adjust.
204 * decl.c (duplicate_decls): Set DECL_DECLARED_CONSTINIT_P.
205 (check_initializer): Use DECL_DECLARED_CONSTINIT_P instead of
207 (cp_finish_decl): Don't set DECL_DECLARED_CONSTINIT_P. Use
208 DECL_DECLARED_CONSTINIT_P instead of LOOKUP_CONSTINIT.
209 (grokdeclarator): Set DECL_DECLARED_CONSTINIT_P.
210 * decl2.c (grokfield): Don't handle LOOKUP_CONSTINIT.
211 * parser.c (cp_parser_decomposition_declaration): Remove
212 LOOKUP_CONSTINIT handling.
213 (cp_parser_init_declarator): Likewise.
214 * pt.c (tsubst_expr): Likewise.
215 (instantiate_decl): Likewise.
216 * typeck2.c (store_init_value): Use DECL_DECLARED_CONSTINIT_P instead
219 2020-09-10 Nathan Sidwell <nathan@acm.org>
221 * cp-tree.h (TINFO_VAR_DECLARED_CONSTINIT): Replace with ...
222 (DECL_DECLARED_CONSTINIT_P): ... this.
223 * decl.c (start_decl): No need to retrofit_lang_decl for constinit
225 (cp_finish_decl): Use DECL_DECLARED_CONSTINIT_P.
226 * pt.c (tsubst_decl): No need to handle constinit flag
228 (tsubst_expr): Or here.
230 2020-09-10 Nathan Sidwell <nathan@acm.org>
232 * cp-tree.h (DECL_LOCAL_FUNCTION_P): Rename to ...
233 (DECL_LOCAL_DECL_P): ... here. Accept both fns and vars.
234 * decl.c (start_decl): Set DECL_LOCAL_DECL_P for local externs.
235 (omp_declare_variant_finalize_one): Use DECL_LOCAL_DECL_P.
236 (local_variable_p): Simplify.
237 * name-lookup.c (set_decl_context_in_fn): Assert DECL_LOCAL_DECL_P
238 is as expected. Simplify.
239 (do_pushdecl): Don't set decl_context_in_fn for friends.
240 (is_local_extern): Simplify.
241 * call.c (equal_functions): Use DECL_LOCAL_DECL_P.
242 * parser.c (cp_parser_postfix_expression): Likewise.
243 (cp_parser_omp_declare_reduction): Likewise.
244 * pt.c (check_default_tmpl_args): Likewise.
245 (tsubst_expr): Assert nested reduction function is local.
246 (type_dependent_expression_p): Use DECL_LOCAL_DECL_P.
247 * semantics.c (finish_call_expr): Likewise.
249 2020-09-09 Marek Polacek <polacek@redhat.com>
252 * decl.c (reshape_init): If we're initializing a char array from
253 a string-literal that is enclosed in braces, unwrap it.
254 * init.c (build_new_1): Don't handle string-initializers here.
255 (build_new): Handle new-expression with paren-init when the
256 array bound is known. Always pass string constants to build_new_1
257 enclosed in braces. Don't handle string-initializers in any
260 2020-09-09 Marek Polacek <polacek@redhat.com>
263 * decl.c (reshape_init_r): When initializing an aggregate member
264 with an initializer from an initializer-list, also consider
267 2020-09-09 Nathan Sidwell <nathan@acm.org>
269 * parser.c (cp_parser_omp_declare_reduction): Refactor to avoid
270 code duplication. Update DECL_TI_TEMPLATE's context.
271 * pt.c (tsubst_expr): For OMP reduction function, set context to
272 global_namespace before pushing.
273 (tsubst_omp_udr): Assert current_function_decl, add comment about
276 2020-09-09 Patrick Palka <ppalka@redhat.com>
279 * class.c (resolve_address_of_overloaded_function): Check
280 constraints_satisfied_p and perform return-type deduction via
281 maybe_instantiate_decl when considering non-template functions
283 * cp-tree.h (maybe_instantiate_decl): Declare.
284 * decl2.c (maybe_instantiate_decl): Remove static.
286 2020-09-04 Jason Merrill <jason@redhat.com>
288 * expr.c (mark_use): Use iloc_sentinel.
290 2020-09-03 Jakub Jelinek <jakub@redhat.com>
293 * constexpr.c (fundef_copies_table): Change type from
294 hash_map<tree, tree> * to decl_tree_map *.
296 2020-09-03 Marek Polacek <polacek@redhat.com>
299 * cp-tree.h (do_aggregate_paren_init): Declare.
300 * decl.c (do_aggregate_paren_init): New.
301 (grok_reference_init): Use it.
302 (check_initializer): Likewise.
303 * init.c (perform_member_init): Handle initializing an array from
304 a ()-list. Use do_aggregate_paren_init.
306 2020-09-03 Jakub Jelinek <jakub@redhat.com>
309 * constexpr.c (cxx_eval_outermost_constant_expr): Temporarily disable
310 flag_rounding_math during manifestly constant evaluation.
312 2020-09-01 Marek Polacek <polacek@redhat.com>
315 * init.c (build_new_1): Call reshape_init.
317 2020-09-01 Jakub Jelinek <jakub@redhat.com>
320 * semantics.c (handle_omp_array_sections_1): Test
321 DECL_ARRAY_PARAMETER_P only on PARM_DECLs.
323 2020-08-31 Marek Polacek <polacek@redhat.com>
324 Jason Merrill <jason@redhat.com>
327 * call.c (build_new_method_call_1): Use build_constructor_from_vec
328 instead of build_tree_list_vec + build_constructor_from_list.
329 * init.c (build_new_1): Handle new char[]{"foo"}. Use
330 build_constructor_from_vec instead of build_tree_list_vec +
331 build_constructor_from_list.
332 (build_new): Deduce the array size in new-expression if not
333 present. Handle ()-init. Handle initializing an array from
335 * parser.c (cp_parser_new_type_id): Leave [] alone.
336 (cp_parser_direct_new_declarator): Allow [].
337 * pt.c (type_dependent_expression_p): In a NEW_EXPR, consider
338 array types whose dimension has to be deduced type-dependent.
340 2020-08-27 Martin Liska <mliska@suse.cz>
342 * class.c (build_vtbl_initializer): Set exact argument of a vector
343 growth function to true.
344 * constraint.cc (get_mapped_args): Likewise.
345 * decl.c (cp_maybe_mangle_decomp): Likewise.
346 (cp_finish_decomp): Likewise.
347 * parser.c (cp_parser_omp_for_loop): Likewise.
348 * pt.c (canonical_type_parameter): Likewise.
349 * rtti.c (get_pseudo_ti_init): Likewise.
351 2020-08-26 Nathan Sidwell <nathan@acm.org>
353 * decl.c (poplevel): A local-binding tree list holds the name in
355 * name-lookup.c (update_local_overload): Add id to TREE_PURPOSE.
356 (lookup_name_1): Deal with local-binding error_mark_node marker.
357 (op_unqualified_lookup): Return error_mark_node for 'nothing
358 found'. Retain global binding, check class binding here.
359 (maybe_save_operator_binding): Reimplement to always cache a
361 (push_operator_bindings): Deal with 'ignore' marker.
363 2020-08-25 Tobias Burnus <tobias@codesourcery.com>
366 * semantics.c (handle_omp_array_sections_1): Talk about
367 array function parameter in the error message.
369 2020-08-25 Jakub Jelinek <jakub@redhat.com>
372 * cp-tree.h (build_trivial_dtor_call): Add bool argument defaulted
374 * call.c (build_trivial_dtor_call): Add NO_PTR_DEREF argument. If
375 instance is a pointer and NO_PTR_DEREF is true, clobber the pointer
376 rather than what it points to.
377 * semantics.c (finish_call_expr): Call build_trivial_dtor_call with
378 true as NO_PTR_DEREF.
380 2020-08-25 Jason Merrill <jason@redhat.com>
383 * optimize.c (populate_clone_array): Revert PR70462 change.
384 (maybe_clone_body): Likewise.
386 2020-08-24 Nathan Sidwell <nathan@acm.org>
388 * ptree.c (debug_overload): New.
390 2020-08-19 Jason Merrill <jason@redhat.com>
393 * cp-tree.h (push_tinst_level, push_tinst_level_loc): Declare.
394 * constraint.cc (satisfy_declaration_constraints):
395 Use add_outermost_template_args and push_tinst_level.
396 * pt.c (add_outermost_template_args): Handle getting
397 a TEMPLATE_DECL as the first argument.
398 (push_tinst_level, push_tinst_level_loc): No longer static.
399 (fn_type_unification): Check satisfaction before non-dependent
402 2020-08-18 Nathan Sidwell <nathan@acm.org>
404 * cp-tree.h (SET_TYPE_TEMPLTE_INFO): Do not deal with ALIAS templates.
405 * pt.c (lookup_template_class_1): Special-case alias template
406 template_info setting.
408 2020-08-18 Jason Merrill <jason@redhat.com>
411 * pt.c (tsubst_aggr_type): Rewrite in C++17, too.
412 (maybe_dependent_member_ref): Likewise.
413 (build_deduction_guide): Re-substitute template parms.
414 * cp-tree.h (struct push_nested_class_guard): New.
415 * constraint.cc (get_normalized_constraints_from_decl): Use it.
417 2020-08-18 Jason Merrill <jason@redhat.com>
420 * pt.c (maybe_dependent_member_ref): New.
421 (tsubst_copy) [CONST_DECL]: Use it.
422 [VAR_DECL]: Likewise.
423 (tsubst_aggr_type): Handle nested type.
425 2020-08-18 Nathan Sidwell <nathan@acm.org>
427 * name-lookup.c (qualify_lookup): Drop lambda checking here.
428 Reorder namespace & type checking.
429 (lookup_name_1): Do hidden lambda checking here.
431 2020-08-14 Nathan Sidwell <nathan@acm.org>
433 * name-lookup.h (lookup_name_real, lookup_name_nonclass): Rename
435 (lookup_name): ... these new overloads.
436 * name-lookup.c (identifier_type_value_1): Rename lookup_name_real
438 (lookup_name_real_1): Rename to ...
439 (lookup_name_1): ... here.
440 (lookup_name_real): Rename to ...
441 (lookup_name): ... here. Rename lookup_name_real_1 call.
442 (lookup_name_nonclass): Delete.
443 * call.c (build_operator_new_call): Rename lookup_name_real call.
444 (add_operator_candidates): Likewise.
445 (build_op_delete_call): Rename lookup_name_nonclass call.
446 * parser.c (cp_parser_lookup_name): Likewise.
447 * pt.c (tsubst_friend_class, lookup_init_capture_pack): Likewise.
448 (tsubst_expr): Likewise.
449 * semantics.c (capture_decltype): Likewise.
451 2020-08-14 Nathan Sidwell <nathan@acm.org>
453 * cp-tree.h (LOOKUP_HIDDEN): Delete.
454 (LOOKUP_PREFER_RVALUE): Adjust initializer.
455 * name-lookup.h (enum class LOOK_want): Add HIDDEN_FRIEND and
457 (lookup_name_real): Drop flags parm.
458 (lookup_qualified_name): Drop find_hidden parm.
459 * name-lookup.c (class name_lookup): Drop hidden field, adjust
461 (name_lookup::add_overload): Check want for hiddenness.
462 (name_lookup::process_binding): Likewise.
463 (name_lookup::search_unqualified): Likewise.
464 (identifier_type_value_1): Adjust lookup_name_real call.
465 (set_decl_namespace): Adjust name_lookup ctor.
466 (qualify_lookup): Drop flags parm, use want for hiddenness.
467 (lookup_qualified_name): Drop find_hidden parm.
468 (lookup_name_real_1): Drop flags parm, adjust qualify_lookup
470 (lookup_name_real): Drop flags parm.
471 (lookup_name_nonclass, lookup_name): Adjust lookup_name_real
473 (lookup_type_scope_1): Adjust qualify_lookup calls.
474 * call.c (build_operator_new_call): Adjust lookup_name_real call.
475 (add_operator_candidates): Likewise.
476 * coroutines.cc (morph_fn_to_coro): Adjust lookup_qualified_name
478 * parser.c (cp_parser_lookup_name): Adjust lookup_name_real calls.
479 * pt.c (check_explicit_specialization): Adjust
480 lookup_qualified_name call.
481 (deduction_guides_for): Likewise.
482 (tsubst_friend_class): Adjust lookup_name_real call.
483 (lookup_init_capture_pack): Likewise.
484 (tsubst_expr): Likewise, don't look in namespaces.
485 * semantics.c (capture_decltype): Adjust lookup_name_real. Don't
488 2020-08-14 Jason Merrill <jason@redhat.com>
492 * cp-tree.h (unsafe_return_slot_p): Declare.
493 * call.c (is_base_field_ref): Rename to unsafe_return_slot_p.
494 (build_over_call): Check unsafe_return_slot_p.
495 (build_special_member_call): Likewise.
496 * init.c (expand_default_init): Likewise.
497 * typeck2.c (split_nonconstant_init_1): Likewise.
499 2020-08-14 Nathan Sidwell <nathan@acm.org>
501 * cp-tree.h (LOOKUP_PREFER_TYPES, LOOKUP_PREFER_NAMESPACES)
502 (LOOKUP_NAMESPACES_ONLY, LOOKUP_TYPES_ONLY)
503 (LOOKUP_QUALIFIERS_ONL): Delete.
504 (LOOKUP_HIDDEN): Adjust.
505 * name-lookup.h (enum class LOOK_want): New.
506 (operator|, operator&): Overloads for it.
507 (lookup_name_real): Replace prefer_type & namespaces_only with
509 (lookup_qualified_name): Replace prefer_type with LOOK_want.
510 (lookup_name_prefer_type): Replace with ...
511 (lookup_name): ... this. New overload with LOOK_want parm.
512 * name-lookup.c (struct name_lookup): Replace flags with want and
513 hidden fields. Adjust constructors.
514 (name_lookyp::add_overload): Correct hidden stripping test. Update
515 for new LOOK_want type.
516 (name_lookup::process_binding): Likewise.
517 (name_lookup::search_unqualified): Use hidden flag.
518 (identifier_type_value_1): Adjust lookup_name_real call.
519 (set_decl_namespace): Adjust name_lookup ctor.
520 (lookup_flags): Delete.
521 (qualify_lookup): Add LOOK_want parm, adjust.
522 (lookup_qualified_name): Replace prefer_type parm with LOOK_want.
523 (lookup_name_real_1): Replace prefer_type and namespaces_only with
525 (lookup_name_real): Likewise.
526 (lookup_name_nonclass, lookup_name): Adjust lookup_name_real call.
527 (lookup_name_prefer_type): Rename to ...
528 (lookup_name): ... here. New overload with LOOK_want parm.
529 (lookup_type_scope_1): Adjust qualify_lookup calls.
530 * call.c (build_operator_new_call)
531 (add_operator_candidates): Adjust lookup_name_real calls.
532 * coroutines.cc (find_coro_traits_template_decl)
533 (find_coro_handle_template_decl, morph_fn_to_coro): Adjust
534 lookup_qualified_name calls.
535 * cp-objcp-common.c (identifier_global_tag): Likewise.
536 * decl.c (get_tuple_size, get_tuple_decomp_init): Likewise.
537 (lookup_and_check_tag): Use lookup_name overload.
538 * parser.c (cp_parser_userdef_numeric_literal): Adjust
539 lookup_qualified_name call.
540 (prefer_arg_type): Drop template_mem_access parm, return LOOK_want
542 (cp_parser_lookup_name): Adjust lookup_member, lookup_name_real
544 * pt.c (check_explicit_specialization): Adjust lookup_qualified_name
546 (tsubst_copy_and_build, tsubst_qualified_name): Likewise
547 (deduction_guides_for): Likewise.
548 (tsubst_friend_class): Adjust lookup_name_real call.
549 (lookup_init_capture, tsubst_expr): Likewise.
550 * rtti.c (emit_support_tinfos): Adjust lookup_qualified_name call.
551 * semantics.c (omp_reduction_lookup): Likewise.
552 (capture_decltype): Adjust lookup_name_real call.
554 2020-08-13 Nathan Sidwell <nathan@acm.org>
556 * name-lookup.h (enum class LOOK_where): New.
557 (operator|, operator&): Overloads for it.
558 (lookup_name_real): Replace NONCLASS & BLOCK_P parms with WHERE.
559 * name-lookup.c (identifier_type_value_w): Adjust
560 lookup_name_real call.
561 (lookup_name_real_1): Replace NONCLASS and BLOCK_P parameters
562 with WHERE bitmask. Don't search namespaces if not asked to.
563 (lookup_name_real): Adjust lookup_name_real_1 call.
564 (lookup_name_nonclass, lookup_name)
565 (lookup_name_prefer_type): Likewise.
566 * call.c (build_operator_new_call)
567 (add_operator_candidates): Adjust lookup_name_real calls.
568 * parser.c (cp_parser_lookup_name): Likewise.
569 * pt.c (tsubst_friend_class, lookup_init_capture_pack)
570 (tsubst_expr): Likewise.
571 * semantics.c (capture_decltype): Likewise.
573 2020-08-13 Marek Polacek <polacek@redhat.com>
576 * typeck.c (build_static_cast_1): Implement P1975R0 by allowing
577 static_cast to aggregate type.
579 2020-08-10 Jakub Jelinek <jakub@redhat.com>
582 * constexpr.c (cxx_eval_binary_expression): For SPACESHIP_EXPR, tail
583 call cxx_eval_constant_expression after genericize_spaceship to avoid
584 undesirable further VERIFY_CONSTANT.
586 2020-08-10 Patrick Palka <ppalka@redhat.com>
588 * pt.c (resolve_overloaded_unification): Drop functions with
589 unsatisfied constraints.
590 (resolve_nondeduced_context): Likewise.
592 2020-08-05 Patrick Palka <ppalka@redhat.com>
593 Jason Merrill <jason@redhat.com>
596 * constexpr.c (cxx_eval_vec_init_1): Truncate ctx->ctor and
597 then clear CONSTRUCTOR_NO_CLEARING on each appended element
598 initializer if we're initializing a previously zero-initialized
601 2020-08-04 Marek Polacek <polacek@redhat.com>
604 * parser.c (cp_parser_elaborated_type_specifier): Allow
605 'template' following ::.
607 2020-08-04 Nathan Sidwell <nathan@acm.org>
609 * parser.c (cp_parser_explicit_specialization): Refactor
610 to avoid leak of num_template_parameter_lists value.
612 2020-08-04 Patrick Palka <ppalka@redhat.com>
615 * init.c (sort_mem_initializers): Preserve TREE_TYPE of the
616 member initializer list node.
617 (emit_mem_initializers): Set input_location when performing each
618 member initialization.
619 * parser.c (cp_parser_mem_initializer): Attach the source
620 location of this initializer to a dummy EMPTY_CLASS_EXPR
621 within the TREE_TYPE of the list node.
622 * pt.c (tsubst_initializer_list): Preserve TREE_TYPE of the
623 member initializer list node.
625 2020-08-03 Marek Polacek <polacek@redhat.com>
627 * cp-tree.h (after_nsdmi_defaulted_late_checks): Remove.
629 2020-08-03 Marek Polacek <polacek@redhat.com>
633 * pt.c (check_default_tmpl_args): Also consider variable
636 2020-07-31 Jakub Jelinek <jakub@redhat.com>
639 * decl.c (finish_function): In constexpr functions use for C++14 and
640 later error instead of warning if no return statement is present and
641 diagnose it regardless of warn_return_type. Move the warn_return_type
642 diagnostics earlier in the function.
644 2020-07-31 Martin Sebor <msebor@redhat.com>
647 * class.c (build_base_path): Set no-warning bit on the synthesized
648 conditional expression in static_cast.
650 2020-07-31 Richard Biener <rguenther@suse.de>
653 * cp-objcp-common.h (LANG_HOOKS_FINALIZE_EARLY_DEBUG):
654 Define to c_common_finalize_early_debug.
656 2020-07-31 Patrick Palka <ppalka@redhat.com>
659 * constexpr.c (cxx_eval_constant_expression) <case CONST_DECL>:
660 Pass false to decl_constant_value and decl_really_constant_value
661 so that they don't unshare their result.
662 * cp-tree.h (decl_constant_value): New declaration with an added
664 (decl_really_constant_value): Add bool parameter defaulting to
665 true to existing declaration.
666 * init.c (constant_value_1): Add bool parameter which controls
667 whether to unshare the initializer before returning. Call
668 unshare_expr at most once.
669 (scalar_constant_value): Pass true to constant_value_1's new
671 (decl_really_constant_value): Add bool parameter and forward it
673 (decl_constant_value): Likewise, but instead define a new
674 overload with an added bool parameter.
676 2020-07-30 Patrick Palka <ppalka@redhat.com>
679 * pt.c (resolve_overloaded_unification): If the function
680 template specialization has a placeholder return type,
681 then instantiate it before attempting unification.
683 2020-07-30 Patrick Palka <ppalka@redhat.com>
686 * pt.c (alias_ctad_tweaks): Call remove_constraints before
687 calling set_constraints.
689 2020-07-30 Patrick Palka <ppalka@redhat.com>
692 * pt.c (reduce_template_parm_level): Propagate DECL_VIRTUAL_P
693 from the original TEMPLATE_PARM_DECL to the new lowered one.
695 2020-07-30 Patrick Palka <ppalka@redhat.com>
698 * constraint.cc (constraints_satisfied_p): Return true if
700 * pt.c (do_type_instantiation): Update a paragraph taken from
701 [temp.explicit] to reflect the latest specification. Don't
702 instantiate a member with unsatisfied constraints.
704 2020-07-29 Jason Merrill <jason@redhat.com>
707 * cp-tree.h (IMPLICIT_RVALUE_P): New.
708 (enum cp_lvalue_kind_flags): Add clk_implicit_rval.
709 (implicit_rvalue_p, set_implicit_rvalue_p): New.
710 * call.c (reference_binding): Check clk_implicit_rval.
711 (build_over_call): Adjust C++20 implicit move.
712 * coroutines.cc (finish_co_return_stmt): Simplify implicit move.
713 * except.c (build_throw): Adjust C++20 implicit move.
714 * pt.c (tsubst_copy_and_build) [STATIC_CAST_EXPR]: Propagate
716 * tree.c (lvalue_kind): Set clk_implicit_rval.
717 * typeck.c (treat_lvalue_as_rvalue_p): Overhaul.
718 (maybe_warn_pessimizing_move): Adjust.
719 (check_return_expr): Adjust C++20 implicit move.
721 2020-07-29 Jason Merrill <jason@redhat.com>
724 * call.c (build_over_call): Don't call a const ref
725 overload for implicit move.
727 2020-07-28 Nathan Sidwell <nathan@acm.org>
729 * cp-gimplify.c (cp_genericize_r): Set IMPORTED_DECL's context.
730 * cp-objcp-common.c (cp_pushdecl): Set decl's context.
731 * decl.c (grokfndecl): Make DECL_CONTEXT setting clearer.
733 2020-07-28 Nathan Sidwell <nathan@acm.org>
735 * class.c (fixup_type_variants): Copy TYPE_SIZE and
737 (finish_struct): Call it.
739 2020-07-28 Nathan Sidwell <nathan@acm.org>
741 * ptree.c (cxx_print_decl): Better indentation.
743 2020-07-28 Jakub Jelinek <jakub@redhat.com>
744 Mark Wielaard <mark@klomp.org>
747 * parser.c (cp_lexer_safe_previous_token): Don't call
748 cp_lexer_previous_token, instead inline it by hand and return NULL
749 instead of failing assertion if all previous tokens until the first
751 (cp_parser_error_1): Optimize - only call cp_lexer_safe_previous_token
752 if token->type is CPP_NAME. Use cp_lexer_safe_previous_token instead
753 of cp_lexer_previous_token for the missing_token_desc != RT_NONE
756 2020-07-27 Nathan Sidwell <nathan@acm.org>
758 * cp-tree.h (enum cp_tree_index): Add CPTI_AS_BASE_IDENTIFIER.
759 (as_base_identifier): Define.
760 * decl.c (initialize_predifined_identifiers): Initialize as_base
762 * class.c (layout_class_type): Name the as-base type. Zap
763 NSDMI its fields may have.
765 2020-07-22 Nathan Sidwell <nathan@acm.org>
767 * class.c (maybe_add_class_template_decl_list): Don't add CONST_DECLs.
769 2020-07-22 Nathan Sidwell <nathan@acm.org>
771 * typeck.c (structural_comptypes): [DECLTYPE_TYPE] break
773 [UNDERLYING_TYPE]: Use an if.
776 2020-07-22 Nathan Sidwell <nathan@acm.org>
778 * decl.c (decls_match): Move variables into scopes
780 (duplicate_decls): Use STRIP_TEMPLATE.
781 (build_typename_type): Move var decls to their assignments.
782 (begin_function_body): Likewise.
783 * decl2.c (get_guard): Likewise.
784 (mark_used): Use true for truthiness.
785 * error.c (dump_aggr_type): Hold the decl in a var called
788 2020-07-22 Nathan Sidwell <nathan@acm.org>
790 * cp-tree.h (struct tree_lambda_expr): Shrink
791 default_capture_mode & discriminator.
793 2020-07-22 Nathan Sidwell <nathan@acm.org>
795 * mangle.c (decl_is_template_id): Rename to ...
796 (maybe_template_info): ... here. Return the template info,
797 rather than use a pointer. Adjust all callers.
798 (find_substitution): Use template_args_equal, rather than
801 2020-07-22 Tobias Burnus <tobias@codesourcery.com>
803 * parser.c (cp_parser_omp_clause_hint): Require nonnegative hint.
804 (cp_parser_omp_critical): Permit hint(0) clause without named critical.
805 * pt.c (tsubst_expr): Re-check the latter for templates.
807 2020-07-21 Sunil K Pandey <skpgkp2@gmail.com>
810 * decl.c (cp_finish_decl): Call target hook
811 lower_local_decl_alignment to lower local decl alignment.
813 2020-07-21 Nathan Sidwell <nathan@acm.org>
815 * parser.c (cp_lexer_consume_token): Drop PRAGMA_EOL assert.
816 (cp_parser_skip_to_closing_parenthesis_1): Only pass start token
817 to pragma skipper if recovering.
818 (cp_parser_skip_to_pragma_eol): Only purge and change pragma
819 state when recovering.
821 2020-07-20 Jason Merrill <jason@redhat.com>
823 * pt.c (type_dependent_expression_p): A pseudo-dtor can be
825 * semantics.c (finish_call_expr): Use build_trivial_dtor_call for
827 (finish_pseudo_destructor_expr): Leave type NULL for dependent arg.
829 2020-07-20 Jason Merrill <jason@redhat.com>
831 * mangle.c (write_base_ref): New.
832 (write_expression): Use it for base field COMPONENT_REFs.
833 * pt.c (invalid_tparm_referent_p): Canonicalize the type
834 of array offsets. Allow subobjects.
836 2020-07-20 Jason Merrill <jason@redhat.com>
838 * pt.c (collect_ctor_idx_types): Add 'const' when deducing from
841 2020-07-17 Marek Polacek <polacek@redhat.com>
844 * decl.c (grokdeclarator): Detect cv-qual decltype(auto).
845 * pt.c (do_auto_deduction): Likewise.
847 2020-07-16 Iain Sandoe <iain@sandoe.co.uk>
854 * coroutines.cc (struct coro_ret_data): Delete.
855 (coro_maybe_expand_co_return): Delete.
856 (co_return_expander): Delete.
857 (expand_co_returns): Delete.
858 (co_await_find_in_subtree): Remove unused name.
859 (build_actor_fn): Remove unused parm, remove handling
860 for co_return expansion.
861 (register_await_info): Demote duplicate info message to a
863 (coro_make_frame_entry): Move closer to use site.
864 (struct susp_frame_data): Add fields for final suspend label
865 and a flag to indicate await expressions with initializers.
866 (captures_temporary): Delete.
867 (register_awaits): Remove unused code, update comments.
868 (find_any_await): New.
869 (tmp_target_expr_p): New.
870 (struct interesting): New.
871 (find_interesting_subtree): New.
872 (struct var_nest_node): New.
873 (flatten_await_stmt): New.
874 (handle_nested_conditionals): New.
875 (process_conditional): New.
876 (replace_statement_captures): Rename to...
877 (maybe_promote_temps): ... this.
878 (maybe_promote_captured_temps): Delete.
879 (analyze_expression_awaits): Check for await expressions with
880 initializers. Simplify handling for truth-and/or-if.
881 (expand_one_truth_if): Simplify (map cases that need expansion
883 (await_statement_walker): Handle CO_RETURN_EXPR. Simplify the
884 handling for truth-and/or-if expressions.
885 (register_local_var_uses): Ensure that we create names in the
886 implementation namespace.
887 (morph_fn_to_coro): Add final suspend label to suspend frame
888 callback data and remove it from the build_actor_fn call.
890 2020-07-16 Marek Polacek <polacek@redhat.com>
892 * call.c (convert_like): Remove macro and introduce a new
894 (convert_like_with_context): Likewise.
895 (convert_like_real): Rename to convert_like.
896 (convert_like_real_1): Rename to convert_like_internal. Call
897 convert_like instead of convert_like_real therein.
898 (perform_direct_initialization_if_possible): Call convert_like
899 instead of convert_like_real.
901 2020-07-16 Iain Sandoe <iain@sandoe.co.uk>
903 * coroutines.cc: Correct some spelling errors
906 2020-07-15 Nathan Sidwell <nathan@acm.org>
908 * parser.c (cp_parser_declaration): Avoid copying tokens.
909 (cp_parser_block_declaration): RAII token pointer.
911 2020-07-15 Nathan Sidwell <nathan@acm.org>
913 * parser.c (cp_parser_skip_to_closing_parenthesis_1): Deal with
914 meeting a deferred pragma.
915 (cp_parser_skip_to_end_of_statement): Likewise.
916 (cp_parser_skip_to_end_of_block_or_statement): Likewise.
917 (cp_parser_skip_to_pragma_eol): We should never meet EOF.
918 (cp_parser_omp_declare_simd): Likewise.
919 (cp_parser_omp_declare_reduction, cp_parser_oacc_routine)
920 (pragma_lex): Likewise.
922 2020-07-14 Marek Polacek <polacek@redhat.com>
927 * call.c (convert_like_real_1): Renamed from convert_like_real.
928 (convert_like_real): New wrapper for convert_like_real_1.
930 2020-07-14 Nathan Sidwell <nathan@acm.org>
932 * parser.c (cp_lexer_alloc): Do not deal with PCH here.
933 (cp_lexer_new_main): Deal with PCH here. Store the tokens directly
935 (cp_lexer_new_from_tokens): Assert last token isn't purged either.
936 (cp_lexer_get_preprocessor_token): Change first arg to flags, adjust.
937 (cp_parser_new): Pass the lexer in, don't create it here.
938 (cp_parser_translation_unit): Initialize access checks here.
939 (cp_parser_initial_pragma): First token is provided by caller,
940 don't deal with PCH stopping here. Adjust error message.
941 (c_parse_file): Adjust, change error message to avoid C++20 module
944 2020-07-14 Nathan Sidwell <nathan@acm.org>
946 * ptree.c (cxx_print_type): Add TYPEOF_TYPE and BASES.
948 2020-07-14 Nathan Sidwell <nathan@acm.org>
950 * class.c (build_base_field_1): Cache CLASSTYPE_AS_BASE.
951 (build_self_reference): Rename value -> decl.
952 (dump_class_hierarchy_1): Cache CLASSTYPE_AS_BASE.
954 2020-07-14 Marek Polacek <polacek@redhat.com>
957 * decl.c (grokdeclarator) <case cdk_function>: Check also
958 pointers/references/... to functions.
960 2020-07-14 Nathan Sidwell <nathan@acm.org>
962 * cp-tree.h: Correct some tree lang flag comments,
963 reformat some structure definitions. Note some structure
964 sizes. Clarify some comments.
965 (yyungetc): Delete. Not been a thing for some time.
966 * class.c (copy_fndecl_with_name): Comment.
967 (check_bases_and_members): Unnecessary {}.
968 (layout_class_type): Comment.
969 * cp-tree.def (UNBOUND_CLASS_TEMPLATE): Adjust comment.
970 * decl.c: Fix some formatting & whitespace issues.
971 (function_requirements_equivalent_p): Note why
972 substitutions are needed.
973 * decl2.c (no_linkage_error): Note that heroics about
974 'typedef struct { ... };' are no longer needed.
975 * method.c: Whitespace.
976 * name-lookup.c: Whitespace.
977 (add_decl_to_level): Reformat a line.
978 (print_binding_stack): Mark as DEBUG_FUNCTION.
979 (has_using_namespace_std_directive_p): Delete comment.
981 * ptree.c: Whitespace.
982 * rtti.c: Whitespace & comment.
984 * typeck.c (structural_comptypes): Add comment.
986 2020-07-13 Nathan Sidwell <nathan@acm.org>
988 * Make-lang.in (c++.disclean): Likewise.
990 2020-07-13 Marek Polacek <polacek@redhat.com>
993 * parser.c (cp_parser_enum_specifier): Commit to tentative parse
994 after we've seen an opening brace.
996 2020-07-10 Jason Merrill <jason@redhat.com>
998 * tree.c (structural_type_p): Allow unions.
999 * mangle.c (write_expression): Express unions with a designator.
1001 2020-07-10 Jason Merrill <jason@redhat.com>
1003 * pt.c (convert_nontype_argument): Handle REAL_TYPE.
1004 (invalid_nontype_parm_type_p): Allow all structural types.
1005 * tree.c (structural_type_p): Use SCALAR_TYPE_P.
1007 2020-07-10 Jason Merrill <jason@redhat.com>
1012 * class.c (check_field_decls): An array of empty classes is not an
1014 (layout_empty_base_or_field): Handle explicit alignment.
1017 2020-07-09 Julian Brown <julian@codesourcery.com>
1018 Thomas Schwinge <thomas@codesourcery.com>
1021 * semantics.c (finish_omp_clauses): Likewise.
1023 2020-07-09 Patrick Palka <ppalka@redhat.com>
1026 * constexpr.c (potential_constant_expression_1) <case PARM_DECL>:
1027 Restore dependent_type_p check that guarded the call to
1028 is_really_empty_class.
1030 2020-07-08 Patrick Palka <ppalka@redhat.com>
1033 * constexpr.c (potential_constant_expression_1) <case PARM_DECL>:
1034 When processing_template_decl, check COMPLETE_TYPE_P before
1035 calling is_really_empty_class. Don't check dependent_type_p.
1037 2020-07-08 Marek Polacek <polacek@redhat.com>
1040 * parser.c (cp_parser_decltype): Print error about using decltype(auto)
1041 in C++11. Check that the token following "auto" is ")".
1043 2020-07-07 Patrick Palka <ppalka@redhat.com>
1046 * cxx-pretty-print.c (pp_cxx_unqualified_id): Check
1047 PRIMARY_TEMPLATE_P before printing the innermost template
1050 2020-07-07 Martin Sebor <msebor@redhat.com>
1053 * parser.c (class_decl_loc_t::diag_mismatched_tags): Print notes only
1054 if warning_at returns nonzero.
1056 2020-07-06 Martin Sebor <msebor@redhat.com>
1059 * call.c (build_over_call): Check calls only when tf_warning is set.
1061 2020-07-06 Nathan Sidwell <nathan@acm.org>
1063 * decl.c (push_library_fn): Return the decl pushdecl_toplevel returns.
1064 * except.c (verify_library_fn): Replace with ...
1065 (declare_library_fn_1): ... this fn. Always push the fn.
1066 (declare_library_fn): Call it.
1067 (build_throw): Call declare_library_fn_1.
1069 2020-07-06 Jonathan Wakely <jwakely@redhat.com>
1072 * parser.c (cp_parser_toplevel_declaration): Only do pedwarn for
1073 empty-declaration in C++98.
1075 2020-07-02 Jason Merrill <jason@redhat.com>
1076 Jakub Jelinek <jakub@redhat.com>
1078 * decl.c (grokfndecl): Allow consteval virtual.
1079 * search.c (check_final_overrider): Check consteval mismatch.
1080 * constexpr.c (cxx_eval_thunk_call): New.
1081 (cxx_eval_call_expression): Call it.
1082 * cvt.c (cp_get_fndecl_from_callee): Handle FDESC_EXPR.
1083 * decl2.c (mark_vtable_entries): Track vtables with consteval.
1084 (maybe_emit_vtables): Pass consteval_vtables through.
1085 (clear_consteval_vfns): Replace consteval with nullptr.
1086 (c_parse_final_cleanups): Call it.
1088 2020-07-01 Nathan Sidwell <nathan@acm.org>
1090 * class.c (copy_fndecl_with_name): Add additional predicate args, do
1091 not deduce them locally.
1092 (copy_operator_fn): Adjust copy_fndecl_with_name call.
1093 (build_clone): Add vtt and inherited predicate args. Pass through
1094 to copy_fndecl_with_name call.
1095 (build_cdtor_clones): Likewise, pass through to build_clone as
1097 (build_cdtor): Determine vtt and inherited here.
1098 * cp-tree.h (DECL_NEEDS_CTT_PARM_P): Delete.
1100 2020-06-30 Nathan Sidwell <nathan@acm.org>
1102 * cp-tree.h (copy_fndecl_with_name): Rename to ...
1103 (copy_operatorn_fn): ... this. Change arg type.
1104 (clone_function_decl): Rename to ...
1105 (clone_cdtor): ... this.
1106 * class.c (copy_fndecl_with_name): Make static.
1107 (copy_operator_fn): New wrapper.
1108 (build_clones): Rename to ...
1109 (build_cdtor_clones): ... this.
1110 (clone_function_decl): Rename to ...
1111 (clone_cdtor): ... this. Adjust build_clones calls.
1112 (clone_constructors_and_destructors): Adjust clone_function_decl
1114 * method.c (implicitly_declare_fn): Adjust copy_fndecl_with_name
1116 (lazily_declare_fn): Adjust clone_function_decl call.
1117 * pt.c (tsubst_function_decl): Likewise.
1118 (instantiate_template_1): Likewise.
1120 2020-06-30 Iain Sandoe <iain@sandoe.co.uk>
1122 * coroutines.cc (morph_fn_to_coro): Remove trailing
1123 space in a diagnostic.
1125 2020-06-30 Iain Sandoe <iain@sandoe.co.uk>
1127 * coroutines.cc (expand_one_await_expression): Remove
1128 code dealing with initial suspend.
1129 (build_actor_fn): Remove code special-casing initial
1130 and final suspend. Handle the final suspend and marking
1131 of the coroutine as done.
1132 (coro_rewrite_function_body): New.
1133 (bind_expr_find_in_subtree): Remove.
1134 (coro_body_contains_bind_expr_p): Remove.
1135 (morph_fn_to_coro): Split the rewrite of the original
1136 function into coro_rewrite_function_body and call it.
1138 2020-06-29 Marek Polacek <polacek@redhat.com>
1141 * decl.c (duplicate_decls): Make sure a concept or a variable
1142 template is unique in its declarative region.
1144 2020-06-29 Marek Polacek <polacek@redhat.com>
1147 * pt.c (collect_ctor_idx_types): Use TREE_TYPE.
1149 2020-06-28 Iain Sandoe <iain@sandoe.co.uk>
1152 * coroutines.cc (register_local_var_uses): Skip past
1155 2020-06-27 Iain Sandoe <iain@sandoe.co.uk>
1158 * coroutines.cc (get_awaitable_var): New helper.
1159 (build_co_await): Check more carefully before
1160 copying an awaitable.
1161 (expand_one_await_expression): No initializer
1162 is required when the awaitable is not a temp.
1163 (register_awaits): Remove handling that is now
1164 completed when the await expression is built.
1166 2020-06-27 Iain Sandoe <iain@sandoe.co.uk>
1168 * coroutines.cc (morph_fn_to_coro): Diagnose unavailable
1169 get_return_object_on_allocation_failure.
1171 2020-06-26 Iain Sandoe <iain@sandoe.co.uk>
1174 * coroutines.cc (struct coroutine_info):Add a field
1175 to hold computed p.return_void expressions.
1176 (coro_build_promise_expression): New.
1177 (get_coroutine_return_void_expr): New.
1178 (finish_co_yield_expr): Build the promise expression
1179 using coro_build_promise_expression.
1180 (finish_co_return_stmt): Likewise.
1181 (build_init_or_final_await): Likewise.
1182 (morph_fn_to_coro): Likewise, for several cases.
1184 2020-06-26 Iain Sandoe <iain@sandoe.co.uk>
1186 * coroutines.cc (morph_fn_to_coro): Handle error
1187 returns in building g-r-o-o-a-f expressions.
1189 2020-06-24 Nicholas Krause <xerofoify@gmail.com>
1192 * typeck2.c (cxx_incomplete_type_diagnostic): Add missing
1193 TYPE_EXPANSION_PACK check for diagnosing incomplete types in
1194 cxx_incomplete_type_diagnostic.
1196 2020-06-24 Iain Sandoe <iain@sandoe.co.uk>
1200 * coroutines.cc (act_des_fn): Copy function
1201 attributes onto the outlined coroutine helpers.
1203 2020-06-24 Jason Merrill <jason@redhat.com>
1205 * call.c (build_over_call): Only call build_base_path once.
1207 2020-06-24 Jason Merrill <jason@redhat.com>
1210 * call.c (build_over_call): Look up the overrider in base_binfo.
1211 * class.c (lookup_vfn_in_binfo): Look through BINFO_PRIMARY_P.
1213 2020-06-23 Jason Merrill <jason@redhat.com>
1216 Implement C++20 P2082R1, Fixing CTAD for aggregates.
1217 * cp-tree.h (TPARMS_PRIMARY_TEMPLATE): Split out from...
1218 (DECL_PRIMARY_TEMPLATE): ...here.
1219 (builtin_guide_p): Declare.
1220 * decl.c (reshape_init_class): Handle bases of a template.
1221 (reshape_init_r): An array with dependent bound takes a single
1223 * pt.c (tsubst_default_argument): Shortcut {}.
1224 (unify_pack_expansion): Allow omitted arguments to trailing pack.
1225 (builtin_guide_p): New.
1226 (collect_ctor_idx_types): Give a trailing pack a {} default
1227 argument. Handle arrays better.
1229 2020-06-23 Iain Sandoe <iain@sandoe.co.uk>
1232 * coroutines.cc (morph_fn_to_coro): Apply a cleanup to
1233 the get return object when the DTOR is non-trivial.
1235 2020-06-20 Iain Sandoe <iain@sandoe.co.uk>
1238 * coroutines.cc (morph_fn_to_coro): Update handling of
1239 get-return-object-on-allocation-fail and diagnose missing
1242 2020-06-20 Jason Merrill <jason@redhat.com>
1244 * call.c (joust): Only compare constraints for non-template
1245 candidates with matching parameters.
1246 * pt.c (tsubst_pack_expansion): Fix getting a type parameter
1248 (more_specialized_fn): Only compare constraints for candidates with
1249 matching parameters.
1251 2020-06-19 Jason Merrill <jason@redhat.com>
1253 * method.c (early_check_defaulted_comparison): Allow defaulting
1254 comparison outside class. Complain if non-member operator isn't a
1257 2020-06-18 Jason Merrill <jason@redhat.com>
1259 * method.c (early_check_defaulted_comparison): Check for &&.
1260 (build_comparison_op): Allow empty union. Diagnose non-category
1262 (common_comparison_type): Remove handling for non-category type.
1264 2020-06-18 Marek Polacek <polacek@redhat.com>
1267 * pt.c (finish_template_variable): Return if
1268 coerce_innermost_template_parms return error_mark_node.
1270 2020-06-18 Marek Polacek <polacek@redhat.com>
1273 * pt.c (tsubst_copy_and_build) <case NEW_EXPR>: Return error_mark_node
1274 if placement is erroneous.
1276 2020-06-17 Jonathan Wakely <jwakely@redhat.com>
1279 * parser.c (cp_parser_elaborated_type_specifier): Do not warn
1280 unless in a declaration.
1282 2020-06-17 Jason Merrill <jason@redhat.com>
1284 * cp-tree.h (copy_fndecl_with_name): Declare.
1285 * class.c (copy_fndecl_with_name): Split out from...
1286 (build_clone): ...here.
1287 (add_implicitly_declared_members): Add op== to TYPE_FIELDS.
1288 * method.c (implicitly_declare_fn): Use copy_fndecl_with_name.
1290 2020-06-17 Jason Merrill <jason@redhat.com>
1292 * call.c (build_new_op_1): Don't look for a CALL_EXPR when
1293 calling a consteval function.
1295 2020-06-17 Jason Merrill <jason@redhat.com>
1297 * decl2.c (grokfield): Pass SD_DEFAULTED and SD_DELETED.
1298 * decl.c (duplicate_decls): Reduce error for delete
1299 after earlier declaration to pedwarn.
1301 2020-06-17 Marek Polacek <polacek@redhat.com>
1304 * constexpr.c (maybe_fold_non_dependent_expr): New.
1305 * cp-tree.h (maybe_fold_non_dependent_expr): Declare.
1306 * typeck.c (cp_build_array_ref): Call maybe_fold_non_dependent_expr
1307 instead of maybe_constant_value.
1309 2020-06-16 Marek Polacek <polacek@redhat.com>
1312 * call.c (add_list_candidates): Return if a designated initializer
1313 is used with a non-aggregate.
1314 (implicit_conversion_error): Give an error for the case above.
1316 2020-06-16 Marek Polacek <polacek@redhat.com>
1319 * name-lookup.c (check_local_shadow): Check if types are
1320 non-null before calling same_type_p.
1322 2020-06-16 Jakub Jelinek <jakub@redhat.com>
1324 * semantics.c (handle_omp_for_class_iterator): Adjust
1325 c_omp_check_loop_iv_exprs caller.
1326 (finish_omp_for): Likewise. Don't call fold_build_cleanup_point_expr
1327 before calling c_finish_omp_for and c_omp_check_loop_iv, move it
1329 * pt.c (tsubst_omp_for_iterator): Handle non-rectangular loops.
1331 2020-06-16 Jakub Jelinek <jakub@redhat.com>
1333 * parser.c (cp_parser_omp_clause_schedule): Reject modifier separated
1334 from kind by comma rather than colon.
1336 2020-06-16 Patrick Palka <ppalka@redhat.com>
1338 * pt.c (perform_instantiation_time_access_checks): No need to
1340 * semantics.c (enforce_access): Verify that decl is not
1343 2020-06-16 Patrick Palka <ppalka@redhat.com>
1347 * cp-tree.h (qualified_typedef_usage_s): Delete.
1348 (qualified_typedef_usage_t): Delete.
1349 (deferred_access_check): Move up in file.
1350 (tree_template_info::typedefs_needing_access_checking): Delete.
1351 (tree_template_info::deferred_access_checks): New field.
1352 (TI_TYPEDEFS_NEEDING_ACCESS_CHECKING): Rename to ...
1353 (TI_DEFERRED_ACCESS_CHECKS): ... this, and adjust accordingly.
1354 * pt.c (perform_typedefs_access_check): Rename to ...
1355 (perform_instantiation_time_access_checks): ... this, and adjust
1356 accordingly. Remove unnecessary tree tests.
1357 (instantiate_class_template_1): Adjust accordingly.
1358 (instantiate_decl): Likewise.
1359 * semantics.c (enforce_access): Likewise.
1361 2020-06-16 Patrick Palka <ppalka@redhat.com>
1365 * call.c (enforce_access): Move to semantics.c.
1366 * cp-tree.h (enforce_access): Delete.
1367 (get_types_needing_access_check): Delete.
1368 (add_typedef_to_current_template_for_access_check): Delete.
1369 * decl.c (make_typename_type): Adjust accordingly. Use
1370 check_accessibility_of_qualified_id instead of directly using
1371 perform_or_defer_access_check.
1372 * parser.c (cp_parser_template_declaration_after_parameters):
1373 Don't push a dk_no_check access state when parsing a template.
1374 * pt.c (get_types_needing_access_check): Delete.
1375 (append_type_to_template_for_access_check_1): Delete.
1376 (perform_typedefs_access_check): Adjust. If type_decl is a
1377 FIELD_DECL, also check its DECL_CONTEXT for dependence. Use
1378 tsubst_copy instead of tsubst to substitute into type_decl so
1379 that we substitute into the DECL_CONTEXT of a FIELD_DECL.
1380 (append_type_to_template_for_access_check): Delete.
1381 * search.c (accessible_p): Remove the processing_template_decl
1383 * semantics.c (enforce_access): Moved from call.c. If we're
1384 parsing a template and the access check failed, add the check to
1385 TI_TYPEDEFS_NEEDING_ACCESS_CHECKING.
1386 (perform_or_defer_access_check): Adjust comment.
1387 (add_typedef_to_current_template_for_access_check): Delete.
1388 (check_accessibility_of_qualified_id): Adjust accordingly.
1389 Exit early if the scope is dependent.
1391 2020-06-11 Patrick Palka <ppalka@redhat.com>
1394 * constraint.cc (associate_classtype_constraints): If there is a
1395 discrepancy between the current template depth and the template
1396 depth of the original declaration, then adjust the template
1397 parameter depth within the current constraints appropriately.
1398 * pt.c (tsubst_friend_class): Substitute into and set the
1399 constraints on the injected declaration.
1401 2020-06-11 Iain Sandoe <iain@sandoe.co.uk>
1403 * coroutines.cc (instantiate_coro_traits): Pass a reference
1404 to lambda closure objects to traits instantiation.
1405 (morph_fn_to_coro): Likewise for promise parameter
1406 preview and allocator lookup.
1408 2020-06-10 Iain Sandoe <iain@sandoe.co.uk>
1411 * call.c (add_candidates): Use vec_safe_length() for
1412 testing the arguments list.
1413 (build_new_method_call_1): Use vec_safe_is_empty() when
1414 checking for an empty args list.
1416 2020-06-10 Marek Polacek <polacek@redhat.com>
1419 * parser.c (cp_parser_direct_declarator): Clear
1420 CP_PARSER_FLAGS_DELAY_NOEXCEPT if the declarator kind is not
1423 2020-06-09 Iain Sandoe <iain@sandoe.co.uk>
1426 * coroutines.cc (expand_one_await_expression): Build separate
1427 DTOR trees for the awaitable object on the destroy and resume
1430 2020-06-09 Jason Merrill <jason@redhat.com>
1433 * cp-gimplify.c (predeclare_vla): Only predeclare a VLA if it's
1434 wrapped in a pointer type.
1436 2020-06-05 Marek Polacek <polacek@redhat.com>
1439 * call.c (build_converted_constant_expr_internal): Allow
1440 list-initialization.
1442 2020-06-05 Iain Sandoe <iain@sandoe.co.uk>
1444 * cp-tree.def (CO_RETURN_EXPR): Correct the class
1445 to use tcc_statement.
1447 2020-06-05 Jason Merrill <jason@redhat.com>
1449 * error.c (dump_binary_op): Handle negative operand to
1452 2020-06-04 Jason Merrill <jason@redhat.com>
1455 * constexpr.c (cxx_eval_constant_expression) [OBJ_TYPE_REF]:
1456 Evaluate OBJ_TYPE_REF_EXPR.
1458 2020-06-04 Jason Merrill <jason@redhat.com>
1461 * class.c (lookup_vfn_in_binfo): New.
1462 * call.c (build_over_call): Use it.
1463 * cp-tree.h (resolves_to_fixed_type_p): Add default argument.
1464 (lookup_vfn_in_binfo): Declare.
1466 2020-06-04 Iain Sandoe <iain@sandoe.co.uk>
1469 * coroutines.cc (morph_fn_to_coro): Ensure that the get-
1470 return-object is constructed correctly; When it is not the
1471 final return value, pass it to the CTOR of the return type
1472 as an rvalue, per the standard comment.
1474 2020-06-04 Jakub Jelinek <jakub@redhat.com>
1478 * constexpr.c (cxx_eval_constant_expression): Diagnose CONVERT_EXPR
1479 conversions from pointer types to arithmetic types here...
1480 (cxx_eval_outermost_constant_expr): ... instead of here.
1482 2020-06-03 Mark Wielaard <mark@klomp.org>
1484 * parser.c (cp_lexer_safe_previous_token): New function.
1485 (cp_parser_error_1): Add name_hint if the previous token is
1486 a string literal and next token is a CPP_NAME and we have a
1487 missing header suggestion for the name.
1489 2020-06-03 Patrick Palka <ppalka@redhat.com>
1491 * pt.c (process_partial_specialization): Pass the full set of
1492 generic template arguments to strictly_subsumes.
1494 2020-06-03 Patrick Palka <ppalka@redhat.com>
1497 * pt.c (most_specialized_partial_spec): Reorganize the loop over
1498 DECL_TEMPLATE_SPECIALIZATIONS. Check constraints_satisfied_p on
1499 the original template declaration, not on the tsubsted one.
1501 2020-06-03 Iain Sandoe <iain@sandoe.co.uk>
1504 * coroutines.cc (finish_co_await_expr): Revise to allow for
1506 (finish_co_yield_expr): Likewise.
1508 2020-06-03 Jason Merrill <jason@redhat.com>
1511 * cp-tree.h (predeclare_vla): Declare.
1512 * cp-gimplify.c (predeclare_vla): Handle getting a decl.
1513 * pt.c (tsubst_expr) [DECL_EXPR]: Use it.
1515 2020-06-03 Tobias Burnus <tobias@codesourcery.com>
1517 * cp-gimplify.c (cxx_omp_predetermined_mapping): New.
1518 * cp-objcp-common.h (LANG_HOOKS_OMP_PREDETERMINED_MAPPING): Redfine.
1519 * cp-tree.h (cxx_omp_predetermined_mapping): Declare.
1521 2020-06-02 Jason Merrill <jason@redhat.com>
1524 * pt.c (tsubst_decl): Relax assert.
1526 2020-06-02 Iain Sandoe <iain@sandoe.co.uk>
1529 * coroutines.cc (build_co_await): Wrap the co_await expression
1530 in a TARGET_EXPR, where needed.
1531 (finish_co_yield_expr): Likewise.
1533 2020-06-02 Patrick Palka <ppalka@redhat.com>
1537 * pt.c (tsubst_function_decl): Don't do set_constraints when
1538 regenerating a lambda.
1539 (tsubst_lambda_expr): Substitute into the lambda's constraints
1540 and do set_constraints here.
1542 2020-06-01 Jason Merrill <jason@redhat.com>
1547 * class.c (build_vfn_ref): Revert 95311 change.
1548 * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call): Build a
1551 2020-06-01 Iain Sandoe <iain@sandoe.co.uk>
1554 * coroutines.cc (struct param_info): Remove rv_ref field.
1555 (build_actor_fn): Remove specifial rvalue ref handling.
1556 (morph_fn_to_coro): Likewise.
1558 2020-05-31 Iain Sandoe <iain@sandoe.co.uk>
1561 * coroutines.cc (morph_fn_to_coro): If we see an
1562 early fatal error, drop the erroneous function body.
1564 2020-05-31 Iain Sandoe <iain@sandoe.co.uk>
1566 * coroutines.cc (build_co_await): Remove unused
1568 (finish_co_await_expr): Likewise.
1569 (finish_co_yield_expr): Likewise; revise comment.
1571 2020-05-30 Iain Sandoe <iain@sandoe.co.uk>
1573 * coroutines.cc (morph_fn_to_coro): Revise initialization
1574 of the frame pointer to avoid an unused value.
1576 2020-05-30 Patrick Palka <ppalka@redhat.com>
1579 * constraint.cc (satisfaction_value): Accept INTEGER_CST of any
1582 2020-05-29 Patrick Palka <ppalka@redhat.com>
1583 Jason Merrill <jason@redhat.com>
1586 * class.c (add_method): Let special member function templates
1587 coexist if they are not equivalently constrained, or in a class
1590 2020-05-29 Jason Merrill <jason@redhat.com>
1593 * pt.c (process_template_parm): Set DECL_TEMPLATE_INFO
1594 on the DECL_TEMPLATE_RESULT.
1596 2020-05-29 Marek Polacek <polacek@redhat.com>
1599 * cp-gimplify.c (cp_fold) <case MODIFY_EXPR>: Don't set
1600 TREE_THIS_VOLATILE here.
1601 (cp_fold): Set it here along with TREE_NO_WARNING.
1603 2020-05-29 Jason Merrill <jason@redhat.com>
1607 * class.c (build_vfn_ref): Don't fold the INDIRECT_REF.
1609 2020-05-29 Patrick Palka <ppalka@redhat.com>
1614 * parser.c (cp_parser_requires_clause_expression): Temporarily
1615 increment processing_template_decl only if it is 0.
1616 (cp_parser_constraint_expression): Likewise.
1617 (cp_parser_requires_expression): Likewise.
1619 2020-05-29 Patrick Palka <ppalka@redhat.com>
1622 * constexpr.c (get_or_insert_ctor_field): Add limited support
1623 for RANGE_EXPR index lookups.
1625 2020-05-28 Jakub Jelinek <jakub@redhat.com>
1628 * decl.c (cp_finish_decomp): Call complete_type before checking
1631 2020-05-28 Jason Merrill <jason@redhat.com>
1634 * decl.c (cp_finish_decl): Revert r9-297 change.
1635 (check_static_variable_definition): Likewise.
1636 * constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
1637 * pt.c (instantiate_decl): Return early on type error.
1639 2020-05-27 Jason Merrill <jason@redhat.com>
1642 * decl.c (reshape_init_array_1): Don't reuse in overload context.
1644 2020-05-27 Jason Merrill <jason@redhat.com>
1647 * call.c (build_new_op_1): Suppress
1648 warn_zero_as_null_pointer_constant across comparison of <=> result
1651 2020-05-27 Jason Merrill <jason@redhat.com>
1654 * decl.c (grokdeclarator): Don't shift attributes in TYPENAME
1657 2020-05-27 Nathan Sidwell <nathan@acm.org>
1660 * pt.c (lookup_template_class_1): Restore alias template mutation.
1662 2020-05-26 Jakub Jelinek <jakub@redhat.com>
1665 * cp-gimplify.c: Include omp-general.h.
1666 (cp_genericize_r) <case OMP_DISTRIBUTE>: For class iteration
1667 variables in composite distribute parallel for, instantiate copy
1668 ctor of their types.
1670 2020-05-23 Patrick Palka <ppalka@redhat.com>
1673 * constexpr.c (cxx_eval_constant_expression)
1674 <case TEMPLATE_ID_EXPR>: Don't evaluate the concept when
1675 constexpr evaluation is uid-sensitive.
1677 2020-05-22 Jason Merrill <jason@redhat.com>
1679 * cp-gimplify.c (cp_gimplify_expr) [CALL_EXPR]: Don't preevaluate
1680 the function address if the call used operator syntax.
1682 2020-05-21 Jason Merrill <jason@redhat.com>
1685 * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call): For a virtual
1686 call, instrument the OBJ_TYPE_REF.
1688 * decl.c (compute_array_index_type_loc): Diagnose expressions
1689 in a template that can't be constant.
1690 * parser.c (cp_parser_direct_declarator): Don't check
1691 non-constant array bounds here.
1693 * cp-tree.h (is_rvalue_constant_expression): Declare.
1694 * constexpr.c (is_rvalue_constant_expression): New.
1695 * parser.c (cp_parser_constant_expression): Use it.
1696 * decl.c (cp_finish_decl): Try to treat a constexpr initializer in a
1697 template as constant.
1699 * typeck.c (build_x_modify_expr): Handle error_mark_node arguments.
1701 * decl.c (grokparms): Return NULL_TREE if any parms were erroneous.
1703 2020-05-21 Iain Sandoe <iain@sandoe.co.uk>
1705 * coroutines.cc (finish_co_return_stmt): Revert change to use
1708 2020-05-21 Patrick Palka <ppalka@redhat.com>
1711 * constexpr.c (constexpr_ctx::uid_sensitive): Remove field.
1712 (uid_sensitive_constexpr_evaluation_value): Define.
1713 (uid_sensitive_constexpr_evaluation_true_counter): Define.
1714 (uid_sensitive_constexpr_evaluation_p): Define.
1715 (uid_sensitive_constexpr_evaluation_sentinel): Define its
1717 (uid_sensitive_constexpr_evaluation_checker): Define its
1718 constructor and its evaluation_restricted_p method.
1719 (get_fundef_copy): Remove 'ctx' parameter. Use u_s_c_e_p
1720 instead of constexpr_ctx::uid_sensitive.
1721 (cxx_eval_call_expression): Use u_s_c_e_p instead, and test it
1722 last. Adjust call to get_fundef_copy.
1723 (instantiate_cx_fn_r): Test u_s_c_e_p so that we increment the
1724 counter if necessary.
1725 (cxx_eval_outermost_constant_expr): Remove 'uid_sensitive'
1726 parameter. Adjust function body accordingly.
1727 (maybe_constant_value): Remove 'uid_sensitive' parameter and
1728 adjust function body accordingly. Set up a
1729 uid_sensitive_constexpr_evaluation_checker, and use it to
1730 conditionally update the cv_cache.
1731 * cp-gimplify.c (cp_fold): Set up a
1732 uid_sensitive_constexpr_evaluation_checker, and use it to
1733 conditionally update the fold_cache.
1734 * cp-tree.h (maybe_constant_value): Update declaration.
1735 (struct uid_sensitive_constexpr_evaluation_sentinel): Define.
1736 (struct sensitive_constexpr_evaluation_checker): Define.
1737 * expr.c (fold_for_warn): Set up a
1738 uid_sensitive_constexpr_evaluation_sentinel before calling
1739 the folding subroutines. Drop all but the first argument to
1740 maybe_constant_value.
1742 2020-05-20 Marek Polacek <polacek@redhat.com>
1745 * parser.c (cp_parser_unqualified_id): Reject simple-template-id as
1746 the declarator-id of a destructor.
1747 (cp_parser_constructor_declarator_p): Reject simple-template-id as
1748 the declarator-id of a constructor.
1750 2020-05-20 Marek Polacek <polacek@redhat.com>
1754 * cp-tree.h (SD_DECOMPOSITION): New flag.
1755 * decl.c (duplicate_decls): Make sure a structured binding is unique
1756 in its declarative region.
1757 (start_decl): If INITIALIZED is SD_DECOMPOSITION, call
1758 fit_decomposition_lang_decl.
1759 (grokdeclarator): Compare INITIALIZED directly to SD_* flags.
1760 * parser.c (cp_parser_decomposition_declaration): Pass SD_DECOMPOSITION
1763 2020-05-20 Patrick Palka <ppalka@redhat.com>
1766 * typeck.c (structural_comptypes): Don't perform
1767 context-dependent resolution of TYPENAME_TYPEs when
1768 comparing_specializations.
1770 2020-05-19 Nathan Sidwell <nathan@acm.org>
1772 * pt.c (lookup_template_class_1): Do not reinit template_info of an
1775 2020-05-18 Martin Sebor <msebor@redhat.com>
1778 * call.c ((maybe_warn_class_memaccess): Use is_byte_access_type.
1779 * cp-tree.h (is_dummy_object): Return bool.
1780 (is_byte_access_type): Declare new function.
1781 * tree.c (is_dummy_object): Return bool.
1782 (is_byte_access_type): Define new function.
1784 2020-05-19 Patrick Palka <ppalka@redhat.com>
1787 * pt.c (init_template_processing): Enable sanitization for
1788 decl_specializations and type_specializations.
1791 * pt.c (fn_type_unification): Pass 'fn' instead of NULL_TREE as
1792 the 'in_decl' parameter to coerce_template_parms.
1794 2020-05-18 Marek Polacek <polacek@redhat.com>
1797 * typeck.c (cp_build_binary_op): Use fold_for_warn instead of
1800 2020-05-18 Marek Polacek <polacek@redhat.com>
1803 * cvt.c (cp_get_fndecl_from_callee): Return NULL_TREE if the function
1804 type is not INDIRECT_TYPE_P.
1805 * decl.c (omp_declare_variant_finalize_one): Call
1806 cp_get_callee_fndecl_nofold instead of looking for the function decl
1809 2020-05-18 Marek Polacek <polacek@redhat.com>
1812 * parser.c (cp_parser_has_attribute_expression): Sorry on a
1813 type-dependent argument.
1815 2020-05-18 Marek Polacek <polacek@redhat.com>
1819 * call.c (add_builtin_candidate) <case EQ_EXPR>: Create candidate
1820 operator functions when type is std::nullptr_t for ==/!=.
1821 * typeck.c (composite_pointer_type_r): Add a bool * parameter. Use it
1822 to maybe add "const" to the pointer type.
1823 (composite_pointer_type): Update the call to composite_pointer_type_r.
1824 (cp_build_binary_op): Turn two warning_at into error_at. Print the
1827 2020-05-18 Jason Merrill <jason@redhat.com>
1829 * call.c (build_over_call): Remove unnecessary
1830 cp_stabilize_reference.
1832 2020-05-18 Marek Polacek <polacek@redhat.com>
1834 * call.c (add_builtin_candidate): Don't create a builtin overload
1835 candidate for ++ when type is bool in C++17.
1837 2020-05-18 Marek Polacek <polacek@redhat.com>
1839 * cfns.h: Regenerated.
1841 2020-05-17 Iain Sandoe <iain@sandoe.co.uk>
1843 * coroutines.cc (morph_fn_to_coro): Initialize the gro variable.
1845 2020-05-16 Iain Sandoe <iain@sandoe.co.uk>
1847 * coroutines.cc (finish_co_return_stmt): Implement rules
1848 from [class.copy.elision] /3.
1850 2020-05-16 Patrick Palka <ppalka@redhat.com>
1853 * semantics.c (finish_decltype_type): Call
1854 instantiate_non_dependent_expr_sfinae on the expression.
1856 2020-05-15 Patrick Palka <ppalka@redhat.com>
1860 2020-04-07 Patrick Palka <ppalka@redhat.com>
1863 * typeck2.c (process_init_constructor_array): Propagate
1864 CONSTRUCTOR_PLACEHOLDER_BOUNDARY up from each element initializer to
1865 the array initializer.
1867 2020-05-15 Jason Merrill <jason@redhat.com>
1869 PR c++/93286 - ICE with __is_constructible and variadic template.
1870 * pt.c (tsubst_tree_list): New.
1871 (tsubst, tsubst_copy_and_build): Use it.
1872 * decl2.c (is_late_template_attribute): Handle error_mark_node args.
1874 2020-05-15 Nathan Sidwell <nathan@acm.org>
1876 * pt.c (template_args_equal): Fix thinkos in previous 'cleanup'.
1878 2020-05-14 Jason Merrill <jason@redhat.com>
1881 * pt.c (maybe_instantiate_noexcept): Change clone handling.
1883 2020-05-14 Patrick Palka <ppalka@redhat.com>
1886 * call.c (build_op_call): Pass complain to lookup_fnfields.
1887 (build_special_member_call): Likewise.
1888 * class.c (type_requires_array_cookie): Pass tf_warning_or_error
1890 * cp-tree.h (lookup_fnfields): Add tsubst_flags_t parameter.
1891 * except.c (build_throw): Pass tf_warning_or_error to
1893 * init.c (build_new_1): Pass complain to lookup_fnfields.
1894 * method.c (locate_fn_flags): Likewise.
1895 * name-lookup.c (lookup_name_real_1): Pass tf_warning_or_error
1897 * pt.c (tsubst_baselink): Pass complain to lookup_fnfields.
1898 * search.c (lookup_fnfields): New 'complain' parameter. Pass it
1901 2020-05-14 Nathan Sidwell <nathan@acm.org>
1903 * parser.c (cp_parser_diagnose_invalid_typename): Mention
1904 std=c++20 not 2a, reformat dependent binfo inform loops.
1906 * pt.c (tsubst_template_decl): Reorder and commonize some control
1909 * pt.c (tsubst_friend_function): Simplify control flow.
1911 * pt.c (lookup_template_class_1): Remove unnecessary else by
1912 simply grabbing TYPE_NAME earlier.
1914 * pt.c (push_template_decl_real): Adjust friend pushing logic.
1915 Reinit template type.
1917 * pt.c (build_template_decl): Init DECL_TEMPLATE_RESULT &
1919 (process_partial_specialization): ... not here ...
1920 (push_template_decl_real, add_inherited_template_parms)
1921 (build_deduction_guide): ... or here.
1923 2020-05-14 Jakub Jelinek <jakub@redhat.com>
1925 * cp-gimplify.c (cp_genericize_r): Set cfun->has_omp_target.
1927 2020-05-13 Patrick Palka <ppalka@redhat.com>
1930 * init.c (build_vec_delete_1): Just return error_mark_node if
1931 deallocate_expr is error_mark_node.
1932 (build_delete): Just return error_mark_node if do_delete is
1935 2020-05-13 Patrick Palka <ppalka@redhat.com>
1938 * constraint.cc (tsubst_requires_expr): Produce a new
1939 requires-expression when processing_template_decl, even if
1940 template arguments are not dependent.
1942 2020-05-13 Marek Polacek <polacek@redhat.com>
1945 * decl.c (duplicate_decls): Set DECL_HAS_DEPENDENT_EXPLICIT_SPEC_P.
1947 2020-05-13 Nathan Sidwell <nathan@acm.org>
1949 * pt.c (template_args_equal): Reorder category checking for
1952 * pt.c (perform_typedefs_access_check): Cache expensively
1953 calculated object references.
1954 (check_auto_in_tmpl_args): Just assert we do not get unexpected
1955 nodes, rather than silently do nothing.
1956 (append_type_to_template_for_access): Likewise, cache expensie
1959 * pt.c (canonical_type_parameter): Simplify.
1961 Formatting fixups & some simplifications.
1962 * pt.c (spec_hash_table): New typedef.
1963 (decl_specializations, type_specializations): Use it.
1964 (retrieve_specialization): Likewise.
1965 (register_specialization): Remove unnecessary casts.
1966 (push_template_decl_real): Reformat.
1967 (instantiate_class_template_1): Use more RAII.
1968 (make_argument_pack): Simplify.
1969 (instantiate_template_1): Use gcc_checking_assert for expensive
1971 (instantiate_decl): Likewise.
1972 (resolve_typename_type): Reformat comment.
1973 * semantics.c (struct deferred_access): Remove unnecessary GTY on
1975 (begin_class_definition): Fix formatting.
1977 2020-05-13 Jason Merrill <jason@redhat.com>
1979 * call.c, class.c, constexpr.c, constraint.cc, decl.c, init.c,
1980 lambda.c, lex.c, method.c, name-lookup.c, parser.c, pt.c, tree.c,
1981 typeck2.c: Change cxx2a to cxx20.
1983 2020-05-12 Marek Polacek <polacek@redhat.com>
1986 * parser.c (cp_parser_postfix_expression) <case CPP_OPEN_PAREN>: When
1987 looking for a block-scope function declaration, look through the whole
1988 set, not just the first function in the overload set.
1990 2020-05-12 Jakub Jelinek <jakub@redhat.com>
1993 * pt.c (tsubst_decl): Deal with DECL_OMP_PRIVATIZED_MEMBER for
1996 2020-05-11 Jason Merrill <jason@redhat.com>
1998 Resolve C++20 NB comment CA104
1999 * pt.c (determine_specialization): Compare constraints for
2000 specialization of member template of class instantiation.
2002 2020-05-11 Jason Merrill <jason@redhat.com>
2006 * tree.c (cp_walk_subtrees): Stop at typedefs.
2007 Handle TYPENAME_TYPE here.
2008 * pt.c (find_parameter_packs_r): Not here.
2009 (for_each_template_parm_r): Clear *walk_subtrees.
2010 * decl2.c (min_vis_r): Look through typedefs.
2012 2020-05-11 Jason Merrill <jason@redhat.com>
2014 * call.c (implicit_conversion_error): Split out from...
2015 (perform_implicit_conversion_flags): ...here.
2016 (build_converted_constant_expr_internal): Use it.
2018 2020-05-11 Jason Merrill <jason@redhat.com>
2021 * parser.c (inject_parm_decls): Set current_class_ptr here.
2022 (cp_parser_direct_declarator): And here.
2023 (cp_parser_late_return_type_opt): Not here.
2024 (cp_parser_noexcept_specification_opt): Nor here.
2025 (cp_parser_exception_specification_opt)
2026 (cp_parser_late_noexcept_specifier): Remove unneeded parameters.
2028 2020-05-11 Jason Merrill <jason@redhat.com>
2030 * decl.c (cxx_init_decl_processing): Call declare_weak for
2033 2020-05-11 Jason Merrill <jason@redhat.com>
2035 * pt.c (instantiate_class_template_1): Call tsubst_expr for
2036 STATIC_ASSERT member.
2037 * ptree.c (cxx_print_xnode): Handle STATIC_ASSERT.
2039 2020-05-11 Jason Merrill <jason@redhat.com>
2041 * pt.c (find_parameter_packs_r) [LAMBDA_EXPR]: Remove redundant
2042 walking of capture list.
2044 2020-05-11 Jason Merrill <jason@redhat.com>
2046 * cp-tree.h (LOOKUP_EXPLICIT_TMPL_ARGS): Remove.
2047 * call.c (build_new_function_call): Don't set it.
2048 (build_new_method_call_1): Likewise.
2049 (build_over_call): Check cand->explicit_targs instead.
2051 2020-05-11 Jason Merrill <jason@redhat.com>
2053 * decl.c (compute_array_index_type_loc): Stabilize before building
2056 2020-05-11 Jason Merrill <jason@redhat.com>
2058 * decl.c (grokdeclarator): Adjust deprecated_state here.
2059 (start_decl): Not here.
2061 2020-05-08 Iain Sandoe <iain@sandoe.co.uk>
2064 * coroutines.cc (build_actor_fn): Ensure that bind scopes
2065 are marked as having side-effects where necessary.
2066 (replace_statement_captures): Likewise.
2067 (morph_fn_to_coro): Likewise.
2069 2020-05-08 Nathan Sidwell <nathan@acm.org>
2071 * NEWS: Delete, it is so stale.
2073 * parser.c (cp_lexer_set_source_position_from_token): EOF has a
2076 2020-05-07 Iain Sandoe <iain@sandoe.co.uk>
2080 * coroutines.cc (morph_fn_to_coro): Set unformed outline
2081 functions to error_mark_node. For early error returns suppress
2082 warnings about missing ramp return values. Fix reinstatement
2083 of the function body on pre-existing initial error.
2084 * decl.c (finish_function): Use the normal error path for fails
2085 in the ramp function, do not try to compile the helpers if the
2088 2020-05-07 Marek Polacek <polacek@redhat.com>
2090 PR c++/94590 - Detect long double -> double narrowing.
2091 * typeck2.c (check_narrowing): Detect long double -> double
2092 narrowing even when double and long double have the same
2093 precision. Make it handle conversions to float too.
2095 2020-05-07 Marek Polacek <polacek@redhat.com>
2098 * parser.c (cp_parser_class_specifier_1): Check that the scope is
2099 nested inside current scope before pushing it.
2101 2020-05-07 Marek Polacek <polacek@redhat.com>
2104 * typeck2.c (check_narrowing): Consider T* to bool narrowing
2107 2020-05-07 Marek Polacek <polacek@redhat.com>
2109 * decl.c (grok_op_properties): Fix spelling of non-static.
2110 * typeck.c (build_class_member_access_expr): Likewise.
2112 2020-05-07 Richard Biener <rguenther@suse.de>
2115 * optimize.c (update_cloned_parm): Copy DECL_NOT_GIMPLE_REG_P.
2117 2020-05-06 Marek Polacek <polacek@redhat.com>
2120 * pt.c (tsubst_copy_and_build): Call type_dependent_expression_p_push
2121 instead of uses_template_parms. Move the warning_sentinels after the
2124 2020-05-06 Jakub Jelinek <jakub@redhat.com>
2127 * typeck.c (cp_strict_aliasing_warning): New function.
2128 (cp_build_indirect_ref_1, build_reinterpret_cast_1): Use
2129 it instead of strict_aliasing_warning.
2132 * method.c (defaulted_late_check): Don't call synthesize_method
2133 on constexpr sfk_comparison if it has been called on it already.
2135 2020-05-06 Nathan Sidwell <nathan@acm.org>
2138 * decl.c (grokdeclarator): Don't splice template attributes in
2139 parm context -- they can apply to the parm.
2141 2020-05-05 Iain Sandoe <iain@sandoe.co.uk>
2143 * coroutines.cc: Remove references to n4849 throughout.
2145 2020-05-05 Jason Merrill <jason@redhat.com>
2148 * pt.c (more_specialized_fn): Do consider parms with no deducible
2149 template parameters.
2151 2020-05-05 Jason Merrill <jason@redhat.com>
2154 * constexpr.c (potential_constant_expression_1): In a lambda
2155 function, consider a captured variable directly.
2157 2020-05-05 Iain Sandoe <iain@sandoe.co.uk>
2159 * coroutines.cc (transform_await_wrapper): Check that we have
2160 no unlowered co_yields.
2161 (captures_temporary): Likewise.
2162 (register_awaits): Likewise.
2164 2020-05-05 Nathan Sidwell <nathan@acm.org>
2167 * coroutines.cc (morph_fn_to_coro): Just check for
2169 * pt.c (tsubst_function_decl): Update lambda fn's this_ptr name.
2171 2020-05-05 Marek Polacek <polacek@redhat.com>
2172 Jason Merrill <jason@redhat.com>
2175 * parser.c (cp_parser_postfix_dot_deref_expression): If we have
2176 a type-dependent object of class type, stash it to
2177 parser->context->object_type. If the postfix expression doesn't have
2179 (cp_parser_class_name): Consider object scope too.
2180 (cp_parser_lookup_name): Remove code dealing with the case when
2181 object_type is unknown_type_node.
2183 2020-05-04 Patrick Palka <ppalka@redhat.com>
2186 * cp-gimplify.c (cp_fold) <case CALL_EXPR>: Move some variable
2187 declarations closer to their uses. Copy the CALL_EXPR only
2188 when one of its arguments has changed.
2189 <case TREE_VEC>: Instead of first collecting the folded
2190 arguments into a releasing_vec, just make a copy of the TREE_VEC
2191 as soon as folding changes one of its arguments.
2193 2020-05-04 Iain Sandoe <iain@sandoe.co.uk>
2195 * coroutines.cc (morph_fn_to_coro): Mark the coro.gro variable
2196 as artificial and ignored.
2198 2020-05-04 Nathan Sidwell <nathan@acm.org>
2200 pt.c (process_template_parm): Don't walk the template list twice,
2201 remember the final node instead.
2202 (end_template_parm_list): Refactor. Comment on why we do a pop
2205 PR c++/94827 -- don't save parms in nested requirement
2206 * constraint.cc (tsubst_nested_requirement): TYPE directly holds
2207 notmalized requirement.
2208 (finish_nested_requirement): Don't stash current tpl parms into
2210 (diagnose_nested_requirement): TYPE directly holds notmalized
2213 2020-05-01 Patrick Palka <ppalka@redhat.com>
2216 * cp-tree.h (check_accessibility_of_qualified_id): Add
2217 tsubst_flags_t parameter and change return type to bool.
2218 * parser.c (cp_parser_lookup_name): Pass tf_warning_to_error to
2219 check_accessibility_of_qualified_id.
2220 * pt.c (tsubst_qualified_id): Return error_mark_node if
2221 check_accessibility_of_qualified_id returns false.
2222 * semantics.c (check_accessibility_of_qualified_id): Add
2223 complain parameter. Pass complain instead of
2224 tf_warning_or_error to perform_or_defer_access_check. Return
2225 true unless perform_or_defer_access_check returns false.
2227 2020-05-01 Marek Polacek <polacek@redhat.com>
2230 * typeck2.c (process_init_constructor_record): Return PICFLAG_ERRONEOUS
2231 if an initializer element was erroneous.
2233 2020-05-01 Jason Merrill <jason@redhat.com>
2236 * init.c (get_nsdmi): Don't push_to_top_level for a local class.
2238 2020-05-01 Jason Merrill <jason@redhat.com>
2241 * decl.c (cp_finish_decl): Also clear TREE_READONLY if
2242 -fmerge-all-constants.
2244 2020-05-01 Jason Merrill <jason@redhat.com>
2247 * pt.c (tsubst_decl): Make sure DECL_VALUE_EXPR continues to have
2248 the same type as the variable.
2250 2020-04-30 Jason Merrill <jason@redhat.com>
2251 Nathan Sidwell <nathan@acm.org>
2254 * constraint.cc (map_arguments): If ARGS is null, it's a
2255 self-mapping of parms.
2256 (finish_nested_requirement): Do not pass argified
2257 current_template_parms to normalization.
2258 (tsubst_nested_requirement): Don't assert no template parms.
2260 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
2263 * coroutines.cc (transform_local_var_uses): Defer walking
2264 the DECL_INITIALs of BIND_EXPR vars until all the frame
2265 allocations have been made.
2267 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
2270 * coroutines.cc (register_awaits): Update target
2271 expressions for awaitable and suspend handle
2274 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
2277 * coroutines.cc (build_co_await): Account for variables
2278 with DECL_VALUE_EXPRs.
2279 (captures_temporary): Likewise.
2280 (register_awaits): Likewise.
2282 2020-04-29 Patrick Palka <ppalka@redhat.com>
2285 * pt.c (find_template_parameter_info::parm_list): New field.
2286 (keep_template_parm): Use the new field to build up the
2287 parameter list here instead of ...
2288 (find_template_parameters): ... here. Return ftpi.parm_list.
2290 2020-04-29 Jakub Jelinek <jakub@redhat.com>
2293 * class.c (build_base_field): Set DECL_FIELD_ABI_IGNORED on C++17 empty
2294 base artificial FIELD_DECLs.
2295 (layout_class_type): Set DECL_FIELD_ABI_IGNORED on empty class
2296 field_poverlapping_p FIELD_DECLs.
2298 2020-04-29 Patrick Palka <ppalka@redhat.com>
2301 * constraint.cc (satisfy_declaration_constraints): Use saved_t
2302 instead of t as the key to decl_satisfied_cache.
2305 * error.c (print_requires_expression_info): Print the dependent
2306 form of the parameter list with its template parameter mapping,
2307 rather than printing the substituted form.
2309 2020-04-28 Jason Merrill <jason@redhat.com>
2312 * decl.c (use_eh_spec_block): Check nothrow type after
2314 * pt.c (maybe_instantiate_noexcept): Call synthesize_method for
2315 DECL_MAYBE_DELETED fns here.
2316 * decl2.c (mark_used): Not here.
2317 * method.c (get_defaulted_eh_spec): Reject DECL_MAYBE_DELETED here.
2319 2020-04-28 Iain Sandoe <iain@sandoe.co.uk>
2322 * coroutines.cc (instantiate_coro_traits): Pass a reference to
2323 object type rather than a pointer type for 'this', for method
2325 (struct param_info): Add a field to hold that the parm is a lambda
2327 (morph_fn_to_coro): Check for lambda closure pointers in the
2328 args. Use a reference to *this when building the args list for the
2329 promise allocator lookup.
2331 2020-04-28 Iain Sandoe <iain@sandoe.co.uk>
2334 * coroutines.cc (coro_promise_type_found_p): Do not
2335 exclude non-classes here (this needs to be handled in the
2337 (morph_fn_to_coro): Allow for the case where the coroutine
2340 2020-04-27 Iain Sandoe <iain@sandoe.co.uk>
2343 * coroutines.cc (struct local_var_info): Add fields for static
2344 variables and those with DECL_VALUE_EXPR redirection.
2345 (transform_local_var_uses): Skip past typedefs and static vars
2346 and then account for redirected variables.
2347 (register_local_var_uses): Likewise.
2349 2020-04-27 Jason Merrill <jason@redhat.com>
2353 * decl.c (grokdeclarator): Move dependent attribute to decl.
2354 * decl2.c (splice_template_attributes): No longer static.
2356 2020-04-27 Patrick Palka <ppalka@redhat.com>
2359 * constexpr.c (cxx_eval_call_expression): Don't set new_obj if we're
2360 evaluating the target constructor of a delegating constructor.
2361 (cxx_eval_store_expression): Don't set TREE_READONLY if the LHS of the
2362 INIT_EXPR is '*this'.
2364 2020-04-26 Marek Polacek <polacek@redhat.com>
2367 * call.c (struct conversion): Add copy_init_p.
2368 (standard_conversion): Set copy_init_p in ck_base and ck_rvalue
2369 if FLAGS demands LOOKUP_ONLYCONVERTING.
2370 (convert_like_real) <case ck_base>: If copy_init_p is set, or
2371 LOOKUP_ONLYCONVERTING into FLAGS.
2373 2020-04-26 Iain Sandoe <iain@sandoe.co.uk>
2376 * coroutines.cc (morph_fn_to_coro): Ensure that
2377 unnamed function params have a usable and distinct
2380 2020-04-24 Jason Merrill <jason@redhat.com>
2383 * decl.c (redeclaration_error_message): Reject defaulted comparison
2384 operator that has been previously declared.
2386 2020-04-25 Patrick Palka <ppalka@redhat.com>
2388 * parser.c (cp_parser_diagnose_invalid_type_name): Suggest enabling
2389 concepts if the invalid identifier is 'requires'.
2391 2020-04-25 Jakub Jelinek <jakub@redhat.com>
2394 * semantics.c (finish_call_expr): When looking if all overloads
2395 are noreturn, use STRIP_TEMPLATE to look through TEMPLATE_DECLs.
2397 2020-04-24 Martin Liska <mliska@suse.cz>
2399 * coroutines.cc: Fix compilation error for release checking
2400 where we miss declaration of ‘coro_body_contains_bind_expr_p’.
2402 2020-04-23 Patrick Palka <ppalka@redhat.com>
2404 * tree.c (zero_init_expr_p): Use uses_template_parms instead of
2408 * pt.c (template_class_depth): Walk into the DECL_FRIEND_CONTEXT of a
2409 friend declaration rather than into its CP_DECL_CONTEXT.
2411 2020-04-23 Iain Sandoe <iain@sandoe.co.uk>
2414 * coroutines.cc (await_statement_expander): Simplify cases.
2415 (struct susp_frame_data): Add fields for truth and/or if
2416 cases, rename one field.
2417 (analyze_expression_awaits): New.
2418 (expand_one_truth_if): New.
2419 (add_var_to_bind): New helper.
2420 (coro_build_add_if_not_cond_break): New helper.
2421 (await_statement_walker): Handle conditional expressions,
2422 handle expansion of truth-and/or-if cases.
2423 (bind_expr_find_in_subtree): New, checking-only.
2424 (coro_body_contains_bind_expr_p): New, checking-only.
2425 (morph_fn_to_coro): Ensure that we have a top level bind
2428 2020-04-22 Jonathan Wakely <jwakely@redhat.com>
2430 PR translation/94698
2431 * class.c (check_field_decls): Change "define" to "declare" in
2432 -Weffc++ diagnostics.
2434 2020-04-22 Patrick Palka <ppalka@redhat.com>
2438 * constraint.cc (satisfy_declaration_constraints): If the inherited
2439 constructor points to an instantiation of a constructor template,
2440 remember and use its attached template arguments.
2442 2020-04-22 Jonathan Wakely <jwakely@redhat.com>
2444 PR translation/94698
2445 * class.c (check_field_decls): Change "override" to "define" in
2446 -Weffc++ diagnostics.
2448 2020-04-22 Iain Sandoe <iain@sandoe.co.uk>
2451 * coroutines.cc (struct param_info): Add a field to note that
2452 the param is 'this'.
2453 (morph_fn_to_coro): Convert this to a reference before using it
2454 in the promise parameter preview.
2456 2020-04-22 Jason Merrill <jason@redhat.com>
2459 * pt.c (register_parameter_specializations): If the instantiation is
2460 still a parameter pack, don't wrap it in a NONTYPE_ARGUMENT_PACK.
2461 (tsubst_pack_expansion, tsubst_expr): Adjust.
2463 2020-04-22 Martin Sebor <msebor@redhat.com>
2464 Jason Merrill <jason@redhat.com>
2467 * decl.c (reshape_init_array_1): Avoid stripping redundant trailing
2468 zero initializers...
2469 * mangle.c (write_expression): ...and handle them here even for
2470 pointers to members by calling zero_init_expr_p.
2471 * cp-tree.h (zero_init_expr_p): Declare.
2472 * tree.c (zero_init_expr_p): Define.
2473 (type_initializer_zero_p): Remove.
2474 * pt.c (tparm_obj_values): New hash_map.
2475 (get_template_parm_object): Store to it.
2476 (tparm_object_argument): New.
2478 2020-04-22 Patrick Palka <ppalka@redhat.com>
2481 * constraint.cc (diagnose_valid_expression): Check convert_to_void here
2482 as well as in tsubst_valid_expression_requirement.
2484 2020-04-21 Patrick Palka <ppalka@redhat.com>
2487 * constraint.cc (satisfy_declaration_constraints): Don't strip the
2488 inherited constructor if it already has template information.
2491 * pt.c (any_template_parm_r) <case IDENTIFIER_NODE>: New case. If this
2492 is a conversion operator, visit its TREE_TYPE.
2494 2020-04-21 Nathan Sidwell <nathan@acm.org>
2496 * pt.c (tsubst_copy_and_build) [POINTER_PLUS_EXPR]: Check for
2499 2020-04-21 Iain Sandoe <iain@sandoe.co.uk>
2502 * coroutines.cc (morph_fn_to_coro): Simplify return
2505 2020-04-17 Marek Polacek <polacek@redhat.com>
2508 * constexpr.c (cxx_eval_outermost_constant_expr): Return when T is
2509 a BRACE_ENCLOSED_INITIALIZER_P.
2510 (is_nondependent_constant_expression): Don't check
2511 BRACE_ENCLOSED_INITIALIZER_P.
2512 (is_nondependent_static_init_expression): Likewise.
2514 2020-04-20 Patrick Palka <ppalka@redhat.com>
2517 * cp-tree.h (lss_policy::lss_nop): New enumerator.
2518 * pt.c (local_specialization_stack::local_specialization_stack): Handle
2520 (local_specialization_stack::~local_specialization_stack): Likewise.
2521 (tsubst_pack_expansion): Use a local_specialization_stack instead of
2522 manually saving and restoring local_specializations. Conditionally
2523 replace local_specializations sooner, before the handling of the
2524 unsubstituted_packs case.
2526 2020-04-20 Marek Polacek <polacek@redhat.com>
2528 PR c++/94505 - bogus -Wparentheses warning with fold-expression.
2529 * pt.c (fold_expression): Add warning_sentinel for -Wparentheses
2530 before calling build_x_binary_op.
2532 2020-04-20 Marek Polacek <polacek@redhat.com>
2534 * coroutines.cc (captures_temporary): Don't assign the result of
2535 STRIP_NOPS to the same variable.
2537 2020-04-20 Nathan Sidwell <nathan@acm.org>
2539 PR c++/94454 - tpl-tpl-parms are not canonicalizable types
2540 * pt.c (canonical_type_parameter): Assert not a tpl-tpl-parm.
2541 (process_template_parm): tpl-tpl-parms are structural.
2542 (rewrite_template_parm): Propagate structuralness.
2544 PR c++/94454 - Expr pack expansion equality
2545 * tree.c (cp_tree_equal) [TEMPLATE_ID_EXPR, default]: Refactor.
2546 [EXPR_PACK_EXPANSION]: Add.
2548 PR c++/94454 Template Argument Hashing
2549 * pt.c (iterative_hash_template_arg): Strip nodes as
2550 template_args_equal does.
2551 [ARGUMENT_PACK_SELECT, TREE_VEC, CONSTRUCTOR]: Refactor.
2552 [node_class:TEMPLATE_TEMPLATE_PARM]: Hash by level & index.
2553 [node_class:default]: Refactor.
2555 2020-04-18 Patrick Palka <ppalka@redhat.com>
2558 * tree.c (cp_tree_equal) <case PARM_DECL>: Ignore
2559 comparing_specializations if the parameters' contexts are identical.
2562 * pt.c (splice_late_return_type): Propagate cv-qualifiers and
2563 PLACEHOLDER_TYPE_CONSTRAINTS from the original auto node to the new one.
2565 2020-04-17 Patrick Palka <ppalka@redhat.com>
2568 * lambda.c (lambda_capture_field_type): Avoid doing auto deduction if
2569 the explicit initializer has parameter packs.
2572 * parser.c (cp_parser_check_template_parameters): Before issuing a hard
2573 error, first try simulating an error instead.
2575 2020-04-17 Jakub Jelinek <jakub@redhat.com>
2578 * call.c (build_conditional_expr_1): Remove redundant assignment to
2581 2020-04-16 Patrick Palka <ppalka@redhat.com>
2584 * cvt.c (ocp_convert): If the result of scalar_constant_value is
2585 erroneous, ignore it and use the original expression.
2587 2020-04-16 Jakub Jelinek <jakub@redhat.com>
2590 * parser.c (cp_parser_simple_declaration): Fix up a pasto in
2593 2020-04-15 Jakub Jelinek <jakub@redhat.com>
2596 * parser.c (cp_parser_pragma) <case PRAGMA_OMP_REQUIRES>: Reject
2597 requires directive when not at file or namespace scope.
2599 2020-04-14 Iain Sandoe <iain@sandoe.co.uk>
2602 * coroutines.cc (build_actor_fn): Check that the target can
2603 support the resume tailcall before mandating it.
2605 2020-04-14 Patrick Palka <ppalka@redhat.com>
2608 * cxx-pretty-print.c (cxx_pretty_printer:simple_type_specifier)
2609 <case DECLTYPE_TYPE>: Handle DECLTYPE_TYPE here instead of ...
2610 (pp_cxx_type_specifier_seq) <case DECLTYPE_TYPE>: ... here.
2611 (cxx_pretty_printer::direct_abstract_declarator) <case DECLTYPE_TYPE>:
2615 * constexpr.c (replace_result_decl_data): New struct.
2616 (replace_result_decl_data_r): New function.
2617 (replace_result_decl): New function.
2618 (cxx_eval_call_expression): Use it.
2619 * tree.c (build_aggr_init_expr): Set the location of the AGGR_INIT_EXPR
2620 to that of its initializer.
2622 2020-04-13 Marek Polacek <polacek@redhat.com>
2625 * name-lookup.c (check_local_shadow): Add an inform call.
2627 2020-04-13 Patrick Palka <ppalka@redhat.com>
2630 * error.c (dump_scope): Pass TFF_NO_FUNCTION_ARGUMENTS to
2631 dump_function_decl when printing a function template instantiation as a
2635 * constexpr.c (get_or_insert_ctor_field): Set default value of parameter
2637 (cxx_eval_bare_aggregate): Use get_or_insert_ctor_field instead of
2638 assuming the the next index belongs at the end of the new CONSTRUCTOR.
2639 (cxx_eval_store_expression): Revert PR c++/78572 fix.
2641 2020-04-13 Nathan Sidwell <nathan@acm.org>
2643 PR c++/94426 lambdas with internal linkage are different to no-linkage
2644 * decl2.c (determine_visibility): A lambda's visibility is
2645 affected by its extra scope.
2646 * pt.c (instantiate_decl): Determine var's visibility before
2647 instantiating its initializer.
2648 * tree.c (no_linkage_check): Revert code looking at visibility of
2649 lambda's extra scope.
2651 2020-04-10 Iain Sandoe <iain@sandoe.co.uk>
2654 * coroutines.cc (co_await_expander): Remove.
2655 (expand_one_await_expression): New.
2656 (process_one_statement): New.
2657 (await_statement_expander): New.
2658 (build_actor_fn): Revise to use per-statement expander.
2659 (struct susp_frame_data): Reorder and comment.
2660 (register_awaits): Factor code.
2661 (replace_statement_captures): New, factored from...
2662 (maybe_promote_captured_temps):.. here.
2663 (await_statement_walker): Revise to process per statement.
2664 (morph_fn_to_coro): Use revised susp_frame_data layout.
2666 2020-04-10 Marek Polacek <polacek@redhat.com>
2669 * method.c (constructible_expr): In C++20, try using parenthesized
2670 initialization of aggregates to determine the result of
2673 2020-04-10 Bin Cheng <bin.cheng@linux.alibaba.com>
2675 * coroutines.cc (co_await_expander): Simplify.
2677 2020-04-09 Jason Merrill <jason@redhat.com>
2680 * constexpr.c (cxx_eval_constant_expression) [VAR_DECL]: Look at
2681 ctx->object and ctx->global->values first.
2683 2020-04-09 Marek Polacek <polacek@redhat.com>
2686 * call.c (initialize_reference): If the reference binding failed, maybe
2687 try initializing from { }.
2688 * decl.c (grok_reference_init): For T& t(e), set
2689 LOOKUP_AGGREGATE_PAREN_INIT but don't build up a constructor yet.
2691 2020-04-08 Iain Sandoe <iain@sandoe.co.uk>
2692 Jun Ma <JunMa@linux.alibaba.com>
2694 * coroutines.cc (maybe_promote_captured_temps): Add a cleanup
2695 expression, if needed, to any call from which we promoted
2696 temporaries captured by reference.
2698 2020-04-08 Marek Polacek <polacek@redhat.com>
2700 PR c++/94507 - ICE-on-invalid with lambda template.
2701 * pt.c (tsubst_lambda_expr): Cope when tsubst_template_decl or
2702 tsubst_function_decl returns error_mark_node.
2704 2020-04-08 Martin Liska <mliska@suse.cz>
2707 * decl.c (duplicate_decls): Duplicate also DECL_IS_REPLACEABLE_OPERATOR.
2708 (cxx_init_decl_processing): Mark replaceable all implicitly defined
2711 2020-04-08 Patrick Palka <ppalka@redhat.com>
2713 Core issues 1001 and 1322
2715 * pt.c (rebuild_function_or_method_type): Split function out from ...
2716 (tsubst_function_type): ... here.
2717 (maybe_rebuild_function_decl_type): New function.
2718 (tsubst_function_decl): Use it.
2720 2020-04-08 Jakub Jelinek <jakub@redhat.com>
2723 * decl.c (begin_destructor_body): For CLASSTYPE_VBASECLASSES class
2724 dtors, if CLASSTYPE_PRIMARY_BINFO is non-NULL, but not BINFO_VIRTUAL_P,
2725 look at CLASSTYPE_PRIMARY_BINFO of its BINFO_TYPE if it is not
2726 BINFO_VIRTUAL_P, and so on.
2728 2020-04-08 Marek Polacek <polacek@redhat.com>
2730 PR c++/94478 - ICE with defaulted comparison operator
2731 * method.c (early_check_defaulted_comparison): Give an error when the
2734 2020-04-08 Tobias Burnus <tobias@codesourcery.com>
2737 * paser.c (cp_parser_oacc_declare): Add check that variables
2738 are declared in the same scope as the directive.
2740 2020-04-07 Jason Merrill <jason@redhat.com>
2743 * parser.c (cp_parser_requires_expression): Use tentative_firewall.
2746 * parser.c (cp_parser_placeholder_type_specifier): Use
2749 2020-04-07 Iain Sandoe <iain@sandoe.co.uk>
2751 * coroutines.cc (maybe_promote_captured_temps): Ensure that
2752 reference capture placeholder vars are properly declared.
2754 2020-04-07 Patrick Palka <ppalka@redhat.com>
2757 * tree.c (replace_placeholders): Look through all handled components,
2758 not just COMPONENT_REFs.
2759 * typeck2.c (process_init_constructor_array): Propagate
2760 CONSTRUCTOR_PLACEHOLDER_BOUNDARY up from each element initializer to
2761 the array initializer.
2763 2020-04-07 Jakub Jelinek <jakub@redhat.com>
2766 * parser.c (cp_parser_omp_parallel): Set OMP_PARALLEL_COMBINED
2767 if cp_parser_omp_master succeeded.
2769 2020-04-06 Jason Merrill <jason@redhat.com>
2772 * decl.c (duplicate_decls): Fix handling of DECL_HIDDEN_FRIEND_P.
2774 2020-04-04 Marek Polacek <polacek@redhat.com>
2775 Jason Merrill <jason@redhat.com>
2777 PR c++/94155 - crash in gimplifier with paren init of aggregates.
2778 * init.c (build_vec_init): Fill in indexes.
2780 2020-04-04 Jason Merrill <jason@redhat.com>
2783 * mangle.c (write_expression): Skip IMPLICIT_CONV_EXPR.
2785 2020-04-04 Patrick Palka <ppalka@redhat.com>
2789 * constexpr.c (struct constexpr_ctx): New field 'parent'.
2790 (cxx_eval_bare_aggregate): Propagate CONSTRUCTOR_PLACEHOLDER_BOUNDARY
2791 flag from the original constructor to the reduced constructor.
2792 (lookup_placeholder): Prefer to return the outermost matching object
2793 by recursively calling lookup_placeholder on the 'parent' context,
2794 but don't cross CONSTRUCTOR_PLACEHOLDER_BOUNDARY constructors.
2795 (cxx_eval_constant_expression): Link the 'ctx' context to the 'new_ctx'
2796 context via 'new_ctx.parent' when being expanded without an explicit
2797 target. Don't call replace_placeholders.
2798 (cxx_eval_outermost_constant_expr): Initialize 'ctx.parent' to NULL.
2802 * constexpr.c (get_or_insert_ctor_field): Split out (while adding
2803 support for VECTOR_TYPEs, and optimizations for the common case)
2805 (cxx_eval_store_expression): ... here. Rename local variable
2806 'changed_active_union_member_p' to 'activated_union_member_p'. Record
2807 the sequence of indexes into 'indexes' that yields the subobject we're
2808 assigning to. Record the integer offsets of the constructor indexes
2809 we're assigning through into 'index_pos_hints'. After evaluating the
2810 initializer of the store expression, recompute 'valp' using 'indexes'
2811 and using 'index_pos_hints' as hints.
2812 (cxx_eval_bare_aggregate): Tweak comments. Use get_or_insert_ctor_field
2813 to recompute the constructor_elt pointer we're assigning through after
2814 evaluating each initializer.
2816 2020-04-04 Jason Merrill <jason@redhat.com>
2819 * constraint.cc (tsubst_valid_expression_requirement): Call
2822 2020-04-04 Jason Merrill <jason@redhat.com>
2825 * constexpr.c (maybe_constant_value): Use break_out_target_exprs.
2826 * expr.c (mark_use) [VIEW_CONVERT_EXPR]: Don't wrap a TARGET_EXPR in
2829 2020-04-04 Jakub Jelinek <jakub@redhat.com>
2832 * parser.c (cp_parser_omp_for_loop): Use
2833 protected_set_expr_location_if_unset.
2834 * cp-gimplify.c (genericize_if_stmt, genericize_cp_loop): Likewise.
2837 * pt.c (tsubst_expr) <case OMP_MASTER>: Clear
2838 omp_parallel_combined_clauses.
2840 2020-04-03 Jason Merrill <jason@redhat.com>
2843 * pt.c (complex_pack_expansion_r): New.
2844 (complex_alias_template_p): Use it.
2846 2020-03-31 Jason Merrill <jason@redhat.com>
2849 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Call
2850 replace_placeholders.
2851 * typeck2.c (store_init_value): Fix arguments to
2852 fold_non_dependent_expr.
2854 2020-03-31 Jason Merrill <jason@redhat.com>
2856 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Use
2859 2020-03-30 Jason Merrill <jason@redhat.com>
2862 * tree.c (cp_tree_equal) [CALL_EXPR]: Compare KOENIG_LOOKUP_P.
2863 (called_fns_equal): Check DECL_CONTEXT.
2865 2020-03-30 Jakub Jelinek <jakub@redhat.com>
2868 * semantics.c (add_stmt): Only set STMT_IS_FULL_EXPR_P on trees with
2869 STATEMENT_CODE_P code.
2871 2020-03-28 Patrick Palka <ppalka@redhat.com>
2874 * parser.c (cp_parser_requires_clause_opt): Diagnose and recover from
2875 "requires {" when "requires requires {" was probably intended.
2878 * constraint.cc (tsubst_compound_requirement): Always suppress errors
2879 from type_deducible_p and expression_convertible_p, as they're not
2880 substitution errors.
2881 (diagnose_atomic_constraint) <case INTEGER_CST>: Remove this case so
2882 that we diagnose INTEGER_CST expressions of non-bool type via the
2884 * cp-gimplify.c (cp_genericize_r) <case REQUIRES_EXPR>: New case.
2885 * parser.c (cp_parser_requires_expression): Always parse the requirement
2886 body as if we're processing a template, by temporarily incrementing
2887 processing_template_decl. Afterwards, if we're not actually in a
2888 template context, perform semantic processing to diagnose any invalid
2889 types and expressions.
2890 * pt.c (tsubst_copy_and_build) <case REQUIRES_EXPR>: Remove dead code.
2891 * semantics.c (finish_static_assert): Explain an assertion failure
2892 when the condition is a REQUIRES_EXPR like we do when it is a concept
2895 * constraint.cc (diagnose_compound_requirement): When diagnosing a
2896 compound requirement, maybe replay the satisfaction failure, subject to
2897 the current diagnosis depth.
2899 * constraint.cc (finish_constraint_binary_op): Set the location of EXPR
2900 as well as its range, because build_x_binary_op doesn't always do so.
2901 (current_constraint_diagnosis_depth): New.
2902 (concepts_diagnostics_max_depth_exceeded_p): New.
2903 (collect_operands_of_disjunction): New.
2904 (satisfy_disjunction): When diagnosing a satisfaction failure, maybe
2905 replay each branch of the disjunction, subject to the current diagnosis
2907 (diagnose_valid_expression): When diagnosing a satisfaction failure,
2908 maybe replay the substitution error, subject to the current diagnosis
2910 (diagnose_valid_type): Likewise.
2911 (diagnose_nested_requiremnet): Likewise.
2912 (diagnosing_failed_constraint::diagnosing_failed_constraint): Increment
2913 current_constraint_diagnosis_depth when diagnosing.
2914 (diagnosing_failed_constraint::~diagnosing_failed_constraint): Decrement
2915 current_constraint_diagnosis_depth when diagnosing.
2916 (diagnosing_failed_constraint::replay_errors_p): New static member
2918 (diagnose_constraints): Don't diagnose if concepts_diagnostics_max_depth
2919 is 0. Emit a one-off note to increase -fconcepts-diagnostics-depth if
2920 the limit was exceeded.
2921 * cp-tree.h (diagnosing_failed_constraint::replay_errors_p): Declare.
2923 2020-03-27 Nathan Sidwell <nathan@acm.org>
2926 * name-lookup.c (do_pushdecl): Look through cleanp levels.
2928 2020-03-27 Martin Sebor <msebor@redhat.com>
2933 * cp-tree.h (most_specialized_partial_spec): Declare.
2934 * parser.c (cp_parser_elaborated_type_specifier): Distinguish alias
2936 (specialization_of): New function.
2937 (cp_parser_check_class_key): Move code...
2938 (class_decl_loc_t::add): ...to here. Add parameters. Avoid issuing
2939 -Wredundant-tags on first-time declarations in other declarators.
2940 Correct handling of template specializations.
2941 (class_decl_loc_t::diag_mismatched_tags): Also expect to be called
2942 when -Wredundant-tags is enabled. Use primary template or partial
2943 specialization as the guide for uses of implicit instantiations.
2944 * pt.c (most_specialized_partial_spec): Declare extern.
2946 2020-03-27 Nathan Sidwell <nathan@acm.org>
2949 * name-lookup.c (push_namespace): Triage ambiguous lookups that
2952 2020-03-27 Jakub Jelinek <jakub@redhat.com>
2955 * call.c (set_flags_from_callee): Don't update
2956 cp_function_chain->can_throw or current_function_returns_abnormally
2957 if cp_unevaluated_operand.
2960 * cvt.c (ocp_convert): Handle COMPOUND_EXPR by recursion on the second
2961 operand and creating a new COMPOUND_EXPR if anything changed.
2963 2020-03-26 Marek Polacek <polacek@redhat.com>
2965 PR c++/94336 - template keyword accepted before destructor names.
2966 * parser.c (cp_parser_unqualified_id): Give an error when 'template'
2967 is followed by a destructor name.
2969 2020-03-27 Patrick Palka <ppalka@redhat.com>
2971 * decl.c (compute_array_index_type_loc): Remove redundant
2972 type_dependent_expression_p check that is subsumed by
2973 value_dependent_expression_p.
2974 * decl2.c (is_late_template_attribute): Likewise.
2975 * pt.c (uses_template_parms): Likewise.
2976 (dependent_template_arg_p): Likewise.
2978 2020-03-26 Marek Polacek <polacek@redhat.com>
2981 PR c++/94057 - template keyword in a typename-specifier.
2982 * parser.c (check_template_keyword_in_nested_name_spec): New.
2983 (cp_parser_nested_name_specifier_opt): Implement DR1710, optional
2984 'template'. Call check_template_keyword_in_nested_name_spec.
2985 (cp_parser_simple_type_specifier): Assume that a <
2986 following a qualified-id in a typename-specifier begins
2987 a template argument list.
2989 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
2991 * coroutines.cc (coro_init_identifiers): Initialize an identifier
2992 for the cororoutine handle 'address' method name.
2993 (struct coro_aw_data): Add fields to cover the continuations.
2994 (co_await_expander): Determine the kind of await_suspend in use.
2995 If we have the case that returns a continuation handle, then save
2996 this and make the target for 'scope exit without cleanup' be the
2997 continuation resume label.
2998 (expand_co_awaits): Remove.
2999 (struct suspend_point_info): Remove fields that kept the returned
3000 await_suspend handle type.
3001 (transform_await_expr): Remove code tracking continuation handles.
3002 (build_actor_fn): Add the continuation handle as an actor-function
3003 scope var. Build the symmetric transfer continuation point. Call
3004 the tree walk for co_await expansion directly, rather than via a
3005 trivial shim function.
3006 (register_await_info): Remove fields tracking continuation handles.
3007 (get_await_suspend_return_type): Remove.
3008 (register_awaits): Remove code tracking continuation handles.
3009 (morph_fn_to_coro): Remove code tracking continuation handles.
3011 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
3013 * coroutines.cc (co_await_expander): If we are expanding the
3014 initial await expression, set a boolean flag to show that we
3015 have now reached the initial await_resume() method call.
3016 (expand_co_awaits): Handle the 'initial await resume called' flag.
3017 (build_actor_fn): Insert the initial await expression into the
3018 start of the user-authored function-body. Handle the 'initial await
3019 resume called' flag.
3020 (morph_fn_to_coro): Initialise the 'initial await resume called'
3021 flag. Modify the unhandled exception catch clause to recognise
3022 exceptions that occur before the initial await_resume() and re-
3025 2020-03-26 Jakub Jelinek <jakub@redhat.com>
3028 * class.c (user_provided_p): Use STRIP_TEMPLATE instead of returning
3029 true for all TEMPLATE_DECLs.
3032 * cp-gimplify.c (cp_genericize_r): Handle STATEMENT_LIST.
3034 2020-03-25 Patrick Palka <ppalka@redhat.com>
3037 * parser.c (cp_parser_selection_statement) <case RID_IF>: Invalidate the
3038 current condition chain when the if-statement has a non-empty
3041 2020-03-25 Iain Sandoe <iain@sandoe.co.uk>
3044 * coroutines.cc (captures_temporary): Fix a missing dereference.
3046 2020-03-24 Marek Polacek <polacek@redhat.com>
3048 PR c++/94190 - wrong no post-decrement operator error in template.
3049 * call.c (convert_like_real): Use convert_from_reference on the result.
3051 2020-03-24 Jason Merrill <jason@redhat.com>
3054 * constraint.cc (constraint_satisfaction_value): Repeat noisily on
3056 (tsubst_nested_requirement): Likewise.
3057 (get_constraint_error_location): Allow missing context.
3058 (diagnose_atomic_constraint): Diagnose non-bool constraint here.
3059 (satisfy_atom): Not here. Only diagnose non-constant when noisy.
3061 2020-03-24 Jason Merrill <jason@redhat.com>
3063 * pt.c (any_template_parm_r): Look into the type of a non-type
3066 2020-03-24 Jason Merrill <jason@redhat.com>
3068 * cp-tree.h (cp_expr): When constructing from an expr and a
3069 location, call protected_set_expr_location.
3071 2020-03-23 Patrick Palka <ppalka@redhat.com>
3074 * except.c (maybe_noexcept_warning): Add TODO.
3075 * method.c (walk_field_subobs): Pass tf_none to expr_noexcept_p.
3077 2020-03-23 nathans <nathan@acm.org>
3080 * tree.c (cp_tree_equal) [SIZEOF_EXPR]: Detect argument pack
3083 2020-03-21 Patrick Palka <ppalka@redhat.com>
3086 * constexpr.c (reduced_constant_expression_p) [CONSTRUCTOR]: Properly
3087 handle unions without an initializer.
3088 (cxx_eval_component_reference): Emit a different diagnostic when the
3089 constructor element corresponding to a union member is NULL.
3090 (cxx_eval_bare_aggregate): When constructing a union, always set the
3091 active union member before evaluating the initializer. Relax assertion
3092 that verifies the index of the constructor element we're initializing
3093 hasn't been changed.
3094 (cxx_eval_store_expression): Diagnose changing the active union member
3095 while the union is in the process of being initialized. After setting
3096 an active union member, clear CONSTRUCTOR_NO_CLEARING on the underlying
3098 (cxx_eval_constant_expression) [PLACEHOLDER_EXPR]: Don't re-reduce a
3099 CONSTRUCTOR returned by lookup_placeholder.
3101 2020-03-20 Patrick Palka <ppalka@redhat.com>
3103 * cxx-pretty-print.c (pp_cxx_parameter_mapping): Make extern. Move
3104 the "[with ]" bits to here from ...
3105 (pp_cxx_atomic_constraint): ... here.
3106 * cxx-pretty-print.h (pp_cxx_parameter_mapping): Declare.
3107 * error.c (rebuild_concept_check): Delete.
3108 (print_concept_check_info): Print the dependent form of the constraint and the
3109 preferably substituted parameter mapping alongside it.
3111 2020-03-19 Jason Merrill <jason@redhat.com>
3114 * cp-gimplify.c (simple_empty_class_p): Look through
3115 SIMPLE_TARGET_EXPR_P.
3116 (cp_gimplify_expr) [MODIFY_EXPR]: Likewise.
3117 [RETURN_EXPR]: Avoid producing 'return *retval;'.
3118 * call.c (build_call_a): Strip TARGET_EXPR from empty class arg.
3119 * cp-tree.h (SIMPLE_TARGET_EXPR_P): Check that TARGET_EXPR_INITIAL
3122 2020-03-19 Jakub Jelinek <jakub@redhat.com>
3125 * parser.c (cp_parser_omp_var_list_no_open): Call process_outer_var_ref
3126 on outer_automatic_var_p decls.
3127 * cp-gimplify.c (cxx_omp_disregard_value_expr): Return true also for
3128 capture proxy decls.
3130 2020-03-18 Nathan Sidwell <nathan@acm.org>
3132 PR c++/94147 - mangling of lambdas assigned to globals
3133 * parser.c (cp_parser_init_declarator): Namespace-scope variables
3134 provide a lambda scope.
3135 * tree.c (no_linkage_check): Lambdas with a variable for extra
3136 scope have a linkage from the variable.
3138 2020-03-18 Jakub Jelinek <jakub@redhat.com>
3140 * constraint.cc (resolve_function_concept_check, subsumes_constraints,
3141 strictly_subsumes): Fix up duplicated word issue in a comment.
3142 * coroutines.cc (build_init_or_final_await, captures_temporary):
3144 * logic.cc (dnf_size_r, cnf_size_r): Likewise.
3145 * pt.c (append_type_to_template_for_access_check): Likewise.
3148 * decl.c (grokfndecl): Restore old diagnostics about deduction
3149 guide declared in different scope if in_namespace is NULL_TREE.
3151 2020-03-17 Jakub Jelinek <jakub@redhat.com>
3154 * parser.c (cp_parser_enum_specifier): Use temp_override for
3155 parser->colon_corrects_to_scope_p, replace goto out with return.
3156 If scoped enum or enum with underlying type is not followed by
3157 { or ;, call cp_parser_commit_to_tentative_parse before calling
3158 cp_parser_error and make sure to return error_mark_node instead of
3159 NULL_TREE. Formatting fixes.
3161 2020-03-17 Ville Voutilainen <ville.voutilainen@gmail.com>
3164 * method.c (assignable_expr): Use cp_unevaluated.
3165 (is_xible_helper): Push a non-deferred access check for
3166 the stub objects created by assignable_expr and constructible_expr.
3168 2020-03-17 Jakub Jelinek <jakub@redhat.com>
3170 * pt.c (tsubst): Fix up duplicated word issue in a diagnostic message.
3171 (lookup_template_class_1, tsubst_expr): Fix up duplicated word issue
3173 * parser.c (cp_parser_statement, cp_parser_linkage_specification,
3174 cp_parser_placeholder_type_specifier,
3175 cp_parser_constraint_requires_parens): Likewise.
3176 * name-lookup.c (suggest_alternative_in_explicit_scope): Likewise.
3178 2020-03-15 Iain Sandoe <iain@sandoe.co.uk>
3180 * coroutines.cc (co_await_expander): Fix indentation.
3182 2020-03-14 Jason Merrill <jason@redhat.com>
3185 * pt.c (process_partial_specialization): Error rather than crash on
3186 extra pack expansion.
3188 2020-03-14 Jason Merrill <jason@redhat.com>
3191 * pt.c (find_parameter_packs_r): [DECL_EXPR]: Walk
3192 DECL_ORIGINAL_TYPE of a typedef.
3194 2020-03-14 Jason Merrill <jason@redhat.com>
3197 * pt.c (build_deduction_guide): Clear cp_unevaluated_operand for
3198 substituting DECL_ARGUMENTS.
3200 2020-03-14 Jakub Jelinek <jakub@redhat.com>
3202 * logic.cc (formula::formula): Change "a an" to "an" in a comment.
3203 * parser.c (cp_debug_parser): Change "a an" to "an" in a string
3206 2020-03-13 Patrick Palka <ppalka@redhat.com>
3209 * call.c (build_over_call): Use a warning_sentinel to disable
3210 warn_deprecated_decl before calling build_addr_func.
3212 2020-03-12 Jakub Jelinek <jakub@redhat.com>
3215 * decl.c (reshape_init_array_1): Don't unshare constructor if there
3216 aren't any trailing zero elts, otherwise only unshare the first
3219 2020-03-11 Jason Merrill <jason@redhat.com>
3222 * constraint.cc (tsubst_parameter_mapping): Canonicalize type
3225 2020-03-11 Marek Polacek <polacek@redhat.com>
3226 Jason Merrill <jason@redhat.com>
3228 PR c++/94074 - wrong modifying const object error for COMPONENT_REF.
3229 * constexpr.c (cref_has_const_field): New function.
3230 (modifying_const_object_p): Consider a COMPONENT_REF
3231 const only if any of its fields are const.
3232 (cxx_eval_store_expression): Mark a CONSTRUCTOR of a const type
3233 as readonly after its initialization has been done.
3235 2020-03-10 Marek Polacek <polacek@redhat.com>
3237 PR c++/94124 - wrong conversion error with non-viable overload.
3238 * decl.c (reshape_init_array_1): Unshare a constructor if we
3239 stripped trailing zero-initializers.
3241 2020-03-10 Jason Merrill <jason@redhat.com>
3244 * pt.c (maybe_instantiate_noexcept): Always update clones.
3246 2020-03-10 Jason Merrill <jason@redhat.com>
3249 * pt.c (maybe_aggr_guide): Check BRACE_ENCLOSED_INITIALIZER_P.
3251 2020-03-10 Jason Merrill <jason@redhat.com>
3257 * cp-gimplify.c (cp_gimplify_init_expr): Partially revert patch for
3258 66139: Don't split_nonconstant_init. Remove pre_p parameter.
3260 2020-03-09 Marek Polacek <polacek@redhat.com>
3262 PR c++/92031 - bogus taking address of rvalue error.
3263 PR c++/91465 - ICE with template codes in check_narrowing.
3264 PR c++/93870 - wrong error when converting template non-type arg.
3265 PR c++/94068 - ICE with template codes in check_narrowing.
3266 * call.c (convert_like_real): Return IMPLICIT_CONV_EXPR
3267 in a template when not ck_identity and we're dealing with a class.
3268 (convert_like_real) <case ck_ref_bind>: Return IMPLICIT_CONV_EXPR
3269 in a template if we need a temporary.
3270 * decl.c (compute_array_index_type_loc): Remove
3271 instantiate_non_dependent_expr_sfinae call. Call
3272 fold_non_dependent_expr instead of maybe_constant_value.
3273 (build_explicit_specifier): Don't instantiate or create a sentinel
3274 before converting the expression.
3275 * except.c (build_noexcept_spec): Likewise.
3276 * pt.c (convert_nontype_argument): Don't build IMPLICIT_CONV_EXPR.
3277 Set IMPLICIT_CONV_EXPR_NONTYPE_ARG if that's what
3278 build_converted_constant_expr returned.
3279 * typeck2.c (check_narrowing): Call fold_non_dependent_expr instead
3280 of maybe_constant_value.
3282 2020-03-09 Jakub Jelinek <jakub@redhat.com>
3286 2019-10-11 Paolo Carlini <paolo.carlini@oracle.com>
3288 * constexpr.c (cxx_eval_constant_expression): Do not handle
3289 RROTATE_EXPR and LROTATE_EXPR.
3291 2020-03-09 Marek Polacek <polacek@redhat.com>
3293 PR c++/94050 - ABI issue with alignas on armv7hl.
3294 * class.c (layout_class_type): Don't replace a class's
3295 CLASSTYPE_AS_BASE if their TYPE_USER_ALIGN don't match.
3297 2020-03-09 Bin Cheng <bin.cheng@linux.alibaba.com>
3299 * coroutines.cc (build_actor_fn): Factor out code inserting the
3300 default return_void call to...
3301 (morph_fn_to_coro): ...here, also hoist local var declarations.
3303 2020-03-08 Patrick Palka <ppalka@redhat.com>
3306 * call.c (convert_like_real): Check complain before emitting an error
3307 about binding a bit-field to a reference.
3309 * cxx-pretty-print.c (cxx_pretty_printer::simple_type_specifier)
3310 [TYPENAME_TYPE]: Print the TYPENAME_TYPE_FULLNAME instead of the
3313 2020-03-06 Nathan Sidwell <nathan@acm.org>
3316 * mangle.c (find_substitution): Don't call same_type_p on template
3317 args that cannot match.
3319 2020-03-04 Martin Sebor <msebor@redhat.com>
3322 * tree.c (type_initializer_zero_p): Fail for structs initialized
3325 2020-03-04 Jason Merrill <jason@redhat.com>
3328 * init.c (perform_member_init): Don't do aggregate initialization of
3330 * constexpr.c (cx_check_missing_mem_inits): Don't enforce
3331 initialization of empty field.
3333 2020-03-04 Martin Liska <mliska@suse.cz>
3335 * method.c: Wrap array in ctor with braces in order
3336 to silent clang warnings.
3338 2020-03-03 Jason Merrill <jason@redhat.com>
3339 Marek Polacek <polacek@redhat.com>
3341 PR c++/90505 - mismatch in template argument deduction.
3342 * pt.c (tsubst): Don't reduce the template level of template
3343 parameters when tf_partial.
3345 2020-03-03 Jakub Jelinek <jakub@redhat.com>
3348 * constexpr.c (cxx_eval_constant_expression)
3349 <case TARGET_EXPR, case SAVE_EXPR>: Don't record anything if
3350 *non_constant_p is true.
3352 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
3354 * coroutines.cc (captures_temporary): Strip component_ref
3357 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
3359 * coroutines.cc (finish_co_await_expr): Build co_await_expr
3360 with unknown_type_node.
3361 (finish_co_yield_expr): Ditto.
3362 *pt.c (type_dependent_expression_p): Set co_await/yield_expr
3363 with unknown type as dependent.
3365 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
3367 * coroutines.cc (struct local_var_info): Adjust to remove the
3368 reference to the captured var, and just to note that this is a
3369 lambda capture proxy.
3370 (transform_local_var_uses): Handle lambda captures specially.
3371 (struct param_frame_data): Add a visited set.
3372 (register_param_uses): Also check for param uses in lambda
3374 (struct local_vars_frame_data): Remove captures list.
3375 (register_local_var_uses): Handle lambda capture proxies by
3376 noting and bypassing them.
3377 (morph_fn_to_coro): Update to remove lifetime extension of
3378 lambda capture-by-copy vars.
3380 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
3382 * coroutines.cc (build_co_await): Do not build frame
3383 awaitable proxy vars when the co_await expression is
3384 a function parameter or local var.
3385 (co_await_expander): Do not initialise a frame var with
3387 (transform_await_expr): Only substitute the awaitable
3388 frame var if it's needed.
3389 (register_awaits): Do not make frame copies for param
3390 or local vars that are awaitables.
3392 2020-02-28 Jason Merrill <jason@redhat.com>
3394 Implement P2092R0, Disambiguating Nested-Requirements
3395 * parser.c (cp_parser_requirement_parameter_list): Pass
3396 CP_PARSER_FLAGS_TYPENAME_OPTIONAL.
3398 * call.c (build_user_type_conversion_1): Don't look at the second
3399 conversion of a non-viable candidate.
3401 2020-02-28 Jakub Jelinek <jakub@redhat.com>
3403 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
3404 * typeck.c (cp_build_addr_expr_1): Allow taking address of immediate
3405 functions in unevaluated contexts.
3407 2020-02-27 Nathan Sidwell <nathan@acm.org>
3410 * pt.c (template_args_equal): Pass ARGUMENT_PACKS through to
3412 * tree.c (cp_tree_equal): Compare ARGUMENT_PACKS here,
3413 * typeck.c (comptypes): Assert we don't get any argument packs.
3415 * class.c (adjust_clone_args): Correct arg-checking assert.
3416 * typeck.c (comptypes): Assert not nulls.
3418 2020-02-26 Marek Polacek <polacek@redhat.com>
3420 PR c++/93789 - ICE with invalid array bounds.
3421 * decl.c (compute_array_index_type_loc): Don't use the folded
3422 size when folding cleared TREE_CONSTANT.
3424 2020-02-26 Iain Sandoe <iain@sandoe.co.uk>
3426 * class.c (classtype_has_non_deleted_copy_ctor): New.
3427 * coroutines.cc (struct param_info): Keep track of params
3428 that are references, and cache the original type and whether
3429 the DTOR is trivial.
3430 (build_actor_fn): Handle param copies always, and adjust the
3431 handling for references.
3432 (register_param_uses): Only handle uses here.
3433 (classtype_has_non_deleted_copy_ctor): New.
3434 (morph_fn_to_coro): Adjust param copy handling to match n4849
3435 by reordering ahead of the promise CTOR and always making a
3436 frame copy, even if the param is unused in the coroutine body.
3437 * cp-tree.h (classtype_has_non_deleted_copy_ctor): New.
3439 2020-02-26 Patrick Palka <ppalka@redhat.com>
3441 * constraint.cc (finish_constraint_binary_op): Set expr's location range
3442 to the range of its operands.
3443 (satisfy_atom): Pass MAP instead of ARGS to diagnose_atomic_constraint.
3444 (diagnose_trait_expr): Take the instantiated parameter mapping MAP
3445 instead of the corresponding template arguments ARGS and adjust body
3447 (diagnose_requires_expr): Likewise.
3448 (diagnose_atomic_constraint): Likewise. When printing an atomic
3449 constraint expression, print the instantiated parameter mapping
3451 * cxx-pretty-print.cc (cxx_pretty_printer::expression)
3452 [NONTYPE_ARGUMENT_PACK]: Print braces around a NONTYPE_ARGUMENT_PACK.
3453 (cxx_pretty_printer::type_id): Handle TYPE_ARGUMENT_PACK.
3455 2020-02-26 Marek Polacek <polacek@redhat.com>
3457 PR c++/93676 - value-init crash in template.
3458 * init.c (build_new_1): Don't call build_vec_init in a template.
3460 2020-02-26 Marek Polacek <polacek@redhat.com>
3462 PR c++/93862 - ICE with static_cast when converting from int[].
3463 * call.c (reference_compatible_p): No longer static.
3464 * cp-tree.h (reference_compatible_p): Declare.
3465 * typeck.c (build_static_cast_1): Use reference_compatible_p instead
3466 of reference_related_p.
3468 2020-02-26 Marek Polacek <polacek@redhat.com>
3470 PR c++/93803 - ICE with constexpr init and [[no_unique_address]].
3471 * constexpr.c (reduced_constant_expression_p): Don't crash on a null
3474 2020-02-24 Martin Sebor <msebor@redhat.com>
3477 * parser.c (cp_parser_check_class_key): Avoid issuing -Wredundant-tags
3478 in shared C/C++ code in headers.
3479 Remove a duplicate hunk of code.
3481 2020-02-24 Marek Polacek <polacek@redhat.com>
3483 PR c++/93869 - ICE with -Wmismatched-tags.
3484 * parser.c (cp_parser_check_class_key): Check class_key earlier.
3486 2020-02-24 Marek Polacek <polacek@redhat.com>
3488 PR c++/93712 - ICE with ill-formed array list-initialization.
3489 * call.c (next_conversion): Return NULL for ck_aggr.
3490 (build_aggr_conv): Set u.expr instead of u.next.
3491 (build_array_conv): Likewise.
3492 (build_complex_conv): Likewise.
3493 (conv_get_original_expr): Handle ck_aggr.
3495 2020-02-24 Jakub Jelinek <jakub@redhat.com>
3497 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
3498 * call.c (build_over_call): Don't evaluate immediate functions in
3499 unevaluated operands.
3501 2020-02-24 Jason Merrill <jason@redhat.com>
3503 P0780R2: Resolve lambda init-capture pack grammar.
3504 * parser.c (cp_parser_lambda_introducer): Expect &...x=y rather than
3507 2020-02-22 Marek Polacek <polacek@redhat.com>
3510 * decl.c (grokdeclarator): Use %qs in a diagnostic message.
3512 2020-02-21 Martin Sebor <msebor@redhat.com>
3514 PR gcov-profile/93753
3515 * class.c (check_flexarrays): Tighten up a test for potential members
3516 of anonymous structs or unions.
3518 2020-02-20 Martin Sebor <msebor@redhat.com>
3521 * parser.c (cp_parser_check_class_key): Only handle true C++ class-keys.
3523 2020-02-20 Martin Liska <mliska@suse.cz>
3525 PR translation/93841
3526 * config/or1k/or1k.opt: Remove superfluous word.
3527 * doc/invoke.texi: Likewise.
3529 2020-02-20 Martin Liska <mliska@suse.cz>
3531 PR translation/93838
3532 * parser.c (cp_parser_decl_specifier_seq): Remove trailing space.
3534 2020-02-19 Marek Polacek <polacek@redhat.com>
3536 PR c++/93169 - wrong-code with a non-constexpr constructor.
3537 * constexpr.c (cxx_eval_call_expression): Only set TREE_READONLY
3538 on constant CONSTRUCTORs.
3540 2020-02-15 Marek Polacek <polacek@redhat.com>
3542 PR c++/93710 - poor diagnostic for array initializer.
3543 * call.c (build_user_type_conversion_1): Use cp_expr_loc_or_input_loc
3546 2020-02-15 Jason Merrill <jason@redhat.com>
3549 * pt.c (any_template_parm_r): Look into lambda body.
3552 * pt.c (any_template_parm_r): Remove CONSTRUCTOR handling.
3554 2020-02-14 Jakub Jelinek <jakub@redhat.com>
3557 * class.c (enum_min_precision): Change prec type from int to int &.
3560 * cp-tree.h (enum cp_tree_index): Add CPTI_FALLBACK_DFLOAT32_TYPE,
3561 CPTI_FALLBACK_DFLOAT64_TYPE and CPTI_FALLBACK_DFLOAT128_TYPE.
3562 (fallback_dfloat32_type, fallback_dfloat64_type,
3563 fallback_dfloat128_type): Define.
3564 * mangle.c (write_builtin_type): Handle fallback_dfloat*_type like
3566 * rtti.c (emit_support_tinfos): Emit DFP typeinfos even when dfp
3567 is disabled for compatibility.
3569 2020-02-13 Jason Merrill <jason@redhat.com>
3572 * name-lookup.c (matching_fn_p): A function does not match a
3577 * tree.c (decl_linkage): Always lk_none for locals.
3579 2020-02-12 Jason Merrill <jason@redhat.com>
3583 * tree.c (cp_walk_subtrees): Walk CONSTRUCTOR types here.
3584 * pt.c (find_parameter_packs_r): Not here.
3586 2020-02-12 Iain Sandoe <iain@sandoe.co.uk>
3588 * coroutines.cc (build_actor_fn): Implement deallocation function
3589 selection per n4849, dcl.fct.def.coroutine bullet 12.
3590 (morph_fn_to_coro): Implement allocation function selection per
3591 n4849, dcl.fct.def.coroutine bullets 9 and 10.
3593 2020-02-12 Marek Polacek <polacek@redhat.com>
3595 PR c++/93684 - ICE-on-invalid with broken attribute.
3596 * parser.c (cp_parser_std_attribute): Peek a token first before
3599 2020-02-11 Jason Merrill <jason@redhat.com>
3602 * class.c (add_implicitly_declared_members): Use do_friend.
3603 * method.c (implicitly_declare_fn): Fix friend handling.
3604 (decl_remember_implicit_trigger_p): New.
3605 (synthesize_method): Use it.
3606 * decl2.c (mark_used): Use it.
3608 2020-02-11 Jason Merrill <jason@redhat.com>
3612 * constexpr.c (maybe_constant_value): Correct earlier change.
3613 (cxx_eval_binary_expression) [SPACESHIP_EXPR]: Pass lval through.
3614 * method.c (genericize_spaceship): Wrap result in TARGET_EXPR.
3616 2020-02-12 Patrick Palka <ppalka@redhat.com>
3620 * type-utils.h (find_type_usage): Refactor to take a tree * and to
3621 return a tree *, and update documentation accordingly.
3622 * pt.c (make_auto_1): Set AUTO_IS_DECLTYPE when building a
3623 decltype(auto) node.
3624 (make_constrained_decltype_auto): No need to explicitly set
3625 AUTO_IS_DECLTYPE anymore.
3626 (splice_late_return_type): Use find_type_usage to find and
3627 replace a possibly nested auto node instead of using is_auto.
3628 Check test for is_auto into an assert when deciding whether
3629 to late_return_type.
3630 (type_uses_auto): Adjust the call to find_type_usage.
3631 * parser.c (cp_parser_decltype): No need to explicitly set
3632 AUTO_IS_DECLTYPE anymore.
3634 * error.c (dump_decl) [CONCEPT_DECL]: Use dump_simple_decl.
3635 (dump_simple_decl): Handle standard concept definitions as well as
3636 variable concept definitions.
3638 2020-02-10 Jakub Jelinek <jakub@redhat.com>
3641 * error.c (dump_decl_name): Fix up last argument to strncmp.
3643 2020-02-10 Jason Merrill <jason@redhat.com>
3646 * tree.c (array_of_unknown_bound_p): New.
3647 * init.c (perform_member_init): Do nothing for flexible arrays.
3649 2020-02-09 Jakub Jelinek <jakub@redhat.com>
3652 * constexpr.c (cxx_eval_constant_expression): If obj is heap var with
3653 ARRAY_TYPE, use the element type. Punt if objtype after that is not
3656 2020-02-08 Jason Merrill <jason@redhat.com>
3659 * expr.c (fold_for_warn): Call maybe_constant_value.
3660 * constexpr.c (struct constexpr_ctx): Add uid_sensitive bit-field.
3661 (maybe_constant_value): Add uid_sensitive parm.
3662 (get_fundef_copy): Don't copy if it's true.
3663 (cxx_eval_call_expression): Don't instantiate if it's true.
3664 (cxx_eval_outermost_constant_expr): Likewise.
3667 * constexpr.c (maybe_constant_value): Don't unshare if the cached
3668 value is the same as the argument.
3670 * typeck.c (maybe_warn_about_returning_address_of_local): Add
3673 * typeck2.c (process_init_constructor): Also clear TREE_SIDE_EFFECTS
3676 2020-02-08 Jakub Jelinek <jakub@redhat.com>
3679 * constexpr.c (find_array_ctor_elt): If last element has no index,
3680 for flag_checking verify all elts have no index. If i is within the
3681 elts, return it directly, if it is right after the last elt, append
3682 if NULL index, otherwise force indexes on all elts.
3683 (cxx_eval_store_expression): Allow cep->index to be NULL.
3685 2020-02-07 Marek Polacek <polacek@redhat.com>
3687 PR c++/92947 - Paren init of aggregates in unevaluated context.
3688 * call.c (build_new_method_call_1): Don't check
3689 cp_unevaluated_operand. Check the return value of digest_init.
3691 2020-02-06 Jason Merrill <jason@redhat.com>
3694 * tree.c (cp_walk_subtrees): Walk into type template arguments.
3695 * cp-tree.h (TYPE_TEMPLATE_INFO_MAYBE_ALIAS): Use typedef_variant_p
3696 instead of TYPE_ALIAS_P.
3697 * pt.c (push_template_decl_real): Likewise.
3698 (find_parameter_packs_r): Likewise. Remove dead code.
3699 * error.c (find_typenames_r): Remove dead code.
3701 2020-02-06 Jason Merrill <jason@redhat.com>
3704 * parser.c (cp_parser_constraint_primary_expression): Do the main
3705 parse non-tentatively.
3707 2020-02-06 Marek Polacek <polacek@redhat.com>
3709 PR c++/93597 - ICE with lambda in operator function.
3710 * name-lookup.c (maybe_save_operator_binding): Check is_overloaded_fn.
3712 2020-02-05 Jason Merrill <jason@redhat.com>
3715 * pt.c (tsubst_decl) [PARM_DECL]: Check cp_unevaluated_operand in
3716 handling of TREE_CHAIN for empty pack.
3718 2020-02-05 Jakub Jelinek <jakub@redhat.com>
3721 * semantics.c (cp_build_vec_convert): Call decay_conversion on arg
3722 prior to passing it to c_build_vec_convert.
3724 2020-02-05 Marek Polacek <polacek@redhat.com>
3726 PR c++/93559 - ICE with CONSTRUCTOR flags verification.
3727 * decl.c (reshape_init_array_1): Don't reuse a CONSTRUCTOR with
3730 2020-02-05 Jason Merrill <jason@redhat.com>
3733 * decl.c (grokdeclarator): Reject field of current class type even
3736 2020-02-05 Bin Cheng <bin.cheng@linux.alibaba.com>
3738 * coroutines.cc (maybe_promote_captured_temps): Increase the index
3739 number for temporary variables' name.
3741 2020-02-05 Jun Ma <JunMa@linux.alibaba.com>
3743 * coroutines.cc (build_co_await): Call convert_from_reference
3744 to wrap co_await_expr with indirect_ref which avoid
3745 reference/non-reference type confusion.
3747 (co_await_expander): Sink to call_expr if await_resume
3748 is wrapped by indirect_ref.
3750 2020-02-04 Jason Merrill <jason@redhat.com>
3753 * constraint.cc (satisfy_declaration_constraints): Check return
3754 value of push_tinst_level.
3757 * constexpr.c (cxx_eval_array_reference): {}-initialize missing
3758 elements instead of value-initializing them.
3761 * init.c (perform_member_init): Simplify.
3762 * constexpr.c (cx_check_missing_mem_inits): Allow uninitialized
3764 (cxx_eval_vec_init_1): Handle CONSTRUCTOR.
3766 2020-02-04 Iain Sandoe <iain@sandoe.co.uk>
3768 * coroutines.cc (find_promise_type): Delete unused forward
3770 (struct coroutine_info): Add a bool for no promise type error.
3771 (coro_promise_type_found_p): Only emit the error for a missing
3772 promise once in each affected coroutine.
3774 2020-02-03 Jason Merrill <jason@redhat.com>
3777 * constexpr.c (cxx_eval_constant_expression) [PARM_DECL]: Don't
3778 defer loading the value of a reference.
3780 2020-02-03 Jason Merrill <jason@redhat.com>
3783 * constexpr.c (potential_constant_expression_1) [PARM_DECL]: Allow
3785 [COMPONENT_REF]: A member function reference doesn't use the object
3788 2020-02-03 Iain Sandoe <iain@sandoe.co.uk>
3791 * coroutines.cc (struct coroutine_info): Add a bool flag to note
3792 that we emitted an error for a bad function return type.
3793 (get_coroutine_info): Tolerate an unset info table in case of
3795 (find_coro_traits_template_decl): In case of error or if we didn't
3796 find a type template, note we emitted the error and suppress
3798 (find_coro_handle_template_decl): Likewise.
3799 (instantiate_coro_traits): Only check for error_mark_node in the
3800 return from lookup_qualified_name.
3801 (coro_promise_type_found_p): Reorder initialization so that we check
3802 for the traits and their usability before allocation of the info
3803 table. Check for a suitable return type and emit a diagnostic for
3804 here instead of relying on the lookup machinery. This allows the
3805 error to have a better location, and means we can suppress multiple
3807 (coro_function_valid_p): Re-check for a valid promise (and thus the
3808 traits) before proceeding. Tolerate missing info as a fatal error.
3810 2020-02-03 Jason Merrill <jason@redhat.com>
3813 * cp-gimplify.c (predeclare_vla): New.
3814 (cp_genericize_r) [NOP_EXPR]: Call it.
3816 2020-02-03 Jun Ma <JunMa@linux.alibaba.com>
3818 * coroutines.cc (transform_await_wrapper): Set actor funcion as
3819 new context of label_decl.
3820 (build_actor_fn): Fill new field of await_xform_data.
3822 2020-02-02 Marek Polacek <polacek@redhat.com>
3824 PR c++/93530 - ICE on invalid alignas in a template.
3825 * decl.c (grokdeclarator): Call cplus_decl_attributes instead of
3828 2020-01-31 Jason Merrill <jason@redhat.com>
3831 * semantics.c (process_outer_var_ref): Capture VLAs even in
3832 unevaluated context.
3835 * decl.c (reshape_init_array_1): Reuse a single CONSTRUCTOR with
3836 non-aggregate elements.
3837 (reshape_init_array): Add first_initializer_p parm.
3838 (reshape_init_r): Change first_initializer_p from bool to tree.
3839 (reshape_init): Pass init to it.
3842 * parser.c (cp_parser_initializer_list): Suppress location wrappers
3845 2020-01-29 Jason Merrill <jason@redhat.com>
3848 * pt.c (tsubst_copy_and_build) [EQ_EXPR]: Only suppress warnings if
3849 the expression was dependent before substitution.
3851 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
3853 * coroutines.cc (act_des_fn): New.
3854 (morph_fn_to_coro): Call act_des_fn to build actor/destroy decls.
3855 Access promise via actor function's frame pointer argument.
3856 (build_actor_fn, build_destroy_fn): Use frame pointer argument.
3858 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
3860 * coroutines.cc (co_await_expander): Handle type conversion case.
3862 2020-01-29 Jason Merrill <jason@redhat.com>
3867 * parser.c (cp_parser_type_specifier_seq): Don't parse attributes in
3868 a trailing return type.
3869 (cp_parser_lambda_declarator_opt): Parse C++11 attributes before
3872 2020-01-29 Marek Polacek <polacek@redhat.com>
3874 PR c++/91754 - Fix template arguments comparison with class NTTP.
3875 * pt.c (class_nttp_const_wrapper_p): New.
3876 (template_args_equal): See through class_nttp_const_wrapper_p
3879 2020-01-29 Marek Polacek <polacek@redhat.com>
3881 PR c++/92948 - Fix class NTTP with template arguments.
3882 * pt.c (convert_nontype_argument): Use IMPLICIT_CONV_EXPR when
3883 converting a value-dependent expression to a class type.
3884 (tsubst_copy) <case VIEW_CONVERT_EXPR>: Allow IMPLICIT_CONV_EXPR
3885 as the result of the tsubst_copy call.
3887 2020-01-29 Jakub Jelinek <jakub@redhat.com>
3890 * cp-gimplify.c (cxx_omp_predetermined_sharing): Return
3891 OMP_CLAUSE_DEFAULT_SHARED for typeinfo decls.
3893 2020-01-28 Jason Merrill <jason@redhat.com>
3896 * parser.c (cp_parser_lambda_expression): Clear in_discarded_stmt.
3900 * decl2.c (copy_linkage): Do copy DECL_ONE_ONLY and DECL_WEAK.
3903 * call.c (build_user_type_conversion_1): Allow a template conversion
3904 returning an rvalue reference to bind directly to an lvalue.
3907 * decl.c (grokdeclarator): Propagate eh spec from typedef.
3909 2020-01-28 Martin Liska <mliska@suse.cz>
3912 * pt.c (redeclare_class_template): Group couple of
3913 errors and inform messages with auto_diagnostic_group.
3915 2020-01-28 Martin Liska <mliska@suse.cz>
3918 * pt.c (redeclare_class_template): Use inform
3919 for the second location.
3921 2020-01-27 Jason Merrill <jason@redhat.com>
3924 * pt.c (tsubst_copy) [STRING_CST]: Don't use fold_convert.
3926 2020-01-27 Iain Sandoe <iain@sandoe.co.uk>
3929 * coroutines.cc (morph_fn_to_coro): Check the ramp return
3930 value when it is constructed from the 'get return object'.
3932 2020-01-27 Nathan Sidwell <nathan@acm.org>
3935 * name-lookup.c (is_ancestor): Allow CHILD to be a namespace alias.
3937 2020-01-26 Jason Merrill <jason@redhat.com>
3940 * except.c (maybe_noexcept_warning): Check DECL_IN_SYSTEM_HEADER and
3941 temporarily enable -Wsystem-headers. Change second warning to
3945 * semantics.c (finish_call_expr): Don't call
3946 instantiate_non_dependent_expr before warn_for_memset.
3948 2020-01-25 Marek Polacek <polacek@redhat.com>
3950 PR c++/93414 - poor diagnostic for dynamic_cast in constexpr context.
3951 * constexpr.c (cxx_eval_dynamic_cast_fn): Add a reference
3952 dynamic_cast diagnostic.
3954 2020-01-24 Jason Merrill <jason@redhat.com>
3956 PR c++/93400 - ICE with constrained friend.
3957 * constraint.cc (maybe_substitute_reqs_for): New.
3958 * decl.c (function_requirements_equivalent_p): Call it.
3959 * pt.c (tsubst_friend_function): Only substitute
3960 TEMPLATE_PARMS_CONSTRAINTS.
3961 (tsubst_template_parms): Copy constraints.
3963 2020-01-24 Jason Merrill <jason@redhat.com>
3965 PR c++/93279 - ICE with lambda in member operator.
3966 * name-lookup.c (maybe_save_operator_binding): Don't remember
3967 class-scope bindings.
3969 2020-01-24 Jason Merrill <jason@redhat.com>
3971 PR c++/93377 - ICE with member alias in constraint.
3972 * pt.c (any_template_parm_r): Look at template arguments for all
3973 aliases, not only alias templates.
3975 2020-01-24 Marek Polacek <polacek@redhat.com>
3977 PR c++/93299 - ICE in tsubst_copy with parenthesized expression.
3978 * pt.c (tsubst_copy): Handle a REF_PARENTHESIZED_P VIEW_CONVERT_EXPR.
3980 2020-01-24 Jason Merrill <jason@redhat.com>
3982 PR c++/92852 - ICE with generic lambda and reference var.
3983 * constexpr.c (maybe_constant_value): Likewise.
3985 2020-01-23 Paolo Carlini <paolo.carlini@oracle.com>
3988 * parser.c (cp_parser_nested_name_specifier_opt): Properly
3989 diagnose concept-ids.
3991 2020-01-23 Jason Merrill <jason@redhat.com>
3993 PR c++/93331 - ICE with __builtin_strchr.
3994 * constexpr.c (cxx_eval_builtin_function_call): Use the original
3995 argument if we didn't manage to extract a STRING_CST.
3997 PR c++/93345 - ICE with defaulted dtor and template.
3999 * decl.c (cxx_maybe_build_cleanup): Don't try to set
4000 throwing_cleanup in a template.
4002 2020-01-22 Marek Polacek <polacek@redhat.com>
4004 PR c++/92907 - noexcept does not consider "const" in member functions.
4005 * g++.dg/cpp0x/noexcept56.C: New test.
4007 2020-01-22 Marek Polacek <polacek@redhat.com>
4009 PR c++/93324 - ICE with -Wall on constexpr if.
4010 * semantics.c (is_std_constant_evaluated_p): Check fndecl.
4012 2020-01-22 Patrick Palka <ppalka@redhat.com>
4014 * constraint.cc (get_mapped_args): Avoid using auto_vec
4015 as a vector element. Release the vectors inside the lists
4017 * parser.c (cp_literal_operator_id): Free the buffer.
4019 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
4021 * coroutines.cc (finish_co_await_expr): Add error check on return
4022 value of build_co_await.
4023 (finish_co_yield_expr,): Ditto.
4025 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
4027 * coroutines.cc (lookup_awaitable_member): Lookup an awaitable member.
4028 (lookup_promise_method): Emit diagnostic when get NULL_TREE back only.
4029 (build_co_await): Use lookup_awaitable_member instead of lookup_member.
4031 2020-01-21 Jason Merrill <jason@redhat.com>
4033 PR c++/60855 - ICE with sizeof VLA capture.
4034 * lambda.c (is_lambda_ignored_entity): Don't look past VLA capture.
4036 PR c++/90732 - ICE with VLA capture and generic lambda.
4037 * pt.c (tsubst_lambda_expr): Repeat add_capture for VLAs.
4039 2020-01-21 Iain Sandoe <iain@sandoe.co.uk>
4040 Bin Cheng <bin.cheng@linux.alibaba.com>
4042 * coroutines.cc (coro_promise_type_found_p): Check for NULL return
4043 from complete_type_or_else.
4044 (register_param_uses): Likewise.
4045 (build_co_await): Do not try to use complete_type_or_else for void
4046 types, otherwise for incomplete types, check for NULL return from
4047 complete_type_or_else.
4049 2020-01-21 Jason Merrill <jason@redhat.com>
4051 PR c++/91476 - anon-namespace reference temp clash between TUs.
4052 * decl2.c (copy_linkage): Factor out of get_guard.
4053 * call.c (make_temporary_var_for_ref_to_temp): Use it.
4054 * decl.c (cp_finish_decomp): Use it.
4055 (cp_finish_decl): determine_visibility sooner.
4057 2020-01-21 Bin Cheng <bin.cheng@linux.alibaba.com>
4059 * coroutines.cc (finish_co_await_expr): Set return value flag.
4060 (finish_co_yield_expr, morph_fn_to_coro): Ditto.
4062 2020-01-19 Jason Merrill <jason@redhat.com>
4064 PR c++/33799 - destroy return value, take 2.
4065 * cp-tree.h (current_retval_sentinel): New macro.
4066 (struct language_function): Add throwing_cleanup bitfield.
4067 * decl.c (cxx_maybe_build_cleanup): Set it.
4068 * except.c (maybe_set_retval_sentinel)
4069 (maybe_splice_retval_cleanup): New functions.
4070 * parser.c (cp_parser_compound_statement): Call
4071 maybe_splice_retval_cleanup.
4072 * typeck.c (check_return_expr): Call maybe_set_retval_sentinel.
4074 * parser.c (cp_parser_lambda_body): Use cp_parser_function_body.
4076 2020-01-18 Jakub Jelinek <jakub@redhat.com>
4078 * coroutines.cc (get_fn_local_identifier): Fix NO_DOT_IN_LABEL
4079 but non-NO_DOLLAR_IN_LABEL case build.
4081 2020-01-18 Iain Sandoe <iain@sandoe.co.uk>
4083 * Make-lang.in: Add coroutines.o.
4084 * cp-tree.h (lang_decl-fn): coroutine_p, new bit.
4085 (DECL_COROUTINE_P): New.
4086 * lex.c (init_reswords): Enable keywords when the coroutine flag
4088 * operators.def (co_await): New operator.
4089 * call.c (add_builtin_candidates): Handle CO_AWAIT_EXPR.
4090 (op_error): Likewise.
4091 (build_new_op_1): Likewise.
4092 (build_new_function_call): Validate coroutine builtin arguments.
4093 * constexpr.c (potential_constant_expression_1): Handle
4094 CO_AWAIT_EXPR, CO_YIELD_EXPR, CO_RETURN_EXPR.
4095 * coroutines.cc: New file.
4096 * cp-objcp-common.c (cp_common_init_ts): Add CO_AWAIT_EXPR,
4097 CO_YIELD_EXPR, CO_RETRN_EXPR as TS expressions.
4098 * cp-tree.def (CO_AWAIT_EXPR, CO_YIELD_EXPR, (CO_RETURN_EXPR): New.
4099 * cp-tree.h (coro_validate_builtin_call): New.
4100 * decl.c (emit_coro_helper): New.
4101 (finish_function): Handle the case when a function is found to
4102 be a coroutine, perform the outlining and emit the outlined
4103 functions. Set a bit to signal that this is a coroutine component.
4104 * parser.c (enum required_token): New enumeration RT_CO_YIELD.
4105 (cp_parser_unary_expression): Handle co_await.
4106 (cp_parser_assignment_expression): Handle co_yield.
4107 (cp_parser_statement): Handle RID_CO_RETURN.
4108 (cp_parser_jump_statement): Handle co_return.
4109 (cp_parser_operator): Handle co_await operator.
4110 (cp_parser_yield_expression): New.
4111 (cp_parser_required_error): Handle RT_CO_YIELD.
4112 * pt.c (tsubst_copy): Handle CO_AWAIT_EXPR.
4113 (tsubst_expr): Handle CO_AWAIT_EXPR, CO_YIELD_EXPR and
4115 * tree.c (cp_walk_subtrees): Likewise.
4117 2020-01-17 Jason Merrill <jason@redhat.com>
4119 PR c++/92531 - ICE with noexcept(lambda).
4120 * pt.c (uses_template_parms): Don't try to enumerate all the
4123 2020-01-17 Jakub Jelinek <jakub@redhat.com>
4126 * parser.c (cp_parser_template_name): Look up deprecated attribute
4127 in DECL_TEMPLATE_RESULT or its type's attributes.
4129 2020-01-16 Jason Merrill <jason@redhat.com>
4131 PR c++/93286 - ICE with __is_constructible and variadic template.
4132 * pt.c (tsubst) [TREE_LIST]: Handle pack expansion.
4133 (tsubst_copy_and_build) [TRAIT_EXPR]: Always use tsubst for type2.
4135 PR c++/93280 - ICE with aggregate assignment and DMI.
4136 * init.c (get_nsdmi): Set TARGET_EXPR_DIRECT_INIT_P here.
4137 * typeck2.c (digest_nsdmi_init): Not here.
4139 2020-01-15 Paolo Carlini <paolo.carlini@oracle.com>
4142 * cp-tree.h (is_constrained_auto): New.
4143 * parser.c (cp_parser_maybe_commit_to_declaration): Correctly
4144 handle concept-check expressions; take a cp_decl_specifier_seq*
4146 (cp_parser_condition): Update call.
4147 (cp_parser_simple_declaration): Likewise.
4148 (cp_parser_placeholder_type_specifier): Correctly handle
4149 concept-check expressions.
4151 2020-01-15 Jason Merrill <jason@redhat.com>
4154 PR c++/33799 - destroy return value if local cleanup throws.
4155 * cp-tree.h (current_retval_sentinel): New macro.
4156 * decl.c (start_preparsed_function): Set up cleanup for retval.
4157 * typeck.c (check_return_expr): Set current_retval_sentinel.
4159 PR c++/93257 - consteval void function.
4160 * constexpr.c (verify_constant): Allow void_node.
4162 PR c++/92871 - bad code with xvalue and GNU ?: extension.
4163 * call.c (prevent_lifetime_extension): New.
4164 (build_conditional_expr_1): Use it.
4166 2020-01-14 Nathan Sidwell <nathan@acm.org>
4169 * pt.c (retrieve_specialization): Use get_template_info, not open
4173 * pt.c (retrieve_specialization): Get the TI from the decl or the
4174 classtype as appropriate.
4176 2020-01-14 David Malcolm <dmalcolm@redhat.com>
4178 * cp-gimplify.c (source_location_table_entry_hash::empty_zero_p):
4179 New static constant.
4180 * cp-tree.h (named_decl_hash::empty_zero_p): Likewise.
4181 (struct named_label_hash::empty_zero_p): Likewise.
4182 * decl2.c (mangled_decl_hash::empty_zero_p): Likewise.
4184 2020-01-14 Jason Merrill <jason@redhat.com>
4186 PR c++/92590 - wrong handling of inherited default ctor.
4187 * class.c (add_method): A constrained inherited ctor doesn't hide an
4188 implicit derived ctor.
4190 PR c++/92552 - ICE with inherited constrained default ctor.
4191 * pt.c (instantiate_class_template_1): Copy
4192 TYPE_HAS_USER_CONSTRUCTOR.
4193 PR c++/91930 - ICE with constrained inherited default ctor.
4194 * name-lookup.c (do_class_using_decl): Set TYPE_HAS_USER_CONSTRUCTOR
4195 for inherited constructor.
4196 PR c++/92594 - ICE with inherited trivial default ctor.
4197 * method.c (trivial_fn_p): Treat an inherited default constructor
4198 like a normal default constructor.
4200 PR c++/92594 - ICE with inherited trivial default ctor.
4201 * method.c (trivial_fn_p): Treat an inherited default constructor
4202 like a normal default constructor.
4204 PR c++/92009 - ICE with punning of typeid.
4205 * rtti.c (get_tinfo_desc): Call xref_basetypes.
4206 * constexpr.c (cxx_fold_indirect_ref): Don't strip
4209 2020-01-13 Jason Merrill <jason@redhat.com>
4211 PR c++/92746 - ICE with noexcept of function concept check.
4212 * except.c (check_noexcept_r): Handle concept-check.
4214 PR c++/92582 - ICE with member template as requirement.
4215 * pt.c (struct find_template_parameter_info): Add ctx_parms.
4216 (any_template_parm_r): Handle TEMPLATE_DECL.
4217 (find_template_parameters): Take parms instead of their depth.
4218 * constraint.cc (build_parameter_mapping): Pass them.
4220 PR c++/33799 - destroy return value if local cleanup throws.
4221 * cp-tree.h (current_retval_sentinel): New macro.
4222 * decl.c (start_preparsed_function): Set up cleanup for retval.
4223 * typeck.c (check_return_expr): Set current_retval_sentinel.
4225 PR c++/93238 - short right-shift with enum.
4226 * typeck.c (cp_build_binary_op): Use folded op1 for short_shift.
4228 2020-01-10 Jason Merrill <jason@redhat.com>
4230 * typeck.c (cp_build_binary_op): Restore short_shift code.
4232 PR c++/93143 - incorrect tree sharing with constexpr.
4233 * constexpr.c (cxx_eval_outermost_constant_expr): Don't assume
4234 CONSTRUCTORs are already unshared.
4236 PR c++/93173 - incorrect tree sharing.
4238 * cp-gimplify.c (cp_gimplify_init_expr, cp_gimplify_expr): Use
4239 copy_if_shared after cp_genericize_tree.
4240 * typeck2.c (split_nonconstant_init): Don't unshare here.
4242 2020-01-08 Jason Merrill <jason@redhat.com>
4244 * cp-gimplify.c (cp_gimplify_expr) [TARGET_EXPR]: Check
4245 TARGET_EXPR_DIRECT_INIT_P.
4246 * constexpr.c (cxx_eval_constant_expression): Likewise.
4248 2020-01-08 Jason Merrill <jason@redhat.com>
4250 PR c++/91369 - constexpr destructor and member initializer.
4251 * constexpr.c (cxx_eval_store_expression): Look through TARGET_EXPR
4252 when not preevaluating.
4254 2020-01-08 Jason Merrill <jason@redhat.com>
4256 * constexpr.c (cxx_eval_call_expression): Remove DECL_BY_REFERENCE
4259 2020-01-07 Paolo Carlini <paolo.carlini@oracle.com>
4261 * init.c (build_new): Add location_t parameter and use it throughout.
4262 (build_raw_new_expr): Likewise.
4263 * parser.c (cp_parser_new_expression): Pass the combined_loc.
4264 * pt.c (tsubst_copy_and_build): Adjust call.
4265 * cp-tree.h: Update declarations.
4267 2020-01-07 Jason Merrill <jason@redhat.com>
4269 PR c++/47877 - -fvisibility-inlines-hidden and member templates.
4270 * decl2.c (determine_visibility): -fvisibility-inlines-hidden beats
4271 explicit class visibility for a template.
4273 2020-01-07 Richard Sandiford <richard.sandiford@arm.com>
4275 * mangle.c (mangle_type_attribute_p): New function, split out from...
4276 (write_CV_qualifiers_for_type): ...here. Don't mangle attributes
4277 that contain a space.
4279 2020-01-07 Jakub Jelinek <jakub@redhat.com>
4282 * constexpr.c (struct constexpr_global_ctx): Add heap_alloc_count
4283 member, initialize it to zero in ctor.
4284 (cxx_eval_call_expression): Bump heap_dealloc_count when deleting
4285 a heap object. Don't cache calls to functions which allocate some
4286 heap objects and don't deallocate them or deallocate some heap
4287 objects they didn't allocate.
4289 2020-01-06 Jason Merrill <jason@redhat.com>
4291 PR c++/92552 - ICE with inherited constrained default ctor.
4292 * pt.c (instantiate_class_template_1): Copy
4293 TYPE_HAS_USER_CONSTRUCTOR.
4294 * class.c (one_inherited_ctor): Don't set it here.
4296 2020-01-06 Andrew Sutton <asutton@lock3software.com>
4298 PR c++/92739 - parsing requires clause with attributes.
4299 * parser.c (cp_parser_constraint_requires_parens): Exclude
4300 attributes as postfix expressions.
4302 2020-01-05 Jakub Jelinek <jakub@redhat.com>
4305 * parser.c (cp_parser_check_class_key): Disable access checks for the
4307 (cp_parser_maybe_warn_enum_key): Likewise. Return early if
4308 !warn_redundant_tags.
4310 2010-01-05 Jakub Jelinek <jakub@redhat.com>
4313 * cp-gimplify.c (cp_gimplify_init_expr): Don't look through
4314 TARGET_EXPR if it has been gimplified already.
4316 2020-01-03 Jason Merrill <jason@redhat.com>
4318 PR c++/93033 - incorrect tree node sharing with array init.
4319 * typeck2.c (split_nonconstant_init): Unshare non-decl.
4320 * cp-gimplify.c (cp_gimplify_init_expr): Only split if -fexceptions.
4322 2020-01-02 Jason Merrill <jason@redhat.com>
4324 * pt.c (invalid_nontype_parm_type_p): Reject class placeholder in
4327 2020-01-02 Jakub Jelinek <jakub@redhat.com>
4330 * cp-objcp-common.c (identifier_global_tag): Return NULL_TREE if name
4331 has not been found, rather than error_mark_node.
4333 2020-01-01 Jakub Jelinek <jakub@redhat.com>
4335 Update copyright years.
4337 Copyright (C) 2020 Free Software Foundation, Inc.
4339 Copying and distribution of this file, with or without modification,
4340 are permitted in any medium without royalty provided the copyright
4341 notice and this notice are preserved.