1 2019-12-05 David Edelsohn <dje.gcc@gmail.com>
3 * cp-gimplify.c: Include memmodel.h.
5 2019-12-05 Paolo Carlini <paolo.carlini@oracle.com>
7 * typeck2.c (build_functional_cast): Add location_t parameter
9 * cp-tree.h: Update declaration.
10 * parser.c (cp_parser_functional_cast): Adjust call.
11 * call.c (build_op_delete_call): Likewise.
12 (build_new_method_call_1): Likewise.
13 * decl.c (check_initializer): Likewise.
14 * pt.c (tsubst_copy_and_build): Likewise.
15 * semantics.c (finish_compound_literal): Likewise.
17 2019-12-04 David Edelsohn <dje.gcc@gmail.com>
19 * cp-gimplify.c: Include tm_p.h.
21 2019-12-04 Marek Polacek <polacek@redhat.com>
23 * parser.c (enum primary_constraint_error): Remove stray comma.
25 2019-12-04 Richard Sandiford <richard.sandiford@arm.com>
27 * cp-tree.h (CP_AGGREGATE_TYPE_P): Check for gnu_vector_type_p
28 instead of VECTOR_TYPE.
29 * call.c (build_conditional_expr_1): Restrict vector handling
30 to vectors that satisfy gnu_vector_type_p.
31 * cvt.c (ocp_convert): Only allow vectors to be converted
32 to bool if they satisfy gnu_vector_type_p.
33 (build_expr_type_conversion): Only allow conversions from
34 vectors if they satisfy gnu_vector_type_p.
35 * typeck.c (cp_build_binary_op): Only allow binary operators to be
36 applied to vectors if they satisfy gnu_vector_type_p.
37 (cp_build_unary_op): Likewise unary operators.
38 (build_reinterpret_cast_1):
40 2019-12-03 Jakub Jelinek <jakub@redhat.com>
42 * cp-tree.h (enum cp_tree_index): Add CPTI_SOURCE_LOCATION_IMPL.
43 (source_location_impl): Define.
44 (enum cp_built_in_function): Add CP_BUILT_IN_SOURCE_LOCATION.
45 (fold_builtin_source_location): Declare.
46 * cp-gimplify.c: Include output.h, file-prefix-map.h and cgraph.h.
47 (cp_gimplify_expr, cp_fold): Handle CP_BUILT_IN_SOURCE_LOCATION.
49 (get_source_location_impl_type): New function.
50 (struct source_location_table_entry,
51 struct source_location_table_entry_hash): New types.
52 (source_location_table, source_location_id): New variables.
53 (fold_builtin_source_location): New function.
54 * constexpr.c (cxx_eval_builtin_function_call): Handle
55 CP_BUILT_IN_SOURCE_LOCATION.
56 * tree.c (builtin_valid_in_constant_expr_p): Likewise. Formatting
58 * decl.c (cxx_init_decl_processing): Register
59 __builtin_source_location.
60 * name-lookup.c (get_std_name_hint): Add source_location entry.
62 2019-12-03 Paolo Carlini <paolo.carlini@oracle.com>
64 * typeck.c (cp_build_addr_expr_1): Use the cp_expr_loc_or_input_loc
65 location in a few additional diagnostics; tidy.
66 (check_return_expr): Likewise.
68 * typeck.c (cp_build_addr_expr_1): Use tree_strip_any_location_wrapper
69 for the address of main pedwarn.
71 2019-12-03 Jakub Jelinek <jakub@redhat.com>
74 * constexpr.c (struct constexpr_global_ctx): Add cleanups member,
75 initialize it in the ctor.
76 (cxx_eval_constant_expression) <case TARGET_EXPR>: If TARGET_EXPR_SLOT
77 is already in the values hash_map, don't evaluate it again. Put
78 TARGET_EXPR_SLOT into hash_map even if not lval, and push it into
79 save_exprs too. If there is TARGET_EXPR_CLEANUP and not
80 CLEANUP_EH_ONLY, push the cleanup to cleanups vector.
81 <case CLEANUP_POINT_EXPR>: Save outer cleanups, set cleanups to
82 local auto_vec, after evaluating the body evaluate cleanups and
83 restore previous cleanups.
84 <case TRY_CATCH_EXPR>: Don't crash if the first operand is NULL_TREE.
85 (cxx_eval_outermost_constant_expr): Set cleanups to local auto_vec,
86 after evaluating the expression evaluate cleanups.
88 2019-12-03 Marek Polacek <polacek@redhat.com>
90 PR c++/91363 - P0960R3: Parenthesized initialization of aggregates.
91 * call.c (build_new_method_call_1): Handle parenthesized initialization
92 of aggregates by building up a CONSTRUCTOR.
93 (extend_ref_init_temps): Do nothing for CONSTRUCTOR_IS_PAREN_INIT.
94 * cp-tree.h (CONSTRUCTOR_IS_PAREN_INIT, LOOKUP_AGGREGATE_PAREN_INIT):
96 * decl.c (grok_reference_init): Handle aggregate initialization from
97 a parenthesized list of values.
98 (reshape_init): Do nothing for CONSTRUCTOR_IS_PAREN_INIT.
99 (check_initializer): Handle initialization of an array from a
100 parenthesized list of values. Use NULL_TREE instead of NULL.
101 * tree.c (build_cplus_new): Handle BRACE_ENCLOSED_INITIALIZER_P.
102 * typeck2.c (digest_init_r): Set LOOKUP_AGGREGATE_PAREN_INIT if it
103 receives a CONSTRUCTOR with CONSTRUCTOR_IS_PAREN_INIT set. Allow
104 narrowing when LOOKUP_AGGREGATE_PAREN_INIT.
105 (massage_init_elt): Don't lose LOOKUP_AGGREGATE_PAREN_INIT when passing
106 flags to digest_init_r.
108 2019-12-03 Jakub Jelinek <jakub@redhat.com>
111 * typeck2.c (digest_nsdmi_init): For bitfields, use
112 DECL_BIT_FIELD_TYPE instead of TREE_TYPE.
114 2019-12-03 Jason Merrill <jason@redhat.com>
115 Jakub Jelinek <jakub@redhat.com>
118 * call.c (strip_standard_conversion): New function.
119 (build_new_op_1): Use it for user_conv_p.
120 (compare_ics): Likewise.
121 (source_type): Likewise.
123 2019-12-03 Jakub Jelinek <jakub@redhat.com>
126 * constexpr.c (cxx_bind_parameters_in_call): For virtual calls,
127 adjust the first argument to point to the derived object rather
130 2019-12-02 Jakub Jelinek <jakub@redhat.com>
133 * constexpr.c (cxx_eval_constant_expression) <case OBJ_TYPE_REF>: Use
134 STRIP_NOPS before checking for ADDR_EXPR.
136 2019-11-29 Jakub Jelinek <jakub@redhat.com>
139 * parser.c (cp_parser_omp_declare_reduction_exprs): If
140 processing_template_decl, wrap the combiner or initializer
142 * decl.c (start_preparsed_function): Don't start a lambda scope
143 for DECL_OMP_DECLARE_REDUCTION_P functions.
144 (finish_function): Don't finish a lambda scope for
145 DECL_OMP_DECLARE_REDUCTION_P functions, nor cp_fold_function
146 them nor cp_genericize them.
147 * mangle.c (decl_mangling_context): Look through
148 DECL_OMP_DECLARE_REDUCTION_P functions.
149 * semantics.c (expand_or_defer_fn_1): For DECL_OMP_DECLARE_REDUCTION_P
150 functions, use tentative linkage, don't keep their bodies with
151 -fkeep-inline-functions and return false at the end.
153 2019-11-28 Jakub Jelinek <jakub@redhat.com>
156 * decl2.c (mark_used): Don't call note_vague_linkage_fn for pure
157 virtual functions, even if they are declared inline.
159 2019-11-16 Jason Merrill <jason@redhat.com>
161 Implement P1814R0, CTAD for alias templates.
162 * pt.c (rewrite_tparm_list): Factor out of build_deduction_guide.
163 (maybe_aggr_guide): Check for copy-init here.
164 (alias_ctad_tweaks, deduction_guides_for): New.
165 (ctor_deduction_guides_for): Factor out of do_class_deduction.
166 (ctad_template_p): New.
167 * parser.c (cp_parser_simple_type_specifier): Use it.
168 * constraint.cc (append_constraint): New.
170 2019-11-16 Jason Merrill <jason@redhat.com>
172 * cxx-pretty-print.c (pp_cxx_unqualified_id): Handle alias
174 * pt.c (complex_alias_template_p): True if constraints.
175 (get_underlying_template, tsubst): Check alias constraints.
176 (push_template_decl_real): Set alias constraints here.
177 * parser.c (cp_parser_alias_declaration): Not here.
178 * constraint.cc (get_constraints): Take const_tree.
180 2019-11-12 Jason Merrill <jason@redhat.com>
182 PR c++/92206 - ICE with typedef to dependent alias.
183 * pt.c (dependent_alias_template_spec_p)
184 (alias_template_specialization_p): Add transparent_typedefs
186 (iterative_hash_template_arg, any_template_parm_r)
187 (primary_template_specialization_p, tsubst, dependent_type_p_r):
189 * decl.c (check_elaborated_type_specifier): Adjust.
190 * error.c (dump_template_bindings, dump_aggr_type): Adjust.
192 2019-11-27 Andrew Sutton <asutton@lock3software.com>
195 Defer evaluation of concept checks so that static assertions can
196 emit more detailed diagnostics.
197 * constexpr.c (cxx_eval_call_expression): Handle concept checks.
198 (cxx_eval_constant_expression): Diagnose misuse of function concepts
199 as template-id expressions. Follow the usual return path for results.
200 (cxx_eval_outermost_constant_expr): Avoid calling
201 cp_get_callee_fndecl_nofold for function concepts.
202 * constraint.cc (build_function_check): Fully type the concept check
203 so that we don't ICE in conversions.
204 * cp-gimplify.c (cp_genericize_r) [CALL_EXPR]: Handle concept checks.
205 [TEMPLATE_ID_EXPR] Likewise.
206 * cvt.c (convert_to_void): Always evaluate concept checks so we don't
207 accidentally ignore them. Substitution during satisfaction can make
208 a program ill-formed (example in g++.dg/cpp2a/concepts6.C).
209 * pt.c (tsubst_copy_and_build): [CALL_EXPR]: Don't evaluate concepts.
210 [TEMPLATE_ID_EXPR]: Likewise.
211 * semantics.c (finish_call_expr): Don't evaluate concepts.
212 (finish_id_expression_1): Likewise.
213 (finish_static_assert): Preserve the original condition so we can
214 diagnose concept errors when a check returns false.
216 2019-11-27 Andrew Sutton <asutton@lock3software.com>
219 Improve quality of diagnostics for subexpressions that need parens.
220 * parser.c (cp_parser_requires_clause_opt): Add a flag to indicate
221 when parsing a requires-clause before lambda parameters, and...
222 (cp_parser_lambda_declarator_opt): ... use that here ...
223 (cp_parser_type_parameter): ... and here ...
224 (cp_parser_late_return_type_opt): ... and here ...
225 (cp_parser_explicit_template_declaration): ... and here.
226 (cp_parser_diagnose_ungrouped_constraint_plain): Adjust the message
227 because this can apply to subexpressions that are not immediately
228 after a requires-clause.
229 (cp_parser_diagnose_ungrouped_constraint_rich): Likewise.
230 (primary_constraint_error): New.
231 (cp_parser_constraint_requires_parens): New.
232 (cp_parser_unary_constraint_requires_parens): New.
233 (cp_parser_constraint_primary_expression): Check for unary expressions
234 before parsing the primary expression. Also check for binary and
235 postfix operators after a successful parse of the primary expression.
236 Force a re-parse if the result would form a lower-precedence string.
237 (cp_parser_constraint_logical_and_expression): Propagate lambda flag;
238 move checks for ill-formed constraints into the constraint primary
240 (cp_parser_constraint_logical_or_expression): Likewise.
241 (cp_parser_requires_clause_expression): Propagate lambda flag.
243 2019-11-27 Andrew Sutton <asutton@lock3software.com>
246 * constraint.cc (satisfy_declaration_constraints): Push tinst levels
249 2019-11-27 Andrew Sutton <asutton@lock3software.com>
251 Diagnose certain constraint errors as hard errors, but otherwise treat
252 them the same as normal SFINAE-type errors. Also, generally clean up
253 the satisfaction functions.
255 * constexpr.c (cxx_eval_constant_expression): Use
256 evaluate_concept_check.
257 * constraint.cc (normalize_concept_definition): Accept a diagnostic
258 flag and only cache when not diagnosing errors.
259 (decl_satisfied_cache): Map to trees instead of bools.
260 (satisfy_atom): Guarantee a location for the errors, propagate complain
261 flags to force_rvalue, and emit errors for non-boolean constraints.
262 (get_normalized_constraints_and_args): New overloads. Factored out of
263 satisfy_constraint_expression and satisfy_declaration_constraints.
264 (satisfy_constraint_expression): Propagate diagnostic info to
266 (satisfy_declaration_constraints): New. Factored out of
267 constraints_satisfied_p.
268 (constraint_satisfaction_value): New. Calls
269 satisfy_constraint_expression or satisfy_declaration_constraints.
270 (constraints_satisfied_p): Call constraint_satisfaction_value.
271 (evaluate_concept_check): Don't take tsubst_falgs_t. Replay
272 satisfaction if an error is encountered.
273 (current_failed_constraint): Moved from pt.c.
274 (diagnose_constraints): Call constraint_satisfaction_value.
275 * cp-tree.h: Update declarations.
276 * pt.c (current_failed_constraint): Moved to constraint.cc.
277 * semantics.c (finish_id_expression_1): Remove a duplicate case.
279 2019-11-27 Jakub Jelinek <jakub@redhat.com>
282 * tree.c (replace_placeholders_r): Don't walk constructor elts with
285 2019-11-26 Jason Merrill <jason@redhat.com>
287 * pt.c (tsubst_copy_and_build) [TEMPLATE_ID_EXPR]: Remember the
288 location of a variable template-id.
289 * constexpr.c (cxx_eval_constant_expression): Get expr location
290 before stripping location wrappers.
291 (non_const_var_error): Take location argument.
293 2019-11-26 Paolo Carlini <paolo.carlini@oracle.com>
295 * typeck.c (cp_build_unary_op): Consistently use the accurate
296 location in seven additional diagnostic messages.
297 (cp_build_compound_expr): Use cp_expr_loc_or_input_loc in one place.
299 2019-11-26 Jakub Jelinek <jakub@redhat.com>
302 * parser.c (cp_parser_std_attribute): For unknown attributes,
303 skip balanced token seq instead of trying to parse
304 attribute-argument-clause as expression list. Formatting fix.
307 * class.c (enum_to_min_precision): New hash_map.
308 (enum_min_precision): New function.
309 (check_bitfield_decl): Use it.
311 2019-11-25 Paolo Carlini <paolo.carlini@oracle.com>
313 * typeck.c (cp_build_indirect_ref_1): Add location_t parameter
314 and use it in error messages.
315 (build_x_indirect_ref): Adjust call.
316 (build_indirect_ref): Likewise.
317 (cp_build_fold_indirect_ref): Likewise.
318 (cp_build_array_ref): Likewise.
319 * call.c (build_new_op_1): Likewise.
320 * semantics.c (finish_omp_clauses): Likewise.
321 (finish_omp_depobj): Likewise.
322 * typeck2.c (build_x_arrow): Likewise.
323 * cp-tree.h (cp_build_indirect_ref): Update declaration.
325 * call.c (build_new_op_1): Use location argument in warning_at.
327 * typeck.c (cp_build_modify_expr): Consistently use the
330 2019-11-23 Bernd Edlinger <bernd.edlinger@hotmail.de>
333 * name-lookup.c (check_local_shadow): Use can_convert_arg
334 instead of can_convert.
336 2019-11-22 Marek Polacek <polacek@redhat.com>
338 PR c++/88337 - P1327R1: Allow polymorphic typeid in constexpr.
339 * constexpr.c (potential_constant_expression_1): Allow a typeid
340 expression whose operand is of polymorphic type in constexpr in
342 * rtti.c (build_typeid): Remove obsolete FIXME comment.
344 2019-11-22 Jakub Jelinek <jakub@redhat.com>
347 * cp-objcp-common.c (identifier_global_tag): Define.
350 * init.c (nsdmi_inst): Change type to
351 decl_tree_cache_map * from tree_cache_map *.
352 * constraint.cc (decl_constraints): Likewise.
353 * decl.c (get_tuple_decomp_init): Likewise.
354 * pt.c (defarg_inst, explicit_specifier_map): Likewise.
355 (tsubst_default_argument, store_explicit_specifier): Use
356 decl_tree_cache_map::create_ggc rather than
357 tree_cache_map::create_ggc.
358 * cp-objcp-common.c (debug_type_map): Change type to
359 type_tree_cache_map * from tree_cache_map *.
361 2019-11-21 Marek Polacek <polacek@redhat.com>
363 PR c++/92450 - ICE with invalid nested name specifier.
364 * parser.c (cp_parser_member_declaration): Don't attempt to print
365 erroneous bit-field diagnostic if grokdeclarator returns
368 2019-11-21 Jakub Jelinek <jakub@redhat.com>
369 Jason Merrill <jason@redhat.com>
372 * parser.c (cp_parser_decl_specifier_seq): For concept or typedef
373 break early if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR.
374 For type specifiers, set CP_PARSER_FLAGS_NO_TYPE_DEFINITIONS
375 if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR is set.
377 2019-11-20 Paolo Carlini <paolo.carlini@oracle.com>
379 * typeck2.c (build_x_arrow): Early return if decay_conversion
380 returns error_mark_node.
382 2019-11-20 Jakub Jelinek <jakub@redhat.com>
385 * call.c (complain_about_no_candidates_for_method_call): If
386 conv->from is not a type, pass to complain_about_bad_argument
387 lvalue_type of conv->from.
389 2019-11-20 Paolo Carlini <paolo.carlini@oracle.com>
391 * cvt.c (ocp_convert): Use additional warning sentinel.
393 2019-11-19 Jakub Jelinek <jakub@redhat.com>
396 * constexpr.c (cxx_eval_outermost_constant_expr): If DECL_INITIAL
397 on object is erroneous, return t without trying to evaluate
400 2019-11-12 Jason Merrill <jason@redhat.com>
402 * call.c (same_fn_or_template): Change to cand_parms_match.
404 (print_z_candidate): Mark rewritten/reversed candidates.
405 (build_new_op_1): Warn about recursive call with reversed arguments.
407 2019-11-15 Andrew Sutton <asutton@lock3software.com>
410 * pt.c (get_underlying_template): Exit loop if the original type
411 of the alias is null.
413 2019-11-19 Andrew Sutton <asutton@lock3software.com>
416 * pt.c (maybe_new_partial_specialization): Apply access to newly
417 created partial specializations. Update comment style.
419 2019-11-19 Andrew Sutton <asutton@lock3software.com>
422 * pt.c (maybe_new_partial_specialization): Apply access to newly
423 created partial specializations. Update comment style.
425 2019-11-19 Andrew Sutton <asutton@lock3software.com>
428 Suppress diagnostics substituting into a requires-expression.
429 * pt.c (tsubst_copy_and_build): Perform the first substitution without
430 diagnostics and a second only if tsubst_requries_expr returns an error.
432 2019-11-19 Jakub Jelinek <jakub@redhat.com>
435 * semantics.c (handle_omp_for_class_iterator): Don't call
436 cp_fully_fold on cond.
438 2019-11-18 Paolo Carlini <paolo.carlini@oracle.com>
440 * typeck.c (cp_build_addr_expr_1): Use cp_expr_loc_or_input_loc
442 (cxx_sizeof_expr): Use it in one additional place.
443 (cxx_alignof_expr): Likewise.
444 (lvalue_or_else): Likewise.
446 2019-11-18 Marek Polacek <polacek@redhat.com>
448 PR c++/91962 - ICE with reference binding and qualification conversion.
449 * call.c (convert_like_real) <case ck_ref_bind>: Check need_temporary_p.
451 2019-11-17 Jakub Jelinek <jakub@redhat.com>
453 * method.c (lookup_comparison_result): Use %qD instead of %<%T::%D%>
455 (lookup_comparison_category): Use %qD instead of %<std::%D%> to print
458 2019-11-15 Paolo Carlini <paolo.carlini@oracle.com>
460 * typeck.c (cp_truthvalue_conversion): Add tsubst_flags_t parameter
461 and use it in calls; also pass the location_t of the expression to
462 cp_build_binary_op and c_common_truthvalue_conversion.
463 * rtti.c (build_dynamic_cast_1): Adjust call.
464 * cvt.c (ocp_convert): Likewise.
465 * cp-gimplify.c (cp_fold): Likewise.
466 * cp-tree.h (cp_truthvalue_conversion): Update declaration.
468 2019-11-14 Jason Merrill <jason@redhat.com>
470 Implement P1816R0, class template argument deduction for aggregates.
471 * pt.c (maybe_aggr_guide, collect_ctor_idx_types): New.
472 (is_spec_or_derived): Split out from do_class_deduction.
473 (build_deduction_guide): Handle aggregate guide.
474 * class.c (finish_struct): Set CLASSTYPE_NON_AGGREGATE in a
476 * cp-tree.h (CP_AGGREGATE_TYPE_P): An incomplete class is not an
479 2019-11-14 Richard Sandiford <richard.sandiford@arm.com>
481 * call.c (build_conditional_expr_1): Use truth_type_for instead
482 of build_same_sized_truth_vector_type.
483 * typeck.c (build_vec_cmp): Likewise.
485 2019-11-14 Jakub Jelinek <jakub@redhat.com>
487 * parser.c (cp_parser_omp_context_selector): Don't require score
488 argument to fit into shwi, just to be INTEGER_CST. Diagnose
490 * pt.c (tsubst_attribute): Likewise.
492 * parser.c (cp_parser_omp_context_selector): Rename
493 CTX_PROPERTY_IDLIST to CTX_PROPERTY_NAME_LIST, add CTX_PROPERTY_ID.
494 Use CTX_PROPERTY_ID for atomic_default_mem_order, only allow a single
495 identifier in that. For CTX_PROPERTY_NAME_LIST, allow identifiers
497 * pt.c (tsubst_attribute): Fix up STRING_CST handling if allow_string.
499 2019-11-13 Marek Polacek <polacek@redhat.com>
501 PR c++/89070 - bogus [[nodiscard]] warning in SFINAE.
502 * cvt.c (convert_to_void): Guard maybe_warn_nodiscard calls with
505 2019-11-13 Richard Sandiford <richard.sandiford@arm.com>
508 * cp-tree.h (STF_STRIP_DEPENDENT): New constant.
509 * tree.c (strip_typedefs): Add STF_STRIP_DEPENDENT to the flags
510 when calling strip_typedefs recursively on a DECL_ORIGINAL_TYPE.
511 Don't apply the fix for DR1558 in that case; allow aliases with
512 dependent template parameters to be stripped instead.
514 2019-11-12 Nathan Sidwell <nathan@acm.org>
516 * name-lookup.c (lookup_using_decl): New function, merged from ...
517 (do_class_using_decl): ... here. Call it. And ...
518 (finish_nonmember_using_decl): ... here. Call it.
520 2019-11-12 Martin Liska <mliska@suse.cz>
522 * name-lookup.c: Do not include params.h.
523 * typeck.c: Likewise.
525 2019-11-12 Martin Liska <mliska@suse.cz>
527 * name-lookup.c (namespace_hints::namespace_hints): Replace old
528 parameter syntax with the new one, include opts.h if needed. Use
529 SET_OPTION_IF_UNSET macro.
530 * typeck.c (comptypes): Likewise.
532 2019-11-12 Maciej W. Rozycki <macro@codesourcery.com>
533 Frederik Harwath <frederik@codesourcery.com>
536 * constexpr.c (potential_constant_expression_1): Handle
538 * parser.c (OACC_SERIAL_CLAUSE_MASK): New macro.
539 (cp_parser_oacc_kernels_parallel): Rename function to...
540 (cp_parser_oacc_compute): ... this. Handle PRAGMA_OACC_SERIAL.
541 (cp_parser_omp_construct): Update accordingly.
542 (cp_parser_pragma): Handle PRAGMA_OACC_SERIAL. Fix alphabetic
544 * pt.c (tsubst_expr): Handle OACC_SERIAL.
546 2019-11-11 Jason Merrill <jason@redhat.com>
548 Implement P1946R0, Allow defaulting comparisons by value.
549 * method.c (early_check_defaulted_comparison): Accept by-value,
550 reject mixed by-value and by-reference parms.
551 * decl.c (grokdeclarator): Set funcdef_flag for defaulted friend.
552 * decl2.c (grokfield): Don't SET_DECL_FRIEND_CONTEXT.
554 * typeck.c (cp_build_binary_op): Sorry about <=> on VECTOR_TYPE.
556 2019-11-11 Jakub Jelinek <jakub@redhat.com>
559 * decl.c (finish_function): Move ctype initialization before
560 DECL_DELETED_FN handling.
562 * semantics.c (finish_translation_unit): Diagnose declare target
563 without corresponding end declare target.
565 2019-11-10 Jason Merrill <jason@redhat.com>
567 Implement D1957R0, T* to bool should be considered narrowing.
568 * typeck2.c (check_narrowing): Treat pointer->bool as a narrowing
569 conversion with -std=c++2a.
571 2019-11-08 Marek Polacek <polacek@redhat.com>
573 PR c++/92215 - flawed diagnostic for bit-field with non-integral type.
574 * parser.c (cp_parser_member_declaration): Add a diagnostic for
575 bit-fields with non-integral types.
577 2019-11-08 Jakub Jelinek <jakub@redhat.com>
579 * init.c (build_vec_delete_1): Fix a comment typo - mist -> must.
581 2019-11-07 Jason Merrill <jason@redhat.com>
583 Implement D1959R0, remove weak_equality and strong_equality.
584 * method.c (enum comp_cat_tag, comp_cat_info): Remove *_equality.
585 (genericize_spaceship, common_comparison_type): Likewise.
586 * typeck.c (cp_build_binary_op): Move SPACESHIP_EXPR to be with the
587 relational operators, exclude other types no longer supported.
589 2019-11-06 Jason Merrill <jason@redhat.com>
591 Implement D1907R1 "structural type".
592 * tree.c (structural_type_p): New.
593 * pt.c (invalid_nontype_parm_type_p): Use it.
594 * class.c (build_base_field_1): Take binfo. Copy TREE_PRIVATE.
595 (build_base_field): Pass binfo.
597 PR c++/92150 - partial specialization with class NTTP.
598 * pt.c (unify): Handle VIEW_CONVERT_EXPR.
600 * pt.c (use_pack_expansion_extra_args_p): Still do substitution if
601 all packs are simple pack expansions.
602 (add_extra_args): Check that the extra args aren't dependent.
604 2019-11-06 Andrew Sutton <asutton@lock3software.com>
606 Use satisfaction with nested requirements.
607 * constraint.cc (build_parameter_mapping): Use
608 current_template_parms when the declaration is not available.
609 (norm_info::norm_info) Make explicit.
610 (normalize_constraint_expression): Factor into a separate overload
611 that takes arguments, and use that in the original function.
612 (tsubst_nested_requirement): Use satisfy_constraint instead of
613 trying to evaluate this as a constant expression.
614 (finish_nested_requirement): Keep the normalized constraint and the
615 original normalization arguments with the requirement.
616 (diagnose_nested_requirement): Use satisfy_constraint. Tentatively
617 implement more comprehensive diagnostics, but do not enable.
618 * parser.c (cp_parser_requires_expression): Relax requirement that
619 requires-expressions can live only inside templates.
620 * pt.c (any_template_parm_r): Look into type of PARM_DECL.
622 2019-11-06 Jason Merrill <jason@redhat.com>
624 C++20 NB CA378 - Remove constrained non-template functions.
625 * decl.c (grokfndecl): Reject constraints on non-templated function.
627 2019-11-06 Matthias Kretz <m.kretz@gsi.de>
629 * parser.c (cp_parser_operator): Parse operator?: as an
630 attempt to overload the conditional operator.
632 2019-11-05 Jason Merrill <jason@redhat.com>
634 Implement C++20 operator<=>.
635 * cp-tree.h (struct lang_decl_fn): Add maybe_deleted bitfield.
636 (DECL_MAYBE_DELETED): New.
637 (enum special_function_kind): Add sfk_comparison.
638 (LOOKUP_REWRITTEN, LOOKUP_REVERSED): New.
639 * call.c (struct z_candidate): Add rewritten and reversed methods.
640 (add_builtin_candidate): Handle SPACESHIP_EXPR.
641 (add_builtin_candidates): Likewise.
642 (add_candidates): Don't add a reversed candidate if the parms are
644 (add_operator_candidates): Split out from build_new_op_1. Handle
645 rewritten and reversed candidates.
646 (add_candidate): Swap conversions of reversed candidate.
647 (build_new_op_1): Swap them back. Build a second operation for
648 rewritten candidates.
649 (extract_call_expr): Handle rewritten calls.
650 (same_fn_or_template): New.
651 (joust): Handle rewritten and reversed candidates.
652 * class.c (add_implicitly_declared_members): Add implicit op==.
653 (classtype_has_op, classtype_has_defaulted_op): New.
654 * constexpr.c (cxx_eval_binary_expression): Handle SPACESHIP_EXPR.
655 (cxx_eval_constant_expression, potential_constant_expression_1):
657 * cp-gimplify.c (genericize_spaceship): New.
658 (cp_genericize_r): Use it.
659 * cp-objcp-common.c (cp_common_init_ts): Handle SPACESHIP_EXPR.
660 * decl.c (finish_function): Handle deleted function.
661 * decl2.c (grokfield): SET_DECL_FRIEND_CONTEXT on defaulted friend.
662 (mark_used): Check DECL_MAYBE_DELETED. Remove assumption that
663 defaulted functions are non-static members.
664 * error.c (dump_expr): Handle SPACESHIP_EXPR.
665 * method.c (type_has_trivial_fn): False for sfk_comparison.
666 (enum comp_cat_tag, struct comp_cat_info_t): New types.
667 (comp_cat_cache): New array variable.
668 (lookup_comparison_result, lookup_comparison_category)
669 (is_cat, cat_tag_for, spaceship_comp_cat)
670 (spaceship_type, genericize_spaceship)
671 (common_comparison_type, early_check_defaulted_comparison)
672 (comp_info, build_comparison_op): New.
673 (synthesize_method): Handle sfk_comparison. Handle deleted.
674 (get_defaulted_eh_spec, maybe_explain_implicit_delete)
675 (explain_implicit_non_constexpr, implicitly_declare_fn)
676 (defaulted_late_check, defaultable_fn_check): Handle sfk_comparison.
677 * name-lookup.c (get_std_name_hint): Add comparison categories.
678 * tree.c (special_function_p): Add sfk_comparison.
679 * typeck.c (cp_build_binary_op): Handle SPACESHIP_EXPR.
681 2019-11-05 Tim van Deurzen <tim@kompiler.org>
683 Add new tree code for the spaceship operator.
684 * cp-tree.def: Add new tree code.
685 * operators.def: New binary operator.
686 * parser.c: Add new token and tree code.
688 2019-09-15 Jason Merrill <jason@redhat.com>
690 * call.c (build_new_op_1): Don't apply any standard conversions to
691 the operands of a built-in operator. Don't suppress conversions in
693 * typeck.c (cp_build_unary_op): Do integral promotions for enums.
695 2019-11-04 Jason Merrill <jason@redhat.com>
697 Use vec instead of raw array for built-in candidates.
698 * call.c (build_builtin_candidate): Take args in a vec.
699 (add_builtin_candidate, add_builtin_candidates): Likewise.
700 (build_conditional_expr_1, build_new_op_1): Adjust.
702 2019-11-04 Jason Merrill <jason@redhat.com>
704 * constexpr.c (explain_invalid_constexpr_fn): Show location of fn.
706 * pt.c (maybe_instantiate_noexcept): Only update clones if we
709 * typeck.c (contextual_conv_bool): New.
711 * name-lookup.c (lookup_qualified_name): Add wrapper overload taking
712 C string rather than identifier.
713 * parser.c (cp_parser_userdef_numeric_literal): Use it.
714 * rtti.c (emit_support_tinfos): Use it.
715 * cp-tree.h (ovl_op_identifier): Change to inline functions.
716 (build_x_binary_op): Add wrapper with fewer parms.
718 2019-11-05 Jason Merrill <jason@redhat.com>
720 * decl2.c (mark_used): Diagnose use of a function with unsatisfied
722 * typeck.c (cp_build_function_call_vec): Not here.
724 2019-11-05 Nathan Sidwell <nathan@acm.org>
727 * parser.c (cp_parser_error_1): Check EOF and UNKNOWN_LOCATION
728 when skipping over version control marker.
730 2019-11-05 Jakub Jelinek <jakub@redhat.com>
733 * constexpr.c (potential_constant_expression_1): Return true rather
734 than false for PREDICT_EXPR.
736 * decl.c (omp_declare_variant_finalize_one): Call
737 declare_simd_adjust_this not just on the context, but also on the
738 variant-id expression for methods. Don't call
739 cp_get_callee_fndecl_nofold, call cp_get_callee and only if it is
740 safe cp_get_fndecl_from_callee. Don't try to print as %qD
742 * pt.c (tsubst_attribute): Handle "omp declare variant base"
744 (tsubst_function_decl): Call omp_declare_variant_finalize
745 if there are any "omp declare variant base" attributes left.
747 2019-11-04 Kamlesh Kumar <kamleshbhalui@gmail.com>
749 PR c++/91979 - mangling nullptr expression
750 * mangle.c (write_template_arg_literal): Handle nullptr
753 2019-11-04 Jason Merrill <jason@redhat.com>
755 * typeck.c (check_return_expr): Avoid redundant error.
757 2019-11-02 Paolo Carlini <paolo.carlini@oracle.com>
759 * typeck.c (composite_pointer_type): Add a const op_location_t&
760 parameter and use it in diagnostics.
761 (composite_pointer_error): Likewise.
762 (composite_pointer_type_r): Add a const op_location_t&
763 parameter and forward it.
764 (cp_build_binary_op): Adjust calls.
765 (common_pointer_type): Likewise.
766 * call.c (add_builtin_candidate): Likewise.
767 (build_conditional_expr_1): Likewise.
768 * cp-tree.h (composite_pointer_type): Update declaration.
770 * typeck.c (cxx_sizeof_expr): Use cp_expr_loc_or_input_loc
772 (cxx_alignof_expr): Likewise.
773 (lvalue_or_else): Likewise.
775 2019-11-02 Jakub Jelinek <jakub@redhat.com>
777 * decl.c (omp_declare_variant_finalize_one): Use
778 omp_get_context_selector instead of c_omp_get_context_selector.
781 * parser.c (cp_parser_decl_specifier_seq): Don't parse attributes
782 if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR.
784 PR c++/88335 - Implement P1073R3: Immediate functions
785 * cp-tree.h (struct lang_decl_fn): Add immediate_fn_p bit.
786 (DECL_IMMEDIATE_FUNCTION_P, SET_DECL_IMMEDIATE_FUNCTION_P): Define.
787 (enum cp_decl_spec): Add ds_consteval.
788 (fold_non_dependent_expr): Add another tree argument defaulted to
790 * name-lookup.h (struct cp_binding_level): Add immediate_fn_ctx_p
792 * parser.c (cp_keyword_starts_decl_specifier_p): Adjust comments
793 for C++11 and C++20 specifiers. Handle RID_CONSTEVAL.
794 (CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR): Adjust comment.
795 (CP_PARSER_FLAGS_CONSTEVAL): New.
796 (cp_parser_skip_balanced_tokens): New forward declaration.
797 (cp_parser_lambda_declarator_opt): Handle ds_consteval. Set
798 current_binding_level->immediate_fn_ctx_p before parsing parameter
799 list if decl-specifier-seq contains consteval specifier.
800 (cp_parser_decl_specifier_seq): Handle RID_CONSTEVAL.
801 (cp_parser_explicit_instantiation): Diagnose explicit instantiation
802 with consteval specifier.
803 (cp_parser_init_declarator): For consteval or into flags
804 CP_PARSER_FLAGS_CONSTEVAL.
805 (cp_parser_direct_declarator): If CP_PARSER_FLAGS_CONSTEVAL, set
806 current_binding_level->immediate_fn_ctx_p in the sk_function_parms
808 (set_and_check_decl_spec_loc): Add consteval entry, formatting fix.
809 * call.c (build_addr_func): For direct calls to immediate functions
810 use build_address rather than decay_conversion.
811 (build_over_call): Evaluate immediate function invocations.
812 * error.c (dump_function_decl): Handle DECL_IMMEDIATE_FUNCTION_P.
813 * semantics.c (expand_or_defer_fn_1): Use tentative linkage and don't
814 call mark_needed for immediate functions.
815 * typeck.c (cxx_sizeof_or_alignof_expr): Likewise. Formatting fix.
816 (cp_build_addr_expr_1): Reject taking address of immediate function
817 outside of immediate function.
818 * decl.c (validate_constexpr_redeclaration): Diagnose consteval
819 vs. non-consteval or vice versa redeclaration. Use
820 SET_DECL_IMMEDIATE_FUNCTION_P if new_decl is immediate function.
821 (check_tag_decl): Use %qs with keyword string to simplify translation.
823 (start_decl): Adjust diagnostics for static or thread_local variables
824 in immediate functions.
825 (grokfndecl): Call sorry_at on virtual consteval. Use %qs with keyword
826 to string to simplify translation. Diagnose consteval main. Use
827 SET_DECL_IMMEDIATE_FUNCTION_P for consteval.
828 (grokdeclarator): Handle consteval. Use %qs with keyword strings to
829 simplify translation. Use separate ifs instead of chained else if
830 for invalid specifiers. For constinit clear constinit_p rather than
832 * constexpr.c (find_immediate_fndecl): New function.
833 (cxx_eval_outermost_constant_expr): Allow consteval calls returning
834 void. Diagnose returning address of immediate function from consteval
836 (fold_non_dependent_expr_template): Add OBJECT argument, pass it
837 through to cxx_eval_outermost_constant_expr.
838 (fold_non_dependent_expr): Add OBJECT argument, pass it through to
839 fold_non_dependent_expr_template.
840 (fold_non_dependent_init): Adjust fold_non_dependent_expr_template
842 * method.c (defaulted_late_check): Adjust diagnostics for consteval.
843 * lambda.c (maybe_add_lambda_conv_op): Copy over
844 DECL_DECLARED_CONSTEXPR_P and DECL_IMMEDIATE_FUNCTION_P bits from
845 callop to both artificial functions.
846 * init.c (build_value_init): Don't do further processing if
847 build_special_member_call returned a TREE_CONSTANT. Formatting fix.
849 PR c++/91369 - Implement P0784R7: constexpr new
850 * cp-tree.h (CALL_FROM_NEW_OR_DELETE_P): Define.
851 * init.c (build_new_1, build_vec_delete_1, build_delete): Set
852 CALL_FROM_NEW_OR_DELETE_P on the CALL_EXPR to allocator functions.
853 * constexpr.c (is_std_allocator_allocate): Only allow
854 global replaceable allocator functions if CALL_FROM_NEW_OR_DELETE_P
855 or in std::allocate<T>::{,de}allocate.
856 (potential_constant_expression_1): Likewise.
858 2019-11-01 Nathan Sidwell <nathan@acm.org>
860 * class.c (check_field_decls): Refactor.
862 2019-10-31 Jakub Jelinek <jakub@redhat.com>
865 * cp-tree.h (type_initializer_zero_p): Declare.
866 * decl.c (reshape_init_array_1): Formatting fix.
867 * tree.c (type_initializer_zero_p): New function. Moved from
868 ../tree.c, use next_initializable_field, formatting fix. Return
869 false for TYPE_NON_AGGREGATE_CLASS types.
871 2019-10-30 Jason Merrill <jason@redhat.com>
873 PR c++/92268 - hard error satisfying return-type-requirement
874 * constraint.cc (type_deducible_p): Check for substitution failure.
875 (diagnose_compound_requirement): Adjust diagnostic.
876 * pt.c (do_auto_deduction): Don't pass cargs to
877 constraints_satisfied_p.
879 2019-10-30 Jakub Jelinek <jakub@redhat.com>
881 PR c++/91369 - Implement P0784R7: constexpr new
882 * constexpr.c (cxx_replaceable_global_alloc_fn): Don't return true
884 (cxx_placement_new_fn, is_std_construct_at): New functions.
885 (cxx_eval_call_expression): Allow placement new in std::construct_at.
886 (potential_constant_expression_1): Likewise.
888 * typeck.c (decl_in_std_namespace_p): Return true also for decls
889 in inline namespaces inside of std namespace.
891 2019-10-30 Bernd Edlinger <bernd.edlinger@hotmail.de>
894 * name-lookup.c (check_local_shadow): Shadowing TYPE_DECLs
895 is always a -Wshadow=compatible-local warning, unless
898 2019-10-30 Jason Merrill <jason@redhat.com>
900 * cxx-pretty-print.c (get_fold_operator): Use OVL_OP_INFO.
902 2019-10-30 Marek Polacek <polacek@redhat.com>
904 PR c++/92134 - constinit malfunction in static data member.
905 * decl2.c (grokfield): Set LOOKUP_CONSTINIT.
907 2019-10-30 Jakub Jelinek <jakub@redhat.com>
909 * cp-tree.h (omp_declare_variant_finalize, build_local_temp): Declare.
910 * decl.c: Include omp-general.h.
911 (declare_simd_adjust_this): Add forward declaration.
912 (omp_declare_variant_finalize_one, omp_declare_variant_finalize): New
914 (cp_finish_decl, finish_function): Call omp_declare_variant_finalize.
915 * parser.c (cp_finish_omp_declare_variant): Adjust parsing of the
916 variant id-expression and propagate enough information to
917 omp_declare_variant_finalize_one in the attribute so that it can
919 * class.c (finish_struct): Call omp_declare_variant_finalize.
920 * tree.c (build_local_temp): No longer static, remove forward
923 2019-10-30 Paolo Carlini <paolo.carlini@oracle.com>
925 * typeck.c (cp_build_modify_expr): Prefer error + inform to
926 error + error in one place.
927 (get_delta_difference_1): Likewise.
928 (get_delta_difference): Likewise, in two places.
930 2019-10-29 Paolo Carlini <paolo.carlini@oracle.com>
932 * typeck.c (build_x_unary_op): Use the location_t argument in
935 2019-10-29 Marek Polacek <polacek@redhat.com>
937 PR c++/90998 - ICE with copy elision in init by ctor and -Wconversion.
938 * call.c (joust): Don't attempt to warn if ->second_conv is null.
940 2019-10-29 Jakub Jelinek <jakub@redhat.com>
943 * cp-gimplify.c (cp_gimplify_expr): If gimplify_to_rvalue changes the
944 function pointer type, re-add cast to the original one.
946 2019-10-29 Marek Polacek <polacek@redhat.com>
948 PR c++/91548 - fix detecting modifying const objects for ARRAY_REF.
949 * constexpr.c (cxx_eval_store_expression): Don't call
950 modifying_const_object_p for ARRAY_REF.
952 2019-10-29 Richard Sandiford <richard.sandiford@arm.com>
954 * cp-objcp-common.h (cxx_simulate_enum_decl): Declare.
955 (LANG_HOOKS_SIMULATE_ENUM_DECL): Define to the above.
956 * decl.c (cxx_simulate_enum_decl): New function.
958 2019-10-29 Richard Sandiford <richard.sandiford@arm.com>
960 * cp-tree.h (cxx_simulate_builtin_function_decl): Declare.
961 * decl.c (cxx_simulate_builtin_function_decl): New function.
962 * cp-objcp-common.h (LANG_HOOKS_SIMULATE_BUILTIN_FUNCTION_DECL):
965 2019-10-28 Martin Sebor <msebor@redhat.com>
968 * cp-objcp-common.c (names_builtin_p): Define new function.
970 2019-10-28 Nathan Sidwell <nathan@acm.org>
972 * parser.h (struct cp_token): Drop {ENUM,BOOL}_BITFIELD C-ism.
973 Add tree_check_p flag, use as nested union discriminator.
974 (struct cp_lexer): Add saved_type & saved_keyword fields.
975 * parser.c (eof_token): Delete.
976 (cp_lexer_new_main): Always init last_token to last token of
978 (cp_lexer_new_from_tokens): Overlay EOF token at end of range.
979 (cp_lexer_destroy): Restore token under the EOF.
980 (cp_lexer_previous_token_position): No check for eof_token here.
981 (cp_lexer_get_preprocessor_token): Clear tree_check_p.
982 (cp_lexer_peek_nth_token): Check CPP_EOF not eof_token.
983 (cp_lexer_consume_token): Assert not CPP_EOF, no check for
985 (cp_lexer_purge_token): Likewise.
986 (cp_lexer_purge_tokens_after): No check for EOF token.
987 (cp_parser_nested_name_specifier, cp_parser_decltype)
988 (cp_parser_template_id): Set tree_check_p.
990 2019-10-24 Jakub Jelinek <jakub@redhat.com>
992 * decl2.c (cplus_decl_attributes): Add "omp declare target block"
993 attribute in between declare target and end declare target
996 * call.c (convert_arg_to_ellipsis): Add missing space in string
999 2019-10-24 Marek Polacek <polacek@redhat.com>
1001 * decl.c (reshape_init_r): Add missing space.
1003 2019-10-24 Nathan Sidwell <nathan@acm.org>
1005 * pt.c (reduce_template_parm_level): Attach the new TPI to the new
1007 (convert_generic_types_to_packs): Pass the copied type to
1008 reduce_templatE_parm_level.
1010 2019-10-23 Nathan Sidwell <nathan@acm.org>
1012 * cp-tree.c (CPTI_STD_IDENTIFIER): Delete.
1013 (std_identifier): Delete.
1014 (DECL_NAME_SPACE_STD_P): Compare against std_node.
1015 * decl.c (initialize_predefined_identifiers): 'std' is not needed.
1016 (cxx_init_decl_processing): Adjust creation of ::std. Use
1017 {push,pop}_nested_namespace.
1018 (cxx_builtin_function): Use {push,pop}_nested_namespace.
1019 * except.c (init_exception_processing): Likewise.
1020 * rtti.c (init_rtti_processing): Likewise.
1022 2019-10-23 Jason Merrill <jason@redhat.com>
1024 Implement P1286R2, Contra CWG1778
1025 * method.c (defaulted_late_check): Don't check explicit
1026 exception-specification on defaulted function.
1027 (after_nsdmi_defaulted_late_checks): Remove.
1028 * parser.h (struct cp_unparsed_functions_entry): Remove classes.
1029 * parser.c (unparsed_classes): Remove.
1030 (push_unparsed_function_queues, cp_parser_class_specifier_1):
1033 2019-10-23 Jakub Jelinek <jakub@redhat.com>
1035 * constexpr.c (cxx_eval_constant_expression) <case CLEANUP_STMT>:
1036 Temporarily change input_location to CLEANUP_STMT location.
1038 2019-10-22 Jakub Jelinek <jakub@redhat.com>
1040 PR tree-optimization/85887
1041 * decl.c (expand_static_init): Drop ECF_LEAF from __cxa_guard_acquire
1042 and __cxa_guard_release.
1044 2019-10-22 Marc Glisse <marc.glisse@inria.fr>
1047 * constexpr.c (cxx_eval_builtin_function_call): Only set
1048 force_folding_builtin_constant_p if manifestly_const_eval.
1050 2019-10-22 Richard Sandiford <richard.sandiford@arm.com>
1052 * cp-tree.h (STF_USER_VISIBLE): New constant.
1053 (strip_typedefs, strip_typedefs_expr): Take a flags argument.
1054 * tree.c (strip_typedefs, strip_typedefs_expr): Likewise,
1055 updating mutual calls accordingly. When STF_USER_VISIBLE is true,
1056 only look through typedefs if user_facing_original_type_p.
1057 * error.c (dump_template_bindings, type_to_string): Pass
1058 STF_USER_VISIBLE to strip_typedefs.
1059 (dump_type): Likewise, unless pp_c_flag_gnu_v3 is set.
1061 2019-10-21 Kamlesh Kumar <kamleshbhalui@gmail.com>
1062 Jason Merrill <jason@redhat.com>
1064 PR c++/83534 - typeinfo of noexcept function
1065 * rtti.c (get_tinfo_decl_dynamic): Do not call
1066 TYPE_MAIN_VARIANT for function.
1067 (get_typeid): Likewise.
1069 2019-10-21 Paolo Carlini <paolo.carlini@oracle.com>
1071 * parser.c (cp_parser_class_head): Improve error recovery upon
1072 extra qualification error.
1074 2019-10-21 Jakub Jelinek <jakub@redhat.com>
1077 * constexpr.c (cxx_eval_component_reference, cxx_eval_bit_field_ref):
1078 Use STRIP_ANY_LOCATION_WRAPPER on CONSTRUCTOR elts.
1080 2019-10-21 Marek Polacek <polacek@redhat.com>
1082 PR c++/92062 - ODR-use ignored for static member of class template.
1083 * pt.c (has_value_dependent_address): Strip location wrappers.
1085 2019-10-21 Marek Polacek <polacek@redhat.com>
1087 PR c++/92106 - ICE with structured bindings and -Wreturn-local-addr.
1088 * typeck.c (maybe_warn_about_returning_address_of_local): Avoid
1089 recursing on null initializer and return false instead.
1091 2019-10-17 JeanHeyd Meneide <phdofthehouse@gmail.com>
1093 Implement p1301 [[nodiscard("should have a reason")]] + p1771 DR
1094 * tree.c (handle_nodiscard_attribute): Handle C++2a nodiscard
1096 (std_attribute_table) Increase nodiscard argument handling
1097 max_length from 0 to 1.
1098 * parser.c (cp_parser_check_std_attribute): Add requirement
1099 that nodiscard only be seen once in attribute-list.
1100 (cp_parser_std_attribute): Check that empty parenthesis lists are
1101 not specified for attributes that have max_length > 0 (e.g.
1103 * cvt.c (maybe_warn_nodiscard): Add nodiscard message to
1104 output, if applicable.
1105 (convert_to_void): Allow constructors to be nodiscard-able (P1771).
1107 2019-10-18 Nathan Sidwell <nathan@acm.org>
1109 * cp-tree.h (struct lang_type): Remove was_anonymous.
1110 (TYPE_WAS_UNNAMED): Implement by checking TYPE_DECL &
1112 * decl.c (name_unnamed_type): Don't set TYPE_WAS_UNNAMED.
1114 2019-10-17 Paolo Carlini <paolo.carlini@oracle.com>
1116 * decl.c (grokfndecl): Remove redundant use of in_system_header_at.
1117 (compute_array_index_type_loc): Likewise.
1118 (grokdeclarator): Likewise.
1119 * error.c (cp_printer): Likewise.
1120 * lambda.c (add_default_capture): Likewise.
1121 * parser.c (cp_parser_primary_expression): Likewise.
1122 (cp_parser_selection_statement): Likewise.
1123 (cp_parser_toplevel_declaration): Likewise.
1124 (cp_parser_enumerator_list): Likewise.
1125 (cp_parser_using_declaration): Likewise.
1126 (cp_parser_member_declaration): Likewise.
1127 (cp_parser_exception_specification_opt): Likewise.
1128 (cp_parser_std_attribute_spec): Likewise.
1129 * pt.c (do_decl_instantiation): Likewise.
1130 (do_type_instantiation): Likewise.
1131 * typeck.c (cp_build_unary_op): Likewise.
1133 * decl.c (check_tag_decl): Pass to in_system_header_at the same
1134 location used for the permerror.
1135 (grokdeclarator): Likewise.
1137 * decl.c (check_tag_decl): Use locations[ds_typedef] in error_at.
1139 2019-10-17 Jason Merrill <jason@redhat.com>
1141 * cp-gimplify.c (cp_gimplify_expr): Use get_initialized_tmp_var.
1142 (gimplify_to_rvalue): Remove default NULL argument.
1144 2019-10-17 Nathan Sidwell <nathan@acm.org>
1146 * decl.c (builtin_function_1): Merge into ...
1147 (cxx_builtin_function): ... here. Nadger the decl before maybe
1148 copying it. Set the context.
1149 (cxx_builtin_function_ext_scope): Push to top level, then call
1150 cxx_builtin_function.
1152 2019-10-16 Luis Machado <luis.machado@linaro.org>
1154 * cp-gimplify.c: Fix reference to non-existing tree-gimple.c file.
1156 2019-10-16 Jakub Jelinek <jakub@redhat.com>
1158 * decl.c (cxx_maybe_build_cleanup): When clearing location of cleanup,
1159 if cleanup is a nop, clear location of its operand too.
1161 2019-10-15 Andrew Sutton <asutton@lock3software.com>
1163 Finish moving constraint and logic functionality of out pt.c.
1164 Reimplement and re-enable subsumption caching.
1166 * config-lang.in (gtfiles): Add logic.cc.
1167 * constraint.cc (atomic_constraints_identical_p): Add assertions.
1168 (hash_atomic_constraint): Likewise.
1169 (constraints_equivalent_p): New.
1170 (inchash::add_constraint): New.
1171 (iterative_hash_constraint): New.
1172 (decl_constraints): Moved from pt.c.
1173 (get_constraints): Likewise.
1174 (set_constraints): Likewise.
1175 (remove_constraints): Likewise.
1176 * cp-tree.h (CONSTR_P): New.
1177 (init_constraint_processing): Remove.
1178 (constraints_equivalent_p, iterative_hash_constraint): Declare.
1179 * decl.c (cxx_init_decl_processing): Don't initialize constraints.
1180 * logic.cc (subsumption_entry): Moved from pt.c.
1181 (subsumption_hasher): Likewise.
1182 (subsumption_cache): Likewise.
1183 (lookup_subsumption): Likewise.
1184 (save_subsumption): Likewise.
1185 (subsumes_constraints_nonnull): Use subsumption cache.
1186 * pt.c: Move aforementioned declarations out of this file.
1187 (init_constraint_processing): Remove.
1189 2019-10-15 Andrew Sutton <asutton@lock3software.com>
1191 * parser.c (cp_parser_constructor_declarator_p): Pass an empty
1192 decl-specifier-seq to make sure we parse type constraints as part
1193 of a type-specifier.
1195 2019-10-15 Nathan Sidwell <nathan@acm.org>
1197 * class.c (build_clones): Break out of clone_function_decl. Just
1199 (clone_function_decl): Call build_clones, then maybe add them to
1202 * class.c (build_clone): Refactor to clarify recursiveness.
1204 2019-10-14 Jason Merrill <jason@redhat.com>
1206 PR c++/91930 - ICE with constrained inherited default ctor.
1207 * name-lookup.c (do_class_using_decl): Set TYPE_HAS_USER_CONSTRUCTOR
1208 for inherited constructor.
1210 2019-10-14 Paolo Carlini <paolo.carlini@oracle.com>
1212 * decl.c (check_tag_decl): Use DECL_SOURCE_LOCATION.
1214 2019-10-14 Jakub Jelinek <jakub@redhat.com>
1217 * semantics.c (handle_omp_array_sections_1): Temporarily disable
1218 -fstrong-eval-order also for in_reduction and task_reduction clauses.
1220 * parser.c (cp_parser_omp_all_clauses): Change bool NESTED_P argument
1221 into int NESTED, if it is 2, diagnose missing commas in between
1223 (cp_parser_omp_context_selector): Pass 2 as last argument to
1224 cp_parser_omp_all_clauses.
1226 2019-10-12 Jakub Jelinek <jakub@redhat.com>
1228 * parser.c (cp_parser_omp_context_selector): Improve error recovery.
1229 For simd properties, put them directly into TREE_VALUE.
1230 (cp_finish_omp_declare_variant): Add "omp declare variant base"
1231 attribute rather than "omp declare variant".
1233 2019-10-11 Marek Polacek <polacek@redhat.com>
1235 PR c++/92049 - extra error with -fchecking=2.
1236 * pt.c (build_non_dependent_expr): Call fold_non_dependent_expr
1239 2019-10-11 Paolo Carlini <paolo.carlini@oracle.com>
1241 * typeck.c (cp_build_binary_op): Do not handle RROTATE_EXPR and
1243 * constexpr.c (cxx_eval_constant_expression): Likewise.
1244 (potential_constant_expression_1): Likewise.
1245 * pt.c (tsubst_copy): Likewise.
1247 2019-10-11 Jason Merrill <jason@redhat.com>
1249 * decl2.c (mark_used): Don't clobber DECL_SOURCE_LOCATION on
1250 explicitly defaulted functions.
1251 * method.c (synthesize_method): Likewise.
1253 2019-10-11 Jakub Jelinek <jakub@redhat.com>
1256 * decl2.c (grok_array_decl): For -fstrong-eval-order, when array ref
1257 operands have been swapped and at least one operand has side-effects,
1258 revert the swapping before calling build_array_ref.
1259 * typeck.c (cp_build_array_ref): For non-ARRAY_TYPE array ref with
1260 side-effects on the index operand, if -fstrong-eval-order use
1261 save_expr around the array operand.
1262 (cp_build_binary_op): For shifts with side-effects in the second
1263 operand, wrap first operand into SAVE_EXPR and evaluate it before
1265 * semantics.c (handle_omp_array_sections_1): Temporarily disable
1266 flag_strong_eval_order during OMP_CLAUSE_REDUCTION array section
1268 * cp-gimplify.c (gimplify_to_rvalue): New function.
1269 (cp_gimplify_expr): Use it.
1271 2019-10-10 Marek Polacek <polacek@redhat.com>
1273 * typeck.c (comp_ptr_ttypes_real): Change the return type to bool.
1274 Use false instead of 0.
1276 2019-10-10 Jakub Jelinek <jakub@redhat.com>
1278 * parser.h (struct cp_omp_declare_simd_data): Add variant_p member.
1279 * parser.c (cp_ensure_no_omp_declare_simd): Handle both declare simd
1280 and declare variant.
1281 (cp_parser_oacc_all_clauses): Formatting fix.
1282 (cp_parser_omp_all_clauses): Add NESTED_P argument, if true, terminate
1283 processing on closing paren and don't skip to end of pragma line.
1284 (cp_parser_omp_declare_simd): Add VARIANT_P argument. Handle also
1286 (omp_construct_selectors, omp_device_selectors,
1287 omp_implementation_selectors, omp_user_selectors): New variables.
1288 (cp_parser_omp_context_selector,
1289 cp_parser_omp_context_selector_specification,
1290 cp_finish_omp_declare_variant): New functions.
1291 (cp_parser_late_parsing_omp_declare_simd): Handle also declare variant.
1292 (cp_parser_omp_declare): Handle declare variant.
1294 2019-10-09 Jason Merrill <jason@redhat.com>
1296 * cp-tree.h (template_info_decl_check): Check ENABLE_TREE_CHECKING.
1298 2019-10-09 Marek Polacek <polacek@redhat.com>
1300 PR c++/91364 - P0388R4: Permit conversions to arrays of unknown bound.
1301 PR c++/69531 - DR 1307: Differently bounded array parameters.
1302 PR c++/88128 - DR 330: Qual convs and pointers to arrays of pointers.
1303 * call.c (build_array_conv): Build ck_identity at the beginning
1305 (standard_conversion): Pass bounds_none to comp_ptr_ttypes_const.
1306 (maybe_warn_array_conv): New.
1307 (convert_like_real): Call it. Add an error message about converting
1308 from arrays of unknown bounds.
1309 (conv_get_original_expr): New.
1310 (nelts_initialized_by_list_init): New.
1311 (conv_binds_to_array_of_unknown_bound): New.
1312 (compare_ics): Implement list-initialization ranking based on
1313 array sizes, as specified in DR 1307 and P0388R.
1314 * cp-tree.h (comp_ptr_ttypes_const): Adjust declaration.
1315 (compare_bounds_t): New enum.
1316 * typeck.c (comp_array_types): New bool and compare_bounds_t
1317 parameters. Use them.
1318 (structural_comptypes): Adjust the call to comp_array_types.
1319 (similar_type_p): Handle ARRAY_TYPE.
1320 (build_const_cast_1): Pass bounds_none to comp_ptr_ttypes_const.
1321 (comp_ptr_ttypes_real): Don't check cv-quals of ARRAY_TYPEs. Use
1322 comp_array_types to compare array types. Look through arrays as per
1324 (comp_ptr_ttypes_const): Use comp_array_types to compare array types.
1325 Look through arrays as per DR 330.
1327 2019-10-09 Marek Polacek <polacek@redhat.com>
1329 PR c++/92032 - DR 1601: Promotion of enum with fixed underlying type.
1330 * call.c (standard_conversion): When converting an enumeration with
1331 a fixed underlying type to the underlying type, give it the cr_promotion
1333 (compare_ics): Implement a tiebreaker as per CWG 1601.
1335 2019-10-08 Andrew Sutton <asutton@lock3software.com>
1336 Jason Merrill <jason@redhat.com>
1338 Update the concepts implementation to conform to the C++20
1339 specification, improve compile times, and generally clean up
1341 * call.c (build_new_function_call): Don't evaluate concepts here.
1342 (constraint_failure): Don't record the template.
1343 (print_z_candidate): Don't extract the template.
1344 * class.c (add_method): When overloading, hide ineligible special
1346 (check_methods): Set TYPE_HAS_COMPLEX_* here.
1347 * constexpr.c (cxx_eval_constant_expression): Evaluate concepts.
1348 (maybe_initialize_fundef_copies_table): Remove.
1349 (get_fundef_copy): Use hash_map_safe_get_or_insert.
1350 (clear_cv_and_fold_caches): Clear the satisfaction cache.
1351 * constraint.cc (known_non_bool_p): New.
1352 (parsing_constraint_expression_sentinel): Renamed from
1353 expanding_constraint_sentinel.
1354 (check_constraint_operands): New.
1355 (check_constraint_atom): New.
1356 (finish_constraint_binary_op): New.
1357 (finish_constraint_or_expr): Likewise.
1358 (finish_constraint_and_expr): Likewise.
1359 (finish_constraint_primary_expr): Likewise.
1360 (combine_constraint_expressions): New.
1361 (finish_requires_expr): Add location parm.
1362 (get_concept_definition): Return the initializer of concept definitions.
1363 (get_template_head_requirements): New.
1364 (get_trailing_function_requirements): New.
1365 (deduce_constrained_parameter): Check if the identifier or template-id
1366 is a concept definition.
1367 (resolve_concept_definition_check): Removed.
1368 (resolve_variable_concept_check): Removed.
1369 (resolve_concept_check): New.
1370 (resolve_constraint_check): Handle concept definitions.
1371 converting arguments.
1372 (function_concept_check_p): Removed.
1373 (variable_concept_check_p): Removed.
1374 (unpack_concept_check): New.
1375 (get_concept_check_template): New.
1376 (build_call_check): Moved and renamed to build_function_check.
1377 (build_concept_check_arguments): make static.
1378 (build_function_check): Always do overload resolution
1379 in order to force conversion of template arguments (i.e., actually
1380 check that the use of a concept is valid).
1381 (build_standard_check): Renamed from build_real_concept_check.
1382 (build_real_concept_check): Build checks for C++2a concepts by
1383 (build_wildcard_concept_check): New.
1384 (build_concept_check): Use build_real_concept_check. New overload.
1385 (build_constraints): Save expressions, not normalized constraints.
1386 (build_concept_id): New. Pass tf_warning_or_error.
1387 (build_type_constraint): New.
1388 (finish_type_constraints): New.
1389 (associate_classtype_constraints): Also add constraints to union
1390 types. Note the original declaration in errors. Don't return
1391 error_mark_node in order to avoid an assertion later.
1392 (push_down_pack_expansion): Remove.
1393 (finish_shorthand_constraint): Make fold expressions, not naked
1394 parameter packs. Always apply the constraint to each template argument.
1395 (check_introduction_list): New. Fail if not enough
1396 names are introduced.
1397 (finish_template_introduction): Don't normalize constraints. Pass
1398 tsubst flags. Check for insufficient introductions.
1399 (placeholder_extract_concept_and_args): Handle the template-id case.
1400 Unpack function concept checks correctly.
1401 (tsubst_simple_requirement): Return errors if they occur. Don't
1402 process as a template.
1403 (tsubst_type_requirement): Likewise.
1404 (type_deducible_p): New. Wrap the input expression in parens for the
1405 purpose of deduction.
1406 (expression_convertible_t): New.
1407 (tsubst_compound_requirement): Use new deduction, conversion predicates.
1408 (tsubst_nested_requirement): Return errors if they occur. Don't
1409 process as a template. Instantiate and evaluate the nested requirement.
1410 (tsubst_valid_expression_requirement): New.
1411 (tsubst_simple_requirement): Use tsubst_valid_expression_requirement.
1412 (tsubst_compound_requirement): Use tsubst_valid_expression_requirement.
1413 (check_constaint_variables): New.
1414 (tsubst_constraint_variables): Check that type substitutions are valid.
1415 (tsubst_requires_expr): Likewise. Produce new requires-exprs during
1416 template substitution. Copy the previous local specialization stack,
1417 so references to non-local parameters can be found. Use cp_unevaluated.
1418 (tsubst_constraint): New. Don't evaluate concept checks.
1420 (norm_info): New. Used to build a normalization tree for concept check
1422 (debug_parameter_mapping): New.
1423 (debug_argument_list): New.
1424 (expand_concept): Removed.
1425 (normalize_logical_operation): Pass subst_info through call.
1426 (normalize_pack_expansion): Remove.
1427 (normalize_simple_requirement): Removed
1428 (normalize_type_requirement): Removed
1429 (normalize_compound_requirement): Removed
1430 (normalize_nested_requirement): Removed
1431 (normalize_requirement): Removed
1432 (normalize_requirements): Removed
1433 (normalize_requires_expression): Removed
1434 (normalize_variable_concept_check): Removed.
1435 (normalize_function_concept_check): Removed.
1436 (normalize_concept_check): Merged all normalize_*_check here.
1437 Substitute through written template arguments before normalizing the
1438 definition. Only substitute the innermost template arguments.
1439 (check_for_logical_overloads): Delete.
1440 (map_arguments): New. Associate template parameters with arguments.
1441 (build_parameter_mapping): New. Extract used parameters.
1442 (normalize_expression): Rewrite.
1443 (normalize_conjunction): Removed
1444 (normalize_disjunction): Removed
1445 (normalize_predicate_constraint): Removed
1446 (normalize_parameterized_constraint): Removed
1447 (normalized_map): New variable.
1448 (get_normalized_constraints): New entry point for normalization.
1449 Establishes a timer.
1450 (get_normalized_constraints_from_info): New.
1451 (get_normalized_constraints_from_decl): New. Turn on template processing
1452 prior to normalization. Handle inheriting ctors. Build the
1453 normalization arguments from the full set of template parameters of the
1454 most general template. This guarantees that we have no concrete arguments
1455 in the parameter mapping (e.g., from template members of class
1456 templates). Cache normalizations.
1457 (normalize_concept_definition): New. Cache normalizations.
1458 (normalize_template_requirements): New.
1459 (normalize_nontemplate_requirements): New.
1460 (normalize_constraint_expression): New.
1461 (tsubst_parameter_mapping): New.
1462 (get_mapped_args): New.
1463 (parameter_mapping_equivalent_p): New. Use template_args_equal.
1464 (atomic_constraints_identical_p): New.
1465 (hash_atomic_constraint): New.
1466 (satisfying_constraint_p): New. Guard against recursive evaluation of
1467 constraints during satisfaction.
1468 (satisfy_conjunction): New.
1469 (satisfy_disjunction): New.
1470 (sat_entry): New class for hashing satisfaction results.
1471 (sat_hasher): New hash traits.
1473 (get_satisfaction): New. Returns cached satisfaction result.
1474 (save_satisfaction): New. Caches a satisfaction result.
1475 (clear_satisfaction_cache): New.
1476 (satisfaction_cache): New. Helps manage satisfaction cache requests.
1477 (decl_satisfied_cache): New.
1478 (satisfy_atom): New.
1479 (satisfy_constraint_r): New.
1480 (satisfy_constraint): Use new satisfaction algorithm.
1481 (evaluate_concept_check): New.
1482 (evaluate_concept): Removed.
1483 (evaluate_function_concept): Removed.
1484 (evaluate_variable_concept): Removed.
1485 (satisfy_constraint_expression): New.
1486 (constraint_expression_satisfied_p): New.
1487 (constraints_satisfied_p): Use strip_inheriting_ctors. Use
1488 push_/pop_access_scope.
1489 (more_constrained): Normalize before calling out to subsumption. Allow
1490 classes as arguments.
1491 (strictly_subsumes): Allow non-templates as arguments. Accept a new
1493 (weakly_subsumes): New.
1494 (at_least_as_constrained): Removed.
1495 (diagnose_other_expression): Removed.
1496 (diagnose_predicate_constraint): Removed.
1497 (diagnose_pack_expansion): Removed.
1498 (diagnose_check_constraint): Removed.
1499 (diagnose_logical_constraint): Removed.
1500 (diagnose_expression_constraint): Removed.
1501 (diagnose_type_constraint): Removed.
1502 (diagnose_implicit_conversion_constraint): Removed.
1503 (diagnose_argument_deduction_constraint): Removed.
1504 (diagnose_exception_constraint): Removed.
1505 (diagnose_parameterized_constraint): Removed.
1506 (diagnose_argument_deduction_constraint): Removed.
1507 (diagnose_argument_deduction_constraint): Removed.
1508 (diagnose_argument_deduction_constraint): Removed.
1509 (diagnose_trait_expr): New.
1510 (diagnose_requires_expr): New.
1511 (diagnose_atomic_constraint): New.
1512 (diagnose_valid_expression) Stop wrongly diagnosing valid expressions.
1513 Don't substitute as if in template decls. This causes substitution
1514 to generate expressions that aren't suitable for use with the noexcept
1516 (diagnose_valid_type) Likewise.
1517 (diagnose_compound_requirement) Actually emit diagnostics for
1518 the causes of errors.Call force_paren_expr_uneval.
1519 (diagnose_declaration_constraints): Turn on template processing to
1520 suppress certain analyses.
1521 * cp-objcp-common.c (cp_common_init_ts): Make concepts typed.
1522 (cp_get_debug_type): Use hash_map_safe_*.
1523 * cp-tree.h: New function declarations for semantic actions, other
1524 facilities. Remove declaration no longer used or needed. Remove
1525 unused _CONSTR macros.
1526 (LANG_DECL_HAS_MIN): Add CONCEPT_DECL.
1527 (template_info_decl_check): Factor macro check into an inline function.
1528 (DECL_TEMPLATE_INFO): Use new check facility.
1529 (finish_concept_definition): New. Don't invalid concept declarations
1530 with invalid initializers.
1531 (find_template_parameters): New.
1532 (concept_definition_p): New.
1533 (concept_check_p): New.
1534 (variable_concept_check_p): New.
1535 (force_paren_expr_uneval): New.
1536 (ovl_iterator::using_p): A USING_DECL by itself was also
1537 introduced by a using-declaration.
1538 (struct tree_template_info): Use tree_base instead of
1539 tree_common. Add tmpl and args fields.
1540 (TI_TEMPLATE, TI_ARGS): Adjust.
1541 (DECLTYPE_FOR_INIT_CAPTURE): Remove.
1542 (CONSTR_CHECK, CONSTR_INFO, CONSTR_EXPR, CONSTR_CONTEXT): New.
1543 (ATOMIC_CONSTR_MAP, TRAIT_EXPR_LOCATION): New.
1544 (struct tree_trait_expr): Add locus field.
1545 (enum tsubst_flags): Add tf_norm as a hint to generate normalization
1546 context when diagnosing constraint failure.
1547 * cp-tree.def: Remove unused _CONSTR nodes and rename PRED_CONSTR
1549 (CONCEPT_DECL): New.
1550 * cxx-pretty-print.c: Remove constraint printing code.
1551 (pp_cxx_concept_definition): New.
1552 (pp_cxx_template_declaration): Print concept definitions.
1553 (pp_cxx_check_constraint): Update printing for concept definitions.
1554 (pp_cxx_nested_name_specifier): Fix a weird
1555 case where we're printing '::::' for concepts.
1556 (simple_type_specifier): Print requirements for placeholder types.
1557 (pp_cxx_constrained_type_spec): Print the associated requirements of
1559 (pp_cxx_compound_requirement): Add space before the '->'.
1560 (pp_cxx_parameter_mapping): Print the parameter mapping.
1561 (pp_cxx_atomic_constraint): Use the function above.
1562 * decl.c (redeclaration_error_message): New error for concepts.
1563 (grokdeclarator): Check for and disallow decltype(auto) in parameter
1565 (grokfndecl): Don't normalize constraints. Add check for constraints
1567 (grokvardecl): Don't normalize constraints.
1568 (grok_special_member_properties): Don't set TYPE_HAS_COMPLEX_*.
1569 (function_requirements_equivalent_p): New. Compare trailing
1570 requires clauses. Compare combined constraints in pre-C++20 mode.
1571 (decls_match): Compare trailing requires clauses. Compare template
1572 heads for function templates. Remove old constraint comparison.
1573 Simplify comparison of functions, function templates.
1574 (duplicate_function_template_decls): New. Refactor a nasty if
1575 condition into a single predicate.
1576 (require_deduced_type): Don't complain if we already complained about
1578 (finish_function): Perform auto deduction to ensure that constraints
1579 are checked even when functions contain no return statements. Only do
1580 auto deduction if we haven't previously seen any return statements.
1581 This prevents multiple diagnostics of the same error.
1582 (store_decomp_type): Remove.
1583 (cp_finish_decomp): Use hash_map_safe_put.
1584 * error.c: Remove constraint printing code.
1585 (dump_decl): Dump concept definitions. Handle wildcard declarations.
1586 (dump_template_decl): Likewise.
1587 (dump_type): Print associated requirements for placeholder
1589 (rebuild_concept_check): New.
1590 (maybe_print_single_constraint_context): New.
1591 (maybe_print_constraint_context): Recursively print nested contexts.
1592 * init.c (get_nsdmi): Use hash_map_safe_*.
1593 * lambda.c (maybe_add_lambda_conv_op): Bail if deduction failed.
1594 (add_capture): Copy parameter packs from init.
1595 (lambda_capture_field_type): Always use auto for init-capture.
1596 * logic.cc: Completely rewrite.
1597 (constraint_hash): New.
1598 (clause/ctor): Save atoms in the hash table.
1599 (replace): Save atoms during replacement.
1600 (insert): Save atoms during insertion.
1601 (contains): Only search the hash table for containment.
1602 (clause): Keep a hash of atomic constraints.
1603 (clause::clause): Explicitly copy the hash table when copying.
1604 (disjunction_p, conjunction_p, atomic_p, dnf_size, cnf_size): New.
1605 (diagnose_constraint_size): New.
1606 (subsumes_constraints_nonnull): Compare the sizes of normalized formula
1607 to determine the cheapest decomposition.
1608 * name-lookup.c (diagnose_name_conflict): Diagnose name issues with
1610 (matching_fn_p): Check constraints.
1611 (push_class_level_binding_1): Move overloaded functions case down,
1612 accept FUNCTION_DECL as target_decl.
1613 * parser.c (enum required_token): New required token for auto.
1614 (make_location): Add overload taking lexer as last parm.
1615 (cp_parser_required_error): Diagnose missing auto.
1616 (cp_parser_diagnose_ungrouped_constraint_plain): New.
1617 (cp_parser_diagnose_ungrouped_constraint_plain): New.
1618 (cp_parser_constraint_primary_expression): New. Tentatively parse the
1619 primary expression. If that fails tentatively parse a lower
1620 precedence expression in order to diagnose the error.
1621 (cp_parser_check_non_logical_constraint): New. Performs a trial
1622 parse of the right-hand-side of non-logical operators in order to
1623 generate good diagnostics.
1624 (cp_parser_constraint_logical_and_expression): New.
1625 (cp_parser_constraint_logical_or_expression): New.
1626 (cp_parser_requires_clause_expression): New.
1627 (cp_parser_requires_clause): Renamed to cp_parser_constraint_expression.
1628 (cp_parser_requires_clause_opt): Parse the requires-clause differently
1629 in -fconcepts and -std=c++2a modes.
1630 (cp_parser_requirement_list): Rename to cp_parser_requirement_seq.
1631 Rewrite so that semicolons are parsed
1632 along with requirements, not the sequence.
1633 (cp_parser_simple_requirement): Expect a semicolon at end.
1634 (cp_parser_compound_requirement): Expect a semicolon at end. Only
1635 allow trailing-return-type with -fconcepts-ts.
1636 (cp_parser_nested_requirement): Expect a semicolon at end. Parse
1637 constraint-expressions.
1638 (cp_parser_concept_definition): New. Don't fail parsing the concept
1639 definition if the initializer is ill-formed. Don't declare the concept
1640 before parsing the initializer.
1641 (cp_parser_constraint_expression): Declare earlier.
1642 (cp_parser_type_requirement): Current scope is not valid.
1643 (cp_parser_requires_expression): Commit to the tentative parse.
1644 (cp_parser_decl_specifier_seq): Warn when concept appears to be used
1645 as a decl-specifier.
1646 (cp_parser_template_declaration_after_parameters): Parse concept
1648 (cp_parser_template_id): Don't try to resolve a concept template-id yet.
1649 (cp_parser_template_id_expr): Resolve it as a concept check.
1650 (cp_parser_decl_specifier_seq): Warn on 'concept bool'.
1651 (cp_parser_type_parameter): Combine expressions not
1653 (cp_parser_explicit_template_declaration): Combine expressions not
1655 (cp_parser_maybe_concept_name): Removed.
1656 (cp_parser_simple_type_specifier): Handle an error condition of
1657 a bad constrained type specifier. Expect auto or decltype after
1658 a concept name. Also handle the case where we have a template-id
1660 (cp_parser_template_introduction): Diagnose errors on invalid
1661 introductions. Give up if it doesn't start with a concept name.
1662 Pedwarn if not -fconcepts-ts.
1663 (synthesize_implicit_template_parm): Don't do consistent binding.
1664 Use a new flag for constrained parameters. Combine expressions,
1665 not constraints. Fail if we get a placeholder in block scope.
1666 Placeholders that do not constrain types are not allowed in parameter
1667 declarations, so don't handle them.
1668 (cp_parser_placeholder_type_specifier): New. Implement parsing of
1669 placeholder type specifiers following a concept name or partial
1670 concept check. Disallow decltype(auto) parameters.
1671 (cp_parser_nested_name_specifier_opt): If the token is already
1672 CPP_NESTED_NAME_SPECIFIER, leave it alone.
1673 (cp_parser_id_expression, cp_parser_unqualified_id): Call
1674 cp_parser_template_id_expr.
1675 (cp_parser_placeholder_type_specifier): Add tentative parm. Don't
1676 expect a WILDCARD_DECL.
1677 (cp_parser_trait_expr): Pass trait_loc down.
1678 (cp_parser_postfix_expression): Do set location of dependent member
1680 * pt.c (finish_concept_definition): New.
1681 (push_template_decl_real): Handle concept definitions.
1682 (start_concept_definition): Let push_template_decl_real handle the
1683 creation of the template.
1684 (get_constraints): Return null if the table hasn't been initialized.
1685 (tsubst_copy_and_build): Build template-id expressions for concept
1687 [TRAIT_EXPR]: Pass trait_loc down.
1688 (lookup_template_class_1): Add the template name to the constraint
1690 (lookup_and_finish_template_variable): Build concept checks
1691 with the correct arguments.
1692 (tsubst_function_decl): Don't substitute through constraints.
1693 Always associate constraints with functions.
1694 (template_parm_level_and_index): Make non-static.
1695 (for_each_template_parm_r): Handle requires expressions.
1696 (keep_template_parm): New.
1697 (find_template_parameters): New.
1698 (more_specialized_fn): Change how winners and losers are chosen.
1699 (make_constrained_auto): Don't normalize constraints.
1700 (template_parameters_equivalent_p): New. Compare template
1701 parameters. Add a comparison for implicitly vs. explicitly declared
1703 (template_parameter_lists_equivalent_p): New. Compare template
1705 (template_requirements_equivalent_p): New.
1706 (template_heads_equivalent_p): New. Compare template heads.
1707 (template_parameter_constraints_equivalent_p): New.
1708 (is_compatible_template_arg): Use weakly_subsumes.
1709 (maybe_new_partial_specialization): Use new constraint comparison
1710 for finding specializations.
1711 (process_partial_specialization): Pass main template as argument.
1712 (more_specialized_partial_spec): Don't immediately return when
1714 (make_constrained_auto): Handle concept definitions.
1715 (do_auto_deduction): Update auto deduction for new concept model.
1716 Extract the function concept correctly; rename constr to check to
1717 reflect the kind of node.
1718 (tsubst): Adjust wildcard argument during substitution.
1719 [DECLTYPE_TYPE]: Remove init-capture handling.
1720 (tsubst_copy_and_build): Build concept checks, not template ids.
1721 Defer checks of function concepts. Handle concepts before variable
1722 templates. Handle calls to function concepts explicitly.
1723 (coerce_template_parms): Use concept_definition_p. Handle a deduction
1724 error where a potentially empty pack can be supplied after the last
1725 parameter of a concept.
1726 (finish_template_variable): Don't process concepts here.
1727 (instantiation_dependent_r): Use concept_check_p.
1728 (tsubst_template_args): Make non-static.
1729 (make_constrained_placeholder_type): New. Refactored from
1730 make_constrained_auto.
1731 (make_constrained_auto) Use make_constrained_placeholder_type.
1732 (make_constrained_decltype_auto) New.
1733 (tsubst_function_parms): New.
1734 (value_dependent_expression_p) [TEMPLATE_ID_EXPR]: Use
1735 concept_definition_p.
1736 (push_access_scope, pop_access_scope): No longer static.
1737 (tsubst_template_parm): Substitute TEMPLATE_PARM_CONSTRAINTS.
1738 (tsubst_friend_function): Use tsubst_constraint. Use generic_targs_for.
1739 (get_underlying_template) Use generic_targs_for.
1740 (uses_parameter_packs): Return tree.
1741 (gen_elem_of_pack_expansion_instantiation): Don't push
1742 local_specialization_stack.
1743 (prepend_one_capture): New.
1744 (tsubst_lambda_expr): Use prepend_one_capture. Don't touch
1745 local_specializations.
1746 (template_parms_level_to_args): No longer static.
1747 (add_outermost_template_args): Likewise.
1748 (find_template_parameter_info): New. Provide context for finding
1749 template parameters.
1750 (keep_template_parm): Don't keep parameters declared at depth levels
1751 greater than those of the template parameters of the source declaration.
1752 Don't propagate cv-qualified types. Return 0, so we find all template
1753 parameters, not the just first.
1754 (any_template_parm_r): New. Handle cases that are mishandled by
1755 for_each_template_parm_r.
1756 (generic_targs_for): Factor out of coerce_template_args_for_ttp.
1757 (tsubst_argument_pack): Factor out of tsubst_template_args.
1758 (constraint_sat_entry): Removed.
1759 (constraint_sat_hasher): Removed.
1760 (concept_spec_entry): Removed.
1761 (concept_spec_hasher): Removed.
1762 (constraint_memos): Removed.
1763 (concept_memos): Removed.
1764 (lookup_constraint_satisfaction): Removed.
1765 (memoize_constraint_satisfaction): Removed.
1766 (lookup_concept_satisfaction): Removed.
1767 (memoize_concept_satisfaction): Removed.
1768 (concept_expansions): Removed.
1769 (get_concept_expansion): Removed.
1770 (save_concept_expansion): Removed.
1771 (init_constraint_processing): Remove initialization of non-existing
1773 (find_template_requirement): New. Search for the sub-requirement
1774 within the associated constraints.
1775 (convert_generic_types_to_packs): Also transform the associated
1776 constraint and update the current template requirements.
1777 (store_defaulted_ttp, lookup_defaulted_ttp): Remove.
1778 (add_defaults_to_ttp): Use hash_map_safe_*.
1779 * semantics.c (finish_call_expr): Diagnose calls to concepts.
1780 Handle concept checks explicitly.
1781 (finish_id_expression): Evaluate variable concepts as part of
1782 id-expression processing. Don't treat variable concepts as variables,
1783 and don't process function concepts as plain id-expressions.
1784 (force_paren_expr): Add even_uneval parm.
1785 (finish_trait_expr): Add location parm.
1786 * tree.c (special_memfn_p): New.
1787 (cp_expr_location): Handle TRAIT_EXPR.
1788 * typeck.c (check_return_expr): Actually use the diagnostic kind
1789 when performing return-type deduction.
1790 * typeck2.c (build_functional_cast): Don't rely on the location of
1793 2019-10-09 Paolo Carlini <paolo.carlini@oracle.com>
1795 * decl.c (grok_ctor_properties): Use DECL_SOURCE_LOCATION.
1796 * typeck.c (cp_build_binary_op): Use the op_location_t argument
1797 in many error messages.
1799 2019-10-08 Martin Sebor <msebor@redhat.com>
1802 * call.c (maybe_warn_class_memaccess): Handle arrays.
1804 2019-10-07 Paolo Carlini <paolo.carlini@oracle.com>
1806 * call.c (resolve_args): Use cp_expr_loc_or_input_loc in one place.
1807 * decl.c (grokdeclarator): Use id_loc in one place.
1808 * decl2.c (build_anon_union_vars): Use DECL_SOURCE_LOCATION.
1809 * parser.c (cp_parser_delete_expression): Fix the location of the
1810 returned expression.
1811 (cp_parser_throw_expression): Likewise.
1812 * pt.c (determine_specialization): Use DECL_SOURCE_LOCATION.
1814 2019-10-05 Jakub Jelinek <jakub@redhat.com>
1816 PR c++/91369 - Implement P0784R7: constexpr new
1817 * cp-tree.h (enum cp_tree_index): Add CPTI_HEAP_UNINIT_IDENTIFIER,
1818 CPTI_HEAP_IDENTIFIER and CPTI_HEAP_DELETED_IDENTIFIER.
1819 (heap_uninit_identifier, heap_identifier, heap_deleted_identifier):
1821 (type_has_constexpr_destructor, build_new_constexpr_heap_type,
1822 cxx_constant_dtor): Declare.
1823 * class.c (type_maybe_constexpr_default_constructor): Make static.
1824 (type_maybe_constexpr_destructor, type_has_constexpr_destructor): New
1826 (finalize_literal_type_property): For c++2a, don't clear
1827 CLASSTYPE_LITERAL_P for types without trivial destructors unless they
1828 have non-constexpr destructors.
1829 (explain_non_literal_class): For c++2a, complain about non-constexpr
1830 destructors rather than about non-trivial destructors.
1831 * constexpr.c: Include stor-layout.h.
1832 (struct constexpr_global_ctx): New type.
1833 (struct constexpr_ctx): Add global field, remove values and
1834 constexpr_ops_count.
1835 (cxx_replaceable_global_alloc_fn): New inline function.
1836 (cxx_eval_call_expression): For c++2a allow calls to replaceable
1837 global allocation functions, for new return address of a heap uninit
1838 var, for delete record its deletion. Change ctx->values->{get,put} to
1839 ctx->global->values.{get,put}.
1840 (non_const_var_error): Add auto_diagnostic_group sentinel. Emit
1841 special diagnostics for heap variables.
1842 (cxx_eval_store_expression): Change ctx->values->{get,put} to
1843 ctx->global->values.{get,put}.
1844 (cxx_eval_loop_expr): Initialize jump_target if NULL. Change
1845 new_ctx.values->remove to ctx->global->values.remove.
1846 (cxx_eval_constant_expression): Change *ctx->constexpr_ops_count
1847 to ctx->global->constexpr_ops_count. Change ctx->values->{get,put} to
1848 ctx->global->values.{get,put}.
1849 <case NOP_EXPR>: Formatting fix. On cast of replaceable global
1850 allocation function to some pointer type, adjust the type of
1851 the heap variable and change name from heap_uninit_identifier
1853 (find_heap_var_refs): New function.
1854 (cxx_eval_outermost_constant_expr): Add constexpr_dtor argument,
1855 handle evaluation of constexpr dtors and add tracking of heap
1856 variables. Use tf_no_cleanup for get_target_expr_with_sfinae.
1857 (cxx_constant_value): Adjust cxx_eval_outermost_constant_expr caller.
1858 (cxx_constant_dtor): New function.
1859 (maybe_constant_value, fold_non_dependent_expr_template,
1860 maybe_constant_init_1): Adjust cxx_eval_outermost_constant_expr
1862 (potential_constant_expression_1): Ignore clobbers. Allow
1863 COND_EXPR_IS_VEC_DELETE for c++2a.
1864 * decl.c (initialize_predefined_identifiers): Add heap identifiers.
1865 (decl_maybe_constant_destruction): New function.
1866 (cp_finish_decl): Don't clear TREE_READONLY for constexpr variables
1867 with non-trivial, but constexpr destructors.
1868 (register_dtor_fn): For constexpr variables with constexpr non-trivial
1869 destructors call cxx_maybe_build_cleanup instead of adding destructor
1871 (expand_static_init): For constexpr variables with constexpr
1872 non-trivial destructors call cxx_maybe_build_cleanup.
1873 (grokdeclarator): Allow constexpr destructors for c++2a. Formatting
1875 (cxx_maybe_build_cleanup): For constexpr variables with constexpr
1876 non-trivial destructors call cxx_constant_dtor instead of adding
1877 destructor calls at runtime.
1878 * init.c: Include stor-layout.h.
1879 (build_new_constexpr_heap_type, maybe_wrap_new_for_constexpr): New
1881 (build_new_1): For c++2a and new[], add cast around the alloc call
1882 to help constexpr evaluation figure out the type of the heap storage.
1883 (build_vec_delete_1): Set DECL_INITIAL of tbase and emit a DECL_EXPR
1884 for it instead of initializing an uninitialized variable.
1885 * method.c: Include intl.h.
1886 (SFK_CTOR_P, SFK_DTOR_P, SFK_ASSIGN_P, SFK_COPY_P, SFK_MOVE_P): Move
1887 definitions earlier.
1888 (process_subob_fn): Add sfk argument, adjust non-constexpr call
1889 diagnostics based on it.
1890 (walk_field_subobs): Formatting fixes. Adjust process_subob_fn caller.
1891 (synthesized_method_base_walk): Likewise.
1892 (synthesized_method_walk): Set *constexpr_p to true for dtors in c++2a.
1893 Fix up DR number in comment.
1894 (implicitly_declare_fn): Formatting fix.
1895 * typeck2.c (store_init_value): Don't call cp_fully_fold_init on
1896 initializers of automatic non-constexpr variables in constexpr
1899 2019-10-04 Jakub Jelinek <jakub@redhat.com>
1902 * constexpr.c (cxx_fold_indirect_ref_1): New function.
1903 (cxx_fold_indirect_ref): Use it.
1906 * cp-gimplify.c (cp_gimplify_expr) <case CALL_EXPR>: For
1907 -fstrong-eval-order ensure CALL_EXPR_FN side-effects are evaluated
1908 before any arguments. Additionally, ensure CALL_EXPR_FN that isn't
1909 invariant nor OBJ_TYPE_REF nor SSA_NAME is forced into a temporary.
1911 2019-10-03 Paolo Carlini <paolo.carlini@oracle.com>
1913 * init.c (build_new): Use cp_expr_loc_or_input_loc in two places.
1914 * name-lookup.c (do_pushdecl): Use DECL_SOURCE_LOCATION.
1915 (push_class_level_binding_1): Likewise.
1916 (set_decl_namespace): Likewise.
1918 2019-10-03 Jakub Jelinek <jakub@redhat.com>
1920 * constexpr.c (cxx_eval_constant_expression) <case CLEANUP_STMT>: If
1921 not skipping upon entry to body, run cleanup with the same *jump_target
1922 as it started to run the cleanup even if the body returns, breaks or
1924 (potential_constant_expression_1): Allow CLEANUP_STMT.
1926 * constexpr.c (cxx_eval_store_expression): Formatting fix. Handle
1927 const_object_being_modified with array type.
1929 2019-10-02 Jason Merrill <jason@redhat.com>
1931 * typeck2.c (store_init_value): Only clear_cv_and_fold_caches if the
1934 2019-09-30 Jason Merrill <jason@redhat.com>
1936 Use hash_map_safe_* functions.
1937 * constexpr.c (maybe_initialize_fundef_copies_table): Remove.
1938 (get_fundef_copy): Use hash_map_safe_get_or_insert.
1939 * cp-objcp-common.c (cp_get_debug_type): Use hash_map_safe_*.
1940 * decl.c (store_decomp_type): Remove.
1941 (cp_finish_decomp): Use hash_map_safe_put.
1942 * init.c (get_nsdmi): Use hash_map_safe_*.
1943 * pt.c (store_defaulted_ttp, lookup_defaulted_ttp): Remove.
1944 (add_defaults_to_ttp): Use hash_map_safe_*.
1946 2019-10-02 Richard Biener <rguenther@suse.de>
1949 * decl.c (build_ptrmemfunc_type): Mark pointer-to-member
1950 fat pointer structure members as DECL_NONADDRESSABLE_P.
1952 2019-09-28 Marek Polacek <polacek@redhat.com>
1954 PR c++/91889 - follow-up fix for DR 2352.
1955 * call.c (involves_qualification_conversion_p): New function.
1956 (direct_reference_binding): Build a ck_qual if the conversion
1957 would involve a qualification conversion.
1958 (convert_like_real): Strip the conversion created by the ck_qual
1959 in direct_reference_binding.
1961 PR c++/91921 - stray warning with -Woverloaded-virtual.
1962 * class.c (warn_hidden): Only emit the second part of
1963 -Woverloaded-virtual if the first part was issued. Use inform instead
1966 PR c++/91923 - failure-to-SFINAE with class type NTTP in C++17.
1967 * pt.c (invalid_nontype_parm_type_p): Only emit errors when
1970 2019-09-27 Jakub Jelinek <jakub@redhat.com>
1973 * parser.c (cp_parser_omp_var_list_no_open): Parse predefined
1975 * semantics.c (finish_omp_clauses): Allow predefined variables in
1976 shared and firstprivate clauses, even when they are predetermined
1978 * cp-gimplify.c (cxx_omp_predetermined_sharing_1): Return
1979 OMP_CLAUSE_DEFAULT_SHARED for predefined variables.
1981 2019-09-27 Jason Merrill <jason@redhat.com>
1983 * constexpr.c (cxx_fold_indirect_ref): Use similar_type_p.
1984 (cxx_eval_indirect_ref): Likewise. Improve error location.
1986 * cp-tree.h (class iloc_sentinel): New.
1987 * decl.c (grokdeclarator, finish_enum_value_list): Use it.
1988 * mangle.c (mangle_decl_string): Use it.
1989 * pt.c (perform_typedefs_access_check): Use it.
1991 2019-09-27 Richard Sandiford <richard.sandiford@arm.com>
1993 * cp-tree.h (build_cxx_call): Take the original function decl
1994 as an optional final parameter.
1995 (cp_build_function_call_vec): Likewise.
1996 * call.c (build_cxx_call): Likewise. Pass all built-in calls to
1997 check_builtin_function_arguments.
1998 * typeck.c (build_function_call_vec): Take the original function
1999 decl as an optional final parameter and pass it to
2000 cp_build_function_call_vec.
2001 (cp_build_function_call_vec): Take the original function
2002 decl as an optional final parameter and pass it to build_cxx_call.
2004 2019-09-25 Marek Polacek <polacek@redhat.com>
2006 PR c++/91877 - ICE with converting member of packed struct.
2007 * call.c (convert_like_real): Use similar_type_p in an assert.
2009 2019-09-25 Paolo Carlini <paolo.carlini@oracle.com>
2011 * name-lookup.c (check_extern_c_conflict): Use DECL_SOURCE_LOCATION.
2012 (check_local_shadow): Use it in three additional places.
2014 2019-09-24 Jason Merrill <jason@redhat.com>
2016 * parser.c (cp_parser_postfix_expression): Do set location of
2017 dependent member call.
2019 2019-09-24 Marek Polacek <polacek@redhat.com>
2021 PR c++/91868 - improve -Wshadow location.
2022 * name-lookup.c (check_local_shadow): Use DECL_SOURCE_LOCATION
2023 instead of input_location.
2025 PR c++/91845 - ICE with invalid pointer-to-member.
2026 * expr.c (mark_use): Use error_operand_p.
2027 * typeck2.c (build_m_component_ref): Check error_operand_p after
2028 calling mark_[lr]value_use.
2030 2019-09-23 Paolo Carlini <paolo.carlini@oracle.com>
2032 * pt.c (check_explicit_specialization): Use cp_expr_loc_or_input_loc.
2033 (process_partial_specialization): Likewise.
2034 (convert_nontype_argument_function): Likewise.
2035 (invalid_tparm_referent_p): Likewise.
2036 (convert_template_argument): Likewise.
2037 (check_valid_ptrmem_cst_expr): Tidy.
2039 2019-09-23 Jason Merrill <jason@redhat.com>
2041 PR c++/91809 - bit-field and ellipsis.
2042 * call.c (convert_arg_to_ellipsis): Don't call decay_conversion for
2043 arithmetic arguments.
2045 2019-09-23 Marek Polacek <polacek@redhat.com>
2047 PR c++/91844 - Implement CWG 2352, Similar types and reference binding.
2048 * call.c (reference_related_p): Use similar_type_p instead of
2050 (reference_compatible_p): Update implementation to match CWG 2352.
2051 * cp-tree.h (similar_type_p): Declare.
2052 * typeck.c (similar_type_p): New.
2054 2019-09-22 Marek Polacek <polacek@redhat.com>
2056 PR c++/91819 - ICE with operator++ and enum.
2057 * call.c (build_new_op_1): Set arg2_type.
2059 2019-09-17 Jason Merrill <jason@redhat.com>
2061 * parser.c (cp_parser_statement): Handle [[likely]] on
2064 2019-09-19 Jason Merrill <jason@redhat.com>
2067 * call.c (build_new_op_1): Don't apply any standard conversions to
2068 the operands of a built-in operator. Don't suppress conversions in
2070 * typeck.c (cp_build_unary_op): Do integral promotions for enums.
2072 2019-09-16 Paolo Carlini <paolo.carlini@oracle.com>
2074 * decl.c (grokdeclarator): Use declspecs->locations and
2075 declarator->id_loc in a few error messages.
2076 * pt.c (finish_member_template_decl): Use DECL_SOURCE_LOCATION.
2077 (push_template_decl_real): Likewise.
2079 2019-09-15 Jason Merrill <jason@redhat.com>
2081 PR c++/30277 - int-width bit-field promotion.
2082 PR c++/33819 - long bit-field promotion.
2083 * typeck.c (cp_perform_integral_promotions): Handle large bit-fields
2084 properly. Handle 32-bit non-int bit-fields properly.
2085 (is_bitfield_expr_with_lowered_type): Don't look through NOP_EXPR.
2087 PR c++/82165 - enum bitfields and operator overloading.
2088 * call.c (build_new_op_1): Use unlowered_expr_type.
2090 * call.c (build_new_op_1): Don't apply any standard conversions to
2091 the operands of a built-in operator. Don't suppress conversions in
2093 * typeck.c (cp_build_unary_op): Do integral promotions for enums.
2095 2019-09-15 Marek Polacek <polacek@redhat.com>
2097 PR c++/91740 - ICE with constexpr call and ?: in ARRAY_REF.
2098 * pt.c (build_non_dependent_expr): Call build_non_dependent_expr for
2101 2019-09-15 Nathan Sidwell <nathan@acm.org>
2103 * cp-tree.h (DECL_CLONED_FUNCTION_P): Reimplement using
2104 IDENTIFIER_CDTOR_P, correct documentation.
2105 (DECL_CLONED_FUNCTION): Directly access field.
2106 (decl_cloned_function_p): Delete.
2107 * class.c (decl_cloned_function_p): Delete.
2108 * pt.c (instantiate_template_1): Check DECL_CHAIN is a decl.
2110 2019-09-11 Nathan Sidwell <nathan@acm.org>
2112 * c-objcp-common.c (cp-objcp-common.c): Alphababetize and
2113 correctly mark all C++ nodes.
2114 * decl.c (cp_tree_node_structure): Alphabetize.
2116 2019-09-10 Marek Polacek <polacek@redhat.com>
2118 PR c++/91673 - ICE with noexcept in alias-declaration.
2119 * parser.c (CP_PARSER_FLAGS_DELAY_NOEXCEPT): New parser flag.
2120 (cp_parser_lambda_declarator_opt): Pass CP_PARSER_FLAGS_NONE to
2121 cp_parser_exception_specification_opt.
2122 (cp_parser_direct_declarator): Adjust a call to
2123 cp_parser_exception_specification_opt.
2124 (cp_parser_member_declaration): Pass CP_PARSER_FLAGS_DELAY_NOEXCEPT
2125 to cp_parser_declarator if not processing a friend or typedef
2127 (cp_parser_late_noexcept_specifier): Adjust a call to
2128 cp_parser_noexcept_specification_opt.
2129 (cp_parser_noexcept_specification_opt): New parameter for parser flags,
2130 drop the FRIEND_P parameter. Use the new parameter.
2131 (cp_parser_exception_specification_opt): Likewise.
2132 (cp_parser_transaction): Adjust a call to
2133 cp_parser_noexcept_specification_opt.
2134 (cp_parser_transaction_expression): Likewise.
2136 2019-09-10 Marek Polacek <polacek@redhat.com>
2138 PR c++/91705 - constexpr evaluation rejects ++/-- on floats.
2139 * constexpr.c (cxx_eval_increment_expression): Call fold_simple on
2142 2019-09-10 Paolo Carlini <paolo.carlini@oracle.com>
2144 * decl.c (has_designator_problem): Use cp_expr_loc_or_input_loc
2146 (build_enumerator): Likewise.
2147 (cp_finish_decl): Use DECL_SOURCE_LOCATION.
2148 (grokdeclarator): Use id_loc in two error_at; change errror
2149 message about constinit together constexpr to use two ranges.
2151 2019-09-09 Marek Polacek <polacek@redhat.com>
2153 PR c++/84374 - diagnose invalid uses of decltype(auto).
2154 * decl.c (grokdeclarator): Diagnose wrong usage of decltype(auto) in
2155 a function declaration.
2157 2019-09-06 Nathan Sidwell <nathan@acm.org>
2160 * cp-tree.h (IDENTIFIER_REPO_CHOSEN, DECL_REPO_AVAILABLE_P): Delete.
2161 (struct lang_decl_base): Remove repo_available_p.
2162 * decl.c (duplicate_decls): Don't copy DECL_REPO_AVAILABLE_P.
2164 (Reserve TREE_LANG_FLAG_3 for modules.
2165 * cp-tree.h (DECL_CONSTRUCTION_VTABLE_P): Delete.
2166 (DECL_NON_TRIVIALLY_INITIALIZED_P): Move to TREE_LANG_FLAG_6.
2167 * class.c (build_ctor_vtbl_group): Don't set
2168 DECL_CONSTRUCTION_VTABLE_P.
2169 * decl2.c (determine_visibility_from_class): Don't check
2170 DECL_CONSTRUCTION_VTABLE_P anymore.
2172 2019-09-06 Martin Liska <mliska@suse.cz>
2175 * Make-lang.in: Remove repo.o.
2176 * config-lang.in: Likewise.
2177 * cp-tree.h (init_repo): Remove declarations
2178 of repo-related functions.
2179 (repo_emit_p): Likewise.
2180 (repo_export_class_p): Likewise.
2181 (finish_repo): Likewise.
2182 * decl2.c (import_export_class): Always
2184 (mark_needed): Remove -frepo from comment.
2185 (import_export_decl): Similarly here.
2186 (c_parse_final_cleanups): Remove call of finish_repo.
2187 * lex.c (cxx_init): Remove call to init_repo.
2188 * optimize.c (can_alias_cdtor): Remove dead condition.
2189 * pt.c (push_template_decl_real): Update comment.
2190 (instantiate_decl): Remove dead code used for -frepo.
2193 2019-09-05 Marek Polacek <polacek@redhat.com>
2195 PR c++/91644 - ICE with constinit in function template.
2196 * decl.c (start_decl): Call retrofit_lang_decl for constinit variables.
2197 * pt.c (tsubst_expr): Pass LOOKUP_CONSTINIT down to cp_finish_decl for
2198 constinit variables.
2200 2019-09-05 Nathan Sidwell <nathan@acm.org>
2202 * cp-tree.h (DECL_VTABLE_OR_VTT_P): Forward to DECL_VIRTUAL_P.
2204 2019-09-04 Marek Polacek <polacek@redhat.com>
2206 * call.c (build_over_call): Remove -fdeduce-init-list implementation.
2207 * pt.c (unify): Likewise.
2209 2019-09-01 Marek Polacek <polacek@redhat.com>
2211 PR c++/91129 - wrong error with binary op in template argument.
2212 * typeck.c (warn_for_null_address): Use fold_for_warn instead of
2213 fold_non_dependent_expr.
2214 (cp_build_binary_op): Likewise.
2216 2019-08-30 Jason Merrill <jason@redhat.com>
2218 Add source location to TRAIT_EXPR.
2219 * cp-tree.h (TRAIT_EXPR_LOCATION): New.
2220 (struct tree_trait_expr): Add locus field.
2221 * parser.c (cp_parser_trait_expr): Pass trait_loc down.
2222 * pt.c (tsubst_copy_and_build) [TRAIT_EXPR]: Likewise.
2223 * semantics.c (finish_trait_expr): Add location parm.
2224 * tree.c (cp_expr_location): Handle TRAIT_EXPR.
2226 2019-08-29 Paolo Carlini <paolo.carlini@oracle.com>
2228 * decl.c (check_var_type): Add location_t parameter and use it.
2229 (grokdeclarator): Adjust call.
2230 * pt.c (tsubst_decl): Likewise.
2231 * cp-tree.h: Adjust declaration.
2233 2019-08-28 Marek Polacek <polacek@redhat.com>
2235 Implement P1152R4: Deprecating some uses of volatile.
2237 * cp-gimplify.c (cp_fold): Set TREE_THIS_VOLATILE.
2238 * decl.c (grokdeclarator): Warn about a volatile-qualified structured
2239 binding and return type.
2240 (grokparms): Warn about a volatile-qualified function parameter.
2241 * expr.c (mark_use) <case MODIFY_EXPR>: Emit a -Wvolatile warning.
2242 * typeck.c (cp_build_unary_op): Emit a -Wvolatile warning for pre and
2243 post ++/-- on a volatile operand.
2244 (genericize_compound_lvalue): Use a better location. Don't lose
2246 (cp_build_modify_expr): Emit a -Wvolatile warning for a compound
2247 assignment whose LHS is volatile-qualified. Build the assignment with
2248 a more precise location.
2250 2019-08-28 Marek Polacek <polacek@redhat.com>
2252 PR c++/91360 - Implement C++20 P1143R2: constinit.
2253 * cp-tree.h (TINFO_VAR_DECLARED_CONSTINIT): Define.
2254 (LOOKUP_CONSTINIT): Define.
2255 (enum cp_decl_spec): Add ds_constinit.
2256 * decl.c (check_tag_decl): Give an error for constinit in type
2258 (check_initializer): Also check LOOKUP_CONSTINIT.
2259 (cp_finish_decl): Add checking for a constinit declaration. Set
2260 TINFO_VAR_DECLARED_CONSTINIT.
2261 (grokdeclarator): Add checking for a declaration with the constinit
2263 * lex.c (init_reswords): Handle D_CXX20.
2264 * parser.c (cp_lexer_get_preprocessor_token): Pass a better location
2265 to warning_at. Warn about C++20 keywords.
2266 (cp_keyword_starts_decl_specifier_p): Handle RID_CONSTINIT.
2267 (cp_parser_diagnose_invalid_type_name): Add an inform about constinit.
2268 (cp_parser_decomposition_declaration): Maybe pass LOOKUP_CONSTINIT to
2270 (cp_parser_decl_specifier_seq): Handle RID_CONSTINIT.
2271 (cp_parser_init_declarator): Maybe pass LOOKUP_CONSTINIT to
2273 (set_and_check_decl_spec_loc): Add "constinit".
2274 * pt.c (tsubst_decl): Set TINFO_VAR_DECLARED_CONSTINIT.
2275 (instantiate_decl): Maybe pass LOOKUP_CONSTINIT to cp_finish_decl.
2276 * typeck2.c (store_init_value): If a constinit variable wasn't
2277 initialized using a constant initializer, give an error.
2279 2019-08-28 Nathan Sidwell <nathan@acm.org>
2282 * name-lookup.c (cp_emit_debug_info): Check for builtins during
2285 2019-08-27 Marek Polacek <polacek@redhat.com>
2287 PR c++/81676 - bogus -Wunused warnings in constexpr if.
2288 * semantics.c (maybe_mark_exp_read_r): New function.
2289 (finish_if_stmt): Call it on THEN_CLAUSE and ELSE_CLAUSE.
2291 PR c++/91428 - warn about std::is_constant_evaluated in if constexpr.
2292 * cp-tree.h (decl_in_std_namespace_p): Declare.
2293 * semantics.c (is_std_constant_evaluated_p): New.
2294 (finish_if_stmt_cond): Warn about "std::is_constant_evaluated ()" in
2296 * typeck.c (decl_in_std_namespace_p): No longer static.
2298 2019-08-26 Jason Merrill <jason@redhat.com>
2300 * decl.c (duplicate_decls): Always merge DECL_DECLARED_CONSTEXPR_P.
2302 2019-08-26 Marek Polacek <polacek@redhat.com>
2304 PR c++/91545 - ICE in constexpr store evaluation.
2305 * constexpr.c (cxx_eval_store_expression): Check FIELD_DECL instead
2308 2019-08-24 Nathan Sidwell <nathan@acm.org>
2310 * class.c (check_for_overrides): Conversion operators need
2313 2019-08-24 Paolo Carlini <paolo.carlini@oracle.com>
2315 * semantics.c (finish_switch_cond): Improve error message location.
2317 2019-08-23 Jason Merrill <jason@redhat.com>
2319 * decl2.c (decl_dependent_p): New.
2320 (mark_used): Check it instead of just processing_template_decl.
2322 2019-08-23 Jason Merrill <jason@redhat.com>
2324 * parser.c (cp_parser_nested_name_specifier_opt): Avoid redundant
2327 2019-08-23 Marek Polacek <polacek@redhat.com>
2329 PR c++/91521 - wrong error with operator->.
2330 * decl.c (grokdeclarator): Return error_mark_node for an invalid
2331 trailing return type.
2333 PR c++/79817 - attribute deprecated on namespace.
2334 * cp-tree.h (cp_warn_deprecated_use_scopes): Declare.
2335 * decl.c (grokdeclarator): Call cp_warn_deprecated_use_scopes.
2336 (type_is_deprecated): Likewise.
2337 * decl2.c (cp_warn_deprecated_use_scopes): New function.
2338 * name-lookup.c (handle_namespace_attrs): Handle attribute deprecated.
2339 * parser.c (cp_parser_namespace_alias_definition): Call
2340 cp_warn_deprecated_use_scopes.
2341 (cp_parser_using_declaration): Likewise.
2342 (cp_parser_using_directive): Likewise.
2343 * semantics.c (finish_id_expression_1): Likewise.
2345 2019-08-23 Nathan Sidwell <nathan@acm.org>
2347 * class.c (check_for_override): Checking IDENTIFIER_VIRTUAL_P is
2348 sufficient, reorder DECL_OVERRIDE_P check.
2350 2019-08-23 Iain Sandoe <iain@sandoe.co.uk>
2353 * parser.c (cp_parser_initial_pragma): Call c_common_no_more_pch ()
2354 after determining that the first token is not
2355 PRAGMA_GCC_PCH_PREPROCESS.
2357 2019-08-22 Marek Polacek <polacek@redhat.com>
2359 PR c++/91304 - prefix attributes ignored in condition.
2360 * parser.c (cp_parser_condition): Handle prefix attributes.
2362 2019-08-21 Richard Sandiford <richard.sandiford@arm.com>
2365 * decl.c (duplicate_decls): Call copy_attributes_to_builtin inside
2366 the BUILT_IN_NORMAL block rather than afterward.
2368 2019-08-19 Marek Polacek <polacek@redhat.com>
2370 PR c++/91264 - detect modifying const objects in constexpr.
2371 * constexpr.c (modifying_const_object_error): New function.
2372 (cxx_eval_call_expression): Set TREE_READONLY on a CONSTRUCTOR of
2373 a const-qualified object after it's been fully constructed.
2374 (modifying_const_object_p): New function.
2375 (cxx_eval_store_expression): Detect modifying a const object
2376 during constant expression evaluation.
2377 (cxx_eval_increment_expression): Use a better location when building
2379 (cxx_eval_constant_expression) <case DECL_EXPR>: Mark a constant
2380 object's constructor TREE_READONLY.
2382 2019-08-15 Jason Merrill <jason@redhat.com>
2384 PR c++/90393 - ICE with thow in ?:
2386 PR c++/64372, DR 1560 - Gratuitous lvalue-to-rvalue conversion in ?:
2387 * tree.c (lvalue_kind): Handle throw in one arm.
2388 * typeck.c (rationalize_conditional_expr): Likewise.
2389 (cp_build_modify_expr): Likewise.
2391 2019-08-14 Jason Merrill <jason@redhat.com>
2393 Implement P0848R3, Conditionally Trivial Special Member Functions.
2394 * tree.c (special_memfn_p): New.
2395 * class.c (add_method): When overloading, hide ineligible special
2397 (check_methods): Set TYPE_HAS_COMPLEX_* here.
2398 * decl.c (grok_special_member_properties): Not here.
2399 * name-lookup.c (push_class_level_binding_1): Move overloaded
2400 functions case down, accept FUNCTION_DECL as target_decl.
2402 2019-08-14 Jonathan Wakely <jwakely@redhat.com>
2405 * name-lookup.c (get_std_name_hint): Fix min_dialect field for
2406 complex_literals and make_unique entries.
2408 2019-08-14 Jakub Jelinek <jakub@redhat.com>
2409 Marek Polacek <polacek@redhat.com>
2411 PR c++/91391 - bogus -Wcomma-subscript warning.
2412 * parser.c (cp_parser_postfix_open_square_expression): Don't warn about
2413 a deprecated comma here. Pass warn_comma_subscript down to
2414 cp_parser_expression.
2415 (cp_parser_expression): New bool parameter. Warn about uses of a comma
2416 operator within a subscripting expression.
2417 (cp_parser_skip_to_closing_square_bracket): Revert to pre-r274121 state.
2418 (cp_parser_skip_to_closing_square_bracket_1): Remove.
2420 2019-08-14 Jonathan Wakely <jwakely@redhat.com>
2422 * name-lookup.c (get_std_name_hint): Add more entries.
2424 2019-08-14 Paolo Carlini <paolo.carlini@oracle.com>
2426 * decl2.c (grok_array_decl): Use the location of the open square
2427 bracket in error message about invalid types.
2429 2019-08-14 Paolo Carlini <paolo.carlini@oracle.com>
2431 * decl.c (grokdeclarator): Check here for typedef a function
2432 definition or a member function definition.
2433 (start_function): Adjust.
2434 (grokmethod): Likewise.
2436 2019-08-13 Richard Sandiford <richard.sandiford@arm.com>
2439 * decl.c (duplicate_decls): Use copy_decl_built_in_function.
2440 * pt.c (declare_integer_pack): Use set_decl_built_in_function.
2442 2019-08-13 Marek Polacek <polacek@redhat.com>
2444 PR c++/90473 - wrong code with nullptr in default argument.
2445 * call.c (null_ptr_cst_p): Update quote from the standard.
2446 * decl.c (check_default_argument): Don't return nullptr when the arg
2449 2019-08-13 Marek Polacek <polacek@redhat.com>
2451 * cp-tree.h (DECL_MUTABLE_P): Use FIELD_DECL_CHECK.
2453 2019-08-10 Jakub Jelinek <jakub@redhat.com>
2455 * parser.c (cp_parser_omp_clause_name): Parse device_type.
2456 (cp_parser_omp_clause_device_type): New function.
2457 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_DEVICE_TYPE.
2458 (OMP_DECLARE_TARGET_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_DEVICE_TYPE.
2459 (cp_parser_omp_declare_target): Handle device_type clauses. Remove
2460 diagnostics for declare target with clauses nested in clause-less
2461 declare target declaration-definition-seq.
2462 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_DEVICE_TYPE.
2464 2019-08-09 Jakub Jelinek <jakub@redhat.com>
2466 * parser.c (check_no_duplicate_clause): Simplify using
2468 (cp_parser_omp_clause_if): Fix up printing of target {enter,exit} data
2469 directive name modifiers.
2472 * parser.c (cp_parser_omp_clause_dist_schedule): Comment out the
2473 check_no_duplicate_clause call, instead emit a warning for duplicate
2474 dist_schedule clauses.
2476 2019-08-08 Paolo Carlini <paolo.carlini@oracle.com>
2478 * decl.c (grokdeclarator): Use id_loc and EXPR_LOCATION in
2479 a few error messages.
2481 2019-08-08 Marek Polacek <polacek@redhat.com>
2483 PR c++/87519 - bogus warning with -Wsign-conversion.
2484 * typeck.c (cp_build_binary_op): Use same_type_p instead of comparing
2487 * constexpr.c (inline_asm_in_constexpr_error): New.
2488 (cxx_eval_constant_expression) <case ASM_EXPR>: Call it.
2489 (potential_constant_expression_1) <case ASM_EXPR>: Likewise.
2491 2019-08-08 Jakub Jelinek <jakub@redhat.com>
2493 * semantics.c (finish_omp_clauses): For C_ORT_OMP
2494 OMP_CLAUSE_USE_DEVICE_* clauses use oacc_reduction_head bitmap
2495 instead of generic_head to track duplicates.
2497 2019-08-07 Marek Polacek <polacek@redhat.com>
2499 PR c++/81429 - wrong parsing of constructor with C++11 attribute.
2500 * parser.c (cp_parser_constructor_declarator_p): Handle the scenario
2501 when a parameter declaration begins with [[attribute]].
2503 2019-08-07 Marek Polacek <polacek@redhat.com>
2505 PR c++/91346 - Implement P1668R1, allow unevaluated asm in constexpr.
2506 * constexpr.c (cxx_eval_constant_expression): Handle ASM_EXPR.
2507 (potential_constant_expression_1) <case ASM_EXPR>: Allow.
2508 * cp-tree.h (finish_asm_stmt): Adjust.
2509 * parser.c (cp_parser_asm_definition): Grab the locaion of "asm" and
2510 use it. Change an error to a pedwarn. Allow asm in C++2a, warn
2512 * pt.c (tsubst_expr): Pass a location down to finish_asm_stmt.
2513 * semantics.c (finish_asm_stmt): New location_t parameter. Use it.
2515 2019-08-07 Jakub Jelinek <jakub@redhat.com>
2517 * parser.c (cp_parser_omp_clause_name): Parse use_device_addr clause.
2518 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR.
2519 (OMP_TARGET_DATA_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR.
2520 (cp_parser_omp_target_data): Handle PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR
2521 like PRAGMA_OMP_CLAUSE_USE_DEVICE_PTR, adjust diagnostics about no
2522 map or use_device_* clauses.
2523 * semantics.c (finish_omp_clauses): For OMP_CLAUSE_USE_DEVICE_PTR
2524 in OpenMP, require pointer or reference to pointer type rather than
2525 pointer or array or reference to pointer or array type. Handle
2526 OMP_CLAUSE_USE_DEVICE_ADDR.
2527 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_USE_DEVICE_ADDR.
2529 2019-08-06 Jason Merrill <jason@redhat.com>
2531 PR c++/91378 - ICE with noexcept and auto return type.
2532 * pt.c (maybe_instantiate_noexcept): push_to_top_level.
2534 2019-08-06 Paolo Carlini <paolo.carlini@oracle.com>
2536 * decl.c (check_array_designated_initializer): Use
2537 cp_expr_loc_or_input_loc in one place.
2539 2019-08-06 Jakub Jelinek <jakub@redhat.com>
2541 * parser.c (cp_parser_omp_for_loop): For OMP_LOOP, ignore parallel
2542 clauses and predetermine iterator as lastprivate.
2543 * semantics.c (handle_omp_for_class_iterator): Use
2544 OMP_CLAUSE_LASTPRIVATE_LOOP_IV instead of
2545 OMP_CLAUSE_LASTPRIVATE_TASKLOOP_IV, set it for lastprivate also
2546 on OMP_LOOP construct. If a clause is missing for class iterator
2547 on OMP_LOOP, add firstprivate clause, and if there is private
2548 clause, turn it into firstprivate too.
2549 (finish_omp_for): Formatting fix. For OMP_LOOP, adjust
2550 OMP_CLAUSE_LASTPRIVATE_LOOP_IV clause CP_CLAUSE_INFO, so that it
2551 uses copy ctor instead of default ctor.
2552 * cp-gimplify.c (cp_gimplify_expr): Handle OMP_LOOP like
2554 (cp_fold_r): Likewise.
2555 (cp_genericize_r): Likewise.
2556 (cxx_omp_finish_clause): Also finish lastprivate clause with
2557 OMP_CLAUSE_LASTPRIVATE_LOOP_IV flag.
2558 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_BIND.
2559 (tsubst_omp_for_iterator): For OMP_LOOP, ignore parallel
2560 clauses and predetermine iterator as lastprivate.
2561 * constexpr.c (potential_constant_expression_1): Handle OMP_LOOP
2562 like OMP_DISTRIBUTE etc.
2564 2019-08-05 Marek Polacek <polacek@redhat.com>
2566 DR 2413 - typename in conversion-function-ids.
2567 * parser.c (cp_parser_conversion_type_id): Call
2568 cp_parser_type_specifier_seq with CP_PARSER_FLAGS_TYPENAME_OPTIONAL
2569 instead of CP_PARSER_FLAGS_NONE.
2571 2019-08-05 Paolo Carlini <paolo.carlini@oracle.com>
2573 * cp-tree.h (cp_expr_loc_or_input_loc): New.
2574 (cxx_incomplete_type_diagnostic): Use it.
2575 * call.c (build_converted_constant_expr_internal, convert_like_real,
2576 convert_arg_to_ellipsis, convert_for_arg_passing, build_over_call,
2577 build_cxx_call, perform_implicit_conversion_flags,
2578 initialize_reference): Likewise.
2579 * constexpr.c (cxx_eval_internal_function, cxx_eval_call_expression,
2580 eval_and_check_array_index, cxx_eval_store_expression,
2581 cxx_eval_statement_list, cxx_eval_loop_expr,
2582 cxx_eval_constant_expression, potential_constant_expression_1):
2584 * constraint.cc (check_for_logical_overloads,
2585 satisfy_predicate_constraint): Likewise.
2586 * cp-gimplify.c (cp_gimplify_expr): Likewise.
2587 * cvt.c (cp_convert_to_pointer, convert_to_reference,
2588 cp_convert_and_check, ocp_convert, maybe_warn_nodiscard): Likewise.
2589 * decl.c (pop_switch): Likewise.
2590 * decl2.c (delete_sanity): Likewise.
2591 * error.c (location_of): Likewise.
2592 * init.c (maybe_warn_list_ctor, build_aggr_init,
2593 warn_placement_new_too_small, build_new_1, build_vec_init): Likewise.
2594 * lex.c (unqualified_name_lookup_error): Likewise.
2595 * parser.c (cp_parser_initializer_list, cp_parser_omp_for_cond):
2597 * pt.c (check_for_bare_parameter_packs, check_valid_ptrmem_cst_expr,
2598 unify_arg_conversion, convert_nontype_argument,
2599 tsubst_copy_and_build, resolve_typename_type): Likewise.
2600 * semantics.c (maybe_convert_cond, finish_call_expr,
2601 cp_build_vec_convert): Likewise.
2602 * typeck.c (decay_conversion, rationalize_conditional_expr,
2603 cp_build_unary_op, build_x_compound_expr_from_list,
2604 maybe_warn_about_returning_address_of_local,
2605 maybe_warn_pessimizing_move): Likewise.
2606 * typeck2.c (check_narrowing, digest_init_r,
2607 process_init_constructor_array): Likewise.
2609 2019-08-05 Tom Honermann <tom@honermann.net>
2611 * parser.c (cp_parser_template_declaration_after_parameters): Enable
2612 class template argument deduction for non-type template parameters
2613 in literal operator templates.
2615 2019-08-05 Marek Polacek <polacek@redhat.com>
2617 PR c++/91338 - Implement P1161R3: Deprecate a[b,c].
2618 * parser.c (cp_parser_postfix_open_square_expression): Warn about uses
2619 of a comma operator within a subscripting expression.
2620 (cp_parser_skip_to_closing_square_bracket_1): New function, made out
2622 (cp_parser_skip_to_closing_square_bracket): ...this.
2624 2019-08-05 Jason Merrill <jason@redhat.com>
2626 * semantics.c (force_paren_expr): Preserve location.
2628 2019-08-02 Marek Polacek <polacek@redhat.com>
2630 PR c++/91230 - wrong error with __PRETTY_FUNCTION__ and generic lambda.
2631 * pt.c (value_dependent_expression_p): Consider __PRETTY_FUNCTION__
2632 inside a template function value-dependent.
2634 2019-08-02 Paolo Carlini <paolo.carlini@oracle.com>
2636 * tree.c (handle_nodiscard_attribute): Do not warn about nodiscard
2637 applied to a constructor.
2639 2019-08-02 Martin Liska <mliska@suse.cz>
2641 * decl.c (grok_op_properties):
2642 Mark DECL_SET_IS_OPERATOR_DELETE for user-provided delete operators.
2644 2019-08-01 Martin Sebor <msebor@redhat.com>
2647 * decl.c (reshape_init_array_1): Avoid truncating initializer
2648 lists containing string literals.
2650 2019-08-01 Marek Polacek <polacek@redhat.com>
2652 PR c++/90805 - detect narrowing in case values.
2653 * decl.c (case_conversion): Detect narrowing in case values.
2655 2019-07-31 Paolo Carlini <paolo.carlini@oracle.com>
2657 * decl2.c (delete_sanity): Improve diagnostic locations, use
2658 cp_expr_loc_or_loc in four places.
2660 2019-07-31 Jason Merrill <jason@redhat.com>
2662 PR c++/90538 - multiple expansions of capture packs
2663 * cp-tree.h (DECLTYPE_FOR_INIT_CAPTURE): Remove.
2664 * lambda.c (add_capture): Copy parameter packs from init.
2665 (lambda_capture_field_type): Always use auto for init-capture.
2666 * pt.c (uses_parameter_packs): Return tree.
2667 (tsubst) [DECLTYPE_TYPE]: Remove init-capture handling.
2668 (gen_elem_of_pack_expansion_instantiation): Don't push
2669 local_specialization_stack.
2670 (prepend_one_capture): New.
2671 (tsubst_lambda_expr): Use it. Don't touch local_specializations.
2672 (do_auto_deduction): Avoid redundant error.
2674 Fix copy_node of TEMPLATE_INFO.
2675 * cp-tree.h (struct tree_template_info): Use tree_base instead of
2676 tree_common. Add tmpl and args fields.
2677 (TI_TEMPLATE, TI_ARGS): Adjust.
2679 2019-07-30 Martin Liska <mliska@suse.cz>
2681 PR tree-optimization/91270
2682 * tree-ssa-dce.c (propagate_necessity): Mark 2nd argument
2683 of delete operator as needed.
2685 2019-07-25 Martin Liska <mliska@suse.cz>
2686 Dominik Infuhr <dominik.infuehr@theobroma-systems.com>
2689 * decl.c (cxx_init_decl_processing): Mark delete operators
2690 with DECL_SET_IS_OPERATOR_DELETE.
2692 2019-07-25 Martin Liska <mliska@suse.cz>
2694 * decl.c (duplicate_decls): Use new macros
2695 (e.g. DECL_SET_LAMBDA_FUNCTION and DECL_LAMBDA_FUNCTION_P).
2696 (cxx_init_decl_processing): Likewise.
2697 (grok_op_properties): Likewise.
2698 * parser.c (cp_parser_lambda_declarator_opt): Likewise.
2700 2019-07-24 Martin Sebor <msebor@redhat.com>
2703 * decl.c (finish_function): Use lang_mask.
2705 2019-07-20 Jason Merrill <jason@redhat.com>
2707 * cp-tree.h (ovl_iterator::using_p): A USING_DECL by itself was also
2708 introduced by a using-declaration.
2710 2019-07-20 Jason Merrill <jason@redhat.com>
2712 Reduce memory consumption for push/pop_access_scope.
2713 * name-lookup.c (leave_scope): Do add class levels other than
2714 previous_class_level to free_binding_level.
2715 (invalidate_class_lookup_cache): Move from class.c, add to
2717 * pt.c (saved_access_scope): Change from list to vec.
2719 2019-07-20 Jakub Jelinek <jakub@redhat.com>
2721 * cp-tree.h (OMP_FOR_GIMPLIFYING_P): Use OMP_LOOPING_CHECK
2722 instead of OMP_LOOP_CHECK.
2723 * parser.c (cp_parser_omp_clause_name): Handle bind clause.
2724 (cp_parser_omp_clause_bind): New function.
2725 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_BIND.
2726 (OMP_LOOP_CLAUSE_MASK): Define.
2727 (cp_parser_omp_loop): New function.
2728 (cp_parser_omp_parallel, cp_parser_omp_teams): Handle parsing of
2729 loop combined with parallel or teams.
2730 (cp_parser_omp_construct): Handle PRAGMA_OMP_LOOP.
2731 (cp_parser_pragma): Likewise.
2732 * pt.c (tsubst_expr): Handle OMP_LOOP.
2733 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_BIND.
2735 2019-07-19 Jason Merrill <jason@redhat.com>
2737 PR c++/90101 - dependent class non-type parameter.
2738 * pt.c (invalid_nontype_parm_type_p): Check for dependent class type.
2740 2019-07-18 Jason Merrill <jason@redhat.com>
2742 PR c++/90098 - partial specialization and class non-type parms.
2745 * call.c (build_converted_constant_expr_internal): Don't copy.
2746 * pt.c (process_partial_specialization): Allow VIEW_CONVERT_EXPR
2747 around class non-type parameter.
2748 (unify) [TEMPLATE_PARM_INDEX]: Ignore cv-quals.
2750 2019-07-16 Jason Merrill <jason@redhat.com>
2752 * parser.c (make_location): Add overload taking cp_lexer* as last
2755 * parser.c (cp_parser_simple_type_specifier): Separate tentative
2756 parses for optional type-spec and CTAD.
2758 * parser.c (cp_parser_nested_name_specifier_opt): If the token is
2759 already CPP_NESTED_NAME_SPECIFIER, leave it alone.
2761 2019-07-12 Jakub Jelinek <jakub@redhat.com>
2763 * parser.c (cp_parser_omp_clause_name): Handle order clause.
2764 (cp_parser_omp_clause_order): New function.
2765 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_ORDER.
2766 (OMP_SIMD_CLAUSE_MASK, OMP_FOR_CLAUSE_MASK): Add
2767 PRAGMA_OMP_CLAUSE_ORDER.
2768 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_ORDER.
2769 * pt.c (tsubst_omp_clauses): Likewise.
2771 2019-07-10 Paolo Carlini <paolo.carlini@oracle.com>
2773 * decl.c (get_type_quals,
2774 smallest_type_location (const cp_decl_specifier_seq*)): New.
2775 (check_tag_decl): Use smallest_type_location in error_at about
2776 multiple types in one declaration.
2777 (grokdeclarator): Use locations[ds_complex] in error_at about
2778 complex invalid; use locations[ds_storage_class] in error_at
2779 about static cdtor; use id_loc in error_at about flexible
2780 array member in union; use get_type_quals.
2782 2019-07-09 Martin Sebor <msebor@redhat.com>
2785 * cp-tree.h: Change class-key of PODs to struct and others to class.
2787 * semantics.c (finalize_nrv_r): Same.
2789 2019-07-09 Martin Sebor <msebor@redhat.com>
2792 * constexpr.c (cxx_eval_call_expression): Change class-key from class
2793 to struct and vice versa to match convention and avoid -Wclass-is-pod
2794 and -Wstruct-no-pod.
2795 * constraint.cc (get_concept_definition): Same.
2797 * cxx-pretty-print.h: Same.
2799 * logic.cc (term_list::replace): Same.
2800 * name-lookup.c (find_local_binding): Same.
2801 * pt.c (tsubst_binary_right_fold): Same.
2802 * search.c (field_accessor_p): Same.
2803 * semantics.c (expand_or_defer_fn): Same.
2805 2019-07-08 Jakub Jelinek <jakub@redhat.com>
2808 * decl2.c (cp_omp_mappable_type_1): Don't emit any note for
2809 error_mark_node type.
2811 2019-07-05 Jakub Jelinek <jakub@redhat.com>
2815 * call.c (build_new_method_call_1): Remove set but not used variable
2818 2019-07-05 Paolo Carlini <paolo.carlini@oracle.com>
2820 PR c++/67184 (again)
2822 * call.c (build_over_call): Devirtualize user-defined operators
2823 coming from a base too.
2824 (build_new_method_call_1): Do not devirtualize here.
2826 2019-07-04 Marek Polacek <polacek@redhat.com>
2829 PR c++/83374 - __is_standard_layout wrong for a class with repeated
2831 * class.c (check_bases): Set CLASSTYPE_NON_STD_LAYOUT for a class if
2832 CLASSTYPE_REPEATED_BASE_P is true.
2834 2019-07-04 Andrew Stubbs <ams@codesourcery.com>
2836 * cp-tree.h (cp_omp_emit_unmappable_type_notes): New prototype.
2837 * decl.c (cp_finish_decl): Call cp_omp_emit_unmappable_type_notes.
2838 * decl2.c (cp_omp_mappable_type): Move contents to ...
2839 (cp_omp_mappable_type_1): ... here and add note output.
2840 (cp_omp_emit_unmappable_type_notes): New function.
2841 * semantics.c (finish_omp_clauses): Call
2842 cp_omp_emit_unmappable_type_notes in four places.
2844 2019-07-03 Martin Liska <mliska@suse.cz>
2846 * call.c (build_new_op_1): Remove dead assignemts.
2847 * typeck.c (cp_build_binary_op): Likewise.
2849 2019-06-27 Jason Merrill <jason@redhat.com>
2851 PR c++/55442 - memory-hog with highly recursive constexpr.
2852 * constexpr.c (push_cx_call_context): Return depth.
2853 (cxx_eval_call_expression): Don't cache past constexpr_cache_depth.
2855 2019-06-27 Jan Hubicka <jh@suse.cz>
2857 * class.c (layout_class_type): Set TYPE_CXX_ODR_P for as-base
2860 2019-06-27 Martin Liska <mliska@suse.cz>
2862 * class.c (adjust_clone_args): Remove obviously
2864 (dump_class_hierarchy_r): Likewise.
2865 * decl.c (check_initializer): Likewise.
2866 * parser.c (cp_parser_lambda_expression): Likewise.
2867 * pt.c (unify_bound_ttp_args): Likewise.
2868 (convert_template_argument): Likewise.
2869 * rtti.c (build_headof): Likewise.
2870 * typeck.c (convert_for_initialization): Likewise.
2872 2019-06-25 Jason Merrill <jason@redhat.com>
2874 PR c++/70462 - unnecessary base ctor variant with final.
2875 * optimize.c (populate_clone_array): Skip base variant if
2877 (maybe_clone_body): We don't need an alias if we are only defining
2880 * class.c (resolves_to_fixed_type_p): Check CLASSTYPE_FINAL.
2882 2019-06-25 Jakub Jelinek <jakub@redhat.com>
2885 * constexpr.c (cxx_eval_array_reference): Don't look through VCE from
2886 vector type if lval.
2888 2019-06-25 Jozef Lawrynowicz <jozef.l@mittosystems.com>
2890 * lex.c (init_reswords): Create keyword for "__intN__" type.
2891 * cp-tree.h (cp_decl_specifier_seq): New bitfield "int_n_alt".
2892 * decl.c (grokdeclarator): Don't pedwarn about "__intN" ISO
2893 C incompatibility if alternate "__intN__" form is used.
2894 * parser.c (cp_parser_simple_type_specifier): Set
2895 decl_specs->int_n_alt if "__intN__" form is used.
2897 2019-06-24 Jan Hubicka <jh@suse.cz>
2899 * lex.c (cxx_make_type): Set TYPE_CXX_ODR_P.
2901 2019-06-24 Jason Merrill <jason@redhat.com>
2903 * class.c (layout_class_type): Don't use a separate
2904 CLASSTYPE_AS_BASE if it's the same size.
2906 2019-06-23 Marek Polacek <polacek@redhat.com>
2908 * call.c (convert_default_arg): Use DEFERRED_PARSE instead of
2910 * cp-objcp-common.c (cp_tree_size): Likewise. Use tree_deferred_parse
2911 instead of tree_default_arg.
2912 * cp-tree.def: Rename DEFAULT_ARG to DEFERRED_PARSE.
2913 * cp-tree.h: Rename DEFARG_TOKENS to DEFPARSE_TOKENS. Rename
2914 DEFARG_INSTANTIATIONS to DEFPARSE_INSTANTIATIONS. Rename
2915 tree_default_arg to tree_deferred_parse.
2916 (UNPARSED_NOEXCEPT_SPEC_P): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2917 (cp_tree_node_structure_enum): Rename TS_CP_DEFAULT_ARG to
2918 TS_CP_DEFERRED_PARSE.
2919 (lang_tree_node): Rename tree_default_arg to tree_deferred_parse.
2920 Rename default_arg to deferred_parse. Use TS_CP_DEFERRED_PARSE instead
2921 of TS_CP_DEFAULT_ARG.
2922 (defarg_location): Remove declaration.
2923 (defparse_location): Add declaration.
2924 * decl.c (grokfndecl): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2925 Call defparse_location instead of defarg_location.
2926 (check_default_argument): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2927 (cp_tree_node_structure): Likewise. Use TS_CP_DEFERRED_PARSE instead
2928 of TS_CP_DEFAULT_ARG.
2929 * decl2.c (grokfield): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2930 * error.c (dump_expr): Likewise.
2931 (location_of): Likewise.
2932 * init.c (get_nsdmi): Likewise.
2933 * parser.c (cp_parser_save_noexcept): Likewise. Use DEFPARSE_TOKENS
2934 instead of DEFARG_TOKENS.
2935 (cp_parser_late_noexcept_specifier): Likewise.
2936 (cp_parser_late_parse_one_default_arg): Use DEFPARSE_TOKENS instead
2938 (cp_parser_late_parsing_default_args): Use DEFERRED_PARSE instead of
2939 DEFAULT_ARG. Use DEFPARSE_INSTANTIATIONS instead of
2940 DEFARG_INSTANTIATIONS.
2941 (cp_parser_cache_defarg): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2942 Use DEFPARSE_TOKENS instead of DEFARG_TOKENS. Use
2943 DEFPARSE_INSTANTIATIONS instead of DEFARG_INSTANTIATIONS.
2944 (defparse_location): Renamed from defarg_location.
2945 * pt.c (tsubst_default_argument): Use DEFERRED_PARSE instead of
2947 (tsubst_arg_types): Likewise.
2948 (dependent_type_p_r): Likewise.
2949 * tree.c (cp_tree_equal): Likewise.
2950 (cp_walk_subtrees): Likewise.
2951 * typeck.c (convert_arguments): Likewise.
2953 2019-06-22 Marek Polacek <polacek@redhat.com>
2955 PR c++/86476 - noexcept-specifier is a complete-class context.
2957 * cp-tree.def (DEFAULT_ARG): Update commentary.
2958 * cp-tree.h (UNPARSED_NOEXCEPT_SPEC_P): New macro.
2959 (tree_default_arg): Use tree_base instead of tree_common.
2960 (do_push_parm_decls, maybe_check_overriding_exception_spec): Declare.
2961 * decl.c (do_push_parm_decls): New function, broken out of...
2962 (store_parm_decls): ...here. Call it.
2963 * except.c (nothrow_spec_p): Accept DEFAULT_ARG in the assert.
2964 * parser.c (cp_parser_noexcept_specification_opt,
2965 cp_parser_late_noexcept_specifier, noexcept_override_late_checks):
2967 (unparsed_noexcepts): New macro.
2968 (push_unparsed_function_queues): Update initializer.
2969 (cp_parser_direct_declarator): Pass FRIEND_P to
2970 cp_parser_exception_specification_opt.
2971 (inject_parm_decls): New.
2972 (pop_injected_parms): New.
2973 (cp_parser_class_specifier_1): Implement delayed parsing of
2974 noexcept-specifiers.
2975 (cp_parser_save_noexcept): New.
2976 (cp_parser_late_noexcept_specifier): New.
2977 (noexcept_override_late_checks): New.
2978 (cp_parser_noexcept_specification_opt): Add FRIEND_P parameter. Call
2979 cp_parser_save_noexcept instead of the normal processing if needed.
2980 (cp_parser_exception_specification_opt): Add FRIEND_P parameter and
2981 pass it to cp_parser_noexcept_specification_opt.
2982 (cp_parser_save_member_function_body): Fix comment.
2983 (cp_parser_save_default_args): Maybe save the noexcept-specifier to
2985 (cp_parser_transaction): Update call to
2986 cp_parser_noexcept_specification_opt.
2987 (cp_parser_transaction_expression): Likewise.
2988 * parser.h (cp_unparsed_functions_entry): Add new field to carry
2989 a noexcept-specifier.
2990 * pt.c (dependent_type_p_r): Handle unparsed noexcept expression.
2991 * search.c (maybe_check_overriding_exception_spec): New function, broken
2993 (check_final_overrider): ...here. Call
2994 maybe_check_overriding_exception_spec.
2995 * tree.c (canonical_eh_spec): Handle UNPARSED_NOEXCEPT_SPEC_P.
2996 (cp_tree_equal): Handle DEFAULT_ARG.
2998 PR c++/90881 - bogus -Wunused-value in unevaluated context.
2999 * cvt.c (convert_to_void): Don't emit unused warnings in
3000 an unevaluated context.
3002 2019-06-22 Paolo Carlini <paolo.carlini@oracle.com>
3004 * decl.c (grokdeclarator): Use id_loc, typespec_loc, and
3005 locations[ds_storage_class] in a few additional places.
3007 2019-06-21 Paolo Carlini <paolo.carlini@oracle.com>
3011 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com>
3015 * call.c (build_over_call): Devirtualize when the final overrider
3016 comes from the base.
3018 2019-06-21 Marek Polacek <polacek@redhat.com>
3020 PR c++/61490 - qualified-id in friend function definition.
3021 * decl.c (grokdeclarator): Diagnose qualified-id in friend function
3022 definition. Improve location for diagnostics of friend functions.
3024 PR c++/60223 - ICE with T{} in non-deduced context.
3025 * pt.c (unify): Allow COMPOUND_LITERAL_P in a non-deduced context.
3027 PR c++/64235 - missing syntax error with invalid alignas.
3028 * parser.c (cp_parser_std_attribute_spec): Commit to tentative parse
3029 if there's a missing close paren.
3031 PR c++/90490 - fix decltype issues in noexcept-specifier.
3032 * except.c (build_noexcept_spec): Call
3033 instantiate_non_dependent_expr_sfinae before
3034 build_converted_constant_expr instead of calling
3035 instantiate_non_dependent_expr after it. Add
3036 processing_template_decl_sentinel.
3038 2019-06-21 Jakub Jelinek <jakub@redhat.com>
3041 * semantics.c (finish_omp_clauses): Don't reject references to
3042 incomplete types if processing_template_decl.
3044 2019-06-19 Marek Polacek <polacek@redhat.com>
3046 PR c++/60364 - noreturn after first decl not diagnosed.
3047 * decl.c (duplicate_decls): Give an error when a function is
3048 declared [[noreturn]] after its first declaration.
3049 * parser.c (cp_parser_std_attribute): Don't treat C++11 noreturn
3050 attribute as equivalent to GNU's.
3051 * tree.c (std_attribute_table): Add noreturn.
3053 2019-06-19 Jakub Jelinek <jakub@redhat.com>
3055 * cp-gimplify.c (cp_genericize_r): Handle OMP_CLAUSE_{IN,EX}CLUSIVE
3056 like OMP_CLAUSE_SHARED.
3058 2019-06-18 Jason Merrill <jason@redhat.com>
3060 * constexpr.c (cxx_eval_store_expression): Delay target evaluation.
3062 2019-06-18 Jason Merrill <jason@redhat.com>
3064 * constexpr.c (eval_and_check_array_index): Split out from...
3065 (cxx_eval_array_reference): ...here.
3066 (cxx_eval_store_expression): Use it here, too.
3067 (diag_array_subscript): Take location. Strip location wrapper.
3069 2019-06-18 Jason Merrill <jason@redhat.com>
3071 * constexpr.c (cxx_eval_constant_expression): Handle conversion from
3072 and then to the same type.
3074 2019-06-18 Jason Merrill <jason@redhat.com>
3076 * constexpr.c (unshare_constructor): Add MEM_STAT_DECL.
3078 2019-06-17 Jakub Jelinek <jakub@redhat.com>
3080 * semantics.c (finish_omp_clauses): For OMP_CLAUSE_REDUCTION_INSCAN
3081 set need_copy_assignment.
3083 2019-06-17 Marek Polacek <polacek@redhat.com>
3085 PR c++/83820 - excessive attribute arguments not detected.
3086 * parser.c (cp_parser_std_attribute): Detect excessive arguments.
3088 2019-06-17 Nathan Sidwell <nathan@acm.org>
3091 * name-lookup.c (lookup_type_scope_1): Calll qualify_lookup before
3094 2019-06-14 Marek Polacek <polacek@redhat.com>
3096 PR c++/90884 - stray note with -Wctor-dtor-privacy.
3097 * class.c (maybe_warn_about_overly_private_class): Guard the call to
3100 2019-06-12 Jason Merrill <jason@redhat.com>
3102 PR c++/85552 - wrong instantiation of dtor for DMI.
3103 * typeck2.c (digest_nsdmi_init): Set tf_no_cleanup for direct-init.
3105 2019-06-13 Paolo Carlini <paolo.carlini@oracle.com>
3107 * decl.c (grokdeclarator): Use id_loc in five additional places
3108 in the last part of the function.
3110 2019-06-13 Paolo Carlini <paolo.carlini@oracle.com>
3112 * decl.c (grokdeclarator): Move further up the declaration of
3113 id_loc, use it immediately, update its value after the loop
3114 over declarator, use it again in the final part of function;
3115 improve locations of error messages about multiple data types
3116 and conflicting specifiers.
3118 2019-06-13 Richard Biener <rguenther@suse.de>
3121 * typeck2.c (split_nonconstant_init_1): Properly count
3122 num_split_elts, optimize single constructor elt removal.
3124 2019-06-12 Marek Polacek <polacek@redhat.com>
3126 PR c++/66999 - 'this' captured by reference.
3127 * parser.c (cp_parser_lambda_introducer): Reject `&this'. Use
3128 cp_lexer_nth_token_is instead of cp_lexer_peek_nth_token.
3130 PR c++/90825 - endless recursion when evaluating sizeof.
3131 PR c++/90832 - endless recursion when evaluating sizeof.
3132 * constexpr.c (cxx_eval_constant_expression): Don't recurse on the
3133 result of fold_sizeof_expr if is returns a SIZEOF_EXPR.
3134 * typeck.c (cxx_sizeof_expr): Only return a SIZEOF_EXPR if the operand
3135 is instantiation-dependent.
3137 PR c++/90736 - bogus error with alignof.
3138 * constexpr.c (adjust_temp_type): Use cv_unqualified type.
3140 2019-06-11 Matthew Beliveau <mbelivea@redhat.com>
3142 PR c++/90449 - add -Winaccessible-base option.
3143 * class.c (warn_about_ambiguous_bases): Changed name to:
3144 maybe_warn_about_inaccessible_bases.
3145 (maybe_warn_about_inaccessible_bases): Implemented new
3146 Winaccessible-base warning option for both direct and virtual
3148 (layout_class_type): Call to warn_about_ambiguous_bases changed to fit
3151 2019-06-11 Richard Biener <rguenther@suse.de>
3154 * typeck2.c (split_nonconstant_init_1): Avoid ordered remove
3155 from CONSTRUCTOR by marking to remove elements and doing all
3156 of them in a O(n) scan.
3158 2019-06-11 Jakub Jelinek <jakub@redhat.com>
3161 * init.c (constant_value_1): Handle VECTOR_CST DECL_INITIAL for
3162 !DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P decls like CONSTRUCTOR.
3164 2019-06-11 Martin Liska <mliska@suse.cz>
3167 * pt.c (init_template_processing): Disable hash table
3168 sanitization for decl_specializations and type_specializations.
3170 2019-06-10 Jason Merrill <jason@redhat.com>
3172 * constexpr.c (free_constructor): New.
3173 (cxx_eval_call_expression): Free parameter value CONSTRUCTORs.
3175 * constexpr.c (unshare_constructor): Only unshare if T is itself a
3177 (cxx_eval_call_expression): Don't call it on the result here.
3179 Reduce constexpr_call memory consumption.
3180 * constexpr.c (cxx_bind_parameters_in_call): Use TREE_VEC rather
3182 (constexpr_call_hasher::equal, cxx_bind_parameters_in_call)
3183 (cxx_eval_call_expression): Adjust.
3185 2019-06-10 Jakub Jelinek <jakub@redhat.com>
3187 * parser.c (cp_parser_omp_clause_reduction): Don't sorry_at on inscan
3189 (cp_parser_omp_scan_loop_body): New function.
3190 (cp_parser_omp_for_loop): Call cp_parser_omp_scan_loop_body if there
3191 are inscan reduction clauses.
3192 (cp_parser_pragma): Reject PRAGMA_OMP_SCAN.
3193 * semantics.c (finish_omp_clauses): Reject mixing inscan with
3194 non-inscan reductions on the same construct, or inscan reductions with
3195 ordered or schedule clauses, or inscan array reductions.
3196 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_{IN,EX}CLUSIVE.
3197 (tsubst_expr): Handle OMP_SCAN.
3199 2019-06-07 Jason Merrill <jason@redhat.com>
3201 * constexpr.c (cxx_eval_constant_expression): Call
3202 STRIP_ANY_LOCATION_WRAPPER early.
3203 [CONVERT_EXPR]: Don't build anything for conversion to void.
3204 [ADDR_EXPR]: ggc_free unused ADDR_EXPR.
3206 2019-06-05 Martin Sebor <msebor@redhat.com>
3209 * typeck.c (maybe_warn_about_returning_address_of_local): Only
3210 consider functions returning pointers as candidates for
3211 -Wreturn-local-addr.
3213 2019-06-05 Paolo Carlini <paolo.carlini@oracle.com>
3215 * decl.c (smallest_type_location): New.
3216 (check_special_function_return_type): Use it.
3217 (grokdeclarator): Lkewise.
3219 2019-06-05 Paolo Carlini <paolo.carlini@oracle.com>
3221 * decl.c (grokdeclarator): Use locations[ds_friend]
3224 2019-06-05 Martin Sebor <msebor@redhat.com>
3226 * call.c (build_conditional_expr_1): Adjust quoting and hyphenation.
3227 (convert_like_real): Same.
3228 (convert_arg_to_ellipsis): Same.
3229 * constexpr.c (diag_array_subscript): Same.
3230 * constraint.cc (diagnose_trait_expression): Same.
3231 * cvt.c (ocp_convert): Same.
3232 * decl.c (start_decl): Same.
3233 (check_for_uninitialized_const_var): Same.
3235 (check_special_function_return_type): Same.
3236 (finish_enum_value_list): Same.
3237 (start_preparsed_function): Same.
3238 * parser.c (cp_parser_decl_specifier_seq): Same.
3239 * typeck.c (cp_build_binary_op): Same.
3240 (build_static_cast_1): Same.
3242 2019-06-04 Nina Dinka Ranns <dinka.ranns@gmail.com>
3244 PR c++/63149 - Wrong auto deduction from braced-init-list.
3245 * pt.c (listify_autos): use non cv qualified auto_node in
3246 std::initializer_list<auto>.
3248 2019-06-04 Paolo Carlini <paolo.carlini@oracle.com>
3250 * decl.c (grokdeclarator): Use declarator->id_loc in two
3253 2019-06-04 Nathan Sidwell <nathan@acm.org>
3255 * name-lookup.c (lookup_type_scope_1): Reimplement, handle local
3256 and namespace scopes separately.
3258 2019-06-04 Harald van Dijk <harald@gigawatt.nl>
3260 PR c++/60531 - Wrong error about unresolved overloaded function
3261 * typeck.c (cp_build_binary_op): See if overload can be resolved.
3262 (cp_build_unary_op): Ditto.
3264 2019-06-04 Jason Merrill <jason@redhat.com>
3266 Reduce accumulated garbage in constexpr evaluation.
3267 * constexpr.c (cxx_eval_call_expression): ggc_free any bindings we
3269 (cxx_eval_increment_expression): ggc_free the MODIFY_EXPR after
3272 2019-06-04 Jakub Jelinek <jakub@redhat.com>
3274 * cp-tree.h (CP_OMP_CLAUSE_INFO): Allow for any clauses up to _condvar_
3275 instead of only up to linear.
3277 2019-06-03 Paolo Carlini <paolo.carlini@oracle.com>
3279 * parser.c (cp_parser_unqualified_id): Use build_min_nt_loc in
3282 2019-06-01 Ville Voutilainen <ville.voutilainen@gmail.com>
3285 * class.c (fixup_type_variants): Handle CLASSTYPE_FINAL.
3287 2019-05-31 Nathan Sidwell <nathan@acm.org>
3289 * cp-tree.h (IDENTIFIER_LAMBDA_P): New.
3291 (LAMBDA_TYPE_P, TYPE_UNNAMED_P): Likewise.
3292 (LAMBDANAME_PREFIX, LAMBDANAME_FORMAT): Delete.
3293 (make_lambda_name): Don't declare.
3294 * error.c (dump_aggr_type): Check for lambdas before other
3296 * lambda.c (begin_lambda_type): Use make_anon_name.
3297 * cp-lang.c (cxx_dwarf_name): Lambda names smell anonymous.
3298 * mangle.c (write_local_name): Likewise.
3299 * name-lookup.c (lambda_cnt, make_lambda_name): Delete.
3301 2019-05-30 Marek Polacek <polacek@redhat.com>
3303 * cp-tree.h (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Fix a typo.
3305 2019-05-31 Paolo Carlini <paolo.carlini@oracle.com>
3307 * decl.c (grokdeclarator): Use declarator->id_loc in five
3310 2019-05-29 Jakub Jelinek <jakub@redhat.com>
3313 * tree.c (lvalue_kind): Return clk_none for expressions with
3316 2019-05-29 Paolo Carlini <paolo.carlini@oracle.com>
3319 * parser.c (cp_parser_sizeof_operand): When the type-id production
3320 did not work out commit to the tentative parse.
3322 2019-05-29 Jakub Jelinek <jakub@redhat.com>
3324 P1091R3 - Extending structured bindings to be more like var decls
3325 P1381R1 - Reference capture of structured bindings
3326 * decl.c (cp_maybe_mangle_decomp): Handle TREE_STATIC decls even at
3328 (cp_finish_decomp): Copy over various decl properties from decl to
3329 v[i] in the tuple case.
3330 (grokdeclarator): Allow static, thread_local and __thread for C++2a
3331 and use pedwarn instead of error for older standard revisions.
3332 Make other structured binding diagnostic messages more i18n friendly.
3334 2019-05-28 Nathan Sidwell <nathan@acm.org>
3336 * decl.c (duplicate_decls): Assert a template newdecl has no
3339 2019-05-28 Marek Polacek <polacek@redhat.com>
3341 PR c++/90548 - ICE with generic lambda and empty pack.
3342 * pt.c (tsubst_copy_and_build): Handle pack expansion properly.
3344 2019-05-28 Nathan Sidwell <nathan@acm.org>
3346 * cp-tree.h (make_anon_name): Drop declaration.
3347 (TYPE_UNNAMED_P): Use IDENTIFIER_ANON_P.
3348 * cp-lang.c (cxx_dwarf_name): Likewise.
3349 * class.c (find_flexarrays): Likewise.
3350 * decl.c (name_unnamed_type, xref_tag_1): Likewise.
3351 * error.c (dump_aggr_type): Likewise.
3352 * pt.c (push_template_decl_real): Likewise.
3353 * name-lookup.c (consider_binding_level): Likewise.
3354 (anon_cnt, make_anon_name): Delete.
3356 2019-05-25 Marek Polacek <polacek@redhat.com>
3358 PR c++/90572 - wrong disambiguation in friend declaration.
3359 * parser.c (cp_parser_constructor_declarator_p): Don't allow missing
3360 typename for friend declarations.
3362 2019-05-23 Jonathan Wakely <jwakely@redhat.com>
3364 * cp-tree.h (CP_AGGREGATE_TYPE_P): Fix whitespace.
3366 * init.c (std_placement_new_fn_p): Remove outdated TODO comment that
3367 was resolved by r254694.
3369 2019-05-22 Jason Merrill <jason@redhat.com>
3371 PR c++/20408 - unnecessary code for empty struct.
3372 * call.c (build_call_a): Use simple_empty_class_p.
3374 PR c++/86485 - -Wmaybe-unused with empty class ?:
3375 * cp-gimplify.c (simple_empty_class_p): Also true for MODIFY_EXPR.
3377 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com>
3379 * parser.c (cp_parser_template_declaration_after_parameters): Use
3380 DECL_SOURCE_LOCATION in literal operator template errors.
3382 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com>
3386 * call.c (build_over_call): Devirtualize when the final overrider
3387 comes from the base.
3389 2019-05-21 Nathan Sidwell <nathan@acm.org>
3391 * name-lookup.c (do_nonmember_using_decl): Drop INSERT_P
3392 parameter. Document.
3393 (finish_nonmember_using_decl): Adjust do_nonmember_using_decl
3394 calls. Remove stray FIXME comment.
3396 * name-lookup.h (struct cp_binding_level): Drop usings field.
3397 (finish_namespace_using_decl, finish_local_using_decl): Replace with ...
3398 (finish_nonmember_using_decl): ... this.
3399 * name-lookup.c (push_using_decl_1, push_using_decl):
3400 (do_nonmember_using_decl): ... here. Add INSERT_P arg. Reimplement.
3401 (validate_nonmember_using_decl, finish_namespace_using_decl)
3402 (finish_local_using_decl): Replace with ...
3403 (finish_nonmember_using_decl): ... this. Drop DECL parm.
3404 * parser.c (cp_parser_using_declaration): Don't do lookup here.
3405 * pt.c (tsubst_expr): Do not do using decl lookup here.
3407 2019-05-21 Eric Botcazou <ebotcazou@adacore.com>
3409 * decl2.c (cpp_check) <IS_ASSIGNMENT_OPERATOR>: New case.
3411 2019-05-20 Marek Polacek <polacek@redhat.com>
3413 CWG 2094 - volatile scalars are trivially copyable.
3415 * tree.c (trivially_copyable_p): Don't check CP_TYPE_VOLATILE_P for
3418 2019-05-20 Marek Polacek <polacek@redhat.com>
3420 * pt.c (convert_template_argument): Add a diagnostic for the
3421 [temp.arg]/2 ambiguity case.
3423 * name-lookup.c (finish_using_directive): Don't issue inform() if the
3424 warning didn't trigger. Add quoting. Tweak the inform message.
3426 2019-05-20 Paolo Carlini <paolo.carlini@oracle.com>
3428 * cp-tree.h: Remove remnants of CONV_NONCONVERTING.
3430 2019-05-20 Nathan Sidwell <nathan@acm.org>
3432 * name-lookup.c (finish_namespace_using_directive)
3433 (finish_local_using_directive): Merge to ...
3434 (finish_using_directive): ... here. Handle both contexts.
3435 * name-lookup.h (finish_namespace_using_directive)
3436 (finish_local_using_directive): Replace with ...
3437 (finish_using_directive): ... this.
3438 * parser.c (cp_parser_using_directive): Adjust.
3439 * pt.c (tsubst_expr): Likewise.
3441 * cp-tree.h (struct lang_decl_ns): Remove usings field.
3442 (DECL_NAMESPACE_USING): Delete.
3443 * name-lookup.c (name_lookup::search_usings): Use namespace's
3445 (name_lookup::queue_namespae): Likewise.
3446 (finish_namespace_using_directive, push_namespace): Likewise.
3447 (has_using_namespace_std_directive): Just search the entire
3450 2019-05-20 Jonathan Wakely <jwakely@redhat.com>
3452 PR c++/90532 Ensure __is_constructible(T[]) is false
3453 * method.c (is_xible_helper): Return error_mark_node for construction
3454 of an array of unknown bound.
3456 2019-05-17 Thomas Schwinge <thomas@codesourcery.com>
3459 * parser.c (cp_finalize_oacc_routine): Rework checking if already
3460 marked with an OpenACC 'routine' directive.
3463 * parser.c (cp_parser_oacc_routine)
3464 (cp_parser_late_parsing_oacc_routine): Normalize order of clauses.
3465 (cp_finalize_oacc_routine): Call oacc_verify_routine_clauses.
3468 * parser.c (cp_finalize_oacc_routine): Refer to OpenACC 'routine'
3469 clauses from "omp declare target" attribute.
3471 2019-05-16 Martin Sebor <msebor@redhat.com>
3473 * call.c (print_z_candidate): Wrap diagnostic text in a gettext
3475 (print_z_candidates): Same.
3476 (build_conditional_expr_1): Quote keywords, operators, and types
3478 (build_op_delete_call): Same.
3479 (maybe_print_user_conv_context): Wrap diagnostic text in a gettext
3481 (convert_like_real): Same.
3482 (convert_arg_to_ellipsis): Quote keywords, operators, and types
3484 (build_over_call): Same.
3485 (joust): Break up an overlong line. Wrap diagnostic text in a gettext
3487 * constexpr.c (cxx_eval_check_shift_p): Spell out >= in English.
3488 (cxx_eval_constant_expression): Quote keywords, operators, and types
3490 (potential_constant_expression_1): Same.
3491 * cp-gimplify.c (cp_genericize_r): Same.
3492 * cvt.c (maybe_warn_nodiscard): Quote keywords, operators, and types
3494 (type_promotes_to): Same.
3495 * decl.c (check_previous_goto_1): Same.
3498 (cp_finish_decl): Avoid parenthesizing a sentence for consistency.
3499 (grok_op_properties): Quote keywords, operators, and types
3501 * decl2.c (grokfield): Same.
3502 (coerce_delete_type): Same.
3503 * except.c (is_admissible_throw_operand_or_catch_parameter): Same.
3504 * friend.c (do_friend): Quote C++ tokens.
3505 * init.c (build_new_1): Quote keywords, operators, and types
3507 (build_vec_delete_1): Same.
3508 (build_delete): Same.
3509 * lex.c (parse_strconst_pragma): Same.
3510 (handle_pragma_implementation): Same.
3511 (unqualified_fn_lookup_error): Same.
3512 * mangle.c (write_type): Same.
3513 * method.c (defaulted_late_check): Avoid two consecutive punctuators.
3514 * name-lookup.c (cp_binding_level_debug): Remove a trailing newline.
3515 (pop_everything): Same.
3516 * parser.c (cp_lexer_start_debugging): Quote a macro name.
3518 (cp_lexer_stop_debugging): Same.
3519 (cp_parser_userdef_numeric_literal): Quote a C++ header name
3521 (cp_parser_nested_name_specifier_opt): Quote keywords, operators,
3522 and types in diagnostics.
3523 (cp_parser_question_colon_clause): Same.
3524 (cp_parser_asm_definition): Same.
3525 (cp_parser_init_declarator): Same.
3526 (cp_parser_template_declaration_after_parameters): Avoid capitalizing
3527 a sentence in a diagnostic.
3528 (cp_parser_omp_declare_reduction): Quote keywords, operators, and types
3530 (cp_parser_transaction): Same.
3531 * pt.c (maybe_process_partial_specialization): Replace second call
3532 to permerror with inform for consistency with other uses.
3533 (expand_integer_pack): Quote keywords, operators, and types
3535 * rtti.c (get_typeid): Quote keywords, operators, and types
3537 (build_dynamic_cast_1): Same.
3538 * semantics.c (finish_asm_stmt): Same.
3539 (finish_label_decl): Same.
3540 (finish_bases): Same.
3541 (finish_offsetof): Same.
3542 (cp_check_omp_declare_reduction): Same.
3543 (finish_decltype_type): Same.
3544 * tree.c (handle_init_priority_attribute): Same. Add detail
3546 (maybe_warn_zero_as_null_pointer_constant): Same.
3547 * typeck.c (cp_build_binary_op): Quote keywords, operators, and types
3549 (cp_build_unary_op): Same.
3550 (check_for_casting_away_constness): Same.
3551 (build_static_cast): Same.
3552 (build_const_cast_1): Same.
3553 (maybe_warn_about_returning_address_of_local): Same.
3554 (check_return_expr): Same.
3555 * typeck2.c (abstract_virtuals_error_sfinae): Same.
3556 (digest_init_r): Replace a tab with spaces in a diagnostic.
3557 (build_functional_cast): Quote keywords, operators, and types
3560 2019-05-15 Jakub Jelinek <jakub@redhat.com>
3563 * cp-gimplify.c (genericize_cp_loop): Emit a DEBUG_BEGIN_STMT
3564 before the condition (or if missing or constant non-zero at the end
3565 of the loop. Emit a DEBUG_BEGIN_STMT before the increment expression
3566 if any. Don't call protected_set_expr_location on incr if it already
3569 2019-05-15 Marek Polacek <polacek@redhat.com>
3571 CWG 2096 - constraints on literal unions.
3572 * class.c (check_field_decls): Initialize booleans directly. A union
3573 is literal if at least one of its non-static data members is of
3574 non-volatile literal type.
3576 2019-05-15 Paolo Carlini <paolo.carlini@oracle.com>
3578 * cp-tree.h (REFERENCE_VLA_OK): Remove.
3579 * lambda.c (build_capture_proxy): Remove use of the above.
3581 2019-05-15 Paolo Carlini <paolo.carlini@oracle.com>
3583 * call.c (perform_overload_resolution, build_new_method_call_1):
3584 Use OVL_P; remove redundant TEMPLATE_DECL checks.
3585 * decl.c (grokfndecl): Likewise.
3586 * mangle.c (write_expression): Likewise.
3587 * parser.c (cp_parser_template_id): Likewise.
3588 * pt.c (resolve_overloaded_unification, type_dependent_expression_p):
3590 * search.c (build_baselink): Likewise.
3591 * tree.c (is_overloaded_fn, dependent_name, maybe_get_fns): Likewise.
3593 2019-05-14 Paolo Carlini <paolo.carlini@oracle.com>
3595 PR preprocessor/90382
3596 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
3599 2019-05-13 Jason Merrill <jason@redhat.com>
3601 Use releasing_vec more broadly.
3602 * cp-tree.h (struct releasing_vec): Replace get_ref method with
3604 (vec_safe_push, vec_safe_reserve, vec_safe_length, vec_safe_splice):
3605 Forwarding functions for releasing_vec.
3606 (release_tree_vector): Declare but don't define.
3607 * call.c (build_op_delete_call, build_temp, call_copy_ctor)
3608 (perform_direct_initialization_if_possible): Use releasing_vec.
3609 * constexpr.c (cxx_eval_vec_init_1, cxx_eval_store_expression):
3611 * cp-gimplify.c (cp_fold): Likewise.
3612 * cvt.c (force_rvalue, ocp_convert): Likewise.
3613 * decl.c (get_tuple_decomp_init): Likewise.
3614 * except.c (build_throw): Likewise.
3615 * init.c (perform_member_init, expand_default_init): Likewise.
3616 * method.c (do_build_copy_assign, locate_fn_flags): Likewise.
3617 * parser.c (cp_parser_userdef_char_literal)
3618 (cp_parser_userdef_numeric_literal)
3619 (cp_parser_userdef_string_literal)
3620 (cp_parser_perform_range_for_lookup)
3621 (cp_parser_range_for_member_function, cp_parser_omp_for_loop)
3622 (cp_parser_omp_for_loop_init): Likewise.
3623 * pt.c (tsubst_copy_and_build, do_class_deduction): Likewise.
3624 * semantics.c (calculate_direct_bases, calculate_bases)
3625 (finish_omp_barrier, finish_omp_flush, finish_omp_taskwait)
3626 (finish_omp_taskyield, finish_omp_cancel)
3627 (finish_omp_cancellation_point): Likewise.
3628 * tree.c (build_vec_init_elt, strip_typedefs, strip_typedefs_expr)
3629 (build_min_non_dep_op_overload): Likewise.
3630 * typeck.c (build_function_call_vec, cp_build_function_call_nary)
3631 (cp_build_modify_expr): Likewise.
3632 * typeck2.c (build_functional_cast): Likewise.
3634 2019-05-11 Paolo Carlini <paolo.carlini@oracle.com>
3636 * typeck.c (cp_build_function_call_vec): When mark_used fails
3637 unconditionally return error_mark_node.
3639 2019-05-10 Paolo Carlini <paolo.carlini@oracle.com>
3641 * decl.c (grokvardecl): Use an accurate location in error message
3642 about main as a global variable.
3644 2019-05-10 Paolo Carlini <paolo.carlini@oracle.com>
3646 * call.c (build_call_a): Use FUNC_OR_METHOD_TYPE_P.
3647 * cp-gimplify.c (cp_fold): Likewise.
3648 * cp-objcp-common.c (cp_type_dwarf_attribute): Likewise.
3649 * cp-tree.h (TYPE_OBJ_P, TYPE_PTROBV_P): Likewise.
3650 * cvt.c (perform_qualification_conversions): Likewise.
3651 * decl.c (grokdeclarator): Likewise.
3652 * decl2.c (build_memfn_type): Likewise.
3653 * mangle.c (canonicalize_for_substitution, write_type): Likewise.
3654 * parser.c (cp_parser_omp_declare_reduction): Likewise.
3655 * pt.c (check_explicit_specialization, uses_deducible_template_parms,
3656 check_cv_quals_for_unify, dependent_type_p_r): Likewise.
3657 * rtti.c (ptr_initializer): Likewise.
3658 * semantics.c (finish_asm_stmt, finish_offsetof,
3659 cp_check_omp_declare_reduction): Likewise.
3660 * tree.c (cp_build_qualified_type_real,
3661 cp_build_type_attribute_variant, cxx_type_hash_eq,
3662 cxx_copy_lang_qualifiers, cp_free_lang_data): Likewise.
3663 * typeck.c (structural_comptypes, convert_arguments,
3664 cp_build_addr_expr_1, unary_complex_lvalue, cp_build_c_cast,
3665 cp_build_modify_expr, comp_ptr_ttypes_real, type_memfn_rqual):
3668 2019-05-10 Marek Polacek <polacek@redhat.com>
3670 PR c++/78010 - bogus -Wsuggest-override warning on final function.
3671 * class.c (check_for_override): Don't warn for final functions.
3673 2019-05-10 Jakub Jelinek <jakub@redhat.com>
3676 * config-lang.in (gtfiles): Remove c-family/c-lex.c, add
3677 c-family/c-cppbuiltin.c.
3679 2019-05-09 Paolo Carlini <paolo.carlini@oracle.com>
3683 2018-04-26 Paolo Carlini <paolo.carlini@oracle.com>
3685 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
3688 2019-05-08 Nathan Sidwell <nathan@acm.org>
3690 Kill DECL_SAVED_FUNCTION_DATA .
3691 * cp-tree.h (language_function): Remove x_auto_return_pattern.
3692 (current_function_auto_return_pattern): Delete.
3693 (lang_decl_fn): Replace saved_language_function with
3694 saved_auto_return type.
3695 (DECL_SAVED_FUNCTION_DATA): Delete.
3696 (DECL_SAVED_AUTO_RETURN_TYPE): New.
3697 (FNDECL_USED_AUTO): Correct documentation.
3698 * decl.c (duplicate_decls): Adjust AUTO return handling.
3699 (start_preparsed_function): Replace
3700 current_function_auto_return_pattern with
3701 DECL_SAVED_AUTO_RETURN_TYPE. Remove DECL_SAVED_FUNCTION_DATA
3703 (finish_function): Likewise.
3704 (save_function_data): Delete.
3705 (fndecl_declared_return_type): Reimplement.
3706 * mangle.c (write_unqualified_name): Use DECL_SAVED_AUTO_RETURN_TYPE.
3707 * method.c (make_thunk, make_alias_for): Likewise.
3708 * parser.c (cp_parser_jump_statement): Likewise.
3709 * pt.c (do_auto_deduction): Likewise.
3710 * typeck.c (check_return_expr): Likewise.
3712 2019-05-06 Jason Merrill <jason@redhat.com>
3714 PR c++/90171 - reorganize usual_deallocation_fn_p
3715 * call.c (struct dealloc_info): New.
3716 (usual_deallocation_fn_p): Take a dealloc_info*.
3717 (aligned_deallocation_fn_p, sized_deallocation_fn_p): Remove.
3718 (build_op_delete_call): Adjust.
3720 2019-05-07 Jason Merrill <jason@redhat.com>
3722 PR c++/86485 - -Wmaybe-unused with empty class ?:
3723 * typeck.c (build_static_cast_1): Use cp_build_addr_expr.
3725 * pt.c (type_dependent_expression_p): A non-type template parm with
3726 a placeholder type is type-dependent.
3728 2019-05-06 Marek Polacek <polacek@redhat.com>
3730 PR c++/90265 - ICE with generic lambda.
3731 * pt.c (tsubst_copy_and_build): Use a dedicated variable for the last
3732 element in the vector.
3734 2019-05-03 Martin Liska <mliska@suse.cz>
3736 * call.c (build_aggr_conv): Use is_empty instead of
3737 elements () == 0 (and similar usages).
3738 * parser.c (cp_parser_lambda_introducer): Likewise.
3740 2019-05-02 Nathan Sidwell <nathan@acm.org>
3742 * semantics.c (finish_id_expression_1): Remove unreachable code.
3744 2019-05-01 Nathan Sidwell <nathan@acm.org>
3746 * name-lookup.h (get_class_binding_direct): Change final arg to
3748 (get_class_binding): Likewise.
3749 * name-lookup.c (get_class_binding_direct): Replace TYPE_OR_FNS
3750 arg with WANT_TYPE bool. Simplify.
3751 (get_class_binding): Adjust final arg.
3752 * decl.c (reshape_init_class): Adjust get_class_binding calls.
3754 2019-04-30 Nathan Sidwell <nathan@acm.org>
3756 * cp-objcp-common.c (cp_common_init_ts): Use MARK_TS_EXP for _EXPR
3757 nodes. Call c_common_init_ts.
3759 2019-04-29 Nathan Sidwell <nathan@acm.org>
3761 * decl.c (duplicate_decls): Add whitespace, move comments into
3763 * method.c (explain_implicit_non_constexpr): Refactor.
3764 * pt.c (check_explicit_specialization): Fix indentation.
3765 * semantics.c (process_outer_var_ref): Reformat.
3766 (finish_id_expression_1): Use STRIP_TEMPLATE.
3768 2019-04-26 Jonathan Wakely <jwakely@redhat.com>
3770 PR c++/90243 - orphaned note in uninstantiated constexpr function
3771 * decl.c (check_for_uninitialized_const_var): Suppress notes if no
3774 2019-04-26 Paolo Carlini <paolo.carlini@oracle.com>
3777 * decl.c (grokdeclarator): Set type to error_mark_node
3778 upon error about template placeholder type non followed
3779 by a simple declarator-id.
3781 2019-04-26 Paolo Carlini <paolo.carlini@oracle.com>
3783 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
3786 2019-04-24 Jason Merrill <jason@redhat.com>
3788 PR c++/90227 - error with template parameter packs.
3789 * pt.c (coerce_template_parms): Do add empty pack when
3792 2019-04-24 Richard Biener <rguenther@suse.de>
3794 * call.c (null_ptr_cst_p): Order checks according to expensiveness.
3795 (conversion_null_warnings): Likewise.
3796 * typeck.c (same_type_ignoring_top_level_qualifiers_p): Return
3797 early if type1 == type2.
3799 2019-04-22 Jason Merrill <jason@redhat.com>
3801 PR c++/87366 - wrong error with alias template.
3802 * typeck.c (structural_comptypes): When comparing_specializations,
3803 aliases are unequal.
3804 (comptypes): When comparing_specializations, do structural
3807 2019-04-19 Jason Merrill <jason@redhat.com>
3809 PR c++/90190 - CTAD with list-constructor.
3810 * pt.c (do_class_deduction): Don't try the single element deduction
3811 if the single element is also a braced list.
3813 PR c++/90171 - ICE with destroying delete with size_t parm.
3814 * call.c (sized_deallocation_fn_p): New. Use it instead of
3815 second_parm_is_size_t in most cases.
3816 (second_parm_is_size_t): Don't check for aligned.
3818 2019-04-19 Paolo Carlini <paolo.carlini@oracle.com>
3821 * pt.c (fn_type_unification): When handling null explicit
3822 arguments do not special case non-parameter packs.
3824 2019-04-19 Jakub Jelinek <jakub@redhat.com>
3827 * pt.c (process_template_parm): Set decl to pushdecl result. If
3828 !is_non_type, also set parm to that.
3831 * decl.c (struct cp_switch): Remove outside_range_p member.
3832 (push_switch): Don't clear it.
3833 (pop_switch): Adjust c_do_switch_warnings caller.
3834 (finish_case_label): Adjust c_add_case_label caller.
3837 * decl.c (duplicate_decls): If remove is main variant and
3838 DECL_ORIGINAL_TYPE is some other type, remove a DECL_ORIGINAL_TYPE
3839 variant that has newdecl as TYPE_NAME if any.
3841 2019-04-18 Jason Merrill <jason@redhat.com>
3843 PR c++/87554 - ICE with extern template and reference member.
3844 * decl.c (cp_finish_decl): Don't set DECL_INITIAL of external vars.
3846 2019-04-17 Jason Merrill <jason@redhat.com>
3848 PR c++/90047 - ICE with enable_if alias template.
3849 * pt.c (tsubst_decl) [TYPE_DECL]: Don't put an erroneous decl in the
3850 hash table when we're in SFINAE context.
3852 2019-04-17 Marek Polacek <polacek@redhat.com>
3854 PR c++/90124 - bogus error with incomplete type in decltype.
3855 * typeck.c (build_class_member_access_expr): Check
3856 cp_unevaluated_operand.
3858 2019-04-12 Jakub Jelinek <jakub@redhat.com>
3861 * decl.c (duplicate_decls): When newdecl's type is its main variant,
3862 don't try to remove it from the variant list, but instead assert
3865 2019-04-12 Martin Sebor <msebor@redhat.com>
3869 * parser.c (cp_parser_has_attribute_expression): Handle assignment
3872 2019-04-12 Jason Merrill <jason@redhat.com>
3874 * call.c (null_member_pointer_value_p): Handle an empty CONSTRUCTOR
3877 2019-04-12 Marek Polacek <polacek@redhat.com>
3879 * except.c (build_noexcept_spec): Use build_converted_constant_bool_expr
3880 instead of perform_implicit_conversion_flags.
3882 PR c++/87603 - constexpr functions are no longer noexcept.
3883 * constexpr.c (is_sub_constant_expr): Remove unused function.
3884 * cp-tree.h (is_sub_constant_expr): Remove declaration.
3885 * except.c (check_noexcept_r): Don't consider a call to a constexpr
3888 2019-04-11 Jakub Jelinek <jakub@redhat.com>
3890 PR translation/90035
3891 * parser.h (struct cp_parser): Add
3892 type_definition_forbidden_message_arg member.
3893 * parser.c (cp_debug_parser): Print it.
3894 (cp_parser_check_type_definition): Pass
3895 parser->type_definition_forbidden_message_arg as second argument to
3897 (cp_parser_has_attribute_expression, cp_parser_sizeof_operand): Set
3898 parser->type_definition_forbidden_message_arg and use G_() with
3899 %qs for parser->type_definition_forbidden_message instead of
3900 building untranslatable message using concat.
3902 2019-04-09 Jakub Jelinek <jakub@redhat.com>
3904 PR translation/90011
3905 * typeck2.c (check_narrowing): Remove trailing space from diagnostics.
3907 2019-04-08 Marek Polacek <polacek@redhat.com>
3909 * typeck2.c (digest_init_r): Don't condition the object slicing warning
3912 2019-04-08 Paolo Carlini <paolo.carlini@oracle.com>
3915 * semantics.c (trait_expr_value): Don't use TYPE_NOTHROW_P
3916 when maybe_instantiate_noexcept fails.
3917 (classtype_has_nothrow_assign_or_copy_p): Likewise.
3918 * method.c (implicitly_declare_fn): Avoid passing error_mark_node
3919 to build_exception_variant.
3921 2019-04-05 Marek Polacek <polacek@redhat.com>
3923 PR c++/87145 - bogus error converting class type in template arg list.
3924 * pt.c (convert_nontype_argument): Don't call
3925 build_converted_constant_expr if it could involve calling a conversion
3926 function with a instantiation-dependent constructor as its argument.
3928 2019-04-05 Martin Sebor <msebor@redhat.com>
3931 * decl.c (reshape_init_array_1): Avoid treating empty strings
3932 as zeros in array initializers.
3933 Use trivial_type_p () instead of TYPE_HAS_TRIVIAL_DFLT().
3935 2019-04-04 Jason Merrill <jason@redhat.com>
3937 PR c++/89948 - ICE with break in statement-expr.
3938 * constexpr.c (cxx_eval_statement_list): Jumping out of a
3939 statement-expr is non-constant.
3941 2019-04-04 Jason Merrill <jason@redhat.com>
3943 PR c++/89966 - error with non-type auto tparm.
3944 * pt.c (do_auto_deduction): Clear tf_partial.
3946 2019-04-04 Jason Merrill <jason@redhat.com>
3948 PR c++/86986 - ICE with TTP with parameter pack.
3949 * pt.c (coerce_template_parameter_pack): Only look at the type of a
3950 non-type parameter pack.
3951 (fixed_parameter_pack_p_1): Don't recurse into the type of a
3952 non-type parameter pack.
3953 (coerce_template_template_parms): Call add_outermost_template_args.
3955 2019-04-04 Martin Sebor <msebor@redhat.com>
3961 * decl.c (reshape_init_array_1): Strip trailing zero-initializers
3962 from arrays of trivial type and known size.
3963 * mangle.c (write_expression): Convert braced initializer lists
3965 (write_expression): Trim trailing zero-initializers from arrays
3967 (write_template_arg_literal): Mangle strings the same as braced
3970 2019-04-03 Jason Merrill <jason@redhat.com>
3972 PR c++/81866 - ICE with member template and default targ.
3973 * pt.c (tsubst_template_decl): Handle getting a type from
3974 retrieve_specialization.
3976 PR c++/86586 - -fcompare-debug=-Wsign-compare.
3977 * typeck.c (cp_build_binary_op): Don't fold for -Wsign-compare.
3979 PR c++/89331 - ICE with offsetof in incomplete class.
3980 * semantics.c (finish_offsetof): Handle error_mark_node.
3981 * typeck.c (build_class_member_access_expr): Call
3982 complete_type_or_maybe_complain before converting to base.
3984 PR c++/89917 - ICE with lambda in variadic mem-init.
3985 * pt.c (make_pack_expansion): Change type_pack_expansion_p to false.
3987 2019-04-01 Jason Merrill <jason@redhat.com>
3989 PR c++/86946 - ICE with function call in template argument.
3991 * pt.c (iterative_hash_template_arg) [CALL_EXPR]: Use
3994 2019-04-01 Paolo Carlini <paolo.carlini@oracle.com>
3997 * pt.c (tsubst_copy): Deal with lookup_name not returing a variable.
3999 2019-03-31 Marek Polacek <polacek@redhat.com>
4001 PR c++/89852 - ICE with C++11 functional cast with { }.
4002 * constexpr.c (fold_non_dependent_expr_template): New static function
4004 (fold_non_dependent_expr): ...here.
4005 (fold_non_dependent_init): New function.
4006 * cp-tree.h (fold_non_dependent_init): Declare.
4007 * typeck2.c (massage_init_elt): Call fold_non_dependent_init instead
4008 of fold_non_dependent_expr. Don't call maybe_constant_init.
4010 2019-03-30 Jason Merrill <jason@redhat.com>
4012 PR c++/89744 - ICE with specialization of member class template.
4013 * pt.c (lookup_template_class_1): If the partial instantiation is
4014 explicitly specialized, adjust.
4015 (maybe_process_partial_specialization): Also adjust
4018 2019-03-29 Jakub Jelinek <jakub@redhat.com>
4021 * typeck.c: Include gimplify.h.
4022 (cp_build_modify_expr) <case COND_EXPR>: Unshare rhs before using it
4023 for second time. Formatting fixes.
4025 2019-03-29 Marek Polacek <polacek@redhat.com>
4027 PR c++/89876 - ICE with deprecated conversion.
4028 * call.c (convert_like_real): Only give warnings with tf_warning.
4030 2019-03-28 Marek Polacek <polacek@redhat.com>
4032 PR c++/89612 - ICE with member friend template with noexcept.
4033 * pt.c (maybe_instantiate_noexcept): For function templates, use their
4034 template result (function decl). Don't set up local specializations.
4035 Temporarily turn on processing_template_decl. Update the template type
4038 PR c++/89836 - bool constant expression and explicit conversions.
4039 * call.c (build_converted_constant_expr_internal): New function,
4041 (build_converted_constant_expr): ...this. New.
4042 (build_converted_constant_bool_expr): New.
4043 * cp-tree.h (build_converted_constant_bool_expr): Declare.
4044 * decl.c (build_explicit_specifier): Call
4045 build_converted_constant_bool_expr.
4047 2019-03-28 Jakub Jelinek <jakub@redhat.com>
4050 * constexpr.c (struct check_for_return_continue_data): New type.
4051 (check_for_return_continue): New function.
4052 (potential_constant_expression_1) <case SWITCH_STMT>: Walk
4053 SWITCH_STMT_BODY to find RETURN_EXPRs or CONTINUE_STMTs not nested
4054 in loop bodies and set *jump_target to that if found.
4056 2019-03-27 Jason Merrill <jason@redhat.com>
4058 PR c++/89831 - error with qualified-id in const member function.
4059 * semantics.c (finish_non_static_data_member): Use object cv-quals
4060 in scoped case, too.
4062 PR c++/89421 - ICE with lambda in template parameter list.
4063 * parser.c (cp_parser_lambda_expression): Also reject a lambda in a
4064 template parameter list before C++20.
4065 * pt.c (type_dependent_expression_p): True for LAMBDA_EXPR.
4066 * semantics.c (begin_class_definition): Restore error about defining
4067 non-lambda class in template parm list.
4069 2019-03-26 Jason Merrill <jason@redhat.com>
4071 PR c++/86932 - missed SFINAE with empty pack.
4072 * pt.c (coerce_template_parms): Don't add an empty pack if
4074 (fn_type_unification): Pass tf_partial to coerce_template_parms.
4076 PR c++/86429 - constexpr variable in lambda.
4079 * constexpr.c (cxx_eval_constant_expression): In a lambda function,
4080 try evaluating the captured variable directly.
4082 2019-03-26 Jakub Jelinek <jakub@redhat.com>
4085 * semantics.c (finish_omp_atomic): Add warning_sentinel for
4086 -Wunused-value around finish_expr_stmt call.
4088 2019-03-25 Paolo Carlini <paolo.carlini@oracle.com>
4092 * parser.c (cp_parser_binary_expression): Don't call cp_fully_fold
4093 to undo the disabling of warnings.
4095 2019-03-25 Jason Merrill <jason@redhat.com>
4097 PR c++/87748 - substitution failure error with decltype.
4098 * pt.c (most_specialized_partial_spec): Clear
4099 processing_template_decl.
4101 2019-03-25 Marek Polacek <polacek@redhat.com>
4103 PR c++/89214 - ICE when initializing aggregates with bases.
4104 * typeck2.c (digest_init_r): Warn about object slicing instead of
4107 PR c++/89705 - ICE with reference binding with conversion function.
4108 * call.c (reference_binding): If the result of the conversion function
4109 is a prvalue of non-class type, use the cv-unqualified type.
4111 2019-03-25 Nathan Sidwell <nathan@acm.org>
4113 * lambda.c (maybe_add_lambda_conv_op): Don't add to comdat group.
4115 2019-03-22 Jakub Jelinek <jakub@redhat.com>
4118 * cp-tree.h (get_tls_wrapper_fn): Remove declaration.
4119 (maybe_get_tls_wrapper_call): Declare.
4120 * decl2.c (get_tls_wrapper_fn): Make static.
4121 (maybe_get_tls_wrapper_call): New function.
4122 * typeck.c (build_class_member_access_expr): Handle accesses to TLS
4124 * semantics.c (finish_qualified_id_expr): Likewise.
4125 (finish_id_expression_1): Use maybe_get_tls_wrapper_call.
4126 * pt.c (tsubst_copy_and_build): Likewise.
4129 * constexpr.c (struct constexpr_ctx): Add constexpr_ops_count member.
4130 (cxx_eval_constant_expression): When not skipping, not constant class
4131 or location wrapper, increment *ctx->constexpr_ops_count and if it is
4132 above constexpr_loop_nest_limit, diagnose failure.
4133 (cxx_eval_outermost_constant_expr): Add constexpr_ops_count and
4134 initialize ctx.constexpr_ops_count to its address.
4135 (is_sub_constant_expr): Likewise.
4137 2019-03-21 Jakub Jelinek <jakub@redhat.com>
4140 * call.c (filed_in_pset): Change pset from hash_set<tree> * to
4141 hash_set<tree, true> &, adjust uses accordingly.
4142 (build_aggr_conv): Change pset from hash_set<tree> *
4143 to hash_set<tree, true>. Replace goto fail; with return NULL;,
4147 * parser.c (cp_parser_lambda_introducer): Add ids and first_capture_id
4148 variables, check for duplicates in this function.
4149 * lambda.c (add_capture): Don't check for duplicates nor use
4151 (register_capture_members): Don't clear IDENTIFIER_MARKED here.
4153 2019-03-21 Paolo Carlini <paolo.carlini@oracle.com>
4156 * method.c (after_nsdmi_defaulted_late_checks): Avoid passing
4157 error_mark_node to comp_except_specs.
4159 2019-03-20 Jason Merrill <jason@redhat.com>
4161 PR c++/87480 - decltype of member access in default template arg
4162 * pt.c (type_unification_real): Accept a dependent result in
4165 2019-03-19 Martin Sebor <msebor@redhat.com>
4167 PR tree-optimization/89688
4168 * typeck2.c (store_init_value): Call braced_lists_to_string for more
4169 kinds of initializers.
4171 2019-03-18 Jason Merrill <jason@redhat.com>
4173 PR c++/89630 - ICE with dependent using-decl as template arg.
4174 * tree.c (cp_tree_equal): Always return false for USING_DECL.
4176 PR c++/89761 - ICE with sizeof... in pack expansion.
4177 * pt.c (argument_pack_element_is_expansion_p): Handle
4178 ARGUMENT_PACK_SELECT.
4180 PR c++/89640 - GNU attributes on lambda.
4181 * parser.c (cp_parser_lambda_declarator_opt): Allow GNU attributes.
4183 PR c++/89682 - wrong access error in default argument.
4184 * pt.c (tsubst_default_argument): Don't defer access checks.
4186 2019-03-18 Paolo Carlini <paolo.carlini@oracle.com>
4189 * semantics.c (finish_non_static_data_member): Check return value
4190 of context_for_name_lookup and immediately return error_mark_node
4193 2019-03-17 Jason Merrill <jason@redhat.com>
4195 PR c++/89571 - ICE with ill-formed noexcept on constructor.
4196 * pt.c (maybe_instantiate_noexcept): Only return false if defaulted.
4197 (regenerate_decl_from_template): Use it for noexcept-specs.
4199 2019-03-14 Jason Merrill <jason@redhat.com>
4201 * parser.c (cp_parser_decl_specifier_seq): Support C++20
4202 concept-definition syntax without 'bool'.
4204 2019-03-14 Jakub Jelinek <jakub@redhat.com>
4207 * semantics.c (finish_qualified_id_expr): Reject variable templates.
4210 * constexpr.c (struct constexpr_ctx): Change save_exprs type from
4211 hash_set<tree> to vec<tree>.
4212 (cxx_eval_call_expression): Adjust for save_exprs being a vec instead
4214 (cxx_eval_loop_expr): Likewise. Truncate the vector after each
4215 removal of SAVE_EXPRs from values.
4216 (cxx_eval_constant_expression) <case SAVE_EXPR>: Call safe_push
4217 method on save_exprs instead of add.
4219 2019-03-13 Jason Merrill <jason@redhat.com>
4221 PR c++/86521 - C++17 copy elision in initialization by constructor.
4222 * call.c (joust_maybe_elide_copy): New.
4225 2019-03-13 Marek Polacek <polacek@redhat.com>
4227 PR c++/88979 - further P0634 fix for constructors.
4228 * parser.c (cp_parser_decl_specifier_seq): Pass flags to
4229 cp_parser_constructor_declarator_p.
4230 (cp_parser_direct_declarator): Allow missing typename for constructor
4232 (cp_parser_constructor_declarator_p): Add FLAGS parameter. Pass it to
4233 cp_parser_type_specifier.
4235 PR c++/89686 - mixing init-capture and simple-capture in lambda.
4236 * parser.c (cp_parser_lambda_introducer): Give error when combining
4237 init-capture and simple-capture.
4239 PR c++/89660 - bogus error with -Wredundant-move.
4240 * typeck.c (maybe_warn_pessimizing_move): Only accept (T &) &arg
4241 as the std::move's argument. Don't call convert_for_initialization
4242 when warn_redundant_move isn't on.
4244 2019-03-11 Jason Merrill <jason@redhat.com>
4246 PR c++/86521 - wrong overload resolution with ref-qualifiers.
4247 * call.c (build_user_type_conversion_1): Don't use a conversion to a
4248 reference of the wrong rvalueness for direct binding.
4250 2019-03-11 Martin Liska <mliska@suse.cz>
4252 * cvt.c (build_expr_type_conversion): Wrap apostrophes
4253 in gcc internal format with %'.
4254 * decl.c (check_no_redeclaration_friend_default_args): Likewise.
4255 (grokfndecl): Likewise.
4256 * name-lookup.c (do_pushtag): Likewise.
4257 * pt.c (unify_parameter_deduction_failure): Likewise.
4258 (unify_template_deduction_failure): Likewise.
4260 2019-03-11 Martin Liska <mliska@suse.cz>
4262 * call.c (convert_arg_to_ellipsis): Wrap an option name
4263 in a string format message and fix GNU coding style.
4264 (build_over_call): Likewise.
4265 * class.c (check_field_decl): Likewise.
4266 (layout_nonempty_base_or_field): Likewise.
4267 * constexpr.c (cxx_eval_loop_expr): Likewise.
4268 * cvt.c (type_promotes_to): Likewise.
4269 * decl.c (cxx_init_decl_processing): Likewise.
4270 (mark_inline_variable): Likewise.
4271 (grokdeclarator): Likewise.
4272 * decl2.c (record_mangling): Likewise.
4273 * error.c (maybe_warn_cpp0x): Likewise.
4274 * except.c (doing_eh): Likewise.
4275 * mangle.c (maybe_check_abi_tags): Likewise.
4276 * parser.c (cp_parser_diagnose_invalid_type_name): Likewise.
4277 (cp_parser_userdef_numeric_literal): Likewise.
4278 (cp_parser_primary_expression): Likewise.
4279 (cp_parser_unqualified_id): Likewise.
4280 (cp_parser_pseudo_destructor_name): Likewise.
4281 (cp_parser_builtin_offsetof): Likewise.
4282 (cp_parser_lambda_expression): Likewise.
4283 (cp_parser_lambda_introducer): Likewise.
4284 (cp_parser_lambda_declarator_opt): Likewise.
4285 (cp_parser_selection_statement): Likewise.
4286 (cp_parser_init_statement): Likewise.
4287 (cp_parser_decomposition_declaration): Likewise.
4288 (cp_parser_function_specifier_opt): Likewise.
4289 (cp_parser_static_assert): Likewise.
4290 (cp_parser_simple_type_specifier): Likewise.
4291 (cp_parser_namespace_definition): Likewise.
4292 (cp_parser_using_declaration): Likewise.
4293 (cp_parser_ctor_initializer_opt_and_function_body): Likewise.
4294 (cp_parser_initializer_list): Likewise.
4295 (cp_parser_type_parameter_key): Likewise.
4296 (cp_parser_member_declaration): Likewise.
4297 (cp_parser_try_block): Likewise.
4298 (cp_parser_std_attribute_spec): Likewise.
4299 (cp_parser_requires_clause_opt): Likewise.
4300 * pt.c (check_template_variable): Likewise.
4301 (check_default_tmpl_args): Likewise.
4302 (push_tinst_level_loc): Likewise.
4303 (instantiate_pending_templates): Likewise.
4304 (invalid_nontype_parm_type_p): Likewise.
4305 * repo.c (get_base_filename): Likewise.
4306 * rtti.c (typeid_ok_p): Likewise.
4307 (build_dynamic_cast_1): Likewise.
4308 * tree.c (maybe_warn_parm_abi): Likewise.
4310 2019-03-08 Jakub Jelinek <jakub@redhat.com>
4313 * parser.c (cp_parser_template_declaration_after_parameters): Avoid
4314 one space before " at the end of line and another after " on another
4315 line in a string literal.
4317 PR tree-optimization/89550
4318 * semantics.c (maybe_convert_cond): Only set TREE_NO_WARNING if
4319 warning_at returned true.
4320 * decl2.c (c_parse_final_cleanups): Likewise.
4321 * typeck.c (convert_for_assignment): Likewise.
4322 * decl.c (finish_function): Likewise.
4325 * parser.c (cp_parser_asm_definition): Just warn instead of error
4326 on volatile qualifier outside of function body.
4329 * constexpr.c (potential_constant_expression_1): Reject
4330 REINTERPRET_CAST_P NOP_EXPRs.
4333 * call.c (joust): Call print_z_candidate only if pedwarn returned
4336 2019-03-07 Jason Merrill <jason@redhat.com>
4338 PR c++/88123 - lambda and using-directive.
4339 * name-lookup.c (op_unqualified_lookup)
4340 (maybe_save_operator_binding, discard_operator_bindings)
4341 (push_operator_bindings): New.
4342 * typeck.c (build_x_binary_op, build_x_unary_op): Call
4343 maybe_save_operator_binding.
4344 * decl.c (start_preparsed_function): Call push_operator_bindings.
4345 * tree.c (cp_free_lang_data): Call discard_operator_bindings.
4347 PR c++/88820 - ICE with CTAD and member template used in DMI.
4348 * pt.c (do_class_deduction): Handle parm used as its own arg.
4350 2019-03-07 Jakub Jelinek <jakub@redhat.com>
4353 * parser.c (cp_parser_asm_definition): Parse asm qualifiers even
4354 at toplevel, but diagnose them.
4356 2019-03-06 Jason Merrill <jason@redhat.com>
4358 PR c++/89381 - implicit copy and using-declaration.
4359 * class.c (classtype_has_move_assign_or_move_ctor_p): Don't consider
4360 op= brought in by a using-declaration.
4362 2019-03-06 Jakub Jelinek <jakub@redhat.com>
4365 * init.c (build_value_init_noctor): Ignore flexible array members.
4367 2019-03-06 Jason Merrill <jason@redhat.com>
4369 PR c++/89576 - if constexpr of lambda capture.
4370 * semantics.c (maybe_convert_cond): Do convert a non-dependent
4371 condition in a template.
4372 * typeck.c (condition_conversion): Handle being called in a
4375 2019-03-06 Marek Polacek <polacek@redhat.com>
4377 PR c++/87378 - bogus -Wredundant-move warning.
4378 * typeck.c (maybe_warn_pessimizing_move): See if the maybe-rvalue
4379 overload resolution would actually succeed.
4381 2019-03-05 Jason Merrill <jason@redhat.com>
4383 * class.c (is_really_empty_class): Add ignore_vptr parm.
4384 (trivial_default_constructor_is_constexpr): Pass it.
4385 * call.c (build_over_call): Pass it.
4386 * constexpr.c (cxx_eval_constant_expression): Pass it instead of
4387 checking TYPE_POLYMORPHIC_P.
4388 (cxx_eval_component_reference, potential_constant_expression_1):
4390 * cp-gimplify.c (simple_empty_class_p): Pass it.
4391 * init.c (expand_aggr_init_1): Pass it.
4393 2019-03-04 Paolo Carlini <paolo.carlini@oracle.com>
4396 * parser.c (cp_parser_class_head): Reject TYPE_BEING_DEFINED too.
4398 2019-03-04 Jakub Jelinek <jakub@redhat.com>
4401 * call.c (field_in_pset): New function.
4402 (build_aggr_conv): Handle CONSTRUCTOR_IS_DESIGNATED_INIT correctly.
4404 2019-03-02 Jakub Jelinek <jakub@redhat.com>
4407 * cp-tree.h (CONSTRUCTOR_IS_DESIGNATED_INIT): Define.
4408 * parser.c (cp_parser_braced_list): Adjust cp_parser_initializer_list
4409 caller, set CONSTRUCTOR_IS_DESIGNATED_INIT.
4410 (cp_parser_initializer_list): Add designated parameter, set *designated
4411 to a bool whether any designators were parsed.
4412 * decl.c (reshape_init): Copy over CONSTRUCTOR_IS_DESIGNATED_INIT if
4414 * pt.c (tsubst_copy_and_build): Likewise.
4415 * call.c (implicit_conversion): If CONSTRUCTOR_IS_DESIGNATED_INIT,
4416 don't call build_list_conv, nor build_complex_conv, nor attempt to
4417 convert a single element initializer to scalar.
4419 2019-03-01 Marek Polacek <polacek@redhat.com>
4421 PR c++/89537 - missing location for error with non-static member fn.
4422 * call.c (resolve_args): Use EXPR_LOCATION.
4423 * typeck.c (build_class_member_access_expr): Use input_location.
4425 PR c++/89532 - ICE with incomplete type in decltype.
4426 * semantics.c (finish_compound_literal): Return error_mark_node
4427 if digest_init_flags returns error_mark_node.
4429 2019-03-01 Jakub Jelinek <jakub@redhat.com>
4431 Implement P1002R1, Try-catch blocks in constexpr functions
4433 * parser.c (cp_parser_ctor_initializer_opt_and_function_body):
4434 Diagnose constexpr ctor or function with function-try-block with
4435 pedwarn for c++17 and earlier. Formatting fix.
4436 (cp_parser_try_block): Use pedwarn instead of error and only for
4437 c++17 and earlier when try block appears in constexpr function.
4438 * constexpr.c (build_constexpr_constructor_member_initializers):
4439 Handle TRY_BLOCK here instead of erroring on it.
4441 2019-02-28 Jason Merrill <jason@redhat.com>
4443 PR c++/88183 - ICE with .* fold-expression.
4444 * pt.c (fold_expression) [DOTSTAR_EXPR]: Remove special handling.
4446 PR c++/86969 - ICE with constexpr if and recursive generic lambdas.
4447 * class.c, lambda.c, pt.c: Revert earlier change.
4448 * lambda.c (add_capture): Don't special-case capture of dependent
4451 * name-lookup.c (print_binding_level): Print this_entity.
4453 2019-02-27 Marek Polacek <polacek@redhat.com>
4455 PR c++/88857 - ICE with value-initialization of argument in template.
4456 * call.c (convert_like_real): Don't call build_value_init in template.
4458 2019-02-27 Jason Merrill <jason@redhat.com>
4460 PR c++/86969 - ICE with constexpr if and recursive generic lambdas.
4461 * semantics.c (process_outer_var_ref): Do capture dependent vars.
4462 * class.c (finish_struct): Only add TAG_DEFN if T is in
4463 current_function_decl.
4464 * lambda.c (vla_capture_type): Force the capture type out into the
4465 lambda's enclosing function.
4466 (add_capture): Pass in the lambda.
4467 * pt.c (tsubst_lambda_expr): complete_type a VLA capture type.
4469 2019-02-27 Marek Polacek <polacek@redhat.com>
4471 PR c++/89511 - ICE with using-declaration and unscoped enumerator.
4472 * parser.c (cp_parser_using_declaration): For an unscoped enum
4473 only use its context if it's not a function declaration.
4475 2019-02-27 Paolo Carlini <paolo.carlini@oracle.com>
4478 * method.c (process_subob_fn): When maybe_instantiate_noexcept
4479 returns false don't call merge_exception_specifiers.
4481 2019-02-27 Paolo Carlini <paolo.carlini@oracle.com>
4484 * parser.c (cp_parser_noexcept_specification_opt): Return NULL_TREE
4485 for a non-constant parsed expression.
4487 2019-02-26 Jakub Jelinek <jakub@redhat.com>
4490 * constexpr.c (cxx_eval_store_expression): When changing active union
4491 member, set no_zero_init.
4493 2019-02-23 Marek Polacek <polacek@redhat.com>
4495 PR c++/88294 - ICE with non-constant noexcept-specifier.
4496 * pt.c (maybe_instantiate_noexcept): Set up the list of local
4497 specializations. Set current_class_{ptr,ref}.
4499 2019-02-22 David Malcolm <dmalcolm@redhat.com>
4502 * parser.c (cp_parser_unqualified_id): Capture and use locations
4505 2019-02-22 Marek Polacek <polacek@redhat.com>
4507 PR c++/89420 - ICE with CAST_EXPR in explicit-specifier.
4508 * decl.c (build_explicit_specifier): Don't check
4509 processing_template_decl. Call instantiation_dependent_expression_p
4510 instead of value_dependent_expression_p. Call
4511 instantiate_non_dependent_expr_sfinae before
4512 build_converted_constant_expr instead of calling
4513 instantiate_non_dependent_expr after it. Add
4514 processing_template_decl_sentinel.
4516 2019-02-22 Thomas Schwinge <thomas@codesourcery.com>
4518 * parser.c (cp_parser_oacc_simple_clause): Remove parser formal
4519 parameter, move loc formal parameter to the front. Adjust all
4521 (cp_parser_oacc_shape_clause): Add loc formal parameter. Adjust
4524 2019-02-21 Jason Merrill <jason@redhat.com>
4526 PR c++/87685 - generic lambda 'this' capture error.
4527 * lambda.c (lambda_expr_this_capture): Change add_capture_p to int.
4528 (maybe_generic_this_capture): Pass -1.
4530 PR c++/88394 - ICE with VLA init-capture.
4531 * lambda.c (is_normal_capture_proxy): Check DECL_CAPTURED_VARIABLE.
4533 PR c++/88869 - C++17 ICE with CTAD and explicit specialization.
4534 * pt.c (do_class_deduction): Don't include explicit specialization
4537 PR c++/89422 - ICE with -g and lambda in default arg in template.
4538 * pt.c (tsubst_function_decl): SET_DECL_FRIEND_CONTEXT sooner.
4540 2019-02-21 Jason Merrill <jason@redhat.com>
4542 PR c++/88419 - C++17 ICE with class template arg deduction.
4543 * pt.c (make_template_placeholder): Set TYPE_CANONICAL after
4544 CLASS_PLACEHOLDER_TEMPLATE.
4546 2019-02-21 Jakub Jelinek <jakub@redhat.com>
4549 * constexpr.c (struct constexpr_fundef): Add parms and result members.
4550 (retrieve_constexpr_fundef): Adjust for the above change.
4551 (register_constexpr_fundef): Save constexpr body with copy_fn,
4552 temporarily set DECL_CONTEXT on DECL_RESULT before that.
4553 (get_fundef_copy): Change FUN argument to FUNDEF with
4554 constexpr_fundef * type, grab body and parms/result out of
4555 constexpr_fundef struct and temporarily change it for copy_fn calls
4557 (cxx_eval_builtin_function_call): For __builtin_FUNCTION temporarily
4558 adjust current_function_decl from ctx->call context. Test
4559 !potential_constant_expression instead of !is_constant_expression.
4560 (cxx_bind_parameters_in_call): Grab parameters from new_call. Undo
4561 convert_for_arg_passing changes for TREE_ADDRESSABLE type passing.
4562 (cxx_eval_call_expression): Adjust get_fundef_copy caller.
4563 (cxx_eval_conditional_expression): For IF_STMT, allow then or else
4564 operands to be NULL.
4565 (label_matches): Handle BREAK_STMT and CONTINUE_STMT.
4566 (cxx_eval_loop_expr): Add support for FOR_STMT, WHILE_STMT and DO_STMT.
4567 (cxx_eval_switch_expr): Add support for SWITCH_STMT.
4568 (cxx_eval_constant_expression): Handle IF_STMT, FOR_STMT, WHILE_STMT,
4569 DO_STMT, CONTINUE_STMT, SWITCH_STMT, BREAK_STMT and CONTINUE_STMT.
4570 For SIZEOF_EXPR, recurse on the result of fold_sizeof_expr. Ignore
4571 DECL_EXPR with USING_DECL operand.
4572 * lambda.c (maybe_add_lambda_conv_op): Build thisarg using
4573 build_int_cst to make it a valid constant expression.
4575 2019-02-20 Jason Merrill <jason@redhat.com>
4577 PR c++/88690 - C++17 ICE with empty base in aggregate.
4578 * typeck2.c (process_init_constructor_record): Skip trivial
4579 initialization of an empty base.
4581 2019-02-21 Richard Biener <rguenther@suse.de>
4584 * vtable-class-hierarchy.c (vtv_generate_init_routine): Do not
4585 make symtab process new functions here.
4587 2019-02-20 Jason Merrill <jason@redhat.com>
4589 PR c++/87921 - wrong error with inline static data member.
4590 * decl2.c (finish_static_data_member_decl): Don't set DECL_IN_AGGR_P
4591 for a non-template inline variable. Do nothing for an
4592 already-instantiated variable.
4593 (c_parse_final_cleanups): Check DECL_IN_AGGR_P without
4595 * decl.c (check_initializer): Likewise.
4596 (make_rtl_for_nonlocal_decl): Likewise.
4597 * pt.c (instantiate_decl): Likewise.
4598 * typeck2.c (store_init_value): Likewise.
4600 2019-02-20 Jakub Jelinek <jakub@redhat.com>
4603 * decl2.c (c_parse_final_cleanups): Move TREE_ASM_WRITTEN setting
4604 for flag_syntax_only from here...
4605 * semantics.c (expand_or_defer_fn_1): ... here.
4608 * decl.c (maybe_commonize_var): When clearing TREE_PUBLIC and
4609 DECL_COMMON, set DECL_INTERFACE_KNOWN.
4612 * constexpr.c (cxx_eval_store_expression): Diagnose changing of active
4613 union member for -std=c++17 and earlier.
4615 2019-02-19 Jason Merrill <jason@redhat.com>
4617 PR c++/87513 - 'sorry' mangling PMF template-id.
4618 * mangle.c (write_expression): Handle SCOPE_REF to BASELINK.
4620 2019-02-19 Jason Merrill <jason@redhat.com>
4622 PR c++/88380 - wrong-code with flexible array and NSDMI.
4623 * typeck2.c (process_init_constructor_record): Skip flexarrays.
4625 2019-02-20 will wray <wjwray@gmail.com>
4627 PR c++/88572 - wrong handling of braces on scalar init.
4628 * decl.c (reshape_init_r): Allow braces around scalar initializer
4629 within aggregate init. Reject double braced-init of scalar
4632 2019-02-20 Paolo Carlini <paolo.carlini@oracle.com>
4635 * pt.c (tsubst_init): Diagnose an initializer expanding to an
4636 empty list of expressions; tweak wrt dependent types.
4637 (regenerate_decl_from_template): For VAR_DECLs call tsubst_init
4638 instead of tsubst_expr.
4640 2019-02-19 Jason Merrill <jason@redhat.com>
4642 PR c++/88368 - wrong 'use of deleted function'
4643 * method.c (walk_field_subobs): Remember errors from get_nsdmi.
4644 (get_defaulted_eh_spec): Call push_tinst_level.
4645 * pt.c (maybe_instantiate_noexcept): Keep error_mark_node.
4646 * typeck2.c (merge_exception_specifiers): Handle error_mark_node.
4648 2019-02-19 Chung-Lin Tang <cltang@codesourcery.com>
4651 * parser.c (cp_parser_oacc_clause_wait): Add representation of wait
4652 clause without argument as 'wait (GOMP_ASYNC_NOVAL)', adjust comments.
4654 2019-02-19 Jakub Jelinek <jakub@redhat.com>
4657 * lambda.c (maybe_generic_this_capture): Don't check
4658 DECL_NONSTATIC_MEMBER_FUNCTION_P on USING_DECLs.
4661 * typeck.c (build_reinterpret_cast_1): Don't handle void to
4662 && conversion go through build_target_expr_with_type.
4665 * error.c (qualified_name_lookup_error): Only call
4666 suggest_alternative_in_scoped_enum if name is IDENTIFIER_NODE.
4668 2019-02-19 Tom Honermann <tom@honermann.net>
4670 * name-lookup.c (get_std_name_hint): Added u8string as a name hint.
4672 2019-02-18 Jason Merrill <jason@redhat.com>
4674 PR c++/89336 - multiple stores in constexpr stmt.
4675 * constexpr.c (cxx_eval_store_expression): Preevaluate scalar or
4678 * pt.c (check_explicit_specialization): If the declarator is a
4679 template-id, only check whether the arguments are dependent.
4681 Improve duplicate [[likely]] diagnostic.
4682 * parser.c (cp_parser_statement): Make attrs_loc a range. Pass it
4683 to process_stmt_hotness_attribute.
4684 * cp-gimplify.c (process_stmt_hotness_attribute): Take attrs_loc.
4685 (genericize_if_stmt): Use likely/unlikely instead of predictor_name.
4687 2019-02-17 Marek Polacek <polacek@redhat.com>
4689 PR c++/89217 - ICE with list-initialization in range-based for loop.
4690 * constexpr.c (unshare_constructor): No longer static.
4691 * cp-tree.h (unshare_constructor): Declare.
4692 * semantics.c (finish_compound_literal): When dealing with a
4693 non-dependent expression in a template, return the original
4694 expression. Pass LOOKUP_NO_NARROWING to digest_init_flags.
4696 2019-02-13 Marek Polacek <polacek@redhat.com>
4698 PR c++/89297 - ICE with OVERLOAD in template.
4699 * semantics.c (finish_compound_literal): Call
4700 instantiate_non_dependent_expr_sfinae.
4702 2019-02-13 Alexandre Oliva <aoliva@redhat.com>
4705 * cp-tree.h (USING_DECL_SCOPE): Use result rather than type.
4706 * name-lookup.c (strip_using_decl): Use USING_DECL_SCOPE.
4707 * search.c (protected_accessible_p): Follow USING_DECL_DECLS.
4708 (shared_member_p): Likewise.
4709 (lookup_member): Likewise.
4710 * decl.c (grok_special_member_properties): Skip USING_DECLs.
4711 * semantics.c (finish_omp_declare_simd_methods): Likewise.
4712 (finish_qualified_id_expr): Do not call shared_member_p with
4716 * pt.c (tsubst_lambda_expr): Avoid duplicate tsubsting.
4717 Move cp_evaluated resetting before signature tsubsting.
4718 (gen_elem_of_pack_expansion_instantiation): Separate local
4719 specializations per index.
4721 2019-02-13 David Malcolm <dmalcolm@redhat.com>
4724 * class.c (add_method): Drop destructor assertion.
4726 2019-02-13 Paolo Carlini <paolo.carlini@oracle.com>
4729 * decl.c (make_typename_type): Allow for TYPE_PACK_EXPANSION as
4730 context (the first argument).
4731 * pt.c (tsubst, case TYPENAME_TYPE): Handle TYPE_PACK_EXPANSION
4734 2019-02-12 Jason Merrill <jason@redhat.com>
4736 PR c++/89144 - link error with constexpr initializer_list.
4737 * call.c (convert_like_real) [ck_list]: Don't allocate a temporary
4738 array for an empty list.
4739 * typeck2.c (store_init_value): Don't use cxx_constant_init in a
4742 2019-02-11 Jason Merrill <jason@redhat.com>
4744 PR c++/89241 - ICE with __func__ in lambda in template.
4745 * pt.c (enclosing_instantiation_of): Also check
4746 instantiated_lambda_fn_p for the template context.
4748 2019-02-11 Marek Polacek <polacek@redhat.com>
4750 PR c++/89212 - ICE converting nullptr to pointer-to-member-function.
4751 * pt.c (tsubst_copy_and_build) <case CONSTRUCTOR>: Return early for
4752 null member pointer value.
4754 2019-02-11 Jakub Jelinek <jakub@redhat.com>
4757 * pt.c (convert_nontype_argument): Pass true as manifestly_const_eval
4758 to maybe_constant_value calls.
4760 2019-02-11 Marek Polacek <polacek@redhat.com>
4762 * typeck2.c (digest_init_r): Remove commented code.
4764 2019-02-11 Martin Sebor <msebor@redhat.com>
4767 * decl.c (compute_array_index_type_loc): Preserve signed sizes
4768 for diagnostics. Call valid_array_size_p instead of error.
4769 * init.c (build_new_1): Compute size for diagnostic. Call
4770 invalid_array_size_error
4771 (build_new): Call valid_array_size_p instead of error.
4773 2019-02-07 Alexandre Oliva <aoliva@redhat.com>
4776 * call.c (compare_ics): Deal with ck_aggr in either cs.
4778 2019-02-06 David Malcolm <dmalcolm@redhat.com>
4781 * call.c (get_location_for_expr_unwinding_for_system_header): New
4783 (conversion_null_warnings): Use it when getting locations for
4784 EXPR, effectively adding a call to
4785 get_location_for_expr_unwinding_for_system_header for
4786 -Wconversion-null and making use of EXPR_LOCATION for
4787 -Wzero-as-null-pointer-constant.
4789 2019-02-05 Jakub Jelinek <jakub@redhat.com>
4792 * optimize.c (maybe_thunk_body): Clear TREE_ADDRESSABLE on
4793 PARM_DECLs of the thunk.
4794 * lambda.c (maybe_add_lambda_conv_op): Likewise.
4796 2019-02-05 Marek Polacek <polacek@redhat.com>
4798 PR c++/89158 - by-value capture of constexpr variable broken.
4799 * call.c (convert_like_real) <case ck_user>: Call mark_exp_read
4800 instead of mark_rvalue_use.
4802 2019-02-05 Alexandre Oliva <aoliva@redhat.com>
4805 * pt.c (instantiates_primary_template_p): New.
4806 (type_dependent_expression_p): Use it.
4808 2019-02-01 Jason Merrill <jason@redhat.com>
4810 PR c++/88761 - ICE with reference capture of constant.
4811 * lambda.c (mark_const_cap_r): Do walk subtrees of DECL_EXPR for
4814 2019-02-01 Marek Polacek <polacek@redhat.com>
4816 PR c++/88325 - ICE with invalid out-of-line template member definition.
4817 * parser.c (cp_parser_class_name): Don't call make_typename_type
4820 2019-02-01 Jakub Jelinek <jakub@redhat.com>
4823 * parser.c (cp_parser_gnu_attributes_opt): Set ok to false
4824 if require_open failed.
4826 2019-01-31 Marek Polacek <polacek@redhat.com>
4828 PR c++/89083, c++/80864 - ICE with list initialization in template.
4829 * constexpr.c (adjust_temp_type): Use copy_node and change the type
4830 instead of using build_constructor.
4831 * decl.c (reshape_init_r): Don't reshape a digested initializer.
4832 Return the initializer for COMPOUND_LITERAL_P.
4834 PR c++/88983 - ICE with switch in constexpr function.
4835 * constexpr.c (cxx_eval_switch_expr): Use SWITCH_COND and SWITCH_BODY.
4836 (cxx_eval_constant_expression) <case COND_EXPR>: Don't look for the
4837 label in the else branch if we found it in the then branch.
4839 2019-01-30 Jason Merrill <jason@redhat.com>
4841 PR c++/88752 - ICE with lambda and constexpr if.
4842 * cp-tree.h (LAMBDA_EXPR_INSTANTIATED): New.
4843 * pt.c (tsubst_lambda_expr): Set it.
4844 (instantiated_lambda_fn_p): Check it.
4845 (enclosing_instantiation_of): Use it.
4847 2019-01-31 Jakub Jelinek <jakub@redhat.com>
4850 * cxx-pretty-print.c (pp_cxx_enumeration_constant): Print always as
4851 a C cast in pp_c_flag_gnu_v3 mode.
4853 2019-01-30 Jakub Jelinek <jakub@redhat.com>
4856 * lambda.c (is_capture_proxy): Don't return true for
4857 DECL_OMP_PRIVATIZED_MEMBER artificial vars.
4859 2019-01-30 Marek Polacek <polacek@redhat.com>
4861 PR c++/89119 - ICE with value-initialization in template.
4862 * pt.c (tsubst_copy_and_build): Handle RANGE_EXPR.
4864 2019-01-29 Jason Merrill <jason@redhat.com>
4866 PR c++/86943 - wrong code converting lambda to function pointer.
4867 * lambda.c (maybe_add_lambda_conv_op): Use a template-id in the
4868 call. Only forward parms for decltype.
4869 * pt.c (tsubst_copy_and_build) [CALL_EXPR]: Handle CALL_FROM_THUNK_P
4871 * typeck.c (check_return_expr): Don't mess with a thunk call.
4873 2019-01-28 Jason Merrill <jason@redhat.com>
4875 PR c++/89089 - ICE with [[no_unique_address]].
4876 PR c++/88865 - wrong layout with [[no_unique_address]].
4877 * class.c (check_field_decls): A potentially-overlapping field makes
4878 the class non-layout-POD, but not non-empty.
4879 (end_of_class): Always consider empty data members.
4880 (layout_class_type): Set DECL_SIZE for empty fields.
4882 2019-01-28 Marek Polacek <polacek@redhat.com>
4884 PR c++/88358 - name wrongly treated as type.
4885 * parser.c (cp_parser_direct_declarator): Don't assume a qualified-id
4886 in parameter-list is a type if the function's declarator-id is not
4889 2019-01-27 Marek Polacek <polacek@redhat.com>
4891 PR c++/88815 - narrowing conversion lost in decltype.
4892 PR c++/78244 - narrowing conversion in template not detected.
4893 * cp-tree.h (CONSTRUCTOR_IS_DEPENDENT): New.
4894 * pt.c (instantiation_dependent_r): Consider a CONSTRUCTOR with
4895 CONSTRUCTOR_IS_DEPENDENT instantiation-dependent.
4896 * semantics.c (finish_compound_literal): When the compound literal
4897 isn't instantiation-dependent and the type isn't type-dependent,
4898 fall back to the normal processing. Set CONSTRUCTOR_IS_DEPENDENT.
4900 PR c++/89024 - ICE with incomplete enum type.
4901 * call.c (standard_conversion): When converting an
4902 ARITHMETIC_TYPE_P to an incomplete type, return NULL.
4904 2019-01-25 Paolo Carlini <paolo.carlini@oracle.com>
4907 * call.c (build_op_delete_call): Implement 7.6.2.5/(10.1).
4908 * decl2.c (coerce_delete_type): Use build_pointer_type instead
4911 2019-01-24 Jason Merrill <jason@redhat.com>
4913 PR c++/89001 - mangling of reference temporaries
4914 * cp-tree.h (struct saved_scope): Add ref_temp_count.
4915 (current_ref_temp_count): New macro.
4916 * mangle.c (mangle_ref_init_variable): Use it.
4917 * typeck2.c (store_init_value): Clear it.
4918 * call.c (make_temporary_var_for_ref_to_temp): Copy public and
4921 2019-01-24 Jakub Jelinek <jakub@redhat.com>
4924 * semantics.c (finish_omp_cancel): Diagnose more than one if
4925 on #pragma omp cancel with different modifiers. Use
4926 maybe_convert_cond when not in template or build_x_binary_op
4929 2019-01-23 Marek Polacek <polacek@redhat.com>
4931 PR c++/88757 - qualified name treated wrongly as type.
4932 * parser.c (cp_parser_direct_declarator): Don't treat qualified-ids
4933 in parameter-list as types if name lookup for declarator-id didn't
4934 find one or more function templates.
4936 2019-01-23 Jakub Jelinek <jakub@redhat.com>
4939 * cp-gimplify.c (genericize_cp_loop): Call begin_bc_block only
4940 after genericizing cond and incr expressions.
4943 * cp-gimplify.c (genericize_switch_stmt): Move cond genericization
4944 before the begin_bc_block call.
4946 2019-01-21 Jason Merrill <jason@redhat.com>
4948 PR c++/87893 - constexpr ctor ICE on ARM.
4949 PR c++/88293 - ICE with comma expression.
4950 * constexpr.c (initialized_type): Don't shortcut non-void type.
4951 Handle COMPOUND_EXPR.
4952 (cxx_eval_outermost_constant_expr): Return early for void type.
4954 2019-01-21 Jakub Jelinek <jakub@redhat.com>
4957 * optimize.c (cxx_copy_decl): New function.
4958 (clone_body): Use it instead of copy_decl_no_change.
4961 * typeck.c (cp_build_binary_op): Don't instrument
4962 SANITIZE_POINTER_COMPARE if processing_template_decl.
4963 (pointer_diff): Similarly for SANITIZE_POINTER_SUBTRACT.
4965 2019-01-18 Jason Merrill <jason@redhat.com>
4967 PR c++/88875 - error with explicit list constructor.
4968 * call.c (reference_binding): Don't modify EXPR. Set
4969 need_temporary_p on the ck_user conversion for a temporary.
4970 (convert_like_real): Check it.
4972 2019-01-18 H.J. Lu <hongjiu.lu@intel.com>
4976 * call.c (convert_for_arg_passing): Upate the
4977 warn_for_address_or_pointer_of_packed_member call.
4978 * typeck.c (convert_for_assignment): Likewise.
4980 2019-01-17 Jason Merrill <jason@redhat.com>
4982 PR c++/86205 - ICE with ?: of throw and template-id.
4983 * pt.c (resolve_nondeduced_context_or_error): Split out from...
4984 * typeck.c (decay_conversion): ...here.
4985 * call.c (build_conditional_expr_1): Use it.
4987 PR c++/86740, ICE with constexpr if and nested generic lambdas.
4988 * tree.c (cp_walk_subtrees): Handle LAMBDA_EXPR.
4990 2019-01-17 Paolo Carlini <paolo.carlini@oracle.com>
4992 * decl.c (grokdeclarator): Use typespec_loc in error messages
4993 about 'auto' and trailing return type.
4995 2019-01-17 David Malcolm <dmalcolm@redhat.com>
4998 * class.c (add_method): Don't use DECL_DESTRUCTOR_P on
5001 2019-01-17 Nathan Sidwell <nathan@acm.org>
5004 * semantics.c (process_outer_var_ref): Only skip dependent types
5007 2019-01-17 Alexandre Oliva <aoliva@redhat.com>
5010 * cp-tree.h (saved_scope): Add suppress_location_wrappers.
5011 * name-lookup.c (do_push_to_top_level): Save and reset it.
5012 (do_pop_from_top_level): Restore it.
5015 * pt.c (make_template_placeholder): Use auto_identifier.
5016 (is_auto): Drop CLASS_PLACEHOLDER_TEMPLATE test.
5017 * error.c (dump_type): Handle template placeholders.
5018 * cxx-pretty-print.c (pp_cx_unqualified_id): Likewise.
5021 * cvt.c (convert_to_void): Handle all cdtor calls as if
5024 2019-01-16 Paolo Carlini <paolo.carlini@oracle.com>
5026 * decl.c (grokdeclarator): Use locations[ds_storage_class] in
5027 error messages about ill-formed uses of mutable.
5029 2019-01-16 Marek Polacek <polacek@redhat.com>
5031 PR c++/78244 - narrowing conversion in template not detected.
5032 * call.c (perform_implicit_conversion_flags): Set
5033 IMPLICIT_CONV_EXPR_BRACED_INIT.
5034 * cp-tree.h (IMPLICIT_CONV_EXPR_BRACED_INIT): New.
5035 * pt.c (tsubst_copy_and_build): Use it.
5037 2019-01-15 David Malcolm <dmalcolm@redhat.com>
5040 * pt.c (build_deduction_guide): Bail out if tsubst_arg_types
5043 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com>
5045 * decl.c (start_decl): Improve error location.
5046 * decl2.c (grokfield): Likewise.
5048 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com>
5050 * decl.c (grokdeclarator): Move further up the location_t loc
5051 declaration and use the location when building a TYPE_DECL for
5053 * decl2.c (grokbitfield): Use DECL_SOURCE_LOCATION in the error
5054 about an ill-formed bit-field as typedef.
5056 2019-01-14 Marek Polacek <polacek@redhat.com>
5058 PR c++/88830 - ICE with abstract class.
5059 * decl2.c (maybe_emit_vtables): Check CLASSTYPE_LAZY_DESTRUCTOR.
5062 PR c++/88825 - ICE with bogus function return type deduction.
5063 * typeck.c (can_do_nrvo_p): Check error_mark_node.
5065 2019-01-14 Tom Honermann <tom@honermann.net>
5067 Implement P0482R5, char8_t: A type for UTF-8 characters and strings
5068 * cvt.c (type_promotes_to): Handle char8_t promotion.
5069 * decl.c (grokdeclarator): Handle invalid type specifier
5070 combinations involving char8_t.
5071 * lex.c (init_reswords): Add char8_t as a reserved word.
5072 * mangle.c (write_builtin_type): Add name mangling for char8_t (Du).
5073 * parser.c (cp_keyword_starts_decl_specifier_p)
5074 (cp_parser_simple_type_specifier): Recognize char8_t as a simple
5076 (cp_parser_string_literal): Use char8_array_type_node for the type
5078 (cp_parser_set_decl_spec_type): Tolerate char8_t typedefs in system
5080 * rtti.c (emit_support_tinfos): type_info support for char8_t.
5081 * tree.c (char_type_p): Recognize char8_t as a character type.
5082 * typeck.c (string_conv_p): Handle conversions of u8 string
5083 literals of char8_t type.
5084 (check_literal_operator_args): Handle UDLs with u8 string literals
5086 * typeck2.c (ordinary_char_type_p): New.
5087 (digest_init_r): Disallow initializing a char array with a u8 string
5090 2019-01-14 Martin Liska <mliska@suse.cz>
5092 PR gcov-profile/88263
5093 * decl2.c (get_tls_wrapper_fn): Use DECL_SOURCE_LOCATION
5094 as location of the TLS wrapper.
5096 2019-01-12 Paolo Carlini <paolo.carlini@oracle.com>
5098 * decl.c (cp_finish_decl): Improve error location.
5099 * decl2.c (grokfield): Likewise, improve two locations.
5101 2019-01-11 Marek Polacek <polacek@redhat.com>
5103 PR c++/88692, c++/87882 - -Wredundant-move false positive with *this.
5104 * typeck.c (maybe_warn_pessimizing_move): Return if ARG isn't
5107 2019-01-11 Jason Merrill <jason@redhat.com>
5109 PR c++/88312 - pack expansion of decltype.
5110 * pt.c (instantiation_dependent_r): A template non-type parameter
5111 pack is instantiation-dependent.
5113 2019-01-11 Jason Merrill <jason@redhat.com>
5115 PR c++/88613 - ICE with use of const var in lambda.
5116 * expr.c (mark_use): Fix location wrapper handling.
5117 * cp-gimplify.c (cp_fold_maybe_rvalue): Call mark_rvalue_use.
5119 2019-01-11 Tobias Burnus <burnus@net-b.de>
5122 * decl2.c (maybe_emit_vtables): If needed, generate code for
5123 the destructor of an abstract class.
5124 (mark_used): Update comment for older function-name change.
5126 2019-01-11 Paolo Carlini <paolo.carlini@oracle.com>
5128 * decl.c (start_decl): Improve error location.
5129 (grokdeclarator): Likewise, improve two locations.
5131 2019-01-09 Sandra Loosemore <sandra@codesourcery.com>
5135 * cp-tree.h: Mechanically replace "can not" with "cannot".
5136 * parser.c: Likewise.
5139 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com>
5141 * decl.c (grok_reference_init): Improve error location.
5142 (grokdeclarator): Likewise, improve two locations.
5144 2019-01-08 Marek Polacek <polacek@redhat.com>
5146 PR c++/88538 - braced-init-list in template-argument-list.
5147 * parser.c (cp_parser_template_argument): Handle braced-init-list when
5150 PR c++/88548 - this accepted in static member functions.
5151 * parser.c (cp_debug_parser): Adjust printing of
5152 local_variables_forbidden_p.
5153 (cp_parser_new): Set local_variables_forbidden_p to 0 rather than false.
5154 (cp_parser_primary_expression): When checking
5155 local_variables_forbidden_p, use THIS_FORBIDDEN or
5156 LOCAL_VARS_FORBIDDEN.
5157 (cp_parser_lambda_body): Update the type of
5158 local_variables_forbidden_p. Set it to 0 rather than false.
5159 (cp_parser_condition): Adjust call to cp_parser_declarator.
5160 (cp_parser_explicit_instantiation): Likewise.
5161 (cp_parser_init_declarator): Likewise.
5162 (cp_parser_declarator): New parameter. Use it.
5163 (cp_parser_direct_declarator): New parameter. Use it to set
5164 local_variables_forbidden_p. Adjust call to cp_parser_declarator.
5165 (cp_parser_type_id_1): Adjust call to cp_parser_declarator.
5166 (cp_parser_parameter_declaration): Likewise.
5167 (cp_parser_default_argument): Update the type of
5168 local_variables_forbidden_p. Set it to LOCAL_VARS_AND_THIS_FORBIDDEN
5170 (cp_parser_member_declaration): Tell cp_parser_declarator if we saw
5171 'static' or 'friend'.
5172 (cp_parser_exception_declaration): Adjust call to cp_parser_declarator.
5173 (cp_parser_late_parsing_default_args): Update the type of
5174 local_variables_forbidden_p. Set it to LOCAL_VARS_AND_THIS_FORBIDDEN
5176 (cp_parser_cache_defarg): Adjust call to cp_parser_declarator.
5177 (cp_parser_objc_class_ivars): Likewise.
5178 (cp_parser_objc_struct_declaration): Likewise.
5179 (cp_parser_omp_for_loop_init): Likewise.
5180 * parser.h (cp_parser): Change the type of local_variables_forbidden_p
5182 (LOCAL_VARS_FORBIDDEN, LOCAL_VARS_AND_THIS_FORBIDDEN, THIS_FORBIDDEN):
5185 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com>
5187 * decl.c (start_decl): Improve permerror location.
5189 2019-01-08 Jonathan Wakely <jwakely@redhat.com>
5190 Jakub Jelinek <jakub@redhat.com>
5193 * decl.c (finish_function): For -Wreturn-type don't add a return *this;
5194 fixit hint if current_class_ref is NULL. Use a single if instead of
5197 2019-01-07 Paolo Carlini <paolo.carlini@oracle.com>
5199 * decl.c (start_decl): Improve two error_at locations.
5200 (expand_static_init): Likewise.
5202 2019-01-07 Marek Polacek <polacek@redhat.com>
5204 PR c++/88741 - wrong error with initializer-string.
5205 * decl.c (cp_complete_array_type): Strip any location wrappers.
5207 2019-01-07 Bernd Edlinger <bernd.edlinger@hotmail.de>
5213 * cp-tree.h (LOOKUP_ALLOW_FLEXARRAY_INIT): New flag value.
5214 * typeck2.c (digest_init_r): Raise an error for non-static
5215 initialization of a flexible array member.
5216 (process_init_constructor, massage_init_elt,
5217 process_init_constructor_array, process_init_constructor_record,
5218 process_init_constructor_union, process_init_constructor): Add the
5219 flags parameter and pass it thru.
5220 (store_init_value): Pass LOOKUP_ALLOW_FLEXARRAY_INIT parameter to
5221 digest_init_flags for static decls.
5223 2019-01-07 Jakub Jelinek <jakub@redhat.com>
5226 * cp-tree.h (cp_build_vec_convert): Declare.
5227 * parser.c (cp_parser_postfix_expression): Parse
5228 __builtin_convertvector.
5229 * constexpr.c: Include fold-const-call.h.
5230 (cxx_eval_internal_function): Handle IFN_VEC_CONVERT.
5231 (potential_constant_expression_1): Likewise.
5232 * semantics.c (cp_build_vec_convert): New function.
5233 * pt.c (tsubst_copy_and_build): Handle CALL_EXPR to
5236 2019-01-03 Jakub Jelinek <jakub@redhat.com>
5239 * decl.c (builtin_function_1): Return result of pushdecl_top_level
5240 or pushdecl rather than decl.
5242 2019-01-03 Paolo Carlini <paolo.carlini@oracle.com>
5244 * tree.c (handle_nodiscard_attribute): Improve warning location.
5246 2019-01-02 Marek Polacek <polacek@redhat.com>
5248 PR c++/88612 - ICE with -Waddress-of-packed-member.
5249 * call.c (convert_for_arg_passing): Only give warnings with tf_warning.
5250 * typeck.c (convert_for_assignment): Likewise.
5252 PR c++/88631 - CTAD failing for value-initialization.
5253 * typeck2.c (build_functional_cast): Try deducing the template
5254 arguments even if there are no arguments to deduce from.
5256 2019-01-01 Jakub Jelinek <jakub@redhat.com>
5258 Update copyright years.
5260 Copyright (C) 2019 Free Software Foundation, Inc.
5262 Copying and distribution of this file, with or without modification,
5263 are permitted in any medium without royalty provided the copyright
5264 notice and this notice are preserved.