4dc30e0a321b0348c50c7fc0c4bc8d38b8e1ca6f
[gcc.git] / gcc / cp / ChangeLog
1 2020-02-28 Jakub Jelinek <jakub@redhat.com>
2
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.
6
7 2020-02-27 Nathan Sidwell <nathan@acm.org>
8
9 PR c++/93933
10 * pt.c (template_args_equal): Pass ARGUMENT_PACKS through to
11 cp_tree_equal.
12 * tree.c (cp_tree_equal): Compare ARGUMENT_PACKS here,
13 * typeck.c (comptypes): Assert we don't get any argument packs.
14
15 * class.c (adjust_clone_args): Correct arg-checking assert.
16 * typeck.c (comptypes): Assert not nulls.
17
18 2020-02-26 Marek Polacek <polacek@redhat.com>
19
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.
23
24 2020-02-26 Iain Sandoe <iain@sandoe.co.uk>
25
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
29 the DTOR is trivial.
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.
38
39 2020-02-26 Patrick Palka <ppalka@redhat.com>
40
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
46 accordingly.
47 (diagnose_requires_expr): Likewise.
48 (diagnose_atomic_constraint): Likewise. When printing an atomic
49 constraint expression, print the instantiated parameter mapping
50 alongside it.
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.
54
55 2020-02-26 Marek Polacek <polacek@redhat.com>
56
57 PR c++/93676 - value-init crash in template.
58 * init.c (build_new_1): Don't call build_vec_init in a template.
59
60 2020-02-26 Marek Polacek <polacek@redhat.com>
61
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.
67
68 2020-02-26 Marek Polacek <polacek@redhat.com>
69
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
72 field.
73
74 2020-02-24 Martin Sebor <msebor@redhat.com>
75
76 PR c++/93804
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.
80
81 2020-02-24 Marek Polacek <polacek@redhat.com>
82
83 PR c++/93869 - ICE with -Wmismatched-tags.
84 * parser.c (cp_parser_check_class_key): Check class_key earlier.
85
86 2020-02-24 Marek Polacek <polacek@redhat.com>
87
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.
94
95 2020-02-24 Jakub Jelinek <jakub@redhat.com>
96
97 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
98 * call.c (build_over_call): Don't evaluate immediate functions in
99 unevaluated operands.
100
101 2020-02-24 Jason Merrill <jason@redhat.com>
102
103 P0780R2: Resolve lambda init-capture pack grammar.
104 * parser.c (cp_parser_lambda_introducer): Expect &...x=y rather than
105 ...&x=y.
106
107 2020-02-22 Marek Polacek <polacek@redhat.com>
108
109 PR c++/93882
110 * decl.c (grokdeclarator): Use %qs in a diagnostic message.
111
112 2020-02-21 Martin Sebor <msebor@redhat.com>
113
114 PR gcov-profile/93753
115 * class.c (check_flexarrays): Tighten up a test for potential members
116 of anonymous structs or unions.
117
118 2020-02-20 Martin Sebor <msebor@redhat.com>
119
120 PR c++/93801
121 * parser.c (cp_parser_check_class_key): Only handle true C++ class-keys.
122
123 2020-02-20 Martin Liska <mliska@suse.cz>
124
125 PR translation/93841
126 * config/or1k/or1k.opt: Remove superfluous word.
127 * doc/invoke.texi: Likewise.
128
129 2020-02-20 Martin Liska <mliska@suse.cz>
130
131 PR translation/93838
132 * parser.c (cp_parser_decl_specifier_seq): Remove trailing space.
133
134 2020-02-19 Marek Polacek <polacek@redhat.com>
135
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.
139
140 2020-02-15 Marek Polacek <polacek@redhat.com>
141
142 PR c++/93710 - poor diagnostic for array initializer.
143 * call.c (build_user_type_conversion_1): Use cp_expr_loc_or_input_loc
144 for an error call.
145
146 2020-02-15 Jason Merrill <jason@redhat.com>
147
148 PR c++/92556
149 * pt.c (any_template_parm_r): Look into lambda body.
150
151 PR c++/92583
152 * pt.c (any_template_parm_r): Remove CONSTRUCTOR handling.
153
154 2020-02-14 Jakub Jelinek <jakub@redhat.com>
155
156 PR c++/61414
157 * class.c (enum_min_precision): Change prec type from int to int &.
158
159 PR libstdc++/92906
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
165 dfloat*_type_node.
166 * rtti.c (emit_support_tinfos): Emit DFP typeinfos even when dfp
167 is disabled for compatibility.
168
169 2020-02-13 Jason Merrill <jason@redhat.com>
170
171 PR c++/93713
172 * name-lookup.c (matching_fn_p): A function does not match a
173 template.
174
175 PR c++/93643
176 PR c++/91476
177 * tree.c (decl_linkage): Always lk_none for locals.
178
179 2020-02-12 Jason Merrill <jason@redhat.com>
180
181 PR c++/92583
182 PR c++/92654
183 * tree.c (cp_walk_subtrees): Walk CONSTRUCTOR types here.
184 * pt.c (find_parameter_packs_r): Not here.
185
186 2020-02-12 Iain Sandoe <iain@sandoe.co.uk>
187
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.
192
193 2020-02-12 Marek Polacek <polacek@redhat.com>
194
195 PR c++/93684 - ICE-on-invalid with broken attribute.
196 * parser.c (cp_parser_std_attribute): Peek a token first before
197 consuming it.
198
199 2020-02-11 Jason Merrill <jason@redhat.com>
200
201 PR c++/93675
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.
207
208 2020-02-11 Jason Merrill <jason@redhat.com>
209
210 PR c++/93650
211 PR c++/90691
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.
215
216 2020-02-12 Patrick Palka <ppalka@redhat.com>
217
218 PR c++/69448
219 PR c++/80471
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
223 decltype(auto) node.
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
229 to late_return_type.
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.
233
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.
237
238 2020-02-10 Jakub Jelinek <jakub@redhat.com>
239
240 PR other/93641
241 * error.c (dump_decl_name): Fix up last argument to strncmp.
242
243 2020-02-10 Jason Merrill <jason@redhat.com>
244
245 PR c++/93618
246 * tree.c (array_of_unknown_bound_p): New.
247 * init.c (perform_member_init): Do nothing for flexible arrays.
248
249 2020-02-09 Jakub Jelinek <jakub@redhat.com>
250
251 PR c++/93633
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
254 a class type.
255
256 2020-02-08 Jason Merrill <jason@redhat.com>
257
258 PR c++/90691
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.
265
266 PR c++/92852
267 * constexpr.c (maybe_constant_value): Don't unshare if the cached
268 value is the same as the argument.
269
270 * typeck.c (maybe_warn_about_returning_address_of_local): Add
271 location parameter.
272
273 * typeck2.c (process_init_constructor): Also clear TREE_SIDE_EFFECTS
274 if appropriate.
275
276 2020-02-08 Jakub Jelinek <jakub@redhat.com>
277
278 PR c++/93549
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.
284
285 2020-02-07 Marek Polacek <polacek@redhat.com>
286
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.
290
291 2020-02-06 Jason Merrill <jason@redhat.com>
292
293 PR c++/92654
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.
300
301 2020-02-06 Jason Merrill <jason@redhat.com>
302
303 PR c++/92517
304 * parser.c (cp_parser_constraint_primary_expression): Do the main
305 parse non-tentatively.
306
307 2020-02-06 Marek Polacek <polacek@redhat.com>
308
309 PR c++/93597 - ICE with lambda in operator function.
310 * name-lookup.c (maybe_save_operator_binding): Check is_overloaded_fn.
311
312 2020-02-05 Jason Merrill <jason@redhat.com>
313
314 PR c++/93140
315 * pt.c (tsubst_decl) [PARM_DECL]: Check cp_unevaluated_operand in
316 handling of TREE_CHAIN for empty pack.
317
318 2020-02-05 Jakub Jelinek <jakub@redhat.com>
319
320 PR c++/93557
321 * semantics.c (cp_build_vec_convert): Call decay_conversion on arg
322 prior to passing it to c_build_vec_convert.
323
324 2020-02-05 Marek Polacek <polacek@redhat.com>
325
326 PR c++/93559 - ICE with CONSTRUCTOR flags verification.
327 * decl.c (reshape_init_array_1): Don't reuse a CONSTRUCTOR with
328 TREE_SIDE_EFFECTS.
329
330 2020-02-05 Jason Merrill <jason@redhat.com>
331
332 PR c++/92593
333 * decl.c (grokdeclarator): Reject field of current class type even
334 in a template.
335
336 2020-02-05 Bin Cheng <bin.cheng@linux.alibaba.com>
337
338 * coroutines.cc (maybe_promote_captured_temps): Increase the index
339 number for temporary variables' name.
340
341 2020-02-05 Jun Ma <JunMa@linux.alibaba.com>
342
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.
346
347 (co_await_expander): Sink to call_expr if await_resume
348 is wrapped by indirect_ref.
349
350 2020-02-04 Jason Merrill <jason@redhat.com>
351
352 PR c++/93551
353 * constraint.cc (satisfy_declaration_constraints): Check return
354 value of push_tinst_level.
355
356 PR c++/90951
357 * constexpr.c (cxx_eval_array_reference): {}-initialize missing
358 elements instead of value-initializing them.
359
360 PR c++/86917
361 * init.c (perform_member_init): Simplify.
362 * constexpr.c (cx_check_missing_mem_inits): Allow uninitialized
363 flexarray.
364 (cxx_eval_vec_init_1): Handle CONSTRUCTOR.
365
366 2020-02-04 Iain Sandoe <iain@sandoe.co.uk>
367
368 * coroutines.cc (find_promise_type): Delete unused forward
369 declaration.
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.
373
374 2020-02-03 Jason Merrill <jason@redhat.com>
375
376 PR c++/66477
377 * constexpr.c (cxx_eval_constant_expression) [PARM_DECL]: Don't
378 defer loading the value of a reference.
379
380 2020-02-03 Jason Merrill <jason@redhat.com>
381
382 PR c++/91953
383 * constexpr.c (potential_constant_expression_1) [PARM_DECL]: Allow
384 empty class type.
385 [COMPONENT_REF]: A member function reference doesn't use the object
386 as an rvalue.
387
388 2020-02-03 Iain Sandoe <iain@sandoe.co.uk>
389
390 PR c++/93458
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
394 missing traits.
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
397 duplicates.
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
406 copies.
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.
409
410 2020-02-03 Jason Merrill <jason@redhat.com>
411
412 PR c++/88256
413 * cp-gimplify.c (predeclare_vla): New.
414 (cp_genericize_r) [NOP_EXPR]: Call it.
415
416 2020-02-03 Jun Ma <JunMa@linux.alibaba.com>
417
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.
421
422 2020-02-02 Marek Polacek <polacek@redhat.com>
423
424 PR c++/93530 - ICE on invalid alignas in a template.
425 * decl.c (grokdeclarator): Call cplus_decl_attributes instead of
426 decl_attributes.
427
428 2020-01-31 Jason Merrill <jason@redhat.com>
429
430 PR c++/86216
431 * semantics.c (process_outer_var_ref): Capture VLAs even in
432 unevaluated context.
433
434 PR c++/14179
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.
440
441 PR c++/14179
442 * parser.c (cp_parser_initializer_list): Suppress location wrappers
443 after 256 elements.
444
445 2020-01-29 Jason Merrill <jason@redhat.com>
446
447 PR c++/82521
448 * pt.c (tsubst_copy_and_build) [EQ_EXPR]: Only suppress warnings if
449 the expression was dependent before substitution.
450
451 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
452
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.
457
458 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
459
460 * coroutines.cc (co_await_expander): Handle type conversion case.
461
462 2020-01-29 Jason Merrill <jason@redhat.com>
463
464 PR c++/90333
465 PR c++/89640
466 PR c++/60503
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
470 parens.
471
472 2020-01-29 Marek Polacek <polacek@redhat.com>
473
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
477 arguments.
478
479 2020-01-29 Marek Polacek <polacek@redhat.com>
480
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.
486
487 2020-01-29 Jakub Jelinek <jakub@redhat.com>
488
489 PR c++/91118
490 * cp-gimplify.c (cxx_omp_predetermined_sharing): Return
491 OMP_CLAUSE_DEFAULT_SHARED for typeinfo decls.
492
493 2020-01-28 Jason Merrill <jason@redhat.com>
494
495 PR c++/93442
496 * parser.c (cp_parser_lambda_expression): Clear in_discarded_stmt.
497
498 PR c++/93477
499 PR c++/91476
500 * decl2.c (copy_linkage): Do copy DECL_ONE_ONLY and DECL_WEAK.
501
502 PR c++/90546
503 * call.c (build_user_type_conversion_1): Allow a template conversion
504 returning an rvalue reference to bind directly to an lvalue.
505
506 PR c++/90731
507 * decl.c (grokdeclarator): Propagate eh spec from typedef.
508
509 2020-01-28 Martin Liska <mliska@suse.cz>
510
511 PR c++/92440
512 * pt.c (redeclare_class_template): Group couple of
513 errors and inform messages with auto_diagnostic_group.
514
515 2020-01-28 Martin Liska <mliska@suse.cz>
516
517 PR c++/92440
518 * pt.c (redeclare_class_template): Use inform
519 for the second location.
520
521 2020-01-27 Jason Merrill <jason@redhat.com>
522
523 PR c++/90966
524 * pt.c (tsubst_copy) [STRING_CST]: Don't use fold_convert.
525
526 2020-01-27 Iain Sandoe <iain@sandoe.co.uk>
527
528 PR c++/93443
529 * coroutines.cc (morph_fn_to_coro): Check the ramp return
530 value when it is constructed from the 'get return object'.
531
532 2020-01-27 Nathan Sidwell <nathan@acm.org>
533
534 PR c++/91826
535 * name-lookup.c (is_ancestor): Allow CHILD to be a namespace alias.
536
537 2020-01-26 Jason Merrill <jason@redhat.com>
538
539 PR c++/90992
540 * except.c (maybe_noexcept_warning): Check DECL_IN_SYSTEM_HEADER and
541 temporarily enable -Wsystem-headers. Change second warning to
542 conditional inform.
543
544 PR c++/90997
545 * semantics.c (finish_call_expr): Don't call
546 instantiate_non_dependent_expr before warn_for_memset.
547
548 2020-01-25 Marek Polacek <polacek@redhat.com>
549
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.
553
554 2020-01-24 Jason Merrill <jason@redhat.com>
555
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.
562
563 2020-01-24 Jason Merrill <jason@redhat.com>
564
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.
568
569 2020-01-24 Jason Merrill <jason@redhat.com>
570
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.
574
575 2020-01-24 Marek Polacek <polacek@redhat.com>
576
577 PR c++/93299 - ICE in tsubst_copy with parenthesized expression.
578 * pt.c (tsubst_copy): Handle a REF_PARENTHESIZED_P VIEW_CONVERT_EXPR.
579
580 2020-01-24 Jason Merrill <jason@redhat.com>
581
582 PR c++/92852 - ICE with generic lambda and reference var.
583 * constexpr.c (maybe_constant_value): Likewise.
584
585 2020-01-23 Paolo Carlini <paolo.carlini@oracle.com>
586
587 PR c++/92804
588 * parser.c (cp_parser_nested_name_specifier_opt): Properly
589 diagnose concept-ids.
590
591 2020-01-23 Jason Merrill <jason@redhat.com>
592
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.
596
597 PR c++/93345 - ICE with defaulted dtor and template.
598 PR c++/33799
599 * decl.c (cxx_maybe_build_cleanup): Don't try to set
600 throwing_cleanup in a template.
601
602 2020-01-22 Marek Polacek <polacek@redhat.com>
603
604 PR c++/92907 - noexcept does not consider "const" in member functions.
605 * g++.dg/cpp0x/noexcept56.C: New test.
606
607 2020-01-22 Marek Polacek <polacek@redhat.com>
608
609 PR c++/93324 - ICE with -Wall on constexpr if.
610 * semantics.c (is_std_constant_evaluated_p): Check fndecl.
611
612 2020-01-22 Patrick Palka <ppalka@redhat.com>
613
614 * constraint.cc (get_mapped_args): Avoid using auto_vec
615 as a vector element. Release the vectors inside the lists
616 vector.
617 * parser.c (cp_literal_operator_id): Free the buffer.
618
619 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
620
621 * coroutines.cc (finish_co_await_expr): Add error check on return
622 value of build_co_await.
623 (finish_co_yield_expr,): Ditto.
624
625 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
626
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.
630
631 2020-01-21 Jason Merrill <jason@redhat.com>
632
633 PR c++/60855 - ICE with sizeof VLA capture.
634 * lambda.c (is_lambda_ignored_entity): Don't look past VLA capture.
635
636 PR c++/90732 - ICE with VLA capture and generic lambda.
637 * pt.c (tsubst_lambda_expr): Repeat add_capture for VLAs.
638
639 2020-01-21 Iain Sandoe <iain@sandoe.co.uk>
640 Bin Cheng <bin.cheng@linux.alibaba.com>
641
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.
648
649 2020-01-21 Jason Merrill <jason@redhat.com>
650
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.
656
657 2020-01-21 Bin Cheng <bin.cheng@linux.alibaba.com>
658
659 * coroutines.cc (finish_co_await_expr): Set return value flag.
660 (finish_co_yield_expr, morph_fn_to_coro): Ditto.
661
662 2020-01-19 Jason Merrill <jason@redhat.com>
663
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.
673
674 * parser.c (cp_parser_lambda_body): Use cp_parser_function_body.
675
676 2020-01-18 Jakub Jelinek <jakub@redhat.com>
677
678 * coroutines.cc (get_fn_local_identifier): Fix NO_DOT_IN_LABEL
679 but non-NO_DOLLAR_IN_LABEL case build.
680
681 2020-01-18 Iain Sandoe <iain@sandoe.co.uk>
682
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
687 is set,
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
714 CO_RETURN_EXPRs.
715 * tree.c (cp_walk_subtrees): Likewise.
716
717 2020-01-17 Jason Merrill <jason@redhat.com>
718
719 PR c++/92531 - ICE with noexcept(lambda).
720 * pt.c (uses_template_parms): Don't try to enumerate all the
721 expression cases.
722
723 2020-01-17 Jakub Jelinek <jakub@redhat.com>
724
725 PR c++/93228
726 * parser.c (cp_parser_template_name): Look up deprecated attribute
727 in DECL_TEMPLATE_RESULT or its type's attributes.
728
729 2020-01-16 Jason Merrill <jason@redhat.com>
730
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.
734
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.
738
739 2020-01-15 Paolo Carlini <paolo.carlini@oracle.com>
740
741 PR c++/91073
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*
745 instead of a bool.
746 (cp_parser_condition): Update call.
747 (cp_parser_simple_declaration): Likewise.
748 (cp_parser_placeholder_type_specifier): Correctly handle
749 concept-check expressions.
750
751 2020-01-15 Jason Merrill <jason@redhat.com>
752
753 Revert
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.
758
759 PR c++/93257 - consteval void function.
760 * constexpr.c (verify_constant): Allow void_node.
761
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.
765
766 2020-01-14 Nathan Sidwell <nathan@acm.org>
767
768 PR c++/90916
769 * pt.c (retrieve_specialization): Use get_template_info, not open
770 coding access.
771
772 PR c++/90916
773 * pt.c (retrieve_specialization): Get the TI from the decl or the
774 classtype as appropriate.
775
776 2020-01-14 David Malcolm <dmalcolm@redhat.com>
777
778 * cp-gimplify.c (source_location_table_entry_hash::empty_zero_p):
779 New static constant.
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.
783
784 2020-01-14 Jason Merrill <jason@redhat.com>
785
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.
789 Revert:
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.
799
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.
803
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
807 REINTERPRET_CAST_P.
808
809 2020-01-13 Jason Merrill <jason@redhat.com>
810
811 PR c++/92746 - ICE with noexcept of function concept check.
812 * except.c (check_noexcept_r): Handle concept-check.
813
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.
819
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.
824
825 PR c++/93238 - short right-shift with enum.
826 * typeck.c (cp_build_binary_op): Use folded op1 for short_shift.
827
828 2020-01-10 Jason Merrill <jason@redhat.com>
829
830 * typeck.c (cp_build_binary_op): Restore short_shift code.
831
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.
835
836 PR c++/93173 - incorrect tree sharing.
837 PR c++/93033
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.
841
842 2020-01-08 Jason Merrill <jason@redhat.com>
843
844 * cp-gimplify.c (cp_gimplify_expr) [TARGET_EXPR]: Check
845 TARGET_EXPR_DIRECT_INIT_P.
846 * constexpr.c (cxx_eval_constant_expression): Likewise.
847
848 2020-01-08 Jason Merrill <jason@redhat.com>
849
850 PR c++/91369 - constexpr destructor and member initializer.
851 * constexpr.c (cxx_eval_store_expression): Look through TARGET_EXPR
852 when not preevaluating.
853
854 2020-01-08 Jason Merrill <jason@redhat.com>
855
856 * constexpr.c (cxx_eval_call_expression): Remove DECL_BY_REFERENCE
857 support.
858
859 2020-01-07 Paolo Carlini <paolo.carlini@oracle.com>
860
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.
866
867 2020-01-07 Jason Merrill <jason@redhat.com>
868
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.
872
873 2020-01-07 Richard Sandiford <richard.sandiford@arm.com>
874
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.
878
879 2020-01-07 Jakub Jelinek <jakub@redhat.com>
880
881 PR c++/91369
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.
888
889 2020-01-06 Jason Merrill <jason@redhat.com>
890
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.
895
896 2020-01-06 Andrew Sutton <asutton@lock3software.com>
897
898 PR c++/92739 - parsing requires clause with attributes.
899 * parser.c (cp_parser_constraint_requires_parens): Exclude
900 attributes as postfix expressions.
901
902 2020-01-05 Jakub Jelinek <jakub@redhat.com>
903
904 PR c++/93138
905 * parser.c (cp_parser_check_class_key): Disable access checks for the
906 simple name lookup.
907 (cp_parser_maybe_warn_enum_key): Likewise. Return early if
908 !warn_redundant_tags.
909
910 2010-01-05 Jakub Jelinek <jakub@redhat.com>
911
912 PR c++/93046
913 * cp-gimplify.c (cp_gimplify_init_expr): Don't look through
914 TARGET_EXPR if it has been gimplified already.
915
916 2020-01-03 Jason Merrill <jason@redhat.com>
917
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.
921
922 2020-01-02 Jason Merrill <jason@redhat.com>
923
924 * pt.c (invalid_nontype_parm_type_p): Reject class placeholder in
925 C++17.
926
927 2020-01-02 Jakub Jelinek <jakub@redhat.com>
928
929 PR c/90677
930 * cp-objcp-common.c (identifier_global_tag): Return NULL_TREE if name
931 has not been found, rather than error_mark_node.
932
933 2020-01-01 Jakub Jelinek <jakub@redhat.com>
934
935 Update copyright years.
936 \f
937 Copyright (C) 2020 Free Software Foundation, Inc.
938
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.