]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/cp/ChangeLog
PR c++/90190 - CTAD with list-constructor.
[thirdparty/gcc.git] / gcc / cp / ChangeLog
1 2019-04-19 Jason Merrill <jason@redhat.com>
2
3 PR c++/90190 - CTAD with list-constructor.
4 * pt.c (do_class_deduction): Don't try the single element deduction
5 if the single element is also a braced list.
6
7 PR c++/90171 - ICE with destroying delete with size_t parm.
8 * call.c (sized_deallocation_fn_p): New. Use it instead of
9 second_parm_is_size_t in most cases.
10 (second_parm_is_size_t): Don't check for aligned.
11
12 2019-04-19 Paolo Carlini <paolo.carlini@oracle.com>
13
14 PR c++/89900
15 * pt.c (fn_type_unification): When handling null explicit
16 arguments do not special case non-parameter packs.
17
18 2019-04-19 Jakub Jelinek <jakub@redhat.com>
19
20 PR c++/90138
21 * pt.c (process_template_parm): Set decl to pushdecl result. If
22 !is_non_type, also set parm to that.
23
24 PR c/89888
25 * decl.c (struct cp_switch): Remove outside_range_p member.
26 (push_switch): Don't clear it.
27 (pop_switch): Adjust c_do_switch_warnings caller.
28 (finish_case_label): Adjust c_add_case_label caller.
29
30 PR c++/90108
31 * decl.c (duplicate_decls): If remove is main variant and
32 DECL_ORIGINAL_TYPE is some other type, remove a DECL_ORIGINAL_TYPE
33 variant that has newdecl as TYPE_NAME if any.
34
35 2019-04-18 Jason Merrill <jason@redhat.com>
36
37 PR c++/87554 - ICE with extern template and reference member.
38 * decl.c (cp_finish_decl): Don't set DECL_INITIAL of external vars.
39
40 2019-04-17 Jason Merrill <jason@redhat.com>
41
42 PR c++/90047 - ICE with enable_if alias template.
43 * pt.c (tsubst_decl) [TYPE_DECL]: Don't put an erroneous decl in the
44 hash table when we're in SFINAE context.
45
46 2019-04-17 Marek Polacek <polacek@redhat.com>
47
48 PR c++/90124 - bogus error with incomplete type in decltype.
49 * typeck.c (build_class_member_access_expr): Check
50 cp_unevaluated_operand.
51
52 2019-04-12 Jakub Jelinek <jakub@redhat.com>
53
54 PR c/89933
55 * decl.c (duplicate_decls): When newdecl's type is its main variant,
56 don't try to remove it from the variant list, but instead assert
57 it has no variants.
58
59 2019-04-12 Martin Sebor <msebor@redhat.com>
60
61 PR c/88383
62 PR c/89288
63 * parser.c (cp_parser_has_attribute_expression): Handle assignment
64 expressions.
65
66 2019-04-12 Jason Merrill <jason@redhat.com>
67
68 * call.c (null_member_pointer_value_p): Handle an empty CONSTRUCTOR
69 of PMF type.
70
71 2019-04-12 Marek Polacek <polacek@redhat.com>
72
73 * except.c (build_noexcept_spec): Use build_converted_constant_bool_expr
74 instead of perform_implicit_conversion_flags.
75
76 PR c++/87603 - constexpr functions are no longer noexcept.
77 * constexpr.c (is_sub_constant_expr): Remove unused function.
78 * cp-tree.h (is_sub_constant_expr): Remove declaration.
79 * except.c (check_noexcept_r): Don't consider a call to a constexpr
80 function noexcept.
81
82 2019-04-11 Jakub Jelinek <jakub@redhat.com>
83
84 PR translation/90035
85 * parser.h (struct cp_parser): Add
86 type_definition_forbidden_message_arg member.
87 * parser.c (cp_debug_parser): Print it.
88 (cp_parser_check_type_definition): Pass
89 parser->type_definition_forbidden_message_arg as second argument to
90 error.
91 (cp_parser_has_attribute_expression, cp_parser_sizeof_operand): Set
92 parser->type_definition_forbidden_message_arg and use G_() with
93 %qs for parser->type_definition_forbidden_message instead of
94 building untranslatable message using concat.
95
96 2019-04-09 Jakub Jelinek <jakub@redhat.com>
97
98 PR translation/90011
99 * typeck2.c (check_narrowing): Remove trailing space from diagnostics.
100
101 2019-04-08 Marek Polacek <polacek@redhat.com>
102
103 * typeck2.c (digest_init_r): Don't condition the object slicing warning
104 on flag_checking.
105
106 2019-04-08 Paolo Carlini <paolo.carlini@oracle.com>
107
108 PR c++/89914
109 * semantics.c (trait_expr_value): Don't use TYPE_NOTHROW_P
110 when maybe_instantiate_noexcept fails.
111 (classtype_has_nothrow_assign_or_copy_p): Likewise.
112 * method.c (implicitly_declare_fn): Avoid passing error_mark_node
113 to build_exception_variant.
114
115 2019-04-05 Marek Polacek <polacek@redhat.com>
116
117 PR c++/87145 - bogus error converting class type in template arg list.
118 * pt.c (convert_nontype_argument): Don't call
119 build_converted_constant_expr if it could involve calling a conversion
120 function with a instantiation-dependent constructor as its argument.
121
122 2019-04-05 Martin Sebor <msebor@redhat.com>
123
124 PR bootstrap/89980
125 * decl.c (reshape_init_array_1): Avoid treating empty strings
126 as zeros in array initializers.
127 Use trivial_type_p () instead of TYPE_HAS_TRIVIAL_DFLT().
128
129 2019-04-04 Jason Merrill <jason@redhat.com>
130
131 PR c++/89948 - ICE with break in statement-expr.
132 * constexpr.c (cxx_eval_statement_list): Jumping out of a
133 statement-expr is non-constant.
134
135 2019-04-04 Jason Merrill <jason@redhat.com>
136
137 PR c++/89966 - error with non-type auto tparm.
138 * pt.c (do_auto_deduction): Clear tf_partial.
139
140 2019-04-04 Jason Merrill <jason@redhat.com>
141
142 PR c++/86986 - ICE with TTP with parameter pack.
143 * pt.c (coerce_template_parameter_pack): Only look at the type of a
144 non-type parameter pack.
145 (fixed_parameter_pack_p_1): Don't recurse into the type of a
146 non-type parameter pack.
147 (coerce_template_template_parms): Call add_outermost_template_args.
148
149 2019-04-04 Martin Sebor <msebor@redhat.com>
150
151 PR c++/89974
152 PR c++/89878
153 PR c++/89833
154 PR c++/47488
155 * decl.c (reshape_init_array_1): Strip trailing zero-initializers
156 from arrays of trivial type and known size.
157 * mangle.c (write_expression): Convert braced initializer lists
158 to STRING_CSTs.
159 (write_expression): Trim trailing zero-initializers from arrays
160 of trivial type.
161 (write_template_arg_literal): Mangle strings the same as braced
162 initializer lists.
163
164 2019-04-03 Jason Merrill <jason@redhat.com>
165
166 PR c++/81866 - ICE with member template and default targ.
167 * pt.c (tsubst_template_decl): Handle getting a type from
168 retrieve_specialization.
169
170 PR c++/86586 - -fcompare-debug=-Wsign-compare.
171 * typeck.c (cp_build_binary_op): Don't fold for -Wsign-compare.
172
173 PR c++/89331 - ICE with offsetof in incomplete class.
174 * semantics.c (finish_offsetof): Handle error_mark_node.
175 * typeck.c (build_class_member_access_expr): Call
176 complete_type_or_maybe_complain before converting to base.
177
178 PR c++/89917 - ICE with lambda in variadic mem-init.
179 * pt.c (make_pack_expansion): Change type_pack_expansion_p to false.
180
181 2019-04-01 Jason Merrill <jason@redhat.com>
182
183 PR c++/86946 - ICE with function call in template argument.
184 DR 1321
185 * pt.c (iterative_hash_template_arg) [CALL_EXPR]: Use
186 dependent_name.
187
188 2019-04-01 Paolo Carlini <paolo.carlini@oracle.com>
189
190 PR c++/62207
191 * pt.c (tsubst_copy): Deal with lookup_name not returing a variable.
192
193 2019-03-31 Marek Polacek <polacek@redhat.com>
194
195 PR c++/89852 - ICE with C++11 functional cast with { }.
196 * constexpr.c (fold_non_dependent_expr_template): New static function
197 broken out of...
198 (fold_non_dependent_expr): ...here.
199 (fold_non_dependent_init): New function.
200 * cp-tree.h (fold_non_dependent_init): Declare.
201 * typeck2.c (massage_init_elt): Call fold_non_dependent_init instead
202 of fold_non_dependent_expr. Don't call maybe_constant_init.
203
204 2019-03-30 Jason Merrill <jason@redhat.com>
205
206 PR c++/89744 - ICE with specialization of member class template.
207 * pt.c (lookup_template_class_1): If the partial instantiation is
208 explicitly specialized, adjust.
209 (maybe_process_partial_specialization): Also adjust
210 CLASSTYPE_TI_ARGS.
211
212 2019-03-29 Jakub Jelinek <jakub@redhat.com>
213
214 PR sanitizer/89869
215 * typeck.c: Include gimplify.h.
216 (cp_build_modify_expr) <case COND_EXPR>: Unshare rhs before using it
217 for second time. Formatting fixes.
218
219 2019-03-29 Marek Polacek <polacek@redhat.com>
220
221 PR c++/89876 - ICE with deprecated conversion.
222 * call.c (convert_like_real): Only give warnings with tf_warning.
223
224 2019-03-28 Marek Polacek <polacek@redhat.com>
225
226 PR c++/89612 - ICE with member friend template with noexcept.
227 * pt.c (maybe_instantiate_noexcept): For function templates, use their
228 template result (function decl). Don't set up local specializations.
229 Temporarily turn on processing_template_decl. Update the template type
230 too.
231
232 PR c++/89836 - bool constant expression and explicit conversions.
233 * call.c (build_converted_constant_expr_internal): New function,
234 renamed from...
235 (build_converted_constant_expr): ...this. New.
236 (build_converted_constant_bool_expr): New.
237 * cp-tree.h (build_converted_constant_bool_expr): Declare.
238 * decl.c (build_explicit_specifier): Call
239 build_converted_constant_bool_expr.
240
241 2019-03-28 Jakub Jelinek <jakub@redhat.com>
242
243 PR c++/89785
244 * constexpr.c (struct check_for_return_continue_data): New type.
245 (check_for_return_continue): New function.
246 (potential_constant_expression_1) <case SWITCH_STMT>: Walk
247 SWITCH_STMT_BODY to find RETURN_EXPRs or CONTINUE_STMTs not nested
248 in loop bodies and set *jump_target to that if found.
249
250 2019-03-27 Jason Merrill <jason@redhat.com>
251
252 PR c++/89831 - error with qualified-id in const member function.
253 * semantics.c (finish_non_static_data_member): Use object cv-quals
254 in scoped case, too.
255
256 PR c++/89421 - ICE with lambda in template parameter list.
257 * parser.c (cp_parser_lambda_expression): Also reject a lambda in a
258 template parameter list before C++20.
259 * pt.c (type_dependent_expression_p): True for LAMBDA_EXPR.
260 * semantics.c (begin_class_definition): Restore error about defining
261 non-lambda class in template parm list.
262
263 2019-03-26 Jason Merrill <jason@redhat.com>
264
265 PR c++/86932 - missed SFINAE with empty pack.
266 * pt.c (coerce_template_parms): Don't add an empty pack if
267 tf_partial.
268 (fn_type_unification): Pass tf_partial to coerce_template_parms.
269
270 PR c++/86429 - constexpr variable in lambda.
271 PR c++/82643
272 PR c++/87327
273 * constexpr.c (cxx_eval_constant_expression): In a lambda function,
274 try evaluating the captured variable directly.
275
276 2019-03-26 Jakub Jelinek <jakub@redhat.com>
277
278 PR c++/89796
279 * semantics.c (finish_omp_atomic): Add warning_sentinel for
280 -Wunused-value around finish_expr_stmt call.
281
282 2019-03-25 Paolo Carlini <paolo.carlini@oracle.com>
283
284 PR c++/84661
285 PR c++/85013
286 * parser.c (cp_parser_binary_expression): Don't call cp_fully_fold
287 to undo the disabling of warnings.
288
289 2019-03-25 Jason Merrill <jason@redhat.com>
290
291 PR c++/87748 - substitution failure error with decltype.
292 * pt.c (most_specialized_partial_spec): Clear
293 processing_template_decl.
294
295 2019-03-25 Marek Polacek <polacek@redhat.com>
296
297 PR c++/89214 - ICE when initializing aggregates with bases.
298 * typeck2.c (digest_init_r): Warn about object slicing instead of
299 crashing.
300
301 PR c++/89705 - ICE with reference binding with conversion function.
302 * call.c (reference_binding): If the result of the conversion function
303 is a prvalue of non-class type, use the cv-unqualified type.
304
305 2019-03-25 Nathan Sidwell <nathan@acm.org>
306
307 * lambda.c (maybe_add_lambda_conv_op): Don't add to comdat group.
308
309 2019-03-22 Jakub Jelinek <jakub@redhat.com>
310
311 PR c++/60702
312 * cp-tree.h (get_tls_wrapper_fn): Remove declaration.
313 (maybe_get_tls_wrapper_call): Declare.
314 * decl2.c (get_tls_wrapper_fn): Make static.
315 (maybe_get_tls_wrapper_call): New function.
316 * typeck.c (build_class_member_access_expr): Handle accesses to TLS
317 variables.
318 * semantics.c (finish_qualified_id_expr): Likewise.
319 (finish_id_expression_1): Use maybe_get_tls_wrapper_call.
320 * pt.c (tsubst_copy_and_build): Likewise.
321
322 PR c++/87481
323 * constexpr.c (struct constexpr_ctx): Add constexpr_ops_count member.
324 (cxx_eval_constant_expression): When not skipping, not constant class
325 or location wrapper, increment *ctx->constexpr_ops_count and if it is
326 above constexpr_loop_nest_limit, diagnose failure.
327 (cxx_eval_outermost_constant_expr): Add constexpr_ops_count and
328 initialize ctx.constexpr_ops_count to its address.
329 (is_sub_constant_expr): Likewise.
330
331 2019-03-21 Jakub Jelinek <jakub@redhat.com>
332
333 PR c++/71446
334 * call.c (filed_in_pset): Change pset from hash_set<tree> * to
335 hash_set<tree, true> &, adjust uses accordingly.
336 (build_aggr_conv): Change pset from hash_set<tree> *
337 to hash_set<tree, true>. Replace goto fail; with return NULL;,
338 adjust pset uses.
339
340 PR c++/89767
341 * parser.c (cp_parser_lambda_introducer): Add ids and first_capture_id
342 variables, check for duplicates in this function.
343 * lambda.c (add_capture): Don't check for duplicates nor use
344 IDENTIFIER_MARKED.
345 (register_capture_members): Don't clear IDENTIFIER_MARKED here.
346
347 2019-03-21 Paolo Carlini <paolo.carlini@oracle.com>
348
349 PR c++/89571
350 * method.c (after_nsdmi_defaulted_late_checks): Avoid passing
351 error_mark_node to comp_except_specs.
352
353 2019-03-20 Jason Merrill <jason@redhat.com>
354
355 PR c++/87480 - decltype of member access in default template arg
356 * pt.c (type_unification_real): Accept a dependent result in
357 template context.
358
359 2019-03-19 Martin Sebor <msebor@redhat.com>
360
361 PR tree-optimization/89688
362 * typeck2.c (store_init_value): Call braced_lists_to_string for more
363 kinds of initializers.
364
365 2019-03-18 Jason Merrill <jason@redhat.com>
366
367 PR c++/89630 - ICE with dependent using-decl as template arg.
368 * tree.c (cp_tree_equal): Always return false for USING_DECL.
369
370 PR c++/89761 - ICE with sizeof... in pack expansion.
371 * pt.c (argument_pack_element_is_expansion_p): Handle
372 ARGUMENT_PACK_SELECT.
373
374 PR c++/89640 - GNU attributes on lambda.
375 * parser.c (cp_parser_lambda_declarator_opt): Allow GNU attributes.
376
377 PR c++/89682 - wrong access error in default argument.
378 * pt.c (tsubst_default_argument): Don't defer access checks.
379
380 2019-03-18 Paolo Carlini <paolo.carlini@oracle.com>
381
382 PR c++/85014
383 * semantics.c (finish_non_static_data_member): Check return value
384 of context_for_name_lookup and immediately return error_mark_node
385 if isn't a type.
386
387 2019-03-17 Jason Merrill <jason@redhat.com>
388
389 PR c++/89571 - ICE with ill-formed noexcept on constructor.
390 * pt.c (maybe_instantiate_noexcept): Only return false if defaulted.
391 (regenerate_decl_from_template): Use it for noexcept-specs.
392
393 2019-03-14 Jason Merrill <jason@redhat.com>
394
395 * parser.c (cp_parser_decl_specifier_seq): Support C++20
396 concept-definition syntax without 'bool'.
397
398 2019-03-14 Jakub Jelinek <jakub@redhat.com>
399
400 PR c++/89512
401 * semantics.c (finish_qualified_id_expr): Reject variable templates.
402
403 PR c++/89652
404 * constexpr.c (struct constexpr_ctx): Change save_exprs type from
405 hash_set<tree> to vec<tree>.
406 (cxx_eval_call_expression): Adjust for save_exprs being a vec instead
407 of hash_set.
408 (cxx_eval_loop_expr): Likewise. Truncate the vector after each
409 removal of SAVE_EXPRs from values.
410 (cxx_eval_constant_expression) <case SAVE_EXPR>: Call safe_push
411 method on save_exprs instead of add.
412
413 2019-03-13 Jason Merrill <jason@redhat.com>
414
415 PR c++/86521 - C++17 copy elision in initialization by constructor.
416 * call.c (joust_maybe_elide_copy): New.
417 (joust): Call it.
418
419 2019-03-13 Marek Polacek <polacek@redhat.com>
420
421 PR c++/88979 - further P0634 fix for constructors.
422 * parser.c (cp_parser_decl_specifier_seq): Pass flags to
423 cp_parser_constructor_declarator_p.
424 (cp_parser_direct_declarator): Allow missing typename for constructor
425 parameters.
426 (cp_parser_constructor_declarator_p): Add FLAGS parameter. Pass it to
427 cp_parser_type_specifier.
428
429 PR c++/89686 - mixing init-capture and simple-capture in lambda.
430 * parser.c (cp_parser_lambda_introducer): Give error when combining
431 init-capture and simple-capture.
432
433 PR c++/89660 - bogus error with -Wredundant-move.
434 * typeck.c (maybe_warn_pessimizing_move): Only accept (T &) &arg
435 as the std::move's argument. Don't call convert_for_initialization
436 when warn_redundant_move isn't on.
437
438 2019-03-11 Jason Merrill <jason@redhat.com>
439
440 PR c++/86521 - wrong overload resolution with ref-qualifiers.
441 * call.c (build_user_type_conversion_1): Don't use a conversion to a
442 reference of the wrong rvalueness for direct binding.
443
444 2019-03-11 Martin Liska <mliska@suse.cz>
445
446 * cvt.c (build_expr_type_conversion): Wrap apostrophes
447 in gcc internal format with %'.
448 * decl.c (check_no_redeclaration_friend_default_args): Likewise.
449 (grokfndecl): Likewise.
450 * name-lookup.c (do_pushtag): Likewise.
451 * pt.c (unify_parameter_deduction_failure): Likewise.
452 (unify_template_deduction_failure): Likewise.
453
454 2019-03-11 Martin Liska <mliska@suse.cz>
455
456 * call.c (convert_arg_to_ellipsis): Wrap an option name
457 in a string format message and fix GNU coding style.
458 (build_over_call): Likewise.
459 * class.c (check_field_decl): Likewise.
460 (layout_nonempty_base_or_field): Likewise.
461 * constexpr.c (cxx_eval_loop_expr): Likewise.
462 * cvt.c (type_promotes_to): Likewise.
463 * decl.c (cxx_init_decl_processing): Likewise.
464 (mark_inline_variable): Likewise.
465 (grokdeclarator): Likewise.
466 * decl2.c (record_mangling): Likewise.
467 * error.c (maybe_warn_cpp0x): Likewise.
468 * except.c (doing_eh): Likewise.
469 * mangle.c (maybe_check_abi_tags): Likewise.
470 * parser.c (cp_parser_diagnose_invalid_type_name): Likewise.
471 (cp_parser_userdef_numeric_literal): Likewise.
472 (cp_parser_primary_expression): Likewise.
473 (cp_parser_unqualified_id): Likewise.
474 (cp_parser_pseudo_destructor_name): Likewise.
475 (cp_parser_builtin_offsetof): Likewise.
476 (cp_parser_lambda_expression): Likewise.
477 (cp_parser_lambda_introducer): Likewise.
478 (cp_parser_lambda_declarator_opt): Likewise.
479 (cp_parser_selection_statement): Likewise.
480 (cp_parser_init_statement): Likewise.
481 (cp_parser_decomposition_declaration): Likewise.
482 (cp_parser_function_specifier_opt): Likewise.
483 (cp_parser_static_assert): Likewise.
484 (cp_parser_simple_type_specifier): Likewise.
485 (cp_parser_namespace_definition): Likewise.
486 (cp_parser_using_declaration): Likewise.
487 (cp_parser_ctor_initializer_opt_and_function_body): Likewise.
488 (cp_parser_initializer_list): Likewise.
489 (cp_parser_type_parameter_key): Likewise.
490 (cp_parser_member_declaration): Likewise.
491 (cp_parser_try_block): Likewise.
492 (cp_parser_std_attribute_spec): Likewise.
493 (cp_parser_requires_clause_opt): Likewise.
494 * pt.c (check_template_variable): Likewise.
495 (check_default_tmpl_args): Likewise.
496 (push_tinst_level_loc): Likewise.
497 (instantiate_pending_templates): Likewise.
498 (invalid_nontype_parm_type_p): Likewise.
499 * repo.c (get_base_filename): Likewise.
500 * rtti.c (typeid_ok_p): Likewise.
501 (build_dynamic_cast_1): Likewise.
502 * tree.c (maybe_warn_parm_abi): Likewise.
503
504 2019-03-08 Jakub Jelinek <jakub@redhat.com>
505
506 PR other/80058
507 * parser.c (cp_parser_template_declaration_after_parameters): Avoid
508 one space before " at the end of line and another after " on another
509 line in a string literal.
510
511 PR tree-optimization/89550
512 * semantics.c (maybe_convert_cond): Only set TREE_NO_WARNING if
513 warning_at returned true.
514 * decl2.c (c_parse_final_cleanups): Likewise.
515 * typeck.c (convert_for_assignment): Likewise.
516 * decl.c (finish_function): Likewise.
517
518 PR c++/89585
519 * parser.c (cp_parser_asm_definition): Just warn instead of error
520 on volatile qualifier outside of function body.
521
522 PR c++/89599
523 * constexpr.c (potential_constant_expression_1): Reject
524 REINTERPRET_CAST_P NOP_EXPRs.
525
526 PR c++/89622
527 * call.c (joust): Call print_z_candidate only if pedwarn returned
528 true.
529
530 2019-03-07 Jason Merrill <jason@redhat.com>
531
532 PR c++/88123 - lambda and using-directive.
533 * name-lookup.c (op_unqualified_lookup)
534 (maybe_save_operator_binding, discard_operator_bindings)
535 (push_operator_bindings): New.
536 * typeck.c (build_x_binary_op, build_x_unary_op): Call
537 maybe_save_operator_binding.
538 * decl.c (start_preparsed_function): Call push_operator_bindings.
539 * tree.c (cp_free_lang_data): Call discard_operator_bindings.
540
541 PR c++/88820 - ICE with CTAD and member template used in DMI.
542 * pt.c (do_class_deduction): Handle parm used as its own arg.
543
544 2019-03-07 Jakub Jelinek <jakub@redhat.com>
545
546 PR c++/89585
547 * parser.c (cp_parser_asm_definition): Parse asm qualifiers even
548 at toplevel, but diagnose them.
549
550 2019-03-06 Jason Merrill <jason@redhat.com>
551
552 PR c++/89381 - implicit copy and using-declaration.
553 * class.c (classtype_has_move_assign_or_move_ctor_p): Don't consider
554 op= brought in by a using-declaration.
555
556 2019-03-06 Jakub Jelinek <jakub@redhat.com>
557
558 PR c++/87148
559 * init.c (build_value_init_noctor): Ignore flexible array members.
560
561 2019-03-06 Jason Merrill <jason@redhat.com>
562
563 PR c++/89576 - if constexpr of lambda capture.
564 * semantics.c (maybe_convert_cond): Do convert a non-dependent
565 condition in a template.
566 * typeck.c (condition_conversion): Handle being called in a
567 template.
568
569 2019-03-06 Marek Polacek <polacek@redhat.com>
570
571 PR c++/87378 - bogus -Wredundant-move warning.
572 * typeck.c (maybe_warn_pessimizing_move): See if the maybe-rvalue
573 overload resolution would actually succeed.
574
575 2019-03-05 Jason Merrill <jason@redhat.com>
576
577 * class.c (is_really_empty_class): Add ignore_vptr parm.
578 (trivial_default_constructor_is_constexpr): Pass it.
579 * call.c (build_over_call): Pass it.
580 * constexpr.c (cxx_eval_constant_expression): Pass it instead of
581 checking TYPE_POLYMORPHIC_P.
582 (cxx_eval_component_reference, potential_constant_expression_1):
583 Pass it.
584 * cp-gimplify.c (simple_empty_class_p): Pass it.
585 * init.c (expand_aggr_init_1): Pass it.
586
587 2019-03-04 Paolo Carlini <paolo.carlini@oracle.com>
588
589 PR c++/84605
590 * parser.c (cp_parser_class_head): Reject TYPE_BEING_DEFINED too.
591
592 2019-03-04 Jakub Jelinek <jakub@redhat.com>
593
594 PR c++/71446
595 * call.c (field_in_pset): New function.
596 (build_aggr_conv): Handle CONSTRUCTOR_IS_DESIGNATED_INIT correctly.
597
598 2019-03-02 Jakub Jelinek <jakub@redhat.com>
599
600 PR c++/71446
601 * cp-tree.h (CONSTRUCTOR_IS_DESIGNATED_INIT): Define.
602 * parser.c (cp_parser_braced_list): Adjust cp_parser_initializer_list
603 caller, set CONSTRUCTOR_IS_DESIGNATED_INIT.
604 (cp_parser_initializer_list): Add designated parameter, set *designated
605 to a bool whether any designators were parsed.
606 * decl.c (reshape_init): Copy over CONSTRUCTOR_IS_DESIGNATED_INIT if
607 needed.
608 * pt.c (tsubst_copy_and_build): Likewise.
609 * call.c (implicit_conversion): If CONSTRUCTOR_IS_DESIGNATED_INIT,
610 don't call build_list_conv, nor build_complex_conv, nor attempt to
611 convert a single element initializer to scalar.
612
613 2019-03-01 Marek Polacek <polacek@redhat.com>
614
615 PR c++/89537 - missing location for error with non-static member fn.
616 * call.c (resolve_args): Use EXPR_LOCATION.
617 * typeck.c (build_class_member_access_expr): Use input_location.
618
619 PR c++/89532 - ICE with incomplete type in decltype.
620 * semantics.c (finish_compound_literal): Return error_mark_node
621 if digest_init_flags returns error_mark_node.
622
623 2019-03-01 Jakub Jelinek <jakub@redhat.com>
624
625 Implement P1002R1, Try-catch blocks in constexpr functions
626 PR c++/89513
627 * parser.c (cp_parser_ctor_initializer_opt_and_function_body):
628 Diagnose constexpr ctor or function with function-try-block with
629 pedwarn for c++17 and earlier. Formatting fix.
630 (cp_parser_try_block): Use pedwarn instead of error and only for
631 c++17 and earlier when try block appears in constexpr function.
632 * constexpr.c (build_constexpr_constructor_member_initializers):
633 Handle TRY_BLOCK here instead of erroring on it.
634
635 2019-02-28 Jason Merrill <jason@redhat.com>
636
637 PR c++/88183 - ICE with .* fold-expression.
638 * pt.c (fold_expression) [DOTSTAR_EXPR]: Remove special handling.
639
640 PR c++/86969 - ICE with constexpr if and recursive generic lambdas.
641 * class.c, lambda.c, pt.c: Revert earlier change.
642 * lambda.c (add_capture): Don't special-case capture of dependent
643 VLA.
644
645 * name-lookup.c (print_binding_level): Print this_entity.
646
647 2019-02-27 Marek Polacek <polacek@redhat.com>
648
649 PR c++/88857 - ICE with value-initialization of argument in template.
650 * call.c (convert_like_real): Don't call build_value_init in template.
651
652 2019-02-27 Jason Merrill <jason@redhat.com>
653
654 PR c++/86969 - ICE with constexpr if and recursive generic lambdas.
655 * semantics.c (process_outer_var_ref): Do capture dependent vars.
656 * class.c (finish_struct): Only add TAG_DEFN if T is in
657 current_function_decl.
658 * lambda.c (vla_capture_type): Force the capture type out into the
659 lambda's enclosing function.
660 (add_capture): Pass in the lambda.
661 * pt.c (tsubst_lambda_expr): complete_type a VLA capture type.
662
663 2019-02-27 Marek Polacek <polacek@redhat.com>
664
665 PR c++/89511 - ICE with using-declaration and unscoped enumerator.
666 * parser.c (cp_parser_using_declaration): For an unscoped enum
667 only use its context if it's not a function declaration.
668
669 2019-02-27 Paolo Carlini <paolo.carlini@oracle.com>
670
671 PR c++/89488
672 * method.c (process_subob_fn): When maybe_instantiate_noexcept
673 returns false don't call merge_exception_specifiers.
674
675 2019-02-27 Paolo Carlini <paolo.carlini@oracle.com>
676
677 PR c++/88987
678 * parser.c (cp_parser_noexcept_specification_opt): Return NULL_TREE
679 for a non-constant parsed expression.
680
681 2019-02-26 Jakub Jelinek <jakub@redhat.com>
682
683 PR c++/89481
684 * constexpr.c (cxx_eval_store_expression): When changing active union
685 member, set no_zero_init.
686
687 2019-02-23 Marek Polacek <polacek@redhat.com>
688
689 PR c++/88294 - ICE with non-constant noexcept-specifier.
690 * pt.c (maybe_instantiate_noexcept): Set up the list of local
691 specializations. Set current_class_{ptr,ref}.
692
693 2019-02-22 David Malcolm <dmalcolm@redhat.com>
694
695 PR c++/89390
696 * parser.c (cp_parser_unqualified_id): Capture and use locations
697 for destructors.
698
699 2019-02-22 Marek Polacek <polacek@redhat.com>
700
701 PR c++/89420 - ICE with CAST_EXPR in explicit-specifier.
702 * decl.c (build_explicit_specifier): Don't check
703 processing_template_decl. Call instantiation_dependent_expression_p
704 instead of value_dependent_expression_p. Call
705 instantiate_non_dependent_expr_sfinae before
706 build_converted_constant_expr instead of calling
707 instantiate_non_dependent_expr after it. Add
708 processing_template_decl_sentinel.
709
710 2019-02-22 Thomas Schwinge <thomas@codesourcery.com>
711
712 * parser.c (cp_parser_oacc_simple_clause): Remove parser formal
713 parameter, move loc formal parameter to the front. Adjust all
714 users.
715 (cp_parser_oacc_shape_clause): Add loc formal parameter. Adjust
716 all users.
717
718 2019-02-21 Jason Merrill <jason@redhat.com>
719
720 PR c++/87685 - generic lambda 'this' capture error.
721 * lambda.c (lambda_expr_this_capture): Change add_capture_p to int.
722 (maybe_generic_this_capture): Pass -1.
723
724 PR c++/88394 - ICE with VLA init-capture.
725 * lambda.c (is_normal_capture_proxy): Check DECL_CAPTURED_VARIABLE.
726
727 PR c++/88869 - C++17 ICE with CTAD and explicit specialization.
728 * pt.c (do_class_deduction): Don't include explicit specialization
729 args in outer_args.
730
731 PR c++/89422 - ICE with -g and lambda in default arg in template.
732 * pt.c (tsubst_function_decl): SET_DECL_FRIEND_CONTEXT sooner.
733
734 2019-02-21 Jason Merrill <jason@redhat.com>
735
736 PR c++/88419 - C++17 ICE with class template arg deduction.
737 * pt.c (make_template_placeholder): Set TYPE_CANONICAL after
738 CLASS_PLACEHOLDER_TEMPLATE.
739
740 2019-02-21 Jakub Jelinek <jakub@redhat.com>
741
742 PR c++/89285
743 * constexpr.c (struct constexpr_fundef): Add parms and result members.
744 (retrieve_constexpr_fundef): Adjust for the above change.
745 (register_constexpr_fundef): Save constexpr body with copy_fn,
746 temporarily set DECL_CONTEXT on DECL_RESULT before that.
747 (get_fundef_copy): Change FUN argument to FUNDEF with
748 constexpr_fundef * type, grab body and parms/result out of
749 constexpr_fundef struct and temporarily change it for copy_fn calls
750 too.
751 (cxx_eval_builtin_function_call): For __builtin_FUNCTION temporarily
752 adjust current_function_decl from ctx->call context. Test
753 !potential_constant_expression instead of !is_constant_expression.
754 (cxx_bind_parameters_in_call): Grab parameters from new_call. Undo
755 convert_for_arg_passing changes for TREE_ADDRESSABLE type passing.
756 (cxx_eval_call_expression): Adjust get_fundef_copy caller.
757 (cxx_eval_conditional_expression): For IF_STMT, allow then or else
758 operands to be NULL.
759 (label_matches): Handle BREAK_STMT and CONTINUE_STMT.
760 (cxx_eval_loop_expr): Add support for FOR_STMT, WHILE_STMT and DO_STMT.
761 (cxx_eval_switch_expr): Add support for SWITCH_STMT.
762 (cxx_eval_constant_expression): Handle IF_STMT, FOR_STMT, WHILE_STMT,
763 DO_STMT, CONTINUE_STMT, SWITCH_STMT, BREAK_STMT and CONTINUE_STMT.
764 For SIZEOF_EXPR, recurse on the result of fold_sizeof_expr. Ignore
765 DECL_EXPR with USING_DECL operand.
766 * lambda.c (maybe_add_lambda_conv_op): Build thisarg using
767 build_int_cst to make it a valid constant expression.
768
769 2019-02-20 Jason Merrill <jason@redhat.com>
770
771 PR c++/88690 - C++17 ICE with empty base in aggregate.
772 * typeck2.c (process_init_constructor_record): Skip trivial
773 initialization of an empty base.
774
775 2019-02-21 Richard Biener <rguenther@suse.de>
776
777 PR middle-end/89392
778 * vtable-class-hierarchy.c (vtv_generate_init_routine): Do not
779 make symtab process new functions here.
780
781 2019-02-20 Jason Merrill <jason@redhat.com>
782
783 PR c++/87921 - wrong error with inline static data member.
784 * decl2.c (finish_static_data_member_decl): Don't set DECL_IN_AGGR_P
785 for a non-template inline variable. Do nothing for an
786 already-instantiated variable.
787 (c_parse_final_cleanups): Check DECL_IN_AGGR_P without
788 DECL_INLINE_VAR_P.
789 * decl.c (check_initializer): Likewise.
790 (make_rtl_for_nonlocal_decl): Likewise.
791 * pt.c (instantiate_decl): Likewise.
792 * typeck2.c (store_init_value): Likewise.
793
794 2019-02-20 Jakub Jelinek <jakub@redhat.com>
795
796 PR c++/89403
797 * decl2.c (c_parse_final_cleanups): Move TREE_ASM_WRITTEN setting
798 for flag_syntax_only from here...
799 * semantics.c (expand_or_defer_fn_1): ... here.
800
801 PR c++/89405
802 * decl.c (maybe_commonize_var): When clearing TREE_PUBLIC and
803 DECL_COMMON, set DECL_INTERFACE_KNOWN.
804
805 PR c++/89336
806 * constexpr.c (cxx_eval_store_expression): Diagnose changing of active
807 union member for -std=c++17 and earlier.
808
809 2019-02-19 Jason Merrill <jason@redhat.com>
810
811 PR c++/87513 - 'sorry' mangling PMF template-id.
812 * mangle.c (write_expression): Handle SCOPE_REF to BASELINK.
813
814 2019-02-19 Jason Merrill <jason@redhat.com>
815
816 PR c++/88380 - wrong-code with flexible array and NSDMI.
817 * typeck2.c (process_init_constructor_record): Skip flexarrays.
818
819 2019-02-20 will wray <wjwray@gmail.com>
820
821 PR c++/88572 - wrong handling of braces on scalar init.
822 * decl.c (reshape_init_r): Allow braces around scalar initializer
823 within aggregate init. Reject double braced-init of scalar
824 variable.
825
826 2019-02-20 Paolo Carlini <paolo.carlini@oracle.com>
827
828 PR c++/84536
829 * pt.c (tsubst_init): Diagnose an initializer expanding to an
830 empty list of expressions; tweak wrt dependent types.
831 (regenerate_decl_from_template): For VAR_DECLs call tsubst_init
832 instead of tsubst_expr.
833
834 2019-02-19 Jason Merrill <jason@redhat.com>
835
836 PR c++/88368 - wrong 'use of deleted function'
837 * method.c (walk_field_subobs): Remember errors from get_nsdmi.
838 (get_defaulted_eh_spec): Call push_tinst_level.
839 * pt.c (maybe_instantiate_noexcept): Keep error_mark_node.
840 * typeck2.c (merge_exception_specifiers): Handle error_mark_node.
841
842 2019-02-19 Chung-Lin Tang <cltang@codesourcery.com>
843
844 PR c/87924
845 * parser.c (cp_parser_oacc_clause_wait): Add representation of wait
846 clause without argument as 'wait (GOMP_ASYNC_NOVAL)', adjust comments.
847
848 2019-02-19 Jakub Jelinek <jakub@redhat.com>
849
850 PR c++/89387
851 * lambda.c (maybe_generic_this_capture): Don't check
852 DECL_NONSTATIC_MEMBER_FUNCTION_P on USING_DECLs.
853
854 PR c++/89391
855 * typeck.c (build_reinterpret_cast_1): Don't handle void to
856 && conversion go through build_target_expr_with_type.
857
858 PR c++/89390
859 * error.c (qualified_name_lookup_error): Only call
860 suggest_alternative_in_scoped_enum if name is IDENTIFIER_NODE.
861
862 2019-02-19 Tom Honermann <tom@honermann.net>
863
864 * name-lookup.c (get_std_name_hint): Added u8string as a name hint.
865
866 2019-02-18 Jason Merrill <jason@redhat.com>
867
868 PR c++/89336 - multiple stores in constexpr stmt.
869 * constexpr.c (cxx_eval_store_expression): Preevaluate scalar or
870 assigned value.
871
872 * pt.c (check_explicit_specialization): If the declarator is a
873 template-id, only check whether the arguments are dependent.
874
875 Improve duplicate [[likely]] diagnostic.
876 * parser.c (cp_parser_statement): Make attrs_loc a range. Pass it
877 to process_stmt_hotness_attribute.
878 * cp-gimplify.c (process_stmt_hotness_attribute): Take attrs_loc.
879 (genericize_if_stmt): Use likely/unlikely instead of predictor_name.
880
881 2019-02-17 Marek Polacek <polacek@redhat.com>
882
883 PR c++/89217 - ICE with list-initialization in range-based for loop.
884 * constexpr.c (unshare_constructor): No longer static.
885 * cp-tree.h (unshare_constructor): Declare.
886 * semantics.c (finish_compound_literal): When dealing with a
887 non-dependent expression in a template, return the original
888 expression. Pass LOOKUP_NO_NARROWING to digest_init_flags.
889
890 2019-02-13 Marek Polacek <polacek@redhat.com>
891
892 PR c++/89297 - ICE with OVERLOAD in template.
893 * semantics.c (finish_compound_literal): Call
894 instantiate_non_dependent_expr_sfinae.
895
896 2019-02-13 Alexandre Oliva <aoliva@redhat.com>
897
898 PR c++/86379
899 * cp-tree.h (USING_DECL_SCOPE): Use result rather than type.
900 * name-lookup.c (strip_using_decl): Use USING_DECL_SCOPE.
901 * search.c (protected_accessible_p): Follow USING_DECL_DECLS.
902 (shared_member_p): Likewise.
903 (lookup_member): Likewise.
904 * decl.c (grok_special_member_properties): Skip USING_DECLs.
905 * semantics.c (finish_omp_declare_simd_methods): Likewise.
906 (finish_qualified_id_expr): Do not call shared_member_p with
907 a dependent expr.
908
909 PR c++/87322
910 * pt.c (tsubst_lambda_expr): Avoid duplicate tsubsting.
911 Move cp_evaluated resetting before signature tsubsting.
912 (gen_elem_of_pack_expansion_instantiation): Separate local
913 specializations per index.
914
915 2019-02-13 David Malcolm <dmalcolm@redhat.com>
916
917 PR c++/89036
918 * class.c (add_method): Drop destructor assertion.
919
920 2019-02-13 Paolo Carlini <paolo.carlini@oracle.com>
921
922 PR c++/88986
923 * decl.c (make_typename_type): Allow for TYPE_PACK_EXPANSION as
924 context (the first argument).
925 * pt.c (tsubst, case TYPENAME_TYPE): Handle TYPE_PACK_EXPANSION
926 as context.
927
928 2019-02-12 Jason Merrill <jason@redhat.com>
929
930 PR c++/89144 - link error with constexpr initializer_list.
931 * call.c (convert_like_real) [ck_list]: Don't allocate a temporary
932 array for an empty list.
933 * typeck2.c (store_init_value): Don't use cxx_constant_init in a
934 template.
935
936 2019-02-11 Jason Merrill <jason@redhat.com>
937
938 PR c++/89241 - ICE with __func__ in lambda in template.
939 * pt.c (enclosing_instantiation_of): Also check
940 instantiated_lambda_fn_p for the template context.
941
942 2019-02-11 Marek Polacek <polacek@redhat.com>
943
944 PR c++/89212 - ICE converting nullptr to pointer-to-member-function.
945 * pt.c (tsubst_copy_and_build) <case CONSTRUCTOR>: Return early for
946 null member pointer value.
947
948 2019-02-11 Jakub Jelinek <jakub@redhat.com>
949
950 PR c++/88977
951 * pt.c (convert_nontype_argument): Pass true as manifestly_const_eval
952 to maybe_constant_value calls.
953
954 2019-02-11 Marek Polacek <polacek@redhat.com>
955
956 * typeck2.c (digest_init_r): Remove commented code.
957
958 2019-02-11 Martin Sebor <msebor@redhat.com>
959
960 PR c++/87996
961 * decl.c (compute_array_index_type_loc): Preserve signed sizes
962 for diagnostics. Call valid_array_size_p instead of error.
963 * init.c (build_new_1): Compute size for diagnostic. Call
964 invalid_array_size_error
965 (build_new): Call valid_array_size_p instead of error.
966
967 2019-02-07 Alexandre Oliva <aoliva@redhat.com>
968
969 PR c++/86218
970 * call.c (compare_ics): Deal with ck_aggr in either cs.
971
972 2019-02-06 David Malcolm <dmalcolm@redhat.com>
973
974 PR c++/71302
975 * call.c (get_location_for_expr_unwinding_for_system_header): New
976 function.
977 (conversion_null_warnings): Use it when getting locations for
978 EXPR, effectively adding a call to
979 get_location_for_expr_unwinding_for_system_header for
980 -Wconversion-null and making use of EXPR_LOCATION for
981 -Wzero-as-null-pointer-constant.
982
983 2019-02-05 Jakub Jelinek <jakub@redhat.com>
984
985 PR c++/89187
986 * optimize.c (maybe_thunk_body): Clear TREE_ADDRESSABLE on
987 PARM_DECLs of the thunk.
988 * lambda.c (maybe_add_lambda_conv_op): Likewise.
989
990 2019-02-05 Marek Polacek <polacek@redhat.com>
991
992 PR c++/89158 - by-value capture of constexpr variable broken.
993 * call.c (convert_like_real) <case ck_user>: Call mark_exp_read
994 instead of mark_rvalue_use.
995
996 2019-02-05 Alexandre Oliva <aoliva@redhat.com>
997
998 PR c++/87770
999 * pt.c (instantiates_primary_template_p): New.
1000 (type_dependent_expression_p): Use it.
1001
1002 2019-02-01 Jason Merrill <jason@redhat.com>
1003
1004 PR c++/88761 - ICE with reference capture of constant.
1005 * lambda.c (mark_const_cap_r): Do walk subtrees of DECL_EXPR for
1006 non-proxy decls.
1007
1008 2019-02-01 Marek Polacek <polacek@redhat.com>
1009
1010 PR c++/88325 - ICE with invalid out-of-line template member definition.
1011 * parser.c (cp_parser_class_name): Don't call make_typename_type
1012 for overloads.
1013
1014 2019-02-01 Jakub Jelinek <jakub@redhat.com>
1015
1016 PR c++/87175
1017 * parser.c (cp_parser_gnu_attributes_opt): Set ok to false
1018 if require_open failed.
1019
1020 2019-01-31 Marek Polacek <polacek@redhat.com>
1021
1022 PR c++/89083, c++/80864 - ICE with list initialization in template.
1023 * constexpr.c (adjust_temp_type): Use copy_node and change the type
1024 instead of using build_constructor.
1025 * decl.c (reshape_init_r): Don't reshape a digested initializer.
1026 Return the initializer for COMPOUND_LITERAL_P.
1027
1028 PR c++/88983 - ICE with switch in constexpr function.
1029 * constexpr.c (cxx_eval_switch_expr): Use SWITCH_COND and SWITCH_BODY.
1030 (cxx_eval_constant_expression) <case COND_EXPR>: Don't look for the
1031 label in the else branch if we found it in the then branch.
1032
1033 2019-01-30 Jason Merrill <jason@redhat.com>
1034
1035 PR c++/88752 - ICE with lambda and constexpr if.
1036 * cp-tree.h (LAMBDA_EXPR_INSTANTIATED): New.
1037 * pt.c (tsubst_lambda_expr): Set it.
1038 (instantiated_lambda_fn_p): Check it.
1039 (enclosing_instantiation_of): Use it.
1040
1041 2019-01-31 Jakub Jelinek <jakub@redhat.com>
1042
1043 PR libstdc++/88170
1044 * cxx-pretty-print.c (pp_cxx_enumeration_constant): Print always as
1045 a C cast in pp_c_flag_gnu_v3 mode.
1046
1047 2019-01-30 Jakub Jelinek <jakub@redhat.com>
1048
1049 PR c++/88988
1050 * lambda.c (is_capture_proxy): Don't return true for
1051 DECL_OMP_PRIVATIZED_MEMBER artificial vars.
1052
1053 2019-01-30 Marek Polacek <polacek@redhat.com>
1054
1055 PR c++/89119 - ICE with value-initialization in template.
1056 * pt.c (tsubst_copy_and_build): Handle RANGE_EXPR.
1057
1058 2019-01-29 Jason Merrill <jason@redhat.com>
1059
1060 PR c++/86943 - wrong code converting lambda to function pointer.
1061 * lambda.c (maybe_add_lambda_conv_op): Use a template-id in the
1062 call. Only forward parms for decltype.
1063 * pt.c (tsubst_copy_and_build) [CALL_EXPR]: Handle CALL_FROM_THUNK_P
1064 specially.
1065 * typeck.c (check_return_expr): Don't mess with a thunk call.
1066
1067 2019-01-28 Jason Merrill <jason@redhat.com>
1068
1069 PR c++/89089 - ICE with [[no_unique_address]].
1070 PR c++/88865 - wrong layout with [[no_unique_address]].
1071 * class.c (check_field_decls): A potentially-overlapping field makes
1072 the class non-layout-POD, but not non-empty.
1073 (end_of_class): Always consider empty data members.
1074 (layout_class_type): Set DECL_SIZE for empty fields.
1075
1076 2019-01-28 Marek Polacek <polacek@redhat.com>
1077
1078 PR c++/88358 - name wrongly treated as type.
1079 * parser.c (cp_parser_direct_declarator): Don't assume a qualified-id
1080 in parameter-list is a type if the function's declarator-id is not
1081 qualified.
1082
1083 2019-01-27 Marek Polacek <polacek@redhat.com>
1084
1085 PR c++/88815 - narrowing conversion lost in decltype.
1086 PR c++/78244 - narrowing conversion in template not detected.
1087 * cp-tree.h (CONSTRUCTOR_IS_DEPENDENT): New.
1088 * pt.c (instantiation_dependent_r): Consider a CONSTRUCTOR with
1089 CONSTRUCTOR_IS_DEPENDENT instantiation-dependent.
1090 * semantics.c (finish_compound_literal): When the compound literal
1091 isn't instantiation-dependent and the type isn't type-dependent,
1092 fall back to the normal processing. Set CONSTRUCTOR_IS_DEPENDENT.
1093
1094 PR c++/89024 - ICE with incomplete enum type.
1095 * call.c (standard_conversion): When converting an
1096 ARITHMETIC_TYPE_P to an incomplete type, return NULL.
1097
1098 2019-01-25 Paolo Carlini <paolo.carlini@oracle.com>
1099
1100 PR c++/88969
1101 * call.c (build_op_delete_call): Implement 7.6.2.5/(10.1).
1102 * decl2.c (coerce_delete_type): Use build_pointer_type instead
1103 of TYPE_POINTER_TO.
1104
1105 2019-01-24 Jason Merrill <jason@redhat.com>
1106
1107 PR c++/89001 - mangling of reference temporaries
1108 * cp-tree.h (struct saved_scope): Add ref_temp_count.
1109 (current_ref_temp_count): New macro.
1110 * mangle.c (mangle_ref_init_variable): Use it.
1111 * typeck2.c (store_init_value): Clear it.
1112 * call.c (make_temporary_var_for_ref_to_temp): Copy public and
1113 comdat.
1114
1115 2019-01-24 Jakub Jelinek <jakub@redhat.com>
1116
1117 PR c++/88976
1118 * semantics.c (finish_omp_cancel): Diagnose more than one if
1119 on #pragma omp cancel with different modifiers. Use
1120 maybe_convert_cond when not in template or build_x_binary_op
1121 otherwise.
1122
1123 2019-01-23 Marek Polacek <polacek@redhat.com>
1124
1125 PR c++/88757 - qualified name treated wrongly as type.
1126 * parser.c (cp_parser_direct_declarator): Don't treat qualified-ids
1127 in parameter-list as types if name lookup for declarator-id didn't
1128 find one or more function templates.
1129
1130 2019-01-23 Jakub Jelinek <jakub@redhat.com>
1131
1132 PR c/44715
1133 * cp-gimplify.c (genericize_cp_loop): Call begin_bc_block only
1134 after genericizing cond and incr expressions.
1135
1136 PR c++/88984
1137 * cp-gimplify.c (genericize_switch_stmt): Move cond genericization
1138 before the begin_bc_block call.
1139
1140 2019-01-21 Jason Merrill <jason@redhat.com>
1141
1142 PR c++/87893 - constexpr ctor ICE on ARM.
1143 PR c++/88293 - ICE with comma expression.
1144 * constexpr.c (initialized_type): Don't shortcut non-void type.
1145 Handle COMPOUND_EXPR.
1146 (cxx_eval_outermost_constant_expr): Return early for void type.
1147
1148 2019-01-21 Jakub Jelinek <jakub@redhat.com>
1149
1150 PR c++/88949
1151 * optimize.c (cxx_copy_decl): New function.
1152 (clone_body): Use it instead of copy_decl_no_change.
1153
1154 PR sanitizer/88901
1155 * typeck.c (cp_build_binary_op): Don't instrument
1156 SANITIZE_POINTER_COMPARE if processing_template_decl.
1157 (pointer_diff): Similarly for SANITIZE_POINTER_SUBTRACT.
1158
1159 2019-01-18 Jason Merrill <jason@redhat.com>
1160
1161 PR c++/88875 - error with explicit list constructor.
1162 * call.c (reference_binding): Don't modify EXPR. Set
1163 need_temporary_p on the ck_user conversion for a temporary.
1164 (convert_like_real): Check it.
1165
1166 2019-01-18 H.J. Lu <hongjiu.lu@intel.com>
1167
1168 PR c/51628
1169 PR c/88664
1170 * call.c (convert_for_arg_passing): Upate the
1171 warn_for_address_or_pointer_of_packed_member call.
1172 * typeck.c (convert_for_assignment): Likewise.
1173
1174 2019-01-17 Jason Merrill <jason@redhat.com>
1175
1176 PR c++/86205 - ICE with ?: of throw and template-id.
1177 * pt.c (resolve_nondeduced_context_or_error): Split out from...
1178 * typeck.c (decay_conversion): ...here.
1179 * call.c (build_conditional_expr_1): Use it.
1180
1181 PR c++/86740, ICE with constexpr if and nested generic lambdas.
1182 * tree.c (cp_walk_subtrees): Handle LAMBDA_EXPR.
1183
1184 2019-01-17 Paolo Carlini <paolo.carlini@oracle.com>
1185
1186 * decl.c (grokdeclarator): Use typespec_loc in error messages
1187 about 'auto' and trailing return type.
1188
1189 2019-01-17 David Malcolm <dmalcolm@redhat.com>
1190
1191 PR c++/88699
1192 * class.c (add_method): Don't use DECL_DESTRUCTOR_P on
1193 USING_DECLs.
1194
1195 2019-01-17 Nathan Sidwell <nathan@acm.org>
1196
1197 PR c++/86610
1198 * semantics.c (process_outer_var_ref): Only skip dependent types
1199 in templates.
1200
1201 2019-01-17 Alexandre Oliva <aoliva@redhat.com>
1202
1203 PR c++/87768
1204 * cp-tree.h (saved_scope): Add suppress_location_wrappers.
1205 * name-lookup.c (do_push_to_top_level): Save and reset it.
1206 (do_pop_from_top_level): Restore it.
1207
1208 PR c++/86648
1209 * pt.c (make_template_placeholder): Use auto_identifier.
1210 (is_auto): Drop CLASS_PLACEHOLDER_TEMPLATE test.
1211 * error.c (dump_type): Handle template placeholders.
1212 * cxx-pretty-print.c (pp_cx_unqualified_id): Likewise.
1213
1214 PR c++/88146
1215 * cvt.c (convert_to_void): Handle all cdtor calls as if
1216 returning void.
1217
1218 2019-01-16 Paolo Carlini <paolo.carlini@oracle.com>
1219
1220 * decl.c (grokdeclarator): Use locations[ds_storage_class] in
1221 error messages about ill-formed uses of mutable.
1222
1223 2019-01-16 Marek Polacek <polacek@redhat.com>
1224
1225 PR c++/78244 - narrowing conversion in template not detected.
1226 * call.c (perform_implicit_conversion_flags): Set
1227 IMPLICIT_CONV_EXPR_BRACED_INIT.
1228 * cp-tree.h (IMPLICIT_CONV_EXPR_BRACED_INIT): New.
1229 * pt.c (tsubst_copy_and_build): Use it.
1230
1231 2019-01-15 David Malcolm <dmalcolm@redhat.com>
1232
1233 PR c++/88795
1234 * pt.c (build_deduction_guide): Bail out if tsubst_arg_types
1235 fails.
1236
1237 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com>
1238
1239 * decl.c (start_decl): Improve error location.
1240 * decl2.c (grokfield): Likewise.
1241
1242 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com>
1243
1244 * decl.c (grokdeclarator): Move further up the location_t loc
1245 declaration and use the location when building a TYPE_DECL for
1246 a typedef name.
1247 * decl2.c (grokbitfield): Use DECL_SOURCE_LOCATION in the error
1248 about an ill-formed bit-field as typedef.
1249
1250 2019-01-14 Marek Polacek <polacek@redhat.com>
1251
1252 PR c++/88830 - ICE with abstract class.
1253 * decl2.c (maybe_emit_vtables): Check CLASSTYPE_LAZY_DESTRUCTOR.
1254 Fix formatting.
1255
1256 PR c++/88825 - ICE with bogus function return type deduction.
1257 * typeck.c (can_do_nrvo_p): Check error_mark_node.
1258
1259 2019-01-14 Tom Honermann <tom@honermann.net>
1260
1261 Implement P0482R5, char8_t: A type for UTF-8 characters and strings
1262 * cvt.c (type_promotes_to): Handle char8_t promotion.
1263 * decl.c (grokdeclarator): Handle invalid type specifier
1264 combinations involving char8_t.
1265 * lex.c (init_reswords): Add char8_t as a reserved word.
1266 * mangle.c (write_builtin_type): Add name mangling for char8_t (Du).
1267 * parser.c (cp_keyword_starts_decl_specifier_p)
1268 (cp_parser_simple_type_specifier): Recognize char8_t as a simple
1269 type specifier.
1270 (cp_parser_string_literal): Use char8_array_type_node for the type
1271 of CPP_UTF8STRING.
1272 (cp_parser_set_decl_spec_type): Tolerate char8_t typedefs in system
1273 headers.
1274 * rtti.c (emit_support_tinfos): type_info support for char8_t.
1275 * tree.c (char_type_p): Recognize char8_t as a character type.
1276 * typeck.c (string_conv_p): Handle conversions of u8 string
1277 literals of char8_t type.
1278 (check_literal_operator_args): Handle UDLs with u8 string literals
1279 of char8_t type.
1280 * typeck2.c (ordinary_char_type_p): New.
1281 (digest_init_r): Disallow initializing a char array with a u8 string
1282 literal.
1283
1284 2019-01-14 Martin Liska <mliska@suse.cz>
1285
1286 PR gcov-profile/88263
1287 * decl2.c (get_tls_wrapper_fn): Use DECL_SOURCE_LOCATION
1288 as location of the TLS wrapper.
1289
1290 2019-01-12 Paolo Carlini <paolo.carlini@oracle.com>
1291
1292 * decl.c (cp_finish_decl): Improve error location.
1293 * decl2.c (grokfield): Likewise, improve two locations.
1294
1295 2019-01-11 Marek Polacek <polacek@redhat.com>
1296
1297 PR c++/88692, c++/87882 - -Wredundant-move false positive with *this.
1298 * typeck.c (maybe_warn_pessimizing_move): Return if ARG isn't
1299 ADDR_EXPR.
1300
1301 2019-01-11 Jason Merrill <jason@redhat.com>
1302
1303 PR c++/88312 - pack expansion of decltype.
1304 * pt.c (instantiation_dependent_r): A template non-type parameter
1305 pack is instantiation-dependent.
1306
1307 2019-01-11 Jason Merrill <jason@redhat.com>
1308
1309 PR c++/88613 - ICE with use of const var in lambda.
1310 * expr.c (mark_use): Fix location wrapper handling.
1311 * cp-gimplify.c (cp_fold_maybe_rvalue): Call mark_rvalue_use.
1312
1313 2019-01-11 Tobias Burnus <burnus@net-b.de>
1314
1315 PR C++/88114
1316 * decl2.c (maybe_emit_vtables): If needed, generate code for
1317 the destructor of an abstract class.
1318 (mark_used): Update comment for older function-name change.
1319
1320 2019-01-11 Paolo Carlini <paolo.carlini@oracle.com>
1321
1322 * decl.c (start_decl): Improve error location.
1323 (grokdeclarator): Likewise, improve two locations.
1324
1325 2019-01-09 Sandra Loosemore <sandra@codesourcery.com>
1326
1327 PR other/16615
1328
1329 * cp-tree.h: Mechanically replace "can not" with "cannot".
1330 * parser.c: Likewise.
1331 * pt.c: Likewise.
1332
1333 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com>
1334
1335 * decl.c (grok_reference_init): Improve error location.
1336 (grokdeclarator): Likewise, improve two locations.
1337
1338 2019-01-08 Marek Polacek <polacek@redhat.com>
1339
1340 PR c++/88538 - braced-init-list in template-argument-list.
1341 * parser.c (cp_parser_template_argument): Handle braced-init-list when
1342 in C++20.
1343
1344 PR c++/88548 - this accepted in static member functions.
1345 * parser.c (cp_debug_parser): Adjust printing of
1346 local_variables_forbidden_p.
1347 (cp_parser_new): Set local_variables_forbidden_p to 0 rather than false.
1348 (cp_parser_primary_expression): When checking
1349 local_variables_forbidden_p, use THIS_FORBIDDEN or
1350 LOCAL_VARS_FORBIDDEN.
1351 (cp_parser_lambda_body): Update the type of
1352 local_variables_forbidden_p. Set it to 0 rather than false.
1353 (cp_parser_condition): Adjust call to cp_parser_declarator.
1354 (cp_parser_explicit_instantiation): Likewise.
1355 (cp_parser_init_declarator): Likewise.
1356 (cp_parser_declarator): New parameter. Use it.
1357 (cp_parser_direct_declarator): New parameter. Use it to set
1358 local_variables_forbidden_p. Adjust call to cp_parser_declarator.
1359 (cp_parser_type_id_1): Adjust call to cp_parser_declarator.
1360 (cp_parser_parameter_declaration): Likewise.
1361 (cp_parser_default_argument): Update the type of
1362 local_variables_forbidden_p. Set it to LOCAL_VARS_AND_THIS_FORBIDDEN
1363 rather than true.
1364 (cp_parser_member_declaration): Tell cp_parser_declarator if we saw
1365 'static' or 'friend'.
1366 (cp_parser_exception_declaration): Adjust call to cp_parser_declarator.
1367 (cp_parser_late_parsing_default_args): Update the type of
1368 local_variables_forbidden_p. Set it to LOCAL_VARS_AND_THIS_FORBIDDEN
1369 rather than true.
1370 (cp_parser_cache_defarg): Adjust call to cp_parser_declarator.
1371 (cp_parser_objc_class_ivars): Likewise.
1372 (cp_parser_objc_struct_declaration): Likewise.
1373 (cp_parser_omp_for_loop_init): Likewise.
1374 * parser.h (cp_parser): Change the type of local_variables_forbidden_p
1375 to unsigned char.
1376 (LOCAL_VARS_FORBIDDEN, LOCAL_VARS_AND_THIS_FORBIDDEN, THIS_FORBIDDEN):
1377 Define.
1378
1379 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com>
1380
1381 * decl.c (start_decl): Improve permerror location.
1382
1383 2019-01-08 Jonathan Wakely <jwakely@redhat.com>
1384 Jakub Jelinek <jakub@redhat.com>
1385
1386 PR c++/88554
1387 * decl.c (finish_function): For -Wreturn-type don't add a return *this;
1388 fixit hint if current_class_ref is NULL. Use a single if instead of
1389 two nested ones.
1390
1391 2019-01-07 Paolo Carlini <paolo.carlini@oracle.com>
1392
1393 * decl.c (start_decl): Improve two error_at locations.
1394 (expand_static_init): Likewise.
1395
1396 2019-01-07 Marek Polacek <polacek@redhat.com>
1397
1398 PR c++/88741 - wrong error with initializer-string.
1399 * decl.c (cp_complete_array_type): Strip any location wrappers.
1400
1401 2019-01-07 Bernd Edlinger <bernd.edlinger@hotmail.de>
1402
1403 PR c++/88261
1404 PR c++/69338
1405 PR c++/69696
1406 PR c++/69697
1407 * cp-tree.h (LOOKUP_ALLOW_FLEXARRAY_INIT): New flag value.
1408 * typeck2.c (digest_init_r): Raise an error for non-static
1409 initialization of a flexible array member.
1410 (process_init_constructor, massage_init_elt,
1411 process_init_constructor_array, process_init_constructor_record,
1412 process_init_constructor_union, process_init_constructor): Add the
1413 flags parameter and pass it thru.
1414 (store_init_value): Pass LOOKUP_ALLOW_FLEXARRAY_INIT parameter to
1415 digest_init_flags for static decls.
1416
1417 2019-01-07 Jakub Jelinek <jakub@redhat.com>
1418
1419 PR c++/85052
1420 * cp-tree.h (cp_build_vec_convert): Declare.
1421 * parser.c (cp_parser_postfix_expression): Parse
1422 __builtin_convertvector.
1423 * constexpr.c: Include fold-const-call.h.
1424 (cxx_eval_internal_function): Handle IFN_VEC_CONVERT.
1425 (potential_constant_expression_1): Likewise.
1426 * semantics.c (cp_build_vec_convert): New function.
1427 * pt.c (tsubst_copy_and_build): Handle CALL_EXPR to
1428 IFN_VEC_CONVERT.
1429
1430 2019-01-03 Jakub Jelinek <jakub@redhat.com>
1431
1432 PR c++/88636
1433 * decl.c (builtin_function_1): Return result of pushdecl_top_level
1434 or pushdecl rather than decl.
1435
1436 2019-01-03 Paolo Carlini <paolo.carlini@oracle.com>
1437
1438 * tree.c (handle_nodiscard_attribute): Improve warning location.
1439
1440 2019-01-02 Marek Polacek <polacek@redhat.com>
1441
1442 PR c++/88612 - ICE with -Waddress-of-packed-member.
1443 * call.c (convert_for_arg_passing): Only give warnings with tf_warning.
1444 * typeck.c (convert_for_assignment): Likewise.
1445
1446 PR c++/88631 - CTAD failing for value-initialization.
1447 * typeck2.c (build_functional_cast): Try deducing the template
1448 arguments even if there are no arguments to deduce from.
1449
1450 2019-01-01 Jakub Jelinek <jakub@redhat.com>
1451
1452 Update copyright years.
1453 \f
1454 Copyright (C) 2019 Free Software Foundation, Inc.
1455
1456 Copying and distribution of this file, with or without modification,
1457 are permitted in any medium without royalty provided the copyright
1458 notice and this notice are preserved.