f8140885dab408e680d8802cdddfc3fe84711aa0
[gcc.git] / gcc / cp / ChangeLog
1 2020-01-31 Jason Merrill <jason@redhat.com>
2
3 PR c++/14179
4 * parser.c (cp_parser_initializer_list): Suppress location wrappers
5 after 256 elements.
6
7 2020-01-29 Jason Merrill <jason@redhat.com>
8
9 PR c++/82521
10 * pt.c (tsubst_copy_and_build) [EQ_EXPR]: Only suppress warnings if
11 the expression was dependent before substitution.
12
13 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
14
15 * coroutines.cc (act_des_fn): New.
16 (morph_fn_to_coro): Call act_des_fn to build actor/destroy decls.
17 Access promise via actor function's frame pointer argument.
18 (build_actor_fn, build_destroy_fn): Use frame pointer argument.
19
20 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
21
22 * coroutines.cc (co_await_expander): Handle type conversion case.
23
24 2020-01-29 Jason Merrill <jason@redhat.com>
25
26 PR c++/90333
27 PR c++/89640
28 PR c++/60503
29 * parser.c (cp_parser_type_specifier_seq): Don't parse attributes in
30 a trailing return type.
31 (cp_parser_lambda_declarator_opt): Parse C++11 attributes before
32 parens.
33
34 2020-01-29 Marek Polacek <polacek@redhat.com>
35
36 PR c++/91754 - Fix template arguments comparison with class NTTP.
37 * pt.c (class_nttp_const_wrapper_p): New.
38 (template_args_equal): See through class_nttp_const_wrapper_p
39 arguments.
40
41 2020-01-29 Marek Polacek <polacek@redhat.com>
42
43 PR c++/92948 - Fix class NTTP with template arguments.
44 * pt.c (convert_nontype_argument): Use IMPLICIT_CONV_EXPR when
45 converting a value-dependent expression to a class type.
46 (tsubst_copy) <case VIEW_CONVERT_EXPR>: Allow IMPLICIT_CONV_EXPR
47 as the result of the tsubst_copy call.
48
49 2020-01-29 Jakub Jelinek <jakub@redhat.com>
50
51 PR c++/91118
52 * cp-gimplify.c (cxx_omp_predetermined_sharing): Return
53 OMP_CLAUSE_DEFAULT_SHARED for typeinfo decls.
54
55 2020-01-28 Jason Merrill <jason@redhat.com>
56
57 PR c++/93442
58 * parser.c (cp_parser_lambda_expression): Clear in_discarded_stmt.
59
60 PR c++/93477
61 PR c++/91476
62 * decl2.c (copy_linkage): Do copy DECL_ONE_ONLY and DECL_WEAK.
63
64 PR c++/90546
65 * call.c (build_user_type_conversion_1): Allow a template conversion
66 returning an rvalue reference to bind directly to an lvalue.
67
68 PR c++/90731
69 * decl.c (grokdeclarator): Propagate eh spec from typedef.
70
71 2020-01-28 Martin Liska <mliska@suse.cz>
72
73 PR c++/92440
74 * pt.c (redeclare_class_template): Group couple of
75 errors and inform messages with auto_diagnostic_group.
76
77 2020-01-28 Martin Liska <mliska@suse.cz>
78
79 PR c++/92440
80 * pt.c (redeclare_class_template): Use inform
81 for the second location.
82
83 2020-01-27 Jason Merrill <jason@redhat.com>
84
85 PR c++/90966
86 * pt.c (tsubst_copy) [STRING_CST]: Don't use fold_convert.
87
88 2020-01-27 Iain Sandoe <iain@sandoe.co.uk>
89
90 PR c++/93443
91 * coroutines.cc (morph_fn_to_coro): Check the ramp return
92 value when it is constructed from the 'get return object'.
93
94 2020-01-27 Nathan Sidwell <nathan@acm.org>
95
96 PR c++/91826
97 * name-lookup.c (is_ancestor): Allow CHILD to be a namespace alias.
98
99 2020-01-26 Jason Merrill <jason@redhat.com>
100
101 PR c++/90992
102 * except.c (maybe_noexcept_warning): Check DECL_IN_SYSTEM_HEADER and
103 temporarily enable -Wsystem-headers. Change second warning to
104 conditional inform.
105
106 PR c++/90997
107 * semantics.c (finish_call_expr): Don't call
108 instantiate_non_dependent_expr before warn_for_memset.
109
110 2020-01-25 Marek Polacek <polacek@redhat.com>
111
112 PR c++/93414 - poor diagnostic for dynamic_cast in constexpr context.
113 * constexpr.c (cxx_eval_dynamic_cast_fn): Add a reference
114 dynamic_cast diagnostic.
115
116 2020-01-24 Jason Merrill <jason@redhat.com>
117
118 PR c++/93400 - ICE with constrained friend.
119 * constraint.cc (maybe_substitute_reqs_for): New.
120 * decl.c (function_requirements_equivalent_p): Call it.
121 * pt.c (tsubst_friend_function): Only substitute
122 TEMPLATE_PARMS_CONSTRAINTS.
123 (tsubst_template_parms): Copy constraints.
124
125 2020-01-24 Jason Merrill <jason@redhat.com>
126
127 PR c++/93279 - ICE with lambda in member operator.
128 * name-lookup.c (maybe_save_operator_binding): Don't remember
129 class-scope bindings.
130
131 2020-01-24 Jason Merrill <jason@redhat.com>
132
133 PR c++/93377 - ICE with member alias in constraint.
134 * pt.c (any_template_parm_r): Look at template arguments for all
135 aliases, not only alias templates.
136
137 2020-01-24 Marek Polacek <polacek@redhat.com>
138
139 PR c++/93299 - ICE in tsubst_copy with parenthesized expression.
140 * pt.c (tsubst_copy): Handle a REF_PARENTHESIZED_P VIEW_CONVERT_EXPR.
141
142 2020-01-24 Jason Merrill <jason@redhat.com>
143
144 PR c++/92852 - ICE with generic lambda and reference var.
145 * constexpr.c (maybe_constant_value): Likewise.
146
147 2020-01-23 Paolo Carlini <paolo.carlini@oracle.com>
148
149 PR c++/92804
150 * parser.c (cp_parser_nested_name_specifier_opt): Properly
151 diagnose concept-ids.
152
153 2020-01-23 Jason Merrill <jason@redhat.com>
154
155 PR c++/93331 - ICE with __builtin_strchr.
156 * constexpr.c (cxx_eval_builtin_function_call): Use the original
157 argument if we didn't manage to extract a STRING_CST.
158
159 PR c++/93345 - ICE with defaulted dtor and template.
160 PR c++/33799
161 * decl.c (cxx_maybe_build_cleanup): Don't try to set
162 throwing_cleanup in a template.
163
164 2020-01-22 Marek Polacek <polacek@redhat.com>
165
166 PR c++/92907 - noexcept does not consider "const" in member functions.
167 * g++.dg/cpp0x/noexcept56.C: New test.
168
169 2020-01-22 Marek Polacek <polacek@redhat.com>
170
171 PR c++/93324 - ICE with -Wall on constexpr if.
172 * semantics.c (is_std_constant_evaluated_p): Check fndecl.
173
174 2020-01-22 Patrick Palka <ppalka@redhat.com>
175
176 * constraint.cc (get_mapped_args): Avoid using auto_vec
177 as a vector element. Release the vectors inside the lists
178 vector.
179 * parser.c (cp_literal_operator_id): Free the buffer.
180
181 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
182
183 * coroutines.cc (finish_co_await_expr): Add error check on return
184 value of build_co_await.
185 (finish_co_yield_expr,): Ditto.
186
187 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
188
189 * coroutines.cc (lookup_awaitable_member): Lookup an awaitable member.
190 (lookup_promise_method): Emit diagnostic when get NULL_TREE back only.
191 (build_co_await): Use lookup_awaitable_member instead of lookup_member.
192
193 2020-01-21 Jason Merrill <jason@redhat.com>
194
195 PR c++/60855 - ICE with sizeof VLA capture.
196 * lambda.c (is_lambda_ignored_entity): Don't look past VLA capture.
197
198 PR c++/90732 - ICE with VLA capture and generic lambda.
199 * pt.c (tsubst_lambda_expr): Repeat add_capture for VLAs.
200
201 2020-01-21 Iain Sandoe <iain@sandoe.co.uk>
202 Bin Cheng <bin.cheng@linux.alibaba.com>
203
204 * coroutines.cc (coro_promise_type_found_p): Check for NULL return
205 from complete_type_or_else.
206 (register_param_uses): Likewise.
207 (build_co_await): Do not try to use complete_type_or_else for void
208 types, otherwise for incomplete types, check for NULL return from
209 complete_type_or_else.
210
211 2020-01-21 Jason Merrill <jason@redhat.com>
212
213 PR c++/91476 - anon-namespace reference temp clash between TUs.
214 * decl2.c (copy_linkage): Factor out of get_guard.
215 * call.c (make_temporary_var_for_ref_to_temp): Use it.
216 * decl.c (cp_finish_decomp): Use it.
217 (cp_finish_decl): determine_visibility sooner.
218
219 2020-01-21 Bin Cheng <bin.cheng@linux.alibaba.com>
220
221 * coroutines.cc (finish_co_await_expr): Set return value flag.
222 (finish_co_yield_expr, morph_fn_to_coro): Ditto.
223
224 2020-01-19 Jason Merrill <jason@redhat.com>
225
226 PR c++/33799 - destroy return value, take 2.
227 * cp-tree.h (current_retval_sentinel): New macro.
228 (struct language_function): Add throwing_cleanup bitfield.
229 * decl.c (cxx_maybe_build_cleanup): Set it.
230 * except.c (maybe_set_retval_sentinel)
231 (maybe_splice_retval_cleanup): New functions.
232 * parser.c (cp_parser_compound_statement): Call
233 maybe_splice_retval_cleanup.
234 * typeck.c (check_return_expr): Call maybe_set_retval_sentinel.
235
236 * parser.c (cp_parser_lambda_body): Use cp_parser_function_body.
237
238 2020-01-18 Jakub Jelinek <jakub@redhat.com>
239
240 * coroutines.cc (get_fn_local_identifier): Fix NO_DOT_IN_LABEL
241 but non-NO_DOLLAR_IN_LABEL case build.
242
243 2020-01-18 Iain Sandoe <iain@sandoe.co.uk>
244
245 * Make-lang.in: Add coroutines.o.
246 * cp-tree.h (lang_decl-fn): coroutine_p, new bit.
247 (DECL_COROUTINE_P): New.
248 * lex.c (init_reswords): Enable keywords when the coroutine flag
249 is set,
250 * operators.def (co_await): New operator.
251 * call.c (add_builtin_candidates): Handle CO_AWAIT_EXPR.
252 (op_error): Likewise.
253 (build_new_op_1): Likewise.
254 (build_new_function_call): Validate coroutine builtin arguments.
255 * constexpr.c (potential_constant_expression_1): Handle
256 CO_AWAIT_EXPR, CO_YIELD_EXPR, CO_RETURN_EXPR.
257 * coroutines.cc: New file.
258 * cp-objcp-common.c (cp_common_init_ts): Add CO_AWAIT_EXPR,
259 CO_YIELD_EXPR, CO_RETRN_EXPR as TS expressions.
260 * cp-tree.def (CO_AWAIT_EXPR, CO_YIELD_EXPR, (CO_RETURN_EXPR): New.
261 * cp-tree.h (coro_validate_builtin_call): New.
262 * decl.c (emit_coro_helper): New.
263 (finish_function): Handle the case when a function is found to
264 be a coroutine, perform the outlining and emit the outlined
265 functions. Set a bit to signal that this is a coroutine component.
266 * parser.c (enum required_token): New enumeration RT_CO_YIELD.
267 (cp_parser_unary_expression): Handle co_await.
268 (cp_parser_assignment_expression): Handle co_yield.
269 (cp_parser_statement): Handle RID_CO_RETURN.
270 (cp_parser_jump_statement): Handle co_return.
271 (cp_parser_operator): Handle co_await operator.
272 (cp_parser_yield_expression): New.
273 (cp_parser_required_error): Handle RT_CO_YIELD.
274 * pt.c (tsubst_copy): Handle CO_AWAIT_EXPR.
275 (tsubst_expr): Handle CO_AWAIT_EXPR, CO_YIELD_EXPR and
276 CO_RETURN_EXPRs.
277 * tree.c (cp_walk_subtrees): Likewise.
278
279 2020-01-17 Jason Merrill <jason@redhat.com>
280
281 PR c++/92531 - ICE with noexcept(lambda).
282 * pt.c (uses_template_parms): Don't try to enumerate all the
283 expression cases.
284
285 2020-01-17 Jakub Jelinek <jakub@redhat.com>
286
287 PR c++/93228
288 * parser.c (cp_parser_template_name): Look up deprecated attribute
289 in DECL_TEMPLATE_RESULT or its type's attributes.
290
291 2020-01-16 Jason Merrill <jason@redhat.com>
292
293 PR c++/93286 - ICE with __is_constructible and variadic template.
294 * pt.c (tsubst) [TREE_LIST]: Handle pack expansion.
295 (tsubst_copy_and_build) [TRAIT_EXPR]: Always use tsubst for type2.
296
297 PR c++/93280 - ICE with aggregate assignment and DMI.
298 * init.c (get_nsdmi): Set TARGET_EXPR_DIRECT_INIT_P here.
299 * typeck2.c (digest_nsdmi_init): Not here.
300
301 2020-01-15 Paolo Carlini <paolo.carlini@oracle.com>
302
303 PR c++/91073
304 * cp-tree.h (is_constrained_auto): New.
305 * parser.c (cp_parser_maybe_commit_to_declaration): Correctly
306 handle concept-check expressions; take a cp_decl_specifier_seq*
307 instead of a bool.
308 (cp_parser_condition): Update call.
309 (cp_parser_simple_declaration): Likewise.
310 (cp_parser_placeholder_type_specifier): Correctly handle
311 concept-check expressions.
312
313 2020-01-15 Jason Merrill <jason@redhat.com>
314
315 Revert
316 PR c++/33799 - destroy return value if local cleanup throws.
317 * cp-tree.h (current_retval_sentinel): New macro.
318 * decl.c (start_preparsed_function): Set up cleanup for retval.
319 * typeck.c (check_return_expr): Set current_retval_sentinel.
320
321 PR c++/93257 - consteval void function.
322 * constexpr.c (verify_constant): Allow void_node.
323
324 PR c++/92871 - bad code with xvalue and GNU ?: extension.
325 * call.c (prevent_lifetime_extension): New.
326 (build_conditional_expr_1): Use it.
327
328 2020-01-14 Nathan Sidwell <nathan@acm.org>
329
330 PR c++/90916
331 * pt.c (retrieve_specialization): Use get_template_info, not open
332 coding access.
333
334 PR c++/90916
335 * pt.c (retrieve_specialization): Get the TI from the decl or the
336 classtype as appropriate.
337
338 2020-01-14 David Malcolm <dmalcolm@redhat.com>
339
340 * cp-gimplify.c (source_location_table_entry_hash::empty_zero_p):
341 New static constant.
342 * cp-tree.h (named_decl_hash::empty_zero_p): Likewise.
343 (struct named_label_hash::empty_zero_p): Likewise.
344 * decl2.c (mangled_decl_hash::empty_zero_p): Likewise.
345
346 2020-01-14 Jason Merrill <jason@redhat.com>
347
348 PR c++/92590 - wrong handling of inherited default ctor.
349 * class.c (add_method): A constrained inherited ctor doesn't hide an
350 implicit derived ctor.
351 Revert:
352 PR c++/92552 - ICE with inherited constrained default ctor.
353 * pt.c (instantiate_class_template_1): Copy
354 TYPE_HAS_USER_CONSTRUCTOR.
355 PR c++/91930 - ICE with constrained inherited default ctor.
356 * name-lookup.c (do_class_using_decl): Set TYPE_HAS_USER_CONSTRUCTOR
357 for inherited constructor.
358 PR c++/92594 - ICE with inherited trivial default ctor.
359 * method.c (trivial_fn_p): Treat an inherited default constructor
360 like a normal default constructor.
361
362 PR c++/92594 - ICE with inherited trivial default ctor.
363 * method.c (trivial_fn_p): Treat an inherited default constructor
364 like a normal default constructor.
365
366 PR c++/92009 - ICE with punning of typeid.
367 * rtti.c (get_tinfo_desc): Call xref_basetypes.
368 * constexpr.c (cxx_fold_indirect_ref): Don't strip
369 REINTERPRET_CAST_P.
370
371 2020-01-13 Jason Merrill <jason@redhat.com>
372
373 PR c++/92746 - ICE with noexcept of function concept check.
374 * except.c (check_noexcept_r): Handle concept-check.
375
376 PR c++/92582 - ICE with member template as requirement.
377 * pt.c (struct find_template_parameter_info): Add ctx_parms.
378 (any_template_parm_r): Handle TEMPLATE_DECL.
379 (find_template_parameters): Take parms instead of their depth.
380 * constraint.cc (build_parameter_mapping): Pass them.
381
382 PR c++/33799 - destroy return value if local cleanup throws.
383 * cp-tree.h (current_retval_sentinel): New macro.
384 * decl.c (start_preparsed_function): Set up cleanup for retval.
385 * typeck.c (check_return_expr): Set current_retval_sentinel.
386
387 PR c++/93238 - short right-shift with enum.
388 * typeck.c (cp_build_binary_op): Use folded op1 for short_shift.
389
390 2020-01-10 Jason Merrill <jason@redhat.com>
391
392 * typeck.c (cp_build_binary_op): Restore short_shift code.
393
394 PR c++/93143 - incorrect tree sharing with constexpr.
395 * constexpr.c (cxx_eval_outermost_constant_expr): Don't assume
396 CONSTRUCTORs are already unshared.
397
398 PR c++/93173 - incorrect tree sharing.
399 PR c++/93033
400 * cp-gimplify.c (cp_gimplify_init_expr, cp_gimplify_expr): Use
401 copy_if_shared after cp_genericize_tree.
402 * typeck2.c (split_nonconstant_init): Don't unshare here.
403
404 2020-01-08 Jason Merrill <jason@redhat.com>
405
406 * cp-gimplify.c (cp_gimplify_expr) [TARGET_EXPR]: Check
407 TARGET_EXPR_DIRECT_INIT_P.
408 * constexpr.c (cxx_eval_constant_expression): Likewise.
409
410 2020-01-08 Jason Merrill <jason@redhat.com>
411
412 PR c++/91369 - constexpr destructor and member initializer.
413 * constexpr.c (cxx_eval_store_expression): Look through TARGET_EXPR
414 when not preevaluating.
415
416 2020-01-08 Jason Merrill <jason@redhat.com>
417
418 * constexpr.c (cxx_eval_call_expression): Remove DECL_BY_REFERENCE
419 support.
420
421 2020-01-07 Paolo Carlini <paolo.carlini@oracle.com>
422
423 * init.c (build_new): Add location_t parameter and use it throughout.
424 (build_raw_new_expr): Likewise.
425 * parser.c (cp_parser_new_expression): Pass the combined_loc.
426 * pt.c (tsubst_copy_and_build): Adjust call.
427 * cp-tree.h: Update declarations.
428
429 2020-01-07 Jason Merrill <jason@redhat.com>
430
431 PR c++/47877 - -fvisibility-inlines-hidden and member templates.
432 * decl2.c (determine_visibility): -fvisibility-inlines-hidden beats
433 explicit class visibility for a template.
434
435 2020-01-07 Richard Sandiford <richard.sandiford@arm.com>
436
437 * mangle.c (mangle_type_attribute_p): New function, split out from...
438 (write_CV_qualifiers_for_type): ...here. Don't mangle attributes
439 that contain a space.
440
441 2020-01-07 Jakub Jelinek <jakub@redhat.com>
442
443 PR c++/91369
444 * constexpr.c (struct constexpr_global_ctx): Add heap_alloc_count
445 member, initialize it to zero in ctor.
446 (cxx_eval_call_expression): Bump heap_dealloc_count when deleting
447 a heap object. Don't cache calls to functions which allocate some
448 heap objects and don't deallocate them or deallocate some heap
449 objects they didn't allocate.
450
451 2020-01-06 Jason Merrill <jason@redhat.com>
452
453 PR c++/92552 - ICE with inherited constrained default ctor.
454 * pt.c (instantiate_class_template_1): Copy
455 TYPE_HAS_USER_CONSTRUCTOR.
456 * class.c (one_inherited_ctor): Don't set it here.
457
458 2020-01-06 Andrew Sutton <asutton@lock3software.com>
459
460 PR c++/92739 - parsing requires clause with attributes.
461 * parser.c (cp_parser_constraint_requires_parens): Exclude
462 attributes as postfix expressions.
463
464 2020-01-05 Jakub Jelinek <jakub@redhat.com>
465
466 PR c++/93138
467 * parser.c (cp_parser_check_class_key): Disable access checks for the
468 simple name lookup.
469 (cp_parser_maybe_warn_enum_key): Likewise. Return early if
470 !warn_redundant_tags.
471
472 2010-01-05 Jakub Jelinek <jakub@redhat.com>
473
474 PR c++/93046
475 * cp-gimplify.c (cp_gimplify_init_expr): Don't look through
476 TARGET_EXPR if it has been gimplified already.
477
478 2020-01-03 Jason Merrill <jason@redhat.com>
479
480 PR c++/93033 - incorrect tree node sharing with array init.
481 * typeck2.c (split_nonconstant_init): Unshare non-decl.
482 * cp-gimplify.c (cp_gimplify_init_expr): Only split if -fexceptions.
483
484 2020-01-02 Jason Merrill <jason@redhat.com>
485
486 * pt.c (invalid_nontype_parm_type_p): Reject class placeholder in
487 C++17.
488
489 2020-01-02 Jakub Jelinek <jakub@redhat.com>
490
491 PR c/90677
492 * cp-objcp-common.c (identifier_global_tag): Return NULL_TREE if name
493 has not been found, rather than error_mark_node.
494
495 2020-01-01 Jakub Jelinek <jakub@redhat.com>
496
497 Update copyright years.
498 \f
499 Copyright (C) 2020 Free Software Foundation, Inc.
500
501 Copying and distribution of this file, with or without modification,
502 are permitted in any medium without royalty provided the copyright
503 notice and this notice are preserved.