1 2019-11-19 Jakub Jelinek <jakub@redhat.com>
4 * constexpr.c (cxx_eval_outermost_constant_expr): If DECL_INITIAL
5 on object is erroneous, return t without trying to evaluate
8 2019-11-12 Jason Merrill <jason@redhat.com>
10 * call.c (same_fn_or_template): Change to cand_parms_match.
12 (print_z_candidate): Mark rewritten/reversed candidates.
13 (build_new_op_1): Warn about recursive call with reversed arguments.
15 2019-11-15 Andrew Sutton <asutton@lock3software.com>
18 * pt.c (get_underlying_template): Exit loop if the original type
21 2019-11-19 Andrew Sutton <asutton@lock3software.com>
24 * pt.c (maybe_new_partial_specialization): Apply access to newly
25 created partial specializations. Update comment style.
27 2019-11-19 Andrew Sutton <asutton@lock3software.com>
30 * pt.c (maybe_new_partial_specialization): Apply access to newly
31 created partial specializations. Update comment style.
33 2019-11-19 Andrew Sutton <asutton@lock3software.com>
36 Suppress diagnostics substituting into a requires-expression.
37 * pt.c (tsubst_copy_and_build): Perform the first substitution without
38 diagnostics and a second only if tsubst_requries_expr returns an error.
40 2019-11-19 Jakub Jelinek <jakub@redhat.com>
43 * semantics.c (handle_omp_for_class_iterator): Don't call
44 cp_fully_fold on cond.
46 2019-11-18 Paolo Carlini <paolo.carlini@oracle.com>
48 * typeck.c (cp_build_addr_expr_1): Use cp_expr_loc_or_input_loc
50 (cxx_sizeof_expr): Use it in one additional place.
51 (cxx_alignof_expr): Likewise.
52 (lvalue_or_else): Likewise.
54 2019-11-18 Marek Polacek <polacek@redhat.com>
56 PR c++/91962 - ICE with reference binding and qualification conversion.
57 * call.c (convert_like_real) <case ck_ref_bind>: Check need_temporary_p.
59 2019-11-17 Jakub Jelinek <jakub@redhat.com>
61 * method.c (lookup_comparison_result): Use %qD instead of %<%T::%D%>
63 (lookup_comparison_category): Use %qD instead of %<std::%D%> to print
66 2019-11-15 Paolo Carlini <paolo.carlini@oracle.com>
68 * typeck.c (cp_truthvalue_conversion): Add tsubst_flags_t parameter
69 and use it in calls; also pass the location_t of the expression to
70 cp_build_binary_op and c_common_truthvalue_conversion.
71 * rtti.c (build_dynamic_cast_1): Adjust call.
72 * cvt.c (ocp_convert): Likewise.
73 * cp-gimplify.c (cp_fold): Likewise.
74 * cp-tree.h (cp_truthvalue_conversion): Update declaration.
76 2019-11-14 Jason Merrill <jason@redhat.com>
78 Implement P1816R0, class template argument deduction for aggregates.
79 * pt.c (maybe_aggr_guide, collect_ctor_idx_types): New.
80 (is_spec_or_derived): Split out from do_class_deduction.
81 (build_deduction_guide): Handle aggregate guide.
82 * class.c (finish_struct): Set CLASSTYPE_NON_AGGREGATE in a
84 * cp-tree.h (CP_AGGREGATE_TYPE_P): An incomplete class is not an
87 2019-11-14 Richard Sandiford <richard.sandiford@arm.com>
89 * call.c (build_conditional_expr_1): Use truth_type_for instead
90 of build_same_sized_truth_vector_type.
91 * typeck.c (build_vec_cmp): Likewise.
93 2019-11-14 Jakub Jelinek <jakub@redhat.com>
95 * parser.c (cp_parser_omp_context_selector): Don't require score
96 argument to fit into shwi, just to be INTEGER_CST. Diagnose
98 * pt.c (tsubst_attribute): Likewise.
100 * parser.c (cp_parser_omp_context_selector): Rename
101 CTX_PROPERTY_IDLIST to CTX_PROPERTY_NAME_LIST, add CTX_PROPERTY_ID.
102 Use CTX_PROPERTY_ID for atomic_default_mem_order, only allow a single
103 identifier in that. For CTX_PROPERTY_NAME_LIST, allow identifiers
105 * pt.c (tsubst_attribute): Fix up STRING_CST handling if allow_string.
107 2019-11-13 Marek Polacek <polacek@redhat.com>
109 PR c++/89070 - bogus [[nodiscard]] warning in SFINAE.
110 * cvt.c (convert_to_void): Guard maybe_warn_nodiscard calls with
113 2019-11-13 Richard Sandiford <richard.sandiford@arm.com>
116 * cp-tree.h (STF_STRIP_DEPENDENT): New constant.
117 * tree.c (strip_typedefs): Add STF_STRIP_DEPENDENT to the flags
118 when calling strip_typedefs recursively on a DECL_ORIGINAL_TYPE.
119 Don't apply the fix for DR1558 in that case; allow aliases with
120 dependent template parameters to be stripped instead.
122 2019-11-12 Nathan Sidwell <nathan@acm.org>
124 * name-lookup.c (lookup_using_decl): New function, merged from ...
125 (do_class_using_decl): ... here. Call it. And ...
126 (finish_nonmember_using_decl): ... here. Call it.
128 2019-11-12 Martin Liska <mliska@suse.cz>
130 * name-lookup.c: Do not include params.h.
131 * typeck.c: Likewise.
133 2019-11-12 Martin Liska <mliska@suse.cz>
135 * name-lookup.c (namespace_hints::namespace_hints): Replace old
136 parameter syntax with the new one, include opts.h if needed. Use
137 SET_OPTION_IF_UNSET macro.
138 * typeck.c (comptypes): Likewise.
140 2019-11-12 Maciej W. Rozycki <macro@codesourcery.com>
141 Frederik Harwath <frederik@codesourcery.com>
144 * constexpr.c (potential_constant_expression_1): Handle
146 * parser.c (OACC_SERIAL_CLAUSE_MASK): New macro.
147 (cp_parser_oacc_kernels_parallel): Rename function to...
148 (cp_parser_oacc_compute): ... this. Handle PRAGMA_OACC_SERIAL.
149 (cp_parser_omp_construct): Update accordingly.
150 (cp_parser_pragma): Handle PRAGMA_OACC_SERIAL. Fix alphabetic
152 * pt.c (tsubst_expr): Handle OACC_SERIAL.
154 2019-11-11 Jason Merrill <jason@redhat.com>
156 Implement P1946R0, Allow defaulting comparisons by value.
157 * method.c (early_check_defaulted_comparison): Accept by-value,
158 reject mixed by-value and by-reference parms.
159 * decl.c (grokdeclarator): Set funcdef_flag for defaulted friend.
160 * decl2.c (grokfield): Don't SET_DECL_FRIEND_CONTEXT.
162 * typeck.c (cp_build_binary_op): Sorry about <=> on VECTOR_TYPE.
164 2019-11-11 Jakub Jelinek <jakub@redhat.com>
167 * decl.c (finish_function): Move ctype initialization before
168 DECL_DELETED_FN handling.
170 * semantics.c (finish_translation_unit): Diagnose declare target
171 without corresponding end declare target.
173 2019-11-10 Jason Merrill <jason@redhat.com>
175 Implement D1957R0, T* to bool should be considered narrowing.
176 * typeck2.c (check_narrowing): Treat pointer->bool as a narrowing
177 conversion with -std=c++2a.
179 2019-11-08 Marek Polacek <polacek@redhat.com>
181 PR c++/92215 - flawed diagnostic for bit-field with non-integral type.
182 * parser.c (cp_parser_member_declaration): Add a diagnostic for
183 bit-fields with non-integral types.
185 2019-11-08 Jakub Jelinek <jakub@redhat.com>
187 * init.c (build_vec_delete_1): Fix a comment typo - mist -> must.
189 2019-11-07 Jason Merrill <jason@redhat.com>
191 Implement D1959R0, remove weak_equality and strong_equality.
192 * method.c (enum comp_cat_tag, comp_cat_info): Remove *_equality.
193 (genericize_spaceship, common_comparison_type): Likewise.
194 * typeck.c (cp_build_binary_op): Move SPACESHIP_EXPR to be with the
195 relational operators, exclude other types no longer supported.
197 2019-11-06 Jason Merrill <jason@redhat.com>
199 Implement D1907R1 "structural type".
200 * tree.c (structural_type_p): New.
201 * pt.c (invalid_nontype_parm_type_p): Use it.
202 * class.c (build_base_field_1): Take binfo. Copy TREE_PRIVATE.
203 (build_base_field): Pass binfo.
205 PR c++/92150 - partial specialization with class NTTP.
206 * pt.c (unify): Handle VIEW_CONVERT_EXPR.
208 * pt.c (use_pack_expansion_extra_args_p): Still do substitution if
209 all packs are simple pack expansions.
210 (add_extra_args): Check that the extra args aren't dependent.
212 2019-11-06 Andrew Sutton <asutton@lock3software.com>
214 Use satisfaction with nested requirements.
215 * constraint.cc (build_parameter_mapping): Use
216 current_template_parms when the declaration is not available.
217 (norm_info::norm_info) Make explicit.
218 (normalize_constraint_expression): Factor into a separate overload
219 that takes arguments, and use that in the original function.
220 (tsubst_nested_requirement): Use satisfy_constraint instead of
221 trying to evaluate this as a constant expression.
222 (finish_nested_requirement): Keep the normalized constraint and the
223 original normalization arguments with the requirement.
224 (diagnose_nested_requirement): Use satisfy_constraint. Tentatively
225 implement more comprehensive diagnostics, but do not enable.
226 * parser.c (cp_parser_requires_expression): Relax requirement that
227 requires-expressions can live only inside templates.
228 * pt.c (any_template_parm_r): Look into type of PARM_DECL.
230 2019-11-06 Jason Merrill <jason@redhat.com>
232 C++20 NB CA378 - Remove constrained non-template functions.
233 * decl.c (grokfndecl): Reject constraints on non-templated function.
235 2019-11-06 Matthias Kretz <m.kretz@gsi.de>
237 * parser.c (cp_parser_operator): Parse operator?: as an
238 attempt to overload the conditional operator.
240 2019-11-05 Jason Merrill <jason@redhat.com>
242 Implement C++20 operator<=>.
243 * cp-tree.h (struct lang_decl_fn): Add maybe_deleted bitfield.
244 (DECL_MAYBE_DELETED): New.
245 (enum special_function_kind): Add sfk_comparison.
246 (LOOKUP_REWRITTEN, LOOKUP_REVERSED): New.
247 * call.c (struct z_candidate): Add rewritten and reversed methods.
248 (add_builtin_candidate): Handle SPACESHIP_EXPR.
249 (add_builtin_candidates): Likewise.
250 (add_candidates): Don't add a reversed candidate if the parms are
252 (add_operator_candidates): Split out from build_new_op_1. Handle
253 rewritten and reversed candidates.
254 (add_candidate): Swap conversions of reversed candidate.
255 (build_new_op_1): Swap them back. Build a second operation for
256 rewritten candidates.
257 (extract_call_expr): Handle rewritten calls.
258 (same_fn_or_template): New.
259 (joust): Handle rewritten and reversed candidates.
260 * class.c (add_implicitly_declared_members): Add implicit op==.
261 (classtype_has_op, classtype_has_defaulted_op): New.
262 * constexpr.c (cxx_eval_binary_expression): Handle SPACESHIP_EXPR.
263 (cxx_eval_constant_expression, potential_constant_expression_1):
265 * cp-gimplify.c (genericize_spaceship): New.
266 (cp_genericize_r): Use it.
267 * cp-objcp-common.c (cp_common_init_ts): Handle SPACESHIP_EXPR.
268 * decl.c (finish_function): Handle deleted function.
269 * decl2.c (grokfield): SET_DECL_FRIEND_CONTEXT on defaulted friend.
270 (mark_used): Check DECL_MAYBE_DELETED. Remove assumption that
271 defaulted functions are non-static members.
272 * error.c (dump_expr): Handle SPACESHIP_EXPR.
273 * method.c (type_has_trivial_fn): False for sfk_comparison.
274 (enum comp_cat_tag, struct comp_cat_info_t): New types.
275 (comp_cat_cache): New array variable.
276 (lookup_comparison_result, lookup_comparison_category)
277 (is_cat, cat_tag_for, spaceship_comp_cat)
278 (spaceship_type, genericize_spaceship)
279 (common_comparison_type, early_check_defaulted_comparison)
280 (comp_info, build_comparison_op): New.
281 (synthesize_method): Handle sfk_comparison. Handle deleted.
282 (get_defaulted_eh_spec, maybe_explain_implicit_delete)
283 (explain_implicit_non_constexpr, implicitly_declare_fn)
284 (defaulted_late_check, defaultable_fn_check): Handle sfk_comparison.
285 * name-lookup.c (get_std_name_hint): Add comparison categories.
286 * tree.c (special_function_p): Add sfk_comparison.
287 * typeck.c (cp_build_binary_op): Handle SPACESHIP_EXPR.
289 2019-11-05 Tim van Deurzen <tim@kompiler.org>
291 Add new tree code for the spaceship operator.
292 * cp-tree.def: Add new tree code.
293 * operators.def: New binary operator.
294 * parser.c: Add new token and tree code.
296 2019-09-15 Jason Merrill <jason@redhat.com>
298 * call.c (build_new_op_1): Don't apply any standard conversions to
299 the operands of a built-in operator. Don't suppress conversions in
301 * typeck.c (cp_build_unary_op): Do integral promotions for enums.
303 2019-11-04 Jason Merrill <jason@redhat.com>
305 Use vec instead of raw array for built-in candidates.
306 * call.c (build_builtin_candidate): Take args in a vec.
307 (add_builtin_candidate, add_builtin_candidates): Likewise.
308 (build_conditional_expr_1, build_new_op_1): Adjust.
310 2019-11-04 Jason Merrill <jason@redhat.com>
312 * constexpr.c (explain_invalid_constexpr_fn): Show location of fn.
314 * pt.c (maybe_instantiate_noexcept): Only update clones if we
317 * typeck.c (contextual_conv_bool): New.
319 * name-lookup.c (lookup_qualified_name): Add wrapper overload taking
320 C string rather than identifier.
321 * parser.c (cp_parser_userdef_numeric_literal): Use it.
322 * rtti.c (emit_support_tinfos): Use it.
323 * cp-tree.h (ovl_op_identifier): Change to inline functions.
324 (build_x_binary_op): Add wrapper with fewer parms.
326 2019-11-05 Jason Merrill <jason@redhat.com>
328 * decl2.c (mark_used): Diagnose use of a function with unsatisfied
330 * typeck.c (cp_build_function_call_vec): Not here.
332 2019-11-05 Nathan Sidwell <nathan@acm.org>
335 * parser.c (cp_parser_error_1): Check EOF and UNKNOWN_LOCATION
336 when skipping over version control marker.
338 2019-11-05 Jakub Jelinek <jakub@redhat.com>
341 * constexpr.c (potential_constant_expression_1): Return true rather
342 than false for PREDICT_EXPR.
344 * decl.c (omp_declare_variant_finalize_one): Call
345 declare_simd_adjust_this not just on the context, but also on the
346 variant-id expression for methods. Don't call
347 cp_get_callee_fndecl_nofold, call cp_get_callee and only if it is
348 safe cp_get_fndecl_from_callee. Don't try to print as %qD
350 * pt.c (tsubst_attribute): Handle "omp declare variant base"
352 (tsubst_function_decl): Call omp_declare_variant_finalize
353 if there are any "omp declare variant base" attributes left.
355 2019-11-04 Kamlesh Kumar <kamleshbhalui@gmail.com>
357 PR c++/91979 - mangling nullptr expression
358 * mangle.c (write_template_arg_literal): Handle nullptr
361 2019-11-04 Jason Merrill <jason@redhat.com>
363 * typeck.c (check_return_expr): Avoid redundant error.
365 2019-11-02 Paolo Carlini <paolo.carlini@oracle.com>
367 * typeck.c (composite_pointer_type): Add a const op_location_t&
368 parameter and use it in diagnostics.
369 (composite_pointer_error): Likewise.
370 (composite_pointer_type_r): Add a const op_location_t&
371 parameter and forward it.
372 (cp_build_binary_op): Adjust calls.
373 (common_pointer_type): Likewise.
374 * call.c (add_builtin_candidate): Likewise.
375 (build_conditional_expr_1): Likewise.
376 * cp-tree.h (composite_pointer_type): Update declaration.
378 * typeck.c (cxx_sizeof_expr): Use cp_expr_loc_or_input_loc
380 (cxx_alignof_expr): Likewise.
381 (lvalue_or_else): Likewise.
383 2019-11-02 Jakub Jelinek <jakub@redhat.com>
385 * decl.c (omp_declare_variant_finalize_one): Use
386 omp_get_context_selector instead of c_omp_get_context_selector.
389 * parser.c (cp_parser_decl_specifier_seq): Don't parse attributes
390 if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR.
392 PR c++/88335 - Implement P1073R3: Immediate functions
393 * cp-tree.h (struct lang_decl_fn): Add immediate_fn_p bit.
394 (DECL_IMMEDIATE_FUNCTION_P, SET_DECL_IMMEDIATE_FUNCTION_P): Define.
395 (enum cp_decl_spec): Add ds_consteval.
396 (fold_non_dependent_expr): Add another tree argument defaulted to
398 * name-lookup.h (struct cp_binding_level): Add immediate_fn_ctx_p
400 * parser.c (cp_keyword_starts_decl_specifier_p): Adjust comments
401 for C++11 and C++20 specifiers. Handle RID_CONSTEVAL.
402 (CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR): Adjust comment.
403 (CP_PARSER_FLAGS_CONSTEVAL): New.
404 (cp_parser_skip_balanced_tokens): New forward declaration.
405 (cp_parser_lambda_declarator_opt): Handle ds_consteval. Set
406 current_binding_level->immediate_fn_ctx_p before parsing parameter
407 list if decl-specifier-seq contains consteval specifier.
408 (cp_parser_decl_specifier_seq): Handle RID_CONSTEVAL.
409 (cp_parser_explicit_instantiation): Diagnose explicit instantiation
410 with consteval specifier.
411 (cp_parser_init_declarator): For consteval or into flags
412 CP_PARSER_FLAGS_CONSTEVAL.
413 (cp_parser_direct_declarator): If CP_PARSER_FLAGS_CONSTEVAL, set
414 current_binding_level->immediate_fn_ctx_p in the sk_function_parms
416 (set_and_check_decl_spec_loc): Add consteval entry, formatting fix.
417 * call.c (build_addr_func): For direct calls to immediate functions
418 use build_address rather than decay_conversion.
419 (build_over_call): Evaluate immediate function invocations.
420 * error.c (dump_function_decl): Handle DECL_IMMEDIATE_FUNCTION_P.
421 * semantics.c (expand_or_defer_fn_1): Use tentative linkage and don't
422 call mark_needed for immediate functions.
423 * typeck.c (cxx_sizeof_or_alignof_expr): Likewise. Formatting fix.
424 (cp_build_addr_expr_1): Reject taking address of immediate function
425 outside of immediate function.
426 * decl.c (validate_constexpr_redeclaration): Diagnose consteval
427 vs. non-consteval or vice versa redeclaration. Use
428 SET_DECL_IMMEDIATE_FUNCTION_P if new_decl is immediate function.
429 (check_tag_decl): Use %qs with keyword string to simplify translation.
431 (start_decl): Adjust diagnostics for static or thread_local variables
432 in immediate functions.
433 (grokfndecl): Call sorry_at on virtual consteval. Use %qs with keyword
434 to string to simplify translation. Diagnose consteval main. Use
435 SET_DECL_IMMEDIATE_FUNCTION_P for consteval.
436 (grokdeclarator): Handle consteval. Use %qs with keyword strings to
437 simplify translation. Use separate ifs instead of chained else if
438 for invalid specifiers. For constinit clear constinit_p rather than
440 * constexpr.c (find_immediate_fndecl): New function.
441 (cxx_eval_outermost_constant_expr): Allow consteval calls returning
442 void. Diagnose returning address of immediate function from consteval
444 (fold_non_dependent_expr_template): Add OBJECT argument, pass it
445 through to cxx_eval_outermost_constant_expr.
446 (fold_non_dependent_expr): Add OBJECT argument, pass it through to
447 fold_non_dependent_expr_template.
448 (fold_non_dependent_init): Adjust fold_non_dependent_expr_template
450 * method.c (defaulted_late_check): Adjust diagnostics for consteval.
451 * lambda.c (maybe_add_lambda_conv_op): Copy over
452 DECL_DECLARED_CONSTEXPR_P and DECL_IMMEDIATE_FUNCTION_P bits from
453 callop to both artificial functions.
454 * init.c (build_value_init): Don't do further processing if
455 build_special_member_call returned a TREE_CONSTANT. Formatting fix.
457 PR c++/91369 - Implement P0784R7: constexpr new
458 * cp-tree.h (CALL_FROM_NEW_OR_DELETE_P): Define.
459 * init.c (build_new_1, build_vec_delete_1, build_delete): Set
460 CALL_FROM_NEW_OR_DELETE_P on the CALL_EXPR to allocator functions.
461 * constexpr.c (is_std_allocator_allocate): Only allow
462 global replaceable allocator functions if CALL_FROM_NEW_OR_DELETE_P
463 or in std::allocate<T>::{,de}allocate.
464 (potential_constant_expression_1): Likewise.
466 2019-11-01 Nathan Sidwell <nathan@acm.org>
468 * class.c (check_field_decls): Refactor.
470 2019-10-31 Jakub Jelinek <jakub@redhat.com>
473 * cp-tree.h (type_initializer_zero_p): Declare.
474 * decl.c (reshape_init_array_1): Formatting fix.
475 * tree.c (type_initializer_zero_p): New function. Moved from
476 ../tree.c, use next_initializable_field, formatting fix. Return
477 false for TYPE_NON_AGGREGATE_CLASS types.
479 2019-10-30 Jason Merrill <jason@redhat.com>
481 PR c++/92268 - hard error satisfying return-type-requirement
482 * constraint.cc (type_deducible_p): Check for substitution failure.
483 (diagnose_compound_requirement): Adjust diagnostic.
484 * pt.c (do_auto_deduction): Don't pass cargs to
485 constraints_satisfied_p.
487 2019-10-30 Jakub Jelinek <jakub@redhat.com>
489 PR c++/91369 - Implement P0784R7: constexpr new
490 * constexpr.c (cxx_replaceable_global_alloc_fn): Don't return true
492 (cxx_placement_new_fn, is_std_construct_at): New functions.
493 (cxx_eval_call_expression): Allow placement new in std::construct_at.
494 (potential_constant_expression_1): Likewise.
496 * typeck.c (decl_in_std_namespace_p): Return true also for decls
497 in inline namespaces inside of std namespace.
499 2019-10-30 Bernd Edlinger <bernd.edlinger@hotmail.de>
502 * name-lookup.c (check_local_shadow): Shadowing TYPE_DECLs
503 is always a -Wshadow=compatible-local warning, unless
506 2019-10-30 Jason Merrill <jason@redhat.com>
508 * cxx-pretty-print.c (get_fold_operator): Use OVL_OP_INFO.
510 2019-10-30 Marek Polacek <polacek@redhat.com>
512 PR c++/92134 - constinit malfunction in static data member.
513 * decl2.c (grokfield): Set LOOKUP_CONSTINIT.
515 2019-10-30 Jakub Jelinek <jakub@redhat.com>
517 * cp-tree.h (omp_declare_variant_finalize, build_local_temp): Declare.
518 * decl.c: Include omp-general.h.
519 (declare_simd_adjust_this): Add forward declaration.
520 (omp_declare_variant_finalize_one, omp_declare_variant_finalize): New
522 (cp_finish_decl, finish_function): Call omp_declare_variant_finalize.
523 * parser.c (cp_finish_omp_declare_variant): Adjust parsing of the
524 variant id-expression and propagate enough information to
525 omp_declare_variant_finalize_one in the attribute so that it can
527 * class.c (finish_struct): Call omp_declare_variant_finalize.
528 * tree.c (build_local_temp): No longer static, remove forward
531 2019-10-30 Paolo Carlini <paolo.carlini@oracle.com>
533 * typeck.c (cp_build_modify_expr): Prefer error + inform to
534 error + error in one place.
535 (get_delta_difference_1): Likewise.
536 (get_delta_difference): Likewise, in two places.
538 2019-10-29 Paolo Carlini <paolo.carlini@oracle.com>
540 * typeck.c (build_x_unary_op): Use the location_t argument in
543 2019-10-29 Marek Polacek <polacek@redhat.com>
545 PR c++/90998 - ICE with copy elision in init by ctor and -Wconversion.
546 * call.c (joust): Don't attempt to warn if ->second_conv is null.
548 2019-10-29 Jakub Jelinek <jakub@redhat.com>
551 * cp-gimplify.c (cp_gimplify_expr): If gimplify_to_rvalue changes the
552 function pointer type, re-add cast to the original one.
554 2019-10-29 Marek Polacek <polacek@redhat.com>
556 PR c++/91548 - fix detecting modifying const objects for ARRAY_REF.
557 * constexpr.c (cxx_eval_store_expression): Don't call
558 modifying_const_object_p for ARRAY_REF.
560 2019-10-29 Richard Sandiford <richard.sandiford@arm.com>
562 * cp-objcp-common.h (cxx_simulate_enum_decl): Declare.
563 (LANG_HOOKS_SIMULATE_ENUM_DECL): Define to the above.
564 * decl.c (cxx_simulate_enum_decl): New function.
566 2019-10-29 Richard Sandiford <richard.sandiford@arm.com>
568 * cp-tree.h (cxx_simulate_builtin_function_decl): Declare.
569 * decl.c (cxx_simulate_builtin_function_decl): New function.
570 * cp-objcp-common.h (LANG_HOOKS_SIMULATE_BUILTIN_FUNCTION_DECL):
573 2019-10-28 Martin Sebor <msebor@redhat.com>
576 * cp-objcp-common.c (names_builtin_p): Define new function.
578 2019-10-28 Nathan Sidwell <nathan@acm.org>
580 * parser.h (struct cp_token): Drop {ENUM,BOOL}_BITFIELD C-ism.
581 Add tree_check_p flag, use as nested union discriminator.
582 (struct cp_lexer): Add saved_type & saved_keyword fields.
583 * parser.c (eof_token): Delete.
584 (cp_lexer_new_main): Always init last_token to last token of
586 (cp_lexer_new_from_tokens): Overlay EOF token at end of range.
587 (cp_lexer_destroy): Restore token under the EOF.
588 (cp_lexer_previous_token_position): No check for eof_token here.
589 (cp_lexer_get_preprocessor_token): Clear tree_check_p.
590 (cp_lexer_peek_nth_token): Check CPP_EOF not eof_token.
591 (cp_lexer_consume_token): Assert not CPP_EOF, no check for
593 (cp_lexer_purge_token): Likewise.
594 (cp_lexer_purge_tokens_after): No check for EOF token.
595 (cp_parser_nested_name_specifier, cp_parser_decltype)
596 (cp_parser_template_id): Set tree_check_p.
598 2019-10-24 Jakub Jelinek <jakub@redhat.com>
600 * decl2.c (cplus_decl_attributes): Add "omp declare target block"
601 attribute in between declare target and end declare target
604 * call.c (convert_arg_to_ellipsis): Add missing space in string
607 2019-10-24 Marek Polacek <polacek@redhat.com>
609 * decl.c (reshape_init_r): Add missing space.
611 2019-10-24 Nathan Sidwell <nathan@acm.org>
613 * pt.c (reduce_template_parm_level): Attach the new TPI to the new
615 (convert_generic_types_to_packs): Pass the copied type to
616 reduce_templatE_parm_level.
618 2019-10-23 Nathan Sidwell <nathan@acm.org>
620 * cp-tree.c (CPTI_STD_IDENTIFIER): Delete.
621 (std_identifier): Delete.
622 (DECL_NAME_SPACE_STD_P): Compare against std_node.
623 * decl.c (initialize_predefined_identifiers): 'std' is not needed.
624 (cxx_init_decl_processing): Adjust creation of ::std. Use
625 {push,pop}_nested_namespace.
626 (cxx_builtin_function): Use {push,pop}_nested_namespace.
627 * except.c (init_exception_processing): Likewise.
628 * rtti.c (init_rtti_processing): Likewise.
630 2019-10-23 Jason Merrill <jason@redhat.com>
632 Implement P1286R2, Contra CWG1778
633 * method.c (defaulted_late_check): Don't check explicit
634 exception-specification on defaulted function.
635 (after_nsdmi_defaulted_late_checks): Remove.
636 * parser.h (struct cp_unparsed_functions_entry): Remove classes.
637 * parser.c (unparsed_classes): Remove.
638 (push_unparsed_function_queues, cp_parser_class_specifier_1):
641 2019-10-23 Jakub Jelinek <jakub@redhat.com>
643 * constexpr.c (cxx_eval_constant_expression) <case CLEANUP_STMT>:
644 Temporarily change input_location to CLEANUP_STMT location.
646 2019-10-22 Jakub Jelinek <jakub@redhat.com>
648 PR tree-optimization/85887
649 * decl.c (expand_static_init): Drop ECF_LEAF from __cxa_guard_acquire
650 and __cxa_guard_release.
652 2019-10-22 Marc Glisse <marc.glisse@inria.fr>
655 * constexpr.c (cxx_eval_builtin_function_call): Only set
656 force_folding_builtin_constant_p if manifestly_const_eval.
658 2019-10-22 Richard Sandiford <richard.sandiford@arm.com>
660 * cp-tree.h (STF_USER_VISIBLE): New constant.
661 (strip_typedefs, strip_typedefs_expr): Take a flags argument.
662 * tree.c (strip_typedefs, strip_typedefs_expr): Likewise,
663 updating mutual calls accordingly. When STF_USER_VISIBLE is true,
664 only look through typedefs if user_facing_original_type_p.
665 * error.c (dump_template_bindings, type_to_string): Pass
666 STF_USER_VISIBLE to strip_typedefs.
667 (dump_type): Likewise, unless pp_c_flag_gnu_v3 is set.
669 2019-10-21 Kamlesh Kumar <kamleshbhalui@gmail.com>
670 Jason Merrill <jason@redhat.com>
672 PR c++/83534 - typeinfo of noexcept function
673 * rtti.c (get_tinfo_decl_dynamic): Do not call
674 TYPE_MAIN_VARIANT for function.
675 (get_typeid): Likewise.
677 2019-10-21 Paolo Carlini <paolo.carlini@oracle.com>
679 * parser.c (cp_parser_class_head): Improve error recovery upon
680 extra qualification error.
682 2019-10-21 Jakub Jelinek <jakub@redhat.com>
685 * constexpr.c (cxx_eval_component_reference, cxx_eval_bit_field_ref):
686 Use STRIP_ANY_LOCATION_WRAPPER on CONSTRUCTOR elts.
688 2019-10-21 Marek Polacek <polacek@redhat.com>
690 PR c++/92062 - ODR-use ignored for static member of class template.
691 * pt.c (has_value_dependent_address): Strip location wrappers.
693 2019-10-21 Marek Polacek <polacek@redhat.com>
695 PR c++/92106 - ICE with structured bindings and -Wreturn-local-addr.
696 * typeck.c (maybe_warn_about_returning_address_of_local): Avoid
697 recursing on null initializer and return false instead.
699 2019-10-17 JeanHeyd Meneide <phdofthehouse@gmail.com>
701 Implement p1301 [[nodiscard("should have a reason")]] + p1771 DR
702 * tree.c (handle_nodiscard_attribute): Handle C++2a nodiscard
704 (std_attribute_table) Increase nodiscard argument handling
705 max_length from 0 to 1.
706 * parser.c (cp_parser_check_std_attribute): Add requirement
707 that nodiscard only be seen once in attribute-list.
708 (cp_parser_std_attribute): Check that empty parenthesis lists are
709 not specified for attributes that have max_length > 0 (e.g.
711 * cvt.c (maybe_warn_nodiscard): Add nodiscard message to
712 output, if applicable.
713 (convert_to_void): Allow constructors to be nodiscard-able (P1771).
715 2019-10-18 Nathan Sidwell <nathan@acm.org>
717 * cp-tree.h (struct lang_type): Remove was_anonymous.
718 (TYPE_WAS_UNNAMED): Implement by checking TYPE_DECL &
720 * decl.c (name_unnamed_type): Don't set TYPE_WAS_UNNAMED.
722 2019-10-17 Paolo Carlini <paolo.carlini@oracle.com>
724 * decl.c (grokfndecl): Remove redundant use of in_system_header_at.
725 (compute_array_index_type_loc): Likewise.
726 (grokdeclarator): Likewise.
727 * error.c (cp_printer): Likewise.
728 * lambda.c (add_default_capture): Likewise.
729 * parser.c (cp_parser_primary_expression): Likewise.
730 (cp_parser_selection_statement): Likewise.
731 (cp_parser_toplevel_declaration): Likewise.
732 (cp_parser_enumerator_list): Likewise.
733 (cp_parser_using_declaration): Likewise.
734 (cp_parser_member_declaration): Likewise.
735 (cp_parser_exception_specification_opt): Likewise.
736 (cp_parser_std_attribute_spec): Likewise.
737 * pt.c (do_decl_instantiation): Likewise.
738 (do_type_instantiation): Likewise.
739 * typeck.c (cp_build_unary_op): Likewise.
741 * decl.c (check_tag_decl): Pass to in_system_header_at the same
742 location used for the permerror.
743 (grokdeclarator): Likewise.
745 * decl.c (check_tag_decl): Use locations[ds_typedef] in error_at.
747 2019-10-17 Jason Merrill <jason@redhat.com>
749 * cp-gimplify.c (cp_gimplify_expr): Use get_initialized_tmp_var.
750 (gimplify_to_rvalue): Remove default NULL argument.
752 2019-10-17 Nathan Sidwell <nathan@acm.org>
754 * decl.c (builtin_function_1): Merge into ...
755 (cxx_builtin_function): ... here. Nadger the decl before maybe
756 copying it. Set the context.
757 (cxx_builtin_function_ext_scope): Push to top level, then call
758 cxx_builtin_function.
760 2019-10-16 Luis Machado <luis.machado@linaro.org>
762 * cp-gimplify.c: Fix reference to non-existing tree-gimple.c file.
764 2019-10-16 Jakub Jelinek <jakub@redhat.com>
766 * decl.c (cxx_maybe_build_cleanup): When clearing location of cleanup,
767 if cleanup is a nop, clear location of its operand too.
769 2019-10-15 Andrew Sutton <asutton@lock3software.com>
771 Finish moving constraint and logic functionality of out pt.c.
772 Reimplement and re-enable subsumption caching.
774 * config-lang.in (gtfiles): Add logic.cc.
775 * constraint.cc (atomic_constraints_identical_p): Add assertions.
776 (hash_atomic_constraint): Likewise.
777 (constraints_equivalent_p): New.
778 (inchash::add_constraint): New.
779 (iterative_hash_constraint): New.
780 (decl_constraints): Moved from pt.c.
781 (get_constraints): Likewise.
782 (set_constraints): Likewise.
783 (remove_constraints): Likewise.
784 * cp-tree.h (CONSTR_P): New.
785 (init_constraint_processing): Remove.
786 (constraints_equivalent_p, iterative_hash_constraint): Declare.
787 * decl.c (cxx_init_decl_processing): Don't initialize constraints.
788 * logic.cc (subsumption_entry): Moved from pt.c.
789 (subsumption_hasher): Likewise.
790 (subsumption_cache): Likewise.
791 (lookup_subsumption): Likewise.
792 (save_subsumption): Likewise.
793 (subsumes_constraints_nonnull): Use subsumption cache.
794 * pt.c: Move aforementioned declarations out of this file.
795 (init_constraint_processing): Remove.
797 2019-10-15 Andrew Sutton <asutton@lock3software.com>
799 * parser.c (cp_parser_constructor_declarator_p): Pass an empty
800 decl-specifier-seq to make sure we parse type constraints as part
803 2019-10-15 Nathan Sidwell <nathan@acm.org>
805 * class.c (build_clones): Break out of clone_function_decl. Just
807 (clone_function_decl): Call build_clones, then maybe add them to
810 * class.c (build_clone): Refactor to clarify recursiveness.
812 2019-10-14 Jason Merrill <jason@redhat.com>
814 PR c++/91930 - ICE with constrained inherited default ctor.
815 * name-lookup.c (do_class_using_decl): Set TYPE_HAS_USER_CONSTRUCTOR
816 for inherited constructor.
818 2019-10-14 Paolo Carlini <paolo.carlini@oracle.com>
820 * decl.c (check_tag_decl): Use DECL_SOURCE_LOCATION.
822 2019-10-14 Jakub Jelinek <jakub@redhat.com>
825 * semantics.c (handle_omp_array_sections_1): Temporarily disable
826 -fstrong-eval-order also for in_reduction and task_reduction clauses.
828 * parser.c (cp_parser_omp_all_clauses): Change bool NESTED_P argument
829 into int NESTED, if it is 2, diagnose missing commas in between
831 (cp_parser_omp_context_selector): Pass 2 as last argument to
832 cp_parser_omp_all_clauses.
834 2019-10-12 Jakub Jelinek <jakub@redhat.com>
836 * parser.c (cp_parser_omp_context_selector): Improve error recovery.
837 For simd properties, put them directly into TREE_VALUE.
838 (cp_finish_omp_declare_variant): Add "omp declare variant base"
839 attribute rather than "omp declare variant".
841 2019-10-11 Marek Polacek <polacek@redhat.com>
843 PR c++/92049 - extra error with -fchecking=2.
844 * pt.c (build_non_dependent_expr): Call fold_non_dependent_expr
847 2019-10-11 Paolo Carlini <paolo.carlini@oracle.com>
849 * typeck.c (cp_build_binary_op): Do not handle RROTATE_EXPR and
851 * constexpr.c (cxx_eval_constant_expression): Likewise.
852 (potential_constant_expression_1): Likewise.
853 * pt.c (tsubst_copy): Likewise.
855 2019-10-11 Jason Merrill <jason@redhat.com>
857 * decl2.c (mark_used): Don't clobber DECL_SOURCE_LOCATION on
858 explicitly defaulted functions.
859 * method.c (synthesize_method): Likewise.
861 2019-10-11 Jakub Jelinek <jakub@redhat.com>
864 * decl2.c (grok_array_decl): For -fstrong-eval-order, when array ref
865 operands have been swapped and at least one operand has side-effects,
866 revert the swapping before calling build_array_ref.
867 * typeck.c (cp_build_array_ref): For non-ARRAY_TYPE array ref with
868 side-effects on the index operand, if -fstrong-eval-order use
869 save_expr around the array operand.
870 (cp_build_binary_op): For shifts with side-effects in the second
871 operand, wrap first operand into SAVE_EXPR and evaluate it before
873 * semantics.c (handle_omp_array_sections_1): Temporarily disable
874 flag_strong_eval_order during OMP_CLAUSE_REDUCTION array section
876 * cp-gimplify.c (gimplify_to_rvalue): New function.
877 (cp_gimplify_expr): Use it.
879 2019-10-10 Marek Polacek <polacek@redhat.com>
881 * typeck.c (comp_ptr_ttypes_real): Change the return type to bool.
882 Use false instead of 0.
884 2019-10-10 Jakub Jelinek <jakub@redhat.com>
886 * parser.h (struct cp_omp_declare_simd_data): Add variant_p member.
887 * parser.c (cp_ensure_no_omp_declare_simd): Handle both declare simd
889 (cp_parser_oacc_all_clauses): Formatting fix.
890 (cp_parser_omp_all_clauses): Add NESTED_P argument, if true, terminate
891 processing on closing paren and don't skip to end of pragma line.
892 (cp_parser_omp_declare_simd): Add VARIANT_P argument. Handle also
894 (omp_construct_selectors, omp_device_selectors,
895 omp_implementation_selectors, omp_user_selectors): New variables.
896 (cp_parser_omp_context_selector,
897 cp_parser_omp_context_selector_specification,
898 cp_finish_omp_declare_variant): New functions.
899 (cp_parser_late_parsing_omp_declare_simd): Handle also declare variant.
900 (cp_parser_omp_declare): Handle declare variant.
902 2019-10-09 Jason Merrill <jason@redhat.com>
904 * cp-tree.h (template_info_decl_check): Check ENABLE_TREE_CHECKING.
906 2019-10-09 Marek Polacek <polacek@redhat.com>
908 PR c++/91364 - P0388R4: Permit conversions to arrays of unknown bound.
909 PR c++/69531 - DR 1307: Differently bounded array parameters.
910 PR c++/88128 - DR 330: Qual convs and pointers to arrays of pointers.
911 * call.c (build_array_conv): Build ck_identity at the beginning
913 (standard_conversion): Pass bounds_none to comp_ptr_ttypes_const.
914 (maybe_warn_array_conv): New.
915 (convert_like_real): Call it. Add an error message about converting
916 from arrays of unknown bounds.
917 (conv_get_original_expr): New.
918 (nelts_initialized_by_list_init): New.
919 (conv_binds_to_array_of_unknown_bound): New.
920 (compare_ics): Implement list-initialization ranking based on
921 array sizes, as specified in DR 1307 and P0388R.
922 * cp-tree.h (comp_ptr_ttypes_const): Adjust declaration.
923 (compare_bounds_t): New enum.
924 * typeck.c (comp_array_types): New bool and compare_bounds_t
925 parameters. Use them.
926 (structural_comptypes): Adjust the call to comp_array_types.
927 (similar_type_p): Handle ARRAY_TYPE.
928 (build_const_cast_1): Pass bounds_none to comp_ptr_ttypes_const.
929 (comp_ptr_ttypes_real): Don't check cv-quals of ARRAY_TYPEs. Use
930 comp_array_types to compare array types. Look through arrays as per
932 (comp_ptr_ttypes_const): Use comp_array_types to compare array types.
933 Look through arrays as per DR 330.
935 2019-10-09 Marek Polacek <polacek@redhat.com>
937 PR c++/92032 - DR 1601: Promotion of enum with fixed underlying type.
938 * call.c (standard_conversion): When converting an enumeration with
939 a fixed underlying type to the underlying type, give it the cr_promotion
941 (compare_ics): Implement a tiebreaker as per CWG 1601.
943 2019-10-08 Andrew Sutton <asutton@lock3software.com>
944 Jason Merrill <jason@redhat.com>
946 Update the concepts implementation to conform to the C++20
947 specification, improve compile times, and generally clean up
949 * call.c (build_new_function_call): Don't evaluate concepts here.
950 (constraint_failure): Don't record the template.
951 (print_z_candidate): Don't extract the template.
952 * class.c (add_method): When overloading, hide ineligible special
954 (check_methods): Set TYPE_HAS_COMPLEX_* here.
955 * constexpr.c (cxx_eval_constant_expression): Evaluate concepts.
956 (maybe_initialize_fundef_copies_table): Remove.
957 (get_fundef_copy): Use hash_map_safe_get_or_insert.
958 (clear_cv_and_fold_caches): Clear the satisfaction cache.
959 * constraint.cc (known_non_bool_p): New.
960 (parsing_constraint_expression_sentinel): Renamed from
961 expanding_constraint_sentinel.
962 (check_constraint_operands): New.
963 (check_constraint_atom): New.
964 (finish_constraint_binary_op): New.
965 (finish_constraint_or_expr): Likewise.
966 (finish_constraint_and_expr): Likewise.
967 (finish_constraint_primary_expr): Likewise.
968 (combine_constraint_expressions): New.
969 (finish_requires_expr): Add location parm.
970 (get_concept_definition): Return the initializer of concept definitions.
971 (get_template_head_requirements): New.
972 (get_trailing_function_requirements): New.
973 (deduce_constrained_parameter): Check if the identifier or template-id
974 is a concept definition.
975 (resolve_concept_definition_check): Removed.
976 (resolve_variable_concept_check): Removed.
977 (resolve_concept_check): New.
978 (resolve_constraint_check): Handle concept definitions.
979 converting arguments.
980 (function_concept_check_p): Removed.
981 (variable_concept_check_p): Removed.
982 (unpack_concept_check): New.
983 (get_concept_check_template): New.
984 (build_call_check): Moved and renamed to build_function_check.
985 (build_concept_check_arguments): make static.
986 (build_function_check): Always do overload resolution
987 in order to force conversion of template arguments (i.e., actually
988 check that the use of a concept is valid).
989 (build_standard_check): Renamed from build_real_concept_check.
990 (build_real_concept_check): Build checks for C++2a concepts by
991 (build_wildcard_concept_check): New.
992 (build_concept_check): Use build_real_concept_check. New overload.
993 (build_constraints): Save expressions, not normalized constraints.
994 (build_concept_id): New. Pass tf_warning_or_error.
995 (build_type_constraint): New.
996 (finish_type_constraints): New.
997 (associate_classtype_constraints): Also add constraints to union
998 types. Note the original declaration in errors. Don't return
999 error_mark_node in order to avoid an assertion later.
1000 (push_down_pack_expansion): Remove.
1001 (finish_shorthand_constraint): Make fold expressions, not naked
1002 parameter packs. Always apply the constraint to each template argument.
1003 (check_introduction_list): New. Fail if not enough
1004 names are introduced.
1005 (finish_template_introduction): Don't normalize constraints. Pass
1006 tsubst flags. Check for insufficient introductions.
1007 (placeholder_extract_concept_and_args): Handle the template-id case.
1008 Unpack function concept checks correctly.
1009 (tsubst_simple_requirement): Return errors if they occur. Don't
1010 process as a template.
1011 (tsubst_type_requirement): Likewise.
1012 (type_deducible_p): New. Wrap the input expression in parens for the
1013 purpose of deduction.
1014 (expression_convertible_t): New.
1015 (tsubst_compound_requirement): Use new deduction, conversion predicates.
1016 (tsubst_nested_requirement): Return errors if they occur. Don't
1017 process as a template. Instantiate and evaluate the nested requirement.
1018 (tsubst_valid_expression_requirement): New.
1019 (tsubst_simple_requirement): Use tsubst_valid_expression_requirement.
1020 (tsubst_compound_requirement): Use tsubst_valid_expression_requirement.
1021 (check_constaint_variables): New.
1022 (tsubst_constraint_variables): Check that type substitutions are valid.
1023 (tsubst_requires_expr): Likewise. Produce new requires-exprs during
1024 template substitution. Copy the previous local specialization stack,
1025 so references to non-local parameters can be found. Use cp_unevaluated.
1026 (tsubst_constraint): New. Don't evaluate concept checks.
1028 (norm_info): New. Used to build a normalization tree for concept check
1030 (debug_parameter_mapping): New.
1031 (debug_argument_list): New.
1032 (expand_concept): Removed.
1033 (normalize_logical_operation): Pass subst_info through call.
1034 (normalize_pack_expansion): Remove.
1035 (normalize_simple_requirement): Removed
1036 (normalize_type_requirement): Removed
1037 (normalize_compound_requirement): Removed
1038 (normalize_nested_requirement): Removed
1039 (normalize_requirement): Removed
1040 (normalize_requirements): Removed
1041 (normalize_requires_expression): Removed
1042 (normalize_variable_concept_check): Removed.
1043 (normalize_function_concept_check): Removed.
1044 (normalize_concept_check): Merged all normalize_*_check here.
1045 Substitute through written template arguments before normalizing the
1046 definition. Only substitute the innermost template arguments.
1047 (check_for_logical_overloads): Delete.
1048 (map_arguments): New. Associate template parameters with arguments.
1049 (build_parameter_mapping): New. Extract used parameters.
1050 (normalize_expression): Rewrite.
1051 (normalize_conjunction): Removed
1052 (normalize_disjunction): Removed
1053 (normalize_predicate_constraint): Removed
1054 (normalize_parameterized_constraint): Removed
1055 (normalized_map): New variable.
1056 (get_normalized_constraints): New entry point for normalization.
1057 Establishes a timer.
1058 (get_normalized_constraints_from_info): New.
1059 (get_normalized_constraints_from_decl): New. Turn on template processing
1060 prior to normalization. Handle inheriting ctors. Build the
1061 normalization arguments from the full set of template parameters of the
1062 most general template. This guarantees that we have no concrete arguments
1063 in the parameter mapping (e.g., from template members of class
1064 templates). Cache normalizations.
1065 (normalize_concept_definition): New. Cache normalizations.
1066 (normalize_template_requirements): New.
1067 (normalize_nontemplate_requirements): New.
1068 (normalize_constraint_expression): New.
1069 (tsubst_parameter_mapping): New.
1070 (get_mapped_args): New.
1071 (parameter_mapping_equivalent_p): New. Use template_args_equal.
1072 (atomic_constraints_identical_p): New.
1073 (hash_atomic_constraint): New.
1074 (satisfying_constraint_p): New. Guard against recursive evaluation of
1075 constraints during satisfaction.
1076 (satisfy_conjunction): New.
1077 (satisfy_disjunction): New.
1078 (sat_entry): New class for hashing satisfaction results.
1079 (sat_hasher): New hash traits.
1081 (get_satisfaction): New. Returns cached satisfaction result.
1082 (save_satisfaction): New. Caches a satisfaction result.
1083 (clear_satisfaction_cache): New.
1084 (satisfaction_cache): New. Helps manage satisfaction cache requests.
1085 (decl_satisfied_cache): New.
1086 (satisfy_atom): New.
1087 (satisfy_constraint_r): New.
1088 (satisfy_constraint): Use new satisfaction algorithm.
1089 (evaluate_concept_check): New.
1090 (evaluate_concept): Removed.
1091 (evaluate_function_concept): Removed.
1092 (evaluate_variable_concept): Removed.
1093 (satisfy_constraint_expression): New.
1094 (constraint_expression_satisfied_p): New.
1095 (constraints_satisfied_p): Use strip_inheriting_ctors. Use
1096 push_/pop_access_scope.
1097 (more_constrained): Normalize before calling out to subsumption. Allow
1098 classes as arguments.
1099 (strictly_subsumes): Allow non-templates as arguments. Accept a new
1101 (weakly_subsumes): New.
1102 (at_least_as_constrained): Removed.
1103 (diagnose_other_expression): Removed.
1104 (diagnose_predicate_constraint): Removed.
1105 (diagnose_pack_expansion): Removed.
1106 (diagnose_check_constraint): Removed.
1107 (diagnose_logical_constraint): Removed.
1108 (diagnose_expression_constraint): Removed.
1109 (diagnose_type_constraint): Removed.
1110 (diagnose_implicit_conversion_constraint): Removed.
1111 (diagnose_argument_deduction_constraint): Removed.
1112 (diagnose_exception_constraint): Removed.
1113 (diagnose_parameterized_constraint): Removed.
1114 (diagnose_argument_deduction_constraint): Removed.
1115 (diagnose_argument_deduction_constraint): Removed.
1116 (diagnose_argument_deduction_constraint): Removed.
1117 (diagnose_trait_expr): New.
1118 (diagnose_requires_expr): New.
1119 (diagnose_atomic_constraint): New.
1120 (diagnose_valid_expression) Stop wrongly diagnosing valid expressions.
1121 Don't substitute as if in template decls. This causes substitution
1122 to generate expressions that aren't suitable for use with the noexcept
1124 (diagnose_valid_type) Likewise.
1125 (diagnose_compound_requirement) Actually emit diagnostics for
1126 the causes of errors.Call force_paren_expr_uneval.
1127 (diagnose_declaration_constraints): Turn on template processing to
1128 suppress certain analyses.
1129 * cp-objcp-common.c (cp_common_init_ts): Make concepts typed.
1130 (cp_get_debug_type): Use hash_map_safe_*.
1131 * cp-tree.h: New function declarations for semantic actions, other
1132 facilities. Remove declaration no longer used or needed. Remove
1133 unused _CONSTR macros.
1134 (LANG_DECL_HAS_MIN): Add CONCEPT_DECL.
1135 (template_info_decl_check): Factor macro check into an inline function.
1136 (DECL_TEMPLATE_INFO): Use new check facility.
1137 (finish_concept_definition): New. Don't invalid concept declarations
1138 with invalid initializers.
1139 (find_template_parameters): New.
1140 (concept_definition_p): New.
1141 (concept_check_p): New.
1142 (variable_concept_check_p): New.
1143 (force_paren_expr_uneval): New.
1144 (ovl_iterator::using_p): A USING_DECL by itself was also
1145 introduced by a using-declaration.
1146 (struct tree_template_info): Use tree_base instead of
1147 tree_common. Add tmpl and args fields.
1148 (TI_TEMPLATE, TI_ARGS): Adjust.
1149 (DECLTYPE_FOR_INIT_CAPTURE): Remove.
1150 (CONSTR_CHECK, CONSTR_INFO, CONSTR_EXPR, CONSTR_CONTEXT): New.
1151 (ATOMIC_CONSTR_MAP, TRAIT_EXPR_LOCATION): New.
1152 (struct tree_trait_expr): Add locus field.
1153 (enum tsubst_flags): Add tf_norm as a hint to generate normalization
1154 context when diagnosing constraint failure.
1155 * cp-tree.def: Remove unused _CONSTR nodes and rename PRED_CONSTR
1157 (CONCEPT_DECL): New.
1158 * cxx-pretty-print.c: Remove constraint printing code.
1159 (pp_cxx_concept_definition): New.
1160 (pp_cxx_template_declaration): Print concept definitions.
1161 (pp_cxx_check_constraint): Update printing for concept definitions.
1162 (pp_cxx_nested_name_specifier): Fix a weird
1163 case where we're printing '::::' for concepts.
1164 (simple_type_specifier): Print requirements for placeholder types.
1165 (pp_cxx_constrained_type_spec): Print the associated requirements of
1167 (pp_cxx_compound_requirement): Add space before the '->'.
1168 (pp_cxx_parameter_mapping): Print the parameter mapping.
1169 (pp_cxx_atomic_constraint): Use the function above.
1170 * decl.c (redeclaration_error_message): New error for concepts.
1171 (grokdeclarator): Check for and disallow decltype(auto) in parameter
1173 (grokfndecl): Don't normalize constraints. Add check for constraints
1175 (grokvardecl): Don't normalize constraints.
1176 (grok_special_member_properties): Don't set TYPE_HAS_COMPLEX_*.
1177 (function_requirements_equivalent_p): New. Compare trailing
1178 requires clauses. Compare combined constraints in pre-C++20 mode.
1179 (decls_match): Compare trailing requires clauses. Compare template
1180 heads for function templates. Remove old constraint comparison.
1181 Simplify comparison of functions, function templates.
1182 (duplicate_function_template_decls): New. Refactor a nasty if
1183 condition into a single predicate.
1184 (require_deduced_type): Don't complain if we already complained about
1186 (finish_function): Perform auto deduction to ensure that constraints
1187 are checked even when functions contain no return statements. Only do
1188 auto deduction if we haven't previously seen any return statements.
1189 This prevents multiple diagnostics of the same error.
1190 (store_decomp_type): Remove.
1191 (cp_finish_decomp): Use hash_map_safe_put.
1192 * error.c: Remove constraint printing code.
1193 (dump_decl): Dump concept definitions. Handle wildcard declarations.
1194 (dump_template_decl): Likewise.
1195 (dump_type): Print associated requirements for placeholder
1197 (rebuild_concept_check): New.
1198 (maybe_print_single_constraint_context): New.
1199 (maybe_print_constraint_context): Recursively print nested contexts.
1200 * init.c (get_nsdmi): Use hash_map_safe_*.
1201 * lambda.c (maybe_add_lambda_conv_op): Bail if deduction failed.
1202 (add_capture): Copy parameter packs from init.
1203 (lambda_capture_field_type): Always use auto for init-capture.
1204 * logic.cc: Completely rewrite.
1205 (constraint_hash): New.
1206 (clause/ctor): Save atoms in the hash table.
1207 (replace): Save atoms during replacement.
1208 (insert): Save atoms during insertion.
1209 (contains): Only search the hash table for containment.
1210 (clause): Keep a hash of atomic constraints.
1211 (clause::clause): Explicitly copy the hash table when copying.
1212 (disjunction_p, conjunction_p, atomic_p, dnf_size, cnf_size): New.
1213 (diagnose_constraint_size): New.
1214 (subsumes_constraints_nonnull): Compare the sizes of normalized formula
1215 to determine the cheapest decomposition.
1216 * name-lookup.c (diagnose_name_conflict): Diagnose name issues with
1218 (matching_fn_p): Check constraints.
1219 (push_class_level_binding_1): Move overloaded functions case down,
1220 accept FUNCTION_DECL as target_decl.
1221 * parser.c (enum required_token): New required token for auto.
1222 (make_location): Add overload taking lexer as last parm.
1223 (cp_parser_required_error): Diagnose missing auto.
1224 (cp_parser_diagnose_ungrouped_constraint_plain): New.
1225 (cp_parser_diagnose_ungrouped_constraint_plain): New.
1226 (cp_parser_constraint_primary_expression): New. Tentatively parse the
1227 primary expression. If that fails tentatively parse a lower
1228 precedence expression in order to diagnose the error.
1229 (cp_parser_check_non_logical_constraint): New. Performs a trial
1230 parse of the right-hand-side of non-logical operators in order to
1231 generate good diagnostics.
1232 (cp_parser_constraint_logical_and_expression): New.
1233 (cp_parser_constraint_logical_or_expression): New.
1234 (cp_parser_requires_clause_expression): New.
1235 (cp_parser_requires_clause): Renamed to cp_parser_constraint_expression.
1236 (cp_parser_requires_clause_opt): Parse the requires-clause differently
1237 in -fconcepts and -std=c++2a modes.
1238 (cp_parser_requirement_list): Rename to cp_parser_requirement_seq.
1239 Rewrite so that semicolons are parsed
1240 along with requirements, not the sequence.
1241 (cp_parser_simple_requirement): Expect a semicolon at end.
1242 (cp_parser_compound_requirement): Expect a semicolon at end. Only
1243 allow trailing-return-type with -fconcepts-ts.
1244 (cp_parser_nested_requirement): Expect a semicolon at end. Parse
1245 constraint-expressions.
1246 (cp_parser_concept_definition): New. Don't fail parsing the concept
1247 definition if the initializer is ill-formed. Don't declare the concept
1248 before parsing the initializer.
1249 (cp_parser_constraint_expression): Declare earlier.
1250 (cp_parser_type_requirement): Current scope is not valid.
1251 (cp_parser_requires_expression): Commit to the tentative parse.
1252 (cp_parser_decl_specifier_seq): Warn when concept appears to be used
1253 as a decl-specifier.
1254 (cp_parser_template_declaration_after_parameters): Parse concept
1256 (cp_parser_template_id): Don't try to resolve a concept template-id yet.
1257 (cp_parser_template_id_expr): Resolve it as a concept check.
1258 (cp_parser_decl_specifier_seq): Warn on 'concept bool'.
1259 (cp_parser_type_parameter): Combine expressions not
1261 (cp_parser_explicit_template_declaration): Combine expressions not
1263 (cp_parser_maybe_concept_name): Removed.
1264 (cp_parser_simple_type_specifier): Handle an error condition of
1265 a bad constrained type specifier. Expect auto or decltype after
1266 a concept name. Also handle the case where we have a template-id
1268 (cp_parser_template_introduction): Diagnose errors on invalid
1269 introductions. Give up if it doesn't start with a concept name.
1270 Pedwarn if not -fconcepts-ts.
1271 (synthesize_implicit_template_parm): Don't do consistent binding.
1272 Use a new flag for constrained parameters. Combine expressions,
1273 not constraints. Fail if we get a placeholder in block scope.
1274 Placeholders that do not constrain types are not allowed in parameter
1275 declarations, so don't handle them.
1276 (cp_parser_placeholder_type_specifier): New. Implement parsing of
1277 placeholder type specifiers following a concept name or partial
1278 concept check. Disallow decltype(auto) parameters.
1279 (cp_parser_nested_name_specifier_opt): If the token is already
1280 CPP_NESTED_NAME_SPECIFIER, leave it alone.
1281 (cp_parser_id_expression, cp_parser_unqualified_id): Call
1282 cp_parser_template_id_expr.
1283 (cp_parser_placeholder_type_specifier): Add tentative parm. Don't
1284 expect a WILDCARD_DECL.
1285 (cp_parser_trait_expr): Pass trait_loc down.
1286 (cp_parser_postfix_expression): Do set location of dependent member
1288 * pt.c (finish_concept_definition): New.
1289 (push_template_decl_real): Handle concept definitions.
1290 (start_concept_definition): Let push_template_decl_real handle the
1291 creation of the template.
1292 (get_constraints): Return null if the table hasn't been initialized.
1293 (tsubst_copy_and_build): Build template-id expressions for concept
1295 [TRAIT_EXPR]: Pass trait_loc down.
1296 (lookup_template_class_1): Add the template name to the constraint
1298 (lookup_and_finish_template_variable): Build concept checks
1299 with the correct arguments.
1300 (tsubst_function_decl): Don't substitute through constraints.
1301 Always associate constraints with functions.
1302 (template_parm_level_and_index): Make non-static.
1303 (for_each_template_parm_r): Handle requires expressions.
1304 (keep_template_parm): New.
1305 (find_template_parameters): New.
1306 (more_specialized_fn): Change how winners and losers are chosen.
1307 (make_constrained_auto): Don't normalize constraints.
1308 (template_parameters_equivalent_p): New. Compare template
1309 parameters. Add a comparison for implicitly vs. explicitly declared
1311 (template_parameter_lists_equivalent_p): New. Compare template
1313 (template_requirements_equivalent_p): New.
1314 (template_heads_equivalent_p): New. Compare template heads.
1315 (template_parameter_constraints_equivalent_p): New.
1316 (is_compatible_template_arg): Use weakly_subsumes.
1317 (maybe_new_partial_specialization): Use new constraint comparison
1318 for finding specializations.
1319 (process_partial_specialization): Pass main template as argument.
1320 (more_specialized_partial_spec): Don't immediately return when
1322 (make_constrained_auto): Handle concept definitions.
1323 (do_auto_deduction): Update auto deduction for new concept model.
1324 Extract the function concept correctly; rename constr to check to
1325 reflect the kind of node.
1326 (tsubst): Adjust wildcard argument during substitution.
1327 [DECLTYPE_TYPE]: Remove init-capture handling.
1328 (tsubst_copy_and_build): Build concept checks, not template ids.
1329 Defer checks of function concepts. Handle concepts before variable
1330 templates. Handle calls to function concepts explicitly.
1331 (coerce_template_parms): Use concept_definition_p. Handle a deduction
1332 error where a potentially empty pack can be supplied after the last
1333 parameter of a concept.
1334 (finish_template_variable): Don't process concepts here.
1335 (instantiation_dependent_r): Use concept_check_p.
1336 (tsubst_template_args): Make non-static.
1337 (make_constrained_placeholder_type): New. Refactored from
1338 make_constrained_auto.
1339 (make_constrained_auto) Use make_constrained_placeholder_type.
1340 (make_constrained_decltype_auto) New.
1341 (tsubst_function_parms): New.
1342 (value_dependent_expression_p) [TEMPLATE_ID_EXPR]: Use
1343 concept_definition_p.
1344 (push_access_scope, pop_access_scope): No longer static.
1345 (tsubst_template_parm): Substitute TEMPLATE_PARM_CONSTRAINTS.
1346 (tsubst_friend_function): Use tsubst_constraint. Use generic_targs_for.
1347 (get_underlying_template) Use generic_targs_for.
1348 (uses_parameter_packs): Return tree.
1349 (gen_elem_of_pack_expansion_instantiation): Don't push
1350 local_specialization_stack.
1351 (prepend_one_capture): New.
1352 (tsubst_lambda_expr): Use prepend_one_capture. Don't touch
1353 local_specializations.
1354 (template_parms_level_to_args): No longer static.
1355 (add_outermost_template_args): Likewise.
1356 (find_template_parameter_info): New. Provide context for finding
1357 template parameters.
1358 (keep_template_parm): Don't keep parameters declared at depth levels
1359 greater than those of the template parameters of the source declaration.
1360 Don't propagate cv-qualified types. Return 0, so we find all template
1361 parameters, not the just first.
1362 (any_template_parm_r): New. Handle cases that are mishandled by
1363 for_each_template_parm_r.
1364 (generic_targs_for): Factor out of coerce_template_args_for_ttp.
1365 (tsubst_argument_pack): Factor out of tsubst_template_args.
1366 (constraint_sat_entry): Removed.
1367 (constraint_sat_hasher): Removed.
1368 (concept_spec_entry): Removed.
1369 (concept_spec_hasher): Removed.
1370 (constraint_memos): Removed.
1371 (concept_memos): Removed.
1372 (lookup_constraint_satisfaction): Removed.
1373 (memoize_constraint_satisfaction): Removed.
1374 (lookup_concept_satisfaction): Removed.
1375 (memoize_concept_satisfaction): Removed.
1376 (concept_expansions): Removed.
1377 (get_concept_expansion): Removed.
1378 (save_concept_expansion): Removed.
1379 (init_constraint_processing): Remove initialization of non-existing
1381 (find_template_requirement): New. Search for the sub-requirement
1382 within the associated constraints.
1383 (convert_generic_types_to_packs): Also transform the associated
1384 constraint and update the current template requirements.
1385 (store_defaulted_ttp, lookup_defaulted_ttp): Remove.
1386 (add_defaults_to_ttp): Use hash_map_safe_*.
1387 * semantics.c (finish_call_expr): Diagnose calls to concepts.
1388 Handle concept checks explicitly.
1389 (finish_id_expression): Evaluate variable concepts as part of
1390 id-expression processing. Don't treat variable concepts as variables,
1391 and don't process function concepts as plain id-expressions.
1392 (force_paren_expr): Add even_uneval parm.
1393 (finish_trait_expr): Add location parm.
1394 * tree.c (special_memfn_p): New.
1395 (cp_expr_location): Handle TRAIT_EXPR.
1396 * typeck.c (check_return_expr): Actually use the diagnostic kind
1397 when performing return-type deduction.
1398 * typeck2.c (build_functional_cast): Don't rely on the location of
1401 2019-10-09 Paolo Carlini <paolo.carlini@oracle.com>
1403 * decl.c (grok_ctor_properties): Use DECL_SOURCE_LOCATION.
1404 * typeck.c (cp_build_binary_op): Use the op_location_t argument
1405 in many error messages.
1407 2019-10-08 Martin Sebor <msebor@redhat.com>
1410 * call.c (maybe_warn_class_memaccess): Handle arrays.
1412 2019-10-07 Paolo Carlini <paolo.carlini@oracle.com>
1414 * call.c (resolve_args): Use cp_expr_loc_or_input_loc in one place.
1415 * decl.c (grokdeclarator): Use id_loc in one place.
1416 * decl2.c (build_anon_union_vars): Use DECL_SOURCE_LOCATION.
1417 * parser.c (cp_parser_delete_expression): Fix the location of the
1418 returned expression.
1419 (cp_parser_throw_expression): Likewise.
1420 * pt.c (determine_specialization): Use DECL_SOURCE_LOCATION.
1422 2019-10-05 Jakub Jelinek <jakub@redhat.com>
1424 PR c++/91369 - Implement P0784R7: constexpr new
1425 * cp-tree.h (enum cp_tree_index): Add CPTI_HEAP_UNINIT_IDENTIFIER,
1426 CPTI_HEAP_IDENTIFIER and CPTI_HEAP_DELETED_IDENTIFIER.
1427 (heap_uninit_identifier, heap_identifier, heap_deleted_identifier):
1429 (type_has_constexpr_destructor, build_new_constexpr_heap_type,
1430 cxx_constant_dtor): Declare.
1431 * class.c (type_maybe_constexpr_default_constructor): Make static.
1432 (type_maybe_constexpr_destructor, type_has_constexpr_destructor): New
1434 (finalize_literal_type_property): For c++2a, don't clear
1435 CLASSTYPE_LITERAL_P for types without trivial destructors unless they
1436 have non-constexpr destructors.
1437 (explain_non_literal_class): For c++2a, complain about non-constexpr
1438 destructors rather than about non-trivial destructors.
1439 * constexpr.c: Include stor-layout.h.
1440 (struct constexpr_global_ctx): New type.
1441 (struct constexpr_ctx): Add global field, remove values and
1442 constexpr_ops_count.
1443 (cxx_replaceable_global_alloc_fn): New inline function.
1444 (cxx_eval_call_expression): For c++2a allow calls to replaceable
1445 global allocation functions, for new return address of a heap uninit
1446 var, for delete record its deletion. Change ctx->values->{get,put} to
1447 ctx->global->values.{get,put}.
1448 (non_const_var_error): Add auto_diagnostic_group sentinel. Emit
1449 special diagnostics for heap variables.
1450 (cxx_eval_store_expression): Change ctx->values->{get,put} to
1451 ctx->global->values.{get,put}.
1452 (cxx_eval_loop_expr): Initialize jump_target if NULL. Change
1453 new_ctx.values->remove to ctx->global->values.remove.
1454 (cxx_eval_constant_expression): Change *ctx->constexpr_ops_count
1455 to ctx->global->constexpr_ops_count. Change ctx->values->{get,put} to
1456 ctx->global->values.{get,put}.
1457 <case NOP_EXPR>: Formatting fix. On cast of replaceable global
1458 allocation function to some pointer type, adjust the type of
1459 the heap variable and change name from heap_uninit_identifier
1461 (find_heap_var_refs): New function.
1462 (cxx_eval_outermost_constant_expr): Add constexpr_dtor argument,
1463 handle evaluation of constexpr dtors and add tracking of heap
1464 variables. Use tf_no_cleanup for get_target_expr_with_sfinae.
1465 (cxx_constant_value): Adjust cxx_eval_outermost_constant_expr caller.
1466 (cxx_constant_dtor): New function.
1467 (maybe_constant_value, fold_non_dependent_expr_template,
1468 maybe_constant_init_1): Adjust cxx_eval_outermost_constant_expr
1470 (potential_constant_expression_1): Ignore clobbers. Allow
1471 COND_EXPR_IS_VEC_DELETE for c++2a.
1472 * decl.c (initialize_predefined_identifiers): Add heap identifiers.
1473 (decl_maybe_constant_destruction): New function.
1474 (cp_finish_decl): Don't clear TREE_READONLY for constexpr variables
1475 with non-trivial, but constexpr destructors.
1476 (register_dtor_fn): For constexpr variables with constexpr non-trivial
1477 destructors call cxx_maybe_build_cleanup instead of adding destructor
1479 (expand_static_init): For constexpr variables with constexpr
1480 non-trivial destructors call cxx_maybe_build_cleanup.
1481 (grokdeclarator): Allow constexpr destructors for c++2a. Formatting
1483 (cxx_maybe_build_cleanup): For constexpr variables with constexpr
1484 non-trivial destructors call cxx_constant_dtor instead of adding
1485 destructor calls at runtime.
1486 * init.c: Include stor-layout.h.
1487 (build_new_constexpr_heap_type, maybe_wrap_new_for_constexpr): New
1489 (build_new_1): For c++2a and new[], add cast around the alloc call
1490 to help constexpr evaluation figure out the type of the heap storage.
1491 (build_vec_delete_1): Set DECL_INITIAL of tbase and emit a DECL_EXPR
1492 for it instead of initializing an uninitialized variable.
1493 * method.c: Include intl.h.
1494 (SFK_CTOR_P, SFK_DTOR_P, SFK_ASSIGN_P, SFK_COPY_P, SFK_MOVE_P): Move
1495 definitions earlier.
1496 (process_subob_fn): Add sfk argument, adjust non-constexpr call
1497 diagnostics based on it.
1498 (walk_field_subobs): Formatting fixes. Adjust process_subob_fn caller.
1499 (synthesized_method_base_walk): Likewise.
1500 (synthesized_method_walk): Set *constexpr_p to true for dtors in c++2a.
1501 Fix up DR number in comment.
1502 (implicitly_declare_fn): Formatting fix.
1503 * typeck2.c (store_init_value): Don't call cp_fully_fold_init on
1504 initializers of automatic non-constexpr variables in constexpr
1507 2019-10-04 Jakub Jelinek <jakub@redhat.com>
1510 * constexpr.c (cxx_fold_indirect_ref_1): New function.
1511 (cxx_fold_indirect_ref): Use it.
1514 * cp-gimplify.c (cp_gimplify_expr) <case CALL_EXPR>: For
1515 -fstrong-eval-order ensure CALL_EXPR_FN side-effects are evaluated
1516 before any arguments. Additionally, ensure CALL_EXPR_FN that isn't
1517 invariant nor OBJ_TYPE_REF nor SSA_NAME is forced into a temporary.
1519 2019-10-03 Paolo Carlini <paolo.carlini@oracle.com>
1521 * init.c (build_new): Use cp_expr_loc_or_input_loc in two places.
1522 * name-lookup.c (do_pushdecl): Use DECL_SOURCE_LOCATION.
1523 (push_class_level_binding_1): Likewise.
1524 (set_decl_namespace): Likewise.
1526 2019-10-03 Jakub Jelinek <jakub@redhat.com>
1528 * constexpr.c (cxx_eval_constant_expression) <case CLEANUP_STMT>: If
1529 not skipping upon entry to body, run cleanup with the same *jump_target
1530 as it started to run the cleanup even if the body returns, breaks or
1532 (potential_constant_expression_1): Allow CLEANUP_STMT.
1534 * constexpr.c (cxx_eval_store_expression): Formatting fix. Handle
1535 const_object_being_modified with array type.
1537 2019-10-02 Jason Merrill <jason@redhat.com>
1539 * typeck2.c (store_init_value): Only clear_cv_and_fold_caches if the
1542 2019-09-30 Jason Merrill <jason@redhat.com>
1544 Use hash_map_safe_* functions.
1545 * constexpr.c (maybe_initialize_fundef_copies_table): Remove.
1546 (get_fundef_copy): Use hash_map_safe_get_or_insert.
1547 * cp-objcp-common.c (cp_get_debug_type): Use hash_map_safe_*.
1548 * decl.c (store_decomp_type): Remove.
1549 (cp_finish_decomp): Use hash_map_safe_put.
1550 * init.c (get_nsdmi): Use hash_map_safe_*.
1551 * pt.c (store_defaulted_ttp, lookup_defaulted_ttp): Remove.
1552 (add_defaults_to_ttp): Use hash_map_safe_*.
1554 2019-10-02 Richard Biener <rguenther@suse.de>
1557 * decl.c (build_ptrmemfunc_type): Mark pointer-to-member
1558 fat pointer structure members as DECL_NONADDRESSABLE_P.
1560 2019-09-28 Marek Polacek <polacek@redhat.com>
1562 PR c++/91889 - follow-up fix for DR 2352.
1563 * call.c (involves_qualification_conversion_p): New function.
1564 (direct_reference_binding): Build a ck_qual if the conversion
1565 would involve a qualification conversion.
1566 (convert_like_real): Strip the conversion created by the ck_qual
1567 in direct_reference_binding.
1569 PR c++/91921 - stray warning with -Woverloaded-virtual.
1570 * class.c (warn_hidden): Only emit the second part of
1571 -Woverloaded-virtual if the first part was issued. Use inform instead
1574 PR c++/91923 - failure-to-SFINAE with class type NTTP in C++17.
1575 * pt.c (invalid_nontype_parm_type_p): Only emit errors when
1578 2019-09-27 Jakub Jelinek <jakub@redhat.com>
1581 * parser.c (cp_parser_omp_var_list_no_open): Parse predefined
1583 * semantics.c (finish_omp_clauses): Allow predefined variables in
1584 shared and firstprivate clauses, even when they are predetermined
1586 * cp-gimplify.c (cxx_omp_predetermined_sharing_1): Return
1587 OMP_CLAUSE_DEFAULT_SHARED for predefined variables.
1589 2019-09-27 Jason Merrill <jason@redhat.com>
1591 * constexpr.c (cxx_fold_indirect_ref): Use similar_type_p.
1592 (cxx_eval_indirect_ref): Likewise. Improve error location.
1594 * cp-tree.h (class iloc_sentinel): New.
1595 * decl.c (grokdeclarator, finish_enum_value_list): Use it.
1596 * mangle.c (mangle_decl_string): Use it.
1597 * pt.c (perform_typedefs_access_check): Use it.
1599 2019-09-27 Richard Sandiford <richard.sandiford@arm.com>
1601 * cp-tree.h (build_cxx_call): Take the original function decl
1602 as an optional final parameter.
1603 (cp_build_function_call_vec): Likewise.
1604 * call.c (build_cxx_call): Likewise. Pass all built-in calls to
1605 check_builtin_function_arguments.
1606 * typeck.c (build_function_call_vec): Take the original function
1607 decl as an optional final parameter and pass it to
1608 cp_build_function_call_vec.
1609 (cp_build_function_call_vec): Take the original function
1610 decl as an optional final parameter and pass it to build_cxx_call.
1612 2019-09-25 Marek Polacek <polacek@redhat.com>
1614 PR c++/91877 - ICE with converting member of packed struct.
1615 * call.c (convert_like_real): Use similar_type_p in an assert.
1617 2019-09-25 Paolo Carlini <paolo.carlini@oracle.com>
1619 * name-lookup.c (check_extern_c_conflict): Use DECL_SOURCE_LOCATION.
1620 (check_local_shadow): Use it in three additional places.
1622 2019-09-24 Jason Merrill <jason@redhat.com>
1624 * parser.c (cp_parser_postfix_expression): Do set location of
1625 dependent member call.
1627 2019-09-24 Marek Polacek <polacek@redhat.com>
1629 PR c++/91868 - improve -Wshadow location.
1630 * name-lookup.c (check_local_shadow): Use DECL_SOURCE_LOCATION
1631 instead of input_location.
1633 PR c++/91845 - ICE with invalid pointer-to-member.
1634 * expr.c (mark_use): Use error_operand_p.
1635 * typeck2.c (build_m_component_ref): Check error_operand_p after
1636 calling mark_[lr]value_use.
1638 2019-09-23 Paolo Carlini <paolo.carlini@oracle.com>
1640 * pt.c (check_explicit_specialization): Use cp_expr_loc_or_input_loc.
1641 (process_partial_specialization): Likewise.
1642 (convert_nontype_argument_function): Likewise.
1643 (invalid_tparm_referent_p): Likewise.
1644 (convert_template_argument): Likewise.
1645 (check_valid_ptrmem_cst_expr): Tidy.
1647 2019-09-23 Jason Merrill <jason@redhat.com>
1649 PR c++/91809 - bit-field and ellipsis.
1650 * call.c (convert_arg_to_ellipsis): Don't call decay_conversion for
1651 arithmetic arguments.
1653 2019-09-23 Marek Polacek <polacek@redhat.com>
1655 PR c++/91844 - Implement CWG 2352, Similar types and reference binding.
1656 * call.c (reference_related_p): Use similar_type_p instead of
1658 (reference_compatible_p): Update implementation to match CWG 2352.
1659 * cp-tree.h (similar_type_p): Declare.
1660 * typeck.c (similar_type_p): New.
1662 2019-09-22 Marek Polacek <polacek@redhat.com>
1664 PR c++/91819 - ICE with operator++ and enum.
1665 * call.c (build_new_op_1): Set arg2_type.
1667 2019-09-17 Jason Merrill <jason@redhat.com>
1669 * parser.c (cp_parser_statement): Handle [[likely]] on
1672 2019-09-19 Jason Merrill <jason@redhat.com>
1675 * call.c (build_new_op_1): Don't apply any standard conversions to
1676 the operands of a built-in operator. Don't suppress conversions in
1678 * typeck.c (cp_build_unary_op): Do integral promotions for enums.
1680 2019-09-16 Paolo Carlini <paolo.carlini@oracle.com>
1682 * decl.c (grokdeclarator): Use declspecs->locations and
1683 declarator->id_loc in a few error messages.
1684 * pt.c (finish_member_template_decl): Use DECL_SOURCE_LOCATION.
1685 (push_template_decl_real): Likewise.
1687 2019-09-15 Jason Merrill <jason@redhat.com>
1689 PR c++/30277 - int-width bit-field promotion.
1690 PR c++/33819 - long bit-field promotion.
1691 * typeck.c (cp_perform_integral_promotions): Handle large bit-fields
1692 properly. Handle 32-bit non-int bit-fields properly.
1693 (is_bitfield_expr_with_lowered_type): Don't look through NOP_EXPR.
1695 PR c++/82165 - enum bitfields and operator overloading.
1696 * call.c (build_new_op_1): Use unlowered_expr_type.
1698 * call.c (build_new_op_1): Don't apply any standard conversions to
1699 the operands of a built-in operator. Don't suppress conversions in
1701 * typeck.c (cp_build_unary_op): Do integral promotions for enums.
1703 2019-09-15 Marek Polacek <polacek@redhat.com>
1705 PR c++/91740 - ICE with constexpr call and ?: in ARRAY_REF.
1706 * pt.c (build_non_dependent_expr): Call build_non_dependent_expr for
1709 2019-09-15 Nathan Sidwell <nathan@acm.org>
1711 * cp-tree.h (DECL_CLONED_FUNCTION_P): Reimplement using
1712 IDENTIFIER_CDTOR_P, correct documentation.
1713 (DECL_CLONED_FUNCTION): Directly access field.
1714 (decl_cloned_function_p): Delete.
1715 * class.c (decl_cloned_function_p): Delete.
1716 * pt.c (instantiate_template_1): Check DECL_CHAIN is a decl.
1718 2019-09-11 Nathan Sidwell <nathan@acm.org>
1720 * c-objcp-common.c (cp-objcp-common.c): Alphababetize and
1721 correctly mark all C++ nodes.
1722 * decl.c (cp_tree_node_structure): Alphabetize.
1724 2019-09-10 Marek Polacek <polacek@redhat.com>
1726 PR c++/91673 - ICE with noexcept in alias-declaration.
1727 * parser.c (CP_PARSER_FLAGS_DELAY_NOEXCEPT): New parser flag.
1728 (cp_parser_lambda_declarator_opt): Pass CP_PARSER_FLAGS_NONE to
1729 cp_parser_exception_specification_opt.
1730 (cp_parser_direct_declarator): Adjust a call to
1731 cp_parser_exception_specification_opt.
1732 (cp_parser_member_declaration): Pass CP_PARSER_FLAGS_DELAY_NOEXCEPT
1733 to cp_parser_declarator if not processing a friend or typedef
1735 (cp_parser_late_noexcept_specifier): Adjust a call to
1736 cp_parser_noexcept_specification_opt.
1737 (cp_parser_noexcept_specification_opt): New parameter for parser flags,
1738 drop the FRIEND_P parameter. Use the new parameter.
1739 (cp_parser_exception_specification_opt): Likewise.
1740 (cp_parser_transaction): Adjust a call to
1741 cp_parser_noexcept_specification_opt.
1742 (cp_parser_transaction_expression): Likewise.
1744 2019-09-10 Marek Polacek <polacek@redhat.com>
1746 PR c++/91705 - constexpr evaluation rejects ++/-- on floats.
1747 * constexpr.c (cxx_eval_increment_expression): Call fold_simple on
1750 2019-09-10 Paolo Carlini <paolo.carlini@oracle.com>
1752 * decl.c (has_designator_problem): Use cp_expr_loc_or_input_loc
1754 (build_enumerator): Likewise.
1755 (cp_finish_decl): Use DECL_SOURCE_LOCATION.
1756 (grokdeclarator): Use id_loc in two error_at; change errror
1757 message about constinit together constexpr to use two ranges.
1759 2019-09-09 Marek Polacek <polacek@redhat.com>
1761 PR c++/84374 - diagnose invalid uses of decltype(auto).
1762 * decl.c (grokdeclarator): Diagnose wrong usage of decltype(auto) in
1763 a function declaration.
1765 2019-09-06 Nathan Sidwell <nathan@acm.org>
1768 * cp-tree.h (IDENTIFIER_REPO_CHOSEN, DECL_REPO_AVAILABLE_P): Delete.
1769 (struct lang_decl_base): Remove repo_available_p.
1770 * decl.c (duplicate_decls): Don't copy DECL_REPO_AVAILABLE_P.
1772 (Reserve TREE_LANG_FLAG_3 for modules.
1773 * cp-tree.h (DECL_CONSTRUCTION_VTABLE_P): Delete.
1774 (DECL_NON_TRIVIALLY_INITIALIZED_P): Move to TREE_LANG_FLAG_6.
1775 * class.c (build_ctor_vtbl_group): Don't set
1776 DECL_CONSTRUCTION_VTABLE_P.
1777 * decl2.c (determine_visibility_from_class): Don't check
1778 DECL_CONSTRUCTION_VTABLE_P anymore.
1780 2019-09-06 Martin Liska <mliska@suse.cz>
1783 * Make-lang.in: Remove repo.o.
1784 * config-lang.in: Likewise.
1785 * cp-tree.h (init_repo): Remove declarations
1786 of repo-related functions.
1787 (repo_emit_p): Likewise.
1788 (repo_export_class_p): Likewise.
1789 (finish_repo): Likewise.
1790 * decl2.c (import_export_class): Always
1792 (mark_needed): Remove -frepo from comment.
1793 (import_export_decl): Similarly here.
1794 (c_parse_final_cleanups): Remove call of finish_repo.
1795 * lex.c (cxx_init): Remove call to init_repo.
1796 * optimize.c (can_alias_cdtor): Remove dead condition.
1797 * pt.c (push_template_decl_real): Update comment.
1798 (instantiate_decl): Remove dead code used for -frepo.
1801 2019-09-05 Marek Polacek <polacek@redhat.com>
1803 PR c++/91644 - ICE with constinit in function template.
1804 * decl.c (start_decl): Call retrofit_lang_decl for constinit variables.
1805 * pt.c (tsubst_expr): Pass LOOKUP_CONSTINIT down to cp_finish_decl for
1806 constinit variables.
1808 2019-09-05 Nathan Sidwell <nathan@acm.org>
1810 * cp-tree.h (DECL_VTABLE_OR_VTT_P): Forward to DECL_VIRTUAL_P.
1812 2019-09-04 Marek Polacek <polacek@redhat.com>
1814 * call.c (build_over_call): Remove -fdeduce-init-list implementation.
1815 * pt.c (unify): Likewise.
1817 2019-09-01 Marek Polacek <polacek@redhat.com>
1819 PR c++/91129 - wrong error with binary op in template argument.
1820 * typeck.c (warn_for_null_address): Use fold_for_warn instead of
1821 fold_non_dependent_expr.
1822 (cp_build_binary_op): Likewise.
1824 2019-08-30 Jason Merrill <jason@redhat.com>
1826 Add source location to TRAIT_EXPR.
1827 * cp-tree.h (TRAIT_EXPR_LOCATION): New.
1828 (struct tree_trait_expr): Add locus field.
1829 * parser.c (cp_parser_trait_expr): Pass trait_loc down.
1830 * pt.c (tsubst_copy_and_build) [TRAIT_EXPR]: Likewise.
1831 * semantics.c (finish_trait_expr): Add location parm.
1832 * tree.c (cp_expr_location): Handle TRAIT_EXPR.
1834 2019-08-29 Paolo Carlini <paolo.carlini@oracle.com>
1836 * decl.c (check_var_type): Add location_t parameter and use it.
1837 (grokdeclarator): Adjust call.
1838 * pt.c (tsubst_decl): Likewise.
1839 * cp-tree.h: Adjust declaration.
1841 2019-08-28 Marek Polacek <polacek@redhat.com>
1843 Implement P1152R4: Deprecating some uses of volatile.
1845 * cp-gimplify.c (cp_fold): Set TREE_THIS_VOLATILE.
1846 * decl.c (grokdeclarator): Warn about a volatile-qualified structured
1847 binding and return type.
1848 (grokparms): Warn about a volatile-qualified function parameter.
1849 * expr.c (mark_use) <case MODIFY_EXPR>: Emit a -Wvolatile warning.
1850 * typeck.c (cp_build_unary_op): Emit a -Wvolatile warning for pre and
1851 post ++/-- on a volatile operand.
1852 (genericize_compound_lvalue): Use a better location. Don't lose
1854 (cp_build_modify_expr): Emit a -Wvolatile warning for a compound
1855 assignment whose LHS is volatile-qualified. Build the assignment with
1856 a more precise location.
1858 2019-08-28 Marek Polacek <polacek@redhat.com>
1860 PR c++/91360 - Implement C++20 P1143R2: constinit.
1861 * cp-tree.h (TINFO_VAR_DECLARED_CONSTINIT): Define.
1862 (LOOKUP_CONSTINIT): Define.
1863 (enum cp_decl_spec): Add ds_constinit.
1864 * decl.c (check_tag_decl): Give an error for constinit in type
1866 (check_initializer): Also check LOOKUP_CONSTINIT.
1867 (cp_finish_decl): Add checking for a constinit declaration. Set
1868 TINFO_VAR_DECLARED_CONSTINIT.
1869 (grokdeclarator): Add checking for a declaration with the constinit
1871 * lex.c (init_reswords): Handle D_CXX20.
1872 * parser.c (cp_lexer_get_preprocessor_token): Pass a better location
1873 to warning_at. Warn about C++20 keywords.
1874 (cp_keyword_starts_decl_specifier_p): Handle RID_CONSTINIT.
1875 (cp_parser_diagnose_invalid_type_name): Add an inform about constinit.
1876 (cp_parser_decomposition_declaration): Maybe pass LOOKUP_CONSTINIT to
1878 (cp_parser_decl_specifier_seq): Handle RID_CONSTINIT.
1879 (cp_parser_init_declarator): Maybe pass LOOKUP_CONSTINIT to
1881 (set_and_check_decl_spec_loc): Add "constinit".
1882 * pt.c (tsubst_decl): Set TINFO_VAR_DECLARED_CONSTINIT.
1883 (instantiate_decl): Maybe pass LOOKUP_CONSTINIT to cp_finish_decl.
1884 * typeck2.c (store_init_value): If a constinit variable wasn't
1885 initialized using a constant initializer, give an error.
1887 2019-08-28 Nathan Sidwell <nathan@acm.org>
1890 * name-lookup.c (cp_emit_debug_info): Check for builtins during
1893 2019-08-27 Marek Polacek <polacek@redhat.com>
1895 PR c++/81676 - bogus -Wunused warnings in constexpr if.
1896 * semantics.c (maybe_mark_exp_read_r): New function.
1897 (finish_if_stmt): Call it on THEN_CLAUSE and ELSE_CLAUSE.
1899 PR c++/91428 - warn about std::is_constant_evaluated in if constexpr.
1900 * cp-tree.h (decl_in_std_namespace_p): Declare.
1901 * semantics.c (is_std_constant_evaluated_p): New.
1902 (finish_if_stmt_cond): Warn about "std::is_constant_evaluated ()" in
1904 * typeck.c (decl_in_std_namespace_p): No longer static.
1906 2019-08-26 Jason Merrill <jason@redhat.com>
1908 * decl.c (duplicate_decls): Always merge DECL_DECLARED_CONSTEXPR_P.
1910 2019-08-26 Marek Polacek <polacek@redhat.com>
1912 PR c++/91545 - ICE in constexpr store evaluation.
1913 * constexpr.c (cxx_eval_store_expression): Check FIELD_DECL instead
1916 2019-08-24 Nathan Sidwell <nathan@acm.org>
1918 * class.c (check_for_overrides): Conversion operators need
1921 2019-08-24 Paolo Carlini <paolo.carlini@oracle.com>
1923 * semantics.c (finish_switch_cond): Improve error message location.
1925 2019-08-23 Jason Merrill <jason@redhat.com>
1927 * decl2.c (decl_dependent_p): New.
1928 (mark_used): Check it instead of just processing_template_decl.
1930 2019-08-23 Jason Merrill <jason@redhat.com>
1932 * parser.c (cp_parser_nested_name_specifier_opt): Avoid redundant
1935 2019-08-23 Marek Polacek <polacek@redhat.com>
1937 PR c++/91521 - wrong error with operator->.
1938 * decl.c (grokdeclarator): Return error_mark_node for an invalid
1939 trailing return type.
1941 PR c++/79817 - attribute deprecated on namespace.
1942 * cp-tree.h (cp_warn_deprecated_use_scopes): Declare.
1943 * decl.c (grokdeclarator): Call cp_warn_deprecated_use_scopes.
1944 (type_is_deprecated): Likewise.
1945 * decl2.c (cp_warn_deprecated_use_scopes): New function.
1946 * name-lookup.c (handle_namespace_attrs): Handle attribute deprecated.
1947 * parser.c (cp_parser_namespace_alias_definition): Call
1948 cp_warn_deprecated_use_scopes.
1949 (cp_parser_using_declaration): Likewise.
1950 (cp_parser_using_directive): Likewise.
1951 * semantics.c (finish_id_expression_1): Likewise.
1953 2019-08-23 Nathan Sidwell <nathan@acm.org>
1955 * class.c (check_for_override): Checking IDENTIFIER_VIRTUAL_P is
1956 sufficient, reorder DECL_OVERRIDE_P check.
1958 2019-08-23 Iain Sandoe <iain@sandoe.co.uk>
1961 * parser.c (cp_parser_initial_pragma): Call c_common_no_more_pch ()
1962 after determining that the first token is not
1963 PRAGMA_GCC_PCH_PREPROCESS.
1965 2019-08-22 Marek Polacek <polacek@redhat.com>
1967 PR c++/91304 - prefix attributes ignored in condition.
1968 * parser.c (cp_parser_condition): Handle prefix attributes.
1970 2019-08-21 Richard Sandiford <richard.sandiford@arm.com>
1973 * decl.c (duplicate_decls): Call copy_attributes_to_builtin inside
1974 the BUILT_IN_NORMAL block rather than afterward.
1976 2019-08-19 Marek Polacek <polacek@redhat.com>
1978 PR c++/91264 - detect modifying const objects in constexpr.
1979 * constexpr.c (modifying_const_object_error): New function.
1980 (cxx_eval_call_expression): Set TREE_READONLY on a CONSTRUCTOR of
1981 a const-qualified object after it's been fully constructed.
1982 (modifying_const_object_p): New function.
1983 (cxx_eval_store_expression): Detect modifying a const object
1984 during constant expression evaluation.
1985 (cxx_eval_increment_expression): Use a better location when building
1987 (cxx_eval_constant_expression) <case DECL_EXPR>: Mark a constant
1988 object's constructor TREE_READONLY.
1990 2019-08-15 Jason Merrill <jason@redhat.com>
1992 PR c++/90393 - ICE with thow in ?:
1994 PR c++/64372, DR 1560 - Gratuitous lvalue-to-rvalue conversion in ?:
1995 * tree.c (lvalue_kind): Handle throw in one arm.
1996 * typeck.c (rationalize_conditional_expr): Likewise.
1997 (cp_build_modify_expr): Likewise.
1999 2019-08-14 Jason Merrill <jason@redhat.com>
2001 Implement P0848R3, Conditionally Trivial Special Member Functions.
2002 * tree.c (special_memfn_p): New.
2003 * class.c (add_method): When overloading, hide ineligible special
2005 (check_methods): Set TYPE_HAS_COMPLEX_* here.
2006 * decl.c (grok_special_member_properties): Not here.
2007 * name-lookup.c (push_class_level_binding_1): Move overloaded
2008 functions case down, accept FUNCTION_DECL as target_decl.
2010 2019-08-14 Jonathan Wakely <jwakely@redhat.com>
2013 * name-lookup.c (get_std_name_hint): Fix min_dialect field for
2014 complex_literals and make_unique entries.
2016 2019-08-14 Jakub Jelinek <jakub@redhat.com>
2017 Marek Polacek <polacek@redhat.com>
2019 PR c++/91391 - bogus -Wcomma-subscript warning.
2020 * parser.c (cp_parser_postfix_open_square_expression): Don't warn about
2021 a deprecated comma here. Pass warn_comma_subscript down to
2022 cp_parser_expression.
2023 (cp_parser_expression): New bool parameter. Warn about uses of a comma
2024 operator within a subscripting expression.
2025 (cp_parser_skip_to_closing_square_bracket): Revert to pre-r274121 state.
2026 (cp_parser_skip_to_closing_square_bracket_1): Remove.
2028 2019-08-14 Jonathan Wakely <jwakely@redhat.com>
2030 * name-lookup.c (get_std_name_hint): Add more entries.
2032 2019-08-14 Paolo Carlini <paolo.carlini@oracle.com>
2034 * decl2.c (grok_array_decl): Use the location of the open square
2035 bracket in error message about invalid types.
2037 2019-08-14 Paolo Carlini <paolo.carlini@oracle.com>
2039 * decl.c (grokdeclarator): Check here for typedef a function
2040 definition or a member function definition.
2041 (start_function): Adjust.
2042 (grokmethod): Likewise.
2044 2019-08-13 Richard Sandiford <richard.sandiford@arm.com>
2047 * decl.c (duplicate_decls): Use copy_decl_built_in_function.
2048 * pt.c (declare_integer_pack): Use set_decl_built_in_function.
2050 2019-08-13 Marek Polacek <polacek@redhat.com>
2052 PR c++/90473 - wrong code with nullptr in default argument.
2053 * call.c (null_ptr_cst_p): Update quote from the standard.
2054 * decl.c (check_default_argument): Don't return nullptr when the arg
2057 2019-08-13 Marek Polacek <polacek@redhat.com>
2059 * cp-tree.h (DECL_MUTABLE_P): Use FIELD_DECL_CHECK.
2061 2019-08-10 Jakub Jelinek <jakub@redhat.com>
2063 * parser.c (cp_parser_omp_clause_name): Parse device_type.
2064 (cp_parser_omp_clause_device_type): New function.
2065 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_DEVICE_TYPE.
2066 (OMP_DECLARE_TARGET_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_DEVICE_TYPE.
2067 (cp_parser_omp_declare_target): Handle device_type clauses. Remove
2068 diagnostics for declare target with clauses nested in clause-less
2069 declare target declaration-definition-seq.
2070 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_DEVICE_TYPE.
2072 2019-08-09 Jakub Jelinek <jakub@redhat.com>
2074 * parser.c (check_no_duplicate_clause): Simplify using
2076 (cp_parser_omp_clause_if): Fix up printing of target {enter,exit} data
2077 directive name modifiers.
2080 * parser.c (cp_parser_omp_clause_dist_schedule): Comment out the
2081 check_no_duplicate_clause call, instead emit a warning for duplicate
2082 dist_schedule clauses.
2084 2019-08-08 Paolo Carlini <paolo.carlini@oracle.com>
2086 * decl.c (grokdeclarator): Use id_loc and EXPR_LOCATION in
2087 a few error messages.
2089 2019-08-08 Marek Polacek <polacek@redhat.com>
2091 PR c++/87519 - bogus warning with -Wsign-conversion.
2092 * typeck.c (cp_build_binary_op): Use same_type_p instead of comparing
2095 * constexpr.c (inline_asm_in_constexpr_error): New.
2096 (cxx_eval_constant_expression) <case ASM_EXPR>: Call it.
2097 (potential_constant_expression_1) <case ASM_EXPR>: Likewise.
2099 2019-08-08 Jakub Jelinek <jakub@redhat.com>
2101 * semantics.c (finish_omp_clauses): For C_ORT_OMP
2102 OMP_CLAUSE_USE_DEVICE_* clauses use oacc_reduction_head bitmap
2103 instead of generic_head to track duplicates.
2105 2019-08-07 Marek Polacek <polacek@redhat.com>
2107 PR c++/81429 - wrong parsing of constructor with C++11 attribute.
2108 * parser.c (cp_parser_constructor_declarator_p): Handle the scenario
2109 when a parameter declaration begins with [[attribute]].
2111 2019-08-07 Marek Polacek <polacek@redhat.com>
2113 PR c++/91346 - Implement P1668R1, allow unevaluated asm in constexpr.
2114 * constexpr.c (cxx_eval_constant_expression): Handle ASM_EXPR.
2115 (potential_constant_expression_1) <case ASM_EXPR>: Allow.
2116 * cp-tree.h (finish_asm_stmt): Adjust.
2117 * parser.c (cp_parser_asm_definition): Grab the locaion of "asm" and
2118 use it. Change an error to a pedwarn. Allow asm in C++2a, warn
2120 * pt.c (tsubst_expr): Pass a location down to finish_asm_stmt.
2121 * semantics.c (finish_asm_stmt): New location_t parameter. Use it.
2123 2019-08-07 Jakub Jelinek <jakub@redhat.com>
2125 * parser.c (cp_parser_omp_clause_name): Parse use_device_addr clause.
2126 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR.
2127 (OMP_TARGET_DATA_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR.
2128 (cp_parser_omp_target_data): Handle PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR
2129 like PRAGMA_OMP_CLAUSE_USE_DEVICE_PTR, adjust diagnostics about no
2130 map or use_device_* clauses.
2131 * semantics.c (finish_omp_clauses): For OMP_CLAUSE_USE_DEVICE_PTR
2132 in OpenMP, require pointer or reference to pointer type rather than
2133 pointer or array or reference to pointer or array type. Handle
2134 OMP_CLAUSE_USE_DEVICE_ADDR.
2135 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_USE_DEVICE_ADDR.
2137 2019-08-06 Jason Merrill <jason@redhat.com>
2139 PR c++/91378 - ICE with noexcept and auto return type.
2140 * pt.c (maybe_instantiate_noexcept): push_to_top_level.
2142 2019-08-06 Paolo Carlini <paolo.carlini@oracle.com>
2144 * decl.c (check_array_designated_initializer): Use
2145 cp_expr_loc_or_input_loc in one place.
2147 2019-08-06 Jakub Jelinek <jakub@redhat.com>
2149 * parser.c (cp_parser_omp_for_loop): For OMP_LOOP, ignore parallel
2150 clauses and predetermine iterator as lastprivate.
2151 * semantics.c (handle_omp_for_class_iterator): Use
2152 OMP_CLAUSE_LASTPRIVATE_LOOP_IV instead of
2153 OMP_CLAUSE_LASTPRIVATE_TASKLOOP_IV, set it for lastprivate also
2154 on OMP_LOOP construct. If a clause is missing for class iterator
2155 on OMP_LOOP, add firstprivate clause, and if there is private
2156 clause, turn it into firstprivate too.
2157 (finish_omp_for): Formatting fix. For OMP_LOOP, adjust
2158 OMP_CLAUSE_LASTPRIVATE_LOOP_IV clause CP_CLAUSE_INFO, so that it
2159 uses copy ctor instead of default ctor.
2160 * cp-gimplify.c (cp_gimplify_expr): Handle OMP_LOOP like
2162 (cp_fold_r): Likewise.
2163 (cp_genericize_r): Likewise.
2164 (cxx_omp_finish_clause): Also finish lastprivate clause with
2165 OMP_CLAUSE_LASTPRIVATE_LOOP_IV flag.
2166 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_BIND.
2167 (tsubst_omp_for_iterator): For OMP_LOOP, ignore parallel
2168 clauses and predetermine iterator as lastprivate.
2169 * constexpr.c (potential_constant_expression_1): Handle OMP_LOOP
2170 like OMP_DISTRIBUTE etc.
2172 2019-08-05 Marek Polacek <polacek@redhat.com>
2174 DR 2413 - typename in conversion-function-ids.
2175 * parser.c (cp_parser_conversion_type_id): Call
2176 cp_parser_type_specifier_seq with CP_PARSER_FLAGS_TYPENAME_OPTIONAL
2177 instead of CP_PARSER_FLAGS_NONE.
2179 2019-08-05 Paolo Carlini <paolo.carlini@oracle.com>
2181 * cp-tree.h (cp_expr_loc_or_input_loc): New.
2182 (cxx_incomplete_type_diagnostic): Use it.
2183 * call.c (build_converted_constant_expr_internal, convert_like_real,
2184 convert_arg_to_ellipsis, convert_for_arg_passing, build_over_call,
2185 build_cxx_call, perform_implicit_conversion_flags,
2186 initialize_reference): Likewise.
2187 * constexpr.c (cxx_eval_internal_function, cxx_eval_call_expression,
2188 eval_and_check_array_index, cxx_eval_store_expression,
2189 cxx_eval_statement_list, cxx_eval_loop_expr,
2190 cxx_eval_constant_expression, potential_constant_expression_1):
2192 * constraint.cc (check_for_logical_overloads,
2193 satisfy_predicate_constraint): Likewise.
2194 * cp-gimplify.c (cp_gimplify_expr): Likewise.
2195 * cvt.c (cp_convert_to_pointer, convert_to_reference,
2196 cp_convert_and_check, ocp_convert, maybe_warn_nodiscard): Likewise.
2197 * decl.c (pop_switch): Likewise.
2198 * decl2.c (delete_sanity): Likewise.
2199 * error.c (location_of): Likewise.
2200 * init.c (maybe_warn_list_ctor, build_aggr_init,
2201 warn_placement_new_too_small, build_new_1, build_vec_init): Likewise.
2202 * lex.c (unqualified_name_lookup_error): Likewise.
2203 * parser.c (cp_parser_initializer_list, cp_parser_omp_for_cond):
2205 * pt.c (check_for_bare_parameter_packs, check_valid_ptrmem_cst_expr,
2206 unify_arg_conversion, convert_nontype_argument,
2207 tsubst_copy_and_build, resolve_typename_type): Likewise.
2208 * semantics.c (maybe_convert_cond, finish_call_expr,
2209 cp_build_vec_convert): Likewise.
2210 * typeck.c (decay_conversion, rationalize_conditional_expr,
2211 cp_build_unary_op, build_x_compound_expr_from_list,
2212 maybe_warn_about_returning_address_of_local,
2213 maybe_warn_pessimizing_move): Likewise.
2214 * typeck2.c (check_narrowing, digest_init_r,
2215 process_init_constructor_array): Likewise.
2217 2019-08-05 Tom Honermann <tom@honermann.net>
2219 * parser.c (cp_parser_template_declaration_after_parameters): Enable
2220 class template argument deduction for non-type template parameters
2221 in literal operator templates.
2223 2019-08-05 Marek Polacek <polacek@redhat.com>
2225 PR c++/91338 - Implement P1161R3: Deprecate a[b,c].
2226 * parser.c (cp_parser_postfix_open_square_expression): Warn about uses
2227 of a comma operator within a subscripting expression.
2228 (cp_parser_skip_to_closing_square_bracket_1): New function, made out
2230 (cp_parser_skip_to_closing_square_bracket): ...this.
2232 2019-08-05 Jason Merrill <jason@redhat.com>
2234 * semantics.c (force_paren_expr): Preserve location.
2236 2019-08-02 Marek Polacek <polacek@redhat.com>
2238 PR c++/91230 - wrong error with __PRETTY_FUNCTION__ and generic lambda.
2239 * pt.c (value_dependent_expression_p): Consider __PRETTY_FUNCTION__
2240 inside a template function value-dependent.
2242 2019-08-02 Paolo Carlini <paolo.carlini@oracle.com>
2244 * tree.c (handle_nodiscard_attribute): Do not warn about nodiscard
2245 applied to a constructor.
2247 2019-08-02 Martin Liska <mliska@suse.cz>
2249 * decl.c (grok_op_properties):
2250 Mark DECL_SET_IS_OPERATOR_DELETE for user-provided delete operators.
2252 2019-08-01 Martin Sebor <msebor@redhat.com>
2255 * decl.c (reshape_init_array_1): Avoid truncating initializer
2256 lists containing string literals.
2258 2019-08-01 Marek Polacek <polacek@redhat.com>
2260 PR c++/90805 - detect narrowing in case values.
2261 * decl.c (case_conversion): Detect narrowing in case values.
2263 2019-07-31 Paolo Carlini <paolo.carlini@oracle.com>
2265 * decl2.c (delete_sanity): Improve diagnostic locations, use
2266 cp_expr_loc_or_loc in four places.
2268 2019-07-31 Jason Merrill <jason@redhat.com>
2270 PR c++/90538 - multiple expansions of capture packs
2271 * cp-tree.h (DECLTYPE_FOR_INIT_CAPTURE): Remove.
2272 * lambda.c (add_capture): Copy parameter packs from init.
2273 (lambda_capture_field_type): Always use auto for init-capture.
2274 * pt.c (uses_parameter_packs): Return tree.
2275 (tsubst) [DECLTYPE_TYPE]: Remove init-capture handling.
2276 (gen_elem_of_pack_expansion_instantiation): Don't push
2277 local_specialization_stack.
2278 (prepend_one_capture): New.
2279 (tsubst_lambda_expr): Use it. Don't touch local_specializations.
2280 (do_auto_deduction): Avoid redundant error.
2282 Fix copy_node of TEMPLATE_INFO.
2283 * cp-tree.h (struct tree_template_info): Use tree_base instead of
2284 tree_common. Add tmpl and args fields.
2285 (TI_TEMPLATE, TI_ARGS): Adjust.
2287 2019-07-30 Martin Liska <mliska@suse.cz>
2289 PR tree-optimization/91270
2290 * tree-ssa-dce.c (propagate_necessity): Mark 2nd argument
2291 of delete operator as needed.
2293 2019-07-25 Martin Liska <mliska@suse.cz>
2294 Dominik Infuhr <dominik.infuehr@theobroma-systems.com>
2297 * decl.c (cxx_init_decl_processing): Mark delete operators
2298 with DECL_SET_IS_OPERATOR_DELETE.
2300 2019-07-25 Martin Liska <mliska@suse.cz>
2302 * decl.c (duplicate_decls): Use new macros
2303 (e.g. DECL_SET_LAMBDA_FUNCTION and DECL_LAMBDA_FUNCTION_P).
2304 (cxx_init_decl_processing): Likewise.
2305 (grok_op_properties): Likewise.
2306 * parser.c (cp_parser_lambda_declarator_opt): Likewise.
2308 2019-07-24 Martin Sebor <msebor@redhat.com>
2311 * decl.c (finish_function): Use lang_mask.
2313 2019-07-20 Jason Merrill <jason@redhat.com>
2315 * cp-tree.h (ovl_iterator::using_p): A USING_DECL by itself was also
2316 introduced by a using-declaration.
2318 2019-07-20 Jason Merrill <jason@redhat.com>
2320 Reduce memory consumption for push/pop_access_scope.
2321 * name-lookup.c (leave_scope): Do add class levels other than
2322 previous_class_level to free_binding_level.
2323 (invalidate_class_lookup_cache): Move from class.c, add to
2325 * pt.c (saved_access_scope): Change from list to vec.
2327 2019-07-20 Jakub Jelinek <jakub@redhat.com>
2329 * cp-tree.h (OMP_FOR_GIMPLIFYING_P): Use OMP_LOOPING_CHECK
2330 instead of OMP_LOOP_CHECK.
2331 * parser.c (cp_parser_omp_clause_name): Handle bind clause.
2332 (cp_parser_omp_clause_bind): New function.
2333 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_BIND.
2334 (OMP_LOOP_CLAUSE_MASK): Define.
2335 (cp_parser_omp_loop): New function.
2336 (cp_parser_omp_parallel, cp_parser_omp_teams): Handle parsing of
2337 loop combined with parallel or teams.
2338 (cp_parser_omp_construct): Handle PRAGMA_OMP_LOOP.
2339 (cp_parser_pragma): Likewise.
2340 * pt.c (tsubst_expr): Handle OMP_LOOP.
2341 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_BIND.
2343 2019-07-19 Jason Merrill <jason@redhat.com>
2345 PR c++/90101 - dependent class non-type parameter.
2346 * pt.c (invalid_nontype_parm_type_p): Check for dependent class type.
2348 2019-07-18 Jason Merrill <jason@redhat.com>
2350 PR c++/90098 - partial specialization and class non-type parms.
2353 * call.c (build_converted_constant_expr_internal): Don't copy.
2354 * pt.c (process_partial_specialization): Allow VIEW_CONVERT_EXPR
2355 around class non-type parameter.
2356 (unify) [TEMPLATE_PARM_INDEX]: Ignore cv-quals.
2358 2019-07-16 Jason Merrill <jason@redhat.com>
2360 * parser.c (make_location): Add overload taking cp_lexer* as last
2363 * parser.c (cp_parser_simple_type_specifier): Separate tentative
2364 parses for optional type-spec and CTAD.
2366 * parser.c (cp_parser_nested_name_specifier_opt): If the token is
2367 already CPP_NESTED_NAME_SPECIFIER, leave it alone.
2369 2019-07-12 Jakub Jelinek <jakub@redhat.com>
2371 * parser.c (cp_parser_omp_clause_name): Handle order clause.
2372 (cp_parser_omp_clause_order): New function.
2373 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_ORDER.
2374 (OMP_SIMD_CLAUSE_MASK, OMP_FOR_CLAUSE_MASK): Add
2375 PRAGMA_OMP_CLAUSE_ORDER.
2376 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_ORDER.
2377 * pt.c (tsubst_omp_clauses): Likewise.
2379 2019-07-10 Paolo Carlini <paolo.carlini@oracle.com>
2381 * decl.c (get_type_quals,
2382 smallest_type_location (const cp_decl_specifier_seq*)): New.
2383 (check_tag_decl): Use smallest_type_location in error_at about
2384 multiple types in one declaration.
2385 (grokdeclarator): Use locations[ds_complex] in error_at about
2386 complex invalid; use locations[ds_storage_class] in error_at
2387 about static cdtor; use id_loc in error_at about flexible
2388 array member in union; use get_type_quals.
2390 2019-07-09 Martin Sebor <msebor@redhat.com>
2393 * cp-tree.h: Change class-key of PODs to struct and others to class.
2395 * semantics.c (finalize_nrv_r): Same.
2397 2019-07-09 Martin Sebor <msebor@redhat.com>
2400 * constexpr.c (cxx_eval_call_expression): Change class-key from class
2401 to struct and vice versa to match convention and avoid -Wclass-is-pod
2402 and -Wstruct-no-pod.
2403 * constraint.cc (get_concept_definition): Same.
2405 * cxx-pretty-print.h: Same.
2407 * logic.cc (term_list::replace): Same.
2408 * name-lookup.c (find_local_binding): Same.
2409 * pt.c (tsubst_binary_right_fold): Same.
2410 * search.c (field_accessor_p): Same.
2411 * semantics.c (expand_or_defer_fn): Same.
2413 2019-07-08 Jakub Jelinek <jakub@redhat.com>
2416 * decl2.c (cp_omp_mappable_type_1): Don't emit any note for
2417 error_mark_node type.
2419 2019-07-05 Jakub Jelinek <jakub@redhat.com>
2423 * call.c (build_new_method_call_1): Remove set but not used variable
2426 2019-07-05 Paolo Carlini <paolo.carlini@oracle.com>
2428 PR c++/67184 (again)
2430 * call.c (build_over_call): Devirtualize user-defined operators
2431 coming from a base too.
2432 (build_new_method_call_1): Do not devirtualize here.
2434 2019-07-04 Marek Polacek <polacek@redhat.com>
2437 PR c++/83374 - __is_standard_layout wrong for a class with repeated
2439 * class.c (check_bases): Set CLASSTYPE_NON_STD_LAYOUT for a class if
2440 CLASSTYPE_REPEATED_BASE_P is true.
2442 2019-07-04 Andrew Stubbs <ams@codesourcery.com>
2444 * cp-tree.h (cp_omp_emit_unmappable_type_notes): New prototype.
2445 * decl.c (cp_finish_decl): Call cp_omp_emit_unmappable_type_notes.
2446 * decl2.c (cp_omp_mappable_type): Move contents to ...
2447 (cp_omp_mappable_type_1): ... here and add note output.
2448 (cp_omp_emit_unmappable_type_notes): New function.
2449 * semantics.c (finish_omp_clauses): Call
2450 cp_omp_emit_unmappable_type_notes in four places.
2452 2019-07-03 Martin Liska <mliska@suse.cz>
2454 * call.c (build_new_op_1): Remove dead assignemts.
2455 * typeck.c (cp_build_binary_op): Likewise.
2457 2019-06-27 Jason Merrill <jason@redhat.com>
2459 PR c++/55442 - memory-hog with highly recursive constexpr.
2460 * constexpr.c (push_cx_call_context): Return depth.
2461 (cxx_eval_call_expression): Don't cache past constexpr_cache_depth.
2463 2019-06-27 Jan Hubicka <jh@suse.cz>
2465 * class.c (layout_class_type): Set TYPE_CXX_ODR_P for as-base
2468 2019-06-27 Martin Liska <mliska@suse.cz>
2470 * class.c (adjust_clone_args): Remove obviously
2472 (dump_class_hierarchy_r): Likewise.
2473 * decl.c (check_initializer): Likewise.
2474 * parser.c (cp_parser_lambda_expression): Likewise.
2475 * pt.c (unify_bound_ttp_args): Likewise.
2476 (convert_template_argument): Likewise.
2477 * rtti.c (build_headof): Likewise.
2478 * typeck.c (convert_for_initialization): Likewise.
2480 2019-06-25 Jason Merrill <jason@redhat.com>
2482 PR c++/70462 - unnecessary base ctor variant with final.
2483 * optimize.c (populate_clone_array): Skip base variant if
2485 (maybe_clone_body): We don't need an alias if we are only defining
2488 * class.c (resolves_to_fixed_type_p): Check CLASSTYPE_FINAL.
2490 2019-06-25 Jakub Jelinek <jakub@redhat.com>
2493 * constexpr.c (cxx_eval_array_reference): Don't look through VCE from
2494 vector type if lval.
2496 2019-06-25 Jozef Lawrynowicz <jozef.l@mittosystems.com>
2498 * lex.c (init_reswords): Create keyword for "__intN__" type.
2499 * cp-tree.h (cp_decl_specifier_seq): New bitfield "int_n_alt".
2500 * decl.c (grokdeclarator): Don't pedwarn about "__intN" ISO
2501 C incompatibility if alternate "__intN__" form is used.
2502 * parser.c (cp_parser_simple_type_specifier): Set
2503 decl_specs->int_n_alt if "__intN__" form is used.
2505 2019-06-24 Jan Hubicka <jh@suse.cz>
2507 * lex.c (cxx_make_type): Set TYPE_CXX_ODR_P.
2509 2019-06-24 Jason Merrill <jason@redhat.com>
2511 * class.c (layout_class_type): Don't use a separate
2512 CLASSTYPE_AS_BASE if it's the same size.
2514 2019-06-23 Marek Polacek <polacek@redhat.com>
2516 * call.c (convert_default_arg): Use DEFERRED_PARSE instead of
2518 * cp-objcp-common.c (cp_tree_size): Likewise. Use tree_deferred_parse
2519 instead of tree_default_arg.
2520 * cp-tree.def: Rename DEFAULT_ARG to DEFERRED_PARSE.
2521 * cp-tree.h: Rename DEFARG_TOKENS to DEFPARSE_TOKENS. Rename
2522 DEFARG_INSTANTIATIONS to DEFPARSE_INSTANTIATIONS. Rename
2523 tree_default_arg to tree_deferred_parse.
2524 (UNPARSED_NOEXCEPT_SPEC_P): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2525 (cp_tree_node_structure_enum): Rename TS_CP_DEFAULT_ARG to
2526 TS_CP_DEFERRED_PARSE.
2527 (lang_tree_node): Rename tree_default_arg to tree_deferred_parse.
2528 Rename default_arg to deferred_parse. Use TS_CP_DEFERRED_PARSE instead
2529 of TS_CP_DEFAULT_ARG.
2530 (defarg_location): Remove declaration.
2531 (defparse_location): Add declaration.
2532 * decl.c (grokfndecl): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2533 Call defparse_location instead of defarg_location.
2534 (check_default_argument): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2535 (cp_tree_node_structure): Likewise. Use TS_CP_DEFERRED_PARSE instead
2536 of TS_CP_DEFAULT_ARG.
2537 * decl2.c (grokfield): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2538 * error.c (dump_expr): Likewise.
2539 (location_of): Likewise.
2540 * init.c (get_nsdmi): Likewise.
2541 * parser.c (cp_parser_save_noexcept): Likewise. Use DEFPARSE_TOKENS
2542 instead of DEFARG_TOKENS.
2543 (cp_parser_late_noexcept_specifier): Likewise.
2544 (cp_parser_late_parse_one_default_arg): Use DEFPARSE_TOKENS instead
2546 (cp_parser_late_parsing_default_args): Use DEFERRED_PARSE instead of
2547 DEFAULT_ARG. Use DEFPARSE_INSTANTIATIONS instead of
2548 DEFARG_INSTANTIATIONS.
2549 (cp_parser_cache_defarg): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2550 Use DEFPARSE_TOKENS instead of DEFARG_TOKENS. Use
2551 DEFPARSE_INSTANTIATIONS instead of DEFARG_INSTANTIATIONS.
2552 (defparse_location): Renamed from defarg_location.
2553 * pt.c (tsubst_default_argument): Use DEFERRED_PARSE instead of
2555 (tsubst_arg_types): Likewise.
2556 (dependent_type_p_r): Likewise.
2557 * tree.c (cp_tree_equal): Likewise.
2558 (cp_walk_subtrees): Likewise.
2559 * typeck.c (convert_arguments): Likewise.
2561 2019-06-22 Marek Polacek <polacek@redhat.com>
2563 PR c++/86476 - noexcept-specifier is a complete-class context.
2565 * cp-tree.def (DEFAULT_ARG): Update commentary.
2566 * cp-tree.h (UNPARSED_NOEXCEPT_SPEC_P): New macro.
2567 (tree_default_arg): Use tree_base instead of tree_common.
2568 (do_push_parm_decls, maybe_check_overriding_exception_spec): Declare.
2569 * decl.c (do_push_parm_decls): New function, broken out of...
2570 (store_parm_decls): ...here. Call it.
2571 * except.c (nothrow_spec_p): Accept DEFAULT_ARG in the assert.
2572 * parser.c (cp_parser_noexcept_specification_opt,
2573 cp_parser_late_noexcept_specifier, noexcept_override_late_checks):
2575 (unparsed_noexcepts): New macro.
2576 (push_unparsed_function_queues): Update initializer.
2577 (cp_parser_direct_declarator): Pass FRIEND_P to
2578 cp_parser_exception_specification_opt.
2579 (inject_parm_decls): New.
2580 (pop_injected_parms): New.
2581 (cp_parser_class_specifier_1): Implement delayed parsing of
2582 noexcept-specifiers.
2583 (cp_parser_save_noexcept): New.
2584 (cp_parser_late_noexcept_specifier): New.
2585 (noexcept_override_late_checks): New.
2586 (cp_parser_noexcept_specification_opt): Add FRIEND_P parameter. Call
2587 cp_parser_save_noexcept instead of the normal processing if needed.
2588 (cp_parser_exception_specification_opt): Add FRIEND_P parameter and
2589 pass it to cp_parser_noexcept_specification_opt.
2590 (cp_parser_save_member_function_body): Fix comment.
2591 (cp_parser_save_default_args): Maybe save the noexcept-specifier to
2593 (cp_parser_transaction): Update call to
2594 cp_parser_noexcept_specification_opt.
2595 (cp_parser_transaction_expression): Likewise.
2596 * parser.h (cp_unparsed_functions_entry): Add new field to carry
2597 a noexcept-specifier.
2598 * pt.c (dependent_type_p_r): Handle unparsed noexcept expression.
2599 * search.c (maybe_check_overriding_exception_spec): New function, broken
2601 (check_final_overrider): ...here. Call
2602 maybe_check_overriding_exception_spec.
2603 * tree.c (canonical_eh_spec): Handle UNPARSED_NOEXCEPT_SPEC_P.
2604 (cp_tree_equal): Handle DEFAULT_ARG.
2606 PR c++/90881 - bogus -Wunused-value in unevaluated context.
2607 * cvt.c (convert_to_void): Don't emit unused warnings in
2608 an unevaluated context.
2610 2019-06-22 Paolo Carlini <paolo.carlini@oracle.com>
2612 * decl.c (grokdeclarator): Use id_loc, typespec_loc, and
2613 locations[ds_storage_class] in a few additional places.
2615 2019-06-21 Paolo Carlini <paolo.carlini@oracle.com>
2619 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com>
2623 * call.c (build_over_call): Devirtualize when the final overrider
2624 comes from the base.
2626 2019-06-21 Marek Polacek <polacek@redhat.com>
2628 PR c++/61490 - qualified-id in friend function definition.
2629 * decl.c (grokdeclarator): Diagnose qualified-id in friend function
2630 definition. Improve location for diagnostics of friend functions.
2632 PR c++/60223 - ICE with T{} in non-deduced context.
2633 * pt.c (unify): Allow COMPOUND_LITERAL_P in a non-deduced context.
2635 PR c++/64235 - missing syntax error with invalid alignas.
2636 * parser.c (cp_parser_std_attribute_spec): Commit to tentative parse
2637 if there's a missing close paren.
2639 PR c++/90490 - fix decltype issues in noexcept-specifier.
2640 * except.c (build_noexcept_spec): Call
2641 instantiate_non_dependent_expr_sfinae before
2642 build_converted_constant_expr instead of calling
2643 instantiate_non_dependent_expr after it. Add
2644 processing_template_decl_sentinel.
2646 2019-06-21 Jakub Jelinek <jakub@redhat.com>
2649 * semantics.c (finish_omp_clauses): Don't reject references to
2650 incomplete types if processing_template_decl.
2652 2019-06-19 Marek Polacek <polacek@redhat.com>
2654 PR c++/60364 - noreturn after first decl not diagnosed.
2655 * decl.c (duplicate_decls): Give an error when a function is
2656 declared [[noreturn]] after its first declaration.
2657 * parser.c (cp_parser_std_attribute): Don't treat C++11 noreturn
2658 attribute as equivalent to GNU's.
2659 * tree.c (std_attribute_table): Add noreturn.
2661 2019-06-19 Jakub Jelinek <jakub@redhat.com>
2663 * cp-gimplify.c (cp_genericize_r): Handle OMP_CLAUSE_{IN,EX}CLUSIVE
2664 like OMP_CLAUSE_SHARED.
2666 2019-06-18 Jason Merrill <jason@redhat.com>
2668 * constexpr.c (cxx_eval_store_expression): Delay target evaluation.
2670 2019-06-18 Jason Merrill <jason@redhat.com>
2672 * constexpr.c (eval_and_check_array_index): Split out from...
2673 (cxx_eval_array_reference): ...here.
2674 (cxx_eval_store_expression): Use it here, too.
2675 (diag_array_subscript): Take location. Strip location wrapper.
2677 2019-06-18 Jason Merrill <jason@redhat.com>
2679 * constexpr.c (cxx_eval_constant_expression): Handle conversion from
2680 and then to the same type.
2682 2019-06-18 Jason Merrill <jason@redhat.com>
2684 * constexpr.c (unshare_constructor): Add MEM_STAT_DECL.
2686 2019-06-17 Jakub Jelinek <jakub@redhat.com>
2688 * semantics.c (finish_omp_clauses): For OMP_CLAUSE_REDUCTION_INSCAN
2689 set need_copy_assignment.
2691 2019-06-17 Marek Polacek <polacek@redhat.com>
2693 PR c++/83820 - excessive attribute arguments not detected.
2694 * parser.c (cp_parser_std_attribute): Detect excessive arguments.
2696 2019-06-17 Nathan Sidwell <nathan@acm.org>
2699 * name-lookup.c (lookup_type_scope_1): Calll qualify_lookup before
2702 2019-06-14 Marek Polacek <polacek@redhat.com>
2704 PR c++/90884 - stray note with -Wctor-dtor-privacy.
2705 * class.c (maybe_warn_about_overly_private_class): Guard the call to
2708 2019-06-12 Jason Merrill <jason@redhat.com>
2710 PR c++/85552 - wrong instantiation of dtor for DMI.
2711 * typeck2.c (digest_nsdmi_init): Set tf_no_cleanup for direct-init.
2713 2019-06-13 Paolo Carlini <paolo.carlini@oracle.com>
2715 * decl.c (grokdeclarator): Use id_loc in five additional places
2716 in the last part of the function.
2718 2019-06-13 Paolo Carlini <paolo.carlini@oracle.com>
2720 * decl.c (grokdeclarator): Move further up the declaration of
2721 id_loc, use it immediately, update its value after the loop
2722 over declarator, use it again in the final part of function;
2723 improve locations of error messages about multiple data types
2724 and conflicting specifiers.
2726 2019-06-13 Richard Biener <rguenther@suse.de>
2729 * typeck2.c (split_nonconstant_init_1): Properly count
2730 num_split_elts, optimize single constructor elt removal.
2732 2019-06-12 Marek Polacek <polacek@redhat.com>
2734 PR c++/66999 - 'this' captured by reference.
2735 * parser.c (cp_parser_lambda_introducer): Reject `&this'. Use
2736 cp_lexer_nth_token_is instead of cp_lexer_peek_nth_token.
2738 PR c++/90825 - endless recursion when evaluating sizeof.
2739 PR c++/90832 - endless recursion when evaluating sizeof.
2740 * constexpr.c (cxx_eval_constant_expression): Don't recurse on the
2741 result of fold_sizeof_expr if is returns a SIZEOF_EXPR.
2742 * typeck.c (cxx_sizeof_expr): Only return a SIZEOF_EXPR if the operand
2743 is instantiation-dependent.
2745 PR c++/90736 - bogus error with alignof.
2746 * constexpr.c (adjust_temp_type): Use cv_unqualified type.
2748 2019-06-11 Matthew Beliveau <mbelivea@redhat.com>
2750 PR c++/90449 - add -Winaccessible-base option.
2751 * class.c (warn_about_ambiguous_bases): Changed name to:
2752 maybe_warn_about_inaccessible_bases.
2753 (maybe_warn_about_inaccessible_bases): Implemented new
2754 Winaccessible-base warning option for both direct and virtual
2756 (layout_class_type): Call to warn_about_ambiguous_bases changed to fit
2759 2019-06-11 Richard Biener <rguenther@suse.de>
2762 * typeck2.c (split_nonconstant_init_1): Avoid ordered remove
2763 from CONSTRUCTOR by marking to remove elements and doing all
2764 of them in a O(n) scan.
2766 2019-06-11 Jakub Jelinek <jakub@redhat.com>
2769 * init.c (constant_value_1): Handle VECTOR_CST DECL_INITIAL for
2770 !DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P decls like CONSTRUCTOR.
2772 2019-06-11 Martin Liska <mliska@suse.cz>
2775 * pt.c (init_template_processing): Disable hash table
2776 sanitization for decl_specializations and type_specializations.
2778 2019-06-10 Jason Merrill <jason@redhat.com>
2780 * constexpr.c (free_constructor): New.
2781 (cxx_eval_call_expression): Free parameter value CONSTRUCTORs.
2783 * constexpr.c (unshare_constructor): Only unshare if T is itself a
2785 (cxx_eval_call_expression): Don't call it on the result here.
2787 Reduce constexpr_call memory consumption.
2788 * constexpr.c (cxx_bind_parameters_in_call): Use TREE_VEC rather
2790 (constexpr_call_hasher::equal, cxx_bind_parameters_in_call)
2791 (cxx_eval_call_expression): Adjust.
2793 2019-06-10 Jakub Jelinek <jakub@redhat.com>
2795 * parser.c (cp_parser_omp_clause_reduction): Don't sorry_at on inscan
2797 (cp_parser_omp_scan_loop_body): New function.
2798 (cp_parser_omp_for_loop): Call cp_parser_omp_scan_loop_body if there
2799 are inscan reduction clauses.
2800 (cp_parser_pragma): Reject PRAGMA_OMP_SCAN.
2801 * semantics.c (finish_omp_clauses): Reject mixing inscan with
2802 non-inscan reductions on the same construct, or inscan reductions with
2803 ordered or schedule clauses, or inscan array reductions.
2804 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_{IN,EX}CLUSIVE.
2805 (tsubst_expr): Handle OMP_SCAN.
2807 2019-06-07 Jason Merrill <jason@redhat.com>
2809 * constexpr.c (cxx_eval_constant_expression): Call
2810 STRIP_ANY_LOCATION_WRAPPER early.
2811 [CONVERT_EXPR]: Don't build anything for conversion to void.
2812 [ADDR_EXPR]: ggc_free unused ADDR_EXPR.
2814 2019-06-05 Martin Sebor <msebor@redhat.com>
2817 * typeck.c (maybe_warn_about_returning_address_of_local): Only
2818 consider functions returning pointers as candidates for
2819 -Wreturn-local-addr.
2821 2019-06-05 Paolo Carlini <paolo.carlini@oracle.com>
2823 * decl.c (smallest_type_location): New.
2824 (check_special_function_return_type): Use it.
2825 (grokdeclarator): Lkewise.
2827 2019-06-05 Paolo Carlini <paolo.carlini@oracle.com>
2829 * decl.c (grokdeclarator): Use locations[ds_friend]
2832 2019-06-05 Martin Sebor <msebor@redhat.com>
2834 * call.c (build_conditional_expr_1): Adjust quoting and hyphenation.
2835 (convert_like_real): Same.
2836 (convert_arg_to_ellipsis): Same.
2837 * constexpr.c (diag_array_subscript): Same.
2838 * constraint.cc (diagnose_trait_expression): Same.
2839 * cvt.c (ocp_convert): Same.
2840 * decl.c (start_decl): Same.
2841 (check_for_uninitialized_const_var): Same.
2843 (check_special_function_return_type): Same.
2844 (finish_enum_value_list): Same.
2845 (start_preparsed_function): Same.
2846 * parser.c (cp_parser_decl_specifier_seq): Same.
2847 * typeck.c (cp_build_binary_op): Same.
2848 (build_static_cast_1): Same.
2850 2019-06-04 Nina Dinka Ranns <dinka.ranns@gmail.com>
2852 PR c++/63149 - Wrong auto deduction from braced-init-list.
2853 * pt.c (listify_autos): use non cv qualified auto_node in
2854 std::initializer_list<auto>.
2856 2019-06-04 Paolo Carlini <paolo.carlini@oracle.com>
2858 * decl.c (grokdeclarator): Use declarator->id_loc in two
2861 2019-06-04 Nathan Sidwell <nathan@acm.org>
2863 * name-lookup.c (lookup_type_scope_1): Reimplement, handle local
2864 and namespace scopes separately.
2866 2019-06-04 Harald van Dijk <harald@gigawatt.nl>
2868 PR c++/60531 - Wrong error about unresolved overloaded function
2869 * typeck.c (cp_build_binary_op): See if overload can be resolved.
2870 (cp_build_unary_op): Ditto.
2872 2019-06-04 Jason Merrill <jason@redhat.com>
2874 Reduce accumulated garbage in constexpr evaluation.
2875 * constexpr.c (cxx_eval_call_expression): ggc_free any bindings we
2877 (cxx_eval_increment_expression): ggc_free the MODIFY_EXPR after
2880 2019-06-04 Jakub Jelinek <jakub@redhat.com>
2882 * cp-tree.h (CP_OMP_CLAUSE_INFO): Allow for any clauses up to _condvar_
2883 instead of only up to linear.
2885 2019-06-03 Paolo Carlini <paolo.carlini@oracle.com>
2887 * parser.c (cp_parser_unqualified_id): Use build_min_nt_loc in
2890 2019-06-01 Ville Voutilainen <ville.voutilainen@gmail.com>
2893 * class.c (fixup_type_variants): Handle CLASSTYPE_FINAL.
2895 2019-05-31 Nathan Sidwell <nathan@acm.org>
2897 * cp-tree.h (IDENTIFIER_LAMBDA_P): New.
2899 (LAMBDA_TYPE_P, TYPE_UNNAMED_P): Likewise.
2900 (LAMBDANAME_PREFIX, LAMBDANAME_FORMAT): Delete.
2901 (make_lambda_name): Don't declare.
2902 * error.c (dump_aggr_type): Check for lambdas before other
2904 * lambda.c (begin_lambda_type): Use make_anon_name.
2905 * cp-lang.c (cxx_dwarf_name): Lambda names smell anonymous.
2906 * mangle.c (write_local_name): Likewise.
2907 * name-lookup.c (lambda_cnt, make_lambda_name): Delete.
2909 2019-05-30 Marek Polacek <polacek@redhat.com>
2911 * cp-tree.h (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Fix a typo.
2913 2019-05-31 Paolo Carlini <paolo.carlini@oracle.com>
2915 * decl.c (grokdeclarator): Use declarator->id_loc in five
2918 2019-05-29 Jakub Jelinek <jakub@redhat.com>
2921 * tree.c (lvalue_kind): Return clk_none for expressions with
2924 2019-05-29 Paolo Carlini <paolo.carlini@oracle.com>
2927 * parser.c (cp_parser_sizeof_operand): When the type-id production
2928 did not work out commit to the tentative parse.
2930 2019-05-29 Jakub Jelinek <jakub@redhat.com>
2932 P1091R3 - Extending structured bindings to be more like var decls
2933 P1381R1 - Reference capture of structured bindings
2934 * decl.c (cp_maybe_mangle_decomp): Handle TREE_STATIC decls even at
2936 (cp_finish_decomp): Copy over various decl properties from decl to
2937 v[i] in the tuple case.
2938 (grokdeclarator): Allow static, thread_local and __thread for C++2a
2939 and use pedwarn instead of error for older standard revisions.
2940 Make other structured binding diagnostic messages more i18n friendly.
2942 2019-05-28 Nathan Sidwell <nathan@acm.org>
2944 * decl.c (duplicate_decls): Assert a template newdecl has no
2947 2019-05-28 Marek Polacek <polacek@redhat.com>
2949 PR c++/90548 - ICE with generic lambda and empty pack.
2950 * pt.c (tsubst_copy_and_build): Handle pack expansion properly.
2952 2019-05-28 Nathan Sidwell <nathan@acm.org>
2954 * cp-tree.h (make_anon_name): Drop declaration.
2955 (TYPE_UNNAMED_P): Use IDENTIFIER_ANON_P.
2956 * cp-lang.c (cxx_dwarf_name): Likewise.
2957 * class.c (find_flexarrays): Likewise.
2958 * decl.c (name_unnamed_type, xref_tag_1): Likewise.
2959 * error.c (dump_aggr_type): Likewise.
2960 * pt.c (push_template_decl_real): Likewise.
2961 * name-lookup.c (consider_binding_level): Likewise.
2962 (anon_cnt, make_anon_name): Delete.
2964 2019-05-25 Marek Polacek <polacek@redhat.com>
2966 PR c++/90572 - wrong disambiguation in friend declaration.
2967 * parser.c (cp_parser_constructor_declarator_p): Don't allow missing
2968 typename for friend declarations.
2970 2019-05-23 Jonathan Wakely <jwakely@redhat.com>
2972 * cp-tree.h (CP_AGGREGATE_TYPE_P): Fix whitespace.
2974 * init.c (std_placement_new_fn_p): Remove outdated TODO comment that
2975 was resolved by r254694.
2977 2019-05-22 Jason Merrill <jason@redhat.com>
2979 PR c++/20408 - unnecessary code for empty struct.
2980 * call.c (build_call_a): Use simple_empty_class_p.
2982 PR c++/86485 - -Wmaybe-unused with empty class ?:
2983 * cp-gimplify.c (simple_empty_class_p): Also true for MODIFY_EXPR.
2985 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com>
2987 * parser.c (cp_parser_template_declaration_after_parameters): Use
2988 DECL_SOURCE_LOCATION in literal operator template errors.
2990 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com>
2994 * call.c (build_over_call): Devirtualize when the final overrider
2995 comes from the base.
2997 2019-05-21 Nathan Sidwell <nathan@acm.org>
2999 * name-lookup.c (do_nonmember_using_decl): Drop INSERT_P
3000 parameter. Document.
3001 (finish_nonmember_using_decl): Adjust do_nonmember_using_decl
3002 calls. Remove stray FIXME comment.
3004 * name-lookup.h (struct cp_binding_level): Drop usings field.
3005 (finish_namespace_using_decl, finish_local_using_decl): Replace with ...
3006 (finish_nonmember_using_decl): ... this.
3007 * name-lookup.c (push_using_decl_1, push_using_decl):
3008 (do_nonmember_using_decl): ... here. Add INSERT_P arg. Reimplement.
3009 (validate_nonmember_using_decl, finish_namespace_using_decl)
3010 (finish_local_using_decl): Replace with ...
3011 (finish_nonmember_using_decl): ... this. Drop DECL parm.
3012 * parser.c (cp_parser_using_declaration): Don't do lookup here.
3013 * pt.c (tsubst_expr): Do not do using decl lookup here.
3015 2019-05-21 Eric Botcazou <ebotcazou@adacore.com>
3017 * decl2.c (cpp_check) <IS_ASSIGNMENT_OPERATOR>: New case.
3019 2019-05-20 Marek Polacek <polacek@redhat.com>
3021 CWG 2094 - volatile scalars are trivially copyable.
3023 * tree.c (trivially_copyable_p): Don't check CP_TYPE_VOLATILE_P for
3026 2019-05-20 Marek Polacek <polacek@redhat.com>
3028 * pt.c (convert_template_argument): Add a diagnostic for the
3029 [temp.arg]/2 ambiguity case.
3031 * name-lookup.c (finish_using_directive): Don't issue inform() if the
3032 warning didn't trigger. Add quoting. Tweak the inform message.
3034 2019-05-20 Paolo Carlini <paolo.carlini@oracle.com>
3036 * cp-tree.h: Remove remnants of CONV_NONCONVERTING.
3038 2019-05-20 Nathan Sidwell <nathan@acm.org>
3040 * name-lookup.c (finish_namespace_using_directive)
3041 (finish_local_using_directive): Merge to ...
3042 (finish_using_directive): ... here. Handle both contexts.
3043 * name-lookup.h (finish_namespace_using_directive)
3044 (finish_local_using_directive): Replace with ...
3045 (finish_using_directive): ... this.
3046 * parser.c (cp_parser_using_directive): Adjust.
3047 * pt.c (tsubst_expr): Likewise.
3049 * cp-tree.h (struct lang_decl_ns): Remove usings field.
3050 (DECL_NAMESPACE_USING): Delete.
3051 * name-lookup.c (name_lookup::search_usings): Use namespace's
3053 (name_lookup::queue_namespae): Likewise.
3054 (finish_namespace_using_directive, push_namespace): Likewise.
3055 (has_using_namespace_std_directive): Just search the entire
3058 2019-05-20 Jonathan Wakely <jwakely@redhat.com>
3060 PR c++/90532 Ensure __is_constructible(T[]) is false
3061 * method.c (is_xible_helper): Return error_mark_node for construction
3062 of an array of unknown bound.
3064 2019-05-17 Thomas Schwinge <thomas@codesourcery.com>
3067 * parser.c (cp_finalize_oacc_routine): Rework checking if already
3068 marked with an OpenACC 'routine' directive.
3071 * parser.c (cp_parser_oacc_routine)
3072 (cp_parser_late_parsing_oacc_routine): Normalize order of clauses.
3073 (cp_finalize_oacc_routine): Call oacc_verify_routine_clauses.
3076 * parser.c (cp_finalize_oacc_routine): Refer to OpenACC 'routine'
3077 clauses from "omp declare target" attribute.
3079 2019-05-16 Martin Sebor <msebor@redhat.com>
3081 * call.c (print_z_candidate): Wrap diagnostic text in a gettext
3083 (print_z_candidates): Same.
3084 (build_conditional_expr_1): Quote keywords, operators, and types
3086 (build_op_delete_call): Same.
3087 (maybe_print_user_conv_context): Wrap diagnostic text in a gettext
3089 (convert_like_real): Same.
3090 (convert_arg_to_ellipsis): Quote keywords, operators, and types
3092 (build_over_call): Same.
3093 (joust): Break up an overlong line. Wrap diagnostic text in a gettext
3095 * constexpr.c (cxx_eval_check_shift_p): Spell out >= in English.
3096 (cxx_eval_constant_expression): Quote keywords, operators, and types
3098 (potential_constant_expression_1): Same.
3099 * cp-gimplify.c (cp_genericize_r): Same.
3100 * cvt.c (maybe_warn_nodiscard): Quote keywords, operators, and types
3102 (type_promotes_to): Same.
3103 * decl.c (check_previous_goto_1): Same.
3106 (cp_finish_decl): Avoid parenthesizing a sentence for consistency.
3107 (grok_op_properties): Quote keywords, operators, and types
3109 * decl2.c (grokfield): Same.
3110 (coerce_delete_type): Same.
3111 * except.c (is_admissible_throw_operand_or_catch_parameter): Same.
3112 * friend.c (do_friend): Quote C++ tokens.
3113 * init.c (build_new_1): Quote keywords, operators, and types
3115 (build_vec_delete_1): Same.
3116 (build_delete): Same.
3117 * lex.c (parse_strconst_pragma): Same.
3118 (handle_pragma_implementation): Same.
3119 (unqualified_fn_lookup_error): Same.
3120 * mangle.c (write_type): Same.
3121 * method.c (defaulted_late_check): Avoid two consecutive punctuators.
3122 * name-lookup.c (cp_binding_level_debug): Remove a trailing newline.
3123 (pop_everything): Same.
3124 * parser.c (cp_lexer_start_debugging): Quote a macro name.
3126 (cp_lexer_stop_debugging): Same.
3127 (cp_parser_userdef_numeric_literal): Quote a C++ header name
3129 (cp_parser_nested_name_specifier_opt): Quote keywords, operators,
3130 and types in diagnostics.
3131 (cp_parser_question_colon_clause): Same.
3132 (cp_parser_asm_definition): Same.
3133 (cp_parser_init_declarator): Same.
3134 (cp_parser_template_declaration_after_parameters): Avoid capitalizing
3135 a sentence in a diagnostic.
3136 (cp_parser_omp_declare_reduction): Quote keywords, operators, and types
3138 (cp_parser_transaction): Same.
3139 * pt.c (maybe_process_partial_specialization): Replace second call
3140 to permerror with inform for consistency with other uses.
3141 (expand_integer_pack): Quote keywords, operators, and types
3143 * rtti.c (get_typeid): Quote keywords, operators, and types
3145 (build_dynamic_cast_1): Same.
3146 * semantics.c (finish_asm_stmt): Same.
3147 (finish_label_decl): Same.
3148 (finish_bases): Same.
3149 (finish_offsetof): Same.
3150 (cp_check_omp_declare_reduction): Same.
3151 (finish_decltype_type): Same.
3152 * tree.c (handle_init_priority_attribute): Same. Add detail
3154 (maybe_warn_zero_as_null_pointer_constant): Same.
3155 * typeck.c (cp_build_binary_op): Quote keywords, operators, and types
3157 (cp_build_unary_op): Same.
3158 (check_for_casting_away_constness): Same.
3159 (build_static_cast): Same.
3160 (build_const_cast_1): Same.
3161 (maybe_warn_about_returning_address_of_local): Same.
3162 (check_return_expr): Same.
3163 * typeck2.c (abstract_virtuals_error_sfinae): Same.
3164 (digest_init_r): Replace a tab with spaces in a diagnostic.
3165 (build_functional_cast): Quote keywords, operators, and types
3168 2019-05-15 Jakub Jelinek <jakub@redhat.com>
3171 * cp-gimplify.c (genericize_cp_loop): Emit a DEBUG_BEGIN_STMT
3172 before the condition (or if missing or constant non-zero at the end
3173 of the loop. Emit a DEBUG_BEGIN_STMT before the increment expression
3174 if any. Don't call protected_set_expr_location on incr if it already
3177 2019-05-15 Marek Polacek <polacek@redhat.com>
3179 CWG 2096 - constraints on literal unions.
3180 * class.c (check_field_decls): Initialize booleans directly. A union
3181 is literal if at least one of its non-static data members is of
3182 non-volatile literal type.
3184 2019-05-15 Paolo Carlini <paolo.carlini@oracle.com>
3186 * cp-tree.h (REFERENCE_VLA_OK): Remove.
3187 * lambda.c (build_capture_proxy): Remove use of the above.
3189 2019-05-15 Paolo Carlini <paolo.carlini@oracle.com>
3191 * call.c (perform_overload_resolution, build_new_method_call_1):
3192 Use OVL_P; remove redundant TEMPLATE_DECL checks.
3193 * decl.c (grokfndecl): Likewise.
3194 * mangle.c (write_expression): Likewise.
3195 * parser.c (cp_parser_template_id): Likewise.
3196 * pt.c (resolve_overloaded_unification, type_dependent_expression_p):
3198 * search.c (build_baselink): Likewise.
3199 * tree.c (is_overloaded_fn, dependent_name, maybe_get_fns): Likewise.
3201 2019-05-14 Paolo Carlini <paolo.carlini@oracle.com>
3203 PR preprocessor/90382
3204 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
3207 2019-05-13 Jason Merrill <jason@redhat.com>
3209 Use releasing_vec more broadly.
3210 * cp-tree.h (struct releasing_vec): Replace get_ref method with
3212 (vec_safe_push, vec_safe_reserve, vec_safe_length, vec_safe_splice):
3213 Forwarding functions for releasing_vec.
3214 (release_tree_vector): Declare but don't define.
3215 * call.c (build_op_delete_call, build_temp, call_copy_ctor)
3216 (perform_direct_initialization_if_possible): Use releasing_vec.
3217 * constexpr.c (cxx_eval_vec_init_1, cxx_eval_store_expression):
3219 * cp-gimplify.c (cp_fold): Likewise.
3220 * cvt.c (force_rvalue, ocp_convert): Likewise.
3221 * decl.c (get_tuple_decomp_init): Likewise.
3222 * except.c (build_throw): Likewise.
3223 * init.c (perform_member_init, expand_default_init): Likewise.
3224 * method.c (do_build_copy_assign, locate_fn_flags): Likewise.
3225 * parser.c (cp_parser_userdef_char_literal)
3226 (cp_parser_userdef_numeric_literal)
3227 (cp_parser_userdef_string_literal)
3228 (cp_parser_perform_range_for_lookup)
3229 (cp_parser_range_for_member_function, cp_parser_omp_for_loop)
3230 (cp_parser_omp_for_loop_init): Likewise.
3231 * pt.c (tsubst_copy_and_build, do_class_deduction): Likewise.
3232 * semantics.c (calculate_direct_bases, calculate_bases)
3233 (finish_omp_barrier, finish_omp_flush, finish_omp_taskwait)
3234 (finish_omp_taskyield, finish_omp_cancel)
3235 (finish_omp_cancellation_point): Likewise.
3236 * tree.c (build_vec_init_elt, strip_typedefs, strip_typedefs_expr)
3237 (build_min_non_dep_op_overload): Likewise.
3238 * typeck.c (build_function_call_vec, cp_build_function_call_nary)
3239 (cp_build_modify_expr): Likewise.
3240 * typeck2.c (build_functional_cast): Likewise.
3242 2019-05-11 Paolo Carlini <paolo.carlini@oracle.com>
3244 * typeck.c (cp_build_function_call_vec): When mark_used fails
3245 unconditionally return error_mark_node.
3247 2019-05-10 Paolo Carlini <paolo.carlini@oracle.com>
3249 * decl.c (grokvardecl): Use an accurate location in error message
3250 about main as a global variable.
3252 2019-05-10 Paolo Carlini <paolo.carlini@oracle.com>
3254 * call.c (build_call_a): Use FUNC_OR_METHOD_TYPE_P.
3255 * cp-gimplify.c (cp_fold): Likewise.
3256 * cp-objcp-common.c (cp_type_dwarf_attribute): Likewise.
3257 * cp-tree.h (TYPE_OBJ_P, TYPE_PTROBV_P): Likewise.
3258 * cvt.c (perform_qualification_conversions): Likewise.
3259 * decl.c (grokdeclarator): Likewise.
3260 * decl2.c (build_memfn_type): Likewise.
3261 * mangle.c (canonicalize_for_substitution, write_type): Likewise.
3262 * parser.c (cp_parser_omp_declare_reduction): Likewise.
3263 * pt.c (check_explicit_specialization, uses_deducible_template_parms,
3264 check_cv_quals_for_unify, dependent_type_p_r): Likewise.
3265 * rtti.c (ptr_initializer): Likewise.
3266 * semantics.c (finish_asm_stmt, finish_offsetof,
3267 cp_check_omp_declare_reduction): Likewise.
3268 * tree.c (cp_build_qualified_type_real,
3269 cp_build_type_attribute_variant, cxx_type_hash_eq,
3270 cxx_copy_lang_qualifiers, cp_free_lang_data): Likewise.
3271 * typeck.c (structural_comptypes, convert_arguments,
3272 cp_build_addr_expr_1, unary_complex_lvalue, cp_build_c_cast,
3273 cp_build_modify_expr, comp_ptr_ttypes_real, type_memfn_rqual):
3276 2019-05-10 Marek Polacek <polacek@redhat.com>
3278 PR c++/78010 - bogus -Wsuggest-override warning on final function.
3279 * class.c (check_for_override): Don't warn for final functions.
3281 2019-05-10 Jakub Jelinek <jakub@redhat.com>
3284 * config-lang.in (gtfiles): Remove c-family/c-lex.c, add
3285 c-family/c-cppbuiltin.c.
3287 2019-05-09 Paolo Carlini <paolo.carlini@oracle.com>
3291 2018-04-26 Paolo Carlini <paolo.carlini@oracle.com>
3293 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
3296 2019-05-08 Nathan Sidwell <nathan@acm.org>
3298 Kill DECL_SAVED_FUNCTION_DATA .
3299 * cp-tree.h (language_function): Remove x_auto_return_pattern.
3300 (current_function_auto_return_pattern): Delete.
3301 (lang_decl_fn): Replace saved_language_function with
3302 saved_auto_return type.
3303 (DECL_SAVED_FUNCTION_DATA): Delete.
3304 (DECL_SAVED_AUTO_RETURN_TYPE): New.
3305 (FNDECL_USED_AUTO): Correct documentation.
3306 * decl.c (duplicate_decls): Adjust AUTO return handling.
3307 (start_preparsed_function): Replace
3308 current_function_auto_return_pattern with
3309 DECL_SAVED_AUTO_RETURN_TYPE. Remove DECL_SAVED_FUNCTION_DATA
3311 (finish_function): Likewise.
3312 (save_function_data): Delete.
3313 (fndecl_declared_return_type): Reimplement.
3314 * mangle.c (write_unqualified_name): Use DECL_SAVED_AUTO_RETURN_TYPE.
3315 * method.c (make_thunk, make_alias_for): Likewise.
3316 * parser.c (cp_parser_jump_statement): Likewise.
3317 * pt.c (do_auto_deduction): Likewise.
3318 * typeck.c (check_return_expr): Likewise.
3320 2019-05-06 Jason Merrill <jason@redhat.com>
3322 PR c++/90171 - reorganize usual_deallocation_fn_p
3323 * call.c (struct dealloc_info): New.
3324 (usual_deallocation_fn_p): Take a dealloc_info*.
3325 (aligned_deallocation_fn_p, sized_deallocation_fn_p): Remove.
3326 (build_op_delete_call): Adjust.
3328 2019-05-07 Jason Merrill <jason@redhat.com>
3330 PR c++/86485 - -Wmaybe-unused with empty class ?:
3331 * typeck.c (build_static_cast_1): Use cp_build_addr_expr.
3333 * pt.c (type_dependent_expression_p): A non-type template parm with
3334 a placeholder type is type-dependent.
3336 2019-05-06 Marek Polacek <polacek@redhat.com>
3338 PR c++/90265 - ICE with generic lambda.
3339 * pt.c (tsubst_copy_and_build): Use a dedicated variable for the last
3340 element in the vector.
3342 2019-05-03 Martin Liska <mliska@suse.cz>
3344 * call.c (build_aggr_conv): Use is_empty instead of
3345 elements () == 0 (and similar usages).
3346 * parser.c (cp_parser_lambda_introducer): Likewise.
3348 2019-05-02 Nathan Sidwell <nathan@acm.org>
3350 * semantics.c (finish_id_expression_1): Remove unreachable code.
3352 2019-05-01 Nathan Sidwell <nathan@acm.org>
3354 * name-lookup.h (get_class_binding_direct): Change final arg to
3356 (get_class_binding): Likewise.
3357 * name-lookup.c (get_class_binding_direct): Replace TYPE_OR_FNS
3358 arg with WANT_TYPE bool. Simplify.
3359 (get_class_binding): Adjust final arg.
3360 * decl.c (reshape_init_class): Adjust get_class_binding calls.
3362 2019-04-30 Nathan Sidwell <nathan@acm.org>
3364 * cp-objcp-common.c (cp_common_init_ts): Use MARK_TS_EXP for _EXPR
3365 nodes. Call c_common_init_ts.
3367 2019-04-29 Nathan Sidwell <nathan@acm.org>
3369 * decl.c (duplicate_decls): Add whitespace, move comments into
3371 * method.c (explain_implicit_non_constexpr): Refactor.
3372 * pt.c (check_explicit_specialization): Fix indentation.
3373 * semantics.c (process_outer_var_ref): Reformat.
3374 (finish_id_expression_1): Use STRIP_TEMPLATE.
3376 2019-04-26 Jonathan Wakely <jwakely@redhat.com>
3378 PR c++/90243 - orphaned note in uninstantiated constexpr function
3379 * decl.c (check_for_uninitialized_const_var): Suppress notes if no
3382 2019-04-26 Paolo Carlini <paolo.carlini@oracle.com>
3385 * decl.c (grokdeclarator): Set type to error_mark_node
3386 upon error about template placeholder type non followed
3387 by a simple declarator-id.
3389 2019-04-26 Paolo Carlini <paolo.carlini@oracle.com>
3391 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
3394 2019-04-24 Jason Merrill <jason@redhat.com>
3396 PR c++/90227 - error with template parameter packs.
3397 * pt.c (coerce_template_parms): Do add empty pack when
3400 2019-04-24 Richard Biener <rguenther@suse.de>
3402 * call.c (null_ptr_cst_p): Order checks according to expensiveness.
3403 (conversion_null_warnings): Likewise.
3404 * typeck.c (same_type_ignoring_top_level_qualifiers_p): Return
3405 early if type1 == type2.
3407 2019-04-22 Jason Merrill <jason@redhat.com>
3409 PR c++/87366 - wrong error with alias template.
3410 * typeck.c (structural_comptypes): When comparing_specializations,
3411 aliases are unequal.
3412 (comptypes): When comparing_specializations, do structural
3415 2019-04-19 Jason Merrill <jason@redhat.com>
3417 PR c++/90190 - CTAD with list-constructor.
3418 * pt.c (do_class_deduction): Don't try the single element deduction
3419 if the single element is also a braced list.
3421 PR c++/90171 - ICE with destroying delete with size_t parm.
3422 * call.c (sized_deallocation_fn_p): New. Use it instead of
3423 second_parm_is_size_t in most cases.
3424 (second_parm_is_size_t): Don't check for aligned.
3426 2019-04-19 Paolo Carlini <paolo.carlini@oracle.com>
3429 * pt.c (fn_type_unification): When handling null explicit
3430 arguments do not special case non-parameter packs.
3432 2019-04-19 Jakub Jelinek <jakub@redhat.com>
3435 * pt.c (process_template_parm): Set decl to pushdecl result. If
3436 !is_non_type, also set parm to that.
3439 * decl.c (struct cp_switch): Remove outside_range_p member.
3440 (push_switch): Don't clear it.
3441 (pop_switch): Adjust c_do_switch_warnings caller.
3442 (finish_case_label): Adjust c_add_case_label caller.
3445 * decl.c (duplicate_decls): If remove is main variant and
3446 DECL_ORIGINAL_TYPE is some other type, remove a DECL_ORIGINAL_TYPE
3447 variant that has newdecl as TYPE_NAME if any.
3449 2019-04-18 Jason Merrill <jason@redhat.com>
3451 PR c++/87554 - ICE with extern template and reference member.
3452 * decl.c (cp_finish_decl): Don't set DECL_INITIAL of external vars.
3454 2019-04-17 Jason Merrill <jason@redhat.com>
3456 PR c++/90047 - ICE with enable_if alias template.
3457 * pt.c (tsubst_decl) [TYPE_DECL]: Don't put an erroneous decl in the
3458 hash table when we're in SFINAE context.
3460 2019-04-17 Marek Polacek <polacek@redhat.com>
3462 PR c++/90124 - bogus error with incomplete type in decltype.
3463 * typeck.c (build_class_member_access_expr): Check
3464 cp_unevaluated_operand.
3466 2019-04-12 Jakub Jelinek <jakub@redhat.com>
3469 * decl.c (duplicate_decls): When newdecl's type is its main variant,
3470 don't try to remove it from the variant list, but instead assert
3473 2019-04-12 Martin Sebor <msebor@redhat.com>
3477 * parser.c (cp_parser_has_attribute_expression): Handle assignment
3480 2019-04-12 Jason Merrill <jason@redhat.com>
3482 * call.c (null_member_pointer_value_p): Handle an empty CONSTRUCTOR
3485 2019-04-12 Marek Polacek <polacek@redhat.com>
3487 * except.c (build_noexcept_spec): Use build_converted_constant_bool_expr
3488 instead of perform_implicit_conversion_flags.
3490 PR c++/87603 - constexpr functions are no longer noexcept.
3491 * constexpr.c (is_sub_constant_expr): Remove unused function.
3492 * cp-tree.h (is_sub_constant_expr): Remove declaration.
3493 * except.c (check_noexcept_r): Don't consider a call to a constexpr
3496 2019-04-11 Jakub Jelinek <jakub@redhat.com>
3498 PR translation/90035
3499 * parser.h (struct cp_parser): Add
3500 type_definition_forbidden_message_arg member.
3501 * parser.c (cp_debug_parser): Print it.
3502 (cp_parser_check_type_definition): Pass
3503 parser->type_definition_forbidden_message_arg as second argument to
3505 (cp_parser_has_attribute_expression, cp_parser_sizeof_operand): Set
3506 parser->type_definition_forbidden_message_arg and use G_() with
3507 %qs for parser->type_definition_forbidden_message instead of
3508 building untranslatable message using concat.
3510 2019-04-09 Jakub Jelinek <jakub@redhat.com>
3512 PR translation/90011
3513 * typeck2.c (check_narrowing): Remove trailing space from diagnostics.
3515 2019-04-08 Marek Polacek <polacek@redhat.com>
3517 * typeck2.c (digest_init_r): Don't condition the object slicing warning
3520 2019-04-08 Paolo Carlini <paolo.carlini@oracle.com>
3523 * semantics.c (trait_expr_value): Don't use TYPE_NOTHROW_P
3524 when maybe_instantiate_noexcept fails.
3525 (classtype_has_nothrow_assign_or_copy_p): Likewise.
3526 * method.c (implicitly_declare_fn): Avoid passing error_mark_node
3527 to build_exception_variant.
3529 2019-04-05 Marek Polacek <polacek@redhat.com>
3531 PR c++/87145 - bogus error converting class type in template arg list.
3532 * pt.c (convert_nontype_argument): Don't call
3533 build_converted_constant_expr if it could involve calling a conversion
3534 function with a instantiation-dependent constructor as its argument.
3536 2019-04-05 Martin Sebor <msebor@redhat.com>
3539 * decl.c (reshape_init_array_1): Avoid treating empty strings
3540 as zeros in array initializers.
3541 Use trivial_type_p () instead of TYPE_HAS_TRIVIAL_DFLT().
3543 2019-04-04 Jason Merrill <jason@redhat.com>
3545 PR c++/89948 - ICE with break in statement-expr.
3546 * constexpr.c (cxx_eval_statement_list): Jumping out of a
3547 statement-expr is non-constant.
3549 2019-04-04 Jason Merrill <jason@redhat.com>
3551 PR c++/89966 - error with non-type auto tparm.
3552 * pt.c (do_auto_deduction): Clear tf_partial.
3554 2019-04-04 Jason Merrill <jason@redhat.com>
3556 PR c++/86986 - ICE with TTP with parameter pack.
3557 * pt.c (coerce_template_parameter_pack): Only look at the type of a
3558 non-type parameter pack.
3559 (fixed_parameter_pack_p_1): Don't recurse into the type of a
3560 non-type parameter pack.
3561 (coerce_template_template_parms): Call add_outermost_template_args.
3563 2019-04-04 Martin Sebor <msebor@redhat.com>
3569 * decl.c (reshape_init_array_1): Strip trailing zero-initializers
3570 from arrays of trivial type and known size.
3571 * mangle.c (write_expression): Convert braced initializer lists
3573 (write_expression): Trim trailing zero-initializers from arrays
3575 (write_template_arg_literal): Mangle strings the same as braced
3578 2019-04-03 Jason Merrill <jason@redhat.com>
3580 PR c++/81866 - ICE with member template and default targ.
3581 * pt.c (tsubst_template_decl): Handle getting a type from
3582 retrieve_specialization.
3584 PR c++/86586 - -fcompare-debug=-Wsign-compare.
3585 * typeck.c (cp_build_binary_op): Don't fold for -Wsign-compare.
3587 PR c++/89331 - ICE with offsetof in incomplete class.
3588 * semantics.c (finish_offsetof): Handle error_mark_node.
3589 * typeck.c (build_class_member_access_expr): Call
3590 complete_type_or_maybe_complain before converting to base.
3592 PR c++/89917 - ICE with lambda in variadic mem-init.
3593 * pt.c (make_pack_expansion): Change type_pack_expansion_p to false.
3595 2019-04-01 Jason Merrill <jason@redhat.com>
3597 PR c++/86946 - ICE with function call in template argument.
3599 * pt.c (iterative_hash_template_arg) [CALL_EXPR]: Use
3602 2019-04-01 Paolo Carlini <paolo.carlini@oracle.com>
3605 * pt.c (tsubst_copy): Deal with lookup_name not returing a variable.
3607 2019-03-31 Marek Polacek <polacek@redhat.com>
3609 PR c++/89852 - ICE with C++11 functional cast with { }.
3610 * constexpr.c (fold_non_dependent_expr_template): New static function
3612 (fold_non_dependent_expr): ...here.
3613 (fold_non_dependent_init): New function.
3614 * cp-tree.h (fold_non_dependent_init): Declare.
3615 * typeck2.c (massage_init_elt): Call fold_non_dependent_init instead
3616 of fold_non_dependent_expr. Don't call maybe_constant_init.
3618 2019-03-30 Jason Merrill <jason@redhat.com>
3620 PR c++/89744 - ICE with specialization of member class template.
3621 * pt.c (lookup_template_class_1): If the partial instantiation is
3622 explicitly specialized, adjust.
3623 (maybe_process_partial_specialization): Also adjust
3626 2019-03-29 Jakub Jelinek <jakub@redhat.com>
3629 * typeck.c: Include gimplify.h.
3630 (cp_build_modify_expr) <case COND_EXPR>: Unshare rhs before using it
3631 for second time. Formatting fixes.
3633 2019-03-29 Marek Polacek <polacek@redhat.com>
3635 PR c++/89876 - ICE with deprecated conversion.
3636 * call.c (convert_like_real): Only give warnings with tf_warning.
3638 2019-03-28 Marek Polacek <polacek@redhat.com>
3640 PR c++/89612 - ICE with member friend template with noexcept.
3641 * pt.c (maybe_instantiate_noexcept): For function templates, use their
3642 template result (function decl). Don't set up local specializations.
3643 Temporarily turn on processing_template_decl. Update the template type
3646 PR c++/89836 - bool constant expression and explicit conversions.
3647 * call.c (build_converted_constant_expr_internal): New function,
3649 (build_converted_constant_expr): ...this. New.
3650 (build_converted_constant_bool_expr): New.
3651 * cp-tree.h (build_converted_constant_bool_expr): Declare.
3652 * decl.c (build_explicit_specifier): Call
3653 build_converted_constant_bool_expr.
3655 2019-03-28 Jakub Jelinek <jakub@redhat.com>
3658 * constexpr.c (struct check_for_return_continue_data): New type.
3659 (check_for_return_continue): New function.
3660 (potential_constant_expression_1) <case SWITCH_STMT>: Walk
3661 SWITCH_STMT_BODY to find RETURN_EXPRs or CONTINUE_STMTs not nested
3662 in loop bodies and set *jump_target to that if found.
3664 2019-03-27 Jason Merrill <jason@redhat.com>
3666 PR c++/89831 - error with qualified-id in const member function.
3667 * semantics.c (finish_non_static_data_member): Use object cv-quals
3668 in scoped case, too.
3670 PR c++/89421 - ICE with lambda in template parameter list.
3671 * parser.c (cp_parser_lambda_expression): Also reject a lambda in a
3672 template parameter list before C++20.
3673 * pt.c (type_dependent_expression_p): True for LAMBDA_EXPR.
3674 * semantics.c (begin_class_definition): Restore error about defining
3675 non-lambda class in template parm list.
3677 2019-03-26 Jason Merrill <jason@redhat.com>
3679 PR c++/86932 - missed SFINAE with empty pack.
3680 * pt.c (coerce_template_parms): Don't add an empty pack if
3682 (fn_type_unification): Pass tf_partial to coerce_template_parms.
3684 PR c++/86429 - constexpr variable in lambda.
3687 * constexpr.c (cxx_eval_constant_expression): In a lambda function,
3688 try evaluating the captured variable directly.
3690 2019-03-26 Jakub Jelinek <jakub@redhat.com>
3693 * semantics.c (finish_omp_atomic): Add warning_sentinel for
3694 -Wunused-value around finish_expr_stmt call.
3696 2019-03-25 Paolo Carlini <paolo.carlini@oracle.com>
3700 * parser.c (cp_parser_binary_expression): Don't call cp_fully_fold
3701 to undo the disabling of warnings.
3703 2019-03-25 Jason Merrill <jason@redhat.com>
3705 PR c++/87748 - substitution failure error with decltype.
3706 * pt.c (most_specialized_partial_spec): Clear
3707 processing_template_decl.
3709 2019-03-25 Marek Polacek <polacek@redhat.com>
3711 PR c++/89214 - ICE when initializing aggregates with bases.
3712 * typeck2.c (digest_init_r): Warn about object slicing instead of
3715 PR c++/89705 - ICE with reference binding with conversion function.
3716 * call.c (reference_binding): If the result of the conversion function
3717 is a prvalue of non-class type, use the cv-unqualified type.
3719 2019-03-25 Nathan Sidwell <nathan@acm.org>
3721 * lambda.c (maybe_add_lambda_conv_op): Don't add to comdat group.
3723 2019-03-22 Jakub Jelinek <jakub@redhat.com>
3726 * cp-tree.h (get_tls_wrapper_fn): Remove declaration.
3727 (maybe_get_tls_wrapper_call): Declare.
3728 * decl2.c (get_tls_wrapper_fn): Make static.
3729 (maybe_get_tls_wrapper_call): New function.
3730 * typeck.c (build_class_member_access_expr): Handle accesses to TLS
3732 * semantics.c (finish_qualified_id_expr): Likewise.
3733 (finish_id_expression_1): Use maybe_get_tls_wrapper_call.
3734 * pt.c (tsubst_copy_and_build): Likewise.
3737 * constexpr.c (struct constexpr_ctx): Add constexpr_ops_count member.
3738 (cxx_eval_constant_expression): When not skipping, not constant class
3739 or location wrapper, increment *ctx->constexpr_ops_count and if it is
3740 above constexpr_loop_nest_limit, diagnose failure.
3741 (cxx_eval_outermost_constant_expr): Add constexpr_ops_count and
3742 initialize ctx.constexpr_ops_count to its address.
3743 (is_sub_constant_expr): Likewise.
3745 2019-03-21 Jakub Jelinek <jakub@redhat.com>
3748 * call.c (filed_in_pset): Change pset from hash_set<tree> * to
3749 hash_set<tree, true> &, adjust uses accordingly.
3750 (build_aggr_conv): Change pset from hash_set<tree> *
3751 to hash_set<tree, true>. Replace goto fail; with return NULL;,
3755 * parser.c (cp_parser_lambda_introducer): Add ids and first_capture_id
3756 variables, check for duplicates in this function.
3757 * lambda.c (add_capture): Don't check for duplicates nor use
3759 (register_capture_members): Don't clear IDENTIFIER_MARKED here.
3761 2019-03-21 Paolo Carlini <paolo.carlini@oracle.com>
3764 * method.c (after_nsdmi_defaulted_late_checks): Avoid passing
3765 error_mark_node to comp_except_specs.
3767 2019-03-20 Jason Merrill <jason@redhat.com>
3769 PR c++/87480 - decltype of member access in default template arg
3770 * pt.c (type_unification_real): Accept a dependent result in
3773 2019-03-19 Martin Sebor <msebor@redhat.com>
3775 PR tree-optimization/89688
3776 * typeck2.c (store_init_value): Call braced_lists_to_string for more
3777 kinds of initializers.
3779 2019-03-18 Jason Merrill <jason@redhat.com>
3781 PR c++/89630 - ICE with dependent using-decl as template arg.
3782 * tree.c (cp_tree_equal): Always return false for USING_DECL.
3784 PR c++/89761 - ICE with sizeof... in pack expansion.
3785 * pt.c (argument_pack_element_is_expansion_p): Handle
3786 ARGUMENT_PACK_SELECT.
3788 PR c++/89640 - GNU attributes on lambda.
3789 * parser.c (cp_parser_lambda_declarator_opt): Allow GNU attributes.
3791 PR c++/89682 - wrong access error in default argument.
3792 * pt.c (tsubst_default_argument): Don't defer access checks.
3794 2019-03-18 Paolo Carlini <paolo.carlini@oracle.com>
3797 * semantics.c (finish_non_static_data_member): Check return value
3798 of context_for_name_lookup and immediately return error_mark_node
3801 2019-03-17 Jason Merrill <jason@redhat.com>
3803 PR c++/89571 - ICE with ill-formed noexcept on constructor.
3804 * pt.c (maybe_instantiate_noexcept): Only return false if defaulted.
3805 (regenerate_decl_from_template): Use it for noexcept-specs.
3807 2019-03-14 Jason Merrill <jason@redhat.com>
3809 * parser.c (cp_parser_decl_specifier_seq): Support C++20
3810 concept-definition syntax without 'bool'.
3812 2019-03-14 Jakub Jelinek <jakub@redhat.com>
3815 * semantics.c (finish_qualified_id_expr): Reject variable templates.
3818 * constexpr.c (struct constexpr_ctx): Change save_exprs type from
3819 hash_set<tree> to vec<tree>.
3820 (cxx_eval_call_expression): Adjust for save_exprs being a vec instead
3822 (cxx_eval_loop_expr): Likewise. Truncate the vector after each
3823 removal of SAVE_EXPRs from values.
3824 (cxx_eval_constant_expression) <case SAVE_EXPR>: Call safe_push
3825 method on save_exprs instead of add.
3827 2019-03-13 Jason Merrill <jason@redhat.com>
3829 PR c++/86521 - C++17 copy elision in initialization by constructor.
3830 * call.c (joust_maybe_elide_copy): New.
3833 2019-03-13 Marek Polacek <polacek@redhat.com>
3835 PR c++/88979 - further P0634 fix for constructors.
3836 * parser.c (cp_parser_decl_specifier_seq): Pass flags to
3837 cp_parser_constructor_declarator_p.
3838 (cp_parser_direct_declarator): Allow missing typename for constructor
3840 (cp_parser_constructor_declarator_p): Add FLAGS parameter. Pass it to
3841 cp_parser_type_specifier.
3843 PR c++/89686 - mixing init-capture and simple-capture in lambda.
3844 * parser.c (cp_parser_lambda_introducer): Give error when combining
3845 init-capture and simple-capture.
3847 PR c++/89660 - bogus error with -Wredundant-move.
3848 * typeck.c (maybe_warn_pessimizing_move): Only accept (T &) &arg
3849 as the std::move's argument. Don't call convert_for_initialization
3850 when warn_redundant_move isn't on.
3852 2019-03-11 Jason Merrill <jason@redhat.com>
3854 PR c++/86521 - wrong overload resolution with ref-qualifiers.
3855 * call.c (build_user_type_conversion_1): Don't use a conversion to a
3856 reference of the wrong rvalueness for direct binding.
3858 2019-03-11 Martin Liska <mliska@suse.cz>
3860 * cvt.c (build_expr_type_conversion): Wrap apostrophes
3861 in gcc internal format with %'.
3862 * decl.c (check_no_redeclaration_friend_default_args): Likewise.
3863 (grokfndecl): Likewise.
3864 * name-lookup.c (do_pushtag): Likewise.
3865 * pt.c (unify_parameter_deduction_failure): Likewise.
3866 (unify_template_deduction_failure): Likewise.
3868 2019-03-11 Martin Liska <mliska@suse.cz>
3870 * call.c (convert_arg_to_ellipsis): Wrap an option name
3871 in a string format message and fix GNU coding style.
3872 (build_over_call): Likewise.
3873 * class.c (check_field_decl): Likewise.
3874 (layout_nonempty_base_or_field): Likewise.
3875 * constexpr.c (cxx_eval_loop_expr): Likewise.
3876 * cvt.c (type_promotes_to): Likewise.
3877 * decl.c (cxx_init_decl_processing): Likewise.
3878 (mark_inline_variable): Likewise.
3879 (grokdeclarator): Likewise.
3880 * decl2.c (record_mangling): Likewise.
3881 * error.c (maybe_warn_cpp0x): Likewise.
3882 * except.c (doing_eh): Likewise.
3883 * mangle.c (maybe_check_abi_tags): Likewise.
3884 * parser.c (cp_parser_diagnose_invalid_type_name): Likewise.
3885 (cp_parser_userdef_numeric_literal): Likewise.
3886 (cp_parser_primary_expression): Likewise.
3887 (cp_parser_unqualified_id): Likewise.
3888 (cp_parser_pseudo_destructor_name): Likewise.
3889 (cp_parser_builtin_offsetof): Likewise.
3890 (cp_parser_lambda_expression): Likewise.
3891 (cp_parser_lambda_introducer): Likewise.
3892 (cp_parser_lambda_declarator_opt): Likewise.
3893 (cp_parser_selection_statement): Likewise.
3894 (cp_parser_init_statement): Likewise.
3895 (cp_parser_decomposition_declaration): Likewise.
3896 (cp_parser_function_specifier_opt): Likewise.
3897 (cp_parser_static_assert): Likewise.
3898 (cp_parser_simple_type_specifier): Likewise.
3899 (cp_parser_namespace_definition): Likewise.
3900 (cp_parser_using_declaration): Likewise.
3901 (cp_parser_ctor_initializer_opt_and_function_body): Likewise.
3902 (cp_parser_initializer_list): Likewise.
3903 (cp_parser_type_parameter_key): Likewise.
3904 (cp_parser_member_declaration): Likewise.
3905 (cp_parser_try_block): Likewise.
3906 (cp_parser_std_attribute_spec): Likewise.
3907 (cp_parser_requires_clause_opt): Likewise.
3908 * pt.c (check_template_variable): Likewise.
3909 (check_default_tmpl_args): Likewise.
3910 (push_tinst_level_loc): Likewise.
3911 (instantiate_pending_templates): Likewise.
3912 (invalid_nontype_parm_type_p): Likewise.
3913 * repo.c (get_base_filename): Likewise.
3914 * rtti.c (typeid_ok_p): Likewise.
3915 (build_dynamic_cast_1): Likewise.
3916 * tree.c (maybe_warn_parm_abi): Likewise.
3918 2019-03-08 Jakub Jelinek <jakub@redhat.com>
3921 * parser.c (cp_parser_template_declaration_after_parameters): Avoid
3922 one space before " at the end of line and another after " on another
3923 line in a string literal.
3925 PR tree-optimization/89550
3926 * semantics.c (maybe_convert_cond): Only set TREE_NO_WARNING if
3927 warning_at returned true.
3928 * decl2.c (c_parse_final_cleanups): Likewise.
3929 * typeck.c (convert_for_assignment): Likewise.
3930 * decl.c (finish_function): Likewise.
3933 * parser.c (cp_parser_asm_definition): Just warn instead of error
3934 on volatile qualifier outside of function body.
3937 * constexpr.c (potential_constant_expression_1): Reject
3938 REINTERPRET_CAST_P NOP_EXPRs.
3941 * call.c (joust): Call print_z_candidate only if pedwarn returned
3944 2019-03-07 Jason Merrill <jason@redhat.com>
3946 PR c++/88123 - lambda and using-directive.
3947 * name-lookup.c (op_unqualified_lookup)
3948 (maybe_save_operator_binding, discard_operator_bindings)
3949 (push_operator_bindings): New.
3950 * typeck.c (build_x_binary_op, build_x_unary_op): Call
3951 maybe_save_operator_binding.
3952 * decl.c (start_preparsed_function): Call push_operator_bindings.
3953 * tree.c (cp_free_lang_data): Call discard_operator_bindings.
3955 PR c++/88820 - ICE with CTAD and member template used in DMI.
3956 * pt.c (do_class_deduction): Handle parm used as its own arg.
3958 2019-03-07 Jakub Jelinek <jakub@redhat.com>
3961 * parser.c (cp_parser_asm_definition): Parse asm qualifiers even
3962 at toplevel, but diagnose them.
3964 2019-03-06 Jason Merrill <jason@redhat.com>
3966 PR c++/89381 - implicit copy and using-declaration.
3967 * class.c (classtype_has_move_assign_or_move_ctor_p): Don't consider
3968 op= brought in by a using-declaration.
3970 2019-03-06 Jakub Jelinek <jakub@redhat.com>
3973 * init.c (build_value_init_noctor): Ignore flexible array members.
3975 2019-03-06 Jason Merrill <jason@redhat.com>
3977 PR c++/89576 - if constexpr of lambda capture.
3978 * semantics.c (maybe_convert_cond): Do convert a non-dependent
3979 condition in a template.
3980 * typeck.c (condition_conversion): Handle being called in a
3983 2019-03-06 Marek Polacek <polacek@redhat.com>
3985 PR c++/87378 - bogus -Wredundant-move warning.
3986 * typeck.c (maybe_warn_pessimizing_move): See if the maybe-rvalue
3987 overload resolution would actually succeed.
3989 2019-03-05 Jason Merrill <jason@redhat.com>
3991 * class.c (is_really_empty_class): Add ignore_vptr parm.
3992 (trivial_default_constructor_is_constexpr): Pass it.
3993 * call.c (build_over_call): Pass it.
3994 * constexpr.c (cxx_eval_constant_expression): Pass it instead of
3995 checking TYPE_POLYMORPHIC_P.
3996 (cxx_eval_component_reference, potential_constant_expression_1):
3998 * cp-gimplify.c (simple_empty_class_p): Pass it.
3999 * init.c (expand_aggr_init_1): Pass it.
4001 2019-03-04 Paolo Carlini <paolo.carlini@oracle.com>
4004 * parser.c (cp_parser_class_head): Reject TYPE_BEING_DEFINED too.
4006 2019-03-04 Jakub Jelinek <jakub@redhat.com>
4009 * call.c (field_in_pset): New function.
4010 (build_aggr_conv): Handle CONSTRUCTOR_IS_DESIGNATED_INIT correctly.
4012 2019-03-02 Jakub Jelinek <jakub@redhat.com>
4015 * cp-tree.h (CONSTRUCTOR_IS_DESIGNATED_INIT): Define.
4016 * parser.c (cp_parser_braced_list): Adjust cp_parser_initializer_list
4017 caller, set CONSTRUCTOR_IS_DESIGNATED_INIT.
4018 (cp_parser_initializer_list): Add designated parameter, set *designated
4019 to a bool whether any designators were parsed.
4020 * decl.c (reshape_init): Copy over CONSTRUCTOR_IS_DESIGNATED_INIT if
4022 * pt.c (tsubst_copy_and_build): Likewise.
4023 * call.c (implicit_conversion): If CONSTRUCTOR_IS_DESIGNATED_INIT,
4024 don't call build_list_conv, nor build_complex_conv, nor attempt to
4025 convert a single element initializer to scalar.
4027 2019-03-01 Marek Polacek <polacek@redhat.com>
4029 PR c++/89537 - missing location for error with non-static member fn.
4030 * call.c (resolve_args): Use EXPR_LOCATION.
4031 * typeck.c (build_class_member_access_expr): Use input_location.
4033 PR c++/89532 - ICE with incomplete type in decltype.
4034 * semantics.c (finish_compound_literal): Return error_mark_node
4035 if digest_init_flags returns error_mark_node.
4037 2019-03-01 Jakub Jelinek <jakub@redhat.com>
4039 Implement P1002R1, Try-catch blocks in constexpr functions
4041 * parser.c (cp_parser_ctor_initializer_opt_and_function_body):
4042 Diagnose constexpr ctor or function with function-try-block with
4043 pedwarn for c++17 and earlier. Formatting fix.
4044 (cp_parser_try_block): Use pedwarn instead of error and only for
4045 c++17 and earlier when try block appears in constexpr function.
4046 * constexpr.c (build_constexpr_constructor_member_initializers):
4047 Handle TRY_BLOCK here instead of erroring on it.
4049 2019-02-28 Jason Merrill <jason@redhat.com>
4051 PR c++/88183 - ICE with .* fold-expression.
4052 * pt.c (fold_expression) [DOTSTAR_EXPR]: Remove special handling.
4054 PR c++/86969 - ICE with constexpr if and recursive generic lambdas.
4055 * class.c, lambda.c, pt.c: Revert earlier change.
4056 * lambda.c (add_capture): Don't special-case capture of dependent
4059 * name-lookup.c (print_binding_level): Print this_entity.
4061 2019-02-27 Marek Polacek <polacek@redhat.com>
4063 PR c++/88857 - ICE with value-initialization of argument in template.
4064 * call.c (convert_like_real): Don't call build_value_init in template.
4066 2019-02-27 Jason Merrill <jason@redhat.com>
4068 PR c++/86969 - ICE with constexpr if and recursive generic lambdas.
4069 * semantics.c (process_outer_var_ref): Do capture dependent vars.
4070 * class.c (finish_struct): Only add TAG_DEFN if T is in
4071 current_function_decl.
4072 * lambda.c (vla_capture_type): Force the capture type out into the
4073 lambda's enclosing function.
4074 (add_capture): Pass in the lambda.
4075 * pt.c (tsubst_lambda_expr): complete_type a VLA capture type.
4077 2019-02-27 Marek Polacek <polacek@redhat.com>
4079 PR c++/89511 - ICE with using-declaration and unscoped enumerator.
4080 * parser.c (cp_parser_using_declaration): For an unscoped enum
4081 only use its context if it's not a function declaration.
4083 2019-02-27 Paolo Carlini <paolo.carlini@oracle.com>
4086 * method.c (process_subob_fn): When maybe_instantiate_noexcept
4087 returns false don't call merge_exception_specifiers.
4089 2019-02-27 Paolo Carlini <paolo.carlini@oracle.com>
4092 * parser.c (cp_parser_noexcept_specification_opt): Return NULL_TREE
4093 for a non-constant parsed expression.
4095 2019-02-26 Jakub Jelinek <jakub@redhat.com>
4098 * constexpr.c (cxx_eval_store_expression): When changing active union
4099 member, set no_zero_init.
4101 2019-02-23 Marek Polacek <polacek@redhat.com>
4103 PR c++/88294 - ICE with non-constant noexcept-specifier.
4104 * pt.c (maybe_instantiate_noexcept): Set up the list of local
4105 specializations. Set current_class_{ptr,ref}.
4107 2019-02-22 David Malcolm <dmalcolm@redhat.com>
4110 * parser.c (cp_parser_unqualified_id): Capture and use locations
4113 2019-02-22 Marek Polacek <polacek@redhat.com>
4115 PR c++/89420 - ICE with CAST_EXPR in explicit-specifier.
4116 * decl.c (build_explicit_specifier): Don't check
4117 processing_template_decl. Call instantiation_dependent_expression_p
4118 instead of value_dependent_expression_p. Call
4119 instantiate_non_dependent_expr_sfinae before
4120 build_converted_constant_expr instead of calling
4121 instantiate_non_dependent_expr after it. Add
4122 processing_template_decl_sentinel.
4124 2019-02-22 Thomas Schwinge <thomas@codesourcery.com>
4126 * parser.c (cp_parser_oacc_simple_clause): Remove parser formal
4127 parameter, move loc formal parameter to the front. Adjust all
4129 (cp_parser_oacc_shape_clause): Add loc formal parameter. Adjust
4132 2019-02-21 Jason Merrill <jason@redhat.com>
4134 PR c++/87685 - generic lambda 'this' capture error.
4135 * lambda.c (lambda_expr_this_capture): Change add_capture_p to int.
4136 (maybe_generic_this_capture): Pass -1.
4138 PR c++/88394 - ICE with VLA init-capture.
4139 * lambda.c (is_normal_capture_proxy): Check DECL_CAPTURED_VARIABLE.
4141 PR c++/88869 - C++17 ICE with CTAD and explicit specialization.
4142 * pt.c (do_class_deduction): Don't include explicit specialization
4145 PR c++/89422 - ICE with -g and lambda in default arg in template.
4146 * pt.c (tsubst_function_decl): SET_DECL_FRIEND_CONTEXT sooner.
4148 2019-02-21 Jason Merrill <jason@redhat.com>
4150 PR c++/88419 - C++17 ICE with class template arg deduction.
4151 * pt.c (make_template_placeholder): Set TYPE_CANONICAL after
4152 CLASS_PLACEHOLDER_TEMPLATE.
4154 2019-02-21 Jakub Jelinek <jakub@redhat.com>
4157 * constexpr.c (struct constexpr_fundef): Add parms and result members.
4158 (retrieve_constexpr_fundef): Adjust for the above change.
4159 (register_constexpr_fundef): Save constexpr body with copy_fn,
4160 temporarily set DECL_CONTEXT on DECL_RESULT before that.
4161 (get_fundef_copy): Change FUN argument to FUNDEF with
4162 constexpr_fundef * type, grab body and parms/result out of
4163 constexpr_fundef struct and temporarily change it for copy_fn calls
4165 (cxx_eval_builtin_function_call): For __builtin_FUNCTION temporarily
4166 adjust current_function_decl from ctx->call context. Test
4167 !potential_constant_expression instead of !is_constant_expression.
4168 (cxx_bind_parameters_in_call): Grab parameters from new_call. Undo
4169 convert_for_arg_passing changes for TREE_ADDRESSABLE type passing.
4170 (cxx_eval_call_expression): Adjust get_fundef_copy caller.
4171 (cxx_eval_conditional_expression): For IF_STMT, allow then or else
4172 operands to be NULL.
4173 (label_matches): Handle BREAK_STMT and CONTINUE_STMT.
4174 (cxx_eval_loop_expr): Add support for FOR_STMT, WHILE_STMT and DO_STMT.
4175 (cxx_eval_switch_expr): Add support for SWITCH_STMT.
4176 (cxx_eval_constant_expression): Handle IF_STMT, FOR_STMT, WHILE_STMT,
4177 DO_STMT, CONTINUE_STMT, SWITCH_STMT, BREAK_STMT and CONTINUE_STMT.
4178 For SIZEOF_EXPR, recurse on the result of fold_sizeof_expr. Ignore
4179 DECL_EXPR with USING_DECL operand.
4180 * lambda.c (maybe_add_lambda_conv_op): Build thisarg using
4181 build_int_cst to make it a valid constant expression.
4183 2019-02-20 Jason Merrill <jason@redhat.com>
4185 PR c++/88690 - C++17 ICE with empty base in aggregate.
4186 * typeck2.c (process_init_constructor_record): Skip trivial
4187 initialization of an empty base.
4189 2019-02-21 Richard Biener <rguenther@suse.de>
4192 * vtable-class-hierarchy.c (vtv_generate_init_routine): Do not
4193 make symtab process new functions here.
4195 2019-02-20 Jason Merrill <jason@redhat.com>
4197 PR c++/87921 - wrong error with inline static data member.
4198 * decl2.c (finish_static_data_member_decl): Don't set DECL_IN_AGGR_P
4199 for a non-template inline variable. Do nothing for an
4200 already-instantiated variable.
4201 (c_parse_final_cleanups): Check DECL_IN_AGGR_P without
4203 * decl.c (check_initializer): Likewise.
4204 (make_rtl_for_nonlocal_decl): Likewise.
4205 * pt.c (instantiate_decl): Likewise.
4206 * typeck2.c (store_init_value): Likewise.
4208 2019-02-20 Jakub Jelinek <jakub@redhat.com>
4211 * decl2.c (c_parse_final_cleanups): Move TREE_ASM_WRITTEN setting
4212 for flag_syntax_only from here...
4213 * semantics.c (expand_or_defer_fn_1): ... here.
4216 * decl.c (maybe_commonize_var): When clearing TREE_PUBLIC and
4217 DECL_COMMON, set DECL_INTERFACE_KNOWN.
4220 * constexpr.c (cxx_eval_store_expression): Diagnose changing of active
4221 union member for -std=c++17 and earlier.
4223 2019-02-19 Jason Merrill <jason@redhat.com>
4225 PR c++/87513 - 'sorry' mangling PMF template-id.
4226 * mangle.c (write_expression): Handle SCOPE_REF to BASELINK.
4228 2019-02-19 Jason Merrill <jason@redhat.com>
4230 PR c++/88380 - wrong-code with flexible array and NSDMI.
4231 * typeck2.c (process_init_constructor_record): Skip flexarrays.
4233 2019-02-20 will wray <wjwray@gmail.com>
4235 PR c++/88572 - wrong handling of braces on scalar init.
4236 * decl.c (reshape_init_r): Allow braces around scalar initializer
4237 within aggregate init. Reject double braced-init of scalar
4240 2019-02-20 Paolo Carlini <paolo.carlini@oracle.com>
4243 * pt.c (tsubst_init): Diagnose an initializer expanding to an
4244 empty list of expressions; tweak wrt dependent types.
4245 (regenerate_decl_from_template): For VAR_DECLs call tsubst_init
4246 instead of tsubst_expr.
4248 2019-02-19 Jason Merrill <jason@redhat.com>
4250 PR c++/88368 - wrong 'use of deleted function'
4251 * method.c (walk_field_subobs): Remember errors from get_nsdmi.
4252 (get_defaulted_eh_spec): Call push_tinst_level.
4253 * pt.c (maybe_instantiate_noexcept): Keep error_mark_node.
4254 * typeck2.c (merge_exception_specifiers): Handle error_mark_node.
4256 2019-02-19 Chung-Lin Tang <cltang@codesourcery.com>
4259 * parser.c (cp_parser_oacc_clause_wait): Add representation of wait
4260 clause without argument as 'wait (GOMP_ASYNC_NOVAL)', adjust comments.
4262 2019-02-19 Jakub Jelinek <jakub@redhat.com>
4265 * lambda.c (maybe_generic_this_capture): Don't check
4266 DECL_NONSTATIC_MEMBER_FUNCTION_P on USING_DECLs.
4269 * typeck.c (build_reinterpret_cast_1): Don't handle void to
4270 && conversion go through build_target_expr_with_type.
4273 * error.c (qualified_name_lookup_error): Only call
4274 suggest_alternative_in_scoped_enum if name is IDENTIFIER_NODE.
4276 2019-02-19 Tom Honermann <tom@honermann.net>
4278 * name-lookup.c (get_std_name_hint): Added u8string as a name hint.
4280 2019-02-18 Jason Merrill <jason@redhat.com>
4282 PR c++/89336 - multiple stores in constexpr stmt.
4283 * constexpr.c (cxx_eval_store_expression): Preevaluate scalar or
4286 * pt.c (check_explicit_specialization): If the declarator is a
4287 template-id, only check whether the arguments are dependent.
4289 Improve duplicate [[likely]] diagnostic.
4290 * parser.c (cp_parser_statement): Make attrs_loc a range. Pass it
4291 to process_stmt_hotness_attribute.
4292 * cp-gimplify.c (process_stmt_hotness_attribute): Take attrs_loc.
4293 (genericize_if_stmt): Use likely/unlikely instead of predictor_name.
4295 2019-02-17 Marek Polacek <polacek@redhat.com>
4297 PR c++/89217 - ICE with list-initialization in range-based for loop.
4298 * constexpr.c (unshare_constructor): No longer static.
4299 * cp-tree.h (unshare_constructor): Declare.
4300 * semantics.c (finish_compound_literal): When dealing with a
4301 non-dependent expression in a template, return the original
4302 expression. Pass LOOKUP_NO_NARROWING to digest_init_flags.
4304 2019-02-13 Marek Polacek <polacek@redhat.com>
4306 PR c++/89297 - ICE with OVERLOAD in template.
4307 * semantics.c (finish_compound_literal): Call
4308 instantiate_non_dependent_expr_sfinae.
4310 2019-02-13 Alexandre Oliva <aoliva@redhat.com>
4313 * cp-tree.h (USING_DECL_SCOPE): Use result rather than type.
4314 * name-lookup.c (strip_using_decl): Use USING_DECL_SCOPE.
4315 * search.c (protected_accessible_p): Follow USING_DECL_DECLS.
4316 (shared_member_p): Likewise.
4317 (lookup_member): Likewise.
4318 * decl.c (grok_special_member_properties): Skip USING_DECLs.
4319 * semantics.c (finish_omp_declare_simd_methods): Likewise.
4320 (finish_qualified_id_expr): Do not call shared_member_p with
4324 * pt.c (tsubst_lambda_expr): Avoid duplicate tsubsting.
4325 Move cp_evaluated resetting before signature tsubsting.
4326 (gen_elem_of_pack_expansion_instantiation): Separate local
4327 specializations per index.
4329 2019-02-13 David Malcolm <dmalcolm@redhat.com>
4332 * class.c (add_method): Drop destructor assertion.
4334 2019-02-13 Paolo Carlini <paolo.carlini@oracle.com>
4337 * decl.c (make_typename_type): Allow for TYPE_PACK_EXPANSION as
4338 context (the first argument).
4339 * pt.c (tsubst, case TYPENAME_TYPE): Handle TYPE_PACK_EXPANSION
4342 2019-02-12 Jason Merrill <jason@redhat.com>
4344 PR c++/89144 - link error with constexpr initializer_list.
4345 * call.c (convert_like_real) [ck_list]: Don't allocate a temporary
4346 array for an empty list.
4347 * typeck2.c (store_init_value): Don't use cxx_constant_init in a
4350 2019-02-11 Jason Merrill <jason@redhat.com>
4352 PR c++/89241 - ICE with __func__ in lambda in template.
4353 * pt.c (enclosing_instantiation_of): Also check
4354 instantiated_lambda_fn_p for the template context.
4356 2019-02-11 Marek Polacek <polacek@redhat.com>
4358 PR c++/89212 - ICE converting nullptr to pointer-to-member-function.
4359 * pt.c (tsubst_copy_and_build) <case CONSTRUCTOR>: Return early for
4360 null member pointer value.
4362 2019-02-11 Jakub Jelinek <jakub@redhat.com>
4365 * pt.c (convert_nontype_argument): Pass true as manifestly_const_eval
4366 to maybe_constant_value calls.
4368 2019-02-11 Marek Polacek <polacek@redhat.com>
4370 * typeck2.c (digest_init_r): Remove commented code.
4372 2019-02-11 Martin Sebor <msebor@redhat.com>
4375 * decl.c (compute_array_index_type_loc): Preserve signed sizes
4376 for diagnostics. Call valid_array_size_p instead of error.
4377 * init.c (build_new_1): Compute size for diagnostic. Call
4378 invalid_array_size_error
4379 (build_new): Call valid_array_size_p instead of error.
4381 2019-02-07 Alexandre Oliva <aoliva@redhat.com>
4384 * call.c (compare_ics): Deal with ck_aggr in either cs.
4386 2019-02-06 David Malcolm <dmalcolm@redhat.com>
4389 * call.c (get_location_for_expr_unwinding_for_system_header): New
4391 (conversion_null_warnings): Use it when getting locations for
4392 EXPR, effectively adding a call to
4393 get_location_for_expr_unwinding_for_system_header for
4394 -Wconversion-null and making use of EXPR_LOCATION for
4395 -Wzero-as-null-pointer-constant.
4397 2019-02-05 Jakub Jelinek <jakub@redhat.com>
4400 * optimize.c (maybe_thunk_body): Clear TREE_ADDRESSABLE on
4401 PARM_DECLs of the thunk.
4402 * lambda.c (maybe_add_lambda_conv_op): Likewise.
4404 2019-02-05 Marek Polacek <polacek@redhat.com>
4406 PR c++/89158 - by-value capture of constexpr variable broken.
4407 * call.c (convert_like_real) <case ck_user>: Call mark_exp_read
4408 instead of mark_rvalue_use.
4410 2019-02-05 Alexandre Oliva <aoliva@redhat.com>
4413 * pt.c (instantiates_primary_template_p): New.
4414 (type_dependent_expression_p): Use it.
4416 2019-02-01 Jason Merrill <jason@redhat.com>
4418 PR c++/88761 - ICE with reference capture of constant.
4419 * lambda.c (mark_const_cap_r): Do walk subtrees of DECL_EXPR for
4422 2019-02-01 Marek Polacek <polacek@redhat.com>
4424 PR c++/88325 - ICE with invalid out-of-line template member definition.
4425 * parser.c (cp_parser_class_name): Don't call make_typename_type
4428 2019-02-01 Jakub Jelinek <jakub@redhat.com>
4431 * parser.c (cp_parser_gnu_attributes_opt): Set ok to false
4432 if require_open failed.
4434 2019-01-31 Marek Polacek <polacek@redhat.com>
4436 PR c++/89083, c++/80864 - ICE with list initialization in template.
4437 * constexpr.c (adjust_temp_type): Use copy_node and change the type
4438 instead of using build_constructor.
4439 * decl.c (reshape_init_r): Don't reshape a digested initializer.
4440 Return the initializer for COMPOUND_LITERAL_P.
4442 PR c++/88983 - ICE with switch in constexpr function.
4443 * constexpr.c (cxx_eval_switch_expr): Use SWITCH_COND and SWITCH_BODY.
4444 (cxx_eval_constant_expression) <case COND_EXPR>: Don't look for the
4445 label in the else branch if we found it in the then branch.
4447 2019-01-30 Jason Merrill <jason@redhat.com>
4449 PR c++/88752 - ICE with lambda and constexpr if.
4450 * cp-tree.h (LAMBDA_EXPR_INSTANTIATED): New.
4451 * pt.c (tsubst_lambda_expr): Set it.
4452 (instantiated_lambda_fn_p): Check it.
4453 (enclosing_instantiation_of): Use it.
4455 2019-01-31 Jakub Jelinek <jakub@redhat.com>
4458 * cxx-pretty-print.c (pp_cxx_enumeration_constant): Print always as
4459 a C cast in pp_c_flag_gnu_v3 mode.
4461 2019-01-30 Jakub Jelinek <jakub@redhat.com>
4464 * lambda.c (is_capture_proxy): Don't return true for
4465 DECL_OMP_PRIVATIZED_MEMBER artificial vars.
4467 2019-01-30 Marek Polacek <polacek@redhat.com>
4469 PR c++/89119 - ICE with value-initialization in template.
4470 * pt.c (tsubst_copy_and_build): Handle RANGE_EXPR.
4472 2019-01-29 Jason Merrill <jason@redhat.com>
4474 PR c++/86943 - wrong code converting lambda to function pointer.
4475 * lambda.c (maybe_add_lambda_conv_op): Use a template-id in the
4476 call. Only forward parms for decltype.
4477 * pt.c (tsubst_copy_and_build) [CALL_EXPR]: Handle CALL_FROM_THUNK_P
4479 * typeck.c (check_return_expr): Don't mess with a thunk call.
4481 2019-01-28 Jason Merrill <jason@redhat.com>
4483 PR c++/89089 - ICE with [[no_unique_address]].
4484 PR c++/88865 - wrong layout with [[no_unique_address]].
4485 * class.c (check_field_decls): A potentially-overlapping field makes
4486 the class non-layout-POD, but not non-empty.
4487 (end_of_class): Always consider empty data members.
4488 (layout_class_type): Set DECL_SIZE for empty fields.
4490 2019-01-28 Marek Polacek <polacek@redhat.com>
4492 PR c++/88358 - name wrongly treated as type.
4493 * parser.c (cp_parser_direct_declarator): Don't assume a qualified-id
4494 in parameter-list is a type if the function's declarator-id is not
4497 2019-01-27 Marek Polacek <polacek@redhat.com>
4499 PR c++/88815 - narrowing conversion lost in decltype.
4500 PR c++/78244 - narrowing conversion in template not detected.
4501 * cp-tree.h (CONSTRUCTOR_IS_DEPENDENT): New.
4502 * pt.c (instantiation_dependent_r): Consider a CONSTRUCTOR with
4503 CONSTRUCTOR_IS_DEPENDENT instantiation-dependent.
4504 * semantics.c (finish_compound_literal): When the compound literal
4505 isn't instantiation-dependent and the type isn't type-dependent,
4506 fall back to the normal processing. Set CONSTRUCTOR_IS_DEPENDENT.
4508 PR c++/89024 - ICE with incomplete enum type.
4509 * call.c (standard_conversion): When converting an
4510 ARITHMETIC_TYPE_P to an incomplete type, return NULL.
4512 2019-01-25 Paolo Carlini <paolo.carlini@oracle.com>
4515 * call.c (build_op_delete_call): Implement 7.6.2.5/(10.1).
4516 * decl2.c (coerce_delete_type): Use build_pointer_type instead
4519 2019-01-24 Jason Merrill <jason@redhat.com>
4521 PR c++/89001 - mangling of reference temporaries
4522 * cp-tree.h (struct saved_scope): Add ref_temp_count.
4523 (current_ref_temp_count): New macro.
4524 * mangle.c (mangle_ref_init_variable): Use it.
4525 * typeck2.c (store_init_value): Clear it.
4526 * call.c (make_temporary_var_for_ref_to_temp): Copy public and
4529 2019-01-24 Jakub Jelinek <jakub@redhat.com>
4532 * semantics.c (finish_omp_cancel): Diagnose more than one if
4533 on #pragma omp cancel with different modifiers. Use
4534 maybe_convert_cond when not in template or build_x_binary_op
4537 2019-01-23 Marek Polacek <polacek@redhat.com>
4539 PR c++/88757 - qualified name treated wrongly as type.
4540 * parser.c (cp_parser_direct_declarator): Don't treat qualified-ids
4541 in parameter-list as types if name lookup for declarator-id didn't
4542 find one or more function templates.
4544 2019-01-23 Jakub Jelinek <jakub@redhat.com>
4547 * cp-gimplify.c (genericize_cp_loop): Call begin_bc_block only
4548 after genericizing cond and incr expressions.
4551 * cp-gimplify.c (genericize_switch_stmt): Move cond genericization
4552 before the begin_bc_block call.
4554 2019-01-21 Jason Merrill <jason@redhat.com>
4556 PR c++/87893 - constexpr ctor ICE on ARM.
4557 PR c++/88293 - ICE with comma expression.
4558 * constexpr.c (initialized_type): Don't shortcut non-void type.
4559 Handle COMPOUND_EXPR.
4560 (cxx_eval_outermost_constant_expr): Return early for void type.
4562 2019-01-21 Jakub Jelinek <jakub@redhat.com>
4565 * optimize.c (cxx_copy_decl): New function.
4566 (clone_body): Use it instead of copy_decl_no_change.
4569 * typeck.c (cp_build_binary_op): Don't instrument
4570 SANITIZE_POINTER_COMPARE if processing_template_decl.
4571 (pointer_diff): Similarly for SANITIZE_POINTER_SUBTRACT.
4573 2019-01-18 Jason Merrill <jason@redhat.com>
4575 PR c++/88875 - error with explicit list constructor.
4576 * call.c (reference_binding): Don't modify EXPR. Set
4577 need_temporary_p on the ck_user conversion for a temporary.
4578 (convert_like_real): Check it.
4580 2019-01-18 H.J. Lu <hongjiu.lu@intel.com>
4584 * call.c (convert_for_arg_passing): Upate the
4585 warn_for_address_or_pointer_of_packed_member call.
4586 * typeck.c (convert_for_assignment): Likewise.
4588 2019-01-17 Jason Merrill <jason@redhat.com>
4590 PR c++/86205 - ICE with ?: of throw and template-id.
4591 * pt.c (resolve_nondeduced_context_or_error): Split out from...
4592 * typeck.c (decay_conversion): ...here.
4593 * call.c (build_conditional_expr_1): Use it.
4595 PR c++/86740, ICE with constexpr if and nested generic lambdas.
4596 * tree.c (cp_walk_subtrees): Handle LAMBDA_EXPR.
4598 2019-01-17 Paolo Carlini <paolo.carlini@oracle.com>
4600 * decl.c (grokdeclarator): Use typespec_loc in error messages
4601 about 'auto' and trailing return type.
4603 2019-01-17 David Malcolm <dmalcolm@redhat.com>
4606 * class.c (add_method): Don't use DECL_DESTRUCTOR_P on
4609 2019-01-17 Nathan Sidwell <nathan@acm.org>
4612 * semantics.c (process_outer_var_ref): Only skip dependent types
4615 2019-01-17 Alexandre Oliva <aoliva@redhat.com>
4618 * cp-tree.h (saved_scope): Add suppress_location_wrappers.
4619 * name-lookup.c (do_push_to_top_level): Save and reset it.
4620 (do_pop_from_top_level): Restore it.
4623 * pt.c (make_template_placeholder): Use auto_identifier.
4624 (is_auto): Drop CLASS_PLACEHOLDER_TEMPLATE test.
4625 * error.c (dump_type): Handle template placeholders.
4626 * cxx-pretty-print.c (pp_cx_unqualified_id): Likewise.
4629 * cvt.c (convert_to_void): Handle all cdtor calls as if
4632 2019-01-16 Paolo Carlini <paolo.carlini@oracle.com>
4634 * decl.c (grokdeclarator): Use locations[ds_storage_class] in
4635 error messages about ill-formed uses of mutable.
4637 2019-01-16 Marek Polacek <polacek@redhat.com>
4639 PR c++/78244 - narrowing conversion in template not detected.
4640 * call.c (perform_implicit_conversion_flags): Set
4641 IMPLICIT_CONV_EXPR_BRACED_INIT.
4642 * cp-tree.h (IMPLICIT_CONV_EXPR_BRACED_INIT): New.
4643 * pt.c (tsubst_copy_and_build): Use it.
4645 2019-01-15 David Malcolm <dmalcolm@redhat.com>
4648 * pt.c (build_deduction_guide): Bail out if tsubst_arg_types
4651 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com>
4653 * decl.c (start_decl): Improve error location.
4654 * decl2.c (grokfield): Likewise.
4656 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com>
4658 * decl.c (grokdeclarator): Move further up the location_t loc
4659 declaration and use the location when building a TYPE_DECL for
4661 * decl2.c (grokbitfield): Use DECL_SOURCE_LOCATION in the error
4662 about an ill-formed bit-field as typedef.
4664 2019-01-14 Marek Polacek <polacek@redhat.com>
4666 PR c++/88830 - ICE with abstract class.
4667 * decl2.c (maybe_emit_vtables): Check CLASSTYPE_LAZY_DESTRUCTOR.
4670 PR c++/88825 - ICE with bogus function return type deduction.
4671 * typeck.c (can_do_nrvo_p): Check error_mark_node.
4673 2019-01-14 Tom Honermann <tom@honermann.net>
4675 Implement P0482R5, char8_t: A type for UTF-8 characters and strings
4676 * cvt.c (type_promotes_to): Handle char8_t promotion.
4677 * decl.c (grokdeclarator): Handle invalid type specifier
4678 combinations involving char8_t.
4679 * lex.c (init_reswords): Add char8_t as a reserved word.
4680 * mangle.c (write_builtin_type): Add name mangling for char8_t (Du).
4681 * parser.c (cp_keyword_starts_decl_specifier_p)
4682 (cp_parser_simple_type_specifier): Recognize char8_t as a simple
4684 (cp_parser_string_literal): Use char8_array_type_node for the type
4686 (cp_parser_set_decl_spec_type): Tolerate char8_t typedefs in system
4688 * rtti.c (emit_support_tinfos): type_info support for char8_t.
4689 * tree.c (char_type_p): Recognize char8_t as a character type.
4690 * typeck.c (string_conv_p): Handle conversions of u8 string
4691 literals of char8_t type.
4692 (check_literal_operator_args): Handle UDLs with u8 string literals
4694 * typeck2.c (ordinary_char_type_p): New.
4695 (digest_init_r): Disallow initializing a char array with a u8 string
4698 2019-01-14 Martin Liska <mliska@suse.cz>
4700 PR gcov-profile/88263
4701 * decl2.c (get_tls_wrapper_fn): Use DECL_SOURCE_LOCATION
4702 as location of the TLS wrapper.
4704 2019-01-12 Paolo Carlini <paolo.carlini@oracle.com>
4706 * decl.c (cp_finish_decl): Improve error location.
4707 * decl2.c (grokfield): Likewise, improve two locations.
4709 2019-01-11 Marek Polacek <polacek@redhat.com>
4711 PR c++/88692, c++/87882 - -Wredundant-move false positive with *this.
4712 * typeck.c (maybe_warn_pessimizing_move): Return if ARG isn't
4715 2019-01-11 Jason Merrill <jason@redhat.com>
4717 PR c++/88312 - pack expansion of decltype.
4718 * pt.c (instantiation_dependent_r): A template non-type parameter
4719 pack is instantiation-dependent.
4721 2019-01-11 Jason Merrill <jason@redhat.com>
4723 PR c++/88613 - ICE with use of const var in lambda.
4724 * expr.c (mark_use): Fix location wrapper handling.
4725 * cp-gimplify.c (cp_fold_maybe_rvalue): Call mark_rvalue_use.
4727 2019-01-11 Tobias Burnus <burnus@net-b.de>
4730 * decl2.c (maybe_emit_vtables): If needed, generate code for
4731 the destructor of an abstract class.
4732 (mark_used): Update comment for older function-name change.
4734 2019-01-11 Paolo Carlini <paolo.carlini@oracle.com>
4736 * decl.c (start_decl): Improve error location.
4737 (grokdeclarator): Likewise, improve two locations.
4739 2019-01-09 Sandra Loosemore <sandra@codesourcery.com>
4743 * cp-tree.h: Mechanically replace "can not" with "cannot".
4744 * parser.c: Likewise.
4747 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com>
4749 * decl.c (grok_reference_init): Improve error location.
4750 (grokdeclarator): Likewise, improve two locations.
4752 2019-01-08 Marek Polacek <polacek@redhat.com>
4754 PR c++/88538 - braced-init-list in template-argument-list.
4755 * parser.c (cp_parser_template_argument): Handle braced-init-list when
4758 PR c++/88548 - this accepted in static member functions.
4759 * parser.c (cp_debug_parser): Adjust printing of
4760 local_variables_forbidden_p.
4761 (cp_parser_new): Set local_variables_forbidden_p to 0 rather than false.
4762 (cp_parser_primary_expression): When checking
4763 local_variables_forbidden_p, use THIS_FORBIDDEN or
4764 LOCAL_VARS_FORBIDDEN.
4765 (cp_parser_lambda_body): Update the type of
4766 local_variables_forbidden_p. Set it to 0 rather than false.
4767 (cp_parser_condition): Adjust call to cp_parser_declarator.
4768 (cp_parser_explicit_instantiation): Likewise.
4769 (cp_parser_init_declarator): Likewise.
4770 (cp_parser_declarator): New parameter. Use it.
4771 (cp_parser_direct_declarator): New parameter. Use it to set
4772 local_variables_forbidden_p. Adjust call to cp_parser_declarator.
4773 (cp_parser_type_id_1): Adjust call to cp_parser_declarator.
4774 (cp_parser_parameter_declaration): Likewise.
4775 (cp_parser_default_argument): Update the type of
4776 local_variables_forbidden_p. Set it to LOCAL_VARS_AND_THIS_FORBIDDEN
4778 (cp_parser_member_declaration): Tell cp_parser_declarator if we saw
4779 'static' or 'friend'.
4780 (cp_parser_exception_declaration): Adjust call to cp_parser_declarator.
4781 (cp_parser_late_parsing_default_args): Update the type of
4782 local_variables_forbidden_p. Set it to LOCAL_VARS_AND_THIS_FORBIDDEN
4784 (cp_parser_cache_defarg): Adjust call to cp_parser_declarator.
4785 (cp_parser_objc_class_ivars): Likewise.
4786 (cp_parser_objc_struct_declaration): Likewise.
4787 (cp_parser_omp_for_loop_init): Likewise.
4788 * parser.h (cp_parser): Change the type of local_variables_forbidden_p
4790 (LOCAL_VARS_FORBIDDEN, LOCAL_VARS_AND_THIS_FORBIDDEN, THIS_FORBIDDEN):
4793 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com>
4795 * decl.c (start_decl): Improve permerror location.
4797 2019-01-08 Jonathan Wakely <jwakely@redhat.com>
4798 Jakub Jelinek <jakub@redhat.com>
4801 * decl.c (finish_function): For -Wreturn-type don't add a return *this;
4802 fixit hint if current_class_ref is NULL. Use a single if instead of
4805 2019-01-07 Paolo Carlini <paolo.carlini@oracle.com>
4807 * decl.c (start_decl): Improve two error_at locations.
4808 (expand_static_init): Likewise.
4810 2019-01-07 Marek Polacek <polacek@redhat.com>
4812 PR c++/88741 - wrong error with initializer-string.
4813 * decl.c (cp_complete_array_type): Strip any location wrappers.
4815 2019-01-07 Bernd Edlinger <bernd.edlinger@hotmail.de>
4821 * cp-tree.h (LOOKUP_ALLOW_FLEXARRAY_INIT): New flag value.
4822 * typeck2.c (digest_init_r): Raise an error for non-static
4823 initialization of a flexible array member.
4824 (process_init_constructor, massage_init_elt,
4825 process_init_constructor_array, process_init_constructor_record,
4826 process_init_constructor_union, process_init_constructor): Add the
4827 flags parameter and pass it thru.
4828 (store_init_value): Pass LOOKUP_ALLOW_FLEXARRAY_INIT parameter to
4829 digest_init_flags for static decls.
4831 2019-01-07 Jakub Jelinek <jakub@redhat.com>
4834 * cp-tree.h (cp_build_vec_convert): Declare.
4835 * parser.c (cp_parser_postfix_expression): Parse
4836 __builtin_convertvector.
4837 * constexpr.c: Include fold-const-call.h.
4838 (cxx_eval_internal_function): Handle IFN_VEC_CONVERT.
4839 (potential_constant_expression_1): Likewise.
4840 * semantics.c (cp_build_vec_convert): New function.
4841 * pt.c (tsubst_copy_and_build): Handle CALL_EXPR to
4844 2019-01-03 Jakub Jelinek <jakub@redhat.com>
4847 * decl.c (builtin_function_1): Return result of pushdecl_top_level
4848 or pushdecl rather than decl.
4850 2019-01-03 Paolo Carlini <paolo.carlini@oracle.com>
4852 * tree.c (handle_nodiscard_attribute): Improve warning location.
4854 2019-01-02 Marek Polacek <polacek@redhat.com>
4856 PR c++/88612 - ICE with -Waddress-of-packed-member.
4857 * call.c (convert_for_arg_passing): Only give warnings with tf_warning.
4858 * typeck.c (convert_for_assignment): Likewise.
4860 PR c++/88631 - CTAD failing for value-initialization.
4861 * typeck2.c (build_functional_cast): Try deducing the template
4862 arguments even if there are no arguments to deduce from.
4864 2019-01-01 Jakub Jelinek <jakub@redhat.com>
4866 Update copyright years.
4868 Copyright (C) 2019 Free Software Foundation, Inc.
4870 Copying and distribution of this file, with or without modification,
4871 are permitted in any medium without royalty provided the copyright
4872 notice and this notice are preserved.