1 2019-02-18 Jason Merrill <jason@redhat.com>
3 PR c++/89336 - multiple stores in constexpr stmt.
4 * constexpr.c (cxx_eval_store_expression): Preevaluate scalar or
7 * pt.c (check_explicit_specialization): If the declarator is a
8 template-id, only check whether the arguments are dependent.
10 Improve duplicate [[likely]] diagnostic.
11 * parser.c (cp_parser_statement): Make attrs_loc a range. Pass it
12 to process_stmt_hotness_attribute.
13 * cp-gimplify.c (process_stmt_hotness_attribute): Take attrs_loc.
14 (genericize_if_stmt): Use likely/unlikely instead of predictor_name.
16 2019-02-17 Marek Polacek <polacek@redhat.com>
18 PR c++/89217 - ICE with list-initialization in range-based for loop.
19 * constexpr.c (unshare_constructor): No longer static.
20 * cp-tree.h (unshare_constructor): Declare.
21 * semantics.c (finish_compound_literal): When dealing with a
22 non-dependent expression in a template, return the original
23 expression. Pass LOOKUP_NO_NARROWING to digest_init_flags.
25 2019-02-13 Marek Polacek <polacek@redhat.com>
27 PR c++/89297 - ICE with OVERLOAD in template.
28 * semantics.c (finish_compound_literal): Call
29 instantiate_non_dependent_expr_sfinae.
31 2019-02-13 Alexandre Oliva <aoliva@redhat.com>
34 * cp-tree.h (USING_DECL_SCOPE): Use result rather than type.
35 * name-lookup.c (strip_using_decl): Use USING_DECL_SCOPE.
36 * search.c (protected_accessible_p): Follow USING_DECL_DECLS.
37 (shared_member_p): Likewise.
38 (lookup_member): Likewise.
39 * decl.c (grok_special_member_properties): Skip USING_DECLs.
40 * semantics.c (finish_omp_declare_simd_methods): Likewise.
41 (finish_qualified_id_expr): Do not call shared_member_p with
45 * pt.c (tsubst_lambda_expr): Avoid duplicate tsubsting.
46 Move cp_evaluated resetting before signature tsubsting.
47 (gen_elem_of_pack_expansion_instantiation): Separate local
48 specializations per index.
50 2019-02-13 David Malcolm <dmalcolm@redhat.com>
53 * class.c (add_method): Drop destructor assertion.
55 2019-02-13 Paolo Carlini <paolo.carlini@oracle.com>
58 * decl.c (make_typename_type): Allow for TYPE_PACK_EXPANSION as
59 context (the first argument).
60 * pt.c (tsubst, case TYPENAME_TYPE): Handle TYPE_PACK_EXPANSION
63 2019-02-12 Jason Merrill <jason@redhat.com>
65 PR c++/89144 - link error with constexpr initializer_list.
66 * call.c (convert_like_real) [ck_list]: Don't allocate a temporary
67 array for an empty list.
68 * typeck2.c (store_init_value): Don't use cxx_constant_init in a
71 2019-02-11 Jason Merrill <jason@redhat.com>
73 PR c++/89241 - ICE with __func__ in lambda in template.
74 * pt.c (enclosing_instantiation_of): Also check
75 instantiated_lambda_fn_p for the template context.
77 2019-02-11 Marek Polacek <polacek@redhat.com>
79 PR c++/89212 - ICE converting nullptr to pointer-to-member-function.
80 * pt.c (tsubst_copy_and_build) <case CONSTRUCTOR>: Return early for
81 null member pointer value.
83 2019-02-11 Jakub Jelinek <jakub@redhat.com>
86 * pt.c (convert_nontype_argument): Pass true as manifestly_const_eval
87 to maybe_constant_value calls.
89 2019-02-11 Marek Polacek <polacek@redhat.com>
91 * typeck2.c (digest_init_r): Remove commented code.
93 2019-02-11 Martin Sebor <msebor@redhat.com>
96 * decl.c (compute_array_index_type_loc): Preserve signed sizes
97 for diagnostics. Call valid_array_size_p instead of error.
98 * init.c (build_new_1): Compute size for diagnostic. Call
99 invalid_array_size_error
100 (build_new): Call valid_array_size_p instead of error.
102 2019-02-07 Alexandre Oliva <aoliva@redhat.com>
105 * call.c (compare_ics): Deal with ck_aggr in either cs.
107 2019-02-06 David Malcolm <dmalcolm@redhat.com>
110 * call.c (get_location_for_expr_unwinding_for_system_header): New
112 (conversion_null_warnings): Use it when getting locations for
113 EXPR, effectively adding a call to
114 get_location_for_expr_unwinding_for_system_header for
115 -Wconversion-null and making use of EXPR_LOCATION for
116 -Wzero-as-null-pointer-constant.
118 2019-02-05 Jakub Jelinek <jakub@redhat.com>
121 * optimize.c (maybe_thunk_body): Clear TREE_ADDRESSABLE on
122 PARM_DECLs of the thunk.
123 * lambda.c (maybe_add_lambda_conv_op): Likewise.
125 2019-02-05 Marek Polacek <polacek@redhat.com>
127 PR c++/89158 - by-value capture of constexpr variable broken.
128 * call.c (convert_like_real) <case ck_user>: Call mark_exp_read
129 instead of mark_rvalue_use.
131 2019-02-05 Alexandre Oliva <aoliva@redhat.com>
134 * pt.c (instantiates_primary_template_p): New.
135 (type_dependent_expression_p): Use it.
137 2019-02-01 Jason Merrill <jason@redhat.com>
139 PR c++/88761 - ICE with reference capture of constant.
140 * lambda.c (mark_const_cap_r): Do walk subtrees of DECL_EXPR for
143 2019-02-01 Marek Polacek <polacek@redhat.com>
145 PR c++/88325 - ICE with invalid out-of-line template member definition.
146 * parser.c (cp_parser_class_name): Don't call make_typename_type
149 2019-02-01 Jakub Jelinek <jakub@redhat.com>
152 * parser.c (cp_parser_gnu_attributes_opt): Set ok to false
153 if require_open failed.
155 2019-01-31 Marek Polacek <polacek@redhat.com>
157 PR c++/89083, c++/80864 - ICE with list initialization in template.
158 * constexpr.c (adjust_temp_type): Use copy_node and change the type
159 instead of using build_constructor.
160 * decl.c (reshape_init_r): Don't reshape a digested initializer.
161 Return the initializer for COMPOUND_LITERAL_P.
163 PR c++/88983 - ICE with switch in constexpr function.
164 * constexpr.c (cxx_eval_switch_expr): Use SWITCH_COND and SWITCH_BODY.
165 (cxx_eval_constant_expression) <case COND_EXPR>: Don't look for the
166 label in the else branch if we found it in the then branch.
168 2019-01-30 Jason Merrill <jason@redhat.com>
170 PR c++/88752 - ICE with lambda and constexpr if.
171 * cp-tree.h (LAMBDA_EXPR_INSTANTIATED): New.
172 * pt.c (tsubst_lambda_expr): Set it.
173 (instantiated_lambda_fn_p): Check it.
174 (enclosing_instantiation_of): Use it.
176 2019-01-31 Jakub Jelinek <jakub@redhat.com>
179 * cxx-pretty-print.c (pp_cxx_enumeration_constant): Print always as
180 a C cast in pp_c_flag_gnu_v3 mode.
182 2019-01-30 Jakub Jelinek <jakub@redhat.com>
185 * lambda.c (is_capture_proxy): Don't return true for
186 DECL_OMP_PRIVATIZED_MEMBER artificial vars.
188 2019-01-30 Marek Polacek <polacek@redhat.com>
190 PR c++/89119 - ICE with value-initialization in template.
191 * pt.c (tsubst_copy_and_build): Handle RANGE_EXPR.
193 2019-01-29 Jason Merrill <jason@redhat.com>
195 PR c++/86943 - wrong code converting lambda to function pointer.
196 * lambda.c (maybe_add_lambda_conv_op): Use a template-id in the
197 call. Only forward parms for decltype.
198 * pt.c (tsubst_copy_and_build) [CALL_EXPR]: Handle CALL_FROM_THUNK_P
200 * typeck.c (check_return_expr): Don't mess with a thunk call.
202 2019-01-28 Jason Merrill <jason@redhat.com>
204 PR c++/89089 - ICE with [[no_unique_address]].
205 PR c++/88865 - wrong layout with [[no_unique_address]].
206 * class.c (check_field_decls): A potentially-overlapping field makes
207 the class non-layout-POD, but not non-empty.
208 (end_of_class): Always consider empty data members.
209 (layout_class_type): Set DECL_SIZE for empty fields.
211 2019-01-28 Marek Polacek <polacek@redhat.com>
213 PR c++/88358 - name wrongly treated as type.
214 * parser.c (cp_parser_direct_declarator): Don't assume a qualified-id
215 in parameter-list is a type if the function's declarator-id is not
218 2019-01-27 Marek Polacek <polacek@redhat.com>
220 PR c++/88815 - narrowing conversion lost in decltype.
221 PR c++/78244 - narrowing conversion in template not detected.
222 * cp-tree.h (CONSTRUCTOR_IS_DEPENDENT): New.
223 * pt.c (instantiation_dependent_r): Consider a CONSTRUCTOR with
224 CONSTRUCTOR_IS_DEPENDENT instantiation-dependent.
225 * semantics.c (finish_compound_literal): When the compound literal
226 isn't instantiation-dependent and the type isn't type-dependent,
227 fall back to the normal processing. Set CONSTRUCTOR_IS_DEPENDENT.
229 PR c++/89024 - ICE with incomplete enum type.
230 * call.c (standard_conversion): When converting an
231 ARITHMETIC_TYPE_P to an incomplete type, return NULL.
233 2019-01-25 Paolo Carlini <paolo.carlini@oracle.com>
236 * call.c (build_op_delete_call): Implement 7.6.2.5/(10.1).
237 * decl2.c (coerce_delete_type): Use build_pointer_type instead
240 2019-01-24 Jason Merrill <jason@redhat.com>
242 PR c++/89001 - mangling of reference temporaries
243 * cp-tree.h (struct saved_scope): Add ref_temp_count.
244 (current_ref_temp_count): New macro.
245 * mangle.c (mangle_ref_init_variable): Use it.
246 * typeck2.c (store_init_value): Clear it.
247 * call.c (make_temporary_var_for_ref_to_temp): Copy public and
250 2019-01-24 Jakub Jelinek <jakub@redhat.com>
253 * semantics.c (finish_omp_cancel): Diagnose more than one if
254 on #pragma omp cancel with different modifiers. Use
255 maybe_convert_cond when not in template or build_x_binary_op
258 2019-01-23 Marek Polacek <polacek@redhat.com>
260 PR c++/88757 - qualified name treated wrongly as type.
261 * parser.c (cp_parser_direct_declarator): Don't treat qualified-ids
262 in parameter-list as types if name lookup for declarator-id didn't
263 find one or more function templates.
265 2019-01-23 Jakub Jelinek <jakub@redhat.com>
268 * cp-gimplify.c (genericize_cp_loop): Call begin_bc_block only
269 after genericizing cond and incr expressions.
272 * cp-gimplify.c (genericize_switch_stmt): Move cond genericization
273 before the begin_bc_block call.
275 2019-01-21 Jason Merrill <jason@redhat.com>
277 PR c++/87893 - constexpr ctor ICE on ARM.
278 PR c++/88293 - ICE with comma expression.
279 * constexpr.c (initialized_type): Don't shortcut non-void type.
280 Handle COMPOUND_EXPR.
281 (cxx_eval_outermost_constant_expr): Return early for void type.
283 2019-01-21 Jakub Jelinek <jakub@redhat.com>
286 * optimize.c (cxx_copy_decl): New function.
287 (clone_body): Use it instead of copy_decl_no_change.
290 * typeck.c (cp_build_binary_op): Don't instrument
291 SANITIZE_POINTER_COMPARE if processing_template_decl.
292 (pointer_diff): Similarly for SANITIZE_POINTER_SUBTRACT.
294 2019-01-18 Jason Merrill <jason@redhat.com>
296 PR c++/88875 - error with explicit list constructor.
297 * call.c (reference_binding): Don't modify EXPR. Set
298 need_temporary_p on the ck_user conversion for a temporary.
299 (convert_like_real): Check it.
301 2019-01-18 H.J. Lu <hongjiu.lu@intel.com>
305 * call.c (convert_for_arg_passing): Upate the
306 warn_for_address_or_pointer_of_packed_member call.
307 * typeck.c (convert_for_assignment): Likewise.
309 2019-01-17 Jason Merrill <jason@redhat.com>
311 PR c++/86205 - ICE with ?: of throw and template-id.
312 * pt.c (resolve_nondeduced_context_or_error): Split out from...
313 * typeck.c (decay_conversion): ...here.
314 * call.c (build_conditional_expr_1): Use it.
316 PR c++/86740, ICE with constexpr if and nested generic lambdas.
317 * tree.c (cp_walk_subtrees): Handle LAMBDA_EXPR.
319 2019-01-17 Paolo Carlini <paolo.carlini@oracle.com>
321 * decl.c (grokdeclarator): Use typespec_loc in error messages
322 about 'auto' and trailing return type.
324 2019-01-17 David Malcolm <dmalcolm@redhat.com>
327 * class.c (add_method): Don't use DECL_DESTRUCTOR_P on
330 2019-01-17 Nathan Sidwell <nathan@acm.org>
333 * semantics.c (process_outer_var_ref): Only skip dependent types
336 2019-01-17 Alexandre Oliva <aoliva@redhat.com>
339 * cp-tree.h (saved_scope): Add suppress_location_wrappers.
340 * name-lookup.c (do_push_to_top_level): Save and reset it.
341 (do_pop_from_top_level): Restore it.
344 * pt.c (make_template_placeholder): Use auto_identifier.
345 (is_auto): Drop CLASS_PLACEHOLDER_TEMPLATE test.
346 * error.c (dump_type): Handle template placeholders.
347 * cxx-pretty-print.c (pp_cx_unqualified_id): Likewise.
350 * cvt.c (convert_to_void): Handle all cdtor calls as if
353 2019-01-16 Paolo Carlini <paolo.carlini@oracle.com>
355 * decl.c (grokdeclarator): Use locations[ds_storage_class] in
356 error messages about ill-formed uses of mutable.
358 2019-01-16 Marek Polacek <polacek@redhat.com>
360 PR c++/78244 - narrowing conversion in template not detected.
361 * call.c (perform_implicit_conversion_flags): Set
362 IMPLICIT_CONV_EXPR_BRACED_INIT.
363 * cp-tree.h (IMPLICIT_CONV_EXPR_BRACED_INIT): New.
364 * pt.c (tsubst_copy_and_build): Use it.
366 2019-01-15 David Malcolm <dmalcolm@redhat.com>
369 * pt.c (build_deduction_guide): Bail out if tsubst_arg_types
372 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com>
374 * decl.c (start_decl): Improve error location.
375 * decl2.c (grokfield): Likewise.
377 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com>
379 * decl.c (grokdeclarator): Move further up the location_t loc
380 declaration and use the location when building a TYPE_DECL for
382 * decl2.c (grokbitfield): Use DECL_SOURCE_LOCATION in the error
383 about an ill-formed bit-field as typedef.
385 2019-01-14 Marek Polacek <polacek@redhat.com>
387 PR c++/88830 - ICE with abstract class.
388 * decl2.c (maybe_emit_vtables): Check CLASSTYPE_LAZY_DESTRUCTOR.
391 PR c++/88825 - ICE with bogus function return type deduction.
392 * typeck.c (can_do_nrvo_p): Check error_mark_node.
394 2019-01-14 Tom Honermann <tom@honermann.net>
396 Implement P0482R5, char8_t: A type for UTF-8 characters and strings
397 * cvt.c (type_promotes_to): Handle char8_t promotion.
398 * decl.c (grokdeclarator): Handle invalid type specifier
399 combinations involving char8_t.
400 * lex.c (init_reswords): Add char8_t as a reserved word.
401 * mangle.c (write_builtin_type): Add name mangling for char8_t (Du).
402 * parser.c (cp_keyword_starts_decl_specifier_p)
403 (cp_parser_simple_type_specifier): Recognize char8_t as a simple
405 (cp_parser_string_literal): Use char8_array_type_node for the type
407 (cp_parser_set_decl_spec_type): Tolerate char8_t typedefs in system
409 * rtti.c (emit_support_tinfos): type_info support for char8_t.
410 * tree.c (char_type_p): Recognize char8_t as a character type.
411 * typeck.c (string_conv_p): Handle conversions of u8 string
412 literals of char8_t type.
413 (check_literal_operator_args): Handle UDLs with u8 string literals
415 * typeck2.c (ordinary_char_type_p): New.
416 (digest_init_r): Disallow initializing a char array with a u8 string
419 2019-01-14 Martin Liska <mliska@suse.cz>
421 PR gcov-profile/88263
422 * decl2.c (get_tls_wrapper_fn): Use DECL_SOURCE_LOCATION
423 as location of the TLS wrapper.
425 2019-01-12 Paolo Carlini <paolo.carlini@oracle.com>
427 * decl.c (cp_finish_decl): Improve error location.
428 * decl2.c (grokfield): Likewise, improve two locations.
430 2019-01-11 Marek Polacek <polacek@redhat.com>
432 PR c++/88692, c++/87882 - -Wredundant-move false positive with *this.
433 * typeck.c (maybe_warn_pessimizing_move): Return if ARG isn't
436 2019-01-11 Jason Merrill <jason@redhat.com>
438 PR c++/88312 - pack expansion of decltype.
439 * pt.c (instantiation_dependent_r): A template non-type parameter
440 pack is instantiation-dependent.
442 2019-01-11 Jason Merrill <jason@redhat.com>
444 PR c++/88613 - ICE with use of const var in lambda.
445 * expr.c (mark_use): Fix location wrapper handling.
446 * cp-gimplify.c (cp_fold_maybe_rvalue): Call mark_rvalue_use.
448 2019-01-11 Tobias Burnus <burnus@net-b.de>
451 * decl2.c (maybe_emit_vtables): If needed, generate code for
452 the destructor of an abstract class.
453 (mark_used): Update comment for older function-name change.
455 2019-01-11 Paolo Carlini <paolo.carlini@oracle.com>
457 * decl.c (start_decl): Improve error location.
458 (grokdeclarator): Likewise, improve two locations.
460 2019-01-09 Sandra Loosemore <sandra@codesourcery.com>
464 * cp-tree.h: Mechanically replace "can not" with "cannot".
465 * parser.c: Likewise.
468 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com>
470 * decl.c (grok_reference_init): Improve error location.
471 (grokdeclarator): Likewise, improve two locations.
473 2019-01-08 Marek Polacek <polacek@redhat.com>
475 PR c++/88538 - braced-init-list in template-argument-list.
476 * parser.c (cp_parser_template_argument): Handle braced-init-list when
479 PR c++/88548 - this accepted in static member functions.
480 * parser.c (cp_debug_parser): Adjust printing of
481 local_variables_forbidden_p.
482 (cp_parser_new): Set local_variables_forbidden_p to 0 rather than false.
483 (cp_parser_primary_expression): When checking
484 local_variables_forbidden_p, use THIS_FORBIDDEN or
485 LOCAL_VARS_FORBIDDEN.
486 (cp_parser_lambda_body): Update the type of
487 local_variables_forbidden_p. Set it to 0 rather than false.
488 (cp_parser_condition): Adjust call to cp_parser_declarator.
489 (cp_parser_explicit_instantiation): Likewise.
490 (cp_parser_init_declarator): Likewise.
491 (cp_parser_declarator): New parameter. Use it.
492 (cp_parser_direct_declarator): New parameter. Use it to set
493 local_variables_forbidden_p. Adjust call to cp_parser_declarator.
494 (cp_parser_type_id_1): Adjust call to cp_parser_declarator.
495 (cp_parser_parameter_declaration): Likewise.
496 (cp_parser_default_argument): Update the type of
497 local_variables_forbidden_p. Set it to LOCAL_VARS_AND_THIS_FORBIDDEN
499 (cp_parser_member_declaration): Tell cp_parser_declarator if we saw
500 'static' or 'friend'.
501 (cp_parser_exception_declaration): Adjust call to cp_parser_declarator.
502 (cp_parser_late_parsing_default_args): Update the type of
503 local_variables_forbidden_p. Set it to LOCAL_VARS_AND_THIS_FORBIDDEN
505 (cp_parser_cache_defarg): Adjust call to cp_parser_declarator.
506 (cp_parser_objc_class_ivars): Likewise.
507 (cp_parser_objc_struct_declaration): Likewise.
508 (cp_parser_omp_for_loop_init): Likewise.
509 * parser.h (cp_parser): Change the type of local_variables_forbidden_p
511 (LOCAL_VARS_FORBIDDEN, LOCAL_VARS_AND_THIS_FORBIDDEN, THIS_FORBIDDEN):
514 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com>
516 * decl.c (start_decl): Improve permerror location.
518 2019-01-08 Jonathan Wakely <jwakely@redhat.com>
519 Jakub Jelinek <jakub@redhat.com>
522 * decl.c (finish_function): For -Wreturn-type don't add a return *this;
523 fixit hint if current_class_ref is NULL. Use a single if instead of
526 2019-01-07 Paolo Carlini <paolo.carlini@oracle.com>
528 * decl.c (start_decl): Improve two error_at locations.
529 (expand_static_init): Likewise.
531 2019-01-07 Marek Polacek <polacek@redhat.com>
533 PR c++/88741 - wrong error with initializer-string.
534 * decl.c (cp_complete_array_type): Strip any location wrappers.
536 2019-01-07 Bernd Edlinger <bernd.edlinger@hotmail.de>
542 * cp-tree.h (LOOKUP_ALLOW_FLEXARRAY_INIT): New flag value.
543 * typeck2.c (digest_init_r): Raise an error for non-static
544 initialization of a flexible array member.
545 (process_init_constructor, massage_init_elt,
546 process_init_constructor_array, process_init_constructor_record,
547 process_init_constructor_union, process_init_constructor): Add the
548 flags parameter and pass it thru.
549 (store_init_value): Pass LOOKUP_ALLOW_FLEXARRAY_INIT parameter to
550 digest_init_flags for static decls.
552 2019-01-07 Jakub Jelinek <jakub@redhat.com>
555 * cp-tree.h (cp_build_vec_convert): Declare.
556 * parser.c (cp_parser_postfix_expression): Parse
557 __builtin_convertvector.
558 * constexpr.c: Include fold-const-call.h.
559 (cxx_eval_internal_function): Handle IFN_VEC_CONVERT.
560 (potential_constant_expression_1): Likewise.
561 * semantics.c (cp_build_vec_convert): New function.
562 * pt.c (tsubst_copy_and_build): Handle CALL_EXPR to
565 2019-01-03 Jakub Jelinek <jakub@redhat.com>
568 * decl.c (builtin_function_1): Return result of pushdecl_top_level
569 or pushdecl rather than decl.
571 2019-01-03 Paolo Carlini <paolo.carlini@oracle.com>
573 * tree.c (handle_nodiscard_attribute): Improve warning location.
575 2019-01-02 Marek Polacek <polacek@redhat.com>
577 PR c++/88612 - ICE with -Waddress-of-packed-member.
578 * call.c (convert_for_arg_passing): Only give warnings with tf_warning.
579 * typeck.c (convert_for_assignment): Likewise.
581 PR c++/88631 - CTAD failing for value-initialization.
582 * typeck2.c (build_functional_cast): Try deducing the template
583 arguments even if there are no arguments to deduce from.
585 2019-01-01 Jakub Jelinek <jakub@redhat.com>
587 Update copyright years.
589 Copyright (C) 2019 Free Software Foundation, Inc.
591 Copying and distribution of this file, with or without modification,
592 are permitted in any medium without royalty provided the copyright
593 notice and this notice are preserved.