1 2019-02-11 Marek Polacek <polacek@redhat.com>
3 * typeck2.c (digest_init_r): Remove commented code.
5 2019-02-11 Martin Sebor <msebor@redhat.com>
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.
14 2019-02-07 Alexandre Oliva <aoliva@redhat.com>
17 * call.c (compare_ics): Deal with ck_aggr in either cs.
19 2019-02-06 David Malcolm <dmalcolm@redhat.com>
22 * call.c (get_location_for_expr_unwinding_for_system_header): New
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.
30 2019-02-05 Jakub Jelinek <jakub@redhat.com>
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.
37 2019-02-05 Marek Polacek <polacek@redhat.com>
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.
43 2019-02-05 Alexandre Oliva <aoliva@redhat.com>
46 * pt.c (instantiates_primary_template_p): New.
47 (type_dependent_expression_p): Use it.
49 2019-02-01 Jason Merrill <jason@redhat.com>
51 PR c++/88761 - ICE with reference capture of constant.
52 * lambda.c (mark_const_cap_r): Do walk subtrees of DECL_EXPR for
55 2019-02-01 Marek Polacek <polacek@redhat.com>
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
61 2019-02-01 Jakub Jelinek <jakub@redhat.com>
64 * parser.c (cp_parser_gnu_attributes_opt): Set ok to false
65 if require_open failed.
67 2019-01-31 Marek Polacek <polacek@redhat.com>
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.
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.
80 2019-01-30 Jason Merrill <jason@redhat.com>
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.
88 2019-01-31 Jakub Jelinek <jakub@redhat.com>
91 * cxx-pretty-print.c (pp_cxx_enumeration_constant): Print always as
92 a C cast in pp_c_flag_gnu_v3 mode.
94 2019-01-30 Jakub Jelinek <jakub@redhat.com>
97 * lambda.c (is_capture_proxy): Don't return true for
98 DECL_OMP_PRIVATIZED_MEMBER artificial vars.
100 2019-01-30 Marek Polacek <polacek@redhat.com>
102 PR c++/89119 - ICE with value-initialization in template.
103 * pt.c (tsubst_copy_and_build): Handle RANGE_EXPR.
105 2019-01-29 Jason Merrill <jason@redhat.com>
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
112 * typeck.c (check_return_expr): Don't mess with a thunk call.
114 2019-01-28 Jason Merrill <jason@redhat.com>
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.
123 2019-01-28 Marek Polacek <polacek@redhat.com>
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
130 2019-01-27 Marek Polacek <polacek@redhat.com>
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.
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.
145 2019-01-25 Paolo Carlini <paolo.carlini@oracle.com>
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
152 2019-01-24 Jason Merrill <jason@redhat.com>
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
162 2019-01-24 Jakub Jelinek <jakub@redhat.com>
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
170 2019-01-23 Marek Polacek <polacek@redhat.com>
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.
177 2019-01-23 Jakub Jelinek <jakub@redhat.com>
180 * cp-gimplify.c (genericize_cp_loop): Call begin_bc_block only
181 after genericizing cond and incr expressions.
184 * cp-gimplify.c (genericize_switch_stmt): Move cond genericization
185 before the begin_bc_block call.
187 2019-01-21 Jason Merrill <jason@redhat.com>
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.
195 2019-01-21 Jakub Jelinek <jakub@redhat.com>
198 * optimize.c (cxx_copy_decl): New function.
199 (clone_body): Use it instead of copy_decl_no_change.
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.
206 2019-01-18 Jason Merrill <jason@redhat.com>
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.
213 2019-01-18 H.J. Lu <hongjiu.lu@intel.com>
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.
221 2019-01-17 Jason Merrill <jason@redhat.com>
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.
228 PR c++/86740, ICE with constexpr if and nested generic lambdas.
229 * tree.c (cp_walk_subtrees): Handle LAMBDA_EXPR.
231 2019-01-17 Paolo Carlini <paolo.carlini@oracle.com>
233 * decl.c (grokdeclarator): Use typespec_loc in error messages
234 about 'auto' and trailing return type.
236 2019-01-17 David Malcolm <dmalcolm@redhat.com>
239 * class.c (add_method): Don't use DECL_DESTRUCTOR_P on
242 2019-01-17 Nathan Sidwell <nathan@acm.org>
245 * semantics.c (process_outer_var_ref): Only skip dependent types
248 2019-01-17 Alexandre Oliva <aoliva@redhat.com>
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.
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.
262 * cvt.c (convert_to_void): Handle all cdtor calls as if
265 2019-01-16 Paolo Carlini <paolo.carlini@oracle.com>
267 * decl.c (grokdeclarator): Use locations[ds_storage_class] in
268 error messages about ill-formed uses of mutable.
270 2019-01-16 Marek Polacek <polacek@redhat.com>
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.
278 2019-01-15 David Malcolm <dmalcolm@redhat.com>
281 * pt.c (build_deduction_guide): Bail out if tsubst_arg_types
284 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com>
286 * decl.c (start_decl): Improve error location.
287 * decl2.c (grokfield): Likewise.
289 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com>
291 * decl.c (grokdeclarator): Move further up the location_t loc
292 declaration and use the location when building a TYPE_DECL for
294 * decl2.c (grokbitfield): Use DECL_SOURCE_LOCATION in the error
295 about an ill-formed bit-field as typedef.
297 2019-01-14 Marek Polacek <polacek@redhat.com>
299 PR c++/88830 - ICE with abstract class.
300 * decl2.c (maybe_emit_vtables): Check CLASSTYPE_LAZY_DESTRUCTOR.
303 PR c++/88825 - ICE with bogus function return type deduction.
304 * typeck.c (can_do_nrvo_p): Check error_mark_node.
306 2019-01-14 Tom Honermann <tom@honermann.net>
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
317 (cp_parser_string_literal): Use char8_array_type_node for the type
319 (cp_parser_set_decl_spec_type): Tolerate char8_t typedefs in system
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
327 * typeck2.c (ordinary_char_type_p): New.
328 (digest_init_r): Disallow initializing a char array with a u8 string
331 2019-01-14 Martin Liska <mliska@suse.cz>
333 PR gcov-profile/88263
334 * decl2.c (get_tls_wrapper_fn): Use DECL_SOURCE_LOCATION
335 as location of the TLS wrapper.
337 2019-01-12 Paolo Carlini <paolo.carlini@oracle.com>
339 * decl.c (cp_finish_decl): Improve error location.
340 * decl2.c (grokfield): Likewise, improve two locations.
342 2019-01-11 Marek Polacek <polacek@redhat.com>
344 PR c++/88692, c++/87882 - -Wredundant-move false positive with *this.
345 * typeck.c (maybe_warn_pessimizing_move): Return if ARG isn't
348 2019-01-11 Jason Merrill <jason@redhat.com>
350 PR c++/88312 - pack expansion of decltype.
351 * pt.c (instantiation_dependent_r): A template non-type parameter
352 pack is instantiation-dependent.
354 2019-01-11 Jason Merrill <jason@redhat.com>
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.
360 2019-01-11 Tobias Burnus <burnus@net-b.de>
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.
367 2019-01-11 Paolo Carlini <paolo.carlini@oracle.com>
369 * decl.c (start_decl): Improve error location.
370 (grokdeclarator): Likewise, improve two locations.
372 2019-01-09 Sandra Loosemore <sandra@codesourcery.com>
376 * cp-tree.h: Mechanically replace "can not" with "cannot".
377 * parser.c: Likewise.
380 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com>
382 * decl.c (grok_reference_init): Improve error location.
383 (grokdeclarator): Likewise, improve two locations.
385 2019-01-08 Marek Polacek <polacek@redhat.com>
387 PR c++/88538 - braced-init-list in template-argument-list.
388 * parser.c (cp_parser_template_argument): Handle braced-init-list when
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
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
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
423 (LOCAL_VARS_FORBIDDEN, LOCAL_VARS_AND_THIS_FORBIDDEN, THIS_FORBIDDEN):
426 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com>
428 * decl.c (start_decl): Improve permerror location.
430 2019-01-08 Jonathan Wakely <jwakely@redhat.com>
431 Jakub Jelinek <jakub@redhat.com>
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
438 2019-01-07 Paolo Carlini <paolo.carlini@oracle.com>
440 * decl.c (start_decl): Improve two error_at locations.
441 (expand_static_init): Likewise.
443 2019-01-07 Marek Polacek <polacek@redhat.com>
445 PR c++/88741 - wrong error with initializer-string.
446 * decl.c (cp_complete_array_type): Strip any location wrappers.
448 2019-01-07 Bernd Edlinger <bernd.edlinger@hotmail.de>
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.
464 2019-01-07 Jakub Jelinek <jakub@redhat.com>
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
477 2019-01-03 Jakub Jelinek <jakub@redhat.com>
480 * decl.c (builtin_function_1): Return result of pushdecl_top_level
481 or pushdecl rather than decl.
483 2019-01-03 Paolo Carlini <paolo.carlini@oracle.com>
485 * tree.c (handle_nodiscard_attribute): Improve warning location.
487 2019-01-02 Marek Polacek <polacek@redhat.com>
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.
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.
497 2019-01-01 Jakub Jelinek <jakub@redhat.com>
499 Update copyright years.
501 Copyright (C) 2019 Free Software Foundation, Inc.
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.