1 2019-12-07 Jason Merrill <jason@redhat.com>
2 Jakub Jelinek <jakub@redhat.com>
5 * call.c (build_conditional_expr_1): For ?: with omitted middle
6 operand use cp_stabilize_reference if arg1 is glvalue_p rather than
7 just if it is lvalue_p.
9 2019-12-06 Jakub Jelinek <jakub@redhat.com>
11 * parser.c (cp_parser_diagnose_invalid_type_name): Mention
12 that concept is also available with -std=c++2a.
14 PR c++/92831 - CWG 1299, not extending temporary lifetime for ?:
15 * cp-tree.h (extend_ref_init_temps): Add a new argument with NULL
17 * call.c (set_up_extended_ref_temp): Add COND_GUARD argument, pass it
18 down to extend_ref_init_temps. Before pushing cleanup, if COND_GUARD
19 is non-NULL, create a bool temporary if needed, initialize to false
20 and guard the cleanup with the temporary being true.
21 (extend_ref_init_temps_1): Add COND_GUARD argument, pass it down
22 to recursive calls and set_up_extended_ref_temp. Handle COND_EXPR.
23 (extend_ref_init_temps): Add COND_GUARD argument, pass it down to
24 recursive calls and to extend_ref_init_temps_1.
26 2019-12-06 Richard Sandiford <richard.sandiford@arm.com>
28 * decl.c (start_decl_1): Use verify_type_context to check whether
29 the target allows variables of a particular type to have static
30 or thread-local storage duration.
31 (check_array_initializer): Use verify_type_context to check whether
32 the target allows a particular type to be used as an array element.
33 (create_array_type_for_decl): Likewise.
34 (cp_finish_decl): Use verify_type_context to check whether
35 the target allows static member variables of a particular type.
36 (grokdeclarator): Likewise. Also use verify_type_context to check
37 whether the target allows non-static member variables of a particular
39 * except.c: Include target.h.
40 (is_admissible_throw_operand_or_catch_parameter): Use
41 verify_type_context to check whether the target allows particular
42 types to be thrown and caught.
43 * typeck2.c (add_exception_specifier): Likewise.
44 * init.c (build_new_1): Use verify_type_context to check whether
45 the target allows particular types to be dynamically allocated.
46 (build_vec_delete_1, build_delete): Use verify_type_context to check
47 whether the target allows particular types to be deleted.
48 * lambda.c (add_capture): Use verify_type_context to check
49 whether the target allows particular types to be captured by copy.
50 * pt.c: Include target.h.
51 (instantiate_class_template_1): Use verify_type_context to check
52 whether the target allows non-static member variables of a particular
54 * typeck.c (cxx_alignof_expr): Use verify_type_context to check
55 whether the target allows the alignment of a particular type
57 (pointer_diff, cp_build_unary_op): Use verify_type_context to check
58 whether the target allows arithmetic involving pointers to particular
61 2019-12-05 Marek Polacek <polacek@redhat.com>
62 Jakub Jelinek <jakub@redhat.com>
64 PR c++/91353 - P1331R2: Allow trivial default init in constexpr contexts.
65 * class.c (trivial_default_constructor_is_constexpr): Return true in
67 * constexpr.c (cx_check_missing_mem_inits): Allow missing field
68 initializers in C++20.
69 (cxx_eval_call_expression): Don't clear CONSTRUCTOR_NO_CLEARING for
70 constexpr constructors in C++20.
71 (reduced_constant_expression_p): Don't set FIELD for union and array
72 types. Skip empty class fields without initializers.
73 * decl.c (check_for_uninitialized_const_var): Permit trivial default
74 initialization in constexpr.
75 (next_initializable_field): Don't skip vptr fields.
76 * method.c (walk_field_subobs): Still consider a constructor that
77 doesn't initialize all the members constexpr.
79 2019-12-05 Marek Polacek <polacek@redhat.com>
81 PR c++/92271 - make __is_same alias for __is_same_as.
82 * cxx-pretty-print.c (pp_cxx_trait_expression) <case CPTK_IS_SAME_AS>:
85 2019-12-05 David Edelsohn <dje.gcc@gmail.com>
87 * cp-gimplify.c: Include memmodel.h.
89 2019-12-05 Paolo Carlini <paolo.carlini@oracle.com>
91 * typeck2.c (build_functional_cast): Add location_t parameter
93 * cp-tree.h: Update declaration.
94 * parser.c (cp_parser_functional_cast): Adjust call.
95 * call.c (build_op_delete_call): Likewise.
96 (build_new_method_call_1): Likewise.
97 * decl.c (check_initializer): Likewise.
98 * pt.c (tsubst_copy_and_build): Likewise.
99 * semantics.c (finish_compound_literal): Likewise.
101 2019-12-04 David Edelsohn <dje.gcc@gmail.com>
103 * cp-gimplify.c: Include tm_p.h.
105 2019-12-04 Marek Polacek <polacek@redhat.com>
107 * parser.c (enum primary_constraint_error): Remove stray comma.
109 2019-12-04 Richard Sandiford <richard.sandiford@arm.com>
111 * cp-tree.h (CP_AGGREGATE_TYPE_P): Check for gnu_vector_type_p
112 instead of VECTOR_TYPE.
113 * call.c (build_conditional_expr_1): Restrict vector handling
114 to vectors that satisfy gnu_vector_type_p.
115 * cvt.c (ocp_convert): Only allow vectors to be converted
116 to bool if they satisfy gnu_vector_type_p.
117 (build_expr_type_conversion): Only allow conversions from
118 vectors if they satisfy gnu_vector_type_p.
119 * typeck.c (cp_build_binary_op): Only allow binary operators to be
120 applied to vectors if they satisfy gnu_vector_type_p.
121 (cp_build_unary_op): Likewise unary operators.
122 (build_reinterpret_cast_1):
124 2019-12-03 Jakub Jelinek <jakub@redhat.com>
126 * cp-tree.h (enum cp_tree_index): Add CPTI_SOURCE_LOCATION_IMPL.
127 (source_location_impl): Define.
128 (enum cp_built_in_function): Add CP_BUILT_IN_SOURCE_LOCATION.
129 (fold_builtin_source_location): Declare.
130 * cp-gimplify.c: Include output.h, file-prefix-map.h and cgraph.h.
131 (cp_gimplify_expr, cp_fold): Handle CP_BUILT_IN_SOURCE_LOCATION.
133 (get_source_location_impl_type): New function.
134 (struct source_location_table_entry,
135 struct source_location_table_entry_hash): New types.
136 (source_location_table, source_location_id): New variables.
137 (fold_builtin_source_location): New function.
138 * constexpr.c (cxx_eval_builtin_function_call): Handle
139 CP_BUILT_IN_SOURCE_LOCATION.
140 * tree.c (builtin_valid_in_constant_expr_p): Likewise. Formatting
142 * decl.c (cxx_init_decl_processing): Register
143 __builtin_source_location.
144 * name-lookup.c (get_std_name_hint): Add source_location entry.
146 2019-12-03 Paolo Carlini <paolo.carlini@oracle.com>
148 * typeck.c (cp_build_addr_expr_1): Use the cp_expr_loc_or_input_loc
149 location in a few additional diagnostics; tidy.
150 (check_return_expr): Likewise.
152 * typeck.c (cp_build_addr_expr_1): Use tree_strip_any_location_wrapper
153 for the address of main pedwarn.
155 2019-12-03 Jakub Jelinek <jakub@redhat.com>
158 * constexpr.c (struct constexpr_global_ctx): Add cleanups member,
159 initialize it in the ctor.
160 (cxx_eval_constant_expression) <case TARGET_EXPR>: If TARGET_EXPR_SLOT
161 is already in the values hash_map, don't evaluate it again. Put
162 TARGET_EXPR_SLOT into hash_map even if not lval, and push it into
163 save_exprs too. If there is TARGET_EXPR_CLEANUP and not
164 CLEANUP_EH_ONLY, push the cleanup to cleanups vector.
165 <case CLEANUP_POINT_EXPR>: Save outer cleanups, set cleanups to
166 local auto_vec, after evaluating the body evaluate cleanups and
167 restore previous cleanups.
168 <case TRY_CATCH_EXPR>: Don't crash if the first operand is NULL_TREE.
169 (cxx_eval_outermost_constant_expr): Set cleanups to local auto_vec,
170 after evaluating the expression evaluate cleanups.
172 2019-12-03 Marek Polacek <polacek@redhat.com>
174 PR c++/91363 - P0960R3: Parenthesized initialization of aggregates.
175 * call.c (build_new_method_call_1): Handle parenthesized initialization
176 of aggregates by building up a CONSTRUCTOR.
177 (extend_ref_init_temps): Do nothing for CONSTRUCTOR_IS_PAREN_INIT.
178 * cp-tree.h (CONSTRUCTOR_IS_PAREN_INIT, LOOKUP_AGGREGATE_PAREN_INIT):
180 * decl.c (grok_reference_init): Handle aggregate initialization from
181 a parenthesized list of values.
182 (reshape_init): Do nothing for CONSTRUCTOR_IS_PAREN_INIT.
183 (check_initializer): Handle initialization of an array from a
184 parenthesized list of values. Use NULL_TREE instead of NULL.
185 * tree.c (build_cplus_new): Handle BRACE_ENCLOSED_INITIALIZER_P.
186 * typeck2.c (digest_init_r): Set LOOKUP_AGGREGATE_PAREN_INIT if it
187 receives a CONSTRUCTOR with CONSTRUCTOR_IS_PAREN_INIT set. Allow
188 narrowing when LOOKUP_AGGREGATE_PAREN_INIT.
189 (massage_init_elt): Don't lose LOOKUP_AGGREGATE_PAREN_INIT when passing
190 flags to digest_init_r.
192 2019-12-03 Jakub Jelinek <jakub@redhat.com>
195 * typeck2.c (digest_nsdmi_init): For bitfields, use
196 DECL_BIT_FIELD_TYPE instead of TREE_TYPE.
198 2019-12-03 Jason Merrill <jason@redhat.com>
199 Jakub Jelinek <jakub@redhat.com>
202 * call.c (strip_standard_conversion): New function.
203 (build_new_op_1): Use it for user_conv_p.
204 (compare_ics): Likewise.
205 (source_type): Likewise.
207 2019-12-03 Jakub Jelinek <jakub@redhat.com>
210 * constexpr.c (cxx_bind_parameters_in_call): For virtual calls,
211 adjust the first argument to point to the derived object rather
214 2019-12-02 Jakub Jelinek <jakub@redhat.com>
217 * constexpr.c (cxx_eval_constant_expression) <case OBJ_TYPE_REF>: Use
218 STRIP_NOPS before checking for ADDR_EXPR.
220 2019-11-29 Jakub Jelinek <jakub@redhat.com>
223 * parser.c (cp_parser_omp_declare_reduction_exprs): If
224 processing_template_decl, wrap the combiner or initializer
226 * decl.c (start_preparsed_function): Don't start a lambda scope
227 for DECL_OMP_DECLARE_REDUCTION_P functions.
228 (finish_function): Don't finish a lambda scope for
229 DECL_OMP_DECLARE_REDUCTION_P functions, nor cp_fold_function
230 them nor cp_genericize them.
231 * mangle.c (decl_mangling_context): Look through
232 DECL_OMP_DECLARE_REDUCTION_P functions.
233 * semantics.c (expand_or_defer_fn_1): For DECL_OMP_DECLARE_REDUCTION_P
234 functions, use tentative linkage, don't keep their bodies with
235 -fkeep-inline-functions and return false at the end.
237 2019-11-28 Jakub Jelinek <jakub@redhat.com>
240 * decl2.c (mark_used): Don't call note_vague_linkage_fn for pure
241 virtual functions, even if they are declared inline.
243 2019-11-16 Jason Merrill <jason@redhat.com>
245 Implement P1814R0, CTAD for alias templates.
246 * pt.c (rewrite_tparm_list): Factor out of build_deduction_guide.
247 (maybe_aggr_guide): Check for copy-init here.
248 (alias_ctad_tweaks, deduction_guides_for): New.
249 (ctor_deduction_guides_for): Factor out of do_class_deduction.
250 (ctad_template_p): New.
251 * parser.c (cp_parser_simple_type_specifier): Use it.
252 * constraint.cc (append_constraint): New.
254 2019-11-16 Jason Merrill <jason@redhat.com>
256 * cxx-pretty-print.c (pp_cxx_unqualified_id): Handle alias
258 * pt.c (complex_alias_template_p): True if constraints.
259 (get_underlying_template, tsubst): Check alias constraints.
260 (push_template_decl_real): Set alias constraints here.
261 * parser.c (cp_parser_alias_declaration): Not here.
262 * constraint.cc (get_constraints): Take const_tree.
264 2019-11-12 Jason Merrill <jason@redhat.com>
266 PR c++/92206 - ICE with typedef to dependent alias.
267 * pt.c (dependent_alias_template_spec_p)
268 (alias_template_specialization_p): Add transparent_typedefs
270 (iterative_hash_template_arg, any_template_parm_r)
271 (primary_template_specialization_p, tsubst, dependent_type_p_r):
273 * decl.c (check_elaborated_type_specifier): Adjust.
274 * error.c (dump_template_bindings, dump_aggr_type): Adjust.
276 2019-11-27 Andrew Sutton <asutton@lock3software.com>
279 Defer evaluation of concept checks so that static assertions can
280 emit more detailed diagnostics.
281 * constexpr.c (cxx_eval_call_expression): Handle concept checks.
282 (cxx_eval_constant_expression): Diagnose misuse of function concepts
283 as template-id expressions. Follow the usual return path for results.
284 (cxx_eval_outermost_constant_expr): Avoid calling
285 cp_get_callee_fndecl_nofold for function concepts.
286 * constraint.cc (build_function_check): Fully type the concept check
287 so that we don't ICE in conversions.
288 * cp-gimplify.c (cp_genericize_r) [CALL_EXPR]: Handle concept checks.
289 [TEMPLATE_ID_EXPR] Likewise.
290 * cvt.c (convert_to_void): Always evaluate concept checks so we don't
291 accidentally ignore them. Substitution during satisfaction can make
292 a program ill-formed (example in g++.dg/cpp2a/concepts6.C).
293 * pt.c (tsubst_copy_and_build): [CALL_EXPR]: Don't evaluate concepts.
294 [TEMPLATE_ID_EXPR]: Likewise.
295 * semantics.c (finish_call_expr): Don't evaluate concepts.
296 (finish_id_expression_1): Likewise.
297 (finish_static_assert): Preserve the original condition so we can
298 diagnose concept errors when a check returns false.
300 2019-11-27 Andrew Sutton <asutton@lock3software.com>
303 Improve quality of diagnostics for subexpressions that need parens.
304 * parser.c (cp_parser_requires_clause_opt): Add a flag to indicate
305 when parsing a requires-clause before lambda parameters, and...
306 (cp_parser_lambda_declarator_opt): ... use that here ...
307 (cp_parser_type_parameter): ... and here ...
308 (cp_parser_late_return_type_opt): ... and here ...
309 (cp_parser_explicit_template_declaration): ... and here.
310 (cp_parser_diagnose_ungrouped_constraint_plain): Adjust the message
311 because this can apply to subexpressions that are not immediately
312 after a requires-clause.
313 (cp_parser_diagnose_ungrouped_constraint_rich): Likewise.
314 (primary_constraint_error): New.
315 (cp_parser_constraint_requires_parens): New.
316 (cp_parser_unary_constraint_requires_parens): New.
317 (cp_parser_constraint_primary_expression): Check for unary expressions
318 before parsing the primary expression. Also check for binary and
319 postfix operators after a successful parse of the primary expression.
320 Force a re-parse if the result would form a lower-precedence string.
321 (cp_parser_constraint_logical_and_expression): Propagate lambda flag;
322 move checks for ill-formed constraints into the constraint primary
324 (cp_parser_constraint_logical_or_expression): Likewise.
325 (cp_parser_requires_clause_expression): Propagate lambda flag.
327 2019-11-27 Andrew Sutton <asutton@lock3software.com>
330 * constraint.cc (satisfy_declaration_constraints): Push tinst levels
333 2019-11-27 Andrew Sutton <asutton@lock3software.com>
335 Diagnose certain constraint errors as hard errors, but otherwise treat
336 them the same as normal SFINAE-type errors. Also, generally clean up
337 the satisfaction functions.
339 * constexpr.c (cxx_eval_constant_expression): Use
340 evaluate_concept_check.
341 * constraint.cc (normalize_concept_definition): Accept a diagnostic
342 flag and only cache when not diagnosing errors.
343 (decl_satisfied_cache): Map to trees instead of bools.
344 (satisfy_atom): Guarantee a location for the errors, propagate complain
345 flags to force_rvalue, and emit errors for non-boolean constraints.
346 (get_normalized_constraints_and_args): New overloads. Factored out of
347 satisfy_constraint_expression and satisfy_declaration_constraints.
348 (satisfy_constraint_expression): Propagate diagnostic info to
350 (satisfy_declaration_constraints): New. Factored out of
351 constraints_satisfied_p.
352 (constraint_satisfaction_value): New. Calls
353 satisfy_constraint_expression or satisfy_declaration_constraints.
354 (constraints_satisfied_p): Call constraint_satisfaction_value.
355 (evaluate_concept_check): Don't take tsubst_falgs_t. Replay
356 satisfaction if an error is encountered.
357 (current_failed_constraint): Moved from pt.c.
358 (diagnose_constraints): Call constraint_satisfaction_value.
359 * cp-tree.h: Update declarations.
360 * pt.c (current_failed_constraint): Moved to constraint.cc.
361 * semantics.c (finish_id_expression_1): Remove a duplicate case.
363 2019-11-27 Jakub Jelinek <jakub@redhat.com>
366 * tree.c (replace_placeholders_r): Don't walk constructor elts with
369 2019-11-26 Jason Merrill <jason@redhat.com>
371 * pt.c (tsubst_copy_and_build) [TEMPLATE_ID_EXPR]: Remember the
372 location of a variable template-id.
373 * constexpr.c (cxx_eval_constant_expression): Get expr location
374 before stripping location wrappers.
375 (non_const_var_error): Take location argument.
377 2019-11-26 Paolo Carlini <paolo.carlini@oracle.com>
379 * typeck.c (cp_build_unary_op): Consistently use the accurate
380 location in seven additional diagnostic messages.
381 (cp_build_compound_expr): Use cp_expr_loc_or_input_loc in one place.
383 2019-11-26 Jakub Jelinek <jakub@redhat.com>
386 * parser.c (cp_parser_std_attribute): For unknown attributes,
387 skip balanced token seq instead of trying to parse
388 attribute-argument-clause as expression list. Formatting fix.
391 * class.c (enum_to_min_precision): New hash_map.
392 (enum_min_precision): New function.
393 (check_bitfield_decl): Use it.
395 2019-11-25 Paolo Carlini <paolo.carlini@oracle.com>
397 * typeck.c (cp_build_indirect_ref_1): Add location_t parameter
398 and use it in error messages.
399 (build_x_indirect_ref): Adjust call.
400 (build_indirect_ref): Likewise.
401 (cp_build_fold_indirect_ref): Likewise.
402 (cp_build_array_ref): Likewise.
403 * call.c (build_new_op_1): Likewise.
404 * semantics.c (finish_omp_clauses): Likewise.
405 (finish_omp_depobj): Likewise.
406 * typeck2.c (build_x_arrow): Likewise.
407 * cp-tree.h (cp_build_indirect_ref): Update declaration.
409 * call.c (build_new_op_1): Use location argument in warning_at.
411 * typeck.c (cp_build_modify_expr): Consistently use the
414 2019-11-23 Bernd Edlinger <bernd.edlinger@hotmail.de>
417 * name-lookup.c (check_local_shadow): Use can_convert_arg
418 instead of can_convert.
420 2019-11-22 Marek Polacek <polacek@redhat.com>
422 PR c++/88337 - P1327R1: Allow polymorphic typeid in constexpr.
423 * constexpr.c (potential_constant_expression_1): Allow a typeid
424 expression whose operand is of polymorphic type in constexpr in
426 * rtti.c (build_typeid): Remove obsolete FIXME comment.
428 2019-11-22 Jakub Jelinek <jakub@redhat.com>
431 * cp-objcp-common.c (identifier_global_tag): Define.
434 * init.c (nsdmi_inst): Change type to
435 decl_tree_cache_map * from tree_cache_map *.
436 * constraint.cc (decl_constraints): Likewise.
437 * decl.c (get_tuple_decomp_init): Likewise.
438 * pt.c (defarg_inst, explicit_specifier_map): Likewise.
439 (tsubst_default_argument, store_explicit_specifier): Use
440 decl_tree_cache_map::create_ggc rather than
441 tree_cache_map::create_ggc.
442 * cp-objcp-common.c (debug_type_map): Change type to
443 type_tree_cache_map * from tree_cache_map *.
445 2019-11-21 Marek Polacek <polacek@redhat.com>
447 PR c++/92450 - ICE with invalid nested name specifier.
448 * parser.c (cp_parser_member_declaration): Don't attempt to print
449 erroneous bit-field diagnostic if grokdeclarator returns
452 2019-11-21 Jakub Jelinek <jakub@redhat.com>
453 Jason Merrill <jason@redhat.com>
456 * parser.c (cp_parser_decl_specifier_seq): For concept or typedef
457 break early if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR.
458 For type specifiers, set CP_PARSER_FLAGS_NO_TYPE_DEFINITIONS
459 if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR is set.
461 2019-11-20 Paolo Carlini <paolo.carlini@oracle.com>
463 * typeck2.c (build_x_arrow): Early return if decay_conversion
464 returns error_mark_node.
466 2019-11-20 Jakub Jelinek <jakub@redhat.com>
469 * call.c (complain_about_no_candidates_for_method_call): If
470 conv->from is not a type, pass to complain_about_bad_argument
471 lvalue_type of conv->from.
473 2019-11-20 Paolo Carlini <paolo.carlini@oracle.com>
475 * cvt.c (ocp_convert): Use additional warning sentinel.
477 2019-11-19 Jakub Jelinek <jakub@redhat.com>
480 * constexpr.c (cxx_eval_outermost_constant_expr): If DECL_INITIAL
481 on object is erroneous, return t without trying to evaluate
484 2019-11-12 Jason Merrill <jason@redhat.com>
486 * call.c (same_fn_or_template): Change to cand_parms_match.
488 (print_z_candidate): Mark rewritten/reversed candidates.
489 (build_new_op_1): Warn about recursive call with reversed arguments.
491 2019-11-15 Andrew Sutton <asutton@lock3software.com>
494 * pt.c (get_underlying_template): Exit loop if the original type
495 of the alias is null.
497 2019-11-19 Andrew Sutton <asutton@lock3software.com>
500 * pt.c (maybe_new_partial_specialization): Apply access to newly
501 created partial specializations. Update comment style.
503 2019-11-19 Andrew Sutton <asutton@lock3software.com>
506 * pt.c (maybe_new_partial_specialization): Apply access to newly
507 created partial specializations. Update comment style.
509 2019-11-19 Andrew Sutton <asutton@lock3software.com>
512 Suppress diagnostics substituting into a requires-expression.
513 * pt.c (tsubst_copy_and_build): Perform the first substitution without
514 diagnostics and a second only if tsubst_requries_expr returns an error.
516 2019-11-19 Jakub Jelinek <jakub@redhat.com>
519 * semantics.c (handle_omp_for_class_iterator): Don't call
520 cp_fully_fold on cond.
522 2019-11-18 Paolo Carlini <paolo.carlini@oracle.com>
524 * typeck.c (cp_build_addr_expr_1): Use cp_expr_loc_or_input_loc
526 (cxx_sizeof_expr): Use it in one additional place.
527 (cxx_alignof_expr): Likewise.
528 (lvalue_or_else): Likewise.
530 2019-11-18 Marek Polacek <polacek@redhat.com>
532 PR c++/91962 - ICE with reference binding and qualification conversion.
533 * call.c (convert_like_real) <case ck_ref_bind>: Check need_temporary_p.
535 2019-11-17 Jakub Jelinek <jakub@redhat.com>
537 * method.c (lookup_comparison_result): Use %qD instead of %<%T::%D%>
539 (lookup_comparison_category): Use %qD instead of %<std::%D%> to print
542 2019-11-15 Paolo Carlini <paolo.carlini@oracle.com>
544 * typeck.c (cp_truthvalue_conversion): Add tsubst_flags_t parameter
545 and use it in calls; also pass the location_t of the expression to
546 cp_build_binary_op and c_common_truthvalue_conversion.
547 * rtti.c (build_dynamic_cast_1): Adjust call.
548 * cvt.c (ocp_convert): Likewise.
549 * cp-gimplify.c (cp_fold): Likewise.
550 * cp-tree.h (cp_truthvalue_conversion): Update declaration.
552 2019-11-14 Jason Merrill <jason@redhat.com>
554 Implement P1816R0, class template argument deduction for aggregates.
555 * pt.c (maybe_aggr_guide, collect_ctor_idx_types): New.
556 (is_spec_or_derived): Split out from do_class_deduction.
557 (build_deduction_guide): Handle aggregate guide.
558 * class.c (finish_struct): Set CLASSTYPE_NON_AGGREGATE in a
560 * cp-tree.h (CP_AGGREGATE_TYPE_P): An incomplete class is not an
563 2019-11-14 Richard Sandiford <richard.sandiford@arm.com>
565 * call.c (build_conditional_expr_1): Use truth_type_for instead
566 of build_same_sized_truth_vector_type.
567 * typeck.c (build_vec_cmp): Likewise.
569 2019-11-14 Jakub Jelinek <jakub@redhat.com>
571 * parser.c (cp_parser_omp_context_selector): Don't require score
572 argument to fit into shwi, just to be INTEGER_CST. Diagnose
574 * pt.c (tsubst_attribute): Likewise.
576 * parser.c (cp_parser_omp_context_selector): Rename
577 CTX_PROPERTY_IDLIST to CTX_PROPERTY_NAME_LIST, add CTX_PROPERTY_ID.
578 Use CTX_PROPERTY_ID for atomic_default_mem_order, only allow a single
579 identifier in that. For CTX_PROPERTY_NAME_LIST, allow identifiers
581 * pt.c (tsubst_attribute): Fix up STRING_CST handling if allow_string.
583 2019-11-13 Marek Polacek <polacek@redhat.com>
585 PR c++/89070 - bogus [[nodiscard]] warning in SFINAE.
586 * cvt.c (convert_to_void): Guard maybe_warn_nodiscard calls with
589 2019-11-13 Richard Sandiford <richard.sandiford@arm.com>
592 * cp-tree.h (STF_STRIP_DEPENDENT): New constant.
593 * tree.c (strip_typedefs): Add STF_STRIP_DEPENDENT to the flags
594 when calling strip_typedefs recursively on a DECL_ORIGINAL_TYPE.
595 Don't apply the fix for DR1558 in that case; allow aliases with
596 dependent template parameters to be stripped instead.
598 2019-11-12 Nathan Sidwell <nathan@acm.org>
600 * name-lookup.c (lookup_using_decl): New function, merged from ...
601 (do_class_using_decl): ... here. Call it. And ...
602 (finish_nonmember_using_decl): ... here. Call it.
604 2019-11-12 Martin Liska <mliska@suse.cz>
606 * name-lookup.c: Do not include params.h.
607 * typeck.c: Likewise.
609 2019-11-12 Martin Liska <mliska@suse.cz>
611 * name-lookup.c (namespace_hints::namespace_hints): Replace old
612 parameter syntax with the new one, include opts.h if needed. Use
613 SET_OPTION_IF_UNSET macro.
614 * typeck.c (comptypes): Likewise.
616 2019-11-12 Maciej W. Rozycki <macro@codesourcery.com>
617 Frederik Harwath <frederik@codesourcery.com>
620 * constexpr.c (potential_constant_expression_1): Handle
622 * parser.c (OACC_SERIAL_CLAUSE_MASK): New macro.
623 (cp_parser_oacc_kernels_parallel): Rename function to...
624 (cp_parser_oacc_compute): ... this. Handle PRAGMA_OACC_SERIAL.
625 (cp_parser_omp_construct): Update accordingly.
626 (cp_parser_pragma): Handle PRAGMA_OACC_SERIAL. Fix alphabetic
628 * pt.c (tsubst_expr): Handle OACC_SERIAL.
630 2019-11-11 Jason Merrill <jason@redhat.com>
632 Implement P1946R0, Allow defaulting comparisons by value.
633 * method.c (early_check_defaulted_comparison): Accept by-value,
634 reject mixed by-value and by-reference parms.
635 * decl.c (grokdeclarator): Set funcdef_flag for defaulted friend.
636 * decl2.c (grokfield): Don't SET_DECL_FRIEND_CONTEXT.
638 * typeck.c (cp_build_binary_op): Sorry about <=> on VECTOR_TYPE.
640 2019-11-11 Jakub Jelinek <jakub@redhat.com>
643 * decl.c (finish_function): Move ctype initialization before
644 DECL_DELETED_FN handling.
646 * semantics.c (finish_translation_unit): Diagnose declare target
647 without corresponding end declare target.
649 2019-11-10 Jason Merrill <jason@redhat.com>
651 Implement D1957R0, T* to bool should be considered narrowing.
652 * typeck2.c (check_narrowing): Treat pointer->bool as a narrowing
653 conversion with -std=c++2a.
655 2019-11-08 Marek Polacek <polacek@redhat.com>
657 PR c++/92215 - flawed diagnostic for bit-field with non-integral type.
658 * parser.c (cp_parser_member_declaration): Add a diagnostic for
659 bit-fields with non-integral types.
661 2019-11-08 Jakub Jelinek <jakub@redhat.com>
663 * init.c (build_vec_delete_1): Fix a comment typo - mist -> must.
665 2019-11-07 Jason Merrill <jason@redhat.com>
667 Implement D1959R0, remove weak_equality and strong_equality.
668 * method.c (enum comp_cat_tag, comp_cat_info): Remove *_equality.
669 (genericize_spaceship, common_comparison_type): Likewise.
670 * typeck.c (cp_build_binary_op): Move SPACESHIP_EXPR to be with the
671 relational operators, exclude other types no longer supported.
673 2019-11-06 Jason Merrill <jason@redhat.com>
675 Implement D1907R1 "structural type".
676 * tree.c (structural_type_p): New.
677 * pt.c (invalid_nontype_parm_type_p): Use it.
678 * class.c (build_base_field_1): Take binfo. Copy TREE_PRIVATE.
679 (build_base_field): Pass binfo.
681 PR c++/92150 - partial specialization with class NTTP.
682 * pt.c (unify): Handle VIEW_CONVERT_EXPR.
684 * pt.c (use_pack_expansion_extra_args_p): Still do substitution if
685 all packs are simple pack expansions.
686 (add_extra_args): Check that the extra args aren't dependent.
688 2019-11-06 Andrew Sutton <asutton@lock3software.com>
690 Use satisfaction with nested requirements.
691 * constraint.cc (build_parameter_mapping): Use
692 current_template_parms when the declaration is not available.
693 (norm_info::norm_info) Make explicit.
694 (normalize_constraint_expression): Factor into a separate overload
695 that takes arguments, and use that in the original function.
696 (tsubst_nested_requirement): Use satisfy_constraint instead of
697 trying to evaluate this as a constant expression.
698 (finish_nested_requirement): Keep the normalized constraint and the
699 original normalization arguments with the requirement.
700 (diagnose_nested_requirement): Use satisfy_constraint. Tentatively
701 implement more comprehensive diagnostics, but do not enable.
702 * parser.c (cp_parser_requires_expression): Relax requirement that
703 requires-expressions can live only inside templates.
704 * pt.c (any_template_parm_r): Look into type of PARM_DECL.
706 2019-11-06 Jason Merrill <jason@redhat.com>
708 C++20 NB CA378 - Remove constrained non-template functions.
709 * decl.c (grokfndecl): Reject constraints on non-templated function.
711 2019-11-06 Matthias Kretz <m.kretz@gsi.de>
713 * parser.c (cp_parser_operator): Parse operator?: as an
714 attempt to overload the conditional operator.
716 2019-11-05 Jason Merrill <jason@redhat.com>
718 Implement C++20 operator<=>.
719 * cp-tree.h (struct lang_decl_fn): Add maybe_deleted bitfield.
720 (DECL_MAYBE_DELETED): New.
721 (enum special_function_kind): Add sfk_comparison.
722 (LOOKUP_REWRITTEN, LOOKUP_REVERSED): New.
723 * call.c (struct z_candidate): Add rewritten and reversed methods.
724 (add_builtin_candidate): Handle SPACESHIP_EXPR.
725 (add_builtin_candidates): Likewise.
726 (add_candidates): Don't add a reversed candidate if the parms are
728 (add_operator_candidates): Split out from build_new_op_1. Handle
729 rewritten and reversed candidates.
730 (add_candidate): Swap conversions of reversed candidate.
731 (build_new_op_1): Swap them back. Build a second operation for
732 rewritten candidates.
733 (extract_call_expr): Handle rewritten calls.
734 (same_fn_or_template): New.
735 (joust): Handle rewritten and reversed candidates.
736 * class.c (add_implicitly_declared_members): Add implicit op==.
737 (classtype_has_op, classtype_has_defaulted_op): New.
738 * constexpr.c (cxx_eval_binary_expression): Handle SPACESHIP_EXPR.
739 (cxx_eval_constant_expression, potential_constant_expression_1):
741 * cp-gimplify.c (genericize_spaceship): New.
742 (cp_genericize_r): Use it.
743 * cp-objcp-common.c (cp_common_init_ts): Handle SPACESHIP_EXPR.
744 * decl.c (finish_function): Handle deleted function.
745 * decl2.c (grokfield): SET_DECL_FRIEND_CONTEXT on defaulted friend.
746 (mark_used): Check DECL_MAYBE_DELETED. Remove assumption that
747 defaulted functions are non-static members.
748 * error.c (dump_expr): Handle SPACESHIP_EXPR.
749 * method.c (type_has_trivial_fn): False for sfk_comparison.
750 (enum comp_cat_tag, struct comp_cat_info_t): New types.
751 (comp_cat_cache): New array variable.
752 (lookup_comparison_result, lookup_comparison_category)
753 (is_cat, cat_tag_for, spaceship_comp_cat)
754 (spaceship_type, genericize_spaceship)
755 (common_comparison_type, early_check_defaulted_comparison)
756 (comp_info, build_comparison_op): New.
757 (synthesize_method): Handle sfk_comparison. Handle deleted.
758 (get_defaulted_eh_spec, maybe_explain_implicit_delete)
759 (explain_implicit_non_constexpr, implicitly_declare_fn)
760 (defaulted_late_check, defaultable_fn_check): Handle sfk_comparison.
761 * name-lookup.c (get_std_name_hint): Add comparison categories.
762 * tree.c (special_function_p): Add sfk_comparison.
763 * typeck.c (cp_build_binary_op): Handle SPACESHIP_EXPR.
765 2019-11-05 Tim van Deurzen <tim@kompiler.org>
767 Add new tree code for the spaceship operator.
768 * cp-tree.def: Add new tree code.
769 * operators.def: New binary operator.
770 * parser.c: Add new token and tree code.
772 2019-09-15 Jason Merrill <jason@redhat.com>
774 * call.c (build_new_op_1): Don't apply any standard conversions to
775 the operands of a built-in operator. Don't suppress conversions in
777 * typeck.c (cp_build_unary_op): Do integral promotions for enums.
779 2019-11-04 Jason Merrill <jason@redhat.com>
781 Use vec instead of raw array for built-in candidates.
782 * call.c (build_builtin_candidate): Take args in a vec.
783 (add_builtin_candidate, add_builtin_candidates): Likewise.
784 (build_conditional_expr_1, build_new_op_1): Adjust.
786 2019-11-04 Jason Merrill <jason@redhat.com>
788 * constexpr.c (explain_invalid_constexpr_fn): Show location of fn.
790 * pt.c (maybe_instantiate_noexcept): Only update clones if we
793 * typeck.c (contextual_conv_bool): New.
795 * name-lookup.c (lookup_qualified_name): Add wrapper overload taking
796 C string rather than identifier.
797 * parser.c (cp_parser_userdef_numeric_literal): Use it.
798 * rtti.c (emit_support_tinfos): Use it.
799 * cp-tree.h (ovl_op_identifier): Change to inline functions.
800 (build_x_binary_op): Add wrapper with fewer parms.
802 2019-11-05 Jason Merrill <jason@redhat.com>
804 * decl2.c (mark_used): Diagnose use of a function with unsatisfied
806 * typeck.c (cp_build_function_call_vec): Not here.
808 2019-11-05 Nathan Sidwell <nathan@acm.org>
811 * parser.c (cp_parser_error_1): Check EOF and UNKNOWN_LOCATION
812 when skipping over version control marker.
814 2019-11-05 Jakub Jelinek <jakub@redhat.com>
817 * constexpr.c (potential_constant_expression_1): Return true rather
818 than false for PREDICT_EXPR.
820 * decl.c (omp_declare_variant_finalize_one): Call
821 declare_simd_adjust_this not just on the context, but also on the
822 variant-id expression for methods. Don't call
823 cp_get_callee_fndecl_nofold, call cp_get_callee and only if it is
824 safe cp_get_fndecl_from_callee. Don't try to print as %qD
826 * pt.c (tsubst_attribute): Handle "omp declare variant base"
828 (tsubst_function_decl): Call omp_declare_variant_finalize
829 if there are any "omp declare variant base" attributes left.
831 2019-11-04 Kamlesh Kumar <kamleshbhalui@gmail.com>
833 PR c++/91979 - mangling nullptr expression
834 * mangle.c (write_template_arg_literal): Handle nullptr
837 2019-11-04 Jason Merrill <jason@redhat.com>
839 * typeck.c (check_return_expr): Avoid redundant error.
841 2019-11-02 Paolo Carlini <paolo.carlini@oracle.com>
843 * typeck.c (composite_pointer_type): Add a const op_location_t&
844 parameter and use it in diagnostics.
845 (composite_pointer_error): Likewise.
846 (composite_pointer_type_r): Add a const op_location_t&
847 parameter and forward it.
848 (cp_build_binary_op): Adjust calls.
849 (common_pointer_type): Likewise.
850 * call.c (add_builtin_candidate): Likewise.
851 (build_conditional_expr_1): Likewise.
852 * cp-tree.h (composite_pointer_type): Update declaration.
854 * typeck.c (cxx_sizeof_expr): Use cp_expr_loc_or_input_loc
856 (cxx_alignof_expr): Likewise.
857 (lvalue_or_else): Likewise.
859 2019-11-02 Jakub Jelinek <jakub@redhat.com>
861 * decl.c (omp_declare_variant_finalize_one): Use
862 omp_get_context_selector instead of c_omp_get_context_selector.
865 * parser.c (cp_parser_decl_specifier_seq): Don't parse attributes
866 if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR.
868 PR c++/88335 - Implement P1073R3: Immediate functions
869 * cp-tree.h (struct lang_decl_fn): Add immediate_fn_p bit.
870 (DECL_IMMEDIATE_FUNCTION_P, SET_DECL_IMMEDIATE_FUNCTION_P): Define.
871 (enum cp_decl_spec): Add ds_consteval.
872 (fold_non_dependent_expr): Add another tree argument defaulted to
874 * name-lookup.h (struct cp_binding_level): Add immediate_fn_ctx_p
876 * parser.c (cp_keyword_starts_decl_specifier_p): Adjust comments
877 for C++11 and C++20 specifiers. Handle RID_CONSTEVAL.
878 (CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR): Adjust comment.
879 (CP_PARSER_FLAGS_CONSTEVAL): New.
880 (cp_parser_skip_balanced_tokens): New forward declaration.
881 (cp_parser_lambda_declarator_opt): Handle ds_consteval. Set
882 current_binding_level->immediate_fn_ctx_p before parsing parameter
883 list if decl-specifier-seq contains consteval specifier.
884 (cp_parser_decl_specifier_seq): Handle RID_CONSTEVAL.
885 (cp_parser_explicit_instantiation): Diagnose explicit instantiation
886 with consteval specifier.
887 (cp_parser_init_declarator): For consteval or into flags
888 CP_PARSER_FLAGS_CONSTEVAL.
889 (cp_parser_direct_declarator): If CP_PARSER_FLAGS_CONSTEVAL, set
890 current_binding_level->immediate_fn_ctx_p in the sk_function_parms
892 (set_and_check_decl_spec_loc): Add consteval entry, formatting fix.
893 * call.c (build_addr_func): For direct calls to immediate functions
894 use build_address rather than decay_conversion.
895 (build_over_call): Evaluate immediate function invocations.
896 * error.c (dump_function_decl): Handle DECL_IMMEDIATE_FUNCTION_P.
897 * semantics.c (expand_or_defer_fn_1): Use tentative linkage and don't
898 call mark_needed for immediate functions.
899 * typeck.c (cxx_sizeof_or_alignof_expr): Likewise. Formatting fix.
900 (cp_build_addr_expr_1): Reject taking address of immediate function
901 outside of immediate function.
902 * decl.c (validate_constexpr_redeclaration): Diagnose consteval
903 vs. non-consteval or vice versa redeclaration. Use
904 SET_DECL_IMMEDIATE_FUNCTION_P if new_decl is immediate function.
905 (check_tag_decl): Use %qs with keyword string to simplify translation.
907 (start_decl): Adjust diagnostics for static or thread_local variables
908 in immediate functions.
909 (grokfndecl): Call sorry_at on virtual consteval. Use %qs with keyword
910 to string to simplify translation. Diagnose consteval main. Use
911 SET_DECL_IMMEDIATE_FUNCTION_P for consteval.
912 (grokdeclarator): Handle consteval. Use %qs with keyword strings to
913 simplify translation. Use separate ifs instead of chained else if
914 for invalid specifiers. For constinit clear constinit_p rather than
916 * constexpr.c (find_immediate_fndecl): New function.
917 (cxx_eval_outermost_constant_expr): Allow consteval calls returning
918 void. Diagnose returning address of immediate function from consteval
920 (fold_non_dependent_expr_template): Add OBJECT argument, pass it
921 through to cxx_eval_outermost_constant_expr.
922 (fold_non_dependent_expr): Add OBJECT argument, pass it through to
923 fold_non_dependent_expr_template.
924 (fold_non_dependent_init): Adjust fold_non_dependent_expr_template
926 * method.c (defaulted_late_check): Adjust diagnostics for consteval.
927 * lambda.c (maybe_add_lambda_conv_op): Copy over
928 DECL_DECLARED_CONSTEXPR_P and DECL_IMMEDIATE_FUNCTION_P bits from
929 callop to both artificial functions.
930 * init.c (build_value_init): Don't do further processing if
931 build_special_member_call returned a TREE_CONSTANT. Formatting fix.
933 PR c++/91369 - Implement P0784R7: constexpr new
934 * cp-tree.h (CALL_FROM_NEW_OR_DELETE_P): Define.
935 * init.c (build_new_1, build_vec_delete_1, build_delete): Set
936 CALL_FROM_NEW_OR_DELETE_P on the CALL_EXPR to allocator functions.
937 * constexpr.c (is_std_allocator_allocate): Only allow
938 global replaceable allocator functions if CALL_FROM_NEW_OR_DELETE_P
939 or in std::allocate<T>::{,de}allocate.
940 (potential_constant_expression_1): Likewise.
942 2019-11-01 Nathan Sidwell <nathan@acm.org>
944 * class.c (check_field_decls): Refactor.
946 2019-10-31 Jakub Jelinek <jakub@redhat.com>
949 * cp-tree.h (type_initializer_zero_p): Declare.
950 * decl.c (reshape_init_array_1): Formatting fix.
951 * tree.c (type_initializer_zero_p): New function. Moved from
952 ../tree.c, use next_initializable_field, formatting fix. Return
953 false for TYPE_NON_AGGREGATE_CLASS types.
955 2019-10-30 Jason Merrill <jason@redhat.com>
957 PR c++/92268 - hard error satisfying return-type-requirement
958 * constraint.cc (type_deducible_p): Check for substitution failure.
959 (diagnose_compound_requirement): Adjust diagnostic.
960 * pt.c (do_auto_deduction): Don't pass cargs to
961 constraints_satisfied_p.
963 2019-10-30 Jakub Jelinek <jakub@redhat.com>
965 PR c++/91369 - Implement P0784R7: constexpr new
966 * constexpr.c (cxx_replaceable_global_alloc_fn): Don't return true
968 (cxx_placement_new_fn, is_std_construct_at): New functions.
969 (cxx_eval_call_expression): Allow placement new in std::construct_at.
970 (potential_constant_expression_1): Likewise.
972 * typeck.c (decl_in_std_namespace_p): Return true also for decls
973 in inline namespaces inside of std namespace.
975 2019-10-30 Bernd Edlinger <bernd.edlinger@hotmail.de>
978 * name-lookup.c (check_local_shadow): Shadowing TYPE_DECLs
979 is always a -Wshadow=compatible-local warning, unless
982 2019-10-30 Jason Merrill <jason@redhat.com>
984 * cxx-pretty-print.c (get_fold_operator): Use OVL_OP_INFO.
986 2019-10-30 Marek Polacek <polacek@redhat.com>
988 PR c++/92134 - constinit malfunction in static data member.
989 * decl2.c (grokfield): Set LOOKUP_CONSTINIT.
991 2019-10-30 Jakub Jelinek <jakub@redhat.com>
993 * cp-tree.h (omp_declare_variant_finalize, build_local_temp): Declare.
994 * decl.c: Include omp-general.h.
995 (declare_simd_adjust_this): Add forward declaration.
996 (omp_declare_variant_finalize_one, omp_declare_variant_finalize): New
998 (cp_finish_decl, finish_function): Call omp_declare_variant_finalize.
999 * parser.c (cp_finish_omp_declare_variant): Adjust parsing of the
1000 variant id-expression and propagate enough information to
1001 omp_declare_variant_finalize_one in the attribute so that it can
1003 * class.c (finish_struct): Call omp_declare_variant_finalize.
1004 * tree.c (build_local_temp): No longer static, remove forward
1007 2019-10-30 Paolo Carlini <paolo.carlini@oracle.com>
1009 * typeck.c (cp_build_modify_expr): Prefer error + inform to
1010 error + error in one place.
1011 (get_delta_difference_1): Likewise.
1012 (get_delta_difference): Likewise, in two places.
1014 2019-10-29 Paolo Carlini <paolo.carlini@oracle.com>
1016 * typeck.c (build_x_unary_op): Use the location_t argument in
1019 2019-10-29 Marek Polacek <polacek@redhat.com>
1021 PR c++/90998 - ICE with copy elision in init by ctor and -Wconversion.
1022 * call.c (joust): Don't attempt to warn if ->second_conv is null.
1024 2019-10-29 Jakub Jelinek <jakub@redhat.com>
1027 * cp-gimplify.c (cp_gimplify_expr): If gimplify_to_rvalue changes the
1028 function pointer type, re-add cast to the original one.
1030 2019-10-29 Marek Polacek <polacek@redhat.com>
1032 PR c++/91548 - fix detecting modifying const objects for ARRAY_REF.
1033 * constexpr.c (cxx_eval_store_expression): Don't call
1034 modifying_const_object_p for ARRAY_REF.
1036 2019-10-29 Richard Sandiford <richard.sandiford@arm.com>
1038 * cp-objcp-common.h (cxx_simulate_enum_decl): Declare.
1039 (LANG_HOOKS_SIMULATE_ENUM_DECL): Define to the above.
1040 * decl.c (cxx_simulate_enum_decl): New function.
1042 2019-10-29 Richard Sandiford <richard.sandiford@arm.com>
1044 * cp-tree.h (cxx_simulate_builtin_function_decl): Declare.
1045 * decl.c (cxx_simulate_builtin_function_decl): New function.
1046 * cp-objcp-common.h (LANG_HOOKS_SIMULATE_BUILTIN_FUNCTION_DECL):
1047 Define to the above.
1049 2019-10-28 Martin Sebor <msebor@redhat.com>
1052 * cp-objcp-common.c (names_builtin_p): Define new function.
1054 2019-10-28 Nathan Sidwell <nathan@acm.org>
1056 * parser.h (struct cp_token): Drop {ENUM,BOOL}_BITFIELD C-ism.
1057 Add tree_check_p flag, use as nested union discriminator.
1058 (struct cp_lexer): Add saved_type & saved_keyword fields.
1059 * parser.c (eof_token): Delete.
1060 (cp_lexer_new_main): Always init last_token to last token of
1062 (cp_lexer_new_from_tokens): Overlay EOF token at end of range.
1063 (cp_lexer_destroy): Restore token under the EOF.
1064 (cp_lexer_previous_token_position): No check for eof_token here.
1065 (cp_lexer_get_preprocessor_token): Clear tree_check_p.
1066 (cp_lexer_peek_nth_token): Check CPP_EOF not eof_token.
1067 (cp_lexer_consume_token): Assert not CPP_EOF, no check for
1069 (cp_lexer_purge_token): Likewise.
1070 (cp_lexer_purge_tokens_after): No check for EOF token.
1071 (cp_parser_nested_name_specifier, cp_parser_decltype)
1072 (cp_parser_template_id): Set tree_check_p.
1074 2019-10-24 Jakub Jelinek <jakub@redhat.com>
1076 * decl2.c (cplus_decl_attributes): Add "omp declare target block"
1077 attribute in between declare target and end declare target
1080 * call.c (convert_arg_to_ellipsis): Add missing space in string
1083 2019-10-24 Marek Polacek <polacek@redhat.com>
1085 * decl.c (reshape_init_r): Add missing space.
1087 2019-10-24 Nathan Sidwell <nathan@acm.org>
1089 * pt.c (reduce_template_parm_level): Attach the new TPI to the new
1091 (convert_generic_types_to_packs): Pass the copied type to
1092 reduce_templatE_parm_level.
1094 2019-10-23 Nathan Sidwell <nathan@acm.org>
1096 * cp-tree.c (CPTI_STD_IDENTIFIER): Delete.
1097 (std_identifier): Delete.
1098 (DECL_NAME_SPACE_STD_P): Compare against std_node.
1099 * decl.c (initialize_predefined_identifiers): 'std' is not needed.
1100 (cxx_init_decl_processing): Adjust creation of ::std. Use
1101 {push,pop}_nested_namespace.
1102 (cxx_builtin_function): Use {push,pop}_nested_namespace.
1103 * except.c (init_exception_processing): Likewise.
1104 * rtti.c (init_rtti_processing): Likewise.
1106 2019-10-23 Jason Merrill <jason@redhat.com>
1108 Implement P1286R2, Contra CWG1778
1109 * method.c (defaulted_late_check): Don't check explicit
1110 exception-specification on defaulted function.
1111 (after_nsdmi_defaulted_late_checks): Remove.
1112 * parser.h (struct cp_unparsed_functions_entry): Remove classes.
1113 * parser.c (unparsed_classes): Remove.
1114 (push_unparsed_function_queues, cp_parser_class_specifier_1):
1117 2019-10-23 Jakub Jelinek <jakub@redhat.com>
1119 * constexpr.c (cxx_eval_constant_expression) <case CLEANUP_STMT>:
1120 Temporarily change input_location to CLEANUP_STMT location.
1122 2019-10-22 Jakub Jelinek <jakub@redhat.com>
1124 PR tree-optimization/85887
1125 * decl.c (expand_static_init): Drop ECF_LEAF from __cxa_guard_acquire
1126 and __cxa_guard_release.
1128 2019-10-22 Marc Glisse <marc.glisse@inria.fr>
1131 * constexpr.c (cxx_eval_builtin_function_call): Only set
1132 force_folding_builtin_constant_p if manifestly_const_eval.
1134 2019-10-22 Richard Sandiford <richard.sandiford@arm.com>
1136 * cp-tree.h (STF_USER_VISIBLE): New constant.
1137 (strip_typedefs, strip_typedefs_expr): Take a flags argument.
1138 * tree.c (strip_typedefs, strip_typedefs_expr): Likewise,
1139 updating mutual calls accordingly. When STF_USER_VISIBLE is true,
1140 only look through typedefs if user_facing_original_type_p.
1141 * error.c (dump_template_bindings, type_to_string): Pass
1142 STF_USER_VISIBLE to strip_typedefs.
1143 (dump_type): Likewise, unless pp_c_flag_gnu_v3 is set.
1145 2019-10-21 Kamlesh Kumar <kamleshbhalui@gmail.com>
1146 Jason Merrill <jason@redhat.com>
1148 PR c++/83534 - typeinfo of noexcept function
1149 * rtti.c (get_tinfo_decl_dynamic): Do not call
1150 TYPE_MAIN_VARIANT for function.
1151 (get_typeid): Likewise.
1153 2019-10-21 Paolo Carlini <paolo.carlini@oracle.com>
1155 * parser.c (cp_parser_class_head): Improve error recovery upon
1156 extra qualification error.
1158 2019-10-21 Jakub Jelinek <jakub@redhat.com>
1161 * constexpr.c (cxx_eval_component_reference, cxx_eval_bit_field_ref):
1162 Use STRIP_ANY_LOCATION_WRAPPER on CONSTRUCTOR elts.
1164 2019-10-21 Marek Polacek <polacek@redhat.com>
1166 PR c++/92062 - ODR-use ignored for static member of class template.
1167 * pt.c (has_value_dependent_address): Strip location wrappers.
1169 2019-10-21 Marek Polacek <polacek@redhat.com>
1171 PR c++/92106 - ICE with structured bindings and -Wreturn-local-addr.
1172 * typeck.c (maybe_warn_about_returning_address_of_local): Avoid
1173 recursing on null initializer and return false instead.
1175 2019-10-17 JeanHeyd Meneide <phdofthehouse@gmail.com>
1177 Implement p1301 [[nodiscard("should have a reason")]] + p1771 DR
1178 * tree.c (handle_nodiscard_attribute): Handle C++2a nodiscard
1180 (std_attribute_table) Increase nodiscard argument handling
1181 max_length from 0 to 1.
1182 * parser.c (cp_parser_check_std_attribute): Add requirement
1183 that nodiscard only be seen once in attribute-list.
1184 (cp_parser_std_attribute): Check that empty parenthesis lists are
1185 not specified for attributes that have max_length > 0 (e.g.
1187 * cvt.c (maybe_warn_nodiscard): Add nodiscard message to
1188 output, if applicable.
1189 (convert_to_void): Allow constructors to be nodiscard-able (P1771).
1191 2019-10-18 Nathan Sidwell <nathan@acm.org>
1193 * cp-tree.h (struct lang_type): Remove was_anonymous.
1194 (TYPE_WAS_UNNAMED): Implement by checking TYPE_DECL &
1196 * decl.c (name_unnamed_type): Don't set TYPE_WAS_UNNAMED.
1198 2019-10-17 Paolo Carlini <paolo.carlini@oracle.com>
1200 * decl.c (grokfndecl): Remove redundant use of in_system_header_at.
1201 (compute_array_index_type_loc): Likewise.
1202 (grokdeclarator): Likewise.
1203 * error.c (cp_printer): Likewise.
1204 * lambda.c (add_default_capture): Likewise.
1205 * parser.c (cp_parser_primary_expression): Likewise.
1206 (cp_parser_selection_statement): Likewise.
1207 (cp_parser_toplevel_declaration): Likewise.
1208 (cp_parser_enumerator_list): Likewise.
1209 (cp_parser_using_declaration): Likewise.
1210 (cp_parser_member_declaration): Likewise.
1211 (cp_parser_exception_specification_opt): Likewise.
1212 (cp_parser_std_attribute_spec): Likewise.
1213 * pt.c (do_decl_instantiation): Likewise.
1214 (do_type_instantiation): Likewise.
1215 * typeck.c (cp_build_unary_op): Likewise.
1217 * decl.c (check_tag_decl): Pass to in_system_header_at the same
1218 location used for the permerror.
1219 (grokdeclarator): Likewise.
1221 * decl.c (check_tag_decl): Use locations[ds_typedef] in error_at.
1223 2019-10-17 Jason Merrill <jason@redhat.com>
1225 * cp-gimplify.c (cp_gimplify_expr): Use get_initialized_tmp_var.
1226 (gimplify_to_rvalue): Remove default NULL argument.
1228 2019-10-17 Nathan Sidwell <nathan@acm.org>
1230 * decl.c (builtin_function_1): Merge into ...
1231 (cxx_builtin_function): ... here. Nadger the decl before maybe
1232 copying it. Set the context.
1233 (cxx_builtin_function_ext_scope): Push to top level, then call
1234 cxx_builtin_function.
1236 2019-10-16 Luis Machado <luis.machado@linaro.org>
1238 * cp-gimplify.c: Fix reference to non-existing tree-gimple.c file.
1240 2019-10-16 Jakub Jelinek <jakub@redhat.com>
1242 * decl.c (cxx_maybe_build_cleanup): When clearing location of cleanup,
1243 if cleanup is a nop, clear location of its operand too.
1245 2019-10-15 Andrew Sutton <asutton@lock3software.com>
1247 Finish moving constraint and logic functionality of out pt.c.
1248 Reimplement and re-enable subsumption caching.
1250 * config-lang.in (gtfiles): Add logic.cc.
1251 * constraint.cc (atomic_constraints_identical_p): Add assertions.
1252 (hash_atomic_constraint): Likewise.
1253 (constraints_equivalent_p): New.
1254 (inchash::add_constraint): New.
1255 (iterative_hash_constraint): New.
1256 (decl_constraints): Moved from pt.c.
1257 (get_constraints): Likewise.
1258 (set_constraints): Likewise.
1259 (remove_constraints): Likewise.
1260 * cp-tree.h (CONSTR_P): New.
1261 (init_constraint_processing): Remove.
1262 (constraints_equivalent_p, iterative_hash_constraint): Declare.
1263 * decl.c (cxx_init_decl_processing): Don't initialize constraints.
1264 * logic.cc (subsumption_entry): Moved from pt.c.
1265 (subsumption_hasher): Likewise.
1266 (subsumption_cache): Likewise.
1267 (lookup_subsumption): Likewise.
1268 (save_subsumption): Likewise.
1269 (subsumes_constraints_nonnull): Use subsumption cache.
1270 * pt.c: Move aforementioned declarations out of this file.
1271 (init_constraint_processing): Remove.
1273 2019-10-15 Andrew Sutton <asutton@lock3software.com>
1275 * parser.c (cp_parser_constructor_declarator_p): Pass an empty
1276 decl-specifier-seq to make sure we parse type constraints as part
1277 of a type-specifier.
1279 2019-10-15 Nathan Sidwell <nathan@acm.org>
1281 * class.c (build_clones): Break out of clone_function_decl. Just
1283 (clone_function_decl): Call build_clones, then maybe add them to
1286 * class.c (build_clone): Refactor to clarify recursiveness.
1288 2019-10-14 Jason Merrill <jason@redhat.com>
1290 PR c++/91930 - ICE with constrained inherited default ctor.
1291 * name-lookup.c (do_class_using_decl): Set TYPE_HAS_USER_CONSTRUCTOR
1292 for inherited constructor.
1294 2019-10-14 Paolo Carlini <paolo.carlini@oracle.com>
1296 * decl.c (check_tag_decl): Use DECL_SOURCE_LOCATION.
1298 2019-10-14 Jakub Jelinek <jakub@redhat.com>
1301 * semantics.c (handle_omp_array_sections_1): Temporarily disable
1302 -fstrong-eval-order also for in_reduction and task_reduction clauses.
1304 * parser.c (cp_parser_omp_all_clauses): Change bool NESTED_P argument
1305 into int NESTED, if it is 2, diagnose missing commas in between
1307 (cp_parser_omp_context_selector): Pass 2 as last argument to
1308 cp_parser_omp_all_clauses.
1310 2019-10-12 Jakub Jelinek <jakub@redhat.com>
1312 * parser.c (cp_parser_omp_context_selector): Improve error recovery.
1313 For simd properties, put them directly into TREE_VALUE.
1314 (cp_finish_omp_declare_variant): Add "omp declare variant base"
1315 attribute rather than "omp declare variant".
1317 2019-10-11 Marek Polacek <polacek@redhat.com>
1319 PR c++/92049 - extra error with -fchecking=2.
1320 * pt.c (build_non_dependent_expr): Call fold_non_dependent_expr
1323 2019-10-11 Paolo Carlini <paolo.carlini@oracle.com>
1325 * typeck.c (cp_build_binary_op): Do not handle RROTATE_EXPR and
1327 * constexpr.c (cxx_eval_constant_expression): Likewise.
1328 (potential_constant_expression_1): Likewise.
1329 * pt.c (tsubst_copy): Likewise.
1331 2019-10-11 Jason Merrill <jason@redhat.com>
1333 * decl2.c (mark_used): Don't clobber DECL_SOURCE_LOCATION on
1334 explicitly defaulted functions.
1335 * method.c (synthesize_method): Likewise.
1337 2019-10-11 Jakub Jelinek <jakub@redhat.com>
1340 * decl2.c (grok_array_decl): For -fstrong-eval-order, when array ref
1341 operands have been swapped and at least one operand has side-effects,
1342 revert the swapping before calling build_array_ref.
1343 * typeck.c (cp_build_array_ref): For non-ARRAY_TYPE array ref with
1344 side-effects on the index operand, if -fstrong-eval-order use
1345 save_expr around the array operand.
1346 (cp_build_binary_op): For shifts with side-effects in the second
1347 operand, wrap first operand into SAVE_EXPR and evaluate it before
1349 * semantics.c (handle_omp_array_sections_1): Temporarily disable
1350 flag_strong_eval_order during OMP_CLAUSE_REDUCTION array section
1352 * cp-gimplify.c (gimplify_to_rvalue): New function.
1353 (cp_gimplify_expr): Use it.
1355 2019-10-10 Marek Polacek <polacek@redhat.com>
1357 * typeck.c (comp_ptr_ttypes_real): Change the return type to bool.
1358 Use false instead of 0.
1360 2019-10-10 Jakub Jelinek <jakub@redhat.com>
1362 * parser.h (struct cp_omp_declare_simd_data): Add variant_p member.
1363 * parser.c (cp_ensure_no_omp_declare_simd): Handle both declare simd
1364 and declare variant.
1365 (cp_parser_oacc_all_clauses): Formatting fix.
1366 (cp_parser_omp_all_clauses): Add NESTED_P argument, if true, terminate
1367 processing on closing paren and don't skip to end of pragma line.
1368 (cp_parser_omp_declare_simd): Add VARIANT_P argument. Handle also
1370 (omp_construct_selectors, omp_device_selectors,
1371 omp_implementation_selectors, omp_user_selectors): New variables.
1372 (cp_parser_omp_context_selector,
1373 cp_parser_omp_context_selector_specification,
1374 cp_finish_omp_declare_variant): New functions.
1375 (cp_parser_late_parsing_omp_declare_simd): Handle also declare variant.
1376 (cp_parser_omp_declare): Handle declare variant.
1378 2019-10-09 Jason Merrill <jason@redhat.com>
1380 * cp-tree.h (template_info_decl_check): Check ENABLE_TREE_CHECKING.
1382 2019-10-09 Marek Polacek <polacek@redhat.com>
1384 PR c++/91364 - P0388R4: Permit conversions to arrays of unknown bound.
1385 PR c++/69531 - DR 1307: Differently bounded array parameters.
1386 PR c++/88128 - DR 330: Qual convs and pointers to arrays of pointers.
1387 * call.c (build_array_conv): Build ck_identity at the beginning
1389 (standard_conversion): Pass bounds_none to comp_ptr_ttypes_const.
1390 (maybe_warn_array_conv): New.
1391 (convert_like_real): Call it. Add an error message about converting
1392 from arrays of unknown bounds.
1393 (conv_get_original_expr): New.
1394 (nelts_initialized_by_list_init): New.
1395 (conv_binds_to_array_of_unknown_bound): New.
1396 (compare_ics): Implement list-initialization ranking based on
1397 array sizes, as specified in DR 1307 and P0388R.
1398 * cp-tree.h (comp_ptr_ttypes_const): Adjust declaration.
1399 (compare_bounds_t): New enum.
1400 * typeck.c (comp_array_types): New bool and compare_bounds_t
1401 parameters. Use them.
1402 (structural_comptypes): Adjust the call to comp_array_types.
1403 (similar_type_p): Handle ARRAY_TYPE.
1404 (build_const_cast_1): Pass bounds_none to comp_ptr_ttypes_const.
1405 (comp_ptr_ttypes_real): Don't check cv-quals of ARRAY_TYPEs. Use
1406 comp_array_types to compare array types. Look through arrays as per
1408 (comp_ptr_ttypes_const): Use comp_array_types to compare array types.
1409 Look through arrays as per DR 330.
1411 2019-10-09 Marek Polacek <polacek@redhat.com>
1413 PR c++/92032 - DR 1601: Promotion of enum with fixed underlying type.
1414 * call.c (standard_conversion): When converting an enumeration with
1415 a fixed underlying type to the underlying type, give it the cr_promotion
1417 (compare_ics): Implement a tiebreaker as per CWG 1601.
1419 2019-10-08 Andrew Sutton <asutton@lock3software.com>
1420 Jason Merrill <jason@redhat.com>
1422 Update the concepts implementation to conform to the C++20
1423 specification, improve compile times, and generally clean up
1425 * call.c (build_new_function_call): Don't evaluate concepts here.
1426 (constraint_failure): Don't record the template.
1427 (print_z_candidate): Don't extract the template.
1428 * class.c (add_method): When overloading, hide ineligible special
1430 (check_methods): Set TYPE_HAS_COMPLEX_* here.
1431 * constexpr.c (cxx_eval_constant_expression): Evaluate concepts.
1432 (maybe_initialize_fundef_copies_table): Remove.
1433 (get_fundef_copy): Use hash_map_safe_get_or_insert.
1434 (clear_cv_and_fold_caches): Clear the satisfaction cache.
1435 * constraint.cc (known_non_bool_p): New.
1436 (parsing_constraint_expression_sentinel): Renamed from
1437 expanding_constraint_sentinel.
1438 (check_constraint_operands): New.
1439 (check_constraint_atom): New.
1440 (finish_constraint_binary_op): New.
1441 (finish_constraint_or_expr): Likewise.
1442 (finish_constraint_and_expr): Likewise.
1443 (finish_constraint_primary_expr): Likewise.
1444 (combine_constraint_expressions): New.
1445 (finish_requires_expr): Add location parm.
1446 (get_concept_definition): Return the initializer of concept definitions.
1447 (get_template_head_requirements): New.
1448 (get_trailing_function_requirements): New.
1449 (deduce_constrained_parameter): Check if the identifier or template-id
1450 is a concept definition.
1451 (resolve_concept_definition_check): Removed.
1452 (resolve_variable_concept_check): Removed.
1453 (resolve_concept_check): New.
1454 (resolve_constraint_check): Handle concept definitions.
1455 converting arguments.
1456 (function_concept_check_p): Removed.
1457 (variable_concept_check_p): Removed.
1458 (unpack_concept_check): New.
1459 (get_concept_check_template): New.
1460 (build_call_check): Moved and renamed to build_function_check.
1461 (build_concept_check_arguments): make static.
1462 (build_function_check): Always do overload resolution
1463 in order to force conversion of template arguments (i.e., actually
1464 check that the use of a concept is valid).
1465 (build_standard_check): Renamed from build_real_concept_check.
1466 (build_real_concept_check): Build checks for C++2a concepts by
1467 (build_wildcard_concept_check): New.
1468 (build_concept_check): Use build_real_concept_check. New overload.
1469 (build_constraints): Save expressions, not normalized constraints.
1470 (build_concept_id): New. Pass tf_warning_or_error.
1471 (build_type_constraint): New.
1472 (finish_type_constraints): New.
1473 (associate_classtype_constraints): Also add constraints to union
1474 types. Note the original declaration in errors. Don't return
1475 error_mark_node in order to avoid an assertion later.
1476 (push_down_pack_expansion): Remove.
1477 (finish_shorthand_constraint): Make fold expressions, not naked
1478 parameter packs. Always apply the constraint to each template argument.
1479 (check_introduction_list): New. Fail if not enough
1480 names are introduced.
1481 (finish_template_introduction): Don't normalize constraints. Pass
1482 tsubst flags. Check for insufficient introductions.
1483 (placeholder_extract_concept_and_args): Handle the template-id case.
1484 Unpack function concept checks correctly.
1485 (tsubst_simple_requirement): Return errors if they occur. Don't
1486 process as a template.
1487 (tsubst_type_requirement): Likewise.
1488 (type_deducible_p): New. Wrap the input expression in parens for the
1489 purpose of deduction.
1490 (expression_convertible_t): New.
1491 (tsubst_compound_requirement): Use new deduction, conversion predicates.
1492 (tsubst_nested_requirement): Return errors if they occur. Don't
1493 process as a template. Instantiate and evaluate the nested requirement.
1494 (tsubst_valid_expression_requirement): New.
1495 (tsubst_simple_requirement): Use tsubst_valid_expression_requirement.
1496 (tsubst_compound_requirement): Use tsubst_valid_expression_requirement.
1497 (check_constaint_variables): New.
1498 (tsubst_constraint_variables): Check that type substitutions are valid.
1499 (tsubst_requires_expr): Likewise. Produce new requires-exprs during
1500 template substitution. Copy the previous local specialization stack,
1501 so references to non-local parameters can be found. Use cp_unevaluated.
1502 (tsubst_constraint): New. Don't evaluate concept checks.
1504 (norm_info): New. Used to build a normalization tree for concept check
1506 (debug_parameter_mapping): New.
1507 (debug_argument_list): New.
1508 (expand_concept): Removed.
1509 (normalize_logical_operation): Pass subst_info through call.
1510 (normalize_pack_expansion): Remove.
1511 (normalize_simple_requirement): Removed
1512 (normalize_type_requirement): Removed
1513 (normalize_compound_requirement): Removed
1514 (normalize_nested_requirement): Removed
1515 (normalize_requirement): Removed
1516 (normalize_requirements): Removed
1517 (normalize_requires_expression): Removed
1518 (normalize_variable_concept_check): Removed.
1519 (normalize_function_concept_check): Removed.
1520 (normalize_concept_check): Merged all normalize_*_check here.
1521 Substitute through written template arguments before normalizing the
1522 definition. Only substitute the innermost template arguments.
1523 (check_for_logical_overloads): Delete.
1524 (map_arguments): New. Associate template parameters with arguments.
1525 (build_parameter_mapping): New. Extract used parameters.
1526 (normalize_expression): Rewrite.
1527 (normalize_conjunction): Removed
1528 (normalize_disjunction): Removed
1529 (normalize_predicate_constraint): Removed
1530 (normalize_parameterized_constraint): Removed
1531 (normalized_map): New variable.
1532 (get_normalized_constraints): New entry point for normalization.
1533 Establishes a timer.
1534 (get_normalized_constraints_from_info): New.
1535 (get_normalized_constraints_from_decl): New. Turn on template processing
1536 prior to normalization. Handle inheriting ctors. Build the
1537 normalization arguments from the full set of template parameters of the
1538 most general template. This guarantees that we have no concrete arguments
1539 in the parameter mapping (e.g., from template members of class
1540 templates). Cache normalizations.
1541 (normalize_concept_definition): New. Cache normalizations.
1542 (normalize_template_requirements): New.
1543 (normalize_nontemplate_requirements): New.
1544 (normalize_constraint_expression): New.
1545 (tsubst_parameter_mapping): New.
1546 (get_mapped_args): New.
1547 (parameter_mapping_equivalent_p): New. Use template_args_equal.
1548 (atomic_constraints_identical_p): New.
1549 (hash_atomic_constraint): New.
1550 (satisfying_constraint_p): New. Guard against recursive evaluation of
1551 constraints during satisfaction.
1552 (satisfy_conjunction): New.
1553 (satisfy_disjunction): New.
1554 (sat_entry): New class for hashing satisfaction results.
1555 (sat_hasher): New hash traits.
1557 (get_satisfaction): New. Returns cached satisfaction result.
1558 (save_satisfaction): New. Caches a satisfaction result.
1559 (clear_satisfaction_cache): New.
1560 (satisfaction_cache): New. Helps manage satisfaction cache requests.
1561 (decl_satisfied_cache): New.
1562 (satisfy_atom): New.
1563 (satisfy_constraint_r): New.
1564 (satisfy_constraint): Use new satisfaction algorithm.
1565 (evaluate_concept_check): New.
1566 (evaluate_concept): Removed.
1567 (evaluate_function_concept): Removed.
1568 (evaluate_variable_concept): Removed.
1569 (satisfy_constraint_expression): New.
1570 (constraint_expression_satisfied_p): New.
1571 (constraints_satisfied_p): Use strip_inheriting_ctors. Use
1572 push_/pop_access_scope.
1573 (more_constrained): Normalize before calling out to subsumption. Allow
1574 classes as arguments.
1575 (strictly_subsumes): Allow non-templates as arguments. Accept a new
1577 (weakly_subsumes): New.
1578 (at_least_as_constrained): Removed.
1579 (diagnose_other_expression): Removed.
1580 (diagnose_predicate_constraint): Removed.
1581 (diagnose_pack_expansion): Removed.
1582 (diagnose_check_constraint): Removed.
1583 (diagnose_logical_constraint): Removed.
1584 (diagnose_expression_constraint): Removed.
1585 (diagnose_type_constraint): Removed.
1586 (diagnose_implicit_conversion_constraint): Removed.
1587 (diagnose_argument_deduction_constraint): Removed.
1588 (diagnose_exception_constraint): Removed.
1589 (diagnose_parameterized_constraint): Removed.
1590 (diagnose_argument_deduction_constraint): Removed.
1591 (diagnose_argument_deduction_constraint): Removed.
1592 (diagnose_argument_deduction_constraint): Removed.
1593 (diagnose_trait_expr): New.
1594 (diagnose_requires_expr): New.
1595 (diagnose_atomic_constraint): New.
1596 (diagnose_valid_expression) Stop wrongly diagnosing valid expressions.
1597 Don't substitute as if in template decls. This causes substitution
1598 to generate expressions that aren't suitable for use with the noexcept
1600 (diagnose_valid_type) Likewise.
1601 (diagnose_compound_requirement) Actually emit diagnostics for
1602 the causes of errors.Call force_paren_expr_uneval.
1603 (diagnose_declaration_constraints): Turn on template processing to
1604 suppress certain analyses.
1605 * cp-objcp-common.c (cp_common_init_ts): Make concepts typed.
1606 (cp_get_debug_type): Use hash_map_safe_*.
1607 * cp-tree.h: New function declarations for semantic actions, other
1608 facilities. Remove declaration no longer used or needed. Remove
1609 unused _CONSTR macros.
1610 (LANG_DECL_HAS_MIN): Add CONCEPT_DECL.
1611 (template_info_decl_check): Factor macro check into an inline function.
1612 (DECL_TEMPLATE_INFO): Use new check facility.
1613 (finish_concept_definition): New. Don't invalid concept declarations
1614 with invalid initializers.
1615 (find_template_parameters): New.
1616 (concept_definition_p): New.
1617 (concept_check_p): New.
1618 (variable_concept_check_p): New.
1619 (force_paren_expr_uneval): New.
1620 (ovl_iterator::using_p): A USING_DECL by itself was also
1621 introduced by a using-declaration.
1622 (struct tree_template_info): Use tree_base instead of
1623 tree_common. Add tmpl and args fields.
1624 (TI_TEMPLATE, TI_ARGS): Adjust.
1625 (DECLTYPE_FOR_INIT_CAPTURE): Remove.
1626 (CONSTR_CHECK, CONSTR_INFO, CONSTR_EXPR, CONSTR_CONTEXT): New.
1627 (ATOMIC_CONSTR_MAP, TRAIT_EXPR_LOCATION): New.
1628 (struct tree_trait_expr): Add locus field.
1629 (enum tsubst_flags): Add tf_norm as a hint to generate normalization
1630 context when diagnosing constraint failure.
1631 * cp-tree.def: Remove unused _CONSTR nodes and rename PRED_CONSTR
1633 (CONCEPT_DECL): New.
1634 * cxx-pretty-print.c: Remove constraint printing code.
1635 (pp_cxx_concept_definition): New.
1636 (pp_cxx_template_declaration): Print concept definitions.
1637 (pp_cxx_check_constraint): Update printing for concept definitions.
1638 (pp_cxx_nested_name_specifier): Fix a weird
1639 case where we're printing '::::' for concepts.
1640 (simple_type_specifier): Print requirements for placeholder types.
1641 (pp_cxx_constrained_type_spec): Print the associated requirements of
1643 (pp_cxx_compound_requirement): Add space before the '->'.
1644 (pp_cxx_parameter_mapping): Print the parameter mapping.
1645 (pp_cxx_atomic_constraint): Use the function above.
1646 * decl.c (redeclaration_error_message): New error for concepts.
1647 (grokdeclarator): Check for and disallow decltype(auto) in parameter
1649 (grokfndecl): Don't normalize constraints. Add check for constraints
1651 (grokvardecl): Don't normalize constraints.
1652 (grok_special_member_properties): Don't set TYPE_HAS_COMPLEX_*.
1653 (function_requirements_equivalent_p): New. Compare trailing
1654 requires clauses. Compare combined constraints in pre-C++20 mode.
1655 (decls_match): Compare trailing requires clauses. Compare template
1656 heads for function templates. Remove old constraint comparison.
1657 Simplify comparison of functions, function templates.
1658 (duplicate_function_template_decls): New. Refactor a nasty if
1659 condition into a single predicate.
1660 (require_deduced_type): Don't complain if we already complained about
1662 (finish_function): Perform auto deduction to ensure that constraints
1663 are checked even when functions contain no return statements. Only do
1664 auto deduction if we haven't previously seen any return statements.
1665 This prevents multiple diagnostics of the same error.
1666 (store_decomp_type): Remove.
1667 (cp_finish_decomp): Use hash_map_safe_put.
1668 * error.c: Remove constraint printing code.
1669 (dump_decl): Dump concept definitions. Handle wildcard declarations.
1670 (dump_template_decl): Likewise.
1671 (dump_type): Print associated requirements for placeholder
1673 (rebuild_concept_check): New.
1674 (maybe_print_single_constraint_context): New.
1675 (maybe_print_constraint_context): Recursively print nested contexts.
1676 * init.c (get_nsdmi): Use hash_map_safe_*.
1677 * lambda.c (maybe_add_lambda_conv_op): Bail if deduction failed.
1678 (add_capture): Copy parameter packs from init.
1679 (lambda_capture_field_type): Always use auto for init-capture.
1680 * logic.cc: Completely rewrite.
1681 (constraint_hash): New.
1682 (clause/ctor): Save atoms in the hash table.
1683 (replace): Save atoms during replacement.
1684 (insert): Save atoms during insertion.
1685 (contains): Only search the hash table for containment.
1686 (clause): Keep a hash of atomic constraints.
1687 (clause::clause): Explicitly copy the hash table when copying.
1688 (disjunction_p, conjunction_p, atomic_p, dnf_size, cnf_size): New.
1689 (diagnose_constraint_size): New.
1690 (subsumes_constraints_nonnull): Compare the sizes of normalized formula
1691 to determine the cheapest decomposition.
1692 * name-lookup.c (diagnose_name_conflict): Diagnose name issues with
1694 (matching_fn_p): Check constraints.
1695 (push_class_level_binding_1): Move overloaded functions case down,
1696 accept FUNCTION_DECL as target_decl.
1697 * parser.c (enum required_token): New required token for auto.
1698 (make_location): Add overload taking lexer as last parm.
1699 (cp_parser_required_error): Diagnose missing auto.
1700 (cp_parser_diagnose_ungrouped_constraint_plain): New.
1701 (cp_parser_diagnose_ungrouped_constraint_plain): New.
1702 (cp_parser_constraint_primary_expression): New. Tentatively parse the
1703 primary expression. If that fails tentatively parse a lower
1704 precedence expression in order to diagnose the error.
1705 (cp_parser_check_non_logical_constraint): New. Performs a trial
1706 parse of the right-hand-side of non-logical operators in order to
1707 generate good diagnostics.
1708 (cp_parser_constraint_logical_and_expression): New.
1709 (cp_parser_constraint_logical_or_expression): New.
1710 (cp_parser_requires_clause_expression): New.
1711 (cp_parser_requires_clause): Renamed to cp_parser_constraint_expression.
1712 (cp_parser_requires_clause_opt): Parse the requires-clause differently
1713 in -fconcepts and -std=c++2a modes.
1714 (cp_parser_requirement_list): Rename to cp_parser_requirement_seq.
1715 Rewrite so that semicolons are parsed
1716 along with requirements, not the sequence.
1717 (cp_parser_simple_requirement): Expect a semicolon at end.
1718 (cp_parser_compound_requirement): Expect a semicolon at end. Only
1719 allow trailing-return-type with -fconcepts-ts.
1720 (cp_parser_nested_requirement): Expect a semicolon at end. Parse
1721 constraint-expressions.
1722 (cp_parser_concept_definition): New. Don't fail parsing the concept
1723 definition if the initializer is ill-formed. Don't declare the concept
1724 before parsing the initializer.
1725 (cp_parser_constraint_expression): Declare earlier.
1726 (cp_parser_type_requirement): Current scope is not valid.
1727 (cp_parser_requires_expression): Commit to the tentative parse.
1728 (cp_parser_decl_specifier_seq): Warn when concept appears to be used
1729 as a decl-specifier.
1730 (cp_parser_template_declaration_after_parameters): Parse concept
1732 (cp_parser_template_id): Don't try to resolve a concept template-id yet.
1733 (cp_parser_template_id_expr): Resolve it as a concept check.
1734 (cp_parser_decl_specifier_seq): Warn on 'concept bool'.
1735 (cp_parser_type_parameter): Combine expressions not
1737 (cp_parser_explicit_template_declaration): Combine expressions not
1739 (cp_parser_maybe_concept_name): Removed.
1740 (cp_parser_simple_type_specifier): Handle an error condition of
1741 a bad constrained type specifier. Expect auto or decltype after
1742 a concept name. Also handle the case where we have a template-id
1744 (cp_parser_template_introduction): Diagnose errors on invalid
1745 introductions. Give up if it doesn't start with a concept name.
1746 Pedwarn if not -fconcepts-ts.
1747 (synthesize_implicit_template_parm): Don't do consistent binding.
1748 Use a new flag for constrained parameters. Combine expressions,
1749 not constraints. Fail if we get a placeholder in block scope.
1750 Placeholders that do not constrain types are not allowed in parameter
1751 declarations, so don't handle them.
1752 (cp_parser_placeholder_type_specifier): New. Implement parsing of
1753 placeholder type specifiers following a concept name or partial
1754 concept check. Disallow decltype(auto) parameters.
1755 (cp_parser_nested_name_specifier_opt): If the token is already
1756 CPP_NESTED_NAME_SPECIFIER, leave it alone.
1757 (cp_parser_id_expression, cp_parser_unqualified_id): Call
1758 cp_parser_template_id_expr.
1759 (cp_parser_placeholder_type_specifier): Add tentative parm. Don't
1760 expect a WILDCARD_DECL.
1761 (cp_parser_trait_expr): Pass trait_loc down.
1762 (cp_parser_postfix_expression): Do set location of dependent member
1764 * pt.c (finish_concept_definition): New.
1765 (push_template_decl_real): Handle concept definitions.
1766 (start_concept_definition): Let push_template_decl_real handle the
1767 creation of the template.
1768 (get_constraints): Return null if the table hasn't been initialized.
1769 (tsubst_copy_and_build): Build template-id expressions for concept
1771 [TRAIT_EXPR]: Pass trait_loc down.
1772 (lookup_template_class_1): Add the template name to the constraint
1774 (lookup_and_finish_template_variable): Build concept checks
1775 with the correct arguments.
1776 (tsubst_function_decl): Don't substitute through constraints.
1777 Always associate constraints with functions.
1778 (template_parm_level_and_index): Make non-static.
1779 (for_each_template_parm_r): Handle requires expressions.
1780 (keep_template_parm): New.
1781 (find_template_parameters): New.
1782 (more_specialized_fn): Change how winners and losers are chosen.
1783 (make_constrained_auto): Don't normalize constraints.
1784 (template_parameters_equivalent_p): New. Compare template
1785 parameters. Add a comparison for implicitly vs. explicitly declared
1787 (template_parameter_lists_equivalent_p): New. Compare template
1789 (template_requirements_equivalent_p): New.
1790 (template_heads_equivalent_p): New. Compare template heads.
1791 (template_parameter_constraints_equivalent_p): New.
1792 (is_compatible_template_arg): Use weakly_subsumes.
1793 (maybe_new_partial_specialization): Use new constraint comparison
1794 for finding specializations.
1795 (process_partial_specialization): Pass main template as argument.
1796 (more_specialized_partial_spec): Don't immediately return when
1798 (make_constrained_auto): Handle concept definitions.
1799 (do_auto_deduction): Update auto deduction for new concept model.
1800 Extract the function concept correctly; rename constr to check to
1801 reflect the kind of node.
1802 (tsubst): Adjust wildcard argument during substitution.
1803 [DECLTYPE_TYPE]: Remove init-capture handling.
1804 (tsubst_copy_and_build): Build concept checks, not template ids.
1805 Defer checks of function concepts. Handle concepts before variable
1806 templates. Handle calls to function concepts explicitly.
1807 (coerce_template_parms): Use concept_definition_p. Handle a deduction
1808 error where a potentially empty pack can be supplied after the last
1809 parameter of a concept.
1810 (finish_template_variable): Don't process concepts here.
1811 (instantiation_dependent_r): Use concept_check_p.
1812 (tsubst_template_args): Make non-static.
1813 (make_constrained_placeholder_type): New. Refactored from
1814 make_constrained_auto.
1815 (make_constrained_auto) Use make_constrained_placeholder_type.
1816 (make_constrained_decltype_auto) New.
1817 (tsubst_function_parms): New.
1818 (value_dependent_expression_p) [TEMPLATE_ID_EXPR]: Use
1819 concept_definition_p.
1820 (push_access_scope, pop_access_scope): No longer static.
1821 (tsubst_template_parm): Substitute TEMPLATE_PARM_CONSTRAINTS.
1822 (tsubst_friend_function): Use tsubst_constraint. Use generic_targs_for.
1823 (get_underlying_template) Use generic_targs_for.
1824 (uses_parameter_packs): Return tree.
1825 (gen_elem_of_pack_expansion_instantiation): Don't push
1826 local_specialization_stack.
1827 (prepend_one_capture): New.
1828 (tsubst_lambda_expr): Use prepend_one_capture. Don't touch
1829 local_specializations.
1830 (template_parms_level_to_args): No longer static.
1831 (add_outermost_template_args): Likewise.
1832 (find_template_parameter_info): New. Provide context for finding
1833 template parameters.
1834 (keep_template_parm): Don't keep parameters declared at depth levels
1835 greater than those of the template parameters of the source declaration.
1836 Don't propagate cv-qualified types. Return 0, so we find all template
1837 parameters, not the just first.
1838 (any_template_parm_r): New. Handle cases that are mishandled by
1839 for_each_template_parm_r.
1840 (generic_targs_for): Factor out of coerce_template_args_for_ttp.
1841 (tsubst_argument_pack): Factor out of tsubst_template_args.
1842 (constraint_sat_entry): Removed.
1843 (constraint_sat_hasher): Removed.
1844 (concept_spec_entry): Removed.
1845 (concept_spec_hasher): Removed.
1846 (constraint_memos): Removed.
1847 (concept_memos): Removed.
1848 (lookup_constraint_satisfaction): Removed.
1849 (memoize_constraint_satisfaction): Removed.
1850 (lookup_concept_satisfaction): Removed.
1851 (memoize_concept_satisfaction): Removed.
1852 (concept_expansions): Removed.
1853 (get_concept_expansion): Removed.
1854 (save_concept_expansion): Removed.
1855 (init_constraint_processing): Remove initialization of non-existing
1857 (find_template_requirement): New. Search for the sub-requirement
1858 within the associated constraints.
1859 (convert_generic_types_to_packs): Also transform the associated
1860 constraint and update the current template requirements.
1861 (store_defaulted_ttp, lookup_defaulted_ttp): Remove.
1862 (add_defaults_to_ttp): Use hash_map_safe_*.
1863 * semantics.c (finish_call_expr): Diagnose calls to concepts.
1864 Handle concept checks explicitly.
1865 (finish_id_expression): Evaluate variable concepts as part of
1866 id-expression processing. Don't treat variable concepts as variables,
1867 and don't process function concepts as plain id-expressions.
1868 (force_paren_expr): Add even_uneval parm.
1869 (finish_trait_expr): Add location parm.
1870 * tree.c (special_memfn_p): New.
1871 (cp_expr_location): Handle TRAIT_EXPR.
1872 * typeck.c (check_return_expr): Actually use the diagnostic kind
1873 when performing return-type deduction.
1874 * typeck2.c (build_functional_cast): Don't rely on the location of
1877 2019-10-09 Paolo Carlini <paolo.carlini@oracle.com>
1879 * decl.c (grok_ctor_properties): Use DECL_SOURCE_LOCATION.
1880 * typeck.c (cp_build_binary_op): Use the op_location_t argument
1881 in many error messages.
1883 2019-10-08 Martin Sebor <msebor@redhat.com>
1886 * call.c (maybe_warn_class_memaccess): Handle arrays.
1888 2019-10-07 Paolo Carlini <paolo.carlini@oracle.com>
1890 * call.c (resolve_args): Use cp_expr_loc_or_input_loc in one place.
1891 * decl.c (grokdeclarator): Use id_loc in one place.
1892 * decl2.c (build_anon_union_vars): Use DECL_SOURCE_LOCATION.
1893 * parser.c (cp_parser_delete_expression): Fix the location of the
1894 returned expression.
1895 (cp_parser_throw_expression): Likewise.
1896 * pt.c (determine_specialization): Use DECL_SOURCE_LOCATION.
1898 2019-10-05 Jakub Jelinek <jakub@redhat.com>
1900 PR c++/91369 - Implement P0784R7: constexpr new
1901 * cp-tree.h (enum cp_tree_index): Add CPTI_HEAP_UNINIT_IDENTIFIER,
1902 CPTI_HEAP_IDENTIFIER and CPTI_HEAP_DELETED_IDENTIFIER.
1903 (heap_uninit_identifier, heap_identifier, heap_deleted_identifier):
1905 (type_has_constexpr_destructor, build_new_constexpr_heap_type,
1906 cxx_constant_dtor): Declare.
1907 * class.c (type_maybe_constexpr_default_constructor): Make static.
1908 (type_maybe_constexpr_destructor, type_has_constexpr_destructor): New
1910 (finalize_literal_type_property): For c++2a, don't clear
1911 CLASSTYPE_LITERAL_P for types without trivial destructors unless they
1912 have non-constexpr destructors.
1913 (explain_non_literal_class): For c++2a, complain about non-constexpr
1914 destructors rather than about non-trivial destructors.
1915 * constexpr.c: Include stor-layout.h.
1916 (struct constexpr_global_ctx): New type.
1917 (struct constexpr_ctx): Add global field, remove values and
1918 constexpr_ops_count.
1919 (cxx_replaceable_global_alloc_fn): New inline function.
1920 (cxx_eval_call_expression): For c++2a allow calls to replaceable
1921 global allocation functions, for new return address of a heap uninit
1922 var, for delete record its deletion. Change ctx->values->{get,put} to
1923 ctx->global->values.{get,put}.
1924 (non_const_var_error): Add auto_diagnostic_group sentinel. Emit
1925 special diagnostics for heap variables.
1926 (cxx_eval_store_expression): Change ctx->values->{get,put} to
1927 ctx->global->values.{get,put}.
1928 (cxx_eval_loop_expr): Initialize jump_target if NULL. Change
1929 new_ctx.values->remove to ctx->global->values.remove.
1930 (cxx_eval_constant_expression): Change *ctx->constexpr_ops_count
1931 to ctx->global->constexpr_ops_count. Change ctx->values->{get,put} to
1932 ctx->global->values.{get,put}.
1933 <case NOP_EXPR>: Formatting fix. On cast of replaceable global
1934 allocation function to some pointer type, adjust the type of
1935 the heap variable and change name from heap_uninit_identifier
1937 (find_heap_var_refs): New function.
1938 (cxx_eval_outermost_constant_expr): Add constexpr_dtor argument,
1939 handle evaluation of constexpr dtors and add tracking of heap
1940 variables. Use tf_no_cleanup for get_target_expr_with_sfinae.
1941 (cxx_constant_value): Adjust cxx_eval_outermost_constant_expr caller.
1942 (cxx_constant_dtor): New function.
1943 (maybe_constant_value, fold_non_dependent_expr_template,
1944 maybe_constant_init_1): Adjust cxx_eval_outermost_constant_expr
1946 (potential_constant_expression_1): Ignore clobbers. Allow
1947 COND_EXPR_IS_VEC_DELETE for c++2a.
1948 * decl.c (initialize_predefined_identifiers): Add heap identifiers.
1949 (decl_maybe_constant_destruction): New function.
1950 (cp_finish_decl): Don't clear TREE_READONLY for constexpr variables
1951 with non-trivial, but constexpr destructors.
1952 (register_dtor_fn): For constexpr variables with constexpr non-trivial
1953 destructors call cxx_maybe_build_cleanup instead of adding destructor
1955 (expand_static_init): For constexpr variables with constexpr
1956 non-trivial destructors call cxx_maybe_build_cleanup.
1957 (grokdeclarator): Allow constexpr destructors for c++2a. Formatting
1959 (cxx_maybe_build_cleanup): For constexpr variables with constexpr
1960 non-trivial destructors call cxx_constant_dtor instead of adding
1961 destructor calls at runtime.
1962 * init.c: Include stor-layout.h.
1963 (build_new_constexpr_heap_type, maybe_wrap_new_for_constexpr): New
1965 (build_new_1): For c++2a and new[], add cast around the alloc call
1966 to help constexpr evaluation figure out the type of the heap storage.
1967 (build_vec_delete_1): Set DECL_INITIAL of tbase and emit a DECL_EXPR
1968 for it instead of initializing an uninitialized variable.
1969 * method.c: Include intl.h.
1970 (SFK_CTOR_P, SFK_DTOR_P, SFK_ASSIGN_P, SFK_COPY_P, SFK_MOVE_P): Move
1971 definitions earlier.
1972 (process_subob_fn): Add sfk argument, adjust non-constexpr call
1973 diagnostics based on it.
1974 (walk_field_subobs): Formatting fixes. Adjust process_subob_fn caller.
1975 (synthesized_method_base_walk): Likewise.
1976 (synthesized_method_walk): Set *constexpr_p to true for dtors in c++2a.
1977 Fix up DR number in comment.
1978 (implicitly_declare_fn): Formatting fix.
1979 * typeck2.c (store_init_value): Don't call cp_fully_fold_init on
1980 initializers of automatic non-constexpr variables in constexpr
1983 2019-10-04 Jakub Jelinek <jakub@redhat.com>
1986 * constexpr.c (cxx_fold_indirect_ref_1): New function.
1987 (cxx_fold_indirect_ref): Use it.
1990 * cp-gimplify.c (cp_gimplify_expr) <case CALL_EXPR>: For
1991 -fstrong-eval-order ensure CALL_EXPR_FN side-effects are evaluated
1992 before any arguments. Additionally, ensure CALL_EXPR_FN that isn't
1993 invariant nor OBJ_TYPE_REF nor SSA_NAME is forced into a temporary.
1995 2019-10-03 Paolo Carlini <paolo.carlini@oracle.com>
1997 * init.c (build_new): Use cp_expr_loc_or_input_loc in two places.
1998 * name-lookup.c (do_pushdecl): Use DECL_SOURCE_LOCATION.
1999 (push_class_level_binding_1): Likewise.
2000 (set_decl_namespace): Likewise.
2002 2019-10-03 Jakub Jelinek <jakub@redhat.com>
2004 * constexpr.c (cxx_eval_constant_expression) <case CLEANUP_STMT>: If
2005 not skipping upon entry to body, run cleanup with the same *jump_target
2006 as it started to run the cleanup even if the body returns, breaks or
2008 (potential_constant_expression_1): Allow CLEANUP_STMT.
2010 * constexpr.c (cxx_eval_store_expression): Formatting fix. Handle
2011 const_object_being_modified with array type.
2013 2019-10-02 Jason Merrill <jason@redhat.com>
2015 * typeck2.c (store_init_value): Only clear_cv_and_fold_caches if the
2018 2019-09-30 Jason Merrill <jason@redhat.com>
2020 Use hash_map_safe_* functions.
2021 * constexpr.c (maybe_initialize_fundef_copies_table): Remove.
2022 (get_fundef_copy): Use hash_map_safe_get_or_insert.
2023 * cp-objcp-common.c (cp_get_debug_type): Use hash_map_safe_*.
2024 * decl.c (store_decomp_type): Remove.
2025 (cp_finish_decomp): Use hash_map_safe_put.
2026 * init.c (get_nsdmi): Use hash_map_safe_*.
2027 * pt.c (store_defaulted_ttp, lookup_defaulted_ttp): Remove.
2028 (add_defaults_to_ttp): Use hash_map_safe_*.
2030 2019-10-02 Richard Biener <rguenther@suse.de>
2033 * decl.c (build_ptrmemfunc_type): Mark pointer-to-member
2034 fat pointer structure members as DECL_NONADDRESSABLE_P.
2036 2019-09-28 Marek Polacek <polacek@redhat.com>
2038 PR c++/91889 - follow-up fix for DR 2352.
2039 * call.c (involves_qualification_conversion_p): New function.
2040 (direct_reference_binding): Build a ck_qual if the conversion
2041 would involve a qualification conversion.
2042 (convert_like_real): Strip the conversion created by the ck_qual
2043 in direct_reference_binding.
2045 PR c++/91921 - stray warning with -Woverloaded-virtual.
2046 * class.c (warn_hidden): Only emit the second part of
2047 -Woverloaded-virtual if the first part was issued. Use inform instead
2050 PR c++/91923 - failure-to-SFINAE with class type NTTP in C++17.
2051 * pt.c (invalid_nontype_parm_type_p): Only emit errors when
2054 2019-09-27 Jakub Jelinek <jakub@redhat.com>
2057 * parser.c (cp_parser_omp_var_list_no_open): Parse predefined
2059 * semantics.c (finish_omp_clauses): Allow predefined variables in
2060 shared and firstprivate clauses, even when they are predetermined
2062 * cp-gimplify.c (cxx_omp_predetermined_sharing_1): Return
2063 OMP_CLAUSE_DEFAULT_SHARED for predefined variables.
2065 2019-09-27 Jason Merrill <jason@redhat.com>
2067 * constexpr.c (cxx_fold_indirect_ref): Use similar_type_p.
2068 (cxx_eval_indirect_ref): Likewise. Improve error location.
2070 * cp-tree.h (class iloc_sentinel): New.
2071 * decl.c (grokdeclarator, finish_enum_value_list): Use it.
2072 * mangle.c (mangle_decl_string): Use it.
2073 * pt.c (perform_typedefs_access_check): Use it.
2075 2019-09-27 Richard Sandiford <richard.sandiford@arm.com>
2077 * cp-tree.h (build_cxx_call): Take the original function decl
2078 as an optional final parameter.
2079 (cp_build_function_call_vec): Likewise.
2080 * call.c (build_cxx_call): Likewise. Pass all built-in calls to
2081 check_builtin_function_arguments.
2082 * typeck.c (build_function_call_vec): Take the original function
2083 decl as an optional final parameter and pass it to
2084 cp_build_function_call_vec.
2085 (cp_build_function_call_vec): Take the original function
2086 decl as an optional final parameter and pass it to build_cxx_call.
2088 2019-09-25 Marek Polacek <polacek@redhat.com>
2090 PR c++/91877 - ICE with converting member of packed struct.
2091 * call.c (convert_like_real): Use similar_type_p in an assert.
2093 2019-09-25 Paolo Carlini <paolo.carlini@oracle.com>
2095 * name-lookup.c (check_extern_c_conflict): Use DECL_SOURCE_LOCATION.
2096 (check_local_shadow): Use it in three additional places.
2098 2019-09-24 Jason Merrill <jason@redhat.com>
2100 * parser.c (cp_parser_postfix_expression): Do set location of
2101 dependent member call.
2103 2019-09-24 Marek Polacek <polacek@redhat.com>
2105 PR c++/91868 - improve -Wshadow location.
2106 * name-lookup.c (check_local_shadow): Use DECL_SOURCE_LOCATION
2107 instead of input_location.
2109 PR c++/91845 - ICE with invalid pointer-to-member.
2110 * expr.c (mark_use): Use error_operand_p.
2111 * typeck2.c (build_m_component_ref): Check error_operand_p after
2112 calling mark_[lr]value_use.
2114 2019-09-23 Paolo Carlini <paolo.carlini@oracle.com>
2116 * pt.c (check_explicit_specialization): Use cp_expr_loc_or_input_loc.
2117 (process_partial_specialization): Likewise.
2118 (convert_nontype_argument_function): Likewise.
2119 (invalid_tparm_referent_p): Likewise.
2120 (convert_template_argument): Likewise.
2121 (check_valid_ptrmem_cst_expr): Tidy.
2123 2019-09-23 Jason Merrill <jason@redhat.com>
2125 PR c++/91809 - bit-field and ellipsis.
2126 * call.c (convert_arg_to_ellipsis): Don't call decay_conversion for
2127 arithmetic arguments.
2129 2019-09-23 Marek Polacek <polacek@redhat.com>
2131 PR c++/91844 - Implement CWG 2352, Similar types and reference binding.
2132 * call.c (reference_related_p): Use similar_type_p instead of
2134 (reference_compatible_p): Update implementation to match CWG 2352.
2135 * cp-tree.h (similar_type_p): Declare.
2136 * typeck.c (similar_type_p): New.
2138 2019-09-22 Marek Polacek <polacek@redhat.com>
2140 PR c++/91819 - ICE with operator++ and enum.
2141 * call.c (build_new_op_1): Set arg2_type.
2143 2019-09-17 Jason Merrill <jason@redhat.com>
2145 * parser.c (cp_parser_statement): Handle [[likely]] on
2148 2019-09-19 Jason Merrill <jason@redhat.com>
2151 * call.c (build_new_op_1): Don't apply any standard conversions to
2152 the operands of a built-in operator. Don't suppress conversions in
2154 * typeck.c (cp_build_unary_op): Do integral promotions for enums.
2156 2019-09-16 Paolo Carlini <paolo.carlini@oracle.com>
2158 * decl.c (grokdeclarator): Use declspecs->locations and
2159 declarator->id_loc in a few error messages.
2160 * pt.c (finish_member_template_decl): Use DECL_SOURCE_LOCATION.
2161 (push_template_decl_real): Likewise.
2163 2019-09-15 Jason Merrill <jason@redhat.com>
2165 PR c++/30277 - int-width bit-field promotion.
2166 PR c++/33819 - long bit-field promotion.
2167 * typeck.c (cp_perform_integral_promotions): Handle large bit-fields
2168 properly. Handle 32-bit non-int bit-fields properly.
2169 (is_bitfield_expr_with_lowered_type): Don't look through NOP_EXPR.
2171 PR c++/82165 - enum bitfields and operator overloading.
2172 * call.c (build_new_op_1): Use unlowered_expr_type.
2174 * call.c (build_new_op_1): Don't apply any standard conversions to
2175 the operands of a built-in operator. Don't suppress conversions in
2177 * typeck.c (cp_build_unary_op): Do integral promotions for enums.
2179 2019-09-15 Marek Polacek <polacek@redhat.com>
2181 PR c++/91740 - ICE with constexpr call and ?: in ARRAY_REF.
2182 * pt.c (build_non_dependent_expr): Call build_non_dependent_expr for
2185 2019-09-15 Nathan Sidwell <nathan@acm.org>
2187 * cp-tree.h (DECL_CLONED_FUNCTION_P): Reimplement using
2188 IDENTIFIER_CDTOR_P, correct documentation.
2189 (DECL_CLONED_FUNCTION): Directly access field.
2190 (decl_cloned_function_p): Delete.
2191 * class.c (decl_cloned_function_p): Delete.
2192 * pt.c (instantiate_template_1): Check DECL_CHAIN is a decl.
2194 2019-09-11 Nathan Sidwell <nathan@acm.org>
2196 * c-objcp-common.c (cp-objcp-common.c): Alphababetize and
2197 correctly mark all C++ nodes.
2198 * decl.c (cp_tree_node_structure): Alphabetize.
2200 2019-09-10 Marek Polacek <polacek@redhat.com>
2202 PR c++/91673 - ICE with noexcept in alias-declaration.
2203 * parser.c (CP_PARSER_FLAGS_DELAY_NOEXCEPT): New parser flag.
2204 (cp_parser_lambda_declarator_opt): Pass CP_PARSER_FLAGS_NONE to
2205 cp_parser_exception_specification_opt.
2206 (cp_parser_direct_declarator): Adjust a call to
2207 cp_parser_exception_specification_opt.
2208 (cp_parser_member_declaration): Pass CP_PARSER_FLAGS_DELAY_NOEXCEPT
2209 to cp_parser_declarator if not processing a friend or typedef
2211 (cp_parser_late_noexcept_specifier): Adjust a call to
2212 cp_parser_noexcept_specification_opt.
2213 (cp_parser_noexcept_specification_opt): New parameter for parser flags,
2214 drop the FRIEND_P parameter. Use the new parameter.
2215 (cp_parser_exception_specification_opt): Likewise.
2216 (cp_parser_transaction): Adjust a call to
2217 cp_parser_noexcept_specification_opt.
2218 (cp_parser_transaction_expression): Likewise.
2220 2019-09-10 Marek Polacek <polacek@redhat.com>
2222 PR c++/91705 - constexpr evaluation rejects ++/-- on floats.
2223 * constexpr.c (cxx_eval_increment_expression): Call fold_simple on
2226 2019-09-10 Paolo Carlini <paolo.carlini@oracle.com>
2228 * decl.c (has_designator_problem): Use cp_expr_loc_or_input_loc
2230 (build_enumerator): Likewise.
2231 (cp_finish_decl): Use DECL_SOURCE_LOCATION.
2232 (grokdeclarator): Use id_loc in two error_at; change errror
2233 message about constinit together constexpr to use two ranges.
2235 2019-09-09 Marek Polacek <polacek@redhat.com>
2237 PR c++/84374 - diagnose invalid uses of decltype(auto).
2238 * decl.c (grokdeclarator): Diagnose wrong usage of decltype(auto) in
2239 a function declaration.
2241 2019-09-06 Nathan Sidwell <nathan@acm.org>
2244 * cp-tree.h (IDENTIFIER_REPO_CHOSEN, DECL_REPO_AVAILABLE_P): Delete.
2245 (struct lang_decl_base): Remove repo_available_p.
2246 * decl.c (duplicate_decls): Don't copy DECL_REPO_AVAILABLE_P.
2248 (Reserve TREE_LANG_FLAG_3 for modules.
2249 * cp-tree.h (DECL_CONSTRUCTION_VTABLE_P): Delete.
2250 (DECL_NON_TRIVIALLY_INITIALIZED_P): Move to TREE_LANG_FLAG_6.
2251 * class.c (build_ctor_vtbl_group): Don't set
2252 DECL_CONSTRUCTION_VTABLE_P.
2253 * decl2.c (determine_visibility_from_class): Don't check
2254 DECL_CONSTRUCTION_VTABLE_P anymore.
2256 2019-09-06 Martin Liska <mliska@suse.cz>
2259 * Make-lang.in: Remove repo.o.
2260 * config-lang.in: Likewise.
2261 * cp-tree.h (init_repo): Remove declarations
2262 of repo-related functions.
2263 (repo_emit_p): Likewise.
2264 (repo_export_class_p): Likewise.
2265 (finish_repo): Likewise.
2266 * decl2.c (import_export_class): Always
2268 (mark_needed): Remove -frepo from comment.
2269 (import_export_decl): Similarly here.
2270 (c_parse_final_cleanups): Remove call of finish_repo.
2271 * lex.c (cxx_init): Remove call to init_repo.
2272 * optimize.c (can_alias_cdtor): Remove dead condition.
2273 * pt.c (push_template_decl_real): Update comment.
2274 (instantiate_decl): Remove dead code used for -frepo.
2277 2019-09-05 Marek Polacek <polacek@redhat.com>
2279 PR c++/91644 - ICE with constinit in function template.
2280 * decl.c (start_decl): Call retrofit_lang_decl for constinit variables.
2281 * pt.c (tsubst_expr): Pass LOOKUP_CONSTINIT down to cp_finish_decl for
2282 constinit variables.
2284 2019-09-05 Nathan Sidwell <nathan@acm.org>
2286 * cp-tree.h (DECL_VTABLE_OR_VTT_P): Forward to DECL_VIRTUAL_P.
2288 2019-09-04 Marek Polacek <polacek@redhat.com>
2290 * call.c (build_over_call): Remove -fdeduce-init-list implementation.
2291 * pt.c (unify): Likewise.
2293 2019-09-01 Marek Polacek <polacek@redhat.com>
2295 PR c++/91129 - wrong error with binary op in template argument.
2296 * typeck.c (warn_for_null_address): Use fold_for_warn instead of
2297 fold_non_dependent_expr.
2298 (cp_build_binary_op): Likewise.
2300 2019-08-30 Jason Merrill <jason@redhat.com>
2302 Add source location to TRAIT_EXPR.
2303 * cp-tree.h (TRAIT_EXPR_LOCATION): New.
2304 (struct tree_trait_expr): Add locus field.
2305 * parser.c (cp_parser_trait_expr): Pass trait_loc down.
2306 * pt.c (tsubst_copy_and_build) [TRAIT_EXPR]: Likewise.
2307 * semantics.c (finish_trait_expr): Add location parm.
2308 * tree.c (cp_expr_location): Handle TRAIT_EXPR.
2310 2019-08-29 Paolo Carlini <paolo.carlini@oracle.com>
2312 * decl.c (check_var_type): Add location_t parameter and use it.
2313 (grokdeclarator): Adjust call.
2314 * pt.c (tsubst_decl): Likewise.
2315 * cp-tree.h: Adjust declaration.
2317 2019-08-28 Marek Polacek <polacek@redhat.com>
2319 Implement P1152R4: Deprecating some uses of volatile.
2321 * cp-gimplify.c (cp_fold): Set TREE_THIS_VOLATILE.
2322 * decl.c (grokdeclarator): Warn about a volatile-qualified structured
2323 binding and return type.
2324 (grokparms): Warn about a volatile-qualified function parameter.
2325 * expr.c (mark_use) <case MODIFY_EXPR>: Emit a -Wvolatile warning.
2326 * typeck.c (cp_build_unary_op): Emit a -Wvolatile warning for pre and
2327 post ++/-- on a volatile operand.
2328 (genericize_compound_lvalue): Use a better location. Don't lose
2330 (cp_build_modify_expr): Emit a -Wvolatile warning for a compound
2331 assignment whose LHS is volatile-qualified. Build the assignment with
2332 a more precise location.
2334 2019-08-28 Marek Polacek <polacek@redhat.com>
2336 PR c++/91360 - Implement C++20 P1143R2: constinit.
2337 * cp-tree.h (TINFO_VAR_DECLARED_CONSTINIT): Define.
2338 (LOOKUP_CONSTINIT): Define.
2339 (enum cp_decl_spec): Add ds_constinit.
2340 * decl.c (check_tag_decl): Give an error for constinit in type
2342 (check_initializer): Also check LOOKUP_CONSTINIT.
2343 (cp_finish_decl): Add checking for a constinit declaration. Set
2344 TINFO_VAR_DECLARED_CONSTINIT.
2345 (grokdeclarator): Add checking for a declaration with the constinit
2347 * lex.c (init_reswords): Handle D_CXX20.
2348 * parser.c (cp_lexer_get_preprocessor_token): Pass a better location
2349 to warning_at. Warn about C++20 keywords.
2350 (cp_keyword_starts_decl_specifier_p): Handle RID_CONSTINIT.
2351 (cp_parser_diagnose_invalid_type_name): Add an inform about constinit.
2352 (cp_parser_decomposition_declaration): Maybe pass LOOKUP_CONSTINIT to
2354 (cp_parser_decl_specifier_seq): Handle RID_CONSTINIT.
2355 (cp_parser_init_declarator): Maybe pass LOOKUP_CONSTINIT to
2357 (set_and_check_decl_spec_loc): Add "constinit".
2358 * pt.c (tsubst_decl): Set TINFO_VAR_DECLARED_CONSTINIT.
2359 (instantiate_decl): Maybe pass LOOKUP_CONSTINIT to cp_finish_decl.
2360 * typeck2.c (store_init_value): If a constinit variable wasn't
2361 initialized using a constant initializer, give an error.
2363 2019-08-28 Nathan Sidwell <nathan@acm.org>
2366 * name-lookup.c (cp_emit_debug_info): Check for builtins during
2369 2019-08-27 Marek Polacek <polacek@redhat.com>
2371 PR c++/81676 - bogus -Wunused warnings in constexpr if.
2372 * semantics.c (maybe_mark_exp_read_r): New function.
2373 (finish_if_stmt): Call it on THEN_CLAUSE and ELSE_CLAUSE.
2375 PR c++/91428 - warn about std::is_constant_evaluated in if constexpr.
2376 * cp-tree.h (decl_in_std_namespace_p): Declare.
2377 * semantics.c (is_std_constant_evaluated_p): New.
2378 (finish_if_stmt_cond): Warn about "std::is_constant_evaluated ()" in
2380 * typeck.c (decl_in_std_namespace_p): No longer static.
2382 2019-08-26 Jason Merrill <jason@redhat.com>
2384 * decl.c (duplicate_decls): Always merge DECL_DECLARED_CONSTEXPR_P.
2386 2019-08-26 Marek Polacek <polacek@redhat.com>
2388 PR c++/91545 - ICE in constexpr store evaluation.
2389 * constexpr.c (cxx_eval_store_expression): Check FIELD_DECL instead
2392 2019-08-24 Nathan Sidwell <nathan@acm.org>
2394 * class.c (check_for_overrides): Conversion operators need
2397 2019-08-24 Paolo Carlini <paolo.carlini@oracle.com>
2399 * semantics.c (finish_switch_cond): Improve error message location.
2401 2019-08-23 Jason Merrill <jason@redhat.com>
2403 * decl2.c (decl_dependent_p): New.
2404 (mark_used): Check it instead of just processing_template_decl.
2406 2019-08-23 Jason Merrill <jason@redhat.com>
2408 * parser.c (cp_parser_nested_name_specifier_opt): Avoid redundant
2411 2019-08-23 Marek Polacek <polacek@redhat.com>
2413 PR c++/91521 - wrong error with operator->.
2414 * decl.c (grokdeclarator): Return error_mark_node for an invalid
2415 trailing return type.
2417 PR c++/79817 - attribute deprecated on namespace.
2418 * cp-tree.h (cp_warn_deprecated_use_scopes): Declare.
2419 * decl.c (grokdeclarator): Call cp_warn_deprecated_use_scopes.
2420 (type_is_deprecated): Likewise.
2421 * decl2.c (cp_warn_deprecated_use_scopes): New function.
2422 * name-lookup.c (handle_namespace_attrs): Handle attribute deprecated.
2423 * parser.c (cp_parser_namespace_alias_definition): Call
2424 cp_warn_deprecated_use_scopes.
2425 (cp_parser_using_declaration): Likewise.
2426 (cp_parser_using_directive): Likewise.
2427 * semantics.c (finish_id_expression_1): Likewise.
2429 2019-08-23 Nathan Sidwell <nathan@acm.org>
2431 * class.c (check_for_override): Checking IDENTIFIER_VIRTUAL_P is
2432 sufficient, reorder DECL_OVERRIDE_P check.
2434 2019-08-23 Iain Sandoe <iain@sandoe.co.uk>
2437 * parser.c (cp_parser_initial_pragma): Call c_common_no_more_pch ()
2438 after determining that the first token is not
2439 PRAGMA_GCC_PCH_PREPROCESS.
2441 2019-08-22 Marek Polacek <polacek@redhat.com>
2443 PR c++/91304 - prefix attributes ignored in condition.
2444 * parser.c (cp_parser_condition): Handle prefix attributes.
2446 2019-08-21 Richard Sandiford <richard.sandiford@arm.com>
2449 * decl.c (duplicate_decls): Call copy_attributes_to_builtin inside
2450 the BUILT_IN_NORMAL block rather than afterward.
2452 2019-08-19 Marek Polacek <polacek@redhat.com>
2454 PR c++/91264 - detect modifying const objects in constexpr.
2455 * constexpr.c (modifying_const_object_error): New function.
2456 (cxx_eval_call_expression): Set TREE_READONLY on a CONSTRUCTOR of
2457 a const-qualified object after it's been fully constructed.
2458 (modifying_const_object_p): New function.
2459 (cxx_eval_store_expression): Detect modifying a const object
2460 during constant expression evaluation.
2461 (cxx_eval_increment_expression): Use a better location when building
2463 (cxx_eval_constant_expression) <case DECL_EXPR>: Mark a constant
2464 object's constructor TREE_READONLY.
2466 2019-08-15 Jason Merrill <jason@redhat.com>
2468 PR c++/90393 - ICE with thow in ?:
2470 PR c++/64372, DR 1560 - Gratuitous lvalue-to-rvalue conversion in ?:
2471 * tree.c (lvalue_kind): Handle throw in one arm.
2472 * typeck.c (rationalize_conditional_expr): Likewise.
2473 (cp_build_modify_expr): Likewise.
2475 2019-08-14 Jason Merrill <jason@redhat.com>
2477 Implement P0848R3, Conditionally Trivial Special Member Functions.
2478 * tree.c (special_memfn_p): New.
2479 * class.c (add_method): When overloading, hide ineligible special
2481 (check_methods): Set TYPE_HAS_COMPLEX_* here.
2482 * decl.c (grok_special_member_properties): Not here.
2483 * name-lookup.c (push_class_level_binding_1): Move overloaded
2484 functions case down, accept FUNCTION_DECL as target_decl.
2486 2019-08-14 Jonathan Wakely <jwakely@redhat.com>
2489 * name-lookup.c (get_std_name_hint): Fix min_dialect field for
2490 complex_literals and make_unique entries.
2492 2019-08-14 Jakub Jelinek <jakub@redhat.com>
2493 Marek Polacek <polacek@redhat.com>
2495 PR c++/91391 - bogus -Wcomma-subscript warning.
2496 * parser.c (cp_parser_postfix_open_square_expression): Don't warn about
2497 a deprecated comma here. Pass warn_comma_subscript down to
2498 cp_parser_expression.
2499 (cp_parser_expression): New bool parameter. Warn about uses of a comma
2500 operator within a subscripting expression.
2501 (cp_parser_skip_to_closing_square_bracket): Revert to pre-r274121 state.
2502 (cp_parser_skip_to_closing_square_bracket_1): Remove.
2504 2019-08-14 Jonathan Wakely <jwakely@redhat.com>
2506 * name-lookup.c (get_std_name_hint): Add more entries.
2508 2019-08-14 Paolo Carlini <paolo.carlini@oracle.com>
2510 * decl2.c (grok_array_decl): Use the location of the open square
2511 bracket in error message about invalid types.
2513 2019-08-14 Paolo Carlini <paolo.carlini@oracle.com>
2515 * decl.c (grokdeclarator): Check here for typedef a function
2516 definition or a member function definition.
2517 (start_function): Adjust.
2518 (grokmethod): Likewise.
2520 2019-08-13 Richard Sandiford <richard.sandiford@arm.com>
2523 * decl.c (duplicate_decls): Use copy_decl_built_in_function.
2524 * pt.c (declare_integer_pack): Use set_decl_built_in_function.
2526 2019-08-13 Marek Polacek <polacek@redhat.com>
2528 PR c++/90473 - wrong code with nullptr in default argument.
2529 * call.c (null_ptr_cst_p): Update quote from the standard.
2530 * decl.c (check_default_argument): Don't return nullptr when the arg
2533 2019-08-13 Marek Polacek <polacek@redhat.com>
2535 * cp-tree.h (DECL_MUTABLE_P): Use FIELD_DECL_CHECK.
2537 2019-08-10 Jakub Jelinek <jakub@redhat.com>
2539 * parser.c (cp_parser_omp_clause_name): Parse device_type.
2540 (cp_parser_omp_clause_device_type): New function.
2541 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_DEVICE_TYPE.
2542 (OMP_DECLARE_TARGET_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_DEVICE_TYPE.
2543 (cp_parser_omp_declare_target): Handle device_type clauses. Remove
2544 diagnostics for declare target with clauses nested in clause-less
2545 declare target declaration-definition-seq.
2546 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_DEVICE_TYPE.
2548 2019-08-09 Jakub Jelinek <jakub@redhat.com>
2550 * parser.c (check_no_duplicate_clause): Simplify using
2552 (cp_parser_omp_clause_if): Fix up printing of target {enter,exit} data
2553 directive name modifiers.
2556 * parser.c (cp_parser_omp_clause_dist_schedule): Comment out the
2557 check_no_duplicate_clause call, instead emit a warning for duplicate
2558 dist_schedule clauses.
2560 2019-08-08 Paolo Carlini <paolo.carlini@oracle.com>
2562 * decl.c (grokdeclarator): Use id_loc and EXPR_LOCATION in
2563 a few error messages.
2565 2019-08-08 Marek Polacek <polacek@redhat.com>
2567 PR c++/87519 - bogus warning with -Wsign-conversion.
2568 * typeck.c (cp_build_binary_op): Use same_type_p instead of comparing
2571 * constexpr.c (inline_asm_in_constexpr_error): New.
2572 (cxx_eval_constant_expression) <case ASM_EXPR>: Call it.
2573 (potential_constant_expression_1) <case ASM_EXPR>: Likewise.
2575 2019-08-08 Jakub Jelinek <jakub@redhat.com>
2577 * semantics.c (finish_omp_clauses): For C_ORT_OMP
2578 OMP_CLAUSE_USE_DEVICE_* clauses use oacc_reduction_head bitmap
2579 instead of generic_head to track duplicates.
2581 2019-08-07 Marek Polacek <polacek@redhat.com>
2583 PR c++/81429 - wrong parsing of constructor with C++11 attribute.
2584 * parser.c (cp_parser_constructor_declarator_p): Handle the scenario
2585 when a parameter declaration begins with [[attribute]].
2587 2019-08-07 Marek Polacek <polacek@redhat.com>
2589 PR c++/91346 - Implement P1668R1, allow unevaluated asm in constexpr.
2590 * constexpr.c (cxx_eval_constant_expression): Handle ASM_EXPR.
2591 (potential_constant_expression_1) <case ASM_EXPR>: Allow.
2592 * cp-tree.h (finish_asm_stmt): Adjust.
2593 * parser.c (cp_parser_asm_definition): Grab the locaion of "asm" and
2594 use it. Change an error to a pedwarn. Allow asm in C++2a, warn
2596 * pt.c (tsubst_expr): Pass a location down to finish_asm_stmt.
2597 * semantics.c (finish_asm_stmt): New location_t parameter. Use it.
2599 2019-08-07 Jakub Jelinek <jakub@redhat.com>
2601 * parser.c (cp_parser_omp_clause_name): Parse use_device_addr clause.
2602 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR.
2603 (OMP_TARGET_DATA_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR.
2604 (cp_parser_omp_target_data): Handle PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR
2605 like PRAGMA_OMP_CLAUSE_USE_DEVICE_PTR, adjust diagnostics about no
2606 map or use_device_* clauses.
2607 * semantics.c (finish_omp_clauses): For OMP_CLAUSE_USE_DEVICE_PTR
2608 in OpenMP, require pointer or reference to pointer type rather than
2609 pointer or array or reference to pointer or array type. Handle
2610 OMP_CLAUSE_USE_DEVICE_ADDR.
2611 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_USE_DEVICE_ADDR.
2613 2019-08-06 Jason Merrill <jason@redhat.com>
2615 PR c++/91378 - ICE with noexcept and auto return type.
2616 * pt.c (maybe_instantiate_noexcept): push_to_top_level.
2618 2019-08-06 Paolo Carlini <paolo.carlini@oracle.com>
2620 * decl.c (check_array_designated_initializer): Use
2621 cp_expr_loc_or_input_loc in one place.
2623 2019-08-06 Jakub Jelinek <jakub@redhat.com>
2625 * parser.c (cp_parser_omp_for_loop): For OMP_LOOP, ignore parallel
2626 clauses and predetermine iterator as lastprivate.
2627 * semantics.c (handle_omp_for_class_iterator): Use
2628 OMP_CLAUSE_LASTPRIVATE_LOOP_IV instead of
2629 OMP_CLAUSE_LASTPRIVATE_TASKLOOP_IV, set it for lastprivate also
2630 on OMP_LOOP construct. If a clause is missing for class iterator
2631 on OMP_LOOP, add firstprivate clause, and if there is private
2632 clause, turn it into firstprivate too.
2633 (finish_omp_for): Formatting fix. For OMP_LOOP, adjust
2634 OMP_CLAUSE_LASTPRIVATE_LOOP_IV clause CP_CLAUSE_INFO, so that it
2635 uses copy ctor instead of default ctor.
2636 * cp-gimplify.c (cp_gimplify_expr): Handle OMP_LOOP like
2638 (cp_fold_r): Likewise.
2639 (cp_genericize_r): Likewise.
2640 (cxx_omp_finish_clause): Also finish lastprivate clause with
2641 OMP_CLAUSE_LASTPRIVATE_LOOP_IV flag.
2642 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_BIND.
2643 (tsubst_omp_for_iterator): For OMP_LOOP, ignore parallel
2644 clauses and predetermine iterator as lastprivate.
2645 * constexpr.c (potential_constant_expression_1): Handle OMP_LOOP
2646 like OMP_DISTRIBUTE etc.
2648 2019-08-05 Marek Polacek <polacek@redhat.com>
2650 DR 2413 - typename in conversion-function-ids.
2651 * parser.c (cp_parser_conversion_type_id): Call
2652 cp_parser_type_specifier_seq with CP_PARSER_FLAGS_TYPENAME_OPTIONAL
2653 instead of CP_PARSER_FLAGS_NONE.
2655 2019-08-05 Paolo Carlini <paolo.carlini@oracle.com>
2657 * cp-tree.h (cp_expr_loc_or_input_loc): New.
2658 (cxx_incomplete_type_diagnostic): Use it.
2659 * call.c (build_converted_constant_expr_internal, convert_like_real,
2660 convert_arg_to_ellipsis, convert_for_arg_passing, build_over_call,
2661 build_cxx_call, perform_implicit_conversion_flags,
2662 initialize_reference): Likewise.
2663 * constexpr.c (cxx_eval_internal_function, cxx_eval_call_expression,
2664 eval_and_check_array_index, cxx_eval_store_expression,
2665 cxx_eval_statement_list, cxx_eval_loop_expr,
2666 cxx_eval_constant_expression, potential_constant_expression_1):
2668 * constraint.cc (check_for_logical_overloads,
2669 satisfy_predicate_constraint): Likewise.
2670 * cp-gimplify.c (cp_gimplify_expr): Likewise.
2671 * cvt.c (cp_convert_to_pointer, convert_to_reference,
2672 cp_convert_and_check, ocp_convert, maybe_warn_nodiscard): Likewise.
2673 * decl.c (pop_switch): Likewise.
2674 * decl2.c (delete_sanity): Likewise.
2675 * error.c (location_of): Likewise.
2676 * init.c (maybe_warn_list_ctor, build_aggr_init,
2677 warn_placement_new_too_small, build_new_1, build_vec_init): Likewise.
2678 * lex.c (unqualified_name_lookup_error): Likewise.
2679 * parser.c (cp_parser_initializer_list, cp_parser_omp_for_cond):
2681 * pt.c (check_for_bare_parameter_packs, check_valid_ptrmem_cst_expr,
2682 unify_arg_conversion, convert_nontype_argument,
2683 tsubst_copy_and_build, resolve_typename_type): Likewise.
2684 * semantics.c (maybe_convert_cond, finish_call_expr,
2685 cp_build_vec_convert): Likewise.
2686 * typeck.c (decay_conversion, rationalize_conditional_expr,
2687 cp_build_unary_op, build_x_compound_expr_from_list,
2688 maybe_warn_about_returning_address_of_local,
2689 maybe_warn_pessimizing_move): Likewise.
2690 * typeck2.c (check_narrowing, digest_init_r,
2691 process_init_constructor_array): Likewise.
2693 2019-08-05 Tom Honermann <tom@honermann.net>
2695 * parser.c (cp_parser_template_declaration_after_parameters): Enable
2696 class template argument deduction for non-type template parameters
2697 in literal operator templates.
2699 2019-08-05 Marek Polacek <polacek@redhat.com>
2701 PR c++/91338 - Implement P1161R3: Deprecate a[b,c].
2702 * parser.c (cp_parser_postfix_open_square_expression): Warn about uses
2703 of a comma operator within a subscripting expression.
2704 (cp_parser_skip_to_closing_square_bracket_1): New function, made out
2706 (cp_parser_skip_to_closing_square_bracket): ...this.
2708 2019-08-05 Jason Merrill <jason@redhat.com>
2710 * semantics.c (force_paren_expr): Preserve location.
2712 2019-08-02 Marek Polacek <polacek@redhat.com>
2714 PR c++/91230 - wrong error with __PRETTY_FUNCTION__ and generic lambda.
2715 * pt.c (value_dependent_expression_p): Consider __PRETTY_FUNCTION__
2716 inside a template function value-dependent.
2718 2019-08-02 Paolo Carlini <paolo.carlini@oracle.com>
2720 * tree.c (handle_nodiscard_attribute): Do not warn about nodiscard
2721 applied to a constructor.
2723 2019-08-02 Martin Liska <mliska@suse.cz>
2725 * decl.c (grok_op_properties):
2726 Mark DECL_SET_IS_OPERATOR_DELETE for user-provided delete operators.
2728 2019-08-01 Martin Sebor <msebor@redhat.com>
2731 * decl.c (reshape_init_array_1): Avoid truncating initializer
2732 lists containing string literals.
2734 2019-08-01 Marek Polacek <polacek@redhat.com>
2736 PR c++/90805 - detect narrowing in case values.
2737 * decl.c (case_conversion): Detect narrowing in case values.
2739 2019-07-31 Paolo Carlini <paolo.carlini@oracle.com>
2741 * decl2.c (delete_sanity): Improve diagnostic locations, use
2742 cp_expr_loc_or_loc in four places.
2744 2019-07-31 Jason Merrill <jason@redhat.com>
2746 PR c++/90538 - multiple expansions of capture packs
2747 * cp-tree.h (DECLTYPE_FOR_INIT_CAPTURE): Remove.
2748 * lambda.c (add_capture): Copy parameter packs from init.
2749 (lambda_capture_field_type): Always use auto for init-capture.
2750 * pt.c (uses_parameter_packs): Return tree.
2751 (tsubst) [DECLTYPE_TYPE]: Remove init-capture handling.
2752 (gen_elem_of_pack_expansion_instantiation): Don't push
2753 local_specialization_stack.
2754 (prepend_one_capture): New.
2755 (tsubst_lambda_expr): Use it. Don't touch local_specializations.
2756 (do_auto_deduction): Avoid redundant error.
2758 Fix copy_node of TEMPLATE_INFO.
2759 * cp-tree.h (struct tree_template_info): Use tree_base instead of
2760 tree_common. Add tmpl and args fields.
2761 (TI_TEMPLATE, TI_ARGS): Adjust.
2763 2019-07-30 Martin Liska <mliska@suse.cz>
2765 PR tree-optimization/91270
2766 * tree-ssa-dce.c (propagate_necessity): Mark 2nd argument
2767 of delete operator as needed.
2769 2019-07-25 Martin Liska <mliska@suse.cz>
2770 Dominik Infuhr <dominik.infuehr@theobroma-systems.com>
2773 * decl.c (cxx_init_decl_processing): Mark delete operators
2774 with DECL_SET_IS_OPERATOR_DELETE.
2776 2019-07-25 Martin Liska <mliska@suse.cz>
2778 * decl.c (duplicate_decls): Use new macros
2779 (e.g. DECL_SET_LAMBDA_FUNCTION and DECL_LAMBDA_FUNCTION_P).
2780 (cxx_init_decl_processing): Likewise.
2781 (grok_op_properties): Likewise.
2782 * parser.c (cp_parser_lambda_declarator_opt): Likewise.
2784 2019-07-24 Martin Sebor <msebor@redhat.com>
2787 * decl.c (finish_function): Use lang_mask.
2789 2019-07-20 Jason Merrill <jason@redhat.com>
2791 * cp-tree.h (ovl_iterator::using_p): A USING_DECL by itself was also
2792 introduced by a using-declaration.
2794 2019-07-20 Jason Merrill <jason@redhat.com>
2796 Reduce memory consumption for push/pop_access_scope.
2797 * name-lookup.c (leave_scope): Do add class levels other than
2798 previous_class_level to free_binding_level.
2799 (invalidate_class_lookup_cache): Move from class.c, add to
2801 * pt.c (saved_access_scope): Change from list to vec.
2803 2019-07-20 Jakub Jelinek <jakub@redhat.com>
2805 * cp-tree.h (OMP_FOR_GIMPLIFYING_P): Use OMP_LOOPING_CHECK
2806 instead of OMP_LOOP_CHECK.
2807 * parser.c (cp_parser_omp_clause_name): Handle bind clause.
2808 (cp_parser_omp_clause_bind): New function.
2809 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_BIND.
2810 (OMP_LOOP_CLAUSE_MASK): Define.
2811 (cp_parser_omp_loop): New function.
2812 (cp_parser_omp_parallel, cp_parser_omp_teams): Handle parsing of
2813 loop combined with parallel or teams.
2814 (cp_parser_omp_construct): Handle PRAGMA_OMP_LOOP.
2815 (cp_parser_pragma): Likewise.
2816 * pt.c (tsubst_expr): Handle OMP_LOOP.
2817 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_BIND.
2819 2019-07-19 Jason Merrill <jason@redhat.com>
2821 PR c++/90101 - dependent class non-type parameter.
2822 * pt.c (invalid_nontype_parm_type_p): Check for dependent class type.
2824 2019-07-18 Jason Merrill <jason@redhat.com>
2826 PR c++/90098 - partial specialization and class non-type parms.
2829 * call.c (build_converted_constant_expr_internal): Don't copy.
2830 * pt.c (process_partial_specialization): Allow VIEW_CONVERT_EXPR
2831 around class non-type parameter.
2832 (unify) [TEMPLATE_PARM_INDEX]: Ignore cv-quals.
2834 2019-07-16 Jason Merrill <jason@redhat.com>
2836 * parser.c (make_location): Add overload taking cp_lexer* as last
2839 * parser.c (cp_parser_simple_type_specifier): Separate tentative
2840 parses for optional type-spec and CTAD.
2842 * parser.c (cp_parser_nested_name_specifier_opt): If the token is
2843 already CPP_NESTED_NAME_SPECIFIER, leave it alone.
2845 2019-07-12 Jakub Jelinek <jakub@redhat.com>
2847 * parser.c (cp_parser_omp_clause_name): Handle order clause.
2848 (cp_parser_omp_clause_order): New function.
2849 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_ORDER.
2850 (OMP_SIMD_CLAUSE_MASK, OMP_FOR_CLAUSE_MASK): Add
2851 PRAGMA_OMP_CLAUSE_ORDER.
2852 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_ORDER.
2853 * pt.c (tsubst_omp_clauses): Likewise.
2855 2019-07-10 Paolo Carlini <paolo.carlini@oracle.com>
2857 * decl.c (get_type_quals,
2858 smallest_type_location (const cp_decl_specifier_seq*)): New.
2859 (check_tag_decl): Use smallest_type_location in error_at about
2860 multiple types in one declaration.
2861 (grokdeclarator): Use locations[ds_complex] in error_at about
2862 complex invalid; use locations[ds_storage_class] in error_at
2863 about static cdtor; use id_loc in error_at about flexible
2864 array member in union; use get_type_quals.
2866 2019-07-09 Martin Sebor <msebor@redhat.com>
2869 * cp-tree.h: Change class-key of PODs to struct and others to class.
2871 * semantics.c (finalize_nrv_r): Same.
2873 2019-07-09 Martin Sebor <msebor@redhat.com>
2876 * constexpr.c (cxx_eval_call_expression): Change class-key from class
2877 to struct and vice versa to match convention and avoid -Wclass-is-pod
2878 and -Wstruct-no-pod.
2879 * constraint.cc (get_concept_definition): Same.
2881 * cxx-pretty-print.h: Same.
2883 * logic.cc (term_list::replace): Same.
2884 * name-lookup.c (find_local_binding): Same.
2885 * pt.c (tsubst_binary_right_fold): Same.
2886 * search.c (field_accessor_p): Same.
2887 * semantics.c (expand_or_defer_fn): Same.
2889 2019-07-08 Jakub Jelinek <jakub@redhat.com>
2892 * decl2.c (cp_omp_mappable_type_1): Don't emit any note for
2893 error_mark_node type.
2895 2019-07-05 Jakub Jelinek <jakub@redhat.com>
2899 * call.c (build_new_method_call_1): Remove set but not used variable
2902 2019-07-05 Paolo Carlini <paolo.carlini@oracle.com>
2904 PR c++/67184 (again)
2906 * call.c (build_over_call): Devirtualize user-defined operators
2907 coming from a base too.
2908 (build_new_method_call_1): Do not devirtualize here.
2910 2019-07-04 Marek Polacek <polacek@redhat.com>
2913 PR c++/83374 - __is_standard_layout wrong for a class with repeated
2915 * class.c (check_bases): Set CLASSTYPE_NON_STD_LAYOUT for a class if
2916 CLASSTYPE_REPEATED_BASE_P is true.
2918 2019-07-04 Andrew Stubbs <ams@codesourcery.com>
2920 * cp-tree.h (cp_omp_emit_unmappable_type_notes): New prototype.
2921 * decl.c (cp_finish_decl): Call cp_omp_emit_unmappable_type_notes.
2922 * decl2.c (cp_omp_mappable_type): Move contents to ...
2923 (cp_omp_mappable_type_1): ... here and add note output.
2924 (cp_omp_emit_unmappable_type_notes): New function.
2925 * semantics.c (finish_omp_clauses): Call
2926 cp_omp_emit_unmappable_type_notes in four places.
2928 2019-07-03 Martin Liska <mliska@suse.cz>
2930 * call.c (build_new_op_1): Remove dead assignemts.
2931 * typeck.c (cp_build_binary_op): Likewise.
2933 2019-06-27 Jason Merrill <jason@redhat.com>
2935 PR c++/55442 - memory-hog with highly recursive constexpr.
2936 * constexpr.c (push_cx_call_context): Return depth.
2937 (cxx_eval_call_expression): Don't cache past constexpr_cache_depth.
2939 2019-06-27 Jan Hubicka <jh@suse.cz>
2941 * class.c (layout_class_type): Set TYPE_CXX_ODR_P for as-base
2944 2019-06-27 Martin Liska <mliska@suse.cz>
2946 * class.c (adjust_clone_args): Remove obviously
2948 (dump_class_hierarchy_r): Likewise.
2949 * decl.c (check_initializer): Likewise.
2950 * parser.c (cp_parser_lambda_expression): Likewise.
2951 * pt.c (unify_bound_ttp_args): Likewise.
2952 (convert_template_argument): Likewise.
2953 * rtti.c (build_headof): Likewise.
2954 * typeck.c (convert_for_initialization): Likewise.
2956 2019-06-25 Jason Merrill <jason@redhat.com>
2958 PR c++/70462 - unnecessary base ctor variant with final.
2959 * optimize.c (populate_clone_array): Skip base variant if
2961 (maybe_clone_body): We don't need an alias if we are only defining
2964 * class.c (resolves_to_fixed_type_p): Check CLASSTYPE_FINAL.
2966 2019-06-25 Jakub Jelinek <jakub@redhat.com>
2969 * constexpr.c (cxx_eval_array_reference): Don't look through VCE from
2970 vector type if lval.
2972 2019-06-25 Jozef Lawrynowicz <jozef.l@mittosystems.com>
2974 * lex.c (init_reswords): Create keyword for "__intN__" type.
2975 * cp-tree.h (cp_decl_specifier_seq): New bitfield "int_n_alt".
2976 * decl.c (grokdeclarator): Don't pedwarn about "__intN" ISO
2977 C incompatibility if alternate "__intN__" form is used.
2978 * parser.c (cp_parser_simple_type_specifier): Set
2979 decl_specs->int_n_alt if "__intN__" form is used.
2981 2019-06-24 Jan Hubicka <jh@suse.cz>
2983 * lex.c (cxx_make_type): Set TYPE_CXX_ODR_P.
2985 2019-06-24 Jason Merrill <jason@redhat.com>
2987 * class.c (layout_class_type): Don't use a separate
2988 CLASSTYPE_AS_BASE if it's the same size.
2990 2019-06-23 Marek Polacek <polacek@redhat.com>
2992 * call.c (convert_default_arg): Use DEFERRED_PARSE instead of
2994 * cp-objcp-common.c (cp_tree_size): Likewise. Use tree_deferred_parse
2995 instead of tree_default_arg.
2996 * cp-tree.def: Rename DEFAULT_ARG to DEFERRED_PARSE.
2997 * cp-tree.h: Rename DEFARG_TOKENS to DEFPARSE_TOKENS. Rename
2998 DEFARG_INSTANTIATIONS to DEFPARSE_INSTANTIATIONS. Rename
2999 tree_default_arg to tree_deferred_parse.
3000 (UNPARSED_NOEXCEPT_SPEC_P): Use DEFERRED_PARSE instead of DEFAULT_ARG.
3001 (cp_tree_node_structure_enum): Rename TS_CP_DEFAULT_ARG to
3002 TS_CP_DEFERRED_PARSE.
3003 (lang_tree_node): Rename tree_default_arg to tree_deferred_parse.
3004 Rename default_arg to deferred_parse. Use TS_CP_DEFERRED_PARSE instead
3005 of TS_CP_DEFAULT_ARG.
3006 (defarg_location): Remove declaration.
3007 (defparse_location): Add declaration.
3008 * decl.c (grokfndecl): Use DEFERRED_PARSE instead of DEFAULT_ARG.
3009 Call defparse_location instead of defarg_location.
3010 (check_default_argument): Use DEFERRED_PARSE instead of DEFAULT_ARG.
3011 (cp_tree_node_structure): Likewise. Use TS_CP_DEFERRED_PARSE instead
3012 of TS_CP_DEFAULT_ARG.
3013 * decl2.c (grokfield): Use DEFERRED_PARSE instead of DEFAULT_ARG.
3014 * error.c (dump_expr): Likewise.
3015 (location_of): Likewise.
3016 * init.c (get_nsdmi): Likewise.
3017 * parser.c (cp_parser_save_noexcept): Likewise. Use DEFPARSE_TOKENS
3018 instead of DEFARG_TOKENS.
3019 (cp_parser_late_noexcept_specifier): Likewise.
3020 (cp_parser_late_parse_one_default_arg): Use DEFPARSE_TOKENS instead
3022 (cp_parser_late_parsing_default_args): Use DEFERRED_PARSE instead of
3023 DEFAULT_ARG. Use DEFPARSE_INSTANTIATIONS instead of
3024 DEFARG_INSTANTIATIONS.
3025 (cp_parser_cache_defarg): Use DEFERRED_PARSE instead of DEFAULT_ARG.
3026 Use DEFPARSE_TOKENS instead of DEFARG_TOKENS. Use
3027 DEFPARSE_INSTANTIATIONS instead of DEFARG_INSTANTIATIONS.
3028 (defparse_location): Renamed from defarg_location.
3029 * pt.c (tsubst_default_argument): Use DEFERRED_PARSE instead of
3031 (tsubst_arg_types): Likewise.
3032 (dependent_type_p_r): Likewise.
3033 * tree.c (cp_tree_equal): Likewise.
3034 (cp_walk_subtrees): Likewise.
3035 * typeck.c (convert_arguments): Likewise.
3037 2019-06-22 Marek Polacek <polacek@redhat.com>
3039 PR c++/86476 - noexcept-specifier is a complete-class context.
3041 * cp-tree.def (DEFAULT_ARG): Update commentary.
3042 * cp-tree.h (UNPARSED_NOEXCEPT_SPEC_P): New macro.
3043 (tree_default_arg): Use tree_base instead of tree_common.
3044 (do_push_parm_decls, maybe_check_overriding_exception_spec): Declare.
3045 * decl.c (do_push_parm_decls): New function, broken out of...
3046 (store_parm_decls): ...here. Call it.
3047 * except.c (nothrow_spec_p): Accept DEFAULT_ARG in the assert.
3048 * parser.c (cp_parser_noexcept_specification_opt,
3049 cp_parser_late_noexcept_specifier, noexcept_override_late_checks):
3051 (unparsed_noexcepts): New macro.
3052 (push_unparsed_function_queues): Update initializer.
3053 (cp_parser_direct_declarator): Pass FRIEND_P to
3054 cp_parser_exception_specification_opt.
3055 (inject_parm_decls): New.
3056 (pop_injected_parms): New.
3057 (cp_parser_class_specifier_1): Implement delayed parsing of
3058 noexcept-specifiers.
3059 (cp_parser_save_noexcept): New.
3060 (cp_parser_late_noexcept_specifier): New.
3061 (noexcept_override_late_checks): New.
3062 (cp_parser_noexcept_specification_opt): Add FRIEND_P parameter. Call
3063 cp_parser_save_noexcept instead of the normal processing if needed.
3064 (cp_parser_exception_specification_opt): Add FRIEND_P parameter and
3065 pass it to cp_parser_noexcept_specification_opt.
3066 (cp_parser_save_member_function_body): Fix comment.
3067 (cp_parser_save_default_args): Maybe save the noexcept-specifier to
3069 (cp_parser_transaction): Update call to
3070 cp_parser_noexcept_specification_opt.
3071 (cp_parser_transaction_expression): Likewise.
3072 * parser.h (cp_unparsed_functions_entry): Add new field to carry
3073 a noexcept-specifier.
3074 * pt.c (dependent_type_p_r): Handle unparsed noexcept expression.
3075 * search.c (maybe_check_overriding_exception_spec): New function, broken
3077 (check_final_overrider): ...here. Call
3078 maybe_check_overriding_exception_spec.
3079 * tree.c (canonical_eh_spec): Handle UNPARSED_NOEXCEPT_SPEC_P.
3080 (cp_tree_equal): Handle DEFAULT_ARG.
3082 PR c++/90881 - bogus -Wunused-value in unevaluated context.
3083 * cvt.c (convert_to_void): Don't emit unused warnings in
3084 an unevaluated context.
3086 2019-06-22 Paolo Carlini <paolo.carlini@oracle.com>
3088 * decl.c (grokdeclarator): Use id_loc, typespec_loc, and
3089 locations[ds_storage_class] in a few additional places.
3091 2019-06-21 Paolo Carlini <paolo.carlini@oracle.com>
3095 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com>
3099 * call.c (build_over_call): Devirtualize when the final overrider
3100 comes from the base.
3102 2019-06-21 Marek Polacek <polacek@redhat.com>
3104 PR c++/61490 - qualified-id in friend function definition.
3105 * decl.c (grokdeclarator): Diagnose qualified-id in friend function
3106 definition. Improve location for diagnostics of friend functions.
3108 PR c++/60223 - ICE with T{} in non-deduced context.
3109 * pt.c (unify): Allow COMPOUND_LITERAL_P in a non-deduced context.
3111 PR c++/64235 - missing syntax error with invalid alignas.
3112 * parser.c (cp_parser_std_attribute_spec): Commit to tentative parse
3113 if there's a missing close paren.
3115 PR c++/90490 - fix decltype issues in noexcept-specifier.
3116 * except.c (build_noexcept_spec): Call
3117 instantiate_non_dependent_expr_sfinae before
3118 build_converted_constant_expr instead of calling
3119 instantiate_non_dependent_expr after it. Add
3120 processing_template_decl_sentinel.
3122 2019-06-21 Jakub Jelinek <jakub@redhat.com>
3125 * semantics.c (finish_omp_clauses): Don't reject references to
3126 incomplete types if processing_template_decl.
3128 2019-06-19 Marek Polacek <polacek@redhat.com>
3130 PR c++/60364 - noreturn after first decl not diagnosed.
3131 * decl.c (duplicate_decls): Give an error when a function is
3132 declared [[noreturn]] after its first declaration.
3133 * parser.c (cp_parser_std_attribute): Don't treat C++11 noreturn
3134 attribute as equivalent to GNU's.
3135 * tree.c (std_attribute_table): Add noreturn.
3137 2019-06-19 Jakub Jelinek <jakub@redhat.com>
3139 * cp-gimplify.c (cp_genericize_r): Handle OMP_CLAUSE_{IN,EX}CLUSIVE
3140 like OMP_CLAUSE_SHARED.
3142 2019-06-18 Jason Merrill <jason@redhat.com>
3144 * constexpr.c (cxx_eval_store_expression): Delay target evaluation.
3146 2019-06-18 Jason Merrill <jason@redhat.com>
3148 * constexpr.c (eval_and_check_array_index): Split out from...
3149 (cxx_eval_array_reference): ...here.
3150 (cxx_eval_store_expression): Use it here, too.
3151 (diag_array_subscript): Take location. Strip location wrapper.
3153 2019-06-18 Jason Merrill <jason@redhat.com>
3155 * constexpr.c (cxx_eval_constant_expression): Handle conversion from
3156 and then to the same type.
3158 2019-06-18 Jason Merrill <jason@redhat.com>
3160 * constexpr.c (unshare_constructor): Add MEM_STAT_DECL.
3162 2019-06-17 Jakub Jelinek <jakub@redhat.com>
3164 * semantics.c (finish_omp_clauses): For OMP_CLAUSE_REDUCTION_INSCAN
3165 set need_copy_assignment.
3167 2019-06-17 Marek Polacek <polacek@redhat.com>
3169 PR c++/83820 - excessive attribute arguments not detected.
3170 * parser.c (cp_parser_std_attribute): Detect excessive arguments.
3172 2019-06-17 Nathan Sidwell <nathan@acm.org>
3175 * name-lookup.c (lookup_type_scope_1): Calll qualify_lookup before
3178 2019-06-14 Marek Polacek <polacek@redhat.com>
3180 PR c++/90884 - stray note with -Wctor-dtor-privacy.
3181 * class.c (maybe_warn_about_overly_private_class): Guard the call to
3184 2019-06-12 Jason Merrill <jason@redhat.com>
3186 PR c++/85552 - wrong instantiation of dtor for DMI.
3187 * typeck2.c (digest_nsdmi_init): Set tf_no_cleanup for direct-init.
3189 2019-06-13 Paolo Carlini <paolo.carlini@oracle.com>
3191 * decl.c (grokdeclarator): Use id_loc in five additional places
3192 in the last part of the function.
3194 2019-06-13 Paolo Carlini <paolo.carlini@oracle.com>
3196 * decl.c (grokdeclarator): Move further up the declaration of
3197 id_loc, use it immediately, update its value after the loop
3198 over declarator, use it again in the final part of function;
3199 improve locations of error messages about multiple data types
3200 and conflicting specifiers.
3202 2019-06-13 Richard Biener <rguenther@suse.de>
3205 * typeck2.c (split_nonconstant_init_1): Properly count
3206 num_split_elts, optimize single constructor elt removal.
3208 2019-06-12 Marek Polacek <polacek@redhat.com>
3210 PR c++/66999 - 'this' captured by reference.
3211 * parser.c (cp_parser_lambda_introducer): Reject `&this'. Use
3212 cp_lexer_nth_token_is instead of cp_lexer_peek_nth_token.
3214 PR c++/90825 - endless recursion when evaluating sizeof.
3215 PR c++/90832 - endless recursion when evaluating sizeof.
3216 * constexpr.c (cxx_eval_constant_expression): Don't recurse on the
3217 result of fold_sizeof_expr if is returns a SIZEOF_EXPR.
3218 * typeck.c (cxx_sizeof_expr): Only return a SIZEOF_EXPR if the operand
3219 is instantiation-dependent.
3221 PR c++/90736 - bogus error with alignof.
3222 * constexpr.c (adjust_temp_type): Use cv_unqualified type.
3224 2019-06-11 Matthew Beliveau <mbelivea@redhat.com>
3226 PR c++/90449 - add -Winaccessible-base option.
3227 * class.c (warn_about_ambiguous_bases): Changed name to:
3228 maybe_warn_about_inaccessible_bases.
3229 (maybe_warn_about_inaccessible_bases): Implemented new
3230 Winaccessible-base warning option for both direct and virtual
3232 (layout_class_type): Call to warn_about_ambiguous_bases changed to fit
3235 2019-06-11 Richard Biener <rguenther@suse.de>
3238 * typeck2.c (split_nonconstant_init_1): Avoid ordered remove
3239 from CONSTRUCTOR by marking to remove elements and doing all
3240 of them in a O(n) scan.
3242 2019-06-11 Jakub Jelinek <jakub@redhat.com>
3245 * init.c (constant_value_1): Handle VECTOR_CST DECL_INITIAL for
3246 !DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P decls like CONSTRUCTOR.
3248 2019-06-11 Martin Liska <mliska@suse.cz>
3251 * pt.c (init_template_processing): Disable hash table
3252 sanitization for decl_specializations and type_specializations.
3254 2019-06-10 Jason Merrill <jason@redhat.com>
3256 * constexpr.c (free_constructor): New.
3257 (cxx_eval_call_expression): Free parameter value CONSTRUCTORs.
3259 * constexpr.c (unshare_constructor): Only unshare if T is itself a
3261 (cxx_eval_call_expression): Don't call it on the result here.
3263 Reduce constexpr_call memory consumption.
3264 * constexpr.c (cxx_bind_parameters_in_call): Use TREE_VEC rather
3266 (constexpr_call_hasher::equal, cxx_bind_parameters_in_call)
3267 (cxx_eval_call_expression): Adjust.
3269 2019-06-10 Jakub Jelinek <jakub@redhat.com>
3271 * parser.c (cp_parser_omp_clause_reduction): Don't sorry_at on inscan
3273 (cp_parser_omp_scan_loop_body): New function.
3274 (cp_parser_omp_for_loop): Call cp_parser_omp_scan_loop_body if there
3275 are inscan reduction clauses.
3276 (cp_parser_pragma): Reject PRAGMA_OMP_SCAN.
3277 * semantics.c (finish_omp_clauses): Reject mixing inscan with
3278 non-inscan reductions on the same construct, or inscan reductions with
3279 ordered or schedule clauses, or inscan array reductions.
3280 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_{IN,EX}CLUSIVE.
3281 (tsubst_expr): Handle OMP_SCAN.
3283 2019-06-07 Jason Merrill <jason@redhat.com>
3285 * constexpr.c (cxx_eval_constant_expression): Call
3286 STRIP_ANY_LOCATION_WRAPPER early.
3287 [CONVERT_EXPR]: Don't build anything for conversion to void.
3288 [ADDR_EXPR]: ggc_free unused ADDR_EXPR.
3290 2019-06-05 Martin Sebor <msebor@redhat.com>
3293 * typeck.c (maybe_warn_about_returning_address_of_local): Only
3294 consider functions returning pointers as candidates for
3295 -Wreturn-local-addr.
3297 2019-06-05 Paolo Carlini <paolo.carlini@oracle.com>
3299 * decl.c (smallest_type_location): New.
3300 (check_special_function_return_type): Use it.
3301 (grokdeclarator): Lkewise.
3303 2019-06-05 Paolo Carlini <paolo.carlini@oracle.com>
3305 * decl.c (grokdeclarator): Use locations[ds_friend]
3308 2019-06-05 Martin Sebor <msebor@redhat.com>
3310 * call.c (build_conditional_expr_1): Adjust quoting and hyphenation.
3311 (convert_like_real): Same.
3312 (convert_arg_to_ellipsis): Same.
3313 * constexpr.c (diag_array_subscript): Same.
3314 * constraint.cc (diagnose_trait_expression): Same.
3315 * cvt.c (ocp_convert): Same.
3316 * decl.c (start_decl): Same.
3317 (check_for_uninitialized_const_var): Same.
3319 (check_special_function_return_type): Same.
3320 (finish_enum_value_list): Same.
3321 (start_preparsed_function): Same.
3322 * parser.c (cp_parser_decl_specifier_seq): Same.
3323 * typeck.c (cp_build_binary_op): Same.
3324 (build_static_cast_1): Same.
3326 2019-06-04 Nina Dinka Ranns <dinka.ranns@gmail.com>
3328 PR c++/63149 - Wrong auto deduction from braced-init-list.
3329 * pt.c (listify_autos): use non cv qualified auto_node in
3330 std::initializer_list<auto>.
3332 2019-06-04 Paolo Carlini <paolo.carlini@oracle.com>
3334 * decl.c (grokdeclarator): Use declarator->id_loc in two
3337 2019-06-04 Nathan Sidwell <nathan@acm.org>
3339 * name-lookup.c (lookup_type_scope_1): Reimplement, handle local
3340 and namespace scopes separately.
3342 2019-06-04 Harald van Dijk <harald@gigawatt.nl>
3344 PR c++/60531 - Wrong error about unresolved overloaded function
3345 * typeck.c (cp_build_binary_op): See if overload can be resolved.
3346 (cp_build_unary_op): Ditto.
3348 2019-06-04 Jason Merrill <jason@redhat.com>
3350 Reduce accumulated garbage in constexpr evaluation.
3351 * constexpr.c (cxx_eval_call_expression): ggc_free any bindings we
3353 (cxx_eval_increment_expression): ggc_free the MODIFY_EXPR after
3356 2019-06-04 Jakub Jelinek <jakub@redhat.com>
3358 * cp-tree.h (CP_OMP_CLAUSE_INFO): Allow for any clauses up to _condvar_
3359 instead of only up to linear.
3361 2019-06-03 Paolo Carlini <paolo.carlini@oracle.com>
3363 * parser.c (cp_parser_unqualified_id): Use build_min_nt_loc in
3366 2019-06-01 Ville Voutilainen <ville.voutilainen@gmail.com>
3369 * class.c (fixup_type_variants): Handle CLASSTYPE_FINAL.
3371 2019-05-31 Nathan Sidwell <nathan@acm.org>
3373 * cp-tree.h (IDENTIFIER_LAMBDA_P): New.
3375 (LAMBDA_TYPE_P, TYPE_UNNAMED_P): Likewise.
3376 (LAMBDANAME_PREFIX, LAMBDANAME_FORMAT): Delete.
3377 (make_lambda_name): Don't declare.
3378 * error.c (dump_aggr_type): Check for lambdas before other
3380 * lambda.c (begin_lambda_type): Use make_anon_name.
3381 * cp-lang.c (cxx_dwarf_name): Lambda names smell anonymous.
3382 * mangle.c (write_local_name): Likewise.
3383 * name-lookup.c (lambda_cnt, make_lambda_name): Delete.
3385 2019-05-30 Marek Polacek <polacek@redhat.com>
3387 * cp-tree.h (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Fix a typo.
3389 2019-05-31 Paolo Carlini <paolo.carlini@oracle.com>
3391 * decl.c (grokdeclarator): Use declarator->id_loc in five
3394 2019-05-29 Jakub Jelinek <jakub@redhat.com>
3397 * tree.c (lvalue_kind): Return clk_none for expressions with
3400 2019-05-29 Paolo Carlini <paolo.carlini@oracle.com>
3403 * parser.c (cp_parser_sizeof_operand): When the type-id production
3404 did not work out commit to the tentative parse.
3406 2019-05-29 Jakub Jelinek <jakub@redhat.com>
3408 P1091R3 - Extending structured bindings to be more like var decls
3409 P1381R1 - Reference capture of structured bindings
3410 * decl.c (cp_maybe_mangle_decomp): Handle TREE_STATIC decls even at
3412 (cp_finish_decomp): Copy over various decl properties from decl to
3413 v[i] in the tuple case.
3414 (grokdeclarator): Allow static, thread_local and __thread for C++2a
3415 and use pedwarn instead of error for older standard revisions.
3416 Make other structured binding diagnostic messages more i18n friendly.
3418 2019-05-28 Nathan Sidwell <nathan@acm.org>
3420 * decl.c (duplicate_decls): Assert a template newdecl has no
3423 2019-05-28 Marek Polacek <polacek@redhat.com>
3425 PR c++/90548 - ICE with generic lambda and empty pack.
3426 * pt.c (tsubst_copy_and_build): Handle pack expansion properly.
3428 2019-05-28 Nathan Sidwell <nathan@acm.org>
3430 * cp-tree.h (make_anon_name): Drop declaration.
3431 (TYPE_UNNAMED_P): Use IDENTIFIER_ANON_P.
3432 * cp-lang.c (cxx_dwarf_name): Likewise.
3433 * class.c (find_flexarrays): Likewise.
3434 * decl.c (name_unnamed_type, xref_tag_1): Likewise.
3435 * error.c (dump_aggr_type): Likewise.
3436 * pt.c (push_template_decl_real): Likewise.
3437 * name-lookup.c (consider_binding_level): Likewise.
3438 (anon_cnt, make_anon_name): Delete.
3440 2019-05-25 Marek Polacek <polacek@redhat.com>
3442 PR c++/90572 - wrong disambiguation in friend declaration.
3443 * parser.c (cp_parser_constructor_declarator_p): Don't allow missing
3444 typename for friend declarations.
3446 2019-05-23 Jonathan Wakely <jwakely@redhat.com>
3448 * cp-tree.h (CP_AGGREGATE_TYPE_P): Fix whitespace.
3450 * init.c (std_placement_new_fn_p): Remove outdated TODO comment that
3451 was resolved by r254694.
3453 2019-05-22 Jason Merrill <jason@redhat.com>
3455 PR c++/20408 - unnecessary code for empty struct.
3456 * call.c (build_call_a): Use simple_empty_class_p.
3458 PR c++/86485 - -Wmaybe-unused with empty class ?:
3459 * cp-gimplify.c (simple_empty_class_p): Also true for MODIFY_EXPR.
3461 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com>
3463 * parser.c (cp_parser_template_declaration_after_parameters): Use
3464 DECL_SOURCE_LOCATION in literal operator template errors.
3466 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com>
3470 * call.c (build_over_call): Devirtualize when the final overrider
3471 comes from the base.
3473 2019-05-21 Nathan Sidwell <nathan@acm.org>
3475 * name-lookup.c (do_nonmember_using_decl): Drop INSERT_P
3476 parameter. Document.
3477 (finish_nonmember_using_decl): Adjust do_nonmember_using_decl
3478 calls. Remove stray FIXME comment.
3480 * name-lookup.h (struct cp_binding_level): Drop usings field.
3481 (finish_namespace_using_decl, finish_local_using_decl): Replace with ...
3482 (finish_nonmember_using_decl): ... this.
3483 * name-lookup.c (push_using_decl_1, push_using_decl):
3484 (do_nonmember_using_decl): ... here. Add INSERT_P arg. Reimplement.
3485 (validate_nonmember_using_decl, finish_namespace_using_decl)
3486 (finish_local_using_decl): Replace with ...
3487 (finish_nonmember_using_decl): ... this. Drop DECL parm.
3488 * parser.c (cp_parser_using_declaration): Don't do lookup here.
3489 * pt.c (tsubst_expr): Do not do using decl lookup here.
3491 2019-05-21 Eric Botcazou <ebotcazou@adacore.com>
3493 * decl2.c (cpp_check) <IS_ASSIGNMENT_OPERATOR>: New case.
3495 2019-05-20 Marek Polacek <polacek@redhat.com>
3497 CWG 2094 - volatile scalars are trivially copyable.
3499 * tree.c (trivially_copyable_p): Don't check CP_TYPE_VOLATILE_P for
3502 2019-05-20 Marek Polacek <polacek@redhat.com>
3504 * pt.c (convert_template_argument): Add a diagnostic for the
3505 [temp.arg]/2 ambiguity case.
3507 * name-lookup.c (finish_using_directive): Don't issue inform() if the
3508 warning didn't trigger. Add quoting. Tweak the inform message.
3510 2019-05-20 Paolo Carlini <paolo.carlini@oracle.com>
3512 * cp-tree.h: Remove remnants of CONV_NONCONVERTING.
3514 2019-05-20 Nathan Sidwell <nathan@acm.org>
3516 * name-lookup.c (finish_namespace_using_directive)
3517 (finish_local_using_directive): Merge to ...
3518 (finish_using_directive): ... here. Handle both contexts.
3519 * name-lookup.h (finish_namespace_using_directive)
3520 (finish_local_using_directive): Replace with ...
3521 (finish_using_directive): ... this.
3522 * parser.c (cp_parser_using_directive): Adjust.
3523 * pt.c (tsubst_expr): Likewise.
3525 * cp-tree.h (struct lang_decl_ns): Remove usings field.
3526 (DECL_NAMESPACE_USING): Delete.
3527 * name-lookup.c (name_lookup::search_usings): Use namespace's
3529 (name_lookup::queue_namespae): Likewise.
3530 (finish_namespace_using_directive, push_namespace): Likewise.
3531 (has_using_namespace_std_directive): Just search the entire
3534 2019-05-20 Jonathan Wakely <jwakely@redhat.com>
3536 PR c++/90532 Ensure __is_constructible(T[]) is false
3537 * method.c (is_xible_helper): Return error_mark_node for construction
3538 of an array of unknown bound.
3540 2019-05-17 Thomas Schwinge <thomas@codesourcery.com>
3543 * parser.c (cp_finalize_oacc_routine): Rework checking if already
3544 marked with an OpenACC 'routine' directive.
3547 * parser.c (cp_parser_oacc_routine)
3548 (cp_parser_late_parsing_oacc_routine): Normalize order of clauses.
3549 (cp_finalize_oacc_routine): Call oacc_verify_routine_clauses.
3552 * parser.c (cp_finalize_oacc_routine): Refer to OpenACC 'routine'
3553 clauses from "omp declare target" attribute.
3555 2019-05-16 Martin Sebor <msebor@redhat.com>
3557 * call.c (print_z_candidate): Wrap diagnostic text in a gettext
3559 (print_z_candidates): Same.
3560 (build_conditional_expr_1): Quote keywords, operators, and types
3562 (build_op_delete_call): Same.
3563 (maybe_print_user_conv_context): Wrap diagnostic text in a gettext
3565 (convert_like_real): Same.
3566 (convert_arg_to_ellipsis): Quote keywords, operators, and types
3568 (build_over_call): Same.
3569 (joust): Break up an overlong line. Wrap diagnostic text in a gettext
3571 * constexpr.c (cxx_eval_check_shift_p): Spell out >= in English.
3572 (cxx_eval_constant_expression): Quote keywords, operators, and types
3574 (potential_constant_expression_1): Same.
3575 * cp-gimplify.c (cp_genericize_r): Same.
3576 * cvt.c (maybe_warn_nodiscard): Quote keywords, operators, and types
3578 (type_promotes_to): Same.
3579 * decl.c (check_previous_goto_1): Same.
3582 (cp_finish_decl): Avoid parenthesizing a sentence for consistency.
3583 (grok_op_properties): Quote keywords, operators, and types
3585 * decl2.c (grokfield): Same.
3586 (coerce_delete_type): Same.
3587 * except.c (is_admissible_throw_operand_or_catch_parameter): Same.
3588 * friend.c (do_friend): Quote C++ tokens.
3589 * init.c (build_new_1): Quote keywords, operators, and types
3591 (build_vec_delete_1): Same.
3592 (build_delete): Same.
3593 * lex.c (parse_strconst_pragma): Same.
3594 (handle_pragma_implementation): Same.
3595 (unqualified_fn_lookup_error): Same.
3596 * mangle.c (write_type): Same.
3597 * method.c (defaulted_late_check): Avoid two consecutive punctuators.
3598 * name-lookup.c (cp_binding_level_debug): Remove a trailing newline.
3599 (pop_everything): Same.
3600 * parser.c (cp_lexer_start_debugging): Quote a macro name.
3602 (cp_lexer_stop_debugging): Same.
3603 (cp_parser_userdef_numeric_literal): Quote a C++ header name
3605 (cp_parser_nested_name_specifier_opt): Quote keywords, operators,
3606 and types in diagnostics.
3607 (cp_parser_question_colon_clause): Same.
3608 (cp_parser_asm_definition): Same.
3609 (cp_parser_init_declarator): Same.
3610 (cp_parser_template_declaration_after_parameters): Avoid capitalizing
3611 a sentence in a diagnostic.
3612 (cp_parser_omp_declare_reduction): Quote keywords, operators, and types
3614 (cp_parser_transaction): Same.
3615 * pt.c (maybe_process_partial_specialization): Replace second call
3616 to permerror with inform for consistency with other uses.
3617 (expand_integer_pack): Quote keywords, operators, and types
3619 * rtti.c (get_typeid): Quote keywords, operators, and types
3621 (build_dynamic_cast_1): Same.
3622 * semantics.c (finish_asm_stmt): Same.
3623 (finish_label_decl): Same.
3624 (finish_bases): Same.
3625 (finish_offsetof): Same.
3626 (cp_check_omp_declare_reduction): Same.
3627 (finish_decltype_type): Same.
3628 * tree.c (handle_init_priority_attribute): Same. Add detail
3630 (maybe_warn_zero_as_null_pointer_constant): Same.
3631 * typeck.c (cp_build_binary_op): Quote keywords, operators, and types
3633 (cp_build_unary_op): Same.
3634 (check_for_casting_away_constness): Same.
3635 (build_static_cast): Same.
3636 (build_const_cast_1): Same.
3637 (maybe_warn_about_returning_address_of_local): Same.
3638 (check_return_expr): Same.
3639 * typeck2.c (abstract_virtuals_error_sfinae): Same.
3640 (digest_init_r): Replace a tab with spaces in a diagnostic.
3641 (build_functional_cast): Quote keywords, operators, and types
3644 2019-05-15 Jakub Jelinek <jakub@redhat.com>
3647 * cp-gimplify.c (genericize_cp_loop): Emit a DEBUG_BEGIN_STMT
3648 before the condition (or if missing or constant non-zero at the end
3649 of the loop. Emit a DEBUG_BEGIN_STMT before the increment expression
3650 if any. Don't call protected_set_expr_location on incr if it already
3653 2019-05-15 Marek Polacek <polacek@redhat.com>
3655 CWG 2096 - constraints on literal unions.
3656 * class.c (check_field_decls): Initialize booleans directly. A union
3657 is literal if at least one of its non-static data members is of
3658 non-volatile literal type.
3660 2019-05-15 Paolo Carlini <paolo.carlini@oracle.com>
3662 * cp-tree.h (REFERENCE_VLA_OK): Remove.
3663 * lambda.c (build_capture_proxy): Remove use of the above.
3665 2019-05-15 Paolo Carlini <paolo.carlini@oracle.com>
3667 * call.c (perform_overload_resolution, build_new_method_call_1):
3668 Use OVL_P; remove redundant TEMPLATE_DECL checks.
3669 * decl.c (grokfndecl): Likewise.
3670 * mangle.c (write_expression): Likewise.
3671 * parser.c (cp_parser_template_id): Likewise.
3672 * pt.c (resolve_overloaded_unification, type_dependent_expression_p):
3674 * search.c (build_baselink): Likewise.
3675 * tree.c (is_overloaded_fn, dependent_name, maybe_get_fns): Likewise.
3677 2019-05-14 Paolo Carlini <paolo.carlini@oracle.com>
3679 PR preprocessor/90382
3680 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
3683 2019-05-13 Jason Merrill <jason@redhat.com>
3685 Use releasing_vec more broadly.
3686 * cp-tree.h (struct releasing_vec): Replace get_ref method with
3688 (vec_safe_push, vec_safe_reserve, vec_safe_length, vec_safe_splice):
3689 Forwarding functions for releasing_vec.
3690 (release_tree_vector): Declare but don't define.
3691 * call.c (build_op_delete_call, build_temp, call_copy_ctor)
3692 (perform_direct_initialization_if_possible): Use releasing_vec.
3693 * constexpr.c (cxx_eval_vec_init_1, cxx_eval_store_expression):
3695 * cp-gimplify.c (cp_fold): Likewise.
3696 * cvt.c (force_rvalue, ocp_convert): Likewise.
3697 * decl.c (get_tuple_decomp_init): Likewise.
3698 * except.c (build_throw): Likewise.
3699 * init.c (perform_member_init, expand_default_init): Likewise.
3700 * method.c (do_build_copy_assign, locate_fn_flags): Likewise.
3701 * parser.c (cp_parser_userdef_char_literal)
3702 (cp_parser_userdef_numeric_literal)
3703 (cp_parser_userdef_string_literal)
3704 (cp_parser_perform_range_for_lookup)
3705 (cp_parser_range_for_member_function, cp_parser_omp_for_loop)
3706 (cp_parser_omp_for_loop_init): Likewise.
3707 * pt.c (tsubst_copy_and_build, do_class_deduction): Likewise.
3708 * semantics.c (calculate_direct_bases, calculate_bases)
3709 (finish_omp_barrier, finish_omp_flush, finish_omp_taskwait)
3710 (finish_omp_taskyield, finish_omp_cancel)
3711 (finish_omp_cancellation_point): Likewise.
3712 * tree.c (build_vec_init_elt, strip_typedefs, strip_typedefs_expr)
3713 (build_min_non_dep_op_overload): Likewise.
3714 * typeck.c (build_function_call_vec, cp_build_function_call_nary)
3715 (cp_build_modify_expr): Likewise.
3716 * typeck2.c (build_functional_cast): Likewise.
3718 2019-05-11 Paolo Carlini <paolo.carlini@oracle.com>
3720 * typeck.c (cp_build_function_call_vec): When mark_used fails
3721 unconditionally return error_mark_node.
3723 2019-05-10 Paolo Carlini <paolo.carlini@oracle.com>
3725 * decl.c (grokvardecl): Use an accurate location in error message
3726 about main as a global variable.
3728 2019-05-10 Paolo Carlini <paolo.carlini@oracle.com>
3730 * call.c (build_call_a): Use FUNC_OR_METHOD_TYPE_P.
3731 * cp-gimplify.c (cp_fold): Likewise.
3732 * cp-objcp-common.c (cp_type_dwarf_attribute): Likewise.
3733 * cp-tree.h (TYPE_OBJ_P, TYPE_PTROBV_P): Likewise.
3734 * cvt.c (perform_qualification_conversions): Likewise.
3735 * decl.c (grokdeclarator): Likewise.
3736 * decl2.c (build_memfn_type): Likewise.
3737 * mangle.c (canonicalize_for_substitution, write_type): Likewise.
3738 * parser.c (cp_parser_omp_declare_reduction): Likewise.
3739 * pt.c (check_explicit_specialization, uses_deducible_template_parms,
3740 check_cv_quals_for_unify, dependent_type_p_r): Likewise.
3741 * rtti.c (ptr_initializer): Likewise.
3742 * semantics.c (finish_asm_stmt, finish_offsetof,
3743 cp_check_omp_declare_reduction): Likewise.
3744 * tree.c (cp_build_qualified_type_real,
3745 cp_build_type_attribute_variant, cxx_type_hash_eq,
3746 cxx_copy_lang_qualifiers, cp_free_lang_data): Likewise.
3747 * typeck.c (structural_comptypes, convert_arguments,
3748 cp_build_addr_expr_1, unary_complex_lvalue, cp_build_c_cast,
3749 cp_build_modify_expr, comp_ptr_ttypes_real, type_memfn_rqual):
3752 2019-05-10 Marek Polacek <polacek@redhat.com>
3754 PR c++/78010 - bogus -Wsuggest-override warning on final function.
3755 * class.c (check_for_override): Don't warn for final functions.
3757 2019-05-10 Jakub Jelinek <jakub@redhat.com>
3760 * config-lang.in (gtfiles): Remove c-family/c-lex.c, add
3761 c-family/c-cppbuiltin.c.
3763 2019-05-09 Paolo Carlini <paolo.carlini@oracle.com>
3767 2018-04-26 Paolo Carlini <paolo.carlini@oracle.com>
3769 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
3772 2019-05-08 Nathan Sidwell <nathan@acm.org>
3774 Kill DECL_SAVED_FUNCTION_DATA .
3775 * cp-tree.h (language_function): Remove x_auto_return_pattern.
3776 (current_function_auto_return_pattern): Delete.
3777 (lang_decl_fn): Replace saved_language_function with
3778 saved_auto_return type.
3779 (DECL_SAVED_FUNCTION_DATA): Delete.
3780 (DECL_SAVED_AUTO_RETURN_TYPE): New.
3781 (FNDECL_USED_AUTO): Correct documentation.
3782 * decl.c (duplicate_decls): Adjust AUTO return handling.
3783 (start_preparsed_function): Replace
3784 current_function_auto_return_pattern with
3785 DECL_SAVED_AUTO_RETURN_TYPE. Remove DECL_SAVED_FUNCTION_DATA
3787 (finish_function): Likewise.
3788 (save_function_data): Delete.
3789 (fndecl_declared_return_type): Reimplement.
3790 * mangle.c (write_unqualified_name): Use DECL_SAVED_AUTO_RETURN_TYPE.
3791 * method.c (make_thunk, make_alias_for): Likewise.
3792 * parser.c (cp_parser_jump_statement): Likewise.
3793 * pt.c (do_auto_deduction): Likewise.
3794 * typeck.c (check_return_expr): Likewise.
3796 2019-05-06 Jason Merrill <jason@redhat.com>
3798 PR c++/90171 - reorganize usual_deallocation_fn_p
3799 * call.c (struct dealloc_info): New.
3800 (usual_deallocation_fn_p): Take a dealloc_info*.
3801 (aligned_deallocation_fn_p, sized_deallocation_fn_p): Remove.
3802 (build_op_delete_call): Adjust.
3804 2019-05-07 Jason Merrill <jason@redhat.com>
3806 PR c++/86485 - -Wmaybe-unused with empty class ?:
3807 * typeck.c (build_static_cast_1): Use cp_build_addr_expr.
3809 * pt.c (type_dependent_expression_p): A non-type template parm with
3810 a placeholder type is type-dependent.
3812 2019-05-06 Marek Polacek <polacek@redhat.com>
3814 PR c++/90265 - ICE with generic lambda.
3815 * pt.c (tsubst_copy_and_build): Use a dedicated variable for the last
3816 element in the vector.
3818 2019-05-03 Martin Liska <mliska@suse.cz>
3820 * call.c (build_aggr_conv): Use is_empty instead of
3821 elements () == 0 (and similar usages).
3822 * parser.c (cp_parser_lambda_introducer): Likewise.
3824 2019-05-02 Nathan Sidwell <nathan@acm.org>
3826 * semantics.c (finish_id_expression_1): Remove unreachable code.
3828 2019-05-01 Nathan Sidwell <nathan@acm.org>
3830 * name-lookup.h (get_class_binding_direct): Change final arg to
3832 (get_class_binding): Likewise.
3833 * name-lookup.c (get_class_binding_direct): Replace TYPE_OR_FNS
3834 arg with WANT_TYPE bool. Simplify.
3835 (get_class_binding): Adjust final arg.
3836 * decl.c (reshape_init_class): Adjust get_class_binding calls.
3838 2019-04-30 Nathan Sidwell <nathan@acm.org>
3840 * cp-objcp-common.c (cp_common_init_ts): Use MARK_TS_EXP for _EXPR
3841 nodes. Call c_common_init_ts.
3843 2019-04-29 Nathan Sidwell <nathan@acm.org>
3845 * decl.c (duplicate_decls): Add whitespace, move comments into
3847 * method.c (explain_implicit_non_constexpr): Refactor.
3848 * pt.c (check_explicit_specialization): Fix indentation.
3849 * semantics.c (process_outer_var_ref): Reformat.
3850 (finish_id_expression_1): Use STRIP_TEMPLATE.
3852 2019-04-26 Jonathan Wakely <jwakely@redhat.com>
3854 PR c++/90243 - orphaned note in uninstantiated constexpr function
3855 * decl.c (check_for_uninitialized_const_var): Suppress notes if no
3858 2019-04-26 Paolo Carlini <paolo.carlini@oracle.com>
3861 * decl.c (grokdeclarator): Set type to error_mark_node
3862 upon error about template placeholder type non followed
3863 by a simple declarator-id.
3865 2019-04-26 Paolo Carlini <paolo.carlini@oracle.com>
3867 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
3870 2019-04-24 Jason Merrill <jason@redhat.com>
3872 PR c++/90227 - error with template parameter packs.
3873 * pt.c (coerce_template_parms): Do add empty pack when
3876 2019-04-24 Richard Biener <rguenther@suse.de>
3878 * call.c (null_ptr_cst_p): Order checks according to expensiveness.
3879 (conversion_null_warnings): Likewise.
3880 * typeck.c (same_type_ignoring_top_level_qualifiers_p): Return
3881 early if type1 == type2.
3883 2019-04-22 Jason Merrill <jason@redhat.com>
3885 PR c++/87366 - wrong error with alias template.
3886 * typeck.c (structural_comptypes): When comparing_specializations,
3887 aliases are unequal.
3888 (comptypes): When comparing_specializations, do structural
3891 2019-04-19 Jason Merrill <jason@redhat.com>
3893 PR c++/90190 - CTAD with list-constructor.
3894 * pt.c (do_class_deduction): Don't try the single element deduction
3895 if the single element is also a braced list.
3897 PR c++/90171 - ICE with destroying delete with size_t parm.
3898 * call.c (sized_deallocation_fn_p): New. Use it instead of
3899 second_parm_is_size_t in most cases.
3900 (second_parm_is_size_t): Don't check for aligned.
3902 2019-04-19 Paolo Carlini <paolo.carlini@oracle.com>
3905 * pt.c (fn_type_unification): When handling null explicit
3906 arguments do not special case non-parameter packs.
3908 2019-04-19 Jakub Jelinek <jakub@redhat.com>
3911 * pt.c (process_template_parm): Set decl to pushdecl result. If
3912 !is_non_type, also set parm to that.
3915 * decl.c (struct cp_switch): Remove outside_range_p member.
3916 (push_switch): Don't clear it.
3917 (pop_switch): Adjust c_do_switch_warnings caller.
3918 (finish_case_label): Adjust c_add_case_label caller.
3921 * decl.c (duplicate_decls): If remove is main variant and
3922 DECL_ORIGINAL_TYPE is some other type, remove a DECL_ORIGINAL_TYPE
3923 variant that has newdecl as TYPE_NAME if any.
3925 2019-04-18 Jason Merrill <jason@redhat.com>
3927 PR c++/87554 - ICE with extern template and reference member.
3928 * decl.c (cp_finish_decl): Don't set DECL_INITIAL of external vars.
3930 2019-04-17 Jason Merrill <jason@redhat.com>
3932 PR c++/90047 - ICE with enable_if alias template.
3933 * pt.c (tsubst_decl) [TYPE_DECL]: Don't put an erroneous decl in the
3934 hash table when we're in SFINAE context.
3936 2019-04-17 Marek Polacek <polacek@redhat.com>
3938 PR c++/90124 - bogus error with incomplete type in decltype.
3939 * typeck.c (build_class_member_access_expr): Check
3940 cp_unevaluated_operand.
3942 2019-04-12 Jakub Jelinek <jakub@redhat.com>
3945 * decl.c (duplicate_decls): When newdecl's type is its main variant,
3946 don't try to remove it from the variant list, but instead assert
3949 2019-04-12 Martin Sebor <msebor@redhat.com>
3953 * parser.c (cp_parser_has_attribute_expression): Handle assignment
3956 2019-04-12 Jason Merrill <jason@redhat.com>
3958 * call.c (null_member_pointer_value_p): Handle an empty CONSTRUCTOR
3961 2019-04-12 Marek Polacek <polacek@redhat.com>
3963 * except.c (build_noexcept_spec): Use build_converted_constant_bool_expr
3964 instead of perform_implicit_conversion_flags.
3966 PR c++/87603 - constexpr functions are no longer noexcept.
3967 * constexpr.c (is_sub_constant_expr): Remove unused function.
3968 * cp-tree.h (is_sub_constant_expr): Remove declaration.
3969 * except.c (check_noexcept_r): Don't consider a call to a constexpr
3972 2019-04-11 Jakub Jelinek <jakub@redhat.com>
3974 PR translation/90035
3975 * parser.h (struct cp_parser): Add
3976 type_definition_forbidden_message_arg member.
3977 * parser.c (cp_debug_parser): Print it.
3978 (cp_parser_check_type_definition): Pass
3979 parser->type_definition_forbidden_message_arg as second argument to
3981 (cp_parser_has_attribute_expression, cp_parser_sizeof_operand): Set
3982 parser->type_definition_forbidden_message_arg and use G_() with
3983 %qs for parser->type_definition_forbidden_message instead of
3984 building untranslatable message using concat.
3986 2019-04-09 Jakub Jelinek <jakub@redhat.com>
3988 PR translation/90011
3989 * typeck2.c (check_narrowing): Remove trailing space from diagnostics.
3991 2019-04-08 Marek Polacek <polacek@redhat.com>
3993 * typeck2.c (digest_init_r): Don't condition the object slicing warning
3996 2019-04-08 Paolo Carlini <paolo.carlini@oracle.com>
3999 * semantics.c (trait_expr_value): Don't use TYPE_NOTHROW_P
4000 when maybe_instantiate_noexcept fails.
4001 (classtype_has_nothrow_assign_or_copy_p): Likewise.
4002 * method.c (implicitly_declare_fn): Avoid passing error_mark_node
4003 to build_exception_variant.
4005 2019-04-05 Marek Polacek <polacek@redhat.com>
4007 PR c++/87145 - bogus error converting class type in template arg list.
4008 * pt.c (convert_nontype_argument): Don't call
4009 build_converted_constant_expr if it could involve calling a conversion
4010 function with a instantiation-dependent constructor as its argument.
4012 2019-04-05 Martin Sebor <msebor@redhat.com>
4015 * decl.c (reshape_init_array_1): Avoid treating empty strings
4016 as zeros in array initializers.
4017 Use trivial_type_p () instead of TYPE_HAS_TRIVIAL_DFLT().
4019 2019-04-04 Jason Merrill <jason@redhat.com>
4021 PR c++/89948 - ICE with break in statement-expr.
4022 * constexpr.c (cxx_eval_statement_list): Jumping out of a
4023 statement-expr is non-constant.
4025 2019-04-04 Jason Merrill <jason@redhat.com>
4027 PR c++/89966 - error with non-type auto tparm.
4028 * pt.c (do_auto_deduction): Clear tf_partial.
4030 2019-04-04 Jason Merrill <jason@redhat.com>
4032 PR c++/86986 - ICE with TTP with parameter pack.
4033 * pt.c (coerce_template_parameter_pack): Only look at the type of a
4034 non-type parameter pack.
4035 (fixed_parameter_pack_p_1): Don't recurse into the type of a
4036 non-type parameter pack.
4037 (coerce_template_template_parms): Call add_outermost_template_args.
4039 2019-04-04 Martin Sebor <msebor@redhat.com>
4045 * decl.c (reshape_init_array_1): Strip trailing zero-initializers
4046 from arrays of trivial type and known size.
4047 * mangle.c (write_expression): Convert braced initializer lists
4049 (write_expression): Trim trailing zero-initializers from arrays
4051 (write_template_arg_literal): Mangle strings the same as braced
4054 2019-04-03 Jason Merrill <jason@redhat.com>
4056 PR c++/81866 - ICE with member template and default targ.
4057 * pt.c (tsubst_template_decl): Handle getting a type from
4058 retrieve_specialization.
4060 PR c++/86586 - -fcompare-debug=-Wsign-compare.
4061 * typeck.c (cp_build_binary_op): Don't fold for -Wsign-compare.
4063 PR c++/89331 - ICE with offsetof in incomplete class.
4064 * semantics.c (finish_offsetof): Handle error_mark_node.
4065 * typeck.c (build_class_member_access_expr): Call
4066 complete_type_or_maybe_complain before converting to base.
4068 PR c++/89917 - ICE with lambda in variadic mem-init.
4069 * pt.c (make_pack_expansion): Change type_pack_expansion_p to false.
4071 2019-04-01 Jason Merrill <jason@redhat.com>
4073 PR c++/86946 - ICE with function call in template argument.
4075 * pt.c (iterative_hash_template_arg) [CALL_EXPR]: Use
4078 2019-04-01 Paolo Carlini <paolo.carlini@oracle.com>
4081 * pt.c (tsubst_copy): Deal with lookup_name not returing a variable.
4083 2019-03-31 Marek Polacek <polacek@redhat.com>
4085 PR c++/89852 - ICE with C++11 functional cast with { }.
4086 * constexpr.c (fold_non_dependent_expr_template): New static function
4088 (fold_non_dependent_expr): ...here.
4089 (fold_non_dependent_init): New function.
4090 * cp-tree.h (fold_non_dependent_init): Declare.
4091 * typeck2.c (massage_init_elt): Call fold_non_dependent_init instead
4092 of fold_non_dependent_expr. Don't call maybe_constant_init.
4094 2019-03-30 Jason Merrill <jason@redhat.com>
4096 PR c++/89744 - ICE with specialization of member class template.
4097 * pt.c (lookup_template_class_1): If the partial instantiation is
4098 explicitly specialized, adjust.
4099 (maybe_process_partial_specialization): Also adjust
4102 2019-03-29 Jakub Jelinek <jakub@redhat.com>
4105 * typeck.c: Include gimplify.h.
4106 (cp_build_modify_expr) <case COND_EXPR>: Unshare rhs before using it
4107 for second time. Formatting fixes.
4109 2019-03-29 Marek Polacek <polacek@redhat.com>
4111 PR c++/89876 - ICE with deprecated conversion.
4112 * call.c (convert_like_real): Only give warnings with tf_warning.
4114 2019-03-28 Marek Polacek <polacek@redhat.com>
4116 PR c++/89612 - ICE with member friend template with noexcept.
4117 * pt.c (maybe_instantiate_noexcept): For function templates, use their
4118 template result (function decl). Don't set up local specializations.
4119 Temporarily turn on processing_template_decl. Update the template type
4122 PR c++/89836 - bool constant expression and explicit conversions.
4123 * call.c (build_converted_constant_expr_internal): New function,
4125 (build_converted_constant_expr): ...this. New.
4126 (build_converted_constant_bool_expr): New.
4127 * cp-tree.h (build_converted_constant_bool_expr): Declare.
4128 * decl.c (build_explicit_specifier): Call
4129 build_converted_constant_bool_expr.
4131 2019-03-28 Jakub Jelinek <jakub@redhat.com>
4134 * constexpr.c (struct check_for_return_continue_data): New type.
4135 (check_for_return_continue): New function.
4136 (potential_constant_expression_1) <case SWITCH_STMT>: Walk
4137 SWITCH_STMT_BODY to find RETURN_EXPRs or CONTINUE_STMTs not nested
4138 in loop bodies and set *jump_target to that if found.
4140 2019-03-27 Jason Merrill <jason@redhat.com>
4142 PR c++/89831 - error with qualified-id in const member function.
4143 * semantics.c (finish_non_static_data_member): Use object cv-quals
4144 in scoped case, too.
4146 PR c++/89421 - ICE with lambda in template parameter list.
4147 * parser.c (cp_parser_lambda_expression): Also reject a lambda in a
4148 template parameter list before C++20.
4149 * pt.c (type_dependent_expression_p): True for LAMBDA_EXPR.
4150 * semantics.c (begin_class_definition): Restore error about defining
4151 non-lambda class in template parm list.
4153 2019-03-26 Jason Merrill <jason@redhat.com>
4155 PR c++/86932 - missed SFINAE with empty pack.
4156 * pt.c (coerce_template_parms): Don't add an empty pack if
4158 (fn_type_unification): Pass tf_partial to coerce_template_parms.
4160 PR c++/86429 - constexpr variable in lambda.
4163 * constexpr.c (cxx_eval_constant_expression): In a lambda function,
4164 try evaluating the captured variable directly.
4166 2019-03-26 Jakub Jelinek <jakub@redhat.com>
4169 * semantics.c (finish_omp_atomic): Add warning_sentinel for
4170 -Wunused-value around finish_expr_stmt call.
4172 2019-03-25 Paolo Carlini <paolo.carlini@oracle.com>
4176 * parser.c (cp_parser_binary_expression): Don't call cp_fully_fold
4177 to undo the disabling of warnings.
4179 2019-03-25 Jason Merrill <jason@redhat.com>
4181 PR c++/87748 - substitution failure error with decltype.
4182 * pt.c (most_specialized_partial_spec): Clear
4183 processing_template_decl.
4185 2019-03-25 Marek Polacek <polacek@redhat.com>
4187 PR c++/89214 - ICE when initializing aggregates with bases.
4188 * typeck2.c (digest_init_r): Warn about object slicing instead of
4191 PR c++/89705 - ICE with reference binding with conversion function.
4192 * call.c (reference_binding): If the result of the conversion function
4193 is a prvalue of non-class type, use the cv-unqualified type.
4195 2019-03-25 Nathan Sidwell <nathan@acm.org>
4197 * lambda.c (maybe_add_lambda_conv_op): Don't add to comdat group.
4199 2019-03-22 Jakub Jelinek <jakub@redhat.com>
4202 * cp-tree.h (get_tls_wrapper_fn): Remove declaration.
4203 (maybe_get_tls_wrapper_call): Declare.
4204 * decl2.c (get_tls_wrapper_fn): Make static.
4205 (maybe_get_tls_wrapper_call): New function.
4206 * typeck.c (build_class_member_access_expr): Handle accesses to TLS
4208 * semantics.c (finish_qualified_id_expr): Likewise.
4209 (finish_id_expression_1): Use maybe_get_tls_wrapper_call.
4210 * pt.c (tsubst_copy_and_build): Likewise.
4213 * constexpr.c (struct constexpr_ctx): Add constexpr_ops_count member.
4214 (cxx_eval_constant_expression): When not skipping, not constant class
4215 or location wrapper, increment *ctx->constexpr_ops_count and if it is
4216 above constexpr_loop_nest_limit, diagnose failure.
4217 (cxx_eval_outermost_constant_expr): Add constexpr_ops_count and
4218 initialize ctx.constexpr_ops_count to its address.
4219 (is_sub_constant_expr): Likewise.
4221 2019-03-21 Jakub Jelinek <jakub@redhat.com>
4224 * call.c (filed_in_pset): Change pset from hash_set<tree> * to
4225 hash_set<tree, true> &, adjust uses accordingly.
4226 (build_aggr_conv): Change pset from hash_set<tree> *
4227 to hash_set<tree, true>. Replace goto fail; with return NULL;,
4231 * parser.c (cp_parser_lambda_introducer): Add ids and first_capture_id
4232 variables, check for duplicates in this function.
4233 * lambda.c (add_capture): Don't check for duplicates nor use
4235 (register_capture_members): Don't clear IDENTIFIER_MARKED here.
4237 2019-03-21 Paolo Carlini <paolo.carlini@oracle.com>
4240 * method.c (after_nsdmi_defaulted_late_checks): Avoid passing
4241 error_mark_node to comp_except_specs.
4243 2019-03-20 Jason Merrill <jason@redhat.com>
4245 PR c++/87480 - decltype of member access in default template arg
4246 * pt.c (type_unification_real): Accept a dependent result in
4249 2019-03-19 Martin Sebor <msebor@redhat.com>
4251 PR tree-optimization/89688
4252 * typeck2.c (store_init_value): Call braced_lists_to_string for more
4253 kinds of initializers.
4255 2019-03-18 Jason Merrill <jason@redhat.com>
4257 PR c++/89630 - ICE with dependent using-decl as template arg.
4258 * tree.c (cp_tree_equal): Always return false for USING_DECL.
4260 PR c++/89761 - ICE with sizeof... in pack expansion.
4261 * pt.c (argument_pack_element_is_expansion_p): Handle
4262 ARGUMENT_PACK_SELECT.
4264 PR c++/89640 - GNU attributes on lambda.
4265 * parser.c (cp_parser_lambda_declarator_opt): Allow GNU attributes.
4267 PR c++/89682 - wrong access error in default argument.
4268 * pt.c (tsubst_default_argument): Don't defer access checks.
4270 2019-03-18 Paolo Carlini <paolo.carlini@oracle.com>
4273 * semantics.c (finish_non_static_data_member): Check return value
4274 of context_for_name_lookup and immediately return error_mark_node
4277 2019-03-17 Jason Merrill <jason@redhat.com>
4279 PR c++/89571 - ICE with ill-formed noexcept on constructor.
4280 * pt.c (maybe_instantiate_noexcept): Only return false if defaulted.
4281 (regenerate_decl_from_template): Use it for noexcept-specs.
4283 2019-03-14 Jason Merrill <jason@redhat.com>
4285 * parser.c (cp_parser_decl_specifier_seq): Support C++20
4286 concept-definition syntax without 'bool'.
4288 2019-03-14 Jakub Jelinek <jakub@redhat.com>
4291 * semantics.c (finish_qualified_id_expr): Reject variable templates.
4294 * constexpr.c (struct constexpr_ctx): Change save_exprs type from
4295 hash_set<tree> to vec<tree>.
4296 (cxx_eval_call_expression): Adjust for save_exprs being a vec instead
4298 (cxx_eval_loop_expr): Likewise. Truncate the vector after each
4299 removal of SAVE_EXPRs from values.
4300 (cxx_eval_constant_expression) <case SAVE_EXPR>: Call safe_push
4301 method on save_exprs instead of add.
4303 2019-03-13 Jason Merrill <jason@redhat.com>
4305 PR c++/86521 - C++17 copy elision in initialization by constructor.
4306 * call.c (joust_maybe_elide_copy): New.
4309 2019-03-13 Marek Polacek <polacek@redhat.com>
4311 PR c++/88979 - further P0634 fix for constructors.
4312 * parser.c (cp_parser_decl_specifier_seq): Pass flags to
4313 cp_parser_constructor_declarator_p.
4314 (cp_parser_direct_declarator): Allow missing typename for constructor
4316 (cp_parser_constructor_declarator_p): Add FLAGS parameter. Pass it to
4317 cp_parser_type_specifier.
4319 PR c++/89686 - mixing init-capture and simple-capture in lambda.
4320 * parser.c (cp_parser_lambda_introducer): Give error when combining
4321 init-capture and simple-capture.
4323 PR c++/89660 - bogus error with -Wredundant-move.
4324 * typeck.c (maybe_warn_pessimizing_move): Only accept (T &) &arg
4325 as the std::move's argument. Don't call convert_for_initialization
4326 when warn_redundant_move isn't on.
4328 2019-03-11 Jason Merrill <jason@redhat.com>
4330 PR c++/86521 - wrong overload resolution with ref-qualifiers.
4331 * call.c (build_user_type_conversion_1): Don't use a conversion to a
4332 reference of the wrong rvalueness for direct binding.
4334 2019-03-11 Martin Liska <mliska@suse.cz>
4336 * cvt.c (build_expr_type_conversion): Wrap apostrophes
4337 in gcc internal format with %'.
4338 * decl.c (check_no_redeclaration_friend_default_args): Likewise.
4339 (grokfndecl): Likewise.
4340 * name-lookup.c (do_pushtag): Likewise.
4341 * pt.c (unify_parameter_deduction_failure): Likewise.
4342 (unify_template_deduction_failure): Likewise.
4344 2019-03-11 Martin Liska <mliska@suse.cz>
4346 * call.c (convert_arg_to_ellipsis): Wrap an option name
4347 in a string format message and fix GNU coding style.
4348 (build_over_call): Likewise.
4349 * class.c (check_field_decl): Likewise.
4350 (layout_nonempty_base_or_field): Likewise.
4351 * constexpr.c (cxx_eval_loop_expr): Likewise.
4352 * cvt.c (type_promotes_to): Likewise.
4353 * decl.c (cxx_init_decl_processing): Likewise.
4354 (mark_inline_variable): Likewise.
4355 (grokdeclarator): Likewise.
4356 * decl2.c (record_mangling): Likewise.
4357 * error.c (maybe_warn_cpp0x): Likewise.
4358 * except.c (doing_eh): Likewise.
4359 * mangle.c (maybe_check_abi_tags): Likewise.
4360 * parser.c (cp_parser_diagnose_invalid_type_name): Likewise.
4361 (cp_parser_userdef_numeric_literal): Likewise.
4362 (cp_parser_primary_expression): Likewise.
4363 (cp_parser_unqualified_id): Likewise.
4364 (cp_parser_pseudo_destructor_name): Likewise.
4365 (cp_parser_builtin_offsetof): Likewise.
4366 (cp_parser_lambda_expression): Likewise.
4367 (cp_parser_lambda_introducer): Likewise.
4368 (cp_parser_lambda_declarator_opt): Likewise.
4369 (cp_parser_selection_statement): Likewise.
4370 (cp_parser_init_statement): Likewise.
4371 (cp_parser_decomposition_declaration): Likewise.
4372 (cp_parser_function_specifier_opt): Likewise.
4373 (cp_parser_static_assert): Likewise.
4374 (cp_parser_simple_type_specifier): Likewise.
4375 (cp_parser_namespace_definition): Likewise.
4376 (cp_parser_using_declaration): Likewise.
4377 (cp_parser_ctor_initializer_opt_and_function_body): Likewise.
4378 (cp_parser_initializer_list): Likewise.
4379 (cp_parser_type_parameter_key): Likewise.
4380 (cp_parser_member_declaration): Likewise.
4381 (cp_parser_try_block): Likewise.
4382 (cp_parser_std_attribute_spec): Likewise.
4383 (cp_parser_requires_clause_opt): Likewise.
4384 * pt.c (check_template_variable): Likewise.
4385 (check_default_tmpl_args): Likewise.
4386 (push_tinst_level_loc): Likewise.
4387 (instantiate_pending_templates): Likewise.
4388 (invalid_nontype_parm_type_p): Likewise.
4389 * repo.c (get_base_filename): Likewise.
4390 * rtti.c (typeid_ok_p): Likewise.
4391 (build_dynamic_cast_1): Likewise.
4392 * tree.c (maybe_warn_parm_abi): Likewise.
4394 2019-03-08 Jakub Jelinek <jakub@redhat.com>
4397 * parser.c (cp_parser_template_declaration_after_parameters): Avoid
4398 one space before " at the end of line and another after " on another
4399 line in a string literal.
4401 PR tree-optimization/89550
4402 * semantics.c (maybe_convert_cond): Only set TREE_NO_WARNING if
4403 warning_at returned true.
4404 * decl2.c (c_parse_final_cleanups): Likewise.
4405 * typeck.c (convert_for_assignment): Likewise.
4406 * decl.c (finish_function): Likewise.
4409 * parser.c (cp_parser_asm_definition): Just warn instead of error
4410 on volatile qualifier outside of function body.
4413 * constexpr.c (potential_constant_expression_1): Reject
4414 REINTERPRET_CAST_P NOP_EXPRs.
4417 * call.c (joust): Call print_z_candidate only if pedwarn returned
4420 2019-03-07 Jason Merrill <jason@redhat.com>
4422 PR c++/88123 - lambda and using-directive.
4423 * name-lookup.c (op_unqualified_lookup)
4424 (maybe_save_operator_binding, discard_operator_bindings)
4425 (push_operator_bindings): New.
4426 * typeck.c (build_x_binary_op, build_x_unary_op): Call
4427 maybe_save_operator_binding.
4428 * decl.c (start_preparsed_function): Call push_operator_bindings.
4429 * tree.c (cp_free_lang_data): Call discard_operator_bindings.
4431 PR c++/88820 - ICE with CTAD and member template used in DMI.
4432 * pt.c (do_class_deduction): Handle parm used as its own arg.
4434 2019-03-07 Jakub Jelinek <jakub@redhat.com>
4437 * parser.c (cp_parser_asm_definition): Parse asm qualifiers even
4438 at toplevel, but diagnose them.
4440 2019-03-06 Jason Merrill <jason@redhat.com>
4442 PR c++/89381 - implicit copy and using-declaration.
4443 * class.c (classtype_has_move_assign_or_move_ctor_p): Don't consider
4444 op= brought in by a using-declaration.
4446 2019-03-06 Jakub Jelinek <jakub@redhat.com>
4449 * init.c (build_value_init_noctor): Ignore flexible array members.
4451 2019-03-06 Jason Merrill <jason@redhat.com>
4453 PR c++/89576 - if constexpr of lambda capture.
4454 * semantics.c (maybe_convert_cond): Do convert a non-dependent
4455 condition in a template.
4456 * typeck.c (condition_conversion): Handle being called in a
4459 2019-03-06 Marek Polacek <polacek@redhat.com>
4461 PR c++/87378 - bogus -Wredundant-move warning.
4462 * typeck.c (maybe_warn_pessimizing_move): See if the maybe-rvalue
4463 overload resolution would actually succeed.
4465 2019-03-05 Jason Merrill <jason@redhat.com>
4467 * class.c (is_really_empty_class): Add ignore_vptr parm.
4468 (trivial_default_constructor_is_constexpr): Pass it.
4469 * call.c (build_over_call): Pass it.
4470 * constexpr.c (cxx_eval_constant_expression): Pass it instead of
4471 checking TYPE_POLYMORPHIC_P.
4472 (cxx_eval_component_reference, potential_constant_expression_1):
4474 * cp-gimplify.c (simple_empty_class_p): Pass it.
4475 * init.c (expand_aggr_init_1): Pass it.
4477 2019-03-04 Paolo Carlini <paolo.carlini@oracle.com>
4480 * parser.c (cp_parser_class_head): Reject TYPE_BEING_DEFINED too.
4482 2019-03-04 Jakub Jelinek <jakub@redhat.com>
4485 * call.c (field_in_pset): New function.
4486 (build_aggr_conv): Handle CONSTRUCTOR_IS_DESIGNATED_INIT correctly.
4488 2019-03-02 Jakub Jelinek <jakub@redhat.com>
4491 * cp-tree.h (CONSTRUCTOR_IS_DESIGNATED_INIT): Define.
4492 * parser.c (cp_parser_braced_list): Adjust cp_parser_initializer_list
4493 caller, set CONSTRUCTOR_IS_DESIGNATED_INIT.
4494 (cp_parser_initializer_list): Add designated parameter, set *designated
4495 to a bool whether any designators were parsed.
4496 * decl.c (reshape_init): Copy over CONSTRUCTOR_IS_DESIGNATED_INIT if
4498 * pt.c (tsubst_copy_and_build): Likewise.
4499 * call.c (implicit_conversion): If CONSTRUCTOR_IS_DESIGNATED_INIT,
4500 don't call build_list_conv, nor build_complex_conv, nor attempt to
4501 convert a single element initializer to scalar.
4503 2019-03-01 Marek Polacek <polacek@redhat.com>
4505 PR c++/89537 - missing location for error with non-static member fn.
4506 * call.c (resolve_args): Use EXPR_LOCATION.
4507 * typeck.c (build_class_member_access_expr): Use input_location.
4509 PR c++/89532 - ICE with incomplete type in decltype.
4510 * semantics.c (finish_compound_literal): Return error_mark_node
4511 if digest_init_flags returns error_mark_node.
4513 2019-03-01 Jakub Jelinek <jakub@redhat.com>
4515 Implement P1002R1, Try-catch blocks in constexpr functions
4517 * parser.c (cp_parser_ctor_initializer_opt_and_function_body):
4518 Diagnose constexpr ctor or function with function-try-block with
4519 pedwarn for c++17 and earlier. Formatting fix.
4520 (cp_parser_try_block): Use pedwarn instead of error and only for
4521 c++17 and earlier when try block appears in constexpr function.
4522 * constexpr.c (build_constexpr_constructor_member_initializers):
4523 Handle TRY_BLOCK here instead of erroring on it.
4525 2019-02-28 Jason Merrill <jason@redhat.com>
4527 PR c++/88183 - ICE with .* fold-expression.
4528 * pt.c (fold_expression) [DOTSTAR_EXPR]: Remove special handling.
4530 PR c++/86969 - ICE with constexpr if and recursive generic lambdas.
4531 * class.c, lambda.c, pt.c: Revert earlier change.
4532 * lambda.c (add_capture): Don't special-case capture of dependent
4535 * name-lookup.c (print_binding_level): Print this_entity.
4537 2019-02-27 Marek Polacek <polacek@redhat.com>
4539 PR c++/88857 - ICE with value-initialization of argument in template.
4540 * call.c (convert_like_real): Don't call build_value_init in template.
4542 2019-02-27 Jason Merrill <jason@redhat.com>
4544 PR c++/86969 - ICE with constexpr if and recursive generic lambdas.
4545 * semantics.c (process_outer_var_ref): Do capture dependent vars.
4546 * class.c (finish_struct): Only add TAG_DEFN if T is in
4547 current_function_decl.
4548 * lambda.c (vla_capture_type): Force the capture type out into the
4549 lambda's enclosing function.
4550 (add_capture): Pass in the lambda.
4551 * pt.c (tsubst_lambda_expr): complete_type a VLA capture type.
4553 2019-02-27 Marek Polacek <polacek@redhat.com>
4555 PR c++/89511 - ICE with using-declaration and unscoped enumerator.
4556 * parser.c (cp_parser_using_declaration): For an unscoped enum
4557 only use its context if it's not a function declaration.
4559 2019-02-27 Paolo Carlini <paolo.carlini@oracle.com>
4562 * method.c (process_subob_fn): When maybe_instantiate_noexcept
4563 returns false don't call merge_exception_specifiers.
4565 2019-02-27 Paolo Carlini <paolo.carlini@oracle.com>
4568 * parser.c (cp_parser_noexcept_specification_opt): Return NULL_TREE
4569 for a non-constant parsed expression.
4571 2019-02-26 Jakub Jelinek <jakub@redhat.com>
4574 * constexpr.c (cxx_eval_store_expression): When changing active union
4575 member, set no_zero_init.
4577 2019-02-23 Marek Polacek <polacek@redhat.com>
4579 PR c++/88294 - ICE with non-constant noexcept-specifier.
4580 * pt.c (maybe_instantiate_noexcept): Set up the list of local
4581 specializations. Set current_class_{ptr,ref}.
4583 2019-02-22 David Malcolm <dmalcolm@redhat.com>
4586 * parser.c (cp_parser_unqualified_id): Capture and use locations
4589 2019-02-22 Marek Polacek <polacek@redhat.com>
4591 PR c++/89420 - ICE with CAST_EXPR in explicit-specifier.
4592 * decl.c (build_explicit_specifier): Don't check
4593 processing_template_decl. Call instantiation_dependent_expression_p
4594 instead of value_dependent_expression_p. Call
4595 instantiate_non_dependent_expr_sfinae before
4596 build_converted_constant_expr instead of calling
4597 instantiate_non_dependent_expr after it. Add
4598 processing_template_decl_sentinel.
4600 2019-02-22 Thomas Schwinge <thomas@codesourcery.com>
4602 * parser.c (cp_parser_oacc_simple_clause): Remove parser formal
4603 parameter, move loc formal parameter to the front. Adjust all
4605 (cp_parser_oacc_shape_clause): Add loc formal parameter. Adjust
4608 2019-02-21 Jason Merrill <jason@redhat.com>
4610 PR c++/87685 - generic lambda 'this' capture error.
4611 * lambda.c (lambda_expr_this_capture): Change add_capture_p to int.
4612 (maybe_generic_this_capture): Pass -1.
4614 PR c++/88394 - ICE with VLA init-capture.
4615 * lambda.c (is_normal_capture_proxy): Check DECL_CAPTURED_VARIABLE.
4617 PR c++/88869 - C++17 ICE with CTAD and explicit specialization.
4618 * pt.c (do_class_deduction): Don't include explicit specialization
4621 PR c++/89422 - ICE with -g and lambda in default arg in template.
4622 * pt.c (tsubst_function_decl): SET_DECL_FRIEND_CONTEXT sooner.
4624 2019-02-21 Jason Merrill <jason@redhat.com>
4626 PR c++/88419 - C++17 ICE with class template arg deduction.
4627 * pt.c (make_template_placeholder): Set TYPE_CANONICAL after
4628 CLASS_PLACEHOLDER_TEMPLATE.
4630 2019-02-21 Jakub Jelinek <jakub@redhat.com>
4633 * constexpr.c (struct constexpr_fundef): Add parms and result members.
4634 (retrieve_constexpr_fundef): Adjust for the above change.
4635 (register_constexpr_fundef): Save constexpr body with copy_fn,
4636 temporarily set DECL_CONTEXT on DECL_RESULT before that.
4637 (get_fundef_copy): Change FUN argument to FUNDEF with
4638 constexpr_fundef * type, grab body and parms/result out of
4639 constexpr_fundef struct and temporarily change it for copy_fn calls
4641 (cxx_eval_builtin_function_call): For __builtin_FUNCTION temporarily
4642 adjust current_function_decl from ctx->call context. Test
4643 !potential_constant_expression instead of !is_constant_expression.
4644 (cxx_bind_parameters_in_call): Grab parameters from new_call. Undo
4645 convert_for_arg_passing changes for TREE_ADDRESSABLE type passing.
4646 (cxx_eval_call_expression): Adjust get_fundef_copy caller.
4647 (cxx_eval_conditional_expression): For IF_STMT, allow then or else
4648 operands to be NULL.
4649 (label_matches): Handle BREAK_STMT and CONTINUE_STMT.
4650 (cxx_eval_loop_expr): Add support for FOR_STMT, WHILE_STMT and DO_STMT.
4651 (cxx_eval_switch_expr): Add support for SWITCH_STMT.
4652 (cxx_eval_constant_expression): Handle IF_STMT, FOR_STMT, WHILE_STMT,
4653 DO_STMT, CONTINUE_STMT, SWITCH_STMT, BREAK_STMT and CONTINUE_STMT.
4654 For SIZEOF_EXPR, recurse on the result of fold_sizeof_expr. Ignore
4655 DECL_EXPR with USING_DECL operand.
4656 * lambda.c (maybe_add_lambda_conv_op): Build thisarg using
4657 build_int_cst to make it a valid constant expression.
4659 2019-02-20 Jason Merrill <jason@redhat.com>
4661 PR c++/88690 - C++17 ICE with empty base in aggregate.
4662 * typeck2.c (process_init_constructor_record): Skip trivial
4663 initialization of an empty base.
4665 2019-02-21 Richard Biener <rguenther@suse.de>
4668 * vtable-class-hierarchy.c (vtv_generate_init_routine): Do not
4669 make symtab process new functions here.
4671 2019-02-20 Jason Merrill <jason@redhat.com>
4673 PR c++/87921 - wrong error with inline static data member.
4674 * decl2.c (finish_static_data_member_decl): Don't set DECL_IN_AGGR_P
4675 for a non-template inline variable. Do nothing for an
4676 already-instantiated variable.
4677 (c_parse_final_cleanups): Check DECL_IN_AGGR_P without
4679 * decl.c (check_initializer): Likewise.
4680 (make_rtl_for_nonlocal_decl): Likewise.
4681 * pt.c (instantiate_decl): Likewise.
4682 * typeck2.c (store_init_value): Likewise.
4684 2019-02-20 Jakub Jelinek <jakub@redhat.com>
4687 * decl2.c (c_parse_final_cleanups): Move TREE_ASM_WRITTEN setting
4688 for flag_syntax_only from here...
4689 * semantics.c (expand_or_defer_fn_1): ... here.
4692 * decl.c (maybe_commonize_var): When clearing TREE_PUBLIC and
4693 DECL_COMMON, set DECL_INTERFACE_KNOWN.
4696 * constexpr.c (cxx_eval_store_expression): Diagnose changing of active
4697 union member for -std=c++17 and earlier.
4699 2019-02-19 Jason Merrill <jason@redhat.com>
4701 PR c++/87513 - 'sorry' mangling PMF template-id.
4702 * mangle.c (write_expression): Handle SCOPE_REF to BASELINK.
4704 2019-02-19 Jason Merrill <jason@redhat.com>
4706 PR c++/88380 - wrong-code with flexible array and NSDMI.
4707 * typeck2.c (process_init_constructor_record): Skip flexarrays.
4709 2019-02-20 will wray <wjwray@gmail.com>
4711 PR c++/88572 - wrong handling of braces on scalar init.
4712 * decl.c (reshape_init_r): Allow braces around scalar initializer
4713 within aggregate init. Reject double braced-init of scalar
4716 2019-02-20 Paolo Carlini <paolo.carlini@oracle.com>
4719 * pt.c (tsubst_init): Diagnose an initializer expanding to an
4720 empty list of expressions; tweak wrt dependent types.
4721 (regenerate_decl_from_template): For VAR_DECLs call tsubst_init
4722 instead of tsubst_expr.
4724 2019-02-19 Jason Merrill <jason@redhat.com>
4726 PR c++/88368 - wrong 'use of deleted function'
4727 * method.c (walk_field_subobs): Remember errors from get_nsdmi.
4728 (get_defaulted_eh_spec): Call push_tinst_level.
4729 * pt.c (maybe_instantiate_noexcept): Keep error_mark_node.
4730 * typeck2.c (merge_exception_specifiers): Handle error_mark_node.
4732 2019-02-19 Chung-Lin Tang <cltang@codesourcery.com>
4735 * parser.c (cp_parser_oacc_clause_wait): Add representation of wait
4736 clause without argument as 'wait (GOMP_ASYNC_NOVAL)', adjust comments.
4738 2019-02-19 Jakub Jelinek <jakub@redhat.com>
4741 * lambda.c (maybe_generic_this_capture): Don't check
4742 DECL_NONSTATIC_MEMBER_FUNCTION_P on USING_DECLs.
4745 * typeck.c (build_reinterpret_cast_1): Don't handle void to
4746 && conversion go through build_target_expr_with_type.
4749 * error.c (qualified_name_lookup_error): Only call
4750 suggest_alternative_in_scoped_enum if name is IDENTIFIER_NODE.
4752 2019-02-19 Tom Honermann <tom@honermann.net>
4754 * name-lookup.c (get_std_name_hint): Added u8string as a name hint.
4756 2019-02-18 Jason Merrill <jason@redhat.com>
4758 PR c++/89336 - multiple stores in constexpr stmt.
4759 * constexpr.c (cxx_eval_store_expression): Preevaluate scalar or
4762 * pt.c (check_explicit_specialization): If the declarator is a
4763 template-id, only check whether the arguments are dependent.
4765 Improve duplicate [[likely]] diagnostic.
4766 * parser.c (cp_parser_statement): Make attrs_loc a range. Pass it
4767 to process_stmt_hotness_attribute.
4768 * cp-gimplify.c (process_stmt_hotness_attribute): Take attrs_loc.
4769 (genericize_if_stmt): Use likely/unlikely instead of predictor_name.
4771 2019-02-17 Marek Polacek <polacek@redhat.com>
4773 PR c++/89217 - ICE with list-initialization in range-based for loop.
4774 * constexpr.c (unshare_constructor): No longer static.
4775 * cp-tree.h (unshare_constructor): Declare.
4776 * semantics.c (finish_compound_literal): When dealing with a
4777 non-dependent expression in a template, return the original
4778 expression. Pass LOOKUP_NO_NARROWING to digest_init_flags.
4780 2019-02-13 Marek Polacek <polacek@redhat.com>
4782 PR c++/89297 - ICE with OVERLOAD in template.
4783 * semantics.c (finish_compound_literal): Call
4784 instantiate_non_dependent_expr_sfinae.
4786 2019-02-13 Alexandre Oliva <aoliva@redhat.com>
4789 * cp-tree.h (USING_DECL_SCOPE): Use result rather than type.
4790 * name-lookup.c (strip_using_decl): Use USING_DECL_SCOPE.
4791 * search.c (protected_accessible_p): Follow USING_DECL_DECLS.
4792 (shared_member_p): Likewise.
4793 (lookup_member): Likewise.
4794 * decl.c (grok_special_member_properties): Skip USING_DECLs.
4795 * semantics.c (finish_omp_declare_simd_methods): Likewise.
4796 (finish_qualified_id_expr): Do not call shared_member_p with
4800 * pt.c (tsubst_lambda_expr): Avoid duplicate tsubsting.
4801 Move cp_evaluated resetting before signature tsubsting.
4802 (gen_elem_of_pack_expansion_instantiation): Separate local
4803 specializations per index.
4805 2019-02-13 David Malcolm <dmalcolm@redhat.com>
4808 * class.c (add_method): Drop destructor assertion.
4810 2019-02-13 Paolo Carlini <paolo.carlini@oracle.com>
4813 * decl.c (make_typename_type): Allow for TYPE_PACK_EXPANSION as
4814 context (the first argument).
4815 * pt.c (tsubst, case TYPENAME_TYPE): Handle TYPE_PACK_EXPANSION
4818 2019-02-12 Jason Merrill <jason@redhat.com>
4820 PR c++/89144 - link error with constexpr initializer_list.
4821 * call.c (convert_like_real) [ck_list]: Don't allocate a temporary
4822 array for an empty list.
4823 * typeck2.c (store_init_value): Don't use cxx_constant_init in a
4826 2019-02-11 Jason Merrill <jason@redhat.com>
4828 PR c++/89241 - ICE with __func__ in lambda in template.
4829 * pt.c (enclosing_instantiation_of): Also check
4830 instantiated_lambda_fn_p for the template context.
4832 2019-02-11 Marek Polacek <polacek@redhat.com>
4834 PR c++/89212 - ICE converting nullptr to pointer-to-member-function.
4835 * pt.c (tsubst_copy_and_build) <case CONSTRUCTOR>: Return early for
4836 null member pointer value.
4838 2019-02-11 Jakub Jelinek <jakub@redhat.com>
4841 * pt.c (convert_nontype_argument): Pass true as manifestly_const_eval
4842 to maybe_constant_value calls.
4844 2019-02-11 Marek Polacek <polacek@redhat.com>
4846 * typeck2.c (digest_init_r): Remove commented code.
4848 2019-02-11 Martin Sebor <msebor@redhat.com>
4851 * decl.c (compute_array_index_type_loc): Preserve signed sizes
4852 for diagnostics. Call valid_array_size_p instead of error.
4853 * init.c (build_new_1): Compute size for diagnostic. Call
4854 invalid_array_size_error
4855 (build_new): Call valid_array_size_p instead of error.
4857 2019-02-07 Alexandre Oliva <aoliva@redhat.com>
4860 * call.c (compare_ics): Deal with ck_aggr in either cs.
4862 2019-02-06 David Malcolm <dmalcolm@redhat.com>
4865 * call.c (get_location_for_expr_unwinding_for_system_header): New
4867 (conversion_null_warnings): Use it when getting locations for
4868 EXPR, effectively adding a call to
4869 get_location_for_expr_unwinding_for_system_header for
4870 -Wconversion-null and making use of EXPR_LOCATION for
4871 -Wzero-as-null-pointer-constant.
4873 2019-02-05 Jakub Jelinek <jakub@redhat.com>
4876 * optimize.c (maybe_thunk_body): Clear TREE_ADDRESSABLE on
4877 PARM_DECLs of the thunk.
4878 * lambda.c (maybe_add_lambda_conv_op): Likewise.
4880 2019-02-05 Marek Polacek <polacek@redhat.com>
4882 PR c++/89158 - by-value capture of constexpr variable broken.
4883 * call.c (convert_like_real) <case ck_user>: Call mark_exp_read
4884 instead of mark_rvalue_use.
4886 2019-02-05 Alexandre Oliva <aoliva@redhat.com>
4889 * pt.c (instantiates_primary_template_p): New.
4890 (type_dependent_expression_p): Use it.
4892 2019-02-01 Jason Merrill <jason@redhat.com>
4894 PR c++/88761 - ICE with reference capture of constant.
4895 * lambda.c (mark_const_cap_r): Do walk subtrees of DECL_EXPR for
4898 2019-02-01 Marek Polacek <polacek@redhat.com>
4900 PR c++/88325 - ICE with invalid out-of-line template member definition.
4901 * parser.c (cp_parser_class_name): Don't call make_typename_type
4904 2019-02-01 Jakub Jelinek <jakub@redhat.com>
4907 * parser.c (cp_parser_gnu_attributes_opt): Set ok to false
4908 if require_open failed.
4910 2019-01-31 Marek Polacek <polacek@redhat.com>
4912 PR c++/89083, c++/80864 - ICE with list initialization in template.
4913 * constexpr.c (adjust_temp_type): Use copy_node and change the type
4914 instead of using build_constructor.
4915 * decl.c (reshape_init_r): Don't reshape a digested initializer.
4916 Return the initializer for COMPOUND_LITERAL_P.
4918 PR c++/88983 - ICE with switch in constexpr function.
4919 * constexpr.c (cxx_eval_switch_expr): Use SWITCH_COND and SWITCH_BODY.
4920 (cxx_eval_constant_expression) <case COND_EXPR>: Don't look for the
4921 label in the else branch if we found it in the then branch.
4923 2019-01-30 Jason Merrill <jason@redhat.com>
4925 PR c++/88752 - ICE with lambda and constexpr if.
4926 * cp-tree.h (LAMBDA_EXPR_INSTANTIATED): New.
4927 * pt.c (tsubst_lambda_expr): Set it.
4928 (instantiated_lambda_fn_p): Check it.
4929 (enclosing_instantiation_of): Use it.
4931 2019-01-31 Jakub Jelinek <jakub@redhat.com>
4934 * cxx-pretty-print.c (pp_cxx_enumeration_constant): Print always as
4935 a C cast in pp_c_flag_gnu_v3 mode.
4937 2019-01-30 Jakub Jelinek <jakub@redhat.com>
4940 * lambda.c (is_capture_proxy): Don't return true for
4941 DECL_OMP_PRIVATIZED_MEMBER artificial vars.
4943 2019-01-30 Marek Polacek <polacek@redhat.com>
4945 PR c++/89119 - ICE with value-initialization in template.
4946 * pt.c (tsubst_copy_and_build): Handle RANGE_EXPR.
4948 2019-01-29 Jason Merrill <jason@redhat.com>
4950 PR c++/86943 - wrong code converting lambda to function pointer.
4951 * lambda.c (maybe_add_lambda_conv_op): Use a template-id in the
4952 call. Only forward parms for decltype.
4953 * pt.c (tsubst_copy_and_build) [CALL_EXPR]: Handle CALL_FROM_THUNK_P
4955 * typeck.c (check_return_expr): Don't mess with a thunk call.
4957 2019-01-28 Jason Merrill <jason@redhat.com>
4959 PR c++/89089 - ICE with [[no_unique_address]].
4960 PR c++/88865 - wrong layout with [[no_unique_address]].
4961 * class.c (check_field_decls): A potentially-overlapping field makes
4962 the class non-layout-POD, but not non-empty.
4963 (end_of_class): Always consider empty data members.
4964 (layout_class_type): Set DECL_SIZE for empty fields.
4966 2019-01-28 Marek Polacek <polacek@redhat.com>
4968 PR c++/88358 - name wrongly treated as type.
4969 * parser.c (cp_parser_direct_declarator): Don't assume a qualified-id
4970 in parameter-list is a type if the function's declarator-id is not
4973 2019-01-27 Marek Polacek <polacek@redhat.com>
4975 PR c++/88815 - narrowing conversion lost in decltype.
4976 PR c++/78244 - narrowing conversion in template not detected.
4977 * cp-tree.h (CONSTRUCTOR_IS_DEPENDENT): New.
4978 * pt.c (instantiation_dependent_r): Consider a CONSTRUCTOR with
4979 CONSTRUCTOR_IS_DEPENDENT instantiation-dependent.
4980 * semantics.c (finish_compound_literal): When the compound literal
4981 isn't instantiation-dependent and the type isn't type-dependent,
4982 fall back to the normal processing. Set CONSTRUCTOR_IS_DEPENDENT.
4984 PR c++/89024 - ICE with incomplete enum type.
4985 * call.c (standard_conversion): When converting an
4986 ARITHMETIC_TYPE_P to an incomplete type, return NULL.
4988 2019-01-25 Paolo Carlini <paolo.carlini@oracle.com>
4991 * call.c (build_op_delete_call): Implement 7.6.2.5/(10.1).
4992 * decl2.c (coerce_delete_type): Use build_pointer_type instead
4995 2019-01-24 Jason Merrill <jason@redhat.com>
4997 PR c++/89001 - mangling of reference temporaries
4998 * cp-tree.h (struct saved_scope): Add ref_temp_count.
4999 (current_ref_temp_count): New macro.
5000 * mangle.c (mangle_ref_init_variable): Use it.
5001 * typeck2.c (store_init_value): Clear it.
5002 * call.c (make_temporary_var_for_ref_to_temp): Copy public and
5005 2019-01-24 Jakub Jelinek <jakub@redhat.com>
5008 * semantics.c (finish_omp_cancel): Diagnose more than one if
5009 on #pragma omp cancel with different modifiers. Use
5010 maybe_convert_cond when not in template or build_x_binary_op
5013 2019-01-23 Marek Polacek <polacek@redhat.com>
5015 PR c++/88757 - qualified name treated wrongly as type.
5016 * parser.c (cp_parser_direct_declarator): Don't treat qualified-ids
5017 in parameter-list as types if name lookup for declarator-id didn't
5018 find one or more function templates.
5020 2019-01-23 Jakub Jelinek <jakub@redhat.com>
5023 * cp-gimplify.c (genericize_cp_loop): Call begin_bc_block only
5024 after genericizing cond and incr expressions.
5027 * cp-gimplify.c (genericize_switch_stmt): Move cond genericization
5028 before the begin_bc_block call.
5030 2019-01-21 Jason Merrill <jason@redhat.com>
5032 PR c++/87893 - constexpr ctor ICE on ARM.
5033 PR c++/88293 - ICE with comma expression.
5034 * constexpr.c (initialized_type): Don't shortcut non-void type.
5035 Handle COMPOUND_EXPR.
5036 (cxx_eval_outermost_constant_expr): Return early for void type.
5038 2019-01-21 Jakub Jelinek <jakub@redhat.com>
5041 * optimize.c (cxx_copy_decl): New function.
5042 (clone_body): Use it instead of copy_decl_no_change.
5045 * typeck.c (cp_build_binary_op): Don't instrument
5046 SANITIZE_POINTER_COMPARE if processing_template_decl.
5047 (pointer_diff): Similarly for SANITIZE_POINTER_SUBTRACT.
5049 2019-01-18 Jason Merrill <jason@redhat.com>
5051 PR c++/88875 - error with explicit list constructor.
5052 * call.c (reference_binding): Don't modify EXPR. Set
5053 need_temporary_p on the ck_user conversion for a temporary.
5054 (convert_like_real): Check it.
5056 2019-01-18 H.J. Lu <hongjiu.lu@intel.com>
5060 * call.c (convert_for_arg_passing): Upate the
5061 warn_for_address_or_pointer_of_packed_member call.
5062 * typeck.c (convert_for_assignment): Likewise.
5064 2019-01-17 Jason Merrill <jason@redhat.com>
5066 PR c++/86205 - ICE with ?: of throw and template-id.
5067 * pt.c (resolve_nondeduced_context_or_error): Split out from...
5068 * typeck.c (decay_conversion): ...here.
5069 * call.c (build_conditional_expr_1): Use it.
5071 PR c++/86740, ICE with constexpr if and nested generic lambdas.
5072 * tree.c (cp_walk_subtrees): Handle LAMBDA_EXPR.
5074 2019-01-17 Paolo Carlini <paolo.carlini@oracle.com>
5076 * decl.c (grokdeclarator): Use typespec_loc in error messages
5077 about 'auto' and trailing return type.
5079 2019-01-17 David Malcolm <dmalcolm@redhat.com>
5082 * class.c (add_method): Don't use DECL_DESTRUCTOR_P on
5085 2019-01-17 Nathan Sidwell <nathan@acm.org>
5088 * semantics.c (process_outer_var_ref): Only skip dependent types
5091 2019-01-17 Alexandre Oliva <aoliva@redhat.com>
5094 * cp-tree.h (saved_scope): Add suppress_location_wrappers.
5095 * name-lookup.c (do_push_to_top_level): Save and reset it.
5096 (do_pop_from_top_level): Restore it.
5099 * pt.c (make_template_placeholder): Use auto_identifier.
5100 (is_auto): Drop CLASS_PLACEHOLDER_TEMPLATE test.
5101 * error.c (dump_type): Handle template placeholders.
5102 * cxx-pretty-print.c (pp_cx_unqualified_id): Likewise.
5105 * cvt.c (convert_to_void): Handle all cdtor calls as if
5108 2019-01-16 Paolo Carlini <paolo.carlini@oracle.com>
5110 * decl.c (grokdeclarator): Use locations[ds_storage_class] in
5111 error messages about ill-formed uses of mutable.
5113 2019-01-16 Marek Polacek <polacek@redhat.com>
5115 PR c++/78244 - narrowing conversion in template not detected.
5116 * call.c (perform_implicit_conversion_flags): Set
5117 IMPLICIT_CONV_EXPR_BRACED_INIT.
5118 * cp-tree.h (IMPLICIT_CONV_EXPR_BRACED_INIT): New.
5119 * pt.c (tsubst_copy_and_build): Use it.
5121 2019-01-15 David Malcolm <dmalcolm@redhat.com>
5124 * pt.c (build_deduction_guide): Bail out if tsubst_arg_types
5127 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com>
5129 * decl.c (start_decl): Improve error location.
5130 * decl2.c (grokfield): Likewise.
5132 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com>
5134 * decl.c (grokdeclarator): Move further up the location_t loc
5135 declaration and use the location when building a TYPE_DECL for
5137 * decl2.c (grokbitfield): Use DECL_SOURCE_LOCATION in the error
5138 about an ill-formed bit-field as typedef.
5140 2019-01-14 Marek Polacek <polacek@redhat.com>
5142 PR c++/88830 - ICE with abstract class.
5143 * decl2.c (maybe_emit_vtables): Check CLASSTYPE_LAZY_DESTRUCTOR.
5146 PR c++/88825 - ICE with bogus function return type deduction.
5147 * typeck.c (can_do_nrvo_p): Check error_mark_node.
5149 2019-01-14 Tom Honermann <tom@honermann.net>
5151 Implement P0482R5, char8_t: A type for UTF-8 characters and strings
5152 * cvt.c (type_promotes_to): Handle char8_t promotion.
5153 * decl.c (grokdeclarator): Handle invalid type specifier
5154 combinations involving char8_t.
5155 * lex.c (init_reswords): Add char8_t as a reserved word.
5156 * mangle.c (write_builtin_type): Add name mangling for char8_t (Du).
5157 * parser.c (cp_keyword_starts_decl_specifier_p)
5158 (cp_parser_simple_type_specifier): Recognize char8_t as a simple
5160 (cp_parser_string_literal): Use char8_array_type_node for the type
5162 (cp_parser_set_decl_spec_type): Tolerate char8_t typedefs in system
5164 * rtti.c (emit_support_tinfos): type_info support for char8_t.
5165 * tree.c (char_type_p): Recognize char8_t as a character type.
5166 * typeck.c (string_conv_p): Handle conversions of u8 string
5167 literals of char8_t type.
5168 (check_literal_operator_args): Handle UDLs with u8 string literals
5170 * typeck2.c (ordinary_char_type_p): New.
5171 (digest_init_r): Disallow initializing a char array with a u8 string
5174 2019-01-14 Martin Liska <mliska@suse.cz>
5176 PR gcov-profile/88263
5177 * decl2.c (get_tls_wrapper_fn): Use DECL_SOURCE_LOCATION
5178 as location of the TLS wrapper.
5180 2019-01-12 Paolo Carlini <paolo.carlini@oracle.com>
5182 * decl.c (cp_finish_decl): Improve error location.
5183 * decl2.c (grokfield): Likewise, improve two locations.
5185 2019-01-11 Marek Polacek <polacek@redhat.com>
5187 PR c++/88692, c++/87882 - -Wredundant-move false positive with *this.
5188 * typeck.c (maybe_warn_pessimizing_move): Return if ARG isn't
5191 2019-01-11 Jason Merrill <jason@redhat.com>
5193 PR c++/88312 - pack expansion of decltype.
5194 * pt.c (instantiation_dependent_r): A template non-type parameter
5195 pack is instantiation-dependent.
5197 2019-01-11 Jason Merrill <jason@redhat.com>
5199 PR c++/88613 - ICE with use of const var in lambda.
5200 * expr.c (mark_use): Fix location wrapper handling.
5201 * cp-gimplify.c (cp_fold_maybe_rvalue): Call mark_rvalue_use.
5203 2019-01-11 Tobias Burnus <burnus@net-b.de>
5206 * decl2.c (maybe_emit_vtables): If needed, generate code for
5207 the destructor of an abstract class.
5208 (mark_used): Update comment for older function-name change.
5210 2019-01-11 Paolo Carlini <paolo.carlini@oracle.com>
5212 * decl.c (start_decl): Improve error location.
5213 (grokdeclarator): Likewise, improve two locations.
5215 2019-01-09 Sandra Loosemore <sandra@codesourcery.com>
5219 * cp-tree.h: Mechanically replace "can not" with "cannot".
5220 * parser.c: Likewise.
5223 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com>
5225 * decl.c (grok_reference_init): Improve error location.
5226 (grokdeclarator): Likewise, improve two locations.
5228 2019-01-08 Marek Polacek <polacek@redhat.com>
5230 PR c++/88538 - braced-init-list in template-argument-list.
5231 * parser.c (cp_parser_template_argument): Handle braced-init-list when
5234 PR c++/88548 - this accepted in static member functions.
5235 * parser.c (cp_debug_parser): Adjust printing of
5236 local_variables_forbidden_p.
5237 (cp_parser_new): Set local_variables_forbidden_p to 0 rather than false.
5238 (cp_parser_primary_expression): When checking
5239 local_variables_forbidden_p, use THIS_FORBIDDEN or
5240 LOCAL_VARS_FORBIDDEN.
5241 (cp_parser_lambda_body): Update the type of
5242 local_variables_forbidden_p. Set it to 0 rather than false.
5243 (cp_parser_condition): Adjust call to cp_parser_declarator.
5244 (cp_parser_explicit_instantiation): Likewise.
5245 (cp_parser_init_declarator): Likewise.
5246 (cp_parser_declarator): New parameter. Use it.
5247 (cp_parser_direct_declarator): New parameter. Use it to set
5248 local_variables_forbidden_p. Adjust call to cp_parser_declarator.
5249 (cp_parser_type_id_1): Adjust call to cp_parser_declarator.
5250 (cp_parser_parameter_declaration): Likewise.
5251 (cp_parser_default_argument): Update the type of
5252 local_variables_forbidden_p. Set it to LOCAL_VARS_AND_THIS_FORBIDDEN
5254 (cp_parser_member_declaration): Tell cp_parser_declarator if we saw
5255 'static' or 'friend'.
5256 (cp_parser_exception_declaration): Adjust call to cp_parser_declarator.
5257 (cp_parser_late_parsing_default_args): Update the type of
5258 local_variables_forbidden_p. Set it to LOCAL_VARS_AND_THIS_FORBIDDEN
5260 (cp_parser_cache_defarg): Adjust call to cp_parser_declarator.
5261 (cp_parser_objc_class_ivars): Likewise.
5262 (cp_parser_objc_struct_declaration): Likewise.
5263 (cp_parser_omp_for_loop_init): Likewise.
5264 * parser.h (cp_parser): Change the type of local_variables_forbidden_p
5266 (LOCAL_VARS_FORBIDDEN, LOCAL_VARS_AND_THIS_FORBIDDEN, THIS_FORBIDDEN):
5269 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com>
5271 * decl.c (start_decl): Improve permerror location.
5273 2019-01-08 Jonathan Wakely <jwakely@redhat.com>
5274 Jakub Jelinek <jakub@redhat.com>
5277 * decl.c (finish_function): For -Wreturn-type don't add a return *this;
5278 fixit hint if current_class_ref is NULL. Use a single if instead of
5281 2019-01-07 Paolo Carlini <paolo.carlini@oracle.com>
5283 * decl.c (start_decl): Improve two error_at locations.
5284 (expand_static_init): Likewise.
5286 2019-01-07 Marek Polacek <polacek@redhat.com>
5288 PR c++/88741 - wrong error with initializer-string.
5289 * decl.c (cp_complete_array_type): Strip any location wrappers.
5291 2019-01-07 Bernd Edlinger <bernd.edlinger@hotmail.de>
5297 * cp-tree.h (LOOKUP_ALLOW_FLEXARRAY_INIT): New flag value.
5298 * typeck2.c (digest_init_r): Raise an error for non-static
5299 initialization of a flexible array member.
5300 (process_init_constructor, massage_init_elt,
5301 process_init_constructor_array, process_init_constructor_record,
5302 process_init_constructor_union, process_init_constructor): Add the
5303 flags parameter and pass it thru.
5304 (store_init_value): Pass LOOKUP_ALLOW_FLEXARRAY_INIT parameter to
5305 digest_init_flags for static decls.
5307 2019-01-07 Jakub Jelinek <jakub@redhat.com>
5310 * cp-tree.h (cp_build_vec_convert): Declare.
5311 * parser.c (cp_parser_postfix_expression): Parse
5312 __builtin_convertvector.
5313 * constexpr.c: Include fold-const-call.h.
5314 (cxx_eval_internal_function): Handle IFN_VEC_CONVERT.
5315 (potential_constant_expression_1): Likewise.
5316 * semantics.c (cp_build_vec_convert): New function.
5317 * pt.c (tsubst_copy_and_build): Handle CALL_EXPR to
5320 2019-01-03 Jakub Jelinek <jakub@redhat.com>
5323 * decl.c (builtin_function_1): Return result of pushdecl_top_level
5324 or pushdecl rather than decl.
5326 2019-01-03 Paolo Carlini <paolo.carlini@oracle.com>
5328 * tree.c (handle_nodiscard_attribute): Improve warning location.
5330 2019-01-02 Marek Polacek <polacek@redhat.com>
5332 PR c++/88612 - ICE with -Waddress-of-packed-member.
5333 * call.c (convert_for_arg_passing): Only give warnings with tf_warning.
5334 * typeck.c (convert_for_assignment): Likewise.
5336 PR c++/88631 - CTAD failing for value-initialization.
5337 * typeck2.c (build_functional_cast): Try deducing the template
5338 arguments even if there are no arguments to deduce from.
5340 2019-01-01 Jakub Jelinek <jakub@redhat.com>
5342 Update copyright years.
5344 Copyright (C) 2019 Free Software Foundation, Inc.
5346 Copying and distribution of this file, with or without modification,
5347 are permitted in any medium without royalty provided the copyright
5348 notice and this notice are preserved.