1 2019-11-12 Jason Merrill <jason@redhat.com>
3 PR c++/92206 - ICE with typedef to dependent alias.
4 * pt.c (dependent_alias_template_spec_p)
5 (alias_template_specialization_p): Add transparent_typedefs
7 (iterative_hash_template_arg, any_template_parm_r)
8 (primary_template_specialization_p, tsubst, dependent_type_p_r):
10 * decl.c (check_elaborated_type_specifier): Adjust.
11 * error.c (dump_template_bindings, dump_aggr_type): Adjust.
13 2019-11-27 Andrew Sutton <asutton@lock3software.com>
16 Defer evaluation of concept checks so that static assertions can
17 emit more detailed diagnostics.
18 * constexpr.c (cxx_eval_call_expression): Handle concept checks.
19 (cxx_eval_constant_expression): Diagnose misuse of function concepts
20 as template-id expressions. Follow the usual return path for results.
21 (cxx_eval_outermost_constant_expr): Avoid calling
22 cp_get_callee_fndecl_nofold for function concepts.
23 * constraint.cc (build_function_check): Fully type the concept check
24 so that we don't ICE in conversions.
25 * cp-gimplify.c (cp_genericize_r) [CALL_EXPR]: Handle concept checks.
26 [TEMPLATE_ID_EXPR] Likewise.
27 * cvt.c (convert_to_void): Always evaluate concept checks so we don't
28 accidentally ignore them. Substitution during satisfaction can make
29 a program ill-formed (example in g++.dg/cpp2a/concepts6.C).
30 * pt.c (tsubst_copy_and_build): [CALL_EXPR]: Don't evaluate concepts.
31 [TEMPLATE_ID_EXPR]: Likewise.
32 * semantics.c (finish_call_expr): Don't evaluate concepts.
33 (finish_id_expression_1): Likewise.
34 (finish_static_assert): Preserve the original condition so we can
35 diagnose concept errors when a check returns false.
37 2019-11-27 Andrew Sutton <asutton@lock3software.com>
40 Improve quality of diagnostics for subexpressions that need parens.
41 * parser.c (cp_parser_requires_clause_opt): Add a flag to indicate
42 when parsing a requires-clause before lambda parameters, and...
43 (cp_parser_lambda_declarator_opt): ... use that here ...
44 (cp_parser_type_parameter): ... and here ...
45 (cp_parser_late_return_type_opt): ... and here ...
46 (cp_parser_explicit_template_declaration): ... and here.
47 (cp_parser_diagnose_ungrouped_constraint_plain): Adjust the message
48 because this can apply to subexpressions that are not immediately
49 after a requires-clause.
50 (cp_parser_diagnose_ungrouped_constraint_rich): Likewise.
51 (primary_constraint_error): New.
52 (cp_parser_constraint_requires_parens): New.
53 (cp_parser_unary_constraint_requires_parens): New.
54 (cp_parser_constraint_primary_expression): Check for unary expressions
55 before parsing the primary expression. Also check for binary and
56 postfix operators after a successful parse of the primary expression.
57 Force a re-parse if the result would form a lower-precedence string.
58 (cp_parser_constraint_logical_and_expression): Propagate lambda flag;
59 move checks for ill-formed constraints into the constraint primary
61 (cp_parser_constraint_logical_or_expression): Likewise.
62 (cp_parser_requires_clause_expression): Propagate lambda flag.
64 2019-11-27 Andrew Sutton <asutton@lock3software.com>
67 * constraint.cc (satisfy_declaration_constraints): Push tinst levels
70 2019-11-27 Andrew Sutton <asutton@lock3software.com>
72 Diagnose certain constraint errors as hard errors, but otherwise treat
73 them the same as normal SFINAE-type errors. Also, generally clean up
74 the satisfaction functions.
76 * constexpr.c (cxx_eval_constant_expression): Use
77 evaluate_concept_check.
78 * constraint.cc (normalize_concept_definition): Accept a diagnostic
79 flag and only cache when not diagnosing errors.
80 (decl_satisfied_cache): Map to trees instead of bools.
81 (satisfy_atom): Guarantee a location for the errors, propagate complain
82 flags to force_rvalue, and emit errors for non-boolean constraints.
83 (get_normalized_constraints_and_args): New overloads. Factored out of
84 satisfy_constraint_expression and satisfy_declaration_constraints.
85 (satisfy_constraint_expression): Propagate diagnostic info to
87 (satisfy_declaration_constraints): New. Factored out of
88 constraints_satisfied_p.
89 (constraint_satisfaction_value): New. Calls
90 satisfy_constraint_expression or satisfy_declaration_constraints.
91 (constraints_satisfied_p): Call constraint_satisfaction_value.
92 (evaluate_concept_check): Don't take tsubst_falgs_t. Replay
93 satisfaction if an error is encountered.
94 (current_failed_constraint): Moved from pt.c.
95 (diagnose_constraints): Call constraint_satisfaction_value.
96 * cp-tree.h: Update declarations.
97 * pt.c (current_failed_constraint): Moved to constraint.cc.
98 * semantics.c (finish_id_expression_1): Remove a duplicate case.
100 2019-11-27 Jakub Jelinek <jakub@redhat.com>
103 * tree.c (replace_placeholders_r): Don't walk constructor elts with
106 2019-11-26 Jason Merrill <jason@redhat.com>
108 * pt.c (tsubst_copy_and_build) [TEMPLATE_ID_EXPR]: Remember the
109 location of a variable template-id.
110 * constexpr.c (cxx_eval_constant_expression): Get expr location
111 before stripping location wrappers.
112 (non_const_var_error): Take location argument.
114 2019-11-26 Paolo Carlini <paolo.carlini@oracle.com>
116 * typeck.c (cp_build_unary_op): Consistently use the accurate
117 location in seven additional diagnostic messages.
118 (cp_build_compound_expr): Use cp_expr_loc_or_input_loc in one place.
120 2019-11-26 Jakub Jelinek <jakub@redhat.com>
123 * parser.c (cp_parser_std_attribute): For unknown attributes,
124 skip balanced token seq instead of trying to parse
125 attribute-argument-clause as expression list. Formatting fix.
128 * class.c (enum_to_min_precision): New hash_map.
129 (enum_min_precision): New function.
130 (check_bitfield_decl): Use it.
132 2019-11-25 Paolo Carlini <paolo.carlini@oracle.com>
134 * typeck.c (cp_build_indirect_ref_1): Add location_t parameter
135 and use it in error messages.
136 (build_x_indirect_ref): Adjust call.
137 (build_indirect_ref): Likewise.
138 (cp_build_fold_indirect_ref): Likewise.
139 (cp_build_array_ref): Likewise.
140 * call.c (build_new_op_1): Likewise.
141 * semantics.c (finish_omp_clauses): Likewise.
142 (finish_omp_depobj): Likewise.
143 * typeck2.c (build_x_arrow): Likewise.
144 * cp-tree.h (cp_build_indirect_ref): Update declaration.
146 * call.c (build_new_op_1): Use location argument in warning_at.
148 * typeck.c (cp_build_modify_expr): Consistently use the
151 2019-11-23 Bernd Edlinger <bernd.edlinger@hotmail.de>
154 * name-lookup.c (check_local_shadow): Use can_convert_arg
155 instead of can_convert.
157 2019-11-22 Marek Polacek <polacek@redhat.com>
159 PR c++/88337 - P1327R1: Allow polymorphic typeid in constexpr.
160 * constexpr.c (potential_constant_expression_1): Allow a typeid
161 expression whose operand is of polymorphic type in constexpr in
163 * rtti.c (build_typeid): Remove obsolete FIXME comment.
165 2019-11-22 Jakub Jelinek <jakub@redhat.com>
168 * cp-objcp-common.c (identifier_global_tag): Define.
171 * init.c (nsdmi_inst): Change type to
172 decl_tree_cache_map * from tree_cache_map *.
173 * constraint.cc (decl_constraints): Likewise.
174 * decl.c (get_tuple_decomp_init): Likewise.
175 * pt.c (defarg_inst, explicit_specifier_map): Likewise.
176 (tsubst_default_argument, store_explicit_specifier): Use
177 decl_tree_cache_map::create_ggc rather than
178 tree_cache_map::create_ggc.
179 * cp-objcp-common.c (debug_type_map): Change type to
180 type_tree_cache_map * from tree_cache_map *.
182 2019-11-21 Marek Polacek <polacek@redhat.com>
184 PR c++/92450 - ICE with invalid nested name specifier.
185 * parser.c (cp_parser_member_declaration): Don't attempt to print
186 erroneous bit-field diagnostic if grokdeclarator returns
189 2019-11-21 Jakub Jelinek <jakub@redhat.com>
190 Jason Merrill <jason@redhat.com>
193 * parser.c (cp_parser_decl_specifier_seq): For concept or typedef
194 break early if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR.
195 For type specifiers, set CP_PARSER_FLAGS_NO_TYPE_DEFINITIONS
196 if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR is set.
198 2019-11-20 Paolo Carlini <paolo.carlini@oracle.com>
200 * typeck2.c (build_x_arrow): Early return if decay_conversion
201 returns error_mark_node.
203 2019-11-20 Jakub Jelinek <jakub@redhat.com>
206 * call.c (complain_about_no_candidates_for_method_call): If
207 conv->from is not a type, pass to complain_about_bad_argument
208 lvalue_type of conv->from.
210 2019-11-20 Paolo Carlini <paolo.carlini@oracle.com>
212 * cvt.c (ocp_convert): Use additional warning sentinel.
214 2019-11-19 Jakub Jelinek <jakub@redhat.com>
217 * constexpr.c (cxx_eval_outermost_constant_expr): If DECL_INITIAL
218 on object is erroneous, return t without trying to evaluate
221 2019-11-12 Jason Merrill <jason@redhat.com>
223 * call.c (same_fn_or_template): Change to cand_parms_match.
225 (print_z_candidate): Mark rewritten/reversed candidates.
226 (build_new_op_1): Warn about recursive call with reversed arguments.
228 2019-11-15 Andrew Sutton <asutton@lock3software.com>
231 * pt.c (get_underlying_template): Exit loop if the original type
232 of the alias is null.
234 2019-11-19 Andrew Sutton <asutton@lock3software.com>
237 * pt.c (maybe_new_partial_specialization): Apply access to newly
238 created partial specializations. Update comment style.
240 2019-11-19 Andrew Sutton <asutton@lock3software.com>
243 * pt.c (maybe_new_partial_specialization): Apply access to newly
244 created partial specializations. Update comment style.
246 2019-11-19 Andrew Sutton <asutton@lock3software.com>
249 Suppress diagnostics substituting into a requires-expression.
250 * pt.c (tsubst_copy_and_build): Perform the first substitution without
251 diagnostics and a second only if tsubst_requries_expr returns an error.
253 2019-11-19 Jakub Jelinek <jakub@redhat.com>
256 * semantics.c (handle_omp_for_class_iterator): Don't call
257 cp_fully_fold on cond.
259 2019-11-18 Paolo Carlini <paolo.carlini@oracle.com>
261 * typeck.c (cp_build_addr_expr_1): Use cp_expr_loc_or_input_loc
263 (cxx_sizeof_expr): Use it in one additional place.
264 (cxx_alignof_expr): Likewise.
265 (lvalue_or_else): Likewise.
267 2019-11-18 Marek Polacek <polacek@redhat.com>
269 PR c++/91962 - ICE with reference binding and qualification conversion.
270 * call.c (convert_like_real) <case ck_ref_bind>: Check need_temporary_p.
272 2019-11-17 Jakub Jelinek <jakub@redhat.com>
274 * method.c (lookup_comparison_result): Use %qD instead of %<%T::%D%>
276 (lookup_comparison_category): Use %qD instead of %<std::%D%> to print
279 2019-11-15 Paolo Carlini <paolo.carlini@oracle.com>
281 * typeck.c (cp_truthvalue_conversion): Add tsubst_flags_t parameter
282 and use it in calls; also pass the location_t of the expression to
283 cp_build_binary_op and c_common_truthvalue_conversion.
284 * rtti.c (build_dynamic_cast_1): Adjust call.
285 * cvt.c (ocp_convert): Likewise.
286 * cp-gimplify.c (cp_fold): Likewise.
287 * cp-tree.h (cp_truthvalue_conversion): Update declaration.
289 2019-11-14 Jason Merrill <jason@redhat.com>
291 Implement P1816R0, class template argument deduction for aggregates.
292 * pt.c (maybe_aggr_guide, collect_ctor_idx_types): New.
293 (is_spec_or_derived): Split out from do_class_deduction.
294 (build_deduction_guide): Handle aggregate guide.
295 * class.c (finish_struct): Set CLASSTYPE_NON_AGGREGATE in a
297 * cp-tree.h (CP_AGGREGATE_TYPE_P): An incomplete class is not an
300 2019-11-14 Richard Sandiford <richard.sandiford@arm.com>
302 * call.c (build_conditional_expr_1): Use truth_type_for instead
303 of build_same_sized_truth_vector_type.
304 * typeck.c (build_vec_cmp): Likewise.
306 2019-11-14 Jakub Jelinek <jakub@redhat.com>
308 * parser.c (cp_parser_omp_context_selector): Don't require score
309 argument to fit into shwi, just to be INTEGER_CST. Diagnose
311 * pt.c (tsubst_attribute): Likewise.
313 * parser.c (cp_parser_omp_context_selector): Rename
314 CTX_PROPERTY_IDLIST to CTX_PROPERTY_NAME_LIST, add CTX_PROPERTY_ID.
315 Use CTX_PROPERTY_ID for atomic_default_mem_order, only allow a single
316 identifier in that. For CTX_PROPERTY_NAME_LIST, allow identifiers
318 * pt.c (tsubst_attribute): Fix up STRING_CST handling if allow_string.
320 2019-11-13 Marek Polacek <polacek@redhat.com>
322 PR c++/89070 - bogus [[nodiscard]] warning in SFINAE.
323 * cvt.c (convert_to_void): Guard maybe_warn_nodiscard calls with
326 2019-11-13 Richard Sandiford <richard.sandiford@arm.com>
329 * cp-tree.h (STF_STRIP_DEPENDENT): New constant.
330 * tree.c (strip_typedefs): Add STF_STRIP_DEPENDENT to the flags
331 when calling strip_typedefs recursively on a DECL_ORIGINAL_TYPE.
332 Don't apply the fix for DR1558 in that case; allow aliases with
333 dependent template parameters to be stripped instead.
335 2019-11-12 Nathan Sidwell <nathan@acm.org>
337 * name-lookup.c (lookup_using_decl): New function, merged from ...
338 (do_class_using_decl): ... here. Call it. And ...
339 (finish_nonmember_using_decl): ... here. Call it.
341 2019-11-12 Martin Liska <mliska@suse.cz>
343 * name-lookup.c: Do not include params.h.
344 * typeck.c: Likewise.
346 2019-11-12 Martin Liska <mliska@suse.cz>
348 * name-lookup.c (namespace_hints::namespace_hints): Replace old
349 parameter syntax with the new one, include opts.h if needed. Use
350 SET_OPTION_IF_UNSET macro.
351 * typeck.c (comptypes): Likewise.
353 2019-11-12 Maciej W. Rozycki <macro@codesourcery.com>
354 Frederik Harwath <frederik@codesourcery.com>
357 * constexpr.c (potential_constant_expression_1): Handle
359 * parser.c (OACC_SERIAL_CLAUSE_MASK): New macro.
360 (cp_parser_oacc_kernels_parallel): Rename function to...
361 (cp_parser_oacc_compute): ... this. Handle PRAGMA_OACC_SERIAL.
362 (cp_parser_omp_construct): Update accordingly.
363 (cp_parser_pragma): Handle PRAGMA_OACC_SERIAL. Fix alphabetic
365 * pt.c (tsubst_expr): Handle OACC_SERIAL.
367 2019-11-11 Jason Merrill <jason@redhat.com>
369 Implement P1946R0, Allow defaulting comparisons by value.
370 * method.c (early_check_defaulted_comparison): Accept by-value,
371 reject mixed by-value and by-reference parms.
372 * decl.c (grokdeclarator): Set funcdef_flag for defaulted friend.
373 * decl2.c (grokfield): Don't SET_DECL_FRIEND_CONTEXT.
375 * typeck.c (cp_build_binary_op): Sorry about <=> on VECTOR_TYPE.
377 2019-11-11 Jakub Jelinek <jakub@redhat.com>
380 * decl.c (finish_function): Move ctype initialization before
381 DECL_DELETED_FN handling.
383 * semantics.c (finish_translation_unit): Diagnose declare target
384 without corresponding end declare target.
386 2019-11-10 Jason Merrill <jason@redhat.com>
388 Implement D1957R0, T* to bool should be considered narrowing.
389 * typeck2.c (check_narrowing): Treat pointer->bool as a narrowing
390 conversion with -std=c++2a.
392 2019-11-08 Marek Polacek <polacek@redhat.com>
394 PR c++/92215 - flawed diagnostic for bit-field with non-integral type.
395 * parser.c (cp_parser_member_declaration): Add a diagnostic for
396 bit-fields with non-integral types.
398 2019-11-08 Jakub Jelinek <jakub@redhat.com>
400 * init.c (build_vec_delete_1): Fix a comment typo - mist -> must.
402 2019-11-07 Jason Merrill <jason@redhat.com>
404 Implement D1959R0, remove weak_equality and strong_equality.
405 * method.c (enum comp_cat_tag, comp_cat_info): Remove *_equality.
406 (genericize_spaceship, common_comparison_type): Likewise.
407 * typeck.c (cp_build_binary_op): Move SPACESHIP_EXPR to be with the
408 relational operators, exclude other types no longer supported.
410 2019-11-06 Jason Merrill <jason@redhat.com>
412 Implement D1907R1 "structural type".
413 * tree.c (structural_type_p): New.
414 * pt.c (invalid_nontype_parm_type_p): Use it.
415 * class.c (build_base_field_1): Take binfo. Copy TREE_PRIVATE.
416 (build_base_field): Pass binfo.
418 PR c++/92150 - partial specialization with class NTTP.
419 * pt.c (unify): Handle VIEW_CONVERT_EXPR.
421 * pt.c (use_pack_expansion_extra_args_p): Still do substitution if
422 all packs are simple pack expansions.
423 (add_extra_args): Check that the extra args aren't dependent.
425 2019-11-06 Andrew Sutton <asutton@lock3software.com>
427 Use satisfaction with nested requirements.
428 * constraint.cc (build_parameter_mapping): Use
429 current_template_parms when the declaration is not available.
430 (norm_info::norm_info) Make explicit.
431 (normalize_constraint_expression): Factor into a separate overload
432 that takes arguments, and use that in the original function.
433 (tsubst_nested_requirement): Use satisfy_constraint instead of
434 trying to evaluate this as a constant expression.
435 (finish_nested_requirement): Keep the normalized constraint and the
436 original normalization arguments with the requirement.
437 (diagnose_nested_requirement): Use satisfy_constraint. Tentatively
438 implement more comprehensive diagnostics, but do not enable.
439 * parser.c (cp_parser_requires_expression): Relax requirement that
440 requires-expressions can live only inside templates.
441 * pt.c (any_template_parm_r): Look into type of PARM_DECL.
443 2019-11-06 Jason Merrill <jason@redhat.com>
445 C++20 NB CA378 - Remove constrained non-template functions.
446 * decl.c (grokfndecl): Reject constraints on non-templated function.
448 2019-11-06 Matthias Kretz <m.kretz@gsi.de>
450 * parser.c (cp_parser_operator): Parse operator?: as an
451 attempt to overload the conditional operator.
453 2019-11-05 Jason Merrill <jason@redhat.com>
455 Implement C++20 operator<=>.
456 * cp-tree.h (struct lang_decl_fn): Add maybe_deleted bitfield.
457 (DECL_MAYBE_DELETED): New.
458 (enum special_function_kind): Add sfk_comparison.
459 (LOOKUP_REWRITTEN, LOOKUP_REVERSED): New.
460 * call.c (struct z_candidate): Add rewritten and reversed methods.
461 (add_builtin_candidate): Handle SPACESHIP_EXPR.
462 (add_builtin_candidates): Likewise.
463 (add_candidates): Don't add a reversed candidate if the parms are
465 (add_operator_candidates): Split out from build_new_op_1. Handle
466 rewritten and reversed candidates.
467 (add_candidate): Swap conversions of reversed candidate.
468 (build_new_op_1): Swap them back. Build a second operation for
469 rewritten candidates.
470 (extract_call_expr): Handle rewritten calls.
471 (same_fn_or_template): New.
472 (joust): Handle rewritten and reversed candidates.
473 * class.c (add_implicitly_declared_members): Add implicit op==.
474 (classtype_has_op, classtype_has_defaulted_op): New.
475 * constexpr.c (cxx_eval_binary_expression): Handle SPACESHIP_EXPR.
476 (cxx_eval_constant_expression, potential_constant_expression_1):
478 * cp-gimplify.c (genericize_spaceship): New.
479 (cp_genericize_r): Use it.
480 * cp-objcp-common.c (cp_common_init_ts): Handle SPACESHIP_EXPR.
481 * decl.c (finish_function): Handle deleted function.
482 * decl2.c (grokfield): SET_DECL_FRIEND_CONTEXT on defaulted friend.
483 (mark_used): Check DECL_MAYBE_DELETED. Remove assumption that
484 defaulted functions are non-static members.
485 * error.c (dump_expr): Handle SPACESHIP_EXPR.
486 * method.c (type_has_trivial_fn): False for sfk_comparison.
487 (enum comp_cat_tag, struct comp_cat_info_t): New types.
488 (comp_cat_cache): New array variable.
489 (lookup_comparison_result, lookup_comparison_category)
490 (is_cat, cat_tag_for, spaceship_comp_cat)
491 (spaceship_type, genericize_spaceship)
492 (common_comparison_type, early_check_defaulted_comparison)
493 (comp_info, build_comparison_op): New.
494 (synthesize_method): Handle sfk_comparison. Handle deleted.
495 (get_defaulted_eh_spec, maybe_explain_implicit_delete)
496 (explain_implicit_non_constexpr, implicitly_declare_fn)
497 (defaulted_late_check, defaultable_fn_check): Handle sfk_comparison.
498 * name-lookup.c (get_std_name_hint): Add comparison categories.
499 * tree.c (special_function_p): Add sfk_comparison.
500 * typeck.c (cp_build_binary_op): Handle SPACESHIP_EXPR.
502 2019-11-05 Tim van Deurzen <tim@kompiler.org>
504 Add new tree code for the spaceship operator.
505 * cp-tree.def: Add new tree code.
506 * operators.def: New binary operator.
507 * parser.c: Add new token and tree code.
509 2019-09-15 Jason Merrill <jason@redhat.com>
511 * call.c (build_new_op_1): Don't apply any standard conversions to
512 the operands of a built-in operator. Don't suppress conversions in
514 * typeck.c (cp_build_unary_op): Do integral promotions for enums.
516 2019-11-04 Jason Merrill <jason@redhat.com>
518 Use vec instead of raw array for built-in candidates.
519 * call.c (build_builtin_candidate): Take args in a vec.
520 (add_builtin_candidate, add_builtin_candidates): Likewise.
521 (build_conditional_expr_1, build_new_op_1): Adjust.
523 2019-11-04 Jason Merrill <jason@redhat.com>
525 * constexpr.c (explain_invalid_constexpr_fn): Show location of fn.
527 * pt.c (maybe_instantiate_noexcept): Only update clones if we
530 * typeck.c (contextual_conv_bool): New.
532 * name-lookup.c (lookup_qualified_name): Add wrapper overload taking
533 C string rather than identifier.
534 * parser.c (cp_parser_userdef_numeric_literal): Use it.
535 * rtti.c (emit_support_tinfos): Use it.
536 * cp-tree.h (ovl_op_identifier): Change to inline functions.
537 (build_x_binary_op): Add wrapper with fewer parms.
539 2019-11-05 Jason Merrill <jason@redhat.com>
541 * decl2.c (mark_used): Diagnose use of a function with unsatisfied
543 * typeck.c (cp_build_function_call_vec): Not here.
545 2019-11-05 Nathan Sidwell <nathan@acm.org>
548 * parser.c (cp_parser_error_1): Check EOF and UNKNOWN_LOCATION
549 when skipping over version control marker.
551 2019-11-05 Jakub Jelinek <jakub@redhat.com>
554 * constexpr.c (potential_constant_expression_1): Return true rather
555 than false for PREDICT_EXPR.
557 * decl.c (omp_declare_variant_finalize_one): Call
558 declare_simd_adjust_this not just on the context, but also on the
559 variant-id expression for methods. Don't call
560 cp_get_callee_fndecl_nofold, call cp_get_callee and only if it is
561 safe cp_get_fndecl_from_callee. Don't try to print as %qD
563 * pt.c (tsubst_attribute): Handle "omp declare variant base"
565 (tsubst_function_decl): Call omp_declare_variant_finalize
566 if there are any "omp declare variant base" attributes left.
568 2019-11-04 Kamlesh Kumar <kamleshbhalui@gmail.com>
570 PR c++/91979 - mangling nullptr expression
571 * mangle.c (write_template_arg_literal): Handle nullptr
574 2019-11-04 Jason Merrill <jason@redhat.com>
576 * typeck.c (check_return_expr): Avoid redundant error.
578 2019-11-02 Paolo Carlini <paolo.carlini@oracle.com>
580 * typeck.c (composite_pointer_type): Add a const op_location_t&
581 parameter and use it in diagnostics.
582 (composite_pointer_error): Likewise.
583 (composite_pointer_type_r): Add a const op_location_t&
584 parameter and forward it.
585 (cp_build_binary_op): Adjust calls.
586 (common_pointer_type): Likewise.
587 * call.c (add_builtin_candidate): Likewise.
588 (build_conditional_expr_1): Likewise.
589 * cp-tree.h (composite_pointer_type): Update declaration.
591 * typeck.c (cxx_sizeof_expr): Use cp_expr_loc_or_input_loc
593 (cxx_alignof_expr): Likewise.
594 (lvalue_or_else): Likewise.
596 2019-11-02 Jakub Jelinek <jakub@redhat.com>
598 * decl.c (omp_declare_variant_finalize_one): Use
599 omp_get_context_selector instead of c_omp_get_context_selector.
602 * parser.c (cp_parser_decl_specifier_seq): Don't parse attributes
603 if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR.
605 PR c++/88335 - Implement P1073R3: Immediate functions
606 * cp-tree.h (struct lang_decl_fn): Add immediate_fn_p bit.
607 (DECL_IMMEDIATE_FUNCTION_P, SET_DECL_IMMEDIATE_FUNCTION_P): Define.
608 (enum cp_decl_spec): Add ds_consteval.
609 (fold_non_dependent_expr): Add another tree argument defaulted to
611 * name-lookup.h (struct cp_binding_level): Add immediate_fn_ctx_p
613 * parser.c (cp_keyword_starts_decl_specifier_p): Adjust comments
614 for C++11 and C++20 specifiers. Handle RID_CONSTEVAL.
615 (CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR): Adjust comment.
616 (CP_PARSER_FLAGS_CONSTEVAL): New.
617 (cp_parser_skip_balanced_tokens): New forward declaration.
618 (cp_parser_lambda_declarator_opt): Handle ds_consteval. Set
619 current_binding_level->immediate_fn_ctx_p before parsing parameter
620 list if decl-specifier-seq contains consteval specifier.
621 (cp_parser_decl_specifier_seq): Handle RID_CONSTEVAL.
622 (cp_parser_explicit_instantiation): Diagnose explicit instantiation
623 with consteval specifier.
624 (cp_parser_init_declarator): For consteval or into flags
625 CP_PARSER_FLAGS_CONSTEVAL.
626 (cp_parser_direct_declarator): If CP_PARSER_FLAGS_CONSTEVAL, set
627 current_binding_level->immediate_fn_ctx_p in the sk_function_parms
629 (set_and_check_decl_spec_loc): Add consteval entry, formatting fix.
630 * call.c (build_addr_func): For direct calls to immediate functions
631 use build_address rather than decay_conversion.
632 (build_over_call): Evaluate immediate function invocations.
633 * error.c (dump_function_decl): Handle DECL_IMMEDIATE_FUNCTION_P.
634 * semantics.c (expand_or_defer_fn_1): Use tentative linkage and don't
635 call mark_needed for immediate functions.
636 * typeck.c (cxx_sizeof_or_alignof_expr): Likewise. Formatting fix.
637 (cp_build_addr_expr_1): Reject taking address of immediate function
638 outside of immediate function.
639 * decl.c (validate_constexpr_redeclaration): Diagnose consteval
640 vs. non-consteval or vice versa redeclaration. Use
641 SET_DECL_IMMEDIATE_FUNCTION_P if new_decl is immediate function.
642 (check_tag_decl): Use %qs with keyword string to simplify translation.
644 (start_decl): Adjust diagnostics for static or thread_local variables
645 in immediate functions.
646 (grokfndecl): Call sorry_at on virtual consteval. Use %qs with keyword
647 to string to simplify translation. Diagnose consteval main. Use
648 SET_DECL_IMMEDIATE_FUNCTION_P for consteval.
649 (grokdeclarator): Handle consteval. Use %qs with keyword strings to
650 simplify translation. Use separate ifs instead of chained else if
651 for invalid specifiers. For constinit clear constinit_p rather than
653 * constexpr.c (find_immediate_fndecl): New function.
654 (cxx_eval_outermost_constant_expr): Allow consteval calls returning
655 void. Diagnose returning address of immediate function from consteval
657 (fold_non_dependent_expr_template): Add OBJECT argument, pass it
658 through to cxx_eval_outermost_constant_expr.
659 (fold_non_dependent_expr): Add OBJECT argument, pass it through to
660 fold_non_dependent_expr_template.
661 (fold_non_dependent_init): Adjust fold_non_dependent_expr_template
663 * method.c (defaulted_late_check): Adjust diagnostics for consteval.
664 * lambda.c (maybe_add_lambda_conv_op): Copy over
665 DECL_DECLARED_CONSTEXPR_P and DECL_IMMEDIATE_FUNCTION_P bits from
666 callop to both artificial functions.
667 * init.c (build_value_init): Don't do further processing if
668 build_special_member_call returned a TREE_CONSTANT. Formatting fix.
670 PR c++/91369 - Implement P0784R7: constexpr new
671 * cp-tree.h (CALL_FROM_NEW_OR_DELETE_P): Define.
672 * init.c (build_new_1, build_vec_delete_1, build_delete): Set
673 CALL_FROM_NEW_OR_DELETE_P on the CALL_EXPR to allocator functions.
674 * constexpr.c (is_std_allocator_allocate): Only allow
675 global replaceable allocator functions if CALL_FROM_NEW_OR_DELETE_P
676 or in std::allocate<T>::{,de}allocate.
677 (potential_constant_expression_1): Likewise.
679 2019-11-01 Nathan Sidwell <nathan@acm.org>
681 * class.c (check_field_decls): Refactor.
683 2019-10-31 Jakub Jelinek <jakub@redhat.com>
686 * cp-tree.h (type_initializer_zero_p): Declare.
687 * decl.c (reshape_init_array_1): Formatting fix.
688 * tree.c (type_initializer_zero_p): New function. Moved from
689 ../tree.c, use next_initializable_field, formatting fix. Return
690 false for TYPE_NON_AGGREGATE_CLASS types.
692 2019-10-30 Jason Merrill <jason@redhat.com>
694 PR c++/92268 - hard error satisfying return-type-requirement
695 * constraint.cc (type_deducible_p): Check for substitution failure.
696 (diagnose_compound_requirement): Adjust diagnostic.
697 * pt.c (do_auto_deduction): Don't pass cargs to
698 constraints_satisfied_p.
700 2019-10-30 Jakub Jelinek <jakub@redhat.com>
702 PR c++/91369 - Implement P0784R7: constexpr new
703 * constexpr.c (cxx_replaceable_global_alloc_fn): Don't return true
705 (cxx_placement_new_fn, is_std_construct_at): New functions.
706 (cxx_eval_call_expression): Allow placement new in std::construct_at.
707 (potential_constant_expression_1): Likewise.
709 * typeck.c (decl_in_std_namespace_p): Return true also for decls
710 in inline namespaces inside of std namespace.
712 2019-10-30 Bernd Edlinger <bernd.edlinger@hotmail.de>
715 * name-lookup.c (check_local_shadow): Shadowing TYPE_DECLs
716 is always a -Wshadow=compatible-local warning, unless
719 2019-10-30 Jason Merrill <jason@redhat.com>
721 * cxx-pretty-print.c (get_fold_operator): Use OVL_OP_INFO.
723 2019-10-30 Marek Polacek <polacek@redhat.com>
725 PR c++/92134 - constinit malfunction in static data member.
726 * decl2.c (grokfield): Set LOOKUP_CONSTINIT.
728 2019-10-30 Jakub Jelinek <jakub@redhat.com>
730 * cp-tree.h (omp_declare_variant_finalize, build_local_temp): Declare.
731 * decl.c: Include omp-general.h.
732 (declare_simd_adjust_this): Add forward declaration.
733 (omp_declare_variant_finalize_one, omp_declare_variant_finalize): New
735 (cp_finish_decl, finish_function): Call omp_declare_variant_finalize.
736 * parser.c (cp_finish_omp_declare_variant): Adjust parsing of the
737 variant id-expression and propagate enough information to
738 omp_declare_variant_finalize_one in the attribute so that it can
740 * class.c (finish_struct): Call omp_declare_variant_finalize.
741 * tree.c (build_local_temp): No longer static, remove forward
744 2019-10-30 Paolo Carlini <paolo.carlini@oracle.com>
746 * typeck.c (cp_build_modify_expr): Prefer error + inform to
747 error + error in one place.
748 (get_delta_difference_1): Likewise.
749 (get_delta_difference): Likewise, in two places.
751 2019-10-29 Paolo Carlini <paolo.carlini@oracle.com>
753 * typeck.c (build_x_unary_op): Use the location_t argument in
756 2019-10-29 Marek Polacek <polacek@redhat.com>
758 PR c++/90998 - ICE with copy elision in init by ctor and -Wconversion.
759 * call.c (joust): Don't attempt to warn if ->second_conv is null.
761 2019-10-29 Jakub Jelinek <jakub@redhat.com>
764 * cp-gimplify.c (cp_gimplify_expr): If gimplify_to_rvalue changes the
765 function pointer type, re-add cast to the original one.
767 2019-10-29 Marek Polacek <polacek@redhat.com>
769 PR c++/91548 - fix detecting modifying const objects for ARRAY_REF.
770 * constexpr.c (cxx_eval_store_expression): Don't call
771 modifying_const_object_p for ARRAY_REF.
773 2019-10-29 Richard Sandiford <richard.sandiford@arm.com>
775 * cp-objcp-common.h (cxx_simulate_enum_decl): Declare.
776 (LANG_HOOKS_SIMULATE_ENUM_DECL): Define to the above.
777 * decl.c (cxx_simulate_enum_decl): New function.
779 2019-10-29 Richard Sandiford <richard.sandiford@arm.com>
781 * cp-tree.h (cxx_simulate_builtin_function_decl): Declare.
782 * decl.c (cxx_simulate_builtin_function_decl): New function.
783 * cp-objcp-common.h (LANG_HOOKS_SIMULATE_BUILTIN_FUNCTION_DECL):
786 2019-10-28 Martin Sebor <msebor@redhat.com>
789 * cp-objcp-common.c (names_builtin_p): Define new function.
791 2019-10-28 Nathan Sidwell <nathan@acm.org>
793 * parser.h (struct cp_token): Drop {ENUM,BOOL}_BITFIELD C-ism.
794 Add tree_check_p flag, use as nested union discriminator.
795 (struct cp_lexer): Add saved_type & saved_keyword fields.
796 * parser.c (eof_token): Delete.
797 (cp_lexer_new_main): Always init last_token to last token of
799 (cp_lexer_new_from_tokens): Overlay EOF token at end of range.
800 (cp_lexer_destroy): Restore token under the EOF.
801 (cp_lexer_previous_token_position): No check for eof_token here.
802 (cp_lexer_get_preprocessor_token): Clear tree_check_p.
803 (cp_lexer_peek_nth_token): Check CPP_EOF not eof_token.
804 (cp_lexer_consume_token): Assert not CPP_EOF, no check for
806 (cp_lexer_purge_token): Likewise.
807 (cp_lexer_purge_tokens_after): No check for EOF token.
808 (cp_parser_nested_name_specifier, cp_parser_decltype)
809 (cp_parser_template_id): Set tree_check_p.
811 2019-10-24 Jakub Jelinek <jakub@redhat.com>
813 * decl2.c (cplus_decl_attributes): Add "omp declare target block"
814 attribute in between declare target and end declare target
817 * call.c (convert_arg_to_ellipsis): Add missing space in string
820 2019-10-24 Marek Polacek <polacek@redhat.com>
822 * decl.c (reshape_init_r): Add missing space.
824 2019-10-24 Nathan Sidwell <nathan@acm.org>
826 * pt.c (reduce_template_parm_level): Attach the new TPI to the new
828 (convert_generic_types_to_packs): Pass the copied type to
829 reduce_templatE_parm_level.
831 2019-10-23 Nathan Sidwell <nathan@acm.org>
833 * cp-tree.c (CPTI_STD_IDENTIFIER): Delete.
834 (std_identifier): Delete.
835 (DECL_NAME_SPACE_STD_P): Compare against std_node.
836 * decl.c (initialize_predefined_identifiers): 'std' is not needed.
837 (cxx_init_decl_processing): Adjust creation of ::std. Use
838 {push,pop}_nested_namespace.
839 (cxx_builtin_function): Use {push,pop}_nested_namespace.
840 * except.c (init_exception_processing): Likewise.
841 * rtti.c (init_rtti_processing): Likewise.
843 2019-10-23 Jason Merrill <jason@redhat.com>
845 Implement P1286R2, Contra CWG1778
846 * method.c (defaulted_late_check): Don't check explicit
847 exception-specification on defaulted function.
848 (after_nsdmi_defaulted_late_checks): Remove.
849 * parser.h (struct cp_unparsed_functions_entry): Remove classes.
850 * parser.c (unparsed_classes): Remove.
851 (push_unparsed_function_queues, cp_parser_class_specifier_1):
854 2019-10-23 Jakub Jelinek <jakub@redhat.com>
856 * constexpr.c (cxx_eval_constant_expression) <case CLEANUP_STMT>:
857 Temporarily change input_location to CLEANUP_STMT location.
859 2019-10-22 Jakub Jelinek <jakub@redhat.com>
861 PR tree-optimization/85887
862 * decl.c (expand_static_init): Drop ECF_LEAF from __cxa_guard_acquire
863 and __cxa_guard_release.
865 2019-10-22 Marc Glisse <marc.glisse@inria.fr>
868 * constexpr.c (cxx_eval_builtin_function_call): Only set
869 force_folding_builtin_constant_p if manifestly_const_eval.
871 2019-10-22 Richard Sandiford <richard.sandiford@arm.com>
873 * cp-tree.h (STF_USER_VISIBLE): New constant.
874 (strip_typedefs, strip_typedefs_expr): Take a flags argument.
875 * tree.c (strip_typedefs, strip_typedefs_expr): Likewise,
876 updating mutual calls accordingly. When STF_USER_VISIBLE is true,
877 only look through typedefs if user_facing_original_type_p.
878 * error.c (dump_template_bindings, type_to_string): Pass
879 STF_USER_VISIBLE to strip_typedefs.
880 (dump_type): Likewise, unless pp_c_flag_gnu_v3 is set.
882 2019-10-21 Kamlesh Kumar <kamleshbhalui@gmail.com>
883 Jason Merrill <jason@redhat.com>
885 PR c++/83534 - typeinfo of noexcept function
886 * rtti.c (get_tinfo_decl_dynamic): Do not call
887 TYPE_MAIN_VARIANT for function.
888 (get_typeid): Likewise.
890 2019-10-21 Paolo Carlini <paolo.carlini@oracle.com>
892 * parser.c (cp_parser_class_head): Improve error recovery upon
893 extra qualification error.
895 2019-10-21 Jakub Jelinek <jakub@redhat.com>
898 * constexpr.c (cxx_eval_component_reference, cxx_eval_bit_field_ref):
899 Use STRIP_ANY_LOCATION_WRAPPER on CONSTRUCTOR elts.
901 2019-10-21 Marek Polacek <polacek@redhat.com>
903 PR c++/92062 - ODR-use ignored for static member of class template.
904 * pt.c (has_value_dependent_address): Strip location wrappers.
906 2019-10-21 Marek Polacek <polacek@redhat.com>
908 PR c++/92106 - ICE with structured bindings and -Wreturn-local-addr.
909 * typeck.c (maybe_warn_about_returning_address_of_local): Avoid
910 recursing on null initializer and return false instead.
912 2019-10-17 JeanHeyd Meneide <phdofthehouse@gmail.com>
914 Implement p1301 [[nodiscard("should have a reason")]] + p1771 DR
915 * tree.c (handle_nodiscard_attribute): Handle C++2a nodiscard
917 (std_attribute_table) Increase nodiscard argument handling
918 max_length from 0 to 1.
919 * parser.c (cp_parser_check_std_attribute): Add requirement
920 that nodiscard only be seen once in attribute-list.
921 (cp_parser_std_attribute): Check that empty parenthesis lists are
922 not specified for attributes that have max_length > 0 (e.g.
924 * cvt.c (maybe_warn_nodiscard): Add nodiscard message to
925 output, if applicable.
926 (convert_to_void): Allow constructors to be nodiscard-able (P1771).
928 2019-10-18 Nathan Sidwell <nathan@acm.org>
930 * cp-tree.h (struct lang_type): Remove was_anonymous.
931 (TYPE_WAS_UNNAMED): Implement by checking TYPE_DECL &
933 * decl.c (name_unnamed_type): Don't set TYPE_WAS_UNNAMED.
935 2019-10-17 Paolo Carlini <paolo.carlini@oracle.com>
937 * decl.c (grokfndecl): Remove redundant use of in_system_header_at.
938 (compute_array_index_type_loc): Likewise.
939 (grokdeclarator): Likewise.
940 * error.c (cp_printer): Likewise.
941 * lambda.c (add_default_capture): Likewise.
942 * parser.c (cp_parser_primary_expression): Likewise.
943 (cp_parser_selection_statement): Likewise.
944 (cp_parser_toplevel_declaration): Likewise.
945 (cp_parser_enumerator_list): Likewise.
946 (cp_parser_using_declaration): Likewise.
947 (cp_parser_member_declaration): Likewise.
948 (cp_parser_exception_specification_opt): Likewise.
949 (cp_parser_std_attribute_spec): Likewise.
950 * pt.c (do_decl_instantiation): Likewise.
951 (do_type_instantiation): Likewise.
952 * typeck.c (cp_build_unary_op): Likewise.
954 * decl.c (check_tag_decl): Pass to in_system_header_at the same
955 location used for the permerror.
956 (grokdeclarator): Likewise.
958 * decl.c (check_tag_decl): Use locations[ds_typedef] in error_at.
960 2019-10-17 Jason Merrill <jason@redhat.com>
962 * cp-gimplify.c (cp_gimplify_expr): Use get_initialized_tmp_var.
963 (gimplify_to_rvalue): Remove default NULL argument.
965 2019-10-17 Nathan Sidwell <nathan@acm.org>
967 * decl.c (builtin_function_1): Merge into ...
968 (cxx_builtin_function): ... here. Nadger the decl before maybe
969 copying it. Set the context.
970 (cxx_builtin_function_ext_scope): Push to top level, then call
971 cxx_builtin_function.
973 2019-10-16 Luis Machado <luis.machado@linaro.org>
975 * cp-gimplify.c: Fix reference to non-existing tree-gimple.c file.
977 2019-10-16 Jakub Jelinek <jakub@redhat.com>
979 * decl.c (cxx_maybe_build_cleanup): When clearing location of cleanup,
980 if cleanup is a nop, clear location of its operand too.
982 2019-10-15 Andrew Sutton <asutton@lock3software.com>
984 Finish moving constraint and logic functionality of out pt.c.
985 Reimplement and re-enable subsumption caching.
987 * config-lang.in (gtfiles): Add logic.cc.
988 * constraint.cc (atomic_constraints_identical_p): Add assertions.
989 (hash_atomic_constraint): Likewise.
990 (constraints_equivalent_p): New.
991 (inchash::add_constraint): New.
992 (iterative_hash_constraint): New.
993 (decl_constraints): Moved from pt.c.
994 (get_constraints): Likewise.
995 (set_constraints): Likewise.
996 (remove_constraints): Likewise.
997 * cp-tree.h (CONSTR_P): New.
998 (init_constraint_processing): Remove.
999 (constraints_equivalent_p, iterative_hash_constraint): Declare.
1000 * decl.c (cxx_init_decl_processing): Don't initialize constraints.
1001 * logic.cc (subsumption_entry): Moved from pt.c.
1002 (subsumption_hasher): Likewise.
1003 (subsumption_cache): Likewise.
1004 (lookup_subsumption): Likewise.
1005 (save_subsumption): Likewise.
1006 (subsumes_constraints_nonnull): Use subsumption cache.
1007 * pt.c: Move aforementioned declarations out of this file.
1008 (init_constraint_processing): Remove.
1010 2019-10-15 Andrew Sutton <asutton@lock3software.com>
1012 * parser.c (cp_parser_constructor_declarator_p): Pass an empty
1013 decl-specifier-seq to make sure we parse type constraints as part
1014 of a type-specifier.
1016 2019-10-15 Nathan Sidwell <nathan@acm.org>
1018 * class.c (build_clones): Break out of clone_function_decl. Just
1020 (clone_function_decl): Call build_clones, then maybe add them to
1023 * class.c (build_clone): Refactor to clarify recursiveness.
1025 2019-10-14 Jason Merrill <jason@redhat.com>
1027 PR c++/91930 - ICE with constrained inherited default ctor.
1028 * name-lookup.c (do_class_using_decl): Set TYPE_HAS_USER_CONSTRUCTOR
1029 for inherited constructor.
1031 2019-10-14 Paolo Carlini <paolo.carlini@oracle.com>
1033 * decl.c (check_tag_decl): Use DECL_SOURCE_LOCATION.
1035 2019-10-14 Jakub Jelinek <jakub@redhat.com>
1038 * semantics.c (handle_omp_array_sections_1): Temporarily disable
1039 -fstrong-eval-order also for in_reduction and task_reduction clauses.
1041 * parser.c (cp_parser_omp_all_clauses): Change bool NESTED_P argument
1042 into int NESTED, if it is 2, diagnose missing commas in between
1044 (cp_parser_omp_context_selector): Pass 2 as last argument to
1045 cp_parser_omp_all_clauses.
1047 2019-10-12 Jakub Jelinek <jakub@redhat.com>
1049 * parser.c (cp_parser_omp_context_selector): Improve error recovery.
1050 For simd properties, put them directly into TREE_VALUE.
1051 (cp_finish_omp_declare_variant): Add "omp declare variant base"
1052 attribute rather than "omp declare variant".
1054 2019-10-11 Marek Polacek <polacek@redhat.com>
1056 PR c++/92049 - extra error with -fchecking=2.
1057 * pt.c (build_non_dependent_expr): Call fold_non_dependent_expr
1060 2019-10-11 Paolo Carlini <paolo.carlini@oracle.com>
1062 * typeck.c (cp_build_binary_op): Do not handle RROTATE_EXPR and
1064 * constexpr.c (cxx_eval_constant_expression): Likewise.
1065 (potential_constant_expression_1): Likewise.
1066 * pt.c (tsubst_copy): Likewise.
1068 2019-10-11 Jason Merrill <jason@redhat.com>
1070 * decl2.c (mark_used): Don't clobber DECL_SOURCE_LOCATION on
1071 explicitly defaulted functions.
1072 * method.c (synthesize_method): Likewise.
1074 2019-10-11 Jakub Jelinek <jakub@redhat.com>
1077 * decl2.c (grok_array_decl): For -fstrong-eval-order, when array ref
1078 operands have been swapped and at least one operand has side-effects,
1079 revert the swapping before calling build_array_ref.
1080 * typeck.c (cp_build_array_ref): For non-ARRAY_TYPE array ref with
1081 side-effects on the index operand, if -fstrong-eval-order use
1082 save_expr around the array operand.
1083 (cp_build_binary_op): For shifts with side-effects in the second
1084 operand, wrap first operand into SAVE_EXPR and evaluate it before
1086 * semantics.c (handle_omp_array_sections_1): Temporarily disable
1087 flag_strong_eval_order during OMP_CLAUSE_REDUCTION array section
1089 * cp-gimplify.c (gimplify_to_rvalue): New function.
1090 (cp_gimplify_expr): Use it.
1092 2019-10-10 Marek Polacek <polacek@redhat.com>
1094 * typeck.c (comp_ptr_ttypes_real): Change the return type to bool.
1095 Use false instead of 0.
1097 2019-10-10 Jakub Jelinek <jakub@redhat.com>
1099 * parser.h (struct cp_omp_declare_simd_data): Add variant_p member.
1100 * parser.c (cp_ensure_no_omp_declare_simd): Handle both declare simd
1101 and declare variant.
1102 (cp_parser_oacc_all_clauses): Formatting fix.
1103 (cp_parser_omp_all_clauses): Add NESTED_P argument, if true, terminate
1104 processing on closing paren and don't skip to end of pragma line.
1105 (cp_parser_omp_declare_simd): Add VARIANT_P argument. Handle also
1107 (omp_construct_selectors, omp_device_selectors,
1108 omp_implementation_selectors, omp_user_selectors): New variables.
1109 (cp_parser_omp_context_selector,
1110 cp_parser_omp_context_selector_specification,
1111 cp_finish_omp_declare_variant): New functions.
1112 (cp_parser_late_parsing_omp_declare_simd): Handle also declare variant.
1113 (cp_parser_omp_declare): Handle declare variant.
1115 2019-10-09 Jason Merrill <jason@redhat.com>
1117 * cp-tree.h (template_info_decl_check): Check ENABLE_TREE_CHECKING.
1119 2019-10-09 Marek Polacek <polacek@redhat.com>
1121 PR c++/91364 - P0388R4: Permit conversions to arrays of unknown bound.
1122 PR c++/69531 - DR 1307: Differently bounded array parameters.
1123 PR c++/88128 - DR 330: Qual convs and pointers to arrays of pointers.
1124 * call.c (build_array_conv): Build ck_identity at the beginning
1126 (standard_conversion): Pass bounds_none to comp_ptr_ttypes_const.
1127 (maybe_warn_array_conv): New.
1128 (convert_like_real): Call it. Add an error message about converting
1129 from arrays of unknown bounds.
1130 (conv_get_original_expr): New.
1131 (nelts_initialized_by_list_init): New.
1132 (conv_binds_to_array_of_unknown_bound): New.
1133 (compare_ics): Implement list-initialization ranking based on
1134 array sizes, as specified in DR 1307 and P0388R.
1135 * cp-tree.h (comp_ptr_ttypes_const): Adjust declaration.
1136 (compare_bounds_t): New enum.
1137 * typeck.c (comp_array_types): New bool and compare_bounds_t
1138 parameters. Use them.
1139 (structural_comptypes): Adjust the call to comp_array_types.
1140 (similar_type_p): Handle ARRAY_TYPE.
1141 (build_const_cast_1): Pass bounds_none to comp_ptr_ttypes_const.
1142 (comp_ptr_ttypes_real): Don't check cv-quals of ARRAY_TYPEs. Use
1143 comp_array_types to compare array types. Look through arrays as per
1145 (comp_ptr_ttypes_const): Use comp_array_types to compare array types.
1146 Look through arrays as per DR 330.
1148 2019-10-09 Marek Polacek <polacek@redhat.com>
1150 PR c++/92032 - DR 1601: Promotion of enum with fixed underlying type.
1151 * call.c (standard_conversion): When converting an enumeration with
1152 a fixed underlying type to the underlying type, give it the cr_promotion
1154 (compare_ics): Implement a tiebreaker as per CWG 1601.
1156 2019-10-08 Andrew Sutton <asutton@lock3software.com>
1157 Jason Merrill <jason@redhat.com>
1159 Update the concepts implementation to conform to the C++20
1160 specification, improve compile times, and generally clean up
1162 * call.c (build_new_function_call): Don't evaluate concepts here.
1163 (constraint_failure): Don't record the template.
1164 (print_z_candidate): Don't extract the template.
1165 * class.c (add_method): When overloading, hide ineligible special
1167 (check_methods): Set TYPE_HAS_COMPLEX_* here.
1168 * constexpr.c (cxx_eval_constant_expression): Evaluate concepts.
1169 (maybe_initialize_fundef_copies_table): Remove.
1170 (get_fundef_copy): Use hash_map_safe_get_or_insert.
1171 (clear_cv_and_fold_caches): Clear the satisfaction cache.
1172 * constraint.cc (known_non_bool_p): New.
1173 (parsing_constraint_expression_sentinel): Renamed from
1174 expanding_constraint_sentinel.
1175 (check_constraint_operands): New.
1176 (check_constraint_atom): New.
1177 (finish_constraint_binary_op): New.
1178 (finish_constraint_or_expr): Likewise.
1179 (finish_constraint_and_expr): Likewise.
1180 (finish_constraint_primary_expr): Likewise.
1181 (combine_constraint_expressions): New.
1182 (finish_requires_expr): Add location parm.
1183 (get_concept_definition): Return the initializer of concept definitions.
1184 (get_template_head_requirements): New.
1185 (get_trailing_function_requirements): New.
1186 (deduce_constrained_parameter): Check if the identifier or template-id
1187 is a concept definition.
1188 (resolve_concept_definition_check): Removed.
1189 (resolve_variable_concept_check): Removed.
1190 (resolve_concept_check): New.
1191 (resolve_constraint_check): Handle concept definitions.
1192 converting arguments.
1193 (function_concept_check_p): Removed.
1194 (variable_concept_check_p): Removed.
1195 (unpack_concept_check): New.
1196 (get_concept_check_template): New.
1197 (build_call_check): Moved and renamed to build_function_check.
1198 (build_concept_check_arguments): make static.
1199 (build_function_check): Always do overload resolution
1200 in order to force conversion of template arguments (i.e., actually
1201 check that the use of a concept is valid).
1202 (build_standard_check): Renamed from build_real_concept_check.
1203 (build_real_concept_check): Build checks for C++2a concepts by
1204 (build_wildcard_concept_check): New.
1205 (build_concept_check): Use build_real_concept_check. New overload.
1206 (build_constraints): Save expressions, not normalized constraints.
1207 (build_concept_id): New. Pass tf_warning_or_error.
1208 (build_type_constraint): New.
1209 (finish_type_constraints): New.
1210 (associate_classtype_constraints): Also add constraints to union
1211 types. Note the original declaration in errors. Don't return
1212 error_mark_node in order to avoid an assertion later.
1213 (push_down_pack_expansion): Remove.
1214 (finish_shorthand_constraint): Make fold expressions, not naked
1215 parameter packs. Always apply the constraint to each template argument.
1216 (check_introduction_list): New. Fail if not enough
1217 names are introduced.
1218 (finish_template_introduction): Don't normalize constraints. Pass
1219 tsubst flags. Check for insufficient introductions.
1220 (placeholder_extract_concept_and_args): Handle the template-id case.
1221 Unpack function concept checks correctly.
1222 (tsubst_simple_requirement): Return errors if they occur. Don't
1223 process as a template.
1224 (tsubst_type_requirement): Likewise.
1225 (type_deducible_p): New. Wrap the input expression in parens for the
1226 purpose of deduction.
1227 (expression_convertible_t): New.
1228 (tsubst_compound_requirement): Use new deduction, conversion predicates.
1229 (tsubst_nested_requirement): Return errors if they occur. Don't
1230 process as a template. Instantiate and evaluate the nested requirement.
1231 (tsubst_valid_expression_requirement): New.
1232 (tsubst_simple_requirement): Use tsubst_valid_expression_requirement.
1233 (tsubst_compound_requirement): Use tsubst_valid_expression_requirement.
1234 (check_constaint_variables): New.
1235 (tsubst_constraint_variables): Check that type substitutions are valid.
1236 (tsubst_requires_expr): Likewise. Produce new requires-exprs during
1237 template substitution. Copy the previous local specialization stack,
1238 so references to non-local parameters can be found. Use cp_unevaluated.
1239 (tsubst_constraint): New. Don't evaluate concept checks.
1241 (norm_info): New. Used to build a normalization tree for concept check
1243 (debug_parameter_mapping): New.
1244 (debug_argument_list): New.
1245 (expand_concept): Removed.
1246 (normalize_logical_operation): Pass subst_info through call.
1247 (normalize_pack_expansion): Remove.
1248 (normalize_simple_requirement): Removed
1249 (normalize_type_requirement): Removed
1250 (normalize_compound_requirement): Removed
1251 (normalize_nested_requirement): Removed
1252 (normalize_requirement): Removed
1253 (normalize_requirements): Removed
1254 (normalize_requires_expression): Removed
1255 (normalize_variable_concept_check): Removed.
1256 (normalize_function_concept_check): Removed.
1257 (normalize_concept_check): Merged all normalize_*_check here.
1258 Substitute through written template arguments before normalizing the
1259 definition. Only substitute the innermost template arguments.
1260 (check_for_logical_overloads): Delete.
1261 (map_arguments): New. Associate template parameters with arguments.
1262 (build_parameter_mapping): New. Extract used parameters.
1263 (normalize_expression): Rewrite.
1264 (normalize_conjunction): Removed
1265 (normalize_disjunction): Removed
1266 (normalize_predicate_constraint): Removed
1267 (normalize_parameterized_constraint): Removed
1268 (normalized_map): New variable.
1269 (get_normalized_constraints): New entry point for normalization.
1270 Establishes a timer.
1271 (get_normalized_constraints_from_info): New.
1272 (get_normalized_constraints_from_decl): New. Turn on template processing
1273 prior to normalization. Handle inheriting ctors. Build the
1274 normalization arguments from the full set of template parameters of the
1275 most general template. This guarantees that we have no concrete arguments
1276 in the parameter mapping (e.g., from template members of class
1277 templates). Cache normalizations.
1278 (normalize_concept_definition): New. Cache normalizations.
1279 (normalize_template_requirements): New.
1280 (normalize_nontemplate_requirements): New.
1281 (normalize_constraint_expression): New.
1282 (tsubst_parameter_mapping): New.
1283 (get_mapped_args): New.
1284 (parameter_mapping_equivalent_p): New. Use template_args_equal.
1285 (atomic_constraints_identical_p): New.
1286 (hash_atomic_constraint): New.
1287 (satisfying_constraint_p): New. Guard against recursive evaluation of
1288 constraints during satisfaction.
1289 (satisfy_conjunction): New.
1290 (satisfy_disjunction): New.
1291 (sat_entry): New class for hashing satisfaction results.
1292 (sat_hasher): New hash traits.
1294 (get_satisfaction): New. Returns cached satisfaction result.
1295 (save_satisfaction): New. Caches a satisfaction result.
1296 (clear_satisfaction_cache): New.
1297 (satisfaction_cache): New. Helps manage satisfaction cache requests.
1298 (decl_satisfied_cache): New.
1299 (satisfy_atom): New.
1300 (satisfy_constraint_r): New.
1301 (satisfy_constraint): Use new satisfaction algorithm.
1302 (evaluate_concept_check): New.
1303 (evaluate_concept): Removed.
1304 (evaluate_function_concept): Removed.
1305 (evaluate_variable_concept): Removed.
1306 (satisfy_constraint_expression): New.
1307 (constraint_expression_satisfied_p): New.
1308 (constraints_satisfied_p): Use strip_inheriting_ctors. Use
1309 push_/pop_access_scope.
1310 (more_constrained): Normalize before calling out to subsumption. Allow
1311 classes as arguments.
1312 (strictly_subsumes): Allow non-templates as arguments. Accept a new
1314 (weakly_subsumes): New.
1315 (at_least_as_constrained): Removed.
1316 (diagnose_other_expression): Removed.
1317 (diagnose_predicate_constraint): Removed.
1318 (diagnose_pack_expansion): Removed.
1319 (diagnose_check_constraint): Removed.
1320 (diagnose_logical_constraint): Removed.
1321 (diagnose_expression_constraint): Removed.
1322 (diagnose_type_constraint): Removed.
1323 (diagnose_implicit_conversion_constraint): Removed.
1324 (diagnose_argument_deduction_constraint): Removed.
1325 (diagnose_exception_constraint): Removed.
1326 (diagnose_parameterized_constraint): Removed.
1327 (diagnose_argument_deduction_constraint): Removed.
1328 (diagnose_argument_deduction_constraint): Removed.
1329 (diagnose_argument_deduction_constraint): Removed.
1330 (diagnose_trait_expr): New.
1331 (diagnose_requires_expr): New.
1332 (diagnose_atomic_constraint): New.
1333 (diagnose_valid_expression) Stop wrongly diagnosing valid expressions.
1334 Don't substitute as if in template decls. This causes substitution
1335 to generate expressions that aren't suitable for use with the noexcept
1337 (diagnose_valid_type) Likewise.
1338 (diagnose_compound_requirement) Actually emit diagnostics for
1339 the causes of errors.Call force_paren_expr_uneval.
1340 (diagnose_declaration_constraints): Turn on template processing to
1341 suppress certain analyses.
1342 * cp-objcp-common.c (cp_common_init_ts): Make concepts typed.
1343 (cp_get_debug_type): Use hash_map_safe_*.
1344 * cp-tree.h: New function declarations for semantic actions, other
1345 facilities. Remove declaration no longer used or needed. Remove
1346 unused _CONSTR macros.
1347 (LANG_DECL_HAS_MIN): Add CONCEPT_DECL.
1348 (template_info_decl_check): Factor macro check into an inline function.
1349 (DECL_TEMPLATE_INFO): Use new check facility.
1350 (finish_concept_definition): New. Don't invalid concept declarations
1351 with invalid initializers.
1352 (find_template_parameters): New.
1353 (concept_definition_p): New.
1354 (concept_check_p): New.
1355 (variable_concept_check_p): New.
1356 (force_paren_expr_uneval): New.
1357 (ovl_iterator::using_p): A USING_DECL by itself was also
1358 introduced by a using-declaration.
1359 (struct tree_template_info): Use tree_base instead of
1360 tree_common. Add tmpl and args fields.
1361 (TI_TEMPLATE, TI_ARGS): Adjust.
1362 (DECLTYPE_FOR_INIT_CAPTURE): Remove.
1363 (CONSTR_CHECK, CONSTR_INFO, CONSTR_EXPR, CONSTR_CONTEXT): New.
1364 (ATOMIC_CONSTR_MAP, TRAIT_EXPR_LOCATION): New.
1365 (struct tree_trait_expr): Add locus field.
1366 (enum tsubst_flags): Add tf_norm as a hint to generate normalization
1367 context when diagnosing constraint failure.
1368 * cp-tree.def: Remove unused _CONSTR nodes and rename PRED_CONSTR
1370 (CONCEPT_DECL): New.
1371 * cxx-pretty-print.c: Remove constraint printing code.
1372 (pp_cxx_concept_definition): New.
1373 (pp_cxx_template_declaration): Print concept definitions.
1374 (pp_cxx_check_constraint): Update printing for concept definitions.
1375 (pp_cxx_nested_name_specifier): Fix a weird
1376 case where we're printing '::::' for concepts.
1377 (simple_type_specifier): Print requirements for placeholder types.
1378 (pp_cxx_constrained_type_spec): Print the associated requirements of
1380 (pp_cxx_compound_requirement): Add space before the '->'.
1381 (pp_cxx_parameter_mapping): Print the parameter mapping.
1382 (pp_cxx_atomic_constraint): Use the function above.
1383 * decl.c (redeclaration_error_message): New error for concepts.
1384 (grokdeclarator): Check for and disallow decltype(auto) in parameter
1386 (grokfndecl): Don't normalize constraints. Add check for constraints
1388 (grokvardecl): Don't normalize constraints.
1389 (grok_special_member_properties): Don't set TYPE_HAS_COMPLEX_*.
1390 (function_requirements_equivalent_p): New. Compare trailing
1391 requires clauses. Compare combined constraints in pre-C++20 mode.
1392 (decls_match): Compare trailing requires clauses. Compare template
1393 heads for function templates. Remove old constraint comparison.
1394 Simplify comparison of functions, function templates.
1395 (duplicate_function_template_decls): New. Refactor a nasty if
1396 condition into a single predicate.
1397 (require_deduced_type): Don't complain if we already complained about
1399 (finish_function): Perform auto deduction to ensure that constraints
1400 are checked even when functions contain no return statements. Only do
1401 auto deduction if we haven't previously seen any return statements.
1402 This prevents multiple diagnostics of the same error.
1403 (store_decomp_type): Remove.
1404 (cp_finish_decomp): Use hash_map_safe_put.
1405 * error.c: Remove constraint printing code.
1406 (dump_decl): Dump concept definitions. Handle wildcard declarations.
1407 (dump_template_decl): Likewise.
1408 (dump_type): Print associated requirements for placeholder
1410 (rebuild_concept_check): New.
1411 (maybe_print_single_constraint_context): New.
1412 (maybe_print_constraint_context): Recursively print nested contexts.
1413 * init.c (get_nsdmi): Use hash_map_safe_*.
1414 * lambda.c (maybe_add_lambda_conv_op): Bail if deduction failed.
1415 (add_capture): Copy parameter packs from init.
1416 (lambda_capture_field_type): Always use auto for init-capture.
1417 * logic.cc: Completely rewrite.
1418 (constraint_hash): New.
1419 (clause/ctor): Save atoms in the hash table.
1420 (replace): Save atoms during replacement.
1421 (insert): Save atoms during insertion.
1422 (contains): Only search the hash table for containment.
1423 (clause): Keep a hash of atomic constraints.
1424 (clause::clause): Explicitly copy the hash table when copying.
1425 (disjunction_p, conjunction_p, atomic_p, dnf_size, cnf_size): New.
1426 (diagnose_constraint_size): New.
1427 (subsumes_constraints_nonnull): Compare the sizes of normalized formula
1428 to determine the cheapest decomposition.
1429 * name-lookup.c (diagnose_name_conflict): Diagnose name issues with
1431 (matching_fn_p): Check constraints.
1432 (push_class_level_binding_1): Move overloaded functions case down,
1433 accept FUNCTION_DECL as target_decl.
1434 * parser.c (enum required_token): New required token for auto.
1435 (make_location): Add overload taking lexer as last parm.
1436 (cp_parser_required_error): Diagnose missing auto.
1437 (cp_parser_diagnose_ungrouped_constraint_plain): New.
1438 (cp_parser_diagnose_ungrouped_constraint_plain): New.
1439 (cp_parser_constraint_primary_expression): New. Tentatively parse the
1440 primary expression. If that fails tentatively parse a lower
1441 precedence expression in order to diagnose the error.
1442 (cp_parser_check_non_logical_constraint): New. Performs a trial
1443 parse of the right-hand-side of non-logical operators in order to
1444 generate good diagnostics.
1445 (cp_parser_constraint_logical_and_expression): New.
1446 (cp_parser_constraint_logical_or_expression): New.
1447 (cp_parser_requires_clause_expression): New.
1448 (cp_parser_requires_clause): Renamed to cp_parser_constraint_expression.
1449 (cp_parser_requires_clause_opt): Parse the requires-clause differently
1450 in -fconcepts and -std=c++2a modes.
1451 (cp_parser_requirement_list): Rename to cp_parser_requirement_seq.
1452 Rewrite so that semicolons are parsed
1453 along with requirements, not the sequence.
1454 (cp_parser_simple_requirement): Expect a semicolon at end.
1455 (cp_parser_compound_requirement): Expect a semicolon at end. Only
1456 allow trailing-return-type with -fconcepts-ts.
1457 (cp_parser_nested_requirement): Expect a semicolon at end. Parse
1458 constraint-expressions.
1459 (cp_parser_concept_definition): New. Don't fail parsing the concept
1460 definition if the initializer is ill-formed. Don't declare the concept
1461 before parsing the initializer.
1462 (cp_parser_constraint_expression): Declare earlier.
1463 (cp_parser_type_requirement): Current scope is not valid.
1464 (cp_parser_requires_expression): Commit to the tentative parse.
1465 (cp_parser_decl_specifier_seq): Warn when concept appears to be used
1466 as a decl-specifier.
1467 (cp_parser_template_declaration_after_parameters): Parse concept
1469 (cp_parser_template_id): Don't try to resolve a concept template-id yet.
1470 (cp_parser_template_id_expr): Resolve it as a concept check.
1471 (cp_parser_decl_specifier_seq): Warn on 'concept bool'.
1472 (cp_parser_type_parameter): Combine expressions not
1474 (cp_parser_explicit_template_declaration): Combine expressions not
1476 (cp_parser_maybe_concept_name): Removed.
1477 (cp_parser_simple_type_specifier): Handle an error condition of
1478 a bad constrained type specifier. Expect auto or decltype after
1479 a concept name. Also handle the case where we have a template-id
1481 (cp_parser_template_introduction): Diagnose errors on invalid
1482 introductions. Give up if it doesn't start with a concept name.
1483 Pedwarn if not -fconcepts-ts.
1484 (synthesize_implicit_template_parm): Don't do consistent binding.
1485 Use a new flag for constrained parameters. Combine expressions,
1486 not constraints. Fail if we get a placeholder in block scope.
1487 Placeholders that do not constrain types are not allowed in parameter
1488 declarations, so don't handle them.
1489 (cp_parser_placeholder_type_specifier): New. Implement parsing of
1490 placeholder type specifiers following a concept name or partial
1491 concept check. Disallow decltype(auto) parameters.
1492 (cp_parser_nested_name_specifier_opt): If the token is already
1493 CPP_NESTED_NAME_SPECIFIER, leave it alone.
1494 (cp_parser_id_expression, cp_parser_unqualified_id): Call
1495 cp_parser_template_id_expr.
1496 (cp_parser_placeholder_type_specifier): Add tentative parm. Don't
1497 expect a WILDCARD_DECL.
1498 (cp_parser_trait_expr): Pass trait_loc down.
1499 (cp_parser_postfix_expression): Do set location of dependent member
1501 * pt.c (finish_concept_definition): New.
1502 (push_template_decl_real): Handle concept definitions.
1503 (start_concept_definition): Let push_template_decl_real handle the
1504 creation of the template.
1505 (get_constraints): Return null if the table hasn't been initialized.
1506 (tsubst_copy_and_build): Build template-id expressions for concept
1508 [TRAIT_EXPR]: Pass trait_loc down.
1509 (lookup_template_class_1): Add the template name to the constraint
1511 (lookup_and_finish_template_variable): Build concept checks
1512 with the correct arguments.
1513 (tsubst_function_decl): Don't substitute through constraints.
1514 Always associate constraints with functions.
1515 (template_parm_level_and_index): Make non-static.
1516 (for_each_template_parm_r): Handle requires expressions.
1517 (keep_template_parm): New.
1518 (find_template_parameters): New.
1519 (more_specialized_fn): Change how winners and losers are chosen.
1520 (make_constrained_auto): Don't normalize constraints.
1521 (template_parameters_equivalent_p): New. Compare template
1522 parameters. Add a comparison for implicitly vs. explicitly declared
1524 (template_parameter_lists_equivalent_p): New. Compare template
1526 (template_requirements_equivalent_p): New.
1527 (template_heads_equivalent_p): New. Compare template heads.
1528 (template_parameter_constraints_equivalent_p): New.
1529 (is_compatible_template_arg): Use weakly_subsumes.
1530 (maybe_new_partial_specialization): Use new constraint comparison
1531 for finding specializations.
1532 (process_partial_specialization): Pass main template as argument.
1533 (more_specialized_partial_spec): Don't immediately return when
1535 (make_constrained_auto): Handle concept definitions.
1536 (do_auto_deduction): Update auto deduction for new concept model.
1537 Extract the function concept correctly; rename constr to check to
1538 reflect the kind of node.
1539 (tsubst): Adjust wildcard argument during substitution.
1540 [DECLTYPE_TYPE]: Remove init-capture handling.
1541 (tsubst_copy_and_build): Build concept checks, not template ids.
1542 Defer checks of function concepts. Handle concepts before variable
1543 templates. Handle calls to function concepts explicitly.
1544 (coerce_template_parms): Use concept_definition_p. Handle a deduction
1545 error where a potentially empty pack can be supplied after the last
1546 parameter of a concept.
1547 (finish_template_variable): Don't process concepts here.
1548 (instantiation_dependent_r): Use concept_check_p.
1549 (tsubst_template_args): Make non-static.
1550 (make_constrained_placeholder_type): New. Refactored from
1551 make_constrained_auto.
1552 (make_constrained_auto) Use make_constrained_placeholder_type.
1553 (make_constrained_decltype_auto) New.
1554 (tsubst_function_parms): New.
1555 (value_dependent_expression_p) [TEMPLATE_ID_EXPR]: Use
1556 concept_definition_p.
1557 (push_access_scope, pop_access_scope): No longer static.
1558 (tsubst_template_parm): Substitute TEMPLATE_PARM_CONSTRAINTS.
1559 (tsubst_friend_function): Use tsubst_constraint. Use generic_targs_for.
1560 (get_underlying_template) Use generic_targs_for.
1561 (uses_parameter_packs): Return tree.
1562 (gen_elem_of_pack_expansion_instantiation): Don't push
1563 local_specialization_stack.
1564 (prepend_one_capture): New.
1565 (tsubst_lambda_expr): Use prepend_one_capture. Don't touch
1566 local_specializations.
1567 (template_parms_level_to_args): No longer static.
1568 (add_outermost_template_args): Likewise.
1569 (find_template_parameter_info): New. Provide context for finding
1570 template parameters.
1571 (keep_template_parm): Don't keep parameters declared at depth levels
1572 greater than those of the template parameters of the source declaration.
1573 Don't propagate cv-qualified types. Return 0, so we find all template
1574 parameters, not the just first.
1575 (any_template_parm_r): New. Handle cases that are mishandled by
1576 for_each_template_parm_r.
1577 (generic_targs_for): Factor out of coerce_template_args_for_ttp.
1578 (tsubst_argument_pack): Factor out of tsubst_template_args.
1579 (constraint_sat_entry): Removed.
1580 (constraint_sat_hasher): Removed.
1581 (concept_spec_entry): Removed.
1582 (concept_spec_hasher): Removed.
1583 (constraint_memos): Removed.
1584 (concept_memos): Removed.
1585 (lookup_constraint_satisfaction): Removed.
1586 (memoize_constraint_satisfaction): Removed.
1587 (lookup_concept_satisfaction): Removed.
1588 (memoize_concept_satisfaction): Removed.
1589 (concept_expansions): Removed.
1590 (get_concept_expansion): Removed.
1591 (save_concept_expansion): Removed.
1592 (init_constraint_processing): Remove initialization of non-existing
1594 (find_template_requirement): New. Search for the sub-requirement
1595 within the associated constraints.
1596 (convert_generic_types_to_packs): Also transform the associated
1597 constraint and update the current template requirements.
1598 (store_defaulted_ttp, lookup_defaulted_ttp): Remove.
1599 (add_defaults_to_ttp): Use hash_map_safe_*.
1600 * semantics.c (finish_call_expr): Diagnose calls to concepts.
1601 Handle concept checks explicitly.
1602 (finish_id_expression): Evaluate variable concepts as part of
1603 id-expression processing. Don't treat variable concepts as variables,
1604 and don't process function concepts as plain id-expressions.
1605 (force_paren_expr): Add even_uneval parm.
1606 (finish_trait_expr): Add location parm.
1607 * tree.c (special_memfn_p): New.
1608 (cp_expr_location): Handle TRAIT_EXPR.
1609 * typeck.c (check_return_expr): Actually use the diagnostic kind
1610 when performing return-type deduction.
1611 * typeck2.c (build_functional_cast): Don't rely on the location of
1614 2019-10-09 Paolo Carlini <paolo.carlini@oracle.com>
1616 * decl.c (grok_ctor_properties): Use DECL_SOURCE_LOCATION.
1617 * typeck.c (cp_build_binary_op): Use the op_location_t argument
1618 in many error messages.
1620 2019-10-08 Martin Sebor <msebor@redhat.com>
1623 * call.c (maybe_warn_class_memaccess): Handle arrays.
1625 2019-10-07 Paolo Carlini <paolo.carlini@oracle.com>
1627 * call.c (resolve_args): Use cp_expr_loc_or_input_loc in one place.
1628 * decl.c (grokdeclarator): Use id_loc in one place.
1629 * decl2.c (build_anon_union_vars): Use DECL_SOURCE_LOCATION.
1630 * parser.c (cp_parser_delete_expression): Fix the location of the
1631 returned expression.
1632 (cp_parser_throw_expression): Likewise.
1633 * pt.c (determine_specialization): Use DECL_SOURCE_LOCATION.
1635 2019-10-05 Jakub Jelinek <jakub@redhat.com>
1637 PR c++/91369 - Implement P0784R7: constexpr new
1638 * cp-tree.h (enum cp_tree_index): Add CPTI_HEAP_UNINIT_IDENTIFIER,
1639 CPTI_HEAP_IDENTIFIER and CPTI_HEAP_DELETED_IDENTIFIER.
1640 (heap_uninit_identifier, heap_identifier, heap_deleted_identifier):
1642 (type_has_constexpr_destructor, build_new_constexpr_heap_type,
1643 cxx_constant_dtor): Declare.
1644 * class.c (type_maybe_constexpr_default_constructor): Make static.
1645 (type_maybe_constexpr_destructor, type_has_constexpr_destructor): New
1647 (finalize_literal_type_property): For c++2a, don't clear
1648 CLASSTYPE_LITERAL_P for types without trivial destructors unless they
1649 have non-constexpr destructors.
1650 (explain_non_literal_class): For c++2a, complain about non-constexpr
1651 destructors rather than about non-trivial destructors.
1652 * constexpr.c: Include stor-layout.h.
1653 (struct constexpr_global_ctx): New type.
1654 (struct constexpr_ctx): Add global field, remove values and
1655 constexpr_ops_count.
1656 (cxx_replaceable_global_alloc_fn): New inline function.
1657 (cxx_eval_call_expression): For c++2a allow calls to replaceable
1658 global allocation functions, for new return address of a heap uninit
1659 var, for delete record its deletion. Change ctx->values->{get,put} to
1660 ctx->global->values.{get,put}.
1661 (non_const_var_error): Add auto_diagnostic_group sentinel. Emit
1662 special diagnostics for heap variables.
1663 (cxx_eval_store_expression): Change ctx->values->{get,put} to
1664 ctx->global->values.{get,put}.
1665 (cxx_eval_loop_expr): Initialize jump_target if NULL. Change
1666 new_ctx.values->remove to ctx->global->values.remove.
1667 (cxx_eval_constant_expression): Change *ctx->constexpr_ops_count
1668 to ctx->global->constexpr_ops_count. Change ctx->values->{get,put} to
1669 ctx->global->values.{get,put}.
1670 <case NOP_EXPR>: Formatting fix. On cast of replaceable global
1671 allocation function to some pointer type, adjust the type of
1672 the heap variable and change name from heap_uninit_identifier
1674 (find_heap_var_refs): New function.
1675 (cxx_eval_outermost_constant_expr): Add constexpr_dtor argument,
1676 handle evaluation of constexpr dtors and add tracking of heap
1677 variables. Use tf_no_cleanup for get_target_expr_with_sfinae.
1678 (cxx_constant_value): Adjust cxx_eval_outermost_constant_expr caller.
1679 (cxx_constant_dtor): New function.
1680 (maybe_constant_value, fold_non_dependent_expr_template,
1681 maybe_constant_init_1): Adjust cxx_eval_outermost_constant_expr
1683 (potential_constant_expression_1): Ignore clobbers. Allow
1684 COND_EXPR_IS_VEC_DELETE for c++2a.
1685 * decl.c (initialize_predefined_identifiers): Add heap identifiers.
1686 (decl_maybe_constant_destruction): New function.
1687 (cp_finish_decl): Don't clear TREE_READONLY for constexpr variables
1688 with non-trivial, but constexpr destructors.
1689 (register_dtor_fn): For constexpr variables with constexpr non-trivial
1690 destructors call cxx_maybe_build_cleanup instead of adding destructor
1692 (expand_static_init): For constexpr variables with constexpr
1693 non-trivial destructors call cxx_maybe_build_cleanup.
1694 (grokdeclarator): Allow constexpr destructors for c++2a. Formatting
1696 (cxx_maybe_build_cleanup): For constexpr variables with constexpr
1697 non-trivial destructors call cxx_constant_dtor instead of adding
1698 destructor calls at runtime.
1699 * init.c: Include stor-layout.h.
1700 (build_new_constexpr_heap_type, maybe_wrap_new_for_constexpr): New
1702 (build_new_1): For c++2a and new[], add cast around the alloc call
1703 to help constexpr evaluation figure out the type of the heap storage.
1704 (build_vec_delete_1): Set DECL_INITIAL of tbase and emit a DECL_EXPR
1705 for it instead of initializing an uninitialized variable.
1706 * method.c: Include intl.h.
1707 (SFK_CTOR_P, SFK_DTOR_P, SFK_ASSIGN_P, SFK_COPY_P, SFK_MOVE_P): Move
1708 definitions earlier.
1709 (process_subob_fn): Add sfk argument, adjust non-constexpr call
1710 diagnostics based on it.
1711 (walk_field_subobs): Formatting fixes. Adjust process_subob_fn caller.
1712 (synthesized_method_base_walk): Likewise.
1713 (synthesized_method_walk): Set *constexpr_p to true for dtors in c++2a.
1714 Fix up DR number in comment.
1715 (implicitly_declare_fn): Formatting fix.
1716 * typeck2.c (store_init_value): Don't call cp_fully_fold_init on
1717 initializers of automatic non-constexpr variables in constexpr
1720 2019-10-04 Jakub Jelinek <jakub@redhat.com>
1723 * constexpr.c (cxx_fold_indirect_ref_1): New function.
1724 (cxx_fold_indirect_ref): Use it.
1727 * cp-gimplify.c (cp_gimplify_expr) <case CALL_EXPR>: For
1728 -fstrong-eval-order ensure CALL_EXPR_FN side-effects are evaluated
1729 before any arguments. Additionally, ensure CALL_EXPR_FN that isn't
1730 invariant nor OBJ_TYPE_REF nor SSA_NAME is forced into a temporary.
1732 2019-10-03 Paolo Carlini <paolo.carlini@oracle.com>
1734 * init.c (build_new): Use cp_expr_loc_or_input_loc in two places.
1735 * name-lookup.c (do_pushdecl): Use DECL_SOURCE_LOCATION.
1736 (push_class_level_binding_1): Likewise.
1737 (set_decl_namespace): Likewise.
1739 2019-10-03 Jakub Jelinek <jakub@redhat.com>
1741 * constexpr.c (cxx_eval_constant_expression) <case CLEANUP_STMT>: If
1742 not skipping upon entry to body, run cleanup with the same *jump_target
1743 as it started to run the cleanup even if the body returns, breaks or
1745 (potential_constant_expression_1): Allow CLEANUP_STMT.
1747 * constexpr.c (cxx_eval_store_expression): Formatting fix. Handle
1748 const_object_being_modified with array type.
1750 2019-10-02 Jason Merrill <jason@redhat.com>
1752 * typeck2.c (store_init_value): Only clear_cv_and_fold_caches if the
1755 2019-09-30 Jason Merrill <jason@redhat.com>
1757 Use hash_map_safe_* functions.
1758 * constexpr.c (maybe_initialize_fundef_copies_table): Remove.
1759 (get_fundef_copy): Use hash_map_safe_get_or_insert.
1760 * cp-objcp-common.c (cp_get_debug_type): Use hash_map_safe_*.
1761 * decl.c (store_decomp_type): Remove.
1762 (cp_finish_decomp): Use hash_map_safe_put.
1763 * init.c (get_nsdmi): Use hash_map_safe_*.
1764 * pt.c (store_defaulted_ttp, lookup_defaulted_ttp): Remove.
1765 (add_defaults_to_ttp): Use hash_map_safe_*.
1767 2019-10-02 Richard Biener <rguenther@suse.de>
1770 * decl.c (build_ptrmemfunc_type): Mark pointer-to-member
1771 fat pointer structure members as DECL_NONADDRESSABLE_P.
1773 2019-09-28 Marek Polacek <polacek@redhat.com>
1775 PR c++/91889 - follow-up fix for DR 2352.
1776 * call.c (involves_qualification_conversion_p): New function.
1777 (direct_reference_binding): Build a ck_qual if the conversion
1778 would involve a qualification conversion.
1779 (convert_like_real): Strip the conversion created by the ck_qual
1780 in direct_reference_binding.
1782 PR c++/91921 - stray warning with -Woverloaded-virtual.
1783 * class.c (warn_hidden): Only emit the second part of
1784 -Woverloaded-virtual if the first part was issued. Use inform instead
1787 PR c++/91923 - failure-to-SFINAE with class type NTTP in C++17.
1788 * pt.c (invalid_nontype_parm_type_p): Only emit errors when
1791 2019-09-27 Jakub Jelinek <jakub@redhat.com>
1794 * parser.c (cp_parser_omp_var_list_no_open): Parse predefined
1796 * semantics.c (finish_omp_clauses): Allow predefined variables in
1797 shared and firstprivate clauses, even when they are predetermined
1799 * cp-gimplify.c (cxx_omp_predetermined_sharing_1): Return
1800 OMP_CLAUSE_DEFAULT_SHARED for predefined variables.
1802 2019-09-27 Jason Merrill <jason@redhat.com>
1804 * constexpr.c (cxx_fold_indirect_ref): Use similar_type_p.
1805 (cxx_eval_indirect_ref): Likewise. Improve error location.
1807 * cp-tree.h (class iloc_sentinel): New.
1808 * decl.c (grokdeclarator, finish_enum_value_list): Use it.
1809 * mangle.c (mangle_decl_string): Use it.
1810 * pt.c (perform_typedefs_access_check): Use it.
1812 2019-09-27 Richard Sandiford <richard.sandiford@arm.com>
1814 * cp-tree.h (build_cxx_call): Take the original function decl
1815 as an optional final parameter.
1816 (cp_build_function_call_vec): Likewise.
1817 * call.c (build_cxx_call): Likewise. Pass all built-in calls to
1818 check_builtin_function_arguments.
1819 * typeck.c (build_function_call_vec): Take the original function
1820 decl as an optional final parameter and pass it to
1821 cp_build_function_call_vec.
1822 (cp_build_function_call_vec): Take the original function
1823 decl as an optional final parameter and pass it to build_cxx_call.
1825 2019-09-25 Marek Polacek <polacek@redhat.com>
1827 PR c++/91877 - ICE with converting member of packed struct.
1828 * call.c (convert_like_real): Use similar_type_p in an assert.
1830 2019-09-25 Paolo Carlini <paolo.carlini@oracle.com>
1832 * name-lookup.c (check_extern_c_conflict): Use DECL_SOURCE_LOCATION.
1833 (check_local_shadow): Use it in three additional places.
1835 2019-09-24 Jason Merrill <jason@redhat.com>
1837 * parser.c (cp_parser_postfix_expression): Do set location of
1838 dependent member call.
1840 2019-09-24 Marek Polacek <polacek@redhat.com>
1842 PR c++/91868 - improve -Wshadow location.
1843 * name-lookup.c (check_local_shadow): Use DECL_SOURCE_LOCATION
1844 instead of input_location.
1846 PR c++/91845 - ICE with invalid pointer-to-member.
1847 * expr.c (mark_use): Use error_operand_p.
1848 * typeck2.c (build_m_component_ref): Check error_operand_p after
1849 calling mark_[lr]value_use.
1851 2019-09-23 Paolo Carlini <paolo.carlini@oracle.com>
1853 * pt.c (check_explicit_specialization): Use cp_expr_loc_or_input_loc.
1854 (process_partial_specialization): Likewise.
1855 (convert_nontype_argument_function): Likewise.
1856 (invalid_tparm_referent_p): Likewise.
1857 (convert_template_argument): Likewise.
1858 (check_valid_ptrmem_cst_expr): Tidy.
1860 2019-09-23 Jason Merrill <jason@redhat.com>
1862 PR c++/91809 - bit-field and ellipsis.
1863 * call.c (convert_arg_to_ellipsis): Don't call decay_conversion for
1864 arithmetic arguments.
1866 2019-09-23 Marek Polacek <polacek@redhat.com>
1868 PR c++/91844 - Implement CWG 2352, Similar types and reference binding.
1869 * call.c (reference_related_p): Use similar_type_p instead of
1871 (reference_compatible_p): Update implementation to match CWG 2352.
1872 * cp-tree.h (similar_type_p): Declare.
1873 * typeck.c (similar_type_p): New.
1875 2019-09-22 Marek Polacek <polacek@redhat.com>
1877 PR c++/91819 - ICE with operator++ and enum.
1878 * call.c (build_new_op_1): Set arg2_type.
1880 2019-09-17 Jason Merrill <jason@redhat.com>
1882 * parser.c (cp_parser_statement): Handle [[likely]] on
1885 2019-09-19 Jason Merrill <jason@redhat.com>
1888 * call.c (build_new_op_1): Don't apply any standard conversions to
1889 the operands of a built-in operator. Don't suppress conversions in
1891 * typeck.c (cp_build_unary_op): Do integral promotions for enums.
1893 2019-09-16 Paolo Carlini <paolo.carlini@oracle.com>
1895 * decl.c (grokdeclarator): Use declspecs->locations and
1896 declarator->id_loc in a few error messages.
1897 * pt.c (finish_member_template_decl): Use DECL_SOURCE_LOCATION.
1898 (push_template_decl_real): Likewise.
1900 2019-09-15 Jason Merrill <jason@redhat.com>
1902 PR c++/30277 - int-width bit-field promotion.
1903 PR c++/33819 - long bit-field promotion.
1904 * typeck.c (cp_perform_integral_promotions): Handle large bit-fields
1905 properly. Handle 32-bit non-int bit-fields properly.
1906 (is_bitfield_expr_with_lowered_type): Don't look through NOP_EXPR.
1908 PR c++/82165 - enum bitfields and operator overloading.
1909 * call.c (build_new_op_1): Use unlowered_expr_type.
1911 * call.c (build_new_op_1): Don't apply any standard conversions to
1912 the operands of a built-in operator. Don't suppress conversions in
1914 * typeck.c (cp_build_unary_op): Do integral promotions for enums.
1916 2019-09-15 Marek Polacek <polacek@redhat.com>
1918 PR c++/91740 - ICE with constexpr call and ?: in ARRAY_REF.
1919 * pt.c (build_non_dependent_expr): Call build_non_dependent_expr for
1922 2019-09-15 Nathan Sidwell <nathan@acm.org>
1924 * cp-tree.h (DECL_CLONED_FUNCTION_P): Reimplement using
1925 IDENTIFIER_CDTOR_P, correct documentation.
1926 (DECL_CLONED_FUNCTION): Directly access field.
1927 (decl_cloned_function_p): Delete.
1928 * class.c (decl_cloned_function_p): Delete.
1929 * pt.c (instantiate_template_1): Check DECL_CHAIN is a decl.
1931 2019-09-11 Nathan Sidwell <nathan@acm.org>
1933 * c-objcp-common.c (cp-objcp-common.c): Alphababetize and
1934 correctly mark all C++ nodes.
1935 * decl.c (cp_tree_node_structure): Alphabetize.
1937 2019-09-10 Marek Polacek <polacek@redhat.com>
1939 PR c++/91673 - ICE with noexcept in alias-declaration.
1940 * parser.c (CP_PARSER_FLAGS_DELAY_NOEXCEPT): New parser flag.
1941 (cp_parser_lambda_declarator_opt): Pass CP_PARSER_FLAGS_NONE to
1942 cp_parser_exception_specification_opt.
1943 (cp_parser_direct_declarator): Adjust a call to
1944 cp_parser_exception_specification_opt.
1945 (cp_parser_member_declaration): Pass CP_PARSER_FLAGS_DELAY_NOEXCEPT
1946 to cp_parser_declarator if not processing a friend or typedef
1948 (cp_parser_late_noexcept_specifier): Adjust a call to
1949 cp_parser_noexcept_specification_opt.
1950 (cp_parser_noexcept_specification_opt): New parameter for parser flags,
1951 drop the FRIEND_P parameter. Use the new parameter.
1952 (cp_parser_exception_specification_opt): Likewise.
1953 (cp_parser_transaction): Adjust a call to
1954 cp_parser_noexcept_specification_opt.
1955 (cp_parser_transaction_expression): Likewise.
1957 2019-09-10 Marek Polacek <polacek@redhat.com>
1959 PR c++/91705 - constexpr evaluation rejects ++/-- on floats.
1960 * constexpr.c (cxx_eval_increment_expression): Call fold_simple on
1963 2019-09-10 Paolo Carlini <paolo.carlini@oracle.com>
1965 * decl.c (has_designator_problem): Use cp_expr_loc_or_input_loc
1967 (build_enumerator): Likewise.
1968 (cp_finish_decl): Use DECL_SOURCE_LOCATION.
1969 (grokdeclarator): Use id_loc in two error_at; change errror
1970 message about constinit together constexpr to use two ranges.
1972 2019-09-09 Marek Polacek <polacek@redhat.com>
1974 PR c++/84374 - diagnose invalid uses of decltype(auto).
1975 * decl.c (grokdeclarator): Diagnose wrong usage of decltype(auto) in
1976 a function declaration.
1978 2019-09-06 Nathan Sidwell <nathan@acm.org>
1981 * cp-tree.h (IDENTIFIER_REPO_CHOSEN, DECL_REPO_AVAILABLE_P): Delete.
1982 (struct lang_decl_base): Remove repo_available_p.
1983 * decl.c (duplicate_decls): Don't copy DECL_REPO_AVAILABLE_P.
1985 (Reserve TREE_LANG_FLAG_3 for modules.
1986 * cp-tree.h (DECL_CONSTRUCTION_VTABLE_P): Delete.
1987 (DECL_NON_TRIVIALLY_INITIALIZED_P): Move to TREE_LANG_FLAG_6.
1988 * class.c (build_ctor_vtbl_group): Don't set
1989 DECL_CONSTRUCTION_VTABLE_P.
1990 * decl2.c (determine_visibility_from_class): Don't check
1991 DECL_CONSTRUCTION_VTABLE_P anymore.
1993 2019-09-06 Martin Liska <mliska@suse.cz>
1996 * Make-lang.in: Remove repo.o.
1997 * config-lang.in: Likewise.
1998 * cp-tree.h (init_repo): Remove declarations
1999 of repo-related functions.
2000 (repo_emit_p): Likewise.
2001 (repo_export_class_p): Likewise.
2002 (finish_repo): Likewise.
2003 * decl2.c (import_export_class): Always
2005 (mark_needed): Remove -frepo from comment.
2006 (import_export_decl): Similarly here.
2007 (c_parse_final_cleanups): Remove call of finish_repo.
2008 * lex.c (cxx_init): Remove call to init_repo.
2009 * optimize.c (can_alias_cdtor): Remove dead condition.
2010 * pt.c (push_template_decl_real): Update comment.
2011 (instantiate_decl): Remove dead code used for -frepo.
2014 2019-09-05 Marek Polacek <polacek@redhat.com>
2016 PR c++/91644 - ICE with constinit in function template.
2017 * decl.c (start_decl): Call retrofit_lang_decl for constinit variables.
2018 * pt.c (tsubst_expr): Pass LOOKUP_CONSTINIT down to cp_finish_decl for
2019 constinit variables.
2021 2019-09-05 Nathan Sidwell <nathan@acm.org>
2023 * cp-tree.h (DECL_VTABLE_OR_VTT_P): Forward to DECL_VIRTUAL_P.
2025 2019-09-04 Marek Polacek <polacek@redhat.com>
2027 * call.c (build_over_call): Remove -fdeduce-init-list implementation.
2028 * pt.c (unify): Likewise.
2030 2019-09-01 Marek Polacek <polacek@redhat.com>
2032 PR c++/91129 - wrong error with binary op in template argument.
2033 * typeck.c (warn_for_null_address): Use fold_for_warn instead of
2034 fold_non_dependent_expr.
2035 (cp_build_binary_op): Likewise.
2037 2019-08-30 Jason Merrill <jason@redhat.com>
2039 Add source location to TRAIT_EXPR.
2040 * cp-tree.h (TRAIT_EXPR_LOCATION): New.
2041 (struct tree_trait_expr): Add locus field.
2042 * parser.c (cp_parser_trait_expr): Pass trait_loc down.
2043 * pt.c (tsubst_copy_and_build) [TRAIT_EXPR]: Likewise.
2044 * semantics.c (finish_trait_expr): Add location parm.
2045 * tree.c (cp_expr_location): Handle TRAIT_EXPR.
2047 2019-08-29 Paolo Carlini <paolo.carlini@oracle.com>
2049 * decl.c (check_var_type): Add location_t parameter and use it.
2050 (grokdeclarator): Adjust call.
2051 * pt.c (tsubst_decl): Likewise.
2052 * cp-tree.h: Adjust declaration.
2054 2019-08-28 Marek Polacek <polacek@redhat.com>
2056 Implement P1152R4: Deprecating some uses of volatile.
2058 * cp-gimplify.c (cp_fold): Set TREE_THIS_VOLATILE.
2059 * decl.c (grokdeclarator): Warn about a volatile-qualified structured
2060 binding and return type.
2061 (grokparms): Warn about a volatile-qualified function parameter.
2062 * expr.c (mark_use) <case MODIFY_EXPR>: Emit a -Wvolatile warning.
2063 * typeck.c (cp_build_unary_op): Emit a -Wvolatile warning for pre and
2064 post ++/-- on a volatile operand.
2065 (genericize_compound_lvalue): Use a better location. Don't lose
2067 (cp_build_modify_expr): Emit a -Wvolatile warning for a compound
2068 assignment whose LHS is volatile-qualified. Build the assignment with
2069 a more precise location.
2071 2019-08-28 Marek Polacek <polacek@redhat.com>
2073 PR c++/91360 - Implement C++20 P1143R2: constinit.
2074 * cp-tree.h (TINFO_VAR_DECLARED_CONSTINIT): Define.
2075 (LOOKUP_CONSTINIT): Define.
2076 (enum cp_decl_spec): Add ds_constinit.
2077 * decl.c (check_tag_decl): Give an error for constinit in type
2079 (check_initializer): Also check LOOKUP_CONSTINIT.
2080 (cp_finish_decl): Add checking for a constinit declaration. Set
2081 TINFO_VAR_DECLARED_CONSTINIT.
2082 (grokdeclarator): Add checking for a declaration with the constinit
2084 * lex.c (init_reswords): Handle D_CXX20.
2085 * parser.c (cp_lexer_get_preprocessor_token): Pass a better location
2086 to warning_at. Warn about C++20 keywords.
2087 (cp_keyword_starts_decl_specifier_p): Handle RID_CONSTINIT.
2088 (cp_parser_diagnose_invalid_type_name): Add an inform about constinit.
2089 (cp_parser_decomposition_declaration): Maybe pass LOOKUP_CONSTINIT to
2091 (cp_parser_decl_specifier_seq): Handle RID_CONSTINIT.
2092 (cp_parser_init_declarator): Maybe pass LOOKUP_CONSTINIT to
2094 (set_and_check_decl_spec_loc): Add "constinit".
2095 * pt.c (tsubst_decl): Set TINFO_VAR_DECLARED_CONSTINIT.
2096 (instantiate_decl): Maybe pass LOOKUP_CONSTINIT to cp_finish_decl.
2097 * typeck2.c (store_init_value): If a constinit variable wasn't
2098 initialized using a constant initializer, give an error.
2100 2019-08-28 Nathan Sidwell <nathan@acm.org>
2103 * name-lookup.c (cp_emit_debug_info): Check for builtins during
2106 2019-08-27 Marek Polacek <polacek@redhat.com>
2108 PR c++/81676 - bogus -Wunused warnings in constexpr if.
2109 * semantics.c (maybe_mark_exp_read_r): New function.
2110 (finish_if_stmt): Call it on THEN_CLAUSE and ELSE_CLAUSE.
2112 PR c++/91428 - warn about std::is_constant_evaluated in if constexpr.
2113 * cp-tree.h (decl_in_std_namespace_p): Declare.
2114 * semantics.c (is_std_constant_evaluated_p): New.
2115 (finish_if_stmt_cond): Warn about "std::is_constant_evaluated ()" in
2117 * typeck.c (decl_in_std_namespace_p): No longer static.
2119 2019-08-26 Jason Merrill <jason@redhat.com>
2121 * decl.c (duplicate_decls): Always merge DECL_DECLARED_CONSTEXPR_P.
2123 2019-08-26 Marek Polacek <polacek@redhat.com>
2125 PR c++/91545 - ICE in constexpr store evaluation.
2126 * constexpr.c (cxx_eval_store_expression): Check FIELD_DECL instead
2129 2019-08-24 Nathan Sidwell <nathan@acm.org>
2131 * class.c (check_for_overrides): Conversion operators need
2134 2019-08-24 Paolo Carlini <paolo.carlini@oracle.com>
2136 * semantics.c (finish_switch_cond): Improve error message location.
2138 2019-08-23 Jason Merrill <jason@redhat.com>
2140 * decl2.c (decl_dependent_p): New.
2141 (mark_used): Check it instead of just processing_template_decl.
2143 2019-08-23 Jason Merrill <jason@redhat.com>
2145 * parser.c (cp_parser_nested_name_specifier_opt): Avoid redundant
2148 2019-08-23 Marek Polacek <polacek@redhat.com>
2150 PR c++/91521 - wrong error with operator->.
2151 * decl.c (grokdeclarator): Return error_mark_node for an invalid
2152 trailing return type.
2154 PR c++/79817 - attribute deprecated on namespace.
2155 * cp-tree.h (cp_warn_deprecated_use_scopes): Declare.
2156 * decl.c (grokdeclarator): Call cp_warn_deprecated_use_scopes.
2157 (type_is_deprecated): Likewise.
2158 * decl2.c (cp_warn_deprecated_use_scopes): New function.
2159 * name-lookup.c (handle_namespace_attrs): Handle attribute deprecated.
2160 * parser.c (cp_parser_namespace_alias_definition): Call
2161 cp_warn_deprecated_use_scopes.
2162 (cp_parser_using_declaration): Likewise.
2163 (cp_parser_using_directive): Likewise.
2164 * semantics.c (finish_id_expression_1): Likewise.
2166 2019-08-23 Nathan Sidwell <nathan@acm.org>
2168 * class.c (check_for_override): Checking IDENTIFIER_VIRTUAL_P is
2169 sufficient, reorder DECL_OVERRIDE_P check.
2171 2019-08-23 Iain Sandoe <iain@sandoe.co.uk>
2174 * parser.c (cp_parser_initial_pragma): Call c_common_no_more_pch ()
2175 after determining that the first token is not
2176 PRAGMA_GCC_PCH_PREPROCESS.
2178 2019-08-22 Marek Polacek <polacek@redhat.com>
2180 PR c++/91304 - prefix attributes ignored in condition.
2181 * parser.c (cp_parser_condition): Handle prefix attributes.
2183 2019-08-21 Richard Sandiford <richard.sandiford@arm.com>
2186 * decl.c (duplicate_decls): Call copy_attributes_to_builtin inside
2187 the BUILT_IN_NORMAL block rather than afterward.
2189 2019-08-19 Marek Polacek <polacek@redhat.com>
2191 PR c++/91264 - detect modifying const objects in constexpr.
2192 * constexpr.c (modifying_const_object_error): New function.
2193 (cxx_eval_call_expression): Set TREE_READONLY on a CONSTRUCTOR of
2194 a const-qualified object after it's been fully constructed.
2195 (modifying_const_object_p): New function.
2196 (cxx_eval_store_expression): Detect modifying a const object
2197 during constant expression evaluation.
2198 (cxx_eval_increment_expression): Use a better location when building
2200 (cxx_eval_constant_expression) <case DECL_EXPR>: Mark a constant
2201 object's constructor TREE_READONLY.
2203 2019-08-15 Jason Merrill <jason@redhat.com>
2205 PR c++/90393 - ICE with thow in ?:
2207 PR c++/64372, DR 1560 - Gratuitous lvalue-to-rvalue conversion in ?:
2208 * tree.c (lvalue_kind): Handle throw in one arm.
2209 * typeck.c (rationalize_conditional_expr): Likewise.
2210 (cp_build_modify_expr): Likewise.
2212 2019-08-14 Jason Merrill <jason@redhat.com>
2214 Implement P0848R3, Conditionally Trivial Special Member Functions.
2215 * tree.c (special_memfn_p): New.
2216 * class.c (add_method): When overloading, hide ineligible special
2218 (check_methods): Set TYPE_HAS_COMPLEX_* here.
2219 * decl.c (grok_special_member_properties): Not here.
2220 * name-lookup.c (push_class_level_binding_1): Move overloaded
2221 functions case down, accept FUNCTION_DECL as target_decl.
2223 2019-08-14 Jonathan Wakely <jwakely@redhat.com>
2226 * name-lookup.c (get_std_name_hint): Fix min_dialect field for
2227 complex_literals and make_unique entries.
2229 2019-08-14 Jakub Jelinek <jakub@redhat.com>
2230 Marek Polacek <polacek@redhat.com>
2232 PR c++/91391 - bogus -Wcomma-subscript warning.
2233 * parser.c (cp_parser_postfix_open_square_expression): Don't warn about
2234 a deprecated comma here. Pass warn_comma_subscript down to
2235 cp_parser_expression.
2236 (cp_parser_expression): New bool parameter. Warn about uses of a comma
2237 operator within a subscripting expression.
2238 (cp_parser_skip_to_closing_square_bracket): Revert to pre-r274121 state.
2239 (cp_parser_skip_to_closing_square_bracket_1): Remove.
2241 2019-08-14 Jonathan Wakely <jwakely@redhat.com>
2243 * name-lookup.c (get_std_name_hint): Add more entries.
2245 2019-08-14 Paolo Carlini <paolo.carlini@oracle.com>
2247 * decl2.c (grok_array_decl): Use the location of the open square
2248 bracket in error message about invalid types.
2250 2019-08-14 Paolo Carlini <paolo.carlini@oracle.com>
2252 * decl.c (grokdeclarator): Check here for typedef a function
2253 definition or a member function definition.
2254 (start_function): Adjust.
2255 (grokmethod): Likewise.
2257 2019-08-13 Richard Sandiford <richard.sandiford@arm.com>
2260 * decl.c (duplicate_decls): Use copy_decl_built_in_function.
2261 * pt.c (declare_integer_pack): Use set_decl_built_in_function.
2263 2019-08-13 Marek Polacek <polacek@redhat.com>
2265 PR c++/90473 - wrong code with nullptr in default argument.
2266 * call.c (null_ptr_cst_p): Update quote from the standard.
2267 * decl.c (check_default_argument): Don't return nullptr when the arg
2270 2019-08-13 Marek Polacek <polacek@redhat.com>
2272 * cp-tree.h (DECL_MUTABLE_P): Use FIELD_DECL_CHECK.
2274 2019-08-10 Jakub Jelinek <jakub@redhat.com>
2276 * parser.c (cp_parser_omp_clause_name): Parse device_type.
2277 (cp_parser_omp_clause_device_type): New function.
2278 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_DEVICE_TYPE.
2279 (OMP_DECLARE_TARGET_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_DEVICE_TYPE.
2280 (cp_parser_omp_declare_target): Handle device_type clauses. Remove
2281 diagnostics for declare target with clauses nested in clause-less
2282 declare target declaration-definition-seq.
2283 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_DEVICE_TYPE.
2285 2019-08-09 Jakub Jelinek <jakub@redhat.com>
2287 * parser.c (check_no_duplicate_clause): Simplify using
2289 (cp_parser_omp_clause_if): Fix up printing of target {enter,exit} data
2290 directive name modifiers.
2293 * parser.c (cp_parser_omp_clause_dist_schedule): Comment out the
2294 check_no_duplicate_clause call, instead emit a warning for duplicate
2295 dist_schedule clauses.
2297 2019-08-08 Paolo Carlini <paolo.carlini@oracle.com>
2299 * decl.c (grokdeclarator): Use id_loc and EXPR_LOCATION in
2300 a few error messages.
2302 2019-08-08 Marek Polacek <polacek@redhat.com>
2304 PR c++/87519 - bogus warning with -Wsign-conversion.
2305 * typeck.c (cp_build_binary_op): Use same_type_p instead of comparing
2308 * constexpr.c (inline_asm_in_constexpr_error): New.
2309 (cxx_eval_constant_expression) <case ASM_EXPR>: Call it.
2310 (potential_constant_expression_1) <case ASM_EXPR>: Likewise.
2312 2019-08-08 Jakub Jelinek <jakub@redhat.com>
2314 * semantics.c (finish_omp_clauses): For C_ORT_OMP
2315 OMP_CLAUSE_USE_DEVICE_* clauses use oacc_reduction_head bitmap
2316 instead of generic_head to track duplicates.
2318 2019-08-07 Marek Polacek <polacek@redhat.com>
2320 PR c++/81429 - wrong parsing of constructor with C++11 attribute.
2321 * parser.c (cp_parser_constructor_declarator_p): Handle the scenario
2322 when a parameter declaration begins with [[attribute]].
2324 2019-08-07 Marek Polacek <polacek@redhat.com>
2326 PR c++/91346 - Implement P1668R1, allow unevaluated asm in constexpr.
2327 * constexpr.c (cxx_eval_constant_expression): Handle ASM_EXPR.
2328 (potential_constant_expression_1) <case ASM_EXPR>: Allow.
2329 * cp-tree.h (finish_asm_stmt): Adjust.
2330 * parser.c (cp_parser_asm_definition): Grab the locaion of "asm" and
2331 use it. Change an error to a pedwarn. Allow asm in C++2a, warn
2333 * pt.c (tsubst_expr): Pass a location down to finish_asm_stmt.
2334 * semantics.c (finish_asm_stmt): New location_t parameter. Use it.
2336 2019-08-07 Jakub Jelinek <jakub@redhat.com>
2338 * parser.c (cp_parser_omp_clause_name): Parse use_device_addr clause.
2339 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR.
2340 (OMP_TARGET_DATA_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR.
2341 (cp_parser_omp_target_data): Handle PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR
2342 like PRAGMA_OMP_CLAUSE_USE_DEVICE_PTR, adjust diagnostics about no
2343 map or use_device_* clauses.
2344 * semantics.c (finish_omp_clauses): For OMP_CLAUSE_USE_DEVICE_PTR
2345 in OpenMP, require pointer or reference to pointer type rather than
2346 pointer or array or reference to pointer or array type. Handle
2347 OMP_CLAUSE_USE_DEVICE_ADDR.
2348 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_USE_DEVICE_ADDR.
2350 2019-08-06 Jason Merrill <jason@redhat.com>
2352 PR c++/91378 - ICE with noexcept and auto return type.
2353 * pt.c (maybe_instantiate_noexcept): push_to_top_level.
2355 2019-08-06 Paolo Carlini <paolo.carlini@oracle.com>
2357 * decl.c (check_array_designated_initializer): Use
2358 cp_expr_loc_or_input_loc in one place.
2360 2019-08-06 Jakub Jelinek <jakub@redhat.com>
2362 * parser.c (cp_parser_omp_for_loop): For OMP_LOOP, ignore parallel
2363 clauses and predetermine iterator as lastprivate.
2364 * semantics.c (handle_omp_for_class_iterator): Use
2365 OMP_CLAUSE_LASTPRIVATE_LOOP_IV instead of
2366 OMP_CLAUSE_LASTPRIVATE_TASKLOOP_IV, set it for lastprivate also
2367 on OMP_LOOP construct. If a clause is missing for class iterator
2368 on OMP_LOOP, add firstprivate clause, and if there is private
2369 clause, turn it into firstprivate too.
2370 (finish_omp_for): Formatting fix. For OMP_LOOP, adjust
2371 OMP_CLAUSE_LASTPRIVATE_LOOP_IV clause CP_CLAUSE_INFO, so that it
2372 uses copy ctor instead of default ctor.
2373 * cp-gimplify.c (cp_gimplify_expr): Handle OMP_LOOP like
2375 (cp_fold_r): Likewise.
2376 (cp_genericize_r): Likewise.
2377 (cxx_omp_finish_clause): Also finish lastprivate clause with
2378 OMP_CLAUSE_LASTPRIVATE_LOOP_IV flag.
2379 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_BIND.
2380 (tsubst_omp_for_iterator): For OMP_LOOP, ignore parallel
2381 clauses and predetermine iterator as lastprivate.
2382 * constexpr.c (potential_constant_expression_1): Handle OMP_LOOP
2383 like OMP_DISTRIBUTE etc.
2385 2019-08-05 Marek Polacek <polacek@redhat.com>
2387 DR 2413 - typename in conversion-function-ids.
2388 * parser.c (cp_parser_conversion_type_id): Call
2389 cp_parser_type_specifier_seq with CP_PARSER_FLAGS_TYPENAME_OPTIONAL
2390 instead of CP_PARSER_FLAGS_NONE.
2392 2019-08-05 Paolo Carlini <paolo.carlini@oracle.com>
2394 * cp-tree.h (cp_expr_loc_or_input_loc): New.
2395 (cxx_incomplete_type_diagnostic): Use it.
2396 * call.c (build_converted_constant_expr_internal, convert_like_real,
2397 convert_arg_to_ellipsis, convert_for_arg_passing, build_over_call,
2398 build_cxx_call, perform_implicit_conversion_flags,
2399 initialize_reference): Likewise.
2400 * constexpr.c (cxx_eval_internal_function, cxx_eval_call_expression,
2401 eval_and_check_array_index, cxx_eval_store_expression,
2402 cxx_eval_statement_list, cxx_eval_loop_expr,
2403 cxx_eval_constant_expression, potential_constant_expression_1):
2405 * constraint.cc (check_for_logical_overloads,
2406 satisfy_predicate_constraint): Likewise.
2407 * cp-gimplify.c (cp_gimplify_expr): Likewise.
2408 * cvt.c (cp_convert_to_pointer, convert_to_reference,
2409 cp_convert_and_check, ocp_convert, maybe_warn_nodiscard): Likewise.
2410 * decl.c (pop_switch): Likewise.
2411 * decl2.c (delete_sanity): Likewise.
2412 * error.c (location_of): Likewise.
2413 * init.c (maybe_warn_list_ctor, build_aggr_init,
2414 warn_placement_new_too_small, build_new_1, build_vec_init): Likewise.
2415 * lex.c (unqualified_name_lookup_error): Likewise.
2416 * parser.c (cp_parser_initializer_list, cp_parser_omp_for_cond):
2418 * pt.c (check_for_bare_parameter_packs, check_valid_ptrmem_cst_expr,
2419 unify_arg_conversion, convert_nontype_argument,
2420 tsubst_copy_and_build, resolve_typename_type): Likewise.
2421 * semantics.c (maybe_convert_cond, finish_call_expr,
2422 cp_build_vec_convert): Likewise.
2423 * typeck.c (decay_conversion, rationalize_conditional_expr,
2424 cp_build_unary_op, build_x_compound_expr_from_list,
2425 maybe_warn_about_returning_address_of_local,
2426 maybe_warn_pessimizing_move): Likewise.
2427 * typeck2.c (check_narrowing, digest_init_r,
2428 process_init_constructor_array): Likewise.
2430 2019-08-05 Tom Honermann <tom@honermann.net>
2432 * parser.c (cp_parser_template_declaration_after_parameters): Enable
2433 class template argument deduction for non-type template parameters
2434 in literal operator templates.
2436 2019-08-05 Marek Polacek <polacek@redhat.com>
2438 PR c++/91338 - Implement P1161R3: Deprecate a[b,c].
2439 * parser.c (cp_parser_postfix_open_square_expression): Warn about uses
2440 of a comma operator within a subscripting expression.
2441 (cp_parser_skip_to_closing_square_bracket_1): New function, made out
2443 (cp_parser_skip_to_closing_square_bracket): ...this.
2445 2019-08-05 Jason Merrill <jason@redhat.com>
2447 * semantics.c (force_paren_expr): Preserve location.
2449 2019-08-02 Marek Polacek <polacek@redhat.com>
2451 PR c++/91230 - wrong error with __PRETTY_FUNCTION__ and generic lambda.
2452 * pt.c (value_dependent_expression_p): Consider __PRETTY_FUNCTION__
2453 inside a template function value-dependent.
2455 2019-08-02 Paolo Carlini <paolo.carlini@oracle.com>
2457 * tree.c (handle_nodiscard_attribute): Do not warn about nodiscard
2458 applied to a constructor.
2460 2019-08-02 Martin Liska <mliska@suse.cz>
2462 * decl.c (grok_op_properties):
2463 Mark DECL_SET_IS_OPERATOR_DELETE for user-provided delete operators.
2465 2019-08-01 Martin Sebor <msebor@redhat.com>
2468 * decl.c (reshape_init_array_1): Avoid truncating initializer
2469 lists containing string literals.
2471 2019-08-01 Marek Polacek <polacek@redhat.com>
2473 PR c++/90805 - detect narrowing in case values.
2474 * decl.c (case_conversion): Detect narrowing in case values.
2476 2019-07-31 Paolo Carlini <paolo.carlini@oracle.com>
2478 * decl2.c (delete_sanity): Improve diagnostic locations, use
2479 cp_expr_loc_or_loc in four places.
2481 2019-07-31 Jason Merrill <jason@redhat.com>
2483 PR c++/90538 - multiple expansions of capture packs
2484 * cp-tree.h (DECLTYPE_FOR_INIT_CAPTURE): Remove.
2485 * lambda.c (add_capture): Copy parameter packs from init.
2486 (lambda_capture_field_type): Always use auto for init-capture.
2487 * pt.c (uses_parameter_packs): Return tree.
2488 (tsubst) [DECLTYPE_TYPE]: Remove init-capture handling.
2489 (gen_elem_of_pack_expansion_instantiation): Don't push
2490 local_specialization_stack.
2491 (prepend_one_capture): New.
2492 (tsubst_lambda_expr): Use it. Don't touch local_specializations.
2493 (do_auto_deduction): Avoid redundant error.
2495 Fix copy_node of TEMPLATE_INFO.
2496 * cp-tree.h (struct tree_template_info): Use tree_base instead of
2497 tree_common. Add tmpl and args fields.
2498 (TI_TEMPLATE, TI_ARGS): Adjust.
2500 2019-07-30 Martin Liska <mliska@suse.cz>
2502 PR tree-optimization/91270
2503 * tree-ssa-dce.c (propagate_necessity): Mark 2nd argument
2504 of delete operator as needed.
2506 2019-07-25 Martin Liska <mliska@suse.cz>
2507 Dominik Infuhr <dominik.infuehr@theobroma-systems.com>
2510 * decl.c (cxx_init_decl_processing): Mark delete operators
2511 with DECL_SET_IS_OPERATOR_DELETE.
2513 2019-07-25 Martin Liska <mliska@suse.cz>
2515 * decl.c (duplicate_decls): Use new macros
2516 (e.g. DECL_SET_LAMBDA_FUNCTION and DECL_LAMBDA_FUNCTION_P).
2517 (cxx_init_decl_processing): Likewise.
2518 (grok_op_properties): Likewise.
2519 * parser.c (cp_parser_lambda_declarator_opt): Likewise.
2521 2019-07-24 Martin Sebor <msebor@redhat.com>
2524 * decl.c (finish_function): Use lang_mask.
2526 2019-07-20 Jason Merrill <jason@redhat.com>
2528 * cp-tree.h (ovl_iterator::using_p): A USING_DECL by itself was also
2529 introduced by a using-declaration.
2531 2019-07-20 Jason Merrill <jason@redhat.com>
2533 Reduce memory consumption for push/pop_access_scope.
2534 * name-lookup.c (leave_scope): Do add class levels other than
2535 previous_class_level to free_binding_level.
2536 (invalidate_class_lookup_cache): Move from class.c, add to
2538 * pt.c (saved_access_scope): Change from list to vec.
2540 2019-07-20 Jakub Jelinek <jakub@redhat.com>
2542 * cp-tree.h (OMP_FOR_GIMPLIFYING_P): Use OMP_LOOPING_CHECK
2543 instead of OMP_LOOP_CHECK.
2544 * parser.c (cp_parser_omp_clause_name): Handle bind clause.
2545 (cp_parser_omp_clause_bind): New function.
2546 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_BIND.
2547 (OMP_LOOP_CLAUSE_MASK): Define.
2548 (cp_parser_omp_loop): New function.
2549 (cp_parser_omp_parallel, cp_parser_omp_teams): Handle parsing of
2550 loop combined with parallel or teams.
2551 (cp_parser_omp_construct): Handle PRAGMA_OMP_LOOP.
2552 (cp_parser_pragma): Likewise.
2553 * pt.c (tsubst_expr): Handle OMP_LOOP.
2554 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_BIND.
2556 2019-07-19 Jason Merrill <jason@redhat.com>
2558 PR c++/90101 - dependent class non-type parameter.
2559 * pt.c (invalid_nontype_parm_type_p): Check for dependent class type.
2561 2019-07-18 Jason Merrill <jason@redhat.com>
2563 PR c++/90098 - partial specialization and class non-type parms.
2566 * call.c (build_converted_constant_expr_internal): Don't copy.
2567 * pt.c (process_partial_specialization): Allow VIEW_CONVERT_EXPR
2568 around class non-type parameter.
2569 (unify) [TEMPLATE_PARM_INDEX]: Ignore cv-quals.
2571 2019-07-16 Jason Merrill <jason@redhat.com>
2573 * parser.c (make_location): Add overload taking cp_lexer* as last
2576 * parser.c (cp_parser_simple_type_specifier): Separate tentative
2577 parses for optional type-spec and CTAD.
2579 * parser.c (cp_parser_nested_name_specifier_opt): If the token is
2580 already CPP_NESTED_NAME_SPECIFIER, leave it alone.
2582 2019-07-12 Jakub Jelinek <jakub@redhat.com>
2584 * parser.c (cp_parser_omp_clause_name): Handle order clause.
2585 (cp_parser_omp_clause_order): New function.
2586 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_ORDER.
2587 (OMP_SIMD_CLAUSE_MASK, OMP_FOR_CLAUSE_MASK): Add
2588 PRAGMA_OMP_CLAUSE_ORDER.
2589 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_ORDER.
2590 * pt.c (tsubst_omp_clauses): Likewise.
2592 2019-07-10 Paolo Carlini <paolo.carlini@oracle.com>
2594 * decl.c (get_type_quals,
2595 smallest_type_location (const cp_decl_specifier_seq*)): New.
2596 (check_tag_decl): Use smallest_type_location in error_at about
2597 multiple types in one declaration.
2598 (grokdeclarator): Use locations[ds_complex] in error_at about
2599 complex invalid; use locations[ds_storage_class] in error_at
2600 about static cdtor; use id_loc in error_at about flexible
2601 array member in union; use get_type_quals.
2603 2019-07-09 Martin Sebor <msebor@redhat.com>
2606 * cp-tree.h: Change class-key of PODs to struct and others to class.
2608 * semantics.c (finalize_nrv_r): Same.
2610 2019-07-09 Martin Sebor <msebor@redhat.com>
2613 * constexpr.c (cxx_eval_call_expression): Change class-key from class
2614 to struct and vice versa to match convention and avoid -Wclass-is-pod
2615 and -Wstruct-no-pod.
2616 * constraint.cc (get_concept_definition): Same.
2618 * cxx-pretty-print.h: Same.
2620 * logic.cc (term_list::replace): Same.
2621 * name-lookup.c (find_local_binding): Same.
2622 * pt.c (tsubst_binary_right_fold): Same.
2623 * search.c (field_accessor_p): Same.
2624 * semantics.c (expand_or_defer_fn): Same.
2626 2019-07-08 Jakub Jelinek <jakub@redhat.com>
2629 * decl2.c (cp_omp_mappable_type_1): Don't emit any note for
2630 error_mark_node type.
2632 2019-07-05 Jakub Jelinek <jakub@redhat.com>
2636 * call.c (build_new_method_call_1): Remove set but not used variable
2639 2019-07-05 Paolo Carlini <paolo.carlini@oracle.com>
2641 PR c++/67184 (again)
2643 * call.c (build_over_call): Devirtualize user-defined operators
2644 coming from a base too.
2645 (build_new_method_call_1): Do not devirtualize here.
2647 2019-07-04 Marek Polacek <polacek@redhat.com>
2650 PR c++/83374 - __is_standard_layout wrong for a class with repeated
2652 * class.c (check_bases): Set CLASSTYPE_NON_STD_LAYOUT for a class if
2653 CLASSTYPE_REPEATED_BASE_P is true.
2655 2019-07-04 Andrew Stubbs <ams@codesourcery.com>
2657 * cp-tree.h (cp_omp_emit_unmappable_type_notes): New prototype.
2658 * decl.c (cp_finish_decl): Call cp_omp_emit_unmappable_type_notes.
2659 * decl2.c (cp_omp_mappable_type): Move contents to ...
2660 (cp_omp_mappable_type_1): ... here and add note output.
2661 (cp_omp_emit_unmappable_type_notes): New function.
2662 * semantics.c (finish_omp_clauses): Call
2663 cp_omp_emit_unmappable_type_notes in four places.
2665 2019-07-03 Martin Liska <mliska@suse.cz>
2667 * call.c (build_new_op_1): Remove dead assignemts.
2668 * typeck.c (cp_build_binary_op): Likewise.
2670 2019-06-27 Jason Merrill <jason@redhat.com>
2672 PR c++/55442 - memory-hog with highly recursive constexpr.
2673 * constexpr.c (push_cx_call_context): Return depth.
2674 (cxx_eval_call_expression): Don't cache past constexpr_cache_depth.
2676 2019-06-27 Jan Hubicka <jh@suse.cz>
2678 * class.c (layout_class_type): Set TYPE_CXX_ODR_P for as-base
2681 2019-06-27 Martin Liska <mliska@suse.cz>
2683 * class.c (adjust_clone_args): Remove obviously
2685 (dump_class_hierarchy_r): Likewise.
2686 * decl.c (check_initializer): Likewise.
2687 * parser.c (cp_parser_lambda_expression): Likewise.
2688 * pt.c (unify_bound_ttp_args): Likewise.
2689 (convert_template_argument): Likewise.
2690 * rtti.c (build_headof): Likewise.
2691 * typeck.c (convert_for_initialization): Likewise.
2693 2019-06-25 Jason Merrill <jason@redhat.com>
2695 PR c++/70462 - unnecessary base ctor variant with final.
2696 * optimize.c (populate_clone_array): Skip base variant if
2698 (maybe_clone_body): We don't need an alias if we are only defining
2701 * class.c (resolves_to_fixed_type_p): Check CLASSTYPE_FINAL.
2703 2019-06-25 Jakub Jelinek <jakub@redhat.com>
2706 * constexpr.c (cxx_eval_array_reference): Don't look through VCE from
2707 vector type if lval.
2709 2019-06-25 Jozef Lawrynowicz <jozef.l@mittosystems.com>
2711 * lex.c (init_reswords): Create keyword for "__intN__" type.
2712 * cp-tree.h (cp_decl_specifier_seq): New bitfield "int_n_alt".
2713 * decl.c (grokdeclarator): Don't pedwarn about "__intN" ISO
2714 C incompatibility if alternate "__intN__" form is used.
2715 * parser.c (cp_parser_simple_type_specifier): Set
2716 decl_specs->int_n_alt if "__intN__" form is used.
2718 2019-06-24 Jan Hubicka <jh@suse.cz>
2720 * lex.c (cxx_make_type): Set TYPE_CXX_ODR_P.
2722 2019-06-24 Jason Merrill <jason@redhat.com>
2724 * class.c (layout_class_type): Don't use a separate
2725 CLASSTYPE_AS_BASE if it's the same size.
2727 2019-06-23 Marek Polacek <polacek@redhat.com>
2729 * call.c (convert_default_arg): Use DEFERRED_PARSE instead of
2731 * cp-objcp-common.c (cp_tree_size): Likewise. Use tree_deferred_parse
2732 instead of tree_default_arg.
2733 * cp-tree.def: Rename DEFAULT_ARG to DEFERRED_PARSE.
2734 * cp-tree.h: Rename DEFARG_TOKENS to DEFPARSE_TOKENS. Rename
2735 DEFARG_INSTANTIATIONS to DEFPARSE_INSTANTIATIONS. Rename
2736 tree_default_arg to tree_deferred_parse.
2737 (UNPARSED_NOEXCEPT_SPEC_P): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2738 (cp_tree_node_structure_enum): Rename TS_CP_DEFAULT_ARG to
2739 TS_CP_DEFERRED_PARSE.
2740 (lang_tree_node): Rename tree_default_arg to tree_deferred_parse.
2741 Rename default_arg to deferred_parse. Use TS_CP_DEFERRED_PARSE instead
2742 of TS_CP_DEFAULT_ARG.
2743 (defarg_location): Remove declaration.
2744 (defparse_location): Add declaration.
2745 * decl.c (grokfndecl): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2746 Call defparse_location instead of defarg_location.
2747 (check_default_argument): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2748 (cp_tree_node_structure): Likewise. Use TS_CP_DEFERRED_PARSE instead
2749 of TS_CP_DEFAULT_ARG.
2750 * decl2.c (grokfield): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2751 * error.c (dump_expr): Likewise.
2752 (location_of): Likewise.
2753 * init.c (get_nsdmi): Likewise.
2754 * parser.c (cp_parser_save_noexcept): Likewise. Use DEFPARSE_TOKENS
2755 instead of DEFARG_TOKENS.
2756 (cp_parser_late_noexcept_specifier): Likewise.
2757 (cp_parser_late_parse_one_default_arg): Use DEFPARSE_TOKENS instead
2759 (cp_parser_late_parsing_default_args): Use DEFERRED_PARSE instead of
2760 DEFAULT_ARG. Use DEFPARSE_INSTANTIATIONS instead of
2761 DEFARG_INSTANTIATIONS.
2762 (cp_parser_cache_defarg): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2763 Use DEFPARSE_TOKENS instead of DEFARG_TOKENS. Use
2764 DEFPARSE_INSTANTIATIONS instead of DEFARG_INSTANTIATIONS.
2765 (defparse_location): Renamed from defarg_location.
2766 * pt.c (tsubst_default_argument): Use DEFERRED_PARSE instead of
2768 (tsubst_arg_types): Likewise.
2769 (dependent_type_p_r): Likewise.
2770 * tree.c (cp_tree_equal): Likewise.
2771 (cp_walk_subtrees): Likewise.
2772 * typeck.c (convert_arguments): Likewise.
2774 2019-06-22 Marek Polacek <polacek@redhat.com>
2776 PR c++/86476 - noexcept-specifier is a complete-class context.
2778 * cp-tree.def (DEFAULT_ARG): Update commentary.
2779 * cp-tree.h (UNPARSED_NOEXCEPT_SPEC_P): New macro.
2780 (tree_default_arg): Use tree_base instead of tree_common.
2781 (do_push_parm_decls, maybe_check_overriding_exception_spec): Declare.
2782 * decl.c (do_push_parm_decls): New function, broken out of...
2783 (store_parm_decls): ...here. Call it.
2784 * except.c (nothrow_spec_p): Accept DEFAULT_ARG in the assert.
2785 * parser.c (cp_parser_noexcept_specification_opt,
2786 cp_parser_late_noexcept_specifier, noexcept_override_late_checks):
2788 (unparsed_noexcepts): New macro.
2789 (push_unparsed_function_queues): Update initializer.
2790 (cp_parser_direct_declarator): Pass FRIEND_P to
2791 cp_parser_exception_specification_opt.
2792 (inject_parm_decls): New.
2793 (pop_injected_parms): New.
2794 (cp_parser_class_specifier_1): Implement delayed parsing of
2795 noexcept-specifiers.
2796 (cp_parser_save_noexcept): New.
2797 (cp_parser_late_noexcept_specifier): New.
2798 (noexcept_override_late_checks): New.
2799 (cp_parser_noexcept_specification_opt): Add FRIEND_P parameter. Call
2800 cp_parser_save_noexcept instead of the normal processing if needed.
2801 (cp_parser_exception_specification_opt): Add FRIEND_P parameter and
2802 pass it to cp_parser_noexcept_specification_opt.
2803 (cp_parser_save_member_function_body): Fix comment.
2804 (cp_parser_save_default_args): Maybe save the noexcept-specifier to
2806 (cp_parser_transaction): Update call to
2807 cp_parser_noexcept_specification_opt.
2808 (cp_parser_transaction_expression): Likewise.
2809 * parser.h (cp_unparsed_functions_entry): Add new field to carry
2810 a noexcept-specifier.
2811 * pt.c (dependent_type_p_r): Handle unparsed noexcept expression.
2812 * search.c (maybe_check_overriding_exception_spec): New function, broken
2814 (check_final_overrider): ...here. Call
2815 maybe_check_overriding_exception_spec.
2816 * tree.c (canonical_eh_spec): Handle UNPARSED_NOEXCEPT_SPEC_P.
2817 (cp_tree_equal): Handle DEFAULT_ARG.
2819 PR c++/90881 - bogus -Wunused-value in unevaluated context.
2820 * cvt.c (convert_to_void): Don't emit unused warnings in
2821 an unevaluated context.
2823 2019-06-22 Paolo Carlini <paolo.carlini@oracle.com>
2825 * decl.c (grokdeclarator): Use id_loc, typespec_loc, and
2826 locations[ds_storage_class] in a few additional places.
2828 2019-06-21 Paolo Carlini <paolo.carlini@oracle.com>
2832 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com>
2836 * call.c (build_over_call): Devirtualize when the final overrider
2837 comes from the base.
2839 2019-06-21 Marek Polacek <polacek@redhat.com>
2841 PR c++/61490 - qualified-id in friend function definition.
2842 * decl.c (grokdeclarator): Diagnose qualified-id in friend function
2843 definition. Improve location for diagnostics of friend functions.
2845 PR c++/60223 - ICE with T{} in non-deduced context.
2846 * pt.c (unify): Allow COMPOUND_LITERAL_P in a non-deduced context.
2848 PR c++/64235 - missing syntax error with invalid alignas.
2849 * parser.c (cp_parser_std_attribute_spec): Commit to tentative parse
2850 if there's a missing close paren.
2852 PR c++/90490 - fix decltype issues in noexcept-specifier.
2853 * except.c (build_noexcept_spec): Call
2854 instantiate_non_dependent_expr_sfinae before
2855 build_converted_constant_expr instead of calling
2856 instantiate_non_dependent_expr after it. Add
2857 processing_template_decl_sentinel.
2859 2019-06-21 Jakub Jelinek <jakub@redhat.com>
2862 * semantics.c (finish_omp_clauses): Don't reject references to
2863 incomplete types if processing_template_decl.
2865 2019-06-19 Marek Polacek <polacek@redhat.com>
2867 PR c++/60364 - noreturn after first decl not diagnosed.
2868 * decl.c (duplicate_decls): Give an error when a function is
2869 declared [[noreturn]] after its first declaration.
2870 * parser.c (cp_parser_std_attribute): Don't treat C++11 noreturn
2871 attribute as equivalent to GNU's.
2872 * tree.c (std_attribute_table): Add noreturn.
2874 2019-06-19 Jakub Jelinek <jakub@redhat.com>
2876 * cp-gimplify.c (cp_genericize_r): Handle OMP_CLAUSE_{IN,EX}CLUSIVE
2877 like OMP_CLAUSE_SHARED.
2879 2019-06-18 Jason Merrill <jason@redhat.com>
2881 * constexpr.c (cxx_eval_store_expression): Delay target evaluation.
2883 2019-06-18 Jason Merrill <jason@redhat.com>
2885 * constexpr.c (eval_and_check_array_index): Split out from...
2886 (cxx_eval_array_reference): ...here.
2887 (cxx_eval_store_expression): Use it here, too.
2888 (diag_array_subscript): Take location. Strip location wrapper.
2890 2019-06-18 Jason Merrill <jason@redhat.com>
2892 * constexpr.c (cxx_eval_constant_expression): Handle conversion from
2893 and then to the same type.
2895 2019-06-18 Jason Merrill <jason@redhat.com>
2897 * constexpr.c (unshare_constructor): Add MEM_STAT_DECL.
2899 2019-06-17 Jakub Jelinek <jakub@redhat.com>
2901 * semantics.c (finish_omp_clauses): For OMP_CLAUSE_REDUCTION_INSCAN
2902 set need_copy_assignment.
2904 2019-06-17 Marek Polacek <polacek@redhat.com>
2906 PR c++/83820 - excessive attribute arguments not detected.
2907 * parser.c (cp_parser_std_attribute): Detect excessive arguments.
2909 2019-06-17 Nathan Sidwell <nathan@acm.org>
2912 * name-lookup.c (lookup_type_scope_1): Calll qualify_lookup before
2915 2019-06-14 Marek Polacek <polacek@redhat.com>
2917 PR c++/90884 - stray note with -Wctor-dtor-privacy.
2918 * class.c (maybe_warn_about_overly_private_class): Guard the call to
2921 2019-06-12 Jason Merrill <jason@redhat.com>
2923 PR c++/85552 - wrong instantiation of dtor for DMI.
2924 * typeck2.c (digest_nsdmi_init): Set tf_no_cleanup for direct-init.
2926 2019-06-13 Paolo Carlini <paolo.carlini@oracle.com>
2928 * decl.c (grokdeclarator): Use id_loc in five additional places
2929 in the last part of the function.
2931 2019-06-13 Paolo Carlini <paolo.carlini@oracle.com>
2933 * decl.c (grokdeclarator): Move further up the declaration of
2934 id_loc, use it immediately, update its value after the loop
2935 over declarator, use it again in the final part of function;
2936 improve locations of error messages about multiple data types
2937 and conflicting specifiers.
2939 2019-06-13 Richard Biener <rguenther@suse.de>
2942 * typeck2.c (split_nonconstant_init_1): Properly count
2943 num_split_elts, optimize single constructor elt removal.
2945 2019-06-12 Marek Polacek <polacek@redhat.com>
2947 PR c++/66999 - 'this' captured by reference.
2948 * parser.c (cp_parser_lambda_introducer): Reject `&this'. Use
2949 cp_lexer_nth_token_is instead of cp_lexer_peek_nth_token.
2951 PR c++/90825 - endless recursion when evaluating sizeof.
2952 PR c++/90832 - endless recursion when evaluating sizeof.
2953 * constexpr.c (cxx_eval_constant_expression): Don't recurse on the
2954 result of fold_sizeof_expr if is returns a SIZEOF_EXPR.
2955 * typeck.c (cxx_sizeof_expr): Only return a SIZEOF_EXPR if the operand
2956 is instantiation-dependent.
2958 PR c++/90736 - bogus error with alignof.
2959 * constexpr.c (adjust_temp_type): Use cv_unqualified type.
2961 2019-06-11 Matthew Beliveau <mbelivea@redhat.com>
2963 PR c++/90449 - add -Winaccessible-base option.
2964 * class.c (warn_about_ambiguous_bases): Changed name to:
2965 maybe_warn_about_inaccessible_bases.
2966 (maybe_warn_about_inaccessible_bases): Implemented new
2967 Winaccessible-base warning option for both direct and virtual
2969 (layout_class_type): Call to warn_about_ambiguous_bases changed to fit
2972 2019-06-11 Richard Biener <rguenther@suse.de>
2975 * typeck2.c (split_nonconstant_init_1): Avoid ordered remove
2976 from CONSTRUCTOR by marking to remove elements and doing all
2977 of them in a O(n) scan.
2979 2019-06-11 Jakub Jelinek <jakub@redhat.com>
2982 * init.c (constant_value_1): Handle VECTOR_CST DECL_INITIAL for
2983 !DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P decls like CONSTRUCTOR.
2985 2019-06-11 Martin Liska <mliska@suse.cz>
2988 * pt.c (init_template_processing): Disable hash table
2989 sanitization for decl_specializations and type_specializations.
2991 2019-06-10 Jason Merrill <jason@redhat.com>
2993 * constexpr.c (free_constructor): New.
2994 (cxx_eval_call_expression): Free parameter value CONSTRUCTORs.
2996 * constexpr.c (unshare_constructor): Only unshare if T is itself a
2998 (cxx_eval_call_expression): Don't call it on the result here.
3000 Reduce constexpr_call memory consumption.
3001 * constexpr.c (cxx_bind_parameters_in_call): Use TREE_VEC rather
3003 (constexpr_call_hasher::equal, cxx_bind_parameters_in_call)
3004 (cxx_eval_call_expression): Adjust.
3006 2019-06-10 Jakub Jelinek <jakub@redhat.com>
3008 * parser.c (cp_parser_omp_clause_reduction): Don't sorry_at on inscan
3010 (cp_parser_omp_scan_loop_body): New function.
3011 (cp_parser_omp_for_loop): Call cp_parser_omp_scan_loop_body if there
3012 are inscan reduction clauses.
3013 (cp_parser_pragma): Reject PRAGMA_OMP_SCAN.
3014 * semantics.c (finish_omp_clauses): Reject mixing inscan with
3015 non-inscan reductions on the same construct, or inscan reductions with
3016 ordered or schedule clauses, or inscan array reductions.
3017 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_{IN,EX}CLUSIVE.
3018 (tsubst_expr): Handle OMP_SCAN.
3020 2019-06-07 Jason Merrill <jason@redhat.com>
3022 * constexpr.c (cxx_eval_constant_expression): Call
3023 STRIP_ANY_LOCATION_WRAPPER early.
3024 [CONVERT_EXPR]: Don't build anything for conversion to void.
3025 [ADDR_EXPR]: ggc_free unused ADDR_EXPR.
3027 2019-06-05 Martin Sebor <msebor@redhat.com>
3030 * typeck.c (maybe_warn_about_returning_address_of_local): Only
3031 consider functions returning pointers as candidates for
3032 -Wreturn-local-addr.
3034 2019-06-05 Paolo Carlini <paolo.carlini@oracle.com>
3036 * decl.c (smallest_type_location): New.
3037 (check_special_function_return_type): Use it.
3038 (grokdeclarator): Lkewise.
3040 2019-06-05 Paolo Carlini <paolo.carlini@oracle.com>
3042 * decl.c (grokdeclarator): Use locations[ds_friend]
3045 2019-06-05 Martin Sebor <msebor@redhat.com>
3047 * call.c (build_conditional_expr_1): Adjust quoting and hyphenation.
3048 (convert_like_real): Same.
3049 (convert_arg_to_ellipsis): Same.
3050 * constexpr.c (diag_array_subscript): Same.
3051 * constraint.cc (diagnose_trait_expression): Same.
3052 * cvt.c (ocp_convert): Same.
3053 * decl.c (start_decl): Same.
3054 (check_for_uninitialized_const_var): Same.
3056 (check_special_function_return_type): Same.
3057 (finish_enum_value_list): Same.
3058 (start_preparsed_function): Same.
3059 * parser.c (cp_parser_decl_specifier_seq): Same.
3060 * typeck.c (cp_build_binary_op): Same.
3061 (build_static_cast_1): Same.
3063 2019-06-04 Nina Dinka Ranns <dinka.ranns@gmail.com>
3065 PR c++/63149 - Wrong auto deduction from braced-init-list.
3066 * pt.c (listify_autos): use non cv qualified auto_node in
3067 std::initializer_list<auto>.
3069 2019-06-04 Paolo Carlini <paolo.carlini@oracle.com>
3071 * decl.c (grokdeclarator): Use declarator->id_loc in two
3074 2019-06-04 Nathan Sidwell <nathan@acm.org>
3076 * name-lookup.c (lookup_type_scope_1): Reimplement, handle local
3077 and namespace scopes separately.
3079 2019-06-04 Harald van Dijk <harald@gigawatt.nl>
3081 PR c++/60531 - Wrong error about unresolved overloaded function
3082 * typeck.c (cp_build_binary_op): See if overload can be resolved.
3083 (cp_build_unary_op): Ditto.
3085 2019-06-04 Jason Merrill <jason@redhat.com>
3087 Reduce accumulated garbage in constexpr evaluation.
3088 * constexpr.c (cxx_eval_call_expression): ggc_free any bindings we
3090 (cxx_eval_increment_expression): ggc_free the MODIFY_EXPR after
3093 2019-06-04 Jakub Jelinek <jakub@redhat.com>
3095 * cp-tree.h (CP_OMP_CLAUSE_INFO): Allow for any clauses up to _condvar_
3096 instead of only up to linear.
3098 2019-06-03 Paolo Carlini <paolo.carlini@oracle.com>
3100 * parser.c (cp_parser_unqualified_id): Use build_min_nt_loc in
3103 2019-06-01 Ville Voutilainen <ville.voutilainen@gmail.com>
3106 * class.c (fixup_type_variants): Handle CLASSTYPE_FINAL.
3108 2019-05-31 Nathan Sidwell <nathan@acm.org>
3110 * cp-tree.h (IDENTIFIER_LAMBDA_P): New.
3112 (LAMBDA_TYPE_P, TYPE_UNNAMED_P): Likewise.
3113 (LAMBDANAME_PREFIX, LAMBDANAME_FORMAT): Delete.
3114 (make_lambda_name): Don't declare.
3115 * error.c (dump_aggr_type): Check for lambdas before other
3117 * lambda.c (begin_lambda_type): Use make_anon_name.
3118 * cp-lang.c (cxx_dwarf_name): Lambda names smell anonymous.
3119 * mangle.c (write_local_name): Likewise.
3120 * name-lookup.c (lambda_cnt, make_lambda_name): Delete.
3122 2019-05-30 Marek Polacek <polacek@redhat.com>
3124 * cp-tree.h (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Fix a typo.
3126 2019-05-31 Paolo Carlini <paolo.carlini@oracle.com>
3128 * decl.c (grokdeclarator): Use declarator->id_loc in five
3131 2019-05-29 Jakub Jelinek <jakub@redhat.com>
3134 * tree.c (lvalue_kind): Return clk_none for expressions with
3137 2019-05-29 Paolo Carlini <paolo.carlini@oracle.com>
3140 * parser.c (cp_parser_sizeof_operand): When the type-id production
3141 did not work out commit to the tentative parse.
3143 2019-05-29 Jakub Jelinek <jakub@redhat.com>
3145 P1091R3 - Extending structured bindings to be more like var decls
3146 P1381R1 - Reference capture of structured bindings
3147 * decl.c (cp_maybe_mangle_decomp): Handle TREE_STATIC decls even at
3149 (cp_finish_decomp): Copy over various decl properties from decl to
3150 v[i] in the tuple case.
3151 (grokdeclarator): Allow static, thread_local and __thread for C++2a
3152 and use pedwarn instead of error for older standard revisions.
3153 Make other structured binding diagnostic messages more i18n friendly.
3155 2019-05-28 Nathan Sidwell <nathan@acm.org>
3157 * decl.c (duplicate_decls): Assert a template newdecl has no
3160 2019-05-28 Marek Polacek <polacek@redhat.com>
3162 PR c++/90548 - ICE with generic lambda and empty pack.
3163 * pt.c (tsubst_copy_and_build): Handle pack expansion properly.
3165 2019-05-28 Nathan Sidwell <nathan@acm.org>
3167 * cp-tree.h (make_anon_name): Drop declaration.
3168 (TYPE_UNNAMED_P): Use IDENTIFIER_ANON_P.
3169 * cp-lang.c (cxx_dwarf_name): Likewise.
3170 * class.c (find_flexarrays): Likewise.
3171 * decl.c (name_unnamed_type, xref_tag_1): Likewise.
3172 * error.c (dump_aggr_type): Likewise.
3173 * pt.c (push_template_decl_real): Likewise.
3174 * name-lookup.c (consider_binding_level): Likewise.
3175 (anon_cnt, make_anon_name): Delete.
3177 2019-05-25 Marek Polacek <polacek@redhat.com>
3179 PR c++/90572 - wrong disambiguation in friend declaration.
3180 * parser.c (cp_parser_constructor_declarator_p): Don't allow missing
3181 typename for friend declarations.
3183 2019-05-23 Jonathan Wakely <jwakely@redhat.com>
3185 * cp-tree.h (CP_AGGREGATE_TYPE_P): Fix whitespace.
3187 * init.c (std_placement_new_fn_p): Remove outdated TODO comment that
3188 was resolved by r254694.
3190 2019-05-22 Jason Merrill <jason@redhat.com>
3192 PR c++/20408 - unnecessary code for empty struct.
3193 * call.c (build_call_a): Use simple_empty_class_p.
3195 PR c++/86485 - -Wmaybe-unused with empty class ?:
3196 * cp-gimplify.c (simple_empty_class_p): Also true for MODIFY_EXPR.
3198 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com>
3200 * parser.c (cp_parser_template_declaration_after_parameters): Use
3201 DECL_SOURCE_LOCATION in literal operator template errors.
3203 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com>
3207 * call.c (build_over_call): Devirtualize when the final overrider
3208 comes from the base.
3210 2019-05-21 Nathan Sidwell <nathan@acm.org>
3212 * name-lookup.c (do_nonmember_using_decl): Drop INSERT_P
3213 parameter. Document.
3214 (finish_nonmember_using_decl): Adjust do_nonmember_using_decl
3215 calls. Remove stray FIXME comment.
3217 * name-lookup.h (struct cp_binding_level): Drop usings field.
3218 (finish_namespace_using_decl, finish_local_using_decl): Replace with ...
3219 (finish_nonmember_using_decl): ... this.
3220 * name-lookup.c (push_using_decl_1, push_using_decl):
3221 (do_nonmember_using_decl): ... here. Add INSERT_P arg. Reimplement.
3222 (validate_nonmember_using_decl, finish_namespace_using_decl)
3223 (finish_local_using_decl): Replace with ...
3224 (finish_nonmember_using_decl): ... this. Drop DECL parm.
3225 * parser.c (cp_parser_using_declaration): Don't do lookup here.
3226 * pt.c (tsubst_expr): Do not do using decl lookup here.
3228 2019-05-21 Eric Botcazou <ebotcazou@adacore.com>
3230 * decl2.c (cpp_check) <IS_ASSIGNMENT_OPERATOR>: New case.
3232 2019-05-20 Marek Polacek <polacek@redhat.com>
3234 CWG 2094 - volatile scalars are trivially copyable.
3236 * tree.c (trivially_copyable_p): Don't check CP_TYPE_VOLATILE_P for
3239 2019-05-20 Marek Polacek <polacek@redhat.com>
3241 * pt.c (convert_template_argument): Add a diagnostic for the
3242 [temp.arg]/2 ambiguity case.
3244 * name-lookup.c (finish_using_directive): Don't issue inform() if the
3245 warning didn't trigger. Add quoting. Tweak the inform message.
3247 2019-05-20 Paolo Carlini <paolo.carlini@oracle.com>
3249 * cp-tree.h: Remove remnants of CONV_NONCONVERTING.
3251 2019-05-20 Nathan Sidwell <nathan@acm.org>
3253 * name-lookup.c (finish_namespace_using_directive)
3254 (finish_local_using_directive): Merge to ...
3255 (finish_using_directive): ... here. Handle both contexts.
3256 * name-lookup.h (finish_namespace_using_directive)
3257 (finish_local_using_directive): Replace with ...
3258 (finish_using_directive): ... this.
3259 * parser.c (cp_parser_using_directive): Adjust.
3260 * pt.c (tsubst_expr): Likewise.
3262 * cp-tree.h (struct lang_decl_ns): Remove usings field.
3263 (DECL_NAMESPACE_USING): Delete.
3264 * name-lookup.c (name_lookup::search_usings): Use namespace's
3266 (name_lookup::queue_namespae): Likewise.
3267 (finish_namespace_using_directive, push_namespace): Likewise.
3268 (has_using_namespace_std_directive): Just search the entire
3271 2019-05-20 Jonathan Wakely <jwakely@redhat.com>
3273 PR c++/90532 Ensure __is_constructible(T[]) is false
3274 * method.c (is_xible_helper): Return error_mark_node for construction
3275 of an array of unknown bound.
3277 2019-05-17 Thomas Schwinge <thomas@codesourcery.com>
3280 * parser.c (cp_finalize_oacc_routine): Rework checking if already
3281 marked with an OpenACC 'routine' directive.
3284 * parser.c (cp_parser_oacc_routine)
3285 (cp_parser_late_parsing_oacc_routine): Normalize order of clauses.
3286 (cp_finalize_oacc_routine): Call oacc_verify_routine_clauses.
3289 * parser.c (cp_finalize_oacc_routine): Refer to OpenACC 'routine'
3290 clauses from "omp declare target" attribute.
3292 2019-05-16 Martin Sebor <msebor@redhat.com>
3294 * call.c (print_z_candidate): Wrap diagnostic text in a gettext
3296 (print_z_candidates): Same.
3297 (build_conditional_expr_1): Quote keywords, operators, and types
3299 (build_op_delete_call): Same.
3300 (maybe_print_user_conv_context): Wrap diagnostic text in a gettext
3302 (convert_like_real): Same.
3303 (convert_arg_to_ellipsis): Quote keywords, operators, and types
3305 (build_over_call): Same.
3306 (joust): Break up an overlong line. Wrap diagnostic text in a gettext
3308 * constexpr.c (cxx_eval_check_shift_p): Spell out >= in English.
3309 (cxx_eval_constant_expression): Quote keywords, operators, and types
3311 (potential_constant_expression_1): Same.
3312 * cp-gimplify.c (cp_genericize_r): Same.
3313 * cvt.c (maybe_warn_nodiscard): Quote keywords, operators, and types
3315 (type_promotes_to): Same.
3316 * decl.c (check_previous_goto_1): Same.
3319 (cp_finish_decl): Avoid parenthesizing a sentence for consistency.
3320 (grok_op_properties): Quote keywords, operators, and types
3322 * decl2.c (grokfield): Same.
3323 (coerce_delete_type): Same.
3324 * except.c (is_admissible_throw_operand_or_catch_parameter): Same.
3325 * friend.c (do_friend): Quote C++ tokens.
3326 * init.c (build_new_1): Quote keywords, operators, and types
3328 (build_vec_delete_1): Same.
3329 (build_delete): Same.
3330 * lex.c (parse_strconst_pragma): Same.
3331 (handle_pragma_implementation): Same.
3332 (unqualified_fn_lookup_error): Same.
3333 * mangle.c (write_type): Same.
3334 * method.c (defaulted_late_check): Avoid two consecutive punctuators.
3335 * name-lookup.c (cp_binding_level_debug): Remove a trailing newline.
3336 (pop_everything): Same.
3337 * parser.c (cp_lexer_start_debugging): Quote a macro name.
3339 (cp_lexer_stop_debugging): Same.
3340 (cp_parser_userdef_numeric_literal): Quote a C++ header name
3342 (cp_parser_nested_name_specifier_opt): Quote keywords, operators,
3343 and types in diagnostics.
3344 (cp_parser_question_colon_clause): Same.
3345 (cp_parser_asm_definition): Same.
3346 (cp_parser_init_declarator): Same.
3347 (cp_parser_template_declaration_after_parameters): Avoid capitalizing
3348 a sentence in a diagnostic.
3349 (cp_parser_omp_declare_reduction): Quote keywords, operators, and types
3351 (cp_parser_transaction): Same.
3352 * pt.c (maybe_process_partial_specialization): Replace second call
3353 to permerror with inform for consistency with other uses.
3354 (expand_integer_pack): Quote keywords, operators, and types
3356 * rtti.c (get_typeid): Quote keywords, operators, and types
3358 (build_dynamic_cast_1): Same.
3359 * semantics.c (finish_asm_stmt): Same.
3360 (finish_label_decl): Same.
3361 (finish_bases): Same.
3362 (finish_offsetof): Same.
3363 (cp_check_omp_declare_reduction): Same.
3364 (finish_decltype_type): Same.
3365 * tree.c (handle_init_priority_attribute): Same. Add detail
3367 (maybe_warn_zero_as_null_pointer_constant): Same.
3368 * typeck.c (cp_build_binary_op): Quote keywords, operators, and types
3370 (cp_build_unary_op): Same.
3371 (check_for_casting_away_constness): Same.
3372 (build_static_cast): Same.
3373 (build_const_cast_1): Same.
3374 (maybe_warn_about_returning_address_of_local): Same.
3375 (check_return_expr): Same.
3376 * typeck2.c (abstract_virtuals_error_sfinae): Same.
3377 (digest_init_r): Replace a tab with spaces in a diagnostic.
3378 (build_functional_cast): Quote keywords, operators, and types
3381 2019-05-15 Jakub Jelinek <jakub@redhat.com>
3384 * cp-gimplify.c (genericize_cp_loop): Emit a DEBUG_BEGIN_STMT
3385 before the condition (or if missing or constant non-zero at the end
3386 of the loop. Emit a DEBUG_BEGIN_STMT before the increment expression
3387 if any. Don't call protected_set_expr_location on incr if it already
3390 2019-05-15 Marek Polacek <polacek@redhat.com>
3392 CWG 2096 - constraints on literal unions.
3393 * class.c (check_field_decls): Initialize booleans directly. A union
3394 is literal if at least one of its non-static data members is of
3395 non-volatile literal type.
3397 2019-05-15 Paolo Carlini <paolo.carlini@oracle.com>
3399 * cp-tree.h (REFERENCE_VLA_OK): Remove.
3400 * lambda.c (build_capture_proxy): Remove use of the above.
3402 2019-05-15 Paolo Carlini <paolo.carlini@oracle.com>
3404 * call.c (perform_overload_resolution, build_new_method_call_1):
3405 Use OVL_P; remove redundant TEMPLATE_DECL checks.
3406 * decl.c (grokfndecl): Likewise.
3407 * mangle.c (write_expression): Likewise.
3408 * parser.c (cp_parser_template_id): Likewise.
3409 * pt.c (resolve_overloaded_unification, type_dependent_expression_p):
3411 * search.c (build_baselink): Likewise.
3412 * tree.c (is_overloaded_fn, dependent_name, maybe_get_fns): Likewise.
3414 2019-05-14 Paolo Carlini <paolo.carlini@oracle.com>
3416 PR preprocessor/90382
3417 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
3420 2019-05-13 Jason Merrill <jason@redhat.com>
3422 Use releasing_vec more broadly.
3423 * cp-tree.h (struct releasing_vec): Replace get_ref method with
3425 (vec_safe_push, vec_safe_reserve, vec_safe_length, vec_safe_splice):
3426 Forwarding functions for releasing_vec.
3427 (release_tree_vector): Declare but don't define.
3428 * call.c (build_op_delete_call, build_temp, call_copy_ctor)
3429 (perform_direct_initialization_if_possible): Use releasing_vec.
3430 * constexpr.c (cxx_eval_vec_init_1, cxx_eval_store_expression):
3432 * cp-gimplify.c (cp_fold): Likewise.
3433 * cvt.c (force_rvalue, ocp_convert): Likewise.
3434 * decl.c (get_tuple_decomp_init): Likewise.
3435 * except.c (build_throw): Likewise.
3436 * init.c (perform_member_init, expand_default_init): Likewise.
3437 * method.c (do_build_copy_assign, locate_fn_flags): Likewise.
3438 * parser.c (cp_parser_userdef_char_literal)
3439 (cp_parser_userdef_numeric_literal)
3440 (cp_parser_userdef_string_literal)
3441 (cp_parser_perform_range_for_lookup)
3442 (cp_parser_range_for_member_function, cp_parser_omp_for_loop)
3443 (cp_parser_omp_for_loop_init): Likewise.
3444 * pt.c (tsubst_copy_and_build, do_class_deduction): Likewise.
3445 * semantics.c (calculate_direct_bases, calculate_bases)
3446 (finish_omp_barrier, finish_omp_flush, finish_omp_taskwait)
3447 (finish_omp_taskyield, finish_omp_cancel)
3448 (finish_omp_cancellation_point): Likewise.
3449 * tree.c (build_vec_init_elt, strip_typedefs, strip_typedefs_expr)
3450 (build_min_non_dep_op_overload): Likewise.
3451 * typeck.c (build_function_call_vec, cp_build_function_call_nary)
3452 (cp_build_modify_expr): Likewise.
3453 * typeck2.c (build_functional_cast): Likewise.
3455 2019-05-11 Paolo Carlini <paolo.carlini@oracle.com>
3457 * typeck.c (cp_build_function_call_vec): When mark_used fails
3458 unconditionally return error_mark_node.
3460 2019-05-10 Paolo Carlini <paolo.carlini@oracle.com>
3462 * decl.c (grokvardecl): Use an accurate location in error message
3463 about main as a global variable.
3465 2019-05-10 Paolo Carlini <paolo.carlini@oracle.com>
3467 * call.c (build_call_a): Use FUNC_OR_METHOD_TYPE_P.
3468 * cp-gimplify.c (cp_fold): Likewise.
3469 * cp-objcp-common.c (cp_type_dwarf_attribute): Likewise.
3470 * cp-tree.h (TYPE_OBJ_P, TYPE_PTROBV_P): Likewise.
3471 * cvt.c (perform_qualification_conversions): Likewise.
3472 * decl.c (grokdeclarator): Likewise.
3473 * decl2.c (build_memfn_type): Likewise.
3474 * mangle.c (canonicalize_for_substitution, write_type): Likewise.
3475 * parser.c (cp_parser_omp_declare_reduction): Likewise.
3476 * pt.c (check_explicit_specialization, uses_deducible_template_parms,
3477 check_cv_quals_for_unify, dependent_type_p_r): Likewise.
3478 * rtti.c (ptr_initializer): Likewise.
3479 * semantics.c (finish_asm_stmt, finish_offsetof,
3480 cp_check_omp_declare_reduction): Likewise.
3481 * tree.c (cp_build_qualified_type_real,
3482 cp_build_type_attribute_variant, cxx_type_hash_eq,
3483 cxx_copy_lang_qualifiers, cp_free_lang_data): Likewise.
3484 * typeck.c (structural_comptypes, convert_arguments,
3485 cp_build_addr_expr_1, unary_complex_lvalue, cp_build_c_cast,
3486 cp_build_modify_expr, comp_ptr_ttypes_real, type_memfn_rqual):
3489 2019-05-10 Marek Polacek <polacek@redhat.com>
3491 PR c++/78010 - bogus -Wsuggest-override warning on final function.
3492 * class.c (check_for_override): Don't warn for final functions.
3494 2019-05-10 Jakub Jelinek <jakub@redhat.com>
3497 * config-lang.in (gtfiles): Remove c-family/c-lex.c, add
3498 c-family/c-cppbuiltin.c.
3500 2019-05-09 Paolo Carlini <paolo.carlini@oracle.com>
3504 2018-04-26 Paolo Carlini <paolo.carlini@oracle.com>
3506 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
3509 2019-05-08 Nathan Sidwell <nathan@acm.org>
3511 Kill DECL_SAVED_FUNCTION_DATA .
3512 * cp-tree.h (language_function): Remove x_auto_return_pattern.
3513 (current_function_auto_return_pattern): Delete.
3514 (lang_decl_fn): Replace saved_language_function with
3515 saved_auto_return type.
3516 (DECL_SAVED_FUNCTION_DATA): Delete.
3517 (DECL_SAVED_AUTO_RETURN_TYPE): New.
3518 (FNDECL_USED_AUTO): Correct documentation.
3519 * decl.c (duplicate_decls): Adjust AUTO return handling.
3520 (start_preparsed_function): Replace
3521 current_function_auto_return_pattern with
3522 DECL_SAVED_AUTO_RETURN_TYPE. Remove DECL_SAVED_FUNCTION_DATA
3524 (finish_function): Likewise.
3525 (save_function_data): Delete.
3526 (fndecl_declared_return_type): Reimplement.
3527 * mangle.c (write_unqualified_name): Use DECL_SAVED_AUTO_RETURN_TYPE.
3528 * method.c (make_thunk, make_alias_for): Likewise.
3529 * parser.c (cp_parser_jump_statement): Likewise.
3530 * pt.c (do_auto_deduction): Likewise.
3531 * typeck.c (check_return_expr): Likewise.
3533 2019-05-06 Jason Merrill <jason@redhat.com>
3535 PR c++/90171 - reorganize usual_deallocation_fn_p
3536 * call.c (struct dealloc_info): New.
3537 (usual_deallocation_fn_p): Take a dealloc_info*.
3538 (aligned_deallocation_fn_p, sized_deallocation_fn_p): Remove.
3539 (build_op_delete_call): Adjust.
3541 2019-05-07 Jason Merrill <jason@redhat.com>
3543 PR c++/86485 - -Wmaybe-unused with empty class ?:
3544 * typeck.c (build_static_cast_1): Use cp_build_addr_expr.
3546 * pt.c (type_dependent_expression_p): A non-type template parm with
3547 a placeholder type is type-dependent.
3549 2019-05-06 Marek Polacek <polacek@redhat.com>
3551 PR c++/90265 - ICE with generic lambda.
3552 * pt.c (tsubst_copy_and_build): Use a dedicated variable for the last
3553 element in the vector.
3555 2019-05-03 Martin Liska <mliska@suse.cz>
3557 * call.c (build_aggr_conv): Use is_empty instead of
3558 elements () == 0 (and similar usages).
3559 * parser.c (cp_parser_lambda_introducer): Likewise.
3561 2019-05-02 Nathan Sidwell <nathan@acm.org>
3563 * semantics.c (finish_id_expression_1): Remove unreachable code.
3565 2019-05-01 Nathan Sidwell <nathan@acm.org>
3567 * name-lookup.h (get_class_binding_direct): Change final arg to
3569 (get_class_binding): Likewise.
3570 * name-lookup.c (get_class_binding_direct): Replace TYPE_OR_FNS
3571 arg with WANT_TYPE bool. Simplify.
3572 (get_class_binding): Adjust final arg.
3573 * decl.c (reshape_init_class): Adjust get_class_binding calls.
3575 2019-04-30 Nathan Sidwell <nathan@acm.org>
3577 * cp-objcp-common.c (cp_common_init_ts): Use MARK_TS_EXP for _EXPR
3578 nodes. Call c_common_init_ts.
3580 2019-04-29 Nathan Sidwell <nathan@acm.org>
3582 * decl.c (duplicate_decls): Add whitespace, move comments into
3584 * method.c (explain_implicit_non_constexpr): Refactor.
3585 * pt.c (check_explicit_specialization): Fix indentation.
3586 * semantics.c (process_outer_var_ref): Reformat.
3587 (finish_id_expression_1): Use STRIP_TEMPLATE.
3589 2019-04-26 Jonathan Wakely <jwakely@redhat.com>
3591 PR c++/90243 - orphaned note in uninstantiated constexpr function
3592 * decl.c (check_for_uninitialized_const_var): Suppress notes if no
3595 2019-04-26 Paolo Carlini <paolo.carlini@oracle.com>
3598 * decl.c (grokdeclarator): Set type to error_mark_node
3599 upon error about template placeholder type non followed
3600 by a simple declarator-id.
3602 2019-04-26 Paolo Carlini <paolo.carlini@oracle.com>
3604 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
3607 2019-04-24 Jason Merrill <jason@redhat.com>
3609 PR c++/90227 - error with template parameter packs.
3610 * pt.c (coerce_template_parms): Do add empty pack when
3613 2019-04-24 Richard Biener <rguenther@suse.de>
3615 * call.c (null_ptr_cst_p): Order checks according to expensiveness.
3616 (conversion_null_warnings): Likewise.
3617 * typeck.c (same_type_ignoring_top_level_qualifiers_p): Return
3618 early if type1 == type2.
3620 2019-04-22 Jason Merrill <jason@redhat.com>
3622 PR c++/87366 - wrong error with alias template.
3623 * typeck.c (structural_comptypes): When comparing_specializations,
3624 aliases are unequal.
3625 (comptypes): When comparing_specializations, do structural
3628 2019-04-19 Jason Merrill <jason@redhat.com>
3630 PR c++/90190 - CTAD with list-constructor.
3631 * pt.c (do_class_deduction): Don't try the single element deduction
3632 if the single element is also a braced list.
3634 PR c++/90171 - ICE with destroying delete with size_t parm.
3635 * call.c (sized_deallocation_fn_p): New. Use it instead of
3636 second_parm_is_size_t in most cases.
3637 (second_parm_is_size_t): Don't check for aligned.
3639 2019-04-19 Paolo Carlini <paolo.carlini@oracle.com>
3642 * pt.c (fn_type_unification): When handling null explicit
3643 arguments do not special case non-parameter packs.
3645 2019-04-19 Jakub Jelinek <jakub@redhat.com>
3648 * pt.c (process_template_parm): Set decl to pushdecl result. If
3649 !is_non_type, also set parm to that.
3652 * decl.c (struct cp_switch): Remove outside_range_p member.
3653 (push_switch): Don't clear it.
3654 (pop_switch): Adjust c_do_switch_warnings caller.
3655 (finish_case_label): Adjust c_add_case_label caller.
3658 * decl.c (duplicate_decls): If remove is main variant and
3659 DECL_ORIGINAL_TYPE is some other type, remove a DECL_ORIGINAL_TYPE
3660 variant that has newdecl as TYPE_NAME if any.
3662 2019-04-18 Jason Merrill <jason@redhat.com>
3664 PR c++/87554 - ICE with extern template and reference member.
3665 * decl.c (cp_finish_decl): Don't set DECL_INITIAL of external vars.
3667 2019-04-17 Jason Merrill <jason@redhat.com>
3669 PR c++/90047 - ICE with enable_if alias template.
3670 * pt.c (tsubst_decl) [TYPE_DECL]: Don't put an erroneous decl in the
3671 hash table when we're in SFINAE context.
3673 2019-04-17 Marek Polacek <polacek@redhat.com>
3675 PR c++/90124 - bogus error with incomplete type in decltype.
3676 * typeck.c (build_class_member_access_expr): Check
3677 cp_unevaluated_operand.
3679 2019-04-12 Jakub Jelinek <jakub@redhat.com>
3682 * decl.c (duplicate_decls): When newdecl's type is its main variant,
3683 don't try to remove it from the variant list, but instead assert
3686 2019-04-12 Martin Sebor <msebor@redhat.com>
3690 * parser.c (cp_parser_has_attribute_expression): Handle assignment
3693 2019-04-12 Jason Merrill <jason@redhat.com>
3695 * call.c (null_member_pointer_value_p): Handle an empty CONSTRUCTOR
3698 2019-04-12 Marek Polacek <polacek@redhat.com>
3700 * except.c (build_noexcept_spec): Use build_converted_constant_bool_expr
3701 instead of perform_implicit_conversion_flags.
3703 PR c++/87603 - constexpr functions are no longer noexcept.
3704 * constexpr.c (is_sub_constant_expr): Remove unused function.
3705 * cp-tree.h (is_sub_constant_expr): Remove declaration.
3706 * except.c (check_noexcept_r): Don't consider a call to a constexpr
3709 2019-04-11 Jakub Jelinek <jakub@redhat.com>
3711 PR translation/90035
3712 * parser.h (struct cp_parser): Add
3713 type_definition_forbidden_message_arg member.
3714 * parser.c (cp_debug_parser): Print it.
3715 (cp_parser_check_type_definition): Pass
3716 parser->type_definition_forbidden_message_arg as second argument to
3718 (cp_parser_has_attribute_expression, cp_parser_sizeof_operand): Set
3719 parser->type_definition_forbidden_message_arg and use G_() with
3720 %qs for parser->type_definition_forbidden_message instead of
3721 building untranslatable message using concat.
3723 2019-04-09 Jakub Jelinek <jakub@redhat.com>
3725 PR translation/90011
3726 * typeck2.c (check_narrowing): Remove trailing space from diagnostics.
3728 2019-04-08 Marek Polacek <polacek@redhat.com>
3730 * typeck2.c (digest_init_r): Don't condition the object slicing warning
3733 2019-04-08 Paolo Carlini <paolo.carlini@oracle.com>
3736 * semantics.c (trait_expr_value): Don't use TYPE_NOTHROW_P
3737 when maybe_instantiate_noexcept fails.
3738 (classtype_has_nothrow_assign_or_copy_p): Likewise.
3739 * method.c (implicitly_declare_fn): Avoid passing error_mark_node
3740 to build_exception_variant.
3742 2019-04-05 Marek Polacek <polacek@redhat.com>
3744 PR c++/87145 - bogus error converting class type in template arg list.
3745 * pt.c (convert_nontype_argument): Don't call
3746 build_converted_constant_expr if it could involve calling a conversion
3747 function with a instantiation-dependent constructor as its argument.
3749 2019-04-05 Martin Sebor <msebor@redhat.com>
3752 * decl.c (reshape_init_array_1): Avoid treating empty strings
3753 as zeros in array initializers.
3754 Use trivial_type_p () instead of TYPE_HAS_TRIVIAL_DFLT().
3756 2019-04-04 Jason Merrill <jason@redhat.com>
3758 PR c++/89948 - ICE with break in statement-expr.
3759 * constexpr.c (cxx_eval_statement_list): Jumping out of a
3760 statement-expr is non-constant.
3762 2019-04-04 Jason Merrill <jason@redhat.com>
3764 PR c++/89966 - error with non-type auto tparm.
3765 * pt.c (do_auto_deduction): Clear tf_partial.
3767 2019-04-04 Jason Merrill <jason@redhat.com>
3769 PR c++/86986 - ICE with TTP with parameter pack.
3770 * pt.c (coerce_template_parameter_pack): Only look at the type of a
3771 non-type parameter pack.
3772 (fixed_parameter_pack_p_1): Don't recurse into the type of a
3773 non-type parameter pack.
3774 (coerce_template_template_parms): Call add_outermost_template_args.
3776 2019-04-04 Martin Sebor <msebor@redhat.com>
3782 * decl.c (reshape_init_array_1): Strip trailing zero-initializers
3783 from arrays of trivial type and known size.
3784 * mangle.c (write_expression): Convert braced initializer lists
3786 (write_expression): Trim trailing zero-initializers from arrays
3788 (write_template_arg_literal): Mangle strings the same as braced
3791 2019-04-03 Jason Merrill <jason@redhat.com>
3793 PR c++/81866 - ICE with member template and default targ.
3794 * pt.c (tsubst_template_decl): Handle getting a type from
3795 retrieve_specialization.
3797 PR c++/86586 - -fcompare-debug=-Wsign-compare.
3798 * typeck.c (cp_build_binary_op): Don't fold for -Wsign-compare.
3800 PR c++/89331 - ICE with offsetof in incomplete class.
3801 * semantics.c (finish_offsetof): Handle error_mark_node.
3802 * typeck.c (build_class_member_access_expr): Call
3803 complete_type_or_maybe_complain before converting to base.
3805 PR c++/89917 - ICE with lambda in variadic mem-init.
3806 * pt.c (make_pack_expansion): Change type_pack_expansion_p to false.
3808 2019-04-01 Jason Merrill <jason@redhat.com>
3810 PR c++/86946 - ICE with function call in template argument.
3812 * pt.c (iterative_hash_template_arg) [CALL_EXPR]: Use
3815 2019-04-01 Paolo Carlini <paolo.carlini@oracle.com>
3818 * pt.c (tsubst_copy): Deal with lookup_name not returing a variable.
3820 2019-03-31 Marek Polacek <polacek@redhat.com>
3822 PR c++/89852 - ICE with C++11 functional cast with { }.
3823 * constexpr.c (fold_non_dependent_expr_template): New static function
3825 (fold_non_dependent_expr): ...here.
3826 (fold_non_dependent_init): New function.
3827 * cp-tree.h (fold_non_dependent_init): Declare.
3828 * typeck2.c (massage_init_elt): Call fold_non_dependent_init instead
3829 of fold_non_dependent_expr. Don't call maybe_constant_init.
3831 2019-03-30 Jason Merrill <jason@redhat.com>
3833 PR c++/89744 - ICE with specialization of member class template.
3834 * pt.c (lookup_template_class_1): If the partial instantiation is
3835 explicitly specialized, adjust.
3836 (maybe_process_partial_specialization): Also adjust
3839 2019-03-29 Jakub Jelinek <jakub@redhat.com>
3842 * typeck.c: Include gimplify.h.
3843 (cp_build_modify_expr) <case COND_EXPR>: Unshare rhs before using it
3844 for second time. Formatting fixes.
3846 2019-03-29 Marek Polacek <polacek@redhat.com>
3848 PR c++/89876 - ICE with deprecated conversion.
3849 * call.c (convert_like_real): Only give warnings with tf_warning.
3851 2019-03-28 Marek Polacek <polacek@redhat.com>
3853 PR c++/89612 - ICE with member friend template with noexcept.
3854 * pt.c (maybe_instantiate_noexcept): For function templates, use their
3855 template result (function decl). Don't set up local specializations.
3856 Temporarily turn on processing_template_decl. Update the template type
3859 PR c++/89836 - bool constant expression and explicit conversions.
3860 * call.c (build_converted_constant_expr_internal): New function,
3862 (build_converted_constant_expr): ...this. New.
3863 (build_converted_constant_bool_expr): New.
3864 * cp-tree.h (build_converted_constant_bool_expr): Declare.
3865 * decl.c (build_explicit_specifier): Call
3866 build_converted_constant_bool_expr.
3868 2019-03-28 Jakub Jelinek <jakub@redhat.com>
3871 * constexpr.c (struct check_for_return_continue_data): New type.
3872 (check_for_return_continue): New function.
3873 (potential_constant_expression_1) <case SWITCH_STMT>: Walk
3874 SWITCH_STMT_BODY to find RETURN_EXPRs or CONTINUE_STMTs not nested
3875 in loop bodies and set *jump_target to that if found.
3877 2019-03-27 Jason Merrill <jason@redhat.com>
3879 PR c++/89831 - error with qualified-id in const member function.
3880 * semantics.c (finish_non_static_data_member): Use object cv-quals
3881 in scoped case, too.
3883 PR c++/89421 - ICE with lambda in template parameter list.
3884 * parser.c (cp_parser_lambda_expression): Also reject a lambda in a
3885 template parameter list before C++20.
3886 * pt.c (type_dependent_expression_p): True for LAMBDA_EXPR.
3887 * semantics.c (begin_class_definition): Restore error about defining
3888 non-lambda class in template parm list.
3890 2019-03-26 Jason Merrill <jason@redhat.com>
3892 PR c++/86932 - missed SFINAE with empty pack.
3893 * pt.c (coerce_template_parms): Don't add an empty pack if
3895 (fn_type_unification): Pass tf_partial to coerce_template_parms.
3897 PR c++/86429 - constexpr variable in lambda.
3900 * constexpr.c (cxx_eval_constant_expression): In a lambda function,
3901 try evaluating the captured variable directly.
3903 2019-03-26 Jakub Jelinek <jakub@redhat.com>
3906 * semantics.c (finish_omp_atomic): Add warning_sentinel for
3907 -Wunused-value around finish_expr_stmt call.
3909 2019-03-25 Paolo Carlini <paolo.carlini@oracle.com>
3913 * parser.c (cp_parser_binary_expression): Don't call cp_fully_fold
3914 to undo the disabling of warnings.
3916 2019-03-25 Jason Merrill <jason@redhat.com>
3918 PR c++/87748 - substitution failure error with decltype.
3919 * pt.c (most_specialized_partial_spec): Clear
3920 processing_template_decl.
3922 2019-03-25 Marek Polacek <polacek@redhat.com>
3924 PR c++/89214 - ICE when initializing aggregates with bases.
3925 * typeck2.c (digest_init_r): Warn about object slicing instead of
3928 PR c++/89705 - ICE with reference binding with conversion function.
3929 * call.c (reference_binding): If the result of the conversion function
3930 is a prvalue of non-class type, use the cv-unqualified type.
3932 2019-03-25 Nathan Sidwell <nathan@acm.org>
3934 * lambda.c (maybe_add_lambda_conv_op): Don't add to comdat group.
3936 2019-03-22 Jakub Jelinek <jakub@redhat.com>
3939 * cp-tree.h (get_tls_wrapper_fn): Remove declaration.
3940 (maybe_get_tls_wrapper_call): Declare.
3941 * decl2.c (get_tls_wrapper_fn): Make static.
3942 (maybe_get_tls_wrapper_call): New function.
3943 * typeck.c (build_class_member_access_expr): Handle accesses to TLS
3945 * semantics.c (finish_qualified_id_expr): Likewise.
3946 (finish_id_expression_1): Use maybe_get_tls_wrapper_call.
3947 * pt.c (tsubst_copy_and_build): Likewise.
3950 * constexpr.c (struct constexpr_ctx): Add constexpr_ops_count member.
3951 (cxx_eval_constant_expression): When not skipping, not constant class
3952 or location wrapper, increment *ctx->constexpr_ops_count and if it is
3953 above constexpr_loop_nest_limit, diagnose failure.
3954 (cxx_eval_outermost_constant_expr): Add constexpr_ops_count and
3955 initialize ctx.constexpr_ops_count to its address.
3956 (is_sub_constant_expr): Likewise.
3958 2019-03-21 Jakub Jelinek <jakub@redhat.com>
3961 * call.c (filed_in_pset): Change pset from hash_set<tree> * to
3962 hash_set<tree, true> &, adjust uses accordingly.
3963 (build_aggr_conv): Change pset from hash_set<tree> *
3964 to hash_set<tree, true>. Replace goto fail; with return NULL;,
3968 * parser.c (cp_parser_lambda_introducer): Add ids and first_capture_id
3969 variables, check for duplicates in this function.
3970 * lambda.c (add_capture): Don't check for duplicates nor use
3972 (register_capture_members): Don't clear IDENTIFIER_MARKED here.
3974 2019-03-21 Paolo Carlini <paolo.carlini@oracle.com>
3977 * method.c (after_nsdmi_defaulted_late_checks): Avoid passing
3978 error_mark_node to comp_except_specs.
3980 2019-03-20 Jason Merrill <jason@redhat.com>
3982 PR c++/87480 - decltype of member access in default template arg
3983 * pt.c (type_unification_real): Accept a dependent result in
3986 2019-03-19 Martin Sebor <msebor@redhat.com>
3988 PR tree-optimization/89688
3989 * typeck2.c (store_init_value): Call braced_lists_to_string for more
3990 kinds of initializers.
3992 2019-03-18 Jason Merrill <jason@redhat.com>
3994 PR c++/89630 - ICE with dependent using-decl as template arg.
3995 * tree.c (cp_tree_equal): Always return false for USING_DECL.
3997 PR c++/89761 - ICE with sizeof... in pack expansion.
3998 * pt.c (argument_pack_element_is_expansion_p): Handle
3999 ARGUMENT_PACK_SELECT.
4001 PR c++/89640 - GNU attributes on lambda.
4002 * parser.c (cp_parser_lambda_declarator_opt): Allow GNU attributes.
4004 PR c++/89682 - wrong access error in default argument.
4005 * pt.c (tsubst_default_argument): Don't defer access checks.
4007 2019-03-18 Paolo Carlini <paolo.carlini@oracle.com>
4010 * semantics.c (finish_non_static_data_member): Check return value
4011 of context_for_name_lookup and immediately return error_mark_node
4014 2019-03-17 Jason Merrill <jason@redhat.com>
4016 PR c++/89571 - ICE with ill-formed noexcept on constructor.
4017 * pt.c (maybe_instantiate_noexcept): Only return false if defaulted.
4018 (regenerate_decl_from_template): Use it for noexcept-specs.
4020 2019-03-14 Jason Merrill <jason@redhat.com>
4022 * parser.c (cp_parser_decl_specifier_seq): Support C++20
4023 concept-definition syntax without 'bool'.
4025 2019-03-14 Jakub Jelinek <jakub@redhat.com>
4028 * semantics.c (finish_qualified_id_expr): Reject variable templates.
4031 * constexpr.c (struct constexpr_ctx): Change save_exprs type from
4032 hash_set<tree> to vec<tree>.
4033 (cxx_eval_call_expression): Adjust for save_exprs being a vec instead
4035 (cxx_eval_loop_expr): Likewise. Truncate the vector after each
4036 removal of SAVE_EXPRs from values.
4037 (cxx_eval_constant_expression) <case SAVE_EXPR>: Call safe_push
4038 method on save_exprs instead of add.
4040 2019-03-13 Jason Merrill <jason@redhat.com>
4042 PR c++/86521 - C++17 copy elision in initialization by constructor.
4043 * call.c (joust_maybe_elide_copy): New.
4046 2019-03-13 Marek Polacek <polacek@redhat.com>
4048 PR c++/88979 - further P0634 fix for constructors.
4049 * parser.c (cp_parser_decl_specifier_seq): Pass flags to
4050 cp_parser_constructor_declarator_p.
4051 (cp_parser_direct_declarator): Allow missing typename for constructor
4053 (cp_parser_constructor_declarator_p): Add FLAGS parameter. Pass it to
4054 cp_parser_type_specifier.
4056 PR c++/89686 - mixing init-capture and simple-capture in lambda.
4057 * parser.c (cp_parser_lambda_introducer): Give error when combining
4058 init-capture and simple-capture.
4060 PR c++/89660 - bogus error with -Wredundant-move.
4061 * typeck.c (maybe_warn_pessimizing_move): Only accept (T &) &arg
4062 as the std::move's argument. Don't call convert_for_initialization
4063 when warn_redundant_move isn't on.
4065 2019-03-11 Jason Merrill <jason@redhat.com>
4067 PR c++/86521 - wrong overload resolution with ref-qualifiers.
4068 * call.c (build_user_type_conversion_1): Don't use a conversion to a
4069 reference of the wrong rvalueness for direct binding.
4071 2019-03-11 Martin Liska <mliska@suse.cz>
4073 * cvt.c (build_expr_type_conversion): Wrap apostrophes
4074 in gcc internal format with %'.
4075 * decl.c (check_no_redeclaration_friend_default_args): Likewise.
4076 (grokfndecl): Likewise.
4077 * name-lookup.c (do_pushtag): Likewise.
4078 * pt.c (unify_parameter_deduction_failure): Likewise.
4079 (unify_template_deduction_failure): Likewise.
4081 2019-03-11 Martin Liska <mliska@suse.cz>
4083 * call.c (convert_arg_to_ellipsis): Wrap an option name
4084 in a string format message and fix GNU coding style.
4085 (build_over_call): Likewise.
4086 * class.c (check_field_decl): Likewise.
4087 (layout_nonempty_base_or_field): Likewise.
4088 * constexpr.c (cxx_eval_loop_expr): Likewise.
4089 * cvt.c (type_promotes_to): Likewise.
4090 * decl.c (cxx_init_decl_processing): Likewise.
4091 (mark_inline_variable): Likewise.
4092 (grokdeclarator): Likewise.
4093 * decl2.c (record_mangling): Likewise.
4094 * error.c (maybe_warn_cpp0x): Likewise.
4095 * except.c (doing_eh): Likewise.
4096 * mangle.c (maybe_check_abi_tags): Likewise.
4097 * parser.c (cp_parser_diagnose_invalid_type_name): Likewise.
4098 (cp_parser_userdef_numeric_literal): Likewise.
4099 (cp_parser_primary_expression): Likewise.
4100 (cp_parser_unqualified_id): Likewise.
4101 (cp_parser_pseudo_destructor_name): Likewise.
4102 (cp_parser_builtin_offsetof): Likewise.
4103 (cp_parser_lambda_expression): Likewise.
4104 (cp_parser_lambda_introducer): Likewise.
4105 (cp_parser_lambda_declarator_opt): Likewise.
4106 (cp_parser_selection_statement): Likewise.
4107 (cp_parser_init_statement): Likewise.
4108 (cp_parser_decomposition_declaration): Likewise.
4109 (cp_parser_function_specifier_opt): Likewise.
4110 (cp_parser_static_assert): Likewise.
4111 (cp_parser_simple_type_specifier): Likewise.
4112 (cp_parser_namespace_definition): Likewise.
4113 (cp_parser_using_declaration): Likewise.
4114 (cp_parser_ctor_initializer_opt_and_function_body): Likewise.
4115 (cp_parser_initializer_list): Likewise.
4116 (cp_parser_type_parameter_key): Likewise.
4117 (cp_parser_member_declaration): Likewise.
4118 (cp_parser_try_block): Likewise.
4119 (cp_parser_std_attribute_spec): Likewise.
4120 (cp_parser_requires_clause_opt): Likewise.
4121 * pt.c (check_template_variable): Likewise.
4122 (check_default_tmpl_args): Likewise.
4123 (push_tinst_level_loc): Likewise.
4124 (instantiate_pending_templates): Likewise.
4125 (invalid_nontype_parm_type_p): Likewise.
4126 * repo.c (get_base_filename): Likewise.
4127 * rtti.c (typeid_ok_p): Likewise.
4128 (build_dynamic_cast_1): Likewise.
4129 * tree.c (maybe_warn_parm_abi): Likewise.
4131 2019-03-08 Jakub Jelinek <jakub@redhat.com>
4134 * parser.c (cp_parser_template_declaration_after_parameters): Avoid
4135 one space before " at the end of line and another after " on another
4136 line in a string literal.
4138 PR tree-optimization/89550
4139 * semantics.c (maybe_convert_cond): Only set TREE_NO_WARNING if
4140 warning_at returned true.
4141 * decl2.c (c_parse_final_cleanups): Likewise.
4142 * typeck.c (convert_for_assignment): Likewise.
4143 * decl.c (finish_function): Likewise.
4146 * parser.c (cp_parser_asm_definition): Just warn instead of error
4147 on volatile qualifier outside of function body.
4150 * constexpr.c (potential_constant_expression_1): Reject
4151 REINTERPRET_CAST_P NOP_EXPRs.
4154 * call.c (joust): Call print_z_candidate only if pedwarn returned
4157 2019-03-07 Jason Merrill <jason@redhat.com>
4159 PR c++/88123 - lambda and using-directive.
4160 * name-lookup.c (op_unqualified_lookup)
4161 (maybe_save_operator_binding, discard_operator_bindings)
4162 (push_operator_bindings): New.
4163 * typeck.c (build_x_binary_op, build_x_unary_op): Call
4164 maybe_save_operator_binding.
4165 * decl.c (start_preparsed_function): Call push_operator_bindings.
4166 * tree.c (cp_free_lang_data): Call discard_operator_bindings.
4168 PR c++/88820 - ICE with CTAD and member template used in DMI.
4169 * pt.c (do_class_deduction): Handle parm used as its own arg.
4171 2019-03-07 Jakub Jelinek <jakub@redhat.com>
4174 * parser.c (cp_parser_asm_definition): Parse asm qualifiers even
4175 at toplevel, but diagnose them.
4177 2019-03-06 Jason Merrill <jason@redhat.com>
4179 PR c++/89381 - implicit copy and using-declaration.
4180 * class.c (classtype_has_move_assign_or_move_ctor_p): Don't consider
4181 op= brought in by a using-declaration.
4183 2019-03-06 Jakub Jelinek <jakub@redhat.com>
4186 * init.c (build_value_init_noctor): Ignore flexible array members.
4188 2019-03-06 Jason Merrill <jason@redhat.com>
4190 PR c++/89576 - if constexpr of lambda capture.
4191 * semantics.c (maybe_convert_cond): Do convert a non-dependent
4192 condition in a template.
4193 * typeck.c (condition_conversion): Handle being called in a
4196 2019-03-06 Marek Polacek <polacek@redhat.com>
4198 PR c++/87378 - bogus -Wredundant-move warning.
4199 * typeck.c (maybe_warn_pessimizing_move): See if the maybe-rvalue
4200 overload resolution would actually succeed.
4202 2019-03-05 Jason Merrill <jason@redhat.com>
4204 * class.c (is_really_empty_class): Add ignore_vptr parm.
4205 (trivial_default_constructor_is_constexpr): Pass it.
4206 * call.c (build_over_call): Pass it.
4207 * constexpr.c (cxx_eval_constant_expression): Pass it instead of
4208 checking TYPE_POLYMORPHIC_P.
4209 (cxx_eval_component_reference, potential_constant_expression_1):
4211 * cp-gimplify.c (simple_empty_class_p): Pass it.
4212 * init.c (expand_aggr_init_1): Pass it.
4214 2019-03-04 Paolo Carlini <paolo.carlini@oracle.com>
4217 * parser.c (cp_parser_class_head): Reject TYPE_BEING_DEFINED too.
4219 2019-03-04 Jakub Jelinek <jakub@redhat.com>
4222 * call.c (field_in_pset): New function.
4223 (build_aggr_conv): Handle CONSTRUCTOR_IS_DESIGNATED_INIT correctly.
4225 2019-03-02 Jakub Jelinek <jakub@redhat.com>
4228 * cp-tree.h (CONSTRUCTOR_IS_DESIGNATED_INIT): Define.
4229 * parser.c (cp_parser_braced_list): Adjust cp_parser_initializer_list
4230 caller, set CONSTRUCTOR_IS_DESIGNATED_INIT.
4231 (cp_parser_initializer_list): Add designated parameter, set *designated
4232 to a bool whether any designators were parsed.
4233 * decl.c (reshape_init): Copy over CONSTRUCTOR_IS_DESIGNATED_INIT if
4235 * pt.c (tsubst_copy_and_build): Likewise.
4236 * call.c (implicit_conversion): If CONSTRUCTOR_IS_DESIGNATED_INIT,
4237 don't call build_list_conv, nor build_complex_conv, nor attempt to
4238 convert a single element initializer to scalar.
4240 2019-03-01 Marek Polacek <polacek@redhat.com>
4242 PR c++/89537 - missing location for error with non-static member fn.
4243 * call.c (resolve_args): Use EXPR_LOCATION.
4244 * typeck.c (build_class_member_access_expr): Use input_location.
4246 PR c++/89532 - ICE with incomplete type in decltype.
4247 * semantics.c (finish_compound_literal): Return error_mark_node
4248 if digest_init_flags returns error_mark_node.
4250 2019-03-01 Jakub Jelinek <jakub@redhat.com>
4252 Implement P1002R1, Try-catch blocks in constexpr functions
4254 * parser.c (cp_parser_ctor_initializer_opt_and_function_body):
4255 Diagnose constexpr ctor or function with function-try-block with
4256 pedwarn for c++17 and earlier. Formatting fix.
4257 (cp_parser_try_block): Use pedwarn instead of error and only for
4258 c++17 and earlier when try block appears in constexpr function.
4259 * constexpr.c (build_constexpr_constructor_member_initializers):
4260 Handle TRY_BLOCK here instead of erroring on it.
4262 2019-02-28 Jason Merrill <jason@redhat.com>
4264 PR c++/88183 - ICE with .* fold-expression.
4265 * pt.c (fold_expression) [DOTSTAR_EXPR]: Remove special handling.
4267 PR c++/86969 - ICE with constexpr if and recursive generic lambdas.
4268 * class.c, lambda.c, pt.c: Revert earlier change.
4269 * lambda.c (add_capture): Don't special-case capture of dependent
4272 * name-lookup.c (print_binding_level): Print this_entity.
4274 2019-02-27 Marek Polacek <polacek@redhat.com>
4276 PR c++/88857 - ICE with value-initialization of argument in template.
4277 * call.c (convert_like_real): Don't call build_value_init in template.
4279 2019-02-27 Jason Merrill <jason@redhat.com>
4281 PR c++/86969 - ICE with constexpr if and recursive generic lambdas.
4282 * semantics.c (process_outer_var_ref): Do capture dependent vars.
4283 * class.c (finish_struct): Only add TAG_DEFN if T is in
4284 current_function_decl.
4285 * lambda.c (vla_capture_type): Force the capture type out into the
4286 lambda's enclosing function.
4287 (add_capture): Pass in the lambda.
4288 * pt.c (tsubst_lambda_expr): complete_type a VLA capture type.
4290 2019-02-27 Marek Polacek <polacek@redhat.com>
4292 PR c++/89511 - ICE with using-declaration and unscoped enumerator.
4293 * parser.c (cp_parser_using_declaration): For an unscoped enum
4294 only use its context if it's not a function declaration.
4296 2019-02-27 Paolo Carlini <paolo.carlini@oracle.com>
4299 * method.c (process_subob_fn): When maybe_instantiate_noexcept
4300 returns false don't call merge_exception_specifiers.
4302 2019-02-27 Paolo Carlini <paolo.carlini@oracle.com>
4305 * parser.c (cp_parser_noexcept_specification_opt): Return NULL_TREE
4306 for a non-constant parsed expression.
4308 2019-02-26 Jakub Jelinek <jakub@redhat.com>
4311 * constexpr.c (cxx_eval_store_expression): When changing active union
4312 member, set no_zero_init.
4314 2019-02-23 Marek Polacek <polacek@redhat.com>
4316 PR c++/88294 - ICE with non-constant noexcept-specifier.
4317 * pt.c (maybe_instantiate_noexcept): Set up the list of local
4318 specializations. Set current_class_{ptr,ref}.
4320 2019-02-22 David Malcolm <dmalcolm@redhat.com>
4323 * parser.c (cp_parser_unqualified_id): Capture and use locations
4326 2019-02-22 Marek Polacek <polacek@redhat.com>
4328 PR c++/89420 - ICE with CAST_EXPR in explicit-specifier.
4329 * decl.c (build_explicit_specifier): Don't check
4330 processing_template_decl. Call instantiation_dependent_expression_p
4331 instead of value_dependent_expression_p. Call
4332 instantiate_non_dependent_expr_sfinae before
4333 build_converted_constant_expr instead of calling
4334 instantiate_non_dependent_expr after it. Add
4335 processing_template_decl_sentinel.
4337 2019-02-22 Thomas Schwinge <thomas@codesourcery.com>
4339 * parser.c (cp_parser_oacc_simple_clause): Remove parser formal
4340 parameter, move loc formal parameter to the front. Adjust all
4342 (cp_parser_oacc_shape_clause): Add loc formal parameter. Adjust
4345 2019-02-21 Jason Merrill <jason@redhat.com>
4347 PR c++/87685 - generic lambda 'this' capture error.
4348 * lambda.c (lambda_expr_this_capture): Change add_capture_p to int.
4349 (maybe_generic_this_capture): Pass -1.
4351 PR c++/88394 - ICE with VLA init-capture.
4352 * lambda.c (is_normal_capture_proxy): Check DECL_CAPTURED_VARIABLE.
4354 PR c++/88869 - C++17 ICE with CTAD and explicit specialization.
4355 * pt.c (do_class_deduction): Don't include explicit specialization
4358 PR c++/89422 - ICE with -g and lambda in default arg in template.
4359 * pt.c (tsubst_function_decl): SET_DECL_FRIEND_CONTEXT sooner.
4361 2019-02-21 Jason Merrill <jason@redhat.com>
4363 PR c++/88419 - C++17 ICE with class template arg deduction.
4364 * pt.c (make_template_placeholder): Set TYPE_CANONICAL after
4365 CLASS_PLACEHOLDER_TEMPLATE.
4367 2019-02-21 Jakub Jelinek <jakub@redhat.com>
4370 * constexpr.c (struct constexpr_fundef): Add parms and result members.
4371 (retrieve_constexpr_fundef): Adjust for the above change.
4372 (register_constexpr_fundef): Save constexpr body with copy_fn,
4373 temporarily set DECL_CONTEXT on DECL_RESULT before that.
4374 (get_fundef_copy): Change FUN argument to FUNDEF with
4375 constexpr_fundef * type, grab body and parms/result out of
4376 constexpr_fundef struct and temporarily change it for copy_fn calls
4378 (cxx_eval_builtin_function_call): For __builtin_FUNCTION temporarily
4379 adjust current_function_decl from ctx->call context. Test
4380 !potential_constant_expression instead of !is_constant_expression.
4381 (cxx_bind_parameters_in_call): Grab parameters from new_call. Undo
4382 convert_for_arg_passing changes for TREE_ADDRESSABLE type passing.
4383 (cxx_eval_call_expression): Adjust get_fundef_copy caller.
4384 (cxx_eval_conditional_expression): For IF_STMT, allow then or else
4385 operands to be NULL.
4386 (label_matches): Handle BREAK_STMT and CONTINUE_STMT.
4387 (cxx_eval_loop_expr): Add support for FOR_STMT, WHILE_STMT and DO_STMT.
4388 (cxx_eval_switch_expr): Add support for SWITCH_STMT.
4389 (cxx_eval_constant_expression): Handle IF_STMT, FOR_STMT, WHILE_STMT,
4390 DO_STMT, CONTINUE_STMT, SWITCH_STMT, BREAK_STMT and CONTINUE_STMT.
4391 For SIZEOF_EXPR, recurse on the result of fold_sizeof_expr. Ignore
4392 DECL_EXPR with USING_DECL operand.
4393 * lambda.c (maybe_add_lambda_conv_op): Build thisarg using
4394 build_int_cst to make it a valid constant expression.
4396 2019-02-20 Jason Merrill <jason@redhat.com>
4398 PR c++/88690 - C++17 ICE with empty base in aggregate.
4399 * typeck2.c (process_init_constructor_record): Skip trivial
4400 initialization of an empty base.
4402 2019-02-21 Richard Biener <rguenther@suse.de>
4405 * vtable-class-hierarchy.c (vtv_generate_init_routine): Do not
4406 make symtab process new functions here.
4408 2019-02-20 Jason Merrill <jason@redhat.com>
4410 PR c++/87921 - wrong error with inline static data member.
4411 * decl2.c (finish_static_data_member_decl): Don't set DECL_IN_AGGR_P
4412 for a non-template inline variable. Do nothing for an
4413 already-instantiated variable.
4414 (c_parse_final_cleanups): Check DECL_IN_AGGR_P without
4416 * decl.c (check_initializer): Likewise.
4417 (make_rtl_for_nonlocal_decl): Likewise.
4418 * pt.c (instantiate_decl): Likewise.
4419 * typeck2.c (store_init_value): Likewise.
4421 2019-02-20 Jakub Jelinek <jakub@redhat.com>
4424 * decl2.c (c_parse_final_cleanups): Move TREE_ASM_WRITTEN setting
4425 for flag_syntax_only from here...
4426 * semantics.c (expand_or_defer_fn_1): ... here.
4429 * decl.c (maybe_commonize_var): When clearing TREE_PUBLIC and
4430 DECL_COMMON, set DECL_INTERFACE_KNOWN.
4433 * constexpr.c (cxx_eval_store_expression): Diagnose changing of active
4434 union member for -std=c++17 and earlier.
4436 2019-02-19 Jason Merrill <jason@redhat.com>
4438 PR c++/87513 - 'sorry' mangling PMF template-id.
4439 * mangle.c (write_expression): Handle SCOPE_REF to BASELINK.
4441 2019-02-19 Jason Merrill <jason@redhat.com>
4443 PR c++/88380 - wrong-code with flexible array and NSDMI.
4444 * typeck2.c (process_init_constructor_record): Skip flexarrays.
4446 2019-02-20 will wray <wjwray@gmail.com>
4448 PR c++/88572 - wrong handling of braces on scalar init.
4449 * decl.c (reshape_init_r): Allow braces around scalar initializer
4450 within aggregate init. Reject double braced-init of scalar
4453 2019-02-20 Paolo Carlini <paolo.carlini@oracle.com>
4456 * pt.c (tsubst_init): Diagnose an initializer expanding to an
4457 empty list of expressions; tweak wrt dependent types.
4458 (regenerate_decl_from_template): For VAR_DECLs call tsubst_init
4459 instead of tsubst_expr.
4461 2019-02-19 Jason Merrill <jason@redhat.com>
4463 PR c++/88368 - wrong 'use of deleted function'
4464 * method.c (walk_field_subobs): Remember errors from get_nsdmi.
4465 (get_defaulted_eh_spec): Call push_tinst_level.
4466 * pt.c (maybe_instantiate_noexcept): Keep error_mark_node.
4467 * typeck2.c (merge_exception_specifiers): Handle error_mark_node.
4469 2019-02-19 Chung-Lin Tang <cltang@codesourcery.com>
4472 * parser.c (cp_parser_oacc_clause_wait): Add representation of wait
4473 clause without argument as 'wait (GOMP_ASYNC_NOVAL)', adjust comments.
4475 2019-02-19 Jakub Jelinek <jakub@redhat.com>
4478 * lambda.c (maybe_generic_this_capture): Don't check
4479 DECL_NONSTATIC_MEMBER_FUNCTION_P on USING_DECLs.
4482 * typeck.c (build_reinterpret_cast_1): Don't handle void to
4483 && conversion go through build_target_expr_with_type.
4486 * error.c (qualified_name_lookup_error): Only call
4487 suggest_alternative_in_scoped_enum if name is IDENTIFIER_NODE.
4489 2019-02-19 Tom Honermann <tom@honermann.net>
4491 * name-lookup.c (get_std_name_hint): Added u8string as a name hint.
4493 2019-02-18 Jason Merrill <jason@redhat.com>
4495 PR c++/89336 - multiple stores in constexpr stmt.
4496 * constexpr.c (cxx_eval_store_expression): Preevaluate scalar or
4499 * pt.c (check_explicit_specialization): If the declarator is a
4500 template-id, only check whether the arguments are dependent.
4502 Improve duplicate [[likely]] diagnostic.
4503 * parser.c (cp_parser_statement): Make attrs_loc a range. Pass it
4504 to process_stmt_hotness_attribute.
4505 * cp-gimplify.c (process_stmt_hotness_attribute): Take attrs_loc.
4506 (genericize_if_stmt): Use likely/unlikely instead of predictor_name.
4508 2019-02-17 Marek Polacek <polacek@redhat.com>
4510 PR c++/89217 - ICE with list-initialization in range-based for loop.
4511 * constexpr.c (unshare_constructor): No longer static.
4512 * cp-tree.h (unshare_constructor): Declare.
4513 * semantics.c (finish_compound_literal): When dealing with a
4514 non-dependent expression in a template, return the original
4515 expression. Pass LOOKUP_NO_NARROWING to digest_init_flags.
4517 2019-02-13 Marek Polacek <polacek@redhat.com>
4519 PR c++/89297 - ICE with OVERLOAD in template.
4520 * semantics.c (finish_compound_literal): Call
4521 instantiate_non_dependent_expr_sfinae.
4523 2019-02-13 Alexandre Oliva <aoliva@redhat.com>
4526 * cp-tree.h (USING_DECL_SCOPE): Use result rather than type.
4527 * name-lookup.c (strip_using_decl): Use USING_DECL_SCOPE.
4528 * search.c (protected_accessible_p): Follow USING_DECL_DECLS.
4529 (shared_member_p): Likewise.
4530 (lookup_member): Likewise.
4531 * decl.c (grok_special_member_properties): Skip USING_DECLs.
4532 * semantics.c (finish_omp_declare_simd_methods): Likewise.
4533 (finish_qualified_id_expr): Do not call shared_member_p with
4537 * pt.c (tsubst_lambda_expr): Avoid duplicate tsubsting.
4538 Move cp_evaluated resetting before signature tsubsting.
4539 (gen_elem_of_pack_expansion_instantiation): Separate local
4540 specializations per index.
4542 2019-02-13 David Malcolm <dmalcolm@redhat.com>
4545 * class.c (add_method): Drop destructor assertion.
4547 2019-02-13 Paolo Carlini <paolo.carlini@oracle.com>
4550 * decl.c (make_typename_type): Allow for TYPE_PACK_EXPANSION as
4551 context (the first argument).
4552 * pt.c (tsubst, case TYPENAME_TYPE): Handle TYPE_PACK_EXPANSION
4555 2019-02-12 Jason Merrill <jason@redhat.com>
4557 PR c++/89144 - link error with constexpr initializer_list.
4558 * call.c (convert_like_real) [ck_list]: Don't allocate a temporary
4559 array for an empty list.
4560 * typeck2.c (store_init_value): Don't use cxx_constant_init in a
4563 2019-02-11 Jason Merrill <jason@redhat.com>
4565 PR c++/89241 - ICE with __func__ in lambda in template.
4566 * pt.c (enclosing_instantiation_of): Also check
4567 instantiated_lambda_fn_p for the template context.
4569 2019-02-11 Marek Polacek <polacek@redhat.com>
4571 PR c++/89212 - ICE converting nullptr to pointer-to-member-function.
4572 * pt.c (tsubst_copy_and_build) <case CONSTRUCTOR>: Return early for
4573 null member pointer value.
4575 2019-02-11 Jakub Jelinek <jakub@redhat.com>
4578 * pt.c (convert_nontype_argument): Pass true as manifestly_const_eval
4579 to maybe_constant_value calls.
4581 2019-02-11 Marek Polacek <polacek@redhat.com>
4583 * typeck2.c (digest_init_r): Remove commented code.
4585 2019-02-11 Martin Sebor <msebor@redhat.com>
4588 * decl.c (compute_array_index_type_loc): Preserve signed sizes
4589 for diagnostics. Call valid_array_size_p instead of error.
4590 * init.c (build_new_1): Compute size for diagnostic. Call
4591 invalid_array_size_error
4592 (build_new): Call valid_array_size_p instead of error.
4594 2019-02-07 Alexandre Oliva <aoliva@redhat.com>
4597 * call.c (compare_ics): Deal with ck_aggr in either cs.
4599 2019-02-06 David Malcolm <dmalcolm@redhat.com>
4602 * call.c (get_location_for_expr_unwinding_for_system_header): New
4604 (conversion_null_warnings): Use it when getting locations for
4605 EXPR, effectively adding a call to
4606 get_location_for_expr_unwinding_for_system_header for
4607 -Wconversion-null and making use of EXPR_LOCATION for
4608 -Wzero-as-null-pointer-constant.
4610 2019-02-05 Jakub Jelinek <jakub@redhat.com>
4613 * optimize.c (maybe_thunk_body): Clear TREE_ADDRESSABLE on
4614 PARM_DECLs of the thunk.
4615 * lambda.c (maybe_add_lambda_conv_op): Likewise.
4617 2019-02-05 Marek Polacek <polacek@redhat.com>
4619 PR c++/89158 - by-value capture of constexpr variable broken.
4620 * call.c (convert_like_real) <case ck_user>: Call mark_exp_read
4621 instead of mark_rvalue_use.
4623 2019-02-05 Alexandre Oliva <aoliva@redhat.com>
4626 * pt.c (instantiates_primary_template_p): New.
4627 (type_dependent_expression_p): Use it.
4629 2019-02-01 Jason Merrill <jason@redhat.com>
4631 PR c++/88761 - ICE with reference capture of constant.
4632 * lambda.c (mark_const_cap_r): Do walk subtrees of DECL_EXPR for
4635 2019-02-01 Marek Polacek <polacek@redhat.com>
4637 PR c++/88325 - ICE with invalid out-of-line template member definition.
4638 * parser.c (cp_parser_class_name): Don't call make_typename_type
4641 2019-02-01 Jakub Jelinek <jakub@redhat.com>
4644 * parser.c (cp_parser_gnu_attributes_opt): Set ok to false
4645 if require_open failed.
4647 2019-01-31 Marek Polacek <polacek@redhat.com>
4649 PR c++/89083, c++/80864 - ICE with list initialization in template.
4650 * constexpr.c (adjust_temp_type): Use copy_node and change the type
4651 instead of using build_constructor.
4652 * decl.c (reshape_init_r): Don't reshape a digested initializer.
4653 Return the initializer for COMPOUND_LITERAL_P.
4655 PR c++/88983 - ICE with switch in constexpr function.
4656 * constexpr.c (cxx_eval_switch_expr): Use SWITCH_COND and SWITCH_BODY.
4657 (cxx_eval_constant_expression) <case COND_EXPR>: Don't look for the
4658 label in the else branch if we found it in the then branch.
4660 2019-01-30 Jason Merrill <jason@redhat.com>
4662 PR c++/88752 - ICE with lambda and constexpr if.
4663 * cp-tree.h (LAMBDA_EXPR_INSTANTIATED): New.
4664 * pt.c (tsubst_lambda_expr): Set it.
4665 (instantiated_lambda_fn_p): Check it.
4666 (enclosing_instantiation_of): Use it.
4668 2019-01-31 Jakub Jelinek <jakub@redhat.com>
4671 * cxx-pretty-print.c (pp_cxx_enumeration_constant): Print always as
4672 a C cast in pp_c_flag_gnu_v3 mode.
4674 2019-01-30 Jakub Jelinek <jakub@redhat.com>
4677 * lambda.c (is_capture_proxy): Don't return true for
4678 DECL_OMP_PRIVATIZED_MEMBER artificial vars.
4680 2019-01-30 Marek Polacek <polacek@redhat.com>
4682 PR c++/89119 - ICE with value-initialization in template.
4683 * pt.c (tsubst_copy_and_build): Handle RANGE_EXPR.
4685 2019-01-29 Jason Merrill <jason@redhat.com>
4687 PR c++/86943 - wrong code converting lambda to function pointer.
4688 * lambda.c (maybe_add_lambda_conv_op): Use a template-id in the
4689 call. Only forward parms for decltype.
4690 * pt.c (tsubst_copy_and_build) [CALL_EXPR]: Handle CALL_FROM_THUNK_P
4692 * typeck.c (check_return_expr): Don't mess with a thunk call.
4694 2019-01-28 Jason Merrill <jason@redhat.com>
4696 PR c++/89089 - ICE with [[no_unique_address]].
4697 PR c++/88865 - wrong layout with [[no_unique_address]].
4698 * class.c (check_field_decls): A potentially-overlapping field makes
4699 the class non-layout-POD, but not non-empty.
4700 (end_of_class): Always consider empty data members.
4701 (layout_class_type): Set DECL_SIZE for empty fields.
4703 2019-01-28 Marek Polacek <polacek@redhat.com>
4705 PR c++/88358 - name wrongly treated as type.
4706 * parser.c (cp_parser_direct_declarator): Don't assume a qualified-id
4707 in parameter-list is a type if the function's declarator-id is not
4710 2019-01-27 Marek Polacek <polacek@redhat.com>
4712 PR c++/88815 - narrowing conversion lost in decltype.
4713 PR c++/78244 - narrowing conversion in template not detected.
4714 * cp-tree.h (CONSTRUCTOR_IS_DEPENDENT): New.
4715 * pt.c (instantiation_dependent_r): Consider a CONSTRUCTOR with
4716 CONSTRUCTOR_IS_DEPENDENT instantiation-dependent.
4717 * semantics.c (finish_compound_literal): When the compound literal
4718 isn't instantiation-dependent and the type isn't type-dependent,
4719 fall back to the normal processing. Set CONSTRUCTOR_IS_DEPENDENT.
4721 PR c++/89024 - ICE with incomplete enum type.
4722 * call.c (standard_conversion): When converting an
4723 ARITHMETIC_TYPE_P to an incomplete type, return NULL.
4725 2019-01-25 Paolo Carlini <paolo.carlini@oracle.com>
4728 * call.c (build_op_delete_call): Implement 7.6.2.5/(10.1).
4729 * decl2.c (coerce_delete_type): Use build_pointer_type instead
4732 2019-01-24 Jason Merrill <jason@redhat.com>
4734 PR c++/89001 - mangling of reference temporaries
4735 * cp-tree.h (struct saved_scope): Add ref_temp_count.
4736 (current_ref_temp_count): New macro.
4737 * mangle.c (mangle_ref_init_variable): Use it.
4738 * typeck2.c (store_init_value): Clear it.
4739 * call.c (make_temporary_var_for_ref_to_temp): Copy public and
4742 2019-01-24 Jakub Jelinek <jakub@redhat.com>
4745 * semantics.c (finish_omp_cancel): Diagnose more than one if
4746 on #pragma omp cancel with different modifiers. Use
4747 maybe_convert_cond when not in template or build_x_binary_op
4750 2019-01-23 Marek Polacek <polacek@redhat.com>
4752 PR c++/88757 - qualified name treated wrongly as type.
4753 * parser.c (cp_parser_direct_declarator): Don't treat qualified-ids
4754 in parameter-list as types if name lookup for declarator-id didn't
4755 find one or more function templates.
4757 2019-01-23 Jakub Jelinek <jakub@redhat.com>
4760 * cp-gimplify.c (genericize_cp_loop): Call begin_bc_block only
4761 after genericizing cond and incr expressions.
4764 * cp-gimplify.c (genericize_switch_stmt): Move cond genericization
4765 before the begin_bc_block call.
4767 2019-01-21 Jason Merrill <jason@redhat.com>
4769 PR c++/87893 - constexpr ctor ICE on ARM.
4770 PR c++/88293 - ICE with comma expression.
4771 * constexpr.c (initialized_type): Don't shortcut non-void type.
4772 Handle COMPOUND_EXPR.
4773 (cxx_eval_outermost_constant_expr): Return early for void type.
4775 2019-01-21 Jakub Jelinek <jakub@redhat.com>
4778 * optimize.c (cxx_copy_decl): New function.
4779 (clone_body): Use it instead of copy_decl_no_change.
4782 * typeck.c (cp_build_binary_op): Don't instrument
4783 SANITIZE_POINTER_COMPARE if processing_template_decl.
4784 (pointer_diff): Similarly for SANITIZE_POINTER_SUBTRACT.
4786 2019-01-18 Jason Merrill <jason@redhat.com>
4788 PR c++/88875 - error with explicit list constructor.
4789 * call.c (reference_binding): Don't modify EXPR. Set
4790 need_temporary_p on the ck_user conversion for a temporary.
4791 (convert_like_real): Check it.
4793 2019-01-18 H.J. Lu <hongjiu.lu@intel.com>
4797 * call.c (convert_for_arg_passing): Upate the
4798 warn_for_address_or_pointer_of_packed_member call.
4799 * typeck.c (convert_for_assignment): Likewise.
4801 2019-01-17 Jason Merrill <jason@redhat.com>
4803 PR c++/86205 - ICE with ?: of throw and template-id.
4804 * pt.c (resolve_nondeduced_context_or_error): Split out from...
4805 * typeck.c (decay_conversion): ...here.
4806 * call.c (build_conditional_expr_1): Use it.
4808 PR c++/86740, ICE with constexpr if and nested generic lambdas.
4809 * tree.c (cp_walk_subtrees): Handle LAMBDA_EXPR.
4811 2019-01-17 Paolo Carlini <paolo.carlini@oracle.com>
4813 * decl.c (grokdeclarator): Use typespec_loc in error messages
4814 about 'auto' and trailing return type.
4816 2019-01-17 David Malcolm <dmalcolm@redhat.com>
4819 * class.c (add_method): Don't use DECL_DESTRUCTOR_P on
4822 2019-01-17 Nathan Sidwell <nathan@acm.org>
4825 * semantics.c (process_outer_var_ref): Only skip dependent types
4828 2019-01-17 Alexandre Oliva <aoliva@redhat.com>
4831 * cp-tree.h (saved_scope): Add suppress_location_wrappers.
4832 * name-lookup.c (do_push_to_top_level): Save and reset it.
4833 (do_pop_from_top_level): Restore it.
4836 * pt.c (make_template_placeholder): Use auto_identifier.
4837 (is_auto): Drop CLASS_PLACEHOLDER_TEMPLATE test.
4838 * error.c (dump_type): Handle template placeholders.
4839 * cxx-pretty-print.c (pp_cx_unqualified_id): Likewise.
4842 * cvt.c (convert_to_void): Handle all cdtor calls as if
4845 2019-01-16 Paolo Carlini <paolo.carlini@oracle.com>
4847 * decl.c (grokdeclarator): Use locations[ds_storage_class] in
4848 error messages about ill-formed uses of mutable.
4850 2019-01-16 Marek Polacek <polacek@redhat.com>
4852 PR c++/78244 - narrowing conversion in template not detected.
4853 * call.c (perform_implicit_conversion_flags): Set
4854 IMPLICIT_CONV_EXPR_BRACED_INIT.
4855 * cp-tree.h (IMPLICIT_CONV_EXPR_BRACED_INIT): New.
4856 * pt.c (tsubst_copy_and_build): Use it.
4858 2019-01-15 David Malcolm <dmalcolm@redhat.com>
4861 * pt.c (build_deduction_guide): Bail out if tsubst_arg_types
4864 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com>
4866 * decl.c (start_decl): Improve error location.
4867 * decl2.c (grokfield): Likewise.
4869 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com>
4871 * decl.c (grokdeclarator): Move further up the location_t loc
4872 declaration and use the location when building a TYPE_DECL for
4874 * decl2.c (grokbitfield): Use DECL_SOURCE_LOCATION in the error
4875 about an ill-formed bit-field as typedef.
4877 2019-01-14 Marek Polacek <polacek@redhat.com>
4879 PR c++/88830 - ICE with abstract class.
4880 * decl2.c (maybe_emit_vtables): Check CLASSTYPE_LAZY_DESTRUCTOR.
4883 PR c++/88825 - ICE with bogus function return type deduction.
4884 * typeck.c (can_do_nrvo_p): Check error_mark_node.
4886 2019-01-14 Tom Honermann <tom@honermann.net>
4888 Implement P0482R5, char8_t: A type for UTF-8 characters and strings
4889 * cvt.c (type_promotes_to): Handle char8_t promotion.
4890 * decl.c (grokdeclarator): Handle invalid type specifier
4891 combinations involving char8_t.
4892 * lex.c (init_reswords): Add char8_t as a reserved word.
4893 * mangle.c (write_builtin_type): Add name mangling for char8_t (Du).
4894 * parser.c (cp_keyword_starts_decl_specifier_p)
4895 (cp_parser_simple_type_specifier): Recognize char8_t as a simple
4897 (cp_parser_string_literal): Use char8_array_type_node for the type
4899 (cp_parser_set_decl_spec_type): Tolerate char8_t typedefs in system
4901 * rtti.c (emit_support_tinfos): type_info support for char8_t.
4902 * tree.c (char_type_p): Recognize char8_t as a character type.
4903 * typeck.c (string_conv_p): Handle conversions of u8 string
4904 literals of char8_t type.
4905 (check_literal_operator_args): Handle UDLs with u8 string literals
4907 * typeck2.c (ordinary_char_type_p): New.
4908 (digest_init_r): Disallow initializing a char array with a u8 string
4911 2019-01-14 Martin Liska <mliska@suse.cz>
4913 PR gcov-profile/88263
4914 * decl2.c (get_tls_wrapper_fn): Use DECL_SOURCE_LOCATION
4915 as location of the TLS wrapper.
4917 2019-01-12 Paolo Carlini <paolo.carlini@oracle.com>
4919 * decl.c (cp_finish_decl): Improve error location.
4920 * decl2.c (grokfield): Likewise, improve two locations.
4922 2019-01-11 Marek Polacek <polacek@redhat.com>
4924 PR c++/88692, c++/87882 - -Wredundant-move false positive with *this.
4925 * typeck.c (maybe_warn_pessimizing_move): Return if ARG isn't
4928 2019-01-11 Jason Merrill <jason@redhat.com>
4930 PR c++/88312 - pack expansion of decltype.
4931 * pt.c (instantiation_dependent_r): A template non-type parameter
4932 pack is instantiation-dependent.
4934 2019-01-11 Jason Merrill <jason@redhat.com>
4936 PR c++/88613 - ICE with use of const var in lambda.
4937 * expr.c (mark_use): Fix location wrapper handling.
4938 * cp-gimplify.c (cp_fold_maybe_rvalue): Call mark_rvalue_use.
4940 2019-01-11 Tobias Burnus <burnus@net-b.de>
4943 * decl2.c (maybe_emit_vtables): If needed, generate code for
4944 the destructor of an abstract class.
4945 (mark_used): Update comment for older function-name change.
4947 2019-01-11 Paolo Carlini <paolo.carlini@oracle.com>
4949 * decl.c (start_decl): Improve error location.
4950 (grokdeclarator): Likewise, improve two locations.
4952 2019-01-09 Sandra Loosemore <sandra@codesourcery.com>
4956 * cp-tree.h: Mechanically replace "can not" with "cannot".
4957 * parser.c: Likewise.
4960 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com>
4962 * decl.c (grok_reference_init): Improve error location.
4963 (grokdeclarator): Likewise, improve two locations.
4965 2019-01-08 Marek Polacek <polacek@redhat.com>
4967 PR c++/88538 - braced-init-list in template-argument-list.
4968 * parser.c (cp_parser_template_argument): Handle braced-init-list when
4971 PR c++/88548 - this accepted in static member functions.
4972 * parser.c (cp_debug_parser): Adjust printing of
4973 local_variables_forbidden_p.
4974 (cp_parser_new): Set local_variables_forbidden_p to 0 rather than false.
4975 (cp_parser_primary_expression): When checking
4976 local_variables_forbidden_p, use THIS_FORBIDDEN or
4977 LOCAL_VARS_FORBIDDEN.
4978 (cp_parser_lambda_body): Update the type of
4979 local_variables_forbidden_p. Set it to 0 rather than false.
4980 (cp_parser_condition): Adjust call to cp_parser_declarator.
4981 (cp_parser_explicit_instantiation): Likewise.
4982 (cp_parser_init_declarator): Likewise.
4983 (cp_parser_declarator): New parameter. Use it.
4984 (cp_parser_direct_declarator): New parameter. Use it to set
4985 local_variables_forbidden_p. Adjust call to cp_parser_declarator.
4986 (cp_parser_type_id_1): Adjust call to cp_parser_declarator.
4987 (cp_parser_parameter_declaration): Likewise.
4988 (cp_parser_default_argument): Update the type of
4989 local_variables_forbidden_p. Set it to LOCAL_VARS_AND_THIS_FORBIDDEN
4991 (cp_parser_member_declaration): Tell cp_parser_declarator if we saw
4992 'static' or 'friend'.
4993 (cp_parser_exception_declaration): Adjust call to cp_parser_declarator.
4994 (cp_parser_late_parsing_default_args): Update the type of
4995 local_variables_forbidden_p. Set it to LOCAL_VARS_AND_THIS_FORBIDDEN
4997 (cp_parser_cache_defarg): Adjust call to cp_parser_declarator.
4998 (cp_parser_objc_class_ivars): Likewise.
4999 (cp_parser_objc_struct_declaration): Likewise.
5000 (cp_parser_omp_for_loop_init): Likewise.
5001 * parser.h (cp_parser): Change the type of local_variables_forbidden_p
5003 (LOCAL_VARS_FORBIDDEN, LOCAL_VARS_AND_THIS_FORBIDDEN, THIS_FORBIDDEN):
5006 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com>
5008 * decl.c (start_decl): Improve permerror location.
5010 2019-01-08 Jonathan Wakely <jwakely@redhat.com>
5011 Jakub Jelinek <jakub@redhat.com>
5014 * decl.c (finish_function): For -Wreturn-type don't add a return *this;
5015 fixit hint if current_class_ref is NULL. Use a single if instead of
5018 2019-01-07 Paolo Carlini <paolo.carlini@oracle.com>
5020 * decl.c (start_decl): Improve two error_at locations.
5021 (expand_static_init): Likewise.
5023 2019-01-07 Marek Polacek <polacek@redhat.com>
5025 PR c++/88741 - wrong error with initializer-string.
5026 * decl.c (cp_complete_array_type): Strip any location wrappers.
5028 2019-01-07 Bernd Edlinger <bernd.edlinger@hotmail.de>
5034 * cp-tree.h (LOOKUP_ALLOW_FLEXARRAY_INIT): New flag value.
5035 * typeck2.c (digest_init_r): Raise an error for non-static
5036 initialization of a flexible array member.
5037 (process_init_constructor, massage_init_elt,
5038 process_init_constructor_array, process_init_constructor_record,
5039 process_init_constructor_union, process_init_constructor): Add the
5040 flags parameter and pass it thru.
5041 (store_init_value): Pass LOOKUP_ALLOW_FLEXARRAY_INIT parameter to
5042 digest_init_flags for static decls.
5044 2019-01-07 Jakub Jelinek <jakub@redhat.com>
5047 * cp-tree.h (cp_build_vec_convert): Declare.
5048 * parser.c (cp_parser_postfix_expression): Parse
5049 __builtin_convertvector.
5050 * constexpr.c: Include fold-const-call.h.
5051 (cxx_eval_internal_function): Handle IFN_VEC_CONVERT.
5052 (potential_constant_expression_1): Likewise.
5053 * semantics.c (cp_build_vec_convert): New function.
5054 * pt.c (tsubst_copy_and_build): Handle CALL_EXPR to
5057 2019-01-03 Jakub Jelinek <jakub@redhat.com>
5060 * decl.c (builtin_function_1): Return result of pushdecl_top_level
5061 or pushdecl rather than decl.
5063 2019-01-03 Paolo Carlini <paolo.carlini@oracle.com>
5065 * tree.c (handle_nodiscard_attribute): Improve warning location.
5067 2019-01-02 Marek Polacek <polacek@redhat.com>
5069 PR c++/88612 - ICE with -Waddress-of-packed-member.
5070 * call.c (convert_for_arg_passing): Only give warnings with tf_warning.
5071 * typeck.c (convert_for_assignment): Likewise.
5073 PR c++/88631 - CTAD failing for value-initialization.
5074 * typeck2.c (build_functional_cast): Try deducing the template
5075 arguments even if there are no arguments to deduce from.
5077 2019-01-01 Jakub Jelinek <jakub@redhat.com>
5079 Update copyright years.
5081 Copyright (C) 2019 Free Software Foundation, Inc.
5083 Copying and distribution of this file, with or without modification,
5084 are permitted in any medium without royalty provided the copyright
5085 notice and this notice are preserved.