1 2019-12-30 Marek Polacek <polacek@redhat.com>
3 * decl.c (reshape_init_r): Remove assert.
5 2019-12-30 Paolo Carlini <paolo.carlini@oracle.com>
7 * decl2.c (delete_sanity): Add location_t parameter and use
9 * init.c (build_vec_delete_1): Likewise.
10 (build_delete): Likewise.
11 (build_vec_delete): Likewise.
12 (perform_target_ctor): Adjust call.
13 (perform_member_init): Likewise.
14 (build_vec_init): Likewise.
15 * decl.c (cxx_maybe_build_cleanup): Likewise.
16 * pt.c (tsubst_copy_and_build): Likewise.
17 * parser.c (cp_parser_delete_expression): Likewise, pass the
19 * cp-tree.h: Update declarations.
21 2019-12-29 Marek Polacek <polacek@redhat.com>
23 PR c++/88337 - Implement P1327R1: Allow dynamic_cast in constexpr.
24 * constexpr.c (cxx_dynamic_cast_fn_p): New function.
25 (extract_obj_from_addr_offset): New function.
26 (get_component_with_type): New function.
27 (cxx_eval_dynamic_cast_fn): New function.
28 (cxx_eval_call_expression): Call cxx_eval_dynamic_cast_fn for a call
30 (potential_constant_expression_1): Don't give up on
31 cxx_dynamic_cast_fn_p.
32 * rtti.c (build_dynamic_cast_1): When creating a call to
33 __dynamic_cast, use the location of the original expression.
35 2019-12-26 Jakub Jelinek <jakub@redhat.com>
38 * parser.c (cp_parser_constructor_declarator_p): If open paren
39 is followed by RID_ATTRIBUTE, skip over the attribute tokens and
40 try to parse type specifier.
42 2019-12-23 Richard Sandiford <richard.sandiford@arm.com>
45 * typeck.c (structural_comptypes): Make sure that two vector types
46 agree on gnu_vector_type_p.
48 2019-12-23 Richard Sandiford <richard.sandiford@arm.com>
50 * cvt.c (ocp_convert): Apply rvalue to the source of vector
52 * typeck.c (build_reinterpret_cast_1): Likewise.
54 2019-12-19 Marek Polacek <polacek@redhat.com>
56 PR c++/92745 - bogus error when initializing array of vectors.
57 * decl.c (reshape_init_r): For a nested compound literal, do
58 call reshape_init_{class,array,vector}.
60 PR c++/92974 - bogus location for enum and non-enum in ?: warning.
61 * tree.c (build_min_non_dep): Use the location of NON_DEP when
62 building the expression.
64 2019-12-20 Jakub Jelinek <jakub@redhat.com>
67 * pt.c (invalid_nontype_parm_type_p): Call structural_type_p with
68 explain=true only if emitting error.
71 * method.c (early_check_defaulted_comparison): Don't set
72 DECL_MAYBE_DELETED when returning false.
75 * method.c (early_check_defaulted_comparison): For C++17 and earlier
76 diagnose defaulted comparison operators.
79 * call.c (convert_arg_to_ellipsis): For floating point or
80 decltype(nullptr) arguments call mark_rvalue_use.
83 * call.c (convert_arg_to_ellipsis): For decltype(nullptr) arguments
84 that have side-effects use cp_build_compound_expr.
86 2019-12-20 Eric Botcazou <ebotcazou@adacore.com>
88 * decl2.c (c_parse_final_cleanups): Always call collect_source_ref on
89 the main input filename.
91 2019-12-19 Julian Brown <julian@codesourcery.com>
92 Cesar Philippidis <cesar@codesourcery.com>
94 * parser.c (cp_parser_omp_clause_name): Support attach and detach
96 (cp_parser_omp_var_list_no_open): Add ALLOW_DEREF optional parameter.
98 (cp_parser_omp_var_list): Add ALLOW_DEREF optional parameter. Pass to
99 cp_parser_omp_var_list_no_open.
100 (cp_parser_oacc_data_clause): Support attach and detach clauses.
101 Update call to cp_parser_omp_var_list_no_open.
102 (cp_parser_oacc_all_clauses): Support attach and detach.
103 (OACC_DATA_CLAUSE_MASK, OACC_ENTER_DATA_CLAUSE_MASK,
104 OACC_KERNELS_CLAUSE_MASK, OACC_PARALLEL_CLAUSE_MASK,
105 OACC_SERIAL_CLAUSE_MASK): Add PRAGMA_OACC_CLAUSE_ATTACH.
106 (OACC_EXIT_DATA_CLAUSE_MASK): Add PRAGMA_OACC_CLAUSE_DETACH.
107 * semantics.c (handle_omp_array_sections_1): Reject subarrays for
109 (handle_omp_array_sections): Use GOMP_MAP_ATTACH_DETACH instead of
110 GOMP_MAP_ALWAYS_POINTER for OpenACC.
111 (cp_oacc_check_attachments): New function.
112 (finish_omp_clauses): Use above function. Allow structure fields and
113 class members to appear in OpenACC data clauses. Support
114 GOMP_MAP_ATTACH_DETACH. Support deref.
116 2019-12-19 Jason Merrill <jason@redhat.com>
118 PR c++/52320 - EH cleanups for partially constructed arrays.
119 * typeck2.c (split_nonconstant_init_1): Add nested parm.
120 Add cleanup for whole array if true.
122 PR c++/66139 - EH cleanups for partially constructed aggregates.
124 * cp-gimplify.c (cp_gimplify_init_expr): Use split_nonconstant_init.
125 * typeck2.c (split_nonconstant_init): Handle non-variable dest.
126 (split_nonconstant_init_1): Clear TREE_SIDE_EFFECTS.
127 * tree.c (is_local_temp): New.
129 2019-12-18 Jason Merrill <jason@redhat.com>
131 PR c++/91165 follow-on tweak
132 * constexpr.c (cxx_eval_call_expression): Use
133 unshare_expr_without_location.
135 2019-12-19 Julian Brown <julian@codesourcery.com>
136 Maciej W. Rozycki <macro@codesourcery.com>
137 Tobias Burnus <tobias@codesourcery.com>
138 Thomas Schwinge <thomas@codesourcery.com>
140 * parser.c (cp_parser_omp_clause_name): Support no_create.
141 (cp_parser_oacc_data_clause): Likewise.
142 (cp_parser_oacc_all_clauses): Likewise.
143 (OACC_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK)
144 (OACC_PARALLEL_CLAUSE_MASK): Add PRAGMA_OACC_CLAUSE_NO_CREATE.
145 * semantics.c (handle_omp_array_sections): Support no_create.
147 2019-12-18 Paolo Carlini <paolo.carlini@oracle.com>
149 * typeck.c (cxx_sizeof_or_alignof_type): Add location_t parameter
150 and use it throughout.
151 (cxx_sizeof_expr): Likewise.
152 (cxx_alignof_expr): Likewise.
153 (cxx_sizeof_or_alignof_expr): Likewise.
154 (cxx_alignas_expr): Update call.
155 * decl.c (fold_sizeof_expr): Likewise.
156 * pt.c (tsubst_copy): Likewise.
157 (tsubst_copy_and_build): Likewise.
158 * except.c (build_throw): Add location_t parameter and use it.
159 (expand_end_catch_block): Update call.
160 * parser.c (cp_parser_unary_expression): Update
161 cxx_sizeof_or_alignof_type and cxx_sizeof_or_alignof_expr calls,
162 pass the compound location.
163 (cp_parser_throw_expression): Likewise pass the combined location
165 * cp-tree.h: Update declarations.
167 * semantics.c (finish_handler_parms): Use DECL_SOURCE_LOCATION.
168 * decl2.c (check_classfn): Likewise.
170 * except.c (is_admissible_throw_operand_or_catch_parameter):
171 Exploit cp_expr_loc_or_input_loc in one place.
173 * except.c (create_try_catch_expr): Remove, unused.
175 2019-12-17 Jason Merrill <jason@redhat.com>
177 PR c++/12333 - X::~X() with implicit this->.
178 * parser.c (cp_parser_lookup_name): Use lookup_destructor.
179 * typeck.c (lookup_destructor): No longer static.
181 2019-12-17 Martin Sebor <msebor@redhat.com>
184 * parser.c (cp_parser_maybe_warn_enum_key): New function.
185 (class_decl_loc_t): New class.
186 (cp_parser_elaborated_type_specifier): Call
187 cp_parser_maybe_warn_enum_key.
188 (cp_parser_class_head): Call cp_parser_check_class_key.
189 (cp_parser_check_class_key): Add arguments. Call class_decl_loc_t::add.
190 (c_parse_file): Call class_decl_loc_t::diag_mismatched_tags.
192 2019-12-17 Jason Merrill <jason@redhat.com>
194 PR c++/79592 - missing explanation of invalid constexpr.
195 * constexpr.c (register_constexpr_fundef): Do store the body of a
196 template instantiation that is not potentially constant.
197 (explain_invalid_constexpr_fn): Look it up.
198 (cxx_eval_call_expression): Check fundef->result.
200 2019-12-17 Jason Merrill <jason@redhat.com>
202 PR c++/92576 - redeclaration of variable template.
203 * decl.c (redeclaration_error_message): Recurse for variable
206 2019-12-17 Jason Merrill <jason@redhat.com>
208 * name-lookup.c (get_std_name_hint): Add std::byte.
210 2019-12-17 Jakub Jelinek <jakub@redhat.com>
213 * pt.c (push_tinst_level_loc): If limit_bad_template_recursion,
214 set TREE_NO_WARNING on tldcl.
215 * decl2.c (no_linkage_error): Treat templates with TREE_NO_WARNING
216 as defined during error recovery.
218 2019-12-13 Jason Merrill <jason@redhat.com>
220 PR c++/91165 - verify_gimple ICE with cached constexpr.
221 * constexpr.c (cxx_bind_parameters_in_call): Don't unshare.
222 (cxx_eval_call_expression): Unshare all args if we're caching.
224 2019-12-12 Jason Merrill <jason@redhat.com>
226 PR c++/92496 - ICE with <=> and no #include <compare>.
227 * typeck.c (cp_build_binary_op): Handle error from spaceship_type.
229 2019-12-11 David Malcolm <dmalcolm@redhat.com>
231 * cxx-pretty-print.c (cxx_pretty_printer::clone): New vfunc
233 * cxx-pretty-print.h (cxx_pretty_printer::clone): New vfunc decl.
234 * error.c (cxx_format_postprocessor::clone): New vfunc.
236 2019-12-11 Jakub Jelinek <jakub@redhat.com>
239 * class.c (finish_struct): For C++17 and earlier, check
240 type_has_user_provided_or_explicit_constructor rather than
241 TYPE_HAS_USER_CONSTRUCTOR whether to set CLASSTYPE_NON_AGGREGATE.
243 2019-12-11 Marek Polacek <polacek@redhat.com>
245 PR c++/92878 - Parenthesized init of aggregates in new-expression.
246 * init.c (build_new_1): Handle parenthesized initialization of
247 aggregates in new-expression.
249 2019-12-11 Jason Merrill <jason@redhat.com>
251 PR c++/92105 - decltype(decltype) error cascade.
252 * parser.c (cp_parser_decltype_expr): Don't tentative_firewall here.
253 (cp_parser_decltype): Do it here. Remember a non-tentative error.
255 PR c++/57082 - new X{} and private destructor.
256 * init.c (build_new_1): Also pass tf_no_cleanup to
257 build_special_member_call.
259 PR c++/92774 - ICE with implicitly deleted operator<=>.
260 * method.c (comp_info::~comp_info): Factor out of...
261 (build_comparison_op): Here. Handle error return from build_new_op.
263 PR c++/92859 - ADL and bit-field.
264 * name-lookup.c: Use unlowered_expr_type.
266 PR c++/92446 - deduction of class NTTP.
267 * pt.c (deducible_expression): Look through VIEW_CONVERT_EXPR.
269 2019-12-10 Jason Merrill <jason@redhat.com>
271 PR c++/92847 - C++20 comparison ambiguity with class template.
272 * call.c (cand_parms_match): Handle all templated functions.
274 Fix C++20 structural type vs. private base.
275 * class.c (build_base_field_1): Take access parameter.
276 (build_base_field): Likewise.
277 (build_base_fields, layout_virtual_bases): Pass it.
278 * tree.c (structural_type_p): Improve private base diagnostic.
280 PR c++/92560 - ICE with decltype and rewritten operator.
281 * call.c (build_new_op_1): Clear tf_decltype on inner call.
283 2019-12-09 David Malcolm <dmalcolm@redhat.com>
285 * error.c (range_label_for_type_mismatch::get_text): Replace
286 label_text ctor calls with label_text::borrow.
288 2019-12-09 Paolo Carlini <paolo.carlini@oracle.com>
290 * typeck.c (check_for_casting_away_constness): Add location_t
291 parameter and use it.
292 (maybe_warn_about_useless_cast): Likewise.
293 (maybe_warn_about_cast_ignoring_quals): Likewise.
294 (build_static_cast_1): Likewise.
295 (build_static_cast): Likewise; sets the location of the returned tree.
296 (build_reinterpret_cast_1): Likewise.
297 (build_reinterpret_cast): Likewise; sets the location of the returned
299 (build_const_cast_1): Likewise.
300 (build_const_cast): Likewise; sets the location of the returned tree.
301 (cp_build_c_cast): Likewise.
302 (build_c_cast): Adjust.
303 (build_ptrmemfunc): Adjust calls.
304 (cp_build_unary_op): Pass the location to invert_truthvalue_loc.
305 * rtti.c (build_dynamic_cast_1): Add location_t parameter and
307 (build_dynamic_cast): Likewise.
308 * cp-tree.h: Adjust declarations.
309 * parser.c (cp_parser_postfix_expression): Pass cp_cast_loc to
310 the various build_*_cast functions.
311 (get_cast_suggestion): Adjust calls.
312 (cp_parser_builtin_offsetof): Likewise.
313 * decl.c (reshape_init): Adjust call.
314 * method.c (forward_parm): Likewise.
315 (build_comparison_op): Likewise.
316 * pt.c (tsubst_copy_and_build): Likewise.
317 * semantics.c (finish_omp_reduction_clause): Likewise.
318 (cp_omp_finish_iterators): Likewise.
319 * tree.c (cp_stabilize_reference): Likewise.
321 * typeck2.c (build_functional_cast): Likewise.
323 * typeck2.c (build_functional_cast_1): New.
324 (build_functional_cast_1): Calls the latter and sets the location
325 of the returned tree.
327 2019-12-08 Jakub Jelinek <jakub@redhat.com>
329 * cvt.c (maybe_warn_nodiscard): Add workaround for GCC 3.4-4.4 - cast
330 msg to (const char *) in conditional expressions. Formatting fixes.
332 2019-12-07 Jason Merrill <jason@redhat.com>
333 Jakub Jelinek <jakub@redhat.com>
336 * call.c (build_conditional_expr_1): For ?: with omitted middle
337 operand use cp_stabilize_reference if arg1 is glvalue_p rather than
338 just if it is lvalue_p.
340 2019-12-06 Jakub Jelinek <jakub@redhat.com>
342 * parser.c (cp_parser_diagnose_invalid_type_name): Mention
343 that concept is also available with -std=c++2a.
345 PR c++/92831 - CWG 1299, not extending temporary lifetime for ?:
346 * cp-tree.h (extend_ref_init_temps): Add a new argument with NULL
348 * call.c (set_up_extended_ref_temp): Add COND_GUARD argument, pass it
349 down to extend_ref_init_temps. Before pushing cleanup, if COND_GUARD
350 is non-NULL, create a bool temporary if needed, initialize to false
351 and guard the cleanup with the temporary being true.
352 (extend_ref_init_temps_1): Add COND_GUARD argument, pass it down
353 to recursive calls and set_up_extended_ref_temp. Handle COND_EXPR.
354 (extend_ref_init_temps): Add COND_GUARD argument, pass it down to
355 recursive calls and to extend_ref_init_temps_1.
357 2019-12-06 Richard Sandiford <richard.sandiford@arm.com>
359 * decl.c (start_decl_1): Use verify_type_context to check whether
360 the target allows variables of a particular type to have static
361 or thread-local storage duration.
362 (check_array_initializer): Use verify_type_context to check whether
363 the target allows a particular type to be used as an array element.
364 (create_array_type_for_decl): Likewise.
365 (cp_finish_decl): Use verify_type_context to check whether
366 the target allows static member variables of a particular type.
367 (grokdeclarator): Likewise. Also use verify_type_context to check
368 whether the target allows non-static member variables of a particular
370 * except.c: Include target.h.
371 (is_admissible_throw_operand_or_catch_parameter): Use
372 verify_type_context to check whether the target allows particular
373 types to be thrown and caught.
374 * typeck2.c (add_exception_specifier): Likewise.
375 * init.c (build_new_1): Use verify_type_context to check whether
376 the target allows particular types to be dynamically allocated.
377 (build_vec_delete_1, build_delete): Use verify_type_context to check
378 whether the target allows particular types to be deleted.
379 * lambda.c (add_capture): Use verify_type_context to check
380 whether the target allows particular types to be captured by copy.
381 * pt.c: Include target.h.
382 (instantiate_class_template_1): Use verify_type_context to check
383 whether the target allows non-static member variables of a particular
385 * typeck.c (cxx_alignof_expr): Use verify_type_context to check
386 whether the target allows the alignment of a particular type
388 (pointer_diff, cp_build_unary_op): Use verify_type_context to check
389 whether the target allows arithmetic involving pointers to particular
392 2019-12-05 Marek Polacek <polacek@redhat.com>
393 Jakub Jelinek <jakub@redhat.com>
395 PR c++/91353 - P1331R2: Allow trivial default init in constexpr contexts.
396 * class.c (trivial_default_constructor_is_constexpr): Return true in
398 * constexpr.c (cx_check_missing_mem_inits): Allow missing field
399 initializers in C++20.
400 (cxx_eval_call_expression): Don't clear CONSTRUCTOR_NO_CLEARING for
401 constexpr constructors in C++20.
402 (reduced_constant_expression_p): Don't set FIELD for union and array
403 types. Skip empty class fields without initializers.
404 * decl.c (check_for_uninitialized_const_var): Permit trivial default
405 initialization in constexpr.
406 (next_initializable_field): Don't skip vptr fields.
407 * method.c (walk_field_subobs): Still consider a constructor that
408 doesn't initialize all the members constexpr.
410 2019-12-05 Marek Polacek <polacek@redhat.com>
412 PR c++/92271 - make __is_same alias for __is_same_as.
413 * cxx-pretty-print.c (pp_cxx_trait_expression) <case CPTK_IS_SAME_AS>:
416 2019-12-05 David Edelsohn <dje.gcc@gmail.com>
418 * cp-gimplify.c: Include memmodel.h.
420 2019-12-05 Paolo Carlini <paolo.carlini@oracle.com>
422 * typeck2.c (build_functional_cast): Add location_t parameter
424 * cp-tree.h: Update declaration.
425 * parser.c (cp_parser_functional_cast): Adjust call.
426 * call.c (build_op_delete_call): Likewise.
427 (build_new_method_call_1): Likewise.
428 * decl.c (check_initializer): Likewise.
429 * pt.c (tsubst_copy_and_build): Likewise.
430 * semantics.c (finish_compound_literal): Likewise.
432 2019-12-04 David Edelsohn <dje.gcc@gmail.com>
434 * cp-gimplify.c: Include tm_p.h.
436 2019-12-04 Marek Polacek <polacek@redhat.com>
438 * parser.c (enum primary_constraint_error): Remove stray comma.
440 2019-12-04 Richard Sandiford <richard.sandiford@arm.com>
442 * cp-tree.h (CP_AGGREGATE_TYPE_P): Check for gnu_vector_type_p
443 instead of VECTOR_TYPE.
444 * call.c (build_conditional_expr_1): Restrict vector handling
445 to vectors that satisfy gnu_vector_type_p.
446 * cvt.c (ocp_convert): Only allow vectors to be converted
447 to bool if they satisfy gnu_vector_type_p.
448 (build_expr_type_conversion): Only allow conversions from
449 vectors if they satisfy gnu_vector_type_p.
450 * typeck.c (cp_build_binary_op): Only allow binary operators to be
451 applied to vectors if they satisfy gnu_vector_type_p.
452 (cp_build_unary_op): Likewise unary operators.
453 (build_reinterpret_cast_1):
455 2019-12-03 Jakub Jelinek <jakub@redhat.com>
457 * cp-tree.h (enum cp_tree_index): Add CPTI_SOURCE_LOCATION_IMPL.
458 (source_location_impl): Define.
459 (enum cp_built_in_function): Add CP_BUILT_IN_SOURCE_LOCATION.
460 (fold_builtin_source_location): Declare.
461 * cp-gimplify.c: Include output.h, file-prefix-map.h and cgraph.h.
462 (cp_gimplify_expr, cp_fold): Handle CP_BUILT_IN_SOURCE_LOCATION.
464 (get_source_location_impl_type): New function.
465 (struct source_location_table_entry,
466 struct source_location_table_entry_hash): New types.
467 (source_location_table, source_location_id): New variables.
468 (fold_builtin_source_location): New function.
469 * constexpr.c (cxx_eval_builtin_function_call): Handle
470 CP_BUILT_IN_SOURCE_LOCATION.
471 * tree.c (builtin_valid_in_constant_expr_p): Likewise. Formatting
473 * decl.c (cxx_init_decl_processing): Register
474 __builtin_source_location.
475 * name-lookup.c (get_std_name_hint): Add source_location entry.
477 2019-12-03 Paolo Carlini <paolo.carlini@oracle.com>
479 * typeck.c (cp_build_addr_expr_1): Use the cp_expr_loc_or_input_loc
480 location in a few additional diagnostics; tidy.
481 (check_return_expr): Likewise.
483 * typeck.c (cp_build_addr_expr_1): Use tree_strip_any_location_wrapper
484 for the address of main pedwarn.
486 2019-12-03 Jakub Jelinek <jakub@redhat.com>
489 * constexpr.c (struct constexpr_global_ctx): Add cleanups member,
490 initialize it in the ctor.
491 (cxx_eval_constant_expression) <case TARGET_EXPR>: If TARGET_EXPR_SLOT
492 is already in the values hash_map, don't evaluate it again. Put
493 TARGET_EXPR_SLOT into hash_map even if not lval, and push it into
494 save_exprs too. If there is TARGET_EXPR_CLEANUP and not
495 CLEANUP_EH_ONLY, push the cleanup to cleanups vector.
496 <case CLEANUP_POINT_EXPR>: Save outer cleanups, set cleanups to
497 local auto_vec, after evaluating the body evaluate cleanups and
498 restore previous cleanups.
499 <case TRY_CATCH_EXPR>: Don't crash if the first operand is NULL_TREE.
500 (cxx_eval_outermost_constant_expr): Set cleanups to local auto_vec,
501 after evaluating the expression evaluate cleanups.
503 2019-12-03 Marek Polacek <polacek@redhat.com>
505 PR c++/91363 - P0960R3: Parenthesized initialization of aggregates.
506 * call.c (build_new_method_call_1): Handle parenthesized initialization
507 of aggregates by building up a CONSTRUCTOR.
508 (extend_ref_init_temps): Do nothing for CONSTRUCTOR_IS_PAREN_INIT.
509 * cp-tree.h (CONSTRUCTOR_IS_PAREN_INIT, LOOKUP_AGGREGATE_PAREN_INIT):
511 * decl.c (grok_reference_init): Handle aggregate initialization from
512 a parenthesized list of values.
513 (reshape_init): Do nothing for CONSTRUCTOR_IS_PAREN_INIT.
514 (check_initializer): Handle initialization of an array from a
515 parenthesized list of values. Use NULL_TREE instead of NULL.
516 * tree.c (build_cplus_new): Handle BRACE_ENCLOSED_INITIALIZER_P.
517 * typeck2.c (digest_init_r): Set LOOKUP_AGGREGATE_PAREN_INIT if it
518 receives a CONSTRUCTOR with CONSTRUCTOR_IS_PAREN_INIT set. Allow
519 narrowing when LOOKUP_AGGREGATE_PAREN_INIT.
520 (massage_init_elt): Don't lose LOOKUP_AGGREGATE_PAREN_INIT when passing
521 flags to digest_init_r.
523 2019-12-03 Jakub Jelinek <jakub@redhat.com>
526 * typeck2.c (digest_nsdmi_init): For bitfields, use
527 DECL_BIT_FIELD_TYPE instead of TREE_TYPE.
529 2019-12-03 Jason Merrill <jason@redhat.com>
530 Jakub Jelinek <jakub@redhat.com>
533 * call.c (strip_standard_conversion): New function.
534 (build_new_op_1): Use it for user_conv_p.
535 (compare_ics): Likewise.
536 (source_type): Likewise.
538 2019-12-03 Jakub Jelinek <jakub@redhat.com>
541 * constexpr.c (cxx_bind_parameters_in_call): For virtual calls,
542 adjust the first argument to point to the derived object rather
545 2019-12-02 Jakub Jelinek <jakub@redhat.com>
548 * constexpr.c (cxx_eval_constant_expression) <case OBJ_TYPE_REF>: Use
549 STRIP_NOPS before checking for ADDR_EXPR.
551 2019-11-29 Jakub Jelinek <jakub@redhat.com>
554 * parser.c (cp_parser_omp_declare_reduction_exprs): If
555 processing_template_decl, wrap the combiner or initializer
557 * decl.c (start_preparsed_function): Don't start a lambda scope
558 for DECL_OMP_DECLARE_REDUCTION_P functions.
559 (finish_function): Don't finish a lambda scope for
560 DECL_OMP_DECLARE_REDUCTION_P functions, nor cp_fold_function
561 them nor cp_genericize them.
562 * mangle.c (decl_mangling_context): Look through
563 DECL_OMP_DECLARE_REDUCTION_P functions.
564 * semantics.c (expand_or_defer_fn_1): For DECL_OMP_DECLARE_REDUCTION_P
565 functions, use tentative linkage, don't keep their bodies with
566 -fkeep-inline-functions and return false at the end.
568 2019-11-28 Jakub Jelinek <jakub@redhat.com>
571 * decl2.c (mark_used): Don't call note_vague_linkage_fn for pure
572 virtual functions, even if they are declared inline.
574 2019-11-16 Jason Merrill <jason@redhat.com>
576 Implement P1814R0, CTAD for alias templates.
577 * pt.c (rewrite_tparm_list): Factor out of build_deduction_guide.
578 (maybe_aggr_guide): Check for copy-init here.
579 (alias_ctad_tweaks, deduction_guides_for): New.
580 (ctor_deduction_guides_for): Factor out of do_class_deduction.
581 (ctad_template_p): New.
582 * parser.c (cp_parser_simple_type_specifier): Use it.
583 * constraint.cc (append_constraint): New.
585 2019-11-16 Jason Merrill <jason@redhat.com>
587 * cxx-pretty-print.c (pp_cxx_unqualified_id): Handle alias
589 * pt.c (complex_alias_template_p): True if constraints.
590 (get_underlying_template, tsubst): Check alias constraints.
591 (push_template_decl_real): Set alias constraints here.
592 * parser.c (cp_parser_alias_declaration): Not here.
593 * constraint.cc (get_constraints): Take const_tree.
595 2019-11-12 Jason Merrill <jason@redhat.com>
597 PR c++/92206 - ICE with typedef to dependent alias.
598 * pt.c (dependent_alias_template_spec_p)
599 (alias_template_specialization_p): Add transparent_typedefs
601 (iterative_hash_template_arg, any_template_parm_r)
602 (primary_template_specialization_p, tsubst, dependent_type_p_r):
604 * decl.c (check_elaborated_type_specifier): Adjust.
605 * error.c (dump_template_bindings, dump_aggr_type): Adjust.
607 2019-11-27 Andrew Sutton <asutton@lock3software.com>
610 Defer evaluation of concept checks so that static assertions can
611 emit more detailed diagnostics.
612 * constexpr.c (cxx_eval_call_expression): Handle concept checks.
613 (cxx_eval_constant_expression): Diagnose misuse of function concepts
614 as template-id expressions. Follow the usual return path for results.
615 (cxx_eval_outermost_constant_expr): Avoid calling
616 cp_get_callee_fndecl_nofold for function concepts.
617 * constraint.cc (build_function_check): Fully type the concept check
618 so that we don't ICE in conversions.
619 * cp-gimplify.c (cp_genericize_r) [CALL_EXPR]: Handle concept checks.
620 [TEMPLATE_ID_EXPR] Likewise.
621 * cvt.c (convert_to_void): Always evaluate concept checks so we don't
622 accidentally ignore them. Substitution during satisfaction can make
623 a program ill-formed (example in g++.dg/cpp2a/concepts6.C).
624 * pt.c (tsubst_copy_and_build): [CALL_EXPR]: Don't evaluate concepts.
625 [TEMPLATE_ID_EXPR]: Likewise.
626 * semantics.c (finish_call_expr): Don't evaluate concepts.
627 (finish_id_expression_1): Likewise.
628 (finish_static_assert): Preserve the original condition so we can
629 diagnose concept errors when a check returns false.
631 2019-11-27 Andrew Sutton <asutton@lock3software.com>
634 Improve quality of diagnostics for subexpressions that need parens.
635 * parser.c (cp_parser_requires_clause_opt): Add a flag to indicate
636 when parsing a requires-clause before lambda parameters, and...
637 (cp_parser_lambda_declarator_opt): ... use that here ...
638 (cp_parser_type_parameter): ... and here ...
639 (cp_parser_late_return_type_opt): ... and here ...
640 (cp_parser_explicit_template_declaration): ... and here.
641 (cp_parser_diagnose_ungrouped_constraint_plain): Adjust the message
642 because this can apply to subexpressions that are not immediately
643 after a requires-clause.
644 (cp_parser_diagnose_ungrouped_constraint_rich): Likewise.
645 (primary_constraint_error): New.
646 (cp_parser_constraint_requires_parens): New.
647 (cp_parser_unary_constraint_requires_parens): New.
648 (cp_parser_constraint_primary_expression): Check for unary expressions
649 before parsing the primary expression. Also check for binary and
650 postfix operators after a successful parse of the primary expression.
651 Force a re-parse if the result would form a lower-precedence string.
652 (cp_parser_constraint_logical_and_expression): Propagate lambda flag;
653 move checks for ill-formed constraints into the constraint primary
655 (cp_parser_constraint_logical_or_expression): Likewise.
656 (cp_parser_requires_clause_expression): Propagate lambda flag.
658 2019-11-27 Andrew Sutton <asutton@lock3software.com>
661 * constraint.cc (satisfy_declaration_constraints): Push tinst levels
664 2019-11-27 Andrew Sutton <asutton@lock3software.com>
666 Diagnose certain constraint errors as hard errors, but otherwise treat
667 them the same as normal SFINAE-type errors. Also, generally clean up
668 the satisfaction functions.
670 * constexpr.c (cxx_eval_constant_expression): Use
671 evaluate_concept_check.
672 * constraint.cc (normalize_concept_definition): Accept a diagnostic
673 flag and only cache when not diagnosing errors.
674 (decl_satisfied_cache): Map to trees instead of bools.
675 (satisfy_atom): Guarantee a location for the errors, propagate complain
676 flags to force_rvalue, and emit errors for non-boolean constraints.
677 (get_normalized_constraints_and_args): New overloads. Factored out of
678 satisfy_constraint_expression and satisfy_declaration_constraints.
679 (satisfy_constraint_expression): Propagate diagnostic info to
681 (satisfy_declaration_constraints): New. Factored out of
682 constraints_satisfied_p.
683 (constraint_satisfaction_value): New. Calls
684 satisfy_constraint_expression or satisfy_declaration_constraints.
685 (constraints_satisfied_p): Call constraint_satisfaction_value.
686 (evaluate_concept_check): Don't take tsubst_falgs_t. Replay
687 satisfaction if an error is encountered.
688 (current_failed_constraint): Moved from pt.c.
689 (diagnose_constraints): Call constraint_satisfaction_value.
690 * cp-tree.h: Update declarations.
691 * pt.c (current_failed_constraint): Moved to constraint.cc.
692 * semantics.c (finish_id_expression_1): Remove a duplicate case.
694 2019-11-27 Jakub Jelinek <jakub@redhat.com>
697 * tree.c (replace_placeholders_r): Don't walk constructor elts with
700 2019-11-26 Jason Merrill <jason@redhat.com>
702 * pt.c (tsubst_copy_and_build) [TEMPLATE_ID_EXPR]: Remember the
703 location of a variable template-id.
704 * constexpr.c (cxx_eval_constant_expression): Get expr location
705 before stripping location wrappers.
706 (non_const_var_error): Take location argument.
708 2019-11-26 Paolo Carlini <paolo.carlini@oracle.com>
710 * typeck.c (cp_build_unary_op): Consistently use the accurate
711 location in seven additional diagnostic messages.
712 (cp_build_compound_expr): Use cp_expr_loc_or_input_loc in one place.
714 2019-11-26 Jakub Jelinek <jakub@redhat.com>
717 * parser.c (cp_parser_std_attribute): For unknown attributes,
718 skip balanced token seq instead of trying to parse
719 attribute-argument-clause as expression list. Formatting fix.
722 * class.c (enum_to_min_precision): New hash_map.
723 (enum_min_precision): New function.
724 (check_bitfield_decl): Use it.
726 2019-11-25 Paolo Carlini <paolo.carlini@oracle.com>
728 * typeck.c (cp_build_indirect_ref_1): Add location_t parameter
729 and use it in error messages.
730 (build_x_indirect_ref): Adjust call.
731 (build_indirect_ref): Likewise.
732 (cp_build_fold_indirect_ref): Likewise.
733 (cp_build_array_ref): Likewise.
734 * call.c (build_new_op_1): Likewise.
735 * semantics.c (finish_omp_clauses): Likewise.
736 (finish_omp_depobj): Likewise.
737 * typeck2.c (build_x_arrow): Likewise.
738 * cp-tree.h (cp_build_indirect_ref): Update declaration.
740 * call.c (build_new_op_1): Use location argument in warning_at.
742 * typeck.c (cp_build_modify_expr): Consistently use the
745 2019-11-23 Bernd Edlinger <bernd.edlinger@hotmail.de>
748 * name-lookup.c (check_local_shadow): Use can_convert_arg
749 instead of can_convert.
751 2019-11-22 Marek Polacek <polacek@redhat.com>
753 PR c++/88337 - P1327R1: Allow polymorphic typeid in constexpr.
754 * constexpr.c (potential_constant_expression_1): Allow a typeid
755 expression whose operand is of polymorphic type in constexpr in
757 * rtti.c (build_typeid): Remove obsolete FIXME comment.
759 2019-11-22 Jakub Jelinek <jakub@redhat.com>
762 * cp-objcp-common.c (identifier_global_tag): Define.
765 * init.c (nsdmi_inst): Change type to
766 decl_tree_cache_map * from tree_cache_map *.
767 * constraint.cc (decl_constraints): Likewise.
768 * decl.c (get_tuple_decomp_init): Likewise.
769 * pt.c (defarg_inst, explicit_specifier_map): Likewise.
770 (tsubst_default_argument, store_explicit_specifier): Use
771 decl_tree_cache_map::create_ggc rather than
772 tree_cache_map::create_ggc.
773 * cp-objcp-common.c (debug_type_map): Change type to
774 type_tree_cache_map * from tree_cache_map *.
776 2019-11-21 Marek Polacek <polacek@redhat.com>
778 PR c++/92450 - ICE with invalid nested name specifier.
779 * parser.c (cp_parser_member_declaration): Don't attempt to print
780 erroneous bit-field diagnostic if grokdeclarator returns
783 2019-11-21 Jakub Jelinek <jakub@redhat.com>
784 Jason Merrill <jason@redhat.com>
787 * parser.c (cp_parser_decl_specifier_seq): For concept or typedef
788 break early if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR.
789 For type specifiers, set CP_PARSER_FLAGS_NO_TYPE_DEFINITIONS
790 if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR is set.
792 2019-11-20 Paolo Carlini <paolo.carlini@oracle.com>
794 * typeck2.c (build_x_arrow): Early return if decay_conversion
795 returns error_mark_node.
797 2019-11-20 Jakub Jelinek <jakub@redhat.com>
800 * call.c (complain_about_no_candidates_for_method_call): If
801 conv->from is not a type, pass to complain_about_bad_argument
802 lvalue_type of conv->from.
804 2019-11-20 Paolo Carlini <paolo.carlini@oracle.com>
806 * cvt.c (ocp_convert): Use additional warning sentinel.
808 2019-11-19 Jakub Jelinek <jakub@redhat.com>
811 * constexpr.c (cxx_eval_outermost_constant_expr): If DECL_INITIAL
812 on object is erroneous, return t without trying to evaluate
815 2019-11-12 Jason Merrill <jason@redhat.com>
817 * call.c (same_fn_or_template): Change to cand_parms_match.
819 (print_z_candidate): Mark rewritten/reversed candidates.
820 (build_new_op_1): Warn about recursive call with reversed arguments.
822 2019-11-15 Andrew Sutton <asutton@lock3software.com>
825 * pt.c (get_underlying_template): Exit loop if the original type
826 of the alias is null.
828 2019-11-19 Andrew Sutton <asutton@lock3software.com>
831 * pt.c (maybe_new_partial_specialization): Apply access to newly
832 created partial specializations. Update comment style.
834 2019-11-19 Andrew Sutton <asutton@lock3software.com>
837 * pt.c (maybe_new_partial_specialization): Apply access to newly
838 created partial specializations. Update comment style.
840 2019-11-19 Andrew Sutton <asutton@lock3software.com>
843 Suppress diagnostics substituting into a requires-expression.
844 * pt.c (tsubst_copy_and_build): Perform the first substitution without
845 diagnostics and a second only if tsubst_requries_expr returns an error.
847 2019-11-19 Jakub Jelinek <jakub@redhat.com>
850 * semantics.c (handle_omp_for_class_iterator): Don't call
851 cp_fully_fold on cond.
853 2019-11-18 Paolo Carlini <paolo.carlini@oracle.com>
855 * typeck.c (cp_build_addr_expr_1): Use cp_expr_loc_or_input_loc
857 (cxx_sizeof_expr): Use it in one additional place.
858 (cxx_alignof_expr): Likewise.
859 (lvalue_or_else): Likewise.
861 2019-11-18 Marek Polacek <polacek@redhat.com>
863 PR c++/91962 - ICE with reference binding and qualification conversion.
864 * call.c (convert_like_real) <case ck_ref_bind>: Check need_temporary_p.
866 2019-11-17 Jakub Jelinek <jakub@redhat.com>
868 * method.c (lookup_comparison_result): Use %qD instead of %<%T::%D%>
870 (lookup_comparison_category): Use %qD instead of %<std::%D%> to print
873 2019-11-15 Paolo Carlini <paolo.carlini@oracle.com>
875 * typeck.c (cp_truthvalue_conversion): Add tsubst_flags_t parameter
876 and use it in calls; also pass the location_t of the expression to
877 cp_build_binary_op and c_common_truthvalue_conversion.
878 * rtti.c (build_dynamic_cast_1): Adjust call.
879 * cvt.c (ocp_convert): Likewise.
880 * cp-gimplify.c (cp_fold): Likewise.
881 * cp-tree.h (cp_truthvalue_conversion): Update declaration.
883 2019-11-14 Jason Merrill <jason@redhat.com>
885 Implement P1816R0, class template argument deduction for aggregates.
886 * pt.c (maybe_aggr_guide, collect_ctor_idx_types): New.
887 (is_spec_or_derived): Split out from do_class_deduction.
888 (build_deduction_guide): Handle aggregate guide.
889 * class.c (finish_struct): Set CLASSTYPE_NON_AGGREGATE in a
891 * cp-tree.h (CP_AGGREGATE_TYPE_P): An incomplete class is not an
894 2019-11-14 Richard Sandiford <richard.sandiford@arm.com>
896 * call.c (build_conditional_expr_1): Use truth_type_for instead
897 of build_same_sized_truth_vector_type.
898 * typeck.c (build_vec_cmp): Likewise.
900 2019-11-14 Jakub Jelinek <jakub@redhat.com>
902 * parser.c (cp_parser_omp_context_selector): Don't require score
903 argument to fit into shwi, just to be INTEGER_CST. Diagnose
905 * pt.c (tsubst_attribute): Likewise.
907 * parser.c (cp_parser_omp_context_selector): Rename
908 CTX_PROPERTY_IDLIST to CTX_PROPERTY_NAME_LIST, add CTX_PROPERTY_ID.
909 Use CTX_PROPERTY_ID for atomic_default_mem_order, only allow a single
910 identifier in that. For CTX_PROPERTY_NAME_LIST, allow identifiers
912 * pt.c (tsubst_attribute): Fix up STRING_CST handling if allow_string.
914 2019-11-13 Marek Polacek <polacek@redhat.com>
916 PR c++/89070 - bogus [[nodiscard]] warning in SFINAE.
917 * cvt.c (convert_to_void): Guard maybe_warn_nodiscard calls with
920 2019-11-13 Richard Sandiford <richard.sandiford@arm.com>
923 * cp-tree.h (STF_STRIP_DEPENDENT): New constant.
924 * tree.c (strip_typedefs): Add STF_STRIP_DEPENDENT to the flags
925 when calling strip_typedefs recursively on a DECL_ORIGINAL_TYPE.
926 Don't apply the fix for DR1558 in that case; allow aliases with
927 dependent template parameters to be stripped instead.
929 2019-11-12 Nathan Sidwell <nathan@acm.org>
931 * name-lookup.c (lookup_using_decl): New function, merged from ...
932 (do_class_using_decl): ... here. Call it. And ...
933 (finish_nonmember_using_decl): ... here. Call it.
935 2019-11-12 Martin Liska <mliska@suse.cz>
937 * name-lookup.c: Do not include params.h.
938 * typeck.c: Likewise.
940 2019-11-12 Martin Liska <mliska@suse.cz>
942 * name-lookup.c (namespace_hints::namespace_hints): Replace old
943 parameter syntax with the new one, include opts.h if needed. Use
944 SET_OPTION_IF_UNSET macro.
945 * typeck.c (comptypes): Likewise.
947 2019-11-12 Maciej W. Rozycki <macro@codesourcery.com>
948 Frederik Harwath <frederik@codesourcery.com>
951 * constexpr.c (potential_constant_expression_1): Handle
953 * parser.c (OACC_SERIAL_CLAUSE_MASK): New macro.
954 (cp_parser_oacc_kernels_parallel): Rename function to...
955 (cp_parser_oacc_compute): ... this. Handle PRAGMA_OACC_SERIAL.
956 (cp_parser_omp_construct): Update accordingly.
957 (cp_parser_pragma): Handle PRAGMA_OACC_SERIAL. Fix alphabetic
959 * pt.c (tsubst_expr): Handle OACC_SERIAL.
961 2019-11-11 Jason Merrill <jason@redhat.com>
963 Implement P1946R0, Allow defaulting comparisons by value.
964 * method.c (early_check_defaulted_comparison): Accept by-value,
965 reject mixed by-value and by-reference parms.
966 * decl.c (grokdeclarator): Set funcdef_flag for defaulted friend.
967 * decl2.c (grokfield): Don't SET_DECL_FRIEND_CONTEXT.
969 * typeck.c (cp_build_binary_op): Sorry about <=> on VECTOR_TYPE.
971 2019-11-11 Jakub Jelinek <jakub@redhat.com>
974 * decl.c (finish_function): Move ctype initialization before
975 DECL_DELETED_FN handling.
977 * semantics.c (finish_translation_unit): Diagnose declare target
978 without corresponding end declare target.
980 2019-11-10 Jason Merrill <jason@redhat.com>
982 Implement D1957R0, T* to bool should be considered narrowing.
983 * typeck2.c (check_narrowing): Treat pointer->bool as a narrowing
984 conversion with -std=c++2a.
986 2019-11-08 Marek Polacek <polacek@redhat.com>
988 PR c++/92215 - flawed diagnostic for bit-field with non-integral type.
989 * parser.c (cp_parser_member_declaration): Add a diagnostic for
990 bit-fields with non-integral types.
992 2019-11-08 Jakub Jelinek <jakub@redhat.com>
994 * init.c (build_vec_delete_1): Fix a comment typo - mist -> must.
996 2019-11-07 Jason Merrill <jason@redhat.com>
998 Implement D1959R0, remove weak_equality and strong_equality.
999 * method.c (enum comp_cat_tag, comp_cat_info): Remove *_equality.
1000 (genericize_spaceship, common_comparison_type): Likewise.
1001 * typeck.c (cp_build_binary_op): Move SPACESHIP_EXPR to be with the
1002 relational operators, exclude other types no longer supported.
1004 2019-11-06 Jason Merrill <jason@redhat.com>
1006 Implement D1907R1 "structural type".
1007 * tree.c (structural_type_p): New.
1008 * pt.c (invalid_nontype_parm_type_p): Use it.
1009 * class.c (build_base_field_1): Take binfo. Copy TREE_PRIVATE.
1010 (build_base_field): Pass binfo.
1012 PR c++/92150 - partial specialization with class NTTP.
1013 * pt.c (unify): Handle VIEW_CONVERT_EXPR.
1015 * pt.c (use_pack_expansion_extra_args_p): Still do substitution if
1016 all packs are simple pack expansions.
1017 (add_extra_args): Check that the extra args aren't dependent.
1019 2019-11-06 Andrew Sutton <asutton@lock3software.com>
1021 Use satisfaction with nested requirements.
1022 * constraint.cc (build_parameter_mapping): Use
1023 current_template_parms when the declaration is not available.
1024 (norm_info::norm_info) Make explicit.
1025 (normalize_constraint_expression): Factor into a separate overload
1026 that takes arguments, and use that in the original function.
1027 (tsubst_nested_requirement): Use satisfy_constraint instead of
1028 trying to evaluate this as a constant expression.
1029 (finish_nested_requirement): Keep the normalized constraint and the
1030 original normalization arguments with the requirement.
1031 (diagnose_nested_requirement): Use satisfy_constraint. Tentatively
1032 implement more comprehensive diagnostics, but do not enable.
1033 * parser.c (cp_parser_requires_expression): Relax requirement that
1034 requires-expressions can live only inside templates.
1035 * pt.c (any_template_parm_r): Look into type of PARM_DECL.
1037 2019-11-06 Jason Merrill <jason@redhat.com>
1039 C++20 NB CA378 - Remove constrained non-template functions.
1040 * decl.c (grokfndecl): Reject constraints on non-templated function.
1042 2019-11-06 Matthias Kretz <m.kretz@gsi.de>
1044 * parser.c (cp_parser_operator): Parse operator?: as an
1045 attempt to overload the conditional operator.
1047 2019-11-05 Jason Merrill <jason@redhat.com>
1049 Implement C++20 operator<=>.
1050 * cp-tree.h (struct lang_decl_fn): Add maybe_deleted bitfield.
1051 (DECL_MAYBE_DELETED): New.
1052 (enum special_function_kind): Add sfk_comparison.
1053 (LOOKUP_REWRITTEN, LOOKUP_REVERSED): New.
1054 * call.c (struct z_candidate): Add rewritten and reversed methods.
1055 (add_builtin_candidate): Handle SPACESHIP_EXPR.
1056 (add_builtin_candidates): Likewise.
1057 (add_candidates): Don't add a reversed candidate if the parms are
1059 (add_operator_candidates): Split out from build_new_op_1. Handle
1060 rewritten and reversed candidates.
1061 (add_candidate): Swap conversions of reversed candidate.
1062 (build_new_op_1): Swap them back. Build a second operation for
1063 rewritten candidates.
1064 (extract_call_expr): Handle rewritten calls.
1065 (same_fn_or_template): New.
1066 (joust): Handle rewritten and reversed candidates.
1067 * class.c (add_implicitly_declared_members): Add implicit op==.
1068 (classtype_has_op, classtype_has_defaulted_op): New.
1069 * constexpr.c (cxx_eval_binary_expression): Handle SPACESHIP_EXPR.
1070 (cxx_eval_constant_expression, potential_constant_expression_1):
1072 * cp-gimplify.c (genericize_spaceship): New.
1073 (cp_genericize_r): Use it.
1074 * cp-objcp-common.c (cp_common_init_ts): Handle SPACESHIP_EXPR.
1075 * decl.c (finish_function): Handle deleted function.
1076 * decl2.c (grokfield): SET_DECL_FRIEND_CONTEXT on defaulted friend.
1077 (mark_used): Check DECL_MAYBE_DELETED. Remove assumption that
1078 defaulted functions are non-static members.
1079 * error.c (dump_expr): Handle SPACESHIP_EXPR.
1080 * method.c (type_has_trivial_fn): False for sfk_comparison.
1081 (enum comp_cat_tag, struct comp_cat_info_t): New types.
1082 (comp_cat_cache): New array variable.
1083 (lookup_comparison_result, lookup_comparison_category)
1084 (is_cat, cat_tag_for, spaceship_comp_cat)
1085 (spaceship_type, genericize_spaceship)
1086 (common_comparison_type, early_check_defaulted_comparison)
1087 (comp_info, build_comparison_op): New.
1088 (synthesize_method): Handle sfk_comparison. Handle deleted.
1089 (get_defaulted_eh_spec, maybe_explain_implicit_delete)
1090 (explain_implicit_non_constexpr, implicitly_declare_fn)
1091 (defaulted_late_check, defaultable_fn_check): Handle sfk_comparison.
1092 * name-lookup.c (get_std_name_hint): Add comparison categories.
1093 * tree.c (special_function_p): Add sfk_comparison.
1094 * typeck.c (cp_build_binary_op): Handle SPACESHIP_EXPR.
1096 2019-11-05 Tim van Deurzen <tim@kompiler.org>
1098 Add new tree code for the spaceship operator.
1099 * cp-tree.def: Add new tree code.
1100 * operators.def: New binary operator.
1101 * parser.c: Add new token and tree code.
1103 2019-09-15 Jason Merrill <jason@redhat.com>
1105 * call.c (build_new_op_1): Don't apply any standard conversions to
1106 the operands of a built-in operator. Don't suppress conversions in
1108 * typeck.c (cp_build_unary_op): Do integral promotions for enums.
1110 2019-11-04 Jason Merrill <jason@redhat.com>
1112 Use vec instead of raw array for built-in candidates.
1113 * call.c (build_builtin_candidate): Take args in a vec.
1114 (add_builtin_candidate, add_builtin_candidates): Likewise.
1115 (build_conditional_expr_1, build_new_op_1): Adjust.
1117 2019-11-04 Jason Merrill <jason@redhat.com>
1119 * constexpr.c (explain_invalid_constexpr_fn): Show location of fn.
1121 * pt.c (maybe_instantiate_noexcept): Only update clones if we
1124 * typeck.c (contextual_conv_bool): New.
1126 * name-lookup.c (lookup_qualified_name): Add wrapper overload taking
1127 C string rather than identifier.
1128 * parser.c (cp_parser_userdef_numeric_literal): Use it.
1129 * rtti.c (emit_support_tinfos): Use it.
1130 * cp-tree.h (ovl_op_identifier): Change to inline functions.
1131 (build_x_binary_op): Add wrapper with fewer parms.
1133 2019-11-05 Jason Merrill <jason@redhat.com>
1135 * decl2.c (mark_used): Diagnose use of a function with unsatisfied
1137 * typeck.c (cp_build_function_call_vec): Not here.
1139 2019-11-05 Nathan Sidwell <nathan@acm.org>
1142 * parser.c (cp_parser_error_1): Check EOF and UNKNOWN_LOCATION
1143 when skipping over version control marker.
1145 2019-11-05 Jakub Jelinek <jakub@redhat.com>
1148 * constexpr.c (potential_constant_expression_1): Return true rather
1149 than false for PREDICT_EXPR.
1151 * decl.c (omp_declare_variant_finalize_one): Call
1152 declare_simd_adjust_this not just on the context, but also on the
1153 variant-id expression for methods. Don't call
1154 cp_get_callee_fndecl_nofold, call cp_get_callee and only if it is
1155 safe cp_get_fndecl_from_callee. Don't try to print as %qD
1156 NULL in diagnostics.
1157 * pt.c (tsubst_attribute): Handle "omp declare variant base"
1159 (tsubst_function_decl): Call omp_declare_variant_finalize
1160 if there are any "omp declare variant base" attributes left.
1162 2019-11-04 Kamlesh Kumar <kamleshbhalui@gmail.com>
1164 PR c++/91979 - mangling nullptr expression
1165 * mangle.c (write_template_arg_literal): Handle nullptr
1168 2019-11-04 Jason Merrill <jason@redhat.com>
1170 * typeck.c (check_return_expr): Avoid redundant error.
1172 2019-11-02 Paolo Carlini <paolo.carlini@oracle.com>
1174 * typeck.c (composite_pointer_type): Add a const op_location_t&
1175 parameter and use it in diagnostics.
1176 (composite_pointer_error): Likewise.
1177 (composite_pointer_type_r): Add a const op_location_t&
1178 parameter and forward it.
1179 (cp_build_binary_op): Adjust calls.
1180 (common_pointer_type): Likewise.
1181 * call.c (add_builtin_candidate): Likewise.
1182 (build_conditional_expr_1): Likewise.
1183 * cp-tree.h (composite_pointer_type): Update declaration.
1185 * typeck.c (cxx_sizeof_expr): Use cp_expr_loc_or_input_loc
1187 (cxx_alignof_expr): Likewise.
1188 (lvalue_or_else): Likewise.
1190 2019-11-02 Jakub Jelinek <jakub@redhat.com>
1192 * decl.c (omp_declare_variant_finalize_one): Use
1193 omp_get_context_selector instead of c_omp_get_context_selector.
1196 * parser.c (cp_parser_decl_specifier_seq): Don't parse attributes
1197 if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR.
1199 PR c++/88335 - Implement P1073R3: Immediate functions
1200 * cp-tree.h (struct lang_decl_fn): Add immediate_fn_p bit.
1201 (DECL_IMMEDIATE_FUNCTION_P, SET_DECL_IMMEDIATE_FUNCTION_P): Define.
1202 (enum cp_decl_spec): Add ds_consteval.
1203 (fold_non_dependent_expr): Add another tree argument defaulted to
1205 * name-lookup.h (struct cp_binding_level): Add immediate_fn_ctx_p
1207 * parser.c (cp_keyword_starts_decl_specifier_p): Adjust comments
1208 for C++11 and C++20 specifiers. Handle RID_CONSTEVAL.
1209 (CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR): Adjust comment.
1210 (CP_PARSER_FLAGS_CONSTEVAL): New.
1211 (cp_parser_skip_balanced_tokens): New forward declaration.
1212 (cp_parser_lambda_declarator_opt): Handle ds_consteval. Set
1213 current_binding_level->immediate_fn_ctx_p before parsing parameter
1214 list if decl-specifier-seq contains consteval specifier.
1215 (cp_parser_decl_specifier_seq): Handle RID_CONSTEVAL.
1216 (cp_parser_explicit_instantiation): Diagnose explicit instantiation
1217 with consteval specifier.
1218 (cp_parser_init_declarator): For consteval or into flags
1219 CP_PARSER_FLAGS_CONSTEVAL.
1220 (cp_parser_direct_declarator): If CP_PARSER_FLAGS_CONSTEVAL, set
1221 current_binding_level->immediate_fn_ctx_p in the sk_function_parms
1223 (set_and_check_decl_spec_loc): Add consteval entry, formatting fix.
1224 * call.c (build_addr_func): For direct calls to immediate functions
1225 use build_address rather than decay_conversion.
1226 (build_over_call): Evaluate immediate function invocations.
1227 * error.c (dump_function_decl): Handle DECL_IMMEDIATE_FUNCTION_P.
1228 * semantics.c (expand_or_defer_fn_1): Use tentative linkage and don't
1229 call mark_needed for immediate functions.
1230 * typeck.c (cxx_sizeof_or_alignof_expr): Likewise. Formatting fix.
1231 (cp_build_addr_expr_1): Reject taking address of immediate function
1232 outside of immediate function.
1233 * decl.c (validate_constexpr_redeclaration): Diagnose consteval
1234 vs. non-consteval or vice versa redeclaration. Use
1235 SET_DECL_IMMEDIATE_FUNCTION_P if new_decl is immediate function.
1236 (check_tag_decl): Use %qs with keyword string to simplify translation.
1237 Handle ds_consteval.
1238 (start_decl): Adjust diagnostics for static or thread_local variables
1239 in immediate functions.
1240 (grokfndecl): Call sorry_at on virtual consteval. Use %qs with keyword
1241 to string to simplify translation. Diagnose consteval main. Use
1242 SET_DECL_IMMEDIATE_FUNCTION_P for consteval.
1243 (grokdeclarator): Handle consteval. Use %qs with keyword strings to
1244 simplify translation. Use separate ifs instead of chained else if
1245 for invalid specifiers. For constinit clear constinit_p rather than
1247 * constexpr.c (find_immediate_fndecl): New function.
1248 (cxx_eval_outermost_constant_expr): Allow consteval calls returning
1249 void. Diagnose returning address of immediate function from consteval
1251 (fold_non_dependent_expr_template): Add OBJECT argument, pass it
1252 through to cxx_eval_outermost_constant_expr.
1253 (fold_non_dependent_expr): Add OBJECT argument, pass it through to
1254 fold_non_dependent_expr_template.
1255 (fold_non_dependent_init): Adjust fold_non_dependent_expr_template
1257 * method.c (defaulted_late_check): Adjust diagnostics for consteval.
1258 * lambda.c (maybe_add_lambda_conv_op): Copy over
1259 DECL_DECLARED_CONSTEXPR_P and DECL_IMMEDIATE_FUNCTION_P bits from
1260 callop to both artificial functions.
1261 * init.c (build_value_init): Don't do further processing if
1262 build_special_member_call returned a TREE_CONSTANT. Formatting fix.
1264 PR c++/91369 - Implement P0784R7: constexpr new
1265 * cp-tree.h (CALL_FROM_NEW_OR_DELETE_P): Define.
1266 * init.c (build_new_1, build_vec_delete_1, build_delete): Set
1267 CALL_FROM_NEW_OR_DELETE_P on the CALL_EXPR to allocator functions.
1268 * constexpr.c (is_std_allocator_allocate): Only allow
1269 global replaceable allocator functions if CALL_FROM_NEW_OR_DELETE_P
1270 or in std::allocate<T>::{,de}allocate.
1271 (potential_constant_expression_1): Likewise.
1273 2019-11-01 Nathan Sidwell <nathan@acm.org>
1275 * class.c (check_field_decls): Refactor.
1277 2019-10-31 Jakub Jelinek <jakub@redhat.com>
1280 * cp-tree.h (type_initializer_zero_p): Declare.
1281 * decl.c (reshape_init_array_1): Formatting fix.
1282 * tree.c (type_initializer_zero_p): New function. Moved from
1283 ../tree.c, use next_initializable_field, formatting fix. Return
1284 false for TYPE_NON_AGGREGATE_CLASS types.
1286 2019-10-30 Jason Merrill <jason@redhat.com>
1288 PR c++/92268 - hard error satisfying return-type-requirement
1289 * constraint.cc (type_deducible_p): Check for substitution failure.
1290 (diagnose_compound_requirement): Adjust diagnostic.
1291 * pt.c (do_auto_deduction): Don't pass cargs to
1292 constraints_satisfied_p.
1294 2019-10-30 Jakub Jelinek <jakub@redhat.com>
1296 PR c++/91369 - Implement P0784R7: constexpr new
1297 * constexpr.c (cxx_replaceable_global_alloc_fn): Don't return true
1299 (cxx_placement_new_fn, is_std_construct_at): New functions.
1300 (cxx_eval_call_expression): Allow placement new in std::construct_at.
1301 (potential_constant_expression_1): Likewise.
1303 * typeck.c (decl_in_std_namespace_p): Return true also for decls
1304 in inline namespaces inside of std namespace.
1306 2019-10-30 Bernd Edlinger <bernd.edlinger@hotmail.de>
1309 * name-lookup.c (check_local_shadow): Shadowing TYPE_DECLs
1310 is always a -Wshadow=compatible-local warning, unless
1313 2019-10-30 Jason Merrill <jason@redhat.com>
1315 * cxx-pretty-print.c (get_fold_operator): Use OVL_OP_INFO.
1317 2019-10-30 Marek Polacek <polacek@redhat.com>
1319 PR c++/92134 - constinit malfunction in static data member.
1320 * decl2.c (grokfield): Set LOOKUP_CONSTINIT.
1322 2019-10-30 Jakub Jelinek <jakub@redhat.com>
1324 * cp-tree.h (omp_declare_variant_finalize, build_local_temp): Declare.
1325 * decl.c: Include omp-general.h.
1326 (declare_simd_adjust_this): Add forward declaration.
1327 (omp_declare_variant_finalize_one, omp_declare_variant_finalize): New
1329 (cp_finish_decl, finish_function): Call omp_declare_variant_finalize.
1330 * parser.c (cp_finish_omp_declare_variant): Adjust parsing of the
1331 variant id-expression and propagate enough information to
1332 omp_declare_variant_finalize_one in the attribute so that it can
1334 * class.c (finish_struct): Call omp_declare_variant_finalize.
1335 * tree.c (build_local_temp): No longer static, remove forward
1338 2019-10-30 Paolo Carlini <paolo.carlini@oracle.com>
1340 * typeck.c (cp_build_modify_expr): Prefer error + inform to
1341 error + error in one place.
1342 (get_delta_difference_1): Likewise.
1343 (get_delta_difference): Likewise, in two places.
1345 2019-10-29 Paolo Carlini <paolo.carlini@oracle.com>
1347 * typeck.c (build_x_unary_op): Use the location_t argument in
1350 2019-10-29 Marek Polacek <polacek@redhat.com>
1352 PR c++/90998 - ICE with copy elision in init by ctor and -Wconversion.
1353 * call.c (joust): Don't attempt to warn if ->second_conv is null.
1355 2019-10-29 Jakub Jelinek <jakub@redhat.com>
1358 * cp-gimplify.c (cp_gimplify_expr): If gimplify_to_rvalue changes the
1359 function pointer type, re-add cast to the original one.
1361 2019-10-29 Marek Polacek <polacek@redhat.com>
1363 PR c++/91548 - fix detecting modifying const objects for ARRAY_REF.
1364 * constexpr.c (cxx_eval_store_expression): Don't call
1365 modifying_const_object_p for ARRAY_REF.
1367 2019-10-29 Richard Sandiford <richard.sandiford@arm.com>
1369 * cp-objcp-common.h (cxx_simulate_enum_decl): Declare.
1370 (LANG_HOOKS_SIMULATE_ENUM_DECL): Define to the above.
1371 * decl.c (cxx_simulate_enum_decl): New function.
1373 2019-10-29 Richard Sandiford <richard.sandiford@arm.com>
1375 * cp-tree.h (cxx_simulate_builtin_function_decl): Declare.
1376 * decl.c (cxx_simulate_builtin_function_decl): New function.
1377 * cp-objcp-common.h (LANG_HOOKS_SIMULATE_BUILTIN_FUNCTION_DECL):
1378 Define to the above.
1380 2019-10-28 Martin Sebor <msebor@redhat.com>
1383 * cp-objcp-common.c (names_builtin_p): Define new function.
1385 2019-10-28 Nathan Sidwell <nathan@acm.org>
1387 * parser.h (struct cp_token): Drop {ENUM,BOOL}_BITFIELD C-ism.
1388 Add tree_check_p flag, use as nested union discriminator.
1389 (struct cp_lexer): Add saved_type & saved_keyword fields.
1390 * parser.c (eof_token): Delete.
1391 (cp_lexer_new_main): Always init last_token to last token of
1393 (cp_lexer_new_from_tokens): Overlay EOF token at end of range.
1394 (cp_lexer_destroy): Restore token under the EOF.
1395 (cp_lexer_previous_token_position): No check for eof_token here.
1396 (cp_lexer_get_preprocessor_token): Clear tree_check_p.
1397 (cp_lexer_peek_nth_token): Check CPP_EOF not eof_token.
1398 (cp_lexer_consume_token): Assert not CPP_EOF, no check for
1400 (cp_lexer_purge_token): Likewise.
1401 (cp_lexer_purge_tokens_after): No check for EOF token.
1402 (cp_parser_nested_name_specifier, cp_parser_decltype)
1403 (cp_parser_template_id): Set tree_check_p.
1405 2019-10-24 Jakub Jelinek <jakub@redhat.com>
1407 * decl2.c (cplus_decl_attributes): Add "omp declare target block"
1408 attribute in between declare target and end declare target
1411 * call.c (convert_arg_to_ellipsis): Add missing space in string
1414 2019-10-24 Marek Polacek <polacek@redhat.com>
1416 * decl.c (reshape_init_r): Add missing space.
1418 2019-10-24 Nathan Sidwell <nathan@acm.org>
1420 * pt.c (reduce_template_parm_level): Attach the new TPI to the new
1422 (convert_generic_types_to_packs): Pass the copied type to
1423 reduce_templatE_parm_level.
1425 2019-10-23 Nathan Sidwell <nathan@acm.org>
1427 * cp-tree.c (CPTI_STD_IDENTIFIER): Delete.
1428 (std_identifier): Delete.
1429 (DECL_NAME_SPACE_STD_P): Compare against std_node.
1430 * decl.c (initialize_predefined_identifiers): 'std' is not needed.
1431 (cxx_init_decl_processing): Adjust creation of ::std. Use
1432 {push,pop}_nested_namespace.
1433 (cxx_builtin_function): Use {push,pop}_nested_namespace.
1434 * except.c (init_exception_processing): Likewise.
1435 * rtti.c (init_rtti_processing): Likewise.
1437 2019-10-23 Jason Merrill <jason@redhat.com>
1439 Implement P1286R2, Contra CWG1778
1440 * method.c (defaulted_late_check): Don't check explicit
1441 exception-specification on defaulted function.
1442 (after_nsdmi_defaulted_late_checks): Remove.
1443 * parser.h (struct cp_unparsed_functions_entry): Remove classes.
1444 * parser.c (unparsed_classes): Remove.
1445 (push_unparsed_function_queues, cp_parser_class_specifier_1):
1448 2019-10-23 Jakub Jelinek <jakub@redhat.com>
1450 * constexpr.c (cxx_eval_constant_expression) <case CLEANUP_STMT>:
1451 Temporarily change input_location to CLEANUP_STMT location.
1453 2019-10-22 Jakub Jelinek <jakub@redhat.com>
1455 PR tree-optimization/85887
1456 * decl.c (expand_static_init): Drop ECF_LEAF from __cxa_guard_acquire
1457 and __cxa_guard_release.
1459 2019-10-22 Marc Glisse <marc.glisse@inria.fr>
1462 * constexpr.c (cxx_eval_builtin_function_call): Only set
1463 force_folding_builtin_constant_p if manifestly_const_eval.
1465 2019-10-22 Richard Sandiford <richard.sandiford@arm.com>
1467 * cp-tree.h (STF_USER_VISIBLE): New constant.
1468 (strip_typedefs, strip_typedefs_expr): Take a flags argument.
1469 * tree.c (strip_typedefs, strip_typedefs_expr): Likewise,
1470 updating mutual calls accordingly. When STF_USER_VISIBLE is true,
1471 only look through typedefs if user_facing_original_type_p.
1472 * error.c (dump_template_bindings, type_to_string): Pass
1473 STF_USER_VISIBLE to strip_typedefs.
1474 (dump_type): Likewise, unless pp_c_flag_gnu_v3 is set.
1476 2019-10-21 Kamlesh Kumar <kamleshbhalui@gmail.com>
1477 Jason Merrill <jason@redhat.com>
1479 PR c++/83534 - typeinfo of noexcept function
1480 * rtti.c (get_tinfo_decl_dynamic): Do not call
1481 TYPE_MAIN_VARIANT for function.
1482 (get_typeid): Likewise.
1484 2019-10-21 Paolo Carlini <paolo.carlini@oracle.com>
1486 * parser.c (cp_parser_class_head): Improve error recovery upon
1487 extra qualification error.
1489 2019-10-21 Jakub Jelinek <jakub@redhat.com>
1492 * constexpr.c (cxx_eval_component_reference, cxx_eval_bit_field_ref):
1493 Use STRIP_ANY_LOCATION_WRAPPER on CONSTRUCTOR elts.
1495 2019-10-21 Marek Polacek <polacek@redhat.com>
1497 PR c++/92062 - ODR-use ignored for static member of class template.
1498 * pt.c (has_value_dependent_address): Strip location wrappers.
1500 2019-10-21 Marek Polacek <polacek@redhat.com>
1502 PR c++/92106 - ICE with structured bindings and -Wreturn-local-addr.
1503 * typeck.c (maybe_warn_about_returning_address_of_local): Avoid
1504 recursing on null initializer and return false instead.
1506 2019-10-17 JeanHeyd Meneide <phdofthehouse@gmail.com>
1508 Implement p1301 [[nodiscard("should have a reason")]] + p1771 DR
1509 * tree.c (handle_nodiscard_attribute): Handle C++2a nodiscard
1511 (std_attribute_table) Increase nodiscard argument handling
1512 max_length from 0 to 1.
1513 * parser.c (cp_parser_check_std_attribute): Add requirement
1514 that nodiscard only be seen once in attribute-list.
1515 (cp_parser_std_attribute): Check that empty parenthesis lists are
1516 not specified for attributes that have max_length > 0 (e.g.
1518 * cvt.c (maybe_warn_nodiscard): Add nodiscard message to
1519 output, if applicable.
1520 (convert_to_void): Allow constructors to be nodiscard-able (P1771).
1522 2019-10-18 Nathan Sidwell <nathan@acm.org>
1524 * cp-tree.h (struct lang_type): Remove was_anonymous.
1525 (TYPE_WAS_UNNAMED): Implement by checking TYPE_DECL &
1527 * decl.c (name_unnamed_type): Don't set TYPE_WAS_UNNAMED.
1529 2019-10-17 Paolo Carlini <paolo.carlini@oracle.com>
1531 * decl.c (grokfndecl): Remove redundant use of in_system_header_at.
1532 (compute_array_index_type_loc): Likewise.
1533 (grokdeclarator): Likewise.
1534 * error.c (cp_printer): Likewise.
1535 * lambda.c (add_default_capture): Likewise.
1536 * parser.c (cp_parser_primary_expression): Likewise.
1537 (cp_parser_selection_statement): Likewise.
1538 (cp_parser_toplevel_declaration): Likewise.
1539 (cp_parser_enumerator_list): Likewise.
1540 (cp_parser_using_declaration): Likewise.
1541 (cp_parser_member_declaration): Likewise.
1542 (cp_parser_exception_specification_opt): Likewise.
1543 (cp_parser_std_attribute_spec): Likewise.
1544 * pt.c (do_decl_instantiation): Likewise.
1545 (do_type_instantiation): Likewise.
1546 * typeck.c (cp_build_unary_op): Likewise.
1548 * decl.c (check_tag_decl): Pass to in_system_header_at the same
1549 location used for the permerror.
1550 (grokdeclarator): Likewise.
1552 * decl.c (check_tag_decl): Use locations[ds_typedef] in error_at.
1554 2019-10-17 Jason Merrill <jason@redhat.com>
1556 * cp-gimplify.c (cp_gimplify_expr): Use get_initialized_tmp_var.
1557 (gimplify_to_rvalue): Remove default NULL argument.
1559 2019-10-17 Nathan Sidwell <nathan@acm.org>
1561 * decl.c (builtin_function_1): Merge into ...
1562 (cxx_builtin_function): ... here. Nadger the decl before maybe
1563 copying it. Set the context.
1564 (cxx_builtin_function_ext_scope): Push to top level, then call
1565 cxx_builtin_function.
1567 2019-10-16 Luis Machado <luis.machado@linaro.org>
1569 * cp-gimplify.c: Fix reference to non-existing tree-gimple.c file.
1571 2019-10-16 Jakub Jelinek <jakub@redhat.com>
1573 * decl.c (cxx_maybe_build_cleanup): When clearing location of cleanup,
1574 if cleanup is a nop, clear location of its operand too.
1576 2019-10-15 Andrew Sutton <asutton@lock3software.com>
1578 Finish moving constraint and logic functionality of out pt.c.
1579 Reimplement and re-enable subsumption caching.
1581 * config-lang.in (gtfiles): Add logic.cc.
1582 * constraint.cc (atomic_constraints_identical_p): Add assertions.
1583 (hash_atomic_constraint): Likewise.
1584 (constraints_equivalent_p): New.
1585 (inchash::add_constraint): New.
1586 (iterative_hash_constraint): New.
1587 (decl_constraints): Moved from pt.c.
1588 (get_constraints): Likewise.
1589 (set_constraints): Likewise.
1590 (remove_constraints): Likewise.
1591 * cp-tree.h (CONSTR_P): New.
1592 (init_constraint_processing): Remove.
1593 (constraints_equivalent_p, iterative_hash_constraint): Declare.
1594 * decl.c (cxx_init_decl_processing): Don't initialize constraints.
1595 * logic.cc (subsumption_entry): Moved from pt.c.
1596 (subsumption_hasher): Likewise.
1597 (subsumption_cache): Likewise.
1598 (lookup_subsumption): Likewise.
1599 (save_subsumption): Likewise.
1600 (subsumes_constraints_nonnull): Use subsumption cache.
1601 * pt.c: Move aforementioned declarations out of this file.
1602 (init_constraint_processing): Remove.
1604 2019-10-15 Andrew Sutton <asutton@lock3software.com>
1606 * parser.c (cp_parser_constructor_declarator_p): Pass an empty
1607 decl-specifier-seq to make sure we parse type constraints as part
1608 of a type-specifier.
1610 2019-10-15 Nathan Sidwell <nathan@acm.org>
1612 * class.c (build_clones): Break out of clone_function_decl. Just
1614 (clone_function_decl): Call build_clones, then maybe add them to
1617 * class.c (build_clone): Refactor to clarify recursiveness.
1619 2019-10-14 Jason Merrill <jason@redhat.com>
1621 PR c++/91930 - ICE with constrained inherited default ctor.
1622 * name-lookup.c (do_class_using_decl): Set TYPE_HAS_USER_CONSTRUCTOR
1623 for inherited constructor.
1625 2019-10-14 Paolo Carlini <paolo.carlini@oracle.com>
1627 * decl.c (check_tag_decl): Use DECL_SOURCE_LOCATION.
1629 2019-10-14 Jakub Jelinek <jakub@redhat.com>
1632 * semantics.c (handle_omp_array_sections_1): Temporarily disable
1633 -fstrong-eval-order also for in_reduction and task_reduction clauses.
1635 * parser.c (cp_parser_omp_all_clauses): Change bool NESTED_P argument
1636 into int NESTED, if it is 2, diagnose missing commas in between
1638 (cp_parser_omp_context_selector): Pass 2 as last argument to
1639 cp_parser_omp_all_clauses.
1641 2019-10-12 Jakub Jelinek <jakub@redhat.com>
1643 * parser.c (cp_parser_omp_context_selector): Improve error recovery.
1644 For simd properties, put them directly into TREE_VALUE.
1645 (cp_finish_omp_declare_variant): Add "omp declare variant base"
1646 attribute rather than "omp declare variant".
1648 2019-10-11 Marek Polacek <polacek@redhat.com>
1650 PR c++/92049 - extra error with -fchecking=2.
1651 * pt.c (build_non_dependent_expr): Call fold_non_dependent_expr
1654 2019-10-11 Paolo Carlini <paolo.carlini@oracle.com>
1656 * typeck.c (cp_build_binary_op): Do not handle RROTATE_EXPR and
1658 * constexpr.c (cxx_eval_constant_expression): Likewise.
1659 (potential_constant_expression_1): Likewise.
1660 * pt.c (tsubst_copy): Likewise.
1662 2019-10-11 Jason Merrill <jason@redhat.com>
1664 * decl2.c (mark_used): Don't clobber DECL_SOURCE_LOCATION on
1665 explicitly defaulted functions.
1666 * method.c (synthesize_method): Likewise.
1668 2019-10-11 Jakub Jelinek <jakub@redhat.com>
1671 * decl2.c (grok_array_decl): For -fstrong-eval-order, when array ref
1672 operands have been swapped and at least one operand has side-effects,
1673 revert the swapping before calling build_array_ref.
1674 * typeck.c (cp_build_array_ref): For non-ARRAY_TYPE array ref with
1675 side-effects on the index operand, if -fstrong-eval-order use
1676 save_expr around the array operand.
1677 (cp_build_binary_op): For shifts with side-effects in the second
1678 operand, wrap first operand into SAVE_EXPR and evaluate it before
1680 * semantics.c (handle_omp_array_sections_1): Temporarily disable
1681 flag_strong_eval_order during OMP_CLAUSE_REDUCTION array section
1683 * cp-gimplify.c (gimplify_to_rvalue): New function.
1684 (cp_gimplify_expr): Use it.
1686 2019-10-10 Marek Polacek <polacek@redhat.com>
1688 * typeck.c (comp_ptr_ttypes_real): Change the return type to bool.
1689 Use false instead of 0.
1691 2019-10-10 Jakub Jelinek <jakub@redhat.com>
1693 * parser.h (struct cp_omp_declare_simd_data): Add variant_p member.
1694 * parser.c (cp_ensure_no_omp_declare_simd): Handle both declare simd
1695 and declare variant.
1696 (cp_parser_oacc_all_clauses): Formatting fix.
1697 (cp_parser_omp_all_clauses): Add NESTED_P argument, if true, terminate
1698 processing on closing paren and don't skip to end of pragma line.
1699 (cp_parser_omp_declare_simd): Add VARIANT_P argument. Handle also
1701 (omp_construct_selectors, omp_device_selectors,
1702 omp_implementation_selectors, omp_user_selectors): New variables.
1703 (cp_parser_omp_context_selector,
1704 cp_parser_omp_context_selector_specification,
1705 cp_finish_omp_declare_variant): New functions.
1706 (cp_parser_late_parsing_omp_declare_simd): Handle also declare variant.
1707 (cp_parser_omp_declare): Handle declare variant.
1709 2019-10-09 Jason Merrill <jason@redhat.com>
1711 * cp-tree.h (template_info_decl_check): Check ENABLE_TREE_CHECKING.
1713 2019-10-09 Marek Polacek <polacek@redhat.com>
1715 PR c++/91364 - P0388R4: Permit conversions to arrays of unknown bound.
1716 PR c++/69531 - DR 1307: Differently bounded array parameters.
1717 PR c++/88128 - DR 330: Qual convs and pointers to arrays of pointers.
1718 * call.c (build_array_conv): Build ck_identity at the beginning
1720 (standard_conversion): Pass bounds_none to comp_ptr_ttypes_const.
1721 (maybe_warn_array_conv): New.
1722 (convert_like_real): Call it. Add an error message about converting
1723 from arrays of unknown bounds.
1724 (conv_get_original_expr): New.
1725 (nelts_initialized_by_list_init): New.
1726 (conv_binds_to_array_of_unknown_bound): New.
1727 (compare_ics): Implement list-initialization ranking based on
1728 array sizes, as specified in DR 1307 and P0388R.
1729 * cp-tree.h (comp_ptr_ttypes_const): Adjust declaration.
1730 (compare_bounds_t): New enum.
1731 * typeck.c (comp_array_types): New bool and compare_bounds_t
1732 parameters. Use them.
1733 (structural_comptypes): Adjust the call to comp_array_types.
1734 (similar_type_p): Handle ARRAY_TYPE.
1735 (build_const_cast_1): Pass bounds_none to comp_ptr_ttypes_const.
1736 (comp_ptr_ttypes_real): Don't check cv-quals of ARRAY_TYPEs. Use
1737 comp_array_types to compare array types. Look through arrays as per
1739 (comp_ptr_ttypes_const): Use comp_array_types to compare array types.
1740 Look through arrays as per DR 330.
1742 2019-10-09 Marek Polacek <polacek@redhat.com>
1744 PR c++/92032 - DR 1601: Promotion of enum with fixed underlying type.
1745 * call.c (standard_conversion): When converting an enumeration with
1746 a fixed underlying type to the underlying type, give it the cr_promotion
1748 (compare_ics): Implement a tiebreaker as per CWG 1601.
1750 2019-10-08 Andrew Sutton <asutton@lock3software.com>
1751 Jason Merrill <jason@redhat.com>
1753 Update the concepts implementation to conform to the C++20
1754 specification, improve compile times, and generally clean up
1756 * call.c (build_new_function_call): Don't evaluate concepts here.
1757 (constraint_failure): Don't record the template.
1758 (print_z_candidate): Don't extract the template.
1759 * class.c (add_method): When overloading, hide ineligible special
1761 (check_methods): Set TYPE_HAS_COMPLEX_* here.
1762 * constexpr.c (cxx_eval_constant_expression): Evaluate concepts.
1763 (maybe_initialize_fundef_copies_table): Remove.
1764 (get_fundef_copy): Use hash_map_safe_get_or_insert.
1765 (clear_cv_and_fold_caches): Clear the satisfaction cache.
1766 * constraint.cc (known_non_bool_p): New.
1767 (parsing_constraint_expression_sentinel): Renamed from
1768 expanding_constraint_sentinel.
1769 (check_constraint_operands): New.
1770 (check_constraint_atom): New.
1771 (finish_constraint_binary_op): New.
1772 (finish_constraint_or_expr): Likewise.
1773 (finish_constraint_and_expr): Likewise.
1774 (finish_constraint_primary_expr): Likewise.
1775 (combine_constraint_expressions): New.
1776 (finish_requires_expr): Add location parm.
1777 (get_concept_definition): Return the initializer of concept definitions.
1778 (get_template_head_requirements): New.
1779 (get_trailing_function_requirements): New.
1780 (deduce_constrained_parameter): Check if the identifier or template-id
1781 is a concept definition.
1782 (resolve_concept_definition_check): Removed.
1783 (resolve_variable_concept_check): Removed.
1784 (resolve_concept_check): New.
1785 (resolve_constraint_check): Handle concept definitions.
1786 converting arguments.
1787 (function_concept_check_p): Removed.
1788 (variable_concept_check_p): Removed.
1789 (unpack_concept_check): New.
1790 (get_concept_check_template): New.
1791 (build_call_check): Moved and renamed to build_function_check.
1792 (build_concept_check_arguments): make static.
1793 (build_function_check): Always do overload resolution
1794 in order to force conversion of template arguments (i.e., actually
1795 check that the use of a concept is valid).
1796 (build_standard_check): Renamed from build_real_concept_check.
1797 (build_real_concept_check): Build checks for C++2a concepts by
1798 (build_wildcard_concept_check): New.
1799 (build_concept_check): Use build_real_concept_check. New overload.
1800 (build_constraints): Save expressions, not normalized constraints.
1801 (build_concept_id): New. Pass tf_warning_or_error.
1802 (build_type_constraint): New.
1803 (finish_type_constraints): New.
1804 (associate_classtype_constraints): Also add constraints to union
1805 types. Note the original declaration in errors. Don't return
1806 error_mark_node in order to avoid an assertion later.
1807 (push_down_pack_expansion): Remove.
1808 (finish_shorthand_constraint): Make fold expressions, not naked
1809 parameter packs. Always apply the constraint to each template argument.
1810 (check_introduction_list): New. Fail if not enough
1811 names are introduced.
1812 (finish_template_introduction): Don't normalize constraints. Pass
1813 tsubst flags. Check for insufficient introductions.
1814 (placeholder_extract_concept_and_args): Handle the template-id case.
1815 Unpack function concept checks correctly.
1816 (tsubst_simple_requirement): Return errors if they occur. Don't
1817 process as a template.
1818 (tsubst_type_requirement): Likewise.
1819 (type_deducible_p): New. Wrap the input expression in parens for the
1820 purpose of deduction.
1821 (expression_convertible_t): New.
1822 (tsubst_compound_requirement): Use new deduction, conversion predicates.
1823 (tsubst_nested_requirement): Return errors if they occur. Don't
1824 process as a template. Instantiate and evaluate the nested requirement.
1825 (tsubst_valid_expression_requirement): New.
1826 (tsubst_simple_requirement): Use tsubst_valid_expression_requirement.
1827 (tsubst_compound_requirement): Use tsubst_valid_expression_requirement.
1828 (check_constaint_variables): New.
1829 (tsubst_constraint_variables): Check that type substitutions are valid.
1830 (tsubst_requires_expr): Likewise. Produce new requires-exprs during
1831 template substitution. Copy the previous local specialization stack,
1832 so references to non-local parameters can be found. Use cp_unevaluated.
1833 (tsubst_constraint): New. Don't evaluate concept checks.
1835 (norm_info): New. Used to build a normalization tree for concept check
1837 (debug_parameter_mapping): New.
1838 (debug_argument_list): New.
1839 (expand_concept): Removed.
1840 (normalize_logical_operation): Pass subst_info through call.
1841 (normalize_pack_expansion): Remove.
1842 (normalize_simple_requirement): Removed
1843 (normalize_type_requirement): Removed
1844 (normalize_compound_requirement): Removed
1845 (normalize_nested_requirement): Removed
1846 (normalize_requirement): Removed
1847 (normalize_requirements): Removed
1848 (normalize_requires_expression): Removed
1849 (normalize_variable_concept_check): Removed.
1850 (normalize_function_concept_check): Removed.
1851 (normalize_concept_check): Merged all normalize_*_check here.
1852 Substitute through written template arguments before normalizing the
1853 definition. Only substitute the innermost template arguments.
1854 (check_for_logical_overloads): Delete.
1855 (map_arguments): New. Associate template parameters with arguments.
1856 (build_parameter_mapping): New. Extract used parameters.
1857 (normalize_expression): Rewrite.
1858 (normalize_conjunction): Removed
1859 (normalize_disjunction): Removed
1860 (normalize_predicate_constraint): Removed
1861 (normalize_parameterized_constraint): Removed
1862 (normalized_map): New variable.
1863 (get_normalized_constraints): New entry point for normalization.
1864 Establishes a timer.
1865 (get_normalized_constraints_from_info): New.
1866 (get_normalized_constraints_from_decl): New. Turn on template processing
1867 prior to normalization. Handle inheriting ctors. Build the
1868 normalization arguments from the full set of template parameters of the
1869 most general template. This guarantees that we have no concrete arguments
1870 in the parameter mapping (e.g., from template members of class
1871 templates). Cache normalizations.
1872 (normalize_concept_definition): New. Cache normalizations.
1873 (normalize_template_requirements): New.
1874 (normalize_nontemplate_requirements): New.
1875 (normalize_constraint_expression): New.
1876 (tsubst_parameter_mapping): New.
1877 (get_mapped_args): New.
1878 (parameter_mapping_equivalent_p): New. Use template_args_equal.
1879 (atomic_constraints_identical_p): New.
1880 (hash_atomic_constraint): New.
1881 (satisfying_constraint_p): New. Guard against recursive evaluation of
1882 constraints during satisfaction.
1883 (satisfy_conjunction): New.
1884 (satisfy_disjunction): New.
1885 (sat_entry): New class for hashing satisfaction results.
1886 (sat_hasher): New hash traits.
1888 (get_satisfaction): New. Returns cached satisfaction result.
1889 (save_satisfaction): New. Caches a satisfaction result.
1890 (clear_satisfaction_cache): New.
1891 (satisfaction_cache): New. Helps manage satisfaction cache requests.
1892 (decl_satisfied_cache): New.
1893 (satisfy_atom): New.
1894 (satisfy_constraint_r): New.
1895 (satisfy_constraint): Use new satisfaction algorithm.
1896 (evaluate_concept_check): New.
1897 (evaluate_concept): Removed.
1898 (evaluate_function_concept): Removed.
1899 (evaluate_variable_concept): Removed.
1900 (satisfy_constraint_expression): New.
1901 (constraint_expression_satisfied_p): New.
1902 (constraints_satisfied_p): Use strip_inheriting_ctors. Use
1903 push_/pop_access_scope.
1904 (more_constrained): Normalize before calling out to subsumption. Allow
1905 classes as arguments.
1906 (strictly_subsumes): Allow non-templates as arguments. Accept a new
1908 (weakly_subsumes): New.
1909 (at_least_as_constrained): Removed.
1910 (diagnose_other_expression): Removed.
1911 (diagnose_predicate_constraint): Removed.
1912 (diagnose_pack_expansion): Removed.
1913 (diagnose_check_constraint): Removed.
1914 (diagnose_logical_constraint): Removed.
1915 (diagnose_expression_constraint): Removed.
1916 (diagnose_type_constraint): Removed.
1917 (diagnose_implicit_conversion_constraint): Removed.
1918 (diagnose_argument_deduction_constraint): Removed.
1919 (diagnose_exception_constraint): Removed.
1920 (diagnose_parameterized_constraint): Removed.
1921 (diagnose_argument_deduction_constraint): Removed.
1922 (diagnose_argument_deduction_constraint): Removed.
1923 (diagnose_argument_deduction_constraint): Removed.
1924 (diagnose_trait_expr): New.
1925 (diagnose_requires_expr): New.
1926 (diagnose_atomic_constraint): New.
1927 (diagnose_valid_expression) Stop wrongly diagnosing valid expressions.
1928 Don't substitute as if in template decls. This causes substitution
1929 to generate expressions that aren't suitable for use with the noexcept
1931 (diagnose_valid_type) Likewise.
1932 (diagnose_compound_requirement) Actually emit diagnostics for
1933 the causes of errors.Call force_paren_expr_uneval.
1934 (diagnose_declaration_constraints): Turn on template processing to
1935 suppress certain analyses.
1936 * cp-objcp-common.c (cp_common_init_ts): Make concepts typed.
1937 (cp_get_debug_type): Use hash_map_safe_*.
1938 * cp-tree.h: New function declarations for semantic actions, other
1939 facilities. Remove declaration no longer used or needed. Remove
1940 unused _CONSTR macros.
1941 (LANG_DECL_HAS_MIN): Add CONCEPT_DECL.
1942 (template_info_decl_check): Factor macro check into an inline function.
1943 (DECL_TEMPLATE_INFO): Use new check facility.
1944 (finish_concept_definition): New. Don't invalid concept declarations
1945 with invalid initializers.
1946 (find_template_parameters): New.
1947 (concept_definition_p): New.
1948 (concept_check_p): New.
1949 (variable_concept_check_p): New.
1950 (force_paren_expr_uneval): New.
1951 (ovl_iterator::using_p): A USING_DECL by itself was also
1952 introduced by a using-declaration.
1953 (struct tree_template_info): Use tree_base instead of
1954 tree_common. Add tmpl and args fields.
1955 (TI_TEMPLATE, TI_ARGS): Adjust.
1956 (DECLTYPE_FOR_INIT_CAPTURE): Remove.
1957 (CONSTR_CHECK, CONSTR_INFO, CONSTR_EXPR, CONSTR_CONTEXT): New.
1958 (ATOMIC_CONSTR_MAP, TRAIT_EXPR_LOCATION): New.
1959 (struct tree_trait_expr): Add locus field.
1960 (enum tsubst_flags): Add tf_norm as a hint to generate normalization
1961 context when diagnosing constraint failure.
1962 * cp-tree.def: Remove unused _CONSTR nodes and rename PRED_CONSTR
1964 (CONCEPT_DECL): New.
1965 * cxx-pretty-print.c: Remove constraint printing code.
1966 (pp_cxx_concept_definition): New.
1967 (pp_cxx_template_declaration): Print concept definitions.
1968 (pp_cxx_check_constraint): Update printing for concept definitions.
1969 (pp_cxx_nested_name_specifier): Fix a weird
1970 case where we're printing '::::' for concepts.
1971 (simple_type_specifier): Print requirements for placeholder types.
1972 (pp_cxx_constrained_type_spec): Print the associated requirements of
1974 (pp_cxx_compound_requirement): Add space before the '->'.
1975 (pp_cxx_parameter_mapping): Print the parameter mapping.
1976 (pp_cxx_atomic_constraint): Use the function above.
1977 * decl.c (redeclaration_error_message): New error for concepts.
1978 (grokdeclarator): Check for and disallow decltype(auto) in parameter
1980 (grokfndecl): Don't normalize constraints. Add check for constraints
1982 (grokvardecl): Don't normalize constraints.
1983 (grok_special_member_properties): Don't set TYPE_HAS_COMPLEX_*.
1984 (function_requirements_equivalent_p): New. Compare trailing
1985 requires clauses. Compare combined constraints in pre-C++20 mode.
1986 (decls_match): Compare trailing requires clauses. Compare template
1987 heads for function templates. Remove old constraint comparison.
1988 Simplify comparison of functions, function templates.
1989 (duplicate_function_template_decls): New. Refactor a nasty if
1990 condition into a single predicate.
1991 (require_deduced_type): Don't complain if we already complained about
1993 (finish_function): Perform auto deduction to ensure that constraints
1994 are checked even when functions contain no return statements. Only do
1995 auto deduction if we haven't previously seen any return statements.
1996 This prevents multiple diagnostics of the same error.
1997 (store_decomp_type): Remove.
1998 (cp_finish_decomp): Use hash_map_safe_put.
1999 * error.c: Remove constraint printing code.
2000 (dump_decl): Dump concept definitions. Handle wildcard declarations.
2001 (dump_template_decl): Likewise.
2002 (dump_type): Print associated requirements for placeholder
2004 (rebuild_concept_check): New.
2005 (maybe_print_single_constraint_context): New.
2006 (maybe_print_constraint_context): Recursively print nested contexts.
2007 * init.c (get_nsdmi): Use hash_map_safe_*.
2008 * lambda.c (maybe_add_lambda_conv_op): Bail if deduction failed.
2009 (add_capture): Copy parameter packs from init.
2010 (lambda_capture_field_type): Always use auto for init-capture.
2011 * logic.cc: Completely rewrite.
2012 (constraint_hash): New.
2013 (clause/ctor): Save atoms in the hash table.
2014 (replace): Save atoms during replacement.
2015 (insert): Save atoms during insertion.
2016 (contains): Only search the hash table for containment.
2017 (clause): Keep a hash of atomic constraints.
2018 (clause::clause): Explicitly copy the hash table when copying.
2019 (disjunction_p, conjunction_p, atomic_p, dnf_size, cnf_size): New.
2020 (diagnose_constraint_size): New.
2021 (subsumes_constraints_nonnull): Compare the sizes of normalized formula
2022 to determine the cheapest decomposition.
2023 * name-lookup.c (diagnose_name_conflict): Diagnose name issues with
2025 (matching_fn_p): Check constraints.
2026 (push_class_level_binding_1): Move overloaded functions case down,
2027 accept FUNCTION_DECL as target_decl.
2028 * parser.c (enum required_token): New required token for auto.
2029 (make_location): Add overload taking lexer as last parm.
2030 (cp_parser_required_error): Diagnose missing auto.
2031 (cp_parser_diagnose_ungrouped_constraint_plain): New.
2032 (cp_parser_diagnose_ungrouped_constraint_plain): New.
2033 (cp_parser_constraint_primary_expression): New. Tentatively parse the
2034 primary expression. If that fails tentatively parse a lower
2035 precedence expression in order to diagnose the error.
2036 (cp_parser_check_non_logical_constraint): New. Performs a trial
2037 parse of the right-hand-side of non-logical operators in order to
2038 generate good diagnostics.
2039 (cp_parser_constraint_logical_and_expression): New.
2040 (cp_parser_constraint_logical_or_expression): New.
2041 (cp_parser_requires_clause_expression): New.
2042 (cp_parser_requires_clause): Renamed to cp_parser_constraint_expression.
2043 (cp_parser_requires_clause_opt): Parse the requires-clause differently
2044 in -fconcepts and -std=c++2a modes.
2045 (cp_parser_requirement_list): Rename to cp_parser_requirement_seq.
2046 Rewrite so that semicolons are parsed
2047 along with requirements, not the sequence.
2048 (cp_parser_simple_requirement): Expect a semicolon at end.
2049 (cp_parser_compound_requirement): Expect a semicolon at end. Only
2050 allow trailing-return-type with -fconcepts-ts.
2051 (cp_parser_nested_requirement): Expect a semicolon at end. Parse
2052 constraint-expressions.
2053 (cp_parser_concept_definition): New. Don't fail parsing the concept
2054 definition if the initializer is ill-formed. Don't declare the concept
2055 before parsing the initializer.
2056 (cp_parser_constraint_expression): Declare earlier.
2057 (cp_parser_type_requirement): Current scope is not valid.
2058 (cp_parser_requires_expression): Commit to the tentative parse.
2059 (cp_parser_decl_specifier_seq): Warn when concept appears to be used
2060 as a decl-specifier.
2061 (cp_parser_template_declaration_after_parameters): Parse concept
2063 (cp_parser_template_id): Don't try to resolve a concept template-id yet.
2064 (cp_parser_template_id_expr): Resolve it as a concept check.
2065 (cp_parser_decl_specifier_seq): Warn on 'concept bool'.
2066 (cp_parser_type_parameter): Combine expressions not
2068 (cp_parser_explicit_template_declaration): Combine expressions not
2070 (cp_parser_maybe_concept_name): Removed.
2071 (cp_parser_simple_type_specifier): Handle an error condition of
2072 a bad constrained type specifier. Expect auto or decltype after
2073 a concept name. Also handle the case where we have a template-id
2075 (cp_parser_template_introduction): Diagnose errors on invalid
2076 introductions. Give up if it doesn't start with a concept name.
2077 Pedwarn if not -fconcepts-ts.
2078 (synthesize_implicit_template_parm): Don't do consistent binding.
2079 Use a new flag for constrained parameters. Combine expressions,
2080 not constraints. Fail if we get a placeholder in block scope.
2081 Placeholders that do not constrain types are not allowed in parameter
2082 declarations, so don't handle them.
2083 (cp_parser_placeholder_type_specifier): New. Implement parsing of
2084 placeholder type specifiers following a concept name or partial
2085 concept check. Disallow decltype(auto) parameters.
2086 (cp_parser_nested_name_specifier_opt): If the token is already
2087 CPP_NESTED_NAME_SPECIFIER, leave it alone.
2088 (cp_parser_id_expression, cp_parser_unqualified_id): Call
2089 cp_parser_template_id_expr.
2090 (cp_parser_placeholder_type_specifier): Add tentative parm. Don't
2091 expect a WILDCARD_DECL.
2092 (cp_parser_trait_expr): Pass trait_loc down.
2093 (cp_parser_postfix_expression): Do set location of dependent member
2095 * pt.c (finish_concept_definition): New.
2096 (push_template_decl_real): Handle concept definitions.
2097 (start_concept_definition): Let push_template_decl_real handle the
2098 creation of the template.
2099 (get_constraints): Return null if the table hasn't been initialized.
2100 (tsubst_copy_and_build): Build template-id expressions for concept
2102 [TRAIT_EXPR]: Pass trait_loc down.
2103 (lookup_template_class_1): Add the template name to the constraint
2105 (lookup_and_finish_template_variable): Build concept checks
2106 with the correct arguments.
2107 (tsubst_function_decl): Don't substitute through constraints.
2108 Always associate constraints with functions.
2109 (template_parm_level_and_index): Make non-static.
2110 (for_each_template_parm_r): Handle requires expressions.
2111 (keep_template_parm): New.
2112 (find_template_parameters): New.
2113 (more_specialized_fn): Change how winners and losers are chosen.
2114 (make_constrained_auto): Don't normalize constraints.
2115 (template_parameters_equivalent_p): New. Compare template
2116 parameters. Add a comparison for implicitly vs. explicitly declared
2118 (template_parameter_lists_equivalent_p): New. Compare template
2120 (template_requirements_equivalent_p): New.
2121 (template_heads_equivalent_p): New. Compare template heads.
2122 (template_parameter_constraints_equivalent_p): New.
2123 (is_compatible_template_arg): Use weakly_subsumes.
2124 (maybe_new_partial_specialization): Use new constraint comparison
2125 for finding specializations.
2126 (process_partial_specialization): Pass main template as argument.
2127 (more_specialized_partial_spec): Don't immediately return when
2129 (make_constrained_auto): Handle concept definitions.
2130 (do_auto_deduction): Update auto deduction for new concept model.
2131 Extract the function concept correctly; rename constr to check to
2132 reflect the kind of node.
2133 (tsubst): Adjust wildcard argument during substitution.
2134 [DECLTYPE_TYPE]: Remove init-capture handling.
2135 (tsubst_copy_and_build): Build concept checks, not template ids.
2136 Defer checks of function concepts. Handle concepts before variable
2137 templates. Handle calls to function concepts explicitly.
2138 (coerce_template_parms): Use concept_definition_p. Handle a deduction
2139 error where a potentially empty pack can be supplied after the last
2140 parameter of a concept.
2141 (finish_template_variable): Don't process concepts here.
2142 (instantiation_dependent_r): Use concept_check_p.
2143 (tsubst_template_args): Make non-static.
2144 (make_constrained_placeholder_type): New. Refactored from
2145 make_constrained_auto.
2146 (make_constrained_auto) Use make_constrained_placeholder_type.
2147 (make_constrained_decltype_auto) New.
2148 (tsubst_function_parms): New.
2149 (value_dependent_expression_p) [TEMPLATE_ID_EXPR]: Use
2150 concept_definition_p.
2151 (push_access_scope, pop_access_scope): No longer static.
2152 (tsubst_template_parm): Substitute TEMPLATE_PARM_CONSTRAINTS.
2153 (tsubst_friend_function): Use tsubst_constraint. Use generic_targs_for.
2154 (get_underlying_template) Use generic_targs_for.
2155 (uses_parameter_packs): Return tree.
2156 (gen_elem_of_pack_expansion_instantiation): Don't push
2157 local_specialization_stack.
2158 (prepend_one_capture): New.
2159 (tsubst_lambda_expr): Use prepend_one_capture. Don't touch
2160 local_specializations.
2161 (template_parms_level_to_args): No longer static.
2162 (add_outermost_template_args): Likewise.
2163 (find_template_parameter_info): New. Provide context for finding
2164 template parameters.
2165 (keep_template_parm): Don't keep parameters declared at depth levels
2166 greater than those of the template parameters of the source declaration.
2167 Don't propagate cv-qualified types. Return 0, so we find all template
2168 parameters, not the just first.
2169 (any_template_parm_r): New. Handle cases that are mishandled by
2170 for_each_template_parm_r.
2171 (generic_targs_for): Factor out of coerce_template_args_for_ttp.
2172 (tsubst_argument_pack): Factor out of tsubst_template_args.
2173 (constraint_sat_entry): Removed.
2174 (constraint_sat_hasher): Removed.
2175 (concept_spec_entry): Removed.
2176 (concept_spec_hasher): Removed.
2177 (constraint_memos): Removed.
2178 (concept_memos): Removed.
2179 (lookup_constraint_satisfaction): Removed.
2180 (memoize_constraint_satisfaction): Removed.
2181 (lookup_concept_satisfaction): Removed.
2182 (memoize_concept_satisfaction): Removed.
2183 (concept_expansions): Removed.
2184 (get_concept_expansion): Removed.
2185 (save_concept_expansion): Removed.
2186 (init_constraint_processing): Remove initialization of non-existing
2188 (find_template_requirement): New. Search for the sub-requirement
2189 within the associated constraints.
2190 (convert_generic_types_to_packs): Also transform the associated
2191 constraint and update the current template requirements.
2192 (store_defaulted_ttp, lookup_defaulted_ttp): Remove.
2193 (add_defaults_to_ttp): Use hash_map_safe_*.
2194 * semantics.c (finish_call_expr): Diagnose calls to concepts.
2195 Handle concept checks explicitly.
2196 (finish_id_expression): Evaluate variable concepts as part of
2197 id-expression processing. Don't treat variable concepts as variables,
2198 and don't process function concepts as plain id-expressions.
2199 (force_paren_expr): Add even_uneval parm.
2200 (finish_trait_expr): Add location parm.
2201 * tree.c (special_memfn_p): New.
2202 (cp_expr_location): Handle TRAIT_EXPR.
2203 * typeck.c (check_return_expr): Actually use the diagnostic kind
2204 when performing return-type deduction.
2205 * typeck2.c (build_functional_cast): Don't rely on the location of
2208 2019-10-09 Paolo Carlini <paolo.carlini@oracle.com>
2210 * decl.c (grok_ctor_properties): Use DECL_SOURCE_LOCATION.
2211 * typeck.c (cp_build_binary_op): Use the op_location_t argument
2212 in many error messages.
2214 2019-10-08 Martin Sebor <msebor@redhat.com>
2217 * call.c (maybe_warn_class_memaccess): Handle arrays.
2219 2019-10-07 Paolo Carlini <paolo.carlini@oracle.com>
2221 * call.c (resolve_args): Use cp_expr_loc_or_input_loc in one place.
2222 * decl.c (grokdeclarator): Use id_loc in one place.
2223 * decl2.c (build_anon_union_vars): Use DECL_SOURCE_LOCATION.
2224 * parser.c (cp_parser_delete_expression): Fix the location of the
2225 returned expression.
2226 (cp_parser_throw_expression): Likewise.
2227 * pt.c (determine_specialization): Use DECL_SOURCE_LOCATION.
2229 2019-10-05 Jakub Jelinek <jakub@redhat.com>
2231 PR c++/91369 - Implement P0784R7: constexpr new
2232 * cp-tree.h (enum cp_tree_index): Add CPTI_HEAP_UNINIT_IDENTIFIER,
2233 CPTI_HEAP_IDENTIFIER and CPTI_HEAP_DELETED_IDENTIFIER.
2234 (heap_uninit_identifier, heap_identifier, heap_deleted_identifier):
2236 (type_has_constexpr_destructor, build_new_constexpr_heap_type,
2237 cxx_constant_dtor): Declare.
2238 * class.c (type_maybe_constexpr_default_constructor): Make static.
2239 (type_maybe_constexpr_destructor, type_has_constexpr_destructor): New
2241 (finalize_literal_type_property): For c++2a, don't clear
2242 CLASSTYPE_LITERAL_P for types without trivial destructors unless they
2243 have non-constexpr destructors.
2244 (explain_non_literal_class): For c++2a, complain about non-constexpr
2245 destructors rather than about non-trivial destructors.
2246 * constexpr.c: Include stor-layout.h.
2247 (struct constexpr_global_ctx): New type.
2248 (struct constexpr_ctx): Add global field, remove values and
2249 constexpr_ops_count.
2250 (cxx_replaceable_global_alloc_fn): New inline function.
2251 (cxx_eval_call_expression): For c++2a allow calls to replaceable
2252 global allocation functions, for new return address of a heap uninit
2253 var, for delete record its deletion. Change ctx->values->{get,put} to
2254 ctx->global->values.{get,put}.
2255 (non_const_var_error): Add auto_diagnostic_group sentinel. Emit
2256 special diagnostics for heap variables.
2257 (cxx_eval_store_expression): Change ctx->values->{get,put} to
2258 ctx->global->values.{get,put}.
2259 (cxx_eval_loop_expr): Initialize jump_target if NULL. Change
2260 new_ctx.values->remove to ctx->global->values.remove.
2261 (cxx_eval_constant_expression): Change *ctx->constexpr_ops_count
2262 to ctx->global->constexpr_ops_count. Change ctx->values->{get,put} to
2263 ctx->global->values.{get,put}.
2264 <case NOP_EXPR>: Formatting fix. On cast of replaceable global
2265 allocation function to some pointer type, adjust the type of
2266 the heap variable and change name from heap_uninit_identifier
2268 (find_heap_var_refs): New function.
2269 (cxx_eval_outermost_constant_expr): Add constexpr_dtor argument,
2270 handle evaluation of constexpr dtors and add tracking of heap
2271 variables. Use tf_no_cleanup for get_target_expr_with_sfinae.
2272 (cxx_constant_value): Adjust cxx_eval_outermost_constant_expr caller.
2273 (cxx_constant_dtor): New function.
2274 (maybe_constant_value, fold_non_dependent_expr_template,
2275 maybe_constant_init_1): Adjust cxx_eval_outermost_constant_expr
2277 (potential_constant_expression_1): Ignore clobbers. Allow
2278 COND_EXPR_IS_VEC_DELETE for c++2a.
2279 * decl.c (initialize_predefined_identifiers): Add heap identifiers.
2280 (decl_maybe_constant_destruction): New function.
2281 (cp_finish_decl): Don't clear TREE_READONLY for constexpr variables
2282 with non-trivial, but constexpr destructors.
2283 (register_dtor_fn): For constexpr variables with constexpr non-trivial
2284 destructors call cxx_maybe_build_cleanup instead of adding destructor
2286 (expand_static_init): For constexpr variables with constexpr
2287 non-trivial destructors call cxx_maybe_build_cleanup.
2288 (grokdeclarator): Allow constexpr destructors for c++2a. Formatting
2290 (cxx_maybe_build_cleanup): For constexpr variables with constexpr
2291 non-trivial destructors call cxx_constant_dtor instead of adding
2292 destructor calls at runtime.
2293 * init.c: Include stor-layout.h.
2294 (build_new_constexpr_heap_type, maybe_wrap_new_for_constexpr): New
2296 (build_new_1): For c++2a and new[], add cast around the alloc call
2297 to help constexpr evaluation figure out the type of the heap storage.
2298 (build_vec_delete_1): Set DECL_INITIAL of tbase and emit a DECL_EXPR
2299 for it instead of initializing an uninitialized variable.
2300 * method.c: Include intl.h.
2301 (SFK_CTOR_P, SFK_DTOR_P, SFK_ASSIGN_P, SFK_COPY_P, SFK_MOVE_P): Move
2302 definitions earlier.
2303 (process_subob_fn): Add sfk argument, adjust non-constexpr call
2304 diagnostics based on it.
2305 (walk_field_subobs): Formatting fixes. Adjust process_subob_fn caller.
2306 (synthesized_method_base_walk): Likewise.
2307 (synthesized_method_walk): Set *constexpr_p to true for dtors in c++2a.
2308 Fix up DR number in comment.
2309 (implicitly_declare_fn): Formatting fix.
2310 * typeck2.c (store_init_value): Don't call cp_fully_fold_init on
2311 initializers of automatic non-constexpr variables in constexpr
2314 2019-10-04 Jakub Jelinek <jakub@redhat.com>
2317 * constexpr.c (cxx_fold_indirect_ref_1): New function.
2318 (cxx_fold_indirect_ref): Use it.
2321 * cp-gimplify.c (cp_gimplify_expr) <case CALL_EXPR>: For
2322 -fstrong-eval-order ensure CALL_EXPR_FN side-effects are evaluated
2323 before any arguments. Additionally, ensure CALL_EXPR_FN that isn't
2324 invariant nor OBJ_TYPE_REF nor SSA_NAME is forced into a temporary.
2326 2019-10-03 Paolo Carlini <paolo.carlini@oracle.com>
2328 * init.c (build_new): Use cp_expr_loc_or_input_loc in two places.
2329 * name-lookup.c (do_pushdecl): Use DECL_SOURCE_LOCATION.
2330 (push_class_level_binding_1): Likewise.
2331 (set_decl_namespace): Likewise.
2333 2019-10-03 Jakub Jelinek <jakub@redhat.com>
2335 * constexpr.c (cxx_eval_constant_expression) <case CLEANUP_STMT>: If
2336 not skipping upon entry to body, run cleanup with the same *jump_target
2337 as it started to run the cleanup even if the body returns, breaks or
2339 (potential_constant_expression_1): Allow CLEANUP_STMT.
2341 * constexpr.c (cxx_eval_store_expression): Formatting fix. Handle
2342 const_object_being_modified with array type.
2344 2019-10-02 Jason Merrill <jason@redhat.com>
2346 * typeck2.c (store_init_value): Only clear_cv_and_fold_caches if the
2349 2019-09-30 Jason Merrill <jason@redhat.com>
2351 Use hash_map_safe_* functions.
2352 * constexpr.c (maybe_initialize_fundef_copies_table): Remove.
2353 (get_fundef_copy): Use hash_map_safe_get_or_insert.
2354 * cp-objcp-common.c (cp_get_debug_type): Use hash_map_safe_*.
2355 * decl.c (store_decomp_type): Remove.
2356 (cp_finish_decomp): Use hash_map_safe_put.
2357 * init.c (get_nsdmi): Use hash_map_safe_*.
2358 * pt.c (store_defaulted_ttp, lookup_defaulted_ttp): Remove.
2359 (add_defaults_to_ttp): Use hash_map_safe_*.
2361 2019-10-02 Richard Biener <rguenther@suse.de>
2364 * decl.c (build_ptrmemfunc_type): Mark pointer-to-member
2365 fat pointer structure members as DECL_NONADDRESSABLE_P.
2367 2019-09-28 Marek Polacek <polacek@redhat.com>
2369 PR c++/91889 - follow-up fix for DR 2352.
2370 * call.c (involves_qualification_conversion_p): New function.
2371 (direct_reference_binding): Build a ck_qual if the conversion
2372 would involve a qualification conversion.
2373 (convert_like_real): Strip the conversion created by the ck_qual
2374 in direct_reference_binding.
2376 PR c++/91921 - stray warning with -Woverloaded-virtual.
2377 * class.c (warn_hidden): Only emit the second part of
2378 -Woverloaded-virtual if the first part was issued. Use inform instead
2381 PR c++/91923 - failure-to-SFINAE with class type NTTP in C++17.
2382 * pt.c (invalid_nontype_parm_type_p): Only emit errors when
2385 2019-09-27 Jakub Jelinek <jakub@redhat.com>
2388 * parser.c (cp_parser_omp_var_list_no_open): Parse predefined
2390 * semantics.c (finish_omp_clauses): Allow predefined variables in
2391 shared and firstprivate clauses, even when they are predetermined
2393 * cp-gimplify.c (cxx_omp_predetermined_sharing_1): Return
2394 OMP_CLAUSE_DEFAULT_SHARED for predefined variables.
2396 2019-09-27 Jason Merrill <jason@redhat.com>
2398 * constexpr.c (cxx_fold_indirect_ref): Use similar_type_p.
2399 (cxx_eval_indirect_ref): Likewise. Improve error location.
2401 * cp-tree.h (class iloc_sentinel): New.
2402 * decl.c (grokdeclarator, finish_enum_value_list): Use it.
2403 * mangle.c (mangle_decl_string): Use it.
2404 * pt.c (perform_typedefs_access_check): Use it.
2406 2019-09-27 Richard Sandiford <richard.sandiford@arm.com>
2408 * cp-tree.h (build_cxx_call): Take the original function decl
2409 as an optional final parameter.
2410 (cp_build_function_call_vec): Likewise.
2411 * call.c (build_cxx_call): Likewise. Pass all built-in calls to
2412 check_builtin_function_arguments.
2413 * typeck.c (build_function_call_vec): Take the original function
2414 decl as an optional final parameter and pass it to
2415 cp_build_function_call_vec.
2416 (cp_build_function_call_vec): Take the original function
2417 decl as an optional final parameter and pass it to build_cxx_call.
2419 2019-09-25 Marek Polacek <polacek@redhat.com>
2421 PR c++/91877 - ICE with converting member of packed struct.
2422 * call.c (convert_like_real): Use similar_type_p in an assert.
2424 2019-09-25 Paolo Carlini <paolo.carlini@oracle.com>
2426 * name-lookup.c (check_extern_c_conflict): Use DECL_SOURCE_LOCATION.
2427 (check_local_shadow): Use it in three additional places.
2429 2019-09-24 Jason Merrill <jason@redhat.com>
2431 * parser.c (cp_parser_postfix_expression): Do set location of
2432 dependent member call.
2434 2019-09-24 Marek Polacek <polacek@redhat.com>
2436 PR c++/91868 - improve -Wshadow location.
2437 * name-lookup.c (check_local_shadow): Use DECL_SOURCE_LOCATION
2438 instead of input_location.
2440 PR c++/91845 - ICE with invalid pointer-to-member.
2441 * expr.c (mark_use): Use error_operand_p.
2442 * typeck2.c (build_m_component_ref): Check error_operand_p after
2443 calling mark_[lr]value_use.
2445 2019-09-23 Paolo Carlini <paolo.carlini@oracle.com>
2447 * pt.c (check_explicit_specialization): Use cp_expr_loc_or_input_loc.
2448 (process_partial_specialization): Likewise.
2449 (convert_nontype_argument_function): Likewise.
2450 (invalid_tparm_referent_p): Likewise.
2451 (convert_template_argument): Likewise.
2452 (check_valid_ptrmem_cst_expr): Tidy.
2454 2019-09-23 Jason Merrill <jason@redhat.com>
2456 PR c++/91809 - bit-field and ellipsis.
2457 * call.c (convert_arg_to_ellipsis): Don't call decay_conversion for
2458 arithmetic arguments.
2460 2019-09-23 Marek Polacek <polacek@redhat.com>
2462 PR c++/91844 - Implement CWG 2352, Similar types and reference binding.
2463 * call.c (reference_related_p): Use similar_type_p instead of
2465 (reference_compatible_p): Update implementation to match CWG 2352.
2466 * cp-tree.h (similar_type_p): Declare.
2467 * typeck.c (similar_type_p): New.
2469 2019-09-22 Marek Polacek <polacek@redhat.com>
2471 PR c++/91819 - ICE with operator++ and enum.
2472 * call.c (build_new_op_1): Set arg2_type.
2474 2019-09-17 Jason Merrill <jason@redhat.com>
2476 * parser.c (cp_parser_statement): Handle [[likely]] on
2479 2019-09-19 Jason Merrill <jason@redhat.com>
2482 * call.c (build_new_op_1): Don't apply any standard conversions to
2483 the operands of a built-in operator. Don't suppress conversions in
2485 * typeck.c (cp_build_unary_op): Do integral promotions for enums.
2487 2019-09-16 Paolo Carlini <paolo.carlini@oracle.com>
2489 * decl.c (grokdeclarator): Use declspecs->locations and
2490 declarator->id_loc in a few error messages.
2491 * pt.c (finish_member_template_decl): Use DECL_SOURCE_LOCATION.
2492 (push_template_decl_real): Likewise.
2494 2019-09-15 Jason Merrill <jason@redhat.com>
2496 PR c++/30277 - int-width bit-field promotion.
2497 PR c++/33819 - long bit-field promotion.
2498 * typeck.c (cp_perform_integral_promotions): Handle large bit-fields
2499 properly. Handle 32-bit non-int bit-fields properly.
2500 (is_bitfield_expr_with_lowered_type): Don't look through NOP_EXPR.
2502 PR c++/82165 - enum bitfields and operator overloading.
2503 * call.c (build_new_op_1): Use unlowered_expr_type.
2505 * call.c (build_new_op_1): Don't apply any standard conversions to
2506 the operands of a built-in operator. Don't suppress conversions in
2508 * typeck.c (cp_build_unary_op): Do integral promotions for enums.
2510 2019-09-15 Marek Polacek <polacek@redhat.com>
2512 PR c++/91740 - ICE with constexpr call and ?: in ARRAY_REF.
2513 * pt.c (build_non_dependent_expr): Call build_non_dependent_expr for
2516 2019-09-15 Nathan Sidwell <nathan@acm.org>
2518 * cp-tree.h (DECL_CLONED_FUNCTION_P): Reimplement using
2519 IDENTIFIER_CDTOR_P, correct documentation.
2520 (DECL_CLONED_FUNCTION): Directly access field.
2521 (decl_cloned_function_p): Delete.
2522 * class.c (decl_cloned_function_p): Delete.
2523 * pt.c (instantiate_template_1): Check DECL_CHAIN is a decl.
2525 2019-09-11 Nathan Sidwell <nathan@acm.org>
2527 * c-objcp-common.c (cp-objcp-common.c): Alphababetize and
2528 correctly mark all C++ nodes.
2529 * decl.c (cp_tree_node_structure): Alphabetize.
2531 2019-09-10 Marek Polacek <polacek@redhat.com>
2533 PR c++/91673 - ICE with noexcept in alias-declaration.
2534 * parser.c (CP_PARSER_FLAGS_DELAY_NOEXCEPT): New parser flag.
2535 (cp_parser_lambda_declarator_opt): Pass CP_PARSER_FLAGS_NONE to
2536 cp_parser_exception_specification_opt.
2537 (cp_parser_direct_declarator): Adjust a call to
2538 cp_parser_exception_specification_opt.
2539 (cp_parser_member_declaration): Pass CP_PARSER_FLAGS_DELAY_NOEXCEPT
2540 to cp_parser_declarator if not processing a friend or typedef
2542 (cp_parser_late_noexcept_specifier): Adjust a call to
2543 cp_parser_noexcept_specification_opt.
2544 (cp_parser_noexcept_specification_opt): New parameter for parser flags,
2545 drop the FRIEND_P parameter. Use the new parameter.
2546 (cp_parser_exception_specification_opt): Likewise.
2547 (cp_parser_transaction): Adjust a call to
2548 cp_parser_noexcept_specification_opt.
2549 (cp_parser_transaction_expression): Likewise.
2551 2019-09-10 Marek Polacek <polacek@redhat.com>
2553 PR c++/91705 - constexpr evaluation rejects ++/-- on floats.
2554 * constexpr.c (cxx_eval_increment_expression): Call fold_simple on
2557 2019-09-10 Paolo Carlini <paolo.carlini@oracle.com>
2559 * decl.c (has_designator_problem): Use cp_expr_loc_or_input_loc
2561 (build_enumerator): Likewise.
2562 (cp_finish_decl): Use DECL_SOURCE_LOCATION.
2563 (grokdeclarator): Use id_loc in two error_at; change errror
2564 message about constinit together constexpr to use two ranges.
2566 2019-09-09 Marek Polacek <polacek@redhat.com>
2568 PR c++/84374 - diagnose invalid uses of decltype(auto).
2569 * decl.c (grokdeclarator): Diagnose wrong usage of decltype(auto) in
2570 a function declaration.
2572 2019-09-06 Nathan Sidwell <nathan@acm.org>
2575 * cp-tree.h (IDENTIFIER_REPO_CHOSEN, DECL_REPO_AVAILABLE_P): Delete.
2576 (struct lang_decl_base): Remove repo_available_p.
2577 * decl.c (duplicate_decls): Don't copy DECL_REPO_AVAILABLE_P.
2579 (Reserve TREE_LANG_FLAG_3 for modules.
2580 * cp-tree.h (DECL_CONSTRUCTION_VTABLE_P): Delete.
2581 (DECL_NON_TRIVIALLY_INITIALIZED_P): Move to TREE_LANG_FLAG_6.
2582 * class.c (build_ctor_vtbl_group): Don't set
2583 DECL_CONSTRUCTION_VTABLE_P.
2584 * decl2.c (determine_visibility_from_class): Don't check
2585 DECL_CONSTRUCTION_VTABLE_P anymore.
2587 2019-09-06 Martin Liska <mliska@suse.cz>
2590 * Make-lang.in: Remove repo.o.
2591 * config-lang.in: Likewise.
2592 * cp-tree.h (init_repo): Remove declarations
2593 of repo-related functions.
2594 (repo_emit_p): Likewise.
2595 (repo_export_class_p): Likewise.
2596 (finish_repo): Likewise.
2597 * decl2.c (import_export_class): Always
2599 (mark_needed): Remove -frepo from comment.
2600 (import_export_decl): Similarly here.
2601 (c_parse_final_cleanups): Remove call of finish_repo.
2602 * lex.c (cxx_init): Remove call to init_repo.
2603 * optimize.c (can_alias_cdtor): Remove dead condition.
2604 * pt.c (push_template_decl_real): Update comment.
2605 (instantiate_decl): Remove dead code used for -frepo.
2608 2019-09-05 Marek Polacek <polacek@redhat.com>
2610 PR c++/91644 - ICE with constinit in function template.
2611 * decl.c (start_decl): Call retrofit_lang_decl for constinit variables.
2612 * pt.c (tsubst_expr): Pass LOOKUP_CONSTINIT down to cp_finish_decl for
2613 constinit variables.
2615 2019-09-05 Nathan Sidwell <nathan@acm.org>
2617 * cp-tree.h (DECL_VTABLE_OR_VTT_P): Forward to DECL_VIRTUAL_P.
2619 2019-09-04 Marek Polacek <polacek@redhat.com>
2621 * call.c (build_over_call): Remove -fdeduce-init-list implementation.
2622 * pt.c (unify): Likewise.
2624 2019-09-01 Marek Polacek <polacek@redhat.com>
2626 PR c++/91129 - wrong error with binary op in template argument.
2627 * typeck.c (warn_for_null_address): Use fold_for_warn instead of
2628 fold_non_dependent_expr.
2629 (cp_build_binary_op): Likewise.
2631 2019-08-30 Jason Merrill <jason@redhat.com>
2633 Add source location to TRAIT_EXPR.
2634 * cp-tree.h (TRAIT_EXPR_LOCATION): New.
2635 (struct tree_trait_expr): Add locus field.
2636 * parser.c (cp_parser_trait_expr): Pass trait_loc down.
2637 * pt.c (tsubst_copy_and_build) [TRAIT_EXPR]: Likewise.
2638 * semantics.c (finish_trait_expr): Add location parm.
2639 * tree.c (cp_expr_location): Handle TRAIT_EXPR.
2641 2019-08-29 Paolo Carlini <paolo.carlini@oracle.com>
2643 * decl.c (check_var_type): Add location_t parameter and use it.
2644 (grokdeclarator): Adjust call.
2645 * pt.c (tsubst_decl): Likewise.
2646 * cp-tree.h: Adjust declaration.
2648 2019-08-28 Marek Polacek <polacek@redhat.com>
2650 Implement P1152R4: Deprecating some uses of volatile.
2652 * cp-gimplify.c (cp_fold): Set TREE_THIS_VOLATILE.
2653 * decl.c (grokdeclarator): Warn about a volatile-qualified structured
2654 binding and return type.
2655 (grokparms): Warn about a volatile-qualified function parameter.
2656 * expr.c (mark_use) <case MODIFY_EXPR>: Emit a -Wvolatile warning.
2657 * typeck.c (cp_build_unary_op): Emit a -Wvolatile warning for pre and
2658 post ++/-- on a volatile operand.
2659 (genericize_compound_lvalue): Use a better location. Don't lose
2661 (cp_build_modify_expr): Emit a -Wvolatile warning for a compound
2662 assignment whose LHS is volatile-qualified. Build the assignment with
2663 a more precise location.
2665 2019-08-28 Marek Polacek <polacek@redhat.com>
2667 PR c++/91360 - Implement C++20 P1143R2: constinit.
2668 * cp-tree.h (TINFO_VAR_DECLARED_CONSTINIT): Define.
2669 (LOOKUP_CONSTINIT): Define.
2670 (enum cp_decl_spec): Add ds_constinit.
2671 * decl.c (check_tag_decl): Give an error for constinit in type
2673 (check_initializer): Also check LOOKUP_CONSTINIT.
2674 (cp_finish_decl): Add checking for a constinit declaration. Set
2675 TINFO_VAR_DECLARED_CONSTINIT.
2676 (grokdeclarator): Add checking for a declaration with the constinit
2678 * lex.c (init_reswords): Handle D_CXX20.
2679 * parser.c (cp_lexer_get_preprocessor_token): Pass a better location
2680 to warning_at. Warn about C++20 keywords.
2681 (cp_keyword_starts_decl_specifier_p): Handle RID_CONSTINIT.
2682 (cp_parser_diagnose_invalid_type_name): Add an inform about constinit.
2683 (cp_parser_decomposition_declaration): Maybe pass LOOKUP_CONSTINIT to
2685 (cp_parser_decl_specifier_seq): Handle RID_CONSTINIT.
2686 (cp_parser_init_declarator): Maybe pass LOOKUP_CONSTINIT to
2688 (set_and_check_decl_spec_loc): Add "constinit".
2689 * pt.c (tsubst_decl): Set TINFO_VAR_DECLARED_CONSTINIT.
2690 (instantiate_decl): Maybe pass LOOKUP_CONSTINIT to cp_finish_decl.
2691 * typeck2.c (store_init_value): If a constinit variable wasn't
2692 initialized using a constant initializer, give an error.
2694 2019-08-28 Nathan Sidwell <nathan@acm.org>
2697 * name-lookup.c (cp_emit_debug_info): Check for builtins during
2700 2019-08-27 Marek Polacek <polacek@redhat.com>
2702 PR c++/81676 - bogus -Wunused warnings in constexpr if.
2703 * semantics.c (maybe_mark_exp_read_r): New function.
2704 (finish_if_stmt): Call it on THEN_CLAUSE and ELSE_CLAUSE.
2706 PR c++/91428 - warn about std::is_constant_evaluated in if constexpr.
2707 * cp-tree.h (decl_in_std_namespace_p): Declare.
2708 * semantics.c (is_std_constant_evaluated_p): New.
2709 (finish_if_stmt_cond): Warn about "std::is_constant_evaluated ()" in
2711 * typeck.c (decl_in_std_namespace_p): No longer static.
2713 2019-08-26 Jason Merrill <jason@redhat.com>
2715 * decl.c (duplicate_decls): Always merge DECL_DECLARED_CONSTEXPR_P.
2717 2019-08-26 Marek Polacek <polacek@redhat.com>
2719 PR c++/91545 - ICE in constexpr store evaluation.
2720 * constexpr.c (cxx_eval_store_expression): Check FIELD_DECL instead
2723 2019-08-24 Nathan Sidwell <nathan@acm.org>
2725 * class.c (check_for_overrides): Conversion operators need
2728 2019-08-24 Paolo Carlini <paolo.carlini@oracle.com>
2730 * semantics.c (finish_switch_cond): Improve error message location.
2732 2019-08-23 Jason Merrill <jason@redhat.com>
2734 * decl2.c (decl_dependent_p): New.
2735 (mark_used): Check it instead of just processing_template_decl.
2737 2019-08-23 Jason Merrill <jason@redhat.com>
2739 * parser.c (cp_parser_nested_name_specifier_opt): Avoid redundant
2742 2019-08-23 Marek Polacek <polacek@redhat.com>
2744 PR c++/91521 - wrong error with operator->.
2745 * decl.c (grokdeclarator): Return error_mark_node for an invalid
2746 trailing return type.
2748 PR c++/79817 - attribute deprecated on namespace.
2749 * cp-tree.h (cp_warn_deprecated_use_scopes): Declare.
2750 * decl.c (grokdeclarator): Call cp_warn_deprecated_use_scopes.
2751 (type_is_deprecated): Likewise.
2752 * decl2.c (cp_warn_deprecated_use_scopes): New function.
2753 * name-lookup.c (handle_namespace_attrs): Handle attribute deprecated.
2754 * parser.c (cp_parser_namespace_alias_definition): Call
2755 cp_warn_deprecated_use_scopes.
2756 (cp_parser_using_declaration): Likewise.
2757 (cp_parser_using_directive): Likewise.
2758 * semantics.c (finish_id_expression_1): Likewise.
2760 2019-08-23 Nathan Sidwell <nathan@acm.org>
2762 * class.c (check_for_override): Checking IDENTIFIER_VIRTUAL_P is
2763 sufficient, reorder DECL_OVERRIDE_P check.
2765 2019-08-23 Iain Sandoe <iain@sandoe.co.uk>
2768 * parser.c (cp_parser_initial_pragma): Call c_common_no_more_pch ()
2769 after determining that the first token is not
2770 PRAGMA_GCC_PCH_PREPROCESS.
2772 2019-08-22 Marek Polacek <polacek@redhat.com>
2774 PR c++/91304 - prefix attributes ignored in condition.
2775 * parser.c (cp_parser_condition): Handle prefix attributes.
2777 2019-08-21 Richard Sandiford <richard.sandiford@arm.com>
2780 * decl.c (duplicate_decls): Call copy_attributes_to_builtin inside
2781 the BUILT_IN_NORMAL block rather than afterward.
2783 2019-08-19 Marek Polacek <polacek@redhat.com>
2785 PR c++/91264 - detect modifying const objects in constexpr.
2786 * constexpr.c (modifying_const_object_error): New function.
2787 (cxx_eval_call_expression): Set TREE_READONLY on a CONSTRUCTOR of
2788 a const-qualified object after it's been fully constructed.
2789 (modifying_const_object_p): New function.
2790 (cxx_eval_store_expression): Detect modifying a const object
2791 during constant expression evaluation.
2792 (cxx_eval_increment_expression): Use a better location when building
2794 (cxx_eval_constant_expression) <case DECL_EXPR>: Mark a constant
2795 object's constructor TREE_READONLY.
2797 2019-08-15 Jason Merrill <jason@redhat.com>
2799 PR c++/90393 - ICE with thow in ?:
2801 PR c++/64372, DR 1560 - Gratuitous lvalue-to-rvalue conversion in ?:
2802 * tree.c (lvalue_kind): Handle throw in one arm.
2803 * typeck.c (rationalize_conditional_expr): Likewise.
2804 (cp_build_modify_expr): Likewise.
2806 2019-08-14 Jason Merrill <jason@redhat.com>
2808 Implement P0848R3, Conditionally Trivial Special Member Functions.
2809 * tree.c (special_memfn_p): New.
2810 * class.c (add_method): When overloading, hide ineligible special
2812 (check_methods): Set TYPE_HAS_COMPLEX_* here.
2813 * decl.c (grok_special_member_properties): Not here.
2814 * name-lookup.c (push_class_level_binding_1): Move overloaded
2815 functions case down, accept FUNCTION_DECL as target_decl.
2817 2019-08-14 Jonathan Wakely <jwakely@redhat.com>
2820 * name-lookup.c (get_std_name_hint): Fix min_dialect field for
2821 complex_literals and make_unique entries.
2823 2019-08-14 Jakub Jelinek <jakub@redhat.com>
2824 Marek Polacek <polacek@redhat.com>
2826 PR c++/91391 - bogus -Wcomma-subscript warning.
2827 * parser.c (cp_parser_postfix_open_square_expression): Don't warn about
2828 a deprecated comma here. Pass warn_comma_subscript down to
2829 cp_parser_expression.
2830 (cp_parser_expression): New bool parameter. Warn about uses of a comma
2831 operator within a subscripting expression.
2832 (cp_parser_skip_to_closing_square_bracket): Revert to pre-r274121 state.
2833 (cp_parser_skip_to_closing_square_bracket_1): Remove.
2835 2019-08-14 Jonathan Wakely <jwakely@redhat.com>
2837 * name-lookup.c (get_std_name_hint): Add more entries.
2839 2019-08-14 Paolo Carlini <paolo.carlini@oracle.com>
2841 * decl2.c (grok_array_decl): Use the location of the open square
2842 bracket in error message about invalid types.
2844 2019-08-14 Paolo Carlini <paolo.carlini@oracle.com>
2846 * decl.c (grokdeclarator): Check here for typedef a function
2847 definition or a member function definition.
2848 (start_function): Adjust.
2849 (grokmethod): Likewise.
2851 2019-08-13 Richard Sandiford <richard.sandiford@arm.com>
2854 * decl.c (duplicate_decls): Use copy_decl_built_in_function.
2855 * pt.c (declare_integer_pack): Use set_decl_built_in_function.
2857 2019-08-13 Marek Polacek <polacek@redhat.com>
2859 PR c++/90473 - wrong code with nullptr in default argument.
2860 * call.c (null_ptr_cst_p): Update quote from the standard.
2861 * decl.c (check_default_argument): Don't return nullptr when the arg
2864 2019-08-13 Marek Polacek <polacek@redhat.com>
2866 * cp-tree.h (DECL_MUTABLE_P): Use FIELD_DECL_CHECK.
2868 2019-08-10 Jakub Jelinek <jakub@redhat.com>
2870 * parser.c (cp_parser_omp_clause_name): Parse device_type.
2871 (cp_parser_omp_clause_device_type): New function.
2872 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_DEVICE_TYPE.
2873 (OMP_DECLARE_TARGET_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_DEVICE_TYPE.
2874 (cp_parser_omp_declare_target): Handle device_type clauses. Remove
2875 diagnostics for declare target with clauses nested in clause-less
2876 declare target declaration-definition-seq.
2877 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_DEVICE_TYPE.
2879 2019-08-09 Jakub Jelinek <jakub@redhat.com>
2881 * parser.c (check_no_duplicate_clause): Simplify using
2883 (cp_parser_omp_clause_if): Fix up printing of target {enter,exit} data
2884 directive name modifiers.
2887 * parser.c (cp_parser_omp_clause_dist_schedule): Comment out the
2888 check_no_duplicate_clause call, instead emit a warning for duplicate
2889 dist_schedule clauses.
2891 2019-08-08 Paolo Carlini <paolo.carlini@oracle.com>
2893 * decl.c (grokdeclarator): Use id_loc and EXPR_LOCATION in
2894 a few error messages.
2896 2019-08-08 Marek Polacek <polacek@redhat.com>
2898 PR c++/87519 - bogus warning with -Wsign-conversion.
2899 * typeck.c (cp_build_binary_op): Use same_type_p instead of comparing
2902 * constexpr.c (inline_asm_in_constexpr_error): New.
2903 (cxx_eval_constant_expression) <case ASM_EXPR>: Call it.
2904 (potential_constant_expression_1) <case ASM_EXPR>: Likewise.
2906 2019-08-08 Jakub Jelinek <jakub@redhat.com>
2908 * semantics.c (finish_omp_clauses): For C_ORT_OMP
2909 OMP_CLAUSE_USE_DEVICE_* clauses use oacc_reduction_head bitmap
2910 instead of generic_head to track duplicates.
2912 2019-08-07 Marek Polacek <polacek@redhat.com>
2914 PR c++/81429 - wrong parsing of constructor with C++11 attribute.
2915 * parser.c (cp_parser_constructor_declarator_p): Handle the scenario
2916 when a parameter declaration begins with [[attribute]].
2918 2019-08-07 Marek Polacek <polacek@redhat.com>
2920 PR c++/91346 - Implement P1668R1, allow unevaluated asm in constexpr.
2921 * constexpr.c (cxx_eval_constant_expression): Handle ASM_EXPR.
2922 (potential_constant_expression_1) <case ASM_EXPR>: Allow.
2923 * cp-tree.h (finish_asm_stmt): Adjust.
2924 * parser.c (cp_parser_asm_definition): Grab the locaion of "asm" and
2925 use it. Change an error to a pedwarn. Allow asm in C++2a, warn
2927 * pt.c (tsubst_expr): Pass a location down to finish_asm_stmt.
2928 * semantics.c (finish_asm_stmt): New location_t parameter. Use it.
2930 2019-08-07 Jakub Jelinek <jakub@redhat.com>
2932 * parser.c (cp_parser_omp_clause_name): Parse use_device_addr clause.
2933 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR.
2934 (OMP_TARGET_DATA_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR.
2935 (cp_parser_omp_target_data): Handle PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR
2936 like PRAGMA_OMP_CLAUSE_USE_DEVICE_PTR, adjust diagnostics about no
2937 map or use_device_* clauses.
2938 * semantics.c (finish_omp_clauses): For OMP_CLAUSE_USE_DEVICE_PTR
2939 in OpenMP, require pointer or reference to pointer type rather than
2940 pointer or array or reference to pointer or array type. Handle
2941 OMP_CLAUSE_USE_DEVICE_ADDR.
2942 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_USE_DEVICE_ADDR.
2944 2019-08-06 Jason Merrill <jason@redhat.com>
2946 PR c++/91378 - ICE with noexcept and auto return type.
2947 * pt.c (maybe_instantiate_noexcept): push_to_top_level.
2949 2019-08-06 Paolo Carlini <paolo.carlini@oracle.com>
2951 * decl.c (check_array_designated_initializer): Use
2952 cp_expr_loc_or_input_loc in one place.
2954 2019-08-06 Jakub Jelinek <jakub@redhat.com>
2956 * parser.c (cp_parser_omp_for_loop): For OMP_LOOP, ignore parallel
2957 clauses and predetermine iterator as lastprivate.
2958 * semantics.c (handle_omp_for_class_iterator): Use
2959 OMP_CLAUSE_LASTPRIVATE_LOOP_IV instead of
2960 OMP_CLAUSE_LASTPRIVATE_TASKLOOP_IV, set it for lastprivate also
2961 on OMP_LOOP construct. If a clause is missing for class iterator
2962 on OMP_LOOP, add firstprivate clause, and if there is private
2963 clause, turn it into firstprivate too.
2964 (finish_omp_for): Formatting fix. For OMP_LOOP, adjust
2965 OMP_CLAUSE_LASTPRIVATE_LOOP_IV clause CP_CLAUSE_INFO, so that it
2966 uses copy ctor instead of default ctor.
2967 * cp-gimplify.c (cp_gimplify_expr): Handle OMP_LOOP like
2969 (cp_fold_r): Likewise.
2970 (cp_genericize_r): Likewise.
2971 (cxx_omp_finish_clause): Also finish lastprivate clause with
2972 OMP_CLAUSE_LASTPRIVATE_LOOP_IV flag.
2973 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_BIND.
2974 (tsubst_omp_for_iterator): For OMP_LOOP, ignore parallel
2975 clauses and predetermine iterator as lastprivate.
2976 * constexpr.c (potential_constant_expression_1): Handle OMP_LOOP
2977 like OMP_DISTRIBUTE etc.
2979 2019-08-05 Marek Polacek <polacek@redhat.com>
2981 DR 2413 - typename in conversion-function-ids.
2982 * parser.c (cp_parser_conversion_type_id): Call
2983 cp_parser_type_specifier_seq with CP_PARSER_FLAGS_TYPENAME_OPTIONAL
2984 instead of CP_PARSER_FLAGS_NONE.
2986 2019-08-05 Paolo Carlini <paolo.carlini@oracle.com>
2988 * cp-tree.h (cp_expr_loc_or_input_loc): New.
2989 (cxx_incomplete_type_diagnostic): Use it.
2990 * call.c (build_converted_constant_expr_internal, convert_like_real,
2991 convert_arg_to_ellipsis, convert_for_arg_passing, build_over_call,
2992 build_cxx_call, perform_implicit_conversion_flags,
2993 initialize_reference): Likewise.
2994 * constexpr.c (cxx_eval_internal_function, cxx_eval_call_expression,
2995 eval_and_check_array_index, cxx_eval_store_expression,
2996 cxx_eval_statement_list, cxx_eval_loop_expr,
2997 cxx_eval_constant_expression, potential_constant_expression_1):
2999 * constraint.cc (check_for_logical_overloads,
3000 satisfy_predicate_constraint): Likewise.
3001 * cp-gimplify.c (cp_gimplify_expr): Likewise.
3002 * cvt.c (cp_convert_to_pointer, convert_to_reference,
3003 cp_convert_and_check, ocp_convert, maybe_warn_nodiscard): Likewise.
3004 * decl.c (pop_switch): Likewise.
3005 * decl2.c (delete_sanity): Likewise.
3006 * error.c (location_of): Likewise.
3007 * init.c (maybe_warn_list_ctor, build_aggr_init,
3008 warn_placement_new_too_small, build_new_1, build_vec_init): Likewise.
3009 * lex.c (unqualified_name_lookup_error): Likewise.
3010 * parser.c (cp_parser_initializer_list, cp_parser_omp_for_cond):
3012 * pt.c (check_for_bare_parameter_packs, check_valid_ptrmem_cst_expr,
3013 unify_arg_conversion, convert_nontype_argument,
3014 tsubst_copy_and_build, resolve_typename_type): Likewise.
3015 * semantics.c (maybe_convert_cond, finish_call_expr,
3016 cp_build_vec_convert): Likewise.
3017 * typeck.c (decay_conversion, rationalize_conditional_expr,
3018 cp_build_unary_op, build_x_compound_expr_from_list,
3019 maybe_warn_about_returning_address_of_local,
3020 maybe_warn_pessimizing_move): Likewise.
3021 * typeck2.c (check_narrowing, digest_init_r,
3022 process_init_constructor_array): Likewise.
3024 2019-08-05 Tom Honermann <tom@honermann.net>
3026 * parser.c (cp_parser_template_declaration_after_parameters): Enable
3027 class template argument deduction for non-type template parameters
3028 in literal operator templates.
3030 2019-08-05 Marek Polacek <polacek@redhat.com>
3032 PR c++/91338 - Implement P1161R3: Deprecate a[b,c].
3033 * parser.c (cp_parser_postfix_open_square_expression): Warn about uses
3034 of a comma operator within a subscripting expression.
3035 (cp_parser_skip_to_closing_square_bracket_1): New function, made out
3037 (cp_parser_skip_to_closing_square_bracket): ...this.
3039 2019-08-05 Jason Merrill <jason@redhat.com>
3041 * semantics.c (force_paren_expr): Preserve location.
3043 2019-08-02 Marek Polacek <polacek@redhat.com>
3045 PR c++/91230 - wrong error with __PRETTY_FUNCTION__ and generic lambda.
3046 * pt.c (value_dependent_expression_p): Consider __PRETTY_FUNCTION__
3047 inside a template function value-dependent.
3049 2019-08-02 Paolo Carlini <paolo.carlini@oracle.com>
3051 * tree.c (handle_nodiscard_attribute): Do not warn about nodiscard
3052 applied to a constructor.
3054 2019-08-02 Martin Liska <mliska@suse.cz>
3056 * decl.c (grok_op_properties):
3057 Mark DECL_SET_IS_OPERATOR_DELETE for user-provided delete operators.
3059 2019-08-01 Martin Sebor <msebor@redhat.com>
3062 * decl.c (reshape_init_array_1): Avoid truncating initializer
3063 lists containing string literals.
3065 2019-08-01 Marek Polacek <polacek@redhat.com>
3067 PR c++/90805 - detect narrowing in case values.
3068 * decl.c (case_conversion): Detect narrowing in case values.
3070 2019-07-31 Paolo Carlini <paolo.carlini@oracle.com>
3072 * decl2.c (delete_sanity): Improve diagnostic locations, use
3073 cp_expr_loc_or_loc in four places.
3075 2019-07-31 Jason Merrill <jason@redhat.com>
3077 PR c++/90538 - multiple expansions of capture packs
3078 * cp-tree.h (DECLTYPE_FOR_INIT_CAPTURE): Remove.
3079 * lambda.c (add_capture): Copy parameter packs from init.
3080 (lambda_capture_field_type): Always use auto for init-capture.
3081 * pt.c (uses_parameter_packs): Return tree.
3082 (tsubst) [DECLTYPE_TYPE]: Remove init-capture handling.
3083 (gen_elem_of_pack_expansion_instantiation): Don't push
3084 local_specialization_stack.
3085 (prepend_one_capture): New.
3086 (tsubst_lambda_expr): Use it. Don't touch local_specializations.
3087 (do_auto_deduction): Avoid redundant error.
3089 Fix copy_node of TEMPLATE_INFO.
3090 * cp-tree.h (struct tree_template_info): Use tree_base instead of
3091 tree_common. Add tmpl and args fields.
3092 (TI_TEMPLATE, TI_ARGS): Adjust.
3094 2019-07-30 Martin Liska <mliska@suse.cz>
3096 PR tree-optimization/91270
3097 * tree-ssa-dce.c (propagate_necessity): Mark 2nd argument
3098 of delete operator as needed.
3100 2019-07-25 Martin Liska <mliska@suse.cz>
3101 Dominik Infuhr <dominik.infuehr@theobroma-systems.com>
3104 * decl.c (cxx_init_decl_processing): Mark delete operators
3105 with DECL_SET_IS_OPERATOR_DELETE.
3107 2019-07-25 Martin Liska <mliska@suse.cz>
3109 * decl.c (duplicate_decls): Use new macros
3110 (e.g. DECL_SET_LAMBDA_FUNCTION and DECL_LAMBDA_FUNCTION_P).
3111 (cxx_init_decl_processing): Likewise.
3112 (grok_op_properties): Likewise.
3113 * parser.c (cp_parser_lambda_declarator_opt): Likewise.
3115 2019-07-24 Martin Sebor <msebor@redhat.com>
3118 * decl.c (finish_function): Use lang_mask.
3120 2019-07-20 Jason Merrill <jason@redhat.com>
3122 * cp-tree.h (ovl_iterator::using_p): A USING_DECL by itself was also
3123 introduced by a using-declaration.
3125 2019-07-20 Jason Merrill <jason@redhat.com>
3127 Reduce memory consumption for push/pop_access_scope.
3128 * name-lookup.c (leave_scope): Do add class levels other than
3129 previous_class_level to free_binding_level.
3130 (invalidate_class_lookup_cache): Move from class.c, add to
3132 * pt.c (saved_access_scope): Change from list to vec.
3134 2019-07-20 Jakub Jelinek <jakub@redhat.com>
3136 * cp-tree.h (OMP_FOR_GIMPLIFYING_P): Use OMP_LOOPING_CHECK
3137 instead of OMP_LOOP_CHECK.
3138 * parser.c (cp_parser_omp_clause_name): Handle bind clause.
3139 (cp_parser_omp_clause_bind): New function.
3140 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_BIND.
3141 (OMP_LOOP_CLAUSE_MASK): Define.
3142 (cp_parser_omp_loop): New function.
3143 (cp_parser_omp_parallel, cp_parser_omp_teams): Handle parsing of
3144 loop combined with parallel or teams.
3145 (cp_parser_omp_construct): Handle PRAGMA_OMP_LOOP.
3146 (cp_parser_pragma): Likewise.
3147 * pt.c (tsubst_expr): Handle OMP_LOOP.
3148 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_BIND.
3150 2019-07-19 Jason Merrill <jason@redhat.com>
3152 PR c++/90101 - dependent class non-type parameter.
3153 * pt.c (invalid_nontype_parm_type_p): Check for dependent class type.
3155 2019-07-18 Jason Merrill <jason@redhat.com>
3157 PR c++/90098 - partial specialization and class non-type parms.
3160 * call.c (build_converted_constant_expr_internal): Don't copy.
3161 * pt.c (process_partial_specialization): Allow VIEW_CONVERT_EXPR
3162 around class non-type parameter.
3163 (unify) [TEMPLATE_PARM_INDEX]: Ignore cv-quals.
3165 2019-07-16 Jason Merrill <jason@redhat.com>
3167 * parser.c (make_location): Add overload taking cp_lexer* as last
3170 * parser.c (cp_parser_simple_type_specifier): Separate tentative
3171 parses for optional type-spec and CTAD.
3173 * parser.c (cp_parser_nested_name_specifier_opt): If the token is
3174 already CPP_NESTED_NAME_SPECIFIER, leave it alone.
3176 2019-07-12 Jakub Jelinek <jakub@redhat.com>
3178 * parser.c (cp_parser_omp_clause_name): Handle order clause.
3179 (cp_parser_omp_clause_order): New function.
3180 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_ORDER.
3181 (OMP_SIMD_CLAUSE_MASK, OMP_FOR_CLAUSE_MASK): Add
3182 PRAGMA_OMP_CLAUSE_ORDER.
3183 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_ORDER.
3184 * pt.c (tsubst_omp_clauses): Likewise.
3186 2019-07-10 Paolo Carlini <paolo.carlini@oracle.com>
3188 * decl.c (get_type_quals,
3189 smallest_type_location (const cp_decl_specifier_seq*)): New.
3190 (check_tag_decl): Use smallest_type_location in error_at about
3191 multiple types in one declaration.
3192 (grokdeclarator): Use locations[ds_complex] in error_at about
3193 complex invalid; use locations[ds_storage_class] in error_at
3194 about static cdtor; use id_loc in error_at about flexible
3195 array member in union; use get_type_quals.
3197 2019-07-09 Martin Sebor <msebor@redhat.com>
3200 * cp-tree.h: Change class-key of PODs to struct and others to class.
3202 * semantics.c (finalize_nrv_r): Same.
3204 2019-07-09 Martin Sebor <msebor@redhat.com>
3207 * constexpr.c (cxx_eval_call_expression): Change class-key from class
3208 to struct and vice versa to match convention and avoid -Wclass-is-pod
3209 and -Wstruct-no-pod.
3210 * constraint.cc (get_concept_definition): Same.
3212 * cxx-pretty-print.h: Same.
3214 * logic.cc (term_list::replace): Same.
3215 * name-lookup.c (find_local_binding): Same.
3216 * pt.c (tsubst_binary_right_fold): Same.
3217 * search.c (field_accessor_p): Same.
3218 * semantics.c (expand_or_defer_fn): Same.
3220 2019-07-08 Jakub Jelinek <jakub@redhat.com>
3223 * decl2.c (cp_omp_mappable_type_1): Don't emit any note for
3224 error_mark_node type.
3226 2019-07-05 Jakub Jelinek <jakub@redhat.com>
3230 * call.c (build_new_method_call_1): Remove set but not used variable
3233 2019-07-05 Paolo Carlini <paolo.carlini@oracle.com>
3235 PR c++/67184 (again)
3237 * call.c (build_over_call): Devirtualize user-defined operators
3238 coming from a base too.
3239 (build_new_method_call_1): Do not devirtualize here.
3241 2019-07-04 Marek Polacek <polacek@redhat.com>
3244 PR c++/83374 - __is_standard_layout wrong for a class with repeated
3246 * class.c (check_bases): Set CLASSTYPE_NON_STD_LAYOUT for a class if
3247 CLASSTYPE_REPEATED_BASE_P is true.
3249 2019-07-04 Andrew Stubbs <ams@codesourcery.com>
3251 * cp-tree.h (cp_omp_emit_unmappable_type_notes): New prototype.
3252 * decl.c (cp_finish_decl): Call cp_omp_emit_unmappable_type_notes.
3253 * decl2.c (cp_omp_mappable_type): Move contents to ...
3254 (cp_omp_mappable_type_1): ... here and add note output.
3255 (cp_omp_emit_unmappable_type_notes): New function.
3256 * semantics.c (finish_omp_clauses): Call
3257 cp_omp_emit_unmappable_type_notes in four places.
3259 2019-07-03 Martin Liska <mliska@suse.cz>
3261 * call.c (build_new_op_1): Remove dead assignemts.
3262 * typeck.c (cp_build_binary_op): Likewise.
3264 2019-06-27 Jason Merrill <jason@redhat.com>
3266 PR c++/55442 - memory-hog with highly recursive constexpr.
3267 * constexpr.c (push_cx_call_context): Return depth.
3268 (cxx_eval_call_expression): Don't cache past constexpr_cache_depth.
3270 2019-06-27 Jan Hubicka <jh@suse.cz>
3272 * class.c (layout_class_type): Set TYPE_CXX_ODR_P for as-base
3275 2019-06-27 Martin Liska <mliska@suse.cz>
3277 * class.c (adjust_clone_args): Remove obviously
3279 (dump_class_hierarchy_r): Likewise.
3280 * decl.c (check_initializer): Likewise.
3281 * parser.c (cp_parser_lambda_expression): Likewise.
3282 * pt.c (unify_bound_ttp_args): Likewise.
3283 (convert_template_argument): Likewise.
3284 * rtti.c (build_headof): Likewise.
3285 * typeck.c (convert_for_initialization): Likewise.
3287 2019-06-25 Jason Merrill <jason@redhat.com>
3289 PR c++/70462 - unnecessary base ctor variant with final.
3290 * optimize.c (populate_clone_array): Skip base variant if
3292 (maybe_clone_body): We don't need an alias if we are only defining
3295 * class.c (resolves_to_fixed_type_p): Check CLASSTYPE_FINAL.
3297 2019-06-25 Jakub Jelinek <jakub@redhat.com>
3300 * constexpr.c (cxx_eval_array_reference): Don't look through VCE from
3301 vector type if lval.
3303 2019-06-25 Jozef Lawrynowicz <jozef.l@mittosystems.com>
3305 * lex.c (init_reswords): Create keyword for "__intN__" type.
3306 * cp-tree.h (cp_decl_specifier_seq): New bitfield "int_n_alt".
3307 * decl.c (grokdeclarator): Don't pedwarn about "__intN" ISO
3308 C incompatibility if alternate "__intN__" form is used.
3309 * parser.c (cp_parser_simple_type_specifier): Set
3310 decl_specs->int_n_alt if "__intN__" form is used.
3312 2019-06-24 Jan Hubicka <jh@suse.cz>
3314 * lex.c (cxx_make_type): Set TYPE_CXX_ODR_P.
3316 2019-06-24 Jason Merrill <jason@redhat.com>
3318 * class.c (layout_class_type): Don't use a separate
3319 CLASSTYPE_AS_BASE if it's the same size.
3321 2019-06-23 Marek Polacek <polacek@redhat.com>
3323 * call.c (convert_default_arg): Use DEFERRED_PARSE instead of
3325 * cp-objcp-common.c (cp_tree_size): Likewise. Use tree_deferred_parse
3326 instead of tree_default_arg.
3327 * cp-tree.def: Rename DEFAULT_ARG to DEFERRED_PARSE.
3328 * cp-tree.h: Rename DEFARG_TOKENS to DEFPARSE_TOKENS. Rename
3329 DEFARG_INSTANTIATIONS to DEFPARSE_INSTANTIATIONS. Rename
3330 tree_default_arg to tree_deferred_parse.
3331 (UNPARSED_NOEXCEPT_SPEC_P): Use DEFERRED_PARSE instead of DEFAULT_ARG.
3332 (cp_tree_node_structure_enum): Rename TS_CP_DEFAULT_ARG to
3333 TS_CP_DEFERRED_PARSE.
3334 (lang_tree_node): Rename tree_default_arg to tree_deferred_parse.
3335 Rename default_arg to deferred_parse. Use TS_CP_DEFERRED_PARSE instead
3336 of TS_CP_DEFAULT_ARG.
3337 (defarg_location): Remove declaration.
3338 (defparse_location): Add declaration.
3339 * decl.c (grokfndecl): Use DEFERRED_PARSE instead of DEFAULT_ARG.
3340 Call defparse_location instead of defarg_location.
3341 (check_default_argument): Use DEFERRED_PARSE instead of DEFAULT_ARG.
3342 (cp_tree_node_structure): Likewise. Use TS_CP_DEFERRED_PARSE instead
3343 of TS_CP_DEFAULT_ARG.
3344 * decl2.c (grokfield): Use DEFERRED_PARSE instead of DEFAULT_ARG.
3345 * error.c (dump_expr): Likewise.
3346 (location_of): Likewise.
3347 * init.c (get_nsdmi): Likewise.
3348 * parser.c (cp_parser_save_noexcept): Likewise. Use DEFPARSE_TOKENS
3349 instead of DEFARG_TOKENS.
3350 (cp_parser_late_noexcept_specifier): Likewise.
3351 (cp_parser_late_parse_one_default_arg): Use DEFPARSE_TOKENS instead
3353 (cp_parser_late_parsing_default_args): Use DEFERRED_PARSE instead of
3354 DEFAULT_ARG. Use DEFPARSE_INSTANTIATIONS instead of
3355 DEFARG_INSTANTIATIONS.
3356 (cp_parser_cache_defarg): Use DEFERRED_PARSE instead of DEFAULT_ARG.
3357 Use DEFPARSE_TOKENS instead of DEFARG_TOKENS. Use
3358 DEFPARSE_INSTANTIATIONS instead of DEFARG_INSTANTIATIONS.
3359 (defparse_location): Renamed from defarg_location.
3360 * pt.c (tsubst_default_argument): Use DEFERRED_PARSE instead of
3362 (tsubst_arg_types): Likewise.
3363 (dependent_type_p_r): Likewise.
3364 * tree.c (cp_tree_equal): Likewise.
3365 (cp_walk_subtrees): Likewise.
3366 * typeck.c (convert_arguments): Likewise.
3368 2019-06-22 Marek Polacek <polacek@redhat.com>
3370 PR c++/86476 - noexcept-specifier is a complete-class context.
3372 * cp-tree.def (DEFAULT_ARG): Update commentary.
3373 * cp-tree.h (UNPARSED_NOEXCEPT_SPEC_P): New macro.
3374 (tree_default_arg): Use tree_base instead of tree_common.
3375 (do_push_parm_decls, maybe_check_overriding_exception_spec): Declare.
3376 * decl.c (do_push_parm_decls): New function, broken out of...
3377 (store_parm_decls): ...here. Call it.
3378 * except.c (nothrow_spec_p): Accept DEFAULT_ARG in the assert.
3379 * parser.c (cp_parser_noexcept_specification_opt,
3380 cp_parser_late_noexcept_specifier, noexcept_override_late_checks):
3382 (unparsed_noexcepts): New macro.
3383 (push_unparsed_function_queues): Update initializer.
3384 (cp_parser_direct_declarator): Pass FRIEND_P to
3385 cp_parser_exception_specification_opt.
3386 (inject_parm_decls): New.
3387 (pop_injected_parms): New.
3388 (cp_parser_class_specifier_1): Implement delayed parsing of
3389 noexcept-specifiers.
3390 (cp_parser_save_noexcept): New.
3391 (cp_parser_late_noexcept_specifier): New.
3392 (noexcept_override_late_checks): New.
3393 (cp_parser_noexcept_specification_opt): Add FRIEND_P parameter. Call
3394 cp_parser_save_noexcept instead of the normal processing if needed.
3395 (cp_parser_exception_specification_opt): Add FRIEND_P parameter and
3396 pass it to cp_parser_noexcept_specification_opt.
3397 (cp_parser_save_member_function_body): Fix comment.
3398 (cp_parser_save_default_args): Maybe save the noexcept-specifier to
3400 (cp_parser_transaction): Update call to
3401 cp_parser_noexcept_specification_opt.
3402 (cp_parser_transaction_expression): Likewise.
3403 * parser.h (cp_unparsed_functions_entry): Add new field to carry
3404 a noexcept-specifier.
3405 * pt.c (dependent_type_p_r): Handle unparsed noexcept expression.
3406 * search.c (maybe_check_overriding_exception_spec): New function, broken
3408 (check_final_overrider): ...here. Call
3409 maybe_check_overriding_exception_spec.
3410 * tree.c (canonical_eh_spec): Handle UNPARSED_NOEXCEPT_SPEC_P.
3411 (cp_tree_equal): Handle DEFAULT_ARG.
3413 PR c++/90881 - bogus -Wunused-value in unevaluated context.
3414 * cvt.c (convert_to_void): Don't emit unused warnings in
3415 an unevaluated context.
3417 2019-06-22 Paolo Carlini <paolo.carlini@oracle.com>
3419 * decl.c (grokdeclarator): Use id_loc, typespec_loc, and
3420 locations[ds_storage_class] in a few additional places.
3422 2019-06-21 Paolo Carlini <paolo.carlini@oracle.com>
3426 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com>
3430 * call.c (build_over_call): Devirtualize when the final overrider
3431 comes from the base.
3433 2019-06-21 Marek Polacek <polacek@redhat.com>
3435 PR c++/61490 - qualified-id in friend function definition.
3436 * decl.c (grokdeclarator): Diagnose qualified-id in friend function
3437 definition. Improve location for diagnostics of friend functions.
3439 PR c++/60223 - ICE with T{} in non-deduced context.
3440 * pt.c (unify): Allow COMPOUND_LITERAL_P in a non-deduced context.
3442 PR c++/64235 - missing syntax error with invalid alignas.
3443 * parser.c (cp_parser_std_attribute_spec): Commit to tentative parse
3444 if there's a missing close paren.
3446 PR c++/90490 - fix decltype issues in noexcept-specifier.
3447 * except.c (build_noexcept_spec): Call
3448 instantiate_non_dependent_expr_sfinae before
3449 build_converted_constant_expr instead of calling
3450 instantiate_non_dependent_expr after it. Add
3451 processing_template_decl_sentinel.
3453 2019-06-21 Jakub Jelinek <jakub@redhat.com>
3456 * semantics.c (finish_omp_clauses): Don't reject references to
3457 incomplete types if processing_template_decl.
3459 2019-06-19 Marek Polacek <polacek@redhat.com>
3461 PR c++/60364 - noreturn after first decl not diagnosed.
3462 * decl.c (duplicate_decls): Give an error when a function is
3463 declared [[noreturn]] after its first declaration.
3464 * parser.c (cp_parser_std_attribute): Don't treat C++11 noreturn
3465 attribute as equivalent to GNU's.
3466 * tree.c (std_attribute_table): Add noreturn.
3468 2019-06-19 Jakub Jelinek <jakub@redhat.com>
3470 * cp-gimplify.c (cp_genericize_r): Handle OMP_CLAUSE_{IN,EX}CLUSIVE
3471 like OMP_CLAUSE_SHARED.
3473 2019-06-18 Jason Merrill <jason@redhat.com>
3475 * constexpr.c (cxx_eval_store_expression): Delay target evaluation.
3477 2019-06-18 Jason Merrill <jason@redhat.com>
3479 * constexpr.c (eval_and_check_array_index): Split out from...
3480 (cxx_eval_array_reference): ...here.
3481 (cxx_eval_store_expression): Use it here, too.
3482 (diag_array_subscript): Take location. Strip location wrapper.
3484 2019-06-18 Jason Merrill <jason@redhat.com>
3486 * constexpr.c (cxx_eval_constant_expression): Handle conversion from
3487 and then to the same type.
3489 2019-06-18 Jason Merrill <jason@redhat.com>
3491 * constexpr.c (unshare_constructor): Add MEM_STAT_DECL.
3493 2019-06-17 Jakub Jelinek <jakub@redhat.com>
3495 * semantics.c (finish_omp_clauses): For OMP_CLAUSE_REDUCTION_INSCAN
3496 set need_copy_assignment.
3498 2019-06-17 Marek Polacek <polacek@redhat.com>
3500 PR c++/83820 - excessive attribute arguments not detected.
3501 * parser.c (cp_parser_std_attribute): Detect excessive arguments.
3503 2019-06-17 Nathan Sidwell <nathan@acm.org>
3506 * name-lookup.c (lookup_type_scope_1): Calll qualify_lookup before
3509 2019-06-14 Marek Polacek <polacek@redhat.com>
3511 PR c++/90884 - stray note with -Wctor-dtor-privacy.
3512 * class.c (maybe_warn_about_overly_private_class): Guard the call to
3515 2019-06-12 Jason Merrill <jason@redhat.com>
3517 PR c++/85552 - wrong instantiation of dtor for DMI.
3518 * typeck2.c (digest_nsdmi_init): Set tf_no_cleanup for direct-init.
3520 2019-06-13 Paolo Carlini <paolo.carlini@oracle.com>
3522 * decl.c (grokdeclarator): Use id_loc in five additional places
3523 in the last part of the function.
3525 2019-06-13 Paolo Carlini <paolo.carlini@oracle.com>
3527 * decl.c (grokdeclarator): Move further up the declaration of
3528 id_loc, use it immediately, update its value after the loop
3529 over declarator, use it again in the final part of function;
3530 improve locations of error messages about multiple data types
3531 and conflicting specifiers.
3533 2019-06-13 Richard Biener <rguenther@suse.de>
3536 * typeck2.c (split_nonconstant_init_1): Properly count
3537 num_split_elts, optimize single constructor elt removal.
3539 2019-06-12 Marek Polacek <polacek@redhat.com>
3541 PR c++/66999 - 'this' captured by reference.
3542 * parser.c (cp_parser_lambda_introducer): Reject `&this'. Use
3543 cp_lexer_nth_token_is instead of cp_lexer_peek_nth_token.
3545 PR c++/90825 - endless recursion when evaluating sizeof.
3546 PR c++/90832 - endless recursion when evaluating sizeof.
3547 * constexpr.c (cxx_eval_constant_expression): Don't recurse on the
3548 result of fold_sizeof_expr if is returns a SIZEOF_EXPR.
3549 * typeck.c (cxx_sizeof_expr): Only return a SIZEOF_EXPR if the operand
3550 is instantiation-dependent.
3552 PR c++/90736 - bogus error with alignof.
3553 * constexpr.c (adjust_temp_type): Use cv_unqualified type.
3555 2019-06-11 Matthew Beliveau <mbelivea@redhat.com>
3557 PR c++/90449 - add -Winaccessible-base option.
3558 * class.c (warn_about_ambiguous_bases): Changed name to:
3559 maybe_warn_about_inaccessible_bases.
3560 (maybe_warn_about_inaccessible_bases): Implemented new
3561 Winaccessible-base warning option for both direct and virtual
3563 (layout_class_type): Call to warn_about_ambiguous_bases changed to fit
3566 2019-06-11 Richard Biener <rguenther@suse.de>
3569 * typeck2.c (split_nonconstant_init_1): Avoid ordered remove
3570 from CONSTRUCTOR by marking to remove elements and doing all
3571 of them in a O(n) scan.
3573 2019-06-11 Jakub Jelinek <jakub@redhat.com>
3576 * init.c (constant_value_1): Handle VECTOR_CST DECL_INITIAL for
3577 !DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P decls like CONSTRUCTOR.
3579 2019-06-11 Martin Liska <mliska@suse.cz>
3582 * pt.c (init_template_processing): Disable hash table
3583 sanitization for decl_specializations and type_specializations.
3585 2019-06-10 Jason Merrill <jason@redhat.com>
3587 * constexpr.c (free_constructor): New.
3588 (cxx_eval_call_expression): Free parameter value CONSTRUCTORs.
3590 * constexpr.c (unshare_constructor): Only unshare if T is itself a
3592 (cxx_eval_call_expression): Don't call it on the result here.
3594 Reduce constexpr_call memory consumption.
3595 * constexpr.c (cxx_bind_parameters_in_call): Use TREE_VEC rather
3597 (constexpr_call_hasher::equal, cxx_bind_parameters_in_call)
3598 (cxx_eval_call_expression): Adjust.
3600 2019-06-10 Jakub Jelinek <jakub@redhat.com>
3602 * parser.c (cp_parser_omp_clause_reduction): Don't sorry_at on inscan
3604 (cp_parser_omp_scan_loop_body): New function.
3605 (cp_parser_omp_for_loop): Call cp_parser_omp_scan_loop_body if there
3606 are inscan reduction clauses.
3607 (cp_parser_pragma): Reject PRAGMA_OMP_SCAN.
3608 * semantics.c (finish_omp_clauses): Reject mixing inscan with
3609 non-inscan reductions on the same construct, or inscan reductions with
3610 ordered or schedule clauses, or inscan array reductions.
3611 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_{IN,EX}CLUSIVE.
3612 (tsubst_expr): Handle OMP_SCAN.
3614 2019-06-07 Jason Merrill <jason@redhat.com>
3616 * constexpr.c (cxx_eval_constant_expression): Call
3617 STRIP_ANY_LOCATION_WRAPPER early.
3618 [CONVERT_EXPR]: Don't build anything for conversion to void.
3619 [ADDR_EXPR]: ggc_free unused ADDR_EXPR.
3621 2019-06-05 Martin Sebor <msebor@redhat.com>
3624 * typeck.c (maybe_warn_about_returning_address_of_local): Only
3625 consider functions returning pointers as candidates for
3626 -Wreturn-local-addr.
3628 2019-06-05 Paolo Carlini <paolo.carlini@oracle.com>
3630 * decl.c (smallest_type_location): New.
3631 (check_special_function_return_type): Use it.
3632 (grokdeclarator): Lkewise.
3634 2019-06-05 Paolo Carlini <paolo.carlini@oracle.com>
3636 * decl.c (grokdeclarator): Use locations[ds_friend]
3639 2019-06-05 Martin Sebor <msebor@redhat.com>
3641 * call.c (build_conditional_expr_1): Adjust quoting and hyphenation.
3642 (convert_like_real): Same.
3643 (convert_arg_to_ellipsis): Same.
3644 * constexpr.c (diag_array_subscript): Same.
3645 * constraint.cc (diagnose_trait_expression): Same.
3646 * cvt.c (ocp_convert): Same.
3647 * decl.c (start_decl): Same.
3648 (check_for_uninitialized_const_var): Same.
3650 (check_special_function_return_type): Same.
3651 (finish_enum_value_list): Same.
3652 (start_preparsed_function): Same.
3653 * parser.c (cp_parser_decl_specifier_seq): Same.
3654 * typeck.c (cp_build_binary_op): Same.
3655 (build_static_cast_1): Same.
3657 2019-06-04 Nina Dinka Ranns <dinka.ranns@gmail.com>
3659 PR c++/63149 - Wrong auto deduction from braced-init-list.
3660 * pt.c (listify_autos): use non cv qualified auto_node in
3661 std::initializer_list<auto>.
3663 2019-06-04 Paolo Carlini <paolo.carlini@oracle.com>
3665 * decl.c (grokdeclarator): Use declarator->id_loc in two
3668 2019-06-04 Nathan Sidwell <nathan@acm.org>
3670 * name-lookup.c (lookup_type_scope_1): Reimplement, handle local
3671 and namespace scopes separately.
3673 2019-06-04 Harald van Dijk <harald@gigawatt.nl>
3675 PR c++/60531 - Wrong error about unresolved overloaded function
3676 * typeck.c (cp_build_binary_op): See if overload can be resolved.
3677 (cp_build_unary_op): Ditto.
3679 2019-06-04 Jason Merrill <jason@redhat.com>
3681 Reduce accumulated garbage in constexpr evaluation.
3682 * constexpr.c (cxx_eval_call_expression): ggc_free any bindings we
3684 (cxx_eval_increment_expression): ggc_free the MODIFY_EXPR after
3687 2019-06-04 Jakub Jelinek <jakub@redhat.com>
3689 * cp-tree.h (CP_OMP_CLAUSE_INFO): Allow for any clauses up to _condvar_
3690 instead of only up to linear.
3692 2019-06-03 Paolo Carlini <paolo.carlini@oracle.com>
3694 * parser.c (cp_parser_unqualified_id): Use build_min_nt_loc in
3697 2019-06-01 Ville Voutilainen <ville.voutilainen@gmail.com>
3700 * class.c (fixup_type_variants): Handle CLASSTYPE_FINAL.
3702 2019-05-31 Nathan Sidwell <nathan@acm.org>
3704 * cp-tree.h (IDENTIFIER_LAMBDA_P): New.
3706 (LAMBDA_TYPE_P, TYPE_UNNAMED_P): Likewise.
3707 (LAMBDANAME_PREFIX, LAMBDANAME_FORMAT): Delete.
3708 (make_lambda_name): Don't declare.
3709 * error.c (dump_aggr_type): Check for lambdas before other
3711 * lambda.c (begin_lambda_type): Use make_anon_name.
3712 * cp-lang.c (cxx_dwarf_name): Lambda names smell anonymous.
3713 * mangle.c (write_local_name): Likewise.
3714 * name-lookup.c (lambda_cnt, make_lambda_name): Delete.
3716 2019-05-30 Marek Polacek <polacek@redhat.com>
3718 * cp-tree.h (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Fix a typo.
3720 2019-05-31 Paolo Carlini <paolo.carlini@oracle.com>
3722 * decl.c (grokdeclarator): Use declarator->id_loc in five
3725 2019-05-29 Jakub Jelinek <jakub@redhat.com>
3728 * tree.c (lvalue_kind): Return clk_none for expressions with
3731 2019-05-29 Paolo Carlini <paolo.carlini@oracle.com>
3734 * parser.c (cp_parser_sizeof_operand): When the type-id production
3735 did not work out commit to the tentative parse.
3737 2019-05-29 Jakub Jelinek <jakub@redhat.com>
3739 P1091R3 - Extending structured bindings to be more like var decls
3740 P1381R1 - Reference capture of structured bindings
3741 * decl.c (cp_maybe_mangle_decomp): Handle TREE_STATIC decls even at
3743 (cp_finish_decomp): Copy over various decl properties from decl to
3744 v[i] in the tuple case.
3745 (grokdeclarator): Allow static, thread_local and __thread for C++2a
3746 and use pedwarn instead of error for older standard revisions.
3747 Make other structured binding diagnostic messages more i18n friendly.
3749 2019-05-28 Nathan Sidwell <nathan@acm.org>
3751 * decl.c (duplicate_decls): Assert a template newdecl has no
3754 2019-05-28 Marek Polacek <polacek@redhat.com>
3756 PR c++/90548 - ICE with generic lambda and empty pack.
3757 * pt.c (tsubst_copy_and_build): Handle pack expansion properly.
3759 2019-05-28 Nathan Sidwell <nathan@acm.org>
3761 * cp-tree.h (make_anon_name): Drop declaration.
3762 (TYPE_UNNAMED_P): Use IDENTIFIER_ANON_P.
3763 * cp-lang.c (cxx_dwarf_name): Likewise.
3764 * class.c (find_flexarrays): Likewise.
3765 * decl.c (name_unnamed_type, xref_tag_1): Likewise.
3766 * error.c (dump_aggr_type): Likewise.
3767 * pt.c (push_template_decl_real): Likewise.
3768 * name-lookup.c (consider_binding_level): Likewise.
3769 (anon_cnt, make_anon_name): Delete.
3771 2019-05-25 Marek Polacek <polacek@redhat.com>
3773 PR c++/90572 - wrong disambiguation in friend declaration.
3774 * parser.c (cp_parser_constructor_declarator_p): Don't allow missing
3775 typename for friend declarations.
3777 2019-05-23 Jonathan Wakely <jwakely@redhat.com>
3779 * cp-tree.h (CP_AGGREGATE_TYPE_P): Fix whitespace.
3781 * init.c (std_placement_new_fn_p): Remove outdated TODO comment that
3782 was resolved by r254694.
3784 2019-05-22 Jason Merrill <jason@redhat.com>
3786 PR c++/20408 - unnecessary code for empty struct.
3787 * call.c (build_call_a): Use simple_empty_class_p.
3789 PR c++/86485 - -Wmaybe-unused with empty class ?:
3790 * cp-gimplify.c (simple_empty_class_p): Also true for MODIFY_EXPR.
3792 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com>
3794 * parser.c (cp_parser_template_declaration_after_parameters): Use
3795 DECL_SOURCE_LOCATION in literal operator template errors.
3797 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com>
3801 * call.c (build_over_call): Devirtualize when the final overrider
3802 comes from the base.
3804 2019-05-21 Nathan Sidwell <nathan@acm.org>
3806 * name-lookup.c (do_nonmember_using_decl): Drop INSERT_P
3807 parameter. Document.
3808 (finish_nonmember_using_decl): Adjust do_nonmember_using_decl
3809 calls. Remove stray FIXME comment.
3811 * name-lookup.h (struct cp_binding_level): Drop usings field.
3812 (finish_namespace_using_decl, finish_local_using_decl): Replace with ...
3813 (finish_nonmember_using_decl): ... this.
3814 * name-lookup.c (push_using_decl_1, push_using_decl):
3815 (do_nonmember_using_decl): ... here. Add INSERT_P arg. Reimplement.
3816 (validate_nonmember_using_decl, finish_namespace_using_decl)
3817 (finish_local_using_decl): Replace with ...
3818 (finish_nonmember_using_decl): ... this. Drop DECL parm.
3819 * parser.c (cp_parser_using_declaration): Don't do lookup here.
3820 * pt.c (tsubst_expr): Do not do using decl lookup here.
3822 2019-05-21 Eric Botcazou <ebotcazou@adacore.com>
3824 * decl2.c (cpp_check) <IS_ASSIGNMENT_OPERATOR>: New case.
3826 2019-05-20 Marek Polacek <polacek@redhat.com>
3828 CWG 2094 - volatile scalars are trivially copyable.
3830 * tree.c (trivially_copyable_p): Don't check CP_TYPE_VOLATILE_P for
3833 2019-05-20 Marek Polacek <polacek@redhat.com>
3835 * pt.c (convert_template_argument): Add a diagnostic for the
3836 [temp.arg]/2 ambiguity case.
3838 * name-lookup.c (finish_using_directive): Don't issue inform() if the
3839 warning didn't trigger. Add quoting. Tweak the inform message.
3841 2019-05-20 Paolo Carlini <paolo.carlini@oracle.com>
3843 * cp-tree.h: Remove remnants of CONV_NONCONVERTING.
3845 2019-05-20 Nathan Sidwell <nathan@acm.org>
3847 * name-lookup.c (finish_namespace_using_directive)
3848 (finish_local_using_directive): Merge to ...
3849 (finish_using_directive): ... here. Handle both contexts.
3850 * name-lookup.h (finish_namespace_using_directive)
3851 (finish_local_using_directive): Replace with ...
3852 (finish_using_directive): ... this.
3853 * parser.c (cp_parser_using_directive): Adjust.
3854 * pt.c (tsubst_expr): Likewise.
3856 * cp-tree.h (struct lang_decl_ns): Remove usings field.
3857 (DECL_NAMESPACE_USING): Delete.
3858 * name-lookup.c (name_lookup::search_usings): Use namespace's
3860 (name_lookup::queue_namespae): Likewise.
3861 (finish_namespace_using_directive, push_namespace): Likewise.
3862 (has_using_namespace_std_directive): Just search the entire
3865 2019-05-20 Jonathan Wakely <jwakely@redhat.com>
3867 PR c++/90532 Ensure __is_constructible(T[]) is false
3868 * method.c (is_xible_helper): Return error_mark_node for construction
3869 of an array of unknown bound.
3871 2019-05-17 Thomas Schwinge <thomas@codesourcery.com>
3874 * parser.c (cp_finalize_oacc_routine): Rework checking if already
3875 marked with an OpenACC 'routine' directive.
3878 * parser.c (cp_parser_oacc_routine)
3879 (cp_parser_late_parsing_oacc_routine): Normalize order of clauses.
3880 (cp_finalize_oacc_routine): Call oacc_verify_routine_clauses.
3883 * parser.c (cp_finalize_oacc_routine): Refer to OpenACC 'routine'
3884 clauses from "omp declare target" attribute.
3886 2019-05-16 Martin Sebor <msebor@redhat.com>
3888 * call.c (print_z_candidate): Wrap diagnostic text in a gettext
3890 (print_z_candidates): Same.
3891 (build_conditional_expr_1): Quote keywords, operators, and types
3893 (build_op_delete_call): Same.
3894 (maybe_print_user_conv_context): Wrap diagnostic text in a gettext
3896 (convert_like_real): Same.
3897 (convert_arg_to_ellipsis): Quote keywords, operators, and types
3899 (build_over_call): Same.
3900 (joust): Break up an overlong line. Wrap diagnostic text in a gettext
3902 * constexpr.c (cxx_eval_check_shift_p): Spell out >= in English.
3903 (cxx_eval_constant_expression): Quote keywords, operators, and types
3905 (potential_constant_expression_1): Same.
3906 * cp-gimplify.c (cp_genericize_r): Same.
3907 * cvt.c (maybe_warn_nodiscard): Quote keywords, operators, and types
3909 (type_promotes_to): Same.
3910 * decl.c (check_previous_goto_1): Same.
3913 (cp_finish_decl): Avoid parenthesizing a sentence for consistency.
3914 (grok_op_properties): Quote keywords, operators, and types
3916 * decl2.c (grokfield): Same.
3917 (coerce_delete_type): Same.
3918 * except.c (is_admissible_throw_operand_or_catch_parameter): Same.
3919 * friend.c (do_friend): Quote C++ tokens.
3920 * init.c (build_new_1): Quote keywords, operators, and types
3922 (build_vec_delete_1): Same.
3923 (build_delete): Same.
3924 * lex.c (parse_strconst_pragma): Same.
3925 (handle_pragma_implementation): Same.
3926 (unqualified_fn_lookup_error): Same.
3927 * mangle.c (write_type): Same.
3928 * method.c (defaulted_late_check): Avoid two consecutive punctuators.
3929 * name-lookup.c (cp_binding_level_debug): Remove a trailing newline.
3930 (pop_everything): Same.
3931 * parser.c (cp_lexer_start_debugging): Quote a macro name.
3933 (cp_lexer_stop_debugging): Same.
3934 (cp_parser_userdef_numeric_literal): Quote a C++ header name
3936 (cp_parser_nested_name_specifier_opt): Quote keywords, operators,
3937 and types in diagnostics.
3938 (cp_parser_question_colon_clause): Same.
3939 (cp_parser_asm_definition): Same.
3940 (cp_parser_init_declarator): Same.
3941 (cp_parser_template_declaration_after_parameters): Avoid capitalizing
3942 a sentence in a diagnostic.
3943 (cp_parser_omp_declare_reduction): Quote keywords, operators, and types
3945 (cp_parser_transaction): Same.
3946 * pt.c (maybe_process_partial_specialization): Replace second call
3947 to permerror with inform for consistency with other uses.
3948 (expand_integer_pack): Quote keywords, operators, and types
3950 * rtti.c (get_typeid): Quote keywords, operators, and types
3952 (build_dynamic_cast_1): Same.
3953 * semantics.c (finish_asm_stmt): Same.
3954 (finish_label_decl): Same.
3955 (finish_bases): Same.
3956 (finish_offsetof): Same.
3957 (cp_check_omp_declare_reduction): Same.
3958 (finish_decltype_type): Same.
3959 * tree.c (handle_init_priority_attribute): Same. Add detail
3961 (maybe_warn_zero_as_null_pointer_constant): Same.
3962 * typeck.c (cp_build_binary_op): Quote keywords, operators, and types
3964 (cp_build_unary_op): Same.
3965 (check_for_casting_away_constness): Same.
3966 (build_static_cast): Same.
3967 (build_const_cast_1): Same.
3968 (maybe_warn_about_returning_address_of_local): Same.
3969 (check_return_expr): Same.
3970 * typeck2.c (abstract_virtuals_error_sfinae): Same.
3971 (digest_init_r): Replace a tab with spaces in a diagnostic.
3972 (build_functional_cast): Quote keywords, operators, and types
3975 2019-05-15 Jakub Jelinek <jakub@redhat.com>
3978 * cp-gimplify.c (genericize_cp_loop): Emit a DEBUG_BEGIN_STMT
3979 before the condition (or if missing or constant non-zero at the end
3980 of the loop. Emit a DEBUG_BEGIN_STMT before the increment expression
3981 if any. Don't call protected_set_expr_location on incr if it already
3984 2019-05-15 Marek Polacek <polacek@redhat.com>
3986 CWG 2096 - constraints on literal unions.
3987 * class.c (check_field_decls): Initialize booleans directly. A union
3988 is literal if at least one of its non-static data members is of
3989 non-volatile literal type.
3991 2019-05-15 Paolo Carlini <paolo.carlini@oracle.com>
3993 * cp-tree.h (REFERENCE_VLA_OK): Remove.
3994 * lambda.c (build_capture_proxy): Remove use of the above.
3996 2019-05-15 Paolo Carlini <paolo.carlini@oracle.com>
3998 * call.c (perform_overload_resolution, build_new_method_call_1):
3999 Use OVL_P; remove redundant TEMPLATE_DECL checks.
4000 * decl.c (grokfndecl): Likewise.
4001 * mangle.c (write_expression): Likewise.
4002 * parser.c (cp_parser_template_id): Likewise.
4003 * pt.c (resolve_overloaded_unification, type_dependent_expression_p):
4005 * search.c (build_baselink): Likewise.
4006 * tree.c (is_overloaded_fn, dependent_name, maybe_get_fns): Likewise.
4008 2019-05-14 Paolo Carlini <paolo.carlini@oracle.com>
4010 PR preprocessor/90382
4011 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
4014 2019-05-13 Jason Merrill <jason@redhat.com>
4016 Use releasing_vec more broadly.
4017 * cp-tree.h (struct releasing_vec): Replace get_ref method with
4019 (vec_safe_push, vec_safe_reserve, vec_safe_length, vec_safe_splice):
4020 Forwarding functions for releasing_vec.
4021 (release_tree_vector): Declare but don't define.
4022 * call.c (build_op_delete_call, build_temp, call_copy_ctor)
4023 (perform_direct_initialization_if_possible): Use releasing_vec.
4024 * constexpr.c (cxx_eval_vec_init_1, cxx_eval_store_expression):
4026 * cp-gimplify.c (cp_fold): Likewise.
4027 * cvt.c (force_rvalue, ocp_convert): Likewise.
4028 * decl.c (get_tuple_decomp_init): Likewise.
4029 * except.c (build_throw): Likewise.
4030 * init.c (perform_member_init, expand_default_init): Likewise.
4031 * method.c (do_build_copy_assign, locate_fn_flags): Likewise.
4032 * parser.c (cp_parser_userdef_char_literal)
4033 (cp_parser_userdef_numeric_literal)
4034 (cp_parser_userdef_string_literal)
4035 (cp_parser_perform_range_for_lookup)
4036 (cp_parser_range_for_member_function, cp_parser_omp_for_loop)
4037 (cp_parser_omp_for_loop_init): Likewise.
4038 * pt.c (tsubst_copy_and_build, do_class_deduction): Likewise.
4039 * semantics.c (calculate_direct_bases, calculate_bases)
4040 (finish_omp_barrier, finish_omp_flush, finish_omp_taskwait)
4041 (finish_omp_taskyield, finish_omp_cancel)
4042 (finish_omp_cancellation_point): Likewise.
4043 * tree.c (build_vec_init_elt, strip_typedefs, strip_typedefs_expr)
4044 (build_min_non_dep_op_overload): Likewise.
4045 * typeck.c (build_function_call_vec, cp_build_function_call_nary)
4046 (cp_build_modify_expr): Likewise.
4047 * typeck2.c (build_functional_cast): Likewise.
4049 2019-05-11 Paolo Carlini <paolo.carlini@oracle.com>
4051 * typeck.c (cp_build_function_call_vec): When mark_used fails
4052 unconditionally return error_mark_node.
4054 2019-05-10 Paolo Carlini <paolo.carlini@oracle.com>
4056 * decl.c (grokvardecl): Use an accurate location in error message
4057 about main as a global variable.
4059 2019-05-10 Paolo Carlini <paolo.carlini@oracle.com>
4061 * call.c (build_call_a): Use FUNC_OR_METHOD_TYPE_P.
4062 * cp-gimplify.c (cp_fold): Likewise.
4063 * cp-objcp-common.c (cp_type_dwarf_attribute): Likewise.
4064 * cp-tree.h (TYPE_OBJ_P, TYPE_PTROBV_P): Likewise.
4065 * cvt.c (perform_qualification_conversions): Likewise.
4066 * decl.c (grokdeclarator): Likewise.
4067 * decl2.c (build_memfn_type): Likewise.
4068 * mangle.c (canonicalize_for_substitution, write_type): Likewise.
4069 * parser.c (cp_parser_omp_declare_reduction): Likewise.
4070 * pt.c (check_explicit_specialization, uses_deducible_template_parms,
4071 check_cv_quals_for_unify, dependent_type_p_r): Likewise.
4072 * rtti.c (ptr_initializer): Likewise.
4073 * semantics.c (finish_asm_stmt, finish_offsetof,
4074 cp_check_omp_declare_reduction): Likewise.
4075 * tree.c (cp_build_qualified_type_real,
4076 cp_build_type_attribute_variant, cxx_type_hash_eq,
4077 cxx_copy_lang_qualifiers, cp_free_lang_data): Likewise.
4078 * typeck.c (structural_comptypes, convert_arguments,
4079 cp_build_addr_expr_1, unary_complex_lvalue, cp_build_c_cast,
4080 cp_build_modify_expr, comp_ptr_ttypes_real, type_memfn_rqual):
4083 2019-05-10 Marek Polacek <polacek@redhat.com>
4085 PR c++/78010 - bogus -Wsuggest-override warning on final function.
4086 * class.c (check_for_override): Don't warn for final functions.
4088 2019-05-10 Jakub Jelinek <jakub@redhat.com>
4091 * config-lang.in (gtfiles): Remove c-family/c-lex.c, add
4092 c-family/c-cppbuiltin.c.
4094 2019-05-09 Paolo Carlini <paolo.carlini@oracle.com>
4098 2018-04-26 Paolo Carlini <paolo.carlini@oracle.com>
4100 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
4103 2019-05-08 Nathan Sidwell <nathan@acm.org>
4105 Kill DECL_SAVED_FUNCTION_DATA .
4106 * cp-tree.h (language_function): Remove x_auto_return_pattern.
4107 (current_function_auto_return_pattern): Delete.
4108 (lang_decl_fn): Replace saved_language_function with
4109 saved_auto_return type.
4110 (DECL_SAVED_FUNCTION_DATA): Delete.
4111 (DECL_SAVED_AUTO_RETURN_TYPE): New.
4112 (FNDECL_USED_AUTO): Correct documentation.
4113 * decl.c (duplicate_decls): Adjust AUTO return handling.
4114 (start_preparsed_function): Replace
4115 current_function_auto_return_pattern with
4116 DECL_SAVED_AUTO_RETURN_TYPE. Remove DECL_SAVED_FUNCTION_DATA
4118 (finish_function): Likewise.
4119 (save_function_data): Delete.
4120 (fndecl_declared_return_type): Reimplement.
4121 * mangle.c (write_unqualified_name): Use DECL_SAVED_AUTO_RETURN_TYPE.
4122 * method.c (make_thunk, make_alias_for): Likewise.
4123 * parser.c (cp_parser_jump_statement): Likewise.
4124 * pt.c (do_auto_deduction): Likewise.
4125 * typeck.c (check_return_expr): Likewise.
4127 2019-05-06 Jason Merrill <jason@redhat.com>
4129 PR c++/90171 - reorganize usual_deallocation_fn_p
4130 * call.c (struct dealloc_info): New.
4131 (usual_deallocation_fn_p): Take a dealloc_info*.
4132 (aligned_deallocation_fn_p, sized_deallocation_fn_p): Remove.
4133 (build_op_delete_call): Adjust.
4135 2019-05-07 Jason Merrill <jason@redhat.com>
4137 PR c++/86485 - -Wmaybe-unused with empty class ?:
4138 * typeck.c (build_static_cast_1): Use cp_build_addr_expr.
4140 * pt.c (type_dependent_expression_p): A non-type template parm with
4141 a placeholder type is type-dependent.
4143 2019-05-06 Marek Polacek <polacek@redhat.com>
4145 PR c++/90265 - ICE with generic lambda.
4146 * pt.c (tsubst_copy_and_build): Use a dedicated variable for the last
4147 element in the vector.
4149 2019-05-03 Martin Liska <mliska@suse.cz>
4151 * call.c (build_aggr_conv): Use is_empty instead of
4152 elements () == 0 (and similar usages).
4153 * parser.c (cp_parser_lambda_introducer): Likewise.
4155 2019-05-02 Nathan Sidwell <nathan@acm.org>
4157 * semantics.c (finish_id_expression_1): Remove unreachable code.
4159 2019-05-01 Nathan Sidwell <nathan@acm.org>
4161 * name-lookup.h (get_class_binding_direct): Change final arg to
4163 (get_class_binding): Likewise.
4164 * name-lookup.c (get_class_binding_direct): Replace TYPE_OR_FNS
4165 arg with WANT_TYPE bool. Simplify.
4166 (get_class_binding): Adjust final arg.
4167 * decl.c (reshape_init_class): Adjust get_class_binding calls.
4169 2019-04-30 Nathan Sidwell <nathan@acm.org>
4171 * cp-objcp-common.c (cp_common_init_ts): Use MARK_TS_EXP for _EXPR
4172 nodes. Call c_common_init_ts.
4174 2019-04-29 Nathan Sidwell <nathan@acm.org>
4176 * decl.c (duplicate_decls): Add whitespace, move comments into
4178 * method.c (explain_implicit_non_constexpr): Refactor.
4179 * pt.c (check_explicit_specialization): Fix indentation.
4180 * semantics.c (process_outer_var_ref): Reformat.
4181 (finish_id_expression_1): Use STRIP_TEMPLATE.
4183 2019-04-26 Jonathan Wakely <jwakely@redhat.com>
4185 PR c++/90243 - orphaned note in uninstantiated constexpr function
4186 * decl.c (check_for_uninitialized_const_var): Suppress notes if no
4189 2019-04-26 Paolo Carlini <paolo.carlini@oracle.com>
4192 * decl.c (grokdeclarator): Set type to error_mark_node
4193 upon error about template placeholder type non followed
4194 by a simple declarator-id.
4196 2019-04-26 Paolo Carlini <paolo.carlini@oracle.com>
4198 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
4201 2019-04-24 Jason Merrill <jason@redhat.com>
4203 PR c++/90227 - error with template parameter packs.
4204 * pt.c (coerce_template_parms): Do add empty pack when
4207 2019-04-24 Richard Biener <rguenther@suse.de>
4209 * call.c (null_ptr_cst_p): Order checks according to expensiveness.
4210 (conversion_null_warnings): Likewise.
4211 * typeck.c (same_type_ignoring_top_level_qualifiers_p): Return
4212 early if type1 == type2.
4214 2019-04-22 Jason Merrill <jason@redhat.com>
4216 PR c++/87366 - wrong error with alias template.
4217 * typeck.c (structural_comptypes): When comparing_specializations,
4218 aliases are unequal.
4219 (comptypes): When comparing_specializations, do structural
4222 2019-04-19 Jason Merrill <jason@redhat.com>
4224 PR c++/90190 - CTAD with list-constructor.
4225 * pt.c (do_class_deduction): Don't try the single element deduction
4226 if the single element is also a braced list.
4228 PR c++/90171 - ICE with destroying delete with size_t parm.
4229 * call.c (sized_deallocation_fn_p): New. Use it instead of
4230 second_parm_is_size_t in most cases.
4231 (second_parm_is_size_t): Don't check for aligned.
4233 2019-04-19 Paolo Carlini <paolo.carlini@oracle.com>
4236 * pt.c (fn_type_unification): When handling null explicit
4237 arguments do not special case non-parameter packs.
4239 2019-04-19 Jakub Jelinek <jakub@redhat.com>
4242 * pt.c (process_template_parm): Set decl to pushdecl result. If
4243 !is_non_type, also set parm to that.
4246 * decl.c (struct cp_switch): Remove outside_range_p member.
4247 (push_switch): Don't clear it.
4248 (pop_switch): Adjust c_do_switch_warnings caller.
4249 (finish_case_label): Adjust c_add_case_label caller.
4252 * decl.c (duplicate_decls): If remove is main variant and
4253 DECL_ORIGINAL_TYPE is some other type, remove a DECL_ORIGINAL_TYPE
4254 variant that has newdecl as TYPE_NAME if any.
4256 2019-04-18 Jason Merrill <jason@redhat.com>
4258 PR c++/87554 - ICE with extern template and reference member.
4259 * decl.c (cp_finish_decl): Don't set DECL_INITIAL of external vars.
4261 2019-04-17 Jason Merrill <jason@redhat.com>
4263 PR c++/90047 - ICE with enable_if alias template.
4264 * pt.c (tsubst_decl) [TYPE_DECL]: Don't put an erroneous decl in the
4265 hash table when we're in SFINAE context.
4267 2019-04-17 Marek Polacek <polacek@redhat.com>
4269 PR c++/90124 - bogus error with incomplete type in decltype.
4270 * typeck.c (build_class_member_access_expr): Check
4271 cp_unevaluated_operand.
4273 2019-04-12 Jakub Jelinek <jakub@redhat.com>
4276 * decl.c (duplicate_decls): When newdecl's type is its main variant,
4277 don't try to remove it from the variant list, but instead assert
4280 2019-04-12 Martin Sebor <msebor@redhat.com>
4284 * parser.c (cp_parser_has_attribute_expression): Handle assignment
4287 2019-04-12 Jason Merrill <jason@redhat.com>
4289 * call.c (null_member_pointer_value_p): Handle an empty CONSTRUCTOR
4292 2019-04-12 Marek Polacek <polacek@redhat.com>
4294 * except.c (build_noexcept_spec): Use build_converted_constant_bool_expr
4295 instead of perform_implicit_conversion_flags.
4297 PR c++/87603 - constexpr functions are no longer noexcept.
4298 * constexpr.c (is_sub_constant_expr): Remove unused function.
4299 * cp-tree.h (is_sub_constant_expr): Remove declaration.
4300 * except.c (check_noexcept_r): Don't consider a call to a constexpr
4303 2019-04-11 Jakub Jelinek <jakub@redhat.com>
4305 PR translation/90035
4306 * parser.h (struct cp_parser): Add
4307 type_definition_forbidden_message_arg member.
4308 * parser.c (cp_debug_parser): Print it.
4309 (cp_parser_check_type_definition): Pass
4310 parser->type_definition_forbidden_message_arg as second argument to
4312 (cp_parser_has_attribute_expression, cp_parser_sizeof_operand): Set
4313 parser->type_definition_forbidden_message_arg and use G_() with
4314 %qs for parser->type_definition_forbidden_message instead of
4315 building untranslatable message using concat.
4317 2019-04-09 Jakub Jelinek <jakub@redhat.com>
4319 PR translation/90011
4320 * typeck2.c (check_narrowing): Remove trailing space from diagnostics.
4322 2019-04-08 Marek Polacek <polacek@redhat.com>
4324 * typeck2.c (digest_init_r): Don't condition the object slicing warning
4327 2019-04-08 Paolo Carlini <paolo.carlini@oracle.com>
4330 * semantics.c (trait_expr_value): Don't use TYPE_NOTHROW_P
4331 when maybe_instantiate_noexcept fails.
4332 (classtype_has_nothrow_assign_or_copy_p): Likewise.
4333 * method.c (implicitly_declare_fn): Avoid passing error_mark_node
4334 to build_exception_variant.
4336 2019-04-05 Marek Polacek <polacek@redhat.com>
4338 PR c++/87145 - bogus error converting class type in template arg list.
4339 * pt.c (convert_nontype_argument): Don't call
4340 build_converted_constant_expr if it could involve calling a conversion
4341 function with a instantiation-dependent constructor as its argument.
4343 2019-04-05 Martin Sebor <msebor@redhat.com>
4346 * decl.c (reshape_init_array_1): Avoid treating empty strings
4347 as zeros in array initializers.
4348 Use trivial_type_p () instead of TYPE_HAS_TRIVIAL_DFLT().
4350 2019-04-04 Jason Merrill <jason@redhat.com>
4352 PR c++/89948 - ICE with break in statement-expr.
4353 * constexpr.c (cxx_eval_statement_list): Jumping out of a
4354 statement-expr is non-constant.
4356 2019-04-04 Jason Merrill <jason@redhat.com>
4358 PR c++/89966 - error with non-type auto tparm.
4359 * pt.c (do_auto_deduction): Clear tf_partial.
4361 2019-04-04 Jason Merrill <jason@redhat.com>
4363 PR c++/86986 - ICE with TTP with parameter pack.
4364 * pt.c (coerce_template_parameter_pack): Only look at the type of a
4365 non-type parameter pack.
4366 (fixed_parameter_pack_p_1): Don't recurse into the type of a
4367 non-type parameter pack.
4368 (coerce_template_template_parms): Call add_outermost_template_args.
4370 2019-04-04 Martin Sebor <msebor@redhat.com>
4376 * decl.c (reshape_init_array_1): Strip trailing zero-initializers
4377 from arrays of trivial type and known size.
4378 * mangle.c (write_expression): Convert braced initializer lists
4380 (write_expression): Trim trailing zero-initializers from arrays
4382 (write_template_arg_literal): Mangle strings the same as braced
4385 2019-04-03 Jason Merrill <jason@redhat.com>
4387 PR c++/81866 - ICE with member template and default targ.
4388 * pt.c (tsubst_template_decl): Handle getting a type from
4389 retrieve_specialization.
4391 PR c++/86586 - -fcompare-debug=-Wsign-compare.
4392 * typeck.c (cp_build_binary_op): Don't fold for -Wsign-compare.
4394 PR c++/89331 - ICE with offsetof in incomplete class.
4395 * semantics.c (finish_offsetof): Handle error_mark_node.
4396 * typeck.c (build_class_member_access_expr): Call
4397 complete_type_or_maybe_complain before converting to base.
4399 PR c++/89917 - ICE with lambda in variadic mem-init.
4400 * pt.c (make_pack_expansion): Change type_pack_expansion_p to false.
4402 2019-04-01 Jason Merrill <jason@redhat.com>
4404 PR c++/86946 - ICE with function call in template argument.
4406 * pt.c (iterative_hash_template_arg) [CALL_EXPR]: Use
4409 2019-04-01 Paolo Carlini <paolo.carlini@oracle.com>
4412 * pt.c (tsubst_copy): Deal with lookup_name not returing a variable.
4414 2019-03-31 Marek Polacek <polacek@redhat.com>
4416 PR c++/89852 - ICE with C++11 functional cast with { }.
4417 * constexpr.c (fold_non_dependent_expr_template): New static function
4419 (fold_non_dependent_expr): ...here.
4420 (fold_non_dependent_init): New function.
4421 * cp-tree.h (fold_non_dependent_init): Declare.
4422 * typeck2.c (massage_init_elt): Call fold_non_dependent_init instead
4423 of fold_non_dependent_expr. Don't call maybe_constant_init.
4425 2019-03-30 Jason Merrill <jason@redhat.com>
4427 PR c++/89744 - ICE with specialization of member class template.
4428 * pt.c (lookup_template_class_1): If the partial instantiation is
4429 explicitly specialized, adjust.
4430 (maybe_process_partial_specialization): Also adjust
4433 2019-03-29 Jakub Jelinek <jakub@redhat.com>
4436 * typeck.c: Include gimplify.h.
4437 (cp_build_modify_expr) <case COND_EXPR>: Unshare rhs before using it
4438 for second time. Formatting fixes.
4440 2019-03-29 Marek Polacek <polacek@redhat.com>
4442 PR c++/89876 - ICE with deprecated conversion.
4443 * call.c (convert_like_real): Only give warnings with tf_warning.
4445 2019-03-28 Marek Polacek <polacek@redhat.com>
4447 PR c++/89612 - ICE with member friend template with noexcept.
4448 * pt.c (maybe_instantiate_noexcept): For function templates, use their
4449 template result (function decl). Don't set up local specializations.
4450 Temporarily turn on processing_template_decl. Update the template type
4453 PR c++/89836 - bool constant expression and explicit conversions.
4454 * call.c (build_converted_constant_expr_internal): New function,
4456 (build_converted_constant_expr): ...this. New.
4457 (build_converted_constant_bool_expr): New.
4458 * cp-tree.h (build_converted_constant_bool_expr): Declare.
4459 * decl.c (build_explicit_specifier): Call
4460 build_converted_constant_bool_expr.
4462 2019-03-28 Jakub Jelinek <jakub@redhat.com>
4465 * constexpr.c (struct check_for_return_continue_data): New type.
4466 (check_for_return_continue): New function.
4467 (potential_constant_expression_1) <case SWITCH_STMT>: Walk
4468 SWITCH_STMT_BODY to find RETURN_EXPRs or CONTINUE_STMTs not nested
4469 in loop bodies and set *jump_target to that if found.
4471 2019-03-27 Jason Merrill <jason@redhat.com>
4473 PR c++/89831 - error with qualified-id in const member function.
4474 * semantics.c (finish_non_static_data_member): Use object cv-quals
4475 in scoped case, too.
4477 PR c++/89421 - ICE with lambda in template parameter list.
4478 * parser.c (cp_parser_lambda_expression): Also reject a lambda in a
4479 template parameter list before C++20.
4480 * pt.c (type_dependent_expression_p): True for LAMBDA_EXPR.
4481 * semantics.c (begin_class_definition): Restore error about defining
4482 non-lambda class in template parm list.
4484 2019-03-26 Jason Merrill <jason@redhat.com>
4486 PR c++/86932 - missed SFINAE with empty pack.
4487 * pt.c (coerce_template_parms): Don't add an empty pack if
4489 (fn_type_unification): Pass tf_partial to coerce_template_parms.
4491 PR c++/86429 - constexpr variable in lambda.
4494 * constexpr.c (cxx_eval_constant_expression): In a lambda function,
4495 try evaluating the captured variable directly.
4497 2019-03-26 Jakub Jelinek <jakub@redhat.com>
4500 * semantics.c (finish_omp_atomic): Add warning_sentinel for
4501 -Wunused-value around finish_expr_stmt call.
4503 2019-03-25 Paolo Carlini <paolo.carlini@oracle.com>
4507 * parser.c (cp_parser_binary_expression): Don't call cp_fully_fold
4508 to undo the disabling of warnings.
4510 2019-03-25 Jason Merrill <jason@redhat.com>
4512 PR c++/87748 - substitution failure error with decltype.
4513 * pt.c (most_specialized_partial_spec): Clear
4514 processing_template_decl.
4516 2019-03-25 Marek Polacek <polacek@redhat.com>
4518 PR c++/89214 - ICE when initializing aggregates with bases.
4519 * typeck2.c (digest_init_r): Warn about object slicing instead of
4522 PR c++/89705 - ICE with reference binding with conversion function.
4523 * call.c (reference_binding): If the result of the conversion function
4524 is a prvalue of non-class type, use the cv-unqualified type.
4526 2019-03-25 Nathan Sidwell <nathan@acm.org>
4528 * lambda.c (maybe_add_lambda_conv_op): Don't add to comdat group.
4530 2019-03-22 Jakub Jelinek <jakub@redhat.com>
4533 * cp-tree.h (get_tls_wrapper_fn): Remove declaration.
4534 (maybe_get_tls_wrapper_call): Declare.
4535 * decl2.c (get_tls_wrapper_fn): Make static.
4536 (maybe_get_tls_wrapper_call): New function.
4537 * typeck.c (build_class_member_access_expr): Handle accesses to TLS
4539 * semantics.c (finish_qualified_id_expr): Likewise.
4540 (finish_id_expression_1): Use maybe_get_tls_wrapper_call.
4541 * pt.c (tsubst_copy_and_build): Likewise.
4544 * constexpr.c (struct constexpr_ctx): Add constexpr_ops_count member.
4545 (cxx_eval_constant_expression): When not skipping, not constant class
4546 or location wrapper, increment *ctx->constexpr_ops_count and if it is
4547 above constexpr_loop_nest_limit, diagnose failure.
4548 (cxx_eval_outermost_constant_expr): Add constexpr_ops_count and
4549 initialize ctx.constexpr_ops_count to its address.
4550 (is_sub_constant_expr): Likewise.
4552 2019-03-21 Jakub Jelinek <jakub@redhat.com>
4555 * call.c (filed_in_pset): Change pset from hash_set<tree> * to
4556 hash_set<tree, true> &, adjust uses accordingly.
4557 (build_aggr_conv): Change pset from hash_set<tree> *
4558 to hash_set<tree, true>. Replace goto fail; with return NULL;,
4562 * parser.c (cp_parser_lambda_introducer): Add ids and first_capture_id
4563 variables, check for duplicates in this function.
4564 * lambda.c (add_capture): Don't check for duplicates nor use
4566 (register_capture_members): Don't clear IDENTIFIER_MARKED here.
4568 2019-03-21 Paolo Carlini <paolo.carlini@oracle.com>
4571 * method.c (after_nsdmi_defaulted_late_checks): Avoid passing
4572 error_mark_node to comp_except_specs.
4574 2019-03-20 Jason Merrill <jason@redhat.com>
4576 PR c++/87480 - decltype of member access in default template arg
4577 * pt.c (type_unification_real): Accept a dependent result in
4580 2019-03-19 Martin Sebor <msebor@redhat.com>
4582 PR tree-optimization/89688
4583 * typeck2.c (store_init_value): Call braced_lists_to_string for more
4584 kinds of initializers.
4586 2019-03-18 Jason Merrill <jason@redhat.com>
4588 PR c++/89630 - ICE with dependent using-decl as template arg.
4589 * tree.c (cp_tree_equal): Always return false for USING_DECL.
4591 PR c++/89761 - ICE with sizeof... in pack expansion.
4592 * pt.c (argument_pack_element_is_expansion_p): Handle
4593 ARGUMENT_PACK_SELECT.
4595 PR c++/89640 - GNU attributes on lambda.
4596 * parser.c (cp_parser_lambda_declarator_opt): Allow GNU attributes.
4598 PR c++/89682 - wrong access error in default argument.
4599 * pt.c (tsubst_default_argument): Don't defer access checks.
4601 2019-03-18 Paolo Carlini <paolo.carlini@oracle.com>
4604 * semantics.c (finish_non_static_data_member): Check return value
4605 of context_for_name_lookup and immediately return error_mark_node
4608 2019-03-17 Jason Merrill <jason@redhat.com>
4610 PR c++/89571 - ICE with ill-formed noexcept on constructor.
4611 * pt.c (maybe_instantiate_noexcept): Only return false if defaulted.
4612 (regenerate_decl_from_template): Use it for noexcept-specs.
4614 2019-03-14 Jason Merrill <jason@redhat.com>
4616 * parser.c (cp_parser_decl_specifier_seq): Support C++20
4617 concept-definition syntax without 'bool'.
4619 2019-03-14 Jakub Jelinek <jakub@redhat.com>
4622 * semantics.c (finish_qualified_id_expr): Reject variable templates.
4625 * constexpr.c (struct constexpr_ctx): Change save_exprs type from
4626 hash_set<tree> to vec<tree>.
4627 (cxx_eval_call_expression): Adjust for save_exprs being a vec instead
4629 (cxx_eval_loop_expr): Likewise. Truncate the vector after each
4630 removal of SAVE_EXPRs from values.
4631 (cxx_eval_constant_expression) <case SAVE_EXPR>: Call safe_push
4632 method on save_exprs instead of add.
4634 2019-03-13 Jason Merrill <jason@redhat.com>
4636 PR c++/86521 - C++17 copy elision in initialization by constructor.
4637 * call.c (joust_maybe_elide_copy): New.
4640 2019-03-13 Marek Polacek <polacek@redhat.com>
4642 PR c++/88979 - further P0634 fix for constructors.
4643 * parser.c (cp_parser_decl_specifier_seq): Pass flags to
4644 cp_parser_constructor_declarator_p.
4645 (cp_parser_direct_declarator): Allow missing typename for constructor
4647 (cp_parser_constructor_declarator_p): Add FLAGS parameter. Pass it to
4648 cp_parser_type_specifier.
4650 PR c++/89686 - mixing init-capture and simple-capture in lambda.
4651 * parser.c (cp_parser_lambda_introducer): Give error when combining
4652 init-capture and simple-capture.
4654 PR c++/89660 - bogus error with -Wredundant-move.
4655 * typeck.c (maybe_warn_pessimizing_move): Only accept (T &) &arg
4656 as the std::move's argument. Don't call convert_for_initialization
4657 when warn_redundant_move isn't on.
4659 2019-03-11 Jason Merrill <jason@redhat.com>
4661 PR c++/86521 - wrong overload resolution with ref-qualifiers.
4662 * call.c (build_user_type_conversion_1): Don't use a conversion to a
4663 reference of the wrong rvalueness for direct binding.
4665 2019-03-11 Martin Liska <mliska@suse.cz>
4667 * cvt.c (build_expr_type_conversion): Wrap apostrophes
4668 in gcc internal format with %'.
4669 * decl.c (check_no_redeclaration_friend_default_args): Likewise.
4670 (grokfndecl): Likewise.
4671 * name-lookup.c (do_pushtag): Likewise.
4672 * pt.c (unify_parameter_deduction_failure): Likewise.
4673 (unify_template_deduction_failure): Likewise.
4675 2019-03-11 Martin Liska <mliska@suse.cz>
4677 * call.c (convert_arg_to_ellipsis): Wrap an option name
4678 in a string format message and fix GNU coding style.
4679 (build_over_call): Likewise.
4680 * class.c (check_field_decl): Likewise.
4681 (layout_nonempty_base_or_field): Likewise.
4682 * constexpr.c (cxx_eval_loop_expr): Likewise.
4683 * cvt.c (type_promotes_to): Likewise.
4684 * decl.c (cxx_init_decl_processing): Likewise.
4685 (mark_inline_variable): Likewise.
4686 (grokdeclarator): Likewise.
4687 * decl2.c (record_mangling): Likewise.
4688 * error.c (maybe_warn_cpp0x): Likewise.
4689 * except.c (doing_eh): Likewise.
4690 * mangle.c (maybe_check_abi_tags): Likewise.
4691 * parser.c (cp_parser_diagnose_invalid_type_name): Likewise.
4692 (cp_parser_userdef_numeric_literal): Likewise.
4693 (cp_parser_primary_expression): Likewise.
4694 (cp_parser_unqualified_id): Likewise.
4695 (cp_parser_pseudo_destructor_name): Likewise.
4696 (cp_parser_builtin_offsetof): Likewise.
4697 (cp_parser_lambda_expression): Likewise.
4698 (cp_parser_lambda_introducer): Likewise.
4699 (cp_parser_lambda_declarator_opt): Likewise.
4700 (cp_parser_selection_statement): Likewise.
4701 (cp_parser_init_statement): Likewise.
4702 (cp_parser_decomposition_declaration): Likewise.
4703 (cp_parser_function_specifier_opt): Likewise.
4704 (cp_parser_static_assert): Likewise.
4705 (cp_parser_simple_type_specifier): Likewise.
4706 (cp_parser_namespace_definition): Likewise.
4707 (cp_parser_using_declaration): Likewise.
4708 (cp_parser_ctor_initializer_opt_and_function_body): Likewise.
4709 (cp_parser_initializer_list): Likewise.
4710 (cp_parser_type_parameter_key): Likewise.
4711 (cp_parser_member_declaration): Likewise.
4712 (cp_parser_try_block): Likewise.
4713 (cp_parser_std_attribute_spec): Likewise.
4714 (cp_parser_requires_clause_opt): Likewise.
4715 * pt.c (check_template_variable): Likewise.
4716 (check_default_tmpl_args): Likewise.
4717 (push_tinst_level_loc): Likewise.
4718 (instantiate_pending_templates): Likewise.
4719 (invalid_nontype_parm_type_p): Likewise.
4720 * repo.c (get_base_filename): Likewise.
4721 * rtti.c (typeid_ok_p): Likewise.
4722 (build_dynamic_cast_1): Likewise.
4723 * tree.c (maybe_warn_parm_abi): Likewise.
4725 2019-03-08 Jakub Jelinek <jakub@redhat.com>
4728 * parser.c (cp_parser_template_declaration_after_parameters): Avoid
4729 one space before " at the end of line and another after " on another
4730 line in a string literal.
4732 PR tree-optimization/89550
4733 * semantics.c (maybe_convert_cond): Only set TREE_NO_WARNING if
4734 warning_at returned true.
4735 * decl2.c (c_parse_final_cleanups): Likewise.
4736 * typeck.c (convert_for_assignment): Likewise.
4737 * decl.c (finish_function): Likewise.
4740 * parser.c (cp_parser_asm_definition): Just warn instead of error
4741 on volatile qualifier outside of function body.
4744 * constexpr.c (potential_constant_expression_1): Reject
4745 REINTERPRET_CAST_P NOP_EXPRs.
4748 * call.c (joust): Call print_z_candidate only if pedwarn returned
4751 2019-03-07 Jason Merrill <jason@redhat.com>
4753 PR c++/88123 - lambda and using-directive.
4754 * name-lookup.c (op_unqualified_lookup)
4755 (maybe_save_operator_binding, discard_operator_bindings)
4756 (push_operator_bindings): New.
4757 * typeck.c (build_x_binary_op, build_x_unary_op): Call
4758 maybe_save_operator_binding.
4759 * decl.c (start_preparsed_function): Call push_operator_bindings.
4760 * tree.c (cp_free_lang_data): Call discard_operator_bindings.
4762 PR c++/88820 - ICE with CTAD and member template used in DMI.
4763 * pt.c (do_class_deduction): Handle parm used as its own arg.
4765 2019-03-07 Jakub Jelinek <jakub@redhat.com>
4768 * parser.c (cp_parser_asm_definition): Parse asm qualifiers even
4769 at toplevel, but diagnose them.
4771 2019-03-06 Jason Merrill <jason@redhat.com>
4773 PR c++/89381 - implicit copy and using-declaration.
4774 * class.c (classtype_has_move_assign_or_move_ctor_p): Don't consider
4775 op= brought in by a using-declaration.
4777 2019-03-06 Jakub Jelinek <jakub@redhat.com>
4780 * init.c (build_value_init_noctor): Ignore flexible array members.
4782 2019-03-06 Jason Merrill <jason@redhat.com>
4784 PR c++/89576 - if constexpr of lambda capture.
4785 * semantics.c (maybe_convert_cond): Do convert a non-dependent
4786 condition in a template.
4787 * typeck.c (condition_conversion): Handle being called in a
4790 2019-03-06 Marek Polacek <polacek@redhat.com>
4792 PR c++/87378 - bogus -Wredundant-move warning.
4793 * typeck.c (maybe_warn_pessimizing_move): See if the maybe-rvalue
4794 overload resolution would actually succeed.
4796 2019-03-05 Jason Merrill <jason@redhat.com>
4798 * class.c (is_really_empty_class): Add ignore_vptr parm.
4799 (trivial_default_constructor_is_constexpr): Pass it.
4800 * call.c (build_over_call): Pass it.
4801 * constexpr.c (cxx_eval_constant_expression): Pass it instead of
4802 checking TYPE_POLYMORPHIC_P.
4803 (cxx_eval_component_reference, potential_constant_expression_1):
4805 * cp-gimplify.c (simple_empty_class_p): Pass it.
4806 * init.c (expand_aggr_init_1): Pass it.
4808 2019-03-04 Paolo Carlini <paolo.carlini@oracle.com>
4811 * parser.c (cp_parser_class_head): Reject TYPE_BEING_DEFINED too.
4813 2019-03-04 Jakub Jelinek <jakub@redhat.com>
4816 * call.c (field_in_pset): New function.
4817 (build_aggr_conv): Handle CONSTRUCTOR_IS_DESIGNATED_INIT correctly.
4819 2019-03-02 Jakub Jelinek <jakub@redhat.com>
4822 * cp-tree.h (CONSTRUCTOR_IS_DESIGNATED_INIT): Define.
4823 * parser.c (cp_parser_braced_list): Adjust cp_parser_initializer_list
4824 caller, set CONSTRUCTOR_IS_DESIGNATED_INIT.
4825 (cp_parser_initializer_list): Add designated parameter, set *designated
4826 to a bool whether any designators were parsed.
4827 * decl.c (reshape_init): Copy over CONSTRUCTOR_IS_DESIGNATED_INIT if
4829 * pt.c (tsubst_copy_and_build): Likewise.
4830 * call.c (implicit_conversion): If CONSTRUCTOR_IS_DESIGNATED_INIT,
4831 don't call build_list_conv, nor build_complex_conv, nor attempt to
4832 convert a single element initializer to scalar.
4834 2019-03-01 Marek Polacek <polacek@redhat.com>
4836 PR c++/89537 - missing location for error with non-static member fn.
4837 * call.c (resolve_args): Use EXPR_LOCATION.
4838 * typeck.c (build_class_member_access_expr): Use input_location.
4840 PR c++/89532 - ICE with incomplete type in decltype.
4841 * semantics.c (finish_compound_literal): Return error_mark_node
4842 if digest_init_flags returns error_mark_node.
4844 2019-03-01 Jakub Jelinek <jakub@redhat.com>
4846 Implement P1002R1, Try-catch blocks in constexpr functions
4848 * parser.c (cp_parser_ctor_initializer_opt_and_function_body):
4849 Diagnose constexpr ctor or function with function-try-block with
4850 pedwarn for c++17 and earlier. Formatting fix.
4851 (cp_parser_try_block): Use pedwarn instead of error and only for
4852 c++17 and earlier when try block appears in constexpr function.
4853 * constexpr.c (build_constexpr_constructor_member_initializers):
4854 Handle TRY_BLOCK here instead of erroring on it.
4856 2019-02-28 Jason Merrill <jason@redhat.com>
4858 PR c++/88183 - ICE with .* fold-expression.
4859 * pt.c (fold_expression) [DOTSTAR_EXPR]: Remove special handling.
4861 PR c++/86969 - ICE with constexpr if and recursive generic lambdas.
4862 * class.c, lambda.c, pt.c: Revert earlier change.
4863 * lambda.c (add_capture): Don't special-case capture of dependent
4866 * name-lookup.c (print_binding_level): Print this_entity.
4868 2019-02-27 Marek Polacek <polacek@redhat.com>
4870 PR c++/88857 - ICE with value-initialization of argument in template.
4871 * call.c (convert_like_real): Don't call build_value_init in template.
4873 2019-02-27 Jason Merrill <jason@redhat.com>
4875 PR c++/86969 - ICE with constexpr if and recursive generic lambdas.
4876 * semantics.c (process_outer_var_ref): Do capture dependent vars.
4877 * class.c (finish_struct): Only add TAG_DEFN if T is in
4878 current_function_decl.
4879 * lambda.c (vla_capture_type): Force the capture type out into the
4880 lambda's enclosing function.
4881 (add_capture): Pass in the lambda.
4882 * pt.c (tsubst_lambda_expr): complete_type a VLA capture type.
4884 2019-02-27 Marek Polacek <polacek@redhat.com>
4886 PR c++/89511 - ICE with using-declaration and unscoped enumerator.
4887 * parser.c (cp_parser_using_declaration): For an unscoped enum
4888 only use its context if it's not a function declaration.
4890 2019-02-27 Paolo Carlini <paolo.carlini@oracle.com>
4893 * method.c (process_subob_fn): When maybe_instantiate_noexcept
4894 returns false don't call merge_exception_specifiers.
4896 2019-02-27 Paolo Carlini <paolo.carlini@oracle.com>
4899 * parser.c (cp_parser_noexcept_specification_opt): Return NULL_TREE
4900 for a non-constant parsed expression.
4902 2019-02-26 Jakub Jelinek <jakub@redhat.com>
4905 * constexpr.c (cxx_eval_store_expression): When changing active union
4906 member, set no_zero_init.
4908 2019-02-23 Marek Polacek <polacek@redhat.com>
4910 PR c++/88294 - ICE with non-constant noexcept-specifier.
4911 * pt.c (maybe_instantiate_noexcept): Set up the list of local
4912 specializations. Set current_class_{ptr,ref}.
4914 2019-02-22 David Malcolm <dmalcolm@redhat.com>
4917 * parser.c (cp_parser_unqualified_id): Capture and use locations
4920 2019-02-22 Marek Polacek <polacek@redhat.com>
4922 PR c++/89420 - ICE with CAST_EXPR in explicit-specifier.
4923 * decl.c (build_explicit_specifier): Don't check
4924 processing_template_decl. Call instantiation_dependent_expression_p
4925 instead of value_dependent_expression_p. Call
4926 instantiate_non_dependent_expr_sfinae before
4927 build_converted_constant_expr instead of calling
4928 instantiate_non_dependent_expr after it. Add
4929 processing_template_decl_sentinel.
4931 2019-02-22 Thomas Schwinge <thomas@codesourcery.com>
4933 * parser.c (cp_parser_oacc_simple_clause): Remove parser formal
4934 parameter, move loc formal parameter to the front. Adjust all
4936 (cp_parser_oacc_shape_clause): Add loc formal parameter. Adjust
4939 2019-02-21 Jason Merrill <jason@redhat.com>
4941 PR c++/87685 - generic lambda 'this' capture error.
4942 * lambda.c (lambda_expr_this_capture): Change add_capture_p to int.
4943 (maybe_generic_this_capture): Pass -1.
4945 PR c++/88394 - ICE with VLA init-capture.
4946 * lambda.c (is_normal_capture_proxy): Check DECL_CAPTURED_VARIABLE.
4948 PR c++/88869 - C++17 ICE with CTAD and explicit specialization.
4949 * pt.c (do_class_deduction): Don't include explicit specialization
4952 PR c++/89422 - ICE with -g and lambda in default arg in template.
4953 * pt.c (tsubst_function_decl): SET_DECL_FRIEND_CONTEXT sooner.
4955 2019-02-21 Jason Merrill <jason@redhat.com>
4957 PR c++/88419 - C++17 ICE with class template arg deduction.
4958 * pt.c (make_template_placeholder): Set TYPE_CANONICAL after
4959 CLASS_PLACEHOLDER_TEMPLATE.
4961 2019-02-21 Jakub Jelinek <jakub@redhat.com>
4964 * constexpr.c (struct constexpr_fundef): Add parms and result members.
4965 (retrieve_constexpr_fundef): Adjust for the above change.
4966 (register_constexpr_fundef): Save constexpr body with copy_fn,
4967 temporarily set DECL_CONTEXT on DECL_RESULT before that.
4968 (get_fundef_copy): Change FUN argument to FUNDEF with
4969 constexpr_fundef * type, grab body and parms/result out of
4970 constexpr_fundef struct and temporarily change it for copy_fn calls
4972 (cxx_eval_builtin_function_call): For __builtin_FUNCTION temporarily
4973 adjust current_function_decl from ctx->call context. Test
4974 !potential_constant_expression instead of !is_constant_expression.
4975 (cxx_bind_parameters_in_call): Grab parameters from new_call. Undo
4976 convert_for_arg_passing changes for TREE_ADDRESSABLE type passing.
4977 (cxx_eval_call_expression): Adjust get_fundef_copy caller.
4978 (cxx_eval_conditional_expression): For IF_STMT, allow then or else
4979 operands to be NULL.
4980 (label_matches): Handle BREAK_STMT and CONTINUE_STMT.
4981 (cxx_eval_loop_expr): Add support for FOR_STMT, WHILE_STMT and DO_STMT.
4982 (cxx_eval_switch_expr): Add support for SWITCH_STMT.
4983 (cxx_eval_constant_expression): Handle IF_STMT, FOR_STMT, WHILE_STMT,
4984 DO_STMT, CONTINUE_STMT, SWITCH_STMT, BREAK_STMT and CONTINUE_STMT.
4985 For SIZEOF_EXPR, recurse on the result of fold_sizeof_expr. Ignore
4986 DECL_EXPR with USING_DECL operand.
4987 * lambda.c (maybe_add_lambda_conv_op): Build thisarg using
4988 build_int_cst to make it a valid constant expression.
4990 2019-02-20 Jason Merrill <jason@redhat.com>
4992 PR c++/88690 - C++17 ICE with empty base in aggregate.
4993 * typeck2.c (process_init_constructor_record): Skip trivial
4994 initialization of an empty base.
4996 2019-02-21 Richard Biener <rguenther@suse.de>
4999 * vtable-class-hierarchy.c (vtv_generate_init_routine): Do not
5000 make symtab process new functions here.
5002 2019-02-20 Jason Merrill <jason@redhat.com>
5004 PR c++/87921 - wrong error with inline static data member.
5005 * decl2.c (finish_static_data_member_decl): Don't set DECL_IN_AGGR_P
5006 for a non-template inline variable. Do nothing for an
5007 already-instantiated variable.
5008 (c_parse_final_cleanups): Check DECL_IN_AGGR_P without
5010 * decl.c (check_initializer): Likewise.
5011 (make_rtl_for_nonlocal_decl): Likewise.
5012 * pt.c (instantiate_decl): Likewise.
5013 * typeck2.c (store_init_value): Likewise.
5015 2019-02-20 Jakub Jelinek <jakub@redhat.com>
5018 * decl2.c (c_parse_final_cleanups): Move TREE_ASM_WRITTEN setting
5019 for flag_syntax_only from here...
5020 * semantics.c (expand_or_defer_fn_1): ... here.
5023 * decl.c (maybe_commonize_var): When clearing TREE_PUBLIC and
5024 DECL_COMMON, set DECL_INTERFACE_KNOWN.
5027 * constexpr.c (cxx_eval_store_expression): Diagnose changing of active
5028 union member for -std=c++17 and earlier.
5030 2019-02-19 Jason Merrill <jason@redhat.com>
5032 PR c++/87513 - 'sorry' mangling PMF template-id.
5033 * mangle.c (write_expression): Handle SCOPE_REF to BASELINK.
5035 2019-02-19 Jason Merrill <jason@redhat.com>
5037 PR c++/88380 - wrong-code with flexible array and NSDMI.
5038 * typeck2.c (process_init_constructor_record): Skip flexarrays.
5040 2019-02-20 will wray <wjwray@gmail.com>
5042 PR c++/88572 - wrong handling of braces on scalar init.
5043 * decl.c (reshape_init_r): Allow braces around scalar initializer
5044 within aggregate init. Reject double braced-init of scalar
5047 2019-02-20 Paolo Carlini <paolo.carlini@oracle.com>
5050 * pt.c (tsubst_init): Diagnose an initializer expanding to an
5051 empty list of expressions; tweak wrt dependent types.
5052 (regenerate_decl_from_template): For VAR_DECLs call tsubst_init
5053 instead of tsubst_expr.
5055 2019-02-19 Jason Merrill <jason@redhat.com>
5057 PR c++/88368 - wrong 'use of deleted function'
5058 * method.c (walk_field_subobs): Remember errors from get_nsdmi.
5059 (get_defaulted_eh_spec): Call push_tinst_level.
5060 * pt.c (maybe_instantiate_noexcept): Keep error_mark_node.
5061 * typeck2.c (merge_exception_specifiers): Handle error_mark_node.
5063 2019-02-19 Chung-Lin Tang <cltang@codesourcery.com>
5066 * parser.c (cp_parser_oacc_clause_wait): Add representation of wait
5067 clause without argument as 'wait (GOMP_ASYNC_NOVAL)', adjust comments.
5069 2019-02-19 Jakub Jelinek <jakub@redhat.com>
5072 * lambda.c (maybe_generic_this_capture): Don't check
5073 DECL_NONSTATIC_MEMBER_FUNCTION_P on USING_DECLs.
5076 * typeck.c (build_reinterpret_cast_1): Don't handle void to
5077 && conversion go through build_target_expr_with_type.
5080 * error.c (qualified_name_lookup_error): Only call
5081 suggest_alternative_in_scoped_enum if name is IDENTIFIER_NODE.
5083 2019-02-19 Tom Honermann <tom@honermann.net>
5085 * name-lookup.c (get_std_name_hint): Added u8string as a name hint.
5087 2019-02-18 Jason Merrill <jason@redhat.com>
5089 PR c++/89336 - multiple stores in constexpr stmt.
5090 * constexpr.c (cxx_eval_store_expression): Preevaluate scalar or
5093 * pt.c (check_explicit_specialization): If the declarator is a
5094 template-id, only check whether the arguments are dependent.
5096 Improve duplicate [[likely]] diagnostic.
5097 * parser.c (cp_parser_statement): Make attrs_loc a range. Pass it
5098 to process_stmt_hotness_attribute.
5099 * cp-gimplify.c (process_stmt_hotness_attribute): Take attrs_loc.
5100 (genericize_if_stmt): Use likely/unlikely instead of predictor_name.
5102 2019-02-17 Marek Polacek <polacek@redhat.com>
5104 PR c++/89217 - ICE with list-initialization in range-based for loop.
5105 * constexpr.c (unshare_constructor): No longer static.
5106 * cp-tree.h (unshare_constructor): Declare.
5107 * semantics.c (finish_compound_literal): When dealing with a
5108 non-dependent expression in a template, return the original
5109 expression. Pass LOOKUP_NO_NARROWING to digest_init_flags.
5111 2019-02-13 Marek Polacek <polacek@redhat.com>
5113 PR c++/89297 - ICE with OVERLOAD in template.
5114 * semantics.c (finish_compound_literal): Call
5115 instantiate_non_dependent_expr_sfinae.
5117 2019-02-13 Alexandre Oliva <aoliva@redhat.com>
5120 * cp-tree.h (USING_DECL_SCOPE): Use result rather than type.
5121 * name-lookup.c (strip_using_decl): Use USING_DECL_SCOPE.
5122 * search.c (protected_accessible_p): Follow USING_DECL_DECLS.
5123 (shared_member_p): Likewise.
5124 (lookup_member): Likewise.
5125 * decl.c (grok_special_member_properties): Skip USING_DECLs.
5126 * semantics.c (finish_omp_declare_simd_methods): Likewise.
5127 (finish_qualified_id_expr): Do not call shared_member_p with
5131 * pt.c (tsubst_lambda_expr): Avoid duplicate tsubsting.
5132 Move cp_evaluated resetting before signature tsubsting.
5133 (gen_elem_of_pack_expansion_instantiation): Separate local
5134 specializations per index.
5136 2019-02-13 David Malcolm <dmalcolm@redhat.com>
5139 * class.c (add_method): Drop destructor assertion.
5141 2019-02-13 Paolo Carlini <paolo.carlini@oracle.com>
5144 * decl.c (make_typename_type): Allow for TYPE_PACK_EXPANSION as
5145 context (the first argument).
5146 * pt.c (tsubst, case TYPENAME_TYPE): Handle TYPE_PACK_EXPANSION
5149 2019-02-12 Jason Merrill <jason@redhat.com>
5151 PR c++/89144 - link error with constexpr initializer_list.
5152 * call.c (convert_like_real) [ck_list]: Don't allocate a temporary
5153 array for an empty list.
5154 * typeck2.c (store_init_value): Don't use cxx_constant_init in a
5157 2019-02-11 Jason Merrill <jason@redhat.com>
5159 PR c++/89241 - ICE with __func__ in lambda in template.
5160 * pt.c (enclosing_instantiation_of): Also check
5161 instantiated_lambda_fn_p for the template context.
5163 2019-02-11 Marek Polacek <polacek@redhat.com>
5165 PR c++/89212 - ICE converting nullptr to pointer-to-member-function.
5166 * pt.c (tsubst_copy_and_build) <case CONSTRUCTOR>: Return early for
5167 null member pointer value.
5169 2019-02-11 Jakub Jelinek <jakub@redhat.com>
5172 * pt.c (convert_nontype_argument): Pass true as manifestly_const_eval
5173 to maybe_constant_value calls.
5175 2019-02-11 Marek Polacek <polacek@redhat.com>
5177 * typeck2.c (digest_init_r): Remove commented code.
5179 2019-02-11 Martin Sebor <msebor@redhat.com>
5182 * decl.c (compute_array_index_type_loc): Preserve signed sizes
5183 for diagnostics. Call valid_array_size_p instead of error.
5184 * init.c (build_new_1): Compute size for diagnostic. Call
5185 invalid_array_size_error
5186 (build_new): Call valid_array_size_p instead of error.
5188 2019-02-07 Alexandre Oliva <aoliva@redhat.com>
5191 * call.c (compare_ics): Deal with ck_aggr in either cs.
5193 2019-02-06 David Malcolm <dmalcolm@redhat.com>
5196 * call.c (get_location_for_expr_unwinding_for_system_header): New
5198 (conversion_null_warnings): Use it when getting locations for
5199 EXPR, effectively adding a call to
5200 get_location_for_expr_unwinding_for_system_header for
5201 -Wconversion-null and making use of EXPR_LOCATION for
5202 -Wzero-as-null-pointer-constant.
5204 2019-02-05 Jakub Jelinek <jakub@redhat.com>
5207 * optimize.c (maybe_thunk_body): Clear TREE_ADDRESSABLE on
5208 PARM_DECLs of the thunk.
5209 * lambda.c (maybe_add_lambda_conv_op): Likewise.
5211 2019-02-05 Marek Polacek <polacek@redhat.com>
5213 PR c++/89158 - by-value capture of constexpr variable broken.
5214 * call.c (convert_like_real) <case ck_user>: Call mark_exp_read
5215 instead of mark_rvalue_use.
5217 2019-02-05 Alexandre Oliva <aoliva@redhat.com>
5220 * pt.c (instantiates_primary_template_p): New.
5221 (type_dependent_expression_p): Use it.
5223 2019-02-01 Jason Merrill <jason@redhat.com>
5225 PR c++/88761 - ICE with reference capture of constant.
5226 * lambda.c (mark_const_cap_r): Do walk subtrees of DECL_EXPR for
5229 2019-02-01 Marek Polacek <polacek@redhat.com>
5231 PR c++/88325 - ICE with invalid out-of-line template member definition.
5232 * parser.c (cp_parser_class_name): Don't call make_typename_type
5235 2019-02-01 Jakub Jelinek <jakub@redhat.com>
5238 * parser.c (cp_parser_gnu_attributes_opt): Set ok to false
5239 if require_open failed.
5241 2019-01-31 Marek Polacek <polacek@redhat.com>
5243 PR c++/89083, c++/80864 - ICE with list initialization in template.
5244 * constexpr.c (adjust_temp_type): Use copy_node and change the type
5245 instead of using build_constructor.
5246 * decl.c (reshape_init_r): Don't reshape a digested initializer.
5247 Return the initializer for COMPOUND_LITERAL_P.
5249 PR c++/88983 - ICE with switch in constexpr function.
5250 * constexpr.c (cxx_eval_switch_expr): Use SWITCH_COND and SWITCH_BODY.
5251 (cxx_eval_constant_expression) <case COND_EXPR>: Don't look for the
5252 label in the else branch if we found it in the then branch.
5254 2019-01-30 Jason Merrill <jason@redhat.com>
5256 PR c++/88752 - ICE with lambda and constexpr if.
5257 * cp-tree.h (LAMBDA_EXPR_INSTANTIATED): New.
5258 * pt.c (tsubst_lambda_expr): Set it.
5259 (instantiated_lambda_fn_p): Check it.
5260 (enclosing_instantiation_of): Use it.
5262 2019-01-31 Jakub Jelinek <jakub@redhat.com>
5265 * cxx-pretty-print.c (pp_cxx_enumeration_constant): Print always as
5266 a C cast in pp_c_flag_gnu_v3 mode.
5268 2019-01-30 Jakub Jelinek <jakub@redhat.com>
5271 * lambda.c (is_capture_proxy): Don't return true for
5272 DECL_OMP_PRIVATIZED_MEMBER artificial vars.
5274 2019-01-30 Marek Polacek <polacek@redhat.com>
5276 PR c++/89119 - ICE with value-initialization in template.
5277 * pt.c (tsubst_copy_and_build): Handle RANGE_EXPR.
5279 2019-01-29 Jason Merrill <jason@redhat.com>
5281 PR c++/86943 - wrong code converting lambda to function pointer.
5282 * lambda.c (maybe_add_lambda_conv_op): Use a template-id in the
5283 call. Only forward parms for decltype.
5284 * pt.c (tsubst_copy_and_build) [CALL_EXPR]: Handle CALL_FROM_THUNK_P
5286 * typeck.c (check_return_expr): Don't mess with a thunk call.
5288 2019-01-28 Jason Merrill <jason@redhat.com>
5290 PR c++/89089 - ICE with [[no_unique_address]].
5291 PR c++/88865 - wrong layout with [[no_unique_address]].
5292 * class.c (check_field_decls): A potentially-overlapping field makes
5293 the class non-layout-POD, but not non-empty.
5294 (end_of_class): Always consider empty data members.
5295 (layout_class_type): Set DECL_SIZE for empty fields.
5297 2019-01-28 Marek Polacek <polacek@redhat.com>
5299 PR c++/88358 - name wrongly treated as type.
5300 * parser.c (cp_parser_direct_declarator): Don't assume a qualified-id
5301 in parameter-list is a type if the function's declarator-id is not
5304 2019-01-27 Marek Polacek <polacek@redhat.com>
5306 PR c++/88815 - narrowing conversion lost in decltype.
5307 PR c++/78244 - narrowing conversion in template not detected.
5308 * cp-tree.h (CONSTRUCTOR_IS_DEPENDENT): New.
5309 * pt.c (instantiation_dependent_r): Consider a CONSTRUCTOR with
5310 CONSTRUCTOR_IS_DEPENDENT instantiation-dependent.
5311 * semantics.c (finish_compound_literal): When the compound literal
5312 isn't instantiation-dependent and the type isn't type-dependent,
5313 fall back to the normal processing. Set CONSTRUCTOR_IS_DEPENDENT.
5315 PR c++/89024 - ICE with incomplete enum type.
5316 * call.c (standard_conversion): When converting an
5317 ARITHMETIC_TYPE_P to an incomplete type, return NULL.
5319 2019-01-25 Paolo Carlini <paolo.carlini@oracle.com>
5322 * call.c (build_op_delete_call): Implement 7.6.2.5/(10.1).
5323 * decl2.c (coerce_delete_type): Use build_pointer_type instead
5326 2019-01-24 Jason Merrill <jason@redhat.com>
5328 PR c++/89001 - mangling of reference temporaries
5329 * cp-tree.h (struct saved_scope): Add ref_temp_count.
5330 (current_ref_temp_count): New macro.
5331 * mangle.c (mangle_ref_init_variable): Use it.
5332 * typeck2.c (store_init_value): Clear it.
5333 * call.c (make_temporary_var_for_ref_to_temp): Copy public and
5336 2019-01-24 Jakub Jelinek <jakub@redhat.com>
5339 * semantics.c (finish_omp_cancel): Diagnose more than one if
5340 on #pragma omp cancel with different modifiers. Use
5341 maybe_convert_cond when not in template or build_x_binary_op
5344 2019-01-23 Marek Polacek <polacek@redhat.com>
5346 PR c++/88757 - qualified name treated wrongly as type.
5347 * parser.c (cp_parser_direct_declarator): Don't treat qualified-ids
5348 in parameter-list as types if name lookup for declarator-id didn't
5349 find one or more function templates.
5351 2019-01-23 Jakub Jelinek <jakub@redhat.com>
5354 * cp-gimplify.c (genericize_cp_loop): Call begin_bc_block only
5355 after genericizing cond and incr expressions.
5358 * cp-gimplify.c (genericize_switch_stmt): Move cond genericization
5359 before the begin_bc_block call.
5361 2019-01-21 Jason Merrill <jason@redhat.com>
5363 PR c++/87893 - constexpr ctor ICE on ARM.
5364 PR c++/88293 - ICE with comma expression.
5365 * constexpr.c (initialized_type): Don't shortcut non-void type.
5366 Handle COMPOUND_EXPR.
5367 (cxx_eval_outermost_constant_expr): Return early for void type.
5369 2019-01-21 Jakub Jelinek <jakub@redhat.com>
5372 * optimize.c (cxx_copy_decl): New function.
5373 (clone_body): Use it instead of copy_decl_no_change.
5376 * typeck.c (cp_build_binary_op): Don't instrument
5377 SANITIZE_POINTER_COMPARE if processing_template_decl.
5378 (pointer_diff): Similarly for SANITIZE_POINTER_SUBTRACT.
5380 2019-01-18 Jason Merrill <jason@redhat.com>
5382 PR c++/88875 - error with explicit list constructor.
5383 * call.c (reference_binding): Don't modify EXPR. Set
5384 need_temporary_p on the ck_user conversion for a temporary.
5385 (convert_like_real): Check it.
5387 2019-01-18 H.J. Lu <hongjiu.lu@intel.com>
5391 * call.c (convert_for_arg_passing): Upate the
5392 warn_for_address_or_pointer_of_packed_member call.
5393 * typeck.c (convert_for_assignment): Likewise.
5395 2019-01-17 Jason Merrill <jason@redhat.com>
5397 PR c++/86205 - ICE with ?: of throw and template-id.
5398 * pt.c (resolve_nondeduced_context_or_error): Split out from...
5399 * typeck.c (decay_conversion): ...here.
5400 * call.c (build_conditional_expr_1): Use it.
5402 PR c++/86740, ICE with constexpr if and nested generic lambdas.
5403 * tree.c (cp_walk_subtrees): Handle LAMBDA_EXPR.
5405 2019-01-17 Paolo Carlini <paolo.carlini@oracle.com>
5407 * decl.c (grokdeclarator): Use typespec_loc in error messages
5408 about 'auto' and trailing return type.
5410 2019-01-17 David Malcolm <dmalcolm@redhat.com>
5413 * class.c (add_method): Don't use DECL_DESTRUCTOR_P on
5416 2019-01-17 Nathan Sidwell <nathan@acm.org>
5419 * semantics.c (process_outer_var_ref): Only skip dependent types
5422 2019-01-17 Alexandre Oliva <aoliva@redhat.com>
5425 * cp-tree.h (saved_scope): Add suppress_location_wrappers.
5426 * name-lookup.c (do_push_to_top_level): Save and reset it.
5427 (do_pop_from_top_level): Restore it.
5430 * pt.c (make_template_placeholder): Use auto_identifier.
5431 (is_auto): Drop CLASS_PLACEHOLDER_TEMPLATE test.
5432 * error.c (dump_type): Handle template placeholders.
5433 * cxx-pretty-print.c (pp_cx_unqualified_id): Likewise.
5436 * cvt.c (convert_to_void): Handle all cdtor calls as if
5439 2019-01-16 Paolo Carlini <paolo.carlini@oracle.com>
5441 * decl.c (grokdeclarator): Use locations[ds_storage_class] in
5442 error messages about ill-formed uses of mutable.
5444 2019-01-16 Marek Polacek <polacek@redhat.com>
5446 PR c++/78244 - narrowing conversion in template not detected.
5447 * call.c (perform_implicit_conversion_flags): Set
5448 IMPLICIT_CONV_EXPR_BRACED_INIT.
5449 * cp-tree.h (IMPLICIT_CONV_EXPR_BRACED_INIT): New.
5450 * pt.c (tsubst_copy_and_build): Use it.
5452 2019-01-15 David Malcolm <dmalcolm@redhat.com>
5455 * pt.c (build_deduction_guide): Bail out if tsubst_arg_types
5458 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com>
5460 * decl.c (start_decl): Improve error location.
5461 * decl2.c (grokfield): Likewise.
5463 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com>
5465 * decl.c (grokdeclarator): Move further up the location_t loc
5466 declaration and use the location when building a TYPE_DECL for
5468 * decl2.c (grokbitfield): Use DECL_SOURCE_LOCATION in the error
5469 about an ill-formed bit-field as typedef.
5471 2019-01-14 Marek Polacek <polacek@redhat.com>
5473 PR c++/88830 - ICE with abstract class.
5474 * decl2.c (maybe_emit_vtables): Check CLASSTYPE_LAZY_DESTRUCTOR.
5477 PR c++/88825 - ICE with bogus function return type deduction.
5478 * typeck.c (can_do_nrvo_p): Check error_mark_node.
5480 2019-01-14 Tom Honermann <tom@honermann.net>
5482 Implement P0482R5, char8_t: A type for UTF-8 characters and strings
5483 * cvt.c (type_promotes_to): Handle char8_t promotion.
5484 * decl.c (grokdeclarator): Handle invalid type specifier
5485 combinations involving char8_t.
5486 * lex.c (init_reswords): Add char8_t as a reserved word.
5487 * mangle.c (write_builtin_type): Add name mangling for char8_t (Du).
5488 * parser.c (cp_keyword_starts_decl_specifier_p)
5489 (cp_parser_simple_type_specifier): Recognize char8_t as a simple
5491 (cp_parser_string_literal): Use char8_array_type_node for the type
5493 (cp_parser_set_decl_spec_type): Tolerate char8_t typedefs in system
5495 * rtti.c (emit_support_tinfos): type_info support for char8_t.
5496 * tree.c (char_type_p): Recognize char8_t as a character type.
5497 * typeck.c (string_conv_p): Handle conversions of u8 string
5498 literals of char8_t type.
5499 (check_literal_operator_args): Handle UDLs with u8 string literals
5501 * typeck2.c (ordinary_char_type_p): New.
5502 (digest_init_r): Disallow initializing a char array with a u8 string
5505 2019-01-14 Martin Liska <mliska@suse.cz>
5507 PR gcov-profile/88263
5508 * decl2.c (get_tls_wrapper_fn): Use DECL_SOURCE_LOCATION
5509 as location of the TLS wrapper.
5511 2019-01-12 Paolo Carlini <paolo.carlini@oracle.com>
5513 * decl.c (cp_finish_decl): Improve error location.
5514 * decl2.c (grokfield): Likewise, improve two locations.
5516 2019-01-11 Marek Polacek <polacek@redhat.com>
5518 PR c++/88692, c++/87882 - -Wredundant-move false positive with *this.
5519 * typeck.c (maybe_warn_pessimizing_move): Return if ARG isn't
5522 2019-01-11 Jason Merrill <jason@redhat.com>
5524 PR c++/88312 - pack expansion of decltype.
5525 * pt.c (instantiation_dependent_r): A template non-type parameter
5526 pack is instantiation-dependent.
5528 2019-01-11 Jason Merrill <jason@redhat.com>
5530 PR c++/88613 - ICE with use of const var in lambda.
5531 * expr.c (mark_use): Fix location wrapper handling.
5532 * cp-gimplify.c (cp_fold_maybe_rvalue): Call mark_rvalue_use.
5534 2019-01-11 Tobias Burnus <burnus@net-b.de>
5537 * decl2.c (maybe_emit_vtables): If needed, generate code for
5538 the destructor of an abstract class.
5539 (mark_used): Update comment for older function-name change.
5541 2019-01-11 Paolo Carlini <paolo.carlini@oracle.com>
5543 * decl.c (start_decl): Improve error location.
5544 (grokdeclarator): Likewise, improve two locations.
5546 2019-01-09 Sandra Loosemore <sandra@codesourcery.com>
5550 * cp-tree.h: Mechanically replace "can not" with "cannot".
5551 * parser.c: Likewise.
5554 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com>
5556 * decl.c (grok_reference_init): Improve error location.
5557 (grokdeclarator): Likewise, improve two locations.
5559 2019-01-08 Marek Polacek <polacek@redhat.com>
5561 PR c++/88538 - braced-init-list in template-argument-list.
5562 * parser.c (cp_parser_template_argument): Handle braced-init-list when
5565 PR c++/88548 - this accepted in static member functions.
5566 * parser.c (cp_debug_parser): Adjust printing of
5567 local_variables_forbidden_p.
5568 (cp_parser_new): Set local_variables_forbidden_p to 0 rather than false.
5569 (cp_parser_primary_expression): When checking
5570 local_variables_forbidden_p, use THIS_FORBIDDEN or
5571 LOCAL_VARS_FORBIDDEN.
5572 (cp_parser_lambda_body): Update the type of
5573 local_variables_forbidden_p. Set it to 0 rather than false.
5574 (cp_parser_condition): Adjust call to cp_parser_declarator.
5575 (cp_parser_explicit_instantiation): Likewise.
5576 (cp_parser_init_declarator): Likewise.
5577 (cp_parser_declarator): New parameter. Use it.
5578 (cp_parser_direct_declarator): New parameter. Use it to set
5579 local_variables_forbidden_p. Adjust call to cp_parser_declarator.
5580 (cp_parser_type_id_1): Adjust call to cp_parser_declarator.
5581 (cp_parser_parameter_declaration): Likewise.
5582 (cp_parser_default_argument): Update the type of
5583 local_variables_forbidden_p. Set it to LOCAL_VARS_AND_THIS_FORBIDDEN
5585 (cp_parser_member_declaration): Tell cp_parser_declarator if we saw
5586 'static' or 'friend'.
5587 (cp_parser_exception_declaration): Adjust call to cp_parser_declarator.
5588 (cp_parser_late_parsing_default_args): Update the type of
5589 local_variables_forbidden_p. Set it to LOCAL_VARS_AND_THIS_FORBIDDEN
5591 (cp_parser_cache_defarg): Adjust call to cp_parser_declarator.
5592 (cp_parser_objc_class_ivars): Likewise.
5593 (cp_parser_objc_struct_declaration): Likewise.
5594 (cp_parser_omp_for_loop_init): Likewise.
5595 * parser.h (cp_parser): Change the type of local_variables_forbidden_p
5597 (LOCAL_VARS_FORBIDDEN, LOCAL_VARS_AND_THIS_FORBIDDEN, THIS_FORBIDDEN):
5600 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com>
5602 * decl.c (start_decl): Improve permerror location.
5604 2019-01-08 Jonathan Wakely <jwakely@redhat.com>
5605 Jakub Jelinek <jakub@redhat.com>
5608 * decl.c (finish_function): For -Wreturn-type don't add a return *this;
5609 fixit hint if current_class_ref is NULL. Use a single if instead of
5612 2019-01-07 Paolo Carlini <paolo.carlini@oracle.com>
5614 * decl.c (start_decl): Improve two error_at locations.
5615 (expand_static_init): Likewise.
5617 2019-01-07 Marek Polacek <polacek@redhat.com>
5619 PR c++/88741 - wrong error with initializer-string.
5620 * decl.c (cp_complete_array_type): Strip any location wrappers.
5622 2019-01-07 Bernd Edlinger <bernd.edlinger@hotmail.de>
5628 * cp-tree.h (LOOKUP_ALLOW_FLEXARRAY_INIT): New flag value.
5629 * typeck2.c (digest_init_r): Raise an error for non-static
5630 initialization of a flexible array member.
5631 (process_init_constructor, massage_init_elt,
5632 process_init_constructor_array, process_init_constructor_record,
5633 process_init_constructor_union, process_init_constructor): Add the
5634 flags parameter and pass it thru.
5635 (store_init_value): Pass LOOKUP_ALLOW_FLEXARRAY_INIT parameter to
5636 digest_init_flags for static decls.
5638 2019-01-07 Jakub Jelinek <jakub@redhat.com>
5641 * cp-tree.h (cp_build_vec_convert): Declare.
5642 * parser.c (cp_parser_postfix_expression): Parse
5643 __builtin_convertvector.
5644 * constexpr.c: Include fold-const-call.h.
5645 (cxx_eval_internal_function): Handle IFN_VEC_CONVERT.
5646 (potential_constant_expression_1): Likewise.
5647 * semantics.c (cp_build_vec_convert): New function.
5648 * pt.c (tsubst_copy_and_build): Handle CALL_EXPR to
5651 2019-01-03 Jakub Jelinek <jakub@redhat.com>
5654 * decl.c (builtin_function_1): Return result of pushdecl_top_level
5655 or pushdecl rather than decl.
5657 2019-01-03 Paolo Carlini <paolo.carlini@oracle.com>
5659 * tree.c (handle_nodiscard_attribute): Improve warning location.
5661 2019-01-02 Marek Polacek <polacek@redhat.com>
5663 PR c++/88612 - ICE with -Waddress-of-packed-member.
5664 * call.c (convert_for_arg_passing): Only give warnings with tf_warning.
5665 * typeck.c (convert_for_assignment): Likewise.
5667 PR c++/88631 - CTAD failing for value-initialization.
5668 * typeck2.c (build_functional_cast): Try deducing the template
5669 arguments even if there are no arguments to deduce from.
5671 2019-01-01 Jakub Jelinek <jakub@redhat.com>
5673 Update copyright years.
5675 Copyright (C) 2019-2020 Free Software Foundation, Inc.
5677 Copying and distribution of this file, with or without modification,
5678 are permitted in any medium without royalty provided the copyright
5679 notice and this notice are preserved.