1 2020-09-14 Marek Polacek <polacek@redhat.com>
3 * pt.c (push_template_decl_real): Use VAR_OR_FUNCTION_DECL_P.
5 2020-09-14 Nathan Sidwell <nathan@acm.org>
7 * pt.c (push_template_decl_real): Don't attach a template head to
9 (tsubst_function_decl): Add support for headless local extern
11 (tsubst_decl): Add support for headless local extern decls.
13 2020-09-11 Nathan Sidwell <nathan@acm.org>
15 * decl.c (grokfndecl): Don't attach to local extern.
17 2020-09-11 Nathan Sidwell <nathan@acm.org>
19 * parser.c (cp_parser_objc_method_definition_list): Reimplement
20 loop, make sure we pop scope.
22 2020-09-11 Marek Polacek <polacek@redhat.com>
24 * cp-tree.h (LOOKUP_CONSTINIT): Remove.
25 (LOOKUP_REWRITTEN): Adjust.
26 * decl.c (duplicate_decls): Set DECL_DECLARED_CONSTINIT_P.
27 (check_initializer): Use DECL_DECLARED_CONSTINIT_P instead of
29 (cp_finish_decl): Don't set DECL_DECLARED_CONSTINIT_P. Use
30 DECL_DECLARED_CONSTINIT_P instead of LOOKUP_CONSTINIT.
31 (grokdeclarator): Set DECL_DECLARED_CONSTINIT_P.
32 * decl2.c (grokfield): Don't handle LOOKUP_CONSTINIT.
33 * parser.c (cp_parser_decomposition_declaration): Remove
34 LOOKUP_CONSTINIT handling.
35 (cp_parser_init_declarator): Likewise.
36 * pt.c (tsubst_expr): Likewise.
37 (instantiate_decl): Likewise.
38 * typeck2.c (store_init_value): Use DECL_DECLARED_CONSTINIT_P instead
41 2020-09-10 Nathan Sidwell <nathan@acm.org>
43 * cp-tree.h (TINFO_VAR_DECLARED_CONSTINIT): Replace with ...
44 (DECL_DECLARED_CONSTINIT_P): ... this.
45 * decl.c (start_decl): No need to retrofit_lang_decl for constinit
47 (cp_finish_decl): Use DECL_DECLARED_CONSTINIT_P.
48 * pt.c (tsubst_decl): No need to handle constinit flag
50 (tsubst_expr): Or here.
52 2020-09-10 Nathan Sidwell <nathan@acm.org>
54 * cp-tree.h (DECL_LOCAL_FUNCTION_P): Rename to ...
55 (DECL_LOCAL_DECL_P): ... here. Accept both fns and vars.
56 * decl.c (start_decl): Set DECL_LOCAL_DECL_P for local externs.
57 (omp_declare_variant_finalize_one): Use DECL_LOCAL_DECL_P.
58 (local_variable_p): Simplify.
59 * name-lookup.c (set_decl_context_in_fn): Assert DECL_LOCAL_DECL_P
60 is as expected. Simplify.
61 (do_pushdecl): Don't set decl_context_in_fn for friends.
62 (is_local_extern): Simplify.
63 * call.c (equal_functions): Use DECL_LOCAL_DECL_P.
64 * parser.c (cp_parser_postfix_expression): Likewise.
65 (cp_parser_omp_declare_reduction): Likewise.
66 * pt.c (check_default_tmpl_args): Likewise.
67 (tsubst_expr): Assert nested reduction function is local.
68 (type_dependent_expression_p): Use DECL_LOCAL_DECL_P.
69 * semantics.c (finish_call_expr): Likewise.
71 2020-09-09 Marek Polacek <polacek@redhat.com>
74 * decl.c (reshape_init): If we're initializing a char array from
75 a string-literal that is enclosed in braces, unwrap it.
76 * init.c (build_new_1): Don't handle string-initializers here.
77 (build_new): Handle new-expression with paren-init when the
78 array bound is known. Always pass string constants to build_new_1
79 enclosed in braces. Don't handle string-initializers in any
82 2020-09-09 Marek Polacek <polacek@redhat.com>
85 * decl.c (reshape_init_r): When initializing an aggregate member
86 with an initializer from an initializer-list, also consider
89 2020-09-09 Nathan Sidwell <nathan@acm.org>
91 * parser.c (cp_parser_omp_declare_reduction): Refactor to avoid
92 code duplication. Update DECL_TI_TEMPLATE's context.
93 * pt.c (tsubst_expr): For OMP reduction function, set context to
94 global_namespace before pushing.
95 (tsubst_omp_udr): Assert current_function_decl, add comment about
98 2020-09-09 Patrick Palka <ppalka@redhat.com>
101 * class.c (resolve_address_of_overloaded_function): Check
102 constraints_satisfied_p and perform return-type deduction via
103 maybe_instantiate_decl when considering non-template functions
105 * cp-tree.h (maybe_instantiate_decl): Declare.
106 * decl2.c (maybe_instantiate_decl): Remove static.
108 2020-09-04 Jason Merrill <jason@redhat.com>
110 * expr.c (mark_use): Use iloc_sentinel.
112 2020-09-03 Jakub Jelinek <jakub@redhat.com>
115 * constexpr.c (fundef_copies_table): Change type from
116 hash_map<tree, tree> * to decl_tree_map *.
118 2020-09-03 Marek Polacek <polacek@redhat.com>
121 * cp-tree.h (do_aggregate_paren_init): Declare.
122 * decl.c (do_aggregate_paren_init): New.
123 (grok_reference_init): Use it.
124 (check_initializer): Likewise.
125 * init.c (perform_member_init): Handle initializing an array from
126 a ()-list. Use do_aggregate_paren_init.
128 2020-09-03 Jakub Jelinek <jakub@redhat.com>
131 * constexpr.c (cxx_eval_outermost_constant_expr): Temporarily disable
132 flag_rounding_math during manifestly constant evaluation.
134 2020-09-01 Marek Polacek <polacek@redhat.com>
137 * init.c (build_new_1): Call reshape_init.
139 2020-09-01 Jakub Jelinek <jakub@redhat.com>
142 * semantics.c (handle_omp_array_sections_1): Test
143 DECL_ARRAY_PARAMETER_P only on PARM_DECLs.
145 2020-08-31 Marek Polacek <polacek@redhat.com>
146 Jason Merrill <jason@redhat.com>
149 * call.c (build_new_method_call_1): Use build_constructor_from_vec
150 instead of build_tree_list_vec + build_constructor_from_list.
151 * init.c (build_new_1): Handle new char[]{"foo"}. Use
152 build_constructor_from_vec instead of build_tree_list_vec +
153 build_constructor_from_list.
154 (build_new): Deduce the array size in new-expression if not
155 present. Handle ()-init. Handle initializing an array from
157 * parser.c (cp_parser_new_type_id): Leave [] alone.
158 (cp_parser_direct_new_declarator): Allow [].
159 * pt.c (type_dependent_expression_p): In a NEW_EXPR, consider
160 array types whose dimension has to be deduced type-dependent.
162 2020-08-27 Martin Liska <mliska@suse.cz>
164 * class.c (build_vtbl_initializer): Set exact argument of a vector
165 growth function to true.
166 * constraint.cc (get_mapped_args): Likewise.
167 * decl.c (cp_maybe_mangle_decomp): Likewise.
168 (cp_finish_decomp): Likewise.
169 * parser.c (cp_parser_omp_for_loop): Likewise.
170 * pt.c (canonical_type_parameter): Likewise.
171 * rtti.c (get_pseudo_ti_init): Likewise.
173 2020-08-26 Nathan Sidwell <nathan@acm.org>
175 * decl.c (poplevel): A local-binding tree list holds the name in
177 * name-lookup.c (update_local_overload): Add id to TREE_PURPOSE.
178 (lookup_name_1): Deal with local-binding error_mark_node marker.
179 (op_unqualified_lookup): Return error_mark_node for 'nothing
180 found'. Retain global binding, check class binding here.
181 (maybe_save_operator_binding): Reimplement to always cache a
183 (push_operator_bindings): Deal with 'ignore' marker.
185 2020-08-25 Tobias Burnus <tobias@codesourcery.com>
188 * semantics.c (handle_omp_array_sections_1): Talk about
189 array function parameter in the error message.
191 2020-08-25 Jakub Jelinek <jakub@redhat.com>
194 * cp-tree.h (build_trivial_dtor_call): Add bool argument defaulted
196 * call.c (build_trivial_dtor_call): Add NO_PTR_DEREF argument. If
197 instance is a pointer and NO_PTR_DEREF is true, clobber the pointer
198 rather than what it points to.
199 * semantics.c (finish_call_expr): Call build_trivial_dtor_call with
200 true as NO_PTR_DEREF.
202 2020-08-25 Jason Merrill <jason@redhat.com>
205 * optimize.c (populate_clone_array): Revert PR70462 change.
206 (maybe_clone_body): Likewise.
208 2020-08-24 Nathan Sidwell <nathan@acm.org>
210 * ptree.c (debug_overload): New.
212 2020-08-19 Jason Merrill <jason@redhat.com>
215 * cp-tree.h (push_tinst_level, push_tinst_level_loc): Declare.
216 * constraint.cc (satisfy_declaration_constraints):
217 Use add_outermost_template_args and push_tinst_level.
218 * pt.c (add_outermost_template_args): Handle getting
219 a TEMPLATE_DECL as the first argument.
220 (push_tinst_level, push_tinst_level_loc): No longer static.
221 (fn_type_unification): Check satisfaction before non-dependent
224 2020-08-18 Nathan Sidwell <nathan@acm.org>
226 * cp-tree.h (SET_TYPE_TEMPLTE_INFO): Do not deal with ALIAS templates.
227 * pt.c (lookup_template_class_1): Special-case alias template
228 template_info setting.
230 2020-08-18 Jason Merrill <jason@redhat.com>
233 * pt.c (tsubst_aggr_type): Rewrite in C++17, too.
234 (maybe_dependent_member_ref): Likewise.
235 (build_deduction_guide): Re-substitute template parms.
236 * cp-tree.h (struct push_nested_class_guard): New.
237 * constraint.cc (get_normalized_constraints_from_decl): Use it.
239 2020-08-18 Jason Merrill <jason@redhat.com>
242 * pt.c (maybe_dependent_member_ref): New.
243 (tsubst_copy) [CONST_DECL]: Use it.
244 [VAR_DECL]: Likewise.
245 (tsubst_aggr_type): Handle nested type.
247 2020-08-18 Nathan Sidwell <nathan@acm.org>
249 * name-lookup.c (qualify_lookup): Drop lambda checking here.
250 Reorder namespace & type checking.
251 (lookup_name_1): Do hidden lambda checking here.
253 2020-08-14 Nathan Sidwell <nathan@acm.org>
255 * name-lookup.h (lookup_name_real, lookup_name_nonclass): Rename
257 (lookup_name): ... these new overloads.
258 * name-lookup.c (identifier_type_value_1): Rename lookup_name_real
260 (lookup_name_real_1): Rename to ...
261 (lookup_name_1): ... here.
262 (lookup_name_real): Rename to ...
263 (lookup_name): ... here. Rename lookup_name_real_1 call.
264 (lookup_name_nonclass): Delete.
265 * call.c (build_operator_new_call): Rename lookup_name_real call.
266 (add_operator_candidates): Likewise.
267 (build_op_delete_call): Rename lookup_name_nonclass call.
268 * parser.c (cp_parser_lookup_name): Likewise.
269 * pt.c (tsubst_friend_class, lookup_init_capture_pack): Likewise.
270 (tsubst_expr): Likewise.
271 * semantics.c (capture_decltype): Likewise.
273 2020-08-14 Nathan Sidwell <nathan@acm.org>
275 * cp-tree.h (LOOKUP_HIDDEN): Delete.
276 (LOOKUP_PREFER_RVALUE): Adjust initializer.
277 * name-lookup.h (enum class LOOK_want): Add HIDDEN_FRIEND and
279 (lookup_name_real): Drop flags parm.
280 (lookup_qualified_name): Drop find_hidden parm.
281 * name-lookup.c (class name_lookup): Drop hidden field, adjust
283 (name_lookup::add_overload): Check want for hiddenness.
284 (name_lookup::process_binding): Likewise.
285 (name_lookup::search_unqualified): Likewise.
286 (identifier_type_value_1): Adjust lookup_name_real call.
287 (set_decl_namespace): Adjust name_lookup ctor.
288 (qualify_lookup): Drop flags parm, use want for hiddenness.
289 (lookup_qualified_name): Drop find_hidden parm.
290 (lookup_name_real_1): Drop flags parm, adjust qualify_lookup
292 (lookup_name_real): Drop flags parm.
293 (lookup_name_nonclass, lookup_name): Adjust lookup_name_real
295 (lookup_type_scope_1): Adjust qualify_lookup calls.
296 * call.c (build_operator_new_call): Adjust lookup_name_real call.
297 (add_operator_candidates): Likewise.
298 * coroutines.cc (morph_fn_to_coro): Adjust lookup_qualified_name
300 * parser.c (cp_parser_lookup_name): Adjust lookup_name_real calls.
301 * pt.c (check_explicit_specialization): Adjust
302 lookup_qualified_name call.
303 (deduction_guides_for): Likewise.
304 (tsubst_friend_class): Adjust lookup_name_real call.
305 (lookup_init_capture_pack): Likewise.
306 (tsubst_expr): Likewise, don't look in namespaces.
307 * semantics.c (capture_decltype): Adjust lookup_name_real. Don't
310 2020-08-14 Jason Merrill <jason@redhat.com>
314 * cp-tree.h (unsafe_return_slot_p): Declare.
315 * call.c (is_base_field_ref): Rename to unsafe_return_slot_p.
316 (build_over_call): Check unsafe_return_slot_p.
317 (build_special_member_call): Likewise.
318 * init.c (expand_default_init): Likewise.
319 * typeck2.c (split_nonconstant_init_1): Likewise.
321 2020-08-14 Nathan Sidwell <nathan@acm.org>
323 * cp-tree.h (LOOKUP_PREFER_TYPES, LOOKUP_PREFER_NAMESPACES)
324 (LOOKUP_NAMESPACES_ONLY, LOOKUP_TYPES_ONLY)
325 (LOOKUP_QUALIFIERS_ONL): Delete.
326 (LOOKUP_HIDDEN): Adjust.
327 * name-lookup.h (enum class LOOK_want): New.
328 (operator|, operator&): Overloads for it.
329 (lookup_name_real): Replace prefer_type & namespaces_only with
331 (lookup_qualified_name): Replace prefer_type with LOOK_want.
332 (lookup_name_prefer_type): Replace with ...
333 (lookup_name): ... this. New overload with LOOK_want parm.
334 * name-lookup.c (struct name_lookup): Replace flags with want and
335 hidden fields. Adjust constructors.
336 (name_lookyp::add_overload): Correct hidden stripping test. Update
337 for new LOOK_want type.
338 (name_lookup::process_binding): Likewise.
339 (name_lookup::search_unqualified): Use hidden flag.
340 (identifier_type_value_1): Adjust lookup_name_real call.
341 (set_decl_namespace): Adjust name_lookup ctor.
342 (lookup_flags): Delete.
343 (qualify_lookup): Add LOOK_want parm, adjust.
344 (lookup_qualified_name): Replace prefer_type parm with LOOK_want.
345 (lookup_name_real_1): Replace prefer_type and namespaces_only with
347 (lookup_name_real): Likewise.
348 (lookup_name_nonclass, lookup_name): Adjust lookup_name_real call.
349 (lookup_name_prefer_type): Rename to ...
350 (lookup_name): ... here. New overload with LOOK_want parm.
351 (lookup_type_scope_1): Adjust qualify_lookup calls.
352 * call.c (build_operator_new_call)
353 (add_operator_candidates): Adjust lookup_name_real calls.
354 * coroutines.cc (find_coro_traits_template_decl)
355 (find_coro_handle_template_decl, morph_fn_to_coro): Adjust
356 lookup_qualified_name calls.
357 * cp-objcp-common.c (identifier_global_tag): Likewise.
358 * decl.c (get_tuple_size, get_tuple_decomp_init): Likewise.
359 (lookup_and_check_tag): Use lookup_name overload.
360 * parser.c (cp_parser_userdef_numeric_literal): Adjust
361 lookup_qualified_name call.
362 (prefer_arg_type): Drop template_mem_access parm, return LOOK_want
364 (cp_parser_lookup_name): Adjust lookup_member, lookup_name_real
366 * pt.c (check_explicit_specialization): Adjust lookup_qualified_name
368 (tsubst_copy_and_build, tsubst_qualified_name): Likewise
369 (deduction_guides_for): Likewise.
370 (tsubst_friend_class): Adjust lookup_name_real call.
371 (lookup_init_capture, tsubst_expr): Likewise.
372 * rtti.c (emit_support_tinfos): Adjust lookup_qualified_name call.
373 * semantics.c (omp_reduction_lookup): Likewise.
374 (capture_decltype): Adjust lookup_name_real call.
376 2020-08-13 Nathan Sidwell <nathan@acm.org>
378 * name-lookup.h (enum class LOOK_where): New.
379 (operator|, operator&): Overloads for it.
380 (lookup_name_real): Replace NONCLASS & BLOCK_P parms with WHERE.
381 * name-lookup.c (identifier_type_value_w): Adjust
382 lookup_name_real call.
383 (lookup_name_real_1): Replace NONCLASS and BLOCK_P parameters
384 with WHERE bitmask. Don't search namespaces if not asked to.
385 (lookup_name_real): Adjust lookup_name_real_1 call.
386 (lookup_name_nonclass, lookup_name)
387 (lookup_name_prefer_type): Likewise.
388 * call.c (build_operator_new_call)
389 (add_operator_candidates): Adjust lookup_name_real calls.
390 * parser.c (cp_parser_lookup_name): Likewise.
391 * pt.c (tsubst_friend_class, lookup_init_capture_pack)
392 (tsubst_expr): Likewise.
393 * semantics.c (capture_decltype): Likewise.
395 2020-08-13 Marek Polacek <polacek@redhat.com>
398 * typeck.c (build_static_cast_1): Implement P1975R0 by allowing
399 static_cast to aggregate type.
401 2020-08-10 Jakub Jelinek <jakub@redhat.com>
404 * constexpr.c (cxx_eval_binary_expression): For SPACESHIP_EXPR, tail
405 call cxx_eval_constant_expression after genericize_spaceship to avoid
406 undesirable further VERIFY_CONSTANT.
408 2020-08-10 Patrick Palka <ppalka@redhat.com>
410 * pt.c (resolve_overloaded_unification): Drop functions with
411 unsatisfied constraints.
412 (resolve_nondeduced_context): Likewise.
414 2020-08-05 Patrick Palka <ppalka@redhat.com>
415 Jason Merrill <jason@redhat.com>
418 * constexpr.c (cxx_eval_vec_init_1): Truncate ctx->ctor and
419 then clear CONSTRUCTOR_NO_CLEARING on each appended element
420 initializer if we're initializing a previously zero-initialized
423 2020-08-04 Marek Polacek <polacek@redhat.com>
426 * parser.c (cp_parser_elaborated_type_specifier): Allow
427 'template' following ::.
429 2020-08-04 Nathan Sidwell <nathan@acm.org>
431 * parser.c (cp_parser_explicit_specialization): Refactor
432 to avoid leak of num_template_parameter_lists value.
434 2020-08-04 Patrick Palka <ppalka@redhat.com>
437 * init.c (sort_mem_initializers): Preserve TREE_TYPE of the
438 member initializer list node.
439 (emit_mem_initializers): Set input_location when performing each
440 member initialization.
441 * parser.c (cp_parser_mem_initializer): Attach the source
442 location of this initializer to a dummy EMPTY_CLASS_EXPR
443 within the TREE_TYPE of the list node.
444 * pt.c (tsubst_initializer_list): Preserve TREE_TYPE of the
445 member initializer list node.
447 2020-08-03 Marek Polacek <polacek@redhat.com>
449 * cp-tree.h (after_nsdmi_defaulted_late_checks): Remove.
451 2020-08-03 Marek Polacek <polacek@redhat.com>
455 * pt.c (check_default_tmpl_args): Also consider variable
458 2020-07-31 Jakub Jelinek <jakub@redhat.com>
461 * decl.c (finish_function): In constexpr functions use for C++14 and
462 later error instead of warning if no return statement is present and
463 diagnose it regardless of warn_return_type. Move the warn_return_type
464 diagnostics earlier in the function.
466 2020-07-31 Martin Sebor <msebor@redhat.com>
469 * class.c (build_base_path): Set no-warning bit on the synthesized
470 conditional expression in static_cast.
472 2020-07-31 Richard Biener <rguenther@suse.de>
475 * cp-objcp-common.h (LANG_HOOKS_FINALIZE_EARLY_DEBUG):
476 Define to c_common_finalize_early_debug.
478 2020-07-31 Patrick Palka <ppalka@redhat.com>
481 * constexpr.c (cxx_eval_constant_expression) <case CONST_DECL>:
482 Pass false to decl_constant_value and decl_really_constant_value
483 so that they don't unshare their result.
484 * cp-tree.h (decl_constant_value): New declaration with an added
486 (decl_really_constant_value): Add bool parameter defaulting to
487 true to existing declaration.
488 * init.c (constant_value_1): Add bool parameter which controls
489 whether to unshare the initializer before returning. Call
490 unshare_expr at most once.
491 (scalar_constant_value): Pass true to constant_value_1's new
493 (decl_really_constant_value): Add bool parameter and forward it
495 (decl_constant_value): Likewise, but instead define a new
496 overload with an added bool parameter.
498 2020-07-30 Patrick Palka <ppalka@redhat.com>
501 * pt.c (resolve_overloaded_unification): If the function
502 template specialization has a placeholder return type,
503 then instantiate it before attempting unification.
505 2020-07-30 Patrick Palka <ppalka@redhat.com>
508 * pt.c (alias_ctad_tweaks): Call remove_constraints before
509 calling set_constraints.
511 2020-07-30 Patrick Palka <ppalka@redhat.com>
514 * pt.c (reduce_template_parm_level): Propagate DECL_VIRTUAL_P
515 from the original TEMPLATE_PARM_DECL to the new lowered one.
517 2020-07-30 Patrick Palka <ppalka@redhat.com>
520 * constraint.cc (constraints_satisfied_p): Return true if
522 * pt.c (do_type_instantiation): Update a paragraph taken from
523 [temp.explicit] to reflect the latest specification. Don't
524 instantiate a member with unsatisfied constraints.
526 2020-07-29 Jason Merrill <jason@redhat.com>
529 * cp-tree.h (IMPLICIT_RVALUE_P): New.
530 (enum cp_lvalue_kind_flags): Add clk_implicit_rval.
531 (implicit_rvalue_p, set_implicit_rvalue_p): New.
532 * call.c (reference_binding): Check clk_implicit_rval.
533 (build_over_call): Adjust C++20 implicit move.
534 * coroutines.cc (finish_co_return_stmt): Simplify implicit move.
535 * except.c (build_throw): Adjust C++20 implicit move.
536 * pt.c (tsubst_copy_and_build) [STATIC_CAST_EXPR]: Propagate
538 * tree.c (lvalue_kind): Set clk_implicit_rval.
539 * typeck.c (treat_lvalue_as_rvalue_p): Overhaul.
540 (maybe_warn_pessimizing_move): Adjust.
541 (check_return_expr): Adjust C++20 implicit move.
543 2020-07-29 Jason Merrill <jason@redhat.com>
546 * call.c (build_over_call): Don't call a const ref
547 overload for implicit move.
549 2020-07-28 Nathan Sidwell <nathan@acm.org>
551 * cp-gimplify.c (cp_genericize_r): Set IMPORTED_DECL's context.
552 * cp-objcp-common.c (cp_pushdecl): Set decl's context.
553 * decl.c (grokfndecl): Make DECL_CONTEXT setting clearer.
555 2020-07-28 Nathan Sidwell <nathan@acm.org>
557 * class.c (fixup_type_variants): Copy TYPE_SIZE and
559 (finish_struct): Call it.
561 2020-07-28 Nathan Sidwell <nathan@acm.org>
563 * ptree.c (cxx_print_decl): Better indentation.
565 2020-07-28 Jakub Jelinek <jakub@redhat.com>
566 Mark Wielaard <mark@klomp.org>
569 * parser.c (cp_lexer_safe_previous_token): Don't call
570 cp_lexer_previous_token, instead inline it by hand and return NULL
571 instead of failing assertion if all previous tokens until the first
573 (cp_parser_error_1): Optimize - only call cp_lexer_safe_previous_token
574 if token->type is CPP_NAME. Use cp_lexer_safe_previous_token instead
575 of cp_lexer_previous_token for the missing_token_desc != RT_NONE
578 2020-07-27 Nathan Sidwell <nathan@acm.org>
580 * cp-tree.h (enum cp_tree_index): Add CPTI_AS_BASE_IDENTIFIER.
581 (as_base_identifier): Define.
582 * decl.c (initialize_predifined_identifiers): Initialize as_base
584 * class.c (layout_class_type): Name the as-base type. Zap
585 NSDMI its fields may have.
587 2020-07-22 Nathan Sidwell <nathan@acm.org>
589 * class.c (maybe_add_class_template_decl_list): Don't add CONST_DECLs.
591 2020-07-22 Nathan Sidwell <nathan@acm.org>
593 * typeck.c (structural_comptypes): [DECLTYPE_TYPE] break
595 [UNDERLYING_TYPE]: Use an if.
598 2020-07-22 Nathan Sidwell <nathan@acm.org>
600 * decl.c (decls_match): Move variables into scopes
602 (duplicate_decls): Use STRIP_TEMPLATE.
603 (build_typename_type): Move var decls to their assignments.
604 (begin_function_body): Likewise.
605 * decl2.c (get_guard): Likewise.
606 (mark_used): Use true for truthiness.
607 * error.c (dump_aggr_type): Hold the decl in a var called
610 2020-07-22 Nathan Sidwell <nathan@acm.org>
612 * cp-tree.h (struct tree_lambda_expr): Shrink
613 default_capture_mode & discriminator.
615 2020-07-22 Nathan Sidwell <nathan@acm.org>
617 * mangle.c (decl_is_template_id): Rename to ...
618 (maybe_template_info): ... here. Return the template info,
619 rather than use a pointer. Adjust all callers.
620 (find_substitution): Use template_args_equal, rather than
623 2020-07-22 Tobias Burnus <tobias@codesourcery.com>
625 * parser.c (cp_parser_omp_clause_hint): Require nonnegative hint.
626 (cp_parser_omp_critical): Permit hint(0) clause without named critical.
627 * pt.c (tsubst_expr): Re-check the latter for templates.
629 2020-07-21 Sunil K Pandey <skpgkp2@gmail.com>
632 * decl.c (cp_finish_decl): Call target hook
633 lower_local_decl_alignment to lower local decl alignment.
635 2020-07-21 Nathan Sidwell <nathan@acm.org>
637 * parser.c (cp_lexer_consume_token): Drop PRAGMA_EOL assert.
638 (cp_parser_skip_to_closing_parenthesis_1): Only pass start token
639 to pragma skipper if recovering.
640 (cp_parser_skip_to_pragma_eol): Only purge and change pragma
641 state when recovering.
643 2020-07-20 Jason Merrill <jason@redhat.com>
645 * pt.c (type_dependent_expression_p): A pseudo-dtor can be
647 * semantics.c (finish_call_expr): Use build_trivial_dtor_call for
649 (finish_pseudo_destructor_expr): Leave type NULL for dependent arg.
651 2020-07-20 Jason Merrill <jason@redhat.com>
653 * mangle.c (write_base_ref): New.
654 (write_expression): Use it for base field COMPONENT_REFs.
655 * pt.c (invalid_tparm_referent_p): Canonicalize the type
656 of array offsets. Allow subobjects.
658 2020-07-20 Jason Merrill <jason@redhat.com>
660 * pt.c (collect_ctor_idx_types): Add 'const' when deducing from
663 2020-07-17 Marek Polacek <polacek@redhat.com>
666 * decl.c (grokdeclarator): Detect cv-qual decltype(auto).
667 * pt.c (do_auto_deduction): Likewise.
669 2020-07-16 Iain Sandoe <iain@sandoe.co.uk>
676 * coroutines.cc (struct coro_ret_data): Delete.
677 (coro_maybe_expand_co_return): Delete.
678 (co_return_expander): Delete.
679 (expand_co_returns): Delete.
680 (co_await_find_in_subtree): Remove unused name.
681 (build_actor_fn): Remove unused parm, remove handling
682 for co_return expansion.
683 (register_await_info): Demote duplicate info message to a
685 (coro_make_frame_entry): Move closer to use site.
686 (struct susp_frame_data): Add fields for final suspend label
687 and a flag to indicate await expressions with initializers.
688 (captures_temporary): Delete.
689 (register_awaits): Remove unused code, update comments.
690 (find_any_await): New.
691 (tmp_target_expr_p): New.
692 (struct interesting): New.
693 (find_interesting_subtree): New.
694 (struct var_nest_node): New.
695 (flatten_await_stmt): New.
696 (handle_nested_conditionals): New.
697 (process_conditional): New.
698 (replace_statement_captures): Rename to...
699 (maybe_promote_temps): ... this.
700 (maybe_promote_captured_temps): Delete.
701 (analyze_expression_awaits): Check for await expressions with
702 initializers. Simplify handling for truth-and/or-if.
703 (expand_one_truth_if): Simplify (map cases that need expansion
705 (await_statement_walker): Handle CO_RETURN_EXPR. Simplify the
706 handling for truth-and/or-if expressions.
707 (register_local_var_uses): Ensure that we create names in the
708 implementation namespace.
709 (morph_fn_to_coro): Add final suspend label to suspend frame
710 callback data and remove it from the build_actor_fn call.
712 2020-07-16 Marek Polacek <polacek@redhat.com>
714 * call.c (convert_like): Remove macro and introduce a new
716 (convert_like_with_context): Likewise.
717 (convert_like_real): Rename to convert_like.
718 (convert_like_real_1): Rename to convert_like_internal. Call
719 convert_like instead of convert_like_real therein.
720 (perform_direct_initialization_if_possible): Call convert_like
721 instead of convert_like_real.
723 2020-07-16 Iain Sandoe <iain@sandoe.co.uk>
725 * coroutines.cc: Correct some spelling errors
728 2020-07-15 Nathan Sidwell <nathan@acm.org>
730 * parser.c (cp_parser_declaration): Avoid copying tokens.
731 (cp_parser_block_declaration): RAII token pointer.
733 2020-07-15 Nathan Sidwell <nathan@acm.org>
735 * parser.c (cp_parser_skip_to_closing_parenthesis_1): Deal with
736 meeting a deferred pragma.
737 (cp_parser_skip_to_end_of_statement): Likewise.
738 (cp_parser_skip_to_end_of_block_or_statement): Likewise.
739 (cp_parser_skip_to_pragma_eol): We should never meet EOF.
740 (cp_parser_omp_declare_simd): Likewise.
741 (cp_parser_omp_declare_reduction, cp_parser_oacc_routine)
742 (pragma_lex): Likewise.
744 2020-07-14 Marek Polacek <polacek@redhat.com>
749 * call.c (convert_like_real_1): Renamed from convert_like_real.
750 (convert_like_real): New wrapper for convert_like_real_1.
752 2020-07-14 Nathan Sidwell <nathan@acm.org>
754 * parser.c (cp_lexer_alloc): Do not deal with PCH here.
755 (cp_lexer_new_main): Deal with PCH here. Store the tokens directly
757 (cp_lexer_new_from_tokens): Assert last token isn't purged either.
758 (cp_lexer_get_preprocessor_token): Change first arg to flags, adjust.
759 (cp_parser_new): Pass the lexer in, don't create it here.
760 (cp_parser_translation_unit): Initialize access checks here.
761 (cp_parser_initial_pragma): First token is provided by caller,
762 don't deal with PCH stopping here. Adjust error message.
763 (c_parse_file): Adjust, change error message to avoid C++20 module
766 2020-07-14 Nathan Sidwell <nathan@acm.org>
768 * ptree.c (cxx_print_type): Add TYPEOF_TYPE and BASES.
770 2020-07-14 Nathan Sidwell <nathan@acm.org>
772 * class.c (build_base_field_1): Cache CLASSTYPE_AS_BASE.
773 (build_self_reference): Rename value -> decl.
774 (dump_class_hierarchy_1): Cache CLASSTYPE_AS_BASE.
776 2020-07-14 Marek Polacek <polacek@redhat.com>
779 * decl.c (grokdeclarator) <case cdk_function>: Check also
780 pointers/references/... to functions.
782 2020-07-14 Nathan Sidwell <nathan@acm.org>
784 * cp-tree.h: Correct some tree lang flag comments,
785 reformat some structure definitions. Note some structure
786 sizes. Clarify some comments.
787 (yyungetc): Delete. Not been a thing for some time.
788 * class.c (copy_fndecl_with_name): Comment.
789 (check_bases_and_members): Unnecessary {}.
790 (layout_class_type): Comment.
791 * cp-tree.def (UNBOUND_CLASS_TEMPLATE): Adjust comment.
792 * decl.c: Fix some formatting & whitespace issues.
793 (function_requirements_equivalent_p): Note why
794 substitutions are needed.
795 * decl2.c (no_linkage_error): Note that heroics about
796 'typedef struct { ... };' are no longer needed.
797 * method.c: Whitespace.
798 * name-lookup.c: Whitespace.
799 (add_decl_to_level): Reformat a line.
800 (print_binding_stack): Mark as DEBUG_FUNCTION.
801 (has_using_namespace_std_directive_p): Delete comment.
803 * ptree.c: Whitespace.
804 * rtti.c: Whitespace & comment.
806 * typeck.c (structural_comptypes): Add comment.
808 2020-07-13 Nathan Sidwell <nathan@acm.org>
810 * Make-lang.in (c++.disclean): Likewise.
812 2020-07-13 Marek Polacek <polacek@redhat.com>
815 * parser.c (cp_parser_enum_specifier): Commit to tentative parse
816 after we've seen an opening brace.
818 2020-07-10 Jason Merrill <jason@redhat.com>
820 * tree.c (structural_type_p): Allow unions.
821 * mangle.c (write_expression): Express unions with a designator.
823 2020-07-10 Jason Merrill <jason@redhat.com>
825 * pt.c (convert_nontype_argument): Handle REAL_TYPE.
826 (invalid_nontype_parm_type_p): Allow all structural types.
827 * tree.c (structural_type_p): Use SCALAR_TYPE_P.
829 2020-07-10 Jason Merrill <jason@redhat.com>
834 * class.c (check_field_decls): An array of empty classes is not an
836 (layout_empty_base_or_field): Handle explicit alignment.
839 2020-07-09 Julian Brown <julian@codesourcery.com>
840 Thomas Schwinge <thomas@codesourcery.com>
843 * semantics.c (finish_omp_clauses): Likewise.
845 2020-07-09 Patrick Palka <ppalka@redhat.com>
848 * constexpr.c (potential_constant_expression_1) <case PARM_DECL>:
849 Restore dependent_type_p check that guarded the call to
850 is_really_empty_class.
852 2020-07-08 Patrick Palka <ppalka@redhat.com>
855 * constexpr.c (potential_constant_expression_1) <case PARM_DECL>:
856 When processing_template_decl, check COMPLETE_TYPE_P before
857 calling is_really_empty_class. Don't check dependent_type_p.
859 2020-07-08 Marek Polacek <polacek@redhat.com>
862 * parser.c (cp_parser_decltype): Print error about using decltype(auto)
863 in C++11. Check that the token following "auto" is ")".
865 2020-07-07 Patrick Palka <ppalka@redhat.com>
868 * cxx-pretty-print.c (pp_cxx_unqualified_id): Check
869 PRIMARY_TEMPLATE_P before printing the innermost template
872 2020-07-07 Martin Sebor <msebor@redhat.com>
875 * parser.c (class_decl_loc_t::diag_mismatched_tags): Print notes only
876 if warning_at returns nonzero.
878 2020-07-06 Martin Sebor <msebor@redhat.com>
881 * call.c (build_over_call): Check calls only when tf_warning is set.
883 2020-07-06 Nathan Sidwell <nathan@acm.org>
885 * decl.c (push_library_fn): Return the decl pushdecl_toplevel returns.
886 * except.c (verify_library_fn): Replace with ...
887 (declare_library_fn_1): ... this fn. Always push the fn.
888 (declare_library_fn): Call it.
889 (build_throw): Call declare_library_fn_1.
891 2020-07-06 Jonathan Wakely <jwakely@redhat.com>
894 * parser.c (cp_parser_toplevel_declaration): Only do pedwarn for
895 empty-declaration in C++98.
897 2020-07-02 Jason Merrill <jason@redhat.com>
898 Jakub Jelinek <jakub@redhat.com>
900 * decl.c (grokfndecl): Allow consteval virtual.
901 * search.c (check_final_overrider): Check consteval mismatch.
902 * constexpr.c (cxx_eval_thunk_call): New.
903 (cxx_eval_call_expression): Call it.
904 * cvt.c (cp_get_fndecl_from_callee): Handle FDESC_EXPR.
905 * decl2.c (mark_vtable_entries): Track vtables with consteval.
906 (maybe_emit_vtables): Pass consteval_vtables through.
907 (clear_consteval_vfns): Replace consteval with nullptr.
908 (c_parse_final_cleanups): Call it.
910 2020-07-01 Nathan Sidwell <nathan@acm.org>
912 * class.c (copy_fndecl_with_name): Add additional predicate args, do
913 not deduce them locally.
914 (copy_operator_fn): Adjust copy_fndecl_with_name call.
915 (build_clone): Add vtt and inherited predicate args. Pass through
916 to copy_fndecl_with_name call.
917 (build_cdtor_clones): Likewise, pass through to build_clone as
919 (build_cdtor): Determine vtt and inherited here.
920 * cp-tree.h (DECL_NEEDS_CTT_PARM_P): Delete.
922 2020-06-30 Nathan Sidwell <nathan@acm.org>
924 * cp-tree.h (copy_fndecl_with_name): Rename to ...
925 (copy_operatorn_fn): ... this. Change arg type.
926 (clone_function_decl): Rename to ...
927 (clone_cdtor): ... this.
928 * class.c (copy_fndecl_with_name): Make static.
929 (copy_operator_fn): New wrapper.
930 (build_clones): Rename to ...
931 (build_cdtor_clones): ... this.
932 (clone_function_decl): Rename to ...
933 (clone_cdtor): ... this. Adjust build_clones calls.
934 (clone_constructors_and_destructors): Adjust clone_function_decl
936 * method.c (implicitly_declare_fn): Adjust copy_fndecl_with_name
938 (lazily_declare_fn): Adjust clone_function_decl call.
939 * pt.c (tsubst_function_decl): Likewise.
940 (instantiate_template_1): Likewise.
942 2020-06-30 Iain Sandoe <iain@sandoe.co.uk>
944 * coroutines.cc (morph_fn_to_coro): Remove trailing
945 space in a diagnostic.
947 2020-06-30 Iain Sandoe <iain@sandoe.co.uk>
949 * coroutines.cc (expand_one_await_expression): Remove
950 code dealing with initial suspend.
951 (build_actor_fn): Remove code special-casing initial
952 and final suspend. Handle the final suspend and marking
953 of the coroutine as done.
954 (coro_rewrite_function_body): New.
955 (bind_expr_find_in_subtree): Remove.
956 (coro_body_contains_bind_expr_p): Remove.
957 (morph_fn_to_coro): Split the rewrite of the original
958 function into coro_rewrite_function_body and call it.
960 2020-06-29 Marek Polacek <polacek@redhat.com>
963 * decl.c (duplicate_decls): Make sure a concept or a variable
964 template is unique in its declarative region.
966 2020-06-29 Marek Polacek <polacek@redhat.com>
969 * pt.c (collect_ctor_idx_types): Use TREE_TYPE.
971 2020-06-28 Iain Sandoe <iain@sandoe.co.uk>
974 * coroutines.cc (register_local_var_uses): Skip past
977 2020-06-27 Iain Sandoe <iain@sandoe.co.uk>
980 * coroutines.cc (get_awaitable_var): New helper.
981 (build_co_await): Check more carefully before
982 copying an awaitable.
983 (expand_one_await_expression): No initializer
984 is required when the awaitable is not a temp.
985 (register_awaits): Remove handling that is now
986 completed when the await expression is built.
988 2020-06-27 Iain Sandoe <iain@sandoe.co.uk>
990 * coroutines.cc (morph_fn_to_coro): Diagnose unavailable
991 get_return_object_on_allocation_failure.
993 2020-06-26 Iain Sandoe <iain@sandoe.co.uk>
996 * coroutines.cc (struct coroutine_info):Add a field
997 to hold computed p.return_void expressions.
998 (coro_build_promise_expression): New.
999 (get_coroutine_return_void_expr): New.
1000 (finish_co_yield_expr): Build the promise expression
1001 using coro_build_promise_expression.
1002 (finish_co_return_stmt): Likewise.
1003 (build_init_or_final_await): Likewise.
1004 (morph_fn_to_coro): Likewise, for several cases.
1006 2020-06-26 Iain Sandoe <iain@sandoe.co.uk>
1008 * coroutines.cc (morph_fn_to_coro): Handle error
1009 returns in building g-r-o-o-a-f expressions.
1011 2020-06-24 Nicholas Krause <xerofoify@gmail.com>
1014 * typeck2.c (cxx_incomplete_type_diagnostic): Add missing
1015 TYPE_EXPANSION_PACK check for diagnosing incomplete types in
1016 cxx_incomplete_type_diagnostic.
1018 2020-06-24 Iain Sandoe <iain@sandoe.co.uk>
1022 * coroutines.cc (act_des_fn): Copy function
1023 attributes onto the outlined coroutine helpers.
1025 2020-06-24 Jason Merrill <jason@redhat.com>
1027 * call.c (build_over_call): Only call build_base_path once.
1029 2020-06-24 Jason Merrill <jason@redhat.com>
1032 * call.c (build_over_call): Look up the overrider in base_binfo.
1033 * class.c (lookup_vfn_in_binfo): Look through BINFO_PRIMARY_P.
1035 2020-06-23 Jason Merrill <jason@redhat.com>
1038 Implement C++20 P2082R1, Fixing CTAD for aggregates.
1039 * cp-tree.h (TPARMS_PRIMARY_TEMPLATE): Split out from...
1040 (DECL_PRIMARY_TEMPLATE): ...here.
1041 (builtin_guide_p): Declare.
1042 * decl.c (reshape_init_class): Handle bases of a template.
1043 (reshape_init_r): An array with dependent bound takes a single
1045 * pt.c (tsubst_default_argument): Shortcut {}.
1046 (unify_pack_expansion): Allow omitted arguments to trailing pack.
1047 (builtin_guide_p): New.
1048 (collect_ctor_idx_types): Give a trailing pack a {} default
1049 argument. Handle arrays better.
1051 2020-06-23 Iain Sandoe <iain@sandoe.co.uk>
1054 * coroutines.cc (morph_fn_to_coro): Apply a cleanup to
1055 the get return object when the DTOR is non-trivial.
1057 2020-06-20 Iain Sandoe <iain@sandoe.co.uk>
1060 * coroutines.cc (morph_fn_to_coro): Update handling of
1061 get-return-object-on-allocation-fail and diagnose missing
1064 2020-06-20 Jason Merrill <jason@redhat.com>
1066 * call.c (joust): Only compare constraints for non-template
1067 candidates with matching parameters.
1068 * pt.c (tsubst_pack_expansion): Fix getting a type parameter
1070 (more_specialized_fn): Only compare constraints for candidates with
1071 matching parameters.
1073 2020-06-19 Jason Merrill <jason@redhat.com>
1075 * method.c (early_check_defaulted_comparison): Allow defaulting
1076 comparison outside class. Complain if non-member operator isn't a
1079 2020-06-18 Jason Merrill <jason@redhat.com>
1081 * method.c (early_check_defaulted_comparison): Check for &&.
1082 (build_comparison_op): Allow empty union. Diagnose non-category
1084 (common_comparison_type): Remove handling for non-category type.
1086 2020-06-18 Marek Polacek <polacek@redhat.com>
1089 * pt.c (finish_template_variable): Return if
1090 coerce_innermost_template_parms return error_mark_node.
1092 2020-06-18 Marek Polacek <polacek@redhat.com>
1095 * pt.c (tsubst_copy_and_build) <case NEW_EXPR>: Return error_mark_node
1096 if placement is erroneous.
1098 2020-06-17 Jonathan Wakely <jwakely@redhat.com>
1101 * parser.c (cp_parser_elaborated_type_specifier): Do not warn
1102 unless in a declaration.
1104 2020-06-17 Jason Merrill <jason@redhat.com>
1106 * cp-tree.h (copy_fndecl_with_name): Declare.
1107 * class.c (copy_fndecl_with_name): Split out from...
1108 (build_clone): ...here.
1109 (add_implicitly_declared_members): Add op== to TYPE_FIELDS.
1110 * method.c (implicitly_declare_fn): Use copy_fndecl_with_name.
1112 2020-06-17 Jason Merrill <jason@redhat.com>
1114 * call.c (build_new_op_1): Don't look for a CALL_EXPR when
1115 calling a consteval function.
1117 2020-06-17 Jason Merrill <jason@redhat.com>
1119 * decl2.c (grokfield): Pass SD_DEFAULTED and SD_DELETED.
1120 * decl.c (duplicate_decls): Reduce error for delete
1121 after earlier declaration to pedwarn.
1123 2020-06-17 Marek Polacek <polacek@redhat.com>
1126 * constexpr.c (maybe_fold_non_dependent_expr): New.
1127 * cp-tree.h (maybe_fold_non_dependent_expr): Declare.
1128 * typeck.c (cp_build_array_ref): Call maybe_fold_non_dependent_expr
1129 instead of maybe_constant_value.
1131 2020-06-16 Marek Polacek <polacek@redhat.com>
1134 * call.c (add_list_candidates): Return if a designated initializer
1135 is used with a non-aggregate.
1136 (implicit_conversion_error): Give an error for the case above.
1138 2020-06-16 Marek Polacek <polacek@redhat.com>
1141 * name-lookup.c (check_local_shadow): Check if types are
1142 non-null before calling same_type_p.
1144 2020-06-16 Jakub Jelinek <jakub@redhat.com>
1146 * semantics.c (handle_omp_for_class_iterator): Adjust
1147 c_omp_check_loop_iv_exprs caller.
1148 (finish_omp_for): Likewise. Don't call fold_build_cleanup_point_expr
1149 before calling c_finish_omp_for and c_omp_check_loop_iv, move it
1151 * pt.c (tsubst_omp_for_iterator): Handle non-rectangular loops.
1153 2020-06-16 Jakub Jelinek <jakub@redhat.com>
1155 * parser.c (cp_parser_omp_clause_schedule): Reject modifier separated
1156 from kind by comma rather than colon.
1158 2020-06-16 Patrick Palka <ppalka@redhat.com>
1160 * pt.c (perform_instantiation_time_access_checks): No need to
1162 * semantics.c (enforce_access): Verify that decl is not
1165 2020-06-16 Patrick Palka <ppalka@redhat.com>
1169 * cp-tree.h (qualified_typedef_usage_s): Delete.
1170 (qualified_typedef_usage_t): Delete.
1171 (deferred_access_check): Move up in file.
1172 (tree_template_info::typedefs_needing_access_checking): Delete.
1173 (tree_template_info::deferred_access_checks): New field.
1174 (TI_TYPEDEFS_NEEDING_ACCESS_CHECKING): Rename to ...
1175 (TI_DEFERRED_ACCESS_CHECKS): ... this, and adjust accordingly.
1176 * pt.c (perform_typedefs_access_check): Rename to ...
1177 (perform_instantiation_time_access_checks): ... this, and adjust
1178 accordingly. Remove unnecessary tree tests.
1179 (instantiate_class_template_1): Adjust accordingly.
1180 (instantiate_decl): Likewise.
1181 * semantics.c (enforce_access): Likewise.
1183 2020-06-16 Patrick Palka <ppalka@redhat.com>
1187 * call.c (enforce_access): Move to semantics.c.
1188 * cp-tree.h (enforce_access): Delete.
1189 (get_types_needing_access_check): Delete.
1190 (add_typedef_to_current_template_for_access_check): Delete.
1191 * decl.c (make_typename_type): Adjust accordingly. Use
1192 check_accessibility_of_qualified_id instead of directly using
1193 perform_or_defer_access_check.
1194 * parser.c (cp_parser_template_declaration_after_parameters):
1195 Don't push a dk_no_check access state when parsing a template.
1196 * pt.c (get_types_needing_access_check): Delete.
1197 (append_type_to_template_for_access_check_1): Delete.
1198 (perform_typedefs_access_check): Adjust. If type_decl is a
1199 FIELD_DECL, also check its DECL_CONTEXT for dependence. Use
1200 tsubst_copy instead of tsubst to substitute into type_decl so
1201 that we substitute into the DECL_CONTEXT of a FIELD_DECL.
1202 (append_type_to_template_for_access_check): Delete.
1203 * search.c (accessible_p): Remove the processing_template_decl
1205 * semantics.c (enforce_access): Moved from call.c. If we're
1206 parsing a template and the access check failed, add the check to
1207 TI_TYPEDEFS_NEEDING_ACCESS_CHECKING.
1208 (perform_or_defer_access_check): Adjust comment.
1209 (add_typedef_to_current_template_for_access_check): Delete.
1210 (check_accessibility_of_qualified_id): Adjust accordingly.
1211 Exit early if the scope is dependent.
1213 2020-06-11 Patrick Palka <ppalka@redhat.com>
1216 * constraint.cc (associate_classtype_constraints): If there is a
1217 discrepancy between the current template depth and the template
1218 depth of the original declaration, then adjust the template
1219 parameter depth within the current constraints appropriately.
1220 * pt.c (tsubst_friend_class): Substitute into and set the
1221 constraints on the injected declaration.
1223 2020-06-11 Iain Sandoe <iain@sandoe.co.uk>
1225 * coroutines.cc (instantiate_coro_traits): Pass a reference
1226 to lambda closure objects to traits instantiation.
1227 (morph_fn_to_coro): Likewise for promise parameter
1228 preview and allocator lookup.
1230 2020-06-10 Iain Sandoe <iain@sandoe.co.uk>
1233 * call.c (add_candidates): Use vec_safe_length() for
1234 testing the arguments list.
1235 (build_new_method_call_1): Use vec_safe_is_empty() when
1236 checking for an empty args list.
1238 2020-06-10 Marek Polacek <polacek@redhat.com>
1241 * parser.c (cp_parser_direct_declarator): Clear
1242 CP_PARSER_FLAGS_DELAY_NOEXCEPT if the declarator kind is not
1245 2020-06-09 Iain Sandoe <iain@sandoe.co.uk>
1248 * coroutines.cc (expand_one_await_expression): Build separate
1249 DTOR trees for the awaitable object on the destroy and resume
1252 2020-06-09 Jason Merrill <jason@redhat.com>
1255 * cp-gimplify.c (predeclare_vla): Only predeclare a VLA if it's
1256 wrapped in a pointer type.
1258 2020-06-05 Marek Polacek <polacek@redhat.com>
1261 * call.c (build_converted_constant_expr_internal): Allow
1262 list-initialization.
1264 2020-06-05 Iain Sandoe <iain@sandoe.co.uk>
1266 * cp-tree.def (CO_RETURN_EXPR): Correct the class
1267 to use tcc_statement.
1269 2020-06-05 Jason Merrill <jason@redhat.com>
1271 * error.c (dump_binary_op): Handle negative operand to
1274 2020-06-04 Jason Merrill <jason@redhat.com>
1277 * constexpr.c (cxx_eval_constant_expression) [OBJ_TYPE_REF]:
1278 Evaluate OBJ_TYPE_REF_EXPR.
1280 2020-06-04 Jason Merrill <jason@redhat.com>
1283 * class.c (lookup_vfn_in_binfo): New.
1284 * call.c (build_over_call): Use it.
1285 * cp-tree.h (resolves_to_fixed_type_p): Add default argument.
1286 (lookup_vfn_in_binfo): Declare.
1288 2020-06-04 Iain Sandoe <iain@sandoe.co.uk>
1291 * coroutines.cc (morph_fn_to_coro): Ensure that the get-
1292 return-object is constructed correctly; When it is not the
1293 final return value, pass it to the CTOR of the return type
1294 as an rvalue, per the standard comment.
1296 2020-06-04 Jakub Jelinek <jakub@redhat.com>
1300 * constexpr.c (cxx_eval_constant_expression): Diagnose CONVERT_EXPR
1301 conversions from pointer types to arithmetic types here...
1302 (cxx_eval_outermost_constant_expr): ... instead of here.
1304 2020-06-03 Mark Wielaard <mark@klomp.org>
1306 * parser.c (cp_lexer_safe_previous_token): New function.
1307 (cp_parser_error_1): Add name_hint if the previous token is
1308 a string literal and next token is a CPP_NAME and we have a
1309 missing header suggestion for the name.
1311 2020-06-03 Patrick Palka <ppalka@redhat.com>
1313 * pt.c (process_partial_specialization): Pass the full set of
1314 generic template arguments to strictly_subsumes.
1316 2020-06-03 Patrick Palka <ppalka@redhat.com>
1319 * pt.c (most_specialized_partial_spec): Reorganize the loop over
1320 DECL_TEMPLATE_SPECIALIZATIONS. Check constraints_satisfied_p on
1321 the original template declaration, not on the tsubsted one.
1323 2020-06-03 Iain Sandoe <iain@sandoe.co.uk>
1326 * coroutines.cc (finish_co_await_expr): Revise to allow for
1328 (finish_co_yield_expr): Likewise.
1330 2020-06-03 Jason Merrill <jason@redhat.com>
1333 * cp-tree.h (predeclare_vla): Declare.
1334 * cp-gimplify.c (predeclare_vla): Handle getting a decl.
1335 * pt.c (tsubst_expr) [DECL_EXPR]: Use it.
1337 2020-06-03 Tobias Burnus <tobias@codesourcery.com>
1339 * cp-gimplify.c (cxx_omp_predetermined_mapping): New.
1340 * cp-objcp-common.h (LANG_HOOKS_OMP_PREDETERMINED_MAPPING): Redfine.
1341 * cp-tree.h (cxx_omp_predetermined_mapping): Declare.
1343 2020-06-02 Jason Merrill <jason@redhat.com>
1346 * pt.c (tsubst_decl): Relax assert.
1348 2020-06-02 Iain Sandoe <iain@sandoe.co.uk>
1351 * coroutines.cc (build_co_await): Wrap the co_await expression
1352 in a TARGET_EXPR, where needed.
1353 (finish_co_yield_expr): Likewise.
1355 2020-06-02 Patrick Palka <ppalka@redhat.com>
1359 * pt.c (tsubst_function_decl): Don't do set_constraints when
1360 regenerating a lambda.
1361 (tsubst_lambda_expr): Substitute into the lambda's constraints
1362 and do set_constraints here.
1364 2020-06-01 Jason Merrill <jason@redhat.com>
1369 * class.c (build_vfn_ref): Revert 95311 change.
1370 * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call): Build a
1373 2020-06-01 Iain Sandoe <iain@sandoe.co.uk>
1376 * coroutines.cc (struct param_info): Remove rv_ref field.
1377 (build_actor_fn): Remove specifial rvalue ref handling.
1378 (morph_fn_to_coro): Likewise.
1380 2020-05-31 Iain Sandoe <iain@sandoe.co.uk>
1383 * coroutines.cc (morph_fn_to_coro): If we see an
1384 early fatal error, drop the erroneous function body.
1386 2020-05-31 Iain Sandoe <iain@sandoe.co.uk>
1388 * coroutines.cc (build_co_await): Remove unused
1390 (finish_co_await_expr): Likewise.
1391 (finish_co_yield_expr): Likewise; revise comment.
1393 2020-05-30 Iain Sandoe <iain@sandoe.co.uk>
1395 * coroutines.cc (morph_fn_to_coro): Revise initialization
1396 of the frame pointer to avoid an unused value.
1398 2020-05-30 Patrick Palka <ppalka@redhat.com>
1401 * constraint.cc (satisfaction_value): Accept INTEGER_CST of any
1404 2020-05-29 Patrick Palka <ppalka@redhat.com>
1405 Jason Merrill <jason@redhat.com>
1408 * class.c (add_method): Let special member function templates
1409 coexist if they are not equivalently constrained, or in a class
1412 2020-05-29 Jason Merrill <jason@redhat.com>
1415 * pt.c (process_template_parm): Set DECL_TEMPLATE_INFO
1416 on the DECL_TEMPLATE_RESULT.
1418 2020-05-29 Marek Polacek <polacek@redhat.com>
1421 * cp-gimplify.c (cp_fold) <case MODIFY_EXPR>: Don't set
1422 TREE_THIS_VOLATILE here.
1423 (cp_fold): Set it here along with TREE_NO_WARNING.
1425 2020-05-29 Jason Merrill <jason@redhat.com>
1429 * class.c (build_vfn_ref): Don't fold the INDIRECT_REF.
1431 2020-05-29 Patrick Palka <ppalka@redhat.com>
1436 * parser.c (cp_parser_requires_clause_expression): Temporarily
1437 increment processing_template_decl only if it is 0.
1438 (cp_parser_constraint_expression): Likewise.
1439 (cp_parser_requires_expression): Likewise.
1441 2020-05-29 Patrick Palka <ppalka@redhat.com>
1444 * constexpr.c (get_or_insert_ctor_field): Add limited support
1445 for RANGE_EXPR index lookups.
1447 2020-05-28 Jakub Jelinek <jakub@redhat.com>
1450 * decl.c (cp_finish_decomp): Call complete_type before checking
1453 2020-05-28 Jason Merrill <jason@redhat.com>
1456 * decl.c (cp_finish_decl): Revert r9-297 change.
1457 (check_static_variable_definition): Likewise.
1458 * constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
1459 * pt.c (instantiate_decl): Return early on type error.
1461 2020-05-27 Jason Merrill <jason@redhat.com>
1464 * decl.c (reshape_init_array_1): Don't reuse in overload context.
1466 2020-05-27 Jason Merrill <jason@redhat.com>
1469 * call.c (build_new_op_1): Suppress
1470 warn_zero_as_null_pointer_constant across comparison of <=> result
1473 2020-05-27 Jason Merrill <jason@redhat.com>
1476 * decl.c (grokdeclarator): Don't shift attributes in TYPENAME
1479 2020-05-27 Nathan Sidwell <nathan@acm.org>
1482 * pt.c (lookup_template_class_1): Restore alias template mutation.
1484 2020-05-26 Jakub Jelinek <jakub@redhat.com>
1487 * cp-gimplify.c: Include omp-general.h.
1488 (cp_genericize_r) <case OMP_DISTRIBUTE>: For class iteration
1489 variables in composite distribute parallel for, instantiate copy
1490 ctor of their types.
1492 2020-05-23 Patrick Palka <ppalka@redhat.com>
1495 * constexpr.c (cxx_eval_constant_expression)
1496 <case TEMPLATE_ID_EXPR>: Don't evaluate the concept when
1497 constexpr evaluation is uid-sensitive.
1499 2020-05-22 Jason Merrill <jason@redhat.com>
1501 * cp-gimplify.c (cp_gimplify_expr) [CALL_EXPR]: Don't preevaluate
1502 the function address if the call used operator syntax.
1504 2020-05-21 Jason Merrill <jason@redhat.com>
1507 * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call): For a virtual
1508 call, instrument the OBJ_TYPE_REF.
1510 * decl.c (compute_array_index_type_loc): Diagnose expressions
1511 in a template that can't be constant.
1512 * parser.c (cp_parser_direct_declarator): Don't check
1513 non-constant array bounds here.
1515 * cp-tree.h (is_rvalue_constant_expression): Declare.
1516 * constexpr.c (is_rvalue_constant_expression): New.
1517 * parser.c (cp_parser_constant_expression): Use it.
1518 * decl.c (cp_finish_decl): Try to treat a constexpr initializer in a
1519 template as constant.
1521 * typeck.c (build_x_modify_expr): Handle error_mark_node arguments.
1523 * decl.c (grokparms): Return NULL_TREE if any parms were erroneous.
1525 2020-05-21 Iain Sandoe <iain@sandoe.co.uk>
1527 * coroutines.cc (finish_co_return_stmt): Revert change to use
1530 2020-05-21 Patrick Palka <ppalka@redhat.com>
1533 * constexpr.c (constexpr_ctx::uid_sensitive): Remove field.
1534 (uid_sensitive_constexpr_evaluation_value): Define.
1535 (uid_sensitive_constexpr_evaluation_true_counter): Define.
1536 (uid_sensitive_constexpr_evaluation_p): Define.
1537 (uid_sensitive_constexpr_evaluation_sentinel): Define its
1539 (uid_sensitive_constexpr_evaluation_checker): Define its
1540 constructor and its evaluation_restricted_p method.
1541 (get_fundef_copy): Remove 'ctx' parameter. Use u_s_c_e_p
1542 instead of constexpr_ctx::uid_sensitive.
1543 (cxx_eval_call_expression): Use u_s_c_e_p instead, and test it
1544 last. Adjust call to get_fundef_copy.
1545 (instantiate_cx_fn_r): Test u_s_c_e_p so that we increment the
1546 counter if necessary.
1547 (cxx_eval_outermost_constant_expr): Remove 'uid_sensitive'
1548 parameter. Adjust function body accordingly.
1549 (maybe_constant_value): Remove 'uid_sensitive' parameter and
1550 adjust function body accordingly. Set up a
1551 uid_sensitive_constexpr_evaluation_checker, and use it to
1552 conditionally update the cv_cache.
1553 * cp-gimplify.c (cp_fold): Set up a
1554 uid_sensitive_constexpr_evaluation_checker, and use it to
1555 conditionally update the fold_cache.
1556 * cp-tree.h (maybe_constant_value): Update declaration.
1557 (struct uid_sensitive_constexpr_evaluation_sentinel): Define.
1558 (struct sensitive_constexpr_evaluation_checker): Define.
1559 * expr.c (fold_for_warn): Set up a
1560 uid_sensitive_constexpr_evaluation_sentinel before calling
1561 the folding subroutines. Drop all but the first argument to
1562 maybe_constant_value.
1564 2020-05-20 Marek Polacek <polacek@redhat.com>
1567 * parser.c (cp_parser_unqualified_id): Reject simple-template-id as
1568 the declarator-id of a destructor.
1569 (cp_parser_constructor_declarator_p): Reject simple-template-id as
1570 the declarator-id of a constructor.
1572 2020-05-20 Marek Polacek <polacek@redhat.com>
1576 * cp-tree.h (SD_DECOMPOSITION): New flag.
1577 * decl.c (duplicate_decls): Make sure a structured binding is unique
1578 in its declarative region.
1579 (start_decl): If INITIALIZED is SD_DECOMPOSITION, call
1580 fit_decomposition_lang_decl.
1581 (grokdeclarator): Compare INITIALIZED directly to SD_* flags.
1582 * parser.c (cp_parser_decomposition_declaration): Pass SD_DECOMPOSITION
1585 2020-05-20 Patrick Palka <ppalka@redhat.com>
1588 * typeck.c (structural_comptypes): Don't perform
1589 context-dependent resolution of TYPENAME_TYPEs when
1590 comparing_specializations.
1592 2020-05-19 Nathan Sidwell <nathan@acm.org>
1594 * pt.c (lookup_template_class_1): Do not reinit template_info of an
1597 2020-05-18 Martin Sebor <msebor@redhat.com>
1600 * call.c ((maybe_warn_class_memaccess): Use is_byte_access_type.
1601 * cp-tree.h (is_dummy_object): Return bool.
1602 (is_byte_access_type): Declare new function.
1603 * tree.c (is_dummy_object): Return bool.
1604 (is_byte_access_type): Define new function.
1606 2020-05-19 Patrick Palka <ppalka@redhat.com>
1609 * pt.c (init_template_processing): Enable sanitization for
1610 decl_specializations and type_specializations.
1613 * pt.c (fn_type_unification): Pass 'fn' instead of NULL_TREE as
1614 the 'in_decl' parameter to coerce_template_parms.
1616 2020-05-18 Marek Polacek <polacek@redhat.com>
1619 * typeck.c (cp_build_binary_op): Use fold_for_warn instead of
1622 2020-05-18 Marek Polacek <polacek@redhat.com>
1625 * cvt.c (cp_get_fndecl_from_callee): Return NULL_TREE if the function
1626 type is not INDIRECT_TYPE_P.
1627 * decl.c (omp_declare_variant_finalize_one): Call
1628 cp_get_callee_fndecl_nofold instead of looking for the function decl
1631 2020-05-18 Marek Polacek <polacek@redhat.com>
1634 * parser.c (cp_parser_has_attribute_expression): Sorry on a
1635 type-dependent argument.
1637 2020-05-18 Marek Polacek <polacek@redhat.com>
1641 * call.c (add_builtin_candidate) <case EQ_EXPR>: Create candidate
1642 operator functions when type is std::nullptr_t for ==/!=.
1643 * typeck.c (composite_pointer_type_r): Add a bool * parameter. Use it
1644 to maybe add "const" to the pointer type.
1645 (composite_pointer_type): Update the call to composite_pointer_type_r.
1646 (cp_build_binary_op): Turn two warning_at into error_at. Print the
1649 2020-05-18 Jason Merrill <jason@redhat.com>
1651 * call.c (build_over_call): Remove unnecessary
1652 cp_stabilize_reference.
1654 2020-05-18 Marek Polacek <polacek@redhat.com>
1656 * call.c (add_builtin_candidate): Don't create a builtin overload
1657 candidate for ++ when type is bool in C++17.
1659 2020-05-18 Marek Polacek <polacek@redhat.com>
1661 * cfns.h: Regenerated.
1663 2020-05-17 Iain Sandoe <iain@sandoe.co.uk>
1665 * coroutines.cc (morph_fn_to_coro): Initialize the gro variable.
1667 2020-05-16 Iain Sandoe <iain@sandoe.co.uk>
1669 * coroutines.cc (finish_co_return_stmt): Implement rules
1670 from [class.copy.elision] /3.
1672 2020-05-16 Patrick Palka <ppalka@redhat.com>
1675 * semantics.c (finish_decltype_type): Call
1676 instantiate_non_dependent_expr_sfinae on the expression.
1678 2020-05-15 Patrick Palka <ppalka@redhat.com>
1682 2020-04-07 Patrick Palka <ppalka@redhat.com>
1685 * typeck2.c (process_init_constructor_array): Propagate
1686 CONSTRUCTOR_PLACEHOLDER_BOUNDARY up from each element initializer to
1687 the array initializer.
1689 2020-05-15 Jason Merrill <jason@redhat.com>
1691 PR c++/93286 - ICE with __is_constructible and variadic template.
1692 * pt.c (tsubst_tree_list): New.
1693 (tsubst, tsubst_copy_and_build): Use it.
1694 * decl2.c (is_late_template_attribute): Handle error_mark_node args.
1696 2020-05-15 Nathan Sidwell <nathan@acm.org>
1698 * pt.c (template_args_equal): Fix thinkos in previous 'cleanup'.
1700 2020-05-14 Jason Merrill <jason@redhat.com>
1703 * pt.c (maybe_instantiate_noexcept): Change clone handling.
1705 2020-05-14 Patrick Palka <ppalka@redhat.com>
1708 * call.c (build_op_call): Pass complain to lookup_fnfields.
1709 (build_special_member_call): Likewise.
1710 * class.c (type_requires_array_cookie): Pass tf_warning_or_error
1712 * cp-tree.h (lookup_fnfields): Add tsubst_flags_t parameter.
1713 * except.c (build_throw): Pass tf_warning_or_error to
1715 * init.c (build_new_1): Pass complain to lookup_fnfields.
1716 * method.c (locate_fn_flags): Likewise.
1717 * name-lookup.c (lookup_name_real_1): Pass tf_warning_or_error
1719 * pt.c (tsubst_baselink): Pass complain to lookup_fnfields.
1720 * search.c (lookup_fnfields): New 'complain' parameter. Pass it
1723 2020-05-14 Nathan Sidwell <nathan@acm.org>
1725 * parser.c (cp_parser_diagnose_invalid_typename): Mention
1726 std=c++20 not 2a, reformat dependent binfo inform loops.
1728 * pt.c (tsubst_template_decl): Reorder and commonize some control
1731 * pt.c (tsubst_friend_function): Simplify control flow.
1733 * pt.c (lookup_template_class_1): Remove unnecessary else by
1734 simply grabbing TYPE_NAME earlier.
1736 * pt.c (push_template_decl_real): Adjust friend pushing logic.
1737 Reinit template type.
1739 * pt.c (build_template_decl): Init DECL_TEMPLATE_RESULT &
1741 (process_partial_specialization): ... not here ...
1742 (push_template_decl_real, add_inherited_template_parms)
1743 (build_deduction_guide): ... or here.
1745 2020-05-14 Jakub Jelinek <jakub@redhat.com>
1747 * cp-gimplify.c (cp_genericize_r): Set cfun->has_omp_target.
1749 2020-05-13 Patrick Palka <ppalka@redhat.com>
1752 * init.c (build_vec_delete_1): Just return error_mark_node if
1753 deallocate_expr is error_mark_node.
1754 (build_delete): Just return error_mark_node if do_delete is
1757 2020-05-13 Patrick Palka <ppalka@redhat.com>
1760 * constraint.cc (tsubst_requires_expr): Produce a new
1761 requires-expression when processing_template_decl, even if
1762 template arguments are not dependent.
1764 2020-05-13 Marek Polacek <polacek@redhat.com>
1767 * decl.c (duplicate_decls): Set DECL_HAS_DEPENDENT_EXPLICIT_SPEC_P.
1769 2020-05-13 Nathan Sidwell <nathan@acm.org>
1771 * pt.c (template_args_equal): Reorder category checking for
1774 * pt.c (perform_typedefs_access_check): Cache expensively
1775 calculated object references.
1776 (check_auto_in_tmpl_args): Just assert we do not get unexpected
1777 nodes, rather than silently do nothing.
1778 (append_type_to_template_for_access): Likewise, cache expensie
1781 * pt.c (canonical_type_parameter): Simplify.
1783 Formatting fixups & some simplifications.
1784 * pt.c (spec_hash_table): New typedef.
1785 (decl_specializations, type_specializations): Use it.
1786 (retrieve_specialization): Likewise.
1787 (register_specialization): Remove unnecessary casts.
1788 (push_template_decl_real): Reformat.
1789 (instantiate_class_template_1): Use more RAII.
1790 (make_argument_pack): Simplify.
1791 (instantiate_template_1): Use gcc_checking_assert for expensive
1793 (instantiate_decl): Likewise.
1794 (resolve_typename_type): Reformat comment.
1795 * semantics.c (struct deferred_access): Remove unnecessary GTY on
1797 (begin_class_definition): Fix formatting.
1799 2020-05-13 Jason Merrill <jason@redhat.com>
1801 * call.c, class.c, constexpr.c, constraint.cc, decl.c, init.c,
1802 lambda.c, lex.c, method.c, name-lookup.c, parser.c, pt.c, tree.c,
1803 typeck2.c: Change cxx2a to cxx20.
1805 2020-05-12 Marek Polacek <polacek@redhat.com>
1808 * parser.c (cp_parser_postfix_expression) <case CPP_OPEN_PAREN>: When
1809 looking for a block-scope function declaration, look through the whole
1810 set, not just the first function in the overload set.
1812 2020-05-12 Jakub Jelinek <jakub@redhat.com>
1815 * pt.c (tsubst_decl): Deal with DECL_OMP_PRIVATIZED_MEMBER for
1818 2020-05-11 Jason Merrill <jason@redhat.com>
1820 Resolve C++20 NB comment CA104
1821 * pt.c (determine_specialization): Compare constraints for
1822 specialization of member template of class instantiation.
1824 2020-05-11 Jason Merrill <jason@redhat.com>
1828 * tree.c (cp_walk_subtrees): Stop at typedefs.
1829 Handle TYPENAME_TYPE here.
1830 * pt.c (find_parameter_packs_r): Not here.
1831 (for_each_template_parm_r): Clear *walk_subtrees.
1832 * decl2.c (min_vis_r): Look through typedefs.
1834 2020-05-11 Jason Merrill <jason@redhat.com>
1836 * call.c (implicit_conversion_error): Split out from...
1837 (perform_implicit_conversion_flags): ...here.
1838 (build_converted_constant_expr_internal): Use it.
1840 2020-05-11 Jason Merrill <jason@redhat.com>
1843 * parser.c (inject_parm_decls): Set current_class_ptr here.
1844 (cp_parser_direct_declarator): And here.
1845 (cp_parser_late_return_type_opt): Not here.
1846 (cp_parser_noexcept_specification_opt): Nor here.
1847 (cp_parser_exception_specification_opt)
1848 (cp_parser_late_noexcept_specifier): Remove unneeded parameters.
1850 2020-05-11 Jason Merrill <jason@redhat.com>
1852 * decl.c (cxx_init_decl_processing): Call declare_weak for
1855 2020-05-11 Jason Merrill <jason@redhat.com>
1857 * pt.c (instantiate_class_template_1): Call tsubst_expr for
1858 STATIC_ASSERT member.
1859 * ptree.c (cxx_print_xnode): Handle STATIC_ASSERT.
1861 2020-05-11 Jason Merrill <jason@redhat.com>
1863 * pt.c (find_parameter_packs_r) [LAMBDA_EXPR]: Remove redundant
1864 walking of capture list.
1866 2020-05-11 Jason Merrill <jason@redhat.com>
1868 * cp-tree.h (LOOKUP_EXPLICIT_TMPL_ARGS): Remove.
1869 * call.c (build_new_function_call): Don't set it.
1870 (build_new_method_call_1): Likewise.
1871 (build_over_call): Check cand->explicit_targs instead.
1873 2020-05-11 Jason Merrill <jason@redhat.com>
1875 * decl.c (compute_array_index_type_loc): Stabilize before building
1878 2020-05-11 Jason Merrill <jason@redhat.com>
1880 * decl.c (grokdeclarator): Adjust deprecated_state here.
1881 (start_decl): Not here.
1883 2020-05-08 Iain Sandoe <iain@sandoe.co.uk>
1886 * coroutines.cc (build_actor_fn): Ensure that bind scopes
1887 are marked as having side-effects where necessary.
1888 (replace_statement_captures): Likewise.
1889 (morph_fn_to_coro): Likewise.
1891 2020-05-08 Nathan Sidwell <nathan@acm.org>
1893 * NEWS: Delete, it is so stale.
1895 * parser.c (cp_lexer_set_source_position_from_token): EOF has a
1898 2020-05-07 Iain Sandoe <iain@sandoe.co.uk>
1902 * coroutines.cc (morph_fn_to_coro): Set unformed outline
1903 functions to error_mark_node. For early error returns suppress
1904 warnings about missing ramp return values. Fix reinstatement
1905 of the function body on pre-existing initial error.
1906 * decl.c (finish_function): Use the normal error path for fails
1907 in the ramp function, do not try to compile the helpers if the
1910 2020-05-07 Marek Polacek <polacek@redhat.com>
1912 PR c++/94590 - Detect long double -> double narrowing.
1913 * typeck2.c (check_narrowing): Detect long double -> double
1914 narrowing even when double and long double have the same
1915 precision. Make it handle conversions to float too.
1917 2020-05-07 Marek Polacek <polacek@redhat.com>
1920 * parser.c (cp_parser_class_specifier_1): Check that the scope is
1921 nested inside current scope before pushing it.
1923 2020-05-07 Marek Polacek <polacek@redhat.com>
1926 * typeck2.c (check_narrowing): Consider T* to bool narrowing
1929 2020-05-07 Marek Polacek <polacek@redhat.com>
1931 * decl.c (grok_op_properties): Fix spelling of non-static.
1932 * typeck.c (build_class_member_access_expr): Likewise.
1934 2020-05-07 Richard Biener <rguenther@suse.de>
1937 * optimize.c (update_cloned_parm): Copy DECL_NOT_GIMPLE_REG_P.
1939 2020-05-06 Marek Polacek <polacek@redhat.com>
1942 * pt.c (tsubst_copy_and_build): Call type_dependent_expression_p_push
1943 instead of uses_template_parms. Move the warning_sentinels after the
1946 2020-05-06 Jakub Jelinek <jakub@redhat.com>
1949 * typeck.c (cp_strict_aliasing_warning): New function.
1950 (cp_build_indirect_ref_1, build_reinterpret_cast_1): Use
1951 it instead of strict_aliasing_warning.
1954 * method.c (defaulted_late_check): Don't call synthesize_method
1955 on constexpr sfk_comparison if it has been called on it already.
1957 2020-05-06 Nathan Sidwell <nathan@acm.org>
1960 * decl.c (grokdeclarator): Don't splice template attributes in
1961 parm context -- they can apply to the parm.
1963 2020-05-05 Iain Sandoe <iain@sandoe.co.uk>
1965 * coroutines.cc: Remove references to n4849 throughout.
1967 2020-05-05 Jason Merrill <jason@redhat.com>
1970 * pt.c (more_specialized_fn): Do consider parms with no deducible
1971 template parameters.
1973 2020-05-05 Jason Merrill <jason@redhat.com>
1976 * constexpr.c (potential_constant_expression_1): In a lambda
1977 function, consider a captured variable directly.
1979 2020-05-05 Iain Sandoe <iain@sandoe.co.uk>
1981 * coroutines.cc (transform_await_wrapper): Check that we have
1982 no unlowered co_yields.
1983 (captures_temporary): Likewise.
1984 (register_awaits): Likewise.
1986 2020-05-05 Nathan Sidwell <nathan@acm.org>
1989 * coroutines.cc (morph_fn_to_coro): Just check for
1991 * pt.c (tsubst_function_decl): Update lambda fn's this_ptr name.
1993 2020-05-05 Marek Polacek <polacek@redhat.com>
1994 Jason Merrill <jason@redhat.com>
1997 * parser.c (cp_parser_postfix_dot_deref_expression): If we have
1998 a type-dependent object of class type, stash it to
1999 parser->context->object_type. If the postfix expression doesn't have
2001 (cp_parser_class_name): Consider object scope too.
2002 (cp_parser_lookup_name): Remove code dealing with the case when
2003 object_type is unknown_type_node.
2005 2020-05-04 Patrick Palka <ppalka@redhat.com>
2008 * cp-gimplify.c (cp_fold) <case CALL_EXPR>: Move some variable
2009 declarations closer to their uses. Copy the CALL_EXPR only
2010 when one of its arguments has changed.
2011 <case TREE_VEC>: Instead of first collecting the folded
2012 arguments into a releasing_vec, just make a copy of the TREE_VEC
2013 as soon as folding changes one of its arguments.
2015 2020-05-04 Iain Sandoe <iain@sandoe.co.uk>
2017 * coroutines.cc (morph_fn_to_coro): Mark the coro.gro variable
2018 as artificial and ignored.
2020 2020-05-04 Nathan Sidwell <nathan@acm.org>
2022 pt.c (process_template_parm): Don't walk the template list twice,
2023 remember the final node instead.
2024 (end_template_parm_list): Refactor. Comment on why we do a pop
2027 PR c++/94827 -- don't save parms in nested requirement
2028 * constraint.cc (tsubst_nested_requirement): TYPE directly holds
2029 notmalized requirement.
2030 (finish_nested_requirement): Don't stash current tpl parms into
2032 (diagnose_nested_requirement): TYPE directly holds notmalized
2035 2020-05-01 Patrick Palka <ppalka@redhat.com>
2038 * cp-tree.h (check_accessibility_of_qualified_id): Add
2039 tsubst_flags_t parameter and change return type to bool.
2040 * parser.c (cp_parser_lookup_name): Pass tf_warning_to_error to
2041 check_accessibility_of_qualified_id.
2042 * pt.c (tsubst_qualified_id): Return error_mark_node if
2043 check_accessibility_of_qualified_id returns false.
2044 * semantics.c (check_accessibility_of_qualified_id): Add
2045 complain parameter. Pass complain instead of
2046 tf_warning_or_error to perform_or_defer_access_check. Return
2047 true unless perform_or_defer_access_check returns false.
2049 2020-05-01 Marek Polacek <polacek@redhat.com>
2052 * typeck2.c (process_init_constructor_record): Return PICFLAG_ERRONEOUS
2053 if an initializer element was erroneous.
2055 2020-05-01 Jason Merrill <jason@redhat.com>
2058 * init.c (get_nsdmi): Don't push_to_top_level for a local class.
2060 2020-05-01 Jason Merrill <jason@redhat.com>
2063 * decl.c (cp_finish_decl): Also clear TREE_READONLY if
2064 -fmerge-all-constants.
2066 2020-05-01 Jason Merrill <jason@redhat.com>
2069 * pt.c (tsubst_decl): Make sure DECL_VALUE_EXPR continues to have
2070 the same type as the variable.
2072 2020-04-30 Jason Merrill <jason@redhat.com>
2073 Nathan Sidwell <nathan@acm.org>
2076 * constraint.cc (map_arguments): If ARGS is null, it's a
2077 self-mapping of parms.
2078 (finish_nested_requirement): Do not pass argified
2079 current_template_parms to normalization.
2080 (tsubst_nested_requirement): Don't assert no template parms.
2082 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
2085 * coroutines.cc (transform_local_var_uses): Defer walking
2086 the DECL_INITIALs of BIND_EXPR vars until all the frame
2087 allocations have been made.
2089 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
2092 * coroutines.cc (register_awaits): Update target
2093 expressions for awaitable and suspend handle
2096 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
2099 * coroutines.cc (build_co_await): Account for variables
2100 with DECL_VALUE_EXPRs.
2101 (captures_temporary): Likewise.
2102 (register_awaits): Likewise.
2104 2020-04-29 Patrick Palka <ppalka@redhat.com>
2107 * pt.c (find_template_parameter_info::parm_list): New field.
2108 (keep_template_parm): Use the new field to build up the
2109 parameter list here instead of ...
2110 (find_template_parameters): ... here. Return ftpi.parm_list.
2112 2020-04-29 Jakub Jelinek <jakub@redhat.com>
2115 * class.c (build_base_field): Set DECL_FIELD_ABI_IGNORED on C++17 empty
2116 base artificial FIELD_DECLs.
2117 (layout_class_type): Set DECL_FIELD_ABI_IGNORED on empty class
2118 field_poverlapping_p FIELD_DECLs.
2120 2020-04-29 Patrick Palka <ppalka@redhat.com>
2123 * constraint.cc (satisfy_declaration_constraints): Use saved_t
2124 instead of t as the key to decl_satisfied_cache.
2127 * error.c (print_requires_expression_info): Print the dependent
2128 form of the parameter list with its template parameter mapping,
2129 rather than printing the substituted form.
2131 2020-04-28 Jason Merrill <jason@redhat.com>
2134 * decl.c (use_eh_spec_block): Check nothrow type after
2136 * pt.c (maybe_instantiate_noexcept): Call synthesize_method for
2137 DECL_MAYBE_DELETED fns here.
2138 * decl2.c (mark_used): Not here.
2139 * method.c (get_defaulted_eh_spec): Reject DECL_MAYBE_DELETED here.
2141 2020-04-28 Iain Sandoe <iain@sandoe.co.uk>
2144 * coroutines.cc (instantiate_coro_traits): Pass a reference to
2145 object type rather than a pointer type for 'this', for method
2147 (struct param_info): Add a field to hold that the parm is a lambda
2149 (morph_fn_to_coro): Check for lambda closure pointers in the
2150 args. Use a reference to *this when building the args list for the
2151 promise allocator lookup.
2153 2020-04-28 Iain Sandoe <iain@sandoe.co.uk>
2156 * coroutines.cc (coro_promise_type_found_p): Do not
2157 exclude non-classes here (this needs to be handled in the
2159 (morph_fn_to_coro): Allow for the case where the coroutine
2162 2020-04-27 Iain Sandoe <iain@sandoe.co.uk>
2165 * coroutines.cc (struct local_var_info): Add fields for static
2166 variables and those with DECL_VALUE_EXPR redirection.
2167 (transform_local_var_uses): Skip past typedefs and static vars
2168 and then account for redirected variables.
2169 (register_local_var_uses): Likewise.
2171 2020-04-27 Jason Merrill <jason@redhat.com>
2175 * decl.c (grokdeclarator): Move dependent attribute to decl.
2176 * decl2.c (splice_template_attributes): No longer static.
2178 2020-04-27 Patrick Palka <ppalka@redhat.com>
2181 * constexpr.c (cxx_eval_call_expression): Don't set new_obj if we're
2182 evaluating the target constructor of a delegating constructor.
2183 (cxx_eval_store_expression): Don't set TREE_READONLY if the LHS of the
2184 INIT_EXPR is '*this'.
2186 2020-04-26 Marek Polacek <polacek@redhat.com>
2189 * call.c (struct conversion): Add copy_init_p.
2190 (standard_conversion): Set copy_init_p in ck_base and ck_rvalue
2191 if FLAGS demands LOOKUP_ONLYCONVERTING.
2192 (convert_like_real) <case ck_base>: If copy_init_p is set, or
2193 LOOKUP_ONLYCONVERTING into FLAGS.
2195 2020-04-26 Iain Sandoe <iain@sandoe.co.uk>
2198 * coroutines.cc (morph_fn_to_coro): Ensure that
2199 unnamed function params have a usable and distinct
2202 2020-04-24 Jason Merrill <jason@redhat.com>
2205 * decl.c (redeclaration_error_message): Reject defaulted comparison
2206 operator that has been previously declared.
2208 2020-04-25 Patrick Palka <ppalka@redhat.com>
2210 * parser.c (cp_parser_diagnose_invalid_type_name): Suggest enabling
2211 concepts if the invalid identifier is 'requires'.
2213 2020-04-25 Jakub Jelinek <jakub@redhat.com>
2216 * semantics.c (finish_call_expr): When looking if all overloads
2217 are noreturn, use STRIP_TEMPLATE to look through TEMPLATE_DECLs.
2219 2020-04-24 Martin Liska <mliska@suse.cz>
2221 * coroutines.cc: Fix compilation error for release checking
2222 where we miss declaration of ‘coro_body_contains_bind_expr_p’.
2224 2020-04-23 Patrick Palka <ppalka@redhat.com>
2226 * tree.c (zero_init_expr_p): Use uses_template_parms instead of
2230 * pt.c (template_class_depth): Walk into the DECL_FRIEND_CONTEXT of a
2231 friend declaration rather than into its CP_DECL_CONTEXT.
2233 2020-04-23 Iain Sandoe <iain@sandoe.co.uk>
2236 * coroutines.cc (await_statement_expander): Simplify cases.
2237 (struct susp_frame_data): Add fields for truth and/or if
2238 cases, rename one field.
2239 (analyze_expression_awaits): New.
2240 (expand_one_truth_if): New.
2241 (add_var_to_bind): New helper.
2242 (coro_build_add_if_not_cond_break): New helper.
2243 (await_statement_walker): Handle conditional expressions,
2244 handle expansion of truth-and/or-if cases.
2245 (bind_expr_find_in_subtree): New, checking-only.
2246 (coro_body_contains_bind_expr_p): New, checking-only.
2247 (morph_fn_to_coro): Ensure that we have a top level bind
2250 2020-04-22 Jonathan Wakely <jwakely@redhat.com>
2252 PR translation/94698
2253 * class.c (check_field_decls): Change "define" to "declare" in
2254 -Weffc++ diagnostics.
2256 2020-04-22 Patrick Palka <ppalka@redhat.com>
2260 * constraint.cc (satisfy_declaration_constraints): If the inherited
2261 constructor points to an instantiation of a constructor template,
2262 remember and use its attached template arguments.
2264 2020-04-22 Jonathan Wakely <jwakely@redhat.com>
2266 PR translation/94698
2267 * class.c (check_field_decls): Change "override" to "define" in
2268 -Weffc++ diagnostics.
2270 2020-04-22 Iain Sandoe <iain@sandoe.co.uk>
2273 * coroutines.cc (struct param_info): Add a field to note that
2274 the param is 'this'.
2275 (morph_fn_to_coro): Convert this to a reference before using it
2276 in the promise parameter preview.
2278 2020-04-22 Jason Merrill <jason@redhat.com>
2281 * pt.c (register_parameter_specializations): If the instantiation is
2282 still a parameter pack, don't wrap it in a NONTYPE_ARGUMENT_PACK.
2283 (tsubst_pack_expansion, tsubst_expr): Adjust.
2285 2020-04-22 Martin Sebor <msebor@redhat.com>
2286 Jason Merrill <jason@redhat.com>
2289 * decl.c (reshape_init_array_1): Avoid stripping redundant trailing
2290 zero initializers...
2291 * mangle.c (write_expression): ...and handle them here even for
2292 pointers to members by calling zero_init_expr_p.
2293 * cp-tree.h (zero_init_expr_p): Declare.
2294 * tree.c (zero_init_expr_p): Define.
2295 (type_initializer_zero_p): Remove.
2296 * pt.c (tparm_obj_values): New hash_map.
2297 (get_template_parm_object): Store to it.
2298 (tparm_object_argument): New.
2300 2020-04-22 Patrick Palka <ppalka@redhat.com>
2303 * constraint.cc (diagnose_valid_expression): Check convert_to_void here
2304 as well as in tsubst_valid_expression_requirement.
2306 2020-04-21 Patrick Palka <ppalka@redhat.com>
2309 * constraint.cc (satisfy_declaration_constraints): Don't strip the
2310 inherited constructor if it already has template information.
2313 * pt.c (any_template_parm_r) <case IDENTIFIER_NODE>: New case. If this
2314 is a conversion operator, visit its TREE_TYPE.
2316 2020-04-21 Nathan Sidwell <nathan@acm.org>
2318 * pt.c (tsubst_copy_and_build) [POINTER_PLUS_EXPR]: Check for
2321 2020-04-21 Iain Sandoe <iain@sandoe.co.uk>
2324 * coroutines.cc (morph_fn_to_coro): Simplify return
2327 2020-04-17 Marek Polacek <polacek@redhat.com>
2330 * constexpr.c (cxx_eval_outermost_constant_expr): Return when T is
2331 a BRACE_ENCLOSED_INITIALIZER_P.
2332 (is_nondependent_constant_expression): Don't check
2333 BRACE_ENCLOSED_INITIALIZER_P.
2334 (is_nondependent_static_init_expression): Likewise.
2336 2020-04-20 Patrick Palka <ppalka@redhat.com>
2339 * cp-tree.h (lss_policy::lss_nop): New enumerator.
2340 * pt.c (local_specialization_stack::local_specialization_stack): Handle
2342 (local_specialization_stack::~local_specialization_stack): Likewise.
2343 (tsubst_pack_expansion): Use a local_specialization_stack instead of
2344 manually saving and restoring local_specializations. Conditionally
2345 replace local_specializations sooner, before the handling of the
2346 unsubstituted_packs case.
2348 2020-04-20 Marek Polacek <polacek@redhat.com>
2350 PR c++/94505 - bogus -Wparentheses warning with fold-expression.
2351 * pt.c (fold_expression): Add warning_sentinel for -Wparentheses
2352 before calling build_x_binary_op.
2354 2020-04-20 Marek Polacek <polacek@redhat.com>
2356 * coroutines.cc (captures_temporary): Don't assign the result of
2357 STRIP_NOPS to the same variable.
2359 2020-04-20 Nathan Sidwell <nathan@acm.org>
2361 PR c++/94454 - tpl-tpl-parms are not canonicalizable types
2362 * pt.c (canonical_type_parameter): Assert not a tpl-tpl-parm.
2363 (process_template_parm): tpl-tpl-parms are structural.
2364 (rewrite_template_parm): Propagate structuralness.
2366 PR c++/94454 - Expr pack expansion equality
2367 * tree.c (cp_tree_equal) [TEMPLATE_ID_EXPR, default]: Refactor.
2368 [EXPR_PACK_EXPANSION]: Add.
2370 PR c++/94454 Template Argument Hashing
2371 * pt.c (iterative_hash_template_arg): Strip nodes as
2372 template_args_equal does.
2373 [ARGUMENT_PACK_SELECT, TREE_VEC, CONSTRUCTOR]: Refactor.
2374 [node_class:TEMPLATE_TEMPLATE_PARM]: Hash by level & index.
2375 [node_class:default]: Refactor.
2377 2020-04-18 Patrick Palka <ppalka@redhat.com>
2380 * tree.c (cp_tree_equal) <case PARM_DECL>: Ignore
2381 comparing_specializations if the parameters' contexts are identical.
2384 * pt.c (splice_late_return_type): Propagate cv-qualifiers and
2385 PLACEHOLDER_TYPE_CONSTRAINTS from the original auto node to the new one.
2387 2020-04-17 Patrick Palka <ppalka@redhat.com>
2390 * lambda.c (lambda_capture_field_type): Avoid doing auto deduction if
2391 the explicit initializer has parameter packs.
2394 * parser.c (cp_parser_check_template_parameters): Before issuing a hard
2395 error, first try simulating an error instead.
2397 2020-04-17 Jakub Jelinek <jakub@redhat.com>
2400 * call.c (build_conditional_expr_1): Remove redundant assignment to
2403 2020-04-16 Patrick Palka <ppalka@redhat.com>
2406 * cvt.c (ocp_convert): If the result of scalar_constant_value is
2407 erroneous, ignore it and use the original expression.
2409 2020-04-16 Jakub Jelinek <jakub@redhat.com>
2412 * parser.c (cp_parser_simple_declaration): Fix up a pasto in
2415 2020-04-15 Jakub Jelinek <jakub@redhat.com>
2418 * parser.c (cp_parser_pragma) <case PRAGMA_OMP_REQUIRES>: Reject
2419 requires directive when not at file or namespace scope.
2421 2020-04-14 Iain Sandoe <iain@sandoe.co.uk>
2424 * coroutines.cc (build_actor_fn): Check that the target can
2425 support the resume tailcall before mandating it.
2427 2020-04-14 Patrick Palka <ppalka@redhat.com>
2430 * cxx-pretty-print.c (cxx_pretty_printer:simple_type_specifier)
2431 <case DECLTYPE_TYPE>: Handle DECLTYPE_TYPE here instead of ...
2432 (pp_cxx_type_specifier_seq) <case DECLTYPE_TYPE>: ... here.
2433 (cxx_pretty_printer::direct_abstract_declarator) <case DECLTYPE_TYPE>:
2437 * constexpr.c (replace_result_decl_data): New struct.
2438 (replace_result_decl_data_r): New function.
2439 (replace_result_decl): New function.
2440 (cxx_eval_call_expression): Use it.
2441 * tree.c (build_aggr_init_expr): Set the location of the AGGR_INIT_EXPR
2442 to that of its initializer.
2444 2020-04-13 Marek Polacek <polacek@redhat.com>
2447 * name-lookup.c (check_local_shadow): Add an inform call.
2449 2020-04-13 Patrick Palka <ppalka@redhat.com>
2452 * error.c (dump_scope): Pass TFF_NO_FUNCTION_ARGUMENTS to
2453 dump_function_decl when printing a function template instantiation as a
2457 * constexpr.c (get_or_insert_ctor_field): Set default value of parameter
2459 (cxx_eval_bare_aggregate): Use get_or_insert_ctor_field instead of
2460 assuming the the next index belongs at the end of the new CONSTRUCTOR.
2461 (cxx_eval_store_expression): Revert PR c++/78572 fix.
2463 2020-04-13 Nathan Sidwell <nathan@acm.org>
2465 PR c++/94426 lambdas with internal linkage are different to no-linkage
2466 * decl2.c (determine_visibility): A lambda's visibility is
2467 affected by its extra scope.
2468 * pt.c (instantiate_decl): Determine var's visibility before
2469 instantiating its initializer.
2470 * tree.c (no_linkage_check): Revert code looking at visibility of
2471 lambda's extra scope.
2473 2020-04-10 Iain Sandoe <iain@sandoe.co.uk>
2476 * coroutines.cc (co_await_expander): Remove.
2477 (expand_one_await_expression): New.
2478 (process_one_statement): New.
2479 (await_statement_expander): New.
2480 (build_actor_fn): Revise to use per-statement expander.
2481 (struct susp_frame_data): Reorder and comment.
2482 (register_awaits): Factor code.
2483 (replace_statement_captures): New, factored from...
2484 (maybe_promote_captured_temps):.. here.
2485 (await_statement_walker): Revise to process per statement.
2486 (morph_fn_to_coro): Use revised susp_frame_data layout.
2488 2020-04-10 Marek Polacek <polacek@redhat.com>
2491 * method.c (constructible_expr): In C++20, try using parenthesized
2492 initialization of aggregates to determine the result of
2495 2020-04-10 Bin Cheng <bin.cheng@linux.alibaba.com>
2497 * coroutines.cc (co_await_expander): Simplify.
2499 2020-04-09 Jason Merrill <jason@redhat.com>
2502 * constexpr.c (cxx_eval_constant_expression) [VAR_DECL]: Look at
2503 ctx->object and ctx->global->values first.
2505 2020-04-09 Marek Polacek <polacek@redhat.com>
2508 * call.c (initialize_reference): If the reference binding failed, maybe
2509 try initializing from { }.
2510 * decl.c (grok_reference_init): For T& t(e), set
2511 LOOKUP_AGGREGATE_PAREN_INIT but don't build up a constructor yet.
2513 2020-04-08 Iain Sandoe <iain@sandoe.co.uk>
2514 Jun Ma <JunMa@linux.alibaba.com>
2516 * coroutines.cc (maybe_promote_captured_temps): Add a cleanup
2517 expression, if needed, to any call from which we promoted
2518 temporaries captured by reference.
2520 2020-04-08 Marek Polacek <polacek@redhat.com>
2522 PR c++/94507 - ICE-on-invalid with lambda template.
2523 * pt.c (tsubst_lambda_expr): Cope when tsubst_template_decl or
2524 tsubst_function_decl returns error_mark_node.
2526 2020-04-08 Martin Liska <mliska@suse.cz>
2529 * decl.c (duplicate_decls): Duplicate also DECL_IS_REPLACEABLE_OPERATOR.
2530 (cxx_init_decl_processing): Mark replaceable all implicitly defined
2533 2020-04-08 Patrick Palka <ppalka@redhat.com>
2535 Core issues 1001 and 1322
2537 * pt.c (rebuild_function_or_method_type): Split function out from ...
2538 (tsubst_function_type): ... here.
2539 (maybe_rebuild_function_decl_type): New function.
2540 (tsubst_function_decl): Use it.
2542 2020-04-08 Jakub Jelinek <jakub@redhat.com>
2545 * decl.c (begin_destructor_body): For CLASSTYPE_VBASECLASSES class
2546 dtors, if CLASSTYPE_PRIMARY_BINFO is non-NULL, but not BINFO_VIRTUAL_P,
2547 look at CLASSTYPE_PRIMARY_BINFO of its BINFO_TYPE if it is not
2548 BINFO_VIRTUAL_P, and so on.
2550 2020-04-08 Marek Polacek <polacek@redhat.com>
2552 PR c++/94478 - ICE with defaulted comparison operator
2553 * method.c (early_check_defaulted_comparison): Give an error when the
2556 2020-04-08 Tobias Burnus <tobias@codesourcery.com>
2559 * paser.c (cp_parser_oacc_declare): Add check that variables
2560 are declared in the same scope as the directive.
2562 2020-04-07 Jason Merrill <jason@redhat.com>
2565 * parser.c (cp_parser_requires_expression): Use tentative_firewall.
2568 * parser.c (cp_parser_placeholder_type_specifier): Use
2571 2020-04-07 Iain Sandoe <iain@sandoe.co.uk>
2573 * coroutines.cc (maybe_promote_captured_temps): Ensure that
2574 reference capture placeholder vars are properly declared.
2576 2020-04-07 Patrick Palka <ppalka@redhat.com>
2579 * tree.c (replace_placeholders): Look through all handled components,
2580 not just COMPONENT_REFs.
2581 * typeck2.c (process_init_constructor_array): Propagate
2582 CONSTRUCTOR_PLACEHOLDER_BOUNDARY up from each element initializer to
2583 the array initializer.
2585 2020-04-07 Jakub Jelinek <jakub@redhat.com>
2588 * parser.c (cp_parser_omp_parallel): Set OMP_PARALLEL_COMBINED
2589 if cp_parser_omp_master succeeded.
2591 2020-04-06 Jason Merrill <jason@redhat.com>
2594 * decl.c (duplicate_decls): Fix handling of DECL_HIDDEN_FRIEND_P.
2596 2020-04-04 Marek Polacek <polacek@redhat.com>
2597 Jason Merrill <jason@redhat.com>
2599 PR c++/94155 - crash in gimplifier with paren init of aggregates.
2600 * init.c (build_vec_init): Fill in indexes.
2602 2020-04-04 Jason Merrill <jason@redhat.com>
2605 * mangle.c (write_expression): Skip IMPLICIT_CONV_EXPR.
2607 2020-04-04 Patrick Palka <ppalka@redhat.com>
2611 * constexpr.c (struct constexpr_ctx): New field 'parent'.
2612 (cxx_eval_bare_aggregate): Propagate CONSTRUCTOR_PLACEHOLDER_BOUNDARY
2613 flag from the original constructor to the reduced constructor.
2614 (lookup_placeholder): Prefer to return the outermost matching object
2615 by recursively calling lookup_placeholder on the 'parent' context,
2616 but don't cross CONSTRUCTOR_PLACEHOLDER_BOUNDARY constructors.
2617 (cxx_eval_constant_expression): Link the 'ctx' context to the 'new_ctx'
2618 context via 'new_ctx.parent' when being expanded without an explicit
2619 target. Don't call replace_placeholders.
2620 (cxx_eval_outermost_constant_expr): Initialize 'ctx.parent' to NULL.
2624 * constexpr.c (get_or_insert_ctor_field): Split out (while adding
2625 support for VECTOR_TYPEs, and optimizations for the common case)
2627 (cxx_eval_store_expression): ... here. Rename local variable
2628 'changed_active_union_member_p' to 'activated_union_member_p'. Record
2629 the sequence of indexes into 'indexes' that yields the subobject we're
2630 assigning to. Record the integer offsets of the constructor indexes
2631 we're assigning through into 'index_pos_hints'. After evaluating the
2632 initializer of the store expression, recompute 'valp' using 'indexes'
2633 and using 'index_pos_hints' as hints.
2634 (cxx_eval_bare_aggregate): Tweak comments. Use get_or_insert_ctor_field
2635 to recompute the constructor_elt pointer we're assigning through after
2636 evaluating each initializer.
2638 2020-04-04 Jason Merrill <jason@redhat.com>
2641 * constraint.cc (tsubst_valid_expression_requirement): Call
2644 2020-04-04 Jason Merrill <jason@redhat.com>
2647 * constexpr.c (maybe_constant_value): Use break_out_target_exprs.
2648 * expr.c (mark_use) [VIEW_CONVERT_EXPR]: Don't wrap a TARGET_EXPR in
2651 2020-04-04 Jakub Jelinek <jakub@redhat.com>
2654 * parser.c (cp_parser_omp_for_loop): Use
2655 protected_set_expr_location_if_unset.
2656 * cp-gimplify.c (genericize_if_stmt, genericize_cp_loop): Likewise.
2659 * pt.c (tsubst_expr) <case OMP_MASTER>: Clear
2660 omp_parallel_combined_clauses.
2662 2020-04-03 Jason Merrill <jason@redhat.com>
2665 * pt.c (complex_pack_expansion_r): New.
2666 (complex_alias_template_p): Use it.
2668 2020-03-31 Jason Merrill <jason@redhat.com>
2671 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Call
2672 replace_placeholders.
2673 * typeck2.c (store_init_value): Fix arguments to
2674 fold_non_dependent_expr.
2676 2020-03-31 Jason Merrill <jason@redhat.com>
2678 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Use
2681 2020-03-30 Jason Merrill <jason@redhat.com>
2684 * tree.c (cp_tree_equal) [CALL_EXPR]: Compare KOENIG_LOOKUP_P.
2685 (called_fns_equal): Check DECL_CONTEXT.
2687 2020-03-30 Jakub Jelinek <jakub@redhat.com>
2690 * semantics.c (add_stmt): Only set STMT_IS_FULL_EXPR_P on trees with
2691 STATEMENT_CODE_P code.
2693 2020-03-28 Patrick Palka <ppalka@redhat.com>
2696 * parser.c (cp_parser_requires_clause_opt): Diagnose and recover from
2697 "requires {" when "requires requires {" was probably intended.
2700 * constraint.cc (tsubst_compound_requirement): Always suppress errors
2701 from type_deducible_p and expression_convertible_p, as they're not
2702 substitution errors.
2703 (diagnose_atomic_constraint) <case INTEGER_CST>: Remove this case so
2704 that we diagnose INTEGER_CST expressions of non-bool type via the
2706 * cp-gimplify.c (cp_genericize_r) <case REQUIRES_EXPR>: New case.
2707 * parser.c (cp_parser_requires_expression): Always parse the requirement
2708 body as if we're processing a template, by temporarily incrementing
2709 processing_template_decl. Afterwards, if we're not actually in a
2710 template context, perform semantic processing to diagnose any invalid
2711 types and expressions.
2712 * pt.c (tsubst_copy_and_build) <case REQUIRES_EXPR>: Remove dead code.
2713 * semantics.c (finish_static_assert): Explain an assertion failure
2714 when the condition is a REQUIRES_EXPR like we do when it is a concept
2717 * constraint.cc (diagnose_compound_requirement): When diagnosing a
2718 compound requirement, maybe replay the satisfaction failure, subject to
2719 the current diagnosis depth.
2721 * constraint.cc (finish_constraint_binary_op): Set the location of EXPR
2722 as well as its range, because build_x_binary_op doesn't always do so.
2723 (current_constraint_diagnosis_depth): New.
2724 (concepts_diagnostics_max_depth_exceeded_p): New.
2725 (collect_operands_of_disjunction): New.
2726 (satisfy_disjunction): When diagnosing a satisfaction failure, maybe
2727 replay each branch of the disjunction, subject to the current diagnosis
2729 (diagnose_valid_expression): When diagnosing a satisfaction failure,
2730 maybe replay the substitution error, subject to the current diagnosis
2732 (diagnose_valid_type): Likewise.
2733 (diagnose_nested_requiremnet): Likewise.
2734 (diagnosing_failed_constraint::diagnosing_failed_constraint): Increment
2735 current_constraint_diagnosis_depth when diagnosing.
2736 (diagnosing_failed_constraint::~diagnosing_failed_constraint): Decrement
2737 current_constraint_diagnosis_depth when diagnosing.
2738 (diagnosing_failed_constraint::replay_errors_p): New static member
2740 (diagnose_constraints): Don't diagnose if concepts_diagnostics_max_depth
2741 is 0. Emit a one-off note to increase -fconcepts-diagnostics-depth if
2742 the limit was exceeded.
2743 * cp-tree.h (diagnosing_failed_constraint::replay_errors_p): Declare.
2745 2020-03-27 Nathan Sidwell <nathan@acm.org>
2748 * name-lookup.c (do_pushdecl): Look through cleanp levels.
2750 2020-03-27 Martin Sebor <msebor@redhat.com>
2755 * cp-tree.h (most_specialized_partial_spec): Declare.
2756 * parser.c (cp_parser_elaborated_type_specifier): Distinguish alias
2758 (specialization_of): New function.
2759 (cp_parser_check_class_key): Move code...
2760 (class_decl_loc_t::add): ...to here. Add parameters. Avoid issuing
2761 -Wredundant-tags on first-time declarations in other declarators.
2762 Correct handling of template specializations.
2763 (class_decl_loc_t::diag_mismatched_tags): Also expect to be called
2764 when -Wredundant-tags is enabled. Use primary template or partial
2765 specialization as the guide for uses of implicit instantiations.
2766 * pt.c (most_specialized_partial_spec): Declare extern.
2768 2020-03-27 Nathan Sidwell <nathan@acm.org>
2771 * name-lookup.c (push_namespace): Triage ambiguous lookups that
2774 2020-03-27 Jakub Jelinek <jakub@redhat.com>
2777 * call.c (set_flags_from_callee): Don't update
2778 cp_function_chain->can_throw or current_function_returns_abnormally
2779 if cp_unevaluated_operand.
2782 * cvt.c (ocp_convert): Handle COMPOUND_EXPR by recursion on the second
2783 operand and creating a new COMPOUND_EXPR if anything changed.
2785 2020-03-26 Marek Polacek <polacek@redhat.com>
2787 PR c++/94336 - template keyword accepted before destructor names.
2788 * parser.c (cp_parser_unqualified_id): Give an error when 'template'
2789 is followed by a destructor name.
2791 2020-03-27 Patrick Palka <ppalka@redhat.com>
2793 * decl.c (compute_array_index_type_loc): Remove redundant
2794 type_dependent_expression_p check that is subsumed by
2795 value_dependent_expression_p.
2796 * decl2.c (is_late_template_attribute): Likewise.
2797 * pt.c (uses_template_parms): Likewise.
2798 (dependent_template_arg_p): Likewise.
2800 2020-03-26 Marek Polacek <polacek@redhat.com>
2803 PR c++/94057 - template keyword in a typename-specifier.
2804 * parser.c (check_template_keyword_in_nested_name_spec): New.
2805 (cp_parser_nested_name_specifier_opt): Implement DR1710, optional
2806 'template'. Call check_template_keyword_in_nested_name_spec.
2807 (cp_parser_simple_type_specifier): Assume that a <
2808 following a qualified-id in a typename-specifier begins
2809 a template argument list.
2811 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
2813 * coroutines.cc (coro_init_identifiers): Initialize an identifier
2814 for the cororoutine handle 'address' method name.
2815 (struct coro_aw_data): Add fields to cover the continuations.
2816 (co_await_expander): Determine the kind of await_suspend in use.
2817 If we have the case that returns a continuation handle, then save
2818 this and make the target for 'scope exit without cleanup' be the
2819 continuation resume label.
2820 (expand_co_awaits): Remove.
2821 (struct suspend_point_info): Remove fields that kept the returned
2822 await_suspend handle type.
2823 (transform_await_expr): Remove code tracking continuation handles.
2824 (build_actor_fn): Add the continuation handle as an actor-function
2825 scope var. Build the symmetric transfer continuation point. Call
2826 the tree walk for co_await expansion directly, rather than via a
2827 trivial shim function.
2828 (register_await_info): Remove fields tracking continuation handles.
2829 (get_await_suspend_return_type): Remove.
2830 (register_awaits): Remove code tracking continuation handles.
2831 (morph_fn_to_coro): Remove code tracking continuation handles.
2833 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
2835 * coroutines.cc (co_await_expander): If we are expanding the
2836 initial await expression, set a boolean flag to show that we
2837 have now reached the initial await_resume() method call.
2838 (expand_co_awaits): Handle the 'initial await resume called' flag.
2839 (build_actor_fn): Insert the initial await expression into the
2840 start of the user-authored function-body. Handle the 'initial await
2841 resume called' flag.
2842 (morph_fn_to_coro): Initialise the 'initial await resume called'
2843 flag. Modify the unhandled exception catch clause to recognise
2844 exceptions that occur before the initial await_resume() and re-
2847 2020-03-26 Jakub Jelinek <jakub@redhat.com>
2850 * class.c (user_provided_p): Use STRIP_TEMPLATE instead of returning
2851 true for all TEMPLATE_DECLs.
2854 * cp-gimplify.c (cp_genericize_r): Handle STATEMENT_LIST.
2856 2020-03-25 Patrick Palka <ppalka@redhat.com>
2859 * parser.c (cp_parser_selection_statement) <case RID_IF>: Invalidate the
2860 current condition chain when the if-statement has a non-empty
2863 2020-03-25 Iain Sandoe <iain@sandoe.co.uk>
2866 * coroutines.cc (captures_temporary): Fix a missing dereference.
2868 2020-03-24 Marek Polacek <polacek@redhat.com>
2870 PR c++/94190 - wrong no post-decrement operator error in template.
2871 * call.c (convert_like_real): Use convert_from_reference on the result.
2873 2020-03-24 Jason Merrill <jason@redhat.com>
2876 * constraint.cc (constraint_satisfaction_value): Repeat noisily on
2878 (tsubst_nested_requirement): Likewise.
2879 (get_constraint_error_location): Allow missing context.
2880 (diagnose_atomic_constraint): Diagnose non-bool constraint here.
2881 (satisfy_atom): Not here. Only diagnose non-constant when noisy.
2883 2020-03-24 Jason Merrill <jason@redhat.com>
2885 * pt.c (any_template_parm_r): Look into the type of a non-type
2888 2020-03-24 Jason Merrill <jason@redhat.com>
2890 * cp-tree.h (cp_expr): When constructing from an expr and a
2891 location, call protected_set_expr_location.
2893 2020-03-23 Patrick Palka <ppalka@redhat.com>
2896 * except.c (maybe_noexcept_warning): Add TODO.
2897 * method.c (walk_field_subobs): Pass tf_none to expr_noexcept_p.
2899 2020-03-23 nathans <nathan@acm.org>
2902 * tree.c (cp_tree_equal) [SIZEOF_EXPR]: Detect argument pack
2905 2020-03-21 Patrick Palka <ppalka@redhat.com>
2908 * constexpr.c (reduced_constant_expression_p) [CONSTRUCTOR]: Properly
2909 handle unions without an initializer.
2910 (cxx_eval_component_reference): Emit a different diagnostic when the
2911 constructor element corresponding to a union member is NULL.
2912 (cxx_eval_bare_aggregate): When constructing a union, always set the
2913 active union member before evaluating the initializer. Relax assertion
2914 that verifies the index of the constructor element we're initializing
2915 hasn't been changed.
2916 (cxx_eval_store_expression): Diagnose changing the active union member
2917 while the union is in the process of being initialized. After setting
2918 an active union member, clear CONSTRUCTOR_NO_CLEARING on the underlying
2920 (cxx_eval_constant_expression) [PLACEHOLDER_EXPR]: Don't re-reduce a
2921 CONSTRUCTOR returned by lookup_placeholder.
2923 2020-03-20 Patrick Palka <ppalka@redhat.com>
2925 * cxx-pretty-print.c (pp_cxx_parameter_mapping): Make extern. Move
2926 the "[with ]" bits to here from ...
2927 (pp_cxx_atomic_constraint): ... here.
2928 * cxx-pretty-print.h (pp_cxx_parameter_mapping): Declare.
2929 * error.c (rebuild_concept_check): Delete.
2930 (print_concept_check_info): Print the dependent form of the constraint and the
2931 preferably substituted parameter mapping alongside it.
2933 2020-03-19 Jason Merrill <jason@redhat.com>
2936 * cp-gimplify.c (simple_empty_class_p): Look through
2937 SIMPLE_TARGET_EXPR_P.
2938 (cp_gimplify_expr) [MODIFY_EXPR]: Likewise.
2939 [RETURN_EXPR]: Avoid producing 'return *retval;'.
2940 * call.c (build_call_a): Strip TARGET_EXPR from empty class arg.
2941 * cp-tree.h (SIMPLE_TARGET_EXPR_P): Check that TARGET_EXPR_INITIAL
2944 2020-03-19 Jakub Jelinek <jakub@redhat.com>
2947 * parser.c (cp_parser_omp_var_list_no_open): Call process_outer_var_ref
2948 on outer_automatic_var_p decls.
2949 * cp-gimplify.c (cxx_omp_disregard_value_expr): Return true also for
2950 capture proxy decls.
2952 2020-03-18 Nathan Sidwell <nathan@acm.org>
2954 PR c++/94147 - mangling of lambdas assigned to globals
2955 * parser.c (cp_parser_init_declarator): Namespace-scope variables
2956 provide a lambda scope.
2957 * tree.c (no_linkage_check): Lambdas with a variable for extra
2958 scope have a linkage from the variable.
2960 2020-03-18 Jakub Jelinek <jakub@redhat.com>
2962 * constraint.cc (resolve_function_concept_check, subsumes_constraints,
2963 strictly_subsumes): Fix up duplicated word issue in a comment.
2964 * coroutines.cc (build_init_or_final_await, captures_temporary):
2966 * logic.cc (dnf_size_r, cnf_size_r): Likewise.
2967 * pt.c (append_type_to_template_for_access_check): Likewise.
2970 * decl.c (grokfndecl): Restore old diagnostics about deduction
2971 guide declared in different scope if in_namespace is NULL_TREE.
2973 2020-03-17 Jakub Jelinek <jakub@redhat.com>
2976 * parser.c (cp_parser_enum_specifier): Use temp_override for
2977 parser->colon_corrects_to_scope_p, replace goto out with return.
2978 If scoped enum or enum with underlying type is not followed by
2979 { or ;, call cp_parser_commit_to_tentative_parse before calling
2980 cp_parser_error and make sure to return error_mark_node instead of
2981 NULL_TREE. Formatting fixes.
2983 2020-03-17 Ville Voutilainen <ville.voutilainen@gmail.com>
2986 * method.c (assignable_expr): Use cp_unevaluated.
2987 (is_xible_helper): Push a non-deferred access check for
2988 the stub objects created by assignable_expr and constructible_expr.
2990 2020-03-17 Jakub Jelinek <jakub@redhat.com>
2992 * pt.c (tsubst): Fix up duplicated word issue in a diagnostic message.
2993 (lookup_template_class_1, tsubst_expr): Fix up duplicated word issue
2995 * parser.c (cp_parser_statement, cp_parser_linkage_specification,
2996 cp_parser_placeholder_type_specifier,
2997 cp_parser_constraint_requires_parens): Likewise.
2998 * name-lookup.c (suggest_alternative_in_explicit_scope): Likewise.
3000 2020-03-15 Iain Sandoe <iain@sandoe.co.uk>
3002 * coroutines.cc (co_await_expander): Fix indentation.
3004 2020-03-14 Jason Merrill <jason@redhat.com>
3007 * pt.c (process_partial_specialization): Error rather than crash on
3008 extra pack expansion.
3010 2020-03-14 Jason Merrill <jason@redhat.com>
3013 * pt.c (find_parameter_packs_r): [DECL_EXPR]: Walk
3014 DECL_ORIGINAL_TYPE of a typedef.
3016 2020-03-14 Jason Merrill <jason@redhat.com>
3019 * pt.c (build_deduction_guide): Clear cp_unevaluated_operand for
3020 substituting DECL_ARGUMENTS.
3022 2020-03-14 Jakub Jelinek <jakub@redhat.com>
3024 * logic.cc (formula::formula): Change "a an" to "an" in a comment.
3025 * parser.c (cp_debug_parser): Change "a an" to "an" in a string
3028 2020-03-13 Patrick Palka <ppalka@redhat.com>
3031 * call.c (build_over_call): Use a warning_sentinel to disable
3032 warn_deprecated_decl before calling build_addr_func.
3034 2020-03-12 Jakub Jelinek <jakub@redhat.com>
3037 * decl.c (reshape_init_array_1): Don't unshare constructor if there
3038 aren't any trailing zero elts, otherwise only unshare the first
3041 2020-03-11 Jason Merrill <jason@redhat.com>
3044 * constraint.cc (tsubst_parameter_mapping): Canonicalize type
3047 2020-03-11 Marek Polacek <polacek@redhat.com>
3048 Jason Merrill <jason@redhat.com>
3050 PR c++/94074 - wrong modifying const object error for COMPONENT_REF.
3051 * constexpr.c (cref_has_const_field): New function.
3052 (modifying_const_object_p): Consider a COMPONENT_REF
3053 const only if any of its fields are const.
3054 (cxx_eval_store_expression): Mark a CONSTRUCTOR of a const type
3055 as readonly after its initialization has been done.
3057 2020-03-10 Marek Polacek <polacek@redhat.com>
3059 PR c++/94124 - wrong conversion error with non-viable overload.
3060 * decl.c (reshape_init_array_1): Unshare a constructor if we
3061 stripped trailing zero-initializers.
3063 2020-03-10 Jason Merrill <jason@redhat.com>
3066 * pt.c (maybe_instantiate_noexcept): Always update clones.
3068 2020-03-10 Jason Merrill <jason@redhat.com>
3071 * pt.c (maybe_aggr_guide): Check BRACE_ENCLOSED_INITIALIZER_P.
3073 2020-03-10 Jason Merrill <jason@redhat.com>
3079 * cp-gimplify.c (cp_gimplify_init_expr): Partially revert patch for
3080 66139: Don't split_nonconstant_init. Remove pre_p parameter.
3082 2020-03-09 Marek Polacek <polacek@redhat.com>
3084 PR c++/92031 - bogus taking address of rvalue error.
3085 PR c++/91465 - ICE with template codes in check_narrowing.
3086 PR c++/93870 - wrong error when converting template non-type arg.
3087 PR c++/94068 - ICE with template codes in check_narrowing.
3088 * call.c (convert_like_real): Return IMPLICIT_CONV_EXPR
3089 in a template when not ck_identity and we're dealing with a class.
3090 (convert_like_real) <case ck_ref_bind>: Return IMPLICIT_CONV_EXPR
3091 in a template if we need a temporary.
3092 * decl.c (compute_array_index_type_loc): Remove
3093 instantiate_non_dependent_expr_sfinae call. Call
3094 fold_non_dependent_expr instead of maybe_constant_value.
3095 (build_explicit_specifier): Don't instantiate or create a sentinel
3096 before converting the expression.
3097 * except.c (build_noexcept_spec): Likewise.
3098 * pt.c (convert_nontype_argument): Don't build IMPLICIT_CONV_EXPR.
3099 Set IMPLICIT_CONV_EXPR_NONTYPE_ARG if that's what
3100 build_converted_constant_expr returned.
3101 * typeck2.c (check_narrowing): Call fold_non_dependent_expr instead
3102 of maybe_constant_value.
3104 2020-03-09 Jakub Jelinek <jakub@redhat.com>
3108 2019-10-11 Paolo Carlini <paolo.carlini@oracle.com>
3110 * constexpr.c (cxx_eval_constant_expression): Do not handle
3111 RROTATE_EXPR and LROTATE_EXPR.
3113 2020-03-09 Marek Polacek <polacek@redhat.com>
3115 PR c++/94050 - ABI issue with alignas on armv7hl.
3116 * class.c (layout_class_type): Don't replace a class's
3117 CLASSTYPE_AS_BASE if their TYPE_USER_ALIGN don't match.
3119 2020-03-09 Bin Cheng <bin.cheng@linux.alibaba.com>
3121 * coroutines.cc (build_actor_fn): Factor out code inserting the
3122 default return_void call to...
3123 (morph_fn_to_coro): ...here, also hoist local var declarations.
3125 2020-03-08 Patrick Palka <ppalka@redhat.com>
3128 * call.c (convert_like_real): Check complain before emitting an error
3129 about binding a bit-field to a reference.
3131 * cxx-pretty-print.c (cxx_pretty_printer::simple_type_specifier)
3132 [TYPENAME_TYPE]: Print the TYPENAME_TYPE_FULLNAME instead of the
3135 2020-03-06 Nathan Sidwell <nathan@acm.org>
3138 * mangle.c (find_substitution): Don't call same_type_p on template
3139 args that cannot match.
3141 2020-03-04 Martin Sebor <msebor@redhat.com>
3144 * tree.c (type_initializer_zero_p): Fail for structs initialized
3147 2020-03-04 Jason Merrill <jason@redhat.com>
3150 * init.c (perform_member_init): Don't do aggregate initialization of
3152 * constexpr.c (cx_check_missing_mem_inits): Don't enforce
3153 initialization of empty field.
3155 2020-03-04 Martin Liska <mliska@suse.cz>
3157 * method.c: Wrap array in ctor with braces in order
3158 to silent clang warnings.
3160 2020-03-03 Jason Merrill <jason@redhat.com>
3161 Marek Polacek <polacek@redhat.com>
3163 PR c++/90505 - mismatch in template argument deduction.
3164 * pt.c (tsubst): Don't reduce the template level of template
3165 parameters when tf_partial.
3167 2020-03-03 Jakub Jelinek <jakub@redhat.com>
3170 * constexpr.c (cxx_eval_constant_expression)
3171 <case TARGET_EXPR, case SAVE_EXPR>: Don't record anything if
3172 *non_constant_p is true.
3174 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
3176 * coroutines.cc (captures_temporary): Strip component_ref
3179 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
3181 * coroutines.cc (finish_co_await_expr): Build co_await_expr
3182 with unknown_type_node.
3183 (finish_co_yield_expr): Ditto.
3184 *pt.c (type_dependent_expression_p): Set co_await/yield_expr
3185 with unknown type as dependent.
3187 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
3189 * coroutines.cc (struct local_var_info): Adjust to remove the
3190 reference to the captured var, and just to note that this is a
3191 lambda capture proxy.
3192 (transform_local_var_uses): Handle lambda captures specially.
3193 (struct param_frame_data): Add a visited set.
3194 (register_param_uses): Also check for param uses in lambda
3196 (struct local_vars_frame_data): Remove captures list.
3197 (register_local_var_uses): Handle lambda capture proxies by
3198 noting and bypassing them.
3199 (morph_fn_to_coro): Update to remove lifetime extension of
3200 lambda capture-by-copy vars.
3202 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
3204 * coroutines.cc (build_co_await): Do not build frame
3205 awaitable proxy vars when the co_await expression is
3206 a function parameter or local var.
3207 (co_await_expander): Do not initialise a frame var with
3209 (transform_await_expr): Only substitute the awaitable
3210 frame var if it's needed.
3211 (register_awaits): Do not make frame copies for param
3212 or local vars that are awaitables.
3214 2020-02-28 Jason Merrill <jason@redhat.com>
3216 Implement P2092R0, Disambiguating Nested-Requirements
3217 * parser.c (cp_parser_requirement_parameter_list): Pass
3218 CP_PARSER_FLAGS_TYPENAME_OPTIONAL.
3220 * call.c (build_user_type_conversion_1): Don't look at the second
3221 conversion of a non-viable candidate.
3223 2020-02-28 Jakub Jelinek <jakub@redhat.com>
3225 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
3226 * typeck.c (cp_build_addr_expr_1): Allow taking address of immediate
3227 functions in unevaluated contexts.
3229 2020-02-27 Nathan Sidwell <nathan@acm.org>
3232 * pt.c (template_args_equal): Pass ARGUMENT_PACKS through to
3234 * tree.c (cp_tree_equal): Compare ARGUMENT_PACKS here,
3235 * typeck.c (comptypes): Assert we don't get any argument packs.
3237 * class.c (adjust_clone_args): Correct arg-checking assert.
3238 * typeck.c (comptypes): Assert not nulls.
3240 2020-02-26 Marek Polacek <polacek@redhat.com>
3242 PR c++/93789 - ICE with invalid array bounds.
3243 * decl.c (compute_array_index_type_loc): Don't use the folded
3244 size when folding cleared TREE_CONSTANT.
3246 2020-02-26 Iain Sandoe <iain@sandoe.co.uk>
3248 * class.c (classtype_has_non_deleted_copy_ctor): New.
3249 * coroutines.cc (struct param_info): Keep track of params
3250 that are references, and cache the original type and whether
3251 the DTOR is trivial.
3252 (build_actor_fn): Handle param copies always, and adjust the
3253 handling for references.
3254 (register_param_uses): Only handle uses here.
3255 (classtype_has_non_deleted_copy_ctor): New.
3256 (morph_fn_to_coro): Adjust param copy handling to match n4849
3257 by reordering ahead of the promise CTOR and always making a
3258 frame copy, even if the param is unused in the coroutine body.
3259 * cp-tree.h (classtype_has_non_deleted_copy_ctor): New.
3261 2020-02-26 Patrick Palka <ppalka@redhat.com>
3263 * constraint.cc (finish_constraint_binary_op): Set expr's location range
3264 to the range of its operands.
3265 (satisfy_atom): Pass MAP instead of ARGS to diagnose_atomic_constraint.
3266 (diagnose_trait_expr): Take the instantiated parameter mapping MAP
3267 instead of the corresponding template arguments ARGS and adjust body
3269 (diagnose_requires_expr): Likewise.
3270 (diagnose_atomic_constraint): Likewise. When printing an atomic
3271 constraint expression, print the instantiated parameter mapping
3273 * cxx-pretty-print.cc (cxx_pretty_printer::expression)
3274 [NONTYPE_ARGUMENT_PACK]: Print braces around a NONTYPE_ARGUMENT_PACK.
3275 (cxx_pretty_printer::type_id): Handle TYPE_ARGUMENT_PACK.
3277 2020-02-26 Marek Polacek <polacek@redhat.com>
3279 PR c++/93676 - value-init crash in template.
3280 * init.c (build_new_1): Don't call build_vec_init in a template.
3282 2020-02-26 Marek Polacek <polacek@redhat.com>
3284 PR c++/93862 - ICE with static_cast when converting from int[].
3285 * call.c (reference_compatible_p): No longer static.
3286 * cp-tree.h (reference_compatible_p): Declare.
3287 * typeck.c (build_static_cast_1): Use reference_compatible_p instead
3288 of reference_related_p.
3290 2020-02-26 Marek Polacek <polacek@redhat.com>
3292 PR c++/93803 - ICE with constexpr init and [[no_unique_address]].
3293 * constexpr.c (reduced_constant_expression_p): Don't crash on a null
3296 2020-02-24 Martin Sebor <msebor@redhat.com>
3299 * parser.c (cp_parser_check_class_key): Avoid issuing -Wredundant-tags
3300 in shared C/C++ code in headers.
3301 Remove a duplicate hunk of code.
3303 2020-02-24 Marek Polacek <polacek@redhat.com>
3305 PR c++/93869 - ICE with -Wmismatched-tags.
3306 * parser.c (cp_parser_check_class_key): Check class_key earlier.
3308 2020-02-24 Marek Polacek <polacek@redhat.com>
3310 PR c++/93712 - ICE with ill-formed array list-initialization.
3311 * call.c (next_conversion): Return NULL for ck_aggr.
3312 (build_aggr_conv): Set u.expr instead of u.next.
3313 (build_array_conv): Likewise.
3314 (build_complex_conv): Likewise.
3315 (conv_get_original_expr): Handle ck_aggr.
3317 2020-02-24 Jakub Jelinek <jakub@redhat.com>
3319 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
3320 * call.c (build_over_call): Don't evaluate immediate functions in
3321 unevaluated operands.
3323 2020-02-24 Jason Merrill <jason@redhat.com>
3325 P0780R2: Resolve lambda init-capture pack grammar.
3326 * parser.c (cp_parser_lambda_introducer): Expect &...x=y rather than
3329 2020-02-22 Marek Polacek <polacek@redhat.com>
3332 * decl.c (grokdeclarator): Use %qs in a diagnostic message.
3334 2020-02-21 Martin Sebor <msebor@redhat.com>
3336 PR gcov-profile/93753
3337 * class.c (check_flexarrays): Tighten up a test for potential members
3338 of anonymous structs or unions.
3340 2020-02-20 Martin Sebor <msebor@redhat.com>
3343 * parser.c (cp_parser_check_class_key): Only handle true C++ class-keys.
3345 2020-02-20 Martin Liska <mliska@suse.cz>
3347 PR translation/93841
3348 * config/or1k/or1k.opt: Remove superfluous word.
3349 * doc/invoke.texi: Likewise.
3351 2020-02-20 Martin Liska <mliska@suse.cz>
3353 PR translation/93838
3354 * parser.c (cp_parser_decl_specifier_seq): Remove trailing space.
3356 2020-02-19 Marek Polacek <polacek@redhat.com>
3358 PR c++/93169 - wrong-code with a non-constexpr constructor.
3359 * constexpr.c (cxx_eval_call_expression): Only set TREE_READONLY
3360 on constant CONSTRUCTORs.
3362 2020-02-15 Marek Polacek <polacek@redhat.com>
3364 PR c++/93710 - poor diagnostic for array initializer.
3365 * call.c (build_user_type_conversion_1): Use cp_expr_loc_or_input_loc
3368 2020-02-15 Jason Merrill <jason@redhat.com>
3371 * pt.c (any_template_parm_r): Look into lambda body.
3374 * pt.c (any_template_parm_r): Remove CONSTRUCTOR handling.
3376 2020-02-14 Jakub Jelinek <jakub@redhat.com>
3379 * class.c (enum_min_precision): Change prec type from int to int &.
3382 * cp-tree.h (enum cp_tree_index): Add CPTI_FALLBACK_DFLOAT32_TYPE,
3383 CPTI_FALLBACK_DFLOAT64_TYPE and CPTI_FALLBACK_DFLOAT128_TYPE.
3384 (fallback_dfloat32_type, fallback_dfloat64_type,
3385 fallback_dfloat128_type): Define.
3386 * mangle.c (write_builtin_type): Handle fallback_dfloat*_type like
3388 * rtti.c (emit_support_tinfos): Emit DFP typeinfos even when dfp
3389 is disabled for compatibility.
3391 2020-02-13 Jason Merrill <jason@redhat.com>
3394 * name-lookup.c (matching_fn_p): A function does not match a
3399 * tree.c (decl_linkage): Always lk_none for locals.
3401 2020-02-12 Jason Merrill <jason@redhat.com>
3405 * tree.c (cp_walk_subtrees): Walk CONSTRUCTOR types here.
3406 * pt.c (find_parameter_packs_r): Not here.
3408 2020-02-12 Iain Sandoe <iain@sandoe.co.uk>
3410 * coroutines.cc (build_actor_fn): Implement deallocation function
3411 selection per n4849, dcl.fct.def.coroutine bullet 12.
3412 (morph_fn_to_coro): Implement allocation function selection per
3413 n4849, dcl.fct.def.coroutine bullets 9 and 10.
3415 2020-02-12 Marek Polacek <polacek@redhat.com>
3417 PR c++/93684 - ICE-on-invalid with broken attribute.
3418 * parser.c (cp_parser_std_attribute): Peek a token first before
3421 2020-02-11 Jason Merrill <jason@redhat.com>
3424 * class.c (add_implicitly_declared_members): Use do_friend.
3425 * method.c (implicitly_declare_fn): Fix friend handling.
3426 (decl_remember_implicit_trigger_p): New.
3427 (synthesize_method): Use it.
3428 * decl2.c (mark_used): Use it.
3430 2020-02-11 Jason Merrill <jason@redhat.com>
3434 * constexpr.c (maybe_constant_value): Correct earlier change.
3435 (cxx_eval_binary_expression) [SPACESHIP_EXPR]: Pass lval through.
3436 * method.c (genericize_spaceship): Wrap result in TARGET_EXPR.
3438 2020-02-12 Patrick Palka <ppalka@redhat.com>
3442 * type-utils.h (find_type_usage): Refactor to take a tree * and to
3443 return a tree *, and update documentation accordingly.
3444 * pt.c (make_auto_1): Set AUTO_IS_DECLTYPE when building a
3445 decltype(auto) node.
3446 (make_constrained_decltype_auto): No need to explicitly set
3447 AUTO_IS_DECLTYPE anymore.
3448 (splice_late_return_type): Use find_type_usage to find and
3449 replace a possibly nested auto node instead of using is_auto.
3450 Check test for is_auto into an assert when deciding whether
3451 to late_return_type.
3452 (type_uses_auto): Adjust the call to find_type_usage.
3453 * parser.c (cp_parser_decltype): No need to explicitly set
3454 AUTO_IS_DECLTYPE anymore.
3456 * error.c (dump_decl) [CONCEPT_DECL]: Use dump_simple_decl.
3457 (dump_simple_decl): Handle standard concept definitions as well as
3458 variable concept definitions.
3460 2020-02-10 Jakub Jelinek <jakub@redhat.com>
3463 * error.c (dump_decl_name): Fix up last argument to strncmp.
3465 2020-02-10 Jason Merrill <jason@redhat.com>
3468 * tree.c (array_of_unknown_bound_p): New.
3469 * init.c (perform_member_init): Do nothing for flexible arrays.
3471 2020-02-09 Jakub Jelinek <jakub@redhat.com>
3474 * constexpr.c (cxx_eval_constant_expression): If obj is heap var with
3475 ARRAY_TYPE, use the element type. Punt if objtype after that is not
3478 2020-02-08 Jason Merrill <jason@redhat.com>
3481 * expr.c (fold_for_warn): Call maybe_constant_value.
3482 * constexpr.c (struct constexpr_ctx): Add uid_sensitive bit-field.
3483 (maybe_constant_value): Add uid_sensitive parm.
3484 (get_fundef_copy): Don't copy if it's true.
3485 (cxx_eval_call_expression): Don't instantiate if it's true.
3486 (cxx_eval_outermost_constant_expr): Likewise.
3489 * constexpr.c (maybe_constant_value): Don't unshare if the cached
3490 value is the same as the argument.
3492 * typeck.c (maybe_warn_about_returning_address_of_local): Add
3495 * typeck2.c (process_init_constructor): Also clear TREE_SIDE_EFFECTS
3498 2020-02-08 Jakub Jelinek <jakub@redhat.com>
3501 * constexpr.c (find_array_ctor_elt): If last element has no index,
3502 for flag_checking verify all elts have no index. If i is within the
3503 elts, return it directly, if it is right after the last elt, append
3504 if NULL index, otherwise force indexes on all elts.
3505 (cxx_eval_store_expression): Allow cep->index to be NULL.
3507 2020-02-07 Marek Polacek <polacek@redhat.com>
3509 PR c++/92947 - Paren init of aggregates in unevaluated context.
3510 * call.c (build_new_method_call_1): Don't check
3511 cp_unevaluated_operand. Check the return value of digest_init.
3513 2020-02-06 Jason Merrill <jason@redhat.com>
3516 * tree.c (cp_walk_subtrees): Walk into type template arguments.
3517 * cp-tree.h (TYPE_TEMPLATE_INFO_MAYBE_ALIAS): Use typedef_variant_p
3518 instead of TYPE_ALIAS_P.
3519 * pt.c (push_template_decl_real): Likewise.
3520 (find_parameter_packs_r): Likewise. Remove dead code.
3521 * error.c (find_typenames_r): Remove dead code.
3523 2020-02-06 Jason Merrill <jason@redhat.com>
3526 * parser.c (cp_parser_constraint_primary_expression): Do the main
3527 parse non-tentatively.
3529 2020-02-06 Marek Polacek <polacek@redhat.com>
3531 PR c++/93597 - ICE with lambda in operator function.
3532 * name-lookup.c (maybe_save_operator_binding): Check is_overloaded_fn.
3534 2020-02-05 Jason Merrill <jason@redhat.com>
3537 * pt.c (tsubst_decl) [PARM_DECL]: Check cp_unevaluated_operand in
3538 handling of TREE_CHAIN for empty pack.
3540 2020-02-05 Jakub Jelinek <jakub@redhat.com>
3543 * semantics.c (cp_build_vec_convert): Call decay_conversion on arg
3544 prior to passing it to c_build_vec_convert.
3546 2020-02-05 Marek Polacek <polacek@redhat.com>
3548 PR c++/93559 - ICE with CONSTRUCTOR flags verification.
3549 * decl.c (reshape_init_array_1): Don't reuse a CONSTRUCTOR with
3552 2020-02-05 Jason Merrill <jason@redhat.com>
3555 * decl.c (grokdeclarator): Reject field of current class type even
3558 2020-02-05 Bin Cheng <bin.cheng@linux.alibaba.com>
3560 * coroutines.cc (maybe_promote_captured_temps): Increase the index
3561 number for temporary variables' name.
3563 2020-02-05 Jun Ma <JunMa@linux.alibaba.com>
3565 * coroutines.cc (build_co_await): Call convert_from_reference
3566 to wrap co_await_expr with indirect_ref which avoid
3567 reference/non-reference type confusion.
3569 (co_await_expander): Sink to call_expr if await_resume
3570 is wrapped by indirect_ref.
3572 2020-02-04 Jason Merrill <jason@redhat.com>
3575 * constraint.cc (satisfy_declaration_constraints): Check return
3576 value of push_tinst_level.
3579 * constexpr.c (cxx_eval_array_reference): {}-initialize missing
3580 elements instead of value-initializing them.
3583 * init.c (perform_member_init): Simplify.
3584 * constexpr.c (cx_check_missing_mem_inits): Allow uninitialized
3586 (cxx_eval_vec_init_1): Handle CONSTRUCTOR.
3588 2020-02-04 Iain Sandoe <iain@sandoe.co.uk>
3590 * coroutines.cc (find_promise_type): Delete unused forward
3592 (struct coroutine_info): Add a bool for no promise type error.
3593 (coro_promise_type_found_p): Only emit the error for a missing
3594 promise once in each affected coroutine.
3596 2020-02-03 Jason Merrill <jason@redhat.com>
3599 * constexpr.c (cxx_eval_constant_expression) [PARM_DECL]: Don't
3600 defer loading the value of a reference.
3602 2020-02-03 Jason Merrill <jason@redhat.com>
3605 * constexpr.c (potential_constant_expression_1) [PARM_DECL]: Allow
3607 [COMPONENT_REF]: A member function reference doesn't use the object
3610 2020-02-03 Iain Sandoe <iain@sandoe.co.uk>
3613 * coroutines.cc (struct coroutine_info): Add a bool flag to note
3614 that we emitted an error for a bad function return type.
3615 (get_coroutine_info): Tolerate an unset info table in case of
3617 (find_coro_traits_template_decl): In case of error or if we didn't
3618 find a type template, note we emitted the error and suppress
3620 (find_coro_handle_template_decl): Likewise.
3621 (instantiate_coro_traits): Only check for error_mark_node in the
3622 return from lookup_qualified_name.
3623 (coro_promise_type_found_p): Reorder initialization so that we check
3624 for the traits and their usability before allocation of the info
3625 table. Check for a suitable return type and emit a diagnostic for
3626 here instead of relying on the lookup machinery. This allows the
3627 error to have a better location, and means we can suppress multiple
3629 (coro_function_valid_p): Re-check for a valid promise (and thus the
3630 traits) before proceeding. Tolerate missing info as a fatal error.
3632 2020-02-03 Jason Merrill <jason@redhat.com>
3635 * cp-gimplify.c (predeclare_vla): New.
3636 (cp_genericize_r) [NOP_EXPR]: Call it.
3638 2020-02-03 Jun Ma <JunMa@linux.alibaba.com>
3640 * coroutines.cc (transform_await_wrapper): Set actor funcion as
3641 new context of label_decl.
3642 (build_actor_fn): Fill new field of await_xform_data.
3644 2020-02-02 Marek Polacek <polacek@redhat.com>
3646 PR c++/93530 - ICE on invalid alignas in a template.
3647 * decl.c (grokdeclarator): Call cplus_decl_attributes instead of
3650 2020-01-31 Jason Merrill <jason@redhat.com>
3653 * semantics.c (process_outer_var_ref): Capture VLAs even in
3654 unevaluated context.
3657 * decl.c (reshape_init_array_1): Reuse a single CONSTRUCTOR with
3658 non-aggregate elements.
3659 (reshape_init_array): Add first_initializer_p parm.
3660 (reshape_init_r): Change first_initializer_p from bool to tree.
3661 (reshape_init): Pass init to it.
3664 * parser.c (cp_parser_initializer_list): Suppress location wrappers
3667 2020-01-29 Jason Merrill <jason@redhat.com>
3670 * pt.c (tsubst_copy_and_build) [EQ_EXPR]: Only suppress warnings if
3671 the expression was dependent before substitution.
3673 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
3675 * coroutines.cc (act_des_fn): New.
3676 (morph_fn_to_coro): Call act_des_fn to build actor/destroy decls.
3677 Access promise via actor function's frame pointer argument.
3678 (build_actor_fn, build_destroy_fn): Use frame pointer argument.
3680 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
3682 * coroutines.cc (co_await_expander): Handle type conversion case.
3684 2020-01-29 Jason Merrill <jason@redhat.com>
3689 * parser.c (cp_parser_type_specifier_seq): Don't parse attributes in
3690 a trailing return type.
3691 (cp_parser_lambda_declarator_opt): Parse C++11 attributes before
3694 2020-01-29 Marek Polacek <polacek@redhat.com>
3696 PR c++/91754 - Fix template arguments comparison with class NTTP.
3697 * pt.c (class_nttp_const_wrapper_p): New.
3698 (template_args_equal): See through class_nttp_const_wrapper_p
3701 2020-01-29 Marek Polacek <polacek@redhat.com>
3703 PR c++/92948 - Fix class NTTP with template arguments.
3704 * pt.c (convert_nontype_argument): Use IMPLICIT_CONV_EXPR when
3705 converting a value-dependent expression to a class type.
3706 (tsubst_copy) <case VIEW_CONVERT_EXPR>: Allow IMPLICIT_CONV_EXPR
3707 as the result of the tsubst_copy call.
3709 2020-01-29 Jakub Jelinek <jakub@redhat.com>
3712 * cp-gimplify.c (cxx_omp_predetermined_sharing): Return
3713 OMP_CLAUSE_DEFAULT_SHARED for typeinfo decls.
3715 2020-01-28 Jason Merrill <jason@redhat.com>
3718 * parser.c (cp_parser_lambda_expression): Clear in_discarded_stmt.
3722 * decl2.c (copy_linkage): Do copy DECL_ONE_ONLY and DECL_WEAK.
3725 * call.c (build_user_type_conversion_1): Allow a template conversion
3726 returning an rvalue reference to bind directly to an lvalue.
3729 * decl.c (grokdeclarator): Propagate eh spec from typedef.
3731 2020-01-28 Martin Liska <mliska@suse.cz>
3734 * pt.c (redeclare_class_template): Group couple of
3735 errors and inform messages with auto_diagnostic_group.
3737 2020-01-28 Martin Liska <mliska@suse.cz>
3740 * pt.c (redeclare_class_template): Use inform
3741 for the second location.
3743 2020-01-27 Jason Merrill <jason@redhat.com>
3746 * pt.c (tsubst_copy) [STRING_CST]: Don't use fold_convert.
3748 2020-01-27 Iain Sandoe <iain@sandoe.co.uk>
3751 * coroutines.cc (morph_fn_to_coro): Check the ramp return
3752 value when it is constructed from the 'get return object'.
3754 2020-01-27 Nathan Sidwell <nathan@acm.org>
3757 * name-lookup.c (is_ancestor): Allow CHILD to be a namespace alias.
3759 2020-01-26 Jason Merrill <jason@redhat.com>
3762 * except.c (maybe_noexcept_warning): Check DECL_IN_SYSTEM_HEADER and
3763 temporarily enable -Wsystem-headers. Change second warning to
3767 * semantics.c (finish_call_expr): Don't call
3768 instantiate_non_dependent_expr before warn_for_memset.
3770 2020-01-25 Marek Polacek <polacek@redhat.com>
3772 PR c++/93414 - poor diagnostic for dynamic_cast in constexpr context.
3773 * constexpr.c (cxx_eval_dynamic_cast_fn): Add a reference
3774 dynamic_cast diagnostic.
3776 2020-01-24 Jason Merrill <jason@redhat.com>
3778 PR c++/93400 - ICE with constrained friend.
3779 * constraint.cc (maybe_substitute_reqs_for): New.
3780 * decl.c (function_requirements_equivalent_p): Call it.
3781 * pt.c (tsubst_friend_function): Only substitute
3782 TEMPLATE_PARMS_CONSTRAINTS.
3783 (tsubst_template_parms): Copy constraints.
3785 2020-01-24 Jason Merrill <jason@redhat.com>
3787 PR c++/93279 - ICE with lambda in member operator.
3788 * name-lookup.c (maybe_save_operator_binding): Don't remember
3789 class-scope bindings.
3791 2020-01-24 Jason Merrill <jason@redhat.com>
3793 PR c++/93377 - ICE with member alias in constraint.
3794 * pt.c (any_template_parm_r): Look at template arguments for all
3795 aliases, not only alias templates.
3797 2020-01-24 Marek Polacek <polacek@redhat.com>
3799 PR c++/93299 - ICE in tsubst_copy with parenthesized expression.
3800 * pt.c (tsubst_copy): Handle a REF_PARENTHESIZED_P VIEW_CONVERT_EXPR.
3802 2020-01-24 Jason Merrill <jason@redhat.com>
3804 PR c++/92852 - ICE with generic lambda and reference var.
3805 * constexpr.c (maybe_constant_value): Likewise.
3807 2020-01-23 Paolo Carlini <paolo.carlini@oracle.com>
3810 * parser.c (cp_parser_nested_name_specifier_opt): Properly
3811 diagnose concept-ids.
3813 2020-01-23 Jason Merrill <jason@redhat.com>
3815 PR c++/93331 - ICE with __builtin_strchr.
3816 * constexpr.c (cxx_eval_builtin_function_call): Use the original
3817 argument if we didn't manage to extract a STRING_CST.
3819 PR c++/93345 - ICE with defaulted dtor and template.
3821 * decl.c (cxx_maybe_build_cleanup): Don't try to set
3822 throwing_cleanup in a template.
3824 2020-01-22 Marek Polacek <polacek@redhat.com>
3826 PR c++/92907 - noexcept does not consider "const" in member functions.
3827 * g++.dg/cpp0x/noexcept56.C: New test.
3829 2020-01-22 Marek Polacek <polacek@redhat.com>
3831 PR c++/93324 - ICE with -Wall on constexpr if.
3832 * semantics.c (is_std_constant_evaluated_p): Check fndecl.
3834 2020-01-22 Patrick Palka <ppalka@redhat.com>
3836 * constraint.cc (get_mapped_args): Avoid using auto_vec
3837 as a vector element. Release the vectors inside the lists
3839 * parser.c (cp_literal_operator_id): Free the buffer.
3841 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
3843 * coroutines.cc (finish_co_await_expr): Add error check on return
3844 value of build_co_await.
3845 (finish_co_yield_expr,): Ditto.
3847 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
3849 * coroutines.cc (lookup_awaitable_member): Lookup an awaitable member.
3850 (lookup_promise_method): Emit diagnostic when get NULL_TREE back only.
3851 (build_co_await): Use lookup_awaitable_member instead of lookup_member.
3853 2020-01-21 Jason Merrill <jason@redhat.com>
3855 PR c++/60855 - ICE with sizeof VLA capture.
3856 * lambda.c (is_lambda_ignored_entity): Don't look past VLA capture.
3858 PR c++/90732 - ICE with VLA capture and generic lambda.
3859 * pt.c (tsubst_lambda_expr): Repeat add_capture for VLAs.
3861 2020-01-21 Iain Sandoe <iain@sandoe.co.uk>
3862 Bin Cheng <bin.cheng@linux.alibaba.com>
3864 * coroutines.cc (coro_promise_type_found_p): Check for NULL return
3865 from complete_type_or_else.
3866 (register_param_uses): Likewise.
3867 (build_co_await): Do not try to use complete_type_or_else for void
3868 types, otherwise for incomplete types, check for NULL return from
3869 complete_type_or_else.
3871 2020-01-21 Jason Merrill <jason@redhat.com>
3873 PR c++/91476 - anon-namespace reference temp clash between TUs.
3874 * decl2.c (copy_linkage): Factor out of get_guard.
3875 * call.c (make_temporary_var_for_ref_to_temp): Use it.
3876 * decl.c (cp_finish_decomp): Use it.
3877 (cp_finish_decl): determine_visibility sooner.
3879 2020-01-21 Bin Cheng <bin.cheng@linux.alibaba.com>
3881 * coroutines.cc (finish_co_await_expr): Set return value flag.
3882 (finish_co_yield_expr, morph_fn_to_coro): Ditto.
3884 2020-01-19 Jason Merrill <jason@redhat.com>
3886 PR c++/33799 - destroy return value, take 2.
3887 * cp-tree.h (current_retval_sentinel): New macro.
3888 (struct language_function): Add throwing_cleanup bitfield.
3889 * decl.c (cxx_maybe_build_cleanup): Set it.
3890 * except.c (maybe_set_retval_sentinel)
3891 (maybe_splice_retval_cleanup): New functions.
3892 * parser.c (cp_parser_compound_statement): Call
3893 maybe_splice_retval_cleanup.
3894 * typeck.c (check_return_expr): Call maybe_set_retval_sentinel.
3896 * parser.c (cp_parser_lambda_body): Use cp_parser_function_body.
3898 2020-01-18 Jakub Jelinek <jakub@redhat.com>
3900 * coroutines.cc (get_fn_local_identifier): Fix NO_DOT_IN_LABEL
3901 but non-NO_DOLLAR_IN_LABEL case build.
3903 2020-01-18 Iain Sandoe <iain@sandoe.co.uk>
3905 * Make-lang.in: Add coroutines.o.
3906 * cp-tree.h (lang_decl-fn): coroutine_p, new bit.
3907 (DECL_COROUTINE_P): New.
3908 * lex.c (init_reswords): Enable keywords when the coroutine flag
3910 * operators.def (co_await): New operator.
3911 * call.c (add_builtin_candidates): Handle CO_AWAIT_EXPR.
3912 (op_error): Likewise.
3913 (build_new_op_1): Likewise.
3914 (build_new_function_call): Validate coroutine builtin arguments.
3915 * constexpr.c (potential_constant_expression_1): Handle
3916 CO_AWAIT_EXPR, CO_YIELD_EXPR, CO_RETURN_EXPR.
3917 * coroutines.cc: New file.
3918 * cp-objcp-common.c (cp_common_init_ts): Add CO_AWAIT_EXPR,
3919 CO_YIELD_EXPR, CO_RETRN_EXPR as TS expressions.
3920 * cp-tree.def (CO_AWAIT_EXPR, CO_YIELD_EXPR, (CO_RETURN_EXPR): New.
3921 * cp-tree.h (coro_validate_builtin_call): New.
3922 * decl.c (emit_coro_helper): New.
3923 (finish_function): Handle the case when a function is found to
3924 be a coroutine, perform the outlining and emit the outlined
3925 functions. Set a bit to signal that this is a coroutine component.
3926 * parser.c (enum required_token): New enumeration RT_CO_YIELD.
3927 (cp_parser_unary_expression): Handle co_await.
3928 (cp_parser_assignment_expression): Handle co_yield.
3929 (cp_parser_statement): Handle RID_CO_RETURN.
3930 (cp_parser_jump_statement): Handle co_return.
3931 (cp_parser_operator): Handle co_await operator.
3932 (cp_parser_yield_expression): New.
3933 (cp_parser_required_error): Handle RT_CO_YIELD.
3934 * pt.c (tsubst_copy): Handle CO_AWAIT_EXPR.
3935 (tsubst_expr): Handle CO_AWAIT_EXPR, CO_YIELD_EXPR and
3937 * tree.c (cp_walk_subtrees): Likewise.
3939 2020-01-17 Jason Merrill <jason@redhat.com>
3941 PR c++/92531 - ICE with noexcept(lambda).
3942 * pt.c (uses_template_parms): Don't try to enumerate all the
3945 2020-01-17 Jakub Jelinek <jakub@redhat.com>
3948 * parser.c (cp_parser_template_name): Look up deprecated attribute
3949 in DECL_TEMPLATE_RESULT or its type's attributes.
3951 2020-01-16 Jason Merrill <jason@redhat.com>
3953 PR c++/93286 - ICE with __is_constructible and variadic template.
3954 * pt.c (tsubst) [TREE_LIST]: Handle pack expansion.
3955 (tsubst_copy_and_build) [TRAIT_EXPR]: Always use tsubst for type2.
3957 PR c++/93280 - ICE with aggregate assignment and DMI.
3958 * init.c (get_nsdmi): Set TARGET_EXPR_DIRECT_INIT_P here.
3959 * typeck2.c (digest_nsdmi_init): Not here.
3961 2020-01-15 Paolo Carlini <paolo.carlini@oracle.com>
3964 * cp-tree.h (is_constrained_auto): New.
3965 * parser.c (cp_parser_maybe_commit_to_declaration): Correctly
3966 handle concept-check expressions; take a cp_decl_specifier_seq*
3968 (cp_parser_condition): Update call.
3969 (cp_parser_simple_declaration): Likewise.
3970 (cp_parser_placeholder_type_specifier): Correctly handle
3971 concept-check expressions.
3973 2020-01-15 Jason Merrill <jason@redhat.com>
3976 PR c++/33799 - destroy return value if local cleanup throws.
3977 * cp-tree.h (current_retval_sentinel): New macro.
3978 * decl.c (start_preparsed_function): Set up cleanup for retval.
3979 * typeck.c (check_return_expr): Set current_retval_sentinel.
3981 PR c++/93257 - consteval void function.
3982 * constexpr.c (verify_constant): Allow void_node.
3984 PR c++/92871 - bad code with xvalue and GNU ?: extension.
3985 * call.c (prevent_lifetime_extension): New.
3986 (build_conditional_expr_1): Use it.
3988 2020-01-14 Nathan Sidwell <nathan@acm.org>
3991 * pt.c (retrieve_specialization): Use get_template_info, not open
3995 * pt.c (retrieve_specialization): Get the TI from the decl or the
3996 classtype as appropriate.
3998 2020-01-14 David Malcolm <dmalcolm@redhat.com>
4000 * cp-gimplify.c (source_location_table_entry_hash::empty_zero_p):
4001 New static constant.
4002 * cp-tree.h (named_decl_hash::empty_zero_p): Likewise.
4003 (struct named_label_hash::empty_zero_p): Likewise.
4004 * decl2.c (mangled_decl_hash::empty_zero_p): Likewise.
4006 2020-01-14 Jason Merrill <jason@redhat.com>
4008 PR c++/92590 - wrong handling of inherited default ctor.
4009 * class.c (add_method): A constrained inherited ctor doesn't hide an
4010 implicit derived ctor.
4012 PR c++/92552 - ICE with inherited constrained default ctor.
4013 * pt.c (instantiate_class_template_1): Copy
4014 TYPE_HAS_USER_CONSTRUCTOR.
4015 PR c++/91930 - ICE with constrained inherited default ctor.
4016 * name-lookup.c (do_class_using_decl): Set TYPE_HAS_USER_CONSTRUCTOR
4017 for inherited constructor.
4018 PR c++/92594 - ICE with inherited trivial default ctor.
4019 * method.c (trivial_fn_p): Treat an inherited default constructor
4020 like a normal default constructor.
4022 PR c++/92594 - ICE with inherited trivial default ctor.
4023 * method.c (trivial_fn_p): Treat an inherited default constructor
4024 like a normal default constructor.
4026 PR c++/92009 - ICE with punning of typeid.
4027 * rtti.c (get_tinfo_desc): Call xref_basetypes.
4028 * constexpr.c (cxx_fold_indirect_ref): Don't strip
4031 2020-01-13 Jason Merrill <jason@redhat.com>
4033 PR c++/92746 - ICE with noexcept of function concept check.
4034 * except.c (check_noexcept_r): Handle concept-check.
4036 PR c++/92582 - ICE with member template as requirement.
4037 * pt.c (struct find_template_parameter_info): Add ctx_parms.
4038 (any_template_parm_r): Handle TEMPLATE_DECL.
4039 (find_template_parameters): Take parms instead of their depth.
4040 * constraint.cc (build_parameter_mapping): Pass them.
4042 PR c++/33799 - destroy return value if local cleanup throws.
4043 * cp-tree.h (current_retval_sentinel): New macro.
4044 * decl.c (start_preparsed_function): Set up cleanup for retval.
4045 * typeck.c (check_return_expr): Set current_retval_sentinel.
4047 PR c++/93238 - short right-shift with enum.
4048 * typeck.c (cp_build_binary_op): Use folded op1 for short_shift.
4050 2020-01-10 Jason Merrill <jason@redhat.com>
4052 * typeck.c (cp_build_binary_op): Restore short_shift code.
4054 PR c++/93143 - incorrect tree sharing with constexpr.
4055 * constexpr.c (cxx_eval_outermost_constant_expr): Don't assume
4056 CONSTRUCTORs are already unshared.
4058 PR c++/93173 - incorrect tree sharing.
4060 * cp-gimplify.c (cp_gimplify_init_expr, cp_gimplify_expr): Use
4061 copy_if_shared after cp_genericize_tree.
4062 * typeck2.c (split_nonconstant_init): Don't unshare here.
4064 2020-01-08 Jason Merrill <jason@redhat.com>
4066 * cp-gimplify.c (cp_gimplify_expr) [TARGET_EXPR]: Check
4067 TARGET_EXPR_DIRECT_INIT_P.
4068 * constexpr.c (cxx_eval_constant_expression): Likewise.
4070 2020-01-08 Jason Merrill <jason@redhat.com>
4072 PR c++/91369 - constexpr destructor and member initializer.
4073 * constexpr.c (cxx_eval_store_expression): Look through TARGET_EXPR
4074 when not preevaluating.
4076 2020-01-08 Jason Merrill <jason@redhat.com>
4078 * constexpr.c (cxx_eval_call_expression): Remove DECL_BY_REFERENCE
4081 2020-01-07 Paolo Carlini <paolo.carlini@oracle.com>
4083 * init.c (build_new): Add location_t parameter and use it throughout.
4084 (build_raw_new_expr): Likewise.
4085 * parser.c (cp_parser_new_expression): Pass the combined_loc.
4086 * pt.c (tsubst_copy_and_build): Adjust call.
4087 * cp-tree.h: Update declarations.
4089 2020-01-07 Jason Merrill <jason@redhat.com>
4091 PR c++/47877 - -fvisibility-inlines-hidden and member templates.
4092 * decl2.c (determine_visibility): -fvisibility-inlines-hidden beats
4093 explicit class visibility for a template.
4095 2020-01-07 Richard Sandiford <richard.sandiford@arm.com>
4097 * mangle.c (mangle_type_attribute_p): New function, split out from...
4098 (write_CV_qualifiers_for_type): ...here. Don't mangle attributes
4099 that contain a space.
4101 2020-01-07 Jakub Jelinek <jakub@redhat.com>
4104 * constexpr.c (struct constexpr_global_ctx): Add heap_alloc_count
4105 member, initialize it to zero in ctor.
4106 (cxx_eval_call_expression): Bump heap_dealloc_count when deleting
4107 a heap object. Don't cache calls to functions which allocate some
4108 heap objects and don't deallocate them or deallocate some heap
4109 objects they didn't allocate.
4111 2020-01-06 Jason Merrill <jason@redhat.com>
4113 PR c++/92552 - ICE with inherited constrained default ctor.
4114 * pt.c (instantiate_class_template_1): Copy
4115 TYPE_HAS_USER_CONSTRUCTOR.
4116 * class.c (one_inherited_ctor): Don't set it here.
4118 2020-01-06 Andrew Sutton <asutton@lock3software.com>
4120 PR c++/92739 - parsing requires clause with attributes.
4121 * parser.c (cp_parser_constraint_requires_parens): Exclude
4122 attributes as postfix expressions.
4124 2020-01-05 Jakub Jelinek <jakub@redhat.com>
4127 * parser.c (cp_parser_check_class_key): Disable access checks for the
4129 (cp_parser_maybe_warn_enum_key): Likewise. Return early if
4130 !warn_redundant_tags.
4132 2010-01-05 Jakub Jelinek <jakub@redhat.com>
4135 * cp-gimplify.c (cp_gimplify_init_expr): Don't look through
4136 TARGET_EXPR if it has been gimplified already.
4138 2020-01-03 Jason Merrill <jason@redhat.com>
4140 PR c++/93033 - incorrect tree node sharing with array init.
4141 * typeck2.c (split_nonconstant_init): Unshare non-decl.
4142 * cp-gimplify.c (cp_gimplify_init_expr): Only split if -fexceptions.
4144 2020-01-02 Jason Merrill <jason@redhat.com>
4146 * pt.c (invalid_nontype_parm_type_p): Reject class placeholder in
4149 2020-01-02 Jakub Jelinek <jakub@redhat.com>
4152 * cp-objcp-common.c (identifier_global_tag): Return NULL_TREE if name
4153 has not been found, rather than error_mark_node.
4155 2020-01-01 Jakub Jelinek <jakub@redhat.com>
4157 Update copyright years.
4159 Copyright (C) 2020 Free Software Foundation, Inc.
4161 Copying and distribution of this file, with or without modification,
4162 are permitted in any medium without royalty provided the copyright
4163 notice and this notice are preserved.