885cd5056534d6cdd715e565b459bb7075a9c4fd
[gcc.git] / gcc / cp / ChangeLog
1 2019-02-11 Marek Polacek <polacek@redhat.com>
2
3 * typeck2.c (digest_init_r): Remove commented code.
4
5 2019-02-11 Martin Sebor <msebor@redhat.com>
6
7 PR c++/87996
8 * decl.c (compute_array_index_type_loc): Preserve signed sizes
9 for diagnostics. Call valid_array_size_p instead of error.
10 * init.c (build_new_1): Compute size for diagnostic. Call
11 invalid_array_size_error
12 (build_new): Call valid_array_size_p instead of error.
13
14 2019-02-07 Alexandre Oliva <aoliva@redhat.com>
15
16 PR c++/86218
17 * call.c (compare_ics): Deal with ck_aggr in either cs.
18
19 2019-02-06 David Malcolm <dmalcolm@redhat.com>
20
21 PR c++/71302
22 * call.c (get_location_for_expr_unwinding_for_system_header): New
23 function.
24 (conversion_null_warnings): Use it when getting locations for
25 EXPR, effectively adding a call to
26 get_location_for_expr_unwinding_for_system_header for
27 -Wconversion-null and making use of EXPR_LOCATION for
28 -Wzero-as-null-pointer-constant.
29
30 2019-02-05 Jakub Jelinek <jakub@redhat.com>
31
32 PR c++/89187
33 * optimize.c (maybe_thunk_body): Clear TREE_ADDRESSABLE on
34 PARM_DECLs of the thunk.
35 * lambda.c (maybe_add_lambda_conv_op): Likewise.
36
37 2019-02-05 Marek Polacek <polacek@redhat.com>
38
39 PR c++/89158 - by-value capture of constexpr variable broken.
40 * call.c (convert_like_real) <case ck_user>: Call mark_exp_read
41 instead of mark_rvalue_use.
42
43 2019-02-05 Alexandre Oliva <aoliva@redhat.com>
44
45 PR c++/87770
46 * pt.c (instantiates_primary_template_p): New.
47 (type_dependent_expression_p): Use it.
48
49 2019-02-01 Jason Merrill <jason@redhat.com>
50
51 PR c++/88761 - ICE with reference capture of constant.
52 * lambda.c (mark_const_cap_r): Do walk subtrees of DECL_EXPR for
53 non-proxy decls.
54
55 2019-02-01 Marek Polacek <polacek@redhat.com>
56
57 PR c++/88325 - ICE with invalid out-of-line template member definition.
58 * parser.c (cp_parser_class_name): Don't call make_typename_type
59 for overloads.
60
61 2019-02-01 Jakub Jelinek <jakub@redhat.com>
62
63 PR c++/87175
64 * parser.c (cp_parser_gnu_attributes_opt): Set ok to false
65 if require_open failed.
66
67 2019-01-31 Marek Polacek <polacek@redhat.com>
68
69 PR c++/89083, c++/80864 - ICE with list initialization in template.
70 * constexpr.c (adjust_temp_type): Use copy_node and change the type
71 instead of using build_constructor.
72 * decl.c (reshape_init_r): Don't reshape a digested initializer.
73 Return the initializer for COMPOUND_LITERAL_P.
74
75 PR c++/88983 - ICE with switch in constexpr function.
76 * constexpr.c (cxx_eval_switch_expr): Use SWITCH_COND and SWITCH_BODY.
77 (cxx_eval_constant_expression) <case COND_EXPR>: Don't look for the
78 label in the else branch if we found it in the then branch.
79
80 2019-01-30 Jason Merrill <jason@redhat.com>
81
82 PR c++/88752 - ICE with lambda and constexpr if.
83 * cp-tree.h (LAMBDA_EXPR_INSTANTIATED): New.
84 * pt.c (tsubst_lambda_expr): Set it.
85 (instantiated_lambda_fn_p): Check it.
86 (enclosing_instantiation_of): Use it.
87
88 2019-01-31 Jakub Jelinek <jakub@redhat.com>
89
90 PR libstdc++/88170
91 * cxx-pretty-print.c (pp_cxx_enumeration_constant): Print always as
92 a C cast in pp_c_flag_gnu_v3 mode.
93
94 2019-01-30 Jakub Jelinek <jakub@redhat.com>
95
96 PR c++/88988
97 * lambda.c (is_capture_proxy): Don't return true for
98 DECL_OMP_PRIVATIZED_MEMBER artificial vars.
99
100 2019-01-30 Marek Polacek <polacek@redhat.com>
101
102 PR c++/89119 - ICE with value-initialization in template.
103 * pt.c (tsubst_copy_and_build): Handle RANGE_EXPR.
104
105 2019-01-29 Jason Merrill <jason@redhat.com>
106
107 PR c++/86943 - wrong code converting lambda to function pointer.
108 * lambda.c (maybe_add_lambda_conv_op): Use a template-id in the
109 call. Only forward parms for decltype.
110 * pt.c (tsubst_copy_and_build) [CALL_EXPR]: Handle CALL_FROM_THUNK_P
111 specially.
112 * typeck.c (check_return_expr): Don't mess with a thunk call.
113
114 2019-01-28 Jason Merrill <jason@redhat.com>
115
116 PR c++/89089 - ICE with [[no_unique_address]].
117 PR c++/88865 - wrong layout with [[no_unique_address]].
118 * class.c (check_field_decls): A potentially-overlapping field makes
119 the class non-layout-POD, but not non-empty.
120 (end_of_class): Always consider empty data members.
121 (layout_class_type): Set DECL_SIZE for empty fields.
122
123 2019-01-28 Marek Polacek <polacek@redhat.com>
124
125 PR c++/88358 - name wrongly treated as type.
126 * parser.c (cp_parser_direct_declarator): Don't assume a qualified-id
127 in parameter-list is a type if the function's declarator-id is not
128 qualified.
129
130 2019-01-27 Marek Polacek <polacek@redhat.com>
131
132 PR c++/88815 - narrowing conversion lost in decltype.
133 PR c++/78244 - narrowing conversion in template not detected.
134 * cp-tree.h (CONSTRUCTOR_IS_DEPENDENT): New.
135 * pt.c (instantiation_dependent_r): Consider a CONSTRUCTOR with
136 CONSTRUCTOR_IS_DEPENDENT instantiation-dependent.
137 * semantics.c (finish_compound_literal): When the compound literal
138 isn't instantiation-dependent and the type isn't type-dependent,
139 fall back to the normal processing. Set CONSTRUCTOR_IS_DEPENDENT.
140
141 PR c++/89024 - ICE with incomplete enum type.
142 * call.c (standard_conversion): When converting an
143 ARITHMETIC_TYPE_P to an incomplete type, return NULL.
144
145 2019-01-25 Paolo Carlini <paolo.carlini@oracle.com>
146
147 PR c++/88969
148 * call.c (build_op_delete_call): Implement 7.6.2.5/(10.1).
149 * decl2.c (coerce_delete_type): Use build_pointer_type instead
150 of TYPE_POINTER_TO.
151
152 2019-01-24 Jason Merrill <jason@redhat.com>
153
154 PR c++/89001 - mangling of reference temporaries
155 * cp-tree.h (struct saved_scope): Add ref_temp_count.
156 (current_ref_temp_count): New macro.
157 * mangle.c (mangle_ref_init_variable): Use it.
158 * typeck2.c (store_init_value): Clear it.
159 * call.c (make_temporary_var_for_ref_to_temp): Copy public and
160 comdat.
161
162 2019-01-24 Jakub Jelinek <jakub@redhat.com>
163
164 PR c++/88976
165 * semantics.c (finish_omp_cancel): Diagnose more than one if
166 on #pragma omp cancel with different modifiers. Use
167 maybe_convert_cond when not in template or build_x_binary_op
168 otherwise.
169
170 2019-01-23 Marek Polacek <polacek@redhat.com>
171
172 PR c++/88757 - qualified name treated wrongly as type.
173 * parser.c (cp_parser_direct_declarator): Don't treat qualified-ids
174 in parameter-list as types if name lookup for declarator-id didn't
175 find one or more function templates.
176
177 2019-01-23 Jakub Jelinek <jakub@redhat.com>
178
179 PR c/44715
180 * cp-gimplify.c (genericize_cp_loop): Call begin_bc_block only
181 after genericizing cond and incr expressions.
182
183 PR c++/88984
184 * cp-gimplify.c (genericize_switch_stmt): Move cond genericization
185 before the begin_bc_block call.
186
187 2019-01-21 Jason Merrill <jason@redhat.com>
188
189 PR c++/87893 - constexpr ctor ICE on ARM.
190 PR c++/88293 - ICE with comma expression.
191 * constexpr.c (initialized_type): Don't shortcut non-void type.
192 Handle COMPOUND_EXPR.
193 (cxx_eval_outermost_constant_expr): Return early for void type.
194
195 2019-01-21 Jakub Jelinek <jakub@redhat.com>
196
197 PR c++/88949
198 * optimize.c (cxx_copy_decl): New function.
199 (clone_body): Use it instead of copy_decl_no_change.
200
201 PR sanitizer/88901
202 * typeck.c (cp_build_binary_op): Don't instrument
203 SANITIZE_POINTER_COMPARE if processing_template_decl.
204 (pointer_diff): Similarly for SANITIZE_POINTER_SUBTRACT.
205
206 2019-01-18 Jason Merrill <jason@redhat.com>
207
208 PR c++/88875 - error with explicit list constructor.
209 * call.c (reference_binding): Don't modify EXPR. Set
210 need_temporary_p on the ck_user conversion for a temporary.
211 (convert_like_real): Check it.
212
213 2019-01-18 H.J. Lu <hongjiu.lu@intel.com>
214
215 PR c/51628
216 PR c/88664
217 * call.c (convert_for_arg_passing): Upate the
218 warn_for_address_or_pointer_of_packed_member call.
219 * typeck.c (convert_for_assignment): Likewise.
220
221 2019-01-17 Jason Merrill <jason@redhat.com>
222
223 PR c++/86205 - ICE with ?: of throw and template-id.
224 * pt.c (resolve_nondeduced_context_or_error): Split out from...
225 * typeck.c (decay_conversion): ...here.
226 * call.c (build_conditional_expr_1): Use it.
227
228 PR c++/86740, ICE with constexpr if and nested generic lambdas.
229 * tree.c (cp_walk_subtrees): Handle LAMBDA_EXPR.
230
231 2019-01-17 Paolo Carlini <paolo.carlini@oracle.com>
232
233 * decl.c (grokdeclarator): Use typespec_loc in error messages
234 about 'auto' and trailing return type.
235
236 2019-01-17 David Malcolm <dmalcolm@redhat.com>
237
238 PR c++/88699
239 * class.c (add_method): Don't use DECL_DESTRUCTOR_P on
240 USING_DECLs.
241
242 2019-01-17 Nathan Sidwell <nathan@acm.org>
243
244 PR c++/86610
245 * semantics.c (process_outer_var_ref): Only skip dependent types
246 in templates.
247
248 2019-01-17 Alexandre Oliva <aoliva@redhat.com>
249
250 PR c++/87768
251 * cp-tree.h (saved_scope): Add suppress_location_wrappers.
252 * name-lookup.c (do_push_to_top_level): Save and reset it.
253 (do_pop_from_top_level): Restore it.
254
255 PR c++/86648
256 * pt.c (make_template_placeholder): Use auto_identifier.
257 (is_auto): Drop CLASS_PLACEHOLDER_TEMPLATE test.
258 * error.c (dump_type): Handle template placeholders.
259 * cxx-pretty-print.c (pp_cx_unqualified_id): Likewise.
260
261 PR c++/88146
262 * cvt.c (convert_to_void): Handle all cdtor calls as if
263 returning void.
264
265 2019-01-16 Paolo Carlini <paolo.carlini@oracle.com>
266
267 * decl.c (grokdeclarator): Use locations[ds_storage_class] in
268 error messages about ill-formed uses of mutable.
269
270 2019-01-16 Marek Polacek <polacek@redhat.com>
271
272 PR c++/78244 - narrowing conversion in template not detected.
273 * call.c (perform_implicit_conversion_flags): Set
274 IMPLICIT_CONV_EXPR_BRACED_INIT.
275 * cp-tree.h (IMPLICIT_CONV_EXPR_BRACED_INIT): New.
276 * pt.c (tsubst_copy_and_build): Use it.
277
278 2019-01-15 David Malcolm <dmalcolm@redhat.com>
279
280 PR c++/88795
281 * pt.c (build_deduction_guide): Bail out if tsubst_arg_types
282 fails.
283
284 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com>
285
286 * decl.c (start_decl): Improve error location.
287 * decl2.c (grokfield): Likewise.
288
289 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com>
290
291 * decl.c (grokdeclarator): Move further up the location_t loc
292 declaration and use the location when building a TYPE_DECL for
293 a typedef name.
294 * decl2.c (grokbitfield): Use DECL_SOURCE_LOCATION in the error
295 about an ill-formed bit-field as typedef.
296
297 2019-01-14 Marek Polacek <polacek@redhat.com>
298
299 PR c++/88830 - ICE with abstract class.
300 * decl2.c (maybe_emit_vtables): Check CLASSTYPE_LAZY_DESTRUCTOR.
301 Fix formatting.
302
303 PR c++/88825 - ICE with bogus function return type deduction.
304 * typeck.c (can_do_nrvo_p): Check error_mark_node.
305
306 2019-01-14 Tom Honermann <tom@honermann.net>
307
308 Implement P0482R5, char8_t: A type for UTF-8 characters and strings
309 * cvt.c (type_promotes_to): Handle char8_t promotion.
310 * decl.c (grokdeclarator): Handle invalid type specifier
311 combinations involving char8_t.
312 * lex.c (init_reswords): Add char8_t as a reserved word.
313 * mangle.c (write_builtin_type): Add name mangling for char8_t (Du).
314 * parser.c (cp_keyword_starts_decl_specifier_p)
315 (cp_parser_simple_type_specifier): Recognize char8_t as a simple
316 type specifier.
317 (cp_parser_string_literal): Use char8_array_type_node for the type
318 of CPP_UTF8STRING.
319 (cp_parser_set_decl_spec_type): Tolerate char8_t typedefs in system
320 headers.
321 * rtti.c (emit_support_tinfos): type_info support for char8_t.
322 * tree.c (char_type_p): Recognize char8_t as a character type.
323 * typeck.c (string_conv_p): Handle conversions of u8 string
324 literals of char8_t type.
325 (check_literal_operator_args): Handle UDLs with u8 string literals
326 of char8_t type.
327 * typeck2.c (ordinary_char_type_p): New.
328 (digest_init_r): Disallow initializing a char array with a u8 string
329 literal.
330
331 2019-01-14 Martin Liska <mliska@suse.cz>
332
333 PR gcov-profile/88263
334 * decl2.c (get_tls_wrapper_fn): Use DECL_SOURCE_LOCATION
335 as location of the TLS wrapper.
336
337 2019-01-12 Paolo Carlini <paolo.carlini@oracle.com>
338
339 * decl.c (cp_finish_decl): Improve error location.
340 * decl2.c (grokfield): Likewise, improve two locations.
341
342 2019-01-11 Marek Polacek <polacek@redhat.com>
343
344 PR c++/88692, c++/87882 - -Wredundant-move false positive with *this.
345 * typeck.c (maybe_warn_pessimizing_move): Return if ARG isn't
346 ADDR_EXPR.
347
348 2019-01-11 Jason Merrill <jason@redhat.com>
349
350 PR c++/88312 - pack expansion of decltype.
351 * pt.c (instantiation_dependent_r): A template non-type parameter
352 pack is instantiation-dependent.
353
354 2019-01-11 Jason Merrill <jason@redhat.com>
355
356 PR c++/88613 - ICE with use of const var in lambda.
357 * expr.c (mark_use): Fix location wrapper handling.
358 * cp-gimplify.c (cp_fold_maybe_rvalue): Call mark_rvalue_use.
359
360 2019-01-11 Tobias Burnus <burnus@net-b.de>
361
362 PR C++/88114
363 * decl2.c (maybe_emit_vtables): If needed, generate code for
364 the destructor of an abstract class.
365 (mark_used): Update comment for older function-name change.
366
367 2019-01-11 Paolo Carlini <paolo.carlini@oracle.com>
368
369 * decl.c (start_decl): Improve error location.
370 (grokdeclarator): Likewise, improve two locations.
371
372 2019-01-09 Sandra Loosemore <sandra@codesourcery.com>
373
374 PR other/16615
375
376 * cp-tree.h: Mechanically replace "can not" with "cannot".
377 * parser.c: Likewise.
378 * pt.c: Likewise.
379
380 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com>
381
382 * decl.c (grok_reference_init): Improve error location.
383 (grokdeclarator): Likewise, improve two locations.
384
385 2019-01-08 Marek Polacek <polacek@redhat.com>
386
387 PR c++/88538 - braced-init-list in template-argument-list.
388 * parser.c (cp_parser_template_argument): Handle braced-init-list when
389 in C++20.
390
391 PR c++/88548 - this accepted in static member functions.
392 * parser.c (cp_debug_parser): Adjust printing of
393 local_variables_forbidden_p.
394 (cp_parser_new): Set local_variables_forbidden_p to 0 rather than false.
395 (cp_parser_primary_expression): When checking
396 local_variables_forbidden_p, use THIS_FORBIDDEN or
397 LOCAL_VARS_FORBIDDEN.
398 (cp_parser_lambda_body): Update the type of
399 local_variables_forbidden_p. Set it to 0 rather than false.
400 (cp_parser_condition): Adjust call to cp_parser_declarator.
401 (cp_parser_explicit_instantiation): Likewise.
402 (cp_parser_init_declarator): Likewise.
403 (cp_parser_declarator): New parameter. Use it.
404 (cp_parser_direct_declarator): New parameter. Use it to set
405 local_variables_forbidden_p. Adjust call to cp_parser_declarator.
406 (cp_parser_type_id_1): Adjust call to cp_parser_declarator.
407 (cp_parser_parameter_declaration): Likewise.
408 (cp_parser_default_argument): Update the type of
409 local_variables_forbidden_p. Set it to LOCAL_VARS_AND_THIS_FORBIDDEN
410 rather than true.
411 (cp_parser_member_declaration): Tell cp_parser_declarator if we saw
412 'static' or 'friend'.
413 (cp_parser_exception_declaration): Adjust call to cp_parser_declarator.
414 (cp_parser_late_parsing_default_args): Update the type of
415 local_variables_forbidden_p. Set it to LOCAL_VARS_AND_THIS_FORBIDDEN
416 rather than true.
417 (cp_parser_cache_defarg): Adjust call to cp_parser_declarator.
418 (cp_parser_objc_class_ivars): Likewise.
419 (cp_parser_objc_struct_declaration): Likewise.
420 (cp_parser_omp_for_loop_init): Likewise.
421 * parser.h (cp_parser): Change the type of local_variables_forbidden_p
422 to unsigned char.
423 (LOCAL_VARS_FORBIDDEN, LOCAL_VARS_AND_THIS_FORBIDDEN, THIS_FORBIDDEN):
424 Define.
425
426 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com>
427
428 * decl.c (start_decl): Improve permerror location.
429
430 2019-01-08 Jonathan Wakely <jwakely@redhat.com>
431 Jakub Jelinek <jakub@redhat.com>
432
433 PR c++/88554
434 * decl.c (finish_function): For -Wreturn-type don't add a return *this;
435 fixit hint if current_class_ref is NULL. Use a single if instead of
436 two nested ones.
437
438 2019-01-07 Paolo Carlini <paolo.carlini@oracle.com>
439
440 * decl.c (start_decl): Improve two error_at locations.
441 (expand_static_init): Likewise.
442
443 2019-01-07 Marek Polacek <polacek@redhat.com>
444
445 PR c++/88741 - wrong error with initializer-string.
446 * decl.c (cp_complete_array_type): Strip any location wrappers.
447
448 2019-01-07 Bernd Edlinger <bernd.edlinger@hotmail.de>
449
450 PR c++/88261
451 PR c++/69338
452 PR c++/69696
453 PR c++/69697
454 * cp-tree.h (LOOKUP_ALLOW_FLEXARRAY_INIT): New flag value.
455 * typeck2.c (digest_init_r): Raise an error for non-static
456 initialization of a flexible array member.
457 (process_init_constructor, massage_init_elt,
458 process_init_constructor_array, process_init_constructor_record,
459 process_init_constructor_union, process_init_constructor): Add the
460 flags parameter and pass it thru.
461 (store_init_value): Pass LOOKUP_ALLOW_FLEXARRAY_INIT parameter to
462 digest_init_flags for static decls.
463
464 2019-01-07 Jakub Jelinek <jakub@redhat.com>
465
466 PR c++/85052
467 * cp-tree.h (cp_build_vec_convert): Declare.
468 * parser.c (cp_parser_postfix_expression): Parse
469 __builtin_convertvector.
470 * constexpr.c: Include fold-const-call.h.
471 (cxx_eval_internal_function): Handle IFN_VEC_CONVERT.
472 (potential_constant_expression_1): Likewise.
473 * semantics.c (cp_build_vec_convert): New function.
474 * pt.c (tsubst_copy_and_build): Handle CALL_EXPR to
475 IFN_VEC_CONVERT.
476
477 2019-01-03 Jakub Jelinek <jakub@redhat.com>
478
479 PR c++/88636
480 * decl.c (builtin_function_1): Return result of pushdecl_top_level
481 or pushdecl rather than decl.
482
483 2019-01-03 Paolo Carlini <paolo.carlini@oracle.com>
484
485 * tree.c (handle_nodiscard_attribute): Improve warning location.
486
487 2019-01-02 Marek Polacek <polacek@redhat.com>
488
489 PR c++/88612 - ICE with -Waddress-of-packed-member.
490 * call.c (convert_for_arg_passing): Only give warnings with tf_warning.
491 * typeck.c (convert_for_assignment): Likewise.
492
493 PR c++/88631 - CTAD failing for value-initialization.
494 * typeck2.c (build_functional_cast): Try deducing the template
495 arguments even if there are no arguments to deduce from.
496
497 2019-01-01 Jakub Jelinek <jakub@redhat.com>
498
499 Update copyright years.
500 \f
501 Copyright (C) 2019 Free Software Foundation, Inc.
502
503 Copying and distribution of this file, with or without modification,
504 are permitted in any medium without royalty provided the copyright
505 notice and this notice are preserved.