1 2020-02-28 Jakub Jelinek <jakub@redhat.com>
3 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
4 * typeck.c (cp_build_addr_expr_1): Allow taking address of immediate
5 functions in unevaluated contexts.
7 2020-02-27 Nathan Sidwell <nathan@acm.org>
10 * pt.c (template_args_equal): Pass ARGUMENT_PACKS through to
12 * tree.c (cp_tree_equal): Compare ARGUMENT_PACKS here,
13 * typeck.c (comptypes): Assert we don't get any argument packs.
15 * class.c (adjust_clone_args): Correct arg-checking assert.
16 * typeck.c (comptypes): Assert not nulls.
18 2020-02-26 Marek Polacek <polacek@redhat.com>
20 PR c++/93789 - ICE with invalid array bounds.
21 * decl.c (compute_array_index_type_loc): Don't use the folded
22 size when folding cleared TREE_CONSTANT.
24 2020-02-26 Iain Sandoe <iain@sandoe.co.uk>
26 * class.c (classtype_has_non_deleted_copy_ctor): New.
27 * coroutines.cc (struct param_info): Keep track of params
28 that are references, and cache the original type and whether
30 (build_actor_fn): Handle param copies always, and adjust the
31 handling for references.
32 (register_param_uses): Only handle uses here.
33 (classtype_has_non_deleted_copy_ctor): New.
34 (morph_fn_to_coro): Adjust param copy handling to match n4849
35 by reordering ahead of the promise CTOR and always making a
36 frame copy, even if the param is unused in the coroutine body.
37 * cp-tree.h (classtype_has_non_deleted_copy_ctor): New.
39 2020-02-26 Patrick Palka <ppalka@redhat.com>
41 * constraint.cc (finish_constraint_binary_op): Set expr's location range
42 to the range of its operands.
43 (satisfy_atom): Pass MAP instead of ARGS to diagnose_atomic_constraint.
44 (diagnose_trait_expr): Take the instantiated parameter mapping MAP
45 instead of the corresponding template arguments ARGS and adjust body
47 (diagnose_requires_expr): Likewise.
48 (diagnose_atomic_constraint): Likewise. When printing an atomic
49 constraint expression, print the instantiated parameter mapping
51 * cxx-pretty-print.cc (cxx_pretty_printer::expression)
52 [NONTYPE_ARGUMENT_PACK]: Print braces around a NONTYPE_ARGUMENT_PACK.
53 (cxx_pretty_printer::type_id): Handle TYPE_ARGUMENT_PACK.
55 2020-02-26 Marek Polacek <polacek@redhat.com>
57 PR c++/93676 - value-init crash in template.
58 * init.c (build_new_1): Don't call build_vec_init in a template.
60 2020-02-26 Marek Polacek <polacek@redhat.com>
62 PR c++/93862 - ICE with static_cast when converting from int[].
63 * call.c (reference_compatible_p): No longer static.
64 * cp-tree.h (reference_compatible_p): Declare.
65 * typeck.c (build_static_cast_1): Use reference_compatible_p instead
66 of reference_related_p.
68 2020-02-26 Marek Polacek <polacek@redhat.com>
70 PR c++/93803 - ICE with constexpr init and [[no_unique_address]].
71 * constexpr.c (reduced_constant_expression_p): Don't crash on a null
74 2020-02-24 Martin Sebor <msebor@redhat.com>
77 * parser.c (cp_parser_check_class_key): Avoid issuing -Wredundant-tags
78 in shared C/C++ code in headers.
79 Remove a duplicate hunk of code.
81 2020-02-24 Marek Polacek <polacek@redhat.com>
83 PR c++/93869 - ICE with -Wmismatched-tags.
84 * parser.c (cp_parser_check_class_key): Check class_key earlier.
86 2020-02-24 Marek Polacek <polacek@redhat.com>
88 PR c++/93712 - ICE with ill-formed array list-initialization.
89 * call.c (next_conversion): Return NULL for ck_aggr.
90 (build_aggr_conv): Set u.expr instead of u.next.
91 (build_array_conv): Likewise.
92 (build_complex_conv): Likewise.
93 (conv_get_original_expr): Handle ck_aggr.
95 2020-02-24 Jakub Jelinek <jakub@redhat.com>
97 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
98 * call.c (build_over_call): Don't evaluate immediate functions in
101 2020-02-24 Jason Merrill <jason@redhat.com>
103 P0780R2: Resolve lambda init-capture pack grammar.
104 * parser.c (cp_parser_lambda_introducer): Expect &...x=y rather than
107 2020-02-22 Marek Polacek <polacek@redhat.com>
110 * decl.c (grokdeclarator): Use %qs in a diagnostic message.
112 2020-02-21 Martin Sebor <msebor@redhat.com>
114 PR gcov-profile/93753
115 * class.c (check_flexarrays): Tighten up a test for potential members
116 of anonymous structs or unions.
118 2020-02-20 Martin Sebor <msebor@redhat.com>
121 * parser.c (cp_parser_check_class_key): Only handle true C++ class-keys.
123 2020-02-20 Martin Liska <mliska@suse.cz>
126 * config/or1k/or1k.opt: Remove superfluous word.
127 * doc/invoke.texi: Likewise.
129 2020-02-20 Martin Liska <mliska@suse.cz>
132 * parser.c (cp_parser_decl_specifier_seq): Remove trailing space.
134 2020-02-19 Marek Polacek <polacek@redhat.com>
136 PR c++/93169 - wrong-code with a non-constexpr constructor.
137 * constexpr.c (cxx_eval_call_expression): Only set TREE_READONLY
138 on constant CONSTRUCTORs.
140 2020-02-15 Marek Polacek <polacek@redhat.com>
142 PR c++/93710 - poor diagnostic for array initializer.
143 * call.c (build_user_type_conversion_1): Use cp_expr_loc_or_input_loc
146 2020-02-15 Jason Merrill <jason@redhat.com>
149 * pt.c (any_template_parm_r): Look into lambda body.
152 * pt.c (any_template_parm_r): Remove CONSTRUCTOR handling.
154 2020-02-14 Jakub Jelinek <jakub@redhat.com>
157 * class.c (enum_min_precision): Change prec type from int to int &.
160 * cp-tree.h (enum cp_tree_index): Add CPTI_FALLBACK_DFLOAT32_TYPE,
161 CPTI_FALLBACK_DFLOAT64_TYPE and CPTI_FALLBACK_DFLOAT128_TYPE.
162 (fallback_dfloat32_type, fallback_dfloat64_type,
163 fallback_dfloat128_type): Define.
164 * mangle.c (write_builtin_type): Handle fallback_dfloat*_type like
166 * rtti.c (emit_support_tinfos): Emit DFP typeinfos even when dfp
167 is disabled for compatibility.
169 2020-02-13 Jason Merrill <jason@redhat.com>
172 * name-lookup.c (matching_fn_p): A function does not match a
177 * tree.c (decl_linkage): Always lk_none for locals.
179 2020-02-12 Jason Merrill <jason@redhat.com>
183 * tree.c (cp_walk_subtrees): Walk CONSTRUCTOR types here.
184 * pt.c (find_parameter_packs_r): Not here.
186 2020-02-12 Iain Sandoe <iain@sandoe.co.uk>
188 * coroutines.cc (build_actor_fn): Implement deallocation function
189 selection per n4849, dcl.fct.def.coroutine bullet 12.
190 (morph_fn_to_coro): Implement allocation function selection per
191 n4849, dcl.fct.def.coroutine bullets 9 and 10.
193 2020-02-12 Marek Polacek <polacek@redhat.com>
195 PR c++/93684 - ICE-on-invalid with broken attribute.
196 * parser.c (cp_parser_std_attribute): Peek a token first before
199 2020-02-11 Jason Merrill <jason@redhat.com>
202 * class.c (add_implicitly_declared_members): Use do_friend.
203 * method.c (implicitly_declare_fn): Fix friend handling.
204 (decl_remember_implicit_trigger_p): New.
205 (synthesize_method): Use it.
206 * decl2.c (mark_used): Use it.
208 2020-02-11 Jason Merrill <jason@redhat.com>
212 * constexpr.c (maybe_constant_value): Correct earlier change.
213 (cxx_eval_binary_expression) [SPACESHIP_EXPR]: Pass lval through.
214 * method.c (genericize_spaceship): Wrap result in TARGET_EXPR.
216 2020-02-12 Patrick Palka <ppalka@redhat.com>
220 * type-utils.h (find_type_usage): Refactor to take a tree * and to
221 return a tree *, and update documentation accordingly.
222 * pt.c (make_auto_1): Set AUTO_IS_DECLTYPE when building a
224 (make_constrained_decltype_auto): No need to explicitly set
225 AUTO_IS_DECLTYPE anymore.
226 (splice_late_return_type): Use find_type_usage to find and
227 replace a possibly nested auto node instead of using is_auto.
228 Check test for is_auto into an assert when deciding whether
230 (type_uses_auto): Adjust the call to find_type_usage.
231 * parser.c (cp_parser_decltype): No need to explicitly set
232 AUTO_IS_DECLTYPE anymore.
234 * error.c (dump_decl) [CONCEPT_DECL]: Use dump_simple_decl.
235 (dump_simple_decl): Handle standard concept definitions as well as
236 variable concept definitions.
238 2020-02-10 Jakub Jelinek <jakub@redhat.com>
241 * error.c (dump_decl_name): Fix up last argument to strncmp.
243 2020-02-10 Jason Merrill <jason@redhat.com>
246 * tree.c (array_of_unknown_bound_p): New.
247 * init.c (perform_member_init): Do nothing for flexible arrays.
249 2020-02-09 Jakub Jelinek <jakub@redhat.com>
252 * constexpr.c (cxx_eval_constant_expression): If obj is heap var with
253 ARRAY_TYPE, use the element type. Punt if objtype after that is not
256 2020-02-08 Jason Merrill <jason@redhat.com>
259 * expr.c (fold_for_warn): Call maybe_constant_value.
260 * constexpr.c (struct constexpr_ctx): Add uid_sensitive bit-field.
261 (maybe_constant_value): Add uid_sensitive parm.
262 (get_fundef_copy): Don't copy if it's true.
263 (cxx_eval_call_expression): Don't instantiate if it's true.
264 (cxx_eval_outermost_constant_expr): Likewise.
267 * constexpr.c (maybe_constant_value): Don't unshare if the cached
268 value is the same as the argument.
270 * typeck.c (maybe_warn_about_returning_address_of_local): Add
273 * typeck2.c (process_init_constructor): Also clear TREE_SIDE_EFFECTS
276 2020-02-08 Jakub Jelinek <jakub@redhat.com>
279 * constexpr.c (find_array_ctor_elt): If last element has no index,
280 for flag_checking verify all elts have no index. If i is within the
281 elts, return it directly, if it is right after the last elt, append
282 if NULL index, otherwise force indexes on all elts.
283 (cxx_eval_store_expression): Allow cep->index to be NULL.
285 2020-02-07 Marek Polacek <polacek@redhat.com>
287 PR c++/92947 - Paren init of aggregates in unevaluated context.
288 * call.c (build_new_method_call_1): Don't check
289 cp_unevaluated_operand. Check the return value of digest_init.
291 2020-02-06 Jason Merrill <jason@redhat.com>
294 * tree.c (cp_walk_subtrees): Walk into type template arguments.
295 * cp-tree.h (TYPE_TEMPLATE_INFO_MAYBE_ALIAS): Use typedef_variant_p
296 instead of TYPE_ALIAS_P.
297 * pt.c (push_template_decl_real): Likewise.
298 (find_parameter_packs_r): Likewise. Remove dead code.
299 * error.c (find_typenames_r): Remove dead code.
301 2020-02-06 Jason Merrill <jason@redhat.com>
304 * parser.c (cp_parser_constraint_primary_expression): Do the main
305 parse non-tentatively.
307 2020-02-06 Marek Polacek <polacek@redhat.com>
309 PR c++/93597 - ICE with lambda in operator function.
310 * name-lookup.c (maybe_save_operator_binding): Check is_overloaded_fn.
312 2020-02-05 Jason Merrill <jason@redhat.com>
315 * pt.c (tsubst_decl) [PARM_DECL]: Check cp_unevaluated_operand in
316 handling of TREE_CHAIN for empty pack.
318 2020-02-05 Jakub Jelinek <jakub@redhat.com>
321 * semantics.c (cp_build_vec_convert): Call decay_conversion on arg
322 prior to passing it to c_build_vec_convert.
324 2020-02-05 Marek Polacek <polacek@redhat.com>
326 PR c++/93559 - ICE with CONSTRUCTOR flags verification.
327 * decl.c (reshape_init_array_1): Don't reuse a CONSTRUCTOR with
330 2020-02-05 Jason Merrill <jason@redhat.com>
333 * decl.c (grokdeclarator): Reject field of current class type even
336 2020-02-05 Bin Cheng <bin.cheng@linux.alibaba.com>
338 * coroutines.cc (maybe_promote_captured_temps): Increase the index
339 number for temporary variables' name.
341 2020-02-05 Jun Ma <JunMa@linux.alibaba.com>
343 * coroutines.cc (build_co_await): Call convert_from_reference
344 to wrap co_await_expr with indirect_ref which avoid
345 reference/non-reference type confusion.
347 (co_await_expander): Sink to call_expr if await_resume
348 is wrapped by indirect_ref.
350 2020-02-04 Jason Merrill <jason@redhat.com>
353 * constraint.cc (satisfy_declaration_constraints): Check return
354 value of push_tinst_level.
357 * constexpr.c (cxx_eval_array_reference): {}-initialize missing
358 elements instead of value-initializing them.
361 * init.c (perform_member_init): Simplify.
362 * constexpr.c (cx_check_missing_mem_inits): Allow uninitialized
364 (cxx_eval_vec_init_1): Handle CONSTRUCTOR.
366 2020-02-04 Iain Sandoe <iain@sandoe.co.uk>
368 * coroutines.cc (find_promise_type): Delete unused forward
370 (struct coroutine_info): Add a bool for no promise type error.
371 (coro_promise_type_found_p): Only emit the error for a missing
372 promise once in each affected coroutine.
374 2020-02-03 Jason Merrill <jason@redhat.com>
377 * constexpr.c (cxx_eval_constant_expression) [PARM_DECL]: Don't
378 defer loading the value of a reference.
380 2020-02-03 Jason Merrill <jason@redhat.com>
383 * constexpr.c (potential_constant_expression_1) [PARM_DECL]: Allow
385 [COMPONENT_REF]: A member function reference doesn't use the object
388 2020-02-03 Iain Sandoe <iain@sandoe.co.uk>
391 * coroutines.cc (struct coroutine_info): Add a bool flag to note
392 that we emitted an error for a bad function return type.
393 (get_coroutine_info): Tolerate an unset info table in case of
395 (find_coro_traits_template_decl): In case of error or if we didn't
396 find a type template, note we emitted the error and suppress
398 (find_coro_handle_template_decl): Likewise.
399 (instantiate_coro_traits): Only check for error_mark_node in the
400 return from lookup_qualified_name.
401 (coro_promise_type_found_p): Reorder initialization so that we check
402 for the traits and their usability before allocation of the info
403 table. Check for a suitable return type and emit a diagnostic for
404 here instead of relying on the lookup machinery. This allows the
405 error to have a better location, and means we can suppress multiple
407 (coro_function_valid_p): Re-check for a valid promise (and thus the
408 traits) before proceeding. Tolerate missing info as a fatal error.
410 2020-02-03 Jason Merrill <jason@redhat.com>
413 * cp-gimplify.c (predeclare_vla): New.
414 (cp_genericize_r) [NOP_EXPR]: Call it.
416 2020-02-03 Jun Ma <JunMa@linux.alibaba.com>
418 * coroutines.cc (transform_await_wrapper): Set actor funcion as
419 new context of label_decl.
420 (build_actor_fn): Fill new field of await_xform_data.
422 2020-02-02 Marek Polacek <polacek@redhat.com>
424 PR c++/93530 - ICE on invalid alignas in a template.
425 * decl.c (grokdeclarator): Call cplus_decl_attributes instead of
428 2020-01-31 Jason Merrill <jason@redhat.com>
431 * semantics.c (process_outer_var_ref): Capture VLAs even in
435 * decl.c (reshape_init_array_1): Reuse a single CONSTRUCTOR with
436 non-aggregate elements.
437 (reshape_init_array): Add first_initializer_p parm.
438 (reshape_init_r): Change first_initializer_p from bool to tree.
439 (reshape_init): Pass init to it.
442 * parser.c (cp_parser_initializer_list): Suppress location wrappers
445 2020-01-29 Jason Merrill <jason@redhat.com>
448 * pt.c (tsubst_copy_and_build) [EQ_EXPR]: Only suppress warnings if
449 the expression was dependent before substitution.
451 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
453 * coroutines.cc (act_des_fn): New.
454 (morph_fn_to_coro): Call act_des_fn to build actor/destroy decls.
455 Access promise via actor function's frame pointer argument.
456 (build_actor_fn, build_destroy_fn): Use frame pointer argument.
458 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
460 * coroutines.cc (co_await_expander): Handle type conversion case.
462 2020-01-29 Jason Merrill <jason@redhat.com>
467 * parser.c (cp_parser_type_specifier_seq): Don't parse attributes in
468 a trailing return type.
469 (cp_parser_lambda_declarator_opt): Parse C++11 attributes before
472 2020-01-29 Marek Polacek <polacek@redhat.com>
474 PR c++/91754 - Fix template arguments comparison with class NTTP.
475 * pt.c (class_nttp_const_wrapper_p): New.
476 (template_args_equal): See through class_nttp_const_wrapper_p
479 2020-01-29 Marek Polacek <polacek@redhat.com>
481 PR c++/92948 - Fix class NTTP with template arguments.
482 * pt.c (convert_nontype_argument): Use IMPLICIT_CONV_EXPR when
483 converting a value-dependent expression to a class type.
484 (tsubst_copy) <case VIEW_CONVERT_EXPR>: Allow IMPLICIT_CONV_EXPR
485 as the result of the tsubst_copy call.
487 2020-01-29 Jakub Jelinek <jakub@redhat.com>
490 * cp-gimplify.c (cxx_omp_predetermined_sharing): Return
491 OMP_CLAUSE_DEFAULT_SHARED for typeinfo decls.
493 2020-01-28 Jason Merrill <jason@redhat.com>
496 * parser.c (cp_parser_lambda_expression): Clear in_discarded_stmt.
500 * decl2.c (copy_linkage): Do copy DECL_ONE_ONLY and DECL_WEAK.
503 * call.c (build_user_type_conversion_1): Allow a template conversion
504 returning an rvalue reference to bind directly to an lvalue.
507 * decl.c (grokdeclarator): Propagate eh spec from typedef.
509 2020-01-28 Martin Liska <mliska@suse.cz>
512 * pt.c (redeclare_class_template): Group couple of
513 errors and inform messages with auto_diagnostic_group.
515 2020-01-28 Martin Liska <mliska@suse.cz>
518 * pt.c (redeclare_class_template): Use inform
519 for the second location.
521 2020-01-27 Jason Merrill <jason@redhat.com>
524 * pt.c (tsubst_copy) [STRING_CST]: Don't use fold_convert.
526 2020-01-27 Iain Sandoe <iain@sandoe.co.uk>
529 * coroutines.cc (morph_fn_to_coro): Check the ramp return
530 value when it is constructed from the 'get return object'.
532 2020-01-27 Nathan Sidwell <nathan@acm.org>
535 * name-lookup.c (is_ancestor): Allow CHILD to be a namespace alias.
537 2020-01-26 Jason Merrill <jason@redhat.com>
540 * except.c (maybe_noexcept_warning): Check DECL_IN_SYSTEM_HEADER and
541 temporarily enable -Wsystem-headers. Change second warning to
545 * semantics.c (finish_call_expr): Don't call
546 instantiate_non_dependent_expr before warn_for_memset.
548 2020-01-25 Marek Polacek <polacek@redhat.com>
550 PR c++/93414 - poor diagnostic for dynamic_cast in constexpr context.
551 * constexpr.c (cxx_eval_dynamic_cast_fn): Add a reference
552 dynamic_cast diagnostic.
554 2020-01-24 Jason Merrill <jason@redhat.com>
556 PR c++/93400 - ICE with constrained friend.
557 * constraint.cc (maybe_substitute_reqs_for): New.
558 * decl.c (function_requirements_equivalent_p): Call it.
559 * pt.c (tsubst_friend_function): Only substitute
560 TEMPLATE_PARMS_CONSTRAINTS.
561 (tsubst_template_parms): Copy constraints.
563 2020-01-24 Jason Merrill <jason@redhat.com>
565 PR c++/93279 - ICE with lambda in member operator.
566 * name-lookup.c (maybe_save_operator_binding): Don't remember
567 class-scope bindings.
569 2020-01-24 Jason Merrill <jason@redhat.com>
571 PR c++/93377 - ICE with member alias in constraint.
572 * pt.c (any_template_parm_r): Look at template arguments for all
573 aliases, not only alias templates.
575 2020-01-24 Marek Polacek <polacek@redhat.com>
577 PR c++/93299 - ICE in tsubst_copy with parenthesized expression.
578 * pt.c (tsubst_copy): Handle a REF_PARENTHESIZED_P VIEW_CONVERT_EXPR.
580 2020-01-24 Jason Merrill <jason@redhat.com>
582 PR c++/92852 - ICE with generic lambda and reference var.
583 * constexpr.c (maybe_constant_value): Likewise.
585 2020-01-23 Paolo Carlini <paolo.carlini@oracle.com>
588 * parser.c (cp_parser_nested_name_specifier_opt): Properly
589 diagnose concept-ids.
591 2020-01-23 Jason Merrill <jason@redhat.com>
593 PR c++/93331 - ICE with __builtin_strchr.
594 * constexpr.c (cxx_eval_builtin_function_call): Use the original
595 argument if we didn't manage to extract a STRING_CST.
597 PR c++/93345 - ICE with defaulted dtor and template.
599 * decl.c (cxx_maybe_build_cleanup): Don't try to set
600 throwing_cleanup in a template.
602 2020-01-22 Marek Polacek <polacek@redhat.com>
604 PR c++/92907 - noexcept does not consider "const" in member functions.
605 * g++.dg/cpp0x/noexcept56.C: New test.
607 2020-01-22 Marek Polacek <polacek@redhat.com>
609 PR c++/93324 - ICE with -Wall on constexpr if.
610 * semantics.c (is_std_constant_evaluated_p): Check fndecl.
612 2020-01-22 Patrick Palka <ppalka@redhat.com>
614 * constraint.cc (get_mapped_args): Avoid using auto_vec
615 as a vector element. Release the vectors inside the lists
617 * parser.c (cp_literal_operator_id): Free the buffer.
619 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
621 * coroutines.cc (finish_co_await_expr): Add error check on return
622 value of build_co_await.
623 (finish_co_yield_expr,): Ditto.
625 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
627 * coroutines.cc (lookup_awaitable_member): Lookup an awaitable member.
628 (lookup_promise_method): Emit diagnostic when get NULL_TREE back only.
629 (build_co_await): Use lookup_awaitable_member instead of lookup_member.
631 2020-01-21 Jason Merrill <jason@redhat.com>
633 PR c++/60855 - ICE with sizeof VLA capture.
634 * lambda.c (is_lambda_ignored_entity): Don't look past VLA capture.
636 PR c++/90732 - ICE with VLA capture and generic lambda.
637 * pt.c (tsubst_lambda_expr): Repeat add_capture for VLAs.
639 2020-01-21 Iain Sandoe <iain@sandoe.co.uk>
640 Bin Cheng <bin.cheng@linux.alibaba.com>
642 * coroutines.cc (coro_promise_type_found_p): Check for NULL return
643 from complete_type_or_else.
644 (register_param_uses): Likewise.
645 (build_co_await): Do not try to use complete_type_or_else for void
646 types, otherwise for incomplete types, check for NULL return from
647 complete_type_or_else.
649 2020-01-21 Jason Merrill <jason@redhat.com>
651 PR c++/91476 - anon-namespace reference temp clash between TUs.
652 * decl2.c (copy_linkage): Factor out of get_guard.
653 * call.c (make_temporary_var_for_ref_to_temp): Use it.
654 * decl.c (cp_finish_decomp): Use it.
655 (cp_finish_decl): determine_visibility sooner.
657 2020-01-21 Bin Cheng <bin.cheng@linux.alibaba.com>
659 * coroutines.cc (finish_co_await_expr): Set return value flag.
660 (finish_co_yield_expr, morph_fn_to_coro): Ditto.
662 2020-01-19 Jason Merrill <jason@redhat.com>
664 PR c++/33799 - destroy return value, take 2.
665 * cp-tree.h (current_retval_sentinel): New macro.
666 (struct language_function): Add throwing_cleanup bitfield.
667 * decl.c (cxx_maybe_build_cleanup): Set it.
668 * except.c (maybe_set_retval_sentinel)
669 (maybe_splice_retval_cleanup): New functions.
670 * parser.c (cp_parser_compound_statement): Call
671 maybe_splice_retval_cleanup.
672 * typeck.c (check_return_expr): Call maybe_set_retval_sentinel.
674 * parser.c (cp_parser_lambda_body): Use cp_parser_function_body.
676 2020-01-18 Jakub Jelinek <jakub@redhat.com>
678 * coroutines.cc (get_fn_local_identifier): Fix NO_DOT_IN_LABEL
679 but non-NO_DOLLAR_IN_LABEL case build.
681 2020-01-18 Iain Sandoe <iain@sandoe.co.uk>
683 * Make-lang.in: Add coroutines.o.
684 * cp-tree.h (lang_decl-fn): coroutine_p, new bit.
685 (DECL_COROUTINE_P): New.
686 * lex.c (init_reswords): Enable keywords when the coroutine flag
688 * operators.def (co_await): New operator.
689 * call.c (add_builtin_candidates): Handle CO_AWAIT_EXPR.
690 (op_error): Likewise.
691 (build_new_op_1): Likewise.
692 (build_new_function_call): Validate coroutine builtin arguments.
693 * constexpr.c (potential_constant_expression_1): Handle
694 CO_AWAIT_EXPR, CO_YIELD_EXPR, CO_RETURN_EXPR.
695 * coroutines.cc: New file.
696 * cp-objcp-common.c (cp_common_init_ts): Add CO_AWAIT_EXPR,
697 CO_YIELD_EXPR, CO_RETRN_EXPR as TS expressions.
698 * cp-tree.def (CO_AWAIT_EXPR, CO_YIELD_EXPR, (CO_RETURN_EXPR): New.
699 * cp-tree.h (coro_validate_builtin_call): New.
700 * decl.c (emit_coro_helper): New.
701 (finish_function): Handle the case when a function is found to
702 be a coroutine, perform the outlining and emit the outlined
703 functions. Set a bit to signal that this is a coroutine component.
704 * parser.c (enum required_token): New enumeration RT_CO_YIELD.
705 (cp_parser_unary_expression): Handle co_await.
706 (cp_parser_assignment_expression): Handle co_yield.
707 (cp_parser_statement): Handle RID_CO_RETURN.
708 (cp_parser_jump_statement): Handle co_return.
709 (cp_parser_operator): Handle co_await operator.
710 (cp_parser_yield_expression): New.
711 (cp_parser_required_error): Handle RT_CO_YIELD.
712 * pt.c (tsubst_copy): Handle CO_AWAIT_EXPR.
713 (tsubst_expr): Handle CO_AWAIT_EXPR, CO_YIELD_EXPR and
715 * tree.c (cp_walk_subtrees): Likewise.
717 2020-01-17 Jason Merrill <jason@redhat.com>
719 PR c++/92531 - ICE with noexcept(lambda).
720 * pt.c (uses_template_parms): Don't try to enumerate all the
723 2020-01-17 Jakub Jelinek <jakub@redhat.com>
726 * parser.c (cp_parser_template_name): Look up deprecated attribute
727 in DECL_TEMPLATE_RESULT or its type's attributes.
729 2020-01-16 Jason Merrill <jason@redhat.com>
731 PR c++/93286 - ICE with __is_constructible and variadic template.
732 * pt.c (tsubst) [TREE_LIST]: Handle pack expansion.
733 (tsubst_copy_and_build) [TRAIT_EXPR]: Always use tsubst for type2.
735 PR c++/93280 - ICE with aggregate assignment and DMI.
736 * init.c (get_nsdmi): Set TARGET_EXPR_DIRECT_INIT_P here.
737 * typeck2.c (digest_nsdmi_init): Not here.
739 2020-01-15 Paolo Carlini <paolo.carlini@oracle.com>
742 * cp-tree.h (is_constrained_auto): New.
743 * parser.c (cp_parser_maybe_commit_to_declaration): Correctly
744 handle concept-check expressions; take a cp_decl_specifier_seq*
746 (cp_parser_condition): Update call.
747 (cp_parser_simple_declaration): Likewise.
748 (cp_parser_placeholder_type_specifier): Correctly handle
749 concept-check expressions.
751 2020-01-15 Jason Merrill <jason@redhat.com>
754 PR c++/33799 - destroy return value if local cleanup throws.
755 * cp-tree.h (current_retval_sentinel): New macro.
756 * decl.c (start_preparsed_function): Set up cleanup for retval.
757 * typeck.c (check_return_expr): Set current_retval_sentinel.
759 PR c++/93257 - consteval void function.
760 * constexpr.c (verify_constant): Allow void_node.
762 PR c++/92871 - bad code with xvalue and GNU ?: extension.
763 * call.c (prevent_lifetime_extension): New.
764 (build_conditional_expr_1): Use it.
766 2020-01-14 Nathan Sidwell <nathan@acm.org>
769 * pt.c (retrieve_specialization): Use get_template_info, not open
773 * pt.c (retrieve_specialization): Get the TI from the decl or the
774 classtype as appropriate.
776 2020-01-14 David Malcolm <dmalcolm@redhat.com>
778 * cp-gimplify.c (source_location_table_entry_hash::empty_zero_p):
780 * cp-tree.h (named_decl_hash::empty_zero_p): Likewise.
781 (struct named_label_hash::empty_zero_p): Likewise.
782 * decl2.c (mangled_decl_hash::empty_zero_p): Likewise.
784 2020-01-14 Jason Merrill <jason@redhat.com>
786 PR c++/92590 - wrong handling of inherited default ctor.
787 * class.c (add_method): A constrained inherited ctor doesn't hide an
788 implicit derived ctor.
790 PR c++/92552 - ICE with inherited constrained default ctor.
791 * pt.c (instantiate_class_template_1): Copy
792 TYPE_HAS_USER_CONSTRUCTOR.
793 PR c++/91930 - ICE with constrained inherited default ctor.
794 * name-lookup.c (do_class_using_decl): Set TYPE_HAS_USER_CONSTRUCTOR
795 for inherited constructor.
796 PR c++/92594 - ICE with inherited trivial default ctor.
797 * method.c (trivial_fn_p): Treat an inherited default constructor
798 like a normal default constructor.
800 PR c++/92594 - ICE with inherited trivial default ctor.
801 * method.c (trivial_fn_p): Treat an inherited default constructor
802 like a normal default constructor.
804 PR c++/92009 - ICE with punning of typeid.
805 * rtti.c (get_tinfo_desc): Call xref_basetypes.
806 * constexpr.c (cxx_fold_indirect_ref): Don't strip
809 2020-01-13 Jason Merrill <jason@redhat.com>
811 PR c++/92746 - ICE with noexcept of function concept check.
812 * except.c (check_noexcept_r): Handle concept-check.
814 PR c++/92582 - ICE with member template as requirement.
815 * pt.c (struct find_template_parameter_info): Add ctx_parms.
816 (any_template_parm_r): Handle TEMPLATE_DECL.
817 (find_template_parameters): Take parms instead of their depth.
818 * constraint.cc (build_parameter_mapping): Pass them.
820 PR c++/33799 - destroy return value if local cleanup throws.
821 * cp-tree.h (current_retval_sentinel): New macro.
822 * decl.c (start_preparsed_function): Set up cleanup for retval.
823 * typeck.c (check_return_expr): Set current_retval_sentinel.
825 PR c++/93238 - short right-shift with enum.
826 * typeck.c (cp_build_binary_op): Use folded op1 for short_shift.
828 2020-01-10 Jason Merrill <jason@redhat.com>
830 * typeck.c (cp_build_binary_op): Restore short_shift code.
832 PR c++/93143 - incorrect tree sharing with constexpr.
833 * constexpr.c (cxx_eval_outermost_constant_expr): Don't assume
834 CONSTRUCTORs are already unshared.
836 PR c++/93173 - incorrect tree sharing.
838 * cp-gimplify.c (cp_gimplify_init_expr, cp_gimplify_expr): Use
839 copy_if_shared after cp_genericize_tree.
840 * typeck2.c (split_nonconstant_init): Don't unshare here.
842 2020-01-08 Jason Merrill <jason@redhat.com>
844 * cp-gimplify.c (cp_gimplify_expr) [TARGET_EXPR]: Check
845 TARGET_EXPR_DIRECT_INIT_P.
846 * constexpr.c (cxx_eval_constant_expression): Likewise.
848 2020-01-08 Jason Merrill <jason@redhat.com>
850 PR c++/91369 - constexpr destructor and member initializer.
851 * constexpr.c (cxx_eval_store_expression): Look through TARGET_EXPR
852 when not preevaluating.
854 2020-01-08 Jason Merrill <jason@redhat.com>
856 * constexpr.c (cxx_eval_call_expression): Remove DECL_BY_REFERENCE
859 2020-01-07 Paolo Carlini <paolo.carlini@oracle.com>
861 * init.c (build_new): Add location_t parameter and use it throughout.
862 (build_raw_new_expr): Likewise.
863 * parser.c (cp_parser_new_expression): Pass the combined_loc.
864 * pt.c (tsubst_copy_and_build): Adjust call.
865 * cp-tree.h: Update declarations.
867 2020-01-07 Jason Merrill <jason@redhat.com>
869 PR c++/47877 - -fvisibility-inlines-hidden and member templates.
870 * decl2.c (determine_visibility): -fvisibility-inlines-hidden beats
871 explicit class visibility for a template.
873 2020-01-07 Richard Sandiford <richard.sandiford@arm.com>
875 * mangle.c (mangle_type_attribute_p): New function, split out from...
876 (write_CV_qualifiers_for_type): ...here. Don't mangle attributes
877 that contain a space.
879 2020-01-07 Jakub Jelinek <jakub@redhat.com>
882 * constexpr.c (struct constexpr_global_ctx): Add heap_alloc_count
883 member, initialize it to zero in ctor.
884 (cxx_eval_call_expression): Bump heap_dealloc_count when deleting
885 a heap object. Don't cache calls to functions which allocate some
886 heap objects and don't deallocate them or deallocate some heap
887 objects they didn't allocate.
889 2020-01-06 Jason Merrill <jason@redhat.com>
891 PR c++/92552 - ICE with inherited constrained default ctor.
892 * pt.c (instantiate_class_template_1): Copy
893 TYPE_HAS_USER_CONSTRUCTOR.
894 * class.c (one_inherited_ctor): Don't set it here.
896 2020-01-06 Andrew Sutton <asutton@lock3software.com>
898 PR c++/92739 - parsing requires clause with attributes.
899 * parser.c (cp_parser_constraint_requires_parens): Exclude
900 attributes as postfix expressions.
902 2020-01-05 Jakub Jelinek <jakub@redhat.com>
905 * parser.c (cp_parser_check_class_key): Disable access checks for the
907 (cp_parser_maybe_warn_enum_key): Likewise. Return early if
908 !warn_redundant_tags.
910 2010-01-05 Jakub Jelinek <jakub@redhat.com>
913 * cp-gimplify.c (cp_gimplify_init_expr): Don't look through
914 TARGET_EXPR if it has been gimplified already.
916 2020-01-03 Jason Merrill <jason@redhat.com>
918 PR c++/93033 - incorrect tree node sharing with array init.
919 * typeck2.c (split_nonconstant_init): Unshare non-decl.
920 * cp-gimplify.c (cp_gimplify_init_expr): Only split if -fexceptions.
922 2020-01-02 Jason Merrill <jason@redhat.com>
924 * pt.c (invalid_nontype_parm_type_p): Reject class placeholder in
927 2020-01-02 Jakub Jelinek <jakub@redhat.com>
930 * cp-objcp-common.c (identifier_global_tag): Return NULL_TREE if name
931 has not been found, rather than error_mark_node.
933 2020-01-01 Jakub Jelinek <jakub@redhat.com>
935 Update copyright years.
937 Copyright (C) 2020 Free Software Foundation, Inc.
939 Copying and distribution of this file, with or without modification,
940 are permitted in any medium without royalty provided the copyright
941 notice and this notice are preserved.