1 2019-10-30 Jason Merrill <jason@redhat.com>
3 * cxx-pretty-print.c (get_fold_operator): Use OVL_OP_INFO.
5 2019-10-30 Marek Polacek <polacek@redhat.com>
7 PR c++/92134 - constinit malfunction in static data member.
8 * decl2.c (grokfield): Set LOOKUP_CONSTINIT.
10 2019-10-30 Jakub Jelinek <jakub@redhat.com>
12 * cp-tree.h (omp_declare_variant_finalize, build_local_temp): Declare.
13 * decl.c: Include omp-general.h.
14 (declare_simd_adjust_this): Add forward declaration.
15 (omp_declare_variant_finalize_one, omp_declare_variant_finalize): New
17 (cp_finish_decl, finish_function): Call omp_declare_variant_finalize.
18 * parser.c (cp_finish_omp_declare_variant): Adjust parsing of the
19 variant id-expression and propagate enough information to
20 omp_declare_variant_finalize_one in the attribute so that it can
22 * class.c (finish_struct): Call omp_declare_variant_finalize.
23 * tree.c (build_local_temp): No longer static, remove forward
26 2019-10-30 Paolo Carlini <paolo.carlini@oracle.com>
28 * typeck.c (cp_build_modify_expr): Prefer error + inform to
29 error + error in one place.
30 (get_delta_difference_1): Likewise.
31 (get_delta_difference): Likewise, in two places.
33 2019-10-29 Paolo Carlini <paolo.carlini@oracle.com>
35 * typeck.c (build_x_unary_op): Use the location_t argument in
38 2019-10-29 Marek Polacek <polacek@redhat.com>
40 PR c++/90998 - ICE with copy elision in init by ctor and -Wconversion.
41 * call.c (joust): Don't attempt to warn if ->second_conv is null.
43 2019-10-29 Jakub Jelinek <jakub@redhat.com>
46 * cp-gimplify.c (cp_gimplify_expr): If gimplify_to_rvalue changes the
47 function pointer type, re-add cast to the original one.
49 2019-10-29 Marek Polacek <polacek@redhat.com>
51 PR c++/91548 - fix detecting modifying const objects for ARRAY_REF.
52 * constexpr.c (cxx_eval_store_expression): Don't call
53 modifying_const_object_p for ARRAY_REF.
55 2019-10-29 Richard Sandiford <richard.sandiford@arm.com>
57 * cp-objcp-common.h (cxx_simulate_enum_decl): Declare.
58 (LANG_HOOKS_SIMULATE_ENUM_DECL): Define to the above.
59 * decl.c (cxx_simulate_enum_decl): New function.
61 2019-10-29 Richard Sandiford <richard.sandiford@arm.com>
63 * cp-tree.h (cxx_simulate_builtin_function_decl): Declare.
64 * decl.c (cxx_simulate_builtin_function_decl): New function.
65 * cp-objcp-common.h (LANG_HOOKS_SIMULATE_BUILTIN_FUNCTION_DECL):
68 2019-10-28 Martin Sebor <msebor@redhat.com>
71 * cp-objcp-common.c (names_builtin_p): Define new function.
73 2019-10-28 Nathan Sidwell <nathan@acm.org>
75 * parser.h (struct cp_token): Drop {ENUM,BOOL}_BITFIELD C-ism.
76 Add tree_check_p flag, use as nested union discriminator.
77 (struct cp_lexer): Add saved_type & saved_keyword fields.
78 * parser.c (eof_token): Delete.
79 (cp_lexer_new_main): Always init last_token to last token of
81 (cp_lexer_new_from_tokens): Overlay EOF token at end of range.
82 (cp_lexer_destroy): Restore token under the EOF.
83 (cp_lexer_previous_token_position): No check for eof_token here.
84 (cp_lexer_get_preprocessor_token): Clear tree_check_p.
85 (cp_lexer_peek_nth_token): Check CPP_EOF not eof_token.
86 (cp_lexer_consume_token): Assert not CPP_EOF, no check for
88 (cp_lexer_purge_token): Likewise.
89 (cp_lexer_purge_tokens_after): No check for EOF token.
90 (cp_parser_nested_name_specifier, cp_parser_decltype)
91 (cp_parser_template_id): Set tree_check_p.
93 2019-10-24 Jakub Jelinek <jakub@redhat.com>
95 * decl2.c (cplus_decl_attributes): Add "omp declare target block"
96 attribute in between declare target and end declare target
99 * call.c (convert_arg_to_ellipsis): Add missing space in string
102 2019-10-24 Marek Polacek <polacek@redhat.com>
104 * decl.c (reshape_init_r): Add missing space.
106 2019-10-24 Nathan Sidwell <nathan@acm.org>
108 * pt.c (reduce_template_parm_level): Attach the new TPI to the new
110 (convert_generic_types_to_packs): Pass the copied type to
111 reduce_templatE_parm_level.
113 2019-10-23 Nathan Sidwell <nathan@acm.org>
115 * cp-tree.c (CPTI_STD_IDENTIFIER): Delete.
116 (std_identifier): Delete.
117 (DECL_NAME_SPACE_STD_P): Compare against std_node.
118 * decl.c (initialize_predefined_identifiers): 'std' is not needed.
119 (cxx_init_decl_processing): Adjust creation of ::std. Use
120 {push,pop}_nested_namespace.
121 (cxx_builtin_function): Use {push,pop}_nested_namespace.
122 * except.c (init_exception_processing): Likewise.
123 * rtti.c (init_rtti_processing): Likewise.
125 2019-10-23 Jason Merrill <jason@redhat.com>
127 Implement P1286R2, Contra CWG1778
128 * method.c (defaulted_late_check): Don't check explicit
129 exception-specification on defaulted function.
130 (after_nsdmi_defaulted_late_checks): Remove.
131 * parser.h (struct cp_unparsed_functions_entry): Remove classes.
132 * parser.c (unparsed_classes): Remove.
133 (push_unparsed_function_queues, cp_parser_class_specifier_1):
136 2019-10-23 Jakub Jelinek <jakub@redhat.com>
138 * constexpr.c (cxx_eval_constant_expression) <case CLEANUP_STMT>:
139 Temporarily change input_location to CLEANUP_STMT location.
141 2019-10-22 Jakub Jelinek <jakub@redhat.com>
143 PR tree-optimization/85887
144 * decl.c (expand_static_init): Drop ECF_LEAF from __cxa_guard_acquire
145 and __cxa_guard_release.
147 2019-10-22 Marc Glisse <marc.glisse@inria.fr>
150 * constexpr.c (cxx_eval_builtin_function_call): Only set
151 force_folding_builtin_constant_p if manifestly_const_eval.
153 2019-10-22 Richard Sandiford <richard.sandiford@arm.com>
155 * cp-tree.h (STF_USER_VISIBLE): New constant.
156 (strip_typedefs, strip_typedefs_expr): Take a flags argument.
157 * tree.c (strip_typedefs, strip_typedefs_expr): Likewise,
158 updating mutual calls accordingly. When STF_USER_VISIBLE is true,
159 only look through typedefs if user_facing_original_type_p.
160 * error.c (dump_template_bindings, type_to_string): Pass
161 STF_USER_VISIBLE to strip_typedefs.
162 (dump_type): Likewise, unless pp_c_flag_gnu_v3 is set.
164 2019-10-21 Kamlesh Kumar <kamleshbhalui@gmail.com>
165 Jason Merrill <jason@redhat.com>
167 PR c++/83534 - typeinfo of noexcept function
168 * rtti.c (get_tinfo_decl_dynamic): Do not call
169 TYPE_MAIN_VARIANT for function.
170 (get_typeid): Likewise.
172 2019-10-21 Paolo Carlini <paolo.carlini@oracle.com>
174 * parser.c (cp_parser_class_head): Improve error recovery upon
175 extra qualification error.
177 2019-10-21 Jakub Jelinek <jakub@redhat.com>
180 * constexpr.c (cxx_eval_component_reference, cxx_eval_bit_field_ref):
181 Use STRIP_ANY_LOCATION_WRAPPER on CONSTRUCTOR elts.
183 2019-10-21 Marek Polacek <polacek@redhat.com>
185 PR c++/92062 - ODR-use ignored for static member of class template.
186 * pt.c (has_value_dependent_address): Strip location wrappers.
188 2019-10-21 Marek Polacek <polacek@redhat.com>
190 PR c++/92106 - ICE with structured bindings and -Wreturn-local-addr.
191 * typeck.c (maybe_warn_about_returning_address_of_local): Avoid
192 recursing on null initializer and return false instead.
194 2019-10-17 JeanHeyd Meneide <phdofthehouse@gmail.com>
196 Implement p1301 [[nodiscard("should have a reason")]] + p1771 DR
197 * tree.c (handle_nodiscard_attribute): Handle C++2a nodiscard
199 (std_attribute_table) Increase nodiscard argument handling
200 max_length from 0 to 1.
201 * parser.c (cp_parser_check_std_attribute): Add requirement
202 that nodiscard only be seen once in attribute-list.
203 (cp_parser_std_attribute): Check that empty parenthesis lists are
204 not specified for attributes that have max_length > 0 (e.g.
206 * cvt.c (maybe_warn_nodiscard): Add nodiscard message to
207 output, if applicable.
208 (convert_to_void): Allow constructors to be nodiscard-able (P1771).
210 2019-10-18 Nathan Sidwell <nathan@acm.org>
212 * cp-tree.h (struct lang_type): Remove was_anonymous.
213 (TYPE_WAS_UNNAMED): Implement by checking TYPE_DECL &
215 * decl.c (name_unnamed_type): Don't set TYPE_WAS_UNNAMED.
217 2019-10-17 Paolo Carlini <paolo.carlini@oracle.com>
219 * decl.c (grokfndecl): Remove redundant use of in_system_header_at.
220 (compute_array_index_type_loc): Likewise.
221 (grokdeclarator): Likewise.
222 * error.c (cp_printer): Likewise.
223 * lambda.c (add_default_capture): Likewise.
224 * parser.c (cp_parser_primary_expression): Likewise.
225 (cp_parser_selection_statement): Likewise.
226 (cp_parser_toplevel_declaration): Likewise.
227 (cp_parser_enumerator_list): Likewise.
228 (cp_parser_using_declaration): Likewise.
229 (cp_parser_member_declaration): Likewise.
230 (cp_parser_exception_specification_opt): Likewise.
231 (cp_parser_std_attribute_spec): Likewise.
232 * pt.c (do_decl_instantiation): Likewise.
233 (do_type_instantiation): Likewise.
234 * typeck.c (cp_build_unary_op): Likewise.
236 * decl.c (check_tag_decl): Pass to in_system_header_at the same
237 location used for the permerror.
238 (grokdeclarator): Likewise.
240 * decl.c (check_tag_decl): Use locations[ds_typedef] in error_at.
242 2019-10-17 Jason Merrill <jason@redhat.com>
244 * cp-gimplify.c (cp_gimplify_expr): Use get_initialized_tmp_var.
245 (gimplify_to_rvalue): Remove default NULL argument.
247 2019-10-17 Nathan Sidwell <nathan@acm.org>
249 * decl.c (builtin_function_1): Merge into ...
250 (cxx_builtin_function): ... here. Nadger the decl before maybe
251 copying it. Set the context.
252 (cxx_builtin_function_ext_scope): Push to top level, then call
253 cxx_builtin_function.
255 2019-10-16 Luis Machado <luis.machado@linaro.org>
257 * cp-gimplify.c: Fix reference to non-existing tree-gimple.c file.
259 2019-10-16 Jakub Jelinek <jakub@redhat.com>
261 * decl.c (cxx_maybe_build_cleanup): When clearing location of cleanup,
262 if cleanup is a nop, clear location of its operand too.
264 2019-10-15 Andrew Sutton <asutton@lock3software.com>
266 Finish moving constraint and logic functionality of out pt.c.
267 Reimplement and re-enable subsumption caching.
269 * config-lang.in (gtfiles): Add logic.cc.
270 * constraint.cc (atomic_constraints_identical_p): Add assertions.
271 (hash_atomic_constraint): Likewise.
272 (constraints_equivalent_p): New.
273 (inchash::add_constraint): New.
274 (iterative_hash_constraint): New.
275 (decl_constraints): Moved from pt.c.
276 (get_constraints): Likewise.
277 (set_constraints): Likewise.
278 (remove_constraints): Likewise.
279 * cp-tree.h (CONSTR_P): New.
280 (init_constraint_processing): Remove.
281 (constraints_equivalent_p, iterative_hash_constraint): Declare.
282 * decl.c (cxx_init_decl_processing): Don't initialize constraints.
283 * logic.cc (subsumption_entry): Moved from pt.c.
284 (subsumption_hasher): Likewise.
285 (subsumption_cache): Likewise.
286 (lookup_subsumption): Likewise.
287 (save_subsumption): Likewise.
288 (subsumes_constraints_nonnull): Use subsumption cache.
289 * pt.c: Move aforementioned declarations out of this file.
290 (init_constraint_processing): Remove.
292 2019-10-15 Andrew Sutton <asutton@lock3software.com>
294 * parser.c (cp_parser_constructor_declarator_p): Pass an empty
295 decl-specifier-seq to make sure we parse type constraints as part
298 2019-10-15 Nathan Sidwell <nathan@acm.org>
300 * class.c (build_clones): Break out of clone_function_decl. Just
302 (clone_function_decl): Call build_clones, then maybe add them to
305 * class.c (build_clone): Refactor to clarify recursiveness.
307 2019-10-14 Jason Merrill <jason@redhat.com>
309 PR c++/91930 - ICE with constrained inherited default ctor.
310 * name-lookup.c (do_class_using_decl): Set TYPE_HAS_USER_CONSTRUCTOR
311 for inherited constructor.
313 2019-10-14 Paolo Carlini <paolo.carlini@oracle.com>
315 * decl.c (check_tag_decl): Use DECL_SOURCE_LOCATION.
317 2019-10-14 Jakub Jelinek <jakub@redhat.com>
320 * semantics.c (handle_omp_array_sections_1): Temporarily disable
321 -fstrong-eval-order also for in_reduction and task_reduction clauses.
323 * parser.c (cp_parser_omp_all_clauses): Change bool NESTED_P argument
324 into int NESTED, if it is 2, diagnose missing commas in between
326 (cp_parser_omp_context_selector): Pass 2 as last argument to
327 cp_parser_omp_all_clauses.
329 2019-10-12 Jakub Jelinek <jakub@redhat.com>
331 * parser.c (cp_parser_omp_context_selector): Improve error recovery.
332 For simd properties, put them directly into TREE_VALUE.
333 (cp_finish_omp_declare_variant): Add "omp declare variant base"
334 attribute rather than "omp declare variant".
336 2019-10-11 Marek Polacek <polacek@redhat.com>
338 PR c++/92049 - extra error with -fchecking=2.
339 * pt.c (build_non_dependent_expr): Call fold_non_dependent_expr
342 2019-10-11 Paolo Carlini <paolo.carlini@oracle.com>
344 * typeck.c (cp_build_binary_op): Do not handle RROTATE_EXPR and
346 * constexpr.c (cxx_eval_constant_expression): Likewise.
347 (potential_constant_expression_1): Likewise.
348 * pt.c (tsubst_copy): Likewise.
350 2019-10-11 Jason Merrill <jason@redhat.com>
352 * decl2.c (mark_used): Don't clobber DECL_SOURCE_LOCATION on
353 explicitly defaulted functions.
354 * method.c (synthesize_method): Likewise.
356 2019-10-11 Jakub Jelinek <jakub@redhat.com>
359 * decl2.c (grok_array_decl): For -fstrong-eval-order, when array ref
360 operands have been swapped and at least one operand has side-effects,
361 revert the swapping before calling build_array_ref.
362 * typeck.c (cp_build_array_ref): For non-ARRAY_TYPE array ref with
363 side-effects on the index operand, if -fstrong-eval-order use
364 save_expr around the array operand.
365 (cp_build_binary_op): For shifts with side-effects in the second
366 operand, wrap first operand into SAVE_EXPR and evaluate it before
368 * semantics.c (handle_omp_array_sections_1): Temporarily disable
369 flag_strong_eval_order during OMP_CLAUSE_REDUCTION array section
371 * cp-gimplify.c (gimplify_to_rvalue): New function.
372 (cp_gimplify_expr): Use it.
374 2019-10-10 Marek Polacek <polacek@redhat.com>
376 * typeck.c (comp_ptr_ttypes_real): Change the return type to bool.
377 Use false instead of 0.
379 2019-10-10 Jakub Jelinek <jakub@redhat.com>
381 * parser.h (struct cp_omp_declare_simd_data): Add variant_p member.
382 * parser.c (cp_ensure_no_omp_declare_simd): Handle both declare simd
384 (cp_parser_oacc_all_clauses): Formatting fix.
385 (cp_parser_omp_all_clauses): Add NESTED_P argument, if true, terminate
386 processing on closing paren and don't skip to end of pragma line.
387 (cp_parser_omp_declare_simd): Add VARIANT_P argument. Handle also
389 (omp_construct_selectors, omp_device_selectors,
390 omp_implementation_selectors, omp_user_selectors): New variables.
391 (cp_parser_omp_context_selector,
392 cp_parser_omp_context_selector_specification,
393 cp_finish_omp_declare_variant): New functions.
394 (cp_parser_late_parsing_omp_declare_simd): Handle also declare variant.
395 (cp_parser_omp_declare): Handle declare variant.
397 2019-10-09 Jason Merrill <jason@redhat.com>
399 * cp-tree.h (template_info_decl_check): Check ENABLE_TREE_CHECKING.
401 2019-10-09 Marek Polacek <polacek@redhat.com>
403 PR c++/91364 - P0388R4: Permit conversions to arrays of unknown bound.
404 PR c++/69531 - DR 1307: Differently bounded array parameters.
405 PR c++/88128 - DR 330: Qual convs and pointers to arrays of pointers.
406 * call.c (build_array_conv): Build ck_identity at the beginning
408 (standard_conversion): Pass bounds_none to comp_ptr_ttypes_const.
409 (maybe_warn_array_conv): New.
410 (convert_like_real): Call it. Add an error message about converting
411 from arrays of unknown bounds.
412 (conv_get_original_expr): New.
413 (nelts_initialized_by_list_init): New.
414 (conv_binds_to_array_of_unknown_bound): New.
415 (compare_ics): Implement list-initialization ranking based on
416 array sizes, as specified in DR 1307 and P0388R.
417 * cp-tree.h (comp_ptr_ttypes_const): Adjust declaration.
418 (compare_bounds_t): New enum.
419 * typeck.c (comp_array_types): New bool and compare_bounds_t
420 parameters. Use them.
421 (structural_comptypes): Adjust the call to comp_array_types.
422 (similar_type_p): Handle ARRAY_TYPE.
423 (build_const_cast_1): Pass bounds_none to comp_ptr_ttypes_const.
424 (comp_ptr_ttypes_real): Don't check cv-quals of ARRAY_TYPEs. Use
425 comp_array_types to compare array types. Look through arrays as per
427 (comp_ptr_ttypes_const): Use comp_array_types to compare array types.
428 Look through arrays as per DR 330.
430 2019-10-09 Marek Polacek <polacek@redhat.com>
432 PR c++/92032 - DR 1601: Promotion of enum with fixed underlying type.
433 * call.c (standard_conversion): When converting an enumeration with
434 a fixed underlying type to the underlying type, give it the cr_promotion
436 (compare_ics): Implement a tiebreaker as per CWG 1601.
438 2019-10-08 Andrew Sutton <asutton@lock3software.com>
439 Jason Merrill <jason@redhat.com>
441 Update the concepts implementation to conform to the C++20
442 specification, improve compile times, and generally clean up
444 * call.c (build_new_function_call): Don't evaluate concepts here.
445 (constraint_failure): Don't record the template.
446 (print_z_candidate): Don't extract the template.
447 * class.c (add_method): When overloading, hide ineligible special
449 (check_methods): Set TYPE_HAS_COMPLEX_* here.
450 * constexpr.c (cxx_eval_constant_expression): Evaluate concepts.
451 (maybe_initialize_fundef_copies_table): Remove.
452 (get_fundef_copy): Use hash_map_safe_get_or_insert.
453 (clear_cv_and_fold_caches): Clear the satisfaction cache.
454 * constraint.cc (known_non_bool_p): New.
455 (parsing_constraint_expression_sentinel): Renamed from
456 expanding_constraint_sentinel.
457 (check_constraint_operands): New.
458 (check_constraint_atom): New.
459 (finish_constraint_binary_op): New.
460 (finish_constraint_or_expr): Likewise.
461 (finish_constraint_and_expr): Likewise.
462 (finish_constraint_primary_expr): Likewise.
463 (combine_constraint_expressions): New.
464 (finish_requires_expr): Add location parm.
465 (get_concept_definition): Return the initializer of concept definitions.
466 (get_template_head_requirements): New.
467 (get_trailing_function_requirements): New.
468 (deduce_constrained_parameter): Check if the identifier or template-id
469 is a concept definition.
470 (resolve_concept_definition_check): Removed.
471 (resolve_variable_concept_check): Removed.
472 (resolve_concept_check): New.
473 (resolve_constraint_check): Handle concept definitions.
474 converting arguments.
475 (function_concept_check_p): Removed.
476 (variable_concept_check_p): Removed.
477 (unpack_concept_check): New.
478 (get_concept_check_template): New.
479 (build_call_check): Moved and renamed to build_function_check.
480 (build_concept_check_arguments): make static.
481 (build_function_check): Always do overload resolution
482 in order to force conversion of template arguments (i.e., actually
483 check that the use of a concept is valid).
484 (build_standard_check): Renamed from build_real_concept_check.
485 (build_real_concept_check): Build checks for C++2a concepts by
486 (build_wildcard_concept_check): New.
487 (build_concept_check): Use build_real_concept_check. New overload.
488 (build_constraints): Save expressions, not normalized constraints.
489 (build_concept_id): New. Pass tf_warning_or_error.
490 (build_type_constraint): New.
491 (finish_type_constraints): New.
492 (associate_classtype_constraints): Also add constraints to union
493 types. Note the original declaration in errors. Don't return
494 error_mark_node in order to avoid an assertion later.
495 (push_down_pack_expansion): Remove.
496 (finish_shorthand_constraint): Make fold expressions, not naked
497 parameter packs. Always apply the constraint to each template argument.
498 (check_introduction_list): New. Fail if not enough
499 names are introduced.
500 (finish_template_introduction): Don't normalize constraints. Pass
501 tsubst flags. Check for insufficient introductions.
502 (placeholder_extract_concept_and_args): Handle the template-id case.
503 Unpack function concept checks correctly.
504 (tsubst_simple_requirement): Return errors if they occur. Don't
505 process as a template.
506 (tsubst_type_requirement): Likewise.
507 (type_deducible_p): New. Wrap the input expression in parens for the
508 purpose of deduction.
509 (expression_convertible_t): New.
510 (tsubst_compound_requirement): Use new deduction, conversion predicates.
511 (tsubst_nested_requirement): Return errors if they occur. Don't
512 process as a template. Instantiate and evaluate the nested requirement.
513 (tsubst_valid_expression_requirement): New.
514 (tsubst_simple_requirement): Use tsubst_valid_expression_requirement.
515 (tsubst_compound_requirement): Use tsubst_valid_expression_requirement.
516 (check_constaint_variables): New.
517 (tsubst_constraint_variables): Check that type substitutions are valid.
518 (tsubst_requires_expr): Likewise. Produce new requires-exprs during
519 template substitution. Copy the previous local specialization stack,
520 so references to non-local parameters can be found. Use cp_unevaluated.
521 (tsubst_constraint): New. Don't evaluate concept checks.
523 (norm_info): New. Used to build a normalization tree for concept check
525 (debug_parameter_mapping): New.
526 (debug_argument_list): New.
527 (expand_concept): Removed.
528 (normalize_logical_operation): Pass subst_info through call.
529 (normalize_pack_expansion): Remove.
530 (normalize_simple_requirement): Removed
531 (normalize_type_requirement): Removed
532 (normalize_compound_requirement): Removed
533 (normalize_nested_requirement): Removed
534 (normalize_requirement): Removed
535 (normalize_requirements): Removed
536 (normalize_requires_expression): Removed
537 (normalize_variable_concept_check): Removed.
538 (normalize_function_concept_check): Removed.
539 (normalize_concept_check): Merged all normalize_*_check here.
540 Substitute through written template arguments before normalizing the
541 definition. Only substitute the innermost template arguments.
542 (check_for_logical_overloads): Delete.
543 (map_arguments): New. Associate template parameters with arguments.
544 (build_parameter_mapping): New. Extract used parameters.
545 (normalize_expression): Rewrite.
546 (normalize_conjunction): Removed
547 (normalize_disjunction): Removed
548 (normalize_predicate_constraint): Removed
549 (normalize_parameterized_constraint): Removed
550 (normalized_map): New variable.
551 (get_normalized_constraints): New entry point for normalization.
553 (get_normalized_constraints_from_info): New.
554 (get_normalized_constraints_from_decl): New. Turn on template processing
555 prior to normalization. Handle inheriting ctors. Build the
556 normalization arguments from the full set of template parameters of the
557 most general template. This guarantees that we have no concrete arguments
558 in the parameter mapping (e.g., from template members of class
559 templates). Cache normalizations.
560 (normalize_concept_definition): New. Cache normalizations.
561 (normalize_template_requirements): New.
562 (normalize_nontemplate_requirements): New.
563 (normalize_constraint_expression): New.
564 (tsubst_parameter_mapping): New.
565 (get_mapped_args): New.
566 (parameter_mapping_equivalent_p): New. Use template_args_equal.
567 (atomic_constraints_identical_p): New.
568 (hash_atomic_constraint): New.
569 (satisfying_constraint_p): New. Guard against recursive evaluation of
570 constraints during satisfaction.
571 (satisfy_conjunction): New.
572 (satisfy_disjunction): New.
573 (sat_entry): New class for hashing satisfaction results.
574 (sat_hasher): New hash traits.
576 (get_satisfaction): New. Returns cached satisfaction result.
577 (save_satisfaction): New. Caches a satisfaction result.
578 (clear_satisfaction_cache): New.
579 (satisfaction_cache): New. Helps manage satisfaction cache requests.
580 (decl_satisfied_cache): New.
582 (satisfy_constraint_r): New.
583 (satisfy_constraint): Use new satisfaction algorithm.
584 (evaluate_concept_check): New.
585 (evaluate_concept): Removed.
586 (evaluate_function_concept): Removed.
587 (evaluate_variable_concept): Removed.
588 (satisfy_constraint_expression): New.
589 (constraint_expression_satisfied_p): New.
590 (constraints_satisfied_p): Use strip_inheriting_ctors. Use
591 push_/pop_access_scope.
592 (more_constrained): Normalize before calling out to subsumption. Allow
593 classes as arguments.
594 (strictly_subsumes): Allow non-templates as arguments. Accept a new
596 (weakly_subsumes): New.
597 (at_least_as_constrained): Removed.
598 (diagnose_other_expression): Removed.
599 (diagnose_predicate_constraint): Removed.
600 (diagnose_pack_expansion): Removed.
601 (diagnose_check_constraint): Removed.
602 (diagnose_logical_constraint): Removed.
603 (diagnose_expression_constraint): Removed.
604 (diagnose_type_constraint): Removed.
605 (diagnose_implicit_conversion_constraint): Removed.
606 (diagnose_argument_deduction_constraint): Removed.
607 (diagnose_exception_constraint): Removed.
608 (diagnose_parameterized_constraint): Removed.
609 (diagnose_argument_deduction_constraint): Removed.
610 (diagnose_argument_deduction_constraint): Removed.
611 (diagnose_argument_deduction_constraint): Removed.
612 (diagnose_trait_expr): New.
613 (diagnose_requires_expr): New.
614 (diagnose_atomic_constraint): New.
615 (diagnose_valid_expression) Stop wrongly diagnosing valid expressions.
616 Don't substitute as if in template decls. This causes substitution
617 to generate expressions that aren't suitable for use with the noexcept
619 (diagnose_valid_type) Likewise.
620 (diagnose_compound_requirement) Actually emit diagnostics for
621 the causes of errors.Call force_paren_expr_uneval.
622 (diagnose_declaration_constraints): Turn on template processing to
623 suppress certain analyses.
624 * cp-objcp-common.c (cp_common_init_ts): Make concepts typed.
625 (cp_get_debug_type): Use hash_map_safe_*.
626 * cp-tree.h: New function declarations for semantic actions, other
627 facilities. Remove declaration no longer used or needed. Remove
628 unused _CONSTR macros.
629 (LANG_DECL_HAS_MIN): Add CONCEPT_DECL.
630 (template_info_decl_check): Factor macro check into an inline function.
631 (DECL_TEMPLATE_INFO): Use new check facility.
632 (finish_concept_definition): New. Don't invalid concept declarations
633 with invalid initializers.
634 (find_template_parameters): New.
635 (concept_definition_p): New.
636 (concept_check_p): New.
637 (variable_concept_check_p): New.
638 (force_paren_expr_uneval): New.
639 (ovl_iterator::using_p): A USING_DECL by itself was also
640 introduced by a using-declaration.
641 (struct tree_template_info): Use tree_base instead of
642 tree_common. Add tmpl and args fields.
643 (TI_TEMPLATE, TI_ARGS): Adjust.
644 (DECLTYPE_FOR_INIT_CAPTURE): Remove.
645 (CONSTR_CHECK, CONSTR_INFO, CONSTR_EXPR, CONSTR_CONTEXT): New.
646 (ATOMIC_CONSTR_MAP, TRAIT_EXPR_LOCATION): New.
647 (struct tree_trait_expr): Add locus field.
648 (enum tsubst_flags): Add tf_norm as a hint to generate normalization
649 context when diagnosing constraint failure.
650 * cp-tree.def: Remove unused _CONSTR nodes and rename PRED_CONSTR
653 * cxx-pretty-print.c: Remove constraint printing code.
654 (pp_cxx_concept_definition): New.
655 (pp_cxx_template_declaration): Print concept definitions.
656 (pp_cxx_check_constraint): Update printing for concept definitions.
657 (pp_cxx_nested_name_specifier): Fix a weird
658 case where we're printing '::::' for concepts.
659 (simple_type_specifier): Print requirements for placeholder types.
660 (pp_cxx_constrained_type_spec): Print the associated requirements of
662 (pp_cxx_compound_requirement): Add space before the '->'.
663 (pp_cxx_parameter_mapping): Print the parameter mapping.
664 (pp_cxx_atomic_constraint): Use the function above.
665 * decl.c (redeclaration_error_message): New error for concepts.
666 (grokdeclarator): Check for and disallow decltype(auto) in parameter
668 (grokfndecl): Don't normalize constraints. Add check for constraints
670 (grokvardecl): Don't normalize constraints.
671 (grok_special_member_properties): Don't set TYPE_HAS_COMPLEX_*.
672 (function_requirements_equivalent_p): New. Compare trailing
673 requires clauses. Compare combined constraints in pre-C++20 mode.
674 (decls_match): Compare trailing requires clauses. Compare template
675 heads for function templates. Remove old constraint comparison.
676 Simplify comparison of functions, function templates.
677 (duplicate_function_template_decls): New. Refactor a nasty if
678 condition into a single predicate.
679 (require_deduced_type): Don't complain if we already complained about
681 (finish_function): Perform auto deduction to ensure that constraints
682 are checked even when functions contain no return statements. Only do
683 auto deduction if we haven't previously seen any return statements.
684 This prevents multiple diagnostics of the same error.
685 (store_decomp_type): Remove.
686 (cp_finish_decomp): Use hash_map_safe_put.
687 * error.c: Remove constraint printing code.
688 (dump_decl): Dump concept definitions. Handle wildcard declarations.
689 (dump_template_decl): Likewise.
690 (dump_type): Print associated requirements for placeholder
692 (rebuild_concept_check): New.
693 (maybe_print_single_constraint_context): New.
694 (maybe_print_constraint_context): Recursively print nested contexts.
695 * init.c (get_nsdmi): Use hash_map_safe_*.
696 * lambda.c (maybe_add_lambda_conv_op): Bail if deduction failed.
697 (add_capture): Copy parameter packs from init.
698 (lambda_capture_field_type): Always use auto for init-capture.
699 * logic.cc: Completely rewrite.
700 (constraint_hash): New.
701 (clause/ctor): Save atoms in the hash table.
702 (replace): Save atoms during replacement.
703 (insert): Save atoms during insertion.
704 (contains): Only search the hash table for containment.
705 (clause): Keep a hash of atomic constraints.
706 (clause::clause): Explicitly copy the hash table when copying.
707 (disjunction_p, conjunction_p, atomic_p, dnf_size, cnf_size): New.
708 (diagnose_constraint_size): New.
709 (subsumes_constraints_nonnull): Compare the sizes of normalized formula
710 to determine the cheapest decomposition.
711 * name-lookup.c (diagnose_name_conflict): Diagnose name issues with
713 (matching_fn_p): Check constraints.
714 (push_class_level_binding_1): Move overloaded functions case down,
715 accept FUNCTION_DECL as target_decl.
716 * parser.c (enum required_token): New required token for auto.
717 (make_location): Add overload taking lexer as last parm.
718 (cp_parser_required_error): Diagnose missing auto.
719 (cp_parser_diagnose_ungrouped_constraint_plain): New.
720 (cp_parser_diagnose_ungrouped_constraint_plain): New.
721 (cp_parser_constraint_primary_expression): New. Tentatively parse the
722 primary expression. If that fails tentatively parse a lower
723 precedence expression in order to diagnose the error.
724 (cp_parser_check_non_logical_constraint): New. Performs a trial
725 parse of the right-hand-side of non-logical operators in order to
726 generate good diagnostics.
727 (cp_parser_constraint_logical_and_expression): New.
728 (cp_parser_constraint_logical_or_expression): New.
729 (cp_parser_requires_clause_expression): New.
730 (cp_parser_requires_clause): Renamed to cp_parser_constraint_expression.
731 (cp_parser_requires_clause_opt): Parse the requires-clause differently
732 in -fconcepts and -std=c++2a modes.
733 (cp_parser_requirement_list): Rename to cp_parser_requirement_seq.
734 Rewrite so that semicolons are parsed
735 along with requirements, not the sequence.
736 (cp_parser_simple_requirement): Expect a semicolon at end.
737 (cp_parser_compound_requirement): Expect a semicolon at end. Only
738 allow trailing-return-type with -fconcepts-ts.
739 (cp_parser_nested_requirement): Expect a semicolon at end. Parse
740 constraint-expressions.
741 (cp_parser_concept_definition): New. Don't fail parsing the concept
742 definition if the initializer is ill-formed. Don't declare the concept
743 before parsing the initializer.
744 (cp_parser_constraint_expression): Declare earlier.
745 (cp_parser_type_requirement): Current scope is not valid.
746 (cp_parser_requires_expression): Commit to the tentative parse.
747 (cp_parser_decl_specifier_seq): Warn when concept appears to be used
749 (cp_parser_template_declaration_after_parameters): Parse concept
751 (cp_parser_template_id): Don't try to resolve a concept template-id yet.
752 (cp_parser_template_id_expr): Resolve it as a concept check.
753 (cp_parser_decl_specifier_seq): Warn on 'concept bool'.
754 (cp_parser_type_parameter): Combine expressions not
756 (cp_parser_explicit_template_declaration): Combine expressions not
758 (cp_parser_maybe_concept_name): Removed.
759 (cp_parser_simple_type_specifier): Handle an error condition of
760 a bad constrained type specifier. Expect auto or decltype after
761 a concept name. Also handle the case where we have a template-id
763 (cp_parser_template_introduction): Diagnose errors on invalid
764 introductions. Give up if it doesn't start with a concept name.
765 Pedwarn if not -fconcepts-ts.
766 (synthesize_implicit_template_parm): Don't do consistent binding.
767 Use a new flag for constrained parameters. Combine expressions,
768 not constraints. Fail if we get a placeholder in block scope.
769 Placeholders that do not constrain types are not allowed in parameter
770 declarations, so don't handle them.
771 (cp_parser_placeholder_type_specifier): New. Implement parsing of
772 placeholder type specifiers following a concept name or partial
773 concept check. Disallow decltype(auto) parameters.
774 (cp_parser_nested_name_specifier_opt): If the token is already
775 CPP_NESTED_NAME_SPECIFIER, leave it alone.
776 (cp_parser_id_expression, cp_parser_unqualified_id): Call
777 cp_parser_template_id_expr.
778 (cp_parser_placeholder_type_specifier): Add tentative parm. Don't
779 expect a WILDCARD_DECL.
780 (cp_parser_trait_expr): Pass trait_loc down.
781 (cp_parser_postfix_expression): Do set location of dependent member
783 * pt.c (finish_concept_definition): New.
784 (push_template_decl_real): Handle concept definitions.
785 (start_concept_definition): Let push_template_decl_real handle the
786 creation of the template.
787 (get_constraints): Return null if the table hasn't been initialized.
788 (tsubst_copy_and_build): Build template-id expressions for concept
790 [TRAIT_EXPR]: Pass trait_loc down.
791 (lookup_template_class_1): Add the template name to the constraint
793 (lookup_and_finish_template_variable): Build concept checks
794 with the correct arguments.
795 (tsubst_function_decl): Don't substitute through constraints.
796 Always associate constraints with functions.
797 (template_parm_level_and_index): Make non-static.
798 (for_each_template_parm_r): Handle requires expressions.
799 (keep_template_parm): New.
800 (find_template_parameters): New.
801 (more_specialized_fn): Change how winners and losers are chosen.
802 (make_constrained_auto): Don't normalize constraints.
803 (template_parameters_equivalent_p): New. Compare template
804 parameters. Add a comparison for implicitly vs. explicitly declared
806 (template_parameter_lists_equivalent_p): New. Compare template
808 (template_requirements_equivalent_p): New.
809 (template_heads_equivalent_p): New. Compare template heads.
810 (template_parameter_constraints_equivalent_p): New.
811 (is_compatible_template_arg): Use weakly_subsumes.
812 (maybe_new_partial_specialization): Use new constraint comparison
813 for finding specializations.
814 (process_partial_specialization): Pass main template as argument.
815 (more_specialized_partial_spec): Don't immediately return when
817 (make_constrained_auto): Handle concept definitions.
818 (do_auto_deduction): Update auto deduction for new concept model.
819 Extract the function concept correctly; rename constr to check to
820 reflect the kind of node.
821 (tsubst): Adjust wildcard argument during substitution.
822 [DECLTYPE_TYPE]: Remove init-capture handling.
823 (tsubst_copy_and_build): Build concept checks, not template ids.
824 Defer checks of function concepts. Handle concepts before variable
825 templates. Handle calls to function concepts explicitly.
826 (coerce_template_parms): Use concept_definition_p. Handle a deduction
827 error where a potentially empty pack can be supplied after the last
828 parameter of a concept.
829 (finish_template_variable): Don't process concepts here.
830 (instantiation_dependent_r): Use concept_check_p.
831 (tsubst_template_args): Make non-static.
832 (make_constrained_placeholder_type): New. Refactored from
833 make_constrained_auto.
834 (make_constrained_auto) Use make_constrained_placeholder_type.
835 (make_constrained_decltype_auto) New.
836 (tsubst_function_parms): New.
837 (value_dependent_expression_p) [TEMPLATE_ID_EXPR]: Use
838 concept_definition_p.
839 (push_access_scope, pop_access_scope): No longer static.
840 (tsubst_template_parm): Substitute TEMPLATE_PARM_CONSTRAINTS.
841 (tsubst_friend_function): Use tsubst_constraint. Use generic_targs_for.
842 (get_underlying_template) Use generic_targs_for.
843 (uses_parameter_packs): Return tree.
844 (gen_elem_of_pack_expansion_instantiation): Don't push
845 local_specialization_stack.
846 (prepend_one_capture): New.
847 (tsubst_lambda_expr): Use prepend_one_capture. Don't touch
848 local_specializations.
849 (template_parms_level_to_args): No longer static.
850 (add_outermost_template_args): Likewise.
851 (find_template_parameter_info): New. Provide context for finding
853 (keep_template_parm): Don't keep parameters declared at depth levels
854 greater than those of the template parameters of the source declaration.
855 Don't propagate cv-qualified types. Return 0, so we find all template
856 parameters, not the just first.
857 (any_template_parm_r): New. Handle cases that are mishandled by
858 for_each_template_parm_r.
859 (generic_targs_for): Factor out of coerce_template_args_for_ttp.
860 (tsubst_argument_pack): Factor out of tsubst_template_args.
861 (constraint_sat_entry): Removed.
862 (constraint_sat_hasher): Removed.
863 (concept_spec_entry): Removed.
864 (concept_spec_hasher): Removed.
865 (constraint_memos): Removed.
866 (concept_memos): Removed.
867 (lookup_constraint_satisfaction): Removed.
868 (memoize_constraint_satisfaction): Removed.
869 (lookup_concept_satisfaction): Removed.
870 (memoize_concept_satisfaction): Removed.
871 (concept_expansions): Removed.
872 (get_concept_expansion): Removed.
873 (save_concept_expansion): Removed.
874 (init_constraint_processing): Remove initialization of non-existing
876 (find_template_requirement): New. Search for the sub-requirement
877 within the associated constraints.
878 (convert_generic_types_to_packs): Also transform the associated
879 constraint and update the current template requirements.
880 (store_defaulted_ttp, lookup_defaulted_ttp): Remove.
881 (add_defaults_to_ttp): Use hash_map_safe_*.
882 * semantics.c (finish_call_expr): Diagnose calls to concepts.
883 Handle concept checks explicitly.
884 (finish_id_expression): Evaluate variable concepts as part of
885 id-expression processing. Don't treat variable concepts as variables,
886 and don't process function concepts as plain id-expressions.
887 (force_paren_expr): Add even_uneval parm.
888 (finish_trait_expr): Add location parm.
889 * tree.c (special_memfn_p): New.
890 (cp_expr_location): Handle TRAIT_EXPR.
891 * typeck.c (check_return_expr): Actually use the diagnostic kind
892 when performing return-type deduction.
893 * typeck2.c (build_functional_cast): Don't rely on the location of
896 2019-10-09 Paolo Carlini <paolo.carlini@oracle.com>
898 * decl.c (grok_ctor_properties): Use DECL_SOURCE_LOCATION.
899 * typeck.c (cp_build_binary_op): Use the op_location_t argument
900 in many error messages.
902 2019-10-08 Martin Sebor <msebor@redhat.com>
905 * call.c (maybe_warn_class_memaccess): Handle arrays.
907 2019-10-07 Paolo Carlini <paolo.carlini@oracle.com>
909 * call.c (resolve_args): Use cp_expr_loc_or_input_loc in one place.
910 * decl.c (grokdeclarator): Use id_loc in one place.
911 * decl2.c (build_anon_union_vars): Use DECL_SOURCE_LOCATION.
912 * parser.c (cp_parser_delete_expression): Fix the location of the
914 (cp_parser_throw_expression): Likewise.
915 * pt.c (determine_specialization): Use DECL_SOURCE_LOCATION.
917 2019-10-05 Jakub Jelinek <jakub@redhat.com>
919 PR c++/91369 - Implement P0784R7: constexpr new
920 * cp-tree.h (enum cp_tree_index): Add CPTI_HEAP_UNINIT_IDENTIFIER,
921 CPTI_HEAP_IDENTIFIER and CPTI_HEAP_DELETED_IDENTIFIER.
922 (heap_uninit_identifier, heap_identifier, heap_deleted_identifier):
924 (type_has_constexpr_destructor, build_new_constexpr_heap_type,
925 cxx_constant_dtor): Declare.
926 * class.c (type_maybe_constexpr_default_constructor): Make static.
927 (type_maybe_constexpr_destructor, type_has_constexpr_destructor): New
929 (finalize_literal_type_property): For c++2a, don't clear
930 CLASSTYPE_LITERAL_P for types without trivial destructors unless they
931 have non-constexpr destructors.
932 (explain_non_literal_class): For c++2a, complain about non-constexpr
933 destructors rather than about non-trivial destructors.
934 * constexpr.c: Include stor-layout.h.
935 (struct constexpr_global_ctx): New type.
936 (struct constexpr_ctx): Add global field, remove values and
938 (cxx_replaceable_global_alloc_fn): New inline function.
939 (cxx_eval_call_expression): For c++2a allow calls to replaceable
940 global allocation functions, for new return address of a heap uninit
941 var, for delete record its deletion. Change ctx->values->{get,put} to
942 ctx->global->values.{get,put}.
943 (non_const_var_error): Add auto_diagnostic_group sentinel. Emit
944 special diagnostics for heap variables.
945 (cxx_eval_store_expression): Change ctx->values->{get,put} to
946 ctx->global->values.{get,put}.
947 (cxx_eval_loop_expr): Initialize jump_target if NULL. Change
948 new_ctx.values->remove to ctx->global->values.remove.
949 (cxx_eval_constant_expression): Change *ctx->constexpr_ops_count
950 to ctx->global->constexpr_ops_count. Change ctx->values->{get,put} to
951 ctx->global->values.{get,put}.
952 <case NOP_EXPR>: Formatting fix. On cast of replaceable global
953 allocation function to some pointer type, adjust the type of
954 the heap variable and change name from heap_uninit_identifier
956 (find_heap_var_refs): New function.
957 (cxx_eval_outermost_constant_expr): Add constexpr_dtor argument,
958 handle evaluation of constexpr dtors and add tracking of heap
959 variables. Use tf_no_cleanup for get_target_expr_with_sfinae.
960 (cxx_constant_value): Adjust cxx_eval_outermost_constant_expr caller.
961 (cxx_constant_dtor): New function.
962 (maybe_constant_value, fold_non_dependent_expr_template,
963 maybe_constant_init_1): Adjust cxx_eval_outermost_constant_expr
965 (potential_constant_expression_1): Ignore clobbers. Allow
966 COND_EXPR_IS_VEC_DELETE for c++2a.
967 * decl.c (initialize_predefined_identifiers): Add heap identifiers.
968 (decl_maybe_constant_destruction): New function.
969 (cp_finish_decl): Don't clear TREE_READONLY for constexpr variables
970 with non-trivial, but constexpr destructors.
971 (register_dtor_fn): For constexpr variables with constexpr non-trivial
972 destructors call cxx_maybe_build_cleanup instead of adding destructor
974 (expand_static_init): For constexpr variables with constexpr
975 non-trivial destructors call cxx_maybe_build_cleanup.
976 (grokdeclarator): Allow constexpr destructors for c++2a. Formatting
978 (cxx_maybe_build_cleanup): For constexpr variables with constexpr
979 non-trivial destructors call cxx_constant_dtor instead of adding
980 destructor calls at runtime.
981 * init.c: Include stor-layout.h.
982 (build_new_constexpr_heap_type, maybe_wrap_new_for_constexpr): New
984 (build_new_1): For c++2a and new[], add cast around the alloc call
985 to help constexpr evaluation figure out the type of the heap storage.
986 (build_vec_delete_1): Set DECL_INITIAL of tbase and emit a DECL_EXPR
987 for it instead of initializing an uninitialized variable.
988 * method.c: Include intl.h.
989 (SFK_CTOR_P, SFK_DTOR_P, SFK_ASSIGN_P, SFK_COPY_P, SFK_MOVE_P): Move
991 (process_subob_fn): Add sfk argument, adjust non-constexpr call
992 diagnostics based on it.
993 (walk_field_subobs): Formatting fixes. Adjust process_subob_fn caller.
994 (synthesized_method_base_walk): Likewise.
995 (synthesized_method_walk): Set *constexpr_p to true for dtors in c++2a.
996 Fix up DR number in comment.
997 (implicitly_declare_fn): Formatting fix.
998 * typeck2.c (store_init_value): Don't call cp_fully_fold_init on
999 initializers of automatic non-constexpr variables in constexpr
1002 2019-10-04 Jakub Jelinek <jakub@redhat.com>
1005 * constexpr.c (cxx_fold_indirect_ref_1): New function.
1006 (cxx_fold_indirect_ref): Use it.
1009 * cp-gimplify.c (cp_gimplify_expr) <case CALL_EXPR>: For
1010 -fstrong-eval-order ensure CALL_EXPR_FN side-effects are evaluated
1011 before any arguments. Additionally, ensure CALL_EXPR_FN that isn't
1012 invariant nor OBJ_TYPE_REF nor SSA_NAME is forced into a temporary.
1014 2019-10-03 Paolo Carlini <paolo.carlini@oracle.com>
1016 * init.c (build_new): Use cp_expr_loc_or_input_loc in two places.
1017 * name-lookup.c (do_pushdecl): Use DECL_SOURCE_LOCATION.
1018 (push_class_level_binding_1): Likewise.
1019 (set_decl_namespace): Likewise.
1021 2019-10-03 Jakub Jelinek <jakub@redhat.com>
1023 * constexpr.c (cxx_eval_constant_expression) <case CLEANUP_STMT>: If
1024 not skipping upon entry to body, run cleanup with the same *jump_target
1025 as it started to run the cleanup even if the body returns, breaks or
1027 (potential_constant_expression_1): Allow CLEANUP_STMT.
1029 * constexpr.c (cxx_eval_store_expression): Formatting fix. Handle
1030 const_object_being_modified with array type.
1032 2019-10-02 Jason Merrill <jason@redhat.com>
1034 * typeck2.c (store_init_value): Only clear_cv_and_fold_caches if the
1037 2019-09-30 Jason Merrill <jason@redhat.com>
1039 Use hash_map_safe_* functions.
1040 * constexpr.c (maybe_initialize_fundef_copies_table): Remove.
1041 (get_fundef_copy): Use hash_map_safe_get_or_insert.
1042 * cp-objcp-common.c (cp_get_debug_type): Use hash_map_safe_*.
1043 * decl.c (store_decomp_type): Remove.
1044 (cp_finish_decomp): Use hash_map_safe_put.
1045 * init.c (get_nsdmi): Use hash_map_safe_*.
1046 * pt.c (store_defaulted_ttp, lookup_defaulted_ttp): Remove.
1047 (add_defaults_to_ttp): Use hash_map_safe_*.
1049 2019-10-02 Richard Biener <rguenther@suse.de>
1052 * decl.c (build_ptrmemfunc_type): Mark pointer-to-member
1053 fat pointer structure members as DECL_NONADDRESSABLE_P.
1055 2019-09-28 Marek Polacek <polacek@redhat.com>
1057 PR c++/91889 - follow-up fix for DR 2352.
1058 * call.c (involves_qualification_conversion_p): New function.
1059 (direct_reference_binding): Build a ck_qual if the conversion
1060 would involve a qualification conversion.
1061 (convert_like_real): Strip the conversion created by the ck_qual
1062 in direct_reference_binding.
1064 PR c++/91921 - stray warning with -Woverloaded-virtual.
1065 * class.c (warn_hidden): Only emit the second part of
1066 -Woverloaded-virtual if the first part was issued. Use inform instead
1069 PR c++/91923 - failure-to-SFINAE with class type NTTP in C++17.
1070 * pt.c (invalid_nontype_parm_type_p): Only emit errors when
1073 2019-09-27 Jakub Jelinek <jakub@redhat.com>
1076 * parser.c (cp_parser_omp_var_list_no_open): Parse predefined
1078 * semantics.c (finish_omp_clauses): Allow predefined variables in
1079 shared and firstprivate clauses, even when they are predetermined
1081 * cp-gimplify.c (cxx_omp_predetermined_sharing_1): Return
1082 OMP_CLAUSE_DEFAULT_SHARED for predefined variables.
1084 2019-09-27 Jason Merrill <jason@redhat.com>
1086 * constexpr.c (cxx_fold_indirect_ref): Use similar_type_p.
1087 (cxx_eval_indirect_ref): Likewise. Improve error location.
1089 * cp-tree.h (class iloc_sentinel): New.
1090 * decl.c (grokdeclarator, finish_enum_value_list): Use it.
1091 * mangle.c (mangle_decl_string): Use it.
1092 * pt.c (perform_typedefs_access_check): Use it.
1094 2019-09-27 Richard Sandiford <richard.sandiford@arm.com>
1096 * cp-tree.h (build_cxx_call): Take the original function decl
1097 as an optional final parameter.
1098 (cp_build_function_call_vec): Likewise.
1099 * call.c (build_cxx_call): Likewise. Pass all built-in calls to
1100 check_builtin_function_arguments.
1101 * typeck.c (build_function_call_vec): Take the original function
1102 decl as an optional final parameter and pass it to
1103 cp_build_function_call_vec.
1104 (cp_build_function_call_vec): Take the original function
1105 decl as an optional final parameter and pass it to build_cxx_call.
1107 2019-09-25 Marek Polacek <polacek@redhat.com>
1109 PR c++/91877 - ICE with converting member of packed struct.
1110 * call.c (convert_like_real): Use similar_type_p in an assert.
1112 2019-09-25 Paolo Carlini <paolo.carlini@oracle.com>
1114 * name-lookup.c (check_extern_c_conflict): Use DECL_SOURCE_LOCATION.
1115 (check_local_shadow): Use it in three additional places.
1117 2019-09-24 Jason Merrill <jason@redhat.com>
1119 * parser.c (cp_parser_postfix_expression): Do set location of
1120 dependent member call.
1122 2019-09-24 Marek Polacek <polacek@redhat.com>
1124 PR c++/91868 - improve -Wshadow location.
1125 * name-lookup.c (check_local_shadow): Use DECL_SOURCE_LOCATION
1126 instead of input_location.
1128 PR c++/91845 - ICE with invalid pointer-to-member.
1129 * expr.c (mark_use): Use error_operand_p.
1130 * typeck2.c (build_m_component_ref): Check error_operand_p after
1131 calling mark_[lr]value_use.
1133 2019-09-23 Paolo Carlini <paolo.carlini@oracle.com>
1135 * pt.c (check_explicit_specialization): Use cp_expr_loc_or_input_loc.
1136 (process_partial_specialization): Likewise.
1137 (convert_nontype_argument_function): Likewise.
1138 (invalid_tparm_referent_p): Likewise.
1139 (convert_template_argument): Likewise.
1140 (check_valid_ptrmem_cst_expr): Tidy.
1142 2019-09-23 Jason Merrill <jason@redhat.com>
1144 PR c++/91809 - bit-field and ellipsis.
1145 * call.c (convert_arg_to_ellipsis): Don't call decay_conversion for
1146 arithmetic arguments.
1148 2019-09-23 Marek Polacek <polacek@redhat.com>
1150 PR c++/91844 - Implement CWG 2352, Similar types and reference binding.
1151 * call.c (reference_related_p): Use similar_type_p instead of
1153 (reference_compatible_p): Update implementation to match CWG 2352.
1154 * cp-tree.h (similar_type_p): Declare.
1155 * typeck.c (similar_type_p): New.
1157 2019-09-22 Marek Polacek <polacek@redhat.com>
1159 PR c++/91819 - ICE with operator++ and enum.
1160 * call.c (build_new_op_1): Set arg2_type.
1162 2019-09-17 Jason Merrill <jason@redhat.com>
1164 * parser.c (cp_parser_statement): Handle [[likely]] on
1167 2019-09-19 Jason Merrill <jason@redhat.com>
1170 * call.c (build_new_op_1): Don't apply any standard conversions to
1171 the operands of a built-in operator. Don't suppress conversions in
1173 * typeck.c (cp_build_unary_op): Do integral promotions for enums.
1175 2019-09-16 Paolo Carlini <paolo.carlini@oracle.com>
1177 * decl.c (grokdeclarator): Use declspecs->locations and
1178 declarator->id_loc in a few error messages.
1179 * pt.c (finish_member_template_decl): Use DECL_SOURCE_LOCATION.
1180 (push_template_decl_real): Likewise.
1182 2019-09-15 Jason Merrill <jason@redhat.com>
1184 PR c++/30277 - int-width bit-field promotion.
1185 PR c++/33819 - long bit-field promotion.
1186 * typeck.c (cp_perform_integral_promotions): Handle large bit-fields
1187 properly. Handle 32-bit non-int bit-fields properly.
1188 (is_bitfield_expr_with_lowered_type): Don't look through NOP_EXPR.
1190 PR c++/82165 - enum bitfields and operator overloading.
1191 * call.c (build_new_op_1): Use unlowered_expr_type.
1193 * call.c (build_new_op_1): Don't apply any standard conversions to
1194 the operands of a built-in operator. Don't suppress conversions in
1196 * typeck.c (cp_build_unary_op): Do integral promotions for enums.
1198 2019-09-15 Marek Polacek <polacek@redhat.com>
1200 PR c++/91740 - ICE with constexpr call and ?: in ARRAY_REF.
1201 * pt.c (build_non_dependent_expr): Call build_non_dependent_expr for
1204 2019-09-15 Nathan Sidwell <nathan@acm.org>
1206 * cp-tree.h (DECL_CLONED_FUNCTION_P): Reimplement using
1207 IDENTIFIER_CDTOR_P, correct documentation.
1208 (DECL_CLONED_FUNCTION): Directly access field.
1209 (decl_cloned_function_p): Delete.
1210 * class.c (decl_cloned_function_p): Delete.
1211 * pt.c (instantiate_template_1): Check DECL_CHAIN is a decl.
1213 2019-09-11 Nathan Sidwell <nathan@acm.org>
1215 * c-objcp-common.c (cp-objcp-common.c): Alphababetize and
1216 correctly mark all C++ nodes.
1217 * decl.c (cp_tree_node_structure): Alphabetize.
1219 2019-09-10 Marek Polacek <polacek@redhat.com>
1221 PR c++/91673 - ICE with noexcept in alias-declaration.
1222 * parser.c (CP_PARSER_FLAGS_DELAY_NOEXCEPT): New parser flag.
1223 (cp_parser_lambda_declarator_opt): Pass CP_PARSER_FLAGS_NONE to
1224 cp_parser_exception_specification_opt.
1225 (cp_parser_direct_declarator): Adjust a call to
1226 cp_parser_exception_specification_opt.
1227 (cp_parser_member_declaration): Pass CP_PARSER_FLAGS_DELAY_NOEXCEPT
1228 to cp_parser_declarator if not processing a friend or typedef
1230 (cp_parser_late_noexcept_specifier): Adjust a call to
1231 cp_parser_noexcept_specification_opt.
1232 (cp_parser_noexcept_specification_opt): New parameter for parser flags,
1233 drop the FRIEND_P parameter. Use the new parameter.
1234 (cp_parser_exception_specification_opt): Likewise.
1235 (cp_parser_transaction): Adjust a call to
1236 cp_parser_noexcept_specification_opt.
1237 (cp_parser_transaction_expression): Likewise.
1239 2019-09-10 Marek Polacek <polacek@redhat.com>
1241 PR c++/91705 - constexpr evaluation rejects ++/-- on floats.
1242 * constexpr.c (cxx_eval_increment_expression): Call fold_simple on
1245 2019-09-10 Paolo Carlini <paolo.carlini@oracle.com>
1247 * decl.c (has_designator_problem): Use cp_expr_loc_or_input_loc
1249 (build_enumerator): Likewise.
1250 (cp_finish_decl): Use DECL_SOURCE_LOCATION.
1251 (grokdeclarator): Use id_loc in two error_at; change errror
1252 message about constinit together constexpr to use two ranges.
1254 2019-09-09 Marek Polacek <polacek@redhat.com>
1256 PR c++/84374 - diagnose invalid uses of decltype(auto).
1257 * decl.c (grokdeclarator): Diagnose wrong usage of decltype(auto) in
1258 a function declaration.
1260 2019-09-06 Nathan Sidwell <nathan@acm.org>
1263 * cp-tree.h (IDENTIFIER_REPO_CHOSEN, DECL_REPO_AVAILABLE_P): Delete.
1264 (struct lang_decl_base): Remove repo_available_p.
1265 * decl.c (duplicate_decls): Don't copy DECL_REPO_AVAILABLE_P.
1267 (Reserve TREE_LANG_FLAG_3 for modules.
1268 * cp-tree.h (DECL_CONSTRUCTION_VTABLE_P): Delete.
1269 (DECL_NON_TRIVIALLY_INITIALIZED_P): Move to TREE_LANG_FLAG_6.
1270 * class.c (build_ctor_vtbl_group): Don't set
1271 DECL_CONSTRUCTION_VTABLE_P.
1272 * decl2.c (determine_visibility_from_class): Don't check
1273 DECL_CONSTRUCTION_VTABLE_P anymore.
1275 2019-09-06 Martin Liska <mliska@suse.cz>
1278 * Make-lang.in: Remove repo.o.
1279 * config-lang.in: Likewise.
1280 * cp-tree.h (init_repo): Remove declarations
1281 of repo-related functions.
1282 (repo_emit_p): Likewise.
1283 (repo_export_class_p): Likewise.
1284 (finish_repo): Likewise.
1285 * decl2.c (import_export_class): Always
1287 (mark_needed): Remove -frepo from comment.
1288 (import_export_decl): Similarly here.
1289 (c_parse_final_cleanups): Remove call of finish_repo.
1290 * lex.c (cxx_init): Remove call to init_repo.
1291 * optimize.c (can_alias_cdtor): Remove dead condition.
1292 * pt.c (push_template_decl_real): Update comment.
1293 (instantiate_decl): Remove dead code used for -frepo.
1296 2019-09-05 Marek Polacek <polacek@redhat.com>
1298 PR c++/91644 - ICE with constinit in function template.
1299 * decl.c (start_decl): Call retrofit_lang_decl for constinit variables.
1300 * pt.c (tsubst_expr): Pass LOOKUP_CONSTINIT down to cp_finish_decl for
1301 constinit variables.
1303 2019-09-05 Nathan Sidwell <nathan@acm.org>
1305 * cp-tree.h (DECL_VTABLE_OR_VTT_P): Forward to DECL_VIRTUAL_P.
1307 2019-09-04 Marek Polacek <polacek@redhat.com>
1309 * call.c (build_over_call): Remove -fdeduce-init-list implementation.
1310 * pt.c (unify): Likewise.
1312 2019-09-01 Marek Polacek <polacek@redhat.com>
1314 PR c++/91129 - wrong error with binary op in template argument.
1315 * typeck.c (warn_for_null_address): Use fold_for_warn instead of
1316 fold_non_dependent_expr.
1317 (cp_build_binary_op): Likewise.
1319 2019-08-30 Jason Merrill <jason@redhat.com>
1321 Add source location to TRAIT_EXPR.
1322 * cp-tree.h (TRAIT_EXPR_LOCATION): New.
1323 (struct tree_trait_expr): Add locus field.
1324 * parser.c (cp_parser_trait_expr): Pass trait_loc down.
1325 * pt.c (tsubst_copy_and_build) [TRAIT_EXPR]: Likewise.
1326 * semantics.c (finish_trait_expr): Add location parm.
1327 * tree.c (cp_expr_location): Handle TRAIT_EXPR.
1329 2019-08-29 Paolo Carlini <paolo.carlini@oracle.com>
1331 * decl.c (check_var_type): Add location_t parameter and use it.
1332 (grokdeclarator): Adjust call.
1333 * pt.c (tsubst_decl): Likewise.
1334 * cp-tree.h: Adjust declaration.
1336 2019-08-28 Marek Polacek <polacek@redhat.com>
1338 Implement P1152R4: Deprecating some uses of volatile.
1340 * cp-gimplify.c (cp_fold): Set TREE_THIS_VOLATILE.
1341 * decl.c (grokdeclarator): Warn about a volatile-qualified structured
1342 binding and return type.
1343 (grokparms): Warn about a volatile-qualified function parameter.
1344 * expr.c (mark_use) <case MODIFY_EXPR>: Emit a -Wvolatile warning.
1345 * typeck.c (cp_build_unary_op): Emit a -Wvolatile warning for pre and
1346 post ++/-- on a volatile operand.
1347 (genericize_compound_lvalue): Use a better location. Don't lose
1349 (cp_build_modify_expr): Emit a -Wvolatile warning for a compound
1350 assignment whose LHS is volatile-qualified. Build the assignment with
1351 a more precise location.
1353 2019-08-28 Marek Polacek <polacek@redhat.com>
1355 PR c++/91360 - Implement C++20 P1143R2: constinit.
1356 * cp-tree.h (TINFO_VAR_DECLARED_CONSTINIT): Define.
1357 (LOOKUP_CONSTINIT): Define.
1358 (enum cp_decl_spec): Add ds_constinit.
1359 * decl.c (check_tag_decl): Give an error for constinit in type
1361 (check_initializer): Also check LOOKUP_CONSTINIT.
1362 (cp_finish_decl): Add checking for a constinit declaration. Set
1363 TINFO_VAR_DECLARED_CONSTINIT.
1364 (grokdeclarator): Add checking for a declaration with the constinit
1366 * lex.c (init_reswords): Handle D_CXX20.
1367 * parser.c (cp_lexer_get_preprocessor_token): Pass a better location
1368 to warning_at. Warn about C++20 keywords.
1369 (cp_keyword_starts_decl_specifier_p): Handle RID_CONSTINIT.
1370 (cp_parser_diagnose_invalid_type_name): Add an inform about constinit.
1371 (cp_parser_decomposition_declaration): Maybe pass LOOKUP_CONSTINIT to
1373 (cp_parser_decl_specifier_seq): Handle RID_CONSTINIT.
1374 (cp_parser_init_declarator): Maybe pass LOOKUP_CONSTINIT to
1376 (set_and_check_decl_spec_loc): Add "constinit".
1377 * pt.c (tsubst_decl): Set TINFO_VAR_DECLARED_CONSTINIT.
1378 (instantiate_decl): Maybe pass LOOKUP_CONSTINIT to cp_finish_decl.
1379 * typeck2.c (store_init_value): If a constinit variable wasn't
1380 initialized using a constant initializer, give an error.
1382 2019-08-28 Nathan Sidwell <nathan@acm.org>
1385 * name-lookup.c (cp_emit_debug_info): Check for builtins during
1388 2019-08-27 Marek Polacek <polacek@redhat.com>
1390 PR c++/81676 - bogus -Wunused warnings in constexpr if.
1391 * semantics.c (maybe_mark_exp_read_r): New function.
1392 (finish_if_stmt): Call it on THEN_CLAUSE and ELSE_CLAUSE.
1394 PR c++/91428 - warn about std::is_constant_evaluated in if constexpr.
1395 * cp-tree.h (decl_in_std_namespace_p): Declare.
1396 * semantics.c (is_std_constant_evaluated_p): New.
1397 (finish_if_stmt_cond): Warn about "std::is_constant_evaluated ()" in
1399 * typeck.c (decl_in_std_namespace_p): No longer static.
1401 2019-08-26 Jason Merrill <jason@redhat.com>
1403 * decl.c (duplicate_decls): Always merge DECL_DECLARED_CONSTEXPR_P.
1405 2019-08-26 Marek Polacek <polacek@redhat.com>
1407 PR c++/91545 - ICE in constexpr store evaluation.
1408 * constexpr.c (cxx_eval_store_expression): Check FIELD_DECL instead
1411 2019-08-24 Nathan Sidwell <nathan@acm.org>
1413 * class.c (check_for_overrides): Conversion operators need
1416 2019-08-24 Paolo Carlini <paolo.carlini@oracle.com>
1418 * semantics.c (finish_switch_cond): Improve error message location.
1420 2019-08-23 Jason Merrill <jason@redhat.com>
1422 * decl2.c (decl_dependent_p): New.
1423 (mark_used): Check it instead of just processing_template_decl.
1425 2019-08-23 Jason Merrill <jason@redhat.com>
1427 * parser.c (cp_parser_nested_name_specifier_opt): Avoid redundant
1430 2019-08-23 Marek Polacek <polacek@redhat.com>
1432 PR c++/91521 - wrong error with operator->.
1433 * decl.c (grokdeclarator): Return error_mark_node for an invalid
1434 trailing return type.
1436 PR c++/79817 - attribute deprecated on namespace.
1437 * cp-tree.h (cp_warn_deprecated_use_scopes): Declare.
1438 * decl.c (grokdeclarator): Call cp_warn_deprecated_use_scopes.
1439 (type_is_deprecated): Likewise.
1440 * decl2.c (cp_warn_deprecated_use_scopes): New function.
1441 * name-lookup.c (handle_namespace_attrs): Handle attribute deprecated.
1442 * parser.c (cp_parser_namespace_alias_definition): Call
1443 cp_warn_deprecated_use_scopes.
1444 (cp_parser_using_declaration): Likewise.
1445 (cp_parser_using_directive): Likewise.
1446 * semantics.c (finish_id_expression_1): Likewise.
1448 2019-08-23 Nathan Sidwell <nathan@acm.org>
1450 * class.c (check_for_override): Checking IDENTIFIER_VIRTUAL_P is
1451 sufficient, reorder DECL_OVERRIDE_P check.
1453 2019-08-23 Iain Sandoe <iain@sandoe.co.uk>
1456 * parser.c (cp_parser_initial_pragma): Call c_common_no_more_pch ()
1457 after determining that the first token is not
1458 PRAGMA_GCC_PCH_PREPROCESS.
1460 2019-08-22 Marek Polacek <polacek@redhat.com>
1462 PR c++/91304 - prefix attributes ignored in condition.
1463 * parser.c (cp_parser_condition): Handle prefix attributes.
1465 2019-08-21 Richard Sandiford <richard.sandiford@arm.com>
1468 * decl.c (duplicate_decls): Call copy_attributes_to_builtin inside
1469 the BUILT_IN_NORMAL block rather than afterward.
1471 2019-08-19 Marek Polacek <polacek@redhat.com>
1473 PR c++/91264 - detect modifying const objects in constexpr.
1474 * constexpr.c (modifying_const_object_error): New function.
1475 (cxx_eval_call_expression): Set TREE_READONLY on a CONSTRUCTOR of
1476 a const-qualified object after it's been fully constructed.
1477 (modifying_const_object_p): New function.
1478 (cxx_eval_store_expression): Detect modifying a const object
1479 during constant expression evaluation.
1480 (cxx_eval_increment_expression): Use a better location when building
1482 (cxx_eval_constant_expression) <case DECL_EXPR>: Mark a constant
1483 object's constructor TREE_READONLY.
1485 2019-08-15 Jason Merrill <jason@redhat.com>
1487 PR c++/90393 - ICE with thow in ?:
1489 PR c++/64372, DR 1560 - Gratuitous lvalue-to-rvalue conversion in ?:
1490 * tree.c (lvalue_kind): Handle throw in one arm.
1491 * typeck.c (rationalize_conditional_expr): Likewise.
1492 (cp_build_modify_expr): Likewise.
1494 2019-08-14 Jason Merrill <jason@redhat.com>
1496 Implement P0848R3, Conditionally Trivial Special Member Functions.
1497 * tree.c (special_memfn_p): New.
1498 * class.c (add_method): When overloading, hide ineligible special
1500 (check_methods): Set TYPE_HAS_COMPLEX_* here.
1501 * decl.c (grok_special_member_properties): Not here.
1502 * name-lookup.c (push_class_level_binding_1): Move overloaded
1503 functions case down, accept FUNCTION_DECL as target_decl.
1505 2019-08-14 Jonathan Wakely <jwakely@redhat.com>
1508 * name-lookup.c (get_std_name_hint): Fix min_dialect field for
1509 complex_literals and make_unique entries.
1511 2019-08-14 Jakub Jelinek <jakub@redhat.com>
1512 Marek Polacek <polacek@redhat.com>
1514 PR c++/91391 - bogus -Wcomma-subscript warning.
1515 * parser.c (cp_parser_postfix_open_square_expression): Don't warn about
1516 a deprecated comma here. Pass warn_comma_subscript down to
1517 cp_parser_expression.
1518 (cp_parser_expression): New bool parameter. Warn about uses of a comma
1519 operator within a subscripting expression.
1520 (cp_parser_skip_to_closing_square_bracket): Revert to pre-r274121 state.
1521 (cp_parser_skip_to_closing_square_bracket_1): Remove.
1523 2019-08-14 Jonathan Wakely <jwakely@redhat.com>
1525 * name-lookup.c (get_std_name_hint): Add more entries.
1527 2019-08-14 Paolo Carlini <paolo.carlini@oracle.com>
1529 * decl2.c (grok_array_decl): Use the location of the open square
1530 bracket in error message about invalid types.
1532 2019-08-14 Paolo Carlini <paolo.carlini@oracle.com>
1534 * decl.c (grokdeclarator): Check here for typedef a function
1535 definition or a member function definition.
1536 (start_function): Adjust.
1537 (grokmethod): Likewise.
1539 2019-08-13 Richard Sandiford <richard.sandiford@arm.com>
1542 * decl.c (duplicate_decls): Use copy_decl_built_in_function.
1543 * pt.c (declare_integer_pack): Use set_decl_built_in_function.
1545 2019-08-13 Marek Polacek <polacek@redhat.com>
1547 PR c++/90473 - wrong code with nullptr in default argument.
1548 * call.c (null_ptr_cst_p): Update quote from the standard.
1549 * decl.c (check_default_argument): Don't return nullptr when the arg
1552 2019-08-13 Marek Polacek <polacek@redhat.com>
1554 * cp-tree.h (DECL_MUTABLE_P): Use FIELD_DECL_CHECK.
1556 2019-08-10 Jakub Jelinek <jakub@redhat.com>
1558 * parser.c (cp_parser_omp_clause_name): Parse device_type.
1559 (cp_parser_omp_clause_device_type): New function.
1560 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_DEVICE_TYPE.
1561 (OMP_DECLARE_TARGET_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_DEVICE_TYPE.
1562 (cp_parser_omp_declare_target): Handle device_type clauses. Remove
1563 diagnostics for declare target with clauses nested in clause-less
1564 declare target declaration-definition-seq.
1565 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_DEVICE_TYPE.
1567 2019-08-09 Jakub Jelinek <jakub@redhat.com>
1569 * parser.c (check_no_duplicate_clause): Simplify using
1571 (cp_parser_omp_clause_if): Fix up printing of target {enter,exit} data
1572 directive name modifiers.
1575 * parser.c (cp_parser_omp_clause_dist_schedule): Comment out the
1576 check_no_duplicate_clause call, instead emit a warning for duplicate
1577 dist_schedule clauses.
1579 2019-08-08 Paolo Carlini <paolo.carlini@oracle.com>
1581 * decl.c (grokdeclarator): Use id_loc and EXPR_LOCATION in
1582 a few error messages.
1584 2019-08-08 Marek Polacek <polacek@redhat.com>
1586 PR c++/87519 - bogus warning with -Wsign-conversion.
1587 * typeck.c (cp_build_binary_op): Use same_type_p instead of comparing
1590 * constexpr.c (inline_asm_in_constexpr_error): New.
1591 (cxx_eval_constant_expression) <case ASM_EXPR>: Call it.
1592 (potential_constant_expression_1) <case ASM_EXPR>: Likewise.
1594 2019-08-08 Jakub Jelinek <jakub@redhat.com>
1596 * semantics.c (finish_omp_clauses): For C_ORT_OMP
1597 OMP_CLAUSE_USE_DEVICE_* clauses use oacc_reduction_head bitmap
1598 instead of generic_head to track duplicates.
1600 2019-08-07 Marek Polacek <polacek@redhat.com>
1602 PR c++/81429 - wrong parsing of constructor with C++11 attribute.
1603 * parser.c (cp_parser_constructor_declarator_p): Handle the scenario
1604 when a parameter declaration begins with [[attribute]].
1606 2019-08-07 Marek Polacek <polacek@redhat.com>
1608 PR c++/91346 - Implement P1668R1, allow unevaluated asm in constexpr.
1609 * constexpr.c (cxx_eval_constant_expression): Handle ASM_EXPR.
1610 (potential_constant_expression_1) <case ASM_EXPR>: Allow.
1611 * cp-tree.h (finish_asm_stmt): Adjust.
1612 * parser.c (cp_parser_asm_definition): Grab the locaion of "asm" and
1613 use it. Change an error to a pedwarn. Allow asm in C++2a, warn
1615 * pt.c (tsubst_expr): Pass a location down to finish_asm_stmt.
1616 * semantics.c (finish_asm_stmt): New location_t parameter. Use it.
1618 2019-08-07 Jakub Jelinek <jakub@redhat.com>
1620 * parser.c (cp_parser_omp_clause_name): Parse use_device_addr clause.
1621 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR.
1622 (OMP_TARGET_DATA_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR.
1623 (cp_parser_omp_target_data): Handle PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR
1624 like PRAGMA_OMP_CLAUSE_USE_DEVICE_PTR, adjust diagnostics about no
1625 map or use_device_* clauses.
1626 * semantics.c (finish_omp_clauses): For OMP_CLAUSE_USE_DEVICE_PTR
1627 in OpenMP, require pointer or reference to pointer type rather than
1628 pointer or array or reference to pointer or array type. Handle
1629 OMP_CLAUSE_USE_DEVICE_ADDR.
1630 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_USE_DEVICE_ADDR.
1632 2019-08-06 Jason Merrill <jason@redhat.com>
1634 PR c++/91378 - ICE with noexcept and auto return type.
1635 * pt.c (maybe_instantiate_noexcept): push_to_top_level.
1637 2019-08-06 Paolo Carlini <paolo.carlini@oracle.com>
1639 * decl.c (check_array_designated_initializer): Use
1640 cp_expr_loc_or_input_loc in one place.
1642 2019-08-06 Jakub Jelinek <jakub@redhat.com>
1644 * parser.c (cp_parser_omp_for_loop): For OMP_LOOP, ignore parallel
1645 clauses and predetermine iterator as lastprivate.
1646 * semantics.c (handle_omp_for_class_iterator): Use
1647 OMP_CLAUSE_LASTPRIVATE_LOOP_IV instead of
1648 OMP_CLAUSE_LASTPRIVATE_TASKLOOP_IV, set it for lastprivate also
1649 on OMP_LOOP construct. If a clause is missing for class iterator
1650 on OMP_LOOP, add firstprivate clause, and if there is private
1651 clause, turn it into firstprivate too.
1652 (finish_omp_for): Formatting fix. For OMP_LOOP, adjust
1653 OMP_CLAUSE_LASTPRIVATE_LOOP_IV clause CP_CLAUSE_INFO, so that it
1654 uses copy ctor instead of default ctor.
1655 * cp-gimplify.c (cp_gimplify_expr): Handle OMP_LOOP like
1657 (cp_fold_r): Likewise.
1658 (cp_genericize_r): Likewise.
1659 (cxx_omp_finish_clause): Also finish lastprivate clause with
1660 OMP_CLAUSE_LASTPRIVATE_LOOP_IV flag.
1661 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_BIND.
1662 (tsubst_omp_for_iterator): For OMP_LOOP, ignore parallel
1663 clauses and predetermine iterator as lastprivate.
1664 * constexpr.c (potential_constant_expression_1): Handle OMP_LOOP
1665 like OMP_DISTRIBUTE etc.
1667 2019-08-05 Marek Polacek <polacek@redhat.com>
1669 DR 2413 - typename in conversion-function-ids.
1670 * parser.c (cp_parser_conversion_type_id): Call
1671 cp_parser_type_specifier_seq with CP_PARSER_FLAGS_TYPENAME_OPTIONAL
1672 instead of CP_PARSER_FLAGS_NONE.
1674 2019-08-05 Paolo Carlini <paolo.carlini@oracle.com>
1676 * cp-tree.h (cp_expr_loc_or_input_loc): New.
1677 (cxx_incomplete_type_diagnostic): Use it.
1678 * call.c (build_converted_constant_expr_internal, convert_like_real,
1679 convert_arg_to_ellipsis, convert_for_arg_passing, build_over_call,
1680 build_cxx_call, perform_implicit_conversion_flags,
1681 initialize_reference): Likewise.
1682 * constexpr.c (cxx_eval_internal_function, cxx_eval_call_expression,
1683 eval_and_check_array_index, cxx_eval_store_expression,
1684 cxx_eval_statement_list, cxx_eval_loop_expr,
1685 cxx_eval_constant_expression, potential_constant_expression_1):
1687 * constraint.cc (check_for_logical_overloads,
1688 satisfy_predicate_constraint): Likewise.
1689 * cp-gimplify.c (cp_gimplify_expr): Likewise.
1690 * cvt.c (cp_convert_to_pointer, convert_to_reference,
1691 cp_convert_and_check, ocp_convert, maybe_warn_nodiscard): Likewise.
1692 * decl.c (pop_switch): Likewise.
1693 * decl2.c (delete_sanity): Likewise.
1694 * error.c (location_of): Likewise.
1695 * init.c (maybe_warn_list_ctor, build_aggr_init,
1696 warn_placement_new_too_small, build_new_1, build_vec_init): Likewise.
1697 * lex.c (unqualified_name_lookup_error): Likewise.
1698 * parser.c (cp_parser_initializer_list, cp_parser_omp_for_cond):
1700 * pt.c (check_for_bare_parameter_packs, check_valid_ptrmem_cst_expr,
1701 unify_arg_conversion, convert_nontype_argument,
1702 tsubst_copy_and_build, resolve_typename_type): Likewise.
1703 * semantics.c (maybe_convert_cond, finish_call_expr,
1704 cp_build_vec_convert): Likewise.
1705 * typeck.c (decay_conversion, rationalize_conditional_expr,
1706 cp_build_unary_op, build_x_compound_expr_from_list,
1707 maybe_warn_about_returning_address_of_local,
1708 maybe_warn_pessimizing_move): Likewise.
1709 * typeck2.c (check_narrowing, digest_init_r,
1710 process_init_constructor_array): Likewise.
1712 2019-08-05 Tom Honermann <tom@honermann.net>
1714 * parser.c (cp_parser_template_declaration_after_parameters): Enable
1715 class template argument deduction for non-type template parameters
1716 in literal operator templates.
1718 2019-08-05 Marek Polacek <polacek@redhat.com>
1720 PR c++/91338 - Implement P1161R3: Deprecate a[b,c].
1721 * parser.c (cp_parser_postfix_open_square_expression): Warn about uses
1722 of a comma operator within a subscripting expression.
1723 (cp_parser_skip_to_closing_square_bracket_1): New function, made out
1725 (cp_parser_skip_to_closing_square_bracket): ...this.
1727 2019-08-05 Jason Merrill <jason@redhat.com>
1729 * semantics.c (force_paren_expr): Preserve location.
1731 2019-08-02 Marek Polacek <polacek@redhat.com>
1733 PR c++/91230 - wrong error with __PRETTY_FUNCTION__ and generic lambda.
1734 * pt.c (value_dependent_expression_p): Consider __PRETTY_FUNCTION__
1735 inside a template function value-dependent.
1737 2019-08-02 Paolo Carlini <paolo.carlini@oracle.com>
1739 * tree.c (handle_nodiscard_attribute): Do not warn about nodiscard
1740 applied to a constructor.
1742 2019-08-02 Martin Liska <mliska@suse.cz>
1744 * decl.c (grok_op_properties):
1745 Mark DECL_SET_IS_OPERATOR_DELETE for user-provided delete operators.
1747 2019-08-01 Martin Sebor <msebor@redhat.com>
1750 * decl.c (reshape_init_array_1): Avoid truncating initializer
1751 lists containing string literals.
1753 2019-08-01 Marek Polacek <polacek@redhat.com>
1755 PR c++/90805 - detect narrowing in case values.
1756 * decl.c (case_conversion): Detect narrowing in case values.
1758 2019-07-31 Paolo Carlini <paolo.carlini@oracle.com>
1760 * decl2.c (delete_sanity): Improve diagnostic locations, use
1761 cp_expr_loc_or_loc in four places.
1763 2019-07-31 Jason Merrill <jason@redhat.com>
1765 PR c++/90538 - multiple expansions of capture packs
1766 * cp-tree.h (DECLTYPE_FOR_INIT_CAPTURE): Remove.
1767 * lambda.c (add_capture): Copy parameter packs from init.
1768 (lambda_capture_field_type): Always use auto for init-capture.
1769 * pt.c (uses_parameter_packs): Return tree.
1770 (tsubst) [DECLTYPE_TYPE]: Remove init-capture handling.
1771 (gen_elem_of_pack_expansion_instantiation): Don't push
1772 local_specialization_stack.
1773 (prepend_one_capture): New.
1774 (tsubst_lambda_expr): Use it. Don't touch local_specializations.
1775 (do_auto_deduction): Avoid redundant error.
1777 Fix copy_node of TEMPLATE_INFO.
1778 * cp-tree.h (struct tree_template_info): Use tree_base instead of
1779 tree_common. Add tmpl and args fields.
1780 (TI_TEMPLATE, TI_ARGS): Adjust.
1782 2019-07-30 Martin Liska <mliska@suse.cz>
1784 PR tree-optimization/91270
1785 * tree-ssa-dce.c (propagate_necessity): Mark 2nd argument
1786 of delete operator as needed.
1788 2019-07-25 Martin Liska <mliska@suse.cz>
1789 Dominik Infuhr <dominik.infuehr@theobroma-systems.com>
1792 * decl.c (cxx_init_decl_processing): Mark delete operators
1793 with DECL_SET_IS_OPERATOR_DELETE.
1795 2019-07-25 Martin Liska <mliska@suse.cz>
1797 * decl.c (duplicate_decls): Use new macros
1798 (e.g. DECL_SET_LAMBDA_FUNCTION and DECL_LAMBDA_FUNCTION_P).
1799 (cxx_init_decl_processing): Likewise.
1800 (grok_op_properties): Likewise.
1801 * parser.c (cp_parser_lambda_declarator_opt): Likewise.
1803 2019-07-24 Martin Sebor <msebor@redhat.com>
1806 * decl.c (finish_function): Use lang_mask.
1808 2019-07-20 Jason Merrill <jason@redhat.com>
1810 * cp-tree.h (ovl_iterator::using_p): A USING_DECL by itself was also
1811 introduced by a using-declaration.
1813 2019-07-20 Jason Merrill <jason@redhat.com>
1815 Reduce memory consumption for push/pop_access_scope.
1816 * name-lookup.c (leave_scope): Do add class levels other than
1817 previous_class_level to free_binding_level.
1818 (invalidate_class_lookup_cache): Move from class.c, add to
1820 * pt.c (saved_access_scope): Change from list to vec.
1822 2019-07-20 Jakub Jelinek <jakub@redhat.com>
1824 * cp-tree.h (OMP_FOR_GIMPLIFYING_P): Use OMP_LOOPING_CHECK
1825 instead of OMP_LOOP_CHECK.
1826 * parser.c (cp_parser_omp_clause_name): Handle bind clause.
1827 (cp_parser_omp_clause_bind): New function.
1828 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_BIND.
1829 (OMP_LOOP_CLAUSE_MASK): Define.
1830 (cp_parser_omp_loop): New function.
1831 (cp_parser_omp_parallel, cp_parser_omp_teams): Handle parsing of
1832 loop combined with parallel or teams.
1833 (cp_parser_omp_construct): Handle PRAGMA_OMP_LOOP.
1834 (cp_parser_pragma): Likewise.
1835 * pt.c (tsubst_expr): Handle OMP_LOOP.
1836 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_BIND.
1838 2019-07-19 Jason Merrill <jason@redhat.com>
1840 PR c++/90101 - dependent class non-type parameter.
1841 * pt.c (invalid_nontype_parm_type_p): Check for dependent class type.
1843 2019-07-18 Jason Merrill <jason@redhat.com>
1845 PR c++/90098 - partial specialization and class non-type parms.
1848 * call.c (build_converted_constant_expr_internal): Don't copy.
1849 * pt.c (process_partial_specialization): Allow VIEW_CONVERT_EXPR
1850 around class non-type parameter.
1851 (unify) [TEMPLATE_PARM_INDEX]: Ignore cv-quals.
1853 2019-07-16 Jason Merrill <jason@redhat.com>
1855 * parser.c (make_location): Add overload taking cp_lexer* as last
1858 * parser.c (cp_parser_simple_type_specifier): Separate tentative
1859 parses for optional type-spec and CTAD.
1861 * parser.c (cp_parser_nested_name_specifier_opt): If the token is
1862 already CPP_NESTED_NAME_SPECIFIER, leave it alone.
1864 2019-07-12 Jakub Jelinek <jakub@redhat.com>
1866 * parser.c (cp_parser_omp_clause_name): Handle order clause.
1867 (cp_parser_omp_clause_order): New function.
1868 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_ORDER.
1869 (OMP_SIMD_CLAUSE_MASK, OMP_FOR_CLAUSE_MASK): Add
1870 PRAGMA_OMP_CLAUSE_ORDER.
1871 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_ORDER.
1872 * pt.c (tsubst_omp_clauses): Likewise.
1874 2019-07-10 Paolo Carlini <paolo.carlini@oracle.com>
1876 * decl.c (get_type_quals,
1877 smallest_type_location (const cp_decl_specifier_seq*)): New.
1878 (check_tag_decl): Use smallest_type_location in error_at about
1879 multiple types in one declaration.
1880 (grokdeclarator): Use locations[ds_complex] in error_at about
1881 complex invalid; use locations[ds_storage_class] in error_at
1882 about static cdtor; use id_loc in error_at about flexible
1883 array member in union; use get_type_quals.
1885 2019-07-09 Martin Sebor <msebor@redhat.com>
1888 * cp-tree.h: Change class-key of PODs to struct and others to class.
1890 * semantics.c (finalize_nrv_r): Same.
1892 2019-07-09 Martin Sebor <msebor@redhat.com>
1895 * constexpr.c (cxx_eval_call_expression): Change class-key from class
1896 to struct and vice versa to match convention and avoid -Wclass-is-pod
1897 and -Wstruct-no-pod.
1898 * constraint.cc (get_concept_definition): Same.
1900 * cxx-pretty-print.h: Same.
1902 * logic.cc (term_list::replace): Same.
1903 * name-lookup.c (find_local_binding): Same.
1904 * pt.c (tsubst_binary_right_fold): Same.
1905 * search.c (field_accessor_p): Same.
1906 * semantics.c (expand_or_defer_fn): Same.
1908 2019-07-08 Jakub Jelinek <jakub@redhat.com>
1911 * decl2.c (cp_omp_mappable_type_1): Don't emit any note for
1912 error_mark_node type.
1914 2019-07-05 Jakub Jelinek <jakub@redhat.com>
1918 * call.c (build_new_method_call_1): Remove set but not used variable
1921 2019-07-05 Paolo Carlini <paolo.carlini@oracle.com>
1923 PR c++/67184 (again)
1925 * call.c (build_over_call): Devirtualize user-defined operators
1926 coming from a base too.
1927 (build_new_method_call_1): Do not devirtualize here.
1929 2019-07-04 Marek Polacek <polacek@redhat.com>
1932 PR c++/83374 - __is_standard_layout wrong for a class with repeated
1934 * class.c (check_bases): Set CLASSTYPE_NON_STD_LAYOUT for a class if
1935 CLASSTYPE_REPEATED_BASE_P is true.
1937 2019-07-04 Andrew Stubbs <ams@codesourcery.com>
1939 * cp-tree.h (cp_omp_emit_unmappable_type_notes): New prototype.
1940 * decl.c (cp_finish_decl): Call cp_omp_emit_unmappable_type_notes.
1941 * decl2.c (cp_omp_mappable_type): Move contents to ...
1942 (cp_omp_mappable_type_1): ... here and add note output.
1943 (cp_omp_emit_unmappable_type_notes): New function.
1944 * semantics.c (finish_omp_clauses): Call
1945 cp_omp_emit_unmappable_type_notes in four places.
1947 2019-07-03 Martin Liska <mliska@suse.cz>
1949 * call.c (build_new_op_1): Remove dead assignemts.
1950 * typeck.c (cp_build_binary_op): Likewise.
1952 2019-06-27 Jason Merrill <jason@redhat.com>
1954 PR c++/55442 - memory-hog with highly recursive constexpr.
1955 * constexpr.c (push_cx_call_context): Return depth.
1956 (cxx_eval_call_expression): Don't cache past constexpr_cache_depth.
1958 2019-06-27 Jan Hubicka <jh@suse.cz>
1960 * class.c (layout_class_type): Set TYPE_CXX_ODR_P for as-base
1963 2019-06-27 Martin Liska <mliska@suse.cz>
1965 * class.c (adjust_clone_args): Remove obviously
1967 (dump_class_hierarchy_r): Likewise.
1968 * decl.c (check_initializer): Likewise.
1969 * parser.c (cp_parser_lambda_expression): Likewise.
1970 * pt.c (unify_bound_ttp_args): Likewise.
1971 (convert_template_argument): Likewise.
1972 * rtti.c (build_headof): Likewise.
1973 * typeck.c (convert_for_initialization): Likewise.
1975 2019-06-25 Jason Merrill <jason@redhat.com>
1977 PR c++/70462 - unnecessary base ctor variant with final.
1978 * optimize.c (populate_clone_array): Skip base variant if
1980 (maybe_clone_body): We don't need an alias if we are only defining
1983 * class.c (resolves_to_fixed_type_p): Check CLASSTYPE_FINAL.
1985 2019-06-25 Jakub Jelinek <jakub@redhat.com>
1988 * constexpr.c (cxx_eval_array_reference): Don't look through VCE from
1989 vector type if lval.
1991 2019-06-25 Jozef Lawrynowicz <jozef.l@mittosystems.com>
1993 * lex.c (init_reswords): Create keyword for "__intN__" type.
1994 * cp-tree.h (cp_decl_specifier_seq): New bitfield "int_n_alt".
1995 * decl.c (grokdeclarator): Don't pedwarn about "__intN" ISO
1996 C incompatibility if alternate "__intN__" form is used.
1997 * parser.c (cp_parser_simple_type_specifier): Set
1998 decl_specs->int_n_alt if "__intN__" form is used.
2000 2019-06-24 Jan Hubicka <jh@suse.cz>
2002 * lex.c (cxx_make_type): Set TYPE_CXX_ODR_P.
2004 2019-06-24 Jason Merrill <jason@redhat.com>
2006 * class.c (layout_class_type): Don't use a separate
2007 CLASSTYPE_AS_BASE if it's the same size.
2009 2019-06-23 Marek Polacek <polacek@redhat.com>
2011 * call.c (convert_default_arg): Use DEFERRED_PARSE instead of
2013 * cp-objcp-common.c (cp_tree_size): Likewise. Use tree_deferred_parse
2014 instead of tree_default_arg.
2015 * cp-tree.def: Rename DEFAULT_ARG to DEFERRED_PARSE.
2016 * cp-tree.h: Rename DEFARG_TOKENS to DEFPARSE_TOKENS. Rename
2017 DEFARG_INSTANTIATIONS to DEFPARSE_INSTANTIATIONS. Rename
2018 tree_default_arg to tree_deferred_parse.
2019 (UNPARSED_NOEXCEPT_SPEC_P): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2020 (cp_tree_node_structure_enum): Rename TS_CP_DEFAULT_ARG to
2021 TS_CP_DEFERRED_PARSE.
2022 (lang_tree_node): Rename tree_default_arg to tree_deferred_parse.
2023 Rename default_arg to deferred_parse. Use TS_CP_DEFERRED_PARSE instead
2024 of TS_CP_DEFAULT_ARG.
2025 (defarg_location): Remove declaration.
2026 (defparse_location): Add declaration.
2027 * decl.c (grokfndecl): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2028 Call defparse_location instead of defarg_location.
2029 (check_default_argument): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2030 (cp_tree_node_structure): Likewise. Use TS_CP_DEFERRED_PARSE instead
2031 of TS_CP_DEFAULT_ARG.
2032 * decl2.c (grokfield): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2033 * error.c (dump_expr): Likewise.
2034 (location_of): Likewise.
2035 * init.c (get_nsdmi): Likewise.
2036 * parser.c (cp_parser_save_noexcept): Likewise. Use DEFPARSE_TOKENS
2037 instead of DEFARG_TOKENS.
2038 (cp_parser_late_noexcept_specifier): Likewise.
2039 (cp_parser_late_parse_one_default_arg): Use DEFPARSE_TOKENS instead
2041 (cp_parser_late_parsing_default_args): Use DEFERRED_PARSE instead of
2042 DEFAULT_ARG. Use DEFPARSE_INSTANTIATIONS instead of
2043 DEFARG_INSTANTIATIONS.
2044 (cp_parser_cache_defarg): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2045 Use DEFPARSE_TOKENS instead of DEFARG_TOKENS. Use
2046 DEFPARSE_INSTANTIATIONS instead of DEFARG_INSTANTIATIONS.
2047 (defparse_location): Renamed from defarg_location.
2048 * pt.c (tsubst_default_argument): Use DEFERRED_PARSE instead of
2050 (tsubst_arg_types): Likewise.
2051 (dependent_type_p_r): Likewise.
2052 * tree.c (cp_tree_equal): Likewise.
2053 (cp_walk_subtrees): Likewise.
2054 * typeck.c (convert_arguments): Likewise.
2056 2019-06-22 Marek Polacek <polacek@redhat.com>
2058 PR c++/86476 - noexcept-specifier is a complete-class context.
2060 * cp-tree.def (DEFAULT_ARG): Update commentary.
2061 * cp-tree.h (UNPARSED_NOEXCEPT_SPEC_P): New macro.
2062 (tree_default_arg): Use tree_base instead of tree_common.
2063 (do_push_parm_decls, maybe_check_overriding_exception_spec): Declare.
2064 * decl.c (do_push_parm_decls): New function, broken out of...
2065 (store_parm_decls): ...here. Call it.
2066 * except.c (nothrow_spec_p): Accept DEFAULT_ARG in the assert.
2067 * parser.c (cp_parser_noexcept_specification_opt,
2068 cp_parser_late_noexcept_specifier, noexcept_override_late_checks):
2070 (unparsed_noexcepts): New macro.
2071 (push_unparsed_function_queues): Update initializer.
2072 (cp_parser_direct_declarator): Pass FRIEND_P to
2073 cp_parser_exception_specification_opt.
2074 (inject_parm_decls): New.
2075 (pop_injected_parms): New.
2076 (cp_parser_class_specifier_1): Implement delayed parsing of
2077 noexcept-specifiers.
2078 (cp_parser_save_noexcept): New.
2079 (cp_parser_late_noexcept_specifier): New.
2080 (noexcept_override_late_checks): New.
2081 (cp_parser_noexcept_specification_opt): Add FRIEND_P parameter. Call
2082 cp_parser_save_noexcept instead of the normal processing if needed.
2083 (cp_parser_exception_specification_opt): Add FRIEND_P parameter and
2084 pass it to cp_parser_noexcept_specification_opt.
2085 (cp_parser_save_member_function_body): Fix comment.
2086 (cp_parser_save_default_args): Maybe save the noexcept-specifier to
2088 (cp_parser_transaction): Update call to
2089 cp_parser_noexcept_specification_opt.
2090 (cp_parser_transaction_expression): Likewise.
2091 * parser.h (cp_unparsed_functions_entry): Add new field to carry
2092 a noexcept-specifier.
2093 * pt.c (dependent_type_p_r): Handle unparsed noexcept expression.
2094 * search.c (maybe_check_overriding_exception_spec): New function, broken
2096 (check_final_overrider): ...here. Call
2097 maybe_check_overriding_exception_spec.
2098 * tree.c (canonical_eh_spec): Handle UNPARSED_NOEXCEPT_SPEC_P.
2099 (cp_tree_equal): Handle DEFAULT_ARG.
2101 PR c++/90881 - bogus -Wunused-value in unevaluated context.
2102 * cvt.c (convert_to_void): Don't emit unused warnings in
2103 an unevaluated context.
2105 2019-06-22 Paolo Carlini <paolo.carlini@oracle.com>
2107 * decl.c (grokdeclarator): Use id_loc, typespec_loc, and
2108 locations[ds_storage_class] in a few additional places.
2110 2019-06-21 Paolo Carlini <paolo.carlini@oracle.com>
2114 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com>
2118 * call.c (build_over_call): Devirtualize when the final overrider
2119 comes from the base.
2121 2019-06-21 Marek Polacek <polacek@redhat.com>
2123 PR c++/61490 - qualified-id in friend function definition.
2124 * decl.c (grokdeclarator): Diagnose qualified-id in friend function
2125 definition. Improve location for diagnostics of friend functions.
2127 PR c++/60223 - ICE with T{} in non-deduced context.
2128 * pt.c (unify): Allow COMPOUND_LITERAL_P in a non-deduced context.
2130 PR c++/64235 - missing syntax error with invalid alignas.
2131 * parser.c (cp_parser_std_attribute_spec): Commit to tentative parse
2132 if there's a missing close paren.
2134 PR c++/90490 - fix decltype issues in noexcept-specifier.
2135 * except.c (build_noexcept_spec): Call
2136 instantiate_non_dependent_expr_sfinae before
2137 build_converted_constant_expr instead of calling
2138 instantiate_non_dependent_expr after it. Add
2139 processing_template_decl_sentinel.
2141 2019-06-21 Jakub Jelinek <jakub@redhat.com>
2144 * semantics.c (finish_omp_clauses): Don't reject references to
2145 incomplete types if processing_template_decl.
2147 2019-06-19 Marek Polacek <polacek@redhat.com>
2149 PR c++/60364 - noreturn after first decl not diagnosed.
2150 * decl.c (duplicate_decls): Give an error when a function is
2151 declared [[noreturn]] after its first declaration.
2152 * parser.c (cp_parser_std_attribute): Don't treat C++11 noreturn
2153 attribute as equivalent to GNU's.
2154 * tree.c (std_attribute_table): Add noreturn.
2156 2019-06-19 Jakub Jelinek <jakub@redhat.com>
2158 * cp-gimplify.c (cp_genericize_r): Handle OMP_CLAUSE_{IN,EX}CLUSIVE
2159 like OMP_CLAUSE_SHARED.
2161 2019-06-18 Jason Merrill <jason@redhat.com>
2163 * constexpr.c (cxx_eval_store_expression): Delay target evaluation.
2165 2019-06-18 Jason Merrill <jason@redhat.com>
2167 * constexpr.c (eval_and_check_array_index): Split out from...
2168 (cxx_eval_array_reference): ...here.
2169 (cxx_eval_store_expression): Use it here, too.
2170 (diag_array_subscript): Take location. Strip location wrapper.
2172 2019-06-18 Jason Merrill <jason@redhat.com>
2174 * constexpr.c (cxx_eval_constant_expression): Handle conversion from
2175 and then to the same type.
2177 2019-06-18 Jason Merrill <jason@redhat.com>
2179 * constexpr.c (unshare_constructor): Add MEM_STAT_DECL.
2181 2019-06-17 Jakub Jelinek <jakub@redhat.com>
2183 * semantics.c (finish_omp_clauses): For OMP_CLAUSE_REDUCTION_INSCAN
2184 set need_copy_assignment.
2186 2019-06-17 Marek Polacek <polacek@redhat.com>
2188 PR c++/83820 - excessive attribute arguments not detected.
2189 * parser.c (cp_parser_std_attribute): Detect excessive arguments.
2191 2019-06-17 Nathan Sidwell <nathan@acm.org>
2194 * name-lookup.c (lookup_type_scope_1): Calll qualify_lookup before
2197 2019-06-14 Marek Polacek <polacek@redhat.com>
2199 PR c++/90884 - stray note with -Wctor-dtor-privacy.
2200 * class.c (maybe_warn_about_overly_private_class): Guard the call to
2203 2019-06-12 Jason Merrill <jason@redhat.com>
2205 PR c++/85552 - wrong instantiation of dtor for DMI.
2206 * typeck2.c (digest_nsdmi_init): Set tf_no_cleanup for direct-init.
2208 2019-06-13 Paolo Carlini <paolo.carlini@oracle.com>
2210 * decl.c (grokdeclarator): Use id_loc in five additional places
2211 in the last part of the function.
2213 2019-06-13 Paolo Carlini <paolo.carlini@oracle.com>
2215 * decl.c (grokdeclarator): Move further up the declaration of
2216 id_loc, use it immediately, update its value after the loop
2217 over declarator, use it again in the final part of function;
2218 improve locations of error messages about multiple data types
2219 and conflicting specifiers.
2221 2019-06-13 Richard Biener <rguenther@suse.de>
2224 * typeck2.c (split_nonconstant_init_1): Properly count
2225 num_split_elts, optimize single constructor elt removal.
2227 2019-06-12 Marek Polacek <polacek@redhat.com>
2229 PR c++/66999 - 'this' captured by reference.
2230 * parser.c (cp_parser_lambda_introducer): Reject `&this'. Use
2231 cp_lexer_nth_token_is instead of cp_lexer_peek_nth_token.
2233 PR c++/90825 - endless recursion when evaluating sizeof.
2234 PR c++/90832 - endless recursion when evaluating sizeof.
2235 * constexpr.c (cxx_eval_constant_expression): Don't recurse on the
2236 result of fold_sizeof_expr if is returns a SIZEOF_EXPR.
2237 * typeck.c (cxx_sizeof_expr): Only return a SIZEOF_EXPR if the operand
2238 is instantiation-dependent.
2240 PR c++/90736 - bogus error with alignof.
2241 * constexpr.c (adjust_temp_type): Use cv_unqualified type.
2243 2019-06-11 Matthew Beliveau <mbelivea@redhat.com>
2245 PR c++/90449 - add -Winaccessible-base option.
2246 * class.c (warn_about_ambiguous_bases): Changed name to:
2247 maybe_warn_about_inaccessible_bases.
2248 (maybe_warn_about_inaccessible_bases): Implemented new
2249 Winaccessible-base warning option for both direct and virtual
2251 (layout_class_type): Call to warn_about_ambiguous_bases changed to fit
2254 2019-06-11 Richard Biener <rguenther@suse.de>
2257 * typeck2.c (split_nonconstant_init_1): Avoid ordered remove
2258 from CONSTRUCTOR by marking to remove elements and doing all
2259 of them in a O(n) scan.
2261 2019-06-11 Jakub Jelinek <jakub@redhat.com>
2264 * init.c (constant_value_1): Handle VECTOR_CST DECL_INITIAL for
2265 !DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P decls like CONSTRUCTOR.
2267 2019-06-11 Martin Liska <mliska@suse.cz>
2270 * pt.c (init_template_processing): Disable hash table
2271 sanitization for decl_specializations and type_specializations.
2273 2019-06-10 Jason Merrill <jason@redhat.com>
2275 * constexpr.c (free_constructor): New.
2276 (cxx_eval_call_expression): Free parameter value CONSTRUCTORs.
2278 * constexpr.c (unshare_constructor): Only unshare if T is itself a
2280 (cxx_eval_call_expression): Don't call it on the result here.
2282 Reduce constexpr_call memory consumption.
2283 * constexpr.c (cxx_bind_parameters_in_call): Use TREE_VEC rather
2285 (constexpr_call_hasher::equal, cxx_bind_parameters_in_call)
2286 (cxx_eval_call_expression): Adjust.
2288 2019-06-10 Jakub Jelinek <jakub@redhat.com>
2290 * parser.c (cp_parser_omp_clause_reduction): Don't sorry_at on inscan
2292 (cp_parser_omp_scan_loop_body): New function.
2293 (cp_parser_omp_for_loop): Call cp_parser_omp_scan_loop_body if there
2294 are inscan reduction clauses.
2295 (cp_parser_pragma): Reject PRAGMA_OMP_SCAN.
2296 * semantics.c (finish_omp_clauses): Reject mixing inscan with
2297 non-inscan reductions on the same construct, or inscan reductions with
2298 ordered or schedule clauses, or inscan array reductions.
2299 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_{IN,EX}CLUSIVE.
2300 (tsubst_expr): Handle OMP_SCAN.
2302 2019-06-07 Jason Merrill <jason@redhat.com>
2304 * constexpr.c (cxx_eval_constant_expression): Call
2305 STRIP_ANY_LOCATION_WRAPPER early.
2306 [CONVERT_EXPR]: Don't build anything for conversion to void.
2307 [ADDR_EXPR]: ggc_free unused ADDR_EXPR.
2309 2019-06-05 Martin Sebor <msebor@redhat.com>
2312 * typeck.c (maybe_warn_about_returning_address_of_local): Only
2313 consider functions returning pointers as candidates for
2314 -Wreturn-local-addr.
2316 2019-06-05 Paolo Carlini <paolo.carlini@oracle.com>
2318 * decl.c (smallest_type_location): New.
2319 (check_special_function_return_type): Use it.
2320 (grokdeclarator): Lkewise.
2322 2019-06-05 Paolo Carlini <paolo.carlini@oracle.com>
2324 * decl.c (grokdeclarator): Use locations[ds_friend]
2327 2019-06-05 Martin Sebor <msebor@redhat.com>
2329 * call.c (build_conditional_expr_1): Adjust quoting and hyphenation.
2330 (convert_like_real): Same.
2331 (convert_arg_to_ellipsis): Same.
2332 * constexpr.c (diag_array_subscript): Same.
2333 * constraint.cc (diagnose_trait_expression): Same.
2334 * cvt.c (ocp_convert): Same.
2335 * decl.c (start_decl): Same.
2336 (check_for_uninitialized_const_var): Same.
2338 (check_special_function_return_type): Same.
2339 (finish_enum_value_list): Same.
2340 (start_preparsed_function): Same.
2341 * parser.c (cp_parser_decl_specifier_seq): Same.
2342 * typeck.c (cp_build_binary_op): Same.
2343 (build_static_cast_1): Same.
2345 2019-06-04 Nina Dinka Ranns <dinka.ranns@gmail.com>
2347 PR c++/63149 - Wrong auto deduction from braced-init-list.
2348 * pt.c (listify_autos): use non cv qualified auto_node in
2349 std::initializer_list<auto>.
2351 2019-06-04 Paolo Carlini <paolo.carlini@oracle.com>
2353 * decl.c (grokdeclarator): Use declarator->id_loc in two
2356 2019-06-04 Nathan Sidwell <nathan@acm.org>
2358 * name-lookup.c (lookup_type_scope_1): Reimplement, handle local
2359 and namespace scopes separately.
2361 2019-06-04 Harald van Dijk <harald@gigawatt.nl>
2363 PR c++/60531 - Wrong error about unresolved overloaded function
2364 * typeck.c (cp_build_binary_op): See if overload can be resolved.
2365 (cp_build_unary_op): Ditto.
2367 2019-06-04 Jason Merrill <jason@redhat.com>
2369 Reduce accumulated garbage in constexpr evaluation.
2370 * constexpr.c (cxx_eval_call_expression): ggc_free any bindings we
2372 (cxx_eval_increment_expression): ggc_free the MODIFY_EXPR after
2375 2019-06-04 Jakub Jelinek <jakub@redhat.com>
2377 * cp-tree.h (CP_OMP_CLAUSE_INFO): Allow for any clauses up to _condvar_
2378 instead of only up to linear.
2380 2019-06-03 Paolo Carlini <paolo.carlini@oracle.com>
2382 * parser.c (cp_parser_unqualified_id): Use build_min_nt_loc in
2385 2019-06-01 Ville Voutilainen <ville.voutilainen@gmail.com>
2388 * class.c (fixup_type_variants): Handle CLASSTYPE_FINAL.
2390 2019-05-31 Nathan Sidwell <nathan@acm.org>
2392 * cp-tree.h (IDENTIFIER_LAMBDA_P): New.
2394 (LAMBDA_TYPE_P, TYPE_UNNAMED_P): Likewise.
2395 (LAMBDANAME_PREFIX, LAMBDANAME_FORMAT): Delete.
2396 (make_lambda_name): Don't declare.
2397 * error.c (dump_aggr_type): Check for lambdas before other
2399 * lambda.c (begin_lambda_type): Use make_anon_name.
2400 * cp-lang.c (cxx_dwarf_name): Lambda names smell anonymous.
2401 * mangle.c (write_local_name): Likewise.
2402 * name-lookup.c (lambda_cnt, make_lambda_name): Delete.
2404 2019-05-30 Marek Polacek <polacek@redhat.com>
2406 * cp-tree.h (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Fix a typo.
2408 2019-05-31 Paolo Carlini <paolo.carlini@oracle.com>
2410 * decl.c (grokdeclarator): Use declarator->id_loc in five
2413 2019-05-29 Jakub Jelinek <jakub@redhat.com>
2416 * tree.c (lvalue_kind): Return clk_none for expressions with
2419 2019-05-29 Paolo Carlini <paolo.carlini@oracle.com>
2422 * parser.c (cp_parser_sizeof_operand): When the type-id production
2423 did not work out commit to the tentative parse.
2425 2019-05-29 Jakub Jelinek <jakub@redhat.com>
2427 P1091R3 - Extending structured bindings to be more like var decls
2428 P1381R1 - Reference capture of structured bindings
2429 * decl.c (cp_maybe_mangle_decomp): Handle TREE_STATIC decls even at
2431 (cp_finish_decomp): Copy over various decl properties from decl to
2432 v[i] in the tuple case.
2433 (grokdeclarator): Allow static, thread_local and __thread for C++2a
2434 and use pedwarn instead of error for older standard revisions.
2435 Make other structured binding diagnostic messages more i18n friendly.
2437 2019-05-28 Nathan Sidwell <nathan@acm.org>
2439 * decl.c (duplicate_decls): Assert a template newdecl has no
2442 2019-05-28 Marek Polacek <polacek@redhat.com>
2444 PR c++/90548 - ICE with generic lambda and empty pack.
2445 * pt.c (tsubst_copy_and_build): Handle pack expansion properly.
2447 2019-05-28 Nathan Sidwell <nathan@acm.org>
2449 * cp-tree.h (make_anon_name): Drop declaration.
2450 (TYPE_UNNAMED_P): Use IDENTIFIER_ANON_P.
2451 * cp-lang.c (cxx_dwarf_name): Likewise.
2452 * class.c (find_flexarrays): Likewise.
2453 * decl.c (name_unnamed_type, xref_tag_1): Likewise.
2454 * error.c (dump_aggr_type): Likewise.
2455 * pt.c (push_template_decl_real): Likewise.
2456 * name-lookup.c (consider_binding_level): Likewise.
2457 (anon_cnt, make_anon_name): Delete.
2459 2019-05-25 Marek Polacek <polacek@redhat.com>
2461 PR c++/90572 - wrong disambiguation in friend declaration.
2462 * parser.c (cp_parser_constructor_declarator_p): Don't allow missing
2463 typename for friend declarations.
2465 2019-05-23 Jonathan Wakely <jwakely@redhat.com>
2467 * cp-tree.h (CP_AGGREGATE_TYPE_P): Fix whitespace.
2469 * init.c (std_placement_new_fn_p): Remove outdated TODO comment that
2470 was resolved by r254694.
2472 2019-05-22 Jason Merrill <jason@redhat.com>
2474 PR c++/20408 - unnecessary code for empty struct.
2475 * call.c (build_call_a): Use simple_empty_class_p.
2477 PR c++/86485 - -Wmaybe-unused with empty class ?:
2478 * cp-gimplify.c (simple_empty_class_p): Also true for MODIFY_EXPR.
2480 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com>
2482 * parser.c (cp_parser_template_declaration_after_parameters): Use
2483 DECL_SOURCE_LOCATION in literal operator template errors.
2485 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com>
2489 * call.c (build_over_call): Devirtualize when the final overrider
2490 comes from the base.
2492 2019-05-21 Nathan Sidwell <nathan@acm.org>
2494 * name-lookup.c (do_nonmember_using_decl): Drop INSERT_P
2495 parameter. Document.
2496 (finish_nonmember_using_decl): Adjust do_nonmember_using_decl
2497 calls. Remove stray FIXME comment.
2499 * name-lookup.h (struct cp_binding_level): Drop usings field.
2500 (finish_namespace_using_decl, finish_local_using_decl): Replace with ...
2501 (finish_nonmember_using_decl): ... this.
2502 * name-lookup.c (push_using_decl_1, push_using_decl):
2503 (do_nonmember_using_decl): ... here. Add INSERT_P arg. Reimplement.
2504 (validate_nonmember_using_decl, finish_namespace_using_decl)
2505 (finish_local_using_decl): Replace with ...
2506 (finish_nonmember_using_decl): ... this. Drop DECL parm.
2507 * parser.c (cp_parser_using_declaration): Don't do lookup here.
2508 * pt.c (tsubst_expr): Do not do using decl lookup here.
2510 2019-05-21 Eric Botcazou <ebotcazou@adacore.com>
2512 * decl2.c (cpp_check) <IS_ASSIGNMENT_OPERATOR>: New case.
2514 2019-05-20 Marek Polacek <polacek@redhat.com>
2516 CWG 2094 - volatile scalars are trivially copyable.
2518 * tree.c (trivially_copyable_p): Don't check CP_TYPE_VOLATILE_P for
2521 2019-05-20 Marek Polacek <polacek@redhat.com>
2523 * pt.c (convert_template_argument): Add a diagnostic for the
2524 [temp.arg]/2 ambiguity case.
2526 * name-lookup.c (finish_using_directive): Don't issue inform() if the
2527 warning didn't trigger. Add quoting. Tweak the inform message.
2529 2019-05-20 Paolo Carlini <paolo.carlini@oracle.com>
2531 * cp-tree.h: Remove remnants of CONV_NONCONVERTING.
2533 2019-05-20 Nathan Sidwell <nathan@acm.org>
2535 * name-lookup.c (finish_namespace_using_directive)
2536 (finish_local_using_directive): Merge to ...
2537 (finish_using_directive): ... here. Handle both contexts.
2538 * name-lookup.h (finish_namespace_using_directive)
2539 (finish_local_using_directive): Replace with ...
2540 (finish_using_directive): ... this.
2541 * parser.c (cp_parser_using_directive): Adjust.
2542 * pt.c (tsubst_expr): Likewise.
2544 * cp-tree.h (struct lang_decl_ns): Remove usings field.
2545 (DECL_NAMESPACE_USING): Delete.
2546 * name-lookup.c (name_lookup::search_usings): Use namespace's
2548 (name_lookup::queue_namespae): Likewise.
2549 (finish_namespace_using_directive, push_namespace): Likewise.
2550 (has_using_namespace_std_directive): Just search the entire
2553 2019-05-20 Jonathan Wakely <jwakely@redhat.com>
2555 PR c++/90532 Ensure __is_constructible(T[]) is false
2556 * method.c (is_xible_helper): Return error_mark_node for construction
2557 of an array of unknown bound.
2559 2019-05-17 Thomas Schwinge <thomas@codesourcery.com>
2562 * parser.c (cp_finalize_oacc_routine): Rework checking if already
2563 marked with an OpenACC 'routine' directive.
2566 * parser.c (cp_parser_oacc_routine)
2567 (cp_parser_late_parsing_oacc_routine): Normalize order of clauses.
2568 (cp_finalize_oacc_routine): Call oacc_verify_routine_clauses.
2571 * parser.c (cp_finalize_oacc_routine): Refer to OpenACC 'routine'
2572 clauses from "omp declare target" attribute.
2574 2019-05-16 Martin Sebor <msebor@redhat.com>
2576 * call.c (print_z_candidate): Wrap diagnostic text in a gettext
2578 (print_z_candidates): Same.
2579 (build_conditional_expr_1): Quote keywords, operators, and types
2581 (build_op_delete_call): Same.
2582 (maybe_print_user_conv_context): Wrap diagnostic text in a gettext
2584 (convert_like_real): Same.
2585 (convert_arg_to_ellipsis): Quote keywords, operators, and types
2587 (build_over_call): Same.
2588 (joust): Break up an overlong line. Wrap diagnostic text in a gettext
2590 * constexpr.c (cxx_eval_check_shift_p): Spell out >= in English.
2591 (cxx_eval_constant_expression): Quote keywords, operators, and types
2593 (potential_constant_expression_1): Same.
2594 * cp-gimplify.c (cp_genericize_r): Same.
2595 * cvt.c (maybe_warn_nodiscard): Quote keywords, operators, and types
2597 (type_promotes_to): Same.
2598 * decl.c (check_previous_goto_1): Same.
2601 (cp_finish_decl): Avoid parenthesizing a sentence for consistency.
2602 (grok_op_properties): Quote keywords, operators, and types
2604 * decl2.c (grokfield): Same.
2605 (coerce_delete_type): Same.
2606 * except.c (is_admissible_throw_operand_or_catch_parameter): Same.
2607 * friend.c (do_friend): Quote C++ tokens.
2608 * init.c (build_new_1): Quote keywords, operators, and types
2610 (build_vec_delete_1): Same.
2611 (build_delete): Same.
2612 * lex.c (parse_strconst_pragma): Same.
2613 (handle_pragma_implementation): Same.
2614 (unqualified_fn_lookup_error): Same.
2615 * mangle.c (write_type): Same.
2616 * method.c (defaulted_late_check): Avoid two consecutive punctuators.
2617 * name-lookup.c (cp_binding_level_debug): Remove a trailing newline.
2618 (pop_everything): Same.
2619 * parser.c (cp_lexer_start_debugging): Quote a macro name.
2621 (cp_lexer_stop_debugging): Same.
2622 (cp_parser_userdef_numeric_literal): Quote a C++ header name
2624 (cp_parser_nested_name_specifier_opt): Quote keywords, operators,
2625 and types in diagnostics.
2626 (cp_parser_question_colon_clause): Same.
2627 (cp_parser_asm_definition): Same.
2628 (cp_parser_init_declarator): Same.
2629 (cp_parser_template_declaration_after_parameters): Avoid capitalizing
2630 a sentence in a diagnostic.
2631 (cp_parser_omp_declare_reduction): Quote keywords, operators, and types
2633 (cp_parser_transaction): Same.
2634 * pt.c (maybe_process_partial_specialization): Replace second call
2635 to permerror with inform for consistency with other uses.
2636 (expand_integer_pack): Quote keywords, operators, and types
2638 * rtti.c (get_typeid): Quote keywords, operators, and types
2640 (build_dynamic_cast_1): Same.
2641 * semantics.c (finish_asm_stmt): Same.
2642 (finish_label_decl): Same.
2643 (finish_bases): Same.
2644 (finish_offsetof): Same.
2645 (cp_check_omp_declare_reduction): Same.
2646 (finish_decltype_type): Same.
2647 * tree.c (handle_init_priority_attribute): Same. Add detail
2649 (maybe_warn_zero_as_null_pointer_constant): Same.
2650 * typeck.c (cp_build_binary_op): Quote keywords, operators, and types
2652 (cp_build_unary_op): Same.
2653 (check_for_casting_away_constness): Same.
2654 (build_static_cast): Same.
2655 (build_const_cast_1): Same.
2656 (maybe_warn_about_returning_address_of_local): Same.
2657 (check_return_expr): Same.
2658 * typeck2.c (abstract_virtuals_error_sfinae): Same.
2659 (digest_init_r): Replace a tab with spaces in a diagnostic.
2660 (build_functional_cast): Quote keywords, operators, and types
2663 2019-05-15 Jakub Jelinek <jakub@redhat.com>
2666 * cp-gimplify.c (genericize_cp_loop): Emit a DEBUG_BEGIN_STMT
2667 before the condition (or if missing or constant non-zero at the end
2668 of the loop. Emit a DEBUG_BEGIN_STMT before the increment expression
2669 if any. Don't call protected_set_expr_location on incr if it already
2672 2019-05-15 Marek Polacek <polacek@redhat.com>
2674 CWG 2096 - constraints on literal unions.
2675 * class.c (check_field_decls): Initialize booleans directly. A union
2676 is literal if at least one of its non-static data members is of
2677 non-volatile literal type.
2679 2019-05-15 Paolo Carlini <paolo.carlini@oracle.com>
2681 * cp-tree.h (REFERENCE_VLA_OK): Remove.
2682 * lambda.c (build_capture_proxy): Remove use of the above.
2684 2019-05-15 Paolo Carlini <paolo.carlini@oracle.com>
2686 * call.c (perform_overload_resolution, build_new_method_call_1):
2687 Use OVL_P; remove redundant TEMPLATE_DECL checks.
2688 * decl.c (grokfndecl): Likewise.
2689 * mangle.c (write_expression): Likewise.
2690 * parser.c (cp_parser_template_id): Likewise.
2691 * pt.c (resolve_overloaded_unification, type_dependent_expression_p):
2693 * search.c (build_baselink): Likewise.
2694 * tree.c (is_overloaded_fn, dependent_name, maybe_get_fns): Likewise.
2696 2019-05-14 Paolo Carlini <paolo.carlini@oracle.com>
2698 PR preprocessor/90382
2699 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
2702 2019-05-13 Jason Merrill <jason@redhat.com>
2704 Use releasing_vec more broadly.
2705 * cp-tree.h (struct releasing_vec): Replace get_ref method with
2707 (vec_safe_push, vec_safe_reserve, vec_safe_length, vec_safe_splice):
2708 Forwarding functions for releasing_vec.
2709 (release_tree_vector): Declare but don't define.
2710 * call.c (build_op_delete_call, build_temp, call_copy_ctor)
2711 (perform_direct_initialization_if_possible): Use releasing_vec.
2712 * constexpr.c (cxx_eval_vec_init_1, cxx_eval_store_expression):
2714 * cp-gimplify.c (cp_fold): Likewise.
2715 * cvt.c (force_rvalue, ocp_convert): Likewise.
2716 * decl.c (get_tuple_decomp_init): Likewise.
2717 * except.c (build_throw): Likewise.
2718 * init.c (perform_member_init, expand_default_init): Likewise.
2719 * method.c (do_build_copy_assign, locate_fn_flags): Likewise.
2720 * parser.c (cp_parser_userdef_char_literal)
2721 (cp_parser_userdef_numeric_literal)
2722 (cp_parser_userdef_string_literal)
2723 (cp_parser_perform_range_for_lookup)
2724 (cp_parser_range_for_member_function, cp_parser_omp_for_loop)
2725 (cp_parser_omp_for_loop_init): Likewise.
2726 * pt.c (tsubst_copy_and_build, do_class_deduction): Likewise.
2727 * semantics.c (calculate_direct_bases, calculate_bases)
2728 (finish_omp_barrier, finish_omp_flush, finish_omp_taskwait)
2729 (finish_omp_taskyield, finish_omp_cancel)
2730 (finish_omp_cancellation_point): Likewise.
2731 * tree.c (build_vec_init_elt, strip_typedefs, strip_typedefs_expr)
2732 (build_min_non_dep_op_overload): Likewise.
2733 * typeck.c (build_function_call_vec, cp_build_function_call_nary)
2734 (cp_build_modify_expr): Likewise.
2735 * typeck2.c (build_functional_cast): Likewise.
2737 2019-05-11 Paolo Carlini <paolo.carlini@oracle.com>
2739 * typeck.c (cp_build_function_call_vec): When mark_used fails
2740 unconditionally return error_mark_node.
2742 2019-05-10 Paolo Carlini <paolo.carlini@oracle.com>
2744 * decl.c (grokvardecl): Use an accurate location in error message
2745 about main as a global variable.
2747 2019-05-10 Paolo Carlini <paolo.carlini@oracle.com>
2749 * call.c (build_call_a): Use FUNC_OR_METHOD_TYPE_P.
2750 * cp-gimplify.c (cp_fold): Likewise.
2751 * cp-objcp-common.c (cp_type_dwarf_attribute): Likewise.
2752 * cp-tree.h (TYPE_OBJ_P, TYPE_PTROBV_P): Likewise.
2753 * cvt.c (perform_qualification_conversions): Likewise.
2754 * decl.c (grokdeclarator): Likewise.
2755 * decl2.c (build_memfn_type): Likewise.
2756 * mangle.c (canonicalize_for_substitution, write_type): Likewise.
2757 * parser.c (cp_parser_omp_declare_reduction): Likewise.
2758 * pt.c (check_explicit_specialization, uses_deducible_template_parms,
2759 check_cv_quals_for_unify, dependent_type_p_r): Likewise.
2760 * rtti.c (ptr_initializer): Likewise.
2761 * semantics.c (finish_asm_stmt, finish_offsetof,
2762 cp_check_omp_declare_reduction): Likewise.
2763 * tree.c (cp_build_qualified_type_real,
2764 cp_build_type_attribute_variant, cxx_type_hash_eq,
2765 cxx_copy_lang_qualifiers, cp_free_lang_data): Likewise.
2766 * typeck.c (structural_comptypes, convert_arguments,
2767 cp_build_addr_expr_1, unary_complex_lvalue, cp_build_c_cast,
2768 cp_build_modify_expr, comp_ptr_ttypes_real, type_memfn_rqual):
2771 2019-05-10 Marek Polacek <polacek@redhat.com>
2773 PR c++/78010 - bogus -Wsuggest-override warning on final function.
2774 * class.c (check_for_override): Don't warn for final functions.
2776 2019-05-10 Jakub Jelinek <jakub@redhat.com>
2779 * config-lang.in (gtfiles): Remove c-family/c-lex.c, add
2780 c-family/c-cppbuiltin.c.
2782 2019-05-09 Paolo Carlini <paolo.carlini@oracle.com>
2786 2018-04-26 Paolo Carlini <paolo.carlini@oracle.com>
2788 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
2791 2019-05-08 Nathan Sidwell <nathan@acm.org>
2793 Kill DECL_SAVED_FUNCTION_DATA .
2794 * cp-tree.h (language_function): Remove x_auto_return_pattern.
2795 (current_function_auto_return_pattern): Delete.
2796 (lang_decl_fn): Replace saved_language_function with
2797 saved_auto_return type.
2798 (DECL_SAVED_FUNCTION_DATA): Delete.
2799 (DECL_SAVED_AUTO_RETURN_TYPE): New.
2800 (FNDECL_USED_AUTO): Correct documentation.
2801 * decl.c (duplicate_decls): Adjust AUTO return handling.
2802 (start_preparsed_function): Replace
2803 current_function_auto_return_pattern with
2804 DECL_SAVED_AUTO_RETURN_TYPE. Remove DECL_SAVED_FUNCTION_DATA
2806 (finish_function): Likewise.
2807 (save_function_data): Delete.
2808 (fndecl_declared_return_type): Reimplement.
2809 * mangle.c (write_unqualified_name): Use DECL_SAVED_AUTO_RETURN_TYPE.
2810 * method.c (make_thunk, make_alias_for): Likewise.
2811 * parser.c (cp_parser_jump_statement): Likewise.
2812 * pt.c (do_auto_deduction): Likewise.
2813 * typeck.c (check_return_expr): Likewise.
2815 2019-05-06 Jason Merrill <jason@redhat.com>
2817 PR c++/90171 - reorganize usual_deallocation_fn_p
2818 * call.c (struct dealloc_info): New.
2819 (usual_deallocation_fn_p): Take a dealloc_info*.
2820 (aligned_deallocation_fn_p, sized_deallocation_fn_p): Remove.
2821 (build_op_delete_call): Adjust.
2823 2019-05-07 Jason Merrill <jason@redhat.com>
2825 PR c++/86485 - -Wmaybe-unused with empty class ?:
2826 * typeck.c (build_static_cast_1): Use cp_build_addr_expr.
2828 * pt.c (type_dependent_expression_p): A non-type template parm with
2829 a placeholder type is type-dependent.
2831 2019-05-06 Marek Polacek <polacek@redhat.com>
2833 PR c++/90265 - ICE with generic lambda.
2834 * pt.c (tsubst_copy_and_build): Use a dedicated variable for the last
2835 element in the vector.
2837 2019-05-03 Martin Liska <mliska@suse.cz>
2839 * call.c (build_aggr_conv): Use is_empty instead of
2840 elements () == 0 (and similar usages).
2841 * parser.c (cp_parser_lambda_introducer): Likewise.
2843 2019-05-02 Nathan Sidwell <nathan@acm.org>
2845 * semantics.c (finish_id_expression_1): Remove unreachable code.
2847 2019-05-01 Nathan Sidwell <nathan@acm.org>
2849 * name-lookup.h (get_class_binding_direct): Change final arg to
2851 (get_class_binding): Likewise.
2852 * name-lookup.c (get_class_binding_direct): Replace TYPE_OR_FNS
2853 arg with WANT_TYPE bool. Simplify.
2854 (get_class_binding): Adjust final arg.
2855 * decl.c (reshape_init_class): Adjust get_class_binding calls.
2857 2019-04-30 Nathan Sidwell <nathan@acm.org>
2859 * cp-objcp-common.c (cp_common_init_ts): Use MARK_TS_EXP for _EXPR
2860 nodes. Call c_common_init_ts.
2862 2019-04-29 Nathan Sidwell <nathan@acm.org>
2864 * decl.c (duplicate_decls): Add whitespace, move comments into
2866 * method.c (explain_implicit_non_constexpr): Refactor.
2867 * pt.c (check_explicit_specialization): Fix indentation.
2868 * semantics.c (process_outer_var_ref): Reformat.
2869 (finish_id_expression_1): Use STRIP_TEMPLATE.
2871 2019-04-26 Jonathan Wakely <jwakely@redhat.com>
2873 PR c++/90243 - orphaned note in uninstantiated constexpr function
2874 * decl.c (check_for_uninitialized_const_var): Suppress notes if no
2877 2019-04-26 Paolo Carlini <paolo.carlini@oracle.com>
2880 * decl.c (grokdeclarator): Set type to error_mark_node
2881 upon error about template placeholder type non followed
2882 by a simple declarator-id.
2884 2019-04-26 Paolo Carlini <paolo.carlini@oracle.com>
2886 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
2889 2019-04-24 Jason Merrill <jason@redhat.com>
2891 PR c++/90227 - error with template parameter packs.
2892 * pt.c (coerce_template_parms): Do add empty pack when
2895 2019-04-24 Richard Biener <rguenther@suse.de>
2897 * call.c (null_ptr_cst_p): Order checks according to expensiveness.
2898 (conversion_null_warnings): Likewise.
2899 * typeck.c (same_type_ignoring_top_level_qualifiers_p): Return
2900 early if type1 == type2.
2902 2019-04-22 Jason Merrill <jason@redhat.com>
2904 PR c++/87366 - wrong error with alias template.
2905 * typeck.c (structural_comptypes): When comparing_specializations,
2906 aliases are unequal.
2907 (comptypes): When comparing_specializations, do structural
2910 2019-04-19 Jason Merrill <jason@redhat.com>
2912 PR c++/90190 - CTAD with list-constructor.
2913 * pt.c (do_class_deduction): Don't try the single element deduction
2914 if the single element is also a braced list.
2916 PR c++/90171 - ICE with destroying delete with size_t parm.
2917 * call.c (sized_deallocation_fn_p): New. Use it instead of
2918 second_parm_is_size_t in most cases.
2919 (second_parm_is_size_t): Don't check for aligned.
2921 2019-04-19 Paolo Carlini <paolo.carlini@oracle.com>
2924 * pt.c (fn_type_unification): When handling null explicit
2925 arguments do not special case non-parameter packs.
2927 2019-04-19 Jakub Jelinek <jakub@redhat.com>
2930 * pt.c (process_template_parm): Set decl to pushdecl result. If
2931 !is_non_type, also set parm to that.
2934 * decl.c (struct cp_switch): Remove outside_range_p member.
2935 (push_switch): Don't clear it.
2936 (pop_switch): Adjust c_do_switch_warnings caller.
2937 (finish_case_label): Adjust c_add_case_label caller.
2940 * decl.c (duplicate_decls): If remove is main variant and
2941 DECL_ORIGINAL_TYPE is some other type, remove a DECL_ORIGINAL_TYPE
2942 variant that has newdecl as TYPE_NAME if any.
2944 2019-04-18 Jason Merrill <jason@redhat.com>
2946 PR c++/87554 - ICE with extern template and reference member.
2947 * decl.c (cp_finish_decl): Don't set DECL_INITIAL of external vars.
2949 2019-04-17 Jason Merrill <jason@redhat.com>
2951 PR c++/90047 - ICE with enable_if alias template.
2952 * pt.c (tsubst_decl) [TYPE_DECL]: Don't put an erroneous decl in the
2953 hash table when we're in SFINAE context.
2955 2019-04-17 Marek Polacek <polacek@redhat.com>
2957 PR c++/90124 - bogus error with incomplete type in decltype.
2958 * typeck.c (build_class_member_access_expr): Check
2959 cp_unevaluated_operand.
2961 2019-04-12 Jakub Jelinek <jakub@redhat.com>
2964 * decl.c (duplicate_decls): When newdecl's type is its main variant,
2965 don't try to remove it from the variant list, but instead assert
2968 2019-04-12 Martin Sebor <msebor@redhat.com>
2972 * parser.c (cp_parser_has_attribute_expression): Handle assignment
2975 2019-04-12 Jason Merrill <jason@redhat.com>
2977 * call.c (null_member_pointer_value_p): Handle an empty CONSTRUCTOR
2980 2019-04-12 Marek Polacek <polacek@redhat.com>
2982 * except.c (build_noexcept_spec): Use build_converted_constant_bool_expr
2983 instead of perform_implicit_conversion_flags.
2985 PR c++/87603 - constexpr functions are no longer noexcept.
2986 * constexpr.c (is_sub_constant_expr): Remove unused function.
2987 * cp-tree.h (is_sub_constant_expr): Remove declaration.
2988 * except.c (check_noexcept_r): Don't consider a call to a constexpr
2991 2019-04-11 Jakub Jelinek <jakub@redhat.com>
2993 PR translation/90035
2994 * parser.h (struct cp_parser): Add
2995 type_definition_forbidden_message_arg member.
2996 * parser.c (cp_debug_parser): Print it.
2997 (cp_parser_check_type_definition): Pass
2998 parser->type_definition_forbidden_message_arg as second argument to
3000 (cp_parser_has_attribute_expression, cp_parser_sizeof_operand): Set
3001 parser->type_definition_forbidden_message_arg and use G_() with
3002 %qs for parser->type_definition_forbidden_message instead of
3003 building untranslatable message using concat.
3005 2019-04-09 Jakub Jelinek <jakub@redhat.com>
3007 PR translation/90011
3008 * typeck2.c (check_narrowing): Remove trailing space from diagnostics.
3010 2019-04-08 Marek Polacek <polacek@redhat.com>
3012 * typeck2.c (digest_init_r): Don't condition the object slicing warning
3015 2019-04-08 Paolo Carlini <paolo.carlini@oracle.com>
3018 * semantics.c (trait_expr_value): Don't use TYPE_NOTHROW_P
3019 when maybe_instantiate_noexcept fails.
3020 (classtype_has_nothrow_assign_or_copy_p): Likewise.
3021 * method.c (implicitly_declare_fn): Avoid passing error_mark_node
3022 to build_exception_variant.
3024 2019-04-05 Marek Polacek <polacek@redhat.com>
3026 PR c++/87145 - bogus error converting class type in template arg list.
3027 * pt.c (convert_nontype_argument): Don't call
3028 build_converted_constant_expr if it could involve calling a conversion
3029 function with a instantiation-dependent constructor as its argument.
3031 2019-04-05 Martin Sebor <msebor@redhat.com>
3034 * decl.c (reshape_init_array_1): Avoid treating empty strings
3035 as zeros in array initializers.
3036 Use trivial_type_p () instead of TYPE_HAS_TRIVIAL_DFLT().
3038 2019-04-04 Jason Merrill <jason@redhat.com>
3040 PR c++/89948 - ICE with break in statement-expr.
3041 * constexpr.c (cxx_eval_statement_list): Jumping out of a
3042 statement-expr is non-constant.
3044 2019-04-04 Jason Merrill <jason@redhat.com>
3046 PR c++/89966 - error with non-type auto tparm.
3047 * pt.c (do_auto_deduction): Clear tf_partial.
3049 2019-04-04 Jason Merrill <jason@redhat.com>
3051 PR c++/86986 - ICE with TTP with parameter pack.
3052 * pt.c (coerce_template_parameter_pack): Only look at the type of a
3053 non-type parameter pack.
3054 (fixed_parameter_pack_p_1): Don't recurse into the type of a
3055 non-type parameter pack.
3056 (coerce_template_template_parms): Call add_outermost_template_args.
3058 2019-04-04 Martin Sebor <msebor@redhat.com>
3064 * decl.c (reshape_init_array_1): Strip trailing zero-initializers
3065 from arrays of trivial type and known size.
3066 * mangle.c (write_expression): Convert braced initializer lists
3068 (write_expression): Trim trailing zero-initializers from arrays
3070 (write_template_arg_literal): Mangle strings the same as braced
3073 2019-04-03 Jason Merrill <jason@redhat.com>
3075 PR c++/81866 - ICE with member template and default targ.
3076 * pt.c (tsubst_template_decl): Handle getting a type from
3077 retrieve_specialization.
3079 PR c++/86586 - -fcompare-debug=-Wsign-compare.
3080 * typeck.c (cp_build_binary_op): Don't fold for -Wsign-compare.
3082 PR c++/89331 - ICE with offsetof in incomplete class.
3083 * semantics.c (finish_offsetof): Handle error_mark_node.
3084 * typeck.c (build_class_member_access_expr): Call
3085 complete_type_or_maybe_complain before converting to base.
3087 PR c++/89917 - ICE with lambda in variadic mem-init.
3088 * pt.c (make_pack_expansion): Change type_pack_expansion_p to false.
3090 2019-04-01 Jason Merrill <jason@redhat.com>
3092 PR c++/86946 - ICE with function call in template argument.
3094 * pt.c (iterative_hash_template_arg) [CALL_EXPR]: Use
3097 2019-04-01 Paolo Carlini <paolo.carlini@oracle.com>
3100 * pt.c (tsubst_copy): Deal with lookup_name not returing a variable.
3102 2019-03-31 Marek Polacek <polacek@redhat.com>
3104 PR c++/89852 - ICE with C++11 functional cast with { }.
3105 * constexpr.c (fold_non_dependent_expr_template): New static function
3107 (fold_non_dependent_expr): ...here.
3108 (fold_non_dependent_init): New function.
3109 * cp-tree.h (fold_non_dependent_init): Declare.
3110 * typeck2.c (massage_init_elt): Call fold_non_dependent_init instead
3111 of fold_non_dependent_expr. Don't call maybe_constant_init.
3113 2019-03-30 Jason Merrill <jason@redhat.com>
3115 PR c++/89744 - ICE with specialization of member class template.
3116 * pt.c (lookup_template_class_1): If the partial instantiation is
3117 explicitly specialized, adjust.
3118 (maybe_process_partial_specialization): Also adjust
3121 2019-03-29 Jakub Jelinek <jakub@redhat.com>
3124 * typeck.c: Include gimplify.h.
3125 (cp_build_modify_expr) <case COND_EXPR>: Unshare rhs before using it
3126 for second time. Formatting fixes.
3128 2019-03-29 Marek Polacek <polacek@redhat.com>
3130 PR c++/89876 - ICE with deprecated conversion.
3131 * call.c (convert_like_real): Only give warnings with tf_warning.
3133 2019-03-28 Marek Polacek <polacek@redhat.com>
3135 PR c++/89612 - ICE with member friend template with noexcept.
3136 * pt.c (maybe_instantiate_noexcept): For function templates, use their
3137 template result (function decl). Don't set up local specializations.
3138 Temporarily turn on processing_template_decl. Update the template type
3141 PR c++/89836 - bool constant expression and explicit conversions.
3142 * call.c (build_converted_constant_expr_internal): New function,
3144 (build_converted_constant_expr): ...this. New.
3145 (build_converted_constant_bool_expr): New.
3146 * cp-tree.h (build_converted_constant_bool_expr): Declare.
3147 * decl.c (build_explicit_specifier): Call
3148 build_converted_constant_bool_expr.
3150 2019-03-28 Jakub Jelinek <jakub@redhat.com>
3153 * constexpr.c (struct check_for_return_continue_data): New type.
3154 (check_for_return_continue): New function.
3155 (potential_constant_expression_1) <case SWITCH_STMT>: Walk
3156 SWITCH_STMT_BODY to find RETURN_EXPRs or CONTINUE_STMTs not nested
3157 in loop bodies and set *jump_target to that if found.
3159 2019-03-27 Jason Merrill <jason@redhat.com>
3161 PR c++/89831 - error with qualified-id in const member function.
3162 * semantics.c (finish_non_static_data_member): Use object cv-quals
3163 in scoped case, too.
3165 PR c++/89421 - ICE with lambda in template parameter list.
3166 * parser.c (cp_parser_lambda_expression): Also reject a lambda in a
3167 template parameter list before C++20.
3168 * pt.c (type_dependent_expression_p): True for LAMBDA_EXPR.
3169 * semantics.c (begin_class_definition): Restore error about defining
3170 non-lambda class in template parm list.
3172 2019-03-26 Jason Merrill <jason@redhat.com>
3174 PR c++/86932 - missed SFINAE with empty pack.
3175 * pt.c (coerce_template_parms): Don't add an empty pack if
3177 (fn_type_unification): Pass tf_partial to coerce_template_parms.
3179 PR c++/86429 - constexpr variable in lambda.
3182 * constexpr.c (cxx_eval_constant_expression): In a lambda function,
3183 try evaluating the captured variable directly.
3185 2019-03-26 Jakub Jelinek <jakub@redhat.com>
3188 * semantics.c (finish_omp_atomic): Add warning_sentinel for
3189 -Wunused-value around finish_expr_stmt call.
3191 2019-03-25 Paolo Carlini <paolo.carlini@oracle.com>
3195 * parser.c (cp_parser_binary_expression): Don't call cp_fully_fold
3196 to undo the disabling of warnings.
3198 2019-03-25 Jason Merrill <jason@redhat.com>
3200 PR c++/87748 - substitution failure error with decltype.
3201 * pt.c (most_specialized_partial_spec): Clear
3202 processing_template_decl.
3204 2019-03-25 Marek Polacek <polacek@redhat.com>
3206 PR c++/89214 - ICE when initializing aggregates with bases.
3207 * typeck2.c (digest_init_r): Warn about object slicing instead of
3210 PR c++/89705 - ICE with reference binding with conversion function.
3211 * call.c (reference_binding): If the result of the conversion function
3212 is a prvalue of non-class type, use the cv-unqualified type.
3214 2019-03-25 Nathan Sidwell <nathan@acm.org>
3216 * lambda.c (maybe_add_lambda_conv_op): Don't add to comdat group.
3218 2019-03-22 Jakub Jelinek <jakub@redhat.com>
3221 * cp-tree.h (get_tls_wrapper_fn): Remove declaration.
3222 (maybe_get_tls_wrapper_call): Declare.
3223 * decl2.c (get_tls_wrapper_fn): Make static.
3224 (maybe_get_tls_wrapper_call): New function.
3225 * typeck.c (build_class_member_access_expr): Handle accesses to TLS
3227 * semantics.c (finish_qualified_id_expr): Likewise.
3228 (finish_id_expression_1): Use maybe_get_tls_wrapper_call.
3229 * pt.c (tsubst_copy_and_build): Likewise.
3232 * constexpr.c (struct constexpr_ctx): Add constexpr_ops_count member.
3233 (cxx_eval_constant_expression): When not skipping, not constant class
3234 or location wrapper, increment *ctx->constexpr_ops_count and if it is
3235 above constexpr_loop_nest_limit, diagnose failure.
3236 (cxx_eval_outermost_constant_expr): Add constexpr_ops_count and
3237 initialize ctx.constexpr_ops_count to its address.
3238 (is_sub_constant_expr): Likewise.
3240 2019-03-21 Jakub Jelinek <jakub@redhat.com>
3243 * call.c (filed_in_pset): Change pset from hash_set<tree> * to
3244 hash_set<tree, true> &, adjust uses accordingly.
3245 (build_aggr_conv): Change pset from hash_set<tree> *
3246 to hash_set<tree, true>. Replace goto fail; with return NULL;,
3250 * parser.c (cp_parser_lambda_introducer): Add ids and first_capture_id
3251 variables, check for duplicates in this function.
3252 * lambda.c (add_capture): Don't check for duplicates nor use
3254 (register_capture_members): Don't clear IDENTIFIER_MARKED here.
3256 2019-03-21 Paolo Carlini <paolo.carlini@oracle.com>
3259 * method.c (after_nsdmi_defaulted_late_checks): Avoid passing
3260 error_mark_node to comp_except_specs.
3262 2019-03-20 Jason Merrill <jason@redhat.com>
3264 PR c++/87480 - decltype of member access in default template arg
3265 * pt.c (type_unification_real): Accept a dependent result in
3268 2019-03-19 Martin Sebor <msebor@redhat.com>
3270 PR tree-optimization/89688
3271 * typeck2.c (store_init_value): Call braced_lists_to_string for more
3272 kinds of initializers.
3274 2019-03-18 Jason Merrill <jason@redhat.com>
3276 PR c++/89630 - ICE with dependent using-decl as template arg.
3277 * tree.c (cp_tree_equal): Always return false for USING_DECL.
3279 PR c++/89761 - ICE with sizeof... in pack expansion.
3280 * pt.c (argument_pack_element_is_expansion_p): Handle
3281 ARGUMENT_PACK_SELECT.
3283 PR c++/89640 - GNU attributes on lambda.
3284 * parser.c (cp_parser_lambda_declarator_opt): Allow GNU attributes.
3286 PR c++/89682 - wrong access error in default argument.
3287 * pt.c (tsubst_default_argument): Don't defer access checks.
3289 2019-03-18 Paolo Carlini <paolo.carlini@oracle.com>
3292 * semantics.c (finish_non_static_data_member): Check return value
3293 of context_for_name_lookup and immediately return error_mark_node
3296 2019-03-17 Jason Merrill <jason@redhat.com>
3298 PR c++/89571 - ICE with ill-formed noexcept on constructor.
3299 * pt.c (maybe_instantiate_noexcept): Only return false if defaulted.
3300 (regenerate_decl_from_template): Use it for noexcept-specs.
3302 2019-03-14 Jason Merrill <jason@redhat.com>
3304 * parser.c (cp_parser_decl_specifier_seq): Support C++20
3305 concept-definition syntax without 'bool'.
3307 2019-03-14 Jakub Jelinek <jakub@redhat.com>
3310 * semantics.c (finish_qualified_id_expr): Reject variable templates.
3313 * constexpr.c (struct constexpr_ctx): Change save_exprs type from
3314 hash_set<tree> to vec<tree>.
3315 (cxx_eval_call_expression): Adjust for save_exprs being a vec instead
3317 (cxx_eval_loop_expr): Likewise. Truncate the vector after each
3318 removal of SAVE_EXPRs from values.
3319 (cxx_eval_constant_expression) <case SAVE_EXPR>: Call safe_push
3320 method on save_exprs instead of add.
3322 2019-03-13 Jason Merrill <jason@redhat.com>
3324 PR c++/86521 - C++17 copy elision in initialization by constructor.
3325 * call.c (joust_maybe_elide_copy): New.
3328 2019-03-13 Marek Polacek <polacek@redhat.com>
3330 PR c++/88979 - further P0634 fix for constructors.
3331 * parser.c (cp_parser_decl_specifier_seq): Pass flags to
3332 cp_parser_constructor_declarator_p.
3333 (cp_parser_direct_declarator): Allow missing typename for constructor
3335 (cp_parser_constructor_declarator_p): Add FLAGS parameter. Pass it to
3336 cp_parser_type_specifier.
3338 PR c++/89686 - mixing init-capture and simple-capture in lambda.
3339 * parser.c (cp_parser_lambda_introducer): Give error when combining
3340 init-capture and simple-capture.
3342 PR c++/89660 - bogus error with -Wredundant-move.
3343 * typeck.c (maybe_warn_pessimizing_move): Only accept (T &) &arg
3344 as the std::move's argument. Don't call convert_for_initialization
3345 when warn_redundant_move isn't on.
3347 2019-03-11 Jason Merrill <jason@redhat.com>
3349 PR c++/86521 - wrong overload resolution with ref-qualifiers.
3350 * call.c (build_user_type_conversion_1): Don't use a conversion to a
3351 reference of the wrong rvalueness for direct binding.
3353 2019-03-11 Martin Liska <mliska@suse.cz>
3355 * cvt.c (build_expr_type_conversion): Wrap apostrophes
3356 in gcc internal format with %'.
3357 * decl.c (check_no_redeclaration_friend_default_args): Likewise.
3358 (grokfndecl): Likewise.
3359 * name-lookup.c (do_pushtag): Likewise.
3360 * pt.c (unify_parameter_deduction_failure): Likewise.
3361 (unify_template_deduction_failure): Likewise.
3363 2019-03-11 Martin Liska <mliska@suse.cz>
3365 * call.c (convert_arg_to_ellipsis): Wrap an option name
3366 in a string format message and fix GNU coding style.
3367 (build_over_call): Likewise.
3368 * class.c (check_field_decl): Likewise.
3369 (layout_nonempty_base_or_field): Likewise.
3370 * constexpr.c (cxx_eval_loop_expr): Likewise.
3371 * cvt.c (type_promotes_to): Likewise.
3372 * decl.c (cxx_init_decl_processing): Likewise.
3373 (mark_inline_variable): Likewise.
3374 (grokdeclarator): Likewise.
3375 * decl2.c (record_mangling): Likewise.
3376 * error.c (maybe_warn_cpp0x): Likewise.
3377 * except.c (doing_eh): Likewise.
3378 * mangle.c (maybe_check_abi_tags): Likewise.
3379 * parser.c (cp_parser_diagnose_invalid_type_name): Likewise.
3380 (cp_parser_userdef_numeric_literal): Likewise.
3381 (cp_parser_primary_expression): Likewise.
3382 (cp_parser_unqualified_id): Likewise.
3383 (cp_parser_pseudo_destructor_name): Likewise.
3384 (cp_parser_builtin_offsetof): Likewise.
3385 (cp_parser_lambda_expression): Likewise.
3386 (cp_parser_lambda_introducer): Likewise.
3387 (cp_parser_lambda_declarator_opt): Likewise.
3388 (cp_parser_selection_statement): Likewise.
3389 (cp_parser_init_statement): Likewise.
3390 (cp_parser_decomposition_declaration): Likewise.
3391 (cp_parser_function_specifier_opt): Likewise.
3392 (cp_parser_static_assert): Likewise.
3393 (cp_parser_simple_type_specifier): Likewise.
3394 (cp_parser_namespace_definition): Likewise.
3395 (cp_parser_using_declaration): Likewise.
3396 (cp_parser_ctor_initializer_opt_and_function_body): Likewise.
3397 (cp_parser_initializer_list): Likewise.
3398 (cp_parser_type_parameter_key): Likewise.
3399 (cp_parser_member_declaration): Likewise.
3400 (cp_parser_try_block): Likewise.
3401 (cp_parser_std_attribute_spec): Likewise.
3402 (cp_parser_requires_clause_opt): Likewise.
3403 * pt.c (check_template_variable): Likewise.
3404 (check_default_tmpl_args): Likewise.
3405 (push_tinst_level_loc): Likewise.
3406 (instantiate_pending_templates): Likewise.
3407 (invalid_nontype_parm_type_p): Likewise.
3408 * repo.c (get_base_filename): Likewise.
3409 * rtti.c (typeid_ok_p): Likewise.
3410 (build_dynamic_cast_1): Likewise.
3411 * tree.c (maybe_warn_parm_abi): Likewise.
3413 2019-03-08 Jakub Jelinek <jakub@redhat.com>
3416 * parser.c (cp_parser_template_declaration_after_parameters): Avoid
3417 one space before " at the end of line and another after " on another
3418 line in a string literal.
3420 PR tree-optimization/89550
3421 * semantics.c (maybe_convert_cond): Only set TREE_NO_WARNING if
3422 warning_at returned true.
3423 * decl2.c (c_parse_final_cleanups): Likewise.
3424 * typeck.c (convert_for_assignment): Likewise.
3425 * decl.c (finish_function): Likewise.
3428 * parser.c (cp_parser_asm_definition): Just warn instead of error
3429 on volatile qualifier outside of function body.
3432 * constexpr.c (potential_constant_expression_1): Reject
3433 REINTERPRET_CAST_P NOP_EXPRs.
3436 * call.c (joust): Call print_z_candidate only if pedwarn returned
3439 2019-03-07 Jason Merrill <jason@redhat.com>
3441 PR c++/88123 - lambda and using-directive.
3442 * name-lookup.c (op_unqualified_lookup)
3443 (maybe_save_operator_binding, discard_operator_bindings)
3444 (push_operator_bindings): New.
3445 * typeck.c (build_x_binary_op, build_x_unary_op): Call
3446 maybe_save_operator_binding.
3447 * decl.c (start_preparsed_function): Call push_operator_bindings.
3448 * tree.c (cp_free_lang_data): Call discard_operator_bindings.
3450 PR c++/88820 - ICE with CTAD and member template used in DMI.
3451 * pt.c (do_class_deduction): Handle parm used as its own arg.
3453 2019-03-07 Jakub Jelinek <jakub@redhat.com>
3456 * parser.c (cp_parser_asm_definition): Parse asm qualifiers even
3457 at toplevel, but diagnose them.
3459 2019-03-06 Jason Merrill <jason@redhat.com>
3461 PR c++/89381 - implicit copy and using-declaration.
3462 * class.c (classtype_has_move_assign_or_move_ctor_p): Don't consider
3463 op= brought in by a using-declaration.
3465 2019-03-06 Jakub Jelinek <jakub@redhat.com>
3468 * init.c (build_value_init_noctor): Ignore flexible array members.
3470 2019-03-06 Jason Merrill <jason@redhat.com>
3472 PR c++/89576 - if constexpr of lambda capture.
3473 * semantics.c (maybe_convert_cond): Do convert a non-dependent
3474 condition in a template.
3475 * typeck.c (condition_conversion): Handle being called in a
3478 2019-03-06 Marek Polacek <polacek@redhat.com>
3480 PR c++/87378 - bogus -Wredundant-move warning.
3481 * typeck.c (maybe_warn_pessimizing_move): See if the maybe-rvalue
3482 overload resolution would actually succeed.
3484 2019-03-05 Jason Merrill <jason@redhat.com>
3486 * class.c (is_really_empty_class): Add ignore_vptr parm.
3487 (trivial_default_constructor_is_constexpr): Pass it.
3488 * call.c (build_over_call): Pass it.
3489 * constexpr.c (cxx_eval_constant_expression): Pass it instead of
3490 checking TYPE_POLYMORPHIC_P.
3491 (cxx_eval_component_reference, potential_constant_expression_1):
3493 * cp-gimplify.c (simple_empty_class_p): Pass it.
3494 * init.c (expand_aggr_init_1): Pass it.
3496 2019-03-04 Paolo Carlini <paolo.carlini@oracle.com>
3499 * parser.c (cp_parser_class_head): Reject TYPE_BEING_DEFINED too.
3501 2019-03-04 Jakub Jelinek <jakub@redhat.com>
3504 * call.c (field_in_pset): New function.
3505 (build_aggr_conv): Handle CONSTRUCTOR_IS_DESIGNATED_INIT correctly.
3507 2019-03-02 Jakub Jelinek <jakub@redhat.com>
3510 * cp-tree.h (CONSTRUCTOR_IS_DESIGNATED_INIT): Define.
3511 * parser.c (cp_parser_braced_list): Adjust cp_parser_initializer_list
3512 caller, set CONSTRUCTOR_IS_DESIGNATED_INIT.
3513 (cp_parser_initializer_list): Add designated parameter, set *designated
3514 to a bool whether any designators were parsed.
3515 * decl.c (reshape_init): Copy over CONSTRUCTOR_IS_DESIGNATED_INIT if
3517 * pt.c (tsubst_copy_and_build): Likewise.
3518 * call.c (implicit_conversion): If CONSTRUCTOR_IS_DESIGNATED_INIT,
3519 don't call build_list_conv, nor build_complex_conv, nor attempt to
3520 convert a single element initializer to scalar.
3522 2019-03-01 Marek Polacek <polacek@redhat.com>
3524 PR c++/89537 - missing location for error with non-static member fn.
3525 * call.c (resolve_args): Use EXPR_LOCATION.
3526 * typeck.c (build_class_member_access_expr): Use input_location.
3528 PR c++/89532 - ICE with incomplete type in decltype.
3529 * semantics.c (finish_compound_literal): Return error_mark_node
3530 if digest_init_flags returns error_mark_node.
3532 2019-03-01 Jakub Jelinek <jakub@redhat.com>
3534 Implement P1002R1, Try-catch blocks in constexpr functions
3536 * parser.c (cp_parser_ctor_initializer_opt_and_function_body):
3537 Diagnose constexpr ctor or function with function-try-block with
3538 pedwarn for c++17 and earlier. Formatting fix.
3539 (cp_parser_try_block): Use pedwarn instead of error and only for
3540 c++17 and earlier when try block appears in constexpr function.
3541 * constexpr.c (build_constexpr_constructor_member_initializers):
3542 Handle TRY_BLOCK here instead of erroring on it.
3544 2019-02-28 Jason Merrill <jason@redhat.com>
3546 PR c++/88183 - ICE with .* fold-expression.
3547 * pt.c (fold_expression) [DOTSTAR_EXPR]: Remove special handling.
3549 PR c++/86969 - ICE with constexpr if and recursive generic lambdas.
3550 * class.c, lambda.c, pt.c: Revert earlier change.
3551 * lambda.c (add_capture): Don't special-case capture of dependent
3554 * name-lookup.c (print_binding_level): Print this_entity.
3556 2019-02-27 Marek Polacek <polacek@redhat.com>
3558 PR c++/88857 - ICE with value-initialization of argument in template.
3559 * call.c (convert_like_real): Don't call build_value_init in template.
3561 2019-02-27 Jason Merrill <jason@redhat.com>
3563 PR c++/86969 - ICE with constexpr if and recursive generic lambdas.
3564 * semantics.c (process_outer_var_ref): Do capture dependent vars.
3565 * class.c (finish_struct): Only add TAG_DEFN if T is in
3566 current_function_decl.
3567 * lambda.c (vla_capture_type): Force the capture type out into the
3568 lambda's enclosing function.
3569 (add_capture): Pass in the lambda.
3570 * pt.c (tsubst_lambda_expr): complete_type a VLA capture type.
3572 2019-02-27 Marek Polacek <polacek@redhat.com>
3574 PR c++/89511 - ICE with using-declaration and unscoped enumerator.
3575 * parser.c (cp_parser_using_declaration): For an unscoped enum
3576 only use its context if it's not a function declaration.
3578 2019-02-27 Paolo Carlini <paolo.carlini@oracle.com>
3581 * method.c (process_subob_fn): When maybe_instantiate_noexcept
3582 returns false don't call merge_exception_specifiers.
3584 2019-02-27 Paolo Carlini <paolo.carlini@oracle.com>
3587 * parser.c (cp_parser_noexcept_specification_opt): Return NULL_TREE
3588 for a non-constant parsed expression.
3590 2019-02-26 Jakub Jelinek <jakub@redhat.com>
3593 * constexpr.c (cxx_eval_store_expression): When changing active union
3594 member, set no_zero_init.
3596 2019-02-23 Marek Polacek <polacek@redhat.com>
3598 PR c++/88294 - ICE with non-constant noexcept-specifier.
3599 * pt.c (maybe_instantiate_noexcept): Set up the list of local
3600 specializations. Set current_class_{ptr,ref}.
3602 2019-02-22 David Malcolm <dmalcolm@redhat.com>
3605 * parser.c (cp_parser_unqualified_id): Capture and use locations
3608 2019-02-22 Marek Polacek <polacek@redhat.com>
3610 PR c++/89420 - ICE with CAST_EXPR in explicit-specifier.
3611 * decl.c (build_explicit_specifier): Don't check
3612 processing_template_decl. Call instantiation_dependent_expression_p
3613 instead of value_dependent_expression_p. Call
3614 instantiate_non_dependent_expr_sfinae before
3615 build_converted_constant_expr instead of calling
3616 instantiate_non_dependent_expr after it. Add
3617 processing_template_decl_sentinel.
3619 2019-02-22 Thomas Schwinge <thomas@codesourcery.com>
3621 * parser.c (cp_parser_oacc_simple_clause): Remove parser formal
3622 parameter, move loc formal parameter to the front. Adjust all
3624 (cp_parser_oacc_shape_clause): Add loc formal parameter. Adjust
3627 2019-02-21 Jason Merrill <jason@redhat.com>
3629 PR c++/87685 - generic lambda 'this' capture error.
3630 * lambda.c (lambda_expr_this_capture): Change add_capture_p to int.
3631 (maybe_generic_this_capture): Pass -1.
3633 PR c++/88394 - ICE with VLA init-capture.
3634 * lambda.c (is_normal_capture_proxy): Check DECL_CAPTURED_VARIABLE.
3636 PR c++/88869 - C++17 ICE with CTAD and explicit specialization.
3637 * pt.c (do_class_deduction): Don't include explicit specialization
3640 PR c++/89422 - ICE with -g and lambda in default arg in template.
3641 * pt.c (tsubst_function_decl): SET_DECL_FRIEND_CONTEXT sooner.
3643 2019-02-21 Jason Merrill <jason@redhat.com>
3645 PR c++/88419 - C++17 ICE with class template arg deduction.
3646 * pt.c (make_template_placeholder): Set TYPE_CANONICAL after
3647 CLASS_PLACEHOLDER_TEMPLATE.
3649 2019-02-21 Jakub Jelinek <jakub@redhat.com>
3652 * constexpr.c (struct constexpr_fundef): Add parms and result members.
3653 (retrieve_constexpr_fundef): Adjust for the above change.
3654 (register_constexpr_fundef): Save constexpr body with copy_fn,
3655 temporarily set DECL_CONTEXT on DECL_RESULT before that.
3656 (get_fundef_copy): Change FUN argument to FUNDEF with
3657 constexpr_fundef * type, grab body and parms/result out of
3658 constexpr_fundef struct and temporarily change it for copy_fn calls
3660 (cxx_eval_builtin_function_call): For __builtin_FUNCTION temporarily
3661 adjust current_function_decl from ctx->call context. Test
3662 !potential_constant_expression instead of !is_constant_expression.
3663 (cxx_bind_parameters_in_call): Grab parameters from new_call. Undo
3664 convert_for_arg_passing changes for TREE_ADDRESSABLE type passing.
3665 (cxx_eval_call_expression): Adjust get_fundef_copy caller.
3666 (cxx_eval_conditional_expression): For IF_STMT, allow then or else
3667 operands to be NULL.
3668 (label_matches): Handle BREAK_STMT and CONTINUE_STMT.
3669 (cxx_eval_loop_expr): Add support for FOR_STMT, WHILE_STMT and DO_STMT.
3670 (cxx_eval_switch_expr): Add support for SWITCH_STMT.
3671 (cxx_eval_constant_expression): Handle IF_STMT, FOR_STMT, WHILE_STMT,
3672 DO_STMT, CONTINUE_STMT, SWITCH_STMT, BREAK_STMT and CONTINUE_STMT.
3673 For SIZEOF_EXPR, recurse on the result of fold_sizeof_expr. Ignore
3674 DECL_EXPR with USING_DECL operand.
3675 * lambda.c (maybe_add_lambda_conv_op): Build thisarg using
3676 build_int_cst to make it a valid constant expression.
3678 2019-02-20 Jason Merrill <jason@redhat.com>
3680 PR c++/88690 - C++17 ICE with empty base in aggregate.
3681 * typeck2.c (process_init_constructor_record): Skip trivial
3682 initialization of an empty base.
3684 2019-02-21 Richard Biener <rguenther@suse.de>
3687 * vtable-class-hierarchy.c (vtv_generate_init_routine): Do not
3688 make symtab process new functions here.
3690 2019-02-20 Jason Merrill <jason@redhat.com>
3692 PR c++/87921 - wrong error with inline static data member.
3693 * decl2.c (finish_static_data_member_decl): Don't set DECL_IN_AGGR_P
3694 for a non-template inline variable. Do nothing for an
3695 already-instantiated variable.
3696 (c_parse_final_cleanups): Check DECL_IN_AGGR_P without
3698 * decl.c (check_initializer): Likewise.
3699 (make_rtl_for_nonlocal_decl): Likewise.
3700 * pt.c (instantiate_decl): Likewise.
3701 * typeck2.c (store_init_value): Likewise.
3703 2019-02-20 Jakub Jelinek <jakub@redhat.com>
3706 * decl2.c (c_parse_final_cleanups): Move TREE_ASM_WRITTEN setting
3707 for flag_syntax_only from here...
3708 * semantics.c (expand_or_defer_fn_1): ... here.
3711 * decl.c (maybe_commonize_var): When clearing TREE_PUBLIC and
3712 DECL_COMMON, set DECL_INTERFACE_KNOWN.
3715 * constexpr.c (cxx_eval_store_expression): Diagnose changing of active
3716 union member for -std=c++17 and earlier.
3718 2019-02-19 Jason Merrill <jason@redhat.com>
3720 PR c++/87513 - 'sorry' mangling PMF template-id.
3721 * mangle.c (write_expression): Handle SCOPE_REF to BASELINK.
3723 2019-02-19 Jason Merrill <jason@redhat.com>
3725 PR c++/88380 - wrong-code with flexible array and NSDMI.
3726 * typeck2.c (process_init_constructor_record): Skip flexarrays.
3728 2019-02-20 will wray <wjwray@gmail.com>
3730 PR c++/88572 - wrong handling of braces on scalar init.
3731 * decl.c (reshape_init_r): Allow braces around scalar initializer
3732 within aggregate init. Reject double braced-init of scalar
3735 2019-02-20 Paolo Carlini <paolo.carlini@oracle.com>
3738 * pt.c (tsubst_init): Diagnose an initializer expanding to an
3739 empty list of expressions; tweak wrt dependent types.
3740 (regenerate_decl_from_template): For VAR_DECLs call tsubst_init
3741 instead of tsubst_expr.
3743 2019-02-19 Jason Merrill <jason@redhat.com>
3745 PR c++/88368 - wrong 'use of deleted function'
3746 * method.c (walk_field_subobs): Remember errors from get_nsdmi.
3747 (get_defaulted_eh_spec): Call push_tinst_level.
3748 * pt.c (maybe_instantiate_noexcept): Keep error_mark_node.
3749 * typeck2.c (merge_exception_specifiers): Handle error_mark_node.
3751 2019-02-19 Chung-Lin Tang <cltang@codesourcery.com>
3754 * parser.c (cp_parser_oacc_clause_wait): Add representation of wait
3755 clause without argument as 'wait (GOMP_ASYNC_NOVAL)', adjust comments.
3757 2019-02-19 Jakub Jelinek <jakub@redhat.com>
3760 * lambda.c (maybe_generic_this_capture): Don't check
3761 DECL_NONSTATIC_MEMBER_FUNCTION_P on USING_DECLs.
3764 * typeck.c (build_reinterpret_cast_1): Don't handle void to
3765 && conversion go through build_target_expr_with_type.
3768 * error.c (qualified_name_lookup_error): Only call
3769 suggest_alternative_in_scoped_enum if name is IDENTIFIER_NODE.
3771 2019-02-19 Tom Honermann <tom@honermann.net>
3773 * name-lookup.c (get_std_name_hint): Added u8string as a name hint.
3775 2019-02-18 Jason Merrill <jason@redhat.com>
3777 PR c++/89336 - multiple stores in constexpr stmt.
3778 * constexpr.c (cxx_eval_store_expression): Preevaluate scalar or
3781 * pt.c (check_explicit_specialization): If the declarator is a
3782 template-id, only check whether the arguments are dependent.
3784 Improve duplicate [[likely]] diagnostic.
3785 * parser.c (cp_parser_statement): Make attrs_loc a range. Pass it
3786 to process_stmt_hotness_attribute.
3787 * cp-gimplify.c (process_stmt_hotness_attribute): Take attrs_loc.
3788 (genericize_if_stmt): Use likely/unlikely instead of predictor_name.
3790 2019-02-17 Marek Polacek <polacek@redhat.com>
3792 PR c++/89217 - ICE with list-initialization in range-based for loop.
3793 * constexpr.c (unshare_constructor): No longer static.
3794 * cp-tree.h (unshare_constructor): Declare.
3795 * semantics.c (finish_compound_literal): When dealing with a
3796 non-dependent expression in a template, return the original
3797 expression. Pass LOOKUP_NO_NARROWING to digest_init_flags.
3799 2019-02-13 Marek Polacek <polacek@redhat.com>
3801 PR c++/89297 - ICE with OVERLOAD in template.
3802 * semantics.c (finish_compound_literal): Call
3803 instantiate_non_dependent_expr_sfinae.
3805 2019-02-13 Alexandre Oliva <aoliva@redhat.com>
3808 * cp-tree.h (USING_DECL_SCOPE): Use result rather than type.
3809 * name-lookup.c (strip_using_decl): Use USING_DECL_SCOPE.
3810 * search.c (protected_accessible_p): Follow USING_DECL_DECLS.
3811 (shared_member_p): Likewise.
3812 (lookup_member): Likewise.
3813 * decl.c (grok_special_member_properties): Skip USING_DECLs.
3814 * semantics.c (finish_omp_declare_simd_methods): Likewise.
3815 (finish_qualified_id_expr): Do not call shared_member_p with
3819 * pt.c (tsubst_lambda_expr): Avoid duplicate tsubsting.
3820 Move cp_evaluated resetting before signature tsubsting.
3821 (gen_elem_of_pack_expansion_instantiation): Separate local
3822 specializations per index.
3824 2019-02-13 David Malcolm <dmalcolm@redhat.com>
3827 * class.c (add_method): Drop destructor assertion.
3829 2019-02-13 Paolo Carlini <paolo.carlini@oracle.com>
3832 * decl.c (make_typename_type): Allow for TYPE_PACK_EXPANSION as
3833 context (the first argument).
3834 * pt.c (tsubst, case TYPENAME_TYPE): Handle TYPE_PACK_EXPANSION
3837 2019-02-12 Jason Merrill <jason@redhat.com>
3839 PR c++/89144 - link error with constexpr initializer_list.
3840 * call.c (convert_like_real) [ck_list]: Don't allocate a temporary
3841 array for an empty list.
3842 * typeck2.c (store_init_value): Don't use cxx_constant_init in a
3845 2019-02-11 Jason Merrill <jason@redhat.com>
3847 PR c++/89241 - ICE with __func__ in lambda in template.
3848 * pt.c (enclosing_instantiation_of): Also check
3849 instantiated_lambda_fn_p for the template context.
3851 2019-02-11 Marek Polacek <polacek@redhat.com>
3853 PR c++/89212 - ICE converting nullptr to pointer-to-member-function.
3854 * pt.c (tsubst_copy_and_build) <case CONSTRUCTOR>: Return early for
3855 null member pointer value.
3857 2019-02-11 Jakub Jelinek <jakub@redhat.com>
3860 * pt.c (convert_nontype_argument): Pass true as manifestly_const_eval
3861 to maybe_constant_value calls.
3863 2019-02-11 Marek Polacek <polacek@redhat.com>
3865 * typeck2.c (digest_init_r): Remove commented code.
3867 2019-02-11 Martin Sebor <msebor@redhat.com>
3870 * decl.c (compute_array_index_type_loc): Preserve signed sizes
3871 for diagnostics. Call valid_array_size_p instead of error.
3872 * init.c (build_new_1): Compute size for diagnostic. Call
3873 invalid_array_size_error
3874 (build_new): Call valid_array_size_p instead of error.
3876 2019-02-07 Alexandre Oliva <aoliva@redhat.com>
3879 * call.c (compare_ics): Deal with ck_aggr in either cs.
3881 2019-02-06 David Malcolm <dmalcolm@redhat.com>
3884 * call.c (get_location_for_expr_unwinding_for_system_header): New
3886 (conversion_null_warnings): Use it when getting locations for
3887 EXPR, effectively adding a call to
3888 get_location_for_expr_unwinding_for_system_header for
3889 -Wconversion-null and making use of EXPR_LOCATION for
3890 -Wzero-as-null-pointer-constant.
3892 2019-02-05 Jakub Jelinek <jakub@redhat.com>
3895 * optimize.c (maybe_thunk_body): Clear TREE_ADDRESSABLE on
3896 PARM_DECLs of the thunk.
3897 * lambda.c (maybe_add_lambda_conv_op): Likewise.
3899 2019-02-05 Marek Polacek <polacek@redhat.com>
3901 PR c++/89158 - by-value capture of constexpr variable broken.
3902 * call.c (convert_like_real) <case ck_user>: Call mark_exp_read
3903 instead of mark_rvalue_use.
3905 2019-02-05 Alexandre Oliva <aoliva@redhat.com>
3908 * pt.c (instantiates_primary_template_p): New.
3909 (type_dependent_expression_p): Use it.
3911 2019-02-01 Jason Merrill <jason@redhat.com>
3913 PR c++/88761 - ICE with reference capture of constant.
3914 * lambda.c (mark_const_cap_r): Do walk subtrees of DECL_EXPR for
3917 2019-02-01 Marek Polacek <polacek@redhat.com>
3919 PR c++/88325 - ICE with invalid out-of-line template member definition.
3920 * parser.c (cp_parser_class_name): Don't call make_typename_type
3923 2019-02-01 Jakub Jelinek <jakub@redhat.com>
3926 * parser.c (cp_parser_gnu_attributes_opt): Set ok to false
3927 if require_open failed.
3929 2019-01-31 Marek Polacek <polacek@redhat.com>
3931 PR c++/89083, c++/80864 - ICE with list initialization in template.
3932 * constexpr.c (adjust_temp_type): Use copy_node and change the type
3933 instead of using build_constructor.
3934 * decl.c (reshape_init_r): Don't reshape a digested initializer.
3935 Return the initializer for COMPOUND_LITERAL_P.
3937 PR c++/88983 - ICE with switch in constexpr function.
3938 * constexpr.c (cxx_eval_switch_expr): Use SWITCH_COND and SWITCH_BODY.
3939 (cxx_eval_constant_expression) <case COND_EXPR>: Don't look for the
3940 label in the else branch if we found it in the then branch.
3942 2019-01-30 Jason Merrill <jason@redhat.com>
3944 PR c++/88752 - ICE with lambda and constexpr if.
3945 * cp-tree.h (LAMBDA_EXPR_INSTANTIATED): New.
3946 * pt.c (tsubst_lambda_expr): Set it.
3947 (instantiated_lambda_fn_p): Check it.
3948 (enclosing_instantiation_of): Use it.
3950 2019-01-31 Jakub Jelinek <jakub@redhat.com>
3953 * cxx-pretty-print.c (pp_cxx_enumeration_constant): Print always as
3954 a C cast in pp_c_flag_gnu_v3 mode.
3956 2019-01-30 Jakub Jelinek <jakub@redhat.com>
3959 * lambda.c (is_capture_proxy): Don't return true for
3960 DECL_OMP_PRIVATIZED_MEMBER artificial vars.
3962 2019-01-30 Marek Polacek <polacek@redhat.com>
3964 PR c++/89119 - ICE with value-initialization in template.
3965 * pt.c (tsubst_copy_and_build): Handle RANGE_EXPR.
3967 2019-01-29 Jason Merrill <jason@redhat.com>
3969 PR c++/86943 - wrong code converting lambda to function pointer.
3970 * lambda.c (maybe_add_lambda_conv_op): Use a template-id in the
3971 call. Only forward parms for decltype.
3972 * pt.c (tsubst_copy_and_build) [CALL_EXPR]: Handle CALL_FROM_THUNK_P
3974 * typeck.c (check_return_expr): Don't mess with a thunk call.
3976 2019-01-28 Jason Merrill <jason@redhat.com>
3978 PR c++/89089 - ICE with [[no_unique_address]].
3979 PR c++/88865 - wrong layout with [[no_unique_address]].
3980 * class.c (check_field_decls): A potentially-overlapping field makes
3981 the class non-layout-POD, but not non-empty.
3982 (end_of_class): Always consider empty data members.
3983 (layout_class_type): Set DECL_SIZE for empty fields.
3985 2019-01-28 Marek Polacek <polacek@redhat.com>
3987 PR c++/88358 - name wrongly treated as type.
3988 * parser.c (cp_parser_direct_declarator): Don't assume a qualified-id
3989 in parameter-list is a type if the function's declarator-id is not
3992 2019-01-27 Marek Polacek <polacek@redhat.com>
3994 PR c++/88815 - narrowing conversion lost in decltype.
3995 PR c++/78244 - narrowing conversion in template not detected.
3996 * cp-tree.h (CONSTRUCTOR_IS_DEPENDENT): New.
3997 * pt.c (instantiation_dependent_r): Consider a CONSTRUCTOR with
3998 CONSTRUCTOR_IS_DEPENDENT instantiation-dependent.
3999 * semantics.c (finish_compound_literal): When the compound literal
4000 isn't instantiation-dependent and the type isn't type-dependent,
4001 fall back to the normal processing. Set CONSTRUCTOR_IS_DEPENDENT.
4003 PR c++/89024 - ICE with incomplete enum type.
4004 * call.c (standard_conversion): When converting an
4005 ARITHMETIC_TYPE_P to an incomplete type, return NULL.
4007 2019-01-25 Paolo Carlini <paolo.carlini@oracle.com>
4010 * call.c (build_op_delete_call): Implement 7.6.2.5/(10.1).
4011 * decl2.c (coerce_delete_type): Use build_pointer_type instead
4014 2019-01-24 Jason Merrill <jason@redhat.com>
4016 PR c++/89001 - mangling of reference temporaries
4017 * cp-tree.h (struct saved_scope): Add ref_temp_count.
4018 (current_ref_temp_count): New macro.
4019 * mangle.c (mangle_ref_init_variable): Use it.
4020 * typeck2.c (store_init_value): Clear it.
4021 * call.c (make_temporary_var_for_ref_to_temp): Copy public and
4024 2019-01-24 Jakub Jelinek <jakub@redhat.com>
4027 * semantics.c (finish_omp_cancel): Diagnose more than one if
4028 on #pragma omp cancel with different modifiers. Use
4029 maybe_convert_cond when not in template or build_x_binary_op
4032 2019-01-23 Marek Polacek <polacek@redhat.com>
4034 PR c++/88757 - qualified name treated wrongly as type.
4035 * parser.c (cp_parser_direct_declarator): Don't treat qualified-ids
4036 in parameter-list as types if name lookup for declarator-id didn't
4037 find one or more function templates.
4039 2019-01-23 Jakub Jelinek <jakub@redhat.com>
4042 * cp-gimplify.c (genericize_cp_loop): Call begin_bc_block only
4043 after genericizing cond and incr expressions.
4046 * cp-gimplify.c (genericize_switch_stmt): Move cond genericization
4047 before the begin_bc_block call.
4049 2019-01-21 Jason Merrill <jason@redhat.com>
4051 PR c++/87893 - constexpr ctor ICE on ARM.
4052 PR c++/88293 - ICE with comma expression.
4053 * constexpr.c (initialized_type): Don't shortcut non-void type.
4054 Handle COMPOUND_EXPR.
4055 (cxx_eval_outermost_constant_expr): Return early for void type.
4057 2019-01-21 Jakub Jelinek <jakub@redhat.com>
4060 * optimize.c (cxx_copy_decl): New function.
4061 (clone_body): Use it instead of copy_decl_no_change.
4064 * typeck.c (cp_build_binary_op): Don't instrument
4065 SANITIZE_POINTER_COMPARE if processing_template_decl.
4066 (pointer_diff): Similarly for SANITIZE_POINTER_SUBTRACT.
4068 2019-01-18 Jason Merrill <jason@redhat.com>
4070 PR c++/88875 - error with explicit list constructor.
4071 * call.c (reference_binding): Don't modify EXPR. Set
4072 need_temporary_p on the ck_user conversion for a temporary.
4073 (convert_like_real): Check it.
4075 2019-01-18 H.J. Lu <hongjiu.lu@intel.com>
4079 * call.c (convert_for_arg_passing): Upate the
4080 warn_for_address_or_pointer_of_packed_member call.
4081 * typeck.c (convert_for_assignment): Likewise.
4083 2019-01-17 Jason Merrill <jason@redhat.com>
4085 PR c++/86205 - ICE with ?: of throw and template-id.
4086 * pt.c (resolve_nondeduced_context_or_error): Split out from...
4087 * typeck.c (decay_conversion): ...here.
4088 * call.c (build_conditional_expr_1): Use it.
4090 PR c++/86740, ICE with constexpr if and nested generic lambdas.
4091 * tree.c (cp_walk_subtrees): Handle LAMBDA_EXPR.
4093 2019-01-17 Paolo Carlini <paolo.carlini@oracle.com>
4095 * decl.c (grokdeclarator): Use typespec_loc in error messages
4096 about 'auto' and trailing return type.
4098 2019-01-17 David Malcolm <dmalcolm@redhat.com>
4101 * class.c (add_method): Don't use DECL_DESTRUCTOR_P on
4104 2019-01-17 Nathan Sidwell <nathan@acm.org>
4107 * semantics.c (process_outer_var_ref): Only skip dependent types
4110 2019-01-17 Alexandre Oliva <aoliva@redhat.com>
4113 * cp-tree.h (saved_scope): Add suppress_location_wrappers.
4114 * name-lookup.c (do_push_to_top_level): Save and reset it.
4115 (do_pop_from_top_level): Restore it.
4118 * pt.c (make_template_placeholder): Use auto_identifier.
4119 (is_auto): Drop CLASS_PLACEHOLDER_TEMPLATE test.
4120 * error.c (dump_type): Handle template placeholders.
4121 * cxx-pretty-print.c (pp_cx_unqualified_id): Likewise.
4124 * cvt.c (convert_to_void): Handle all cdtor calls as if
4127 2019-01-16 Paolo Carlini <paolo.carlini@oracle.com>
4129 * decl.c (grokdeclarator): Use locations[ds_storage_class] in
4130 error messages about ill-formed uses of mutable.
4132 2019-01-16 Marek Polacek <polacek@redhat.com>
4134 PR c++/78244 - narrowing conversion in template not detected.
4135 * call.c (perform_implicit_conversion_flags): Set
4136 IMPLICIT_CONV_EXPR_BRACED_INIT.
4137 * cp-tree.h (IMPLICIT_CONV_EXPR_BRACED_INIT): New.
4138 * pt.c (tsubst_copy_and_build): Use it.
4140 2019-01-15 David Malcolm <dmalcolm@redhat.com>
4143 * pt.c (build_deduction_guide): Bail out if tsubst_arg_types
4146 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com>
4148 * decl.c (start_decl): Improve error location.
4149 * decl2.c (grokfield): Likewise.
4151 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com>
4153 * decl.c (grokdeclarator): Move further up the location_t loc
4154 declaration and use the location when building a TYPE_DECL for
4156 * decl2.c (grokbitfield): Use DECL_SOURCE_LOCATION in the error
4157 about an ill-formed bit-field as typedef.
4159 2019-01-14 Marek Polacek <polacek@redhat.com>
4161 PR c++/88830 - ICE with abstract class.
4162 * decl2.c (maybe_emit_vtables): Check CLASSTYPE_LAZY_DESTRUCTOR.
4165 PR c++/88825 - ICE with bogus function return type deduction.
4166 * typeck.c (can_do_nrvo_p): Check error_mark_node.
4168 2019-01-14 Tom Honermann <tom@honermann.net>
4170 Implement P0482R5, char8_t: A type for UTF-8 characters and strings
4171 * cvt.c (type_promotes_to): Handle char8_t promotion.
4172 * decl.c (grokdeclarator): Handle invalid type specifier
4173 combinations involving char8_t.
4174 * lex.c (init_reswords): Add char8_t as a reserved word.
4175 * mangle.c (write_builtin_type): Add name mangling for char8_t (Du).
4176 * parser.c (cp_keyword_starts_decl_specifier_p)
4177 (cp_parser_simple_type_specifier): Recognize char8_t as a simple
4179 (cp_parser_string_literal): Use char8_array_type_node for the type
4181 (cp_parser_set_decl_spec_type): Tolerate char8_t typedefs in system
4183 * rtti.c (emit_support_tinfos): type_info support for char8_t.
4184 * tree.c (char_type_p): Recognize char8_t as a character type.
4185 * typeck.c (string_conv_p): Handle conversions of u8 string
4186 literals of char8_t type.
4187 (check_literal_operator_args): Handle UDLs with u8 string literals
4189 * typeck2.c (ordinary_char_type_p): New.
4190 (digest_init_r): Disallow initializing a char array with a u8 string
4193 2019-01-14 Martin Liska <mliska@suse.cz>
4195 PR gcov-profile/88263
4196 * decl2.c (get_tls_wrapper_fn): Use DECL_SOURCE_LOCATION
4197 as location of the TLS wrapper.
4199 2019-01-12 Paolo Carlini <paolo.carlini@oracle.com>
4201 * decl.c (cp_finish_decl): Improve error location.
4202 * decl2.c (grokfield): Likewise, improve two locations.
4204 2019-01-11 Marek Polacek <polacek@redhat.com>
4206 PR c++/88692, c++/87882 - -Wredundant-move false positive with *this.
4207 * typeck.c (maybe_warn_pessimizing_move): Return if ARG isn't
4210 2019-01-11 Jason Merrill <jason@redhat.com>
4212 PR c++/88312 - pack expansion of decltype.
4213 * pt.c (instantiation_dependent_r): A template non-type parameter
4214 pack is instantiation-dependent.
4216 2019-01-11 Jason Merrill <jason@redhat.com>
4218 PR c++/88613 - ICE with use of const var in lambda.
4219 * expr.c (mark_use): Fix location wrapper handling.
4220 * cp-gimplify.c (cp_fold_maybe_rvalue): Call mark_rvalue_use.
4222 2019-01-11 Tobias Burnus <burnus@net-b.de>
4225 * decl2.c (maybe_emit_vtables): If needed, generate code for
4226 the destructor of an abstract class.
4227 (mark_used): Update comment for older function-name change.
4229 2019-01-11 Paolo Carlini <paolo.carlini@oracle.com>
4231 * decl.c (start_decl): Improve error location.
4232 (grokdeclarator): Likewise, improve two locations.
4234 2019-01-09 Sandra Loosemore <sandra@codesourcery.com>
4238 * cp-tree.h: Mechanically replace "can not" with "cannot".
4239 * parser.c: Likewise.
4242 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com>
4244 * decl.c (grok_reference_init): Improve error location.
4245 (grokdeclarator): Likewise, improve two locations.
4247 2019-01-08 Marek Polacek <polacek@redhat.com>
4249 PR c++/88538 - braced-init-list in template-argument-list.
4250 * parser.c (cp_parser_template_argument): Handle braced-init-list when
4253 PR c++/88548 - this accepted in static member functions.
4254 * parser.c (cp_debug_parser): Adjust printing of
4255 local_variables_forbidden_p.
4256 (cp_parser_new): Set local_variables_forbidden_p to 0 rather than false.
4257 (cp_parser_primary_expression): When checking
4258 local_variables_forbidden_p, use THIS_FORBIDDEN or
4259 LOCAL_VARS_FORBIDDEN.
4260 (cp_parser_lambda_body): Update the type of
4261 local_variables_forbidden_p. Set it to 0 rather than false.
4262 (cp_parser_condition): Adjust call to cp_parser_declarator.
4263 (cp_parser_explicit_instantiation): Likewise.
4264 (cp_parser_init_declarator): Likewise.
4265 (cp_parser_declarator): New parameter. Use it.
4266 (cp_parser_direct_declarator): New parameter. Use it to set
4267 local_variables_forbidden_p. Adjust call to cp_parser_declarator.
4268 (cp_parser_type_id_1): Adjust call to cp_parser_declarator.
4269 (cp_parser_parameter_declaration): Likewise.
4270 (cp_parser_default_argument): Update the type of
4271 local_variables_forbidden_p. Set it to LOCAL_VARS_AND_THIS_FORBIDDEN
4273 (cp_parser_member_declaration): Tell cp_parser_declarator if we saw
4274 'static' or 'friend'.
4275 (cp_parser_exception_declaration): Adjust call to cp_parser_declarator.
4276 (cp_parser_late_parsing_default_args): Update the type of
4277 local_variables_forbidden_p. Set it to LOCAL_VARS_AND_THIS_FORBIDDEN
4279 (cp_parser_cache_defarg): Adjust call to cp_parser_declarator.
4280 (cp_parser_objc_class_ivars): Likewise.
4281 (cp_parser_objc_struct_declaration): Likewise.
4282 (cp_parser_omp_for_loop_init): Likewise.
4283 * parser.h (cp_parser): Change the type of local_variables_forbidden_p
4285 (LOCAL_VARS_FORBIDDEN, LOCAL_VARS_AND_THIS_FORBIDDEN, THIS_FORBIDDEN):
4288 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com>
4290 * decl.c (start_decl): Improve permerror location.
4292 2019-01-08 Jonathan Wakely <jwakely@redhat.com>
4293 Jakub Jelinek <jakub@redhat.com>
4296 * decl.c (finish_function): For -Wreturn-type don't add a return *this;
4297 fixit hint if current_class_ref is NULL. Use a single if instead of
4300 2019-01-07 Paolo Carlini <paolo.carlini@oracle.com>
4302 * decl.c (start_decl): Improve two error_at locations.
4303 (expand_static_init): Likewise.
4305 2019-01-07 Marek Polacek <polacek@redhat.com>
4307 PR c++/88741 - wrong error with initializer-string.
4308 * decl.c (cp_complete_array_type): Strip any location wrappers.
4310 2019-01-07 Bernd Edlinger <bernd.edlinger@hotmail.de>
4316 * cp-tree.h (LOOKUP_ALLOW_FLEXARRAY_INIT): New flag value.
4317 * typeck2.c (digest_init_r): Raise an error for non-static
4318 initialization of a flexible array member.
4319 (process_init_constructor, massage_init_elt,
4320 process_init_constructor_array, process_init_constructor_record,
4321 process_init_constructor_union, process_init_constructor): Add the
4322 flags parameter and pass it thru.
4323 (store_init_value): Pass LOOKUP_ALLOW_FLEXARRAY_INIT parameter to
4324 digest_init_flags for static decls.
4326 2019-01-07 Jakub Jelinek <jakub@redhat.com>
4329 * cp-tree.h (cp_build_vec_convert): Declare.
4330 * parser.c (cp_parser_postfix_expression): Parse
4331 __builtin_convertvector.
4332 * constexpr.c: Include fold-const-call.h.
4333 (cxx_eval_internal_function): Handle IFN_VEC_CONVERT.
4334 (potential_constant_expression_1): Likewise.
4335 * semantics.c (cp_build_vec_convert): New function.
4336 * pt.c (tsubst_copy_and_build): Handle CALL_EXPR to
4339 2019-01-03 Jakub Jelinek <jakub@redhat.com>
4342 * decl.c (builtin_function_1): Return result of pushdecl_top_level
4343 or pushdecl rather than decl.
4345 2019-01-03 Paolo Carlini <paolo.carlini@oracle.com>
4347 * tree.c (handle_nodiscard_attribute): Improve warning location.
4349 2019-01-02 Marek Polacek <polacek@redhat.com>
4351 PR c++/88612 - ICE with -Waddress-of-packed-member.
4352 * call.c (convert_for_arg_passing): Only give warnings with tf_warning.
4353 * typeck.c (convert_for_assignment): Likewise.
4355 PR c++/88631 - CTAD failing for value-initialization.
4356 * typeck2.c (build_functional_cast): Try deducing the template
4357 arguments even if there are no arguments to deduce from.
4359 2019-01-01 Jakub Jelinek <jakub@redhat.com>
4361 Update copyright years.
4363 Copyright (C) 2019 Free Software Foundation, Inc.
4365 Copying and distribution of this file, with or without modification,
4366 are permitted in any medium without royalty provided the copyright
4367 notice and this notice are preserved.