1 2019-10-29 Richard Sandiford <richard.sandiford@arm.com>
3 * cp-tree.h (cxx_simulate_builtin_function_decl): Declare.
4 * decl.c (cxx_simulate_builtin_function_decl): New function.
5 * cp-objcp-common.h (LANG_HOOKS_SIMULATE_BUILTIN_FUNCTION_DECL): Define
8 2019-10-28 Martin Sebor <msebor@redhat.com>
11 * cp-objcp-common.c (names_builtin_p): Define new function.
13 2019-10-28 Nathan Sidwell <nathan@acm.org>
15 * parser.h (struct cp_token): Drop {ENUM,BOOL}_BITFIELD C-ism.
16 Add tree_check_p flag, use as nested union discriminator.
17 (struct cp_lexer): Add saved_type & saved_keyword fields.
18 * parser.c (eof_token): Delete.
19 (cp_lexer_new_main): Always init last_token to last token of
21 (cp_lexer_new_from_tokens): Overlay EOF token at end of range.
22 (cp_lexer_destroy): Restore token under the EOF.
23 (cp_lexer_previous_token_position): No check for eof_token here.
24 (cp_lexer_get_preprocessor_token): Clear tree_check_p.
25 (cp_lexer_peek_nth_token): Check CPP_EOF not eof_token.
26 (cp_lexer_consume_token): Assert not CPP_EOF, no check for
28 (cp_lexer_purge_token): Likewise.
29 (cp_lexer_purge_tokens_after): No check for EOF token.
30 (cp_parser_nested_name_specifier, cp_parser_decltype)
31 (cp_parser_template_id): Set tree_check_p.
33 2019-10-24 Jakub Jelinek <jakub@redhat.com>
35 * decl2.c (cplus_decl_attributes): Add "omp declare target block"
36 attribute in between declare target and end declare target
39 * call.c (convert_arg_to_ellipsis): Add missing space in string
42 2019-10-24 Marek Polacek <polacek@redhat.com>
44 * decl.c (reshape_init_r): Add missing space.
46 2019-10-24 Nathan Sidwell <nathan@acm.org>
48 * pt.c (reduce_template_parm_level): Attach the new TPI to the new
50 (convert_generic_types_to_packs): Pass the copied type to
51 reduce_templatE_parm_level.
53 2019-10-23 Nathan Sidwell <nathan@acm.org>
55 * cp-tree.c (CPTI_STD_IDENTIFIER): Delete.
56 (std_identifier): Delete.
57 (DECL_NAME_SPACE_STD_P): Compare against std_node.
58 * decl.c (initialize_predefined_identifiers): 'std' is not needed.
59 (cxx_init_decl_processing): Adjust creation of ::std. Use
60 {push,pop}_nested_namespace.
61 (cxx_builtin_function): Use {push,pop}_nested_namespace.
62 * except.c (init_exception_processing): Likewise.
63 * rtti.c (init_rtti_processing): Likewise.
65 2019-10-23 Jason Merrill <jason@redhat.com>
67 Implement P1286R2, Contra CWG1778
68 * method.c (defaulted_late_check): Don't check explicit
69 exception-specification on defaulted function.
70 (after_nsdmi_defaulted_late_checks): Remove.
71 * parser.h (struct cp_unparsed_functions_entry): Remove classes.
72 * parser.c (unparsed_classes): Remove.
73 (push_unparsed_function_queues, cp_parser_class_specifier_1):
76 2019-10-23 Jakub Jelinek <jakub@redhat.com>
78 * constexpr.c (cxx_eval_constant_expression) <case CLEANUP_STMT>:
79 Temporarily change input_location to CLEANUP_STMT location.
81 2019-10-22 Jakub Jelinek <jakub@redhat.com>
83 PR tree-optimization/85887
84 * decl.c (expand_static_init): Drop ECF_LEAF from __cxa_guard_acquire
85 and __cxa_guard_release.
87 2019-10-22 Marc Glisse <marc.glisse@inria.fr>
90 * constexpr.c (cxx_eval_builtin_function_call): Only set
91 force_folding_builtin_constant_p if manifestly_const_eval.
93 2019-10-22 Richard Sandiford <richard.sandiford@arm.com>
95 * cp-tree.h (STF_USER_VISIBLE): New constant.
96 (strip_typedefs, strip_typedefs_expr): Take a flags argument.
97 * tree.c (strip_typedefs, strip_typedefs_expr): Likewise,
98 updating mutual calls accordingly. When STF_USER_VISIBLE is true,
99 only look through typedefs if user_facing_original_type_p.
100 * error.c (dump_template_bindings, type_to_string): Pass
101 STF_USER_VISIBLE to strip_typedefs.
102 (dump_type): Likewise, unless pp_c_flag_gnu_v3 is set.
104 2019-10-21 Kamlesh Kumar <kamleshbhalui@gmail.com>
105 Jason Merrill <jason@redhat.com>
107 PR c++/83534 - typeinfo of noexcept function
108 * rtti.c (get_tinfo_decl_dynamic): Do not call
109 TYPE_MAIN_VARIANT for function.
110 (get_typeid): Likewise.
112 2019-10-21 Paolo Carlini <paolo.carlini@oracle.com>
114 * parser.c (cp_parser_class_head): Improve error recovery upon
115 extra qualification error.
117 2019-10-21 Jakub Jelinek <jakub@redhat.com>
120 * constexpr.c (cxx_eval_component_reference, cxx_eval_bit_field_ref):
121 Use STRIP_ANY_LOCATION_WRAPPER on CONSTRUCTOR elts.
123 2019-10-21 Marek Polacek <polacek@redhat.com>
125 PR c++/92062 - ODR-use ignored for static member of class template.
126 * pt.c (has_value_dependent_address): Strip location wrappers.
128 2019-10-21 Marek Polacek <polacek@redhat.com>
130 PR c++/92106 - ICE with structured bindings and -Wreturn-local-addr.
131 * typeck.c (maybe_warn_about_returning_address_of_local): Avoid
132 recursing on null initializer and return false instead.
134 2019-10-17 JeanHeyd Meneide <phdofthehouse@gmail.com>
136 Implement p1301 [[nodiscard("should have a reason")]] + p1771 DR
137 * tree.c (handle_nodiscard_attribute): Handle C++2a nodiscard
139 (std_attribute_table) Increase nodiscard argument handling
140 max_length from 0 to 1.
141 * parser.c (cp_parser_check_std_attribute): Add requirement
142 that nodiscard only be seen once in attribute-list.
143 (cp_parser_std_attribute): Check that empty parenthesis lists are
144 not specified for attributes that have max_length > 0 (e.g.
146 * cvt.c (maybe_warn_nodiscard): Add nodiscard message to
147 output, if applicable.
148 (convert_to_void): Allow constructors to be nodiscard-able (P1771).
150 2019-10-18 Nathan Sidwell <nathan@acm.org>
152 * cp-tree.h (struct lang_type): Remove was_anonymous.
153 (TYPE_WAS_UNNAMED): Implement by checking TYPE_DECL &
155 * decl.c (name_unnamed_type): Don't set TYPE_WAS_UNNAMED.
157 2019-10-17 Paolo Carlini <paolo.carlini@oracle.com>
159 * decl.c (grokfndecl): Remove redundant use of in_system_header_at.
160 (compute_array_index_type_loc): Likewise.
161 (grokdeclarator): Likewise.
162 * error.c (cp_printer): Likewise.
163 * lambda.c (add_default_capture): Likewise.
164 * parser.c (cp_parser_primary_expression): Likewise.
165 (cp_parser_selection_statement): Likewise.
166 (cp_parser_toplevel_declaration): Likewise.
167 (cp_parser_enumerator_list): Likewise.
168 (cp_parser_using_declaration): Likewise.
169 (cp_parser_member_declaration): Likewise.
170 (cp_parser_exception_specification_opt): Likewise.
171 (cp_parser_std_attribute_spec): Likewise.
172 * pt.c (do_decl_instantiation): Likewise.
173 (do_type_instantiation): Likewise.
174 * typeck.c (cp_build_unary_op): Likewise.
176 * decl.c (check_tag_decl): Pass to in_system_header_at the same
177 location used for the permerror.
178 (grokdeclarator): Likewise.
180 * decl.c (check_tag_decl): Use locations[ds_typedef] in error_at.
182 2019-10-17 Jason Merrill <jason@redhat.com>
184 * cp-gimplify.c (cp_gimplify_expr): Use get_initialized_tmp_var.
185 (gimplify_to_rvalue): Remove default NULL argument.
187 2019-10-17 Nathan Sidwell <nathan@acm.org>
189 * decl.c (builtin_function_1): Merge into ...
190 (cxx_builtin_function): ... here. Nadger the decl before maybe
191 copying it. Set the context.
192 (cxx_builtin_function_ext_scope): Push to top level, then call
193 cxx_builtin_function.
195 2019-10-16 Luis Machado <luis.machado@linaro.org>
197 * cp-gimplify.c: Fix reference to non-existing tree-gimple.c file.
199 2019-10-16 Jakub Jelinek <jakub@redhat.com>
201 * decl.c (cxx_maybe_build_cleanup): When clearing location of cleanup,
202 if cleanup is a nop, clear location of its operand too.
204 2019-10-15 Andrew Sutton <asutton@lock3software.com>
206 Finish moving constraint and logic functionality of out pt.c.
207 Reimplement and re-enable subsumption caching.
209 * config-lang.in (gtfiles): Add logic.cc.
210 * constraint.cc (atomic_constraints_identical_p): Add assertions.
211 (hash_atomic_constraint): Likewise.
212 (constraints_equivalent_p): New.
213 (inchash::add_constraint): New.
214 (iterative_hash_constraint): New.
215 (decl_constraints): Moved from pt.c.
216 (get_constraints): Likewise.
217 (set_constraints): Likewise.
218 (remove_constraints): Likewise.
219 * cp-tree.h (CONSTR_P): New.
220 (init_constraint_processing): Remove.
221 (constraints_equivalent_p, iterative_hash_constraint): Declare.
222 * decl.c (cxx_init_decl_processing): Don't initialize constraints.
223 * logic.cc (subsumption_entry): Moved from pt.c.
224 (subsumption_hasher): Likewise.
225 (subsumption_cache): Likewise.
226 (lookup_subsumption): Likewise.
227 (save_subsumption): Likewise.
228 (subsumes_constraints_nonnull): Use subsumption cache.
229 * pt.c: Move aforementioned declarations out of this file.
230 (init_constraint_processing): Remove.
232 2019-10-15 Andrew Sutton <asutton@lock3software.com>
234 * parser.c (cp_parser_constructor_declarator_p): Pass an empty
235 decl-specifier-seq to make sure we parse type constraints as part
238 2019-10-15 Nathan Sidwell <nathan@acm.org>
240 * class.c (build_clones): Break out of clone_function_decl. Just
242 (clone_function_decl): Call build_clones, then maybe add them to
245 * class.c (build_clone): Refactor to clarify recursiveness.
247 2019-10-14 Jason Merrill <jason@redhat.com>
249 PR c++/91930 - ICE with constrained inherited default ctor.
250 * name-lookup.c (do_class_using_decl): Set TYPE_HAS_USER_CONSTRUCTOR
251 for inherited constructor.
253 2019-10-14 Paolo Carlini <paolo.carlini@oracle.com>
255 * decl.c (check_tag_decl): Use DECL_SOURCE_LOCATION.
257 2019-10-14 Jakub Jelinek <jakub@redhat.com>
260 * semantics.c (handle_omp_array_sections_1): Temporarily disable
261 -fstrong-eval-order also for in_reduction and task_reduction clauses.
263 * parser.c (cp_parser_omp_all_clauses): Change bool NESTED_P argument
264 into int NESTED, if it is 2, diagnose missing commas in between
266 (cp_parser_omp_context_selector): Pass 2 as last argument to
267 cp_parser_omp_all_clauses.
269 2019-10-12 Jakub Jelinek <jakub@redhat.com>
271 * parser.c (cp_parser_omp_context_selector): Improve error recovery.
272 For simd properties, put them directly into TREE_VALUE.
273 (cp_finish_omp_declare_variant): Add "omp declare variant base"
274 attribute rather than "omp declare variant".
276 2019-10-11 Marek Polacek <polacek@redhat.com>
278 PR c++/92049 - extra error with -fchecking=2.
279 * pt.c (build_non_dependent_expr): Call fold_non_dependent_expr
282 2019-10-11 Paolo Carlini <paolo.carlini@oracle.com>
284 * typeck.c (cp_build_binary_op): Do not handle RROTATE_EXPR and
286 * constexpr.c (cxx_eval_constant_expression): Likewise.
287 (potential_constant_expression_1): Likewise.
288 * pt.c (tsubst_copy): Likewise.
290 2019-10-11 Jason Merrill <jason@redhat.com>
292 * decl2.c (mark_used): Don't clobber DECL_SOURCE_LOCATION on
293 explicitly defaulted functions.
294 * method.c (synthesize_method): Likewise.
296 2019-10-11 Jakub Jelinek <jakub@redhat.com>
299 * decl2.c (grok_array_decl): For -fstrong-eval-order, when array ref
300 operands have been swapped and at least one operand has side-effects,
301 revert the swapping before calling build_array_ref.
302 * typeck.c (cp_build_array_ref): For non-ARRAY_TYPE array ref with
303 side-effects on the index operand, if -fstrong-eval-order use
304 save_expr around the array operand.
305 (cp_build_binary_op): For shifts with side-effects in the second
306 operand, wrap first operand into SAVE_EXPR and evaluate it before
308 * semantics.c (handle_omp_array_sections_1): Temporarily disable
309 flag_strong_eval_order during OMP_CLAUSE_REDUCTION array section
311 * cp-gimplify.c (gimplify_to_rvalue): New function.
312 (cp_gimplify_expr): Use it.
314 2019-10-10 Marek Polacek <polacek@redhat.com>
316 * typeck.c (comp_ptr_ttypes_real): Change the return type to bool.
317 Use false instead of 0.
319 2019-10-10 Jakub Jelinek <jakub@redhat.com>
321 * parser.h (struct cp_omp_declare_simd_data): Add variant_p member.
322 * parser.c (cp_ensure_no_omp_declare_simd): Handle both declare simd
324 (cp_parser_oacc_all_clauses): Formatting fix.
325 (cp_parser_omp_all_clauses): Add NESTED_P argument, if true, terminate
326 processing on closing paren and don't skip to end of pragma line.
327 (cp_parser_omp_declare_simd): Add VARIANT_P argument. Handle also
329 (omp_construct_selectors, omp_device_selectors,
330 omp_implementation_selectors, omp_user_selectors): New variables.
331 (cp_parser_omp_context_selector,
332 cp_parser_omp_context_selector_specification,
333 cp_finish_omp_declare_variant): New functions.
334 (cp_parser_late_parsing_omp_declare_simd): Handle also declare variant.
335 (cp_parser_omp_declare): Handle declare variant.
337 2019-10-09 Jason Merrill <jason@redhat.com>
339 * cp-tree.h (template_info_decl_check): Check ENABLE_TREE_CHECKING.
341 2019-10-09 Marek Polacek <polacek@redhat.com>
343 PR c++/91364 - P0388R4: Permit conversions to arrays of unknown bound.
344 PR c++/69531 - DR 1307: Differently bounded array parameters.
345 PR c++/88128 - DR 330: Qual convs and pointers to arrays of pointers.
346 * call.c (build_array_conv): Build ck_identity at the beginning
348 (standard_conversion): Pass bounds_none to comp_ptr_ttypes_const.
349 (maybe_warn_array_conv): New.
350 (convert_like_real): Call it. Add an error message about converting
351 from arrays of unknown bounds.
352 (conv_get_original_expr): New.
353 (nelts_initialized_by_list_init): New.
354 (conv_binds_to_array_of_unknown_bound): New.
355 (compare_ics): Implement list-initialization ranking based on
356 array sizes, as specified in DR 1307 and P0388R.
357 * cp-tree.h (comp_ptr_ttypes_const): Adjust declaration.
358 (compare_bounds_t): New enum.
359 * typeck.c (comp_array_types): New bool and compare_bounds_t
360 parameters. Use them.
361 (structural_comptypes): Adjust the call to comp_array_types.
362 (similar_type_p): Handle ARRAY_TYPE.
363 (build_const_cast_1): Pass bounds_none to comp_ptr_ttypes_const.
364 (comp_ptr_ttypes_real): Don't check cv-quals of ARRAY_TYPEs. Use
365 comp_array_types to compare array types. Look through arrays as per
367 (comp_ptr_ttypes_const): Use comp_array_types to compare array types.
368 Look through arrays as per DR 330.
370 2019-10-09 Marek Polacek <polacek@redhat.com>
372 PR c++/92032 - DR 1601: Promotion of enum with fixed underlying type.
373 * call.c (standard_conversion): When converting an enumeration with
374 a fixed underlying type to the underlying type, give it the cr_promotion
376 (compare_ics): Implement a tiebreaker as per CWG 1601.
378 2019-10-08 Andrew Sutton <asutton@lock3software.com>
379 Jason Merrill <jason@redhat.com>
381 Update the concepts implementation to conform to the C++20
382 specification, improve compile times, and generally clean up
384 * call.c (build_new_function_call): Don't evaluate concepts here.
385 (constraint_failure): Don't record the template.
386 (print_z_candidate): Don't extract the template.
387 * class.c (add_method): When overloading, hide ineligible special
389 (check_methods): Set TYPE_HAS_COMPLEX_* here.
390 * constexpr.c (cxx_eval_constant_expression): Evaluate concepts.
391 (maybe_initialize_fundef_copies_table): Remove.
392 (get_fundef_copy): Use hash_map_safe_get_or_insert.
393 (clear_cv_and_fold_caches): Clear the satisfaction cache.
394 * constraint.cc (known_non_bool_p): New.
395 (parsing_constraint_expression_sentinel): Renamed from
396 expanding_constraint_sentinel.
397 (check_constraint_operands): New.
398 (check_constraint_atom): New.
399 (finish_constraint_binary_op): New.
400 (finish_constraint_or_expr): Likewise.
401 (finish_constraint_and_expr): Likewise.
402 (finish_constraint_primary_expr): Likewise.
403 (combine_constraint_expressions): New.
404 (finish_requires_expr): Add location parm.
405 (get_concept_definition): Return the initializer of concept definitions.
406 (get_template_head_requirements): New.
407 (get_trailing_function_requirements): New.
408 (deduce_constrained_parameter): Check if the identifier or template-id
409 is a concept definition.
410 (resolve_concept_definition_check): Removed.
411 (resolve_variable_concept_check): Removed.
412 (resolve_concept_check): New.
413 (resolve_constraint_check): Handle concept definitions.
414 converting arguments.
415 (function_concept_check_p): Removed.
416 (variable_concept_check_p): Removed.
417 (unpack_concept_check): New.
418 (get_concept_check_template): New.
419 (build_call_check): Moved and renamed to build_function_check.
420 (build_concept_check_arguments): make static.
421 (build_function_check): Always do overload resolution
422 in order to force conversion of template arguments (i.e., actually
423 check that the use of a concept is valid).
424 (build_standard_check): Renamed from build_real_concept_check.
425 (build_real_concept_check): Build checks for C++2a concepts by
426 (build_wildcard_concept_check): New.
427 (build_concept_check): Use build_real_concept_check. New overload.
428 (build_constraints): Save expressions, not normalized constraints.
429 (build_concept_id): New. Pass tf_warning_or_error.
430 (build_type_constraint): New.
431 (finish_type_constraints): New.
432 (associate_classtype_constraints): Also add constraints to union
433 types. Note the original declaration in errors. Don't return
434 error_mark_node in order to avoid an assertion later.
435 (push_down_pack_expansion): Remove.
436 (finish_shorthand_constraint): Make fold expressions, not naked
437 parameter packs. Always apply the constraint to each template argument.
438 (check_introduction_list): New. Fail if not enough
439 names are introduced.
440 (finish_template_introduction): Don't normalize constraints. Pass
441 tsubst flags. Check for insufficient introductions.
442 (placeholder_extract_concept_and_args): Handle the template-id case.
443 Unpack function concept checks correctly.
444 (tsubst_simple_requirement): Return errors if they occur. Don't
445 process as a template.
446 (tsubst_type_requirement): Likewise.
447 (type_deducible_p): New. Wrap the input expression in parens for the
448 purpose of deduction.
449 (expression_convertible_t): New.
450 (tsubst_compound_requirement): Use new deduction, conversion predicates.
451 (tsubst_nested_requirement): Return errors if they occur. Don't
452 process as a template. Instantiate and evaluate the nested requirement.
453 (tsubst_valid_expression_requirement): New.
454 (tsubst_simple_requirement): Use tsubst_valid_expression_requirement.
455 (tsubst_compound_requirement): Use tsubst_valid_expression_requirement.
456 (check_constaint_variables): New.
457 (tsubst_constraint_variables): Check that type substitutions are valid.
458 (tsubst_requires_expr): Likewise. Produce new requires-exprs during
459 template substitution. Copy the previous local specialization stack,
460 so references to non-local parameters can be found. Use cp_unevaluated.
461 (tsubst_constraint): New. Don't evaluate concept checks.
463 (norm_info): New. Used to build a normalization tree for concept check
465 (debug_parameter_mapping): New.
466 (debug_argument_list): New.
467 (expand_concept): Removed.
468 (normalize_logical_operation): Pass subst_info through call.
469 (normalize_pack_expansion): Remove.
470 (normalize_simple_requirement): Removed
471 (normalize_type_requirement): Removed
472 (normalize_compound_requirement): Removed
473 (normalize_nested_requirement): Removed
474 (normalize_requirement): Removed
475 (normalize_requirements): Removed
476 (normalize_requires_expression): Removed
477 (normalize_variable_concept_check): Removed.
478 (normalize_function_concept_check): Removed.
479 (normalize_concept_check): Merged all normalize_*_check here.
480 Substitute through written template arguments before normalizing the
481 definition. Only substitute the innermost template arguments.
482 (check_for_logical_overloads): Delete.
483 (map_arguments): New. Associate template parameters with arguments.
484 (build_parameter_mapping): New. Extract used parameters.
485 (normalize_expression): Rewrite.
486 (normalize_conjunction): Removed
487 (normalize_disjunction): Removed
488 (normalize_predicate_constraint): Removed
489 (normalize_parameterized_constraint): Removed
490 (normalized_map): New variable.
491 (get_normalized_constraints): New entry point for normalization.
493 (get_normalized_constraints_from_info): New.
494 (get_normalized_constraints_from_decl): New. Turn on template processing
495 prior to normalization. Handle inheriting ctors. Build the
496 normalization arguments from the full set of template parameters of the
497 most general template. This guarantees that we have no concrete arguments
498 in the parameter mapping (e.g., from template members of class
499 templates). Cache normalizations.
500 (normalize_concept_definition): New. Cache normalizations.
501 (normalize_template_requirements): New.
502 (normalize_nontemplate_requirements): New.
503 (normalize_constraint_expression): New.
504 (tsubst_parameter_mapping): New.
505 (get_mapped_args): New.
506 (parameter_mapping_equivalent_p): New. Use template_args_equal.
507 (atomic_constraints_identical_p): New.
508 (hash_atomic_constraint): New.
509 (satisfying_constraint_p): New. Guard against recursive evaluation of
510 constraints during satisfaction.
511 (satisfy_conjunction): New.
512 (satisfy_disjunction): New.
513 (sat_entry): New class for hashing satisfaction results.
514 (sat_hasher): New hash traits.
516 (get_satisfaction): New. Returns cached satisfaction result.
517 (save_satisfaction): New. Caches a satisfaction result.
518 (clear_satisfaction_cache): New.
519 (satisfaction_cache): New. Helps manage satisfaction cache requests.
520 (decl_satisfied_cache): New.
522 (satisfy_constraint_r): New.
523 (satisfy_constraint): Use new satisfaction algorithm.
524 (evaluate_concept_check): New.
525 (evaluate_concept): Removed.
526 (evaluate_function_concept): Removed.
527 (evaluate_variable_concept): Removed.
528 (satisfy_constraint_expression): New.
529 (constraint_expression_satisfied_p): New.
530 (constraints_satisfied_p): Use strip_inheriting_ctors. Use
531 push_/pop_access_scope.
532 (more_constrained): Normalize before calling out to subsumption. Allow
533 classes as arguments.
534 (strictly_subsumes): Allow non-templates as arguments. Accept a new
536 (weakly_subsumes): New.
537 (at_least_as_constrained): Removed.
538 (diagnose_other_expression): Removed.
539 (diagnose_predicate_constraint): Removed.
540 (diagnose_pack_expansion): Removed.
541 (diagnose_check_constraint): Removed.
542 (diagnose_logical_constraint): Removed.
543 (diagnose_expression_constraint): Removed.
544 (diagnose_type_constraint): Removed.
545 (diagnose_implicit_conversion_constraint): Removed.
546 (diagnose_argument_deduction_constraint): Removed.
547 (diagnose_exception_constraint): Removed.
548 (diagnose_parameterized_constraint): Removed.
549 (diagnose_argument_deduction_constraint): Removed.
550 (diagnose_argument_deduction_constraint): Removed.
551 (diagnose_argument_deduction_constraint): Removed.
552 (diagnose_trait_expr): New.
553 (diagnose_requires_expr): New.
554 (diagnose_atomic_constraint): New.
555 (diagnose_valid_expression) Stop wrongly diagnosing valid expressions.
556 Don't substitute as if in template decls. This causes substitution
557 to generate expressions that aren't suitable for use with the noexcept
559 (diagnose_valid_type) Likewise.
560 (diagnose_compound_requirement) Actually emit diagnostics for
561 the causes of errors.Call force_paren_expr_uneval.
562 (diagnose_declaration_constraints): Turn on template processing to
563 suppress certain analyses.
564 * cp-objcp-common.c (cp_common_init_ts): Make concepts typed.
565 (cp_get_debug_type): Use hash_map_safe_*.
566 * cp-tree.h: New function declarations for semantic actions, other
567 facilities. Remove declaration no longer used or needed. Remove
568 unused _CONSTR macros.
569 (LANG_DECL_HAS_MIN): Add CONCEPT_DECL.
570 (template_info_decl_check): Factor macro check into an inline function.
571 (DECL_TEMPLATE_INFO): Use new check facility.
572 (finish_concept_definition): New. Don't invalid concept declarations
573 with invalid initializers.
574 (find_template_parameters): New.
575 (concept_definition_p): New.
576 (concept_check_p): New.
577 (variable_concept_check_p): New.
578 (force_paren_expr_uneval): New.
579 (ovl_iterator::using_p): A USING_DECL by itself was also
580 introduced by a using-declaration.
581 (struct tree_template_info): Use tree_base instead of
582 tree_common. Add tmpl and args fields.
583 (TI_TEMPLATE, TI_ARGS): Adjust.
584 (DECLTYPE_FOR_INIT_CAPTURE): Remove.
585 (CONSTR_CHECK, CONSTR_INFO, CONSTR_EXPR, CONSTR_CONTEXT): New.
586 (ATOMIC_CONSTR_MAP, TRAIT_EXPR_LOCATION): New.
587 (struct tree_trait_expr): Add locus field.
588 (enum tsubst_flags): Add tf_norm as a hint to generate normalization
589 context when diagnosing constraint failure.
590 * cp-tree.def: Remove unused _CONSTR nodes and rename PRED_CONSTR
593 * cxx-pretty-print.c: Remove constraint printing code.
594 (pp_cxx_concept_definition): New.
595 (pp_cxx_template_declaration): Print concept definitions.
596 (pp_cxx_check_constraint): Update printing for concept definitions.
597 (pp_cxx_nested_name_specifier): Fix a weird
598 case where we're printing '::::' for concepts.
599 (simple_type_specifier): Print requirements for placeholder types.
600 (pp_cxx_constrained_type_spec): Print the associated requirements of
602 (pp_cxx_compound_requirement): Add space before the '->'.
603 (pp_cxx_parameter_mapping): Print the parameter mapping.
604 (pp_cxx_atomic_constraint): Use the function above.
605 * decl.c (redeclaration_error_message): New error for concepts.
606 (grokdeclarator): Check for and disallow decltype(auto) in parameter
608 (grokfndecl): Don't normalize constraints. Add check for constraints
610 (grokvardecl): Don't normalize constraints.
611 (grok_special_member_properties): Don't set TYPE_HAS_COMPLEX_*.
612 (function_requirements_equivalent_p): New. Compare trailing
613 requires clauses. Compare combined constraints in pre-C++20 mode.
614 (decls_match): Compare trailing requires clauses. Compare template
615 heads for function templates. Remove old constraint comparison.
616 Simplify comparison of functions, function templates.
617 (duplicate_function_template_decls): New. Refactor a nasty if
618 condition into a single predicate.
619 (require_deduced_type): Don't complain if we already complained about
621 (finish_function): Perform auto deduction to ensure that constraints
622 are checked even when functions contain no return statements. Only do
623 auto deduction if we haven't previously seen any return statements.
624 This prevents multiple diagnostics of the same error.
625 (store_decomp_type): Remove.
626 (cp_finish_decomp): Use hash_map_safe_put.
627 * error.c: Remove constraint printing code.
628 (dump_decl): Dump concept definitions. Handle wildcard declarations.
629 (dump_template_decl): Likewise.
630 (dump_type): Print associated requirements for placeholder
632 (rebuild_concept_check): New.
633 (maybe_print_single_constraint_context): New.
634 (maybe_print_constraint_context): Recursively print nested contexts.
635 * init.c (get_nsdmi): Use hash_map_safe_*.
636 * lambda.c (maybe_add_lambda_conv_op): Bail if deduction failed.
637 (add_capture): Copy parameter packs from init.
638 (lambda_capture_field_type): Always use auto for init-capture.
639 * logic.cc: Completely rewrite.
640 (constraint_hash): New.
641 (clause/ctor): Save atoms in the hash table.
642 (replace): Save atoms during replacement.
643 (insert): Save atoms during insertion.
644 (contains): Only search the hash table for containment.
645 (clause): Keep a hash of atomic constraints.
646 (clause::clause): Explicitly copy the hash table when copying.
647 (disjunction_p, conjunction_p, atomic_p, dnf_size, cnf_size): New.
648 (diagnose_constraint_size): New.
649 (subsumes_constraints_nonnull): Compare the sizes of normalized formula
650 to determine the cheapest decomposition.
651 * name-lookup.c (diagnose_name_conflict): Diagnose name issues with
653 (matching_fn_p): Check constraints.
654 (push_class_level_binding_1): Move overloaded functions case down,
655 accept FUNCTION_DECL as target_decl.
656 * parser.c (enum required_token): New required token for auto.
657 (make_location): Add overload taking lexer as last parm.
658 (cp_parser_required_error): Diagnose missing auto.
659 (cp_parser_diagnose_ungrouped_constraint_plain): New.
660 (cp_parser_diagnose_ungrouped_constraint_plain): New.
661 (cp_parser_constraint_primary_expression): New. Tentatively parse the
662 primary expression. If that fails tentatively parse a lower
663 precedence expression in order to diagnose the error.
664 (cp_parser_check_non_logical_constraint): New. Performs a trial
665 parse of the right-hand-side of non-logical operators in order to
666 generate good diagnostics.
667 (cp_parser_constraint_logical_and_expression): New.
668 (cp_parser_constraint_logical_or_expression): New.
669 (cp_parser_requires_clause_expression): New.
670 (cp_parser_requires_clause): Renamed to cp_parser_constraint_expression.
671 (cp_parser_requires_clause_opt): Parse the requires-clause differently
672 in -fconcepts and -std=c++2a modes.
673 (cp_parser_requirement_list): Rename to cp_parser_requirement_seq.
674 Rewrite so that semicolons are parsed
675 along with requirements, not the sequence.
676 (cp_parser_simple_requirement): Expect a semicolon at end.
677 (cp_parser_compound_requirement): Expect a semicolon at end. Only
678 allow trailing-return-type with -fconcepts-ts.
679 (cp_parser_nested_requirement): Expect a semicolon at end. Parse
680 constraint-expressions.
681 (cp_parser_concept_definition): New. Don't fail parsing the concept
682 definition if the initializer is ill-formed. Don't declare the concept
683 before parsing the initializer.
684 (cp_parser_constraint_expression): Declare earlier.
685 (cp_parser_type_requirement): Current scope is not valid.
686 (cp_parser_requires_expression): Commit to the tentative parse.
687 (cp_parser_decl_specifier_seq): Warn when concept appears to be used
689 (cp_parser_template_declaration_after_parameters): Parse concept
691 (cp_parser_template_id): Don't try to resolve a concept template-id yet.
692 (cp_parser_template_id_expr): Resolve it as a concept check.
693 (cp_parser_decl_specifier_seq): Warn on 'concept bool'.
694 (cp_parser_type_parameter): Combine expressions not
696 (cp_parser_explicit_template_declaration): Combine expressions not
698 (cp_parser_maybe_concept_name): Removed.
699 (cp_parser_simple_type_specifier): Handle an error condition of
700 a bad constrained type specifier. Expect auto or decltype after
701 a concept name. Also handle the case where we have a template-id
703 (cp_parser_template_introduction): Diagnose errors on invalid
704 introductions. Give up if it doesn't start with a concept name.
705 Pedwarn if not -fconcepts-ts.
706 (synthesize_implicit_template_parm): Don't do consistent binding.
707 Use a new flag for constrained parameters. Combine expressions,
708 not constraints. Fail if we get a placeholder in block scope.
709 Placeholders that do not constrain types are not allowed in parameter
710 declarations, so don't handle them.
711 (cp_parser_placeholder_type_specifier): New. Implement parsing of
712 placeholder type specifiers following a concept name or partial
713 concept check. Disallow decltype(auto) parameters.
714 (cp_parser_nested_name_specifier_opt): If the token is already
715 CPP_NESTED_NAME_SPECIFIER, leave it alone.
716 (cp_parser_id_expression, cp_parser_unqualified_id): Call
717 cp_parser_template_id_expr.
718 (cp_parser_placeholder_type_specifier): Add tentative parm. Don't
719 expect a WILDCARD_DECL.
720 (cp_parser_trait_expr): Pass trait_loc down.
721 (cp_parser_postfix_expression): Do set location of dependent member
723 * pt.c (finish_concept_definition): New.
724 (push_template_decl_real): Handle concept definitions.
725 (start_concept_definition): Let push_template_decl_real handle the
726 creation of the template.
727 (get_constraints): Return null if the table hasn't been initialized.
728 (tsubst_copy_and_build): Build template-id expressions for concept
730 [TRAIT_EXPR]: Pass trait_loc down.
731 (lookup_template_class_1): Add the template name to the constraint
733 (lookup_and_finish_template_variable): Build concept checks
734 with the correct arguments.
735 (tsubst_function_decl): Don't substitute through constraints.
736 Always associate constraints with functions.
737 (template_parm_level_and_index): Make non-static.
738 (for_each_template_parm_r): Handle requires expressions.
739 (keep_template_parm): New.
740 (find_template_parameters): New.
741 (more_specialized_fn): Change how winners and losers are chosen.
742 (make_constrained_auto): Don't normalize constraints.
743 (template_parameters_equivalent_p): New. Compare template
744 parameters. Add a comparison for implicitly vs. explicitly declared
746 (template_parameter_lists_equivalent_p): New. Compare template
748 (template_requirements_equivalent_p): New.
749 (template_heads_equivalent_p): New. Compare template heads.
750 (template_parameter_constraints_equivalent_p): New.
751 (is_compatible_template_arg): Use weakly_subsumes.
752 (maybe_new_partial_specialization): Use new constraint comparison
753 for finding specializations.
754 (process_partial_specialization): Pass main template as argument.
755 (more_specialized_partial_spec): Don't immediately return when
757 (make_constrained_auto): Handle concept definitions.
758 (do_auto_deduction): Update auto deduction for new concept model.
759 Extract the function concept correctly; rename constr to check to
760 reflect the kind of node.
761 (tsubst): Adjust wildcard argument during substitution.
762 [DECLTYPE_TYPE]: Remove init-capture handling.
763 (tsubst_copy_and_build): Build concept checks, not template ids.
764 Defer checks of function concepts. Handle concepts before variable
765 templates. Handle calls to function concepts explicitly.
766 (coerce_template_parms): Use concept_definition_p. Handle a deduction
767 error where a potentially empty pack can be supplied after the last
768 parameter of a concept.
769 (finish_template_variable): Don't process concepts here.
770 (instantiation_dependent_r): Use concept_check_p.
771 (tsubst_template_args): Make non-static.
772 (make_constrained_placeholder_type): New. Refactored from
773 make_constrained_auto.
774 (make_constrained_auto) Use make_constrained_placeholder_type.
775 (make_constrained_decltype_auto) New.
776 (tsubst_function_parms): New.
777 (value_dependent_expression_p) [TEMPLATE_ID_EXPR]: Use
778 concept_definition_p.
779 (push_access_scope, pop_access_scope): No longer static.
780 (tsubst_template_parm): Substitute TEMPLATE_PARM_CONSTRAINTS.
781 (tsubst_friend_function): Use tsubst_constraint. Use generic_targs_for.
782 (get_underlying_template) Use generic_targs_for.
783 (uses_parameter_packs): Return tree.
784 (gen_elem_of_pack_expansion_instantiation): Don't push
785 local_specialization_stack.
786 (prepend_one_capture): New.
787 (tsubst_lambda_expr): Use prepend_one_capture. Don't touch
788 local_specializations.
789 (template_parms_level_to_args): No longer static.
790 (add_outermost_template_args): Likewise.
791 (find_template_parameter_info): New. Provide context for finding
793 (keep_template_parm): Don't keep parameters declared at depth levels
794 greater than those of the template parameters of the source declaration.
795 Don't propagate cv-qualified types. Return 0, so we find all template
796 parameters, not the just first.
797 (any_template_parm_r): New. Handle cases that are mishandled by
798 for_each_template_parm_r.
799 (generic_targs_for): Factor out of coerce_template_args_for_ttp.
800 (tsubst_argument_pack): Factor out of tsubst_template_args.
801 (constraint_sat_entry): Removed.
802 (constraint_sat_hasher): Removed.
803 (concept_spec_entry): Removed.
804 (concept_spec_hasher): Removed.
805 (constraint_memos): Removed.
806 (concept_memos): Removed.
807 (lookup_constraint_satisfaction): Removed.
808 (memoize_constraint_satisfaction): Removed.
809 (lookup_concept_satisfaction): Removed.
810 (memoize_concept_satisfaction): Removed.
811 (concept_expansions): Removed.
812 (get_concept_expansion): Removed.
813 (save_concept_expansion): Removed.
814 (init_constraint_processing): Remove initialization of non-existing
816 (find_template_requirement): New. Search for the sub-requirement
817 within the associated constraints.
818 (convert_generic_types_to_packs): Also transform the associated
819 constraint and update the current template requirements.
820 (store_defaulted_ttp, lookup_defaulted_ttp): Remove.
821 (add_defaults_to_ttp): Use hash_map_safe_*.
822 * semantics.c (finish_call_expr): Diagnose calls to concepts.
823 Handle concept checks explicitly.
824 (finish_id_expression): Evaluate variable concepts as part of
825 id-expression processing. Don't treat variable concepts as variables,
826 and don't process function concepts as plain id-expressions.
827 (force_paren_expr): Add even_uneval parm.
828 (finish_trait_expr): Add location parm.
829 * tree.c (special_memfn_p): New.
830 (cp_expr_location): Handle TRAIT_EXPR.
831 * typeck.c (check_return_expr): Actually use the diagnostic kind
832 when performing return-type deduction.
833 * typeck2.c (build_functional_cast): Don't rely on the location of
836 2019-10-09 Paolo Carlini <paolo.carlini@oracle.com>
838 * decl.c (grok_ctor_properties): Use DECL_SOURCE_LOCATION.
839 * typeck.c (cp_build_binary_op): Use the op_location_t argument
840 in many error messages.
842 2019-10-08 Martin Sebor <msebor@redhat.com>
845 * call.c (maybe_warn_class_memaccess): Handle arrays.
847 2019-10-07 Paolo Carlini <paolo.carlini@oracle.com>
849 * call.c (resolve_args): Use cp_expr_loc_or_input_loc in one place.
850 * decl.c (grokdeclarator): Use id_loc in one place.
851 * decl2.c (build_anon_union_vars): Use DECL_SOURCE_LOCATION.
852 * parser.c (cp_parser_delete_expression): Fix the location of the
854 (cp_parser_throw_expression): Likewise.
855 * pt.c (determine_specialization): Use DECL_SOURCE_LOCATION.
857 2019-10-05 Jakub Jelinek <jakub@redhat.com>
859 PR c++/91369 - Implement P0784R7: constexpr new
860 * cp-tree.h (enum cp_tree_index): Add CPTI_HEAP_UNINIT_IDENTIFIER,
861 CPTI_HEAP_IDENTIFIER and CPTI_HEAP_DELETED_IDENTIFIER.
862 (heap_uninit_identifier, heap_identifier, heap_deleted_identifier):
864 (type_has_constexpr_destructor, build_new_constexpr_heap_type,
865 cxx_constant_dtor): Declare.
866 * class.c (type_maybe_constexpr_default_constructor): Make static.
867 (type_maybe_constexpr_destructor, type_has_constexpr_destructor): New
869 (finalize_literal_type_property): For c++2a, don't clear
870 CLASSTYPE_LITERAL_P for types without trivial destructors unless they
871 have non-constexpr destructors.
872 (explain_non_literal_class): For c++2a, complain about non-constexpr
873 destructors rather than about non-trivial destructors.
874 * constexpr.c: Include stor-layout.h.
875 (struct constexpr_global_ctx): New type.
876 (struct constexpr_ctx): Add global field, remove values and
878 (cxx_replaceable_global_alloc_fn): New inline function.
879 (cxx_eval_call_expression): For c++2a allow calls to replaceable
880 global allocation functions, for new return address of a heap uninit
881 var, for delete record its deletion. Change ctx->values->{get,put} to
882 ctx->global->values.{get,put}.
883 (non_const_var_error): Add auto_diagnostic_group sentinel. Emit
884 special diagnostics for heap variables.
885 (cxx_eval_store_expression): Change ctx->values->{get,put} to
886 ctx->global->values.{get,put}.
887 (cxx_eval_loop_expr): Initialize jump_target if NULL. Change
888 new_ctx.values->remove to ctx->global->values.remove.
889 (cxx_eval_constant_expression): Change *ctx->constexpr_ops_count
890 to ctx->global->constexpr_ops_count. Change ctx->values->{get,put} to
891 ctx->global->values.{get,put}.
892 <case NOP_EXPR>: Formatting fix. On cast of replaceable global
893 allocation function to some pointer type, adjust the type of
894 the heap variable and change name from heap_uninit_identifier
896 (find_heap_var_refs): New function.
897 (cxx_eval_outermost_constant_expr): Add constexpr_dtor argument,
898 handle evaluation of constexpr dtors and add tracking of heap
899 variables. Use tf_no_cleanup for get_target_expr_with_sfinae.
900 (cxx_constant_value): Adjust cxx_eval_outermost_constant_expr caller.
901 (cxx_constant_dtor): New function.
902 (maybe_constant_value, fold_non_dependent_expr_template,
903 maybe_constant_init_1): Adjust cxx_eval_outermost_constant_expr
905 (potential_constant_expression_1): Ignore clobbers. Allow
906 COND_EXPR_IS_VEC_DELETE for c++2a.
907 * decl.c (initialize_predefined_identifiers): Add heap identifiers.
908 (decl_maybe_constant_destruction): New function.
909 (cp_finish_decl): Don't clear TREE_READONLY for constexpr variables
910 with non-trivial, but constexpr destructors.
911 (register_dtor_fn): For constexpr variables with constexpr non-trivial
912 destructors call cxx_maybe_build_cleanup instead of adding destructor
914 (expand_static_init): For constexpr variables with constexpr
915 non-trivial destructors call cxx_maybe_build_cleanup.
916 (grokdeclarator): Allow constexpr destructors for c++2a. Formatting
918 (cxx_maybe_build_cleanup): For constexpr variables with constexpr
919 non-trivial destructors call cxx_constant_dtor instead of adding
920 destructor calls at runtime.
921 * init.c: Include stor-layout.h.
922 (build_new_constexpr_heap_type, maybe_wrap_new_for_constexpr): New
924 (build_new_1): For c++2a and new[], add cast around the alloc call
925 to help constexpr evaluation figure out the type of the heap storage.
926 (build_vec_delete_1): Set DECL_INITIAL of tbase and emit a DECL_EXPR
927 for it instead of initializing an uninitialized variable.
928 * method.c: Include intl.h.
929 (SFK_CTOR_P, SFK_DTOR_P, SFK_ASSIGN_P, SFK_COPY_P, SFK_MOVE_P): Move
931 (process_subob_fn): Add sfk argument, adjust non-constexpr call
932 diagnostics based on it.
933 (walk_field_subobs): Formatting fixes. Adjust process_subob_fn caller.
934 (synthesized_method_base_walk): Likewise.
935 (synthesized_method_walk): Set *constexpr_p to true for dtors in c++2a.
936 Fix up DR number in comment.
937 (implicitly_declare_fn): Formatting fix.
938 * typeck2.c (store_init_value): Don't call cp_fully_fold_init on
939 initializers of automatic non-constexpr variables in constexpr
942 2019-10-04 Jakub Jelinek <jakub@redhat.com>
945 * constexpr.c (cxx_fold_indirect_ref_1): New function.
946 (cxx_fold_indirect_ref): Use it.
949 * cp-gimplify.c (cp_gimplify_expr) <case CALL_EXPR>: For
950 -fstrong-eval-order ensure CALL_EXPR_FN side-effects are evaluated
951 before any arguments. Additionally, ensure CALL_EXPR_FN that isn't
952 invariant nor OBJ_TYPE_REF nor SSA_NAME is forced into a temporary.
954 2019-10-03 Paolo Carlini <paolo.carlini@oracle.com>
956 * init.c (build_new): Use cp_expr_loc_or_input_loc in two places.
957 * name-lookup.c (do_pushdecl): Use DECL_SOURCE_LOCATION.
958 (push_class_level_binding_1): Likewise.
959 (set_decl_namespace): Likewise.
961 2019-10-03 Jakub Jelinek <jakub@redhat.com>
963 * constexpr.c (cxx_eval_constant_expression) <case CLEANUP_STMT>: If
964 not skipping upon entry to body, run cleanup with the same *jump_target
965 as it started to run the cleanup even if the body returns, breaks or
967 (potential_constant_expression_1): Allow CLEANUP_STMT.
969 * constexpr.c (cxx_eval_store_expression): Formatting fix. Handle
970 const_object_being_modified with array type.
972 2019-10-02 Jason Merrill <jason@redhat.com>
974 * typeck2.c (store_init_value): Only clear_cv_and_fold_caches if the
977 2019-09-30 Jason Merrill <jason@redhat.com>
979 Use hash_map_safe_* functions.
980 * constexpr.c (maybe_initialize_fundef_copies_table): Remove.
981 (get_fundef_copy): Use hash_map_safe_get_or_insert.
982 * cp-objcp-common.c (cp_get_debug_type): Use hash_map_safe_*.
983 * decl.c (store_decomp_type): Remove.
984 (cp_finish_decomp): Use hash_map_safe_put.
985 * init.c (get_nsdmi): Use hash_map_safe_*.
986 * pt.c (store_defaulted_ttp, lookup_defaulted_ttp): Remove.
987 (add_defaults_to_ttp): Use hash_map_safe_*.
989 2019-10-02 Richard Biener <rguenther@suse.de>
992 * decl.c (build_ptrmemfunc_type): Mark pointer-to-member
993 fat pointer structure members as DECL_NONADDRESSABLE_P.
995 2019-09-28 Marek Polacek <polacek@redhat.com>
997 PR c++/91889 - follow-up fix for DR 2352.
998 * call.c (involves_qualification_conversion_p): New function.
999 (direct_reference_binding): Build a ck_qual if the conversion
1000 would involve a qualification conversion.
1001 (convert_like_real): Strip the conversion created by the ck_qual
1002 in direct_reference_binding.
1004 PR c++/91921 - stray warning with -Woverloaded-virtual.
1005 * class.c (warn_hidden): Only emit the second part of
1006 -Woverloaded-virtual if the first part was issued. Use inform instead
1009 PR c++/91923 - failure-to-SFINAE with class type NTTP in C++17.
1010 * pt.c (invalid_nontype_parm_type_p): Only emit errors when
1013 2019-09-27 Jakub Jelinek <jakub@redhat.com>
1016 * parser.c (cp_parser_omp_var_list_no_open): Parse predefined
1018 * semantics.c (finish_omp_clauses): Allow predefined variables in
1019 shared and firstprivate clauses, even when they are predetermined
1021 * cp-gimplify.c (cxx_omp_predetermined_sharing_1): Return
1022 OMP_CLAUSE_DEFAULT_SHARED for predefined variables.
1024 2019-09-27 Jason Merrill <jason@redhat.com>
1026 * constexpr.c (cxx_fold_indirect_ref): Use similar_type_p.
1027 (cxx_eval_indirect_ref): Likewise. Improve error location.
1029 * cp-tree.h (class iloc_sentinel): New.
1030 * decl.c (grokdeclarator, finish_enum_value_list): Use it.
1031 * mangle.c (mangle_decl_string): Use it.
1032 * pt.c (perform_typedefs_access_check): Use it.
1034 2019-09-27 Richard Sandiford <richard.sandiford@arm.com>
1036 * cp-tree.h (build_cxx_call): Take the original function decl
1037 as an optional final parameter.
1038 (cp_build_function_call_vec): Likewise.
1039 * call.c (build_cxx_call): Likewise. Pass all built-in calls to
1040 check_builtin_function_arguments.
1041 * typeck.c (build_function_call_vec): Take the original function
1042 decl as an optional final parameter and pass it to
1043 cp_build_function_call_vec.
1044 (cp_build_function_call_vec): Take the original function
1045 decl as an optional final parameter and pass it to build_cxx_call.
1047 2019-09-25 Marek Polacek <polacek@redhat.com>
1049 PR c++/91877 - ICE with converting member of packed struct.
1050 * call.c (convert_like_real): Use similar_type_p in an assert.
1052 2019-09-25 Paolo Carlini <paolo.carlini@oracle.com>
1054 * name-lookup.c (check_extern_c_conflict): Use DECL_SOURCE_LOCATION.
1055 (check_local_shadow): Use it in three additional places.
1057 2019-09-24 Jason Merrill <jason@redhat.com>
1059 * parser.c (cp_parser_postfix_expression): Do set location of
1060 dependent member call.
1062 2019-09-24 Marek Polacek <polacek@redhat.com>
1064 PR c++/91868 - improve -Wshadow location.
1065 * name-lookup.c (check_local_shadow): Use DECL_SOURCE_LOCATION
1066 instead of input_location.
1068 PR c++/91845 - ICE with invalid pointer-to-member.
1069 * expr.c (mark_use): Use error_operand_p.
1070 * typeck2.c (build_m_component_ref): Check error_operand_p after
1071 calling mark_[lr]value_use.
1073 2019-09-23 Paolo Carlini <paolo.carlini@oracle.com>
1075 * pt.c (check_explicit_specialization): Use cp_expr_loc_or_input_loc.
1076 (process_partial_specialization): Likewise.
1077 (convert_nontype_argument_function): Likewise.
1078 (invalid_tparm_referent_p): Likewise.
1079 (convert_template_argument): Likewise.
1080 (check_valid_ptrmem_cst_expr): Tidy.
1082 2019-09-23 Jason Merrill <jason@redhat.com>
1084 PR c++/91809 - bit-field and ellipsis.
1085 * call.c (convert_arg_to_ellipsis): Don't call decay_conversion for
1086 arithmetic arguments.
1088 2019-09-23 Marek Polacek <polacek@redhat.com>
1090 PR c++/91844 - Implement CWG 2352, Similar types and reference binding.
1091 * call.c (reference_related_p): Use similar_type_p instead of
1093 (reference_compatible_p): Update implementation to match CWG 2352.
1094 * cp-tree.h (similar_type_p): Declare.
1095 * typeck.c (similar_type_p): New.
1097 2019-09-22 Marek Polacek <polacek@redhat.com>
1099 PR c++/91819 - ICE with operator++ and enum.
1100 * call.c (build_new_op_1): Set arg2_type.
1102 2019-09-17 Jason Merrill <jason@redhat.com>
1104 * parser.c (cp_parser_statement): Handle [[likely]] on
1107 2019-09-19 Jason Merrill <jason@redhat.com>
1110 * call.c (build_new_op_1): Don't apply any standard conversions to
1111 the operands of a built-in operator. Don't suppress conversions in
1113 * typeck.c (cp_build_unary_op): Do integral promotions for enums.
1115 2019-09-16 Paolo Carlini <paolo.carlini@oracle.com>
1117 * decl.c (grokdeclarator): Use declspecs->locations and
1118 declarator->id_loc in a few error messages.
1119 * pt.c (finish_member_template_decl): Use DECL_SOURCE_LOCATION.
1120 (push_template_decl_real): Likewise.
1122 2019-09-15 Jason Merrill <jason@redhat.com>
1124 PR c++/30277 - int-width bit-field promotion.
1125 PR c++/33819 - long bit-field promotion.
1126 * typeck.c (cp_perform_integral_promotions): Handle large bit-fields
1127 properly. Handle 32-bit non-int bit-fields properly.
1128 (is_bitfield_expr_with_lowered_type): Don't look through NOP_EXPR.
1130 PR c++/82165 - enum bitfields and operator overloading.
1131 * call.c (build_new_op_1): Use unlowered_expr_type.
1133 * call.c (build_new_op_1): Don't apply any standard conversions to
1134 the operands of a built-in operator. Don't suppress conversions in
1136 * typeck.c (cp_build_unary_op): Do integral promotions for enums.
1138 2019-09-15 Marek Polacek <polacek@redhat.com>
1140 PR c++/91740 - ICE with constexpr call and ?: in ARRAY_REF.
1141 * pt.c (build_non_dependent_expr): Call build_non_dependent_expr for
1144 2019-09-15 Nathan Sidwell <nathan@acm.org>
1146 * cp-tree.h (DECL_CLONED_FUNCTION_P): Reimplement using
1147 IDENTIFIER_CDTOR_P, correct documentation.
1148 (DECL_CLONED_FUNCTION): Directly access field.
1149 (decl_cloned_function_p): Delete.
1150 * class.c (decl_cloned_function_p): Delete.
1151 * pt.c (instantiate_template_1): Check DECL_CHAIN is a decl.
1153 2019-09-11 Nathan Sidwell <nathan@acm.org>
1155 * c-objcp-common.c (cp-objcp-common.c): Alphababetize and
1156 correctly mark all C++ nodes.
1157 * decl.c (cp_tree_node_structure): Alphabetize.
1159 2019-09-10 Marek Polacek <polacek@redhat.com>
1161 PR c++/91673 - ICE with noexcept in alias-declaration.
1162 * parser.c (CP_PARSER_FLAGS_DELAY_NOEXCEPT): New parser flag.
1163 (cp_parser_lambda_declarator_opt): Pass CP_PARSER_FLAGS_NONE to
1164 cp_parser_exception_specification_opt.
1165 (cp_parser_direct_declarator): Adjust a call to
1166 cp_parser_exception_specification_opt.
1167 (cp_parser_member_declaration): Pass CP_PARSER_FLAGS_DELAY_NOEXCEPT
1168 to cp_parser_declarator if not processing a friend or typedef
1170 (cp_parser_late_noexcept_specifier): Adjust a call to
1171 cp_parser_noexcept_specification_opt.
1172 (cp_parser_noexcept_specification_opt): New parameter for parser flags,
1173 drop the FRIEND_P parameter. Use the new parameter.
1174 (cp_parser_exception_specification_opt): Likewise.
1175 (cp_parser_transaction): Adjust a call to
1176 cp_parser_noexcept_specification_opt.
1177 (cp_parser_transaction_expression): Likewise.
1179 2019-09-10 Marek Polacek <polacek@redhat.com>
1181 PR c++/91705 - constexpr evaluation rejects ++/-- on floats.
1182 * constexpr.c (cxx_eval_increment_expression): Call fold_simple on
1185 2019-09-10 Paolo Carlini <paolo.carlini@oracle.com>
1187 * decl.c (has_designator_problem): Use cp_expr_loc_or_input_loc
1189 (build_enumerator): Likewise.
1190 (cp_finish_decl): Use DECL_SOURCE_LOCATION.
1191 (grokdeclarator): Use id_loc in two error_at; change errror
1192 message about constinit together constexpr to use two ranges.
1194 2019-09-09 Marek Polacek <polacek@redhat.com>
1196 PR c++/84374 - diagnose invalid uses of decltype(auto).
1197 * decl.c (grokdeclarator): Diagnose wrong usage of decltype(auto) in
1198 a function declaration.
1200 2019-09-06 Nathan Sidwell <nathan@acm.org>
1203 * cp-tree.h (IDENTIFIER_REPO_CHOSEN, DECL_REPO_AVAILABLE_P): Delete.
1204 (struct lang_decl_base): Remove repo_available_p.
1205 * decl.c (duplicate_decls): Don't copy DECL_REPO_AVAILABLE_P.
1207 (Reserve TREE_LANG_FLAG_3 for modules.
1208 * cp-tree.h (DECL_CONSTRUCTION_VTABLE_P): Delete.
1209 (DECL_NON_TRIVIALLY_INITIALIZED_P): Move to TREE_LANG_FLAG_6.
1210 * class.c (build_ctor_vtbl_group): Don't set
1211 DECL_CONSTRUCTION_VTABLE_P.
1212 * decl2.c (determine_visibility_from_class): Don't check
1213 DECL_CONSTRUCTION_VTABLE_P anymore.
1215 2019-09-06 Martin Liska <mliska@suse.cz>
1218 * Make-lang.in: Remove repo.o.
1219 * config-lang.in: Likewise.
1220 * cp-tree.h (init_repo): Remove declarations
1221 of repo-related functions.
1222 (repo_emit_p): Likewise.
1223 (repo_export_class_p): Likewise.
1224 (finish_repo): Likewise.
1225 * decl2.c (import_export_class): Always
1227 (mark_needed): Remove -frepo from comment.
1228 (import_export_decl): Similarly here.
1229 (c_parse_final_cleanups): Remove call of finish_repo.
1230 * lex.c (cxx_init): Remove call to init_repo.
1231 * optimize.c (can_alias_cdtor): Remove dead condition.
1232 * pt.c (push_template_decl_real): Update comment.
1233 (instantiate_decl): Remove dead code used for -frepo.
1236 2019-09-05 Marek Polacek <polacek@redhat.com>
1238 PR c++/91644 - ICE with constinit in function template.
1239 * decl.c (start_decl): Call retrofit_lang_decl for constinit variables.
1240 * pt.c (tsubst_expr): Pass LOOKUP_CONSTINIT down to cp_finish_decl for
1241 constinit variables.
1243 2019-09-05 Nathan Sidwell <nathan@acm.org>
1245 * cp-tree.h (DECL_VTABLE_OR_VTT_P): Forward to DECL_VIRTUAL_P.
1247 2019-09-04 Marek Polacek <polacek@redhat.com>
1249 * call.c (build_over_call): Remove -fdeduce-init-list implementation.
1250 * pt.c (unify): Likewise.
1252 2019-09-01 Marek Polacek <polacek@redhat.com>
1254 PR c++/91129 - wrong error with binary op in template argument.
1255 * typeck.c (warn_for_null_address): Use fold_for_warn instead of
1256 fold_non_dependent_expr.
1257 (cp_build_binary_op): Likewise.
1259 2019-08-30 Jason Merrill <jason@redhat.com>
1261 Add source location to TRAIT_EXPR.
1262 * cp-tree.h (TRAIT_EXPR_LOCATION): New.
1263 (struct tree_trait_expr): Add locus field.
1264 * parser.c (cp_parser_trait_expr): Pass trait_loc down.
1265 * pt.c (tsubst_copy_and_build) [TRAIT_EXPR]: Likewise.
1266 * semantics.c (finish_trait_expr): Add location parm.
1267 * tree.c (cp_expr_location): Handle TRAIT_EXPR.
1269 2019-08-29 Paolo Carlini <paolo.carlini@oracle.com>
1271 * decl.c (check_var_type): Add location_t parameter and use it.
1272 (grokdeclarator): Adjust call.
1273 * pt.c (tsubst_decl): Likewise.
1274 * cp-tree.h: Adjust declaration.
1276 2019-08-28 Marek Polacek <polacek@redhat.com>
1278 Implement P1152R4: Deprecating some uses of volatile.
1280 * cp-gimplify.c (cp_fold): Set TREE_THIS_VOLATILE.
1281 * decl.c (grokdeclarator): Warn about a volatile-qualified structured
1282 binding and return type.
1283 (grokparms): Warn about a volatile-qualified function parameter.
1284 * expr.c (mark_use) <case MODIFY_EXPR>: Emit a -Wvolatile warning.
1285 * typeck.c (cp_build_unary_op): Emit a -Wvolatile warning for pre and
1286 post ++/-- on a volatile operand.
1287 (genericize_compound_lvalue): Use a better location. Don't lose
1289 (cp_build_modify_expr): Emit a -Wvolatile warning for a compound
1290 assignment whose LHS is volatile-qualified. Build the assignment with
1291 a more precise location.
1293 2019-08-28 Marek Polacek <polacek@redhat.com>
1295 PR c++/91360 - Implement C++20 P1143R2: constinit.
1296 * cp-tree.h (TINFO_VAR_DECLARED_CONSTINIT): Define.
1297 (LOOKUP_CONSTINIT): Define.
1298 (enum cp_decl_spec): Add ds_constinit.
1299 * decl.c (check_tag_decl): Give an error for constinit in type
1301 (check_initializer): Also check LOOKUP_CONSTINIT.
1302 (cp_finish_decl): Add checking for a constinit declaration. Set
1303 TINFO_VAR_DECLARED_CONSTINIT.
1304 (grokdeclarator): Add checking for a declaration with the constinit
1306 * lex.c (init_reswords): Handle D_CXX20.
1307 * parser.c (cp_lexer_get_preprocessor_token): Pass a better location
1308 to warning_at. Warn about C++20 keywords.
1309 (cp_keyword_starts_decl_specifier_p): Handle RID_CONSTINIT.
1310 (cp_parser_diagnose_invalid_type_name): Add an inform about constinit.
1311 (cp_parser_decomposition_declaration): Maybe pass LOOKUP_CONSTINIT to
1313 (cp_parser_decl_specifier_seq): Handle RID_CONSTINIT.
1314 (cp_parser_init_declarator): Maybe pass LOOKUP_CONSTINIT to
1316 (set_and_check_decl_spec_loc): Add "constinit".
1317 * pt.c (tsubst_decl): Set TINFO_VAR_DECLARED_CONSTINIT.
1318 (instantiate_decl): Maybe pass LOOKUP_CONSTINIT to cp_finish_decl.
1319 * typeck2.c (store_init_value): If a constinit variable wasn't
1320 initialized using a constant initializer, give an error.
1322 2019-08-28 Nathan Sidwell <nathan@acm.org>
1325 * name-lookup.c (cp_emit_debug_info): Check for builtins during
1328 2019-08-27 Marek Polacek <polacek@redhat.com>
1330 PR c++/81676 - bogus -Wunused warnings in constexpr if.
1331 * semantics.c (maybe_mark_exp_read_r): New function.
1332 (finish_if_stmt): Call it on THEN_CLAUSE and ELSE_CLAUSE.
1334 PR c++/91428 - warn about std::is_constant_evaluated in if constexpr.
1335 * cp-tree.h (decl_in_std_namespace_p): Declare.
1336 * semantics.c (is_std_constant_evaluated_p): New.
1337 (finish_if_stmt_cond): Warn about "std::is_constant_evaluated ()" in
1339 * typeck.c (decl_in_std_namespace_p): No longer static.
1341 2019-08-26 Jason Merrill <jason@redhat.com>
1343 * decl.c (duplicate_decls): Always merge DECL_DECLARED_CONSTEXPR_P.
1345 2019-08-26 Marek Polacek <polacek@redhat.com>
1347 PR c++/91545 - ICE in constexpr store evaluation.
1348 * constexpr.c (cxx_eval_store_expression): Check FIELD_DECL instead
1351 2019-08-24 Nathan Sidwell <nathan@acm.org>
1353 * class.c (check_for_overrides): Conversion operators need
1356 2019-08-24 Paolo Carlini <paolo.carlini@oracle.com>
1358 * semantics.c (finish_switch_cond): Improve error message location.
1360 2019-08-23 Jason Merrill <jason@redhat.com>
1362 * decl2.c (decl_dependent_p): New.
1363 (mark_used): Check it instead of just processing_template_decl.
1365 2019-08-23 Jason Merrill <jason@redhat.com>
1367 * parser.c (cp_parser_nested_name_specifier_opt): Avoid redundant
1370 2019-08-23 Marek Polacek <polacek@redhat.com>
1372 PR c++/91521 - wrong error with operator->.
1373 * decl.c (grokdeclarator): Return error_mark_node for an invalid
1374 trailing return type.
1376 PR c++/79817 - attribute deprecated on namespace.
1377 * cp-tree.h (cp_warn_deprecated_use_scopes): Declare.
1378 * decl.c (grokdeclarator): Call cp_warn_deprecated_use_scopes.
1379 (type_is_deprecated): Likewise.
1380 * decl2.c (cp_warn_deprecated_use_scopes): New function.
1381 * name-lookup.c (handle_namespace_attrs): Handle attribute deprecated.
1382 * parser.c (cp_parser_namespace_alias_definition): Call
1383 cp_warn_deprecated_use_scopes.
1384 (cp_parser_using_declaration): Likewise.
1385 (cp_parser_using_directive): Likewise.
1386 * semantics.c (finish_id_expression_1): Likewise.
1388 2019-08-23 Nathan Sidwell <nathan@acm.org>
1390 * class.c (check_for_override): Checking IDENTIFIER_VIRTUAL_P is
1391 sufficient, reorder DECL_OVERRIDE_P check.
1393 2019-08-23 Iain Sandoe <iain@sandoe.co.uk>
1396 * parser.c (cp_parser_initial_pragma): Call c_common_no_more_pch ()
1397 after determining that the first token is not
1398 PRAGMA_GCC_PCH_PREPROCESS.
1400 2019-08-22 Marek Polacek <polacek@redhat.com>
1402 PR c++/91304 - prefix attributes ignored in condition.
1403 * parser.c (cp_parser_condition): Handle prefix attributes.
1405 2019-08-21 Richard Sandiford <richard.sandiford@arm.com>
1408 * decl.c (duplicate_decls): Call copy_attributes_to_builtin inside
1409 the BUILT_IN_NORMAL block rather than afterward.
1411 2019-08-19 Marek Polacek <polacek@redhat.com>
1413 PR c++/91264 - detect modifying const objects in constexpr.
1414 * constexpr.c (modifying_const_object_error): New function.
1415 (cxx_eval_call_expression): Set TREE_READONLY on a CONSTRUCTOR of
1416 a const-qualified object after it's been fully constructed.
1417 (modifying_const_object_p): New function.
1418 (cxx_eval_store_expression): Detect modifying a const object
1419 during constant expression evaluation.
1420 (cxx_eval_increment_expression): Use a better location when building
1422 (cxx_eval_constant_expression) <case DECL_EXPR>: Mark a constant
1423 object's constructor TREE_READONLY.
1425 2019-08-15 Jason Merrill <jason@redhat.com>
1427 PR c++/90393 - ICE with thow in ?:
1429 PR c++/64372, DR 1560 - Gratuitous lvalue-to-rvalue conversion in ?:
1430 * tree.c (lvalue_kind): Handle throw in one arm.
1431 * typeck.c (rationalize_conditional_expr): Likewise.
1432 (cp_build_modify_expr): Likewise.
1434 2019-08-14 Jason Merrill <jason@redhat.com>
1436 Implement P0848R3, Conditionally Trivial Special Member Functions.
1437 * tree.c (special_memfn_p): New.
1438 * class.c (add_method): When overloading, hide ineligible special
1440 (check_methods): Set TYPE_HAS_COMPLEX_* here.
1441 * decl.c (grok_special_member_properties): Not here.
1442 * name-lookup.c (push_class_level_binding_1): Move overloaded
1443 functions case down, accept FUNCTION_DECL as target_decl.
1445 2019-08-14 Jonathan Wakely <jwakely@redhat.com>
1448 * name-lookup.c (get_std_name_hint): Fix min_dialect field for
1449 complex_literals and make_unique entries.
1451 2019-08-14 Jakub Jelinek <jakub@redhat.com>
1452 Marek Polacek <polacek@redhat.com>
1454 PR c++/91391 - bogus -Wcomma-subscript warning.
1455 * parser.c (cp_parser_postfix_open_square_expression): Don't warn about
1456 a deprecated comma here. Pass warn_comma_subscript down to
1457 cp_parser_expression.
1458 (cp_parser_expression): New bool parameter. Warn about uses of a comma
1459 operator within a subscripting expression.
1460 (cp_parser_skip_to_closing_square_bracket): Revert to pre-r274121 state.
1461 (cp_parser_skip_to_closing_square_bracket_1): Remove.
1463 2019-08-14 Jonathan Wakely <jwakely@redhat.com>
1465 * name-lookup.c (get_std_name_hint): Add more entries.
1467 2019-08-14 Paolo Carlini <paolo.carlini@oracle.com>
1469 * decl2.c (grok_array_decl): Use the location of the open square
1470 bracket in error message about invalid types.
1472 2019-08-14 Paolo Carlini <paolo.carlini@oracle.com>
1474 * decl.c (grokdeclarator): Check here for typedef a function
1475 definition or a member function definition.
1476 (start_function): Adjust.
1477 (grokmethod): Likewise.
1479 2019-08-13 Richard Sandiford <richard.sandiford@arm.com>
1482 * decl.c (duplicate_decls): Use copy_decl_built_in_function.
1483 * pt.c (declare_integer_pack): Use set_decl_built_in_function.
1485 2019-08-13 Marek Polacek <polacek@redhat.com>
1487 PR c++/90473 - wrong code with nullptr in default argument.
1488 * call.c (null_ptr_cst_p): Update quote from the standard.
1489 * decl.c (check_default_argument): Don't return nullptr when the arg
1492 2019-08-13 Marek Polacek <polacek@redhat.com>
1494 * cp-tree.h (DECL_MUTABLE_P): Use FIELD_DECL_CHECK.
1496 2019-08-10 Jakub Jelinek <jakub@redhat.com>
1498 * parser.c (cp_parser_omp_clause_name): Parse device_type.
1499 (cp_parser_omp_clause_device_type): New function.
1500 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_DEVICE_TYPE.
1501 (OMP_DECLARE_TARGET_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_DEVICE_TYPE.
1502 (cp_parser_omp_declare_target): Handle device_type clauses. Remove
1503 diagnostics for declare target with clauses nested in clause-less
1504 declare target declaration-definition-seq.
1505 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_DEVICE_TYPE.
1507 2019-08-09 Jakub Jelinek <jakub@redhat.com>
1509 * parser.c (check_no_duplicate_clause): Simplify using
1511 (cp_parser_omp_clause_if): Fix up printing of target {enter,exit} data
1512 directive name modifiers.
1515 * parser.c (cp_parser_omp_clause_dist_schedule): Comment out the
1516 check_no_duplicate_clause call, instead emit a warning for duplicate
1517 dist_schedule clauses.
1519 2019-08-08 Paolo Carlini <paolo.carlini@oracle.com>
1521 * decl.c (grokdeclarator): Use id_loc and EXPR_LOCATION in
1522 a few error messages.
1524 2019-08-08 Marek Polacek <polacek@redhat.com>
1526 PR c++/87519 - bogus warning with -Wsign-conversion.
1527 * typeck.c (cp_build_binary_op): Use same_type_p instead of comparing
1530 * constexpr.c (inline_asm_in_constexpr_error): New.
1531 (cxx_eval_constant_expression) <case ASM_EXPR>: Call it.
1532 (potential_constant_expression_1) <case ASM_EXPR>: Likewise.
1534 2019-08-08 Jakub Jelinek <jakub@redhat.com>
1536 * semantics.c (finish_omp_clauses): For C_ORT_OMP
1537 OMP_CLAUSE_USE_DEVICE_* clauses use oacc_reduction_head bitmap
1538 instead of generic_head to track duplicates.
1540 2019-08-07 Marek Polacek <polacek@redhat.com>
1542 PR c++/81429 - wrong parsing of constructor with C++11 attribute.
1543 * parser.c (cp_parser_constructor_declarator_p): Handle the scenario
1544 when a parameter declaration begins with [[attribute]].
1546 2019-08-07 Marek Polacek <polacek@redhat.com>
1548 PR c++/91346 - Implement P1668R1, allow unevaluated asm in constexpr.
1549 * constexpr.c (cxx_eval_constant_expression): Handle ASM_EXPR.
1550 (potential_constant_expression_1) <case ASM_EXPR>: Allow.
1551 * cp-tree.h (finish_asm_stmt): Adjust.
1552 * parser.c (cp_parser_asm_definition): Grab the locaion of "asm" and
1553 use it. Change an error to a pedwarn. Allow asm in C++2a, warn
1555 * pt.c (tsubst_expr): Pass a location down to finish_asm_stmt.
1556 * semantics.c (finish_asm_stmt): New location_t parameter. Use it.
1558 2019-08-07 Jakub Jelinek <jakub@redhat.com>
1560 * parser.c (cp_parser_omp_clause_name): Parse use_device_addr clause.
1561 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR.
1562 (OMP_TARGET_DATA_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR.
1563 (cp_parser_omp_target_data): Handle PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR
1564 like PRAGMA_OMP_CLAUSE_USE_DEVICE_PTR, adjust diagnostics about no
1565 map or use_device_* clauses.
1566 * semantics.c (finish_omp_clauses): For OMP_CLAUSE_USE_DEVICE_PTR
1567 in OpenMP, require pointer or reference to pointer type rather than
1568 pointer or array or reference to pointer or array type. Handle
1569 OMP_CLAUSE_USE_DEVICE_ADDR.
1570 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_USE_DEVICE_ADDR.
1572 2019-08-06 Jason Merrill <jason@redhat.com>
1574 PR c++/91378 - ICE with noexcept and auto return type.
1575 * pt.c (maybe_instantiate_noexcept): push_to_top_level.
1577 2019-08-06 Paolo Carlini <paolo.carlini@oracle.com>
1579 * decl.c (check_array_designated_initializer): Use
1580 cp_expr_loc_or_input_loc in one place.
1582 2019-08-06 Jakub Jelinek <jakub@redhat.com>
1584 * parser.c (cp_parser_omp_for_loop): For OMP_LOOP, ignore parallel
1585 clauses and predetermine iterator as lastprivate.
1586 * semantics.c (handle_omp_for_class_iterator): Use
1587 OMP_CLAUSE_LASTPRIVATE_LOOP_IV instead of
1588 OMP_CLAUSE_LASTPRIVATE_TASKLOOP_IV, set it for lastprivate also
1589 on OMP_LOOP construct. If a clause is missing for class iterator
1590 on OMP_LOOP, add firstprivate clause, and if there is private
1591 clause, turn it into firstprivate too.
1592 (finish_omp_for): Formatting fix. For OMP_LOOP, adjust
1593 OMP_CLAUSE_LASTPRIVATE_LOOP_IV clause CP_CLAUSE_INFO, so that it
1594 uses copy ctor instead of default ctor.
1595 * cp-gimplify.c (cp_gimplify_expr): Handle OMP_LOOP like
1597 (cp_fold_r): Likewise.
1598 (cp_genericize_r): Likewise.
1599 (cxx_omp_finish_clause): Also finish lastprivate clause with
1600 OMP_CLAUSE_LASTPRIVATE_LOOP_IV flag.
1601 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_BIND.
1602 (tsubst_omp_for_iterator): For OMP_LOOP, ignore parallel
1603 clauses and predetermine iterator as lastprivate.
1604 * constexpr.c (potential_constant_expression_1): Handle OMP_LOOP
1605 like OMP_DISTRIBUTE etc.
1607 2019-08-05 Marek Polacek <polacek@redhat.com>
1609 DR 2413 - typename in conversion-function-ids.
1610 * parser.c (cp_parser_conversion_type_id): Call
1611 cp_parser_type_specifier_seq with CP_PARSER_FLAGS_TYPENAME_OPTIONAL
1612 instead of CP_PARSER_FLAGS_NONE.
1614 2019-08-05 Paolo Carlini <paolo.carlini@oracle.com>
1616 * cp-tree.h (cp_expr_loc_or_input_loc): New.
1617 (cxx_incomplete_type_diagnostic): Use it.
1618 * call.c (build_converted_constant_expr_internal, convert_like_real,
1619 convert_arg_to_ellipsis, convert_for_arg_passing, build_over_call,
1620 build_cxx_call, perform_implicit_conversion_flags,
1621 initialize_reference): Likewise.
1622 * constexpr.c (cxx_eval_internal_function, cxx_eval_call_expression,
1623 eval_and_check_array_index, cxx_eval_store_expression,
1624 cxx_eval_statement_list, cxx_eval_loop_expr,
1625 cxx_eval_constant_expression, potential_constant_expression_1):
1627 * constraint.cc (check_for_logical_overloads,
1628 satisfy_predicate_constraint): Likewise.
1629 * cp-gimplify.c (cp_gimplify_expr): Likewise.
1630 * cvt.c (cp_convert_to_pointer, convert_to_reference,
1631 cp_convert_and_check, ocp_convert, maybe_warn_nodiscard): Likewise.
1632 * decl.c (pop_switch): Likewise.
1633 * decl2.c (delete_sanity): Likewise.
1634 * error.c (location_of): Likewise.
1635 * init.c (maybe_warn_list_ctor, build_aggr_init,
1636 warn_placement_new_too_small, build_new_1, build_vec_init): Likewise.
1637 * lex.c (unqualified_name_lookup_error): Likewise.
1638 * parser.c (cp_parser_initializer_list, cp_parser_omp_for_cond):
1640 * pt.c (check_for_bare_parameter_packs, check_valid_ptrmem_cst_expr,
1641 unify_arg_conversion, convert_nontype_argument,
1642 tsubst_copy_and_build, resolve_typename_type): Likewise.
1643 * semantics.c (maybe_convert_cond, finish_call_expr,
1644 cp_build_vec_convert): Likewise.
1645 * typeck.c (decay_conversion, rationalize_conditional_expr,
1646 cp_build_unary_op, build_x_compound_expr_from_list,
1647 maybe_warn_about_returning_address_of_local,
1648 maybe_warn_pessimizing_move): Likewise.
1649 * typeck2.c (check_narrowing, digest_init_r,
1650 process_init_constructor_array): Likewise.
1652 2019-08-05 Tom Honermann <tom@honermann.net>
1654 * parser.c (cp_parser_template_declaration_after_parameters): Enable
1655 class template argument deduction for non-type template parameters
1656 in literal operator templates.
1658 2019-08-05 Marek Polacek <polacek@redhat.com>
1660 PR c++/91338 - Implement P1161R3: Deprecate a[b,c].
1661 * parser.c (cp_parser_postfix_open_square_expression): Warn about uses
1662 of a comma operator within a subscripting expression.
1663 (cp_parser_skip_to_closing_square_bracket_1): New function, made out
1665 (cp_parser_skip_to_closing_square_bracket): ...this.
1667 2019-08-05 Jason Merrill <jason@redhat.com>
1669 * semantics.c (force_paren_expr): Preserve location.
1671 2019-08-02 Marek Polacek <polacek@redhat.com>
1673 PR c++/91230 - wrong error with __PRETTY_FUNCTION__ and generic lambda.
1674 * pt.c (value_dependent_expression_p): Consider __PRETTY_FUNCTION__
1675 inside a template function value-dependent.
1677 2019-08-02 Paolo Carlini <paolo.carlini@oracle.com>
1679 * tree.c (handle_nodiscard_attribute): Do not warn about nodiscard
1680 applied to a constructor.
1682 2019-08-02 Martin Liska <mliska@suse.cz>
1684 * decl.c (grok_op_properties):
1685 Mark DECL_SET_IS_OPERATOR_DELETE for user-provided delete operators.
1687 2019-08-01 Martin Sebor <msebor@redhat.com>
1690 * decl.c (reshape_init_array_1): Avoid truncating initializer
1691 lists containing string literals.
1693 2019-08-01 Marek Polacek <polacek@redhat.com>
1695 PR c++/90805 - detect narrowing in case values.
1696 * decl.c (case_conversion): Detect narrowing in case values.
1698 2019-07-31 Paolo Carlini <paolo.carlini@oracle.com>
1700 * decl2.c (delete_sanity): Improve diagnostic locations, use
1701 cp_expr_loc_or_loc in four places.
1703 2019-07-31 Jason Merrill <jason@redhat.com>
1705 PR c++/90538 - multiple expansions of capture packs
1706 * cp-tree.h (DECLTYPE_FOR_INIT_CAPTURE): Remove.
1707 * lambda.c (add_capture): Copy parameter packs from init.
1708 (lambda_capture_field_type): Always use auto for init-capture.
1709 * pt.c (uses_parameter_packs): Return tree.
1710 (tsubst) [DECLTYPE_TYPE]: Remove init-capture handling.
1711 (gen_elem_of_pack_expansion_instantiation): Don't push
1712 local_specialization_stack.
1713 (prepend_one_capture): New.
1714 (tsubst_lambda_expr): Use it. Don't touch local_specializations.
1715 (do_auto_deduction): Avoid redundant error.
1717 Fix copy_node of TEMPLATE_INFO.
1718 * cp-tree.h (struct tree_template_info): Use tree_base instead of
1719 tree_common. Add tmpl and args fields.
1720 (TI_TEMPLATE, TI_ARGS): Adjust.
1722 2019-07-30 Martin Liska <mliska@suse.cz>
1724 PR tree-optimization/91270
1725 * tree-ssa-dce.c (propagate_necessity): Mark 2nd argument
1726 of delete operator as needed.
1728 2019-07-25 Martin Liska <mliska@suse.cz>
1729 Dominik Infuhr <dominik.infuehr@theobroma-systems.com>
1732 * decl.c (cxx_init_decl_processing): Mark delete operators
1733 with DECL_SET_IS_OPERATOR_DELETE.
1735 2019-07-25 Martin Liska <mliska@suse.cz>
1737 * decl.c (duplicate_decls): Use new macros
1738 (e.g. DECL_SET_LAMBDA_FUNCTION and DECL_LAMBDA_FUNCTION_P).
1739 (cxx_init_decl_processing): Likewise.
1740 (grok_op_properties): Likewise.
1741 * parser.c (cp_parser_lambda_declarator_opt): Likewise.
1743 2019-07-24 Martin Sebor <msebor@redhat.com>
1746 * decl.c (finish_function): Use lang_mask.
1748 2019-07-20 Jason Merrill <jason@redhat.com>
1750 * cp-tree.h (ovl_iterator::using_p): A USING_DECL by itself was also
1751 introduced by a using-declaration.
1753 2019-07-20 Jason Merrill <jason@redhat.com>
1755 Reduce memory consumption for push/pop_access_scope.
1756 * name-lookup.c (leave_scope): Do add class levels other than
1757 previous_class_level to free_binding_level.
1758 (invalidate_class_lookup_cache): Move from class.c, add to
1760 * pt.c (saved_access_scope): Change from list to vec.
1762 2019-07-20 Jakub Jelinek <jakub@redhat.com>
1764 * cp-tree.h (OMP_FOR_GIMPLIFYING_P): Use OMP_LOOPING_CHECK
1765 instead of OMP_LOOP_CHECK.
1766 * parser.c (cp_parser_omp_clause_name): Handle bind clause.
1767 (cp_parser_omp_clause_bind): New function.
1768 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_BIND.
1769 (OMP_LOOP_CLAUSE_MASK): Define.
1770 (cp_parser_omp_loop): New function.
1771 (cp_parser_omp_parallel, cp_parser_omp_teams): Handle parsing of
1772 loop combined with parallel or teams.
1773 (cp_parser_omp_construct): Handle PRAGMA_OMP_LOOP.
1774 (cp_parser_pragma): Likewise.
1775 * pt.c (tsubst_expr): Handle OMP_LOOP.
1776 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_BIND.
1778 2019-07-19 Jason Merrill <jason@redhat.com>
1780 PR c++/90101 - dependent class non-type parameter.
1781 * pt.c (invalid_nontype_parm_type_p): Check for dependent class type.
1783 2019-07-18 Jason Merrill <jason@redhat.com>
1785 PR c++/90098 - partial specialization and class non-type parms.
1788 * call.c (build_converted_constant_expr_internal): Don't copy.
1789 * pt.c (process_partial_specialization): Allow VIEW_CONVERT_EXPR
1790 around class non-type parameter.
1791 (unify) [TEMPLATE_PARM_INDEX]: Ignore cv-quals.
1793 2019-07-16 Jason Merrill <jason@redhat.com>
1795 * parser.c (make_location): Add overload taking cp_lexer* as last
1798 * parser.c (cp_parser_simple_type_specifier): Separate tentative
1799 parses for optional type-spec and CTAD.
1801 * parser.c (cp_parser_nested_name_specifier_opt): If the token is
1802 already CPP_NESTED_NAME_SPECIFIER, leave it alone.
1804 2019-07-12 Jakub Jelinek <jakub@redhat.com>
1806 * parser.c (cp_parser_omp_clause_name): Handle order clause.
1807 (cp_parser_omp_clause_order): New function.
1808 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_ORDER.
1809 (OMP_SIMD_CLAUSE_MASK, OMP_FOR_CLAUSE_MASK): Add
1810 PRAGMA_OMP_CLAUSE_ORDER.
1811 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_ORDER.
1812 * pt.c (tsubst_omp_clauses): Likewise.
1814 2019-07-10 Paolo Carlini <paolo.carlini@oracle.com>
1816 * decl.c (get_type_quals,
1817 smallest_type_location (const cp_decl_specifier_seq*)): New.
1818 (check_tag_decl): Use smallest_type_location in error_at about
1819 multiple types in one declaration.
1820 (grokdeclarator): Use locations[ds_complex] in error_at about
1821 complex invalid; use locations[ds_storage_class] in error_at
1822 about static cdtor; use id_loc in error_at about flexible
1823 array member in union; use get_type_quals.
1825 2019-07-09 Martin Sebor <msebor@redhat.com>
1828 * cp-tree.h: Change class-key of PODs to struct and others to class.
1830 * semantics.c (finalize_nrv_r): Same.
1832 2019-07-09 Martin Sebor <msebor@redhat.com>
1835 * constexpr.c (cxx_eval_call_expression): Change class-key from class
1836 to struct and vice versa to match convention and avoid -Wclass-is-pod
1837 and -Wstruct-no-pod.
1838 * constraint.cc (get_concept_definition): Same.
1840 * cxx-pretty-print.h: Same.
1842 * logic.cc (term_list::replace): Same.
1843 * name-lookup.c (find_local_binding): Same.
1844 * pt.c (tsubst_binary_right_fold): Same.
1845 * search.c (field_accessor_p): Same.
1846 * semantics.c (expand_or_defer_fn): Same.
1848 2019-07-08 Jakub Jelinek <jakub@redhat.com>
1851 * decl2.c (cp_omp_mappable_type_1): Don't emit any note for
1852 error_mark_node type.
1854 2019-07-05 Jakub Jelinek <jakub@redhat.com>
1858 * call.c (build_new_method_call_1): Remove set but not used variable
1861 2019-07-05 Paolo Carlini <paolo.carlini@oracle.com>
1863 PR c++/67184 (again)
1865 * call.c (build_over_call): Devirtualize user-defined operators
1866 coming from a base too.
1867 (build_new_method_call_1): Do not devirtualize here.
1869 2019-07-04 Marek Polacek <polacek@redhat.com>
1872 PR c++/83374 - __is_standard_layout wrong for a class with repeated
1874 * class.c (check_bases): Set CLASSTYPE_NON_STD_LAYOUT for a class if
1875 CLASSTYPE_REPEATED_BASE_P is true.
1877 2019-07-04 Andrew Stubbs <ams@codesourcery.com>
1879 * cp-tree.h (cp_omp_emit_unmappable_type_notes): New prototype.
1880 * decl.c (cp_finish_decl): Call cp_omp_emit_unmappable_type_notes.
1881 * decl2.c (cp_omp_mappable_type): Move contents to ...
1882 (cp_omp_mappable_type_1): ... here and add note output.
1883 (cp_omp_emit_unmappable_type_notes): New function.
1884 * semantics.c (finish_omp_clauses): Call
1885 cp_omp_emit_unmappable_type_notes in four places.
1887 2019-07-03 Martin Liska <mliska@suse.cz>
1889 * call.c (build_new_op_1): Remove dead assignemts.
1890 * typeck.c (cp_build_binary_op): Likewise.
1892 2019-06-27 Jason Merrill <jason@redhat.com>
1894 PR c++/55442 - memory-hog with highly recursive constexpr.
1895 * constexpr.c (push_cx_call_context): Return depth.
1896 (cxx_eval_call_expression): Don't cache past constexpr_cache_depth.
1898 2019-06-27 Jan Hubicka <jh@suse.cz>
1900 * class.c (layout_class_type): Set TYPE_CXX_ODR_P for as-base
1903 2019-06-27 Martin Liska <mliska@suse.cz>
1905 * class.c (adjust_clone_args): Remove obviously
1907 (dump_class_hierarchy_r): Likewise.
1908 * decl.c (check_initializer): Likewise.
1909 * parser.c (cp_parser_lambda_expression): Likewise.
1910 * pt.c (unify_bound_ttp_args): Likewise.
1911 (convert_template_argument): Likewise.
1912 * rtti.c (build_headof): Likewise.
1913 * typeck.c (convert_for_initialization): Likewise.
1915 2019-06-25 Jason Merrill <jason@redhat.com>
1917 PR c++/70462 - unnecessary base ctor variant with final.
1918 * optimize.c (populate_clone_array): Skip base variant if
1920 (maybe_clone_body): We don't need an alias if we are only defining
1923 * class.c (resolves_to_fixed_type_p): Check CLASSTYPE_FINAL.
1925 2019-06-25 Jakub Jelinek <jakub@redhat.com>
1928 * constexpr.c (cxx_eval_array_reference): Don't look through VCE from
1929 vector type if lval.
1931 2019-06-25 Jozef Lawrynowicz <jozef.l@mittosystems.com>
1933 * lex.c (init_reswords): Create keyword for "__intN__" type.
1934 * cp-tree.h (cp_decl_specifier_seq): New bitfield "int_n_alt".
1935 * decl.c (grokdeclarator): Don't pedwarn about "__intN" ISO
1936 C incompatibility if alternate "__intN__" form is used.
1937 * parser.c (cp_parser_simple_type_specifier): Set
1938 decl_specs->int_n_alt if "__intN__" form is used.
1940 2019-06-24 Jan Hubicka <jh@suse.cz>
1942 * lex.c (cxx_make_type): Set TYPE_CXX_ODR_P.
1944 2019-06-24 Jason Merrill <jason@redhat.com>
1946 * class.c (layout_class_type): Don't use a separate
1947 CLASSTYPE_AS_BASE if it's the same size.
1949 2019-06-23 Marek Polacek <polacek@redhat.com>
1951 * call.c (convert_default_arg): Use DEFERRED_PARSE instead of
1953 * cp-objcp-common.c (cp_tree_size): Likewise. Use tree_deferred_parse
1954 instead of tree_default_arg.
1955 * cp-tree.def: Rename DEFAULT_ARG to DEFERRED_PARSE.
1956 * cp-tree.h: Rename DEFARG_TOKENS to DEFPARSE_TOKENS. Rename
1957 DEFARG_INSTANTIATIONS to DEFPARSE_INSTANTIATIONS. Rename
1958 tree_default_arg to tree_deferred_parse.
1959 (UNPARSED_NOEXCEPT_SPEC_P): Use DEFERRED_PARSE instead of DEFAULT_ARG.
1960 (cp_tree_node_structure_enum): Rename TS_CP_DEFAULT_ARG to
1961 TS_CP_DEFERRED_PARSE.
1962 (lang_tree_node): Rename tree_default_arg to tree_deferred_parse.
1963 Rename default_arg to deferred_parse. Use TS_CP_DEFERRED_PARSE instead
1964 of TS_CP_DEFAULT_ARG.
1965 (defarg_location): Remove declaration.
1966 (defparse_location): Add declaration.
1967 * decl.c (grokfndecl): Use DEFERRED_PARSE instead of DEFAULT_ARG.
1968 Call defparse_location instead of defarg_location.
1969 (check_default_argument): Use DEFERRED_PARSE instead of DEFAULT_ARG.
1970 (cp_tree_node_structure): Likewise. Use TS_CP_DEFERRED_PARSE instead
1971 of TS_CP_DEFAULT_ARG.
1972 * decl2.c (grokfield): Use DEFERRED_PARSE instead of DEFAULT_ARG.
1973 * error.c (dump_expr): Likewise.
1974 (location_of): Likewise.
1975 * init.c (get_nsdmi): Likewise.
1976 * parser.c (cp_parser_save_noexcept): Likewise. Use DEFPARSE_TOKENS
1977 instead of DEFARG_TOKENS.
1978 (cp_parser_late_noexcept_specifier): Likewise.
1979 (cp_parser_late_parse_one_default_arg): Use DEFPARSE_TOKENS instead
1981 (cp_parser_late_parsing_default_args): Use DEFERRED_PARSE instead of
1982 DEFAULT_ARG. Use DEFPARSE_INSTANTIATIONS instead of
1983 DEFARG_INSTANTIATIONS.
1984 (cp_parser_cache_defarg): Use DEFERRED_PARSE instead of DEFAULT_ARG.
1985 Use DEFPARSE_TOKENS instead of DEFARG_TOKENS. Use
1986 DEFPARSE_INSTANTIATIONS instead of DEFARG_INSTANTIATIONS.
1987 (defparse_location): Renamed from defarg_location.
1988 * pt.c (tsubst_default_argument): Use DEFERRED_PARSE instead of
1990 (tsubst_arg_types): Likewise.
1991 (dependent_type_p_r): Likewise.
1992 * tree.c (cp_tree_equal): Likewise.
1993 (cp_walk_subtrees): Likewise.
1994 * typeck.c (convert_arguments): Likewise.
1996 2019-06-22 Marek Polacek <polacek@redhat.com>
1998 PR c++/86476 - noexcept-specifier is a complete-class context.
2000 * cp-tree.def (DEFAULT_ARG): Update commentary.
2001 * cp-tree.h (UNPARSED_NOEXCEPT_SPEC_P): New macro.
2002 (tree_default_arg): Use tree_base instead of tree_common.
2003 (do_push_parm_decls, maybe_check_overriding_exception_spec): Declare.
2004 * decl.c (do_push_parm_decls): New function, broken out of...
2005 (store_parm_decls): ...here. Call it.
2006 * except.c (nothrow_spec_p): Accept DEFAULT_ARG in the assert.
2007 * parser.c (cp_parser_noexcept_specification_opt,
2008 cp_parser_late_noexcept_specifier, noexcept_override_late_checks):
2010 (unparsed_noexcepts): New macro.
2011 (push_unparsed_function_queues): Update initializer.
2012 (cp_parser_direct_declarator): Pass FRIEND_P to
2013 cp_parser_exception_specification_opt.
2014 (inject_parm_decls): New.
2015 (pop_injected_parms): New.
2016 (cp_parser_class_specifier_1): Implement delayed parsing of
2017 noexcept-specifiers.
2018 (cp_parser_save_noexcept): New.
2019 (cp_parser_late_noexcept_specifier): New.
2020 (noexcept_override_late_checks): New.
2021 (cp_parser_noexcept_specification_opt): Add FRIEND_P parameter. Call
2022 cp_parser_save_noexcept instead of the normal processing if needed.
2023 (cp_parser_exception_specification_opt): Add FRIEND_P parameter and
2024 pass it to cp_parser_noexcept_specification_opt.
2025 (cp_parser_save_member_function_body): Fix comment.
2026 (cp_parser_save_default_args): Maybe save the noexcept-specifier to
2028 (cp_parser_transaction): Update call to
2029 cp_parser_noexcept_specification_opt.
2030 (cp_parser_transaction_expression): Likewise.
2031 * parser.h (cp_unparsed_functions_entry): Add new field to carry
2032 a noexcept-specifier.
2033 * pt.c (dependent_type_p_r): Handle unparsed noexcept expression.
2034 * search.c (maybe_check_overriding_exception_spec): New function, broken
2036 (check_final_overrider): ...here. Call
2037 maybe_check_overriding_exception_spec.
2038 * tree.c (canonical_eh_spec): Handle UNPARSED_NOEXCEPT_SPEC_P.
2039 (cp_tree_equal): Handle DEFAULT_ARG.
2041 PR c++/90881 - bogus -Wunused-value in unevaluated context.
2042 * cvt.c (convert_to_void): Don't emit unused warnings in
2043 an unevaluated context.
2045 2019-06-22 Paolo Carlini <paolo.carlini@oracle.com>
2047 * decl.c (grokdeclarator): Use id_loc, typespec_loc, and
2048 locations[ds_storage_class] in a few additional places.
2050 2019-06-21 Paolo Carlini <paolo.carlini@oracle.com>
2054 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com>
2058 * call.c (build_over_call): Devirtualize when the final overrider
2059 comes from the base.
2061 2019-06-21 Marek Polacek <polacek@redhat.com>
2063 PR c++/61490 - qualified-id in friend function definition.
2064 * decl.c (grokdeclarator): Diagnose qualified-id in friend function
2065 definition. Improve location for diagnostics of friend functions.
2067 PR c++/60223 - ICE with T{} in non-deduced context.
2068 * pt.c (unify): Allow COMPOUND_LITERAL_P in a non-deduced context.
2070 PR c++/64235 - missing syntax error with invalid alignas.
2071 * parser.c (cp_parser_std_attribute_spec): Commit to tentative parse
2072 if there's a missing close paren.
2074 PR c++/90490 - fix decltype issues in noexcept-specifier.
2075 * except.c (build_noexcept_spec): Call
2076 instantiate_non_dependent_expr_sfinae before
2077 build_converted_constant_expr instead of calling
2078 instantiate_non_dependent_expr after it. Add
2079 processing_template_decl_sentinel.
2081 2019-06-21 Jakub Jelinek <jakub@redhat.com>
2084 * semantics.c (finish_omp_clauses): Don't reject references to
2085 incomplete types if processing_template_decl.
2087 2019-06-19 Marek Polacek <polacek@redhat.com>
2089 PR c++/60364 - noreturn after first decl not diagnosed.
2090 * decl.c (duplicate_decls): Give an error when a function is
2091 declared [[noreturn]] after its first declaration.
2092 * parser.c (cp_parser_std_attribute): Don't treat C++11 noreturn
2093 attribute as equivalent to GNU's.
2094 * tree.c (std_attribute_table): Add noreturn.
2096 2019-06-19 Jakub Jelinek <jakub@redhat.com>
2098 * cp-gimplify.c (cp_genericize_r): Handle OMP_CLAUSE_{IN,EX}CLUSIVE
2099 like OMP_CLAUSE_SHARED.
2101 2019-06-18 Jason Merrill <jason@redhat.com>
2103 * constexpr.c (cxx_eval_store_expression): Delay target evaluation.
2105 2019-06-18 Jason Merrill <jason@redhat.com>
2107 * constexpr.c (eval_and_check_array_index): Split out from...
2108 (cxx_eval_array_reference): ...here.
2109 (cxx_eval_store_expression): Use it here, too.
2110 (diag_array_subscript): Take location. Strip location wrapper.
2112 2019-06-18 Jason Merrill <jason@redhat.com>
2114 * constexpr.c (cxx_eval_constant_expression): Handle conversion from
2115 and then to the same type.
2117 2019-06-18 Jason Merrill <jason@redhat.com>
2119 * constexpr.c (unshare_constructor): Add MEM_STAT_DECL.
2121 2019-06-17 Jakub Jelinek <jakub@redhat.com>
2123 * semantics.c (finish_omp_clauses): For OMP_CLAUSE_REDUCTION_INSCAN
2124 set need_copy_assignment.
2126 2019-06-17 Marek Polacek <polacek@redhat.com>
2128 PR c++/83820 - excessive attribute arguments not detected.
2129 * parser.c (cp_parser_std_attribute): Detect excessive arguments.
2131 2019-06-17 Nathan Sidwell <nathan@acm.org>
2134 * name-lookup.c (lookup_type_scope_1): Calll qualify_lookup before
2137 2019-06-14 Marek Polacek <polacek@redhat.com>
2139 PR c++/90884 - stray note with -Wctor-dtor-privacy.
2140 * class.c (maybe_warn_about_overly_private_class): Guard the call to
2143 2019-06-12 Jason Merrill <jason@redhat.com>
2145 PR c++/85552 - wrong instantiation of dtor for DMI.
2146 * typeck2.c (digest_nsdmi_init): Set tf_no_cleanup for direct-init.
2148 2019-06-13 Paolo Carlini <paolo.carlini@oracle.com>
2150 * decl.c (grokdeclarator): Use id_loc in five additional places
2151 in the last part of the function.
2153 2019-06-13 Paolo Carlini <paolo.carlini@oracle.com>
2155 * decl.c (grokdeclarator): Move further up the declaration of
2156 id_loc, use it immediately, update its value after the loop
2157 over declarator, use it again in the final part of function;
2158 improve locations of error messages about multiple data types
2159 and conflicting specifiers.
2161 2019-06-13 Richard Biener <rguenther@suse.de>
2164 * typeck2.c (split_nonconstant_init_1): Properly count
2165 num_split_elts, optimize single constructor elt removal.
2167 2019-06-12 Marek Polacek <polacek@redhat.com>
2169 PR c++/66999 - 'this' captured by reference.
2170 * parser.c (cp_parser_lambda_introducer): Reject `&this'. Use
2171 cp_lexer_nth_token_is instead of cp_lexer_peek_nth_token.
2173 PR c++/90825 - endless recursion when evaluating sizeof.
2174 PR c++/90832 - endless recursion when evaluating sizeof.
2175 * constexpr.c (cxx_eval_constant_expression): Don't recurse on the
2176 result of fold_sizeof_expr if is returns a SIZEOF_EXPR.
2177 * typeck.c (cxx_sizeof_expr): Only return a SIZEOF_EXPR if the operand
2178 is instantiation-dependent.
2180 PR c++/90736 - bogus error with alignof.
2181 * constexpr.c (adjust_temp_type): Use cv_unqualified type.
2183 2019-06-11 Matthew Beliveau <mbelivea@redhat.com>
2185 PR c++/90449 - add -Winaccessible-base option.
2186 * class.c (warn_about_ambiguous_bases): Changed name to:
2187 maybe_warn_about_inaccessible_bases.
2188 (maybe_warn_about_inaccessible_bases): Implemented new
2189 Winaccessible-base warning option for both direct and virtual
2191 (layout_class_type): Call to warn_about_ambiguous_bases changed to fit
2194 2019-06-11 Richard Biener <rguenther@suse.de>
2197 * typeck2.c (split_nonconstant_init_1): Avoid ordered remove
2198 from CONSTRUCTOR by marking to remove elements and doing all
2199 of them in a O(n) scan.
2201 2019-06-11 Jakub Jelinek <jakub@redhat.com>
2204 * init.c (constant_value_1): Handle VECTOR_CST DECL_INITIAL for
2205 !DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P decls like CONSTRUCTOR.
2207 2019-06-11 Martin Liska <mliska@suse.cz>
2210 * pt.c (init_template_processing): Disable hash table
2211 sanitization for decl_specializations and type_specializations.
2213 2019-06-10 Jason Merrill <jason@redhat.com>
2215 * constexpr.c (free_constructor): New.
2216 (cxx_eval_call_expression): Free parameter value CONSTRUCTORs.
2218 * constexpr.c (unshare_constructor): Only unshare if T is itself a
2220 (cxx_eval_call_expression): Don't call it on the result here.
2222 Reduce constexpr_call memory consumption.
2223 * constexpr.c (cxx_bind_parameters_in_call): Use TREE_VEC rather
2225 (constexpr_call_hasher::equal, cxx_bind_parameters_in_call)
2226 (cxx_eval_call_expression): Adjust.
2228 2019-06-10 Jakub Jelinek <jakub@redhat.com>
2230 * parser.c (cp_parser_omp_clause_reduction): Don't sorry_at on inscan
2232 (cp_parser_omp_scan_loop_body): New function.
2233 (cp_parser_omp_for_loop): Call cp_parser_omp_scan_loop_body if there
2234 are inscan reduction clauses.
2235 (cp_parser_pragma): Reject PRAGMA_OMP_SCAN.
2236 * semantics.c (finish_omp_clauses): Reject mixing inscan with
2237 non-inscan reductions on the same construct, or inscan reductions with
2238 ordered or schedule clauses, or inscan array reductions.
2239 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_{IN,EX}CLUSIVE.
2240 (tsubst_expr): Handle OMP_SCAN.
2242 2019-06-07 Jason Merrill <jason@redhat.com>
2244 * constexpr.c (cxx_eval_constant_expression): Call
2245 STRIP_ANY_LOCATION_WRAPPER early.
2246 [CONVERT_EXPR]: Don't build anything for conversion to void.
2247 [ADDR_EXPR]: ggc_free unused ADDR_EXPR.
2249 2019-06-05 Martin Sebor <msebor@redhat.com>
2252 * typeck.c (maybe_warn_about_returning_address_of_local): Only
2253 consider functions returning pointers as candidates for
2254 -Wreturn-local-addr.
2256 2019-06-05 Paolo Carlini <paolo.carlini@oracle.com>
2258 * decl.c (smallest_type_location): New.
2259 (check_special_function_return_type): Use it.
2260 (grokdeclarator): Lkewise.
2262 2019-06-05 Paolo Carlini <paolo.carlini@oracle.com>
2264 * decl.c (grokdeclarator): Use locations[ds_friend]
2267 2019-06-05 Martin Sebor <msebor@redhat.com>
2269 * call.c (build_conditional_expr_1): Adjust quoting and hyphenation.
2270 (convert_like_real): Same.
2271 (convert_arg_to_ellipsis): Same.
2272 * constexpr.c (diag_array_subscript): Same.
2273 * constraint.cc (diagnose_trait_expression): Same.
2274 * cvt.c (ocp_convert): Same.
2275 * decl.c (start_decl): Same.
2276 (check_for_uninitialized_const_var): Same.
2278 (check_special_function_return_type): Same.
2279 (finish_enum_value_list): Same.
2280 (start_preparsed_function): Same.
2281 * parser.c (cp_parser_decl_specifier_seq): Same.
2282 * typeck.c (cp_build_binary_op): Same.
2283 (build_static_cast_1): Same.
2285 2019-06-04 Nina Dinka Ranns <dinka.ranns@gmail.com>
2287 PR c++/63149 - Wrong auto deduction from braced-init-list.
2288 * pt.c (listify_autos): use non cv qualified auto_node in
2289 std::initializer_list<auto>.
2291 2019-06-04 Paolo Carlini <paolo.carlini@oracle.com>
2293 * decl.c (grokdeclarator): Use declarator->id_loc in two
2296 2019-06-04 Nathan Sidwell <nathan@acm.org>
2298 * name-lookup.c (lookup_type_scope_1): Reimplement, handle local
2299 and namespace scopes separately.
2301 2019-06-04 Harald van Dijk <harald@gigawatt.nl>
2303 PR c++/60531 - Wrong error about unresolved overloaded function
2304 * typeck.c (cp_build_binary_op): See if overload can be resolved.
2305 (cp_build_unary_op): Ditto.
2307 2019-06-04 Jason Merrill <jason@redhat.com>
2309 Reduce accumulated garbage in constexpr evaluation.
2310 * constexpr.c (cxx_eval_call_expression): ggc_free any bindings we
2312 (cxx_eval_increment_expression): ggc_free the MODIFY_EXPR after
2315 2019-06-04 Jakub Jelinek <jakub@redhat.com>
2317 * cp-tree.h (CP_OMP_CLAUSE_INFO): Allow for any clauses up to _condvar_
2318 instead of only up to linear.
2320 2019-06-03 Paolo Carlini <paolo.carlini@oracle.com>
2322 * parser.c (cp_parser_unqualified_id): Use build_min_nt_loc in
2325 2019-06-01 Ville Voutilainen <ville.voutilainen@gmail.com>
2328 * class.c (fixup_type_variants): Handle CLASSTYPE_FINAL.
2330 2019-05-31 Nathan Sidwell <nathan@acm.org>
2332 * cp-tree.h (IDENTIFIER_LAMBDA_P): New.
2334 (LAMBDA_TYPE_P, TYPE_UNNAMED_P): Likewise.
2335 (LAMBDANAME_PREFIX, LAMBDANAME_FORMAT): Delete.
2336 (make_lambda_name): Don't declare.
2337 * error.c (dump_aggr_type): Check for lambdas before other
2339 * lambda.c (begin_lambda_type): Use make_anon_name.
2340 * cp-lang.c (cxx_dwarf_name): Lambda names smell anonymous.
2341 * mangle.c (write_local_name): Likewise.
2342 * name-lookup.c (lambda_cnt, make_lambda_name): Delete.
2344 2019-05-30 Marek Polacek <polacek@redhat.com>
2346 * cp-tree.h (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Fix a typo.
2348 2019-05-31 Paolo Carlini <paolo.carlini@oracle.com>
2350 * decl.c (grokdeclarator): Use declarator->id_loc in five
2353 2019-05-29 Jakub Jelinek <jakub@redhat.com>
2356 * tree.c (lvalue_kind): Return clk_none for expressions with
2359 2019-05-29 Paolo Carlini <paolo.carlini@oracle.com>
2362 * parser.c (cp_parser_sizeof_operand): When the type-id production
2363 did not work out commit to the tentative parse.
2365 2019-05-29 Jakub Jelinek <jakub@redhat.com>
2367 P1091R3 - Extending structured bindings to be more like var decls
2368 P1381R1 - Reference capture of structured bindings
2369 * decl.c (cp_maybe_mangle_decomp): Handle TREE_STATIC decls even at
2371 (cp_finish_decomp): Copy over various decl properties from decl to
2372 v[i] in the tuple case.
2373 (grokdeclarator): Allow static, thread_local and __thread for C++2a
2374 and use pedwarn instead of error for older standard revisions.
2375 Make other structured binding diagnostic messages more i18n friendly.
2377 2019-05-28 Nathan Sidwell <nathan@acm.org>
2379 * decl.c (duplicate_decls): Assert a template newdecl has no
2382 2019-05-28 Marek Polacek <polacek@redhat.com>
2384 PR c++/90548 - ICE with generic lambda and empty pack.
2385 * pt.c (tsubst_copy_and_build): Handle pack expansion properly.
2387 2019-05-28 Nathan Sidwell <nathan@acm.org>
2389 * cp-tree.h (make_anon_name): Drop declaration.
2390 (TYPE_UNNAMED_P): Use IDENTIFIER_ANON_P.
2391 * cp-lang.c (cxx_dwarf_name): Likewise.
2392 * class.c (find_flexarrays): Likewise.
2393 * decl.c (name_unnamed_type, xref_tag_1): Likewise.
2394 * error.c (dump_aggr_type): Likewise.
2395 * pt.c (push_template_decl_real): Likewise.
2396 * name-lookup.c (consider_binding_level): Likewise.
2397 (anon_cnt, make_anon_name): Delete.
2399 2019-05-25 Marek Polacek <polacek@redhat.com>
2401 PR c++/90572 - wrong disambiguation in friend declaration.
2402 * parser.c (cp_parser_constructor_declarator_p): Don't allow missing
2403 typename for friend declarations.
2405 2019-05-23 Jonathan Wakely <jwakely@redhat.com>
2407 * cp-tree.h (CP_AGGREGATE_TYPE_P): Fix whitespace.
2409 * init.c (std_placement_new_fn_p): Remove outdated TODO comment that
2410 was resolved by r254694.
2412 2019-05-22 Jason Merrill <jason@redhat.com>
2414 PR c++/20408 - unnecessary code for empty struct.
2415 * call.c (build_call_a): Use simple_empty_class_p.
2417 PR c++/86485 - -Wmaybe-unused with empty class ?:
2418 * cp-gimplify.c (simple_empty_class_p): Also true for MODIFY_EXPR.
2420 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com>
2422 * parser.c (cp_parser_template_declaration_after_parameters): Use
2423 DECL_SOURCE_LOCATION in literal operator template errors.
2425 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com>
2429 * call.c (build_over_call): Devirtualize when the final overrider
2430 comes from the base.
2432 2019-05-21 Nathan Sidwell <nathan@acm.org>
2434 * name-lookup.c (do_nonmember_using_decl): Drop INSERT_P
2435 parameter. Document.
2436 (finish_nonmember_using_decl): Adjust do_nonmember_using_decl
2437 calls. Remove stray FIXME comment.
2439 * name-lookup.h (struct cp_binding_level): Drop usings field.
2440 (finish_namespace_using_decl, finish_local_using_decl): Replace with ...
2441 (finish_nonmember_using_decl): ... this.
2442 * name-lookup.c (push_using_decl_1, push_using_decl):
2443 (do_nonmember_using_decl): ... here. Add INSERT_P arg. Reimplement.
2444 (validate_nonmember_using_decl, finish_namespace_using_decl)
2445 (finish_local_using_decl): Replace with ...
2446 (finish_nonmember_using_decl): ... this. Drop DECL parm.
2447 * parser.c (cp_parser_using_declaration): Don't do lookup here.
2448 * pt.c (tsubst_expr): Do not do using decl lookup here.
2450 2019-05-21 Eric Botcazou <ebotcazou@adacore.com>
2452 * decl2.c (cpp_check) <IS_ASSIGNMENT_OPERATOR>: New case.
2454 2019-05-20 Marek Polacek <polacek@redhat.com>
2456 CWG 2094 - volatile scalars are trivially copyable.
2458 * tree.c (trivially_copyable_p): Don't check CP_TYPE_VOLATILE_P for
2461 2019-05-20 Marek Polacek <polacek@redhat.com>
2463 * pt.c (convert_template_argument): Add a diagnostic for the
2464 [temp.arg]/2 ambiguity case.
2466 * name-lookup.c (finish_using_directive): Don't issue inform() if the
2467 warning didn't trigger. Add quoting. Tweak the inform message.
2469 2019-05-20 Paolo Carlini <paolo.carlini@oracle.com>
2471 * cp-tree.h: Remove remnants of CONV_NONCONVERTING.
2473 2019-05-20 Nathan Sidwell <nathan@acm.org>
2475 * name-lookup.c (finish_namespace_using_directive)
2476 (finish_local_using_directive): Merge to ...
2477 (finish_using_directive): ... here. Handle both contexts.
2478 * name-lookup.h (finish_namespace_using_directive)
2479 (finish_local_using_directive): Replace with ...
2480 (finish_using_directive): ... this.
2481 * parser.c (cp_parser_using_directive): Adjust.
2482 * pt.c (tsubst_expr): Likewise.
2484 * cp-tree.h (struct lang_decl_ns): Remove usings field.
2485 (DECL_NAMESPACE_USING): Delete.
2486 * name-lookup.c (name_lookup::search_usings): Use namespace's
2488 (name_lookup::queue_namespae): Likewise.
2489 (finish_namespace_using_directive, push_namespace): Likewise.
2490 (has_using_namespace_std_directive): Just search the entire
2493 2019-05-20 Jonathan Wakely <jwakely@redhat.com>
2495 PR c++/90532 Ensure __is_constructible(T[]) is false
2496 * method.c (is_xible_helper): Return error_mark_node for construction
2497 of an array of unknown bound.
2499 2019-05-17 Thomas Schwinge <thomas@codesourcery.com>
2502 * parser.c (cp_finalize_oacc_routine): Rework checking if already
2503 marked with an OpenACC 'routine' directive.
2506 * parser.c (cp_parser_oacc_routine)
2507 (cp_parser_late_parsing_oacc_routine): Normalize order of clauses.
2508 (cp_finalize_oacc_routine): Call oacc_verify_routine_clauses.
2511 * parser.c (cp_finalize_oacc_routine): Refer to OpenACC 'routine'
2512 clauses from "omp declare target" attribute.
2514 2019-05-16 Martin Sebor <msebor@redhat.com>
2516 * call.c (print_z_candidate): Wrap diagnostic text in a gettext
2518 (print_z_candidates): Same.
2519 (build_conditional_expr_1): Quote keywords, operators, and types
2521 (build_op_delete_call): Same.
2522 (maybe_print_user_conv_context): Wrap diagnostic text in a gettext
2524 (convert_like_real): Same.
2525 (convert_arg_to_ellipsis): Quote keywords, operators, and types
2527 (build_over_call): Same.
2528 (joust): Break up an overlong line. Wrap diagnostic text in a gettext
2530 * constexpr.c (cxx_eval_check_shift_p): Spell out >= in English.
2531 (cxx_eval_constant_expression): Quote keywords, operators, and types
2533 (potential_constant_expression_1): Same.
2534 * cp-gimplify.c (cp_genericize_r): Same.
2535 * cvt.c (maybe_warn_nodiscard): Quote keywords, operators, and types
2537 (type_promotes_to): Same.
2538 * decl.c (check_previous_goto_1): Same.
2541 (cp_finish_decl): Avoid parenthesizing a sentence for consistency.
2542 (grok_op_properties): Quote keywords, operators, and types
2544 * decl2.c (grokfield): Same.
2545 (coerce_delete_type): Same.
2546 * except.c (is_admissible_throw_operand_or_catch_parameter): Same.
2547 * friend.c (do_friend): Quote C++ tokens.
2548 * init.c (build_new_1): Quote keywords, operators, and types
2550 (build_vec_delete_1): Same.
2551 (build_delete): Same.
2552 * lex.c (parse_strconst_pragma): Same.
2553 (handle_pragma_implementation): Same.
2554 (unqualified_fn_lookup_error): Same.
2555 * mangle.c (write_type): Same.
2556 * method.c (defaulted_late_check): Avoid two consecutive punctuators.
2557 * name-lookup.c (cp_binding_level_debug): Remove a trailing newline.
2558 (pop_everything): Same.
2559 * parser.c (cp_lexer_start_debugging): Quote a macro name.
2561 (cp_lexer_stop_debugging): Same.
2562 (cp_parser_userdef_numeric_literal): Quote a C++ header name
2564 (cp_parser_nested_name_specifier_opt): Quote keywords, operators,
2565 and types in diagnostics.
2566 (cp_parser_question_colon_clause): Same.
2567 (cp_parser_asm_definition): Same.
2568 (cp_parser_init_declarator): Same.
2569 (cp_parser_template_declaration_after_parameters): Avoid capitalizing
2570 a sentence in a diagnostic.
2571 (cp_parser_omp_declare_reduction): Quote keywords, operators, and types
2573 (cp_parser_transaction): Same.
2574 * pt.c (maybe_process_partial_specialization): Replace second call
2575 to permerror with inform for consistency with other uses.
2576 (expand_integer_pack): Quote keywords, operators, and types
2578 * rtti.c (get_typeid): Quote keywords, operators, and types
2580 (build_dynamic_cast_1): Same.
2581 * semantics.c (finish_asm_stmt): Same.
2582 (finish_label_decl): Same.
2583 (finish_bases): Same.
2584 (finish_offsetof): Same.
2585 (cp_check_omp_declare_reduction): Same.
2586 (finish_decltype_type): Same.
2587 * tree.c (handle_init_priority_attribute): Same. Add detail
2589 (maybe_warn_zero_as_null_pointer_constant): Same.
2590 * typeck.c (cp_build_binary_op): Quote keywords, operators, and types
2592 (cp_build_unary_op): Same.
2593 (check_for_casting_away_constness): Same.
2594 (build_static_cast): Same.
2595 (build_const_cast_1): Same.
2596 (maybe_warn_about_returning_address_of_local): Same.
2597 (check_return_expr): Same.
2598 * typeck2.c (abstract_virtuals_error_sfinae): Same.
2599 (digest_init_r): Replace a tab with spaces in a diagnostic.
2600 (build_functional_cast): Quote keywords, operators, and types
2603 2019-05-15 Jakub Jelinek <jakub@redhat.com>
2606 * cp-gimplify.c (genericize_cp_loop): Emit a DEBUG_BEGIN_STMT
2607 before the condition (or if missing or constant non-zero at the end
2608 of the loop. Emit a DEBUG_BEGIN_STMT before the increment expression
2609 if any. Don't call protected_set_expr_location on incr if it already
2612 2019-05-15 Marek Polacek <polacek@redhat.com>
2614 CWG 2096 - constraints on literal unions.
2615 * class.c (check_field_decls): Initialize booleans directly. A union
2616 is literal if at least one of its non-static data members is of
2617 non-volatile literal type.
2619 2019-05-15 Paolo Carlini <paolo.carlini@oracle.com>
2621 * cp-tree.h (REFERENCE_VLA_OK): Remove.
2622 * lambda.c (build_capture_proxy): Remove use of the above.
2624 2019-05-15 Paolo Carlini <paolo.carlini@oracle.com>
2626 * call.c (perform_overload_resolution, build_new_method_call_1):
2627 Use OVL_P; remove redundant TEMPLATE_DECL checks.
2628 * decl.c (grokfndecl): Likewise.
2629 * mangle.c (write_expression): Likewise.
2630 * parser.c (cp_parser_template_id): Likewise.
2631 * pt.c (resolve_overloaded_unification, type_dependent_expression_p):
2633 * search.c (build_baselink): Likewise.
2634 * tree.c (is_overloaded_fn, dependent_name, maybe_get_fns): Likewise.
2636 2019-05-14 Paolo Carlini <paolo.carlini@oracle.com>
2638 PR preprocessor/90382
2639 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
2642 2019-05-13 Jason Merrill <jason@redhat.com>
2644 Use releasing_vec more broadly.
2645 * cp-tree.h (struct releasing_vec): Replace get_ref method with
2647 (vec_safe_push, vec_safe_reserve, vec_safe_length, vec_safe_splice):
2648 Forwarding functions for releasing_vec.
2649 (release_tree_vector): Declare but don't define.
2650 * call.c (build_op_delete_call, build_temp, call_copy_ctor)
2651 (perform_direct_initialization_if_possible): Use releasing_vec.
2652 * constexpr.c (cxx_eval_vec_init_1, cxx_eval_store_expression):
2654 * cp-gimplify.c (cp_fold): Likewise.
2655 * cvt.c (force_rvalue, ocp_convert): Likewise.
2656 * decl.c (get_tuple_decomp_init): Likewise.
2657 * except.c (build_throw): Likewise.
2658 * init.c (perform_member_init, expand_default_init): Likewise.
2659 * method.c (do_build_copy_assign, locate_fn_flags): Likewise.
2660 * parser.c (cp_parser_userdef_char_literal)
2661 (cp_parser_userdef_numeric_literal)
2662 (cp_parser_userdef_string_literal)
2663 (cp_parser_perform_range_for_lookup)
2664 (cp_parser_range_for_member_function, cp_parser_omp_for_loop)
2665 (cp_parser_omp_for_loop_init): Likewise.
2666 * pt.c (tsubst_copy_and_build, do_class_deduction): Likewise.
2667 * semantics.c (calculate_direct_bases, calculate_bases)
2668 (finish_omp_barrier, finish_omp_flush, finish_omp_taskwait)
2669 (finish_omp_taskyield, finish_omp_cancel)
2670 (finish_omp_cancellation_point): Likewise.
2671 * tree.c (build_vec_init_elt, strip_typedefs, strip_typedefs_expr)
2672 (build_min_non_dep_op_overload): Likewise.
2673 * typeck.c (build_function_call_vec, cp_build_function_call_nary)
2674 (cp_build_modify_expr): Likewise.
2675 * typeck2.c (build_functional_cast): Likewise.
2677 2019-05-11 Paolo Carlini <paolo.carlini@oracle.com>
2679 * typeck.c (cp_build_function_call_vec): When mark_used fails
2680 unconditionally return error_mark_node.
2682 2019-05-10 Paolo Carlini <paolo.carlini@oracle.com>
2684 * decl.c (grokvardecl): Use an accurate location in error message
2685 about main as a global variable.
2687 2019-05-10 Paolo Carlini <paolo.carlini@oracle.com>
2689 * call.c (build_call_a): Use FUNC_OR_METHOD_TYPE_P.
2690 * cp-gimplify.c (cp_fold): Likewise.
2691 * cp-objcp-common.c (cp_type_dwarf_attribute): Likewise.
2692 * cp-tree.h (TYPE_OBJ_P, TYPE_PTROBV_P): Likewise.
2693 * cvt.c (perform_qualification_conversions): Likewise.
2694 * decl.c (grokdeclarator): Likewise.
2695 * decl2.c (build_memfn_type): Likewise.
2696 * mangle.c (canonicalize_for_substitution, write_type): Likewise.
2697 * parser.c (cp_parser_omp_declare_reduction): Likewise.
2698 * pt.c (check_explicit_specialization, uses_deducible_template_parms,
2699 check_cv_quals_for_unify, dependent_type_p_r): Likewise.
2700 * rtti.c (ptr_initializer): Likewise.
2701 * semantics.c (finish_asm_stmt, finish_offsetof,
2702 cp_check_omp_declare_reduction): Likewise.
2703 * tree.c (cp_build_qualified_type_real,
2704 cp_build_type_attribute_variant, cxx_type_hash_eq,
2705 cxx_copy_lang_qualifiers, cp_free_lang_data): Likewise.
2706 * typeck.c (structural_comptypes, convert_arguments,
2707 cp_build_addr_expr_1, unary_complex_lvalue, cp_build_c_cast,
2708 cp_build_modify_expr, comp_ptr_ttypes_real, type_memfn_rqual):
2711 2019-05-10 Marek Polacek <polacek@redhat.com>
2713 PR c++/78010 - bogus -Wsuggest-override warning on final function.
2714 * class.c (check_for_override): Don't warn for final functions.
2716 2019-05-10 Jakub Jelinek <jakub@redhat.com>
2719 * config-lang.in (gtfiles): Remove c-family/c-lex.c, add
2720 c-family/c-cppbuiltin.c.
2722 2019-05-09 Paolo Carlini <paolo.carlini@oracle.com>
2726 2018-04-26 Paolo Carlini <paolo.carlini@oracle.com>
2728 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
2731 2019-05-08 Nathan Sidwell <nathan@acm.org>
2733 Kill DECL_SAVED_FUNCTION_DATA .
2734 * cp-tree.h (language_function): Remove x_auto_return_pattern.
2735 (current_function_auto_return_pattern): Delete.
2736 (lang_decl_fn): Replace saved_language_function with
2737 saved_auto_return type.
2738 (DECL_SAVED_FUNCTION_DATA): Delete.
2739 (DECL_SAVED_AUTO_RETURN_TYPE): New.
2740 (FNDECL_USED_AUTO): Correct documentation.
2741 * decl.c (duplicate_decls): Adjust AUTO return handling.
2742 (start_preparsed_function): Replace
2743 current_function_auto_return_pattern with
2744 DECL_SAVED_AUTO_RETURN_TYPE. Remove DECL_SAVED_FUNCTION_DATA
2746 (finish_function): Likewise.
2747 (save_function_data): Delete.
2748 (fndecl_declared_return_type): Reimplement.
2749 * mangle.c (write_unqualified_name): Use DECL_SAVED_AUTO_RETURN_TYPE.
2750 * method.c (make_thunk, make_alias_for): Likewise.
2751 * parser.c (cp_parser_jump_statement): Likewise.
2752 * pt.c (do_auto_deduction): Likewise.
2753 * typeck.c (check_return_expr): Likewise.
2755 2019-05-06 Jason Merrill <jason@redhat.com>
2757 PR c++/90171 - reorganize usual_deallocation_fn_p
2758 * call.c (struct dealloc_info): New.
2759 (usual_deallocation_fn_p): Take a dealloc_info*.
2760 (aligned_deallocation_fn_p, sized_deallocation_fn_p): Remove.
2761 (build_op_delete_call): Adjust.
2763 2019-05-07 Jason Merrill <jason@redhat.com>
2765 PR c++/86485 - -Wmaybe-unused with empty class ?:
2766 * typeck.c (build_static_cast_1): Use cp_build_addr_expr.
2768 * pt.c (type_dependent_expression_p): A non-type template parm with
2769 a placeholder type is type-dependent.
2771 2019-05-06 Marek Polacek <polacek@redhat.com>
2773 PR c++/90265 - ICE with generic lambda.
2774 * pt.c (tsubst_copy_and_build): Use a dedicated variable for the last
2775 element in the vector.
2777 2019-05-03 Martin Liska <mliska@suse.cz>
2779 * call.c (build_aggr_conv): Use is_empty instead of
2780 elements () == 0 (and similar usages).
2781 * parser.c (cp_parser_lambda_introducer): Likewise.
2783 2019-05-02 Nathan Sidwell <nathan@acm.org>
2785 * semantics.c (finish_id_expression_1): Remove unreachable code.
2787 2019-05-01 Nathan Sidwell <nathan@acm.org>
2789 * name-lookup.h (get_class_binding_direct): Change final arg to
2791 (get_class_binding): Likewise.
2792 * name-lookup.c (get_class_binding_direct): Replace TYPE_OR_FNS
2793 arg with WANT_TYPE bool. Simplify.
2794 (get_class_binding): Adjust final arg.
2795 * decl.c (reshape_init_class): Adjust get_class_binding calls.
2797 2019-04-30 Nathan Sidwell <nathan@acm.org>
2799 * cp-objcp-common.c (cp_common_init_ts): Use MARK_TS_EXP for _EXPR
2800 nodes. Call c_common_init_ts.
2802 2019-04-29 Nathan Sidwell <nathan@acm.org>
2804 * decl.c (duplicate_decls): Add whitespace, move comments into
2806 * method.c (explain_implicit_non_constexpr): Refactor.
2807 * pt.c (check_explicit_specialization): Fix indentation.
2808 * semantics.c (process_outer_var_ref): Reformat.
2809 (finish_id_expression_1): Use STRIP_TEMPLATE.
2811 2019-04-26 Jonathan Wakely <jwakely@redhat.com>
2813 PR c++/90243 - orphaned note in uninstantiated constexpr function
2814 * decl.c (check_for_uninitialized_const_var): Suppress notes if no
2817 2019-04-26 Paolo Carlini <paolo.carlini@oracle.com>
2820 * decl.c (grokdeclarator): Set type to error_mark_node
2821 upon error about template placeholder type non followed
2822 by a simple declarator-id.
2824 2019-04-26 Paolo Carlini <paolo.carlini@oracle.com>
2826 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
2829 2019-04-24 Jason Merrill <jason@redhat.com>
2831 PR c++/90227 - error with template parameter packs.
2832 * pt.c (coerce_template_parms): Do add empty pack when
2835 2019-04-24 Richard Biener <rguenther@suse.de>
2837 * call.c (null_ptr_cst_p): Order checks according to expensiveness.
2838 (conversion_null_warnings): Likewise.
2839 * typeck.c (same_type_ignoring_top_level_qualifiers_p): Return
2840 early if type1 == type2.
2842 2019-04-22 Jason Merrill <jason@redhat.com>
2844 PR c++/87366 - wrong error with alias template.
2845 * typeck.c (structural_comptypes): When comparing_specializations,
2846 aliases are unequal.
2847 (comptypes): When comparing_specializations, do structural
2850 2019-04-19 Jason Merrill <jason@redhat.com>
2852 PR c++/90190 - CTAD with list-constructor.
2853 * pt.c (do_class_deduction): Don't try the single element deduction
2854 if the single element is also a braced list.
2856 PR c++/90171 - ICE with destroying delete with size_t parm.
2857 * call.c (sized_deallocation_fn_p): New. Use it instead of
2858 second_parm_is_size_t in most cases.
2859 (second_parm_is_size_t): Don't check for aligned.
2861 2019-04-19 Paolo Carlini <paolo.carlini@oracle.com>
2864 * pt.c (fn_type_unification): When handling null explicit
2865 arguments do not special case non-parameter packs.
2867 2019-04-19 Jakub Jelinek <jakub@redhat.com>
2870 * pt.c (process_template_parm): Set decl to pushdecl result. If
2871 !is_non_type, also set parm to that.
2874 * decl.c (struct cp_switch): Remove outside_range_p member.
2875 (push_switch): Don't clear it.
2876 (pop_switch): Adjust c_do_switch_warnings caller.
2877 (finish_case_label): Adjust c_add_case_label caller.
2880 * decl.c (duplicate_decls): If remove is main variant and
2881 DECL_ORIGINAL_TYPE is some other type, remove a DECL_ORIGINAL_TYPE
2882 variant that has newdecl as TYPE_NAME if any.
2884 2019-04-18 Jason Merrill <jason@redhat.com>
2886 PR c++/87554 - ICE with extern template and reference member.
2887 * decl.c (cp_finish_decl): Don't set DECL_INITIAL of external vars.
2889 2019-04-17 Jason Merrill <jason@redhat.com>
2891 PR c++/90047 - ICE with enable_if alias template.
2892 * pt.c (tsubst_decl) [TYPE_DECL]: Don't put an erroneous decl in the
2893 hash table when we're in SFINAE context.
2895 2019-04-17 Marek Polacek <polacek@redhat.com>
2897 PR c++/90124 - bogus error with incomplete type in decltype.
2898 * typeck.c (build_class_member_access_expr): Check
2899 cp_unevaluated_operand.
2901 2019-04-12 Jakub Jelinek <jakub@redhat.com>
2904 * decl.c (duplicate_decls): When newdecl's type is its main variant,
2905 don't try to remove it from the variant list, but instead assert
2908 2019-04-12 Martin Sebor <msebor@redhat.com>
2912 * parser.c (cp_parser_has_attribute_expression): Handle assignment
2915 2019-04-12 Jason Merrill <jason@redhat.com>
2917 * call.c (null_member_pointer_value_p): Handle an empty CONSTRUCTOR
2920 2019-04-12 Marek Polacek <polacek@redhat.com>
2922 * except.c (build_noexcept_spec): Use build_converted_constant_bool_expr
2923 instead of perform_implicit_conversion_flags.
2925 PR c++/87603 - constexpr functions are no longer noexcept.
2926 * constexpr.c (is_sub_constant_expr): Remove unused function.
2927 * cp-tree.h (is_sub_constant_expr): Remove declaration.
2928 * except.c (check_noexcept_r): Don't consider a call to a constexpr
2931 2019-04-11 Jakub Jelinek <jakub@redhat.com>
2933 PR translation/90035
2934 * parser.h (struct cp_parser): Add
2935 type_definition_forbidden_message_arg member.
2936 * parser.c (cp_debug_parser): Print it.
2937 (cp_parser_check_type_definition): Pass
2938 parser->type_definition_forbidden_message_arg as second argument to
2940 (cp_parser_has_attribute_expression, cp_parser_sizeof_operand): Set
2941 parser->type_definition_forbidden_message_arg and use G_() with
2942 %qs for parser->type_definition_forbidden_message instead of
2943 building untranslatable message using concat.
2945 2019-04-09 Jakub Jelinek <jakub@redhat.com>
2947 PR translation/90011
2948 * typeck2.c (check_narrowing): Remove trailing space from diagnostics.
2950 2019-04-08 Marek Polacek <polacek@redhat.com>
2952 * typeck2.c (digest_init_r): Don't condition the object slicing warning
2955 2019-04-08 Paolo Carlini <paolo.carlini@oracle.com>
2958 * semantics.c (trait_expr_value): Don't use TYPE_NOTHROW_P
2959 when maybe_instantiate_noexcept fails.
2960 (classtype_has_nothrow_assign_or_copy_p): Likewise.
2961 * method.c (implicitly_declare_fn): Avoid passing error_mark_node
2962 to build_exception_variant.
2964 2019-04-05 Marek Polacek <polacek@redhat.com>
2966 PR c++/87145 - bogus error converting class type in template arg list.
2967 * pt.c (convert_nontype_argument): Don't call
2968 build_converted_constant_expr if it could involve calling a conversion
2969 function with a instantiation-dependent constructor as its argument.
2971 2019-04-05 Martin Sebor <msebor@redhat.com>
2974 * decl.c (reshape_init_array_1): Avoid treating empty strings
2975 as zeros in array initializers.
2976 Use trivial_type_p () instead of TYPE_HAS_TRIVIAL_DFLT().
2978 2019-04-04 Jason Merrill <jason@redhat.com>
2980 PR c++/89948 - ICE with break in statement-expr.
2981 * constexpr.c (cxx_eval_statement_list): Jumping out of a
2982 statement-expr is non-constant.
2984 2019-04-04 Jason Merrill <jason@redhat.com>
2986 PR c++/89966 - error with non-type auto tparm.
2987 * pt.c (do_auto_deduction): Clear tf_partial.
2989 2019-04-04 Jason Merrill <jason@redhat.com>
2991 PR c++/86986 - ICE with TTP with parameter pack.
2992 * pt.c (coerce_template_parameter_pack): Only look at the type of a
2993 non-type parameter pack.
2994 (fixed_parameter_pack_p_1): Don't recurse into the type of a
2995 non-type parameter pack.
2996 (coerce_template_template_parms): Call add_outermost_template_args.
2998 2019-04-04 Martin Sebor <msebor@redhat.com>
3004 * decl.c (reshape_init_array_1): Strip trailing zero-initializers
3005 from arrays of trivial type and known size.
3006 * mangle.c (write_expression): Convert braced initializer lists
3008 (write_expression): Trim trailing zero-initializers from arrays
3010 (write_template_arg_literal): Mangle strings the same as braced
3013 2019-04-03 Jason Merrill <jason@redhat.com>
3015 PR c++/81866 - ICE with member template and default targ.
3016 * pt.c (tsubst_template_decl): Handle getting a type from
3017 retrieve_specialization.
3019 PR c++/86586 - -fcompare-debug=-Wsign-compare.
3020 * typeck.c (cp_build_binary_op): Don't fold for -Wsign-compare.
3022 PR c++/89331 - ICE with offsetof in incomplete class.
3023 * semantics.c (finish_offsetof): Handle error_mark_node.
3024 * typeck.c (build_class_member_access_expr): Call
3025 complete_type_or_maybe_complain before converting to base.
3027 PR c++/89917 - ICE with lambda in variadic mem-init.
3028 * pt.c (make_pack_expansion): Change type_pack_expansion_p to false.
3030 2019-04-01 Jason Merrill <jason@redhat.com>
3032 PR c++/86946 - ICE with function call in template argument.
3034 * pt.c (iterative_hash_template_arg) [CALL_EXPR]: Use
3037 2019-04-01 Paolo Carlini <paolo.carlini@oracle.com>
3040 * pt.c (tsubst_copy): Deal with lookup_name not returing a variable.
3042 2019-03-31 Marek Polacek <polacek@redhat.com>
3044 PR c++/89852 - ICE with C++11 functional cast with { }.
3045 * constexpr.c (fold_non_dependent_expr_template): New static function
3047 (fold_non_dependent_expr): ...here.
3048 (fold_non_dependent_init): New function.
3049 * cp-tree.h (fold_non_dependent_init): Declare.
3050 * typeck2.c (massage_init_elt): Call fold_non_dependent_init instead
3051 of fold_non_dependent_expr. Don't call maybe_constant_init.
3053 2019-03-30 Jason Merrill <jason@redhat.com>
3055 PR c++/89744 - ICE with specialization of member class template.
3056 * pt.c (lookup_template_class_1): If the partial instantiation is
3057 explicitly specialized, adjust.
3058 (maybe_process_partial_specialization): Also adjust
3061 2019-03-29 Jakub Jelinek <jakub@redhat.com>
3064 * typeck.c: Include gimplify.h.
3065 (cp_build_modify_expr) <case COND_EXPR>: Unshare rhs before using it
3066 for second time. Formatting fixes.
3068 2019-03-29 Marek Polacek <polacek@redhat.com>
3070 PR c++/89876 - ICE with deprecated conversion.
3071 * call.c (convert_like_real): Only give warnings with tf_warning.
3073 2019-03-28 Marek Polacek <polacek@redhat.com>
3075 PR c++/89612 - ICE with member friend template with noexcept.
3076 * pt.c (maybe_instantiate_noexcept): For function templates, use their
3077 template result (function decl). Don't set up local specializations.
3078 Temporarily turn on processing_template_decl. Update the template type
3081 PR c++/89836 - bool constant expression and explicit conversions.
3082 * call.c (build_converted_constant_expr_internal): New function,
3084 (build_converted_constant_expr): ...this. New.
3085 (build_converted_constant_bool_expr): New.
3086 * cp-tree.h (build_converted_constant_bool_expr): Declare.
3087 * decl.c (build_explicit_specifier): Call
3088 build_converted_constant_bool_expr.
3090 2019-03-28 Jakub Jelinek <jakub@redhat.com>
3093 * constexpr.c (struct check_for_return_continue_data): New type.
3094 (check_for_return_continue): New function.
3095 (potential_constant_expression_1) <case SWITCH_STMT>: Walk
3096 SWITCH_STMT_BODY to find RETURN_EXPRs or CONTINUE_STMTs not nested
3097 in loop bodies and set *jump_target to that if found.
3099 2019-03-27 Jason Merrill <jason@redhat.com>
3101 PR c++/89831 - error with qualified-id in const member function.
3102 * semantics.c (finish_non_static_data_member): Use object cv-quals
3103 in scoped case, too.
3105 PR c++/89421 - ICE with lambda in template parameter list.
3106 * parser.c (cp_parser_lambda_expression): Also reject a lambda in a
3107 template parameter list before C++20.
3108 * pt.c (type_dependent_expression_p): True for LAMBDA_EXPR.
3109 * semantics.c (begin_class_definition): Restore error about defining
3110 non-lambda class in template parm list.
3112 2019-03-26 Jason Merrill <jason@redhat.com>
3114 PR c++/86932 - missed SFINAE with empty pack.
3115 * pt.c (coerce_template_parms): Don't add an empty pack if
3117 (fn_type_unification): Pass tf_partial to coerce_template_parms.
3119 PR c++/86429 - constexpr variable in lambda.
3122 * constexpr.c (cxx_eval_constant_expression): In a lambda function,
3123 try evaluating the captured variable directly.
3125 2019-03-26 Jakub Jelinek <jakub@redhat.com>
3128 * semantics.c (finish_omp_atomic): Add warning_sentinel for
3129 -Wunused-value around finish_expr_stmt call.
3131 2019-03-25 Paolo Carlini <paolo.carlini@oracle.com>
3135 * parser.c (cp_parser_binary_expression): Don't call cp_fully_fold
3136 to undo the disabling of warnings.
3138 2019-03-25 Jason Merrill <jason@redhat.com>
3140 PR c++/87748 - substitution failure error with decltype.
3141 * pt.c (most_specialized_partial_spec): Clear
3142 processing_template_decl.
3144 2019-03-25 Marek Polacek <polacek@redhat.com>
3146 PR c++/89214 - ICE when initializing aggregates with bases.
3147 * typeck2.c (digest_init_r): Warn about object slicing instead of
3150 PR c++/89705 - ICE with reference binding with conversion function.
3151 * call.c (reference_binding): If the result of the conversion function
3152 is a prvalue of non-class type, use the cv-unqualified type.
3154 2019-03-25 Nathan Sidwell <nathan@acm.org>
3156 * lambda.c (maybe_add_lambda_conv_op): Don't add to comdat group.
3158 2019-03-22 Jakub Jelinek <jakub@redhat.com>
3161 * cp-tree.h (get_tls_wrapper_fn): Remove declaration.
3162 (maybe_get_tls_wrapper_call): Declare.
3163 * decl2.c (get_tls_wrapper_fn): Make static.
3164 (maybe_get_tls_wrapper_call): New function.
3165 * typeck.c (build_class_member_access_expr): Handle accesses to TLS
3167 * semantics.c (finish_qualified_id_expr): Likewise.
3168 (finish_id_expression_1): Use maybe_get_tls_wrapper_call.
3169 * pt.c (tsubst_copy_and_build): Likewise.
3172 * constexpr.c (struct constexpr_ctx): Add constexpr_ops_count member.
3173 (cxx_eval_constant_expression): When not skipping, not constant class
3174 or location wrapper, increment *ctx->constexpr_ops_count and if it is
3175 above constexpr_loop_nest_limit, diagnose failure.
3176 (cxx_eval_outermost_constant_expr): Add constexpr_ops_count and
3177 initialize ctx.constexpr_ops_count to its address.
3178 (is_sub_constant_expr): Likewise.
3180 2019-03-21 Jakub Jelinek <jakub@redhat.com>
3183 * call.c (filed_in_pset): Change pset from hash_set<tree> * to
3184 hash_set<tree, true> &, adjust uses accordingly.
3185 (build_aggr_conv): Change pset from hash_set<tree> *
3186 to hash_set<tree, true>. Replace goto fail; with return NULL;,
3190 * parser.c (cp_parser_lambda_introducer): Add ids and first_capture_id
3191 variables, check for duplicates in this function.
3192 * lambda.c (add_capture): Don't check for duplicates nor use
3194 (register_capture_members): Don't clear IDENTIFIER_MARKED here.
3196 2019-03-21 Paolo Carlini <paolo.carlini@oracle.com>
3199 * method.c (after_nsdmi_defaulted_late_checks): Avoid passing
3200 error_mark_node to comp_except_specs.
3202 2019-03-20 Jason Merrill <jason@redhat.com>
3204 PR c++/87480 - decltype of member access in default template arg
3205 * pt.c (type_unification_real): Accept a dependent result in
3208 2019-03-19 Martin Sebor <msebor@redhat.com>
3210 PR tree-optimization/89688
3211 * typeck2.c (store_init_value): Call braced_lists_to_string for more
3212 kinds of initializers.
3214 2019-03-18 Jason Merrill <jason@redhat.com>
3216 PR c++/89630 - ICE with dependent using-decl as template arg.
3217 * tree.c (cp_tree_equal): Always return false for USING_DECL.
3219 PR c++/89761 - ICE with sizeof... in pack expansion.
3220 * pt.c (argument_pack_element_is_expansion_p): Handle
3221 ARGUMENT_PACK_SELECT.
3223 PR c++/89640 - GNU attributes on lambda.
3224 * parser.c (cp_parser_lambda_declarator_opt): Allow GNU attributes.
3226 PR c++/89682 - wrong access error in default argument.
3227 * pt.c (tsubst_default_argument): Don't defer access checks.
3229 2019-03-18 Paolo Carlini <paolo.carlini@oracle.com>
3232 * semantics.c (finish_non_static_data_member): Check return value
3233 of context_for_name_lookup and immediately return error_mark_node
3236 2019-03-17 Jason Merrill <jason@redhat.com>
3238 PR c++/89571 - ICE with ill-formed noexcept on constructor.
3239 * pt.c (maybe_instantiate_noexcept): Only return false if defaulted.
3240 (regenerate_decl_from_template): Use it for noexcept-specs.
3242 2019-03-14 Jason Merrill <jason@redhat.com>
3244 * parser.c (cp_parser_decl_specifier_seq): Support C++20
3245 concept-definition syntax without 'bool'.
3247 2019-03-14 Jakub Jelinek <jakub@redhat.com>
3250 * semantics.c (finish_qualified_id_expr): Reject variable templates.
3253 * constexpr.c (struct constexpr_ctx): Change save_exprs type from
3254 hash_set<tree> to vec<tree>.
3255 (cxx_eval_call_expression): Adjust for save_exprs being a vec instead
3257 (cxx_eval_loop_expr): Likewise. Truncate the vector after each
3258 removal of SAVE_EXPRs from values.
3259 (cxx_eval_constant_expression) <case SAVE_EXPR>: Call safe_push
3260 method on save_exprs instead of add.
3262 2019-03-13 Jason Merrill <jason@redhat.com>
3264 PR c++/86521 - C++17 copy elision in initialization by constructor.
3265 * call.c (joust_maybe_elide_copy): New.
3268 2019-03-13 Marek Polacek <polacek@redhat.com>
3270 PR c++/88979 - further P0634 fix for constructors.
3271 * parser.c (cp_parser_decl_specifier_seq): Pass flags to
3272 cp_parser_constructor_declarator_p.
3273 (cp_parser_direct_declarator): Allow missing typename for constructor
3275 (cp_parser_constructor_declarator_p): Add FLAGS parameter. Pass it to
3276 cp_parser_type_specifier.
3278 PR c++/89686 - mixing init-capture and simple-capture in lambda.
3279 * parser.c (cp_parser_lambda_introducer): Give error when combining
3280 init-capture and simple-capture.
3282 PR c++/89660 - bogus error with -Wredundant-move.
3283 * typeck.c (maybe_warn_pessimizing_move): Only accept (T &) &arg
3284 as the std::move's argument. Don't call convert_for_initialization
3285 when warn_redundant_move isn't on.
3287 2019-03-11 Jason Merrill <jason@redhat.com>
3289 PR c++/86521 - wrong overload resolution with ref-qualifiers.
3290 * call.c (build_user_type_conversion_1): Don't use a conversion to a
3291 reference of the wrong rvalueness for direct binding.
3293 2019-03-11 Martin Liska <mliska@suse.cz>
3295 * cvt.c (build_expr_type_conversion): Wrap apostrophes
3296 in gcc internal format with %'.
3297 * decl.c (check_no_redeclaration_friend_default_args): Likewise.
3298 (grokfndecl): Likewise.
3299 * name-lookup.c (do_pushtag): Likewise.
3300 * pt.c (unify_parameter_deduction_failure): Likewise.
3301 (unify_template_deduction_failure): Likewise.
3303 2019-03-11 Martin Liska <mliska@suse.cz>
3305 * call.c (convert_arg_to_ellipsis): Wrap an option name
3306 in a string format message and fix GNU coding style.
3307 (build_over_call): Likewise.
3308 * class.c (check_field_decl): Likewise.
3309 (layout_nonempty_base_or_field): Likewise.
3310 * constexpr.c (cxx_eval_loop_expr): Likewise.
3311 * cvt.c (type_promotes_to): Likewise.
3312 * decl.c (cxx_init_decl_processing): Likewise.
3313 (mark_inline_variable): Likewise.
3314 (grokdeclarator): Likewise.
3315 * decl2.c (record_mangling): Likewise.
3316 * error.c (maybe_warn_cpp0x): Likewise.
3317 * except.c (doing_eh): Likewise.
3318 * mangle.c (maybe_check_abi_tags): Likewise.
3319 * parser.c (cp_parser_diagnose_invalid_type_name): Likewise.
3320 (cp_parser_userdef_numeric_literal): Likewise.
3321 (cp_parser_primary_expression): Likewise.
3322 (cp_parser_unqualified_id): Likewise.
3323 (cp_parser_pseudo_destructor_name): Likewise.
3324 (cp_parser_builtin_offsetof): Likewise.
3325 (cp_parser_lambda_expression): Likewise.
3326 (cp_parser_lambda_introducer): Likewise.
3327 (cp_parser_lambda_declarator_opt): Likewise.
3328 (cp_parser_selection_statement): Likewise.
3329 (cp_parser_init_statement): Likewise.
3330 (cp_parser_decomposition_declaration): Likewise.
3331 (cp_parser_function_specifier_opt): Likewise.
3332 (cp_parser_static_assert): Likewise.
3333 (cp_parser_simple_type_specifier): Likewise.
3334 (cp_parser_namespace_definition): Likewise.
3335 (cp_parser_using_declaration): Likewise.
3336 (cp_parser_ctor_initializer_opt_and_function_body): Likewise.
3337 (cp_parser_initializer_list): Likewise.
3338 (cp_parser_type_parameter_key): Likewise.
3339 (cp_parser_member_declaration): Likewise.
3340 (cp_parser_try_block): Likewise.
3341 (cp_parser_std_attribute_spec): Likewise.
3342 (cp_parser_requires_clause_opt): Likewise.
3343 * pt.c (check_template_variable): Likewise.
3344 (check_default_tmpl_args): Likewise.
3345 (push_tinst_level_loc): Likewise.
3346 (instantiate_pending_templates): Likewise.
3347 (invalid_nontype_parm_type_p): Likewise.
3348 * repo.c (get_base_filename): Likewise.
3349 * rtti.c (typeid_ok_p): Likewise.
3350 (build_dynamic_cast_1): Likewise.
3351 * tree.c (maybe_warn_parm_abi): Likewise.
3353 2019-03-08 Jakub Jelinek <jakub@redhat.com>
3356 * parser.c (cp_parser_template_declaration_after_parameters): Avoid
3357 one space before " at the end of line and another after " on another
3358 line in a string literal.
3360 PR tree-optimization/89550
3361 * semantics.c (maybe_convert_cond): Only set TREE_NO_WARNING if
3362 warning_at returned true.
3363 * decl2.c (c_parse_final_cleanups): Likewise.
3364 * typeck.c (convert_for_assignment): Likewise.
3365 * decl.c (finish_function): Likewise.
3368 * parser.c (cp_parser_asm_definition): Just warn instead of error
3369 on volatile qualifier outside of function body.
3372 * constexpr.c (potential_constant_expression_1): Reject
3373 REINTERPRET_CAST_P NOP_EXPRs.
3376 * call.c (joust): Call print_z_candidate only if pedwarn returned
3379 2019-03-07 Jason Merrill <jason@redhat.com>
3381 PR c++/88123 - lambda and using-directive.
3382 * name-lookup.c (op_unqualified_lookup)
3383 (maybe_save_operator_binding, discard_operator_bindings)
3384 (push_operator_bindings): New.
3385 * typeck.c (build_x_binary_op, build_x_unary_op): Call
3386 maybe_save_operator_binding.
3387 * decl.c (start_preparsed_function): Call push_operator_bindings.
3388 * tree.c (cp_free_lang_data): Call discard_operator_bindings.
3390 PR c++/88820 - ICE with CTAD and member template used in DMI.
3391 * pt.c (do_class_deduction): Handle parm used as its own arg.
3393 2019-03-07 Jakub Jelinek <jakub@redhat.com>
3396 * parser.c (cp_parser_asm_definition): Parse asm qualifiers even
3397 at toplevel, but diagnose them.
3399 2019-03-06 Jason Merrill <jason@redhat.com>
3401 PR c++/89381 - implicit copy and using-declaration.
3402 * class.c (classtype_has_move_assign_or_move_ctor_p): Don't consider
3403 op= brought in by a using-declaration.
3405 2019-03-06 Jakub Jelinek <jakub@redhat.com>
3408 * init.c (build_value_init_noctor): Ignore flexible array members.
3410 2019-03-06 Jason Merrill <jason@redhat.com>
3412 PR c++/89576 - if constexpr of lambda capture.
3413 * semantics.c (maybe_convert_cond): Do convert a non-dependent
3414 condition in a template.
3415 * typeck.c (condition_conversion): Handle being called in a
3418 2019-03-06 Marek Polacek <polacek@redhat.com>
3420 PR c++/87378 - bogus -Wredundant-move warning.
3421 * typeck.c (maybe_warn_pessimizing_move): See if the maybe-rvalue
3422 overload resolution would actually succeed.
3424 2019-03-05 Jason Merrill <jason@redhat.com>
3426 * class.c (is_really_empty_class): Add ignore_vptr parm.
3427 (trivial_default_constructor_is_constexpr): Pass it.
3428 * call.c (build_over_call): Pass it.
3429 * constexpr.c (cxx_eval_constant_expression): Pass it instead of
3430 checking TYPE_POLYMORPHIC_P.
3431 (cxx_eval_component_reference, potential_constant_expression_1):
3433 * cp-gimplify.c (simple_empty_class_p): Pass it.
3434 * init.c (expand_aggr_init_1): Pass it.
3436 2019-03-04 Paolo Carlini <paolo.carlini@oracle.com>
3439 * parser.c (cp_parser_class_head): Reject TYPE_BEING_DEFINED too.
3441 2019-03-04 Jakub Jelinek <jakub@redhat.com>
3444 * call.c (field_in_pset): New function.
3445 (build_aggr_conv): Handle CONSTRUCTOR_IS_DESIGNATED_INIT correctly.
3447 2019-03-02 Jakub Jelinek <jakub@redhat.com>
3450 * cp-tree.h (CONSTRUCTOR_IS_DESIGNATED_INIT): Define.
3451 * parser.c (cp_parser_braced_list): Adjust cp_parser_initializer_list
3452 caller, set CONSTRUCTOR_IS_DESIGNATED_INIT.
3453 (cp_parser_initializer_list): Add designated parameter, set *designated
3454 to a bool whether any designators were parsed.
3455 * decl.c (reshape_init): Copy over CONSTRUCTOR_IS_DESIGNATED_INIT if
3457 * pt.c (tsubst_copy_and_build): Likewise.
3458 * call.c (implicit_conversion): If CONSTRUCTOR_IS_DESIGNATED_INIT,
3459 don't call build_list_conv, nor build_complex_conv, nor attempt to
3460 convert a single element initializer to scalar.
3462 2019-03-01 Marek Polacek <polacek@redhat.com>
3464 PR c++/89537 - missing location for error with non-static member fn.
3465 * call.c (resolve_args): Use EXPR_LOCATION.
3466 * typeck.c (build_class_member_access_expr): Use input_location.
3468 PR c++/89532 - ICE with incomplete type in decltype.
3469 * semantics.c (finish_compound_literal): Return error_mark_node
3470 if digest_init_flags returns error_mark_node.
3472 2019-03-01 Jakub Jelinek <jakub@redhat.com>
3474 Implement P1002R1, Try-catch blocks in constexpr functions
3476 * parser.c (cp_parser_ctor_initializer_opt_and_function_body):
3477 Diagnose constexpr ctor or function with function-try-block with
3478 pedwarn for c++17 and earlier. Formatting fix.
3479 (cp_parser_try_block): Use pedwarn instead of error and only for
3480 c++17 and earlier when try block appears in constexpr function.
3481 * constexpr.c (build_constexpr_constructor_member_initializers):
3482 Handle TRY_BLOCK here instead of erroring on it.
3484 2019-02-28 Jason Merrill <jason@redhat.com>
3486 PR c++/88183 - ICE with .* fold-expression.
3487 * pt.c (fold_expression) [DOTSTAR_EXPR]: Remove special handling.
3489 PR c++/86969 - ICE with constexpr if and recursive generic lambdas.
3490 * class.c, lambda.c, pt.c: Revert earlier change.
3491 * lambda.c (add_capture): Don't special-case capture of dependent
3494 * name-lookup.c (print_binding_level): Print this_entity.
3496 2019-02-27 Marek Polacek <polacek@redhat.com>
3498 PR c++/88857 - ICE with value-initialization of argument in template.
3499 * call.c (convert_like_real): Don't call build_value_init in template.
3501 2019-02-27 Jason Merrill <jason@redhat.com>
3503 PR c++/86969 - ICE with constexpr if and recursive generic lambdas.
3504 * semantics.c (process_outer_var_ref): Do capture dependent vars.
3505 * class.c (finish_struct): Only add TAG_DEFN if T is in
3506 current_function_decl.
3507 * lambda.c (vla_capture_type): Force the capture type out into the
3508 lambda's enclosing function.
3509 (add_capture): Pass in the lambda.
3510 * pt.c (tsubst_lambda_expr): complete_type a VLA capture type.
3512 2019-02-27 Marek Polacek <polacek@redhat.com>
3514 PR c++/89511 - ICE with using-declaration and unscoped enumerator.
3515 * parser.c (cp_parser_using_declaration): For an unscoped enum
3516 only use its context if it's not a function declaration.
3518 2019-02-27 Paolo Carlini <paolo.carlini@oracle.com>
3521 * method.c (process_subob_fn): When maybe_instantiate_noexcept
3522 returns false don't call merge_exception_specifiers.
3524 2019-02-27 Paolo Carlini <paolo.carlini@oracle.com>
3527 * parser.c (cp_parser_noexcept_specification_opt): Return NULL_TREE
3528 for a non-constant parsed expression.
3530 2019-02-26 Jakub Jelinek <jakub@redhat.com>
3533 * constexpr.c (cxx_eval_store_expression): When changing active union
3534 member, set no_zero_init.
3536 2019-02-23 Marek Polacek <polacek@redhat.com>
3538 PR c++/88294 - ICE with non-constant noexcept-specifier.
3539 * pt.c (maybe_instantiate_noexcept): Set up the list of local
3540 specializations. Set current_class_{ptr,ref}.
3542 2019-02-22 David Malcolm <dmalcolm@redhat.com>
3545 * parser.c (cp_parser_unqualified_id): Capture and use locations
3548 2019-02-22 Marek Polacek <polacek@redhat.com>
3550 PR c++/89420 - ICE with CAST_EXPR in explicit-specifier.
3551 * decl.c (build_explicit_specifier): Don't check
3552 processing_template_decl. Call instantiation_dependent_expression_p
3553 instead of value_dependent_expression_p. Call
3554 instantiate_non_dependent_expr_sfinae before
3555 build_converted_constant_expr instead of calling
3556 instantiate_non_dependent_expr after it. Add
3557 processing_template_decl_sentinel.
3559 2019-02-22 Thomas Schwinge <thomas@codesourcery.com>
3561 * parser.c (cp_parser_oacc_simple_clause): Remove parser formal
3562 parameter, move loc formal parameter to the front. Adjust all
3564 (cp_parser_oacc_shape_clause): Add loc formal parameter. Adjust
3567 2019-02-21 Jason Merrill <jason@redhat.com>
3569 PR c++/87685 - generic lambda 'this' capture error.
3570 * lambda.c (lambda_expr_this_capture): Change add_capture_p to int.
3571 (maybe_generic_this_capture): Pass -1.
3573 PR c++/88394 - ICE with VLA init-capture.
3574 * lambda.c (is_normal_capture_proxy): Check DECL_CAPTURED_VARIABLE.
3576 PR c++/88869 - C++17 ICE with CTAD and explicit specialization.
3577 * pt.c (do_class_deduction): Don't include explicit specialization
3580 PR c++/89422 - ICE with -g and lambda in default arg in template.
3581 * pt.c (tsubst_function_decl): SET_DECL_FRIEND_CONTEXT sooner.
3583 2019-02-21 Jason Merrill <jason@redhat.com>
3585 PR c++/88419 - C++17 ICE with class template arg deduction.
3586 * pt.c (make_template_placeholder): Set TYPE_CANONICAL after
3587 CLASS_PLACEHOLDER_TEMPLATE.
3589 2019-02-21 Jakub Jelinek <jakub@redhat.com>
3592 * constexpr.c (struct constexpr_fundef): Add parms and result members.
3593 (retrieve_constexpr_fundef): Adjust for the above change.
3594 (register_constexpr_fundef): Save constexpr body with copy_fn,
3595 temporarily set DECL_CONTEXT on DECL_RESULT before that.
3596 (get_fundef_copy): Change FUN argument to FUNDEF with
3597 constexpr_fundef * type, grab body and parms/result out of
3598 constexpr_fundef struct and temporarily change it for copy_fn calls
3600 (cxx_eval_builtin_function_call): For __builtin_FUNCTION temporarily
3601 adjust current_function_decl from ctx->call context. Test
3602 !potential_constant_expression instead of !is_constant_expression.
3603 (cxx_bind_parameters_in_call): Grab parameters from new_call. Undo
3604 convert_for_arg_passing changes for TREE_ADDRESSABLE type passing.
3605 (cxx_eval_call_expression): Adjust get_fundef_copy caller.
3606 (cxx_eval_conditional_expression): For IF_STMT, allow then or else
3607 operands to be NULL.
3608 (label_matches): Handle BREAK_STMT and CONTINUE_STMT.
3609 (cxx_eval_loop_expr): Add support for FOR_STMT, WHILE_STMT and DO_STMT.
3610 (cxx_eval_switch_expr): Add support for SWITCH_STMT.
3611 (cxx_eval_constant_expression): Handle IF_STMT, FOR_STMT, WHILE_STMT,
3612 DO_STMT, CONTINUE_STMT, SWITCH_STMT, BREAK_STMT and CONTINUE_STMT.
3613 For SIZEOF_EXPR, recurse on the result of fold_sizeof_expr. Ignore
3614 DECL_EXPR with USING_DECL operand.
3615 * lambda.c (maybe_add_lambda_conv_op): Build thisarg using
3616 build_int_cst to make it a valid constant expression.
3618 2019-02-20 Jason Merrill <jason@redhat.com>
3620 PR c++/88690 - C++17 ICE with empty base in aggregate.
3621 * typeck2.c (process_init_constructor_record): Skip trivial
3622 initialization of an empty base.
3624 2019-02-21 Richard Biener <rguenther@suse.de>
3627 * vtable-class-hierarchy.c (vtv_generate_init_routine): Do not
3628 make symtab process new functions here.
3630 2019-02-20 Jason Merrill <jason@redhat.com>
3632 PR c++/87921 - wrong error with inline static data member.
3633 * decl2.c (finish_static_data_member_decl): Don't set DECL_IN_AGGR_P
3634 for a non-template inline variable. Do nothing for an
3635 already-instantiated variable.
3636 (c_parse_final_cleanups): Check DECL_IN_AGGR_P without
3638 * decl.c (check_initializer): Likewise.
3639 (make_rtl_for_nonlocal_decl): Likewise.
3640 * pt.c (instantiate_decl): Likewise.
3641 * typeck2.c (store_init_value): Likewise.
3643 2019-02-20 Jakub Jelinek <jakub@redhat.com>
3646 * decl2.c (c_parse_final_cleanups): Move TREE_ASM_WRITTEN setting
3647 for flag_syntax_only from here...
3648 * semantics.c (expand_or_defer_fn_1): ... here.
3651 * decl.c (maybe_commonize_var): When clearing TREE_PUBLIC and
3652 DECL_COMMON, set DECL_INTERFACE_KNOWN.
3655 * constexpr.c (cxx_eval_store_expression): Diagnose changing of active
3656 union member for -std=c++17 and earlier.
3658 2019-02-19 Jason Merrill <jason@redhat.com>
3660 PR c++/87513 - 'sorry' mangling PMF template-id.
3661 * mangle.c (write_expression): Handle SCOPE_REF to BASELINK.
3663 2019-02-19 Jason Merrill <jason@redhat.com>
3665 PR c++/88380 - wrong-code with flexible array and NSDMI.
3666 * typeck2.c (process_init_constructor_record): Skip flexarrays.
3668 2019-02-20 will wray <wjwray@gmail.com>
3670 PR c++/88572 - wrong handling of braces on scalar init.
3671 * decl.c (reshape_init_r): Allow braces around scalar initializer
3672 within aggregate init. Reject double braced-init of scalar
3675 2019-02-20 Paolo Carlini <paolo.carlini@oracle.com>
3678 * pt.c (tsubst_init): Diagnose an initializer expanding to an
3679 empty list of expressions; tweak wrt dependent types.
3680 (regenerate_decl_from_template): For VAR_DECLs call tsubst_init
3681 instead of tsubst_expr.
3683 2019-02-19 Jason Merrill <jason@redhat.com>
3685 PR c++/88368 - wrong 'use of deleted function'
3686 * method.c (walk_field_subobs): Remember errors from get_nsdmi.
3687 (get_defaulted_eh_spec): Call push_tinst_level.
3688 * pt.c (maybe_instantiate_noexcept): Keep error_mark_node.
3689 * typeck2.c (merge_exception_specifiers): Handle error_mark_node.
3691 2019-02-19 Chung-Lin Tang <cltang@codesourcery.com>
3694 * parser.c (cp_parser_oacc_clause_wait): Add representation of wait
3695 clause without argument as 'wait (GOMP_ASYNC_NOVAL)', adjust comments.
3697 2019-02-19 Jakub Jelinek <jakub@redhat.com>
3700 * lambda.c (maybe_generic_this_capture): Don't check
3701 DECL_NONSTATIC_MEMBER_FUNCTION_P on USING_DECLs.
3704 * typeck.c (build_reinterpret_cast_1): Don't handle void to
3705 && conversion go through build_target_expr_with_type.
3708 * error.c (qualified_name_lookup_error): Only call
3709 suggest_alternative_in_scoped_enum if name is IDENTIFIER_NODE.
3711 2019-02-19 Tom Honermann <tom@honermann.net>
3713 * name-lookup.c (get_std_name_hint): Added u8string as a name hint.
3715 2019-02-18 Jason Merrill <jason@redhat.com>
3717 PR c++/89336 - multiple stores in constexpr stmt.
3718 * constexpr.c (cxx_eval_store_expression): Preevaluate scalar or
3721 * pt.c (check_explicit_specialization): If the declarator is a
3722 template-id, only check whether the arguments are dependent.
3724 Improve duplicate [[likely]] diagnostic.
3725 * parser.c (cp_parser_statement): Make attrs_loc a range. Pass it
3726 to process_stmt_hotness_attribute.
3727 * cp-gimplify.c (process_stmt_hotness_attribute): Take attrs_loc.
3728 (genericize_if_stmt): Use likely/unlikely instead of predictor_name.
3730 2019-02-17 Marek Polacek <polacek@redhat.com>
3732 PR c++/89217 - ICE with list-initialization in range-based for loop.
3733 * constexpr.c (unshare_constructor): No longer static.
3734 * cp-tree.h (unshare_constructor): Declare.
3735 * semantics.c (finish_compound_literal): When dealing with a
3736 non-dependent expression in a template, return the original
3737 expression. Pass LOOKUP_NO_NARROWING to digest_init_flags.
3739 2019-02-13 Marek Polacek <polacek@redhat.com>
3741 PR c++/89297 - ICE with OVERLOAD in template.
3742 * semantics.c (finish_compound_literal): Call
3743 instantiate_non_dependent_expr_sfinae.
3745 2019-02-13 Alexandre Oliva <aoliva@redhat.com>
3748 * cp-tree.h (USING_DECL_SCOPE): Use result rather than type.
3749 * name-lookup.c (strip_using_decl): Use USING_DECL_SCOPE.
3750 * search.c (protected_accessible_p): Follow USING_DECL_DECLS.
3751 (shared_member_p): Likewise.
3752 (lookup_member): Likewise.
3753 * decl.c (grok_special_member_properties): Skip USING_DECLs.
3754 * semantics.c (finish_omp_declare_simd_methods): Likewise.
3755 (finish_qualified_id_expr): Do not call shared_member_p with
3759 * pt.c (tsubst_lambda_expr): Avoid duplicate tsubsting.
3760 Move cp_evaluated resetting before signature tsubsting.
3761 (gen_elem_of_pack_expansion_instantiation): Separate local
3762 specializations per index.
3764 2019-02-13 David Malcolm <dmalcolm@redhat.com>
3767 * class.c (add_method): Drop destructor assertion.
3769 2019-02-13 Paolo Carlini <paolo.carlini@oracle.com>
3772 * decl.c (make_typename_type): Allow for TYPE_PACK_EXPANSION as
3773 context (the first argument).
3774 * pt.c (tsubst, case TYPENAME_TYPE): Handle TYPE_PACK_EXPANSION
3777 2019-02-12 Jason Merrill <jason@redhat.com>
3779 PR c++/89144 - link error with constexpr initializer_list.
3780 * call.c (convert_like_real) [ck_list]: Don't allocate a temporary
3781 array for an empty list.
3782 * typeck2.c (store_init_value): Don't use cxx_constant_init in a
3785 2019-02-11 Jason Merrill <jason@redhat.com>
3787 PR c++/89241 - ICE with __func__ in lambda in template.
3788 * pt.c (enclosing_instantiation_of): Also check
3789 instantiated_lambda_fn_p for the template context.
3791 2019-02-11 Marek Polacek <polacek@redhat.com>
3793 PR c++/89212 - ICE converting nullptr to pointer-to-member-function.
3794 * pt.c (tsubst_copy_and_build) <case CONSTRUCTOR>: Return early for
3795 null member pointer value.
3797 2019-02-11 Jakub Jelinek <jakub@redhat.com>
3800 * pt.c (convert_nontype_argument): Pass true as manifestly_const_eval
3801 to maybe_constant_value calls.
3803 2019-02-11 Marek Polacek <polacek@redhat.com>
3805 * typeck2.c (digest_init_r): Remove commented code.
3807 2019-02-11 Martin Sebor <msebor@redhat.com>
3810 * decl.c (compute_array_index_type_loc): Preserve signed sizes
3811 for diagnostics. Call valid_array_size_p instead of error.
3812 * init.c (build_new_1): Compute size for diagnostic. Call
3813 invalid_array_size_error
3814 (build_new): Call valid_array_size_p instead of error.
3816 2019-02-07 Alexandre Oliva <aoliva@redhat.com>
3819 * call.c (compare_ics): Deal with ck_aggr in either cs.
3821 2019-02-06 David Malcolm <dmalcolm@redhat.com>
3824 * call.c (get_location_for_expr_unwinding_for_system_header): New
3826 (conversion_null_warnings): Use it when getting locations for
3827 EXPR, effectively adding a call to
3828 get_location_for_expr_unwinding_for_system_header for
3829 -Wconversion-null and making use of EXPR_LOCATION for
3830 -Wzero-as-null-pointer-constant.
3832 2019-02-05 Jakub Jelinek <jakub@redhat.com>
3835 * optimize.c (maybe_thunk_body): Clear TREE_ADDRESSABLE on
3836 PARM_DECLs of the thunk.
3837 * lambda.c (maybe_add_lambda_conv_op): Likewise.
3839 2019-02-05 Marek Polacek <polacek@redhat.com>
3841 PR c++/89158 - by-value capture of constexpr variable broken.
3842 * call.c (convert_like_real) <case ck_user>: Call mark_exp_read
3843 instead of mark_rvalue_use.
3845 2019-02-05 Alexandre Oliva <aoliva@redhat.com>
3848 * pt.c (instantiates_primary_template_p): New.
3849 (type_dependent_expression_p): Use it.
3851 2019-02-01 Jason Merrill <jason@redhat.com>
3853 PR c++/88761 - ICE with reference capture of constant.
3854 * lambda.c (mark_const_cap_r): Do walk subtrees of DECL_EXPR for
3857 2019-02-01 Marek Polacek <polacek@redhat.com>
3859 PR c++/88325 - ICE with invalid out-of-line template member definition.
3860 * parser.c (cp_parser_class_name): Don't call make_typename_type
3863 2019-02-01 Jakub Jelinek <jakub@redhat.com>
3866 * parser.c (cp_parser_gnu_attributes_opt): Set ok to false
3867 if require_open failed.
3869 2019-01-31 Marek Polacek <polacek@redhat.com>
3871 PR c++/89083, c++/80864 - ICE with list initialization in template.
3872 * constexpr.c (adjust_temp_type): Use copy_node and change the type
3873 instead of using build_constructor.
3874 * decl.c (reshape_init_r): Don't reshape a digested initializer.
3875 Return the initializer for COMPOUND_LITERAL_P.
3877 PR c++/88983 - ICE with switch in constexpr function.
3878 * constexpr.c (cxx_eval_switch_expr): Use SWITCH_COND and SWITCH_BODY.
3879 (cxx_eval_constant_expression) <case COND_EXPR>: Don't look for the
3880 label in the else branch if we found it in the then branch.
3882 2019-01-30 Jason Merrill <jason@redhat.com>
3884 PR c++/88752 - ICE with lambda and constexpr if.
3885 * cp-tree.h (LAMBDA_EXPR_INSTANTIATED): New.
3886 * pt.c (tsubst_lambda_expr): Set it.
3887 (instantiated_lambda_fn_p): Check it.
3888 (enclosing_instantiation_of): Use it.
3890 2019-01-31 Jakub Jelinek <jakub@redhat.com>
3893 * cxx-pretty-print.c (pp_cxx_enumeration_constant): Print always as
3894 a C cast in pp_c_flag_gnu_v3 mode.
3896 2019-01-30 Jakub Jelinek <jakub@redhat.com>
3899 * lambda.c (is_capture_proxy): Don't return true for
3900 DECL_OMP_PRIVATIZED_MEMBER artificial vars.
3902 2019-01-30 Marek Polacek <polacek@redhat.com>
3904 PR c++/89119 - ICE with value-initialization in template.
3905 * pt.c (tsubst_copy_and_build): Handle RANGE_EXPR.
3907 2019-01-29 Jason Merrill <jason@redhat.com>
3909 PR c++/86943 - wrong code converting lambda to function pointer.
3910 * lambda.c (maybe_add_lambda_conv_op): Use a template-id in the
3911 call. Only forward parms for decltype.
3912 * pt.c (tsubst_copy_and_build) [CALL_EXPR]: Handle CALL_FROM_THUNK_P
3914 * typeck.c (check_return_expr): Don't mess with a thunk call.
3916 2019-01-28 Jason Merrill <jason@redhat.com>
3918 PR c++/89089 - ICE with [[no_unique_address]].
3919 PR c++/88865 - wrong layout with [[no_unique_address]].
3920 * class.c (check_field_decls): A potentially-overlapping field makes
3921 the class non-layout-POD, but not non-empty.
3922 (end_of_class): Always consider empty data members.
3923 (layout_class_type): Set DECL_SIZE for empty fields.
3925 2019-01-28 Marek Polacek <polacek@redhat.com>
3927 PR c++/88358 - name wrongly treated as type.
3928 * parser.c (cp_parser_direct_declarator): Don't assume a qualified-id
3929 in parameter-list is a type if the function's declarator-id is not
3932 2019-01-27 Marek Polacek <polacek@redhat.com>
3934 PR c++/88815 - narrowing conversion lost in decltype.
3935 PR c++/78244 - narrowing conversion in template not detected.
3936 * cp-tree.h (CONSTRUCTOR_IS_DEPENDENT): New.
3937 * pt.c (instantiation_dependent_r): Consider a CONSTRUCTOR with
3938 CONSTRUCTOR_IS_DEPENDENT instantiation-dependent.
3939 * semantics.c (finish_compound_literal): When the compound literal
3940 isn't instantiation-dependent and the type isn't type-dependent,
3941 fall back to the normal processing. Set CONSTRUCTOR_IS_DEPENDENT.
3943 PR c++/89024 - ICE with incomplete enum type.
3944 * call.c (standard_conversion): When converting an
3945 ARITHMETIC_TYPE_P to an incomplete type, return NULL.
3947 2019-01-25 Paolo Carlini <paolo.carlini@oracle.com>
3950 * call.c (build_op_delete_call): Implement 7.6.2.5/(10.1).
3951 * decl2.c (coerce_delete_type): Use build_pointer_type instead
3954 2019-01-24 Jason Merrill <jason@redhat.com>
3956 PR c++/89001 - mangling of reference temporaries
3957 * cp-tree.h (struct saved_scope): Add ref_temp_count.
3958 (current_ref_temp_count): New macro.
3959 * mangle.c (mangle_ref_init_variable): Use it.
3960 * typeck2.c (store_init_value): Clear it.
3961 * call.c (make_temporary_var_for_ref_to_temp): Copy public and
3964 2019-01-24 Jakub Jelinek <jakub@redhat.com>
3967 * semantics.c (finish_omp_cancel): Diagnose more than one if
3968 on #pragma omp cancel with different modifiers. Use
3969 maybe_convert_cond when not in template or build_x_binary_op
3972 2019-01-23 Marek Polacek <polacek@redhat.com>
3974 PR c++/88757 - qualified name treated wrongly as type.
3975 * parser.c (cp_parser_direct_declarator): Don't treat qualified-ids
3976 in parameter-list as types if name lookup for declarator-id didn't
3977 find one or more function templates.
3979 2019-01-23 Jakub Jelinek <jakub@redhat.com>
3982 * cp-gimplify.c (genericize_cp_loop): Call begin_bc_block only
3983 after genericizing cond and incr expressions.
3986 * cp-gimplify.c (genericize_switch_stmt): Move cond genericization
3987 before the begin_bc_block call.
3989 2019-01-21 Jason Merrill <jason@redhat.com>
3991 PR c++/87893 - constexpr ctor ICE on ARM.
3992 PR c++/88293 - ICE with comma expression.
3993 * constexpr.c (initialized_type): Don't shortcut non-void type.
3994 Handle COMPOUND_EXPR.
3995 (cxx_eval_outermost_constant_expr): Return early for void type.
3997 2019-01-21 Jakub Jelinek <jakub@redhat.com>
4000 * optimize.c (cxx_copy_decl): New function.
4001 (clone_body): Use it instead of copy_decl_no_change.
4004 * typeck.c (cp_build_binary_op): Don't instrument
4005 SANITIZE_POINTER_COMPARE if processing_template_decl.
4006 (pointer_diff): Similarly for SANITIZE_POINTER_SUBTRACT.
4008 2019-01-18 Jason Merrill <jason@redhat.com>
4010 PR c++/88875 - error with explicit list constructor.
4011 * call.c (reference_binding): Don't modify EXPR. Set
4012 need_temporary_p on the ck_user conversion for a temporary.
4013 (convert_like_real): Check it.
4015 2019-01-18 H.J. Lu <hongjiu.lu@intel.com>
4019 * call.c (convert_for_arg_passing): Upate the
4020 warn_for_address_or_pointer_of_packed_member call.
4021 * typeck.c (convert_for_assignment): Likewise.
4023 2019-01-17 Jason Merrill <jason@redhat.com>
4025 PR c++/86205 - ICE with ?: of throw and template-id.
4026 * pt.c (resolve_nondeduced_context_or_error): Split out from...
4027 * typeck.c (decay_conversion): ...here.
4028 * call.c (build_conditional_expr_1): Use it.
4030 PR c++/86740, ICE with constexpr if and nested generic lambdas.
4031 * tree.c (cp_walk_subtrees): Handle LAMBDA_EXPR.
4033 2019-01-17 Paolo Carlini <paolo.carlini@oracle.com>
4035 * decl.c (grokdeclarator): Use typespec_loc in error messages
4036 about 'auto' and trailing return type.
4038 2019-01-17 David Malcolm <dmalcolm@redhat.com>
4041 * class.c (add_method): Don't use DECL_DESTRUCTOR_P on
4044 2019-01-17 Nathan Sidwell <nathan@acm.org>
4047 * semantics.c (process_outer_var_ref): Only skip dependent types
4050 2019-01-17 Alexandre Oliva <aoliva@redhat.com>
4053 * cp-tree.h (saved_scope): Add suppress_location_wrappers.
4054 * name-lookup.c (do_push_to_top_level): Save and reset it.
4055 (do_pop_from_top_level): Restore it.
4058 * pt.c (make_template_placeholder): Use auto_identifier.
4059 (is_auto): Drop CLASS_PLACEHOLDER_TEMPLATE test.
4060 * error.c (dump_type): Handle template placeholders.
4061 * cxx-pretty-print.c (pp_cx_unqualified_id): Likewise.
4064 * cvt.c (convert_to_void): Handle all cdtor calls as if
4067 2019-01-16 Paolo Carlini <paolo.carlini@oracle.com>
4069 * decl.c (grokdeclarator): Use locations[ds_storage_class] in
4070 error messages about ill-formed uses of mutable.
4072 2019-01-16 Marek Polacek <polacek@redhat.com>
4074 PR c++/78244 - narrowing conversion in template not detected.
4075 * call.c (perform_implicit_conversion_flags): Set
4076 IMPLICIT_CONV_EXPR_BRACED_INIT.
4077 * cp-tree.h (IMPLICIT_CONV_EXPR_BRACED_INIT): New.
4078 * pt.c (tsubst_copy_and_build): Use it.
4080 2019-01-15 David Malcolm <dmalcolm@redhat.com>
4083 * pt.c (build_deduction_guide): Bail out if tsubst_arg_types
4086 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com>
4088 * decl.c (start_decl): Improve error location.
4089 * decl2.c (grokfield): Likewise.
4091 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com>
4093 * decl.c (grokdeclarator): Move further up the location_t loc
4094 declaration and use the location when building a TYPE_DECL for
4096 * decl2.c (grokbitfield): Use DECL_SOURCE_LOCATION in the error
4097 about an ill-formed bit-field as typedef.
4099 2019-01-14 Marek Polacek <polacek@redhat.com>
4101 PR c++/88830 - ICE with abstract class.
4102 * decl2.c (maybe_emit_vtables): Check CLASSTYPE_LAZY_DESTRUCTOR.
4105 PR c++/88825 - ICE with bogus function return type deduction.
4106 * typeck.c (can_do_nrvo_p): Check error_mark_node.
4108 2019-01-14 Tom Honermann <tom@honermann.net>
4110 Implement P0482R5, char8_t: A type for UTF-8 characters and strings
4111 * cvt.c (type_promotes_to): Handle char8_t promotion.
4112 * decl.c (grokdeclarator): Handle invalid type specifier
4113 combinations involving char8_t.
4114 * lex.c (init_reswords): Add char8_t as a reserved word.
4115 * mangle.c (write_builtin_type): Add name mangling for char8_t (Du).
4116 * parser.c (cp_keyword_starts_decl_specifier_p)
4117 (cp_parser_simple_type_specifier): Recognize char8_t as a simple
4119 (cp_parser_string_literal): Use char8_array_type_node for the type
4121 (cp_parser_set_decl_spec_type): Tolerate char8_t typedefs in system
4123 * rtti.c (emit_support_tinfos): type_info support for char8_t.
4124 * tree.c (char_type_p): Recognize char8_t as a character type.
4125 * typeck.c (string_conv_p): Handle conversions of u8 string
4126 literals of char8_t type.
4127 (check_literal_operator_args): Handle UDLs with u8 string literals
4129 * typeck2.c (ordinary_char_type_p): New.
4130 (digest_init_r): Disallow initializing a char array with a u8 string
4133 2019-01-14 Martin Liska <mliska@suse.cz>
4135 PR gcov-profile/88263
4136 * decl2.c (get_tls_wrapper_fn): Use DECL_SOURCE_LOCATION
4137 as location of the TLS wrapper.
4139 2019-01-12 Paolo Carlini <paolo.carlini@oracle.com>
4141 * decl.c (cp_finish_decl): Improve error location.
4142 * decl2.c (grokfield): Likewise, improve two locations.
4144 2019-01-11 Marek Polacek <polacek@redhat.com>
4146 PR c++/88692, c++/87882 - -Wredundant-move false positive with *this.
4147 * typeck.c (maybe_warn_pessimizing_move): Return if ARG isn't
4150 2019-01-11 Jason Merrill <jason@redhat.com>
4152 PR c++/88312 - pack expansion of decltype.
4153 * pt.c (instantiation_dependent_r): A template non-type parameter
4154 pack is instantiation-dependent.
4156 2019-01-11 Jason Merrill <jason@redhat.com>
4158 PR c++/88613 - ICE with use of const var in lambda.
4159 * expr.c (mark_use): Fix location wrapper handling.
4160 * cp-gimplify.c (cp_fold_maybe_rvalue): Call mark_rvalue_use.
4162 2019-01-11 Tobias Burnus <burnus@net-b.de>
4165 * decl2.c (maybe_emit_vtables): If needed, generate code for
4166 the destructor of an abstract class.
4167 (mark_used): Update comment for older function-name change.
4169 2019-01-11 Paolo Carlini <paolo.carlini@oracle.com>
4171 * decl.c (start_decl): Improve error location.
4172 (grokdeclarator): Likewise, improve two locations.
4174 2019-01-09 Sandra Loosemore <sandra@codesourcery.com>
4178 * cp-tree.h: Mechanically replace "can not" with "cannot".
4179 * parser.c: Likewise.
4182 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com>
4184 * decl.c (grok_reference_init): Improve error location.
4185 (grokdeclarator): Likewise, improve two locations.
4187 2019-01-08 Marek Polacek <polacek@redhat.com>
4189 PR c++/88538 - braced-init-list in template-argument-list.
4190 * parser.c (cp_parser_template_argument): Handle braced-init-list when
4193 PR c++/88548 - this accepted in static member functions.
4194 * parser.c (cp_debug_parser): Adjust printing of
4195 local_variables_forbidden_p.
4196 (cp_parser_new): Set local_variables_forbidden_p to 0 rather than false.
4197 (cp_parser_primary_expression): When checking
4198 local_variables_forbidden_p, use THIS_FORBIDDEN or
4199 LOCAL_VARS_FORBIDDEN.
4200 (cp_parser_lambda_body): Update the type of
4201 local_variables_forbidden_p. Set it to 0 rather than false.
4202 (cp_parser_condition): Adjust call to cp_parser_declarator.
4203 (cp_parser_explicit_instantiation): Likewise.
4204 (cp_parser_init_declarator): Likewise.
4205 (cp_parser_declarator): New parameter. Use it.
4206 (cp_parser_direct_declarator): New parameter. Use it to set
4207 local_variables_forbidden_p. Adjust call to cp_parser_declarator.
4208 (cp_parser_type_id_1): Adjust call to cp_parser_declarator.
4209 (cp_parser_parameter_declaration): Likewise.
4210 (cp_parser_default_argument): Update the type of
4211 local_variables_forbidden_p. Set it to LOCAL_VARS_AND_THIS_FORBIDDEN
4213 (cp_parser_member_declaration): Tell cp_parser_declarator if we saw
4214 'static' or 'friend'.
4215 (cp_parser_exception_declaration): Adjust call to cp_parser_declarator.
4216 (cp_parser_late_parsing_default_args): Update the type of
4217 local_variables_forbidden_p. Set it to LOCAL_VARS_AND_THIS_FORBIDDEN
4219 (cp_parser_cache_defarg): Adjust call to cp_parser_declarator.
4220 (cp_parser_objc_class_ivars): Likewise.
4221 (cp_parser_objc_struct_declaration): Likewise.
4222 (cp_parser_omp_for_loop_init): Likewise.
4223 * parser.h (cp_parser): Change the type of local_variables_forbidden_p
4225 (LOCAL_VARS_FORBIDDEN, LOCAL_VARS_AND_THIS_FORBIDDEN, THIS_FORBIDDEN):
4228 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com>
4230 * decl.c (start_decl): Improve permerror location.
4232 2019-01-08 Jonathan Wakely <jwakely@redhat.com>
4233 Jakub Jelinek <jakub@redhat.com>
4236 * decl.c (finish_function): For -Wreturn-type don't add a return *this;
4237 fixit hint if current_class_ref is NULL. Use a single if instead of
4240 2019-01-07 Paolo Carlini <paolo.carlini@oracle.com>
4242 * decl.c (start_decl): Improve two error_at locations.
4243 (expand_static_init): Likewise.
4245 2019-01-07 Marek Polacek <polacek@redhat.com>
4247 PR c++/88741 - wrong error with initializer-string.
4248 * decl.c (cp_complete_array_type): Strip any location wrappers.
4250 2019-01-07 Bernd Edlinger <bernd.edlinger@hotmail.de>
4256 * cp-tree.h (LOOKUP_ALLOW_FLEXARRAY_INIT): New flag value.
4257 * typeck2.c (digest_init_r): Raise an error for non-static
4258 initialization of a flexible array member.
4259 (process_init_constructor, massage_init_elt,
4260 process_init_constructor_array, process_init_constructor_record,
4261 process_init_constructor_union, process_init_constructor): Add the
4262 flags parameter and pass it thru.
4263 (store_init_value): Pass LOOKUP_ALLOW_FLEXARRAY_INIT parameter to
4264 digest_init_flags for static decls.
4266 2019-01-07 Jakub Jelinek <jakub@redhat.com>
4269 * cp-tree.h (cp_build_vec_convert): Declare.
4270 * parser.c (cp_parser_postfix_expression): Parse
4271 __builtin_convertvector.
4272 * constexpr.c: Include fold-const-call.h.
4273 (cxx_eval_internal_function): Handle IFN_VEC_CONVERT.
4274 (potential_constant_expression_1): Likewise.
4275 * semantics.c (cp_build_vec_convert): New function.
4276 * pt.c (tsubst_copy_and_build): Handle CALL_EXPR to
4279 2019-01-03 Jakub Jelinek <jakub@redhat.com>
4282 * decl.c (builtin_function_1): Return result of pushdecl_top_level
4283 or pushdecl rather than decl.
4285 2019-01-03 Paolo Carlini <paolo.carlini@oracle.com>
4287 * tree.c (handle_nodiscard_attribute): Improve warning location.
4289 2019-01-02 Marek Polacek <polacek@redhat.com>
4291 PR c++/88612 - ICE with -Waddress-of-packed-member.
4292 * call.c (convert_for_arg_passing): Only give warnings with tf_warning.
4293 * typeck.c (convert_for_assignment): Likewise.
4295 PR c++/88631 - CTAD failing for value-initialization.
4296 * typeck2.c (build_functional_cast): Try deducing the template
4297 arguments even if there are no arguments to deduce from.
4299 2019-01-01 Jakub Jelinek <jakub@redhat.com>
4301 Update copyright years.
4303 Copyright (C) 2019 Free Software Foundation, Inc.
4305 Copying and distribution of this file, with or without modification,
4306 are permitted in any medium without royalty provided the copyright
4307 notice and this notice are preserved.