1 2019-11-27 Andrew Sutton <asutton@lock3software.com>
4 Defer evaluation of concept checks so that static assertions can
5 emit more detailed diagnostics.
6 * constexpr.c (cxx_eval_call_expression): Handle concept checks.
7 (cxx_eval_constant_expression): Diagnose misuse of function concepts
8 as template-id expressions. Follow the usual return path for results.
9 (cxx_eval_outermost_constant_expr): Avoid calling
10 cp_get_callee_fndecl_nofold for function concepts.
11 * constraint.cc (build_function_check): Fully type the concept check
12 so that we don't ICE in conversions.
13 * cp-gimplify.c (cp_genericize_r) [CALL_EXPR]: Handle concept checks.
14 [TEMPLATE_ID_EXPR] Likewise.
15 * cvt.c (convert_to_void): Always evaluate concept checks so we don't
16 accidentally ignore them. Substitution during satisfaction can make
17 a program ill-formed (example in g++.dg/cpp2a/concepts6.C).
18 * pt.c (tsubst_copy_and_build): [CALL_EXPR]: Don't evaluate concepts.
19 [TEMPLATE_ID_EXPR]: Likewise.
20 * semantics.c (finish_call_expr): Don't evaluate concepts.
21 (finish_id_expression_1): Likewise.
22 (finish_static_assert): Preserve the original condition so we can
23 diagnose concept errors when a check returns false.
25 2019-11-27 Andrew Sutton <asutton@lock3software.com>
28 Improve quality of diagnostics for subexpressions that need parens.
29 * parser.c (cp_parser_requires_clause_opt): Add a flag to indicate
30 when parsing a requires-clause before lambda parameters, and...
31 (cp_parser_lambda_declarator_opt): ... use that here ...
32 (cp_parser_type_parameter): ... and here ...
33 (cp_parser_late_return_type_opt): ... and here ...
34 (cp_parser_explicit_template_declaration): ... and here.
35 (cp_parser_diagnose_ungrouped_constraint_plain): Adjust the message
36 because this can apply to subexpressions that are not immediately
37 after a requires-clause.
38 (cp_parser_diagnose_ungrouped_constraint_rich): Likewise.
39 (primary_constraint_error): New.
40 (cp_parser_constraint_requires_parens): New.
41 (cp_parser_unary_constraint_requires_parens): New.
42 (cp_parser_constraint_primary_expression): Check for unary expressions
43 before parsing the primary expression. Also check for binary and
44 postfix operators after a successful parse of the primary expression.
45 Force a re-parse if the result would form a lower-precedence string.
46 (cp_parser_constraint_logical_and_expression): Propagate lambda flag;
47 move checks for ill-formed constraints into the constraint primary
49 (cp_parser_constraint_logical_or_expression): Likewise.
50 (cp_parser_requires_clause_expression): Propagate lambda flag.
52 2019-11-27 Andrew Sutton <asutton@lock3software.com>
55 * constraint.cc (satisfy_declaration_constraints): Push tinst levels
58 2019-11-27 Andrew Sutton <asutton@lock3software.com>
60 Diagnose certain constraint errors as hard errors, but otherwise treat
61 them the same as normal SFINAE-type errors. Also, generally clean up
62 the satisfaction functions.
64 * constexpr.c (cxx_eval_constant_expression): Use
65 evaluate_concept_check.
66 * constraint.cc (normalize_concept_definition): Accept a diagnostic
67 flag and only cache when not diagnosing errors.
68 (decl_satisfied_cache): Map to trees instead of bools.
69 (satisfy_atom): Guarantee a location for the errors, propagate complain
70 flags to force_rvalue, and emit errors for non-boolean constraints.
71 (get_normalized_constraints_and_args): New overloads. Factored out of
72 satisfy_constraint_expression and satisfy_declaration_constraints.
73 (satisfy_constraint_expression): Propagate diagnostic info to
75 (satisfy_declaration_constraints): New. Factored out of
76 constraints_satisfied_p.
77 (constraint_satisfaction_value): New. Calls
78 satisfy_constraint_expression or satisfy_declaration_constraints.
79 (constraints_satisfied_p): Call constraint_satisfaction_value.
80 (evaluate_concept_check): Don't take tsubst_falgs_t. Replay
81 satisfaction if an error is encountered.
82 (current_failed_constraint): Moved from pt.c.
83 (diagnose_constraints): Call constraint_satisfaction_value.
84 * cp-tree.h: Update declarations.
85 * pt.c (current_failed_constraint): Moved to constraint.cc.
86 * semantics.c (finish_id_expression_1): Remove a duplicate case.
88 2019-11-27 Jakub Jelinek <jakub@redhat.com>
91 * tree.c (replace_placeholders_r): Don't walk constructor elts with
94 2019-11-26 Jason Merrill <jason@redhat.com>
96 * pt.c (tsubst_copy_and_build) [TEMPLATE_ID_EXPR]: Remember the
97 location of a variable template-id.
98 * constexpr.c (cxx_eval_constant_expression): Get expr location
99 before stripping location wrappers.
100 (non_const_var_error): Take location argument.
102 2019-11-26 Paolo Carlini <paolo.carlini@oracle.com>
104 * typeck.c (cp_build_unary_op): Consistently use the accurate
105 location in seven additional diagnostic messages.
106 (cp_build_compound_expr): Use cp_expr_loc_or_input_loc in one place.
108 2019-11-26 Jakub Jelinek <jakub@redhat.com>
111 * parser.c (cp_parser_std_attribute): For unknown attributes,
112 skip balanced token seq instead of trying to parse
113 attribute-argument-clause as expression list. Formatting fix.
116 * class.c (enum_to_min_precision): New hash_map.
117 (enum_min_precision): New function.
118 (check_bitfield_decl): Use it.
120 2019-11-25 Paolo Carlini <paolo.carlini@oracle.com>
122 * typeck.c (cp_build_indirect_ref_1): Add location_t parameter
123 and use it in error messages.
124 (build_x_indirect_ref): Adjust call.
125 (build_indirect_ref): Likewise.
126 (cp_build_fold_indirect_ref): Likewise.
127 (cp_build_array_ref): Likewise.
128 * call.c (build_new_op_1): Likewise.
129 * semantics.c (finish_omp_clauses): Likewise.
130 (finish_omp_depobj): Likewise.
131 * typeck2.c (build_x_arrow): Likewise.
132 * cp-tree.h (cp_build_indirect_ref): Update declaration.
134 * call.c (build_new_op_1): Use location argument in warning_at.
136 * typeck.c (cp_build_modify_expr): Consistently use the
139 2019-11-23 Bernd Edlinger <bernd.edlinger@hotmail.de>
142 * name-lookup.c (check_local_shadow): Use can_convert_arg
143 instead of can_convert.
145 2019-11-22 Marek Polacek <polacek@redhat.com>
147 PR c++/88337 - P1327R1: Allow polymorphic typeid in constexpr.
148 * constexpr.c (potential_constant_expression_1): Allow a typeid
149 expression whose operand is of polymorphic type in constexpr in
151 * rtti.c (build_typeid): Remove obsolete FIXME comment.
153 2019-11-22 Jakub Jelinek <jakub@redhat.com>
156 * cp-objcp-common.c (identifier_global_tag): Define.
159 * init.c (nsdmi_inst): Change type to
160 decl_tree_cache_map * from tree_cache_map *.
161 * constraint.cc (decl_constraints): Likewise.
162 * decl.c (get_tuple_decomp_init): Likewise.
163 * pt.c (defarg_inst, explicit_specifier_map): Likewise.
164 (tsubst_default_argument, store_explicit_specifier): Use
165 decl_tree_cache_map::create_ggc rather than
166 tree_cache_map::create_ggc.
167 * cp-objcp-common.c (debug_type_map): Change type to
168 type_tree_cache_map * from tree_cache_map *.
170 2019-11-21 Marek Polacek <polacek@redhat.com>
172 PR c++/92450 - ICE with invalid nested name specifier.
173 * parser.c (cp_parser_member_declaration): Don't attempt to print
174 erroneous bit-field diagnostic if grokdeclarator returns
177 2019-11-21 Jakub Jelinek <jakub@redhat.com>
178 Jason Merrill <jason@redhat.com>
181 * parser.c (cp_parser_decl_specifier_seq): For concept or typedef
182 break early if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR.
183 For type specifiers, set CP_PARSER_FLAGS_NO_TYPE_DEFINITIONS
184 if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR is set.
186 2019-11-20 Paolo Carlini <paolo.carlini@oracle.com>
188 * typeck2.c (build_x_arrow): Early return if decay_conversion
189 returns error_mark_node.
191 2019-11-20 Jakub Jelinek <jakub@redhat.com>
194 * call.c (complain_about_no_candidates_for_method_call): If
195 conv->from is not a type, pass to complain_about_bad_argument
196 lvalue_type of conv->from.
198 2019-11-20 Paolo Carlini <paolo.carlini@oracle.com>
200 * cvt.c (ocp_convert): Use additional warning sentinel.
202 2019-11-19 Jakub Jelinek <jakub@redhat.com>
205 * constexpr.c (cxx_eval_outermost_constant_expr): If DECL_INITIAL
206 on object is erroneous, return t without trying to evaluate
209 2019-11-12 Jason Merrill <jason@redhat.com>
211 * call.c (same_fn_or_template): Change to cand_parms_match.
213 (print_z_candidate): Mark rewritten/reversed candidates.
214 (build_new_op_1): Warn about recursive call with reversed arguments.
216 2019-11-15 Andrew Sutton <asutton@lock3software.com>
219 * pt.c (get_underlying_template): Exit loop if the original type
220 of the alias is null.
222 2019-11-19 Andrew Sutton <asutton@lock3software.com>
225 * pt.c (maybe_new_partial_specialization): Apply access to newly
226 created partial specializations. Update comment style.
228 2019-11-19 Andrew Sutton <asutton@lock3software.com>
231 * pt.c (maybe_new_partial_specialization): Apply access to newly
232 created partial specializations. Update comment style.
234 2019-11-19 Andrew Sutton <asutton@lock3software.com>
237 Suppress diagnostics substituting into a requires-expression.
238 * pt.c (tsubst_copy_and_build): Perform the first substitution without
239 diagnostics and a second only if tsubst_requries_expr returns an error.
241 2019-11-19 Jakub Jelinek <jakub@redhat.com>
244 * semantics.c (handle_omp_for_class_iterator): Don't call
245 cp_fully_fold on cond.
247 2019-11-18 Paolo Carlini <paolo.carlini@oracle.com>
249 * typeck.c (cp_build_addr_expr_1): Use cp_expr_loc_or_input_loc
251 (cxx_sizeof_expr): Use it in one additional place.
252 (cxx_alignof_expr): Likewise.
253 (lvalue_or_else): Likewise.
255 2019-11-18 Marek Polacek <polacek@redhat.com>
257 PR c++/91962 - ICE with reference binding and qualification conversion.
258 * call.c (convert_like_real) <case ck_ref_bind>: Check need_temporary_p.
260 2019-11-17 Jakub Jelinek <jakub@redhat.com>
262 * method.c (lookup_comparison_result): Use %qD instead of %<%T::%D%>
264 (lookup_comparison_category): Use %qD instead of %<std::%D%> to print
267 2019-11-15 Paolo Carlini <paolo.carlini@oracle.com>
269 * typeck.c (cp_truthvalue_conversion): Add tsubst_flags_t parameter
270 and use it in calls; also pass the location_t of the expression to
271 cp_build_binary_op and c_common_truthvalue_conversion.
272 * rtti.c (build_dynamic_cast_1): Adjust call.
273 * cvt.c (ocp_convert): Likewise.
274 * cp-gimplify.c (cp_fold): Likewise.
275 * cp-tree.h (cp_truthvalue_conversion): Update declaration.
277 2019-11-14 Jason Merrill <jason@redhat.com>
279 Implement P1816R0, class template argument deduction for aggregates.
280 * pt.c (maybe_aggr_guide, collect_ctor_idx_types): New.
281 (is_spec_or_derived): Split out from do_class_deduction.
282 (build_deduction_guide): Handle aggregate guide.
283 * class.c (finish_struct): Set CLASSTYPE_NON_AGGREGATE in a
285 * cp-tree.h (CP_AGGREGATE_TYPE_P): An incomplete class is not an
288 2019-11-14 Richard Sandiford <richard.sandiford@arm.com>
290 * call.c (build_conditional_expr_1): Use truth_type_for instead
291 of build_same_sized_truth_vector_type.
292 * typeck.c (build_vec_cmp): Likewise.
294 2019-11-14 Jakub Jelinek <jakub@redhat.com>
296 * parser.c (cp_parser_omp_context_selector): Don't require score
297 argument to fit into shwi, just to be INTEGER_CST. Diagnose
299 * pt.c (tsubst_attribute): Likewise.
301 * parser.c (cp_parser_omp_context_selector): Rename
302 CTX_PROPERTY_IDLIST to CTX_PROPERTY_NAME_LIST, add CTX_PROPERTY_ID.
303 Use CTX_PROPERTY_ID for atomic_default_mem_order, only allow a single
304 identifier in that. For CTX_PROPERTY_NAME_LIST, allow identifiers
306 * pt.c (tsubst_attribute): Fix up STRING_CST handling if allow_string.
308 2019-11-13 Marek Polacek <polacek@redhat.com>
310 PR c++/89070 - bogus [[nodiscard]] warning in SFINAE.
311 * cvt.c (convert_to_void): Guard maybe_warn_nodiscard calls with
314 2019-11-13 Richard Sandiford <richard.sandiford@arm.com>
317 * cp-tree.h (STF_STRIP_DEPENDENT): New constant.
318 * tree.c (strip_typedefs): Add STF_STRIP_DEPENDENT to the flags
319 when calling strip_typedefs recursively on a DECL_ORIGINAL_TYPE.
320 Don't apply the fix for DR1558 in that case; allow aliases with
321 dependent template parameters to be stripped instead.
323 2019-11-12 Nathan Sidwell <nathan@acm.org>
325 * name-lookup.c (lookup_using_decl): New function, merged from ...
326 (do_class_using_decl): ... here. Call it. And ...
327 (finish_nonmember_using_decl): ... here. Call it.
329 2019-11-12 Martin Liska <mliska@suse.cz>
331 * name-lookup.c: Do not include params.h.
332 * typeck.c: Likewise.
334 2019-11-12 Martin Liska <mliska@suse.cz>
336 * name-lookup.c (namespace_hints::namespace_hints): Replace old
337 parameter syntax with the new one, include opts.h if needed. Use
338 SET_OPTION_IF_UNSET macro.
339 * typeck.c (comptypes): Likewise.
341 2019-11-12 Maciej W. Rozycki <macro@codesourcery.com>
342 Frederik Harwath <frederik@codesourcery.com>
345 * constexpr.c (potential_constant_expression_1): Handle
347 * parser.c (OACC_SERIAL_CLAUSE_MASK): New macro.
348 (cp_parser_oacc_kernels_parallel): Rename function to...
349 (cp_parser_oacc_compute): ... this. Handle PRAGMA_OACC_SERIAL.
350 (cp_parser_omp_construct): Update accordingly.
351 (cp_parser_pragma): Handle PRAGMA_OACC_SERIAL. Fix alphabetic
353 * pt.c (tsubst_expr): Handle OACC_SERIAL.
355 2019-11-11 Jason Merrill <jason@redhat.com>
357 Implement P1946R0, Allow defaulting comparisons by value.
358 * method.c (early_check_defaulted_comparison): Accept by-value,
359 reject mixed by-value and by-reference parms.
360 * decl.c (grokdeclarator): Set funcdef_flag for defaulted friend.
361 * decl2.c (grokfield): Don't SET_DECL_FRIEND_CONTEXT.
363 * typeck.c (cp_build_binary_op): Sorry about <=> on VECTOR_TYPE.
365 2019-11-11 Jakub Jelinek <jakub@redhat.com>
368 * decl.c (finish_function): Move ctype initialization before
369 DECL_DELETED_FN handling.
371 * semantics.c (finish_translation_unit): Diagnose declare target
372 without corresponding end declare target.
374 2019-11-10 Jason Merrill <jason@redhat.com>
376 Implement D1957R0, T* to bool should be considered narrowing.
377 * typeck2.c (check_narrowing): Treat pointer->bool as a narrowing
378 conversion with -std=c++2a.
380 2019-11-08 Marek Polacek <polacek@redhat.com>
382 PR c++/92215 - flawed diagnostic for bit-field with non-integral type.
383 * parser.c (cp_parser_member_declaration): Add a diagnostic for
384 bit-fields with non-integral types.
386 2019-11-08 Jakub Jelinek <jakub@redhat.com>
388 * init.c (build_vec_delete_1): Fix a comment typo - mist -> must.
390 2019-11-07 Jason Merrill <jason@redhat.com>
392 Implement D1959R0, remove weak_equality and strong_equality.
393 * method.c (enum comp_cat_tag, comp_cat_info): Remove *_equality.
394 (genericize_spaceship, common_comparison_type): Likewise.
395 * typeck.c (cp_build_binary_op): Move SPACESHIP_EXPR to be with the
396 relational operators, exclude other types no longer supported.
398 2019-11-06 Jason Merrill <jason@redhat.com>
400 Implement D1907R1 "structural type".
401 * tree.c (structural_type_p): New.
402 * pt.c (invalid_nontype_parm_type_p): Use it.
403 * class.c (build_base_field_1): Take binfo. Copy TREE_PRIVATE.
404 (build_base_field): Pass binfo.
406 PR c++/92150 - partial specialization with class NTTP.
407 * pt.c (unify): Handle VIEW_CONVERT_EXPR.
409 * pt.c (use_pack_expansion_extra_args_p): Still do substitution if
410 all packs are simple pack expansions.
411 (add_extra_args): Check that the extra args aren't dependent.
413 2019-11-06 Andrew Sutton <asutton@lock3software.com>
415 Use satisfaction with nested requirements.
416 * constraint.cc (build_parameter_mapping): Use
417 current_template_parms when the declaration is not available.
418 (norm_info::norm_info) Make explicit.
419 (normalize_constraint_expression): Factor into a separate overload
420 that takes arguments, and use that in the original function.
421 (tsubst_nested_requirement): Use satisfy_constraint instead of
422 trying to evaluate this as a constant expression.
423 (finish_nested_requirement): Keep the normalized constraint and the
424 original normalization arguments with the requirement.
425 (diagnose_nested_requirement): Use satisfy_constraint. Tentatively
426 implement more comprehensive diagnostics, but do not enable.
427 * parser.c (cp_parser_requires_expression): Relax requirement that
428 requires-expressions can live only inside templates.
429 * pt.c (any_template_parm_r): Look into type of PARM_DECL.
431 2019-11-06 Jason Merrill <jason@redhat.com>
433 C++20 NB CA378 - Remove constrained non-template functions.
434 * decl.c (grokfndecl): Reject constraints on non-templated function.
436 2019-11-06 Matthias Kretz <m.kretz@gsi.de>
438 * parser.c (cp_parser_operator): Parse operator?: as an
439 attempt to overload the conditional operator.
441 2019-11-05 Jason Merrill <jason@redhat.com>
443 Implement C++20 operator<=>.
444 * cp-tree.h (struct lang_decl_fn): Add maybe_deleted bitfield.
445 (DECL_MAYBE_DELETED): New.
446 (enum special_function_kind): Add sfk_comparison.
447 (LOOKUP_REWRITTEN, LOOKUP_REVERSED): New.
448 * call.c (struct z_candidate): Add rewritten and reversed methods.
449 (add_builtin_candidate): Handle SPACESHIP_EXPR.
450 (add_builtin_candidates): Likewise.
451 (add_candidates): Don't add a reversed candidate if the parms are
453 (add_operator_candidates): Split out from build_new_op_1. Handle
454 rewritten and reversed candidates.
455 (add_candidate): Swap conversions of reversed candidate.
456 (build_new_op_1): Swap them back. Build a second operation for
457 rewritten candidates.
458 (extract_call_expr): Handle rewritten calls.
459 (same_fn_or_template): New.
460 (joust): Handle rewritten and reversed candidates.
461 * class.c (add_implicitly_declared_members): Add implicit op==.
462 (classtype_has_op, classtype_has_defaulted_op): New.
463 * constexpr.c (cxx_eval_binary_expression): Handle SPACESHIP_EXPR.
464 (cxx_eval_constant_expression, potential_constant_expression_1):
466 * cp-gimplify.c (genericize_spaceship): New.
467 (cp_genericize_r): Use it.
468 * cp-objcp-common.c (cp_common_init_ts): Handle SPACESHIP_EXPR.
469 * decl.c (finish_function): Handle deleted function.
470 * decl2.c (grokfield): SET_DECL_FRIEND_CONTEXT on defaulted friend.
471 (mark_used): Check DECL_MAYBE_DELETED. Remove assumption that
472 defaulted functions are non-static members.
473 * error.c (dump_expr): Handle SPACESHIP_EXPR.
474 * method.c (type_has_trivial_fn): False for sfk_comparison.
475 (enum comp_cat_tag, struct comp_cat_info_t): New types.
476 (comp_cat_cache): New array variable.
477 (lookup_comparison_result, lookup_comparison_category)
478 (is_cat, cat_tag_for, spaceship_comp_cat)
479 (spaceship_type, genericize_spaceship)
480 (common_comparison_type, early_check_defaulted_comparison)
481 (comp_info, build_comparison_op): New.
482 (synthesize_method): Handle sfk_comparison. Handle deleted.
483 (get_defaulted_eh_spec, maybe_explain_implicit_delete)
484 (explain_implicit_non_constexpr, implicitly_declare_fn)
485 (defaulted_late_check, defaultable_fn_check): Handle sfk_comparison.
486 * name-lookup.c (get_std_name_hint): Add comparison categories.
487 * tree.c (special_function_p): Add sfk_comparison.
488 * typeck.c (cp_build_binary_op): Handle SPACESHIP_EXPR.
490 2019-11-05 Tim van Deurzen <tim@kompiler.org>
492 Add new tree code for the spaceship operator.
493 * cp-tree.def: Add new tree code.
494 * operators.def: New binary operator.
495 * parser.c: Add new token and tree code.
497 2019-09-15 Jason Merrill <jason@redhat.com>
499 * call.c (build_new_op_1): Don't apply any standard conversions to
500 the operands of a built-in operator. Don't suppress conversions in
502 * typeck.c (cp_build_unary_op): Do integral promotions for enums.
504 2019-11-04 Jason Merrill <jason@redhat.com>
506 Use vec instead of raw array for built-in candidates.
507 * call.c (build_builtin_candidate): Take args in a vec.
508 (add_builtin_candidate, add_builtin_candidates): Likewise.
509 (build_conditional_expr_1, build_new_op_1): Adjust.
511 2019-11-04 Jason Merrill <jason@redhat.com>
513 * constexpr.c (explain_invalid_constexpr_fn): Show location of fn.
515 * pt.c (maybe_instantiate_noexcept): Only update clones if we
518 * typeck.c (contextual_conv_bool): New.
520 * name-lookup.c (lookup_qualified_name): Add wrapper overload taking
521 C string rather than identifier.
522 * parser.c (cp_parser_userdef_numeric_literal): Use it.
523 * rtti.c (emit_support_tinfos): Use it.
524 * cp-tree.h (ovl_op_identifier): Change to inline functions.
525 (build_x_binary_op): Add wrapper with fewer parms.
527 2019-11-05 Jason Merrill <jason@redhat.com>
529 * decl2.c (mark_used): Diagnose use of a function with unsatisfied
531 * typeck.c (cp_build_function_call_vec): Not here.
533 2019-11-05 Nathan Sidwell <nathan@acm.org>
536 * parser.c (cp_parser_error_1): Check EOF and UNKNOWN_LOCATION
537 when skipping over version control marker.
539 2019-11-05 Jakub Jelinek <jakub@redhat.com>
542 * constexpr.c (potential_constant_expression_1): Return true rather
543 than false for PREDICT_EXPR.
545 * decl.c (omp_declare_variant_finalize_one): Call
546 declare_simd_adjust_this not just on the context, but also on the
547 variant-id expression for methods. Don't call
548 cp_get_callee_fndecl_nofold, call cp_get_callee and only if it is
549 safe cp_get_fndecl_from_callee. Don't try to print as %qD
551 * pt.c (tsubst_attribute): Handle "omp declare variant base"
553 (tsubst_function_decl): Call omp_declare_variant_finalize
554 if there are any "omp declare variant base" attributes left.
556 2019-11-04 Kamlesh Kumar <kamleshbhalui@gmail.com>
558 PR c++/91979 - mangling nullptr expression
559 * mangle.c (write_template_arg_literal): Handle nullptr
562 2019-11-04 Jason Merrill <jason@redhat.com>
564 * typeck.c (check_return_expr): Avoid redundant error.
566 2019-11-02 Paolo Carlini <paolo.carlini@oracle.com>
568 * typeck.c (composite_pointer_type): Add a const op_location_t&
569 parameter and use it in diagnostics.
570 (composite_pointer_error): Likewise.
571 (composite_pointer_type_r): Add a const op_location_t&
572 parameter and forward it.
573 (cp_build_binary_op): Adjust calls.
574 (common_pointer_type): Likewise.
575 * call.c (add_builtin_candidate): Likewise.
576 (build_conditional_expr_1): Likewise.
577 * cp-tree.h (composite_pointer_type): Update declaration.
579 * typeck.c (cxx_sizeof_expr): Use cp_expr_loc_or_input_loc
581 (cxx_alignof_expr): Likewise.
582 (lvalue_or_else): Likewise.
584 2019-11-02 Jakub Jelinek <jakub@redhat.com>
586 * decl.c (omp_declare_variant_finalize_one): Use
587 omp_get_context_selector instead of c_omp_get_context_selector.
590 * parser.c (cp_parser_decl_specifier_seq): Don't parse attributes
591 if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR.
593 PR c++/88335 - Implement P1073R3: Immediate functions
594 * cp-tree.h (struct lang_decl_fn): Add immediate_fn_p bit.
595 (DECL_IMMEDIATE_FUNCTION_P, SET_DECL_IMMEDIATE_FUNCTION_P): Define.
596 (enum cp_decl_spec): Add ds_consteval.
597 (fold_non_dependent_expr): Add another tree argument defaulted to
599 * name-lookup.h (struct cp_binding_level): Add immediate_fn_ctx_p
601 * parser.c (cp_keyword_starts_decl_specifier_p): Adjust comments
602 for C++11 and C++20 specifiers. Handle RID_CONSTEVAL.
603 (CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR): Adjust comment.
604 (CP_PARSER_FLAGS_CONSTEVAL): New.
605 (cp_parser_skip_balanced_tokens): New forward declaration.
606 (cp_parser_lambda_declarator_opt): Handle ds_consteval. Set
607 current_binding_level->immediate_fn_ctx_p before parsing parameter
608 list if decl-specifier-seq contains consteval specifier.
609 (cp_parser_decl_specifier_seq): Handle RID_CONSTEVAL.
610 (cp_parser_explicit_instantiation): Diagnose explicit instantiation
611 with consteval specifier.
612 (cp_parser_init_declarator): For consteval or into flags
613 CP_PARSER_FLAGS_CONSTEVAL.
614 (cp_parser_direct_declarator): If CP_PARSER_FLAGS_CONSTEVAL, set
615 current_binding_level->immediate_fn_ctx_p in the sk_function_parms
617 (set_and_check_decl_spec_loc): Add consteval entry, formatting fix.
618 * call.c (build_addr_func): For direct calls to immediate functions
619 use build_address rather than decay_conversion.
620 (build_over_call): Evaluate immediate function invocations.
621 * error.c (dump_function_decl): Handle DECL_IMMEDIATE_FUNCTION_P.
622 * semantics.c (expand_or_defer_fn_1): Use tentative linkage and don't
623 call mark_needed for immediate functions.
624 * typeck.c (cxx_sizeof_or_alignof_expr): Likewise. Formatting fix.
625 (cp_build_addr_expr_1): Reject taking address of immediate function
626 outside of immediate function.
627 * decl.c (validate_constexpr_redeclaration): Diagnose consteval
628 vs. non-consteval or vice versa redeclaration. Use
629 SET_DECL_IMMEDIATE_FUNCTION_P if new_decl is immediate function.
630 (check_tag_decl): Use %qs with keyword string to simplify translation.
632 (start_decl): Adjust diagnostics for static or thread_local variables
633 in immediate functions.
634 (grokfndecl): Call sorry_at on virtual consteval. Use %qs with keyword
635 to string to simplify translation. Diagnose consteval main. Use
636 SET_DECL_IMMEDIATE_FUNCTION_P for consteval.
637 (grokdeclarator): Handle consteval. Use %qs with keyword strings to
638 simplify translation. Use separate ifs instead of chained else if
639 for invalid specifiers. For constinit clear constinit_p rather than
641 * constexpr.c (find_immediate_fndecl): New function.
642 (cxx_eval_outermost_constant_expr): Allow consteval calls returning
643 void. Diagnose returning address of immediate function from consteval
645 (fold_non_dependent_expr_template): Add OBJECT argument, pass it
646 through to cxx_eval_outermost_constant_expr.
647 (fold_non_dependent_expr): Add OBJECT argument, pass it through to
648 fold_non_dependent_expr_template.
649 (fold_non_dependent_init): Adjust fold_non_dependent_expr_template
651 * method.c (defaulted_late_check): Adjust diagnostics for consteval.
652 * lambda.c (maybe_add_lambda_conv_op): Copy over
653 DECL_DECLARED_CONSTEXPR_P and DECL_IMMEDIATE_FUNCTION_P bits from
654 callop to both artificial functions.
655 * init.c (build_value_init): Don't do further processing if
656 build_special_member_call returned a TREE_CONSTANT. Formatting fix.
658 PR c++/91369 - Implement P0784R7: constexpr new
659 * cp-tree.h (CALL_FROM_NEW_OR_DELETE_P): Define.
660 * init.c (build_new_1, build_vec_delete_1, build_delete): Set
661 CALL_FROM_NEW_OR_DELETE_P on the CALL_EXPR to allocator functions.
662 * constexpr.c (is_std_allocator_allocate): Only allow
663 global replaceable allocator functions if CALL_FROM_NEW_OR_DELETE_P
664 or in std::allocate<T>::{,de}allocate.
665 (potential_constant_expression_1): Likewise.
667 2019-11-01 Nathan Sidwell <nathan@acm.org>
669 * class.c (check_field_decls): Refactor.
671 2019-10-31 Jakub Jelinek <jakub@redhat.com>
674 * cp-tree.h (type_initializer_zero_p): Declare.
675 * decl.c (reshape_init_array_1): Formatting fix.
676 * tree.c (type_initializer_zero_p): New function. Moved from
677 ../tree.c, use next_initializable_field, formatting fix. Return
678 false for TYPE_NON_AGGREGATE_CLASS types.
680 2019-10-30 Jason Merrill <jason@redhat.com>
682 PR c++/92268 - hard error satisfying return-type-requirement
683 * constraint.cc (type_deducible_p): Check for substitution failure.
684 (diagnose_compound_requirement): Adjust diagnostic.
685 * pt.c (do_auto_deduction): Don't pass cargs to
686 constraints_satisfied_p.
688 2019-10-30 Jakub Jelinek <jakub@redhat.com>
690 PR c++/91369 - Implement P0784R7: constexpr new
691 * constexpr.c (cxx_replaceable_global_alloc_fn): Don't return true
693 (cxx_placement_new_fn, is_std_construct_at): New functions.
694 (cxx_eval_call_expression): Allow placement new in std::construct_at.
695 (potential_constant_expression_1): Likewise.
697 * typeck.c (decl_in_std_namespace_p): Return true also for decls
698 in inline namespaces inside of std namespace.
700 2019-10-30 Bernd Edlinger <bernd.edlinger@hotmail.de>
703 * name-lookup.c (check_local_shadow): Shadowing TYPE_DECLs
704 is always a -Wshadow=compatible-local warning, unless
707 2019-10-30 Jason Merrill <jason@redhat.com>
709 * cxx-pretty-print.c (get_fold_operator): Use OVL_OP_INFO.
711 2019-10-30 Marek Polacek <polacek@redhat.com>
713 PR c++/92134 - constinit malfunction in static data member.
714 * decl2.c (grokfield): Set LOOKUP_CONSTINIT.
716 2019-10-30 Jakub Jelinek <jakub@redhat.com>
718 * cp-tree.h (omp_declare_variant_finalize, build_local_temp): Declare.
719 * decl.c: Include omp-general.h.
720 (declare_simd_adjust_this): Add forward declaration.
721 (omp_declare_variant_finalize_one, omp_declare_variant_finalize): New
723 (cp_finish_decl, finish_function): Call omp_declare_variant_finalize.
724 * parser.c (cp_finish_omp_declare_variant): Adjust parsing of the
725 variant id-expression and propagate enough information to
726 omp_declare_variant_finalize_one in the attribute so that it can
728 * class.c (finish_struct): Call omp_declare_variant_finalize.
729 * tree.c (build_local_temp): No longer static, remove forward
732 2019-10-30 Paolo Carlini <paolo.carlini@oracle.com>
734 * typeck.c (cp_build_modify_expr): Prefer error + inform to
735 error + error in one place.
736 (get_delta_difference_1): Likewise.
737 (get_delta_difference): Likewise, in two places.
739 2019-10-29 Paolo Carlini <paolo.carlini@oracle.com>
741 * typeck.c (build_x_unary_op): Use the location_t argument in
744 2019-10-29 Marek Polacek <polacek@redhat.com>
746 PR c++/90998 - ICE with copy elision in init by ctor and -Wconversion.
747 * call.c (joust): Don't attempt to warn if ->second_conv is null.
749 2019-10-29 Jakub Jelinek <jakub@redhat.com>
752 * cp-gimplify.c (cp_gimplify_expr): If gimplify_to_rvalue changes the
753 function pointer type, re-add cast to the original one.
755 2019-10-29 Marek Polacek <polacek@redhat.com>
757 PR c++/91548 - fix detecting modifying const objects for ARRAY_REF.
758 * constexpr.c (cxx_eval_store_expression): Don't call
759 modifying_const_object_p for ARRAY_REF.
761 2019-10-29 Richard Sandiford <richard.sandiford@arm.com>
763 * cp-objcp-common.h (cxx_simulate_enum_decl): Declare.
764 (LANG_HOOKS_SIMULATE_ENUM_DECL): Define to the above.
765 * decl.c (cxx_simulate_enum_decl): New function.
767 2019-10-29 Richard Sandiford <richard.sandiford@arm.com>
769 * cp-tree.h (cxx_simulate_builtin_function_decl): Declare.
770 * decl.c (cxx_simulate_builtin_function_decl): New function.
771 * cp-objcp-common.h (LANG_HOOKS_SIMULATE_BUILTIN_FUNCTION_DECL):
774 2019-10-28 Martin Sebor <msebor@redhat.com>
777 * cp-objcp-common.c (names_builtin_p): Define new function.
779 2019-10-28 Nathan Sidwell <nathan@acm.org>
781 * parser.h (struct cp_token): Drop {ENUM,BOOL}_BITFIELD C-ism.
782 Add tree_check_p flag, use as nested union discriminator.
783 (struct cp_lexer): Add saved_type & saved_keyword fields.
784 * parser.c (eof_token): Delete.
785 (cp_lexer_new_main): Always init last_token to last token of
787 (cp_lexer_new_from_tokens): Overlay EOF token at end of range.
788 (cp_lexer_destroy): Restore token under the EOF.
789 (cp_lexer_previous_token_position): No check for eof_token here.
790 (cp_lexer_get_preprocessor_token): Clear tree_check_p.
791 (cp_lexer_peek_nth_token): Check CPP_EOF not eof_token.
792 (cp_lexer_consume_token): Assert not CPP_EOF, no check for
794 (cp_lexer_purge_token): Likewise.
795 (cp_lexer_purge_tokens_after): No check for EOF token.
796 (cp_parser_nested_name_specifier, cp_parser_decltype)
797 (cp_parser_template_id): Set tree_check_p.
799 2019-10-24 Jakub Jelinek <jakub@redhat.com>
801 * decl2.c (cplus_decl_attributes): Add "omp declare target block"
802 attribute in between declare target and end declare target
805 * call.c (convert_arg_to_ellipsis): Add missing space in string
808 2019-10-24 Marek Polacek <polacek@redhat.com>
810 * decl.c (reshape_init_r): Add missing space.
812 2019-10-24 Nathan Sidwell <nathan@acm.org>
814 * pt.c (reduce_template_parm_level): Attach the new TPI to the new
816 (convert_generic_types_to_packs): Pass the copied type to
817 reduce_templatE_parm_level.
819 2019-10-23 Nathan Sidwell <nathan@acm.org>
821 * cp-tree.c (CPTI_STD_IDENTIFIER): Delete.
822 (std_identifier): Delete.
823 (DECL_NAME_SPACE_STD_P): Compare against std_node.
824 * decl.c (initialize_predefined_identifiers): 'std' is not needed.
825 (cxx_init_decl_processing): Adjust creation of ::std. Use
826 {push,pop}_nested_namespace.
827 (cxx_builtin_function): Use {push,pop}_nested_namespace.
828 * except.c (init_exception_processing): Likewise.
829 * rtti.c (init_rtti_processing): Likewise.
831 2019-10-23 Jason Merrill <jason@redhat.com>
833 Implement P1286R2, Contra CWG1778
834 * method.c (defaulted_late_check): Don't check explicit
835 exception-specification on defaulted function.
836 (after_nsdmi_defaulted_late_checks): Remove.
837 * parser.h (struct cp_unparsed_functions_entry): Remove classes.
838 * parser.c (unparsed_classes): Remove.
839 (push_unparsed_function_queues, cp_parser_class_specifier_1):
842 2019-10-23 Jakub Jelinek <jakub@redhat.com>
844 * constexpr.c (cxx_eval_constant_expression) <case CLEANUP_STMT>:
845 Temporarily change input_location to CLEANUP_STMT location.
847 2019-10-22 Jakub Jelinek <jakub@redhat.com>
849 PR tree-optimization/85887
850 * decl.c (expand_static_init): Drop ECF_LEAF from __cxa_guard_acquire
851 and __cxa_guard_release.
853 2019-10-22 Marc Glisse <marc.glisse@inria.fr>
856 * constexpr.c (cxx_eval_builtin_function_call): Only set
857 force_folding_builtin_constant_p if manifestly_const_eval.
859 2019-10-22 Richard Sandiford <richard.sandiford@arm.com>
861 * cp-tree.h (STF_USER_VISIBLE): New constant.
862 (strip_typedefs, strip_typedefs_expr): Take a flags argument.
863 * tree.c (strip_typedefs, strip_typedefs_expr): Likewise,
864 updating mutual calls accordingly. When STF_USER_VISIBLE is true,
865 only look through typedefs if user_facing_original_type_p.
866 * error.c (dump_template_bindings, type_to_string): Pass
867 STF_USER_VISIBLE to strip_typedefs.
868 (dump_type): Likewise, unless pp_c_flag_gnu_v3 is set.
870 2019-10-21 Kamlesh Kumar <kamleshbhalui@gmail.com>
871 Jason Merrill <jason@redhat.com>
873 PR c++/83534 - typeinfo of noexcept function
874 * rtti.c (get_tinfo_decl_dynamic): Do not call
875 TYPE_MAIN_VARIANT for function.
876 (get_typeid): Likewise.
878 2019-10-21 Paolo Carlini <paolo.carlini@oracle.com>
880 * parser.c (cp_parser_class_head): Improve error recovery upon
881 extra qualification error.
883 2019-10-21 Jakub Jelinek <jakub@redhat.com>
886 * constexpr.c (cxx_eval_component_reference, cxx_eval_bit_field_ref):
887 Use STRIP_ANY_LOCATION_WRAPPER on CONSTRUCTOR elts.
889 2019-10-21 Marek Polacek <polacek@redhat.com>
891 PR c++/92062 - ODR-use ignored for static member of class template.
892 * pt.c (has_value_dependent_address): Strip location wrappers.
894 2019-10-21 Marek Polacek <polacek@redhat.com>
896 PR c++/92106 - ICE with structured bindings and -Wreturn-local-addr.
897 * typeck.c (maybe_warn_about_returning_address_of_local): Avoid
898 recursing on null initializer and return false instead.
900 2019-10-17 JeanHeyd Meneide <phdofthehouse@gmail.com>
902 Implement p1301 [[nodiscard("should have a reason")]] + p1771 DR
903 * tree.c (handle_nodiscard_attribute): Handle C++2a nodiscard
905 (std_attribute_table) Increase nodiscard argument handling
906 max_length from 0 to 1.
907 * parser.c (cp_parser_check_std_attribute): Add requirement
908 that nodiscard only be seen once in attribute-list.
909 (cp_parser_std_attribute): Check that empty parenthesis lists are
910 not specified for attributes that have max_length > 0 (e.g.
912 * cvt.c (maybe_warn_nodiscard): Add nodiscard message to
913 output, if applicable.
914 (convert_to_void): Allow constructors to be nodiscard-able (P1771).
916 2019-10-18 Nathan Sidwell <nathan@acm.org>
918 * cp-tree.h (struct lang_type): Remove was_anonymous.
919 (TYPE_WAS_UNNAMED): Implement by checking TYPE_DECL &
921 * decl.c (name_unnamed_type): Don't set TYPE_WAS_UNNAMED.
923 2019-10-17 Paolo Carlini <paolo.carlini@oracle.com>
925 * decl.c (grokfndecl): Remove redundant use of in_system_header_at.
926 (compute_array_index_type_loc): Likewise.
927 (grokdeclarator): Likewise.
928 * error.c (cp_printer): Likewise.
929 * lambda.c (add_default_capture): Likewise.
930 * parser.c (cp_parser_primary_expression): Likewise.
931 (cp_parser_selection_statement): Likewise.
932 (cp_parser_toplevel_declaration): Likewise.
933 (cp_parser_enumerator_list): Likewise.
934 (cp_parser_using_declaration): Likewise.
935 (cp_parser_member_declaration): Likewise.
936 (cp_parser_exception_specification_opt): Likewise.
937 (cp_parser_std_attribute_spec): Likewise.
938 * pt.c (do_decl_instantiation): Likewise.
939 (do_type_instantiation): Likewise.
940 * typeck.c (cp_build_unary_op): Likewise.
942 * decl.c (check_tag_decl): Pass to in_system_header_at the same
943 location used for the permerror.
944 (grokdeclarator): Likewise.
946 * decl.c (check_tag_decl): Use locations[ds_typedef] in error_at.
948 2019-10-17 Jason Merrill <jason@redhat.com>
950 * cp-gimplify.c (cp_gimplify_expr): Use get_initialized_tmp_var.
951 (gimplify_to_rvalue): Remove default NULL argument.
953 2019-10-17 Nathan Sidwell <nathan@acm.org>
955 * decl.c (builtin_function_1): Merge into ...
956 (cxx_builtin_function): ... here. Nadger the decl before maybe
957 copying it. Set the context.
958 (cxx_builtin_function_ext_scope): Push to top level, then call
959 cxx_builtin_function.
961 2019-10-16 Luis Machado <luis.machado@linaro.org>
963 * cp-gimplify.c: Fix reference to non-existing tree-gimple.c file.
965 2019-10-16 Jakub Jelinek <jakub@redhat.com>
967 * decl.c (cxx_maybe_build_cleanup): When clearing location of cleanup,
968 if cleanup is a nop, clear location of its operand too.
970 2019-10-15 Andrew Sutton <asutton@lock3software.com>
972 Finish moving constraint and logic functionality of out pt.c.
973 Reimplement and re-enable subsumption caching.
975 * config-lang.in (gtfiles): Add logic.cc.
976 * constraint.cc (atomic_constraints_identical_p): Add assertions.
977 (hash_atomic_constraint): Likewise.
978 (constraints_equivalent_p): New.
979 (inchash::add_constraint): New.
980 (iterative_hash_constraint): New.
981 (decl_constraints): Moved from pt.c.
982 (get_constraints): Likewise.
983 (set_constraints): Likewise.
984 (remove_constraints): Likewise.
985 * cp-tree.h (CONSTR_P): New.
986 (init_constraint_processing): Remove.
987 (constraints_equivalent_p, iterative_hash_constraint): Declare.
988 * decl.c (cxx_init_decl_processing): Don't initialize constraints.
989 * logic.cc (subsumption_entry): Moved from pt.c.
990 (subsumption_hasher): Likewise.
991 (subsumption_cache): Likewise.
992 (lookup_subsumption): Likewise.
993 (save_subsumption): Likewise.
994 (subsumes_constraints_nonnull): Use subsumption cache.
995 * pt.c: Move aforementioned declarations out of this file.
996 (init_constraint_processing): Remove.
998 2019-10-15 Andrew Sutton <asutton@lock3software.com>
1000 * parser.c (cp_parser_constructor_declarator_p): Pass an empty
1001 decl-specifier-seq to make sure we parse type constraints as part
1002 of a type-specifier.
1004 2019-10-15 Nathan Sidwell <nathan@acm.org>
1006 * class.c (build_clones): Break out of clone_function_decl. Just
1008 (clone_function_decl): Call build_clones, then maybe add them to
1011 * class.c (build_clone): Refactor to clarify recursiveness.
1013 2019-10-14 Jason Merrill <jason@redhat.com>
1015 PR c++/91930 - ICE with constrained inherited default ctor.
1016 * name-lookup.c (do_class_using_decl): Set TYPE_HAS_USER_CONSTRUCTOR
1017 for inherited constructor.
1019 2019-10-14 Paolo Carlini <paolo.carlini@oracle.com>
1021 * decl.c (check_tag_decl): Use DECL_SOURCE_LOCATION.
1023 2019-10-14 Jakub Jelinek <jakub@redhat.com>
1026 * semantics.c (handle_omp_array_sections_1): Temporarily disable
1027 -fstrong-eval-order also for in_reduction and task_reduction clauses.
1029 * parser.c (cp_parser_omp_all_clauses): Change bool NESTED_P argument
1030 into int NESTED, if it is 2, diagnose missing commas in between
1032 (cp_parser_omp_context_selector): Pass 2 as last argument to
1033 cp_parser_omp_all_clauses.
1035 2019-10-12 Jakub Jelinek <jakub@redhat.com>
1037 * parser.c (cp_parser_omp_context_selector): Improve error recovery.
1038 For simd properties, put them directly into TREE_VALUE.
1039 (cp_finish_omp_declare_variant): Add "omp declare variant base"
1040 attribute rather than "omp declare variant".
1042 2019-10-11 Marek Polacek <polacek@redhat.com>
1044 PR c++/92049 - extra error with -fchecking=2.
1045 * pt.c (build_non_dependent_expr): Call fold_non_dependent_expr
1048 2019-10-11 Paolo Carlini <paolo.carlini@oracle.com>
1050 * typeck.c (cp_build_binary_op): Do not handle RROTATE_EXPR and
1052 * constexpr.c (cxx_eval_constant_expression): Likewise.
1053 (potential_constant_expression_1): Likewise.
1054 * pt.c (tsubst_copy): Likewise.
1056 2019-10-11 Jason Merrill <jason@redhat.com>
1058 * decl2.c (mark_used): Don't clobber DECL_SOURCE_LOCATION on
1059 explicitly defaulted functions.
1060 * method.c (synthesize_method): Likewise.
1062 2019-10-11 Jakub Jelinek <jakub@redhat.com>
1065 * decl2.c (grok_array_decl): For -fstrong-eval-order, when array ref
1066 operands have been swapped and at least one operand has side-effects,
1067 revert the swapping before calling build_array_ref.
1068 * typeck.c (cp_build_array_ref): For non-ARRAY_TYPE array ref with
1069 side-effects on the index operand, if -fstrong-eval-order use
1070 save_expr around the array operand.
1071 (cp_build_binary_op): For shifts with side-effects in the second
1072 operand, wrap first operand into SAVE_EXPR and evaluate it before
1074 * semantics.c (handle_omp_array_sections_1): Temporarily disable
1075 flag_strong_eval_order during OMP_CLAUSE_REDUCTION array section
1077 * cp-gimplify.c (gimplify_to_rvalue): New function.
1078 (cp_gimplify_expr): Use it.
1080 2019-10-10 Marek Polacek <polacek@redhat.com>
1082 * typeck.c (comp_ptr_ttypes_real): Change the return type to bool.
1083 Use false instead of 0.
1085 2019-10-10 Jakub Jelinek <jakub@redhat.com>
1087 * parser.h (struct cp_omp_declare_simd_data): Add variant_p member.
1088 * parser.c (cp_ensure_no_omp_declare_simd): Handle both declare simd
1089 and declare variant.
1090 (cp_parser_oacc_all_clauses): Formatting fix.
1091 (cp_parser_omp_all_clauses): Add NESTED_P argument, if true, terminate
1092 processing on closing paren and don't skip to end of pragma line.
1093 (cp_parser_omp_declare_simd): Add VARIANT_P argument. Handle also
1095 (omp_construct_selectors, omp_device_selectors,
1096 omp_implementation_selectors, omp_user_selectors): New variables.
1097 (cp_parser_omp_context_selector,
1098 cp_parser_omp_context_selector_specification,
1099 cp_finish_omp_declare_variant): New functions.
1100 (cp_parser_late_parsing_omp_declare_simd): Handle also declare variant.
1101 (cp_parser_omp_declare): Handle declare variant.
1103 2019-10-09 Jason Merrill <jason@redhat.com>
1105 * cp-tree.h (template_info_decl_check): Check ENABLE_TREE_CHECKING.
1107 2019-10-09 Marek Polacek <polacek@redhat.com>
1109 PR c++/91364 - P0388R4: Permit conversions to arrays of unknown bound.
1110 PR c++/69531 - DR 1307: Differently bounded array parameters.
1111 PR c++/88128 - DR 330: Qual convs and pointers to arrays of pointers.
1112 * call.c (build_array_conv): Build ck_identity at the beginning
1114 (standard_conversion): Pass bounds_none to comp_ptr_ttypes_const.
1115 (maybe_warn_array_conv): New.
1116 (convert_like_real): Call it. Add an error message about converting
1117 from arrays of unknown bounds.
1118 (conv_get_original_expr): New.
1119 (nelts_initialized_by_list_init): New.
1120 (conv_binds_to_array_of_unknown_bound): New.
1121 (compare_ics): Implement list-initialization ranking based on
1122 array sizes, as specified in DR 1307 and P0388R.
1123 * cp-tree.h (comp_ptr_ttypes_const): Adjust declaration.
1124 (compare_bounds_t): New enum.
1125 * typeck.c (comp_array_types): New bool and compare_bounds_t
1126 parameters. Use them.
1127 (structural_comptypes): Adjust the call to comp_array_types.
1128 (similar_type_p): Handle ARRAY_TYPE.
1129 (build_const_cast_1): Pass bounds_none to comp_ptr_ttypes_const.
1130 (comp_ptr_ttypes_real): Don't check cv-quals of ARRAY_TYPEs. Use
1131 comp_array_types to compare array types. Look through arrays as per
1133 (comp_ptr_ttypes_const): Use comp_array_types to compare array types.
1134 Look through arrays as per DR 330.
1136 2019-10-09 Marek Polacek <polacek@redhat.com>
1138 PR c++/92032 - DR 1601: Promotion of enum with fixed underlying type.
1139 * call.c (standard_conversion): When converting an enumeration with
1140 a fixed underlying type to the underlying type, give it the cr_promotion
1142 (compare_ics): Implement a tiebreaker as per CWG 1601.
1144 2019-10-08 Andrew Sutton <asutton@lock3software.com>
1145 Jason Merrill <jason@redhat.com>
1147 Update the concepts implementation to conform to the C++20
1148 specification, improve compile times, and generally clean up
1150 * call.c (build_new_function_call): Don't evaluate concepts here.
1151 (constraint_failure): Don't record the template.
1152 (print_z_candidate): Don't extract the template.
1153 * class.c (add_method): When overloading, hide ineligible special
1155 (check_methods): Set TYPE_HAS_COMPLEX_* here.
1156 * constexpr.c (cxx_eval_constant_expression): Evaluate concepts.
1157 (maybe_initialize_fundef_copies_table): Remove.
1158 (get_fundef_copy): Use hash_map_safe_get_or_insert.
1159 (clear_cv_and_fold_caches): Clear the satisfaction cache.
1160 * constraint.cc (known_non_bool_p): New.
1161 (parsing_constraint_expression_sentinel): Renamed from
1162 expanding_constraint_sentinel.
1163 (check_constraint_operands): New.
1164 (check_constraint_atom): New.
1165 (finish_constraint_binary_op): New.
1166 (finish_constraint_or_expr): Likewise.
1167 (finish_constraint_and_expr): Likewise.
1168 (finish_constraint_primary_expr): Likewise.
1169 (combine_constraint_expressions): New.
1170 (finish_requires_expr): Add location parm.
1171 (get_concept_definition): Return the initializer of concept definitions.
1172 (get_template_head_requirements): New.
1173 (get_trailing_function_requirements): New.
1174 (deduce_constrained_parameter): Check if the identifier or template-id
1175 is a concept definition.
1176 (resolve_concept_definition_check): Removed.
1177 (resolve_variable_concept_check): Removed.
1178 (resolve_concept_check): New.
1179 (resolve_constraint_check): Handle concept definitions.
1180 converting arguments.
1181 (function_concept_check_p): Removed.
1182 (variable_concept_check_p): Removed.
1183 (unpack_concept_check): New.
1184 (get_concept_check_template): New.
1185 (build_call_check): Moved and renamed to build_function_check.
1186 (build_concept_check_arguments): make static.
1187 (build_function_check): Always do overload resolution
1188 in order to force conversion of template arguments (i.e., actually
1189 check that the use of a concept is valid).
1190 (build_standard_check): Renamed from build_real_concept_check.
1191 (build_real_concept_check): Build checks for C++2a concepts by
1192 (build_wildcard_concept_check): New.
1193 (build_concept_check): Use build_real_concept_check. New overload.
1194 (build_constraints): Save expressions, not normalized constraints.
1195 (build_concept_id): New. Pass tf_warning_or_error.
1196 (build_type_constraint): New.
1197 (finish_type_constraints): New.
1198 (associate_classtype_constraints): Also add constraints to union
1199 types. Note the original declaration in errors. Don't return
1200 error_mark_node in order to avoid an assertion later.
1201 (push_down_pack_expansion): Remove.
1202 (finish_shorthand_constraint): Make fold expressions, not naked
1203 parameter packs. Always apply the constraint to each template argument.
1204 (check_introduction_list): New. Fail if not enough
1205 names are introduced.
1206 (finish_template_introduction): Don't normalize constraints. Pass
1207 tsubst flags. Check for insufficient introductions.
1208 (placeholder_extract_concept_and_args): Handle the template-id case.
1209 Unpack function concept checks correctly.
1210 (tsubst_simple_requirement): Return errors if they occur. Don't
1211 process as a template.
1212 (tsubst_type_requirement): Likewise.
1213 (type_deducible_p): New. Wrap the input expression in parens for the
1214 purpose of deduction.
1215 (expression_convertible_t): New.
1216 (tsubst_compound_requirement): Use new deduction, conversion predicates.
1217 (tsubst_nested_requirement): Return errors if they occur. Don't
1218 process as a template. Instantiate and evaluate the nested requirement.
1219 (tsubst_valid_expression_requirement): New.
1220 (tsubst_simple_requirement): Use tsubst_valid_expression_requirement.
1221 (tsubst_compound_requirement): Use tsubst_valid_expression_requirement.
1222 (check_constaint_variables): New.
1223 (tsubst_constraint_variables): Check that type substitutions are valid.
1224 (tsubst_requires_expr): Likewise. Produce new requires-exprs during
1225 template substitution. Copy the previous local specialization stack,
1226 so references to non-local parameters can be found. Use cp_unevaluated.
1227 (tsubst_constraint): New. Don't evaluate concept checks.
1229 (norm_info): New. Used to build a normalization tree for concept check
1231 (debug_parameter_mapping): New.
1232 (debug_argument_list): New.
1233 (expand_concept): Removed.
1234 (normalize_logical_operation): Pass subst_info through call.
1235 (normalize_pack_expansion): Remove.
1236 (normalize_simple_requirement): Removed
1237 (normalize_type_requirement): Removed
1238 (normalize_compound_requirement): Removed
1239 (normalize_nested_requirement): Removed
1240 (normalize_requirement): Removed
1241 (normalize_requirements): Removed
1242 (normalize_requires_expression): Removed
1243 (normalize_variable_concept_check): Removed.
1244 (normalize_function_concept_check): Removed.
1245 (normalize_concept_check): Merged all normalize_*_check here.
1246 Substitute through written template arguments before normalizing the
1247 definition. Only substitute the innermost template arguments.
1248 (check_for_logical_overloads): Delete.
1249 (map_arguments): New. Associate template parameters with arguments.
1250 (build_parameter_mapping): New. Extract used parameters.
1251 (normalize_expression): Rewrite.
1252 (normalize_conjunction): Removed
1253 (normalize_disjunction): Removed
1254 (normalize_predicate_constraint): Removed
1255 (normalize_parameterized_constraint): Removed
1256 (normalized_map): New variable.
1257 (get_normalized_constraints): New entry point for normalization.
1258 Establishes a timer.
1259 (get_normalized_constraints_from_info): New.
1260 (get_normalized_constraints_from_decl): New. Turn on template processing
1261 prior to normalization. Handle inheriting ctors. Build the
1262 normalization arguments from the full set of template parameters of the
1263 most general template. This guarantees that we have no concrete arguments
1264 in the parameter mapping (e.g., from template members of class
1265 templates). Cache normalizations.
1266 (normalize_concept_definition): New. Cache normalizations.
1267 (normalize_template_requirements): New.
1268 (normalize_nontemplate_requirements): New.
1269 (normalize_constraint_expression): New.
1270 (tsubst_parameter_mapping): New.
1271 (get_mapped_args): New.
1272 (parameter_mapping_equivalent_p): New. Use template_args_equal.
1273 (atomic_constraints_identical_p): New.
1274 (hash_atomic_constraint): New.
1275 (satisfying_constraint_p): New. Guard against recursive evaluation of
1276 constraints during satisfaction.
1277 (satisfy_conjunction): New.
1278 (satisfy_disjunction): New.
1279 (sat_entry): New class for hashing satisfaction results.
1280 (sat_hasher): New hash traits.
1282 (get_satisfaction): New. Returns cached satisfaction result.
1283 (save_satisfaction): New. Caches a satisfaction result.
1284 (clear_satisfaction_cache): New.
1285 (satisfaction_cache): New. Helps manage satisfaction cache requests.
1286 (decl_satisfied_cache): New.
1287 (satisfy_atom): New.
1288 (satisfy_constraint_r): New.
1289 (satisfy_constraint): Use new satisfaction algorithm.
1290 (evaluate_concept_check): New.
1291 (evaluate_concept): Removed.
1292 (evaluate_function_concept): Removed.
1293 (evaluate_variable_concept): Removed.
1294 (satisfy_constraint_expression): New.
1295 (constraint_expression_satisfied_p): New.
1296 (constraints_satisfied_p): Use strip_inheriting_ctors. Use
1297 push_/pop_access_scope.
1298 (more_constrained): Normalize before calling out to subsumption. Allow
1299 classes as arguments.
1300 (strictly_subsumes): Allow non-templates as arguments. Accept a new
1302 (weakly_subsumes): New.
1303 (at_least_as_constrained): Removed.
1304 (diagnose_other_expression): Removed.
1305 (diagnose_predicate_constraint): Removed.
1306 (diagnose_pack_expansion): Removed.
1307 (diagnose_check_constraint): Removed.
1308 (diagnose_logical_constraint): Removed.
1309 (diagnose_expression_constraint): Removed.
1310 (diagnose_type_constraint): Removed.
1311 (diagnose_implicit_conversion_constraint): Removed.
1312 (diagnose_argument_deduction_constraint): Removed.
1313 (diagnose_exception_constraint): Removed.
1314 (diagnose_parameterized_constraint): Removed.
1315 (diagnose_argument_deduction_constraint): Removed.
1316 (diagnose_argument_deduction_constraint): Removed.
1317 (diagnose_argument_deduction_constraint): Removed.
1318 (diagnose_trait_expr): New.
1319 (diagnose_requires_expr): New.
1320 (diagnose_atomic_constraint): New.
1321 (diagnose_valid_expression) Stop wrongly diagnosing valid expressions.
1322 Don't substitute as if in template decls. This causes substitution
1323 to generate expressions that aren't suitable for use with the noexcept
1325 (diagnose_valid_type) Likewise.
1326 (diagnose_compound_requirement) Actually emit diagnostics for
1327 the causes of errors.Call force_paren_expr_uneval.
1328 (diagnose_declaration_constraints): Turn on template processing to
1329 suppress certain analyses.
1330 * cp-objcp-common.c (cp_common_init_ts): Make concepts typed.
1331 (cp_get_debug_type): Use hash_map_safe_*.
1332 * cp-tree.h: New function declarations for semantic actions, other
1333 facilities. Remove declaration no longer used or needed. Remove
1334 unused _CONSTR macros.
1335 (LANG_DECL_HAS_MIN): Add CONCEPT_DECL.
1336 (template_info_decl_check): Factor macro check into an inline function.
1337 (DECL_TEMPLATE_INFO): Use new check facility.
1338 (finish_concept_definition): New. Don't invalid concept declarations
1339 with invalid initializers.
1340 (find_template_parameters): New.
1341 (concept_definition_p): New.
1342 (concept_check_p): New.
1343 (variable_concept_check_p): New.
1344 (force_paren_expr_uneval): New.
1345 (ovl_iterator::using_p): A USING_DECL by itself was also
1346 introduced by a using-declaration.
1347 (struct tree_template_info): Use tree_base instead of
1348 tree_common. Add tmpl and args fields.
1349 (TI_TEMPLATE, TI_ARGS): Adjust.
1350 (DECLTYPE_FOR_INIT_CAPTURE): Remove.
1351 (CONSTR_CHECK, CONSTR_INFO, CONSTR_EXPR, CONSTR_CONTEXT): New.
1352 (ATOMIC_CONSTR_MAP, TRAIT_EXPR_LOCATION): New.
1353 (struct tree_trait_expr): Add locus field.
1354 (enum tsubst_flags): Add tf_norm as a hint to generate normalization
1355 context when diagnosing constraint failure.
1356 * cp-tree.def: Remove unused _CONSTR nodes and rename PRED_CONSTR
1358 (CONCEPT_DECL): New.
1359 * cxx-pretty-print.c: Remove constraint printing code.
1360 (pp_cxx_concept_definition): New.
1361 (pp_cxx_template_declaration): Print concept definitions.
1362 (pp_cxx_check_constraint): Update printing for concept definitions.
1363 (pp_cxx_nested_name_specifier): Fix a weird
1364 case where we're printing '::::' for concepts.
1365 (simple_type_specifier): Print requirements for placeholder types.
1366 (pp_cxx_constrained_type_spec): Print the associated requirements of
1368 (pp_cxx_compound_requirement): Add space before the '->'.
1369 (pp_cxx_parameter_mapping): Print the parameter mapping.
1370 (pp_cxx_atomic_constraint): Use the function above.
1371 * decl.c (redeclaration_error_message): New error for concepts.
1372 (grokdeclarator): Check for and disallow decltype(auto) in parameter
1374 (grokfndecl): Don't normalize constraints. Add check for constraints
1376 (grokvardecl): Don't normalize constraints.
1377 (grok_special_member_properties): Don't set TYPE_HAS_COMPLEX_*.
1378 (function_requirements_equivalent_p): New. Compare trailing
1379 requires clauses. Compare combined constraints in pre-C++20 mode.
1380 (decls_match): Compare trailing requires clauses. Compare template
1381 heads for function templates. Remove old constraint comparison.
1382 Simplify comparison of functions, function templates.
1383 (duplicate_function_template_decls): New. Refactor a nasty if
1384 condition into a single predicate.
1385 (require_deduced_type): Don't complain if we already complained about
1387 (finish_function): Perform auto deduction to ensure that constraints
1388 are checked even when functions contain no return statements. Only do
1389 auto deduction if we haven't previously seen any return statements.
1390 This prevents multiple diagnostics of the same error.
1391 (store_decomp_type): Remove.
1392 (cp_finish_decomp): Use hash_map_safe_put.
1393 * error.c: Remove constraint printing code.
1394 (dump_decl): Dump concept definitions. Handle wildcard declarations.
1395 (dump_template_decl): Likewise.
1396 (dump_type): Print associated requirements for placeholder
1398 (rebuild_concept_check): New.
1399 (maybe_print_single_constraint_context): New.
1400 (maybe_print_constraint_context): Recursively print nested contexts.
1401 * init.c (get_nsdmi): Use hash_map_safe_*.
1402 * lambda.c (maybe_add_lambda_conv_op): Bail if deduction failed.
1403 (add_capture): Copy parameter packs from init.
1404 (lambda_capture_field_type): Always use auto for init-capture.
1405 * logic.cc: Completely rewrite.
1406 (constraint_hash): New.
1407 (clause/ctor): Save atoms in the hash table.
1408 (replace): Save atoms during replacement.
1409 (insert): Save atoms during insertion.
1410 (contains): Only search the hash table for containment.
1411 (clause): Keep a hash of atomic constraints.
1412 (clause::clause): Explicitly copy the hash table when copying.
1413 (disjunction_p, conjunction_p, atomic_p, dnf_size, cnf_size): New.
1414 (diagnose_constraint_size): New.
1415 (subsumes_constraints_nonnull): Compare the sizes of normalized formula
1416 to determine the cheapest decomposition.
1417 * name-lookup.c (diagnose_name_conflict): Diagnose name issues with
1419 (matching_fn_p): Check constraints.
1420 (push_class_level_binding_1): Move overloaded functions case down,
1421 accept FUNCTION_DECL as target_decl.
1422 * parser.c (enum required_token): New required token for auto.
1423 (make_location): Add overload taking lexer as last parm.
1424 (cp_parser_required_error): Diagnose missing auto.
1425 (cp_parser_diagnose_ungrouped_constraint_plain): New.
1426 (cp_parser_diagnose_ungrouped_constraint_plain): New.
1427 (cp_parser_constraint_primary_expression): New. Tentatively parse the
1428 primary expression. If that fails tentatively parse a lower
1429 precedence expression in order to diagnose the error.
1430 (cp_parser_check_non_logical_constraint): New. Performs a trial
1431 parse of the right-hand-side of non-logical operators in order to
1432 generate good diagnostics.
1433 (cp_parser_constraint_logical_and_expression): New.
1434 (cp_parser_constraint_logical_or_expression): New.
1435 (cp_parser_requires_clause_expression): New.
1436 (cp_parser_requires_clause): Renamed to cp_parser_constraint_expression.
1437 (cp_parser_requires_clause_opt): Parse the requires-clause differently
1438 in -fconcepts and -std=c++2a modes.
1439 (cp_parser_requirement_list): Rename to cp_parser_requirement_seq.
1440 Rewrite so that semicolons are parsed
1441 along with requirements, not the sequence.
1442 (cp_parser_simple_requirement): Expect a semicolon at end.
1443 (cp_parser_compound_requirement): Expect a semicolon at end. Only
1444 allow trailing-return-type with -fconcepts-ts.
1445 (cp_parser_nested_requirement): Expect a semicolon at end. Parse
1446 constraint-expressions.
1447 (cp_parser_concept_definition): New. Don't fail parsing the concept
1448 definition if the initializer is ill-formed. Don't declare the concept
1449 before parsing the initializer.
1450 (cp_parser_constraint_expression): Declare earlier.
1451 (cp_parser_type_requirement): Current scope is not valid.
1452 (cp_parser_requires_expression): Commit to the tentative parse.
1453 (cp_parser_decl_specifier_seq): Warn when concept appears to be used
1454 as a decl-specifier.
1455 (cp_parser_template_declaration_after_parameters): Parse concept
1457 (cp_parser_template_id): Don't try to resolve a concept template-id yet.
1458 (cp_parser_template_id_expr): Resolve it as a concept check.
1459 (cp_parser_decl_specifier_seq): Warn on 'concept bool'.
1460 (cp_parser_type_parameter): Combine expressions not
1462 (cp_parser_explicit_template_declaration): Combine expressions not
1464 (cp_parser_maybe_concept_name): Removed.
1465 (cp_parser_simple_type_specifier): Handle an error condition of
1466 a bad constrained type specifier. Expect auto or decltype after
1467 a concept name. Also handle the case where we have a template-id
1469 (cp_parser_template_introduction): Diagnose errors on invalid
1470 introductions. Give up if it doesn't start with a concept name.
1471 Pedwarn if not -fconcepts-ts.
1472 (synthesize_implicit_template_parm): Don't do consistent binding.
1473 Use a new flag for constrained parameters. Combine expressions,
1474 not constraints. Fail if we get a placeholder in block scope.
1475 Placeholders that do not constrain types are not allowed in parameter
1476 declarations, so don't handle them.
1477 (cp_parser_placeholder_type_specifier): New. Implement parsing of
1478 placeholder type specifiers following a concept name or partial
1479 concept check. Disallow decltype(auto) parameters.
1480 (cp_parser_nested_name_specifier_opt): If the token is already
1481 CPP_NESTED_NAME_SPECIFIER, leave it alone.
1482 (cp_parser_id_expression, cp_parser_unqualified_id): Call
1483 cp_parser_template_id_expr.
1484 (cp_parser_placeholder_type_specifier): Add tentative parm. Don't
1485 expect a WILDCARD_DECL.
1486 (cp_parser_trait_expr): Pass trait_loc down.
1487 (cp_parser_postfix_expression): Do set location of dependent member
1489 * pt.c (finish_concept_definition): New.
1490 (push_template_decl_real): Handle concept definitions.
1491 (start_concept_definition): Let push_template_decl_real handle the
1492 creation of the template.
1493 (get_constraints): Return null if the table hasn't been initialized.
1494 (tsubst_copy_and_build): Build template-id expressions for concept
1496 [TRAIT_EXPR]: Pass trait_loc down.
1497 (lookup_template_class_1): Add the template name to the constraint
1499 (lookup_and_finish_template_variable): Build concept checks
1500 with the correct arguments.
1501 (tsubst_function_decl): Don't substitute through constraints.
1502 Always associate constraints with functions.
1503 (template_parm_level_and_index): Make non-static.
1504 (for_each_template_parm_r): Handle requires expressions.
1505 (keep_template_parm): New.
1506 (find_template_parameters): New.
1507 (more_specialized_fn): Change how winners and losers are chosen.
1508 (make_constrained_auto): Don't normalize constraints.
1509 (template_parameters_equivalent_p): New. Compare template
1510 parameters. Add a comparison for implicitly vs. explicitly declared
1512 (template_parameter_lists_equivalent_p): New. Compare template
1514 (template_requirements_equivalent_p): New.
1515 (template_heads_equivalent_p): New. Compare template heads.
1516 (template_parameter_constraints_equivalent_p): New.
1517 (is_compatible_template_arg): Use weakly_subsumes.
1518 (maybe_new_partial_specialization): Use new constraint comparison
1519 for finding specializations.
1520 (process_partial_specialization): Pass main template as argument.
1521 (more_specialized_partial_spec): Don't immediately return when
1523 (make_constrained_auto): Handle concept definitions.
1524 (do_auto_deduction): Update auto deduction for new concept model.
1525 Extract the function concept correctly; rename constr to check to
1526 reflect the kind of node.
1527 (tsubst): Adjust wildcard argument during substitution.
1528 [DECLTYPE_TYPE]: Remove init-capture handling.
1529 (tsubst_copy_and_build): Build concept checks, not template ids.
1530 Defer checks of function concepts. Handle concepts before variable
1531 templates. Handle calls to function concepts explicitly.
1532 (coerce_template_parms): Use concept_definition_p. Handle a deduction
1533 error where a potentially empty pack can be supplied after the last
1534 parameter of a concept.
1535 (finish_template_variable): Don't process concepts here.
1536 (instantiation_dependent_r): Use concept_check_p.
1537 (tsubst_template_args): Make non-static.
1538 (make_constrained_placeholder_type): New. Refactored from
1539 make_constrained_auto.
1540 (make_constrained_auto) Use make_constrained_placeholder_type.
1541 (make_constrained_decltype_auto) New.
1542 (tsubst_function_parms): New.
1543 (value_dependent_expression_p) [TEMPLATE_ID_EXPR]: Use
1544 concept_definition_p.
1545 (push_access_scope, pop_access_scope): No longer static.
1546 (tsubst_template_parm): Substitute TEMPLATE_PARM_CONSTRAINTS.
1547 (tsubst_friend_function): Use tsubst_constraint. Use generic_targs_for.
1548 (get_underlying_template) Use generic_targs_for.
1549 (uses_parameter_packs): Return tree.
1550 (gen_elem_of_pack_expansion_instantiation): Don't push
1551 local_specialization_stack.
1552 (prepend_one_capture): New.
1553 (tsubst_lambda_expr): Use prepend_one_capture. Don't touch
1554 local_specializations.
1555 (template_parms_level_to_args): No longer static.
1556 (add_outermost_template_args): Likewise.
1557 (find_template_parameter_info): New. Provide context for finding
1558 template parameters.
1559 (keep_template_parm): Don't keep parameters declared at depth levels
1560 greater than those of the template parameters of the source declaration.
1561 Don't propagate cv-qualified types. Return 0, so we find all template
1562 parameters, not the just first.
1563 (any_template_parm_r): New. Handle cases that are mishandled by
1564 for_each_template_parm_r.
1565 (generic_targs_for): Factor out of coerce_template_args_for_ttp.
1566 (tsubst_argument_pack): Factor out of tsubst_template_args.
1567 (constraint_sat_entry): Removed.
1568 (constraint_sat_hasher): Removed.
1569 (concept_spec_entry): Removed.
1570 (concept_spec_hasher): Removed.
1571 (constraint_memos): Removed.
1572 (concept_memos): Removed.
1573 (lookup_constraint_satisfaction): Removed.
1574 (memoize_constraint_satisfaction): Removed.
1575 (lookup_concept_satisfaction): Removed.
1576 (memoize_concept_satisfaction): Removed.
1577 (concept_expansions): Removed.
1578 (get_concept_expansion): Removed.
1579 (save_concept_expansion): Removed.
1580 (init_constraint_processing): Remove initialization of non-existing
1582 (find_template_requirement): New. Search for the sub-requirement
1583 within the associated constraints.
1584 (convert_generic_types_to_packs): Also transform the associated
1585 constraint and update the current template requirements.
1586 (store_defaulted_ttp, lookup_defaulted_ttp): Remove.
1587 (add_defaults_to_ttp): Use hash_map_safe_*.
1588 * semantics.c (finish_call_expr): Diagnose calls to concepts.
1589 Handle concept checks explicitly.
1590 (finish_id_expression): Evaluate variable concepts as part of
1591 id-expression processing. Don't treat variable concepts as variables,
1592 and don't process function concepts as plain id-expressions.
1593 (force_paren_expr): Add even_uneval parm.
1594 (finish_trait_expr): Add location parm.
1595 * tree.c (special_memfn_p): New.
1596 (cp_expr_location): Handle TRAIT_EXPR.
1597 * typeck.c (check_return_expr): Actually use the diagnostic kind
1598 when performing return-type deduction.
1599 * typeck2.c (build_functional_cast): Don't rely on the location of
1602 2019-10-09 Paolo Carlini <paolo.carlini@oracle.com>
1604 * decl.c (grok_ctor_properties): Use DECL_SOURCE_LOCATION.
1605 * typeck.c (cp_build_binary_op): Use the op_location_t argument
1606 in many error messages.
1608 2019-10-08 Martin Sebor <msebor@redhat.com>
1611 * call.c (maybe_warn_class_memaccess): Handle arrays.
1613 2019-10-07 Paolo Carlini <paolo.carlini@oracle.com>
1615 * call.c (resolve_args): Use cp_expr_loc_or_input_loc in one place.
1616 * decl.c (grokdeclarator): Use id_loc in one place.
1617 * decl2.c (build_anon_union_vars): Use DECL_SOURCE_LOCATION.
1618 * parser.c (cp_parser_delete_expression): Fix the location of the
1619 returned expression.
1620 (cp_parser_throw_expression): Likewise.
1621 * pt.c (determine_specialization): Use DECL_SOURCE_LOCATION.
1623 2019-10-05 Jakub Jelinek <jakub@redhat.com>
1625 PR c++/91369 - Implement P0784R7: constexpr new
1626 * cp-tree.h (enum cp_tree_index): Add CPTI_HEAP_UNINIT_IDENTIFIER,
1627 CPTI_HEAP_IDENTIFIER and CPTI_HEAP_DELETED_IDENTIFIER.
1628 (heap_uninit_identifier, heap_identifier, heap_deleted_identifier):
1630 (type_has_constexpr_destructor, build_new_constexpr_heap_type,
1631 cxx_constant_dtor): Declare.
1632 * class.c (type_maybe_constexpr_default_constructor): Make static.
1633 (type_maybe_constexpr_destructor, type_has_constexpr_destructor): New
1635 (finalize_literal_type_property): For c++2a, don't clear
1636 CLASSTYPE_LITERAL_P for types without trivial destructors unless they
1637 have non-constexpr destructors.
1638 (explain_non_literal_class): For c++2a, complain about non-constexpr
1639 destructors rather than about non-trivial destructors.
1640 * constexpr.c: Include stor-layout.h.
1641 (struct constexpr_global_ctx): New type.
1642 (struct constexpr_ctx): Add global field, remove values and
1643 constexpr_ops_count.
1644 (cxx_replaceable_global_alloc_fn): New inline function.
1645 (cxx_eval_call_expression): For c++2a allow calls to replaceable
1646 global allocation functions, for new return address of a heap uninit
1647 var, for delete record its deletion. Change ctx->values->{get,put} to
1648 ctx->global->values.{get,put}.
1649 (non_const_var_error): Add auto_diagnostic_group sentinel. Emit
1650 special diagnostics for heap variables.
1651 (cxx_eval_store_expression): Change ctx->values->{get,put} to
1652 ctx->global->values.{get,put}.
1653 (cxx_eval_loop_expr): Initialize jump_target if NULL. Change
1654 new_ctx.values->remove to ctx->global->values.remove.
1655 (cxx_eval_constant_expression): Change *ctx->constexpr_ops_count
1656 to ctx->global->constexpr_ops_count. Change ctx->values->{get,put} to
1657 ctx->global->values.{get,put}.
1658 <case NOP_EXPR>: Formatting fix. On cast of replaceable global
1659 allocation function to some pointer type, adjust the type of
1660 the heap variable and change name from heap_uninit_identifier
1662 (find_heap_var_refs): New function.
1663 (cxx_eval_outermost_constant_expr): Add constexpr_dtor argument,
1664 handle evaluation of constexpr dtors and add tracking of heap
1665 variables. Use tf_no_cleanup for get_target_expr_with_sfinae.
1666 (cxx_constant_value): Adjust cxx_eval_outermost_constant_expr caller.
1667 (cxx_constant_dtor): New function.
1668 (maybe_constant_value, fold_non_dependent_expr_template,
1669 maybe_constant_init_1): Adjust cxx_eval_outermost_constant_expr
1671 (potential_constant_expression_1): Ignore clobbers. Allow
1672 COND_EXPR_IS_VEC_DELETE for c++2a.
1673 * decl.c (initialize_predefined_identifiers): Add heap identifiers.
1674 (decl_maybe_constant_destruction): New function.
1675 (cp_finish_decl): Don't clear TREE_READONLY for constexpr variables
1676 with non-trivial, but constexpr destructors.
1677 (register_dtor_fn): For constexpr variables with constexpr non-trivial
1678 destructors call cxx_maybe_build_cleanup instead of adding destructor
1680 (expand_static_init): For constexpr variables with constexpr
1681 non-trivial destructors call cxx_maybe_build_cleanup.
1682 (grokdeclarator): Allow constexpr destructors for c++2a. Formatting
1684 (cxx_maybe_build_cleanup): For constexpr variables with constexpr
1685 non-trivial destructors call cxx_constant_dtor instead of adding
1686 destructor calls at runtime.
1687 * init.c: Include stor-layout.h.
1688 (build_new_constexpr_heap_type, maybe_wrap_new_for_constexpr): New
1690 (build_new_1): For c++2a and new[], add cast around the alloc call
1691 to help constexpr evaluation figure out the type of the heap storage.
1692 (build_vec_delete_1): Set DECL_INITIAL of tbase and emit a DECL_EXPR
1693 for it instead of initializing an uninitialized variable.
1694 * method.c: Include intl.h.
1695 (SFK_CTOR_P, SFK_DTOR_P, SFK_ASSIGN_P, SFK_COPY_P, SFK_MOVE_P): Move
1696 definitions earlier.
1697 (process_subob_fn): Add sfk argument, adjust non-constexpr call
1698 diagnostics based on it.
1699 (walk_field_subobs): Formatting fixes. Adjust process_subob_fn caller.
1700 (synthesized_method_base_walk): Likewise.
1701 (synthesized_method_walk): Set *constexpr_p to true for dtors in c++2a.
1702 Fix up DR number in comment.
1703 (implicitly_declare_fn): Formatting fix.
1704 * typeck2.c (store_init_value): Don't call cp_fully_fold_init on
1705 initializers of automatic non-constexpr variables in constexpr
1708 2019-10-04 Jakub Jelinek <jakub@redhat.com>
1711 * constexpr.c (cxx_fold_indirect_ref_1): New function.
1712 (cxx_fold_indirect_ref): Use it.
1715 * cp-gimplify.c (cp_gimplify_expr) <case CALL_EXPR>: For
1716 -fstrong-eval-order ensure CALL_EXPR_FN side-effects are evaluated
1717 before any arguments. Additionally, ensure CALL_EXPR_FN that isn't
1718 invariant nor OBJ_TYPE_REF nor SSA_NAME is forced into a temporary.
1720 2019-10-03 Paolo Carlini <paolo.carlini@oracle.com>
1722 * init.c (build_new): Use cp_expr_loc_or_input_loc in two places.
1723 * name-lookup.c (do_pushdecl): Use DECL_SOURCE_LOCATION.
1724 (push_class_level_binding_1): Likewise.
1725 (set_decl_namespace): Likewise.
1727 2019-10-03 Jakub Jelinek <jakub@redhat.com>
1729 * constexpr.c (cxx_eval_constant_expression) <case CLEANUP_STMT>: If
1730 not skipping upon entry to body, run cleanup with the same *jump_target
1731 as it started to run the cleanup even if the body returns, breaks or
1733 (potential_constant_expression_1): Allow CLEANUP_STMT.
1735 * constexpr.c (cxx_eval_store_expression): Formatting fix. Handle
1736 const_object_being_modified with array type.
1738 2019-10-02 Jason Merrill <jason@redhat.com>
1740 * typeck2.c (store_init_value): Only clear_cv_and_fold_caches if the
1743 2019-09-30 Jason Merrill <jason@redhat.com>
1745 Use hash_map_safe_* functions.
1746 * constexpr.c (maybe_initialize_fundef_copies_table): Remove.
1747 (get_fundef_copy): Use hash_map_safe_get_or_insert.
1748 * cp-objcp-common.c (cp_get_debug_type): Use hash_map_safe_*.
1749 * decl.c (store_decomp_type): Remove.
1750 (cp_finish_decomp): Use hash_map_safe_put.
1751 * init.c (get_nsdmi): Use hash_map_safe_*.
1752 * pt.c (store_defaulted_ttp, lookup_defaulted_ttp): Remove.
1753 (add_defaults_to_ttp): Use hash_map_safe_*.
1755 2019-10-02 Richard Biener <rguenther@suse.de>
1758 * decl.c (build_ptrmemfunc_type): Mark pointer-to-member
1759 fat pointer structure members as DECL_NONADDRESSABLE_P.
1761 2019-09-28 Marek Polacek <polacek@redhat.com>
1763 PR c++/91889 - follow-up fix for DR 2352.
1764 * call.c (involves_qualification_conversion_p): New function.
1765 (direct_reference_binding): Build a ck_qual if the conversion
1766 would involve a qualification conversion.
1767 (convert_like_real): Strip the conversion created by the ck_qual
1768 in direct_reference_binding.
1770 PR c++/91921 - stray warning with -Woverloaded-virtual.
1771 * class.c (warn_hidden): Only emit the second part of
1772 -Woverloaded-virtual if the first part was issued. Use inform instead
1775 PR c++/91923 - failure-to-SFINAE with class type NTTP in C++17.
1776 * pt.c (invalid_nontype_parm_type_p): Only emit errors when
1779 2019-09-27 Jakub Jelinek <jakub@redhat.com>
1782 * parser.c (cp_parser_omp_var_list_no_open): Parse predefined
1784 * semantics.c (finish_omp_clauses): Allow predefined variables in
1785 shared and firstprivate clauses, even when they are predetermined
1787 * cp-gimplify.c (cxx_omp_predetermined_sharing_1): Return
1788 OMP_CLAUSE_DEFAULT_SHARED for predefined variables.
1790 2019-09-27 Jason Merrill <jason@redhat.com>
1792 * constexpr.c (cxx_fold_indirect_ref): Use similar_type_p.
1793 (cxx_eval_indirect_ref): Likewise. Improve error location.
1795 * cp-tree.h (class iloc_sentinel): New.
1796 * decl.c (grokdeclarator, finish_enum_value_list): Use it.
1797 * mangle.c (mangle_decl_string): Use it.
1798 * pt.c (perform_typedefs_access_check): Use it.
1800 2019-09-27 Richard Sandiford <richard.sandiford@arm.com>
1802 * cp-tree.h (build_cxx_call): Take the original function decl
1803 as an optional final parameter.
1804 (cp_build_function_call_vec): Likewise.
1805 * call.c (build_cxx_call): Likewise. Pass all built-in calls to
1806 check_builtin_function_arguments.
1807 * typeck.c (build_function_call_vec): Take the original function
1808 decl as an optional final parameter and pass it to
1809 cp_build_function_call_vec.
1810 (cp_build_function_call_vec): Take the original function
1811 decl as an optional final parameter and pass it to build_cxx_call.
1813 2019-09-25 Marek Polacek <polacek@redhat.com>
1815 PR c++/91877 - ICE with converting member of packed struct.
1816 * call.c (convert_like_real): Use similar_type_p in an assert.
1818 2019-09-25 Paolo Carlini <paolo.carlini@oracle.com>
1820 * name-lookup.c (check_extern_c_conflict): Use DECL_SOURCE_LOCATION.
1821 (check_local_shadow): Use it in three additional places.
1823 2019-09-24 Jason Merrill <jason@redhat.com>
1825 * parser.c (cp_parser_postfix_expression): Do set location of
1826 dependent member call.
1828 2019-09-24 Marek Polacek <polacek@redhat.com>
1830 PR c++/91868 - improve -Wshadow location.
1831 * name-lookup.c (check_local_shadow): Use DECL_SOURCE_LOCATION
1832 instead of input_location.
1834 PR c++/91845 - ICE with invalid pointer-to-member.
1835 * expr.c (mark_use): Use error_operand_p.
1836 * typeck2.c (build_m_component_ref): Check error_operand_p after
1837 calling mark_[lr]value_use.
1839 2019-09-23 Paolo Carlini <paolo.carlini@oracle.com>
1841 * pt.c (check_explicit_specialization): Use cp_expr_loc_or_input_loc.
1842 (process_partial_specialization): Likewise.
1843 (convert_nontype_argument_function): Likewise.
1844 (invalid_tparm_referent_p): Likewise.
1845 (convert_template_argument): Likewise.
1846 (check_valid_ptrmem_cst_expr): Tidy.
1848 2019-09-23 Jason Merrill <jason@redhat.com>
1850 PR c++/91809 - bit-field and ellipsis.
1851 * call.c (convert_arg_to_ellipsis): Don't call decay_conversion for
1852 arithmetic arguments.
1854 2019-09-23 Marek Polacek <polacek@redhat.com>
1856 PR c++/91844 - Implement CWG 2352, Similar types and reference binding.
1857 * call.c (reference_related_p): Use similar_type_p instead of
1859 (reference_compatible_p): Update implementation to match CWG 2352.
1860 * cp-tree.h (similar_type_p): Declare.
1861 * typeck.c (similar_type_p): New.
1863 2019-09-22 Marek Polacek <polacek@redhat.com>
1865 PR c++/91819 - ICE with operator++ and enum.
1866 * call.c (build_new_op_1): Set arg2_type.
1868 2019-09-17 Jason Merrill <jason@redhat.com>
1870 * parser.c (cp_parser_statement): Handle [[likely]] on
1873 2019-09-19 Jason Merrill <jason@redhat.com>
1876 * call.c (build_new_op_1): Don't apply any standard conversions to
1877 the operands of a built-in operator. Don't suppress conversions in
1879 * typeck.c (cp_build_unary_op): Do integral promotions for enums.
1881 2019-09-16 Paolo Carlini <paolo.carlini@oracle.com>
1883 * decl.c (grokdeclarator): Use declspecs->locations and
1884 declarator->id_loc in a few error messages.
1885 * pt.c (finish_member_template_decl): Use DECL_SOURCE_LOCATION.
1886 (push_template_decl_real): Likewise.
1888 2019-09-15 Jason Merrill <jason@redhat.com>
1890 PR c++/30277 - int-width bit-field promotion.
1891 PR c++/33819 - long bit-field promotion.
1892 * typeck.c (cp_perform_integral_promotions): Handle large bit-fields
1893 properly. Handle 32-bit non-int bit-fields properly.
1894 (is_bitfield_expr_with_lowered_type): Don't look through NOP_EXPR.
1896 PR c++/82165 - enum bitfields and operator overloading.
1897 * call.c (build_new_op_1): Use unlowered_expr_type.
1899 * call.c (build_new_op_1): Don't apply any standard conversions to
1900 the operands of a built-in operator. Don't suppress conversions in
1902 * typeck.c (cp_build_unary_op): Do integral promotions for enums.
1904 2019-09-15 Marek Polacek <polacek@redhat.com>
1906 PR c++/91740 - ICE with constexpr call and ?: in ARRAY_REF.
1907 * pt.c (build_non_dependent_expr): Call build_non_dependent_expr for
1910 2019-09-15 Nathan Sidwell <nathan@acm.org>
1912 * cp-tree.h (DECL_CLONED_FUNCTION_P): Reimplement using
1913 IDENTIFIER_CDTOR_P, correct documentation.
1914 (DECL_CLONED_FUNCTION): Directly access field.
1915 (decl_cloned_function_p): Delete.
1916 * class.c (decl_cloned_function_p): Delete.
1917 * pt.c (instantiate_template_1): Check DECL_CHAIN is a decl.
1919 2019-09-11 Nathan Sidwell <nathan@acm.org>
1921 * c-objcp-common.c (cp-objcp-common.c): Alphababetize and
1922 correctly mark all C++ nodes.
1923 * decl.c (cp_tree_node_structure): Alphabetize.
1925 2019-09-10 Marek Polacek <polacek@redhat.com>
1927 PR c++/91673 - ICE with noexcept in alias-declaration.
1928 * parser.c (CP_PARSER_FLAGS_DELAY_NOEXCEPT): New parser flag.
1929 (cp_parser_lambda_declarator_opt): Pass CP_PARSER_FLAGS_NONE to
1930 cp_parser_exception_specification_opt.
1931 (cp_parser_direct_declarator): Adjust a call to
1932 cp_parser_exception_specification_opt.
1933 (cp_parser_member_declaration): Pass CP_PARSER_FLAGS_DELAY_NOEXCEPT
1934 to cp_parser_declarator if not processing a friend or typedef
1936 (cp_parser_late_noexcept_specifier): Adjust a call to
1937 cp_parser_noexcept_specification_opt.
1938 (cp_parser_noexcept_specification_opt): New parameter for parser flags,
1939 drop the FRIEND_P parameter. Use the new parameter.
1940 (cp_parser_exception_specification_opt): Likewise.
1941 (cp_parser_transaction): Adjust a call to
1942 cp_parser_noexcept_specification_opt.
1943 (cp_parser_transaction_expression): Likewise.
1945 2019-09-10 Marek Polacek <polacek@redhat.com>
1947 PR c++/91705 - constexpr evaluation rejects ++/-- on floats.
1948 * constexpr.c (cxx_eval_increment_expression): Call fold_simple on
1951 2019-09-10 Paolo Carlini <paolo.carlini@oracle.com>
1953 * decl.c (has_designator_problem): Use cp_expr_loc_or_input_loc
1955 (build_enumerator): Likewise.
1956 (cp_finish_decl): Use DECL_SOURCE_LOCATION.
1957 (grokdeclarator): Use id_loc in two error_at; change errror
1958 message about constinit together constexpr to use two ranges.
1960 2019-09-09 Marek Polacek <polacek@redhat.com>
1962 PR c++/84374 - diagnose invalid uses of decltype(auto).
1963 * decl.c (grokdeclarator): Diagnose wrong usage of decltype(auto) in
1964 a function declaration.
1966 2019-09-06 Nathan Sidwell <nathan@acm.org>
1969 * cp-tree.h (IDENTIFIER_REPO_CHOSEN, DECL_REPO_AVAILABLE_P): Delete.
1970 (struct lang_decl_base): Remove repo_available_p.
1971 * decl.c (duplicate_decls): Don't copy DECL_REPO_AVAILABLE_P.
1973 (Reserve TREE_LANG_FLAG_3 for modules.
1974 * cp-tree.h (DECL_CONSTRUCTION_VTABLE_P): Delete.
1975 (DECL_NON_TRIVIALLY_INITIALIZED_P): Move to TREE_LANG_FLAG_6.
1976 * class.c (build_ctor_vtbl_group): Don't set
1977 DECL_CONSTRUCTION_VTABLE_P.
1978 * decl2.c (determine_visibility_from_class): Don't check
1979 DECL_CONSTRUCTION_VTABLE_P anymore.
1981 2019-09-06 Martin Liska <mliska@suse.cz>
1984 * Make-lang.in: Remove repo.o.
1985 * config-lang.in: Likewise.
1986 * cp-tree.h (init_repo): Remove declarations
1987 of repo-related functions.
1988 (repo_emit_p): Likewise.
1989 (repo_export_class_p): Likewise.
1990 (finish_repo): Likewise.
1991 * decl2.c (import_export_class): Always
1993 (mark_needed): Remove -frepo from comment.
1994 (import_export_decl): Similarly here.
1995 (c_parse_final_cleanups): Remove call of finish_repo.
1996 * lex.c (cxx_init): Remove call to init_repo.
1997 * optimize.c (can_alias_cdtor): Remove dead condition.
1998 * pt.c (push_template_decl_real): Update comment.
1999 (instantiate_decl): Remove dead code used for -frepo.
2002 2019-09-05 Marek Polacek <polacek@redhat.com>
2004 PR c++/91644 - ICE with constinit in function template.
2005 * decl.c (start_decl): Call retrofit_lang_decl for constinit variables.
2006 * pt.c (tsubst_expr): Pass LOOKUP_CONSTINIT down to cp_finish_decl for
2007 constinit variables.
2009 2019-09-05 Nathan Sidwell <nathan@acm.org>
2011 * cp-tree.h (DECL_VTABLE_OR_VTT_P): Forward to DECL_VIRTUAL_P.
2013 2019-09-04 Marek Polacek <polacek@redhat.com>
2015 * call.c (build_over_call): Remove -fdeduce-init-list implementation.
2016 * pt.c (unify): Likewise.
2018 2019-09-01 Marek Polacek <polacek@redhat.com>
2020 PR c++/91129 - wrong error with binary op in template argument.
2021 * typeck.c (warn_for_null_address): Use fold_for_warn instead of
2022 fold_non_dependent_expr.
2023 (cp_build_binary_op): Likewise.
2025 2019-08-30 Jason Merrill <jason@redhat.com>
2027 Add source location to TRAIT_EXPR.
2028 * cp-tree.h (TRAIT_EXPR_LOCATION): New.
2029 (struct tree_trait_expr): Add locus field.
2030 * parser.c (cp_parser_trait_expr): Pass trait_loc down.
2031 * pt.c (tsubst_copy_and_build) [TRAIT_EXPR]: Likewise.
2032 * semantics.c (finish_trait_expr): Add location parm.
2033 * tree.c (cp_expr_location): Handle TRAIT_EXPR.
2035 2019-08-29 Paolo Carlini <paolo.carlini@oracle.com>
2037 * decl.c (check_var_type): Add location_t parameter and use it.
2038 (grokdeclarator): Adjust call.
2039 * pt.c (tsubst_decl): Likewise.
2040 * cp-tree.h: Adjust declaration.
2042 2019-08-28 Marek Polacek <polacek@redhat.com>
2044 Implement P1152R4: Deprecating some uses of volatile.
2046 * cp-gimplify.c (cp_fold): Set TREE_THIS_VOLATILE.
2047 * decl.c (grokdeclarator): Warn about a volatile-qualified structured
2048 binding and return type.
2049 (grokparms): Warn about a volatile-qualified function parameter.
2050 * expr.c (mark_use) <case MODIFY_EXPR>: Emit a -Wvolatile warning.
2051 * typeck.c (cp_build_unary_op): Emit a -Wvolatile warning for pre and
2052 post ++/-- on a volatile operand.
2053 (genericize_compound_lvalue): Use a better location. Don't lose
2055 (cp_build_modify_expr): Emit a -Wvolatile warning for a compound
2056 assignment whose LHS is volatile-qualified. Build the assignment with
2057 a more precise location.
2059 2019-08-28 Marek Polacek <polacek@redhat.com>
2061 PR c++/91360 - Implement C++20 P1143R2: constinit.
2062 * cp-tree.h (TINFO_VAR_DECLARED_CONSTINIT): Define.
2063 (LOOKUP_CONSTINIT): Define.
2064 (enum cp_decl_spec): Add ds_constinit.
2065 * decl.c (check_tag_decl): Give an error for constinit in type
2067 (check_initializer): Also check LOOKUP_CONSTINIT.
2068 (cp_finish_decl): Add checking for a constinit declaration. Set
2069 TINFO_VAR_DECLARED_CONSTINIT.
2070 (grokdeclarator): Add checking for a declaration with the constinit
2072 * lex.c (init_reswords): Handle D_CXX20.
2073 * parser.c (cp_lexer_get_preprocessor_token): Pass a better location
2074 to warning_at. Warn about C++20 keywords.
2075 (cp_keyword_starts_decl_specifier_p): Handle RID_CONSTINIT.
2076 (cp_parser_diagnose_invalid_type_name): Add an inform about constinit.
2077 (cp_parser_decomposition_declaration): Maybe pass LOOKUP_CONSTINIT to
2079 (cp_parser_decl_specifier_seq): Handle RID_CONSTINIT.
2080 (cp_parser_init_declarator): Maybe pass LOOKUP_CONSTINIT to
2082 (set_and_check_decl_spec_loc): Add "constinit".
2083 * pt.c (tsubst_decl): Set TINFO_VAR_DECLARED_CONSTINIT.
2084 (instantiate_decl): Maybe pass LOOKUP_CONSTINIT to cp_finish_decl.
2085 * typeck2.c (store_init_value): If a constinit variable wasn't
2086 initialized using a constant initializer, give an error.
2088 2019-08-28 Nathan Sidwell <nathan@acm.org>
2091 * name-lookup.c (cp_emit_debug_info): Check for builtins during
2094 2019-08-27 Marek Polacek <polacek@redhat.com>
2096 PR c++/81676 - bogus -Wunused warnings in constexpr if.
2097 * semantics.c (maybe_mark_exp_read_r): New function.
2098 (finish_if_stmt): Call it on THEN_CLAUSE and ELSE_CLAUSE.
2100 PR c++/91428 - warn about std::is_constant_evaluated in if constexpr.
2101 * cp-tree.h (decl_in_std_namespace_p): Declare.
2102 * semantics.c (is_std_constant_evaluated_p): New.
2103 (finish_if_stmt_cond): Warn about "std::is_constant_evaluated ()" in
2105 * typeck.c (decl_in_std_namespace_p): No longer static.
2107 2019-08-26 Jason Merrill <jason@redhat.com>
2109 * decl.c (duplicate_decls): Always merge DECL_DECLARED_CONSTEXPR_P.
2111 2019-08-26 Marek Polacek <polacek@redhat.com>
2113 PR c++/91545 - ICE in constexpr store evaluation.
2114 * constexpr.c (cxx_eval_store_expression): Check FIELD_DECL instead
2117 2019-08-24 Nathan Sidwell <nathan@acm.org>
2119 * class.c (check_for_overrides): Conversion operators need
2122 2019-08-24 Paolo Carlini <paolo.carlini@oracle.com>
2124 * semantics.c (finish_switch_cond): Improve error message location.
2126 2019-08-23 Jason Merrill <jason@redhat.com>
2128 * decl2.c (decl_dependent_p): New.
2129 (mark_used): Check it instead of just processing_template_decl.
2131 2019-08-23 Jason Merrill <jason@redhat.com>
2133 * parser.c (cp_parser_nested_name_specifier_opt): Avoid redundant
2136 2019-08-23 Marek Polacek <polacek@redhat.com>
2138 PR c++/91521 - wrong error with operator->.
2139 * decl.c (grokdeclarator): Return error_mark_node for an invalid
2140 trailing return type.
2142 PR c++/79817 - attribute deprecated on namespace.
2143 * cp-tree.h (cp_warn_deprecated_use_scopes): Declare.
2144 * decl.c (grokdeclarator): Call cp_warn_deprecated_use_scopes.
2145 (type_is_deprecated): Likewise.
2146 * decl2.c (cp_warn_deprecated_use_scopes): New function.
2147 * name-lookup.c (handle_namespace_attrs): Handle attribute deprecated.
2148 * parser.c (cp_parser_namespace_alias_definition): Call
2149 cp_warn_deprecated_use_scopes.
2150 (cp_parser_using_declaration): Likewise.
2151 (cp_parser_using_directive): Likewise.
2152 * semantics.c (finish_id_expression_1): Likewise.
2154 2019-08-23 Nathan Sidwell <nathan@acm.org>
2156 * class.c (check_for_override): Checking IDENTIFIER_VIRTUAL_P is
2157 sufficient, reorder DECL_OVERRIDE_P check.
2159 2019-08-23 Iain Sandoe <iain@sandoe.co.uk>
2162 * parser.c (cp_parser_initial_pragma): Call c_common_no_more_pch ()
2163 after determining that the first token is not
2164 PRAGMA_GCC_PCH_PREPROCESS.
2166 2019-08-22 Marek Polacek <polacek@redhat.com>
2168 PR c++/91304 - prefix attributes ignored in condition.
2169 * parser.c (cp_parser_condition): Handle prefix attributes.
2171 2019-08-21 Richard Sandiford <richard.sandiford@arm.com>
2174 * decl.c (duplicate_decls): Call copy_attributes_to_builtin inside
2175 the BUILT_IN_NORMAL block rather than afterward.
2177 2019-08-19 Marek Polacek <polacek@redhat.com>
2179 PR c++/91264 - detect modifying const objects in constexpr.
2180 * constexpr.c (modifying_const_object_error): New function.
2181 (cxx_eval_call_expression): Set TREE_READONLY on a CONSTRUCTOR of
2182 a const-qualified object after it's been fully constructed.
2183 (modifying_const_object_p): New function.
2184 (cxx_eval_store_expression): Detect modifying a const object
2185 during constant expression evaluation.
2186 (cxx_eval_increment_expression): Use a better location when building
2188 (cxx_eval_constant_expression) <case DECL_EXPR>: Mark a constant
2189 object's constructor TREE_READONLY.
2191 2019-08-15 Jason Merrill <jason@redhat.com>
2193 PR c++/90393 - ICE with thow in ?:
2195 PR c++/64372, DR 1560 - Gratuitous lvalue-to-rvalue conversion in ?:
2196 * tree.c (lvalue_kind): Handle throw in one arm.
2197 * typeck.c (rationalize_conditional_expr): Likewise.
2198 (cp_build_modify_expr): Likewise.
2200 2019-08-14 Jason Merrill <jason@redhat.com>
2202 Implement P0848R3, Conditionally Trivial Special Member Functions.
2203 * tree.c (special_memfn_p): New.
2204 * class.c (add_method): When overloading, hide ineligible special
2206 (check_methods): Set TYPE_HAS_COMPLEX_* here.
2207 * decl.c (grok_special_member_properties): Not here.
2208 * name-lookup.c (push_class_level_binding_1): Move overloaded
2209 functions case down, accept FUNCTION_DECL as target_decl.
2211 2019-08-14 Jonathan Wakely <jwakely@redhat.com>
2214 * name-lookup.c (get_std_name_hint): Fix min_dialect field for
2215 complex_literals and make_unique entries.
2217 2019-08-14 Jakub Jelinek <jakub@redhat.com>
2218 Marek Polacek <polacek@redhat.com>
2220 PR c++/91391 - bogus -Wcomma-subscript warning.
2221 * parser.c (cp_parser_postfix_open_square_expression): Don't warn about
2222 a deprecated comma here. Pass warn_comma_subscript down to
2223 cp_parser_expression.
2224 (cp_parser_expression): New bool parameter. Warn about uses of a comma
2225 operator within a subscripting expression.
2226 (cp_parser_skip_to_closing_square_bracket): Revert to pre-r274121 state.
2227 (cp_parser_skip_to_closing_square_bracket_1): Remove.
2229 2019-08-14 Jonathan Wakely <jwakely@redhat.com>
2231 * name-lookup.c (get_std_name_hint): Add more entries.
2233 2019-08-14 Paolo Carlini <paolo.carlini@oracle.com>
2235 * decl2.c (grok_array_decl): Use the location of the open square
2236 bracket in error message about invalid types.
2238 2019-08-14 Paolo Carlini <paolo.carlini@oracle.com>
2240 * decl.c (grokdeclarator): Check here for typedef a function
2241 definition or a member function definition.
2242 (start_function): Adjust.
2243 (grokmethod): Likewise.
2245 2019-08-13 Richard Sandiford <richard.sandiford@arm.com>
2248 * decl.c (duplicate_decls): Use copy_decl_built_in_function.
2249 * pt.c (declare_integer_pack): Use set_decl_built_in_function.
2251 2019-08-13 Marek Polacek <polacek@redhat.com>
2253 PR c++/90473 - wrong code with nullptr in default argument.
2254 * call.c (null_ptr_cst_p): Update quote from the standard.
2255 * decl.c (check_default_argument): Don't return nullptr when the arg
2258 2019-08-13 Marek Polacek <polacek@redhat.com>
2260 * cp-tree.h (DECL_MUTABLE_P): Use FIELD_DECL_CHECK.
2262 2019-08-10 Jakub Jelinek <jakub@redhat.com>
2264 * parser.c (cp_parser_omp_clause_name): Parse device_type.
2265 (cp_parser_omp_clause_device_type): New function.
2266 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_DEVICE_TYPE.
2267 (OMP_DECLARE_TARGET_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_DEVICE_TYPE.
2268 (cp_parser_omp_declare_target): Handle device_type clauses. Remove
2269 diagnostics for declare target with clauses nested in clause-less
2270 declare target declaration-definition-seq.
2271 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_DEVICE_TYPE.
2273 2019-08-09 Jakub Jelinek <jakub@redhat.com>
2275 * parser.c (check_no_duplicate_clause): Simplify using
2277 (cp_parser_omp_clause_if): Fix up printing of target {enter,exit} data
2278 directive name modifiers.
2281 * parser.c (cp_parser_omp_clause_dist_schedule): Comment out the
2282 check_no_duplicate_clause call, instead emit a warning for duplicate
2283 dist_schedule clauses.
2285 2019-08-08 Paolo Carlini <paolo.carlini@oracle.com>
2287 * decl.c (grokdeclarator): Use id_loc and EXPR_LOCATION in
2288 a few error messages.
2290 2019-08-08 Marek Polacek <polacek@redhat.com>
2292 PR c++/87519 - bogus warning with -Wsign-conversion.
2293 * typeck.c (cp_build_binary_op): Use same_type_p instead of comparing
2296 * constexpr.c (inline_asm_in_constexpr_error): New.
2297 (cxx_eval_constant_expression) <case ASM_EXPR>: Call it.
2298 (potential_constant_expression_1) <case ASM_EXPR>: Likewise.
2300 2019-08-08 Jakub Jelinek <jakub@redhat.com>
2302 * semantics.c (finish_omp_clauses): For C_ORT_OMP
2303 OMP_CLAUSE_USE_DEVICE_* clauses use oacc_reduction_head bitmap
2304 instead of generic_head to track duplicates.
2306 2019-08-07 Marek Polacek <polacek@redhat.com>
2308 PR c++/81429 - wrong parsing of constructor with C++11 attribute.
2309 * parser.c (cp_parser_constructor_declarator_p): Handle the scenario
2310 when a parameter declaration begins with [[attribute]].
2312 2019-08-07 Marek Polacek <polacek@redhat.com>
2314 PR c++/91346 - Implement P1668R1, allow unevaluated asm in constexpr.
2315 * constexpr.c (cxx_eval_constant_expression): Handle ASM_EXPR.
2316 (potential_constant_expression_1) <case ASM_EXPR>: Allow.
2317 * cp-tree.h (finish_asm_stmt): Adjust.
2318 * parser.c (cp_parser_asm_definition): Grab the locaion of "asm" and
2319 use it. Change an error to a pedwarn. Allow asm in C++2a, warn
2321 * pt.c (tsubst_expr): Pass a location down to finish_asm_stmt.
2322 * semantics.c (finish_asm_stmt): New location_t parameter. Use it.
2324 2019-08-07 Jakub Jelinek <jakub@redhat.com>
2326 * parser.c (cp_parser_omp_clause_name): Parse use_device_addr clause.
2327 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR.
2328 (OMP_TARGET_DATA_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR.
2329 (cp_parser_omp_target_data): Handle PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR
2330 like PRAGMA_OMP_CLAUSE_USE_DEVICE_PTR, adjust diagnostics about no
2331 map or use_device_* clauses.
2332 * semantics.c (finish_omp_clauses): For OMP_CLAUSE_USE_DEVICE_PTR
2333 in OpenMP, require pointer or reference to pointer type rather than
2334 pointer or array or reference to pointer or array type. Handle
2335 OMP_CLAUSE_USE_DEVICE_ADDR.
2336 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_USE_DEVICE_ADDR.
2338 2019-08-06 Jason Merrill <jason@redhat.com>
2340 PR c++/91378 - ICE with noexcept and auto return type.
2341 * pt.c (maybe_instantiate_noexcept): push_to_top_level.
2343 2019-08-06 Paolo Carlini <paolo.carlini@oracle.com>
2345 * decl.c (check_array_designated_initializer): Use
2346 cp_expr_loc_or_input_loc in one place.
2348 2019-08-06 Jakub Jelinek <jakub@redhat.com>
2350 * parser.c (cp_parser_omp_for_loop): For OMP_LOOP, ignore parallel
2351 clauses and predetermine iterator as lastprivate.
2352 * semantics.c (handle_omp_for_class_iterator): Use
2353 OMP_CLAUSE_LASTPRIVATE_LOOP_IV instead of
2354 OMP_CLAUSE_LASTPRIVATE_TASKLOOP_IV, set it for lastprivate also
2355 on OMP_LOOP construct. If a clause is missing for class iterator
2356 on OMP_LOOP, add firstprivate clause, and if there is private
2357 clause, turn it into firstprivate too.
2358 (finish_omp_for): Formatting fix. For OMP_LOOP, adjust
2359 OMP_CLAUSE_LASTPRIVATE_LOOP_IV clause CP_CLAUSE_INFO, so that it
2360 uses copy ctor instead of default ctor.
2361 * cp-gimplify.c (cp_gimplify_expr): Handle OMP_LOOP like
2363 (cp_fold_r): Likewise.
2364 (cp_genericize_r): Likewise.
2365 (cxx_omp_finish_clause): Also finish lastprivate clause with
2366 OMP_CLAUSE_LASTPRIVATE_LOOP_IV flag.
2367 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_BIND.
2368 (tsubst_omp_for_iterator): For OMP_LOOP, ignore parallel
2369 clauses and predetermine iterator as lastprivate.
2370 * constexpr.c (potential_constant_expression_1): Handle OMP_LOOP
2371 like OMP_DISTRIBUTE etc.
2373 2019-08-05 Marek Polacek <polacek@redhat.com>
2375 DR 2413 - typename in conversion-function-ids.
2376 * parser.c (cp_parser_conversion_type_id): Call
2377 cp_parser_type_specifier_seq with CP_PARSER_FLAGS_TYPENAME_OPTIONAL
2378 instead of CP_PARSER_FLAGS_NONE.
2380 2019-08-05 Paolo Carlini <paolo.carlini@oracle.com>
2382 * cp-tree.h (cp_expr_loc_or_input_loc): New.
2383 (cxx_incomplete_type_diagnostic): Use it.
2384 * call.c (build_converted_constant_expr_internal, convert_like_real,
2385 convert_arg_to_ellipsis, convert_for_arg_passing, build_over_call,
2386 build_cxx_call, perform_implicit_conversion_flags,
2387 initialize_reference): Likewise.
2388 * constexpr.c (cxx_eval_internal_function, cxx_eval_call_expression,
2389 eval_and_check_array_index, cxx_eval_store_expression,
2390 cxx_eval_statement_list, cxx_eval_loop_expr,
2391 cxx_eval_constant_expression, potential_constant_expression_1):
2393 * constraint.cc (check_for_logical_overloads,
2394 satisfy_predicate_constraint): Likewise.
2395 * cp-gimplify.c (cp_gimplify_expr): Likewise.
2396 * cvt.c (cp_convert_to_pointer, convert_to_reference,
2397 cp_convert_and_check, ocp_convert, maybe_warn_nodiscard): Likewise.
2398 * decl.c (pop_switch): Likewise.
2399 * decl2.c (delete_sanity): Likewise.
2400 * error.c (location_of): Likewise.
2401 * init.c (maybe_warn_list_ctor, build_aggr_init,
2402 warn_placement_new_too_small, build_new_1, build_vec_init): Likewise.
2403 * lex.c (unqualified_name_lookup_error): Likewise.
2404 * parser.c (cp_parser_initializer_list, cp_parser_omp_for_cond):
2406 * pt.c (check_for_bare_parameter_packs, check_valid_ptrmem_cst_expr,
2407 unify_arg_conversion, convert_nontype_argument,
2408 tsubst_copy_and_build, resolve_typename_type): Likewise.
2409 * semantics.c (maybe_convert_cond, finish_call_expr,
2410 cp_build_vec_convert): Likewise.
2411 * typeck.c (decay_conversion, rationalize_conditional_expr,
2412 cp_build_unary_op, build_x_compound_expr_from_list,
2413 maybe_warn_about_returning_address_of_local,
2414 maybe_warn_pessimizing_move): Likewise.
2415 * typeck2.c (check_narrowing, digest_init_r,
2416 process_init_constructor_array): Likewise.
2418 2019-08-05 Tom Honermann <tom@honermann.net>
2420 * parser.c (cp_parser_template_declaration_after_parameters): Enable
2421 class template argument deduction for non-type template parameters
2422 in literal operator templates.
2424 2019-08-05 Marek Polacek <polacek@redhat.com>
2426 PR c++/91338 - Implement P1161R3: Deprecate a[b,c].
2427 * parser.c (cp_parser_postfix_open_square_expression): Warn about uses
2428 of a comma operator within a subscripting expression.
2429 (cp_parser_skip_to_closing_square_bracket_1): New function, made out
2431 (cp_parser_skip_to_closing_square_bracket): ...this.
2433 2019-08-05 Jason Merrill <jason@redhat.com>
2435 * semantics.c (force_paren_expr): Preserve location.
2437 2019-08-02 Marek Polacek <polacek@redhat.com>
2439 PR c++/91230 - wrong error with __PRETTY_FUNCTION__ and generic lambda.
2440 * pt.c (value_dependent_expression_p): Consider __PRETTY_FUNCTION__
2441 inside a template function value-dependent.
2443 2019-08-02 Paolo Carlini <paolo.carlini@oracle.com>
2445 * tree.c (handle_nodiscard_attribute): Do not warn about nodiscard
2446 applied to a constructor.
2448 2019-08-02 Martin Liska <mliska@suse.cz>
2450 * decl.c (grok_op_properties):
2451 Mark DECL_SET_IS_OPERATOR_DELETE for user-provided delete operators.
2453 2019-08-01 Martin Sebor <msebor@redhat.com>
2456 * decl.c (reshape_init_array_1): Avoid truncating initializer
2457 lists containing string literals.
2459 2019-08-01 Marek Polacek <polacek@redhat.com>
2461 PR c++/90805 - detect narrowing in case values.
2462 * decl.c (case_conversion): Detect narrowing in case values.
2464 2019-07-31 Paolo Carlini <paolo.carlini@oracle.com>
2466 * decl2.c (delete_sanity): Improve diagnostic locations, use
2467 cp_expr_loc_or_loc in four places.
2469 2019-07-31 Jason Merrill <jason@redhat.com>
2471 PR c++/90538 - multiple expansions of capture packs
2472 * cp-tree.h (DECLTYPE_FOR_INIT_CAPTURE): Remove.
2473 * lambda.c (add_capture): Copy parameter packs from init.
2474 (lambda_capture_field_type): Always use auto for init-capture.
2475 * pt.c (uses_parameter_packs): Return tree.
2476 (tsubst) [DECLTYPE_TYPE]: Remove init-capture handling.
2477 (gen_elem_of_pack_expansion_instantiation): Don't push
2478 local_specialization_stack.
2479 (prepend_one_capture): New.
2480 (tsubst_lambda_expr): Use it. Don't touch local_specializations.
2481 (do_auto_deduction): Avoid redundant error.
2483 Fix copy_node of TEMPLATE_INFO.
2484 * cp-tree.h (struct tree_template_info): Use tree_base instead of
2485 tree_common. Add tmpl and args fields.
2486 (TI_TEMPLATE, TI_ARGS): Adjust.
2488 2019-07-30 Martin Liska <mliska@suse.cz>
2490 PR tree-optimization/91270
2491 * tree-ssa-dce.c (propagate_necessity): Mark 2nd argument
2492 of delete operator as needed.
2494 2019-07-25 Martin Liska <mliska@suse.cz>
2495 Dominik Infuhr <dominik.infuehr@theobroma-systems.com>
2498 * decl.c (cxx_init_decl_processing): Mark delete operators
2499 with DECL_SET_IS_OPERATOR_DELETE.
2501 2019-07-25 Martin Liska <mliska@suse.cz>
2503 * decl.c (duplicate_decls): Use new macros
2504 (e.g. DECL_SET_LAMBDA_FUNCTION and DECL_LAMBDA_FUNCTION_P).
2505 (cxx_init_decl_processing): Likewise.
2506 (grok_op_properties): Likewise.
2507 * parser.c (cp_parser_lambda_declarator_opt): Likewise.
2509 2019-07-24 Martin Sebor <msebor@redhat.com>
2512 * decl.c (finish_function): Use lang_mask.
2514 2019-07-20 Jason Merrill <jason@redhat.com>
2516 * cp-tree.h (ovl_iterator::using_p): A USING_DECL by itself was also
2517 introduced by a using-declaration.
2519 2019-07-20 Jason Merrill <jason@redhat.com>
2521 Reduce memory consumption for push/pop_access_scope.
2522 * name-lookup.c (leave_scope): Do add class levels other than
2523 previous_class_level to free_binding_level.
2524 (invalidate_class_lookup_cache): Move from class.c, add to
2526 * pt.c (saved_access_scope): Change from list to vec.
2528 2019-07-20 Jakub Jelinek <jakub@redhat.com>
2530 * cp-tree.h (OMP_FOR_GIMPLIFYING_P): Use OMP_LOOPING_CHECK
2531 instead of OMP_LOOP_CHECK.
2532 * parser.c (cp_parser_omp_clause_name): Handle bind clause.
2533 (cp_parser_omp_clause_bind): New function.
2534 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_BIND.
2535 (OMP_LOOP_CLAUSE_MASK): Define.
2536 (cp_parser_omp_loop): New function.
2537 (cp_parser_omp_parallel, cp_parser_omp_teams): Handle parsing of
2538 loop combined with parallel or teams.
2539 (cp_parser_omp_construct): Handle PRAGMA_OMP_LOOP.
2540 (cp_parser_pragma): Likewise.
2541 * pt.c (tsubst_expr): Handle OMP_LOOP.
2542 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_BIND.
2544 2019-07-19 Jason Merrill <jason@redhat.com>
2546 PR c++/90101 - dependent class non-type parameter.
2547 * pt.c (invalid_nontype_parm_type_p): Check for dependent class type.
2549 2019-07-18 Jason Merrill <jason@redhat.com>
2551 PR c++/90098 - partial specialization and class non-type parms.
2554 * call.c (build_converted_constant_expr_internal): Don't copy.
2555 * pt.c (process_partial_specialization): Allow VIEW_CONVERT_EXPR
2556 around class non-type parameter.
2557 (unify) [TEMPLATE_PARM_INDEX]: Ignore cv-quals.
2559 2019-07-16 Jason Merrill <jason@redhat.com>
2561 * parser.c (make_location): Add overload taking cp_lexer* as last
2564 * parser.c (cp_parser_simple_type_specifier): Separate tentative
2565 parses for optional type-spec and CTAD.
2567 * parser.c (cp_parser_nested_name_specifier_opt): If the token is
2568 already CPP_NESTED_NAME_SPECIFIER, leave it alone.
2570 2019-07-12 Jakub Jelinek <jakub@redhat.com>
2572 * parser.c (cp_parser_omp_clause_name): Handle order clause.
2573 (cp_parser_omp_clause_order): New function.
2574 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_ORDER.
2575 (OMP_SIMD_CLAUSE_MASK, OMP_FOR_CLAUSE_MASK): Add
2576 PRAGMA_OMP_CLAUSE_ORDER.
2577 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_ORDER.
2578 * pt.c (tsubst_omp_clauses): Likewise.
2580 2019-07-10 Paolo Carlini <paolo.carlini@oracle.com>
2582 * decl.c (get_type_quals,
2583 smallest_type_location (const cp_decl_specifier_seq*)): New.
2584 (check_tag_decl): Use smallest_type_location in error_at about
2585 multiple types in one declaration.
2586 (grokdeclarator): Use locations[ds_complex] in error_at about
2587 complex invalid; use locations[ds_storage_class] in error_at
2588 about static cdtor; use id_loc in error_at about flexible
2589 array member in union; use get_type_quals.
2591 2019-07-09 Martin Sebor <msebor@redhat.com>
2594 * cp-tree.h: Change class-key of PODs to struct and others to class.
2596 * semantics.c (finalize_nrv_r): Same.
2598 2019-07-09 Martin Sebor <msebor@redhat.com>
2601 * constexpr.c (cxx_eval_call_expression): Change class-key from class
2602 to struct and vice versa to match convention and avoid -Wclass-is-pod
2603 and -Wstruct-no-pod.
2604 * constraint.cc (get_concept_definition): Same.
2606 * cxx-pretty-print.h: Same.
2608 * logic.cc (term_list::replace): Same.
2609 * name-lookup.c (find_local_binding): Same.
2610 * pt.c (tsubst_binary_right_fold): Same.
2611 * search.c (field_accessor_p): Same.
2612 * semantics.c (expand_or_defer_fn): Same.
2614 2019-07-08 Jakub Jelinek <jakub@redhat.com>
2617 * decl2.c (cp_omp_mappable_type_1): Don't emit any note for
2618 error_mark_node type.
2620 2019-07-05 Jakub Jelinek <jakub@redhat.com>
2624 * call.c (build_new_method_call_1): Remove set but not used variable
2627 2019-07-05 Paolo Carlini <paolo.carlini@oracle.com>
2629 PR c++/67184 (again)
2631 * call.c (build_over_call): Devirtualize user-defined operators
2632 coming from a base too.
2633 (build_new_method_call_1): Do not devirtualize here.
2635 2019-07-04 Marek Polacek <polacek@redhat.com>
2638 PR c++/83374 - __is_standard_layout wrong for a class with repeated
2640 * class.c (check_bases): Set CLASSTYPE_NON_STD_LAYOUT for a class if
2641 CLASSTYPE_REPEATED_BASE_P is true.
2643 2019-07-04 Andrew Stubbs <ams@codesourcery.com>
2645 * cp-tree.h (cp_omp_emit_unmappable_type_notes): New prototype.
2646 * decl.c (cp_finish_decl): Call cp_omp_emit_unmappable_type_notes.
2647 * decl2.c (cp_omp_mappable_type): Move contents to ...
2648 (cp_omp_mappable_type_1): ... here and add note output.
2649 (cp_omp_emit_unmappable_type_notes): New function.
2650 * semantics.c (finish_omp_clauses): Call
2651 cp_omp_emit_unmappable_type_notes in four places.
2653 2019-07-03 Martin Liska <mliska@suse.cz>
2655 * call.c (build_new_op_1): Remove dead assignemts.
2656 * typeck.c (cp_build_binary_op): Likewise.
2658 2019-06-27 Jason Merrill <jason@redhat.com>
2660 PR c++/55442 - memory-hog with highly recursive constexpr.
2661 * constexpr.c (push_cx_call_context): Return depth.
2662 (cxx_eval_call_expression): Don't cache past constexpr_cache_depth.
2664 2019-06-27 Jan Hubicka <jh@suse.cz>
2666 * class.c (layout_class_type): Set TYPE_CXX_ODR_P for as-base
2669 2019-06-27 Martin Liska <mliska@suse.cz>
2671 * class.c (adjust_clone_args): Remove obviously
2673 (dump_class_hierarchy_r): Likewise.
2674 * decl.c (check_initializer): Likewise.
2675 * parser.c (cp_parser_lambda_expression): Likewise.
2676 * pt.c (unify_bound_ttp_args): Likewise.
2677 (convert_template_argument): Likewise.
2678 * rtti.c (build_headof): Likewise.
2679 * typeck.c (convert_for_initialization): Likewise.
2681 2019-06-25 Jason Merrill <jason@redhat.com>
2683 PR c++/70462 - unnecessary base ctor variant with final.
2684 * optimize.c (populate_clone_array): Skip base variant if
2686 (maybe_clone_body): We don't need an alias if we are only defining
2689 * class.c (resolves_to_fixed_type_p): Check CLASSTYPE_FINAL.
2691 2019-06-25 Jakub Jelinek <jakub@redhat.com>
2694 * constexpr.c (cxx_eval_array_reference): Don't look through VCE from
2695 vector type if lval.
2697 2019-06-25 Jozef Lawrynowicz <jozef.l@mittosystems.com>
2699 * lex.c (init_reswords): Create keyword for "__intN__" type.
2700 * cp-tree.h (cp_decl_specifier_seq): New bitfield "int_n_alt".
2701 * decl.c (grokdeclarator): Don't pedwarn about "__intN" ISO
2702 C incompatibility if alternate "__intN__" form is used.
2703 * parser.c (cp_parser_simple_type_specifier): Set
2704 decl_specs->int_n_alt if "__intN__" form is used.
2706 2019-06-24 Jan Hubicka <jh@suse.cz>
2708 * lex.c (cxx_make_type): Set TYPE_CXX_ODR_P.
2710 2019-06-24 Jason Merrill <jason@redhat.com>
2712 * class.c (layout_class_type): Don't use a separate
2713 CLASSTYPE_AS_BASE if it's the same size.
2715 2019-06-23 Marek Polacek <polacek@redhat.com>
2717 * call.c (convert_default_arg): Use DEFERRED_PARSE instead of
2719 * cp-objcp-common.c (cp_tree_size): Likewise. Use tree_deferred_parse
2720 instead of tree_default_arg.
2721 * cp-tree.def: Rename DEFAULT_ARG to DEFERRED_PARSE.
2722 * cp-tree.h: Rename DEFARG_TOKENS to DEFPARSE_TOKENS. Rename
2723 DEFARG_INSTANTIATIONS to DEFPARSE_INSTANTIATIONS. Rename
2724 tree_default_arg to tree_deferred_parse.
2725 (UNPARSED_NOEXCEPT_SPEC_P): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2726 (cp_tree_node_structure_enum): Rename TS_CP_DEFAULT_ARG to
2727 TS_CP_DEFERRED_PARSE.
2728 (lang_tree_node): Rename tree_default_arg to tree_deferred_parse.
2729 Rename default_arg to deferred_parse. Use TS_CP_DEFERRED_PARSE instead
2730 of TS_CP_DEFAULT_ARG.
2731 (defarg_location): Remove declaration.
2732 (defparse_location): Add declaration.
2733 * decl.c (grokfndecl): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2734 Call defparse_location instead of defarg_location.
2735 (check_default_argument): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2736 (cp_tree_node_structure): Likewise. Use TS_CP_DEFERRED_PARSE instead
2737 of TS_CP_DEFAULT_ARG.
2738 * decl2.c (grokfield): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2739 * error.c (dump_expr): Likewise.
2740 (location_of): Likewise.
2741 * init.c (get_nsdmi): Likewise.
2742 * parser.c (cp_parser_save_noexcept): Likewise. Use DEFPARSE_TOKENS
2743 instead of DEFARG_TOKENS.
2744 (cp_parser_late_noexcept_specifier): Likewise.
2745 (cp_parser_late_parse_one_default_arg): Use DEFPARSE_TOKENS instead
2747 (cp_parser_late_parsing_default_args): Use DEFERRED_PARSE instead of
2748 DEFAULT_ARG. Use DEFPARSE_INSTANTIATIONS instead of
2749 DEFARG_INSTANTIATIONS.
2750 (cp_parser_cache_defarg): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2751 Use DEFPARSE_TOKENS instead of DEFARG_TOKENS. Use
2752 DEFPARSE_INSTANTIATIONS instead of DEFARG_INSTANTIATIONS.
2753 (defparse_location): Renamed from defarg_location.
2754 * pt.c (tsubst_default_argument): Use DEFERRED_PARSE instead of
2756 (tsubst_arg_types): Likewise.
2757 (dependent_type_p_r): Likewise.
2758 * tree.c (cp_tree_equal): Likewise.
2759 (cp_walk_subtrees): Likewise.
2760 * typeck.c (convert_arguments): Likewise.
2762 2019-06-22 Marek Polacek <polacek@redhat.com>
2764 PR c++/86476 - noexcept-specifier is a complete-class context.
2766 * cp-tree.def (DEFAULT_ARG): Update commentary.
2767 * cp-tree.h (UNPARSED_NOEXCEPT_SPEC_P): New macro.
2768 (tree_default_arg): Use tree_base instead of tree_common.
2769 (do_push_parm_decls, maybe_check_overriding_exception_spec): Declare.
2770 * decl.c (do_push_parm_decls): New function, broken out of...
2771 (store_parm_decls): ...here. Call it.
2772 * except.c (nothrow_spec_p): Accept DEFAULT_ARG in the assert.
2773 * parser.c (cp_parser_noexcept_specification_opt,
2774 cp_parser_late_noexcept_specifier, noexcept_override_late_checks):
2776 (unparsed_noexcepts): New macro.
2777 (push_unparsed_function_queues): Update initializer.
2778 (cp_parser_direct_declarator): Pass FRIEND_P to
2779 cp_parser_exception_specification_opt.
2780 (inject_parm_decls): New.
2781 (pop_injected_parms): New.
2782 (cp_parser_class_specifier_1): Implement delayed parsing of
2783 noexcept-specifiers.
2784 (cp_parser_save_noexcept): New.
2785 (cp_parser_late_noexcept_specifier): New.
2786 (noexcept_override_late_checks): New.
2787 (cp_parser_noexcept_specification_opt): Add FRIEND_P parameter. Call
2788 cp_parser_save_noexcept instead of the normal processing if needed.
2789 (cp_parser_exception_specification_opt): Add FRIEND_P parameter and
2790 pass it to cp_parser_noexcept_specification_opt.
2791 (cp_parser_save_member_function_body): Fix comment.
2792 (cp_parser_save_default_args): Maybe save the noexcept-specifier to
2794 (cp_parser_transaction): Update call to
2795 cp_parser_noexcept_specification_opt.
2796 (cp_parser_transaction_expression): Likewise.
2797 * parser.h (cp_unparsed_functions_entry): Add new field to carry
2798 a noexcept-specifier.
2799 * pt.c (dependent_type_p_r): Handle unparsed noexcept expression.
2800 * search.c (maybe_check_overriding_exception_spec): New function, broken
2802 (check_final_overrider): ...here. Call
2803 maybe_check_overriding_exception_spec.
2804 * tree.c (canonical_eh_spec): Handle UNPARSED_NOEXCEPT_SPEC_P.
2805 (cp_tree_equal): Handle DEFAULT_ARG.
2807 PR c++/90881 - bogus -Wunused-value in unevaluated context.
2808 * cvt.c (convert_to_void): Don't emit unused warnings in
2809 an unevaluated context.
2811 2019-06-22 Paolo Carlini <paolo.carlini@oracle.com>
2813 * decl.c (grokdeclarator): Use id_loc, typespec_loc, and
2814 locations[ds_storage_class] in a few additional places.
2816 2019-06-21 Paolo Carlini <paolo.carlini@oracle.com>
2820 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com>
2824 * call.c (build_over_call): Devirtualize when the final overrider
2825 comes from the base.
2827 2019-06-21 Marek Polacek <polacek@redhat.com>
2829 PR c++/61490 - qualified-id in friend function definition.
2830 * decl.c (grokdeclarator): Diagnose qualified-id in friend function
2831 definition. Improve location for diagnostics of friend functions.
2833 PR c++/60223 - ICE with T{} in non-deduced context.
2834 * pt.c (unify): Allow COMPOUND_LITERAL_P in a non-deduced context.
2836 PR c++/64235 - missing syntax error with invalid alignas.
2837 * parser.c (cp_parser_std_attribute_spec): Commit to tentative parse
2838 if there's a missing close paren.
2840 PR c++/90490 - fix decltype issues in noexcept-specifier.
2841 * except.c (build_noexcept_spec): Call
2842 instantiate_non_dependent_expr_sfinae before
2843 build_converted_constant_expr instead of calling
2844 instantiate_non_dependent_expr after it. Add
2845 processing_template_decl_sentinel.
2847 2019-06-21 Jakub Jelinek <jakub@redhat.com>
2850 * semantics.c (finish_omp_clauses): Don't reject references to
2851 incomplete types if processing_template_decl.
2853 2019-06-19 Marek Polacek <polacek@redhat.com>
2855 PR c++/60364 - noreturn after first decl not diagnosed.
2856 * decl.c (duplicate_decls): Give an error when a function is
2857 declared [[noreturn]] after its first declaration.
2858 * parser.c (cp_parser_std_attribute): Don't treat C++11 noreturn
2859 attribute as equivalent to GNU's.
2860 * tree.c (std_attribute_table): Add noreturn.
2862 2019-06-19 Jakub Jelinek <jakub@redhat.com>
2864 * cp-gimplify.c (cp_genericize_r): Handle OMP_CLAUSE_{IN,EX}CLUSIVE
2865 like OMP_CLAUSE_SHARED.
2867 2019-06-18 Jason Merrill <jason@redhat.com>
2869 * constexpr.c (cxx_eval_store_expression): Delay target evaluation.
2871 2019-06-18 Jason Merrill <jason@redhat.com>
2873 * constexpr.c (eval_and_check_array_index): Split out from...
2874 (cxx_eval_array_reference): ...here.
2875 (cxx_eval_store_expression): Use it here, too.
2876 (diag_array_subscript): Take location. Strip location wrapper.
2878 2019-06-18 Jason Merrill <jason@redhat.com>
2880 * constexpr.c (cxx_eval_constant_expression): Handle conversion from
2881 and then to the same type.
2883 2019-06-18 Jason Merrill <jason@redhat.com>
2885 * constexpr.c (unshare_constructor): Add MEM_STAT_DECL.
2887 2019-06-17 Jakub Jelinek <jakub@redhat.com>
2889 * semantics.c (finish_omp_clauses): For OMP_CLAUSE_REDUCTION_INSCAN
2890 set need_copy_assignment.
2892 2019-06-17 Marek Polacek <polacek@redhat.com>
2894 PR c++/83820 - excessive attribute arguments not detected.
2895 * parser.c (cp_parser_std_attribute): Detect excessive arguments.
2897 2019-06-17 Nathan Sidwell <nathan@acm.org>
2900 * name-lookup.c (lookup_type_scope_1): Calll qualify_lookup before
2903 2019-06-14 Marek Polacek <polacek@redhat.com>
2905 PR c++/90884 - stray note with -Wctor-dtor-privacy.
2906 * class.c (maybe_warn_about_overly_private_class): Guard the call to
2909 2019-06-12 Jason Merrill <jason@redhat.com>
2911 PR c++/85552 - wrong instantiation of dtor for DMI.
2912 * typeck2.c (digest_nsdmi_init): Set tf_no_cleanup for direct-init.
2914 2019-06-13 Paolo Carlini <paolo.carlini@oracle.com>
2916 * decl.c (grokdeclarator): Use id_loc in five additional places
2917 in the last part of the function.
2919 2019-06-13 Paolo Carlini <paolo.carlini@oracle.com>
2921 * decl.c (grokdeclarator): Move further up the declaration of
2922 id_loc, use it immediately, update its value after the loop
2923 over declarator, use it again in the final part of function;
2924 improve locations of error messages about multiple data types
2925 and conflicting specifiers.
2927 2019-06-13 Richard Biener <rguenther@suse.de>
2930 * typeck2.c (split_nonconstant_init_1): Properly count
2931 num_split_elts, optimize single constructor elt removal.
2933 2019-06-12 Marek Polacek <polacek@redhat.com>
2935 PR c++/66999 - 'this' captured by reference.
2936 * parser.c (cp_parser_lambda_introducer): Reject `&this'. Use
2937 cp_lexer_nth_token_is instead of cp_lexer_peek_nth_token.
2939 PR c++/90825 - endless recursion when evaluating sizeof.
2940 PR c++/90832 - endless recursion when evaluating sizeof.
2941 * constexpr.c (cxx_eval_constant_expression): Don't recurse on the
2942 result of fold_sizeof_expr if is returns a SIZEOF_EXPR.
2943 * typeck.c (cxx_sizeof_expr): Only return a SIZEOF_EXPR if the operand
2944 is instantiation-dependent.
2946 PR c++/90736 - bogus error with alignof.
2947 * constexpr.c (adjust_temp_type): Use cv_unqualified type.
2949 2019-06-11 Matthew Beliveau <mbelivea@redhat.com>
2951 PR c++/90449 - add -Winaccessible-base option.
2952 * class.c (warn_about_ambiguous_bases): Changed name to:
2953 maybe_warn_about_inaccessible_bases.
2954 (maybe_warn_about_inaccessible_bases): Implemented new
2955 Winaccessible-base warning option for both direct and virtual
2957 (layout_class_type): Call to warn_about_ambiguous_bases changed to fit
2960 2019-06-11 Richard Biener <rguenther@suse.de>
2963 * typeck2.c (split_nonconstant_init_1): Avoid ordered remove
2964 from CONSTRUCTOR by marking to remove elements and doing all
2965 of them in a O(n) scan.
2967 2019-06-11 Jakub Jelinek <jakub@redhat.com>
2970 * init.c (constant_value_1): Handle VECTOR_CST DECL_INITIAL for
2971 !DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P decls like CONSTRUCTOR.
2973 2019-06-11 Martin Liska <mliska@suse.cz>
2976 * pt.c (init_template_processing): Disable hash table
2977 sanitization for decl_specializations and type_specializations.
2979 2019-06-10 Jason Merrill <jason@redhat.com>
2981 * constexpr.c (free_constructor): New.
2982 (cxx_eval_call_expression): Free parameter value CONSTRUCTORs.
2984 * constexpr.c (unshare_constructor): Only unshare if T is itself a
2986 (cxx_eval_call_expression): Don't call it on the result here.
2988 Reduce constexpr_call memory consumption.
2989 * constexpr.c (cxx_bind_parameters_in_call): Use TREE_VEC rather
2991 (constexpr_call_hasher::equal, cxx_bind_parameters_in_call)
2992 (cxx_eval_call_expression): Adjust.
2994 2019-06-10 Jakub Jelinek <jakub@redhat.com>
2996 * parser.c (cp_parser_omp_clause_reduction): Don't sorry_at on inscan
2998 (cp_parser_omp_scan_loop_body): New function.
2999 (cp_parser_omp_for_loop): Call cp_parser_omp_scan_loop_body if there
3000 are inscan reduction clauses.
3001 (cp_parser_pragma): Reject PRAGMA_OMP_SCAN.
3002 * semantics.c (finish_omp_clauses): Reject mixing inscan with
3003 non-inscan reductions on the same construct, or inscan reductions with
3004 ordered or schedule clauses, or inscan array reductions.
3005 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_{IN,EX}CLUSIVE.
3006 (tsubst_expr): Handle OMP_SCAN.
3008 2019-06-07 Jason Merrill <jason@redhat.com>
3010 * constexpr.c (cxx_eval_constant_expression): Call
3011 STRIP_ANY_LOCATION_WRAPPER early.
3012 [CONVERT_EXPR]: Don't build anything for conversion to void.
3013 [ADDR_EXPR]: ggc_free unused ADDR_EXPR.
3015 2019-06-05 Martin Sebor <msebor@redhat.com>
3018 * typeck.c (maybe_warn_about_returning_address_of_local): Only
3019 consider functions returning pointers as candidates for
3020 -Wreturn-local-addr.
3022 2019-06-05 Paolo Carlini <paolo.carlini@oracle.com>
3024 * decl.c (smallest_type_location): New.
3025 (check_special_function_return_type): Use it.
3026 (grokdeclarator): Lkewise.
3028 2019-06-05 Paolo Carlini <paolo.carlini@oracle.com>
3030 * decl.c (grokdeclarator): Use locations[ds_friend]
3033 2019-06-05 Martin Sebor <msebor@redhat.com>
3035 * call.c (build_conditional_expr_1): Adjust quoting and hyphenation.
3036 (convert_like_real): Same.
3037 (convert_arg_to_ellipsis): Same.
3038 * constexpr.c (diag_array_subscript): Same.
3039 * constraint.cc (diagnose_trait_expression): Same.
3040 * cvt.c (ocp_convert): Same.
3041 * decl.c (start_decl): Same.
3042 (check_for_uninitialized_const_var): Same.
3044 (check_special_function_return_type): Same.
3045 (finish_enum_value_list): Same.
3046 (start_preparsed_function): Same.
3047 * parser.c (cp_parser_decl_specifier_seq): Same.
3048 * typeck.c (cp_build_binary_op): Same.
3049 (build_static_cast_1): Same.
3051 2019-06-04 Nina Dinka Ranns <dinka.ranns@gmail.com>
3053 PR c++/63149 - Wrong auto deduction from braced-init-list.
3054 * pt.c (listify_autos): use non cv qualified auto_node in
3055 std::initializer_list<auto>.
3057 2019-06-04 Paolo Carlini <paolo.carlini@oracle.com>
3059 * decl.c (grokdeclarator): Use declarator->id_loc in two
3062 2019-06-04 Nathan Sidwell <nathan@acm.org>
3064 * name-lookup.c (lookup_type_scope_1): Reimplement, handle local
3065 and namespace scopes separately.
3067 2019-06-04 Harald van Dijk <harald@gigawatt.nl>
3069 PR c++/60531 - Wrong error about unresolved overloaded function
3070 * typeck.c (cp_build_binary_op): See if overload can be resolved.
3071 (cp_build_unary_op): Ditto.
3073 2019-06-04 Jason Merrill <jason@redhat.com>
3075 Reduce accumulated garbage in constexpr evaluation.
3076 * constexpr.c (cxx_eval_call_expression): ggc_free any bindings we
3078 (cxx_eval_increment_expression): ggc_free the MODIFY_EXPR after
3081 2019-06-04 Jakub Jelinek <jakub@redhat.com>
3083 * cp-tree.h (CP_OMP_CLAUSE_INFO): Allow for any clauses up to _condvar_
3084 instead of only up to linear.
3086 2019-06-03 Paolo Carlini <paolo.carlini@oracle.com>
3088 * parser.c (cp_parser_unqualified_id): Use build_min_nt_loc in
3091 2019-06-01 Ville Voutilainen <ville.voutilainen@gmail.com>
3094 * class.c (fixup_type_variants): Handle CLASSTYPE_FINAL.
3096 2019-05-31 Nathan Sidwell <nathan@acm.org>
3098 * cp-tree.h (IDENTIFIER_LAMBDA_P): New.
3100 (LAMBDA_TYPE_P, TYPE_UNNAMED_P): Likewise.
3101 (LAMBDANAME_PREFIX, LAMBDANAME_FORMAT): Delete.
3102 (make_lambda_name): Don't declare.
3103 * error.c (dump_aggr_type): Check for lambdas before other
3105 * lambda.c (begin_lambda_type): Use make_anon_name.
3106 * cp-lang.c (cxx_dwarf_name): Lambda names smell anonymous.
3107 * mangle.c (write_local_name): Likewise.
3108 * name-lookup.c (lambda_cnt, make_lambda_name): Delete.
3110 2019-05-30 Marek Polacek <polacek@redhat.com>
3112 * cp-tree.h (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Fix a typo.
3114 2019-05-31 Paolo Carlini <paolo.carlini@oracle.com>
3116 * decl.c (grokdeclarator): Use declarator->id_loc in five
3119 2019-05-29 Jakub Jelinek <jakub@redhat.com>
3122 * tree.c (lvalue_kind): Return clk_none for expressions with
3125 2019-05-29 Paolo Carlini <paolo.carlini@oracle.com>
3128 * parser.c (cp_parser_sizeof_operand): When the type-id production
3129 did not work out commit to the tentative parse.
3131 2019-05-29 Jakub Jelinek <jakub@redhat.com>
3133 P1091R3 - Extending structured bindings to be more like var decls
3134 P1381R1 - Reference capture of structured bindings
3135 * decl.c (cp_maybe_mangle_decomp): Handle TREE_STATIC decls even at
3137 (cp_finish_decomp): Copy over various decl properties from decl to
3138 v[i] in the tuple case.
3139 (grokdeclarator): Allow static, thread_local and __thread for C++2a
3140 and use pedwarn instead of error for older standard revisions.
3141 Make other structured binding diagnostic messages more i18n friendly.
3143 2019-05-28 Nathan Sidwell <nathan@acm.org>
3145 * decl.c (duplicate_decls): Assert a template newdecl has no
3148 2019-05-28 Marek Polacek <polacek@redhat.com>
3150 PR c++/90548 - ICE with generic lambda and empty pack.
3151 * pt.c (tsubst_copy_and_build): Handle pack expansion properly.
3153 2019-05-28 Nathan Sidwell <nathan@acm.org>
3155 * cp-tree.h (make_anon_name): Drop declaration.
3156 (TYPE_UNNAMED_P): Use IDENTIFIER_ANON_P.
3157 * cp-lang.c (cxx_dwarf_name): Likewise.
3158 * class.c (find_flexarrays): Likewise.
3159 * decl.c (name_unnamed_type, xref_tag_1): Likewise.
3160 * error.c (dump_aggr_type): Likewise.
3161 * pt.c (push_template_decl_real): Likewise.
3162 * name-lookup.c (consider_binding_level): Likewise.
3163 (anon_cnt, make_anon_name): Delete.
3165 2019-05-25 Marek Polacek <polacek@redhat.com>
3167 PR c++/90572 - wrong disambiguation in friend declaration.
3168 * parser.c (cp_parser_constructor_declarator_p): Don't allow missing
3169 typename for friend declarations.
3171 2019-05-23 Jonathan Wakely <jwakely@redhat.com>
3173 * cp-tree.h (CP_AGGREGATE_TYPE_P): Fix whitespace.
3175 * init.c (std_placement_new_fn_p): Remove outdated TODO comment that
3176 was resolved by r254694.
3178 2019-05-22 Jason Merrill <jason@redhat.com>
3180 PR c++/20408 - unnecessary code for empty struct.
3181 * call.c (build_call_a): Use simple_empty_class_p.
3183 PR c++/86485 - -Wmaybe-unused with empty class ?:
3184 * cp-gimplify.c (simple_empty_class_p): Also true for MODIFY_EXPR.
3186 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com>
3188 * parser.c (cp_parser_template_declaration_after_parameters): Use
3189 DECL_SOURCE_LOCATION in literal operator template errors.
3191 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com>
3195 * call.c (build_over_call): Devirtualize when the final overrider
3196 comes from the base.
3198 2019-05-21 Nathan Sidwell <nathan@acm.org>
3200 * name-lookup.c (do_nonmember_using_decl): Drop INSERT_P
3201 parameter. Document.
3202 (finish_nonmember_using_decl): Adjust do_nonmember_using_decl
3203 calls. Remove stray FIXME comment.
3205 * name-lookup.h (struct cp_binding_level): Drop usings field.
3206 (finish_namespace_using_decl, finish_local_using_decl): Replace with ...
3207 (finish_nonmember_using_decl): ... this.
3208 * name-lookup.c (push_using_decl_1, push_using_decl):
3209 (do_nonmember_using_decl): ... here. Add INSERT_P arg. Reimplement.
3210 (validate_nonmember_using_decl, finish_namespace_using_decl)
3211 (finish_local_using_decl): Replace with ...
3212 (finish_nonmember_using_decl): ... this. Drop DECL parm.
3213 * parser.c (cp_parser_using_declaration): Don't do lookup here.
3214 * pt.c (tsubst_expr): Do not do using decl lookup here.
3216 2019-05-21 Eric Botcazou <ebotcazou@adacore.com>
3218 * decl2.c (cpp_check) <IS_ASSIGNMENT_OPERATOR>: New case.
3220 2019-05-20 Marek Polacek <polacek@redhat.com>
3222 CWG 2094 - volatile scalars are trivially copyable.
3224 * tree.c (trivially_copyable_p): Don't check CP_TYPE_VOLATILE_P for
3227 2019-05-20 Marek Polacek <polacek@redhat.com>
3229 * pt.c (convert_template_argument): Add a diagnostic for the
3230 [temp.arg]/2 ambiguity case.
3232 * name-lookup.c (finish_using_directive): Don't issue inform() if the
3233 warning didn't trigger. Add quoting. Tweak the inform message.
3235 2019-05-20 Paolo Carlini <paolo.carlini@oracle.com>
3237 * cp-tree.h: Remove remnants of CONV_NONCONVERTING.
3239 2019-05-20 Nathan Sidwell <nathan@acm.org>
3241 * name-lookup.c (finish_namespace_using_directive)
3242 (finish_local_using_directive): Merge to ...
3243 (finish_using_directive): ... here. Handle both contexts.
3244 * name-lookup.h (finish_namespace_using_directive)
3245 (finish_local_using_directive): Replace with ...
3246 (finish_using_directive): ... this.
3247 * parser.c (cp_parser_using_directive): Adjust.
3248 * pt.c (tsubst_expr): Likewise.
3250 * cp-tree.h (struct lang_decl_ns): Remove usings field.
3251 (DECL_NAMESPACE_USING): Delete.
3252 * name-lookup.c (name_lookup::search_usings): Use namespace's
3254 (name_lookup::queue_namespae): Likewise.
3255 (finish_namespace_using_directive, push_namespace): Likewise.
3256 (has_using_namespace_std_directive): Just search the entire
3259 2019-05-20 Jonathan Wakely <jwakely@redhat.com>
3261 PR c++/90532 Ensure __is_constructible(T[]) is false
3262 * method.c (is_xible_helper): Return error_mark_node for construction
3263 of an array of unknown bound.
3265 2019-05-17 Thomas Schwinge <thomas@codesourcery.com>
3268 * parser.c (cp_finalize_oacc_routine): Rework checking if already
3269 marked with an OpenACC 'routine' directive.
3272 * parser.c (cp_parser_oacc_routine)
3273 (cp_parser_late_parsing_oacc_routine): Normalize order of clauses.
3274 (cp_finalize_oacc_routine): Call oacc_verify_routine_clauses.
3277 * parser.c (cp_finalize_oacc_routine): Refer to OpenACC 'routine'
3278 clauses from "omp declare target" attribute.
3280 2019-05-16 Martin Sebor <msebor@redhat.com>
3282 * call.c (print_z_candidate): Wrap diagnostic text in a gettext
3284 (print_z_candidates): Same.
3285 (build_conditional_expr_1): Quote keywords, operators, and types
3287 (build_op_delete_call): Same.
3288 (maybe_print_user_conv_context): Wrap diagnostic text in a gettext
3290 (convert_like_real): Same.
3291 (convert_arg_to_ellipsis): Quote keywords, operators, and types
3293 (build_over_call): Same.
3294 (joust): Break up an overlong line. Wrap diagnostic text in a gettext
3296 * constexpr.c (cxx_eval_check_shift_p): Spell out >= in English.
3297 (cxx_eval_constant_expression): Quote keywords, operators, and types
3299 (potential_constant_expression_1): Same.
3300 * cp-gimplify.c (cp_genericize_r): Same.
3301 * cvt.c (maybe_warn_nodiscard): Quote keywords, operators, and types
3303 (type_promotes_to): Same.
3304 * decl.c (check_previous_goto_1): Same.
3307 (cp_finish_decl): Avoid parenthesizing a sentence for consistency.
3308 (grok_op_properties): Quote keywords, operators, and types
3310 * decl2.c (grokfield): Same.
3311 (coerce_delete_type): Same.
3312 * except.c (is_admissible_throw_operand_or_catch_parameter): Same.
3313 * friend.c (do_friend): Quote C++ tokens.
3314 * init.c (build_new_1): Quote keywords, operators, and types
3316 (build_vec_delete_1): Same.
3317 (build_delete): Same.
3318 * lex.c (parse_strconst_pragma): Same.
3319 (handle_pragma_implementation): Same.
3320 (unqualified_fn_lookup_error): Same.
3321 * mangle.c (write_type): Same.
3322 * method.c (defaulted_late_check): Avoid two consecutive punctuators.
3323 * name-lookup.c (cp_binding_level_debug): Remove a trailing newline.
3324 (pop_everything): Same.
3325 * parser.c (cp_lexer_start_debugging): Quote a macro name.
3327 (cp_lexer_stop_debugging): Same.
3328 (cp_parser_userdef_numeric_literal): Quote a C++ header name
3330 (cp_parser_nested_name_specifier_opt): Quote keywords, operators,
3331 and types in diagnostics.
3332 (cp_parser_question_colon_clause): Same.
3333 (cp_parser_asm_definition): Same.
3334 (cp_parser_init_declarator): Same.
3335 (cp_parser_template_declaration_after_parameters): Avoid capitalizing
3336 a sentence in a diagnostic.
3337 (cp_parser_omp_declare_reduction): Quote keywords, operators, and types
3339 (cp_parser_transaction): Same.
3340 * pt.c (maybe_process_partial_specialization): Replace second call
3341 to permerror with inform for consistency with other uses.
3342 (expand_integer_pack): Quote keywords, operators, and types
3344 * rtti.c (get_typeid): Quote keywords, operators, and types
3346 (build_dynamic_cast_1): Same.
3347 * semantics.c (finish_asm_stmt): Same.
3348 (finish_label_decl): Same.
3349 (finish_bases): Same.
3350 (finish_offsetof): Same.
3351 (cp_check_omp_declare_reduction): Same.
3352 (finish_decltype_type): Same.
3353 * tree.c (handle_init_priority_attribute): Same. Add detail
3355 (maybe_warn_zero_as_null_pointer_constant): Same.
3356 * typeck.c (cp_build_binary_op): Quote keywords, operators, and types
3358 (cp_build_unary_op): Same.
3359 (check_for_casting_away_constness): Same.
3360 (build_static_cast): Same.
3361 (build_const_cast_1): Same.
3362 (maybe_warn_about_returning_address_of_local): Same.
3363 (check_return_expr): Same.
3364 * typeck2.c (abstract_virtuals_error_sfinae): Same.
3365 (digest_init_r): Replace a tab with spaces in a diagnostic.
3366 (build_functional_cast): Quote keywords, operators, and types
3369 2019-05-15 Jakub Jelinek <jakub@redhat.com>
3372 * cp-gimplify.c (genericize_cp_loop): Emit a DEBUG_BEGIN_STMT
3373 before the condition (or if missing or constant non-zero at the end
3374 of the loop. Emit a DEBUG_BEGIN_STMT before the increment expression
3375 if any. Don't call protected_set_expr_location on incr if it already
3378 2019-05-15 Marek Polacek <polacek@redhat.com>
3380 CWG 2096 - constraints on literal unions.
3381 * class.c (check_field_decls): Initialize booleans directly. A union
3382 is literal if at least one of its non-static data members is of
3383 non-volatile literal type.
3385 2019-05-15 Paolo Carlini <paolo.carlini@oracle.com>
3387 * cp-tree.h (REFERENCE_VLA_OK): Remove.
3388 * lambda.c (build_capture_proxy): Remove use of the above.
3390 2019-05-15 Paolo Carlini <paolo.carlini@oracle.com>
3392 * call.c (perform_overload_resolution, build_new_method_call_1):
3393 Use OVL_P; remove redundant TEMPLATE_DECL checks.
3394 * decl.c (grokfndecl): Likewise.
3395 * mangle.c (write_expression): Likewise.
3396 * parser.c (cp_parser_template_id): Likewise.
3397 * pt.c (resolve_overloaded_unification, type_dependent_expression_p):
3399 * search.c (build_baselink): Likewise.
3400 * tree.c (is_overloaded_fn, dependent_name, maybe_get_fns): Likewise.
3402 2019-05-14 Paolo Carlini <paolo.carlini@oracle.com>
3404 PR preprocessor/90382
3405 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
3408 2019-05-13 Jason Merrill <jason@redhat.com>
3410 Use releasing_vec more broadly.
3411 * cp-tree.h (struct releasing_vec): Replace get_ref method with
3413 (vec_safe_push, vec_safe_reserve, vec_safe_length, vec_safe_splice):
3414 Forwarding functions for releasing_vec.
3415 (release_tree_vector): Declare but don't define.
3416 * call.c (build_op_delete_call, build_temp, call_copy_ctor)
3417 (perform_direct_initialization_if_possible): Use releasing_vec.
3418 * constexpr.c (cxx_eval_vec_init_1, cxx_eval_store_expression):
3420 * cp-gimplify.c (cp_fold): Likewise.
3421 * cvt.c (force_rvalue, ocp_convert): Likewise.
3422 * decl.c (get_tuple_decomp_init): Likewise.
3423 * except.c (build_throw): Likewise.
3424 * init.c (perform_member_init, expand_default_init): Likewise.
3425 * method.c (do_build_copy_assign, locate_fn_flags): Likewise.
3426 * parser.c (cp_parser_userdef_char_literal)
3427 (cp_parser_userdef_numeric_literal)
3428 (cp_parser_userdef_string_literal)
3429 (cp_parser_perform_range_for_lookup)
3430 (cp_parser_range_for_member_function, cp_parser_omp_for_loop)
3431 (cp_parser_omp_for_loop_init): Likewise.
3432 * pt.c (tsubst_copy_and_build, do_class_deduction): Likewise.
3433 * semantics.c (calculate_direct_bases, calculate_bases)
3434 (finish_omp_barrier, finish_omp_flush, finish_omp_taskwait)
3435 (finish_omp_taskyield, finish_omp_cancel)
3436 (finish_omp_cancellation_point): Likewise.
3437 * tree.c (build_vec_init_elt, strip_typedefs, strip_typedefs_expr)
3438 (build_min_non_dep_op_overload): Likewise.
3439 * typeck.c (build_function_call_vec, cp_build_function_call_nary)
3440 (cp_build_modify_expr): Likewise.
3441 * typeck2.c (build_functional_cast): Likewise.
3443 2019-05-11 Paolo Carlini <paolo.carlini@oracle.com>
3445 * typeck.c (cp_build_function_call_vec): When mark_used fails
3446 unconditionally return error_mark_node.
3448 2019-05-10 Paolo Carlini <paolo.carlini@oracle.com>
3450 * decl.c (grokvardecl): Use an accurate location in error message
3451 about main as a global variable.
3453 2019-05-10 Paolo Carlini <paolo.carlini@oracle.com>
3455 * call.c (build_call_a): Use FUNC_OR_METHOD_TYPE_P.
3456 * cp-gimplify.c (cp_fold): Likewise.
3457 * cp-objcp-common.c (cp_type_dwarf_attribute): Likewise.
3458 * cp-tree.h (TYPE_OBJ_P, TYPE_PTROBV_P): Likewise.
3459 * cvt.c (perform_qualification_conversions): Likewise.
3460 * decl.c (grokdeclarator): Likewise.
3461 * decl2.c (build_memfn_type): Likewise.
3462 * mangle.c (canonicalize_for_substitution, write_type): Likewise.
3463 * parser.c (cp_parser_omp_declare_reduction): Likewise.
3464 * pt.c (check_explicit_specialization, uses_deducible_template_parms,
3465 check_cv_quals_for_unify, dependent_type_p_r): Likewise.
3466 * rtti.c (ptr_initializer): Likewise.
3467 * semantics.c (finish_asm_stmt, finish_offsetof,
3468 cp_check_omp_declare_reduction): Likewise.
3469 * tree.c (cp_build_qualified_type_real,
3470 cp_build_type_attribute_variant, cxx_type_hash_eq,
3471 cxx_copy_lang_qualifiers, cp_free_lang_data): Likewise.
3472 * typeck.c (structural_comptypes, convert_arguments,
3473 cp_build_addr_expr_1, unary_complex_lvalue, cp_build_c_cast,
3474 cp_build_modify_expr, comp_ptr_ttypes_real, type_memfn_rqual):
3477 2019-05-10 Marek Polacek <polacek@redhat.com>
3479 PR c++/78010 - bogus -Wsuggest-override warning on final function.
3480 * class.c (check_for_override): Don't warn for final functions.
3482 2019-05-10 Jakub Jelinek <jakub@redhat.com>
3485 * config-lang.in (gtfiles): Remove c-family/c-lex.c, add
3486 c-family/c-cppbuiltin.c.
3488 2019-05-09 Paolo Carlini <paolo.carlini@oracle.com>
3492 2018-04-26 Paolo Carlini <paolo.carlini@oracle.com>
3494 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
3497 2019-05-08 Nathan Sidwell <nathan@acm.org>
3499 Kill DECL_SAVED_FUNCTION_DATA .
3500 * cp-tree.h (language_function): Remove x_auto_return_pattern.
3501 (current_function_auto_return_pattern): Delete.
3502 (lang_decl_fn): Replace saved_language_function with
3503 saved_auto_return type.
3504 (DECL_SAVED_FUNCTION_DATA): Delete.
3505 (DECL_SAVED_AUTO_RETURN_TYPE): New.
3506 (FNDECL_USED_AUTO): Correct documentation.
3507 * decl.c (duplicate_decls): Adjust AUTO return handling.
3508 (start_preparsed_function): Replace
3509 current_function_auto_return_pattern with
3510 DECL_SAVED_AUTO_RETURN_TYPE. Remove DECL_SAVED_FUNCTION_DATA
3512 (finish_function): Likewise.
3513 (save_function_data): Delete.
3514 (fndecl_declared_return_type): Reimplement.
3515 * mangle.c (write_unqualified_name): Use DECL_SAVED_AUTO_RETURN_TYPE.
3516 * method.c (make_thunk, make_alias_for): Likewise.
3517 * parser.c (cp_parser_jump_statement): Likewise.
3518 * pt.c (do_auto_deduction): Likewise.
3519 * typeck.c (check_return_expr): Likewise.
3521 2019-05-06 Jason Merrill <jason@redhat.com>
3523 PR c++/90171 - reorganize usual_deallocation_fn_p
3524 * call.c (struct dealloc_info): New.
3525 (usual_deallocation_fn_p): Take a dealloc_info*.
3526 (aligned_deallocation_fn_p, sized_deallocation_fn_p): Remove.
3527 (build_op_delete_call): Adjust.
3529 2019-05-07 Jason Merrill <jason@redhat.com>
3531 PR c++/86485 - -Wmaybe-unused with empty class ?:
3532 * typeck.c (build_static_cast_1): Use cp_build_addr_expr.
3534 * pt.c (type_dependent_expression_p): A non-type template parm with
3535 a placeholder type is type-dependent.
3537 2019-05-06 Marek Polacek <polacek@redhat.com>
3539 PR c++/90265 - ICE with generic lambda.
3540 * pt.c (tsubst_copy_and_build): Use a dedicated variable for the last
3541 element in the vector.
3543 2019-05-03 Martin Liska <mliska@suse.cz>
3545 * call.c (build_aggr_conv): Use is_empty instead of
3546 elements () == 0 (and similar usages).
3547 * parser.c (cp_parser_lambda_introducer): Likewise.
3549 2019-05-02 Nathan Sidwell <nathan@acm.org>
3551 * semantics.c (finish_id_expression_1): Remove unreachable code.
3553 2019-05-01 Nathan Sidwell <nathan@acm.org>
3555 * name-lookup.h (get_class_binding_direct): Change final arg to
3557 (get_class_binding): Likewise.
3558 * name-lookup.c (get_class_binding_direct): Replace TYPE_OR_FNS
3559 arg with WANT_TYPE bool. Simplify.
3560 (get_class_binding): Adjust final arg.
3561 * decl.c (reshape_init_class): Adjust get_class_binding calls.
3563 2019-04-30 Nathan Sidwell <nathan@acm.org>
3565 * cp-objcp-common.c (cp_common_init_ts): Use MARK_TS_EXP for _EXPR
3566 nodes. Call c_common_init_ts.
3568 2019-04-29 Nathan Sidwell <nathan@acm.org>
3570 * decl.c (duplicate_decls): Add whitespace, move comments into
3572 * method.c (explain_implicit_non_constexpr): Refactor.
3573 * pt.c (check_explicit_specialization): Fix indentation.
3574 * semantics.c (process_outer_var_ref): Reformat.
3575 (finish_id_expression_1): Use STRIP_TEMPLATE.
3577 2019-04-26 Jonathan Wakely <jwakely@redhat.com>
3579 PR c++/90243 - orphaned note in uninstantiated constexpr function
3580 * decl.c (check_for_uninitialized_const_var): Suppress notes if no
3583 2019-04-26 Paolo Carlini <paolo.carlini@oracle.com>
3586 * decl.c (grokdeclarator): Set type to error_mark_node
3587 upon error about template placeholder type non followed
3588 by a simple declarator-id.
3590 2019-04-26 Paolo Carlini <paolo.carlini@oracle.com>
3592 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
3595 2019-04-24 Jason Merrill <jason@redhat.com>
3597 PR c++/90227 - error with template parameter packs.
3598 * pt.c (coerce_template_parms): Do add empty pack when
3601 2019-04-24 Richard Biener <rguenther@suse.de>
3603 * call.c (null_ptr_cst_p): Order checks according to expensiveness.
3604 (conversion_null_warnings): Likewise.
3605 * typeck.c (same_type_ignoring_top_level_qualifiers_p): Return
3606 early if type1 == type2.
3608 2019-04-22 Jason Merrill <jason@redhat.com>
3610 PR c++/87366 - wrong error with alias template.
3611 * typeck.c (structural_comptypes): When comparing_specializations,
3612 aliases are unequal.
3613 (comptypes): When comparing_specializations, do structural
3616 2019-04-19 Jason Merrill <jason@redhat.com>
3618 PR c++/90190 - CTAD with list-constructor.
3619 * pt.c (do_class_deduction): Don't try the single element deduction
3620 if the single element is also a braced list.
3622 PR c++/90171 - ICE with destroying delete with size_t parm.
3623 * call.c (sized_deallocation_fn_p): New. Use it instead of
3624 second_parm_is_size_t in most cases.
3625 (second_parm_is_size_t): Don't check for aligned.
3627 2019-04-19 Paolo Carlini <paolo.carlini@oracle.com>
3630 * pt.c (fn_type_unification): When handling null explicit
3631 arguments do not special case non-parameter packs.
3633 2019-04-19 Jakub Jelinek <jakub@redhat.com>
3636 * pt.c (process_template_parm): Set decl to pushdecl result. If
3637 !is_non_type, also set parm to that.
3640 * decl.c (struct cp_switch): Remove outside_range_p member.
3641 (push_switch): Don't clear it.
3642 (pop_switch): Adjust c_do_switch_warnings caller.
3643 (finish_case_label): Adjust c_add_case_label caller.
3646 * decl.c (duplicate_decls): If remove is main variant and
3647 DECL_ORIGINAL_TYPE is some other type, remove a DECL_ORIGINAL_TYPE
3648 variant that has newdecl as TYPE_NAME if any.
3650 2019-04-18 Jason Merrill <jason@redhat.com>
3652 PR c++/87554 - ICE with extern template and reference member.
3653 * decl.c (cp_finish_decl): Don't set DECL_INITIAL of external vars.
3655 2019-04-17 Jason Merrill <jason@redhat.com>
3657 PR c++/90047 - ICE with enable_if alias template.
3658 * pt.c (tsubst_decl) [TYPE_DECL]: Don't put an erroneous decl in the
3659 hash table when we're in SFINAE context.
3661 2019-04-17 Marek Polacek <polacek@redhat.com>
3663 PR c++/90124 - bogus error with incomplete type in decltype.
3664 * typeck.c (build_class_member_access_expr): Check
3665 cp_unevaluated_operand.
3667 2019-04-12 Jakub Jelinek <jakub@redhat.com>
3670 * decl.c (duplicate_decls): When newdecl's type is its main variant,
3671 don't try to remove it from the variant list, but instead assert
3674 2019-04-12 Martin Sebor <msebor@redhat.com>
3678 * parser.c (cp_parser_has_attribute_expression): Handle assignment
3681 2019-04-12 Jason Merrill <jason@redhat.com>
3683 * call.c (null_member_pointer_value_p): Handle an empty CONSTRUCTOR
3686 2019-04-12 Marek Polacek <polacek@redhat.com>
3688 * except.c (build_noexcept_spec): Use build_converted_constant_bool_expr
3689 instead of perform_implicit_conversion_flags.
3691 PR c++/87603 - constexpr functions are no longer noexcept.
3692 * constexpr.c (is_sub_constant_expr): Remove unused function.
3693 * cp-tree.h (is_sub_constant_expr): Remove declaration.
3694 * except.c (check_noexcept_r): Don't consider a call to a constexpr
3697 2019-04-11 Jakub Jelinek <jakub@redhat.com>
3699 PR translation/90035
3700 * parser.h (struct cp_parser): Add
3701 type_definition_forbidden_message_arg member.
3702 * parser.c (cp_debug_parser): Print it.
3703 (cp_parser_check_type_definition): Pass
3704 parser->type_definition_forbidden_message_arg as second argument to
3706 (cp_parser_has_attribute_expression, cp_parser_sizeof_operand): Set
3707 parser->type_definition_forbidden_message_arg and use G_() with
3708 %qs for parser->type_definition_forbidden_message instead of
3709 building untranslatable message using concat.
3711 2019-04-09 Jakub Jelinek <jakub@redhat.com>
3713 PR translation/90011
3714 * typeck2.c (check_narrowing): Remove trailing space from diagnostics.
3716 2019-04-08 Marek Polacek <polacek@redhat.com>
3718 * typeck2.c (digest_init_r): Don't condition the object slicing warning
3721 2019-04-08 Paolo Carlini <paolo.carlini@oracle.com>
3724 * semantics.c (trait_expr_value): Don't use TYPE_NOTHROW_P
3725 when maybe_instantiate_noexcept fails.
3726 (classtype_has_nothrow_assign_or_copy_p): Likewise.
3727 * method.c (implicitly_declare_fn): Avoid passing error_mark_node
3728 to build_exception_variant.
3730 2019-04-05 Marek Polacek <polacek@redhat.com>
3732 PR c++/87145 - bogus error converting class type in template arg list.
3733 * pt.c (convert_nontype_argument): Don't call
3734 build_converted_constant_expr if it could involve calling a conversion
3735 function with a instantiation-dependent constructor as its argument.
3737 2019-04-05 Martin Sebor <msebor@redhat.com>
3740 * decl.c (reshape_init_array_1): Avoid treating empty strings
3741 as zeros in array initializers.
3742 Use trivial_type_p () instead of TYPE_HAS_TRIVIAL_DFLT().
3744 2019-04-04 Jason Merrill <jason@redhat.com>
3746 PR c++/89948 - ICE with break in statement-expr.
3747 * constexpr.c (cxx_eval_statement_list): Jumping out of a
3748 statement-expr is non-constant.
3750 2019-04-04 Jason Merrill <jason@redhat.com>
3752 PR c++/89966 - error with non-type auto tparm.
3753 * pt.c (do_auto_deduction): Clear tf_partial.
3755 2019-04-04 Jason Merrill <jason@redhat.com>
3757 PR c++/86986 - ICE with TTP with parameter pack.
3758 * pt.c (coerce_template_parameter_pack): Only look at the type of a
3759 non-type parameter pack.
3760 (fixed_parameter_pack_p_1): Don't recurse into the type of a
3761 non-type parameter pack.
3762 (coerce_template_template_parms): Call add_outermost_template_args.
3764 2019-04-04 Martin Sebor <msebor@redhat.com>
3770 * decl.c (reshape_init_array_1): Strip trailing zero-initializers
3771 from arrays of trivial type and known size.
3772 * mangle.c (write_expression): Convert braced initializer lists
3774 (write_expression): Trim trailing zero-initializers from arrays
3776 (write_template_arg_literal): Mangle strings the same as braced
3779 2019-04-03 Jason Merrill <jason@redhat.com>
3781 PR c++/81866 - ICE with member template and default targ.
3782 * pt.c (tsubst_template_decl): Handle getting a type from
3783 retrieve_specialization.
3785 PR c++/86586 - -fcompare-debug=-Wsign-compare.
3786 * typeck.c (cp_build_binary_op): Don't fold for -Wsign-compare.
3788 PR c++/89331 - ICE with offsetof in incomplete class.
3789 * semantics.c (finish_offsetof): Handle error_mark_node.
3790 * typeck.c (build_class_member_access_expr): Call
3791 complete_type_or_maybe_complain before converting to base.
3793 PR c++/89917 - ICE with lambda in variadic mem-init.
3794 * pt.c (make_pack_expansion): Change type_pack_expansion_p to false.
3796 2019-04-01 Jason Merrill <jason@redhat.com>
3798 PR c++/86946 - ICE with function call in template argument.
3800 * pt.c (iterative_hash_template_arg) [CALL_EXPR]: Use
3803 2019-04-01 Paolo Carlini <paolo.carlini@oracle.com>
3806 * pt.c (tsubst_copy): Deal with lookup_name not returing a variable.
3808 2019-03-31 Marek Polacek <polacek@redhat.com>
3810 PR c++/89852 - ICE with C++11 functional cast with { }.
3811 * constexpr.c (fold_non_dependent_expr_template): New static function
3813 (fold_non_dependent_expr): ...here.
3814 (fold_non_dependent_init): New function.
3815 * cp-tree.h (fold_non_dependent_init): Declare.
3816 * typeck2.c (massage_init_elt): Call fold_non_dependent_init instead
3817 of fold_non_dependent_expr. Don't call maybe_constant_init.
3819 2019-03-30 Jason Merrill <jason@redhat.com>
3821 PR c++/89744 - ICE with specialization of member class template.
3822 * pt.c (lookup_template_class_1): If the partial instantiation is
3823 explicitly specialized, adjust.
3824 (maybe_process_partial_specialization): Also adjust
3827 2019-03-29 Jakub Jelinek <jakub@redhat.com>
3830 * typeck.c: Include gimplify.h.
3831 (cp_build_modify_expr) <case COND_EXPR>: Unshare rhs before using it
3832 for second time. Formatting fixes.
3834 2019-03-29 Marek Polacek <polacek@redhat.com>
3836 PR c++/89876 - ICE with deprecated conversion.
3837 * call.c (convert_like_real): Only give warnings with tf_warning.
3839 2019-03-28 Marek Polacek <polacek@redhat.com>
3841 PR c++/89612 - ICE with member friend template with noexcept.
3842 * pt.c (maybe_instantiate_noexcept): For function templates, use their
3843 template result (function decl). Don't set up local specializations.
3844 Temporarily turn on processing_template_decl. Update the template type
3847 PR c++/89836 - bool constant expression and explicit conversions.
3848 * call.c (build_converted_constant_expr_internal): New function,
3850 (build_converted_constant_expr): ...this. New.
3851 (build_converted_constant_bool_expr): New.
3852 * cp-tree.h (build_converted_constant_bool_expr): Declare.
3853 * decl.c (build_explicit_specifier): Call
3854 build_converted_constant_bool_expr.
3856 2019-03-28 Jakub Jelinek <jakub@redhat.com>
3859 * constexpr.c (struct check_for_return_continue_data): New type.
3860 (check_for_return_continue): New function.
3861 (potential_constant_expression_1) <case SWITCH_STMT>: Walk
3862 SWITCH_STMT_BODY to find RETURN_EXPRs or CONTINUE_STMTs not nested
3863 in loop bodies and set *jump_target to that if found.
3865 2019-03-27 Jason Merrill <jason@redhat.com>
3867 PR c++/89831 - error with qualified-id in const member function.
3868 * semantics.c (finish_non_static_data_member): Use object cv-quals
3869 in scoped case, too.
3871 PR c++/89421 - ICE with lambda in template parameter list.
3872 * parser.c (cp_parser_lambda_expression): Also reject a lambda in a
3873 template parameter list before C++20.
3874 * pt.c (type_dependent_expression_p): True for LAMBDA_EXPR.
3875 * semantics.c (begin_class_definition): Restore error about defining
3876 non-lambda class in template parm list.
3878 2019-03-26 Jason Merrill <jason@redhat.com>
3880 PR c++/86932 - missed SFINAE with empty pack.
3881 * pt.c (coerce_template_parms): Don't add an empty pack if
3883 (fn_type_unification): Pass tf_partial to coerce_template_parms.
3885 PR c++/86429 - constexpr variable in lambda.
3888 * constexpr.c (cxx_eval_constant_expression): In a lambda function,
3889 try evaluating the captured variable directly.
3891 2019-03-26 Jakub Jelinek <jakub@redhat.com>
3894 * semantics.c (finish_omp_atomic): Add warning_sentinel for
3895 -Wunused-value around finish_expr_stmt call.
3897 2019-03-25 Paolo Carlini <paolo.carlini@oracle.com>
3901 * parser.c (cp_parser_binary_expression): Don't call cp_fully_fold
3902 to undo the disabling of warnings.
3904 2019-03-25 Jason Merrill <jason@redhat.com>
3906 PR c++/87748 - substitution failure error with decltype.
3907 * pt.c (most_specialized_partial_spec): Clear
3908 processing_template_decl.
3910 2019-03-25 Marek Polacek <polacek@redhat.com>
3912 PR c++/89214 - ICE when initializing aggregates with bases.
3913 * typeck2.c (digest_init_r): Warn about object slicing instead of
3916 PR c++/89705 - ICE with reference binding with conversion function.
3917 * call.c (reference_binding): If the result of the conversion function
3918 is a prvalue of non-class type, use the cv-unqualified type.
3920 2019-03-25 Nathan Sidwell <nathan@acm.org>
3922 * lambda.c (maybe_add_lambda_conv_op): Don't add to comdat group.
3924 2019-03-22 Jakub Jelinek <jakub@redhat.com>
3927 * cp-tree.h (get_tls_wrapper_fn): Remove declaration.
3928 (maybe_get_tls_wrapper_call): Declare.
3929 * decl2.c (get_tls_wrapper_fn): Make static.
3930 (maybe_get_tls_wrapper_call): New function.
3931 * typeck.c (build_class_member_access_expr): Handle accesses to TLS
3933 * semantics.c (finish_qualified_id_expr): Likewise.
3934 (finish_id_expression_1): Use maybe_get_tls_wrapper_call.
3935 * pt.c (tsubst_copy_and_build): Likewise.
3938 * constexpr.c (struct constexpr_ctx): Add constexpr_ops_count member.
3939 (cxx_eval_constant_expression): When not skipping, not constant class
3940 or location wrapper, increment *ctx->constexpr_ops_count and if it is
3941 above constexpr_loop_nest_limit, diagnose failure.
3942 (cxx_eval_outermost_constant_expr): Add constexpr_ops_count and
3943 initialize ctx.constexpr_ops_count to its address.
3944 (is_sub_constant_expr): Likewise.
3946 2019-03-21 Jakub Jelinek <jakub@redhat.com>
3949 * call.c (filed_in_pset): Change pset from hash_set<tree> * to
3950 hash_set<tree, true> &, adjust uses accordingly.
3951 (build_aggr_conv): Change pset from hash_set<tree> *
3952 to hash_set<tree, true>. Replace goto fail; with return NULL;,
3956 * parser.c (cp_parser_lambda_introducer): Add ids and first_capture_id
3957 variables, check for duplicates in this function.
3958 * lambda.c (add_capture): Don't check for duplicates nor use
3960 (register_capture_members): Don't clear IDENTIFIER_MARKED here.
3962 2019-03-21 Paolo Carlini <paolo.carlini@oracle.com>
3965 * method.c (after_nsdmi_defaulted_late_checks): Avoid passing
3966 error_mark_node to comp_except_specs.
3968 2019-03-20 Jason Merrill <jason@redhat.com>
3970 PR c++/87480 - decltype of member access in default template arg
3971 * pt.c (type_unification_real): Accept a dependent result in
3974 2019-03-19 Martin Sebor <msebor@redhat.com>
3976 PR tree-optimization/89688
3977 * typeck2.c (store_init_value): Call braced_lists_to_string for more
3978 kinds of initializers.
3980 2019-03-18 Jason Merrill <jason@redhat.com>
3982 PR c++/89630 - ICE with dependent using-decl as template arg.
3983 * tree.c (cp_tree_equal): Always return false for USING_DECL.
3985 PR c++/89761 - ICE with sizeof... in pack expansion.
3986 * pt.c (argument_pack_element_is_expansion_p): Handle
3987 ARGUMENT_PACK_SELECT.
3989 PR c++/89640 - GNU attributes on lambda.
3990 * parser.c (cp_parser_lambda_declarator_opt): Allow GNU attributes.
3992 PR c++/89682 - wrong access error in default argument.
3993 * pt.c (tsubst_default_argument): Don't defer access checks.
3995 2019-03-18 Paolo Carlini <paolo.carlini@oracle.com>
3998 * semantics.c (finish_non_static_data_member): Check return value
3999 of context_for_name_lookup and immediately return error_mark_node
4002 2019-03-17 Jason Merrill <jason@redhat.com>
4004 PR c++/89571 - ICE with ill-formed noexcept on constructor.
4005 * pt.c (maybe_instantiate_noexcept): Only return false if defaulted.
4006 (regenerate_decl_from_template): Use it for noexcept-specs.
4008 2019-03-14 Jason Merrill <jason@redhat.com>
4010 * parser.c (cp_parser_decl_specifier_seq): Support C++20
4011 concept-definition syntax without 'bool'.
4013 2019-03-14 Jakub Jelinek <jakub@redhat.com>
4016 * semantics.c (finish_qualified_id_expr): Reject variable templates.
4019 * constexpr.c (struct constexpr_ctx): Change save_exprs type from
4020 hash_set<tree> to vec<tree>.
4021 (cxx_eval_call_expression): Adjust for save_exprs being a vec instead
4023 (cxx_eval_loop_expr): Likewise. Truncate the vector after each
4024 removal of SAVE_EXPRs from values.
4025 (cxx_eval_constant_expression) <case SAVE_EXPR>: Call safe_push
4026 method on save_exprs instead of add.
4028 2019-03-13 Jason Merrill <jason@redhat.com>
4030 PR c++/86521 - C++17 copy elision in initialization by constructor.
4031 * call.c (joust_maybe_elide_copy): New.
4034 2019-03-13 Marek Polacek <polacek@redhat.com>
4036 PR c++/88979 - further P0634 fix for constructors.
4037 * parser.c (cp_parser_decl_specifier_seq): Pass flags to
4038 cp_parser_constructor_declarator_p.
4039 (cp_parser_direct_declarator): Allow missing typename for constructor
4041 (cp_parser_constructor_declarator_p): Add FLAGS parameter. Pass it to
4042 cp_parser_type_specifier.
4044 PR c++/89686 - mixing init-capture and simple-capture in lambda.
4045 * parser.c (cp_parser_lambda_introducer): Give error when combining
4046 init-capture and simple-capture.
4048 PR c++/89660 - bogus error with -Wredundant-move.
4049 * typeck.c (maybe_warn_pessimizing_move): Only accept (T &) &arg
4050 as the std::move's argument. Don't call convert_for_initialization
4051 when warn_redundant_move isn't on.
4053 2019-03-11 Jason Merrill <jason@redhat.com>
4055 PR c++/86521 - wrong overload resolution with ref-qualifiers.
4056 * call.c (build_user_type_conversion_1): Don't use a conversion to a
4057 reference of the wrong rvalueness for direct binding.
4059 2019-03-11 Martin Liska <mliska@suse.cz>
4061 * cvt.c (build_expr_type_conversion): Wrap apostrophes
4062 in gcc internal format with %'.
4063 * decl.c (check_no_redeclaration_friend_default_args): Likewise.
4064 (grokfndecl): Likewise.
4065 * name-lookup.c (do_pushtag): Likewise.
4066 * pt.c (unify_parameter_deduction_failure): Likewise.
4067 (unify_template_deduction_failure): Likewise.
4069 2019-03-11 Martin Liska <mliska@suse.cz>
4071 * call.c (convert_arg_to_ellipsis): Wrap an option name
4072 in a string format message and fix GNU coding style.
4073 (build_over_call): Likewise.
4074 * class.c (check_field_decl): Likewise.
4075 (layout_nonempty_base_or_field): Likewise.
4076 * constexpr.c (cxx_eval_loop_expr): Likewise.
4077 * cvt.c (type_promotes_to): Likewise.
4078 * decl.c (cxx_init_decl_processing): Likewise.
4079 (mark_inline_variable): Likewise.
4080 (grokdeclarator): Likewise.
4081 * decl2.c (record_mangling): Likewise.
4082 * error.c (maybe_warn_cpp0x): Likewise.
4083 * except.c (doing_eh): Likewise.
4084 * mangle.c (maybe_check_abi_tags): Likewise.
4085 * parser.c (cp_parser_diagnose_invalid_type_name): Likewise.
4086 (cp_parser_userdef_numeric_literal): Likewise.
4087 (cp_parser_primary_expression): Likewise.
4088 (cp_parser_unqualified_id): Likewise.
4089 (cp_parser_pseudo_destructor_name): Likewise.
4090 (cp_parser_builtin_offsetof): Likewise.
4091 (cp_parser_lambda_expression): Likewise.
4092 (cp_parser_lambda_introducer): Likewise.
4093 (cp_parser_lambda_declarator_opt): Likewise.
4094 (cp_parser_selection_statement): Likewise.
4095 (cp_parser_init_statement): Likewise.
4096 (cp_parser_decomposition_declaration): Likewise.
4097 (cp_parser_function_specifier_opt): Likewise.
4098 (cp_parser_static_assert): Likewise.
4099 (cp_parser_simple_type_specifier): Likewise.
4100 (cp_parser_namespace_definition): Likewise.
4101 (cp_parser_using_declaration): Likewise.
4102 (cp_parser_ctor_initializer_opt_and_function_body): Likewise.
4103 (cp_parser_initializer_list): Likewise.
4104 (cp_parser_type_parameter_key): Likewise.
4105 (cp_parser_member_declaration): Likewise.
4106 (cp_parser_try_block): Likewise.
4107 (cp_parser_std_attribute_spec): Likewise.
4108 (cp_parser_requires_clause_opt): Likewise.
4109 * pt.c (check_template_variable): Likewise.
4110 (check_default_tmpl_args): Likewise.
4111 (push_tinst_level_loc): Likewise.
4112 (instantiate_pending_templates): Likewise.
4113 (invalid_nontype_parm_type_p): Likewise.
4114 * repo.c (get_base_filename): Likewise.
4115 * rtti.c (typeid_ok_p): Likewise.
4116 (build_dynamic_cast_1): Likewise.
4117 * tree.c (maybe_warn_parm_abi): Likewise.
4119 2019-03-08 Jakub Jelinek <jakub@redhat.com>
4122 * parser.c (cp_parser_template_declaration_after_parameters): Avoid
4123 one space before " at the end of line and another after " on another
4124 line in a string literal.
4126 PR tree-optimization/89550
4127 * semantics.c (maybe_convert_cond): Only set TREE_NO_WARNING if
4128 warning_at returned true.
4129 * decl2.c (c_parse_final_cleanups): Likewise.
4130 * typeck.c (convert_for_assignment): Likewise.
4131 * decl.c (finish_function): Likewise.
4134 * parser.c (cp_parser_asm_definition): Just warn instead of error
4135 on volatile qualifier outside of function body.
4138 * constexpr.c (potential_constant_expression_1): Reject
4139 REINTERPRET_CAST_P NOP_EXPRs.
4142 * call.c (joust): Call print_z_candidate only if pedwarn returned
4145 2019-03-07 Jason Merrill <jason@redhat.com>
4147 PR c++/88123 - lambda and using-directive.
4148 * name-lookup.c (op_unqualified_lookup)
4149 (maybe_save_operator_binding, discard_operator_bindings)
4150 (push_operator_bindings): New.
4151 * typeck.c (build_x_binary_op, build_x_unary_op): Call
4152 maybe_save_operator_binding.
4153 * decl.c (start_preparsed_function): Call push_operator_bindings.
4154 * tree.c (cp_free_lang_data): Call discard_operator_bindings.
4156 PR c++/88820 - ICE with CTAD and member template used in DMI.
4157 * pt.c (do_class_deduction): Handle parm used as its own arg.
4159 2019-03-07 Jakub Jelinek <jakub@redhat.com>
4162 * parser.c (cp_parser_asm_definition): Parse asm qualifiers even
4163 at toplevel, but diagnose them.
4165 2019-03-06 Jason Merrill <jason@redhat.com>
4167 PR c++/89381 - implicit copy and using-declaration.
4168 * class.c (classtype_has_move_assign_or_move_ctor_p): Don't consider
4169 op= brought in by a using-declaration.
4171 2019-03-06 Jakub Jelinek <jakub@redhat.com>
4174 * init.c (build_value_init_noctor): Ignore flexible array members.
4176 2019-03-06 Jason Merrill <jason@redhat.com>
4178 PR c++/89576 - if constexpr of lambda capture.
4179 * semantics.c (maybe_convert_cond): Do convert a non-dependent
4180 condition in a template.
4181 * typeck.c (condition_conversion): Handle being called in a
4184 2019-03-06 Marek Polacek <polacek@redhat.com>
4186 PR c++/87378 - bogus -Wredundant-move warning.
4187 * typeck.c (maybe_warn_pessimizing_move): See if the maybe-rvalue
4188 overload resolution would actually succeed.
4190 2019-03-05 Jason Merrill <jason@redhat.com>
4192 * class.c (is_really_empty_class): Add ignore_vptr parm.
4193 (trivial_default_constructor_is_constexpr): Pass it.
4194 * call.c (build_over_call): Pass it.
4195 * constexpr.c (cxx_eval_constant_expression): Pass it instead of
4196 checking TYPE_POLYMORPHIC_P.
4197 (cxx_eval_component_reference, potential_constant_expression_1):
4199 * cp-gimplify.c (simple_empty_class_p): Pass it.
4200 * init.c (expand_aggr_init_1): Pass it.
4202 2019-03-04 Paolo Carlini <paolo.carlini@oracle.com>
4205 * parser.c (cp_parser_class_head): Reject TYPE_BEING_DEFINED too.
4207 2019-03-04 Jakub Jelinek <jakub@redhat.com>
4210 * call.c (field_in_pset): New function.
4211 (build_aggr_conv): Handle CONSTRUCTOR_IS_DESIGNATED_INIT correctly.
4213 2019-03-02 Jakub Jelinek <jakub@redhat.com>
4216 * cp-tree.h (CONSTRUCTOR_IS_DESIGNATED_INIT): Define.
4217 * parser.c (cp_parser_braced_list): Adjust cp_parser_initializer_list
4218 caller, set CONSTRUCTOR_IS_DESIGNATED_INIT.
4219 (cp_parser_initializer_list): Add designated parameter, set *designated
4220 to a bool whether any designators were parsed.
4221 * decl.c (reshape_init): Copy over CONSTRUCTOR_IS_DESIGNATED_INIT if
4223 * pt.c (tsubst_copy_and_build): Likewise.
4224 * call.c (implicit_conversion): If CONSTRUCTOR_IS_DESIGNATED_INIT,
4225 don't call build_list_conv, nor build_complex_conv, nor attempt to
4226 convert a single element initializer to scalar.
4228 2019-03-01 Marek Polacek <polacek@redhat.com>
4230 PR c++/89537 - missing location for error with non-static member fn.
4231 * call.c (resolve_args): Use EXPR_LOCATION.
4232 * typeck.c (build_class_member_access_expr): Use input_location.
4234 PR c++/89532 - ICE with incomplete type in decltype.
4235 * semantics.c (finish_compound_literal): Return error_mark_node
4236 if digest_init_flags returns error_mark_node.
4238 2019-03-01 Jakub Jelinek <jakub@redhat.com>
4240 Implement P1002R1, Try-catch blocks in constexpr functions
4242 * parser.c (cp_parser_ctor_initializer_opt_and_function_body):
4243 Diagnose constexpr ctor or function with function-try-block with
4244 pedwarn for c++17 and earlier. Formatting fix.
4245 (cp_parser_try_block): Use pedwarn instead of error and only for
4246 c++17 and earlier when try block appears in constexpr function.
4247 * constexpr.c (build_constexpr_constructor_member_initializers):
4248 Handle TRY_BLOCK here instead of erroring on it.
4250 2019-02-28 Jason Merrill <jason@redhat.com>
4252 PR c++/88183 - ICE with .* fold-expression.
4253 * pt.c (fold_expression) [DOTSTAR_EXPR]: Remove special handling.
4255 PR c++/86969 - ICE with constexpr if and recursive generic lambdas.
4256 * class.c, lambda.c, pt.c: Revert earlier change.
4257 * lambda.c (add_capture): Don't special-case capture of dependent
4260 * name-lookup.c (print_binding_level): Print this_entity.
4262 2019-02-27 Marek Polacek <polacek@redhat.com>
4264 PR c++/88857 - ICE with value-initialization of argument in template.
4265 * call.c (convert_like_real): Don't call build_value_init in template.
4267 2019-02-27 Jason Merrill <jason@redhat.com>
4269 PR c++/86969 - ICE with constexpr if and recursive generic lambdas.
4270 * semantics.c (process_outer_var_ref): Do capture dependent vars.
4271 * class.c (finish_struct): Only add TAG_DEFN if T is in
4272 current_function_decl.
4273 * lambda.c (vla_capture_type): Force the capture type out into the
4274 lambda's enclosing function.
4275 (add_capture): Pass in the lambda.
4276 * pt.c (tsubst_lambda_expr): complete_type a VLA capture type.
4278 2019-02-27 Marek Polacek <polacek@redhat.com>
4280 PR c++/89511 - ICE with using-declaration and unscoped enumerator.
4281 * parser.c (cp_parser_using_declaration): For an unscoped enum
4282 only use its context if it's not a function declaration.
4284 2019-02-27 Paolo Carlini <paolo.carlini@oracle.com>
4287 * method.c (process_subob_fn): When maybe_instantiate_noexcept
4288 returns false don't call merge_exception_specifiers.
4290 2019-02-27 Paolo Carlini <paolo.carlini@oracle.com>
4293 * parser.c (cp_parser_noexcept_specification_opt): Return NULL_TREE
4294 for a non-constant parsed expression.
4296 2019-02-26 Jakub Jelinek <jakub@redhat.com>
4299 * constexpr.c (cxx_eval_store_expression): When changing active union
4300 member, set no_zero_init.
4302 2019-02-23 Marek Polacek <polacek@redhat.com>
4304 PR c++/88294 - ICE with non-constant noexcept-specifier.
4305 * pt.c (maybe_instantiate_noexcept): Set up the list of local
4306 specializations. Set current_class_{ptr,ref}.
4308 2019-02-22 David Malcolm <dmalcolm@redhat.com>
4311 * parser.c (cp_parser_unqualified_id): Capture and use locations
4314 2019-02-22 Marek Polacek <polacek@redhat.com>
4316 PR c++/89420 - ICE with CAST_EXPR in explicit-specifier.
4317 * decl.c (build_explicit_specifier): Don't check
4318 processing_template_decl. Call instantiation_dependent_expression_p
4319 instead of value_dependent_expression_p. Call
4320 instantiate_non_dependent_expr_sfinae before
4321 build_converted_constant_expr instead of calling
4322 instantiate_non_dependent_expr after it. Add
4323 processing_template_decl_sentinel.
4325 2019-02-22 Thomas Schwinge <thomas@codesourcery.com>
4327 * parser.c (cp_parser_oacc_simple_clause): Remove parser formal
4328 parameter, move loc formal parameter to the front. Adjust all
4330 (cp_parser_oacc_shape_clause): Add loc formal parameter. Adjust
4333 2019-02-21 Jason Merrill <jason@redhat.com>
4335 PR c++/87685 - generic lambda 'this' capture error.
4336 * lambda.c (lambda_expr_this_capture): Change add_capture_p to int.
4337 (maybe_generic_this_capture): Pass -1.
4339 PR c++/88394 - ICE with VLA init-capture.
4340 * lambda.c (is_normal_capture_proxy): Check DECL_CAPTURED_VARIABLE.
4342 PR c++/88869 - C++17 ICE with CTAD and explicit specialization.
4343 * pt.c (do_class_deduction): Don't include explicit specialization
4346 PR c++/89422 - ICE with -g and lambda in default arg in template.
4347 * pt.c (tsubst_function_decl): SET_DECL_FRIEND_CONTEXT sooner.
4349 2019-02-21 Jason Merrill <jason@redhat.com>
4351 PR c++/88419 - C++17 ICE with class template arg deduction.
4352 * pt.c (make_template_placeholder): Set TYPE_CANONICAL after
4353 CLASS_PLACEHOLDER_TEMPLATE.
4355 2019-02-21 Jakub Jelinek <jakub@redhat.com>
4358 * constexpr.c (struct constexpr_fundef): Add parms and result members.
4359 (retrieve_constexpr_fundef): Adjust for the above change.
4360 (register_constexpr_fundef): Save constexpr body with copy_fn,
4361 temporarily set DECL_CONTEXT on DECL_RESULT before that.
4362 (get_fundef_copy): Change FUN argument to FUNDEF with
4363 constexpr_fundef * type, grab body and parms/result out of
4364 constexpr_fundef struct and temporarily change it for copy_fn calls
4366 (cxx_eval_builtin_function_call): For __builtin_FUNCTION temporarily
4367 adjust current_function_decl from ctx->call context. Test
4368 !potential_constant_expression instead of !is_constant_expression.
4369 (cxx_bind_parameters_in_call): Grab parameters from new_call. Undo
4370 convert_for_arg_passing changes for TREE_ADDRESSABLE type passing.
4371 (cxx_eval_call_expression): Adjust get_fundef_copy caller.
4372 (cxx_eval_conditional_expression): For IF_STMT, allow then or else
4373 operands to be NULL.
4374 (label_matches): Handle BREAK_STMT and CONTINUE_STMT.
4375 (cxx_eval_loop_expr): Add support for FOR_STMT, WHILE_STMT and DO_STMT.
4376 (cxx_eval_switch_expr): Add support for SWITCH_STMT.
4377 (cxx_eval_constant_expression): Handle IF_STMT, FOR_STMT, WHILE_STMT,
4378 DO_STMT, CONTINUE_STMT, SWITCH_STMT, BREAK_STMT and CONTINUE_STMT.
4379 For SIZEOF_EXPR, recurse on the result of fold_sizeof_expr. Ignore
4380 DECL_EXPR with USING_DECL operand.
4381 * lambda.c (maybe_add_lambda_conv_op): Build thisarg using
4382 build_int_cst to make it a valid constant expression.
4384 2019-02-20 Jason Merrill <jason@redhat.com>
4386 PR c++/88690 - C++17 ICE with empty base in aggregate.
4387 * typeck2.c (process_init_constructor_record): Skip trivial
4388 initialization of an empty base.
4390 2019-02-21 Richard Biener <rguenther@suse.de>
4393 * vtable-class-hierarchy.c (vtv_generate_init_routine): Do not
4394 make symtab process new functions here.
4396 2019-02-20 Jason Merrill <jason@redhat.com>
4398 PR c++/87921 - wrong error with inline static data member.
4399 * decl2.c (finish_static_data_member_decl): Don't set DECL_IN_AGGR_P
4400 for a non-template inline variable. Do nothing for an
4401 already-instantiated variable.
4402 (c_parse_final_cleanups): Check DECL_IN_AGGR_P without
4404 * decl.c (check_initializer): Likewise.
4405 (make_rtl_for_nonlocal_decl): Likewise.
4406 * pt.c (instantiate_decl): Likewise.
4407 * typeck2.c (store_init_value): Likewise.
4409 2019-02-20 Jakub Jelinek <jakub@redhat.com>
4412 * decl2.c (c_parse_final_cleanups): Move TREE_ASM_WRITTEN setting
4413 for flag_syntax_only from here...
4414 * semantics.c (expand_or_defer_fn_1): ... here.
4417 * decl.c (maybe_commonize_var): When clearing TREE_PUBLIC and
4418 DECL_COMMON, set DECL_INTERFACE_KNOWN.
4421 * constexpr.c (cxx_eval_store_expression): Diagnose changing of active
4422 union member for -std=c++17 and earlier.
4424 2019-02-19 Jason Merrill <jason@redhat.com>
4426 PR c++/87513 - 'sorry' mangling PMF template-id.
4427 * mangle.c (write_expression): Handle SCOPE_REF to BASELINK.
4429 2019-02-19 Jason Merrill <jason@redhat.com>
4431 PR c++/88380 - wrong-code with flexible array and NSDMI.
4432 * typeck2.c (process_init_constructor_record): Skip flexarrays.
4434 2019-02-20 will wray <wjwray@gmail.com>
4436 PR c++/88572 - wrong handling of braces on scalar init.
4437 * decl.c (reshape_init_r): Allow braces around scalar initializer
4438 within aggregate init. Reject double braced-init of scalar
4441 2019-02-20 Paolo Carlini <paolo.carlini@oracle.com>
4444 * pt.c (tsubst_init): Diagnose an initializer expanding to an
4445 empty list of expressions; tweak wrt dependent types.
4446 (regenerate_decl_from_template): For VAR_DECLs call tsubst_init
4447 instead of tsubst_expr.
4449 2019-02-19 Jason Merrill <jason@redhat.com>
4451 PR c++/88368 - wrong 'use of deleted function'
4452 * method.c (walk_field_subobs): Remember errors from get_nsdmi.
4453 (get_defaulted_eh_spec): Call push_tinst_level.
4454 * pt.c (maybe_instantiate_noexcept): Keep error_mark_node.
4455 * typeck2.c (merge_exception_specifiers): Handle error_mark_node.
4457 2019-02-19 Chung-Lin Tang <cltang@codesourcery.com>
4460 * parser.c (cp_parser_oacc_clause_wait): Add representation of wait
4461 clause without argument as 'wait (GOMP_ASYNC_NOVAL)', adjust comments.
4463 2019-02-19 Jakub Jelinek <jakub@redhat.com>
4466 * lambda.c (maybe_generic_this_capture): Don't check
4467 DECL_NONSTATIC_MEMBER_FUNCTION_P on USING_DECLs.
4470 * typeck.c (build_reinterpret_cast_1): Don't handle void to
4471 && conversion go through build_target_expr_with_type.
4474 * error.c (qualified_name_lookup_error): Only call
4475 suggest_alternative_in_scoped_enum if name is IDENTIFIER_NODE.
4477 2019-02-19 Tom Honermann <tom@honermann.net>
4479 * name-lookup.c (get_std_name_hint): Added u8string as a name hint.
4481 2019-02-18 Jason Merrill <jason@redhat.com>
4483 PR c++/89336 - multiple stores in constexpr stmt.
4484 * constexpr.c (cxx_eval_store_expression): Preevaluate scalar or
4487 * pt.c (check_explicit_specialization): If the declarator is a
4488 template-id, only check whether the arguments are dependent.
4490 Improve duplicate [[likely]] diagnostic.
4491 * parser.c (cp_parser_statement): Make attrs_loc a range. Pass it
4492 to process_stmt_hotness_attribute.
4493 * cp-gimplify.c (process_stmt_hotness_attribute): Take attrs_loc.
4494 (genericize_if_stmt): Use likely/unlikely instead of predictor_name.
4496 2019-02-17 Marek Polacek <polacek@redhat.com>
4498 PR c++/89217 - ICE with list-initialization in range-based for loop.
4499 * constexpr.c (unshare_constructor): No longer static.
4500 * cp-tree.h (unshare_constructor): Declare.
4501 * semantics.c (finish_compound_literal): When dealing with a
4502 non-dependent expression in a template, return the original
4503 expression. Pass LOOKUP_NO_NARROWING to digest_init_flags.
4505 2019-02-13 Marek Polacek <polacek@redhat.com>
4507 PR c++/89297 - ICE with OVERLOAD in template.
4508 * semantics.c (finish_compound_literal): Call
4509 instantiate_non_dependent_expr_sfinae.
4511 2019-02-13 Alexandre Oliva <aoliva@redhat.com>
4514 * cp-tree.h (USING_DECL_SCOPE): Use result rather than type.
4515 * name-lookup.c (strip_using_decl): Use USING_DECL_SCOPE.
4516 * search.c (protected_accessible_p): Follow USING_DECL_DECLS.
4517 (shared_member_p): Likewise.
4518 (lookup_member): Likewise.
4519 * decl.c (grok_special_member_properties): Skip USING_DECLs.
4520 * semantics.c (finish_omp_declare_simd_methods): Likewise.
4521 (finish_qualified_id_expr): Do not call shared_member_p with
4525 * pt.c (tsubst_lambda_expr): Avoid duplicate tsubsting.
4526 Move cp_evaluated resetting before signature tsubsting.
4527 (gen_elem_of_pack_expansion_instantiation): Separate local
4528 specializations per index.
4530 2019-02-13 David Malcolm <dmalcolm@redhat.com>
4533 * class.c (add_method): Drop destructor assertion.
4535 2019-02-13 Paolo Carlini <paolo.carlini@oracle.com>
4538 * decl.c (make_typename_type): Allow for TYPE_PACK_EXPANSION as
4539 context (the first argument).
4540 * pt.c (tsubst, case TYPENAME_TYPE): Handle TYPE_PACK_EXPANSION
4543 2019-02-12 Jason Merrill <jason@redhat.com>
4545 PR c++/89144 - link error with constexpr initializer_list.
4546 * call.c (convert_like_real) [ck_list]: Don't allocate a temporary
4547 array for an empty list.
4548 * typeck2.c (store_init_value): Don't use cxx_constant_init in a
4551 2019-02-11 Jason Merrill <jason@redhat.com>
4553 PR c++/89241 - ICE with __func__ in lambda in template.
4554 * pt.c (enclosing_instantiation_of): Also check
4555 instantiated_lambda_fn_p for the template context.
4557 2019-02-11 Marek Polacek <polacek@redhat.com>
4559 PR c++/89212 - ICE converting nullptr to pointer-to-member-function.
4560 * pt.c (tsubst_copy_and_build) <case CONSTRUCTOR>: Return early for
4561 null member pointer value.
4563 2019-02-11 Jakub Jelinek <jakub@redhat.com>
4566 * pt.c (convert_nontype_argument): Pass true as manifestly_const_eval
4567 to maybe_constant_value calls.
4569 2019-02-11 Marek Polacek <polacek@redhat.com>
4571 * typeck2.c (digest_init_r): Remove commented code.
4573 2019-02-11 Martin Sebor <msebor@redhat.com>
4576 * decl.c (compute_array_index_type_loc): Preserve signed sizes
4577 for diagnostics. Call valid_array_size_p instead of error.
4578 * init.c (build_new_1): Compute size for diagnostic. Call
4579 invalid_array_size_error
4580 (build_new): Call valid_array_size_p instead of error.
4582 2019-02-07 Alexandre Oliva <aoliva@redhat.com>
4585 * call.c (compare_ics): Deal with ck_aggr in either cs.
4587 2019-02-06 David Malcolm <dmalcolm@redhat.com>
4590 * call.c (get_location_for_expr_unwinding_for_system_header): New
4592 (conversion_null_warnings): Use it when getting locations for
4593 EXPR, effectively adding a call to
4594 get_location_for_expr_unwinding_for_system_header for
4595 -Wconversion-null and making use of EXPR_LOCATION for
4596 -Wzero-as-null-pointer-constant.
4598 2019-02-05 Jakub Jelinek <jakub@redhat.com>
4601 * optimize.c (maybe_thunk_body): Clear TREE_ADDRESSABLE on
4602 PARM_DECLs of the thunk.
4603 * lambda.c (maybe_add_lambda_conv_op): Likewise.
4605 2019-02-05 Marek Polacek <polacek@redhat.com>
4607 PR c++/89158 - by-value capture of constexpr variable broken.
4608 * call.c (convert_like_real) <case ck_user>: Call mark_exp_read
4609 instead of mark_rvalue_use.
4611 2019-02-05 Alexandre Oliva <aoliva@redhat.com>
4614 * pt.c (instantiates_primary_template_p): New.
4615 (type_dependent_expression_p): Use it.
4617 2019-02-01 Jason Merrill <jason@redhat.com>
4619 PR c++/88761 - ICE with reference capture of constant.
4620 * lambda.c (mark_const_cap_r): Do walk subtrees of DECL_EXPR for
4623 2019-02-01 Marek Polacek <polacek@redhat.com>
4625 PR c++/88325 - ICE with invalid out-of-line template member definition.
4626 * parser.c (cp_parser_class_name): Don't call make_typename_type
4629 2019-02-01 Jakub Jelinek <jakub@redhat.com>
4632 * parser.c (cp_parser_gnu_attributes_opt): Set ok to false
4633 if require_open failed.
4635 2019-01-31 Marek Polacek <polacek@redhat.com>
4637 PR c++/89083, c++/80864 - ICE with list initialization in template.
4638 * constexpr.c (adjust_temp_type): Use copy_node and change the type
4639 instead of using build_constructor.
4640 * decl.c (reshape_init_r): Don't reshape a digested initializer.
4641 Return the initializer for COMPOUND_LITERAL_P.
4643 PR c++/88983 - ICE with switch in constexpr function.
4644 * constexpr.c (cxx_eval_switch_expr): Use SWITCH_COND and SWITCH_BODY.
4645 (cxx_eval_constant_expression) <case COND_EXPR>: Don't look for the
4646 label in the else branch if we found it in the then branch.
4648 2019-01-30 Jason Merrill <jason@redhat.com>
4650 PR c++/88752 - ICE with lambda and constexpr if.
4651 * cp-tree.h (LAMBDA_EXPR_INSTANTIATED): New.
4652 * pt.c (tsubst_lambda_expr): Set it.
4653 (instantiated_lambda_fn_p): Check it.
4654 (enclosing_instantiation_of): Use it.
4656 2019-01-31 Jakub Jelinek <jakub@redhat.com>
4659 * cxx-pretty-print.c (pp_cxx_enumeration_constant): Print always as
4660 a C cast in pp_c_flag_gnu_v3 mode.
4662 2019-01-30 Jakub Jelinek <jakub@redhat.com>
4665 * lambda.c (is_capture_proxy): Don't return true for
4666 DECL_OMP_PRIVATIZED_MEMBER artificial vars.
4668 2019-01-30 Marek Polacek <polacek@redhat.com>
4670 PR c++/89119 - ICE with value-initialization in template.
4671 * pt.c (tsubst_copy_and_build): Handle RANGE_EXPR.
4673 2019-01-29 Jason Merrill <jason@redhat.com>
4675 PR c++/86943 - wrong code converting lambda to function pointer.
4676 * lambda.c (maybe_add_lambda_conv_op): Use a template-id in the
4677 call. Only forward parms for decltype.
4678 * pt.c (tsubst_copy_and_build) [CALL_EXPR]: Handle CALL_FROM_THUNK_P
4680 * typeck.c (check_return_expr): Don't mess with a thunk call.
4682 2019-01-28 Jason Merrill <jason@redhat.com>
4684 PR c++/89089 - ICE with [[no_unique_address]].
4685 PR c++/88865 - wrong layout with [[no_unique_address]].
4686 * class.c (check_field_decls): A potentially-overlapping field makes
4687 the class non-layout-POD, but not non-empty.
4688 (end_of_class): Always consider empty data members.
4689 (layout_class_type): Set DECL_SIZE for empty fields.
4691 2019-01-28 Marek Polacek <polacek@redhat.com>
4693 PR c++/88358 - name wrongly treated as type.
4694 * parser.c (cp_parser_direct_declarator): Don't assume a qualified-id
4695 in parameter-list is a type if the function's declarator-id is not
4698 2019-01-27 Marek Polacek <polacek@redhat.com>
4700 PR c++/88815 - narrowing conversion lost in decltype.
4701 PR c++/78244 - narrowing conversion in template not detected.
4702 * cp-tree.h (CONSTRUCTOR_IS_DEPENDENT): New.
4703 * pt.c (instantiation_dependent_r): Consider a CONSTRUCTOR with
4704 CONSTRUCTOR_IS_DEPENDENT instantiation-dependent.
4705 * semantics.c (finish_compound_literal): When the compound literal
4706 isn't instantiation-dependent and the type isn't type-dependent,
4707 fall back to the normal processing. Set CONSTRUCTOR_IS_DEPENDENT.
4709 PR c++/89024 - ICE with incomplete enum type.
4710 * call.c (standard_conversion): When converting an
4711 ARITHMETIC_TYPE_P to an incomplete type, return NULL.
4713 2019-01-25 Paolo Carlini <paolo.carlini@oracle.com>
4716 * call.c (build_op_delete_call): Implement 7.6.2.5/(10.1).
4717 * decl2.c (coerce_delete_type): Use build_pointer_type instead
4720 2019-01-24 Jason Merrill <jason@redhat.com>
4722 PR c++/89001 - mangling of reference temporaries
4723 * cp-tree.h (struct saved_scope): Add ref_temp_count.
4724 (current_ref_temp_count): New macro.
4725 * mangle.c (mangle_ref_init_variable): Use it.
4726 * typeck2.c (store_init_value): Clear it.
4727 * call.c (make_temporary_var_for_ref_to_temp): Copy public and
4730 2019-01-24 Jakub Jelinek <jakub@redhat.com>
4733 * semantics.c (finish_omp_cancel): Diagnose more than one if
4734 on #pragma omp cancel with different modifiers. Use
4735 maybe_convert_cond when not in template or build_x_binary_op
4738 2019-01-23 Marek Polacek <polacek@redhat.com>
4740 PR c++/88757 - qualified name treated wrongly as type.
4741 * parser.c (cp_parser_direct_declarator): Don't treat qualified-ids
4742 in parameter-list as types if name lookup for declarator-id didn't
4743 find one or more function templates.
4745 2019-01-23 Jakub Jelinek <jakub@redhat.com>
4748 * cp-gimplify.c (genericize_cp_loop): Call begin_bc_block only
4749 after genericizing cond and incr expressions.
4752 * cp-gimplify.c (genericize_switch_stmt): Move cond genericization
4753 before the begin_bc_block call.
4755 2019-01-21 Jason Merrill <jason@redhat.com>
4757 PR c++/87893 - constexpr ctor ICE on ARM.
4758 PR c++/88293 - ICE with comma expression.
4759 * constexpr.c (initialized_type): Don't shortcut non-void type.
4760 Handle COMPOUND_EXPR.
4761 (cxx_eval_outermost_constant_expr): Return early for void type.
4763 2019-01-21 Jakub Jelinek <jakub@redhat.com>
4766 * optimize.c (cxx_copy_decl): New function.
4767 (clone_body): Use it instead of copy_decl_no_change.
4770 * typeck.c (cp_build_binary_op): Don't instrument
4771 SANITIZE_POINTER_COMPARE if processing_template_decl.
4772 (pointer_diff): Similarly for SANITIZE_POINTER_SUBTRACT.
4774 2019-01-18 Jason Merrill <jason@redhat.com>
4776 PR c++/88875 - error with explicit list constructor.
4777 * call.c (reference_binding): Don't modify EXPR. Set
4778 need_temporary_p on the ck_user conversion for a temporary.
4779 (convert_like_real): Check it.
4781 2019-01-18 H.J. Lu <hongjiu.lu@intel.com>
4785 * call.c (convert_for_arg_passing): Upate the
4786 warn_for_address_or_pointer_of_packed_member call.
4787 * typeck.c (convert_for_assignment): Likewise.
4789 2019-01-17 Jason Merrill <jason@redhat.com>
4791 PR c++/86205 - ICE with ?: of throw and template-id.
4792 * pt.c (resolve_nondeduced_context_or_error): Split out from...
4793 * typeck.c (decay_conversion): ...here.
4794 * call.c (build_conditional_expr_1): Use it.
4796 PR c++/86740, ICE with constexpr if and nested generic lambdas.
4797 * tree.c (cp_walk_subtrees): Handle LAMBDA_EXPR.
4799 2019-01-17 Paolo Carlini <paolo.carlini@oracle.com>
4801 * decl.c (grokdeclarator): Use typespec_loc in error messages
4802 about 'auto' and trailing return type.
4804 2019-01-17 David Malcolm <dmalcolm@redhat.com>
4807 * class.c (add_method): Don't use DECL_DESTRUCTOR_P on
4810 2019-01-17 Nathan Sidwell <nathan@acm.org>
4813 * semantics.c (process_outer_var_ref): Only skip dependent types
4816 2019-01-17 Alexandre Oliva <aoliva@redhat.com>
4819 * cp-tree.h (saved_scope): Add suppress_location_wrappers.
4820 * name-lookup.c (do_push_to_top_level): Save and reset it.
4821 (do_pop_from_top_level): Restore it.
4824 * pt.c (make_template_placeholder): Use auto_identifier.
4825 (is_auto): Drop CLASS_PLACEHOLDER_TEMPLATE test.
4826 * error.c (dump_type): Handle template placeholders.
4827 * cxx-pretty-print.c (pp_cx_unqualified_id): Likewise.
4830 * cvt.c (convert_to_void): Handle all cdtor calls as if
4833 2019-01-16 Paolo Carlini <paolo.carlini@oracle.com>
4835 * decl.c (grokdeclarator): Use locations[ds_storage_class] in
4836 error messages about ill-formed uses of mutable.
4838 2019-01-16 Marek Polacek <polacek@redhat.com>
4840 PR c++/78244 - narrowing conversion in template not detected.
4841 * call.c (perform_implicit_conversion_flags): Set
4842 IMPLICIT_CONV_EXPR_BRACED_INIT.
4843 * cp-tree.h (IMPLICIT_CONV_EXPR_BRACED_INIT): New.
4844 * pt.c (tsubst_copy_and_build): Use it.
4846 2019-01-15 David Malcolm <dmalcolm@redhat.com>
4849 * pt.c (build_deduction_guide): Bail out if tsubst_arg_types
4852 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com>
4854 * decl.c (start_decl): Improve error location.
4855 * decl2.c (grokfield): Likewise.
4857 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com>
4859 * decl.c (grokdeclarator): Move further up the location_t loc
4860 declaration and use the location when building a TYPE_DECL for
4862 * decl2.c (grokbitfield): Use DECL_SOURCE_LOCATION in the error
4863 about an ill-formed bit-field as typedef.
4865 2019-01-14 Marek Polacek <polacek@redhat.com>
4867 PR c++/88830 - ICE with abstract class.
4868 * decl2.c (maybe_emit_vtables): Check CLASSTYPE_LAZY_DESTRUCTOR.
4871 PR c++/88825 - ICE with bogus function return type deduction.
4872 * typeck.c (can_do_nrvo_p): Check error_mark_node.
4874 2019-01-14 Tom Honermann <tom@honermann.net>
4876 Implement P0482R5, char8_t: A type for UTF-8 characters and strings
4877 * cvt.c (type_promotes_to): Handle char8_t promotion.
4878 * decl.c (grokdeclarator): Handle invalid type specifier
4879 combinations involving char8_t.
4880 * lex.c (init_reswords): Add char8_t as a reserved word.
4881 * mangle.c (write_builtin_type): Add name mangling for char8_t (Du).
4882 * parser.c (cp_keyword_starts_decl_specifier_p)
4883 (cp_parser_simple_type_specifier): Recognize char8_t as a simple
4885 (cp_parser_string_literal): Use char8_array_type_node for the type
4887 (cp_parser_set_decl_spec_type): Tolerate char8_t typedefs in system
4889 * rtti.c (emit_support_tinfos): type_info support for char8_t.
4890 * tree.c (char_type_p): Recognize char8_t as a character type.
4891 * typeck.c (string_conv_p): Handle conversions of u8 string
4892 literals of char8_t type.
4893 (check_literal_operator_args): Handle UDLs with u8 string literals
4895 * typeck2.c (ordinary_char_type_p): New.
4896 (digest_init_r): Disallow initializing a char array with a u8 string
4899 2019-01-14 Martin Liska <mliska@suse.cz>
4901 PR gcov-profile/88263
4902 * decl2.c (get_tls_wrapper_fn): Use DECL_SOURCE_LOCATION
4903 as location of the TLS wrapper.
4905 2019-01-12 Paolo Carlini <paolo.carlini@oracle.com>
4907 * decl.c (cp_finish_decl): Improve error location.
4908 * decl2.c (grokfield): Likewise, improve two locations.
4910 2019-01-11 Marek Polacek <polacek@redhat.com>
4912 PR c++/88692, c++/87882 - -Wredundant-move false positive with *this.
4913 * typeck.c (maybe_warn_pessimizing_move): Return if ARG isn't
4916 2019-01-11 Jason Merrill <jason@redhat.com>
4918 PR c++/88312 - pack expansion of decltype.
4919 * pt.c (instantiation_dependent_r): A template non-type parameter
4920 pack is instantiation-dependent.
4922 2019-01-11 Jason Merrill <jason@redhat.com>
4924 PR c++/88613 - ICE with use of const var in lambda.
4925 * expr.c (mark_use): Fix location wrapper handling.
4926 * cp-gimplify.c (cp_fold_maybe_rvalue): Call mark_rvalue_use.
4928 2019-01-11 Tobias Burnus <burnus@net-b.de>
4931 * decl2.c (maybe_emit_vtables): If needed, generate code for
4932 the destructor of an abstract class.
4933 (mark_used): Update comment for older function-name change.
4935 2019-01-11 Paolo Carlini <paolo.carlini@oracle.com>
4937 * decl.c (start_decl): Improve error location.
4938 (grokdeclarator): Likewise, improve two locations.
4940 2019-01-09 Sandra Loosemore <sandra@codesourcery.com>
4944 * cp-tree.h: Mechanically replace "can not" with "cannot".
4945 * parser.c: Likewise.
4948 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com>
4950 * decl.c (grok_reference_init): Improve error location.
4951 (grokdeclarator): Likewise, improve two locations.
4953 2019-01-08 Marek Polacek <polacek@redhat.com>
4955 PR c++/88538 - braced-init-list in template-argument-list.
4956 * parser.c (cp_parser_template_argument): Handle braced-init-list when
4959 PR c++/88548 - this accepted in static member functions.
4960 * parser.c (cp_debug_parser): Adjust printing of
4961 local_variables_forbidden_p.
4962 (cp_parser_new): Set local_variables_forbidden_p to 0 rather than false.
4963 (cp_parser_primary_expression): When checking
4964 local_variables_forbidden_p, use THIS_FORBIDDEN or
4965 LOCAL_VARS_FORBIDDEN.
4966 (cp_parser_lambda_body): Update the type of
4967 local_variables_forbidden_p. Set it to 0 rather than false.
4968 (cp_parser_condition): Adjust call to cp_parser_declarator.
4969 (cp_parser_explicit_instantiation): Likewise.
4970 (cp_parser_init_declarator): Likewise.
4971 (cp_parser_declarator): New parameter. Use it.
4972 (cp_parser_direct_declarator): New parameter. Use it to set
4973 local_variables_forbidden_p. Adjust call to cp_parser_declarator.
4974 (cp_parser_type_id_1): Adjust call to cp_parser_declarator.
4975 (cp_parser_parameter_declaration): Likewise.
4976 (cp_parser_default_argument): Update the type of
4977 local_variables_forbidden_p. Set it to LOCAL_VARS_AND_THIS_FORBIDDEN
4979 (cp_parser_member_declaration): Tell cp_parser_declarator if we saw
4980 'static' or 'friend'.
4981 (cp_parser_exception_declaration): Adjust call to cp_parser_declarator.
4982 (cp_parser_late_parsing_default_args): Update the type of
4983 local_variables_forbidden_p. Set it to LOCAL_VARS_AND_THIS_FORBIDDEN
4985 (cp_parser_cache_defarg): Adjust call to cp_parser_declarator.
4986 (cp_parser_objc_class_ivars): Likewise.
4987 (cp_parser_objc_struct_declaration): Likewise.
4988 (cp_parser_omp_for_loop_init): Likewise.
4989 * parser.h (cp_parser): Change the type of local_variables_forbidden_p
4991 (LOCAL_VARS_FORBIDDEN, LOCAL_VARS_AND_THIS_FORBIDDEN, THIS_FORBIDDEN):
4994 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com>
4996 * decl.c (start_decl): Improve permerror location.
4998 2019-01-08 Jonathan Wakely <jwakely@redhat.com>
4999 Jakub Jelinek <jakub@redhat.com>
5002 * decl.c (finish_function): For -Wreturn-type don't add a return *this;
5003 fixit hint if current_class_ref is NULL. Use a single if instead of
5006 2019-01-07 Paolo Carlini <paolo.carlini@oracle.com>
5008 * decl.c (start_decl): Improve two error_at locations.
5009 (expand_static_init): Likewise.
5011 2019-01-07 Marek Polacek <polacek@redhat.com>
5013 PR c++/88741 - wrong error with initializer-string.
5014 * decl.c (cp_complete_array_type): Strip any location wrappers.
5016 2019-01-07 Bernd Edlinger <bernd.edlinger@hotmail.de>
5022 * cp-tree.h (LOOKUP_ALLOW_FLEXARRAY_INIT): New flag value.
5023 * typeck2.c (digest_init_r): Raise an error for non-static
5024 initialization of a flexible array member.
5025 (process_init_constructor, massage_init_elt,
5026 process_init_constructor_array, process_init_constructor_record,
5027 process_init_constructor_union, process_init_constructor): Add the
5028 flags parameter and pass it thru.
5029 (store_init_value): Pass LOOKUP_ALLOW_FLEXARRAY_INIT parameter to
5030 digest_init_flags for static decls.
5032 2019-01-07 Jakub Jelinek <jakub@redhat.com>
5035 * cp-tree.h (cp_build_vec_convert): Declare.
5036 * parser.c (cp_parser_postfix_expression): Parse
5037 __builtin_convertvector.
5038 * constexpr.c: Include fold-const-call.h.
5039 (cxx_eval_internal_function): Handle IFN_VEC_CONVERT.
5040 (potential_constant_expression_1): Likewise.
5041 * semantics.c (cp_build_vec_convert): New function.
5042 * pt.c (tsubst_copy_and_build): Handle CALL_EXPR to
5045 2019-01-03 Jakub Jelinek <jakub@redhat.com>
5048 * decl.c (builtin_function_1): Return result of pushdecl_top_level
5049 or pushdecl rather than decl.
5051 2019-01-03 Paolo Carlini <paolo.carlini@oracle.com>
5053 * tree.c (handle_nodiscard_attribute): Improve warning location.
5055 2019-01-02 Marek Polacek <polacek@redhat.com>
5057 PR c++/88612 - ICE with -Waddress-of-packed-member.
5058 * call.c (convert_for_arg_passing): Only give warnings with tf_warning.
5059 * typeck.c (convert_for_assignment): Likewise.
5061 PR c++/88631 - CTAD failing for value-initialization.
5062 * typeck2.c (build_functional_cast): Try deducing the template
5063 arguments even if there are no arguments to deduce from.
5065 2019-01-01 Jakub Jelinek <jakub@redhat.com>
5067 Update copyright years.
5069 Copyright (C) 2019 Free Software Foundation, Inc.
5071 Copying and distribution of this file, with or without modification,
5072 are permitted in any medium without royalty provided the copyright
5073 notice and this notice are preserved.