1 2019-11-14 Jason Merrill <jason@redhat.com>
3 Implement P1816R0, class template argument deduction for aggregates.
4 * pt.c (maybe_aggr_guide, collect_ctor_idx_types): New.
5 (is_spec_or_derived): Split out from do_class_deduction.
6 (build_deduction_guide): Handle aggregate guide.
7 * class.c (finish_struct): Set CLASSTYPE_NON_AGGREGATE in a
9 * cp-tree.h (CP_AGGREGATE_TYPE_P): An incomplete class is not an
12 2019-11-14 Richard Sandiford <richard.sandiford@arm.com>
14 * call.c (build_conditional_expr_1): Use truth_type_for instead
15 of build_same_sized_truth_vector_type.
16 * typeck.c (build_vec_cmp): Likewise.
18 2019-11-14 Jakub Jelinek <jakub@redhat.com>
20 * parser.c (cp_parser_omp_context_selector): Don't require score
21 argument to fit into shwi, just to be INTEGER_CST. Diagnose
23 * pt.c (tsubst_attribute): Likewise.
25 * parser.c (cp_parser_omp_context_selector): Rename
26 CTX_PROPERTY_IDLIST to CTX_PROPERTY_NAME_LIST, add CTX_PROPERTY_ID.
27 Use CTX_PROPERTY_ID for atomic_default_mem_order, only allow a single
28 identifier in that. For CTX_PROPERTY_NAME_LIST, allow identifiers
30 * pt.c (tsubst_attribute): Fix up STRING_CST handling if allow_string.
32 2019-11-13 Marek Polacek <polacek@redhat.com>
34 PR c++/89070 - bogus [[nodiscard]] warning in SFINAE.
35 * cvt.c (convert_to_void): Guard maybe_warn_nodiscard calls with
38 2019-11-13 Richard Sandiford <richard.sandiford@arm.com>
41 * cp-tree.h (STF_STRIP_DEPENDENT): New constant.
42 * tree.c (strip_typedefs): Add STF_STRIP_DEPENDENT to the flags
43 when calling strip_typedefs recursively on a DECL_ORIGINAL_TYPE.
44 Don't apply the fix for DR1558 in that case; allow aliases with
45 dependent template parameters to be stripped instead.
47 2019-11-12 Nathan Sidwell <nathan@acm.org>
49 * name-lookup.c (lookup_using_decl): New function, merged from ...
50 (do_class_using_decl): ... here. Call it. And ...
51 (finish_nonmember_using_decl): ... here. Call it.
53 2019-11-12 Martin Liska <mliska@suse.cz>
55 * name-lookup.c: Do not include params.h.
58 2019-11-12 Martin Liska <mliska@suse.cz>
60 * name-lookup.c (namespace_hints::namespace_hints): Replace old
61 parameter syntax with the new one, include opts.h if needed. Use
62 SET_OPTION_IF_UNSET macro.
63 * typeck.c (comptypes): Likewise.
65 2019-11-12 Maciej W. Rozycki <macro@codesourcery.com>
66 Frederik Harwath <frederik@codesourcery.com>
69 * constexpr.c (potential_constant_expression_1): Handle
71 * parser.c (OACC_SERIAL_CLAUSE_MASK): New macro.
72 (cp_parser_oacc_kernels_parallel): Rename function to...
73 (cp_parser_oacc_compute): ... this. Handle PRAGMA_OACC_SERIAL.
74 (cp_parser_omp_construct): Update accordingly.
75 (cp_parser_pragma): Handle PRAGMA_OACC_SERIAL. Fix alphabetic
77 * pt.c (tsubst_expr): Handle OACC_SERIAL.
79 2019-11-11 Jason Merrill <jason@redhat.com>
81 Implement P1946R0, Allow defaulting comparisons by value.
82 * method.c (early_check_defaulted_comparison): Accept by-value,
83 reject mixed by-value and by-reference parms.
84 * decl.c (grokdeclarator): Set funcdef_flag for defaulted friend.
85 * decl2.c (grokfield): Don't SET_DECL_FRIEND_CONTEXT.
87 * typeck.c (cp_build_binary_op): Sorry about <=> on VECTOR_TYPE.
89 2019-11-11 Jakub Jelinek <jakub@redhat.com>
92 * decl.c (finish_function): Move ctype initialization before
93 DECL_DELETED_FN handling.
95 * semantics.c (finish_translation_unit): Diagnose declare target
96 without corresponding end declare target.
98 2019-11-10 Jason Merrill <jason@redhat.com>
100 Implement D1957R0, T* to bool should be considered narrowing.
101 * typeck2.c (check_narrowing): Treat pointer->bool as a narrowing
102 conversion with -std=c++2a.
104 2019-11-08 Marek Polacek <polacek@redhat.com>
106 PR c++/92215 - flawed diagnostic for bit-field with non-integral type.
107 * parser.c (cp_parser_member_declaration): Add a diagnostic for
108 bit-fields with non-integral types.
110 2019-11-08 Jakub Jelinek <jakub@redhat.com>
112 * init.c (build_vec_delete_1): Fix a comment typo - mist -> must.
114 2019-11-07 Jason Merrill <jason@redhat.com>
116 Implement D1959R0, remove weak_equality and strong_equality.
117 * method.c (enum comp_cat_tag, comp_cat_info): Remove *_equality.
118 (genericize_spaceship, common_comparison_type): Likewise.
119 * typeck.c (cp_build_binary_op): Move SPACESHIP_EXPR to be with the
120 relational operators, exclude other types no longer supported.
122 2019-11-06 Jason Merrill <jason@redhat.com>
124 Implement D1907R1 "structural type".
125 * tree.c (structural_type_p): New.
126 * pt.c (invalid_nontype_parm_type_p): Use it.
127 * class.c (build_base_field_1): Take binfo. Copy TREE_PRIVATE.
128 (build_base_field): Pass binfo.
130 PR c++/92150 - partial specialization with class NTTP.
131 * pt.c (unify): Handle VIEW_CONVERT_EXPR.
133 * pt.c (use_pack_expansion_extra_args_p): Still do substitution if
134 all packs are simple pack expansions.
135 (add_extra_args): Check that the extra args aren't dependent.
137 2019-11-06 Andrew Sutton <asutton@lock3software.com>
139 Use satisfaction with nested requirements.
140 * constraint.cc (build_parameter_mapping): Use
141 current_template_parms when the declaration is not available.
142 (norm_info::norm_info) Make explicit.
143 (normalize_constraint_expression): Factor into a separate overload
144 that takes arguments, and use that in the original function.
145 (tsubst_nested_requirement): Use satisfy_constraint instead of
146 trying to evaluate this as a constant expression.
147 (finish_nested_requirement): Keep the normalized constraint and the
148 original normalization arguments with the requirement.
149 (diagnose_nested_requirement): Use satisfy_constraint. Tentatively
150 implement more comprehensive diagnostics, but do not enable.
151 * parser.c (cp_parser_requires_expression): Relax requirement that
152 requires-expressions can live only inside templates.
153 * pt.c (any_template_parm_r): Look into type of PARM_DECL.
155 2019-11-06 Jason Merrill <jason@redhat.com>
157 C++20 NB CA378 - Remove constrained non-template functions.
158 * decl.c (grokfndecl): Reject constraints on non-templated function.
160 2019-11-06 Matthias Kretz <m.kretz@gsi.de>
162 * parser.c (cp_parser_operator): Parse operator?: as an
163 attempt to overload the conditional operator.
165 2019-11-05 Jason Merrill <jason@redhat.com>
167 Implement C++20 operator<=>.
168 * cp-tree.h (struct lang_decl_fn): Add maybe_deleted bitfield.
169 (DECL_MAYBE_DELETED): New.
170 (enum special_function_kind): Add sfk_comparison.
171 (LOOKUP_REWRITTEN, LOOKUP_REVERSED): New.
172 * call.c (struct z_candidate): Add rewritten and reversed methods.
173 (add_builtin_candidate): Handle SPACESHIP_EXPR.
174 (add_builtin_candidates): Likewise.
175 (add_candidates): Don't add a reversed candidate if the parms are
177 (add_operator_candidates): Split out from build_new_op_1. Handle
178 rewritten and reversed candidates.
179 (add_candidate): Swap conversions of reversed candidate.
180 (build_new_op_1): Swap them back. Build a second operation for
181 rewritten candidates.
182 (extract_call_expr): Handle rewritten calls.
183 (same_fn_or_template): New.
184 (joust): Handle rewritten and reversed candidates.
185 * class.c (add_implicitly_declared_members): Add implicit op==.
186 (classtype_has_op, classtype_has_defaulted_op): New.
187 * constexpr.c (cxx_eval_binary_expression): Handle SPACESHIP_EXPR.
188 (cxx_eval_constant_expression, potential_constant_expression_1):
190 * cp-gimplify.c (genericize_spaceship): New.
191 (cp_genericize_r): Use it.
192 * cp-objcp-common.c (cp_common_init_ts): Handle SPACESHIP_EXPR.
193 * decl.c (finish_function): Handle deleted function.
194 * decl2.c (grokfield): SET_DECL_FRIEND_CONTEXT on defaulted friend.
195 (mark_used): Check DECL_MAYBE_DELETED. Remove assumption that
196 defaulted functions are non-static members.
197 * error.c (dump_expr): Handle SPACESHIP_EXPR.
198 * method.c (type_has_trivial_fn): False for sfk_comparison.
199 (enum comp_cat_tag, struct comp_cat_info_t): New types.
200 (comp_cat_cache): New array variable.
201 (lookup_comparison_result, lookup_comparison_category)
202 (is_cat, cat_tag_for, spaceship_comp_cat)
203 (spaceship_type, genericize_spaceship)
204 (common_comparison_type, early_check_defaulted_comparison)
205 (comp_info, build_comparison_op): New.
206 (synthesize_method): Handle sfk_comparison. Handle deleted.
207 (get_defaulted_eh_spec, maybe_explain_implicit_delete)
208 (explain_implicit_non_constexpr, implicitly_declare_fn)
209 (defaulted_late_check, defaultable_fn_check): Handle sfk_comparison.
210 * name-lookup.c (get_std_name_hint): Add comparison categories.
211 * tree.c (special_function_p): Add sfk_comparison.
212 * typeck.c (cp_build_binary_op): Handle SPACESHIP_EXPR.
214 2019-11-05 Tim van Deurzen <tim@kompiler.org>
216 Add new tree code for the spaceship operator.
217 * cp-tree.def: Add new tree code.
218 * operators.def: New binary operator.
219 * parser.c: Add new token and tree code.
221 2019-09-15 Jason Merrill <jason@redhat.com>
223 * call.c (build_new_op_1): Don't apply any standard conversions to
224 the operands of a built-in operator. Don't suppress conversions in
226 * typeck.c (cp_build_unary_op): Do integral promotions for enums.
228 2019-11-04 Jason Merrill <jason@redhat.com>
230 Use vec instead of raw array for built-in candidates.
231 * call.c (build_builtin_candidate): Take args in a vec.
232 (add_builtin_candidate, add_builtin_candidates): Likewise.
233 (build_conditional_expr_1, build_new_op_1): Adjust.
235 2019-11-04 Jason Merrill <jason@redhat.com>
237 * constexpr.c (explain_invalid_constexpr_fn): Show location of fn.
239 * pt.c (maybe_instantiate_noexcept): Only update clones if we
242 * typeck.c (contextual_conv_bool): New.
244 * name-lookup.c (lookup_qualified_name): Add wrapper overload taking
245 C string rather than identifier.
246 * parser.c (cp_parser_userdef_numeric_literal): Use it.
247 * rtti.c (emit_support_tinfos): Use it.
248 * cp-tree.h (ovl_op_identifier): Change to inline functions.
249 (build_x_binary_op): Add wrapper with fewer parms.
251 2019-11-05 Jason Merrill <jason@redhat.com>
253 * decl2.c (mark_used): Diagnose use of a function with unsatisfied
255 * typeck.c (cp_build_function_call_vec): Not here.
257 2019-11-05 Nathan Sidwell <nathan@acm.org>
260 * parser.c (cp_parser_error_1): Check EOF and UNKNOWN_LOCATION
261 when skipping over version control marker.
263 2019-11-05 Jakub Jelinek <jakub@redhat.com>
266 * constexpr.c (potential_constant_expression_1): Return true rather
267 than false for PREDICT_EXPR.
269 * decl.c (omp_declare_variant_finalize_one): Call
270 declare_simd_adjust_this not just on the context, but also on the
271 variant-id expression for methods. Don't call
272 cp_get_callee_fndecl_nofold, call cp_get_callee and only if it is
273 safe cp_get_fndecl_from_callee. Don't try to print as %qD
275 * pt.c (tsubst_attribute): Handle "omp declare variant base"
277 (tsubst_function_decl): Call omp_declare_variant_finalize
278 if there are any "omp declare variant base" attributes left.
280 2019-11-04 Kamlesh Kumar <kamleshbhalui@gmail.com>
282 PR c++/91979 - mangling nullptr expression
283 * mangle.c (write_template_arg_literal): Handle nullptr
286 2019-11-04 Jason Merrill <jason@redhat.com>
288 * typeck.c (check_return_expr): Avoid redundant error.
290 2019-11-02 Paolo Carlini <paolo.carlini@oracle.com>
292 * typeck.c (composite_pointer_type): Add a const op_location_t&
293 parameter and use it in diagnostics.
294 (composite_pointer_error): Likewise.
295 (composite_pointer_type_r): Add a const op_location_t&
296 parameter and forward it.
297 (cp_build_binary_op): Adjust calls.
298 (common_pointer_type): Likewise.
299 * call.c (add_builtin_candidate): Likewise.
300 (build_conditional_expr_1): Likewise.
301 * cp-tree.h (composite_pointer_type): Update declaration.
303 * typeck.c (cxx_sizeof_expr): Use cp_expr_loc_or_input_loc
305 (cxx_alignof_expr): Likewise.
306 (lvalue_or_else): Likewise.
308 2019-11-02 Jakub Jelinek <jakub@redhat.com>
310 * decl.c (omp_declare_variant_finalize_one): Use
311 omp_get_context_selector instead of c_omp_get_context_selector.
314 * parser.c (cp_parser_decl_specifier_seq): Don't parse attributes
315 if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR.
317 PR c++/88335 - Implement P1073R3: Immediate functions
318 * cp-tree.h (struct lang_decl_fn): Add immediate_fn_p bit.
319 (DECL_IMMEDIATE_FUNCTION_P, SET_DECL_IMMEDIATE_FUNCTION_P): Define.
320 (enum cp_decl_spec): Add ds_consteval.
321 (fold_non_dependent_expr): Add another tree argument defaulted to
323 * name-lookup.h (struct cp_binding_level): Add immediate_fn_ctx_p
325 * parser.c (cp_keyword_starts_decl_specifier_p): Adjust comments
326 for C++11 and C++20 specifiers. Handle RID_CONSTEVAL.
327 (CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR): Adjust comment.
328 (CP_PARSER_FLAGS_CONSTEVAL): New.
329 (cp_parser_skip_balanced_tokens): New forward declaration.
330 (cp_parser_lambda_declarator_opt): Handle ds_consteval. Set
331 current_binding_level->immediate_fn_ctx_p before parsing parameter
332 list if decl-specifier-seq contains consteval specifier.
333 (cp_parser_decl_specifier_seq): Handle RID_CONSTEVAL.
334 (cp_parser_explicit_instantiation): Diagnose explicit instantiation
335 with consteval specifier.
336 (cp_parser_init_declarator): For consteval or into flags
337 CP_PARSER_FLAGS_CONSTEVAL.
338 (cp_parser_direct_declarator): If CP_PARSER_FLAGS_CONSTEVAL, set
339 current_binding_level->immediate_fn_ctx_p in the sk_function_parms
341 (set_and_check_decl_spec_loc): Add consteval entry, formatting fix.
342 * call.c (build_addr_func): For direct calls to immediate functions
343 use build_address rather than decay_conversion.
344 (build_over_call): Evaluate immediate function invocations.
345 * error.c (dump_function_decl): Handle DECL_IMMEDIATE_FUNCTION_P.
346 * semantics.c (expand_or_defer_fn_1): Use tentative linkage and don't
347 call mark_needed for immediate functions.
348 * typeck.c (cxx_sizeof_or_alignof_expr): Likewise. Formatting fix.
349 (cp_build_addr_expr_1): Reject taking address of immediate function
350 outside of immediate function.
351 * decl.c (validate_constexpr_redeclaration): Diagnose consteval
352 vs. non-consteval or vice versa redeclaration. Use
353 SET_DECL_IMMEDIATE_FUNCTION_P if new_decl is immediate function.
354 (check_tag_decl): Use %qs with keyword string to simplify translation.
356 (start_decl): Adjust diagnostics for static or thread_local variables
357 in immediate functions.
358 (grokfndecl): Call sorry_at on virtual consteval. Use %qs with keyword
359 to string to simplify translation. Diagnose consteval main. Use
360 SET_DECL_IMMEDIATE_FUNCTION_P for consteval.
361 (grokdeclarator): Handle consteval. Use %qs with keyword strings to
362 simplify translation. Use separate ifs instead of chained else if
363 for invalid specifiers. For constinit clear constinit_p rather than
365 * constexpr.c (find_immediate_fndecl): New function.
366 (cxx_eval_outermost_constant_expr): Allow consteval calls returning
367 void. Diagnose returning address of immediate function from consteval
369 (fold_non_dependent_expr_template): Add OBJECT argument, pass it
370 through to cxx_eval_outermost_constant_expr.
371 (fold_non_dependent_expr): Add OBJECT argument, pass it through to
372 fold_non_dependent_expr_template.
373 (fold_non_dependent_init): Adjust fold_non_dependent_expr_template
375 * method.c (defaulted_late_check): Adjust diagnostics for consteval.
376 * lambda.c (maybe_add_lambda_conv_op): Copy over
377 DECL_DECLARED_CONSTEXPR_P and DECL_IMMEDIATE_FUNCTION_P bits from
378 callop to both artificial functions.
379 * init.c (build_value_init): Don't do further processing if
380 build_special_member_call returned a TREE_CONSTANT. Formatting fix.
382 PR c++/91369 - Implement P0784R7: constexpr new
383 * cp-tree.h (CALL_FROM_NEW_OR_DELETE_P): Define.
384 * init.c (build_new_1, build_vec_delete_1, build_delete): Set
385 CALL_FROM_NEW_OR_DELETE_P on the CALL_EXPR to allocator functions.
386 * constexpr.c (is_std_allocator_allocate): Only allow
387 global replaceable allocator functions if CALL_FROM_NEW_OR_DELETE_P
388 or in std::allocate<T>::{,de}allocate.
389 (potential_constant_expression_1): Likewise.
391 2019-11-01 Nathan Sidwell <nathan@acm.org>
393 * class.c (check_field_decls): Refactor.
395 2019-10-31 Jakub Jelinek <jakub@redhat.com>
398 * cp-tree.h (type_initializer_zero_p): Declare.
399 * decl.c (reshape_init_array_1): Formatting fix.
400 * tree.c (type_initializer_zero_p): New function. Moved from
401 ../tree.c, use next_initializable_field, formatting fix. Return
402 false for TYPE_NON_AGGREGATE_CLASS types.
404 2019-10-30 Jason Merrill <jason@redhat.com>
406 PR c++/92268 - hard error satisfying return-type-requirement
407 * constraint.cc (type_deducible_p): Check for substitution failure.
408 (diagnose_compound_requirement): Adjust diagnostic.
409 * pt.c (do_auto_deduction): Don't pass cargs to
410 constraints_satisfied_p.
412 2019-10-30 Jakub Jelinek <jakub@redhat.com>
414 PR c++/91369 - Implement P0784R7: constexpr new
415 * constexpr.c (cxx_replaceable_global_alloc_fn): Don't return true
417 (cxx_placement_new_fn, is_std_construct_at): New functions.
418 (cxx_eval_call_expression): Allow placement new in std::construct_at.
419 (potential_constant_expression_1): Likewise.
421 * typeck.c (decl_in_std_namespace_p): Return true also for decls
422 in inline namespaces inside of std namespace.
424 2019-10-30 Bernd Edlinger <bernd.edlinger@hotmail.de>
427 * name-lookup.c (check_local_shadow): Shadowing TYPE_DECLs
428 is always a -Wshadow=compatible-local warning, unless
431 2019-10-30 Jason Merrill <jason@redhat.com>
433 * cxx-pretty-print.c (get_fold_operator): Use OVL_OP_INFO.
435 2019-10-30 Marek Polacek <polacek@redhat.com>
437 PR c++/92134 - constinit malfunction in static data member.
438 * decl2.c (grokfield): Set LOOKUP_CONSTINIT.
440 2019-10-30 Jakub Jelinek <jakub@redhat.com>
442 * cp-tree.h (omp_declare_variant_finalize, build_local_temp): Declare.
443 * decl.c: Include omp-general.h.
444 (declare_simd_adjust_this): Add forward declaration.
445 (omp_declare_variant_finalize_one, omp_declare_variant_finalize): New
447 (cp_finish_decl, finish_function): Call omp_declare_variant_finalize.
448 * parser.c (cp_finish_omp_declare_variant): Adjust parsing of the
449 variant id-expression and propagate enough information to
450 omp_declare_variant_finalize_one in the attribute so that it can
452 * class.c (finish_struct): Call omp_declare_variant_finalize.
453 * tree.c (build_local_temp): No longer static, remove forward
456 2019-10-30 Paolo Carlini <paolo.carlini@oracle.com>
458 * typeck.c (cp_build_modify_expr): Prefer error + inform to
459 error + error in one place.
460 (get_delta_difference_1): Likewise.
461 (get_delta_difference): Likewise, in two places.
463 2019-10-29 Paolo Carlini <paolo.carlini@oracle.com>
465 * typeck.c (build_x_unary_op): Use the location_t argument in
468 2019-10-29 Marek Polacek <polacek@redhat.com>
470 PR c++/90998 - ICE with copy elision in init by ctor and -Wconversion.
471 * call.c (joust): Don't attempt to warn if ->second_conv is null.
473 2019-10-29 Jakub Jelinek <jakub@redhat.com>
476 * cp-gimplify.c (cp_gimplify_expr): If gimplify_to_rvalue changes the
477 function pointer type, re-add cast to the original one.
479 2019-10-29 Marek Polacek <polacek@redhat.com>
481 PR c++/91548 - fix detecting modifying const objects for ARRAY_REF.
482 * constexpr.c (cxx_eval_store_expression): Don't call
483 modifying_const_object_p for ARRAY_REF.
485 2019-10-29 Richard Sandiford <richard.sandiford@arm.com>
487 * cp-objcp-common.h (cxx_simulate_enum_decl): Declare.
488 (LANG_HOOKS_SIMULATE_ENUM_DECL): Define to the above.
489 * decl.c (cxx_simulate_enum_decl): New function.
491 2019-10-29 Richard Sandiford <richard.sandiford@arm.com>
493 * cp-tree.h (cxx_simulate_builtin_function_decl): Declare.
494 * decl.c (cxx_simulate_builtin_function_decl): New function.
495 * cp-objcp-common.h (LANG_HOOKS_SIMULATE_BUILTIN_FUNCTION_DECL):
498 2019-10-28 Martin Sebor <msebor@redhat.com>
501 * cp-objcp-common.c (names_builtin_p): Define new function.
503 2019-10-28 Nathan Sidwell <nathan@acm.org>
505 * parser.h (struct cp_token): Drop {ENUM,BOOL}_BITFIELD C-ism.
506 Add tree_check_p flag, use as nested union discriminator.
507 (struct cp_lexer): Add saved_type & saved_keyword fields.
508 * parser.c (eof_token): Delete.
509 (cp_lexer_new_main): Always init last_token to last token of
511 (cp_lexer_new_from_tokens): Overlay EOF token at end of range.
512 (cp_lexer_destroy): Restore token under the EOF.
513 (cp_lexer_previous_token_position): No check for eof_token here.
514 (cp_lexer_get_preprocessor_token): Clear tree_check_p.
515 (cp_lexer_peek_nth_token): Check CPP_EOF not eof_token.
516 (cp_lexer_consume_token): Assert not CPP_EOF, no check for
518 (cp_lexer_purge_token): Likewise.
519 (cp_lexer_purge_tokens_after): No check for EOF token.
520 (cp_parser_nested_name_specifier, cp_parser_decltype)
521 (cp_parser_template_id): Set tree_check_p.
523 2019-10-24 Jakub Jelinek <jakub@redhat.com>
525 * decl2.c (cplus_decl_attributes): Add "omp declare target block"
526 attribute in between declare target and end declare target
529 * call.c (convert_arg_to_ellipsis): Add missing space in string
532 2019-10-24 Marek Polacek <polacek@redhat.com>
534 * decl.c (reshape_init_r): Add missing space.
536 2019-10-24 Nathan Sidwell <nathan@acm.org>
538 * pt.c (reduce_template_parm_level): Attach the new TPI to the new
540 (convert_generic_types_to_packs): Pass the copied type to
541 reduce_templatE_parm_level.
543 2019-10-23 Nathan Sidwell <nathan@acm.org>
545 * cp-tree.c (CPTI_STD_IDENTIFIER): Delete.
546 (std_identifier): Delete.
547 (DECL_NAME_SPACE_STD_P): Compare against std_node.
548 * decl.c (initialize_predefined_identifiers): 'std' is not needed.
549 (cxx_init_decl_processing): Adjust creation of ::std. Use
550 {push,pop}_nested_namespace.
551 (cxx_builtin_function): Use {push,pop}_nested_namespace.
552 * except.c (init_exception_processing): Likewise.
553 * rtti.c (init_rtti_processing): Likewise.
555 2019-10-23 Jason Merrill <jason@redhat.com>
557 Implement P1286R2, Contra CWG1778
558 * method.c (defaulted_late_check): Don't check explicit
559 exception-specification on defaulted function.
560 (after_nsdmi_defaulted_late_checks): Remove.
561 * parser.h (struct cp_unparsed_functions_entry): Remove classes.
562 * parser.c (unparsed_classes): Remove.
563 (push_unparsed_function_queues, cp_parser_class_specifier_1):
566 2019-10-23 Jakub Jelinek <jakub@redhat.com>
568 * constexpr.c (cxx_eval_constant_expression) <case CLEANUP_STMT>:
569 Temporarily change input_location to CLEANUP_STMT location.
571 2019-10-22 Jakub Jelinek <jakub@redhat.com>
573 PR tree-optimization/85887
574 * decl.c (expand_static_init): Drop ECF_LEAF from __cxa_guard_acquire
575 and __cxa_guard_release.
577 2019-10-22 Marc Glisse <marc.glisse@inria.fr>
580 * constexpr.c (cxx_eval_builtin_function_call): Only set
581 force_folding_builtin_constant_p if manifestly_const_eval.
583 2019-10-22 Richard Sandiford <richard.sandiford@arm.com>
585 * cp-tree.h (STF_USER_VISIBLE): New constant.
586 (strip_typedefs, strip_typedefs_expr): Take a flags argument.
587 * tree.c (strip_typedefs, strip_typedefs_expr): Likewise,
588 updating mutual calls accordingly. When STF_USER_VISIBLE is true,
589 only look through typedefs if user_facing_original_type_p.
590 * error.c (dump_template_bindings, type_to_string): Pass
591 STF_USER_VISIBLE to strip_typedefs.
592 (dump_type): Likewise, unless pp_c_flag_gnu_v3 is set.
594 2019-10-21 Kamlesh Kumar <kamleshbhalui@gmail.com>
595 Jason Merrill <jason@redhat.com>
597 PR c++/83534 - typeinfo of noexcept function
598 * rtti.c (get_tinfo_decl_dynamic): Do not call
599 TYPE_MAIN_VARIANT for function.
600 (get_typeid): Likewise.
602 2019-10-21 Paolo Carlini <paolo.carlini@oracle.com>
604 * parser.c (cp_parser_class_head): Improve error recovery upon
605 extra qualification error.
607 2019-10-21 Jakub Jelinek <jakub@redhat.com>
610 * constexpr.c (cxx_eval_component_reference, cxx_eval_bit_field_ref):
611 Use STRIP_ANY_LOCATION_WRAPPER on CONSTRUCTOR elts.
613 2019-10-21 Marek Polacek <polacek@redhat.com>
615 PR c++/92062 - ODR-use ignored for static member of class template.
616 * pt.c (has_value_dependent_address): Strip location wrappers.
618 2019-10-21 Marek Polacek <polacek@redhat.com>
620 PR c++/92106 - ICE with structured bindings and -Wreturn-local-addr.
621 * typeck.c (maybe_warn_about_returning_address_of_local): Avoid
622 recursing on null initializer and return false instead.
624 2019-10-17 JeanHeyd Meneide <phdofthehouse@gmail.com>
626 Implement p1301 [[nodiscard("should have a reason")]] + p1771 DR
627 * tree.c (handle_nodiscard_attribute): Handle C++2a nodiscard
629 (std_attribute_table) Increase nodiscard argument handling
630 max_length from 0 to 1.
631 * parser.c (cp_parser_check_std_attribute): Add requirement
632 that nodiscard only be seen once in attribute-list.
633 (cp_parser_std_attribute): Check that empty parenthesis lists are
634 not specified for attributes that have max_length > 0 (e.g.
636 * cvt.c (maybe_warn_nodiscard): Add nodiscard message to
637 output, if applicable.
638 (convert_to_void): Allow constructors to be nodiscard-able (P1771).
640 2019-10-18 Nathan Sidwell <nathan@acm.org>
642 * cp-tree.h (struct lang_type): Remove was_anonymous.
643 (TYPE_WAS_UNNAMED): Implement by checking TYPE_DECL &
645 * decl.c (name_unnamed_type): Don't set TYPE_WAS_UNNAMED.
647 2019-10-17 Paolo Carlini <paolo.carlini@oracle.com>
649 * decl.c (grokfndecl): Remove redundant use of in_system_header_at.
650 (compute_array_index_type_loc): Likewise.
651 (grokdeclarator): Likewise.
652 * error.c (cp_printer): Likewise.
653 * lambda.c (add_default_capture): Likewise.
654 * parser.c (cp_parser_primary_expression): Likewise.
655 (cp_parser_selection_statement): Likewise.
656 (cp_parser_toplevel_declaration): Likewise.
657 (cp_parser_enumerator_list): Likewise.
658 (cp_parser_using_declaration): Likewise.
659 (cp_parser_member_declaration): Likewise.
660 (cp_parser_exception_specification_opt): Likewise.
661 (cp_parser_std_attribute_spec): Likewise.
662 * pt.c (do_decl_instantiation): Likewise.
663 (do_type_instantiation): Likewise.
664 * typeck.c (cp_build_unary_op): Likewise.
666 * decl.c (check_tag_decl): Pass to in_system_header_at the same
667 location used for the permerror.
668 (grokdeclarator): Likewise.
670 * decl.c (check_tag_decl): Use locations[ds_typedef] in error_at.
672 2019-10-17 Jason Merrill <jason@redhat.com>
674 * cp-gimplify.c (cp_gimplify_expr): Use get_initialized_tmp_var.
675 (gimplify_to_rvalue): Remove default NULL argument.
677 2019-10-17 Nathan Sidwell <nathan@acm.org>
679 * decl.c (builtin_function_1): Merge into ...
680 (cxx_builtin_function): ... here. Nadger the decl before maybe
681 copying it. Set the context.
682 (cxx_builtin_function_ext_scope): Push to top level, then call
683 cxx_builtin_function.
685 2019-10-16 Luis Machado <luis.machado@linaro.org>
687 * cp-gimplify.c: Fix reference to non-existing tree-gimple.c file.
689 2019-10-16 Jakub Jelinek <jakub@redhat.com>
691 * decl.c (cxx_maybe_build_cleanup): When clearing location of cleanup,
692 if cleanup is a nop, clear location of its operand too.
694 2019-10-15 Andrew Sutton <asutton@lock3software.com>
696 Finish moving constraint and logic functionality of out pt.c.
697 Reimplement and re-enable subsumption caching.
699 * config-lang.in (gtfiles): Add logic.cc.
700 * constraint.cc (atomic_constraints_identical_p): Add assertions.
701 (hash_atomic_constraint): Likewise.
702 (constraints_equivalent_p): New.
703 (inchash::add_constraint): New.
704 (iterative_hash_constraint): New.
705 (decl_constraints): Moved from pt.c.
706 (get_constraints): Likewise.
707 (set_constraints): Likewise.
708 (remove_constraints): Likewise.
709 * cp-tree.h (CONSTR_P): New.
710 (init_constraint_processing): Remove.
711 (constraints_equivalent_p, iterative_hash_constraint): Declare.
712 * decl.c (cxx_init_decl_processing): Don't initialize constraints.
713 * logic.cc (subsumption_entry): Moved from pt.c.
714 (subsumption_hasher): Likewise.
715 (subsumption_cache): Likewise.
716 (lookup_subsumption): Likewise.
717 (save_subsumption): Likewise.
718 (subsumes_constraints_nonnull): Use subsumption cache.
719 * pt.c: Move aforementioned declarations out of this file.
720 (init_constraint_processing): Remove.
722 2019-10-15 Andrew Sutton <asutton@lock3software.com>
724 * parser.c (cp_parser_constructor_declarator_p): Pass an empty
725 decl-specifier-seq to make sure we parse type constraints as part
728 2019-10-15 Nathan Sidwell <nathan@acm.org>
730 * class.c (build_clones): Break out of clone_function_decl. Just
732 (clone_function_decl): Call build_clones, then maybe add them to
735 * class.c (build_clone): Refactor to clarify recursiveness.
737 2019-10-14 Jason Merrill <jason@redhat.com>
739 PR c++/91930 - ICE with constrained inherited default ctor.
740 * name-lookup.c (do_class_using_decl): Set TYPE_HAS_USER_CONSTRUCTOR
741 for inherited constructor.
743 2019-10-14 Paolo Carlini <paolo.carlini@oracle.com>
745 * decl.c (check_tag_decl): Use DECL_SOURCE_LOCATION.
747 2019-10-14 Jakub Jelinek <jakub@redhat.com>
750 * semantics.c (handle_omp_array_sections_1): Temporarily disable
751 -fstrong-eval-order also for in_reduction and task_reduction clauses.
753 * parser.c (cp_parser_omp_all_clauses): Change bool NESTED_P argument
754 into int NESTED, if it is 2, diagnose missing commas in between
756 (cp_parser_omp_context_selector): Pass 2 as last argument to
757 cp_parser_omp_all_clauses.
759 2019-10-12 Jakub Jelinek <jakub@redhat.com>
761 * parser.c (cp_parser_omp_context_selector): Improve error recovery.
762 For simd properties, put them directly into TREE_VALUE.
763 (cp_finish_omp_declare_variant): Add "omp declare variant base"
764 attribute rather than "omp declare variant".
766 2019-10-11 Marek Polacek <polacek@redhat.com>
768 PR c++/92049 - extra error with -fchecking=2.
769 * pt.c (build_non_dependent_expr): Call fold_non_dependent_expr
772 2019-10-11 Paolo Carlini <paolo.carlini@oracle.com>
774 * typeck.c (cp_build_binary_op): Do not handle RROTATE_EXPR and
776 * constexpr.c (cxx_eval_constant_expression): Likewise.
777 (potential_constant_expression_1): Likewise.
778 * pt.c (tsubst_copy): Likewise.
780 2019-10-11 Jason Merrill <jason@redhat.com>
782 * decl2.c (mark_used): Don't clobber DECL_SOURCE_LOCATION on
783 explicitly defaulted functions.
784 * method.c (synthesize_method): Likewise.
786 2019-10-11 Jakub Jelinek <jakub@redhat.com>
789 * decl2.c (grok_array_decl): For -fstrong-eval-order, when array ref
790 operands have been swapped and at least one operand has side-effects,
791 revert the swapping before calling build_array_ref.
792 * typeck.c (cp_build_array_ref): For non-ARRAY_TYPE array ref with
793 side-effects on the index operand, if -fstrong-eval-order use
794 save_expr around the array operand.
795 (cp_build_binary_op): For shifts with side-effects in the second
796 operand, wrap first operand into SAVE_EXPR and evaluate it before
798 * semantics.c (handle_omp_array_sections_1): Temporarily disable
799 flag_strong_eval_order during OMP_CLAUSE_REDUCTION array section
801 * cp-gimplify.c (gimplify_to_rvalue): New function.
802 (cp_gimplify_expr): Use it.
804 2019-10-10 Marek Polacek <polacek@redhat.com>
806 * typeck.c (comp_ptr_ttypes_real): Change the return type to bool.
807 Use false instead of 0.
809 2019-10-10 Jakub Jelinek <jakub@redhat.com>
811 * parser.h (struct cp_omp_declare_simd_data): Add variant_p member.
812 * parser.c (cp_ensure_no_omp_declare_simd): Handle both declare simd
814 (cp_parser_oacc_all_clauses): Formatting fix.
815 (cp_parser_omp_all_clauses): Add NESTED_P argument, if true, terminate
816 processing on closing paren and don't skip to end of pragma line.
817 (cp_parser_omp_declare_simd): Add VARIANT_P argument. Handle also
819 (omp_construct_selectors, omp_device_selectors,
820 omp_implementation_selectors, omp_user_selectors): New variables.
821 (cp_parser_omp_context_selector,
822 cp_parser_omp_context_selector_specification,
823 cp_finish_omp_declare_variant): New functions.
824 (cp_parser_late_parsing_omp_declare_simd): Handle also declare variant.
825 (cp_parser_omp_declare): Handle declare variant.
827 2019-10-09 Jason Merrill <jason@redhat.com>
829 * cp-tree.h (template_info_decl_check): Check ENABLE_TREE_CHECKING.
831 2019-10-09 Marek Polacek <polacek@redhat.com>
833 PR c++/91364 - P0388R4: Permit conversions to arrays of unknown bound.
834 PR c++/69531 - DR 1307: Differently bounded array parameters.
835 PR c++/88128 - DR 330: Qual convs and pointers to arrays of pointers.
836 * call.c (build_array_conv): Build ck_identity at the beginning
838 (standard_conversion): Pass bounds_none to comp_ptr_ttypes_const.
839 (maybe_warn_array_conv): New.
840 (convert_like_real): Call it. Add an error message about converting
841 from arrays of unknown bounds.
842 (conv_get_original_expr): New.
843 (nelts_initialized_by_list_init): New.
844 (conv_binds_to_array_of_unknown_bound): New.
845 (compare_ics): Implement list-initialization ranking based on
846 array sizes, as specified in DR 1307 and P0388R.
847 * cp-tree.h (comp_ptr_ttypes_const): Adjust declaration.
848 (compare_bounds_t): New enum.
849 * typeck.c (comp_array_types): New bool and compare_bounds_t
850 parameters. Use them.
851 (structural_comptypes): Adjust the call to comp_array_types.
852 (similar_type_p): Handle ARRAY_TYPE.
853 (build_const_cast_1): Pass bounds_none to comp_ptr_ttypes_const.
854 (comp_ptr_ttypes_real): Don't check cv-quals of ARRAY_TYPEs. Use
855 comp_array_types to compare array types. Look through arrays as per
857 (comp_ptr_ttypes_const): Use comp_array_types to compare array types.
858 Look through arrays as per DR 330.
860 2019-10-09 Marek Polacek <polacek@redhat.com>
862 PR c++/92032 - DR 1601: Promotion of enum with fixed underlying type.
863 * call.c (standard_conversion): When converting an enumeration with
864 a fixed underlying type to the underlying type, give it the cr_promotion
866 (compare_ics): Implement a tiebreaker as per CWG 1601.
868 2019-10-08 Andrew Sutton <asutton@lock3software.com>
869 Jason Merrill <jason@redhat.com>
871 Update the concepts implementation to conform to the C++20
872 specification, improve compile times, and generally clean up
874 * call.c (build_new_function_call): Don't evaluate concepts here.
875 (constraint_failure): Don't record the template.
876 (print_z_candidate): Don't extract the template.
877 * class.c (add_method): When overloading, hide ineligible special
879 (check_methods): Set TYPE_HAS_COMPLEX_* here.
880 * constexpr.c (cxx_eval_constant_expression): Evaluate concepts.
881 (maybe_initialize_fundef_copies_table): Remove.
882 (get_fundef_copy): Use hash_map_safe_get_or_insert.
883 (clear_cv_and_fold_caches): Clear the satisfaction cache.
884 * constraint.cc (known_non_bool_p): New.
885 (parsing_constraint_expression_sentinel): Renamed from
886 expanding_constraint_sentinel.
887 (check_constraint_operands): New.
888 (check_constraint_atom): New.
889 (finish_constraint_binary_op): New.
890 (finish_constraint_or_expr): Likewise.
891 (finish_constraint_and_expr): Likewise.
892 (finish_constraint_primary_expr): Likewise.
893 (combine_constraint_expressions): New.
894 (finish_requires_expr): Add location parm.
895 (get_concept_definition): Return the initializer of concept definitions.
896 (get_template_head_requirements): New.
897 (get_trailing_function_requirements): New.
898 (deduce_constrained_parameter): Check if the identifier or template-id
899 is a concept definition.
900 (resolve_concept_definition_check): Removed.
901 (resolve_variable_concept_check): Removed.
902 (resolve_concept_check): New.
903 (resolve_constraint_check): Handle concept definitions.
904 converting arguments.
905 (function_concept_check_p): Removed.
906 (variable_concept_check_p): Removed.
907 (unpack_concept_check): New.
908 (get_concept_check_template): New.
909 (build_call_check): Moved and renamed to build_function_check.
910 (build_concept_check_arguments): make static.
911 (build_function_check): Always do overload resolution
912 in order to force conversion of template arguments (i.e., actually
913 check that the use of a concept is valid).
914 (build_standard_check): Renamed from build_real_concept_check.
915 (build_real_concept_check): Build checks for C++2a concepts by
916 (build_wildcard_concept_check): New.
917 (build_concept_check): Use build_real_concept_check. New overload.
918 (build_constraints): Save expressions, not normalized constraints.
919 (build_concept_id): New. Pass tf_warning_or_error.
920 (build_type_constraint): New.
921 (finish_type_constraints): New.
922 (associate_classtype_constraints): Also add constraints to union
923 types. Note the original declaration in errors. Don't return
924 error_mark_node in order to avoid an assertion later.
925 (push_down_pack_expansion): Remove.
926 (finish_shorthand_constraint): Make fold expressions, not naked
927 parameter packs. Always apply the constraint to each template argument.
928 (check_introduction_list): New. Fail if not enough
929 names are introduced.
930 (finish_template_introduction): Don't normalize constraints. Pass
931 tsubst flags. Check for insufficient introductions.
932 (placeholder_extract_concept_and_args): Handle the template-id case.
933 Unpack function concept checks correctly.
934 (tsubst_simple_requirement): Return errors if they occur. Don't
935 process as a template.
936 (tsubst_type_requirement): Likewise.
937 (type_deducible_p): New. Wrap the input expression in parens for the
938 purpose of deduction.
939 (expression_convertible_t): New.
940 (tsubst_compound_requirement): Use new deduction, conversion predicates.
941 (tsubst_nested_requirement): Return errors if they occur. Don't
942 process as a template. Instantiate and evaluate the nested requirement.
943 (tsubst_valid_expression_requirement): New.
944 (tsubst_simple_requirement): Use tsubst_valid_expression_requirement.
945 (tsubst_compound_requirement): Use tsubst_valid_expression_requirement.
946 (check_constaint_variables): New.
947 (tsubst_constraint_variables): Check that type substitutions are valid.
948 (tsubst_requires_expr): Likewise. Produce new requires-exprs during
949 template substitution. Copy the previous local specialization stack,
950 so references to non-local parameters can be found. Use cp_unevaluated.
951 (tsubst_constraint): New. Don't evaluate concept checks.
953 (norm_info): New. Used to build a normalization tree for concept check
955 (debug_parameter_mapping): New.
956 (debug_argument_list): New.
957 (expand_concept): Removed.
958 (normalize_logical_operation): Pass subst_info through call.
959 (normalize_pack_expansion): Remove.
960 (normalize_simple_requirement): Removed
961 (normalize_type_requirement): Removed
962 (normalize_compound_requirement): Removed
963 (normalize_nested_requirement): Removed
964 (normalize_requirement): Removed
965 (normalize_requirements): Removed
966 (normalize_requires_expression): Removed
967 (normalize_variable_concept_check): Removed.
968 (normalize_function_concept_check): Removed.
969 (normalize_concept_check): Merged all normalize_*_check here.
970 Substitute through written template arguments before normalizing the
971 definition. Only substitute the innermost template arguments.
972 (check_for_logical_overloads): Delete.
973 (map_arguments): New. Associate template parameters with arguments.
974 (build_parameter_mapping): New. Extract used parameters.
975 (normalize_expression): Rewrite.
976 (normalize_conjunction): Removed
977 (normalize_disjunction): Removed
978 (normalize_predicate_constraint): Removed
979 (normalize_parameterized_constraint): Removed
980 (normalized_map): New variable.
981 (get_normalized_constraints): New entry point for normalization.
983 (get_normalized_constraints_from_info): New.
984 (get_normalized_constraints_from_decl): New. Turn on template processing
985 prior to normalization. Handle inheriting ctors. Build the
986 normalization arguments from the full set of template parameters of the
987 most general template. This guarantees that we have no concrete arguments
988 in the parameter mapping (e.g., from template members of class
989 templates). Cache normalizations.
990 (normalize_concept_definition): New. Cache normalizations.
991 (normalize_template_requirements): New.
992 (normalize_nontemplate_requirements): New.
993 (normalize_constraint_expression): New.
994 (tsubst_parameter_mapping): New.
995 (get_mapped_args): New.
996 (parameter_mapping_equivalent_p): New. Use template_args_equal.
997 (atomic_constraints_identical_p): New.
998 (hash_atomic_constraint): New.
999 (satisfying_constraint_p): New. Guard against recursive evaluation of
1000 constraints during satisfaction.
1001 (satisfy_conjunction): New.
1002 (satisfy_disjunction): New.
1003 (sat_entry): New class for hashing satisfaction results.
1004 (sat_hasher): New hash traits.
1006 (get_satisfaction): New. Returns cached satisfaction result.
1007 (save_satisfaction): New. Caches a satisfaction result.
1008 (clear_satisfaction_cache): New.
1009 (satisfaction_cache): New. Helps manage satisfaction cache requests.
1010 (decl_satisfied_cache): New.
1011 (satisfy_atom): New.
1012 (satisfy_constraint_r): New.
1013 (satisfy_constraint): Use new satisfaction algorithm.
1014 (evaluate_concept_check): New.
1015 (evaluate_concept): Removed.
1016 (evaluate_function_concept): Removed.
1017 (evaluate_variable_concept): Removed.
1018 (satisfy_constraint_expression): New.
1019 (constraint_expression_satisfied_p): New.
1020 (constraints_satisfied_p): Use strip_inheriting_ctors. Use
1021 push_/pop_access_scope.
1022 (more_constrained): Normalize before calling out to subsumption. Allow
1023 classes as arguments.
1024 (strictly_subsumes): Allow non-templates as arguments. Accept a new
1026 (weakly_subsumes): New.
1027 (at_least_as_constrained): Removed.
1028 (diagnose_other_expression): Removed.
1029 (diagnose_predicate_constraint): Removed.
1030 (diagnose_pack_expansion): Removed.
1031 (diagnose_check_constraint): Removed.
1032 (diagnose_logical_constraint): Removed.
1033 (diagnose_expression_constraint): Removed.
1034 (diagnose_type_constraint): Removed.
1035 (diagnose_implicit_conversion_constraint): Removed.
1036 (diagnose_argument_deduction_constraint): Removed.
1037 (diagnose_exception_constraint): Removed.
1038 (diagnose_parameterized_constraint): Removed.
1039 (diagnose_argument_deduction_constraint): Removed.
1040 (diagnose_argument_deduction_constraint): Removed.
1041 (diagnose_argument_deduction_constraint): Removed.
1042 (diagnose_trait_expr): New.
1043 (diagnose_requires_expr): New.
1044 (diagnose_atomic_constraint): New.
1045 (diagnose_valid_expression) Stop wrongly diagnosing valid expressions.
1046 Don't substitute as if in template decls. This causes substitution
1047 to generate expressions that aren't suitable for use with the noexcept
1049 (diagnose_valid_type) Likewise.
1050 (diagnose_compound_requirement) Actually emit diagnostics for
1051 the causes of errors.Call force_paren_expr_uneval.
1052 (diagnose_declaration_constraints): Turn on template processing to
1053 suppress certain analyses.
1054 * cp-objcp-common.c (cp_common_init_ts): Make concepts typed.
1055 (cp_get_debug_type): Use hash_map_safe_*.
1056 * cp-tree.h: New function declarations for semantic actions, other
1057 facilities. Remove declaration no longer used or needed. Remove
1058 unused _CONSTR macros.
1059 (LANG_DECL_HAS_MIN): Add CONCEPT_DECL.
1060 (template_info_decl_check): Factor macro check into an inline function.
1061 (DECL_TEMPLATE_INFO): Use new check facility.
1062 (finish_concept_definition): New. Don't invalid concept declarations
1063 with invalid initializers.
1064 (find_template_parameters): New.
1065 (concept_definition_p): New.
1066 (concept_check_p): New.
1067 (variable_concept_check_p): New.
1068 (force_paren_expr_uneval): New.
1069 (ovl_iterator::using_p): A USING_DECL by itself was also
1070 introduced by a using-declaration.
1071 (struct tree_template_info): Use tree_base instead of
1072 tree_common. Add tmpl and args fields.
1073 (TI_TEMPLATE, TI_ARGS): Adjust.
1074 (DECLTYPE_FOR_INIT_CAPTURE): Remove.
1075 (CONSTR_CHECK, CONSTR_INFO, CONSTR_EXPR, CONSTR_CONTEXT): New.
1076 (ATOMIC_CONSTR_MAP, TRAIT_EXPR_LOCATION): New.
1077 (struct tree_trait_expr): Add locus field.
1078 (enum tsubst_flags): Add tf_norm as a hint to generate normalization
1079 context when diagnosing constraint failure.
1080 * cp-tree.def: Remove unused _CONSTR nodes and rename PRED_CONSTR
1082 (CONCEPT_DECL): New.
1083 * cxx-pretty-print.c: Remove constraint printing code.
1084 (pp_cxx_concept_definition): New.
1085 (pp_cxx_template_declaration): Print concept definitions.
1086 (pp_cxx_check_constraint): Update printing for concept definitions.
1087 (pp_cxx_nested_name_specifier): Fix a weird
1088 case where we're printing '::::' for concepts.
1089 (simple_type_specifier): Print requirements for placeholder types.
1090 (pp_cxx_constrained_type_spec): Print the associated requirements of
1092 (pp_cxx_compound_requirement): Add space before the '->'.
1093 (pp_cxx_parameter_mapping): Print the parameter mapping.
1094 (pp_cxx_atomic_constraint): Use the function above.
1095 * decl.c (redeclaration_error_message): New error for concepts.
1096 (grokdeclarator): Check for and disallow decltype(auto) in parameter
1098 (grokfndecl): Don't normalize constraints. Add check for constraints
1100 (grokvardecl): Don't normalize constraints.
1101 (grok_special_member_properties): Don't set TYPE_HAS_COMPLEX_*.
1102 (function_requirements_equivalent_p): New. Compare trailing
1103 requires clauses. Compare combined constraints in pre-C++20 mode.
1104 (decls_match): Compare trailing requires clauses. Compare template
1105 heads for function templates. Remove old constraint comparison.
1106 Simplify comparison of functions, function templates.
1107 (duplicate_function_template_decls): New. Refactor a nasty if
1108 condition into a single predicate.
1109 (require_deduced_type): Don't complain if we already complained about
1111 (finish_function): Perform auto deduction to ensure that constraints
1112 are checked even when functions contain no return statements. Only do
1113 auto deduction if we haven't previously seen any return statements.
1114 This prevents multiple diagnostics of the same error.
1115 (store_decomp_type): Remove.
1116 (cp_finish_decomp): Use hash_map_safe_put.
1117 * error.c: Remove constraint printing code.
1118 (dump_decl): Dump concept definitions. Handle wildcard declarations.
1119 (dump_template_decl): Likewise.
1120 (dump_type): Print associated requirements for placeholder
1122 (rebuild_concept_check): New.
1123 (maybe_print_single_constraint_context): New.
1124 (maybe_print_constraint_context): Recursively print nested contexts.
1125 * init.c (get_nsdmi): Use hash_map_safe_*.
1126 * lambda.c (maybe_add_lambda_conv_op): Bail if deduction failed.
1127 (add_capture): Copy parameter packs from init.
1128 (lambda_capture_field_type): Always use auto for init-capture.
1129 * logic.cc: Completely rewrite.
1130 (constraint_hash): New.
1131 (clause/ctor): Save atoms in the hash table.
1132 (replace): Save atoms during replacement.
1133 (insert): Save atoms during insertion.
1134 (contains): Only search the hash table for containment.
1135 (clause): Keep a hash of atomic constraints.
1136 (clause::clause): Explicitly copy the hash table when copying.
1137 (disjunction_p, conjunction_p, atomic_p, dnf_size, cnf_size): New.
1138 (diagnose_constraint_size): New.
1139 (subsumes_constraints_nonnull): Compare the sizes of normalized formula
1140 to determine the cheapest decomposition.
1141 * name-lookup.c (diagnose_name_conflict): Diagnose name issues with
1143 (matching_fn_p): Check constraints.
1144 (push_class_level_binding_1): Move overloaded functions case down,
1145 accept FUNCTION_DECL as target_decl.
1146 * parser.c (enum required_token): New required token for auto.
1147 (make_location): Add overload taking lexer as last parm.
1148 (cp_parser_required_error): Diagnose missing auto.
1149 (cp_parser_diagnose_ungrouped_constraint_plain): New.
1150 (cp_parser_diagnose_ungrouped_constraint_plain): New.
1151 (cp_parser_constraint_primary_expression): New. Tentatively parse the
1152 primary expression. If that fails tentatively parse a lower
1153 precedence expression in order to diagnose the error.
1154 (cp_parser_check_non_logical_constraint): New. Performs a trial
1155 parse of the right-hand-side of non-logical operators in order to
1156 generate good diagnostics.
1157 (cp_parser_constraint_logical_and_expression): New.
1158 (cp_parser_constraint_logical_or_expression): New.
1159 (cp_parser_requires_clause_expression): New.
1160 (cp_parser_requires_clause): Renamed to cp_parser_constraint_expression.
1161 (cp_parser_requires_clause_opt): Parse the requires-clause differently
1162 in -fconcepts and -std=c++2a modes.
1163 (cp_parser_requirement_list): Rename to cp_parser_requirement_seq.
1164 Rewrite so that semicolons are parsed
1165 along with requirements, not the sequence.
1166 (cp_parser_simple_requirement): Expect a semicolon at end.
1167 (cp_parser_compound_requirement): Expect a semicolon at end. Only
1168 allow trailing-return-type with -fconcepts-ts.
1169 (cp_parser_nested_requirement): Expect a semicolon at end. Parse
1170 constraint-expressions.
1171 (cp_parser_concept_definition): New. Don't fail parsing the concept
1172 definition if the initializer is ill-formed. Don't declare the concept
1173 before parsing the initializer.
1174 (cp_parser_constraint_expression): Declare earlier.
1175 (cp_parser_type_requirement): Current scope is not valid.
1176 (cp_parser_requires_expression): Commit to the tentative parse.
1177 (cp_parser_decl_specifier_seq): Warn when concept appears to be used
1178 as a decl-specifier.
1179 (cp_parser_template_declaration_after_parameters): Parse concept
1181 (cp_parser_template_id): Don't try to resolve a concept template-id yet.
1182 (cp_parser_template_id_expr): Resolve it as a concept check.
1183 (cp_parser_decl_specifier_seq): Warn on 'concept bool'.
1184 (cp_parser_type_parameter): Combine expressions not
1186 (cp_parser_explicit_template_declaration): Combine expressions not
1188 (cp_parser_maybe_concept_name): Removed.
1189 (cp_parser_simple_type_specifier): Handle an error condition of
1190 a bad constrained type specifier. Expect auto or decltype after
1191 a concept name. Also handle the case where we have a template-id
1193 (cp_parser_template_introduction): Diagnose errors on invalid
1194 introductions. Give up if it doesn't start with a concept name.
1195 Pedwarn if not -fconcepts-ts.
1196 (synthesize_implicit_template_parm): Don't do consistent binding.
1197 Use a new flag for constrained parameters. Combine expressions,
1198 not constraints. Fail if we get a placeholder in block scope.
1199 Placeholders that do not constrain types are not allowed in parameter
1200 declarations, so don't handle them.
1201 (cp_parser_placeholder_type_specifier): New. Implement parsing of
1202 placeholder type specifiers following a concept name or partial
1203 concept check. Disallow decltype(auto) parameters.
1204 (cp_parser_nested_name_specifier_opt): If the token is already
1205 CPP_NESTED_NAME_SPECIFIER, leave it alone.
1206 (cp_parser_id_expression, cp_parser_unqualified_id): Call
1207 cp_parser_template_id_expr.
1208 (cp_parser_placeholder_type_specifier): Add tentative parm. Don't
1209 expect a WILDCARD_DECL.
1210 (cp_parser_trait_expr): Pass trait_loc down.
1211 (cp_parser_postfix_expression): Do set location of dependent member
1213 * pt.c (finish_concept_definition): New.
1214 (push_template_decl_real): Handle concept definitions.
1215 (start_concept_definition): Let push_template_decl_real handle the
1216 creation of the template.
1217 (get_constraints): Return null if the table hasn't been initialized.
1218 (tsubst_copy_and_build): Build template-id expressions for concept
1220 [TRAIT_EXPR]: Pass trait_loc down.
1221 (lookup_template_class_1): Add the template name to the constraint
1223 (lookup_and_finish_template_variable): Build concept checks
1224 with the correct arguments.
1225 (tsubst_function_decl): Don't substitute through constraints.
1226 Always associate constraints with functions.
1227 (template_parm_level_and_index): Make non-static.
1228 (for_each_template_parm_r): Handle requires expressions.
1229 (keep_template_parm): New.
1230 (find_template_parameters): New.
1231 (more_specialized_fn): Change how winners and losers are chosen.
1232 (make_constrained_auto): Don't normalize constraints.
1233 (template_parameters_equivalent_p): New. Compare template
1234 parameters. Add a comparison for implicitly vs. explicitly declared
1236 (template_parameter_lists_equivalent_p): New. Compare template
1238 (template_requirements_equivalent_p): New.
1239 (template_heads_equivalent_p): New. Compare template heads.
1240 (template_parameter_constraints_equivalent_p): New.
1241 (is_compatible_template_arg): Use weakly_subsumes.
1242 (maybe_new_partial_specialization): Use new constraint comparison
1243 for finding specializations.
1244 (process_partial_specialization): Pass main template as argument.
1245 (more_specialized_partial_spec): Don't immediately return when
1247 (make_constrained_auto): Handle concept definitions.
1248 (do_auto_deduction): Update auto deduction for new concept model.
1249 Extract the function concept correctly; rename constr to check to
1250 reflect the kind of node.
1251 (tsubst): Adjust wildcard argument during substitution.
1252 [DECLTYPE_TYPE]: Remove init-capture handling.
1253 (tsubst_copy_and_build): Build concept checks, not template ids.
1254 Defer checks of function concepts. Handle concepts before variable
1255 templates. Handle calls to function concepts explicitly.
1256 (coerce_template_parms): Use concept_definition_p. Handle a deduction
1257 error where a potentially empty pack can be supplied after the last
1258 parameter of a concept.
1259 (finish_template_variable): Don't process concepts here.
1260 (instantiation_dependent_r): Use concept_check_p.
1261 (tsubst_template_args): Make non-static.
1262 (make_constrained_placeholder_type): New. Refactored from
1263 make_constrained_auto.
1264 (make_constrained_auto) Use make_constrained_placeholder_type.
1265 (make_constrained_decltype_auto) New.
1266 (tsubst_function_parms): New.
1267 (value_dependent_expression_p) [TEMPLATE_ID_EXPR]: Use
1268 concept_definition_p.
1269 (push_access_scope, pop_access_scope): No longer static.
1270 (tsubst_template_parm): Substitute TEMPLATE_PARM_CONSTRAINTS.
1271 (tsubst_friend_function): Use tsubst_constraint. Use generic_targs_for.
1272 (get_underlying_template) Use generic_targs_for.
1273 (uses_parameter_packs): Return tree.
1274 (gen_elem_of_pack_expansion_instantiation): Don't push
1275 local_specialization_stack.
1276 (prepend_one_capture): New.
1277 (tsubst_lambda_expr): Use prepend_one_capture. Don't touch
1278 local_specializations.
1279 (template_parms_level_to_args): No longer static.
1280 (add_outermost_template_args): Likewise.
1281 (find_template_parameter_info): New. Provide context for finding
1282 template parameters.
1283 (keep_template_parm): Don't keep parameters declared at depth levels
1284 greater than those of the template parameters of the source declaration.
1285 Don't propagate cv-qualified types. Return 0, so we find all template
1286 parameters, not the just first.
1287 (any_template_parm_r): New. Handle cases that are mishandled by
1288 for_each_template_parm_r.
1289 (generic_targs_for): Factor out of coerce_template_args_for_ttp.
1290 (tsubst_argument_pack): Factor out of tsubst_template_args.
1291 (constraint_sat_entry): Removed.
1292 (constraint_sat_hasher): Removed.
1293 (concept_spec_entry): Removed.
1294 (concept_spec_hasher): Removed.
1295 (constraint_memos): Removed.
1296 (concept_memos): Removed.
1297 (lookup_constraint_satisfaction): Removed.
1298 (memoize_constraint_satisfaction): Removed.
1299 (lookup_concept_satisfaction): Removed.
1300 (memoize_concept_satisfaction): Removed.
1301 (concept_expansions): Removed.
1302 (get_concept_expansion): Removed.
1303 (save_concept_expansion): Removed.
1304 (init_constraint_processing): Remove initialization of non-existing
1306 (find_template_requirement): New. Search for the sub-requirement
1307 within the associated constraints.
1308 (convert_generic_types_to_packs): Also transform the associated
1309 constraint and update the current template requirements.
1310 (store_defaulted_ttp, lookup_defaulted_ttp): Remove.
1311 (add_defaults_to_ttp): Use hash_map_safe_*.
1312 * semantics.c (finish_call_expr): Diagnose calls to concepts.
1313 Handle concept checks explicitly.
1314 (finish_id_expression): Evaluate variable concepts as part of
1315 id-expression processing. Don't treat variable concepts as variables,
1316 and don't process function concepts as plain id-expressions.
1317 (force_paren_expr): Add even_uneval parm.
1318 (finish_trait_expr): Add location parm.
1319 * tree.c (special_memfn_p): New.
1320 (cp_expr_location): Handle TRAIT_EXPR.
1321 * typeck.c (check_return_expr): Actually use the diagnostic kind
1322 when performing return-type deduction.
1323 * typeck2.c (build_functional_cast): Don't rely on the location of
1326 2019-10-09 Paolo Carlini <paolo.carlini@oracle.com>
1328 * decl.c (grok_ctor_properties): Use DECL_SOURCE_LOCATION.
1329 * typeck.c (cp_build_binary_op): Use the op_location_t argument
1330 in many error messages.
1332 2019-10-08 Martin Sebor <msebor@redhat.com>
1335 * call.c (maybe_warn_class_memaccess): Handle arrays.
1337 2019-10-07 Paolo Carlini <paolo.carlini@oracle.com>
1339 * call.c (resolve_args): Use cp_expr_loc_or_input_loc in one place.
1340 * decl.c (grokdeclarator): Use id_loc in one place.
1341 * decl2.c (build_anon_union_vars): Use DECL_SOURCE_LOCATION.
1342 * parser.c (cp_parser_delete_expression): Fix the location of the
1343 returned expression.
1344 (cp_parser_throw_expression): Likewise.
1345 * pt.c (determine_specialization): Use DECL_SOURCE_LOCATION.
1347 2019-10-05 Jakub Jelinek <jakub@redhat.com>
1349 PR c++/91369 - Implement P0784R7: constexpr new
1350 * cp-tree.h (enum cp_tree_index): Add CPTI_HEAP_UNINIT_IDENTIFIER,
1351 CPTI_HEAP_IDENTIFIER and CPTI_HEAP_DELETED_IDENTIFIER.
1352 (heap_uninit_identifier, heap_identifier, heap_deleted_identifier):
1354 (type_has_constexpr_destructor, build_new_constexpr_heap_type,
1355 cxx_constant_dtor): Declare.
1356 * class.c (type_maybe_constexpr_default_constructor): Make static.
1357 (type_maybe_constexpr_destructor, type_has_constexpr_destructor): New
1359 (finalize_literal_type_property): For c++2a, don't clear
1360 CLASSTYPE_LITERAL_P for types without trivial destructors unless they
1361 have non-constexpr destructors.
1362 (explain_non_literal_class): For c++2a, complain about non-constexpr
1363 destructors rather than about non-trivial destructors.
1364 * constexpr.c: Include stor-layout.h.
1365 (struct constexpr_global_ctx): New type.
1366 (struct constexpr_ctx): Add global field, remove values and
1367 constexpr_ops_count.
1368 (cxx_replaceable_global_alloc_fn): New inline function.
1369 (cxx_eval_call_expression): For c++2a allow calls to replaceable
1370 global allocation functions, for new return address of a heap uninit
1371 var, for delete record its deletion. Change ctx->values->{get,put} to
1372 ctx->global->values.{get,put}.
1373 (non_const_var_error): Add auto_diagnostic_group sentinel. Emit
1374 special diagnostics for heap variables.
1375 (cxx_eval_store_expression): Change ctx->values->{get,put} to
1376 ctx->global->values.{get,put}.
1377 (cxx_eval_loop_expr): Initialize jump_target if NULL. Change
1378 new_ctx.values->remove to ctx->global->values.remove.
1379 (cxx_eval_constant_expression): Change *ctx->constexpr_ops_count
1380 to ctx->global->constexpr_ops_count. Change ctx->values->{get,put} to
1381 ctx->global->values.{get,put}.
1382 <case NOP_EXPR>: Formatting fix. On cast of replaceable global
1383 allocation function to some pointer type, adjust the type of
1384 the heap variable and change name from heap_uninit_identifier
1386 (find_heap_var_refs): New function.
1387 (cxx_eval_outermost_constant_expr): Add constexpr_dtor argument,
1388 handle evaluation of constexpr dtors and add tracking of heap
1389 variables. Use tf_no_cleanup for get_target_expr_with_sfinae.
1390 (cxx_constant_value): Adjust cxx_eval_outermost_constant_expr caller.
1391 (cxx_constant_dtor): New function.
1392 (maybe_constant_value, fold_non_dependent_expr_template,
1393 maybe_constant_init_1): Adjust cxx_eval_outermost_constant_expr
1395 (potential_constant_expression_1): Ignore clobbers. Allow
1396 COND_EXPR_IS_VEC_DELETE for c++2a.
1397 * decl.c (initialize_predefined_identifiers): Add heap identifiers.
1398 (decl_maybe_constant_destruction): New function.
1399 (cp_finish_decl): Don't clear TREE_READONLY for constexpr variables
1400 with non-trivial, but constexpr destructors.
1401 (register_dtor_fn): For constexpr variables with constexpr non-trivial
1402 destructors call cxx_maybe_build_cleanup instead of adding destructor
1404 (expand_static_init): For constexpr variables with constexpr
1405 non-trivial destructors call cxx_maybe_build_cleanup.
1406 (grokdeclarator): Allow constexpr destructors for c++2a. Formatting
1408 (cxx_maybe_build_cleanup): For constexpr variables with constexpr
1409 non-trivial destructors call cxx_constant_dtor instead of adding
1410 destructor calls at runtime.
1411 * init.c: Include stor-layout.h.
1412 (build_new_constexpr_heap_type, maybe_wrap_new_for_constexpr): New
1414 (build_new_1): For c++2a and new[], add cast around the alloc call
1415 to help constexpr evaluation figure out the type of the heap storage.
1416 (build_vec_delete_1): Set DECL_INITIAL of tbase and emit a DECL_EXPR
1417 for it instead of initializing an uninitialized variable.
1418 * method.c: Include intl.h.
1419 (SFK_CTOR_P, SFK_DTOR_P, SFK_ASSIGN_P, SFK_COPY_P, SFK_MOVE_P): Move
1420 definitions earlier.
1421 (process_subob_fn): Add sfk argument, adjust non-constexpr call
1422 diagnostics based on it.
1423 (walk_field_subobs): Formatting fixes. Adjust process_subob_fn caller.
1424 (synthesized_method_base_walk): Likewise.
1425 (synthesized_method_walk): Set *constexpr_p to true for dtors in c++2a.
1426 Fix up DR number in comment.
1427 (implicitly_declare_fn): Formatting fix.
1428 * typeck2.c (store_init_value): Don't call cp_fully_fold_init on
1429 initializers of automatic non-constexpr variables in constexpr
1432 2019-10-04 Jakub Jelinek <jakub@redhat.com>
1435 * constexpr.c (cxx_fold_indirect_ref_1): New function.
1436 (cxx_fold_indirect_ref): Use it.
1439 * cp-gimplify.c (cp_gimplify_expr) <case CALL_EXPR>: For
1440 -fstrong-eval-order ensure CALL_EXPR_FN side-effects are evaluated
1441 before any arguments. Additionally, ensure CALL_EXPR_FN that isn't
1442 invariant nor OBJ_TYPE_REF nor SSA_NAME is forced into a temporary.
1444 2019-10-03 Paolo Carlini <paolo.carlini@oracle.com>
1446 * init.c (build_new): Use cp_expr_loc_or_input_loc in two places.
1447 * name-lookup.c (do_pushdecl): Use DECL_SOURCE_LOCATION.
1448 (push_class_level_binding_1): Likewise.
1449 (set_decl_namespace): Likewise.
1451 2019-10-03 Jakub Jelinek <jakub@redhat.com>
1453 * constexpr.c (cxx_eval_constant_expression) <case CLEANUP_STMT>: If
1454 not skipping upon entry to body, run cleanup with the same *jump_target
1455 as it started to run the cleanup even if the body returns, breaks or
1457 (potential_constant_expression_1): Allow CLEANUP_STMT.
1459 * constexpr.c (cxx_eval_store_expression): Formatting fix. Handle
1460 const_object_being_modified with array type.
1462 2019-10-02 Jason Merrill <jason@redhat.com>
1464 * typeck2.c (store_init_value): Only clear_cv_and_fold_caches if the
1467 2019-09-30 Jason Merrill <jason@redhat.com>
1469 Use hash_map_safe_* functions.
1470 * constexpr.c (maybe_initialize_fundef_copies_table): Remove.
1471 (get_fundef_copy): Use hash_map_safe_get_or_insert.
1472 * cp-objcp-common.c (cp_get_debug_type): Use hash_map_safe_*.
1473 * decl.c (store_decomp_type): Remove.
1474 (cp_finish_decomp): Use hash_map_safe_put.
1475 * init.c (get_nsdmi): Use hash_map_safe_*.
1476 * pt.c (store_defaulted_ttp, lookup_defaulted_ttp): Remove.
1477 (add_defaults_to_ttp): Use hash_map_safe_*.
1479 2019-10-02 Richard Biener <rguenther@suse.de>
1482 * decl.c (build_ptrmemfunc_type): Mark pointer-to-member
1483 fat pointer structure members as DECL_NONADDRESSABLE_P.
1485 2019-09-28 Marek Polacek <polacek@redhat.com>
1487 PR c++/91889 - follow-up fix for DR 2352.
1488 * call.c (involves_qualification_conversion_p): New function.
1489 (direct_reference_binding): Build a ck_qual if the conversion
1490 would involve a qualification conversion.
1491 (convert_like_real): Strip the conversion created by the ck_qual
1492 in direct_reference_binding.
1494 PR c++/91921 - stray warning with -Woverloaded-virtual.
1495 * class.c (warn_hidden): Only emit the second part of
1496 -Woverloaded-virtual if the first part was issued. Use inform instead
1499 PR c++/91923 - failure-to-SFINAE with class type NTTP in C++17.
1500 * pt.c (invalid_nontype_parm_type_p): Only emit errors when
1503 2019-09-27 Jakub Jelinek <jakub@redhat.com>
1506 * parser.c (cp_parser_omp_var_list_no_open): Parse predefined
1508 * semantics.c (finish_omp_clauses): Allow predefined variables in
1509 shared and firstprivate clauses, even when they are predetermined
1511 * cp-gimplify.c (cxx_omp_predetermined_sharing_1): Return
1512 OMP_CLAUSE_DEFAULT_SHARED for predefined variables.
1514 2019-09-27 Jason Merrill <jason@redhat.com>
1516 * constexpr.c (cxx_fold_indirect_ref): Use similar_type_p.
1517 (cxx_eval_indirect_ref): Likewise. Improve error location.
1519 * cp-tree.h (class iloc_sentinel): New.
1520 * decl.c (grokdeclarator, finish_enum_value_list): Use it.
1521 * mangle.c (mangle_decl_string): Use it.
1522 * pt.c (perform_typedefs_access_check): Use it.
1524 2019-09-27 Richard Sandiford <richard.sandiford@arm.com>
1526 * cp-tree.h (build_cxx_call): Take the original function decl
1527 as an optional final parameter.
1528 (cp_build_function_call_vec): Likewise.
1529 * call.c (build_cxx_call): Likewise. Pass all built-in calls to
1530 check_builtin_function_arguments.
1531 * typeck.c (build_function_call_vec): Take the original function
1532 decl as an optional final parameter and pass it to
1533 cp_build_function_call_vec.
1534 (cp_build_function_call_vec): Take the original function
1535 decl as an optional final parameter and pass it to build_cxx_call.
1537 2019-09-25 Marek Polacek <polacek@redhat.com>
1539 PR c++/91877 - ICE with converting member of packed struct.
1540 * call.c (convert_like_real): Use similar_type_p in an assert.
1542 2019-09-25 Paolo Carlini <paolo.carlini@oracle.com>
1544 * name-lookup.c (check_extern_c_conflict): Use DECL_SOURCE_LOCATION.
1545 (check_local_shadow): Use it in three additional places.
1547 2019-09-24 Jason Merrill <jason@redhat.com>
1549 * parser.c (cp_parser_postfix_expression): Do set location of
1550 dependent member call.
1552 2019-09-24 Marek Polacek <polacek@redhat.com>
1554 PR c++/91868 - improve -Wshadow location.
1555 * name-lookup.c (check_local_shadow): Use DECL_SOURCE_LOCATION
1556 instead of input_location.
1558 PR c++/91845 - ICE with invalid pointer-to-member.
1559 * expr.c (mark_use): Use error_operand_p.
1560 * typeck2.c (build_m_component_ref): Check error_operand_p after
1561 calling mark_[lr]value_use.
1563 2019-09-23 Paolo Carlini <paolo.carlini@oracle.com>
1565 * pt.c (check_explicit_specialization): Use cp_expr_loc_or_input_loc.
1566 (process_partial_specialization): Likewise.
1567 (convert_nontype_argument_function): Likewise.
1568 (invalid_tparm_referent_p): Likewise.
1569 (convert_template_argument): Likewise.
1570 (check_valid_ptrmem_cst_expr): Tidy.
1572 2019-09-23 Jason Merrill <jason@redhat.com>
1574 PR c++/91809 - bit-field and ellipsis.
1575 * call.c (convert_arg_to_ellipsis): Don't call decay_conversion for
1576 arithmetic arguments.
1578 2019-09-23 Marek Polacek <polacek@redhat.com>
1580 PR c++/91844 - Implement CWG 2352, Similar types and reference binding.
1581 * call.c (reference_related_p): Use similar_type_p instead of
1583 (reference_compatible_p): Update implementation to match CWG 2352.
1584 * cp-tree.h (similar_type_p): Declare.
1585 * typeck.c (similar_type_p): New.
1587 2019-09-22 Marek Polacek <polacek@redhat.com>
1589 PR c++/91819 - ICE with operator++ and enum.
1590 * call.c (build_new_op_1): Set arg2_type.
1592 2019-09-17 Jason Merrill <jason@redhat.com>
1594 * parser.c (cp_parser_statement): Handle [[likely]] on
1597 2019-09-19 Jason Merrill <jason@redhat.com>
1600 * call.c (build_new_op_1): Don't apply any standard conversions to
1601 the operands of a built-in operator. Don't suppress conversions in
1603 * typeck.c (cp_build_unary_op): Do integral promotions for enums.
1605 2019-09-16 Paolo Carlini <paolo.carlini@oracle.com>
1607 * decl.c (grokdeclarator): Use declspecs->locations and
1608 declarator->id_loc in a few error messages.
1609 * pt.c (finish_member_template_decl): Use DECL_SOURCE_LOCATION.
1610 (push_template_decl_real): Likewise.
1612 2019-09-15 Jason Merrill <jason@redhat.com>
1614 PR c++/30277 - int-width bit-field promotion.
1615 PR c++/33819 - long bit-field promotion.
1616 * typeck.c (cp_perform_integral_promotions): Handle large bit-fields
1617 properly. Handle 32-bit non-int bit-fields properly.
1618 (is_bitfield_expr_with_lowered_type): Don't look through NOP_EXPR.
1620 PR c++/82165 - enum bitfields and operator overloading.
1621 * call.c (build_new_op_1): Use unlowered_expr_type.
1623 * call.c (build_new_op_1): Don't apply any standard conversions to
1624 the operands of a built-in operator. Don't suppress conversions in
1626 * typeck.c (cp_build_unary_op): Do integral promotions for enums.
1628 2019-09-15 Marek Polacek <polacek@redhat.com>
1630 PR c++/91740 - ICE with constexpr call and ?: in ARRAY_REF.
1631 * pt.c (build_non_dependent_expr): Call build_non_dependent_expr for
1634 2019-09-15 Nathan Sidwell <nathan@acm.org>
1636 * cp-tree.h (DECL_CLONED_FUNCTION_P): Reimplement using
1637 IDENTIFIER_CDTOR_P, correct documentation.
1638 (DECL_CLONED_FUNCTION): Directly access field.
1639 (decl_cloned_function_p): Delete.
1640 * class.c (decl_cloned_function_p): Delete.
1641 * pt.c (instantiate_template_1): Check DECL_CHAIN is a decl.
1643 2019-09-11 Nathan Sidwell <nathan@acm.org>
1645 * c-objcp-common.c (cp-objcp-common.c): Alphababetize and
1646 correctly mark all C++ nodes.
1647 * decl.c (cp_tree_node_structure): Alphabetize.
1649 2019-09-10 Marek Polacek <polacek@redhat.com>
1651 PR c++/91673 - ICE with noexcept in alias-declaration.
1652 * parser.c (CP_PARSER_FLAGS_DELAY_NOEXCEPT): New parser flag.
1653 (cp_parser_lambda_declarator_opt): Pass CP_PARSER_FLAGS_NONE to
1654 cp_parser_exception_specification_opt.
1655 (cp_parser_direct_declarator): Adjust a call to
1656 cp_parser_exception_specification_opt.
1657 (cp_parser_member_declaration): Pass CP_PARSER_FLAGS_DELAY_NOEXCEPT
1658 to cp_parser_declarator if not processing a friend or typedef
1660 (cp_parser_late_noexcept_specifier): Adjust a call to
1661 cp_parser_noexcept_specification_opt.
1662 (cp_parser_noexcept_specification_opt): New parameter for parser flags,
1663 drop the FRIEND_P parameter. Use the new parameter.
1664 (cp_parser_exception_specification_opt): Likewise.
1665 (cp_parser_transaction): Adjust a call to
1666 cp_parser_noexcept_specification_opt.
1667 (cp_parser_transaction_expression): Likewise.
1669 2019-09-10 Marek Polacek <polacek@redhat.com>
1671 PR c++/91705 - constexpr evaluation rejects ++/-- on floats.
1672 * constexpr.c (cxx_eval_increment_expression): Call fold_simple on
1675 2019-09-10 Paolo Carlini <paolo.carlini@oracle.com>
1677 * decl.c (has_designator_problem): Use cp_expr_loc_or_input_loc
1679 (build_enumerator): Likewise.
1680 (cp_finish_decl): Use DECL_SOURCE_LOCATION.
1681 (grokdeclarator): Use id_loc in two error_at; change errror
1682 message about constinit together constexpr to use two ranges.
1684 2019-09-09 Marek Polacek <polacek@redhat.com>
1686 PR c++/84374 - diagnose invalid uses of decltype(auto).
1687 * decl.c (grokdeclarator): Diagnose wrong usage of decltype(auto) in
1688 a function declaration.
1690 2019-09-06 Nathan Sidwell <nathan@acm.org>
1693 * cp-tree.h (IDENTIFIER_REPO_CHOSEN, DECL_REPO_AVAILABLE_P): Delete.
1694 (struct lang_decl_base): Remove repo_available_p.
1695 * decl.c (duplicate_decls): Don't copy DECL_REPO_AVAILABLE_P.
1697 (Reserve TREE_LANG_FLAG_3 for modules.
1698 * cp-tree.h (DECL_CONSTRUCTION_VTABLE_P): Delete.
1699 (DECL_NON_TRIVIALLY_INITIALIZED_P): Move to TREE_LANG_FLAG_6.
1700 * class.c (build_ctor_vtbl_group): Don't set
1701 DECL_CONSTRUCTION_VTABLE_P.
1702 * decl2.c (determine_visibility_from_class): Don't check
1703 DECL_CONSTRUCTION_VTABLE_P anymore.
1705 2019-09-06 Martin Liska <mliska@suse.cz>
1708 * Make-lang.in: Remove repo.o.
1709 * config-lang.in: Likewise.
1710 * cp-tree.h (init_repo): Remove declarations
1711 of repo-related functions.
1712 (repo_emit_p): Likewise.
1713 (repo_export_class_p): Likewise.
1714 (finish_repo): Likewise.
1715 * decl2.c (import_export_class): Always
1717 (mark_needed): Remove -frepo from comment.
1718 (import_export_decl): Similarly here.
1719 (c_parse_final_cleanups): Remove call of finish_repo.
1720 * lex.c (cxx_init): Remove call to init_repo.
1721 * optimize.c (can_alias_cdtor): Remove dead condition.
1722 * pt.c (push_template_decl_real): Update comment.
1723 (instantiate_decl): Remove dead code used for -frepo.
1726 2019-09-05 Marek Polacek <polacek@redhat.com>
1728 PR c++/91644 - ICE with constinit in function template.
1729 * decl.c (start_decl): Call retrofit_lang_decl for constinit variables.
1730 * pt.c (tsubst_expr): Pass LOOKUP_CONSTINIT down to cp_finish_decl for
1731 constinit variables.
1733 2019-09-05 Nathan Sidwell <nathan@acm.org>
1735 * cp-tree.h (DECL_VTABLE_OR_VTT_P): Forward to DECL_VIRTUAL_P.
1737 2019-09-04 Marek Polacek <polacek@redhat.com>
1739 * call.c (build_over_call): Remove -fdeduce-init-list implementation.
1740 * pt.c (unify): Likewise.
1742 2019-09-01 Marek Polacek <polacek@redhat.com>
1744 PR c++/91129 - wrong error with binary op in template argument.
1745 * typeck.c (warn_for_null_address): Use fold_for_warn instead of
1746 fold_non_dependent_expr.
1747 (cp_build_binary_op): Likewise.
1749 2019-08-30 Jason Merrill <jason@redhat.com>
1751 Add source location to TRAIT_EXPR.
1752 * cp-tree.h (TRAIT_EXPR_LOCATION): New.
1753 (struct tree_trait_expr): Add locus field.
1754 * parser.c (cp_parser_trait_expr): Pass trait_loc down.
1755 * pt.c (tsubst_copy_and_build) [TRAIT_EXPR]: Likewise.
1756 * semantics.c (finish_trait_expr): Add location parm.
1757 * tree.c (cp_expr_location): Handle TRAIT_EXPR.
1759 2019-08-29 Paolo Carlini <paolo.carlini@oracle.com>
1761 * decl.c (check_var_type): Add location_t parameter and use it.
1762 (grokdeclarator): Adjust call.
1763 * pt.c (tsubst_decl): Likewise.
1764 * cp-tree.h: Adjust declaration.
1766 2019-08-28 Marek Polacek <polacek@redhat.com>
1768 Implement P1152R4: Deprecating some uses of volatile.
1770 * cp-gimplify.c (cp_fold): Set TREE_THIS_VOLATILE.
1771 * decl.c (grokdeclarator): Warn about a volatile-qualified structured
1772 binding and return type.
1773 (grokparms): Warn about a volatile-qualified function parameter.
1774 * expr.c (mark_use) <case MODIFY_EXPR>: Emit a -Wvolatile warning.
1775 * typeck.c (cp_build_unary_op): Emit a -Wvolatile warning for pre and
1776 post ++/-- on a volatile operand.
1777 (genericize_compound_lvalue): Use a better location. Don't lose
1779 (cp_build_modify_expr): Emit a -Wvolatile warning for a compound
1780 assignment whose LHS is volatile-qualified. Build the assignment with
1781 a more precise location.
1783 2019-08-28 Marek Polacek <polacek@redhat.com>
1785 PR c++/91360 - Implement C++20 P1143R2: constinit.
1786 * cp-tree.h (TINFO_VAR_DECLARED_CONSTINIT): Define.
1787 (LOOKUP_CONSTINIT): Define.
1788 (enum cp_decl_spec): Add ds_constinit.
1789 * decl.c (check_tag_decl): Give an error for constinit in type
1791 (check_initializer): Also check LOOKUP_CONSTINIT.
1792 (cp_finish_decl): Add checking for a constinit declaration. Set
1793 TINFO_VAR_DECLARED_CONSTINIT.
1794 (grokdeclarator): Add checking for a declaration with the constinit
1796 * lex.c (init_reswords): Handle D_CXX20.
1797 * parser.c (cp_lexer_get_preprocessor_token): Pass a better location
1798 to warning_at. Warn about C++20 keywords.
1799 (cp_keyword_starts_decl_specifier_p): Handle RID_CONSTINIT.
1800 (cp_parser_diagnose_invalid_type_name): Add an inform about constinit.
1801 (cp_parser_decomposition_declaration): Maybe pass LOOKUP_CONSTINIT to
1803 (cp_parser_decl_specifier_seq): Handle RID_CONSTINIT.
1804 (cp_parser_init_declarator): Maybe pass LOOKUP_CONSTINIT to
1806 (set_and_check_decl_spec_loc): Add "constinit".
1807 * pt.c (tsubst_decl): Set TINFO_VAR_DECLARED_CONSTINIT.
1808 (instantiate_decl): Maybe pass LOOKUP_CONSTINIT to cp_finish_decl.
1809 * typeck2.c (store_init_value): If a constinit variable wasn't
1810 initialized using a constant initializer, give an error.
1812 2019-08-28 Nathan Sidwell <nathan@acm.org>
1815 * name-lookup.c (cp_emit_debug_info): Check for builtins during
1818 2019-08-27 Marek Polacek <polacek@redhat.com>
1820 PR c++/81676 - bogus -Wunused warnings in constexpr if.
1821 * semantics.c (maybe_mark_exp_read_r): New function.
1822 (finish_if_stmt): Call it on THEN_CLAUSE and ELSE_CLAUSE.
1824 PR c++/91428 - warn about std::is_constant_evaluated in if constexpr.
1825 * cp-tree.h (decl_in_std_namespace_p): Declare.
1826 * semantics.c (is_std_constant_evaluated_p): New.
1827 (finish_if_stmt_cond): Warn about "std::is_constant_evaluated ()" in
1829 * typeck.c (decl_in_std_namespace_p): No longer static.
1831 2019-08-26 Jason Merrill <jason@redhat.com>
1833 * decl.c (duplicate_decls): Always merge DECL_DECLARED_CONSTEXPR_P.
1835 2019-08-26 Marek Polacek <polacek@redhat.com>
1837 PR c++/91545 - ICE in constexpr store evaluation.
1838 * constexpr.c (cxx_eval_store_expression): Check FIELD_DECL instead
1841 2019-08-24 Nathan Sidwell <nathan@acm.org>
1843 * class.c (check_for_overrides): Conversion operators need
1846 2019-08-24 Paolo Carlini <paolo.carlini@oracle.com>
1848 * semantics.c (finish_switch_cond): Improve error message location.
1850 2019-08-23 Jason Merrill <jason@redhat.com>
1852 * decl2.c (decl_dependent_p): New.
1853 (mark_used): Check it instead of just processing_template_decl.
1855 2019-08-23 Jason Merrill <jason@redhat.com>
1857 * parser.c (cp_parser_nested_name_specifier_opt): Avoid redundant
1860 2019-08-23 Marek Polacek <polacek@redhat.com>
1862 PR c++/91521 - wrong error with operator->.
1863 * decl.c (grokdeclarator): Return error_mark_node for an invalid
1864 trailing return type.
1866 PR c++/79817 - attribute deprecated on namespace.
1867 * cp-tree.h (cp_warn_deprecated_use_scopes): Declare.
1868 * decl.c (grokdeclarator): Call cp_warn_deprecated_use_scopes.
1869 (type_is_deprecated): Likewise.
1870 * decl2.c (cp_warn_deprecated_use_scopes): New function.
1871 * name-lookup.c (handle_namespace_attrs): Handle attribute deprecated.
1872 * parser.c (cp_parser_namespace_alias_definition): Call
1873 cp_warn_deprecated_use_scopes.
1874 (cp_parser_using_declaration): Likewise.
1875 (cp_parser_using_directive): Likewise.
1876 * semantics.c (finish_id_expression_1): Likewise.
1878 2019-08-23 Nathan Sidwell <nathan@acm.org>
1880 * class.c (check_for_override): Checking IDENTIFIER_VIRTUAL_P is
1881 sufficient, reorder DECL_OVERRIDE_P check.
1883 2019-08-23 Iain Sandoe <iain@sandoe.co.uk>
1886 * parser.c (cp_parser_initial_pragma): Call c_common_no_more_pch ()
1887 after determining that the first token is not
1888 PRAGMA_GCC_PCH_PREPROCESS.
1890 2019-08-22 Marek Polacek <polacek@redhat.com>
1892 PR c++/91304 - prefix attributes ignored in condition.
1893 * parser.c (cp_parser_condition): Handle prefix attributes.
1895 2019-08-21 Richard Sandiford <richard.sandiford@arm.com>
1898 * decl.c (duplicate_decls): Call copy_attributes_to_builtin inside
1899 the BUILT_IN_NORMAL block rather than afterward.
1901 2019-08-19 Marek Polacek <polacek@redhat.com>
1903 PR c++/91264 - detect modifying const objects in constexpr.
1904 * constexpr.c (modifying_const_object_error): New function.
1905 (cxx_eval_call_expression): Set TREE_READONLY on a CONSTRUCTOR of
1906 a const-qualified object after it's been fully constructed.
1907 (modifying_const_object_p): New function.
1908 (cxx_eval_store_expression): Detect modifying a const object
1909 during constant expression evaluation.
1910 (cxx_eval_increment_expression): Use a better location when building
1912 (cxx_eval_constant_expression) <case DECL_EXPR>: Mark a constant
1913 object's constructor TREE_READONLY.
1915 2019-08-15 Jason Merrill <jason@redhat.com>
1917 PR c++/90393 - ICE with thow in ?:
1919 PR c++/64372, DR 1560 - Gratuitous lvalue-to-rvalue conversion in ?:
1920 * tree.c (lvalue_kind): Handle throw in one arm.
1921 * typeck.c (rationalize_conditional_expr): Likewise.
1922 (cp_build_modify_expr): Likewise.
1924 2019-08-14 Jason Merrill <jason@redhat.com>
1926 Implement P0848R3, Conditionally Trivial Special Member Functions.
1927 * tree.c (special_memfn_p): New.
1928 * class.c (add_method): When overloading, hide ineligible special
1930 (check_methods): Set TYPE_HAS_COMPLEX_* here.
1931 * decl.c (grok_special_member_properties): Not here.
1932 * name-lookup.c (push_class_level_binding_1): Move overloaded
1933 functions case down, accept FUNCTION_DECL as target_decl.
1935 2019-08-14 Jonathan Wakely <jwakely@redhat.com>
1938 * name-lookup.c (get_std_name_hint): Fix min_dialect field for
1939 complex_literals and make_unique entries.
1941 2019-08-14 Jakub Jelinek <jakub@redhat.com>
1942 Marek Polacek <polacek@redhat.com>
1944 PR c++/91391 - bogus -Wcomma-subscript warning.
1945 * parser.c (cp_parser_postfix_open_square_expression): Don't warn about
1946 a deprecated comma here. Pass warn_comma_subscript down to
1947 cp_parser_expression.
1948 (cp_parser_expression): New bool parameter. Warn about uses of a comma
1949 operator within a subscripting expression.
1950 (cp_parser_skip_to_closing_square_bracket): Revert to pre-r274121 state.
1951 (cp_parser_skip_to_closing_square_bracket_1): Remove.
1953 2019-08-14 Jonathan Wakely <jwakely@redhat.com>
1955 * name-lookup.c (get_std_name_hint): Add more entries.
1957 2019-08-14 Paolo Carlini <paolo.carlini@oracle.com>
1959 * decl2.c (grok_array_decl): Use the location of the open square
1960 bracket in error message about invalid types.
1962 2019-08-14 Paolo Carlini <paolo.carlini@oracle.com>
1964 * decl.c (grokdeclarator): Check here for typedef a function
1965 definition or a member function definition.
1966 (start_function): Adjust.
1967 (grokmethod): Likewise.
1969 2019-08-13 Richard Sandiford <richard.sandiford@arm.com>
1972 * decl.c (duplicate_decls): Use copy_decl_built_in_function.
1973 * pt.c (declare_integer_pack): Use set_decl_built_in_function.
1975 2019-08-13 Marek Polacek <polacek@redhat.com>
1977 PR c++/90473 - wrong code with nullptr in default argument.
1978 * call.c (null_ptr_cst_p): Update quote from the standard.
1979 * decl.c (check_default_argument): Don't return nullptr when the arg
1982 2019-08-13 Marek Polacek <polacek@redhat.com>
1984 * cp-tree.h (DECL_MUTABLE_P): Use FIELD_DECL_CHECK.
1986 2019-08-10 Jakub Jelinek <jakub@redhat.com>
1988 * parser.c (cp_parser_omp_clause_name): Parse device_type.
1989 (cp_parser_omp_clause_device_type): New function.
1990 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_DEVICE_TYPE.
1991 (OMP_DECLARE_TARGET_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_DEVICE_TYPE.
1992 (cp_parser_omp_declare_target): Handle device_type clauses. Remove
1993 diagnostics for declare target with clauses nested in clause-less
1994 declare target declaration-definition-seq.
1995 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_DEVICE_TYPE.
1997 2019-08-09 Jakub Jelinek <jakub@redhat.com>
1999 * parser.c (check_no_duplicate_clause): Simplify using
2001 (cp_parser_omp_clause_if): Fix up printing of target {enter,exit} data
2002 directive name modifiers.
2005 * parser.c (cp_parser_omp_clause_dist_schedule): Comment out the
2006 check_no_duplicate_clause call, instead emit a warning for duplicate
2007 dist_schedule clauses.
2009 2019-08-08 Paolo Carlini <paolo.carlini@oracle.com>
2011 * decl.c (grokdeclarator): Use id_loc and EXPR_LOCATION in
2012 a few error messages.
2014 2019-08-08 Marek Polacek <polacek@redhat.com>
2016 PR c++/87519 - bogus warning with -Wsign-conversion.
2017 * typeck.c (cp_build_binary_op): Use same_type_p instead of comparing
2020 * constexpr.c (inline_asm_in_constexpr_error): New.
2021 (cxx_eval_constant_expression) <case ASM_EXPR>: Call it.
2022 (potential_constant_expression_1) <case ASM_EXPR>: Likewise.
2024 2019-08-08 Jakub Jelinek <jakub@redhat.com>
2026 * semantics.c (finish_omp_clauses): For C_ORT_OMP
2027 OMP_CLAUSE_USE_DEVICE_* clauses use oacc_reduction_head bitmap
2028 instead of generic_head to track duplicates.
2030 2019-08-07 Marek Polacek <polacek@redhat.com>
2032 PR c++/81429 - wrong parsing of constructor with C++11 attribute.
2033 * parser.c (cp_parser_constructor_declarator_p): Handle the scenario
2034 when a parameter declaration begins with [[attribute]].
2036 2019-08-07 Marek Polacek <polacek@redhat.com>
2038 PR c++/91346 - Implement P1668R1, allow unevaluated asm in constexpr.
2039 * constexpr.c (cxx_eval_constant_expression): Handle ASM_EXPR.
2040 (potential_constant_expression_1) <case ASM_EXPR>: Allow.
2041 * cp-tree.h (finish_asm_stmt): Adjust.
2042 * parser.c (cp_parser_asm_definition): Grab the locaion of "asm" and
2043 use it. Change an error to a pedwarn. Allow asm in C++2a, warn
2045 * pt.c (tsubst_expr): Pass a location down to finish_asm_stmt.
2046 * semantics.c (finish_asm_stmt): New location_t parameter. Use it.
2048 2019-08-07 Jakub Jelinek <jakub@redhat.com>
2050 * parser.c (cp_parser_omp_clause_name): Parse use_device_addr clause.
2051 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR.
2052 (OMP_TARGET_DATA_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR.
2053 (cp_parser_omp_target_data): Handle PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR
2054 like PRAGMA_OMP_CLAUSE_USE_DEVICE_PTR, adjust diagnostics about no
2055 map or use_device_* clauses.
2056 * semantics.c (finish_omp_clauses): For OMP_CLAUSE_USE_DEVICE_PTR
2057 in OpenMP, require pointer or reference to pointer type rather than
2058 pointer or array or reference to pointer or array type. Handle
2059 OMP_CLAUSE_USE_DEVICE_ADDR.
2060 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_USE_DEVICE_ADDR.
2062 2019-08-06 Jason Merrill <jason@redhat.com>
2064 PR c++/91378 - ICE with noexcept and auto return type.
2065 * pt.c (maybe_instantiate_noexcept): push_to_top_level.
2067 2019-08-06 Paolo Carlini <paolo.carlini@oracle.com>
2069 * decl.c (check_array_designated_initializer): Use
2070 cp_expr_loc_or_input_loc in one place.
2072 2019-08-06 Jakub Jelinek <jakub@redhat.com>
2074 * parser.c (cp_parser_omp_for_loop): For OMP_LOOP, ignore parallel
2075 clauses and predetermine iterator as lastprivate.
2076 * semantics.c (handle_omp_for_class_iterator): Use
2077 OMP_CLAUSE_LASTPRIVATE_LOOP_IV instead of
2078 OMP_CLAUSE_LASTPRIVATE_TASKLOOP_IV, set it for lastprivate also
2079 on OMP_LOOP construct. If a clause is missing for class iterator
2080 on OMP_LOOP, add firstprivate clause, and if there is private
2081 clause, turn it into firstprivate too.
2082 (finish_omp_for): Formatting fix. For OMP_LOOP, adjust
2083 OMP_CLAUSE_LASTPRIVATE_LOOP_IV clause CP_CLAUSE_INFO, so that it
2084 uses copy ctor instead of default ctor.
2085 * cp-gimplify.c (cp_gimplify_expr): Handle OMP_LOOP like
2087 (cp_fold_r): Likewise.
2088 (cp_genericize_r): Likewise.
2089 (cxx_omp_finish_clause): Also finish lastprivate clause with
2090 OMP_CLAUSE_LASTPRIVATE_LOOP_IV flag.
2091 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_BIND.
2092 (tsubst_omp_for_iterator): For OMP_LOOP, ignore parallel
2093 clauses and predetermine iterator as lastprivate.
2094 * constexpr.c (potential_constant_expression_1): Handle OMP_LOOP
2095 like OMP_DISTRIBUTE etc.
2097 2019-08-05 Marek Polacek <polacek@redhat.com>
2099 DR 2413 - typename in conversion-function-ids.
2100 * parser.c (cp_parser_conversion_type_id): Call
2101 cp_parser_type_specifier_seq with CP_PARSER_FLAGS_TYPENAME_OPTIONAL
2102 instead of CP_PARSER_FLAGS_NONE.
2104 2019-08-05 Paolo Carlini <paolo.carlini@oracle.com>
2106 * cp-tree.h (cp_expr_loc_or_input_loc): New.
2107 (cxx_incomplete_type_diagnostic): Use it.
2108 * call.c (build_converted_constant_expr_internal, convert_like_real,
2109 convert_arg_to_ellipsis, convert_for_arg_passing, build_over_call,
2110 build_cxx_call, perform_implicit_conversion_flags,
2111 initialize_reference): Likewise.
2112 * constexpr.c (cxx_eval_internal_function, cxx_eval_call_expression,
2113 eval_and_check_array_index, cxx_eval_store_expression,
2114 cxx_eval_statement_list, cxx_eval_loop_expr,
2115 cxx_eval_constant_expression, potential_constant_expression_1):
2117 * constraint.cc (check_for_logical_overloads,
2118 satisfy_predicate_constraint): Likewise.
2119 * cp-gimplify.c (cp_gimplify_expr): Likewise.
2120 * cvt.c (cp_convert_to_pointer, convert_to_reference,
2121 cp_convert_and_check, ocp_convert, maybe_warn_nodiscard): Likewise.
2122 * decl.c (pop_switch): Likewise.
2123 * decl2.c (delete_sanity): Likewise.
2124 * error.c (location_of): Likewise.
2125 * init.c (maybe_warn_list_ctor, build_aggr_init,
2126 warn_placement_new_too_small, build_new_1, build_vec_init): Likewise.
2127 * lex.c (unqualified_name_lookup_error): Likewise.
2128 * parser.c (cp_parser_initializer_list, cp_parser_omp_for_cond):
2130 * pt.c (check_for_bare_parameter_packs, check_valid_ptrmem_cst_expr,
2131 unify_arg_conversion, convert_nontype_argument,
2132 tsubst_copy_and_build, resolve_typename_type): Likewise.
2133 * semantics.c (maybe_convert_cond, finish_call_expr,
2134 cp_build_vec_convert): Likewise.
2135 * typeck.c (decay_conversion, rationalize_conditional_expr,
2136 cp_build_unary_op, build_x_compound_expr_from_list,
2137 maybe_warn_about_returning_address_of_local,
2138 maybe_warn_pessimizing_move): Likewise.
2139 * typeck2.c (check_narrowing, digest_init_r,
2140 process_init_constructor_array): Likewise.
2142 2019-08-05 Tom Honermann <tom@honermann.net>
2144 * parser.c (cp_parser_template_declaration_after_parameters): Enable
2145 class template argument deduction for non-type template parameters
2146 in literal operator templates.
2148 2019-08-05 Marek Polacek <polacek@redhat.com>
2150 PR c++/91338 - Implement P1161R3: Deprecate a[b,c].
2151 * parser.c (cp_parser_postfix_open_square_expression): Warn about uses
2152 of a comma operator within a subscripting expression.
2153 (cp_parser_skip_to_closing_square_bracket_1): New function, made out
2155 (cp_parser_skip_to_closing_square_bracket): ...this.
2157 2019-08-05 Jason Merrill <jason@redhat.com>
2159 * semantics.c (force_paren_expr): Preserve location.
2161 2019-08-02 Marek Polacek <polacek@redhat.com>
2163 PR c++/91230 - wrong error with __PRETTY_FUNCTION__ and generic lambda.
2164 * pt.c (value_dependent_expression_p): Consider __PRETTY_FUNCTION__
2165 inside a template function value-dependent.
2167 2019-08-02 Paolo Carlini <paolo.carlini@oracle.com>
2169 * tree.c (handle_nodiscard_attribute): Do not warn about nodiscard
2170 applied to a constructor.
2172 2019-08-02 Martin Liska <mliska@suse.cz>
2174 * decl.c (grok_op_properties):
2175 Mark DECL_SET_IS_OPERATOR_DELETE for user-provided delete operators.
2177 2019-08-01 Martin Sebor <msebor@redhat.com>
2180 * decl.c (reshape_init_array_1): Avoid truncating initializer
2181 lists containing string literals.
2183 2019-08-01 Marek Polacek <polacek@redhat.com>
2185 PR c++/90805 - detect narrowing in case values.
2186 * decl.c (case_conversion): Detect narrowing in case values.
2188 2019-07-31 Paolo Carlini <paolo.carlini@oracle.com>
2190 * decl2.c (delete_sanity): Improve diagnostic locations, use
2191 cp_expr_loc_or_loc in four places.
2193 2019-07-31 Jason Merrill <jason@redhat.com>
2195 PR c++/90538 - multiple expansions of capture packs
2196 * cp-tree.h (DECLTYPE_FOR_INIT_CAPTURE): Remove.
2197 * lambda.c (add_capture): Copy parameter packs from init.
2198 (lambda_capture_field_type): Always use auto for init-capture.
2199 * pt.c (uses_parameter_packs): Return tree.
2200 (tsubst) [DECLTYPE_TYPE]: Remove init-capture handling.
2201 (gen_elem_of_pack_expansion_instantiation): Don't push
2202 local_specialization_stack.
2203 (prepend_one_capture): New.
2204 (tsubst_lambda_expr): Use it. Don't touch local_specializations.
2205 (do_auto_deduction): Avoid redundant error.
2207 Fix copy_node of TEMPLATE_INFO.
2208 * cp-tree.h (struct tree_template_info): Use tree_base instead of
2209 tree_common. Add tmpl and args fields.
2210 (TI_TEMPLATE, TI_ARGS): Adjust.
2212 2019-07-30 Martin Liska <mliska@suse.cz>
2214 PR tree-optimization/91270
2215 * tree-ssa-dce.c (propagate_necessity): Mark 2nd argument
2216 of delete operator as needed.
2218 2019-07-25 Martin Liska <mliska@suse.cz>
2219 Dominik Infuhr <dominik.infuehr@theobroma-systems.com>
2222 * decl.c (cxx_init_decl_processing): Mark delete operators
2223 with DECL_SET_IS_OPERATOR_DELETE.
2225 2019-07-25 Martin Liska <mliska@suse.cz>
2227 * decl.c (duplicate_decls): Use new macros
2228 (e.g. DECL_SET_LAMBDA_FUNCTION and DECL_LAMBDA_FUNCTION_P).
2229 (cxx_init_decl_processing): Likewise.
2230 (grok_op_properties): Likewise.
2231 * parser.c (cp_parser_lambda_declarator_opt): Likewise.
2233 2019-07-24 Martin Sebor <msebor@redhat.com>
2236 * decl.c (finish_function): Use lang_mask.
2238 2019-07-20 Jason Merrill <jason@redhat.com>
2240 * cp-tree.h (ovl_iterator::using_p): A USING_DECL by itself was also
2241 introduced by a using-declaration.
2243 2019-07-20 Jason Merrill <jason@redhat.com>
2245 Reduce memory consumption for push/pop_access_scope.
2246 * name-lookup.c (leave_scope): Do add class levels other than
2247 previous_class_level to free_binding_level.
2248 (invalidate_class_lookup_cache): Move from class.c, add to
2250 * pt.c (saved_access_scope): Change from list to vec.
2252 2019-07-20 Jakub Jelinek <jakub@redhat.com>
2254 * cp-tree.h (OMP_FOR_GIMPLIFYING_P): Use OMP_LOOPING_CHECK
2255 instead of OMP_LOOP_CHECK.
2256 * parser.c (cp_parser_omp_clause_name): Handle bind clause.
2257 (cp_parser_omp_clause_bind): New function.
2258 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_BIND.
2259 (OMP_LOOP_CLAUSE_MASK): Define.
2260 (cp_parser_omp_loop): New function.
2261 (cp_parser_omp_parallel, cp_parser_omp_teams): Handle parsing of
2262 loop combined with parallel or teams.
2263 (cp_parser_omp_construct): Handle PRAGMA_OMP_LOOP.
2264 (cp_parser_pragma): Likewise.
2265 * pt.c (tsubst_expr): Handle OMP_LOOP.
2266 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_BIND.
2268 2019-07-19 Jason Merrill <jason@redhat.com>
2270 PR c++/90101 - dependent class non-type parameter.
2271 * pt.c (invalid_nontype_parm_type_p): Check for dependent class type.
2273 2019-07-18 Jason Merrill <jason@redhat.com>
2275 PR c++/90098 - partial specialization and class non-type parms.
2278 * call.c (build_converted_constant_expr_internal): Don't copy.
2279 * pt.c (process_partial_specialization): Allow VIEW_CONVERT_EXPR
2280 around class non-type parameter.
2281 (unify) [TEMPLATE_PARM_INDEX]: Ignore cv-quals.
2283 2019-07-16 Jason Merrill <jason@redhat.com>
2285 * parser.c (make_location): Add overload taking cp_lexer* as last
2288 * parser.c (cp_parser_simple_type_specifier): Separate tentative
2289 parses for optional type-spec and CTAD.
2291 * parser.c (cp_parser_nested_name_specifier_opt): If the token is
2292 already CPP_NESTED_NAME_SPECIFIER, leave it alone.
2294 2019-07-12 Jakub Jelinek <jakub@redhat.com>
2296 * parser.c (cp_parser_omp_clause_name): Handle order clause.
2297 (cp_parser_omp_clause_order): New function.
2298 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_ORDER.
2299 (OMP_SIMD_CLAUSE_MASK, OMP_FOR_CLAUSE_MASK): Add
2300 PRAGMA_OMP_CLAUSE_ORDER.
2301 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_ORDER.
2302 * pt.c (tsubst_omp_clauses): Likewise.
2304 2019-07-10 Paolo Carlini <paolo.carlini@oracle.com>
2306 * decl.c (get_type_quals,
2307 smallest_type_location (const cp_decl_specifier_seq*)): New.
2308 (check_tag_decl): Use smallest_type_location in error_at about
2309 multiple types in one declaration.
2310 (grokdeclarator): Use locations[ds_complex] in error_at about
2311 complex invalid; use locations[ds_storage_class] in error_at
2312 about static cdtor; use id_loc in error_at about flexible
2313 array member in union; use get_type_quals.
2315 2019-07-09 Martin Sebor <msebor@redhat.com>
2318 * cp-tree.h: Change class-key of PODs to struct and others to class.
2320 * semantics.c (finalize_nrv_r): Same.
2322 2019-07-09 Martin Sebor <msebor@redhat.com>
2325 * constexpr.c (cxx_eval_call_expression): Change class-key from class
2326 to struct and vice versa to match convention and avoid -Wclass-is-pod
2327 and -Wstruct-no-pod.
2328 * constraint.cc (get_concept_definition): Same.
2330 * cxx-pretty-print.h: Same.
2332 * logic.cc (term_list::replace): Same.
2333 * name-lookup.c (find_local_binding): Same.
2334 * pt.c (tsubst_binary_right_fold): Same.
2335 * search.c (field_accessor_p): Same.
2336 * semantics.c (expand_or_defer_fn): Same.
2338 2019-07-08 Jakub Jelinek <jakub@redhat.com>
2341 * decl2.c (cp_omp_mappable_type_1): Don't emit any note for
2342 error_mark_node type.
2344 2019-07-05 Jakub Jelinek <jakub@redhat.com>
2348 * call.c (build_new_method_call_1): Remove set but not used variable
2351 2019-07-05 Paolo Carlini <paolo.carlini@oracle.com>
2353 PR c++/67184 (again)
2355 * call.c (build_over_call): Devirtualize user-defined operators
2356 coming from a base too.
2357 (build_new_method_call_1): Do not devirtualize here.
2359 2019-07-04 Marek Polacek <polacek@redhat.com>
2362 PR c++/83374 - __is_standard_layout wrong for a class with repeated
2364 * class.c (check_bases): Set CLASSTYPE_NON_STD_LAYOUT for a class if
2365 CLASSTYPE_REPEATED_BASE_P is true.
2367 2019-07-04 Andrew Stubbs <ams@codesourcery.com>
2369 * cp-tree.h (cp_omp_emit_unmappable_type_notes): New prototype.
2370 * decl.c (cp_finish_decl): Call cp_omp_emit_unmappable_type_notes.
2371 * decl2.c (cp_omp_mappable_type): Move contents to ...
2372 (cp_omp_mappable_type_1): ... here and add note output.
2373 (cp_omp_emit_unmappable_type_notes): New function.
2374 * semantics.c (finish_omp_clauses): Call
2375 cp_omp_emit_unmappable_type_notes in four places.
2377 2019-07-03 Martin Liska <mliska@suse.cz>
2379 * call.c (build_new_op_1): Remove dead assignemts.
2380 * typeck.c (cp_build_binary_op): Likewise.
2382 2019-06-27 Jason Merrill <jason@redhat.com>
2384 PR c++/55442 - memory-hog with highly recursive constexpr.
2385 * constexpr.c (push_cx_call_context): Return depth.
2386 (cxx_eval_call_expression): Don't cache past constexpr_cache_depth.
2388 2019-06-27 Jan Hubicka <jh@suse.cz>
2390 * class.c (layout_class_type): Set TYPE_CXX_ODR_P for as-base
2393 2019-06-27 Martin Liska <mliska@suse.cz>
2395 * class.c (adjust_clone_args): Remove obviously
2397 (dump_class_hierarchy_r): Likewise.
2398 * decl.c (check_initializer): Likewise.
2399 * parser.c (cp_parser_lambda_expression): Likewise.
2400 * pt.c (unify_bound_ttp_args): Likewise.
2401 (convert_template_argument): Likewise.
2402 * rtti.c (build_headof): Likewise.
2403 * typeck.c (convert_for_initialization): Likewise.
2405 2019-06-25 Jason Merrill <jason@redhat.com>
2407 PR c++/70462 - unnecessary base ctor variant with final.
2408 * optimize.c (populate_clone_array): Skip base variant if
2410 (maybe_clone_body): We don't need an alias if we are only defining
2413 * class.c (resolves_to_fixed_type_p): Check CLASSTYPE_FINAL.
2415 2019-06-25 Jakub Jelinek <jakub@redhat.com>
2418 * constexpr.c (cxx_eval_array_reference): Don't look through VCE from
2419 vector type if lval.
2421 2019-06-25 Jozef Lawrynowicz <jozef.l@mittosystems.com>
2423 * lex.c (init_reswords): Create keyword for "__intN__" type.
2424 * cp-tree.h (cp_decl_specifier_seq): New bitfield "int_n_alt".
2425 * decl.c (grokdeclarator): Don't pedwarn about "__intN" ISO
2426 C incompatibility if alternate "__intN__" form is used.
2427 * parser.c (cp_parser_simple_type_specifier): Set
2428 decl_specs->int_n_alt if "__intN__" form is used.
2430 2019-06-24 Jan Hubicka <jh@suse.cz>
2432 * lex.c (cxx_make_type): Set TYPE_CXX_ODR_P.
2434 2019-06-24 Jason Merrill <jason@redhat.com>
2436 * class.c (layout_class_type): Don't use a separate
2437 CLASSTYPE_AS_BASE if it's the same size.
2439 2019-06-23 Marek Polacek <polacek@redhat.com>
2441 * call.c (convert_default_arg): Use DEFERRED_PARSE instead of
2443 * cp-objcp-common.c (cp_tree_size): Likewise. Use tree_deferred_parse
2444 instead of tree_default_arg.
2445 * cp-tree.def: Rename DEFAULT_ARG to DEFERRED_PARSE.
2446 * cp-tree.h: Rename DEFARG_TOKENS to DEFPARSE_TOKENS. Rename
2447 DEFARG_INSTANTIATIONS to DEFPARSE_INSTANTIATIONS. Rename
2448 tree_default_arg to tree_deferred_parse.
2449 (UNPARSED_NOEXCEPT_SPEC_P): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2450 (cp_tree_node_structure_enum): Rename TS_CP_DEFAULT_ARG to
2451 TS_CP_DEFERRED_PARSE.
2452 (lang_tree_node): Rename tree_default_arg to tree_deferred_parse.
2453 Rename default_arg to deferred_parse. Use TS_CP_DEFERRED_PARSE instead
2454 of TS_CP_DEFAULT_ARG.
2455 (defarg_location): Remove declaration.
2456 (defparse_location): Add declaration.
2457 * decl.c (grokfndecl): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2458 Call defparse_location instead of defarg_location.
2459 (check_default_argument): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2460 (cp_tree_node_structure): Likewise. Use TS_CP_DEFERRED_PARSE instead
2461 of TS_CP_DEFAULT_ARG.
2462 * decl2.c (grokfield): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2463 * error.c (dump_expr): Likewise.
2464 (location_of): Likewise.
2465 * init.c (get_nsdmi): Likewise.
2466 * parser.c (cp_parser_save_noexcept): Likewise. Use DEFPARSE_TOKENS
2467 instead of DEFARG_TOKENS.
2468 (cp_parser_late_noexcept_specifier): Likewise.
2469 (cp_parser_late_parse_one_default_arg): Use DEFPARSE_TOKENS instead
2471 (cp_parser_late_parsing_default_args): Use DEFERRED_PARSE instead of
2472 DEFAULT_ARG. Use DEFPARSE_INSTANTIATIONS instead of
2473 DEFARG_INSTANTIATIONS.
2474 (cp_parser_cache_defarg): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2475 Use DEFPARSE_TOKENS instead of DEFARG_TOKENS. Use
2476 DEFPARSE_INSTANTIATIONS instead of DEFARG_INSTANTIATIONS.
2477 (defparse_location): Renamed from defarg_location.
2478 * pt.c (tsubst_default_argument): Use DEFERRED_PARSE instead of
2480 (tsubst_arg_types): Likewise.
2481 (dependent_type_p_r): Likewise.
2482 * tree.c (cp_tree_equal): Likewise.
2483 (cp_walk_subtrees): Likewise.
2484 * typeck.c (convert_arguments): Likewise.
2486 2019-06-22 Marek Polacek <polacek@redhat.com>
2488 PR c++/86476 - noexcept-specifier is a complete-class context.
2490 * cp-tree.def (DEFAULT_ARG): Update commentary.
2491 * cp-tree.h (UNPARSED_NOEXCEPT_SPEC_P): New macro.
2492 (tree_default_arg): Use tree_base instead of tree_common.
2493 (do_push_parm_decls, maybe_check_overriding_exception_spec): Declare.
2494 * decl.c (do_push_parm_decls): New function, broken out of...
2495 (store_parm_decls): ...here. Call it.
2496 * except.c (nothrow_spec_p): Accept DEFAULT_ARG in the assert.
2497 * parser.c (cp_parser_noexcept_specification_opt,
2498 cp_parser_late_noexcept_specifier, noexcept_override_late_checks):
2500 (unparsed_noexcepts): New macro.
2501 (push_unparsed_function_queues): Update initializer.
2502 (cp_parser_direct_declarator): Pass FRIEND_P to
2503 cp_parser_exception_specification_opt.
2504 (inject_parm_decls): New.
2505 (pop_injected_parms): New.
2506 (cp_parser_class_specifier_1): Implement delayed parsing of
2507 noexcept-specifiers.
2508 (cp_parser_save_noexcept): New.
2509 (cp_parser_late_noexcept_specifier): New.
2510 (noexcept_override_late_checks): New.
2511 (cp_parser_noexcept_specification_opt): Add FRIEND_P parameter. Call
2512 cp_parser_save_noexcept instead of the normal processing if needed.
2513 (cp_parser_exception_specification_opt): Add FRIEND_P parameter and
2514 pass it to cp_parser_noexcept_specification_opt.
2515 (cp_parser_save_member_function_body): Fix comment.
2516 (cp_parser_save_default_args): Maybe save the noexcept-specifier to
2518 (cp_parser_transaction): Update call to
2519 cp_parser_noexcept_specification_opt.
2520 (cp_parser_transaction_expression): Likewise.
2521 * parser.h (cp_unparsed_functions_entry): Add new field to carry
2522 a noexcept-specifier.
2523 * pt.c (dependent_type_p_r): Handle unparsed noexcept expression.
2524 * search.c (maybe_check_overriding_exception_spec): New function, broken
2526 (check_final_overrider): ...here. Call
2527 maybe_check_overriding_exception_spec.
2528 * tree.c (canonical_eh_spec): Handle UNPARSED_NOEXCEPT_SPEC_P.
2529 (cp_tree_equal): Handle DEFAULT_ARG.
2531 PR c++/90881 - bogus -Wunused-value in unevaluated context.
2532 * cvt.c (convert_to_void): Don't emit unused warnings in
2533 an unevaluated context.
2535 2019-06-22 Paolo Carlini <paolo.carlini@oracle.com>
2537 * decl.c (grokdeclarator): Use id_loc, typespec_loc, and
2538 locations[ds_storage_class] in a few additional places.
2540 2019-06-21 Paolo Carlini <paolo.carlini@oracle.com>
2544 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com>
2548 * call.c (build_over_call): Devirtualize when the final overrider
2549 comes from the base.
2551 2019-06-21 Marek Polacek <polacek@redhat.com>
2553 PR c++/61490 - qualified-id in friend function definition.
2554 * decl.c (grokdeclarator): Diagnose qualified-id in friend function
2555 definition. Improve location for diagnostics of friend functions.
2557 PR c++/60223 - ICE with T{} in non-deduced context.
2558 * pt.c (unify): Allow COMPOUND_LITERAL_P in a non-deduced context.
2560 PR c++/64235 - missing syntax error with invalid alignas.
2561 * parser.c (cp_parser_std_attribute_spec): Commit to tentative parse
2562 if there's a missing close paren.
2564 PR c++/90490 - fix decltype issues in noexcept-specifier.
2565 * except.c (build_noexcept_spec): Call
2566 instantiate_non_dependent_expr_sfinae before
2567 build_converted_constant_expr instead of calling
2568 instantiate_non_dependent_expr after it. Add
2569 processing_template_decl_sentinel.
2571 2019-06-21 Jakub Jelinek <jakub@redhat.com>
2574 * semantics.c (finish_omp_clauses): Don't reject references to
2575 incomplete types if processing_template_decl.
2577 2019-06-19 Marek Polacek <polacek@redhat.com>
2579 PR c++/60364 - noreturn after first decl not diagnosed.
2580 * decl.c (duplicate_decls): Give an error when a function is
2581 declared [[noreturn]] after its first declaration.
2582 * parser.c (cp_parser_std_attribute): Don't treat C++11 noreturn
2583 attribute as equivalent to GNU's.
2584 * tree.c (std_attribute_table): Add noreturn.
2586 2019-06-19 Jakub Jelinek <jakub@redhat.com>
2588 * cp-gimplify.c (cp_genericize_r): Handle OMP_CLAUSE_{IN,EX}CLUSIVE
2589 like OMP_CLAUSE_SHARED.
2591 2019-06-18 Jason Merrill <jason@redhat.com>
2593 * constexpr.c (cxx_eval_store_expression): Delay target evaluation.
2595 2019-06-18 Jason Merrill <jason@redhat.com>
2597 * constexpr.c (eval_and_check_array_index): Split out from...
2598 (cxx_eval_array_reference): ...here.
2599 (cxx_eval_store_expression): Use it here, too.
2600 (diag_array_subscript): Take location. Strip location wrapper.
2602 2019-06-18 Jason Merrill <jason@redhat.com>
2604 * constexpr.c (cxx_eval_constant_expression): Handle conversion from
2605 and then to the same type.
2607 2019-06-18 Jason Merrill <jason@redhat.com>
2609 * constexpr.c (unshare_constructor): Add MEM_STAT_DECL.
2611 2019-06-17 Jakub Jelinek <jakub@redhat.com>
2613 * semantics.c (finish_omp_clauses): For OMP_CLAUSE_REDUCTION_INSCAN
2614 set need_copy_assignment.
2616 2019-06-17 Marek Polacek <polacek@redhat.com>
2618 PR c++/83820 - excessive attribute arguments not detected.
2619 * parser.c (cp_parser_std_attribute): Detect excessive arguments.
2621 2019-06-17 Nathan Sidwell <nathan@acm.org>
2624 * name-lookup.c (lookup_type_scope_1): Calll qualify_lookup before
2627 2019-06-14 Marek Polacek <polacek@redhat.com>
2629 PR c++/90884 - stray note with -Wctor-dtor-privacy.
2630 * class.c (maybe_warn_about_overly_private_class): Guard the call to
2633 2019-06-12 Jason Merrill <jason@redhat.com>
2635 PR c++/85552 - wrong instantiation of dtor for DMI.
2636 * typeck2.c (digest_nsdmi_init): Set tf_no_cleanup for direct-init.
2638 2019-06-13 Paolo Carlini <paolo.carlini@oracle.com>
2640 * decl.c (grokdeclarator): Use id_loc in five additional places
2641 in the last part of the function.
2643 2019-06-13 Paolo Carlini <paolo.carlini@oracle.com>
2645 * decl.c (grokdeclarator): Move further up the declaration of
2646 id_loc, use it immediately, update its value after the loop
2647 over declarator, use it again in the final part of function;
2648 improve locations of error messages about multiple data types
2649 and conflicting specifiers.
2651 2019-06-13 Richard Biener <rguenther@suse.de>
2654 * typeck2.c (split_nonconstant_init_1): Properly count
2655 num_split_elts, optimize single constructor elt removal.
2657 2019-06-12 Marek Polacek <polacek@redhat.com>
2659 PR c++/66999 - 'this' captured by reference.
2660 * parser.c (cp_parser_lambda_introducer): Reject `&this'. Use
2661 cp_lexer_nth_token_is instead of cp_lexer_peek_nth_token.
2663 PR c++/90825 - endless recursion when evaluating sizeof.
2664 PR c++/90832 - endless recursion when evaluating sizeof.
2665 * constexpr.c (cxx_eval_constant_expression): Don't recurse on the
2666 result of fold_sizeof_expr if is returns a SIZEOF_EXPR.
2667 * typeck.c (cxx_sizeof_expr): Only return a SIZEOF_EXPR if the operand
2668 is instantiation-dependent.
2670 PR c++/90736 - bogus error with alignof.
2671 * constexpr.c (adjust_temp_type): Use cv_unqualified type.
2673 2019-06-11 Matthew Beliveau <mbelivea@redhat.com>
2675 PR c++/90449 - add -Winaccessible-base option.
2676 * class.c (warn_about_ambiguous_bases): Changed name to:
2677 maybe_warn_about_inaccessible_bases.
2678 (maybe_warn_about_inaccessible_bases): Implemented new
2679 Winaccessible-base warning option for both direct and virtual
2681 (layout_class_type): Call to warn_about_ambiguous_bases changed to fit
2684 2019-06-11 Richard Biener <rguenther@suse.de>
2687 * typeck2.c (split_nonconstant_init_1): Avoid ordered remove
2688 from CONSTRUCTOR by marking to remove elements and doing all
2689 of them in a O(n) scan.
2691 2019-06-11 Jakub Jelinek <jakub@redhat.com>
2694 * init.c (constant_value_1): Handle VECTOR_CST DECL_INITIAL for
2695 !DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P decls like CONSTRUCTOR.
2697 2019-06-11 Martin Liska <mliska@suse.cz>
2700 * pt.c (init_template_processing): Disable hash table
2701 sanitization for decl_specializations and type_specializations.
2703 2019-06-10 Jason Merrill <jason@redhat.com>
2705 * constexpr.c (free_constructor): New.
2706 (cxx_eval_call_expression): Free parameter value CONSTRUCTORs.
2708 * constexpr.c (unshare_constructor): Only unshare if T is itself a
2710 (cxx_eval_call_expression): Don't call it on the result here.
2712 Reduce constexpr_call memory consumption.
2713 * constexpr.c (cxx_bind_parameters_in_call): Use TREE_VEC rather
2715 (constexpr_call_hasher::equal, cxx_bind_parameters_in_call)
2716 (cxx_eval_call_expression): Adjust.
2718 2019-06-10 Jakub Jelinek <jakub@redhat.com>
2720 * parser.c (cp_parser_omp_clause_reduction): Don't sorry_at on inscan
2722 (cp_parser_omp_scan_loop_body): New function.
2723 (cp_parser_omp_for_loop): Call cp_parser_omp_scan_loop_body if there
2724 are inscan reduction clauses.
2725 (cp_parser_pragma): Reject PRAGMA_OMP_SCAN.
2726 * semantics.c (finish_omp_clauses): Reject mixing inscan with
2727 non-inscan reductions on the same construct, or inscan reductions with
2728 ordered or schedule clauses, or inscan array reductions.
2729 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_{IN,EX}CLUSIVE.
2730 (tsubst_expr): Handle OMP_SCAN.
2732 2019-06-07 Jason Merrill <jason@redhat.com>
2734 * constexpr.c (cxx_eval_constant_expression): Call
2735 STRIP_ANY_LOCATION_WRAPPER early.
2736 [CONVERT_EXPR]: Don't build anything for conversion to void.
2737 [ADDR_EXPR]: ggc_free unused ADDR_EXPR.
2739 2019-06-05 Martin Sebor <msebor@redhat.com>
2742 * typeck.c (maybe_warn_about_returning_address_of_local): Only
2743 consider functions returning pointers as candidates for
2744 -Wreturn-local-addr.
2746 2019-06-05 Paolo Carlini <paolo.carlini@oracle.com>
2748 * decl.c (smallest_type_location): New.
2749 (check_special_function_return_type): Use it.
2750 (grokdeclarator): Lkewise.
2752 2019-06-05 Paolo Carlini <paolo.carlini@oracle.com>
2754 * decl.c (grokdeclarator): Use locations[ds_friend]
2757 2019-06-05 Martin Sebor <msebor@redhat.com>
2759 * call.c (build_conditional_expr_1): Adjust quoting and hyphenation.
2760 (convert_like_real): Same.
2761 (convert_arg_to_ellipsis): Same.
2762 * constexpr.c (diag_array_subscript): Same.
2763 * constraint.cc (diagnose_trait_expression): Same.
2764 * cvt.c (ocp_convert): Same.
2765 * decl.c (start_decl): Same.
2766 (check_for_uninitialized_const_var): Same.
2768 (check_special_function_return_type): Same.
2769 (finish_enum_value_list): Same.
2770 (start_preparsed_function): Same.
2771 * parser.c (cp_parser_decl_specifier_seq): Same.
2772 * typeck.c (cp_build_binary_op): Same.
2773 (build_static_cast_1): Same.
2775 2019-06-04 Nina Dinka Ranns <dinka.ranns@gmail.com>
2777 PR c++/63149 - Wrong auto deduction from braced-init-list.
2778 * pt.c (listify_autos): use non cv qualified auto_node in
2779 std::initializer_list<auto>.
2781 2019-06-04 Paolo Carlini <paolo.carlini@oracle.com>
2783 * decl.c (grokdeclarator): Use declarator->id_loc in two
2786 2019-06-04 Nathan Sidwell <nathan@acm.org>
2788 * name-lookup.c (lookup_type_scope_1): Reimplement, handle local
2789 and namespace scopes separately.
2791 2019-06-04 Harald van Dijk <harald@gigawatt.nl>
2793 PR c++/60531 - Wrong error about unresolved overloaded function
2794 * typeck.c (cp_build_binary_op): See if overload can be resolved.
2795 (cp_build_unary_op): Ditto.
2797 2019-06-04 Jason Merrill <jason@redhat.com>
2799 Reduce accumulated garbage in constexpr evaluation.
2800 * constexpr.c (cxx_eval_call_expression): ggc_free any bindings we
2802 (cxx_eval_increment_expression): ggc_free the MODIFY_EXPR after
2805 2019-06-04 Jakub Jelinek <jakub@redhat.com>
2807 * cp-tree.h (CP_OMP_CLAUSE_INFO): Allow for any clauses up to _condvar_
2808 instead of only up to linear.
2810 2019-06-03 Paolo Carlini <paolo.carlini@oracle.com>
2812 * parser.c (cp_parser_unqualified_id): Use build_min_nt_loc in
2815 2019-06-01 Ville Voutilainen <ville.voutilainen@gmail.com>
2818 * class.c (fixup_type_variants): Handle CLASSTYPE_FINAL.
2820 2019-05-31 Nathan Sidwell <nathan@acm.org>
2822 * cp-tree.h (IDENTIFIER_LAMBDA_P): New.
2824 (LAMBDA_TYPE_P, TYPE_UNNAMED_P): Likewise.
2825 (LAMBDANAME_PREFIX, LAMBDANAME_FORMAT): Delete.
2826 (make_lambda_name): Don't declare.
2827 * error.c (dump_aggr_type): Check for lambdas before other
2829 * lambda.c (begin_lambda_type): Use make_anon_name.
2830 * cp-lang.c (cxx_dwarf_name): Lambda names smell anonymous.
2831 * mangle.c (write_local_name): Likewise.
2832 * name-lookup.c (lambda_cnt, make_lambda_name): Delete.
2834 2019-05-30 Marek Polacek <polacek@redhat.com>
2836 * cp-tree.h (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Fix a typo.
2838 2019-05-31 Paolo Carlini <paolo.carlini@oracle.com>
2840 * decl.c (grokdeclarator): Use declarator->id_loc in five
2843 2019-05-29 Jakub Jelinek <jakub@redhat.com>
2846 * tree.c (lvalue_kind): Return clk_none for expressions with
2849 2019-05-29 Paolo Carlini <paolo.carlini@oracle.com>
2852 * parser.c (cp_parser_sizeof_operand): When the type-id production
2853 did not work out commit to the tentative parse.
2855 2019-05-29 Jakub Jelinek <jakub@redhat.com>
2857 P1091R3 - Extending structured bindings to be more like var decls
2858 P1381R1 - Reference capture of structured bindings
2859 * decl.c (cp_maybe_mangle_decomp): Handle TREE_STATIC decls even at
2861 (cp_finish_decomp): Copy over various decl properties from decl to
2862 v[i] in the tuple case.
2863 (grokdeclarator): Allow static, thread_local and __thread for C++2a
2864 and use pedwarn instead of error for older standard revisions.
2865 Make other structured binding diagnostic messages more i18n friendly.
2867 2019-05-28 Nathan Sidwell <nathan@acm.org>
2869 * decl.c (duplicate_decls): Assert a template newdecl has no
2872 2019-05-28 Marek Polacek <polacek@redhat.com>
2874 PR c++/90548 - ICE with generic lambda and empty pack.
2875 * pt.c (tsubst_copy_and_build): Handle pack expansion properly.
2877 2019-05-28 Nathan Sidwell <nathan@acm.org>
2879 * cp-tree.h (make_anon_name): Drop declaration.
2880 (TYPE_UNNAMED_P): Use IDENTIFIER_ANON_P.
2881 * cp-lang.c (cxx_dwarf_name): Likewise.
2882 * class.c (find_flexarrays): Likewise.
2883 * decl.c (name_unnamed_type, xref_tag_1): Likewise.
2884 * error.c (dump_aggr_type): Likewise.
2885 * pt.c (push_template_decl_real): Likewise.
2886 * name-lookup.c (consider_binding_level): Likewise.
2887 (anon_cnt, make_anon_name): Delete.
2889 2019-05-25 Marek Polacek <polacek@redhat.com>
2891 PR c++/90572 - wrong disambiguation in friend declaration.
2892 * parser.c (cp_parser_constructor_declarator_p): Don't allow missing
2893 typename for friend declarations.
2895 2019-05-23 Jonathan Wakely <jwakely@redhat.com>
2897 * cp-tree.h (CP_AGGREGATE_TYPE_P): Fix whitespace.
2899 * init.c (std_placement_new_fn_p): Remove outdated TODO comment that
2900 was resolved by r254694.
2902 2019-05-22 Jason Merrill <jason@redhat.com>
2904 PR c++/20408 - unnecessary code for empty struct.
2905 * call.c (build_call_a): Use simple_empty_class_p.
2907 PR c++/86485 - -Wmaybe-unused with empty class ?:
2908 * cp-gimplify.c (simple_empty_class_p): Also true for MODIFY_EXPR.
2910 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com>
2912 * parser.c (cp_parser_template_declaration_after_parameters): Use
2913 DECL_SOURCE_LOCATION in literal operator template errors.
2915 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com>
2919 * call.c (build_over_call): Devirtualize when the final overrider
2920 comes from the base.
2922 2019-05-21 Nathan Sidwell <nathan@acm.org>
2924 * name-lookup.c (do_nonmember_using_decl): Drop INSERT_P
2925 parameter. Document.
2926 (finish_nonmember_using_decl): Adjust do_nonmember_using_decl
2927 calls. Remove stray FIXME comment.
2929 * name-lookup.h (struct cp_binding_level): Drop usings field.
2930 (finish_namespace_using_decl, finish_local_using_decl): Replace with ...
2931 (finish_nonmember_using_decl): ... this.
2932 * name-lookup.c (push_using_decl_1, push_using_decl):
2933 (do_nonmember_using_decl): ... here. Add INSERT_P arg. Reimplement.
2934 (validate_nonmember_using_decl, finish_namespace_using_decl)
2935 (finish_local_using_decl): Replace with ...
2936 (finish_nonmember_using_decl): ... this. Drop DECL parm.
2937 * parser.c (cp_parser_using_declaration): Don't do lookup here.
2938 * pt.c (tsubst_expr): Do not do using decl lookup here.
2940 2019-05-21 Eric Botcazou <ebotcazou@adacore.com>
2942 * decl2.c (cpp_check) <IS_ASSIGNMENT_OPERATOR>: New case.
2944 2019-05-20 Marek Polacek <polacek@redhat.com>
2946 CWG 2094 - volatile scalars are trivially copyable.
2948 * tree.c (trivially_copyable_p): Don't check CP_TYPE_VOLATILE_P for
2951 2019-05-20 Marek Polacek <polacek@redhat.com>
2953 * pt.c (convert_template_argument): Add a diagnostic for the
2954 [temp.arg]/2 ambiguity case.
2956 * name-lookup.c (finish_using_directive): Don't issue inform() if the
2957 warning didn't trigger. Add quoting. Tweak the inform message.
2959 2019-05-20 Paolo Carlini <paolo.carlini@oracle.com>
2961 * cp-tree.h: Remove remnants of CONV_NONCONVERTING.
2963 2019-05-20 Nathan Sidwell <nathan@acm.org>
2965 * name-lookup.c (finish_namespace_using_directive)
2966 (finish_local_using_directive): Merge to ...
2967 (finish_using_directive): ... here. Handle both contexts.
2968 * name-lookup.h (finish_namespace_using_directive)
2969 (finish_local_using_directive): Replace with ...
2970 (finish_using_directive): ... this.
2971 * parser.c (cp_parser_using_directive): Adjust.
2972 * pt.c (tsubst_expr): Likewise.
2974 * cp-tree.h (struct lang_decl_ns): Remove usings field.
2975 (DECL_NAMESPACE_USING): Delete.
2976 * name-lookup.c (name_lookup::search_usings): Use namespace's
2978 (name_lookup::queue_namespae): Likewise.
2979 (finish_namespace_using_directive, push_namespace): Likewise.
2980 (has_using_namespace_std_directive): Just search the entire
2983 2019-05-20 Jonathan Wakely <jwakely@redhat.com>
2985 PR c++/90532 Ensure __is_constructible(T[]) is false
2986 * method.c (is_xible_helper): Return error_mark_node for construction
2987 of an array of unknown bound.
2989 2019-05-17 Thomas Schwinge <thomas@codesourcery.com>
2992 * parser.c (cp_finalize_oacc_routine): Rework checking if already
2993 marked with an OpenACC 'routine' directive.
2996 * parser.c (cp_parser_oacc_routine)
2997 (cp_parser_late_parsing_oacc_routine): Normalize order of clauses.
2998 (cp_finalize_oacc_routine): Call oacc_verify_routine_clauses.
3001 * parser.c (cp_finalize_oacc_routine): Refer to OpenACC 'routine'
3002 clauses from "omp declare target" attribute.
3004 2019-05-16 Martin Sebor <msebor@redhat.com>
3006 * call.c (print_z_candidate): Wrap diagnostic text in a gettext
3008 (print_z_candidates): Same.
3009 (build_conditional_expr_1): Quote keywords, operators, and types
3011 (build_op_delete_call): Same.
3012 (maybe_print_user_conv_context): Wrap diagnostic text in a gettext
3014 (convert_like_real): Same.
3015 (convert_arg_to_ellipsis): Quote keywords, operators, and types
3017 (build_over_call): Same.
3018 (joust): Break up an overlong line. Wrap diagnostic text in a gettext
3020 * constexpr.c (cxx_eval_check_shift_p): Spell out >= in English.
3021 (cxx_eval_constant_expression): Quote keywords, operators, and types
3023 (potential_constant_expression_1): Same.
3024 * cp-gimplify.c (cp_genericize_r): Same.
3025 * cvt.c (maybe_warn_nodiscard): Quote keywords, operators, and types
3027 (type_promotes_to): Same.
3028 * decl.c (check_previous_goto_1): Same.
3031 (cp_finish_decl): Avoid parenthesizing a sentence for consistency.
3032 (grok_op_properties): Quote keywords, operators, and types
3034 * decl2.c (grokfield): Same.
3035 (coerce_delete_type): Same.
3036 * except.c (is_admissible_throw_operand_or_catch_parameter): Same.
3037 * friend.c (do_friend): Quote C++ tokens.
3038 * init.c (build_new_1): Quote keywords, operators, and types
3040 (build_vec_delete_1): Same.
3041 (build_delete): Same.
3042 * lex.c (parse_strconst_pragma): Same.
3043 (handle_pragma_implementation): Same.
3044 (unqualified_fn_lookup_error): Same.
3045 * mangle.c (write_type): Same.
3046 * method.c (defaulted_late_check): Avoid two consecutive punctuators.
3047 * name-lookup.c (cp_binding_level_debug): Remove a trailing newline.
3048 (pop_everything): Same.
3049 * parser.c (cp_lexer_start_debugging): Quote a macro name.
3051 (cp_lexer_stop_debugging): Same.
3052 (cp_parser_userdef_numeric_literal): Quote a C++ header name
3054 (cp_parser_nested_name_specifier_opt): Quote keywords, operators,
3055 and types in diagnostics.
3056 (cp_parser_question_colon_clause): Same.
3057 (cp_parser_asm_definition): Same.
3058 (cp_parser_init_declarator): Same.
3059 (cp_parser_template_declaration_after_parameters): Avoid capitalizing
3060 a sentence in a diagnostic.
3061 (cp_parser_omp_declare_reduction): Quote keywords, operators, and types
3063 (cp_parser_transaction): Same.
3064 * pt.c (maybe_process_partial_specialization): Replace second call
3065 to permerror with inform for consistency with other uses.
3066 (expand_integer_pack): Quote keywords, operators, and types
3068 * rtti.c (get_typeid): Quote keywords, operators, and types
3070 (build_dynamic_cast_1): Same.
3071 * semantics.c (finish_asm_stmt): Same.
3072 (finish_label_decl): Same.
3073 (finish_bases): Same.
3074 (finish_offsetof): Same.
3075 (cp_check_omp_declare_reduction): Same.
3076 (finish_decltype_type): Same.
3077 * tree.c (handle_init_priority_attribute): Same. Add detail
3079 (maybe_warn_zero_as_null_pointer_constant): Same.
3080 * typeck.c (cp_build_binary_op): Quote keywords, operators, and types
3082 (cp_build_unary_op): Same.
3083 (check_for_casting_away_constness): Same.
3084 (build_static_cast): Same.
3085 (build_const_cast_1): Same.
3086 (maybe_warn_about_returning_address_of_local): Same.
3087 (check_return_expr): Same.
3088 * typeck2.c (abstract_virtuals_error_sfinae): Same.
3089 (digest_init_r): Replace a tab with spaces in a diagnostic.
3090 (build_functional_cast): Quote keywords, operators, and types
3093 2019-05-15 Jakub Jelinek <jakub@redhat.com>
3096 * cp-gimplify.c (genericize_cp_loop): Emit a DEBUG_BEGIN_STMT
3097 before the condition (or if missing or constant non-zero at the end
3098 of the loop. Emit a DEBUG_BEGIN_STMT before the increment expression
3099 if any. Don't call protected_set_expr_location on incr if it already
3102 2019-05-15 Marek Polacek <polacek@redhat.com>
3104 CWG 2096 - constraints on literal unions.
3105 * class.c (check_field_decls): Initialize booleans directly. A union
3106 is literal if at least one of its non-static data members is of
3107 non-volatile literal type.
3109 2019-05-15 Paolo Carlini <paolo.carlini@oracle.com>
3111 * cp-tree.h (REFERENCE_VLA_OK): Remove.
3112 * lambda.c (build_capture_proxy): Remove use of the above.
3114 2019-05-15 Paolo Carlini <paolo.carlini@oracle.com>
3116 * call.c (perform_overload_resolution, build_new_method_call_1):
3117 Use OVL_P; remove redundant TEMPLATE_DECL checks.
3118 * decl.c (grokfndecl): Likewise.
3119 * mangle.c (write_expression): Likewise.
3120 * parser.c (cp_parser_template_id): Likewise.
3121 * pt.c (resolve_overloaded_unification, type_dependent_expression_p):
3123 * search.c (build_baselink): Likewise.
3124 * tree.c (is_overloaded_fn, dependent_name, maybe_get_fns): Likewise.
3126 2019-05-14 Paolo Carlini <paolo.carlini@oracle.com>
3128 PR preprocessor/90382
3129 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
3132 2019-05-13 Jason Merrill <jason@redhat.com>
3134 Use releasing_vec more broadly.
3135 * cp-tree.h (struct releasing_vec): Replace get_ref method with
3137 (vec_safe_push, vec_safe_reserve, vec_safe_length, vec_safe_splice):
3138 Forwarding functions for releasing_vec.
3139 (release_tree_vector): Declare but don't define.
3140 * call.c (build_op_delete_call, build_temp, call_copy_ctor)
3141 (perform_direct_initialization_if_possible): Use releasing_vec.
3142 * constexpr.c (cxx_eval_vec_init_1, cxx_eval_store_expression):
3144 * cp-gimplify.c (cp_fold): Likewise.
3145 * cvt.c (force_rvalue, ocp_convert): Likewise.
3146 * decl.c (get_tuple_decomp_init): Likewise.
3147 * except.c (build_throw): Likewise.
3148 * init.c (perform_member_init, expand_default_init): Likewise.
3149 * method.c (do_build_copy_assign, locate_fn_flags): Likewise.
3150 * parser.c (cp_parser_userdef_char_literal)
3151 (cp_parser_userdef_numeric_literal)
3152 (cp_parser_userdef_string_literal)
3153 (cp_parser_perform_range_for_lookup)
3154 (cp_parser_range_for_member_function, cp_parser_omp_for_loop)
3155 (cp_parser_omp_for_loop_init): Likewise.
3156 * pt.c (tsubst_copy_and_build, do_class_deduction): Likewise.
3157 * semantics.c (calculate_direct_bases, calculate_bases)
3158 (finish_omp_barrier, finish_omp_flush, finish_omp_taskwait)
3159 (finish_omp_taskyield, finish_omp_cancel)
3160 (finish_omp_cancellation_point): Likewise.
3161 * tree.c (build_vec_init_elt, strip_typedefs, strip_typedefs_expr)
3162 (build_min_non_dep_op_overload): Likewise.
3163 * typeck.c (build_function_call_vec, cp_build_function_call_nary)
3164 (cp_build_modify_expr): Likewise.
3165 * typeck2.c (build_functional_cast): Likewise.
3167 2019-05-11 Paolo Carlini <paolo.carlini@oracle.com>
3169 * typeck.c (cp_build_function_call_vec): When mark_used fails
3170 unconditionally return error_mark_node.
3172 2019-05-10 Paolo Carlini <paolo.carlini@oracle.com>
3174 * decl.c (grokvardecl): Use an accurate location in error message
3175 about main as a global variable.
3177 2019-05-10 Paolo Carlini <paolo.carlini@oracle.com>
3179 * call.c (build_call_a): Use FUNC_OR_METHOD_TYPE_P.
3180 * cp-gimplify.c (cp_fold): Likewise.
3181 * cp-objcp-common.c (cp_type_dwarf_attribute): Likewise.
3182 * cp-tree.h (TYPE_OBJ_P, TYPE_PTROBV_P): Likewise.
3183 * cvt.c (perform_qualification_conversions): Likewise.
3184 * decl.c (grokdeclarator): Likewise.
3185 * decl2.c (build_memfn_type): Likewise.
3186 * mangle.c (canonicalize_for_substitution, write_type): Likewise.
3187 * parser.c (cp_parser_omp_declare_reduction): Likewise.
3188 * pt.c (check_explicit_specialization, uses_deducible_template_parms,
3189 check_cv_quals_for_unify, dependent_type_p_r): Likewise.
3190 * rtti.c (ptr_initializer): Likewise.
3191 * semantics.c (finish_asm_stmt, finish_offsetof,
3192 cp_check_omp_declare_reduction): Likewise.
3193 * tree.c (cp_build_qualified_type_real,
3194 cp_build_type_attribute_variant, cxx_type_hash_eq,
3195 cxx_copy_lang_qualifiers, cp_free_lang_data): Likewise.
3196 * typeck.c (structural_comptypes, convert_arguments,
3197 cp_build_addr_expr_1, unary_complex_lvalue, cp_build_c_cast,
3198 cp_build_modify_expr, comp_ptr_ttypes_real, type_memfn_rqual):
3201 2019-05-10 Marek Polacek <polacek@redhat.com>
3203 PR c++/78010 - bogus -Wsuggest-override warning on final function.
3204 * class.c (check_for_override): Don't warn for final functions.
3206 2019-05-10 Jakub Jelinek <jakub@redhat.com>
3209 * config-lang.in (gtfiles): Remove c-family/c-lex.c, add
3210 c-family/c-cppbuiltin.c.
3212 2019-05-09 Paolo Carlini <paolo.carlini@oracle.com>
3216 2018-04-26 Paolo Carlini <paolo.carlini@oracle.com>
3218 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
3221 2019-05-08 Nathan Sidwell <nathan@acm.org>
3223 Kill DECL_SAVED_FUNCTION_DATA .
3224 * cp-tree.h (language_function): Remove x_auto_return_pattern.
3225 (current_function_auto_return_pattern): Delete.
3226 (lang_decl_fn): Replace saved_language_function with
3227 saved_auto_return type.
3228 (DECL_SAVED_FUNCTION_DATA): Delete.
3229 (DECL_SAVED_AUTO_RETURN_TYPE): New.
3230 (FNDECL_USED_AUTO): Correct documentation.
3231 * decl.c (duplicate_decls): Adjust AUTO return handling.
3232 (start_preparsed_function): Replace
3233 current_function_auto_return_pattern with
3234 DECL_SAVED_AUTO_RETURN_TYPE. Remove DECL_SAVED_FUNCTION_DATA
3236 (finish_function): Likewise.
3237 (save_function_data): Delete.
3238 (fndecl_declared_return_type): Reimplement.
3239 * mangle.c (write_unqualified_name): Use DECL_SAVED_AUTO_RETURN_TYPE.
3240 * method.c (make_thunk, make_alias_for): Likewise.
3241 * parser.c (cp_parser_jump_statement): Likewise.
3242 * pt.c (do_auto_deduction): Likewise.
3243 * typeck.c (check_return_expr): Likewise.
3245 2019-05-06 Jason Merrill <jason@redhat.com>
3247 PR c++/90171 - reorganize usual_deallocation_fn_p
3248 * call.c (struct dealloc_info): New.
3249 (usual_deallocation_fn_p): Take a dealloc_info*.
3250 (aligned_deallocation_fn_p, sized_deallocation_fn_p): Remove.
3251 (build_op_delete_call): Adjust.
3253 2019-05-07 Jason Merrill <jason@redhat.com>
3255 PR c++/86485 - -Wmaybe-unused with empty class ?:
3256 * typeck.c (build_static_cast_1): Use cp_build_addr_expr.
3258 * pt.c (type_dependent_expression_p): A non-type template parm with
3259 a placeholder type is type-dependent.
3261 2019-05-06 Marek Polacek <polacek@redhat.com>
3263 PR c++/90265 - ICE with generic lambda.
3264 * pt.c (tsubst_copy_and_build): Use a dedicated variable for the last
3265 element in the vector.
3267 2019-05-03 Martin Liska <mliska@suse.cz>
3269 * call.c (build_aggr_conv): Use is_empty instead of
3270 elements () == 0 (and similar usages).
3271 * parser.c (cp_parser_lambda_introducer): Likewise.
3273 2019-05-02 Nathan Sidwell <nathan@acm.org>
3275 * semantics.c (finish_id_expression_1): Remove unreachable code.
3277 2019-05-01 Nathan Sidwell <nathan@acm.org>
3279 * name-lookup.h (get_class_binding_direct): Change final arg to
3281 (get_class_binding): Likewise.
3282 * name-lookup.c (get_class_binding_direct): Replace TYPE_OR_FNS
3283 arg with WANT_TYPE bool. Simplify.
3284 (get_class_binding): Adjust final arg.
3285 * decl.c (reshape_init_class): Adjust get_class_binding calls.
3287 2019-04-30 Nathan Sidwell <nathan@acm.org>
3289 * cp-objcp-common.c (cp_common_init_ts): Use MARK_TS_EXP for _EXPR
3290 nodes. Call c_common_init_ts.
3292 2019-04-29 Nathan Sidwell <nathan@acm.org>
3294 * decl.c (duplicate_decls): Add whitespace, move comments into
3296 * method.c (explain_implicit_non_constexpr): Refactor.
3297 * pt.c (check_explicit_specialization): Fix indentation.
3298 * semantics.c (process_outer_var_ref): Reformat.
3299 (finish_id_expression_1): Use STRIP_TEMPLATE.
3301 2019-04-26 Jonathan Wakely <jwakely@redhat.com>
3303 PR c++/90243 - orphaned note in uninstantiated constexpr function
3304 * decl.c (check_for_uninitialized_const_var): Suppress notes if no
3307 2019-04-26 Paolo Carlini <paolo.carlini@oracle.com>
3310 * decl.c (grokdeclarator): Set type to error_mark_node
3311 upon error about template placeholder type non followed
3312 by a simple declarator-id.
3314 2019-04-26 Paolo Carlini <paolo.carlini@oracle.com>
3316 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
3319 2019-04-24 Jason Merrill <jason@redhat.com>
3321 PR c++/90227 - error with template parameter packs.
3322 * pt.c (coerce_template_parms): Do add empty pack when
3325 2019-04-24 Richard Biener <rguenther@suse.de>
3327 * call.c (null_ptr_cst_p): Order checks according to expensiveness.
3328 (conversion_null_warnings): Likewise.
3329 * typeck.c (same_type_ignoring_top_level_qualifiers_p): Return
3330 early if type1 == type2.
3332 2019-04-22 Jason Merrill <jason@redhat.com>
3334 PR c++/87366 - wrong error with alias template.
3335 * typeck.c (structural_comptypes): When comparing_specializations,
3336 aliases are unequal.
3337 (comptypes): When comparing_specializations, do structural
3340 2019-04-19 Jason Merrill <jason@redhat.com>
3342 PR c++/90190 - CTAD with list-constructor.
3343 * pt.c (do_class_deduction): Don't try the single element deduction
3344 if the single element is also a braced list.
3346 PR c++/90171 - ICE with destroying delete with size_t parm.
3347 * call.c (sized_deallocation_fn_p): New. Use it instead of
3348 second_parm_is_size_t in most cases.
3349 (second_parm_is_size_t): Don't check for aligned.
3351 2019-04-19 Paolo Carlini <paolo.carlini@oracle.com>
3354 * pt.c (fn_type_unification): When handling null explicit
3355 arguments do not special case non-parameter packs.
3357 2019-04-19 Jakub Jelinek <jakub@redhat.com>
3360 * pt.c (process_template_parm): Set decl to pushdecl result. If
3361 !is_non_type, also set parm to that.
3364 * decl.c (struct cp_switch): Remove outside_range_p member.
3365 (push_switch): Don't clear it.
3366 (pop_switch): Adjust c_do_switch_warnings caller.
3367 (finish_case_label): Adjust c_add_case_label caller.
3370 * decl.c (duplicate_decls): If remove is main variant and
3371 DECL_ORIGINAL_TYPE is some other type, remove a DECL_ORIGINAL_TYPE
3372 variant that has newdecl as TYPE_NAME if any.
3374 2019-04-18 Jason Merrill <jason@redhat.com>
3376 PR c++/87554 - ICE with extern template and reference member.
3377 * decl.c (cp_finish_decl): Don't set DECL_INITIAL of external vars.
3379 2019-04-17 Jason Merrill <jason@redhat.com>
3381 PR c++/90047 - ICE with enable_if alias template.
3382 * pt.c (tsubst_decl) [TYPE_DECL]: Don't put an erroneous decl in the
3383 hash table when we're in SFINAE context.
3385 2019-04-17 Marek Polacek <polacek@redhat.com>
3387 PR c++/90124 - bogus error with incomplete type in decltype.
3388 * typeck.c (build_class_member_access_expr): Check
3389 cp_unevaluated_operand.
3391 2019-04-12 Jakub Jelinek <jakub@redhat.com>
3394 * decl.c (duplicate_decls): When newdecl's type is its main variant,
3395 don't try to remove it from the variant list, but instead assert
3398 2019-04-12 Martin Sebor <msebor@redhat.com>
3402 * parser.c (cp_parser_has_attribute_expression): Handle assignment
3405 2019-04-12 Jason Merrill <jason@redhat.com>
3407 * call.c (null_member_pointer_value_p): Handle an empty CONSTRUCTOR
3410 2019-04-12 Marek Polacek <polacek@redhat.com>
3412 * except.c (build_noexcept_spec): Use build_converted_constant_bool_expr
3413 instead of perform_implicit_conversion_flags.
3415 PR c++/87603 - constexpr functions are no longer noexcept.
3416 * constexpr.c (is_sub_constant_expr): Remove unused function.
3417 * cp-tree.h (is_sub_constant_expr): Remove declaration.
3418 * except.c (check_noexcept_r): Don't consider a call to a constexpr
3421 2019-04-11 Jakub Jelinek <jakub@redhat.com>
3423 PR translation/90035
3424 * parser.h (struct cp_parser): Add
3425 type_definition_forbidden_message_arg member.
3426 * parser.c (cp_debug_parser): Print it.
3427 (cp_parser_check_type_definition): Pass
3428 parser->type_definition_forbidden_message_arg as second argument to
3430 (cp_parser_has_attribute_expression, cp_parser_sizeof_operand): Set
3431 parser->type_definition_forbidden_message_arg and use G_() with
3432 %qs for parser->type_definition_forbidden_message instead of
3433 building untranslatable message using concat.
3435 2019-04-09 Jakub Jelinek <jakub@redhat.com>
3437 PR translation/90011
3438 * typeck2.c (check_narrowing): Remove trailing space from diagnostics.
3440 2019-04-08 Marek Polacek <polacek@redhat.com>
3442 * typeck2.c (digest_init_r): Don't condition the object slicing warning
3445 2019-04-08 Paolo Carlini <paolo.carlini@oracle.com>
3448 * semantics.c (trait_expr_value): Don't use TYPE_NOTHROW_P
3449 when maybe_instantiate_noexcept fails.
3450 (classtype_has_nothrow_assign_or_copy_p): Likewise.
3451 * method.c (implicitly_declare_fn): Avoid passing error_mark_node
3452 to build_exception_variant.
3454 2019-04-05 Marek Polacek <polacek@redhat.com>
3456 PR c++/87145 - bogus error converting class type in template arg list.
3457 * pt.c (convert_nontype_argument): Don't call
3458 build_converted_constant_expr if it could involve calling a conversion
3459 function with a instantiation-dependent constructor as its argument.
3461 2019-04-05 Martin Sebor <msebor@redhat.com>
3464 * decl.c (reshape_init_array_1): Avoid treating empty strings
3465 as zeros in array initializers.
3466 Use trivial_type_p () instead of TYPE_HAS_TRIVIAL_DFLT().
3468 2019-04-04 Jason Merrill <jason@redhat.com>
3470 PR c++/89948 - ICE with break in statement-expr.
3471 * constexpr.c (cxx_eval_statement_list): Jumping out of a
3472 statement-expr is non-constant.
3474 2019-04-04 Jason Merrill <jason@redhat.com>
3476 PR c++/89966 - error with non-type auto tparm.
3477 * pt.c (do_auto_deduction): Clear tf_partial.
3479 2019-04-04 Jason Merrill <jason@redhat.com>
3481 PR c++/86986 - ICE with TTP with parameter pack.
3482 * pt.c (coerce_template_parameter_pack): Only look at the type of a
3483 non-type parameter pack.
3484 (fixed_parameter_pack_p_1): Don't recurse into the type of a
3485 non-type parameter pack.
3486 (coerce_template_template_parms): Call add_outermost_template_args.
3488 2019-04-04 Martin Sebor <msebor@redhat.com>
3494 * decl.c (reshape_init_array_1): Strip trailing zero-initializers
3495 from arrays of trivial type and known size.
3496 * mangle.c (write_expression): Convert braced initializer lists
3498 (write_expression): Trim trailing zero-initializers from arrays
3500 (write_template_arg_literal): Mangle strings the same as braced
3503 2019-04-03 Jason Merrill <jason@redhat.com>
3505 PR c++/81866 - ICE with member template and default targ.
3506 * pt.c (tsubst_template_decl): Handle getting a type from
3507 retrieve_specialization.
3509 PR c++/86586 - -fcompare-debug=-Wsign-compare.
3510 * typeck.c (cp_build_binary_op): Don't fold for -Wsign-compare.
3512 PR c++/89331 - ICE with offsetof in incomplete class.
3513 * semantics.c (finish_offsetof): Handle error_mark_node.
3514 * typeck.c (build_class_member_access_expr): Call
3515 complete_type_or_maybe_complain before converting to base.
3517 PR c++/89917 - ICE with lambda in variadic mem-init.
3518 * pt.c (make_pack_expansion): Change type_pack_expansion_p to false.
3520 2019-04-01 Jason Merrill <jason@redhat.com>
3522 PR c++/86946 - ICE with function call in template argument.
3524 * pt.c (iterative_hash_template_arg) [CALL_EXPR]: Use
3527 2019-04-01 Paolo Carlini <paolo.carlini@oracle.com>
3530 * pt.c (tsubst_copy): Deal with lookup_name not returing a variable.
3532 2019-03-31 Marek Polacek <polacek@redhat.com>
3534 PR c++/89852 - ICE with C++11 functional cast with { }.
3535 * constexpr.c (fold_non_dependent_expr_template): New static function
3537 (fold_non_dependent_expr): ...here.
3538 (fold_non_dependent_init): New function.
3539 * cp-tree.h (fold_non_dependent_init): Declare.
3540 * typeck2.c (massage_init_elt): Call fold_non_dependent_init instead
3541 of fold_non_dependent_expr. Don't call maybe_constant_init.
3543 2019-03-30 Jason Merrill <jason@redhat.com>
3545 PR c++/89744 - ICE with specialization of member class template.
3546 * pt.c (lookup_template_class_1): If the partial instantiation is
3547 explicitly specialized, adjust.
3548 (maybe_process_partial_specialization): Also adjust
3551 2019-03-29 Jakub Jelinek <jakub@redhat.com>
3554 * typeck.c: Include gimplify.h.
3555 (cp_build_modify_expr) <case COND_EXPR>: Unshare rhs before using it
3556 for second time. Formatting fixes.
3558 2019-03-29 Marek Polacek <polacek@redhat.com>
3560 PR c++/89876 - ICE with deprecated conversion.
3561 * call.c (convert_like_real): Only give warnings with tf_warning.
3563 2019-03-28 Marek Polacek <polacek@redhat.com>
3565 PR c++/89612 - ICE with member friend template with noexcept.
3566 * pt.c (maybe_instantiate_noexcept): For function templates, use their
3567 template result (function decl). Don't set up local specializations.
3568 Temporarily turn on processing_template_decl. Update the template type
3571 PR c++/89836 - bool constant expression and explicit conversions.
3572 * call.c (build_converted_constant_expr_internal): New function,
3574 (build_converted_constant_expr): ...this. New.
3575 (build_converted_constant_bool_expr): New.
3576 * cp-tree.h (build_converted_constant_bool_expr): Declare.
3577 * decl.c (build_explicit_specifier): Call
3578 build_converted_constant_bool_expr.
3580 2019-03-28 Jakub Jelinek <jakub@redhat.com>
3583 * constexpr.c (struct check_for_return_continue_data): New type.
3584 (check_for_return_continue): New function.
3585 (potential_constant_expression_1) <case SWITCH_STMT>: Walk
3586 SWITCH_STMT_BODY to find RETURN_EXPRs or CONTINUE_STMTs not nested
3587 in loop bodies and set *jump_target to that if found.
3589 2019-03-27 Jason Merrill <jason@redhat.com>
3591 PR c++/89831 - error with qualified-id in const member function.
3592 * semantics.c (finish_non_static_data_member): Use object cv-quals
3593 in scoped case, too.
3595 PR c++/89421 - ICE with lambda in template parameter list.
3596 * parser.c (cp_parser_lambda_expression): Also reject a lambda in a
3597 template parameter list before C++20.
3598 * pt.c (type_dependent_expression_p): True for LAMBDA_EXPR.
3599 * semantics.c (begin_class_definition): Restore error about defining
3600 non-lambda class in template parm list.
3602 2019-03-26 Jason Merrill <jason@redhat.com>
3604 PR c++/86932 - missed SFINAE with empty pack.
3605 * pt.c (coerce_template_parms): Don't add an empty pack if
3607 (fn_type_unification): Pass tf_partial to coerce_template_parms.
3609 PR c++/86429 - constexpr variable in lambda.
3612 * constexpr.c (cxx_eval_constant_expression): In a lambda function,
3613 try evaluating the captured variable directly.
3615 2019-03-26 Jakub Jelinek <jakub@redhat.com>
3618 * semantics.c (finish_omp_atomic): Add warning_sentinel for
3619 -Wunused-value around finish_expr_stmt call.
3621 2019-03-25 Paolo Carlini <paolo.carlini@oracle.com>
3625 * parser.c (cp_parser_binary_expression): Don't call cp_fully_fold
3626 to undo the disabling of warnings.
3628 2019-03-25 Jason Merrill <jason@redhat.com>
3630 PR c++/87748 - substitution failure error with decltype.
3631 * pt.c (most_specialized_partial_spec): Clear
3632 processing_template_decl.
3634 2019-03-25 Marek Polacek <polacek@redhat.com>
3636 PR c++/89214 - ICE when initializing aggregates with bases.
3637 * typeck2.c (digest_init_r): Warn about object slicing instead of
3640 PR c++/89705 - ICE with reference binding with conversion function.
3641 * call.c (reference_binding): If the result of the conversion function
3642 is a prvalue of non-class type, use the cv-unqualified type.
3644 2019-03-25 Nathan Sidwell <nathan@acm.org>
3646 * lambda.c (maybe_add_lambda_conv_op): Don't add to comdat group.
3648 2019-03-22 Jakub Jelinek <jakub@redhat.com>
3651 * cp-tree.h (get_tls_wrapper_fn): Remove declaration.
3652 (maybe_get_tls_wrapper_call): Declare.
3653 * decl2.c (get_tls_wrapper_fn): Make static.
3654 (maybe_get_tls_wrapper_call): New function.
3655 * typeck.c (build_class_member_access_expr): Handle accesses to TLS
3657 * semantics.c (finish_qualified_id_expr): Likewise.
3658 (finish_id_expression_1): Use maybe_get_tls_wrapper_call.
3659 * pt.c (tsubst_copy_and_build): Likewise.
3662 * constexpr.c (struct constexpr_ctx): Add constexpr_ops_count member.
3663 (cxx_eval_constant_expression): When not skipping, not constant class
3664 or location wrapper, increment *ctx->constexpr_ops_count and if it is
3665 above constexpr_loop_nest_limit, diagnose failure.
3666 (cxx_eval_outermost_constant_expr): Add constexpr_ops_count and
3667 initialize ctx.constexpr_ops_count to its address.
3668 (is_sub_constant_expr): Likewise.
3670 2019-03-21 Jakub Jelinek <jakub@redhat.com>
3673 * call.c (filed_in_pset): Change pset from hash_set<tree> * to
3674 hash_set<tree, true> &, adjust uses accordingly.
3675 (build_aggr_conv): Change pset from hash_set<tree> *
3676 to hash_set<tree, true>. Replace goto fail; with return NULL;,
3680 * parser.c (cp_parser_lambda_introducer): Add ids and first_capture_id
3681 variables, check for duplicates in this function.
3682 * lambda.c (add_capture): Don't check for duplicates nor use
3684 (register_capture_members): Don't clear IDENTIFIER_MARKED here.
3686 2019-03-21 Paolo Carlini <paolo.carlini@oracle.com>
3689 * method.c (after_nsdmi_defaulted_late_checks): Avoid passing
3690 error_mark_node to comp_except_specs.
3692 2019-03-20 Jason Merrill <jason@redhat.com>
3694 PR c++/87480 - decltype of member access in default template arg
3695 * pt.c (type_unification_real): Accept a dependent result in
3698 2019-03-19 Martin Sebor <msebor@redhat.com>
3700 PR tree-optimization/89688
3701 * typeck2.c (store_init_value): Call braced_lists_to_string for more
3702 kinds of initializers.
3704 2019-03-18 Jason Merrill <jason@redhat.com>
3706 PR c++/89630 - ICE with dependent using-decl as template arg.
3707 * tree.c (cp_tree_equal): Always return false for USING_DECL.
3709 PR c++/89761 - ICE with sizeof... in pack expansion.
3710 * pt.c (argument_pack_element_is_expansion_p): Handle
3711 ARGUMENT_PACK_SELECT.
3713 PR c++/89640 - GNU attributes on lambda.
3714 * parser.c (cp_parser_lambda_declarator_opt): Allow GNU attributes.
3716 PR c++/89682 - wrong access error in default argument.
3717 * pt.c (tsubst_default_argument): Don't defer access checks.
3719 2019-03-18 Paolo Carlini <paolo.carlini@oracle.com>
3722 * semantics.c (finish_non_static_data_member): Check return value
3723 of context_for_name_lookup and immediately return error_mark_node
3726 2019-03-17 Jason Merrill <jason@redhat.com>
3728 PR c++/89571 - ICE with ill-formed noexcept on constructor.
3729 * pt.c (maybe_instantiate_noexcept): Only return false if defaulted.
3730 (regenerate_decl_from_template): Use it for noexcept-specs.
3732 2019-03-14 Jason Merrill <jason@redhat.com>
3734 * parser.c (cp_parser_decl_specifier_seq): Support C++20
3735 concept-definition syntax without 'bool'.
3737 2019-03-14 Jakub Jelinek <jakub@redhat.com>
3740 * semantics.c (finish_qualified_id_expr): Reject variable templates.
3743 * constexpr.c (struct constexpr_ctx): Change save_exprs type from
3744 hash_set<tree> to vec<tree>.
3745 (cxx_eval_call_expression): Adjust for save_exprs being a vec instead
3747 (cxx_eval_loop_expr): Likewise. Truncate the vector after each
3748 removal of SAVE_EXPRs from values.
3749 (cxx_eval_constant_expression) <case SAVE_EXPR>: Call safe_push
3750 method on save_exprs instead of add.
3752 2019-03-13 Jason Merrill <jason@redhat.com>
3754 PR c++/86521 - C++17 copy elision in initialization by constructor.
3755 * call.c (joust_maybe_elide_copy): New.
3758 2019-03-13 Marek Polacek <polacek@redhat.com>
3760 PR c++/88979 - further P0634 fix for constructors.
3761 * parser.c (cp_parser_decl_specifier_seq): Pass flags to
3762 cp_parser_constructor_declarator_p.
3763 (cp_parser_direct_declarator): Allow missing typename for constructor
3765 (cp_parser_constructor_declarator_p): Add FLAGS parameter. Pass it to
3766 cp_parser_type_specifier.
3768 PR c++/89686 - mixing init-capture and simple-capture in lambda.
3769 * parser.c (cp_parser_lambda_introducer): Give error when combining
3770 init-capture and simple-capture.
3772 PR c++/89660 - bogus error with -Wredundant-move.
3773 * typeck.c (maybe_warn_pessimizing_move): Only accept (T &) &arg
3774 as the std::move's argument. Don't call convert_for_initialization
3775 when warn_redundant_move isn't on.
3777 2019-03-11 Jason Merrill <jason@redhat.com>
3779 PR c++/86521 - wrong overload resolution with ref-qualifiers.
3780 * call.c (build_user_type_conversion_1): Don't use a conversion to a
3781 reference of the wrong rvalueness for direct binding.
3783 2019-03-11 Martin Liska <mliska@suse.cz>
3785 * cvt.c (build_expr_type_conversion): Wrap apostrophes
3786 in gcc internal format with %'.
3787 * decl.c (check_no_redeclaration_friend_default_args): Likewise.
3788 (grokfndecl): Likewise.
3789 * name-lookup.c (do_pushtag): Likewise.
3790 * pt.c (unify_parameter_deduction_failure): Likewise.
3791 (unify_template_deduction_failure): Likewise.
3793 2019-03-11 Martin Liska <mliska@suse.cz>
3795 * call.c (convert_arg_to_ellipsis): Wrap an option name
3796 in a string format message and fix GNU coding style.
3797 (build_over_call): Likewise.
3798 * class.c (check_field_decl): Likewise.
3799 (layout_nonempty_base_or_field): Likewise.
3800 * constexpr.c (cxx_eval_loop_expr): Likewise.
3801 * cvt.c (type_promotes_to): Likewise.
3802 * decl.c (cxx_init_decl_processing): Likewise.
3803 (mark_inline_variable): Likewise.
3804 (grokdeclarator): Likewise.
3805 * decl2.c (record_mangling): Likewise.
3806 * error.c (maybe_warn_cpp0x): Likewise.
3807 * except.c (doing_eh): Likewise.
3808 * mangle.c (maybe_check_abi_tags): Likewise.
3809 * parser.c (cp_parser_diagnose_invalid_type_name): Likewise.
3810 (cp_parser_userdef_numeric_literal): Likewise.
3811 (cp_parser_primary_expression): Likewise.
3812 (cp_parser_unqualified_id): Likewise.
3813 (cp_parser_pseudo_destructor_name): Likewise.
3814 (cp_parser_builtin_offsetof): Likewise.
3815 (cp_parser_lambda_expression): Likewise.
3816 (cp_parser_lambda_introducer): Likewise.
3817 (cp_parser_lambda_declarator_opt): Likewise.
3818 (cp_parser_selection_statement): Likewise.
3819 (cp_parser_init_statement): Likewise.
3820 (cp_parser_decomposition_declaration): Likewise.
3821 (cp_parser_function_specifier_opt): Likewise.
3822 (cp_parser_static_assert): Likewise.
3823 (cp_parser_simple_type_specifier): Likewise.
3824 (cp_parser_namespace_definition): Likewise.
3825 (cp_parser_using_declaration): Likewise.
3826 (cp_parser_ctor_initializer_opt_and_function_body): Likewise.
3827 (cp_parser_initializer_list): Likewise.
3828 (cp_parser_type_parameter_key): Likewise.
3829 (cp_parser_member_declaration): Likewise.
3830 (cp_parser_try_block): Likewise.
3831 (cp_parser_std_attribute_spec): Likewise.
3832 (cp_parser_requires_clause_opt): Likewise.
3833 * pt.c (check_template_variable): Likewise.
3834 (check_default_tmpl_args): Likewise.
3835 (push_tinst_level_loc): Likewise.
3836 (instantiate_pending_templates): Likewise.
3837 (invalid_nontype_parm_type_p): Likewise.
3838 * repo.c (get_base_filename): Likewise.
3839 * rtti.c (typeid_ok_p): Likewise.
3840 (build_dynamic_cast_1): Likewise.
3841 * tree.c (maybe_warn_parm_abi): Likewise.
3843 2019-03-08 Jakub Jelinek <jakub@redhat.com>
3846 * parser.c (cp_parser_template_declaration_after_parameters): Avoid
3847 one space before " at the end of line and another after " on another
3848 line in a string literal.
3850 PR tree-optimization/89550
3851 * semantics.c (maybe_convert_cond): Only set TREE_NO_WARNING if
3852 warning_at returned true.
3853 * decl2.c (c_parse_final_cleanups): Likewise.
3854 * typeck.c (convert_for_assignment): Likewise.
3855 * decl.c (finish_function): Likewise.
3858 * parser.c (cp_parser_asm_definition): Just warn instead of error
3859 on volatile qualifier outside of function body.
3862 * constexpr.c (potential_constant_expression_1): Reject
3863 REINTERPRET_CAST_P NOP_EXPRs.
3866 * call.c (joust): Call print_z_candidate only if pedwarn returned
3869 2019-03-07 Jason Merrill <jason@redhat.com>
3871 PR c++/88123 - lambda and using-directive.
3872 * name-lookup.c (op_unqualified_lookup)
3873 (maybe_save_operator_binding, discard_operator_bindings)
3874 (push_operator_bindings): New.
3875 * typeck.c (build_x_binary_op, build_x_unary_op): Call
3876 maybe_save_operator_binding.
3877 * decl.c (start_preparsed_function): Call push_operator_bindings.
3878 * tree.c (cp_free_lang_data): Call discard_operator_bindings.
3880 PR c++/88820 - ICE with CTAD and member template used in DMI.
3881 * pt.c (do_class_deduction): Handle parm used as its own arg.
3883 2019-03-07 Jakub Jelinek <jakub@redhat.com>
3886 * parser.c (cp_parser_asm_definition): Parse asm qualifiers even
3887 at toplevel, but diagnose them.
3889 2019-03-06 Jason Merrill <jason@redhat.com>
3891 PR c++/89381 - implicit copy and using-declaration.
3892 * class.c (classtype_has_move_assign_or_move_ctor_p): Don't consider
3893 op= brought in by a using-declaration.
3895 2019-03-06 Jakub Jelinek <jakub@redhat.com>
3898 * init.c (build_value_init_noctor): Ignore flexible array members.
3900 2019-03-06 Jason Merrill <jason@redhat.com>
3902 PR c++/89576 - if constexpr of lambda capture.
3903 * semantics.c (maybe_convert_cond): Do convert a non-dependent
3904 condition in a template.
3905 * typeck.c (condition_conversion): Handle being called in a
3908 2019-03-06 Marek Polacek <polacek@redhat.com>
3910 PR c++/87378 - bogus -Wredundant-move warning.
3911 * typeck.c (maybe_warn_pessimizing_move): See if the maybe-rvalue
3912 overload resolution would actually succeed.
3914 2019-03-05 Jason Merrill <jason@redhat.com>
3916 * class.c (is_really_empty_class): Add ignore_vptr parm.
3917 (trivial_default_constructor_is_constexpr): Pass it.
3918 * call.c (build_over_call): Pass it.
3919 * constexpr.c (cxx_eval_constant_expression): Pass it instead of
3920 checking TYPE_POLYMORPHIC_P.
3921 (cxx_eval_component_reference, potential_constant_expression_1):
3923 * cp-gimplify.c (simple_empty_class_p): Pass it.
3924 * init.c (expand_aggr_init_1): Pass it.
3926 2019-03-04 Paolo Carlini <paolo.carlini@oracle.com>
3929 * parser.c (cp_parser_class_head): Reject TYPE_BEING_DEFINED too.
3931 2019-03-04 Jakub Jelinek <jakub@redhat.com>
3934 * call.c (field_in_pset): New function.
3935 (build_aggr_conv): Handle CONSTRUCTOR_IS_DESIGNATED_INIT correctly.
3937 2019-03-02 Jakub Jelinek <jakub@redhat.com>
3940 * cp-tree.h (CONSTRUCTOR_IS_DESIGNATED_INIT): Define.
3941 * parser.c (cp_parser_braced_list): Adjust cp_parser_initializer_list
3942 caller, set CONSTRUCTOR_IS_DESIGNATED_INIT.
3943 (cp_parser_initializer_list): Add designated parameter, set *designated
3944 to a bool whether any designators were parsed.
3945 * decl.c (reshape_init): Copy over CONSTRUCTOR_IS_DESIGNATED_INIT if
3947 * pt.c (tsubst_copy_and_build): Likewise.
3948 * call.c (implicit_conversion): If CONSTRUCTOR_IS_DESIGNATED_INIT,
3949 don't call build_list_conv, nor build_complex_conv, nor attempt to
3950 convert a single element initializer to scalar.
3952 2019-03-01 Marek Polacek <polacek@redhat.com>
3954 PR c++/89537 - missing location for error with non-static member fn.
3955 * call.c (resolve_args): Use EXPR_LOCATION.
3956 * typeck.c (build_class_member_access_expr): Use input_location.
3958 PR c++/89532 - ICE with incomplete type in decltype.
3959 * semantics.c (finish_compound_literal): Return error_mark_node
3960 if digest_init_flags returns error_mark_node.
3962 2019-03-01 Jakub Jelinek <jakub@redhat.com>
3964 Implement P1002R1, Try-catch blocks in constexpr functions
3966 * parser.c (cp_parser_ctor_initializer_opt_and_function_body):
3967 Diagnose constexpr ctor or function with function-try-block with
3968 pedwarn for c++17 and earlier. Formatting fix.
3969 (cp_parser_try_block): Use pedwarn instead of error and only for
3970 c++17 and earlier when try block appears in constexpr function.
3971 * constexpr.c (build_constexpr_constructor_member_initializers):
3972 Handle TRY_BLOCK here instead of erroring on it.
3974 2019-02-28 Jason Merrill <jason@redhat.com>
3976 PR c++/88183 - ICE with .* fold-expression.
3977 * pt.c (fold_expression) [DOTSTAR_EXPR]: Remove special handling.
3979 PR c++/86969 - ICE with constexpr if and recursive generic lambdas.
3980 * class.c, lambda.c, pt.c: Revert earlier change.
3981 * lambda.c (add_capture): Don't special-case capture of dependent
3984 * name-lookup.c (print_binding_level): Print this_entity.
3986 2019-02-27 Marek Polacek <polacek@redhat.com>
3988 PR c++/88857 - ICE with value-initialization of argument in template.
3989 * call.c (convert_like_real): Don't call build_value_init in template.
3991 2019-02-27 Jason Merrill <jason@redhat.com>
3993 PR c++/86969 - ICE with constexpr if and recursive generic lambdas.
3994 * semantics.c (process_outer_var_ref): Do capture dependent vars.
3995 * class.c (finish_struct): Only add TAG_DEFN if T is in
3996 current_function_decl.
3997 * lambda.c (vla_capture_type): Force the capture type out into the
3998 lambda's enclosing function.
3999 (add_capture): Pass in the lambda.
4000 * pt.c (tsubst_lambda_expr): complete_type a VLA capture type.
4002 2019-02-27 Marek Polacek <polacek@redhat.com>
4004 PR c++/89511 - ICE with using-declaration and unscoped enumerator.
4005 * parser.c (cp_parser_using_declaration): For an unscoped enum
4006 only use its context if it's not a function declaration.
4008 2019-02-27 Paolo Carlini <paolo.carlini@oracle.com>
4011 * method.c (process_subob_fn): When maybe_instantiate_noexcept
4012 returns false don't call merge_exception_specifiers.
4014 2019-02-27 Paolo Carlini <paolo.carlini@oracle.com>
4017 * parser.c (cp_parser_noexcept_specification_opt): Return NULL_TREE
4018 for a non-constant parsed expression.
4020 2019-02-26 Jakub Jelinek <jakub@redhat.com>
4023 * constexpr.c (cxx_eval_store_expression): When changing active union
4024 member, set no_zero_init.
4026 2019-02-23 Marek Polacek <polacek@redhat.com>
4028 PR c++/88294 - ICE with non-constant noexcept-specifier.
4029 * pt.c (maybe_instantiate_noexcept): Set up the list of local
4030 specializations. Set current_class_{ptr,ref}.
4032 2019-02-22 David Malcolm <dmalcolm@redhat.com>
4035 * parser.c (cp_parser_unqualified_id): Capture and use locations
4038 2019-02-22 Marek Polacek <polacek@redhat.com>
4040 PR c++/89420 - ICE with CAST_EXPR in explicit-specifier.
4041 * decl.c (build_explicit_specifier): Don't check
4042 processing_template_decl. Call instantiation_dependent_expression_p
4043 instead of value_dependent_expression_p. Call
4044 instantiate_non_dependent_expr_sfinae before
4045 build_converted_constant_expr instead of calling
4046 instantiate_non_dependent_expr after it. Add
4047 processing_template_decl_sentinel.
4049 2019-02-22 Thomas Schwinge <thomas@codesourcery.com>
4051 * parser.c (cp_parser_oacc_simple_clause): Remove parser formal
4052 parameter, move loc formal parameter to the front. Adjust all
4054 (cp_parser_oacc_shape_clause): Add loc formal parameter. Adjust
4057 2019-02-21 Jason Merrill <jason@redhat.com>
4059 PR c++/87685 - generic lambda 'this' capture error.
4060 * lambda.c (lambda_expr_this_capture): Change add_capture_p to int.
4061 (maybe_generic_this_capture): Pass -1.
4063 PR c++/88394 - ICE with VLA init-capture.
4064 * lambda.c (is_normal_capture_proxy): Check DECL_CAPTURED_VARIABLE.
4066 PR c++/88869 - C++17 ICE with CTAD and explicit specialization.
4067 * pt.c (do_class_deduction): Don't include explicit specialization
4070 PR c++/89422 - ICE with -g and lambda in default arg in template.
4071 * pt.c (tsubst_function_decl): SET_DECL_FRIEND_CONTEXT sooner.
4073 2019-02-21 Jason Merrill <jason@redhat.com>
4075 PR c++/88419 - C++17 ICE with class template arg deduction.
4076 * pt.c (make_template_placeholder): Set TYPE_CANONICAL after
4077 CLASS_PLACEHOLDER_TEMPLATE.
4079 2019-02-21 Jakub Jelinek <jakub@redhat.com>
4082 * constexpr.c (struct constexpr_fundef): Add parms and result members.
4083 (retrieve_constexpr_fundef): Adjust for the above change.
4084 (register_constexpr_fundef): Save constexpr body with copy_fn,
4085 temporarily set DECL_CONTEXT on DECL_RESULT before that.
4086 (get_fundef_copy): Change FUN argument to FUNDEF with
4087 constexpr_fundef * type, grab body and parms/result out of
4088 constexpr_fundef struct and temporarily change it for copy_fn calls
4090 (cxx_eval_builtin_function_call): For __builtin_FUNCTION temporarily
4091 adjust current_function_decl from ctx->call context. Test
4092 !potential_constant_expression instead of !is_constant_expression.
4093 (cxx_bind_parameters_in_call): Grab parameters from new_call. Undo
4094 convert_for_arg_passing changes for TREE_ADDRESSABLE type passing.
4095 (cxx_eval_call_expression): Adjust get_fundef_copy caller.
4096 (cxx_eval_conditional_expression): For IF_STMT, allow then or else
4097 operands to be NULL.
4098 (label_matches): Handle BREAK_STMT and CONTINUE_STMT.
4099 (cxx_eval_loop_expr): Add support for FOR_STMT, WHILE_STMT and DO_STMT.
4100 (cxx_eval_switch_expr): Add support for SWITCH_STMT.
4101 (cxx_eval_constant_expression): Handle IF_STMT, FOR_STMT, WHILE_STMT,
4102 DO_STMT, CONTINUE_STMT, SWITCH_STMT, BREAK_STMT and CONTINUE_STMT.
4103 For SIZEOF_EXPR, recurse on the result of fold_sizeof_expr. Ignore
4104 DECL_EXPR with USING_DECL operand.
4105 * lambda.c (maybe_add_lambda_conv_op): Build thisarg using
4106 build_int_cst to make it a valid constant expression.
4108 2019-02-20 Jason Merrill <jason@redhat.com>
4110 PR c++/88690 - C++17 ICE with empty base in aggregate.
4111 * typeck2.c (process_init_constructor_record): Skip trivial
4112 initialization of an empty base.
4114 2019-02-21 Richard Biener <rguenther@suse.de>
4117 * vtable-class-hierarchy.c (vtv_generate_init_routine): Do not
4118 make symtab process new functions here.
4120 2019-02-20 Jason Merrill <jason@redhat.com>
4122 PR c++/87921 - wrong error with inline static data member.
4123 * decl2.c (finish_static_data_member_decl): Don't set DECL_IN_AGGR_P
4124 for a non-template inline variable. Do nothing for an
4125 already-instantiated variable.
4126 (c_parse_final_cleanups): Check DECL_IN_AGGR_P without
4128 * decl.c (check_initializer): Likewise.
4129 (make_rtl_for_nonlocal_decl): Likewise.
4130 * pt.c (instantiate_decl): Likewise.
4131 * typeck2.c (store_init_value): Likewise.
4133 2019-02-20 Jakub Jelinek <jakub@redhat.com>
4136 * decl2.c (c_parse_final_cleanups): Move TREE_ASM_WRITTEN setting
4137 for flag_syntax_only from here...
4138 * semantics.c (expand_or_defer_fn_1): ... here.
4141 * decl.c (maybe_commonize_var): When clearing TREE_PUBLIC and
4142 DECL_COMMON, set DECL_INTERFACE_KNOWN.
4145 * constexpr.c (cxx_eval_store_expression): Diagnose changing of active
4146 union member for -std=c++17 and earlier.
4148 2019-02-19 Jason Merrill <jason@redhat.com>
4150 PR c++/87513 - 'sorry' mangling PMF template-id.
4151 * mangle.c (write_expression): Handle SCOPE_REF to BASELINK.
4153 2019-02-19 Jason Merrill <jason@redhat.com>
4155 PR c++/88380 - wrong-code with flexible array and NSDMI.
4156 * typeck2.c (process_init_constructor_record): Skip flexarrays.
4158 2019-02-20 will wray <wjwray@gmail.com>
4160 PR c++/88572 - wrong handling of braces on scalar init.
4161 * decl.c (reshape_init_r): Allow braces around scalar initializer
4162 within aggregate init. Reject double braced-init of scalar
4165 2019-02-20 Paolo Carlini <paolo.carlini@oracle.com>
4168 * pt.c (tsubst_init): Diagnose an initializer expanding to an
4169 empty list of expressions; tweak wrt dependent types.
4170 (regenerate_decl_from_template): For VAR_DECLs call tsubst_init
4171 instead of tsubst_expr.
4173 2019-02-19 Jason Merrill <jason@redhat.com>
4175 PR c++/88368 - wrong 'use of deleted function'
4176 * method.c (walk_field_subobs): Remember errors from get_nsdmi.
4177 (get_defaulted_eh_spec): Call push_tinst_level.
4178 * pt.c (maybe_instantiate_noexcept): Keep error_mark_node.
4179 * typeck2.c (merge_exception_specifiers): Handle error_mark_node.
4181 2019-02-19 Chung-Lin Tang <cltang@codesourcery.com>
4184 * parser.c (cp_parser_oacc_clause_wait): Add representation of wait
4185 clause without argument as 'wait (GOMP_ASYNC_NOVAL)', adjust comments.
4187 2019-02-19 Jakub Jelinek <jakub@redhat.com>
4190 * lambda.c (maybe_generic_this_capture): Don't check
4191 DECL_NONSTATIC_MEMBER_FUNCTION_P on USING_DECLs.
4194 * typeck.c (build_reinterpret_cast_1): Don't handle void to
4195 && conversion go through build_target_expr_with_type.
4198 * error.c (qualified_name_lookup_error): Only call
4199 suggest_alternative_in_scoped_enum if name is IDENTIFIER_NODE.
4201 2019-02-19 Tom Honermann <tom@honermann.net>
4203 * name-lookup.c (get_std_name_hint): Added u8string as a name hint.
4205 2019-02-18 Jason Merrill <jason@redhat.com>
4207 PR c++/89336 - multiple stores in constexpr stmt.
4208 * constexpr.c (cxx_eval_store_expression): Preevaluate scalar or
4211 * pt.c (check_explicit_specialization): If the declarator is a
4212 template-id, only check whether the arguments are dependent.
4214 Improve duplicate [[likely]] diagnostic.
4215 * parser.c (cp_parser_statement): Make attrs_loc a range. Pass it
4216 to process_stmt_hotness_attribute.
4217 * cp-gimplify.c (process_stmt_hotness_attribute): Take attrs_loc.
4218 (genericize_if_stmt): Use likely/unlikely instead of predictor_name.
4220 2019-02-17 Marek Polacek <polacek@redhat.com>
4222 PR c++/89217 - ICE with list-initialization in range-based for loop.
4223 * constexpr.c (unshare_constructor): No longer static.
4224 * cp-tree.h (unshare_constructor): Declare.
4225 * semantics.c (finish_compound_literal): When dealing with a
4226 non-dependent expression in a template, return the original
4227 expression. Pass LOOKUP_NO_NARROWING to digest_init_flags.
4229 2019-02-13 Marek Polacek <polacek@redhat.com>
4231 PR c++/89297 - ICE with OVERLOAD in template.
4232 * semantics.c (finish_compound_literal): Call
4233 instantiate_non_dependent_expr_sfinae.
4235 2019-02-13 Alexandre Oliva <aoliva@redhat.com>
4238 * cp-tree.h (USING_DECL_SCOPE): Use result rather than type.
4239 * name-lookup.c (strip_using_decl): Use USING_DECL_SCOPE.
4240 * search.c (protected_accessible_p): Follow USING_DECL_DECLS.
4241 (shared_member_p): Likewise.
4242 (lookup_member): Likewise.
4243 * decl.c (grok_special_member_properties): Skip USING_DECLs.
4244 * semantics.c (finish_omp_declare_simd_methods): Likewise.
4245 (finish_qualified_id_expr): Do not call shared_member_p with
4249 * pt.c (tsubst_lambda_expr): Avoid duplicate tsubsting.
4250 Move cp_evaluated resetting before signature tsubsting.
4251 (gen_elem_of_pack_expansion_instantiation): Separate local
4252 specializations per index.
4254 2019-02-13 David Malcolm <dmalcolm@redhat.com>
4257 * class.c (add_method): Drop destructor assertion.
4259 2019-02-13 Paolo Carlini <paolo.carlini@oracle.com>
4262 * decl.c (make_typename_type): Allow for TYPE_PACK_EXPANSION as
4263 context (the first argument).
4264 * pt.c (tsubst, case TYPENAME_TYPE): Handle TYPE_PACK_EXPANSION
4267 2019-02-12 Jason Merrill <jason@redhat.com>
4269 PR c++/89144 - link error with constexpr initializer_list.
4270 * call.c (convert_like_real) [ck_list]: Don't allocate a temporary
4271 array for an empty list.
4272 * typeck2.c (store_init_value): Don't use cxx_constant_init in a
4275 2019-02-11 Jason Merrill <jason@redhat.com>
4277 PR c++/89241 - ICE with __func__ in lambda in template.
4278 * pt.c (enclosing_instantiation_of): Also check
4279 instantiated_lambda_fn_p for the template context.
4281 2019-02-11 Marek Polacek <polacek@redhat.com>
4283 PR c++/89212 - ICE converting nullptr to pointer-to-member-function.
4284 * pt.c (tsubst_copy_and_build) <case CONSTRUCTOR>: Return early for
4285 null member pointer value.
4287 2019-02-11 Jakub Jelinek <jakub@redhat.com>
4290 * pt.c (convert_nontype_argument): Pass true as manifestly_const_eval
4291 to maybe_constant_value calls.
4293 2019-02-11 Marek Polacek <polacek@redhat.com>
4295 * typeck2.c (digest_init_r): Remove commented code.
4297 2019-02-11 Martin Sebor <msebor@redhat.com>
4300 * decl.c (compute_array_index_type_loc): Preserve signed sizes
4301 for diagnostics. Call valid_array_size_p instead of error.
4302 * init.c (build_new_1): Compute size for diagnostic. Call
4303 invalid_array_size_error
4304 (build_new): Call valid_array_size_p instead of error.
4306 2019-02-07 Alexandre Oliva <aoliva@redhat.com>
4309 * call.c (compare_ics): Deal with ck_aggr in either cs.
4311 2019-02-06 David Malcolm <dmalcolm@redhat.com>
4314 * call.c (get_location_for_expr_unwinding_for_system_header): New
4316 (conversion_null_warnings): Use it when getting locations for
4317 EXPR, effectively adding a call to
4318 get_location_for_expr_unwinding_for_system_header for
4319 -Wconversion-null and making use of EXPR_LOCATION for
4320 -Wzero-as-null-pointer-constant.
4322 2019-02-05 Jakub Jelinek <jakub@redhat.com>
4325 * optimize.c (maybe_thunk_body): Clear TREE_ADDRESSABLE on
4326 PARM_DECLs of the thunk.
4327 * lambda.c (maybe_add_lambda_conv_op): Likewise.
4329 2019-02-05 Marek Polacek <polacek@redhat.com>
4331 PR c++/89158 - by-value capture of constexpr variable broken.
4332 * call.c (convert_like_real) <case ck_user>: Call mark_exp_read
4333 instead of mark_rvalue_use.
4335 2019-02-05 Alexandre Oliva <aoliva@redhat.com>
4338 * pt.c (instantiates_primary_template_p): New.
4339 (type_dependent_expression_p): Use it.
4341 2019-02-01 Jason Merrill <jason@redhat.com>
4343 PR c++/88761 - ICE with reference capture of constant.
4344 * lambda.c (mark_const_cap_r): Do walk subtrees of DECL_EXPR for
4347 2019-02-01 Marek Polacek <polacek@redhat.com>
4349 PR c++/88325 - ICE with invalid out-of-line template member definition.
4350 * parser.c (cp_parser_class_name): Don't call make_typename_type
4353 2019-02-01 Jakub Jelinek <jakub@redhat.com>
4356 * parser.c (cp_parser_gnu_attributes_opt): Set ok to false
4357 if require_open failed.
4359 2019-01-31 Marek Polacek <polacek@redhat.com>
4361 PR c++/89083, c++/80864 - ICE with list initialization in template.
4362 * constexpr.c (adjust_temp_type): Use copy_node and change the type
4363 instead of using build_constructor.
4364 * decl.c (reshape_init_r): Don't reshape a digested initializer.
4365 Return the initializer for COMPOUND_LITERAL_P.
4367 PR c++/88983 - ICE with switch in constexpr function.
4368 * constexpr.c (cxx_eval_switch_expr): Use SWITCH_COND and SWITCH_BODY.
4369 (cxx_eval_constant_expression) <case COND_EXPR>: Don't look for the
4370 label in the else branch if we found it in the then branch.
4372 2019-01-30 Jason Merrill <jason@redhat.com>
4374 PR c++/88752 - ICE with lambda and constexpr if.
4375 * cp-tree.h (LAMBDA_EXPR_INSTANTIATED): New.
4376 * pt.c (tsubst_lambda_expr): Set it.
4377 (instantiated_lambda_fn_p): Check it.
4378 (enclosing_instantiation_of): Use it.
4380 2019-01-31 Jakub Jelinek <jakub@redhat.com>
4383 * cxx-pretty-print.c (pp_cxx_enumeration_constant): Print always as
4384 a C cast in pp_c_flag_gnu_v3 mode.
4386 2019-01-30 Jakub Jelinek <jakub@redhat.com>
4389 * lambda.c (is_capture_proxy): Don't return true for
4390 DECL_OMP_PRIVATIZED_MEMBER artificial vars.
4392 2019-01-30 Marek Polacek <polacek@redhat.com>
4394 PR c++/89119 - ICE with value-initialization in template.
4395 * pt.c (tsubst_copy_and_build): Handle RANGE_EXPR.
4397 2019-01-29 Jason Merrill <jason@redhat.com>
4399 PR c++/86943 - wrong code converting lambda to function pointer.
4400 * lambda.c (maybe_add_lambda_conv_op): Use a template-id in the
4401 call. Only forward parms for decltype.
4402 * pt.c (tsubst_copy_and_build) [CALL_EXPR]: Handle CALL_FROM_THUNK_P
4404 * typeck.c (check_return_expr): Don't mess with a thunk call.
4406 2019-01-28 Jason Merrill <jason@redhat.com>
4408 PR c++/89089 - ICE with [[no_unique_address]].
4409 PR c++/88865 - wrong layout with [[no_unique_address]].
4410 * class.c (check_field_decls): A potentially-overlapping field makes
4411 the class non-layout-POD, but not non-empty.
4412 (end_of_class): Always consider empty data members.
4413 (layout_class_type): Set DECL_SIZE for empty fields.
4415 2019-01-28 Marek Polacek <polacek@redhat.com>
4417 PR c++/88358 - name wrongly treated as type.
4418 * parser.c (cp_parser_direct_declarator): Don't assume a qualified-id
4419 in parameter-list is a type if the function's declarator-id is not
4422 2019-01-27 Marek Polacek <polacek@redhat.com>
4424 PR c++/88815 - narrowing conversion lost in decltype.
4425 PR c++/78244 - narrowing conversion in template not detected.
4426 * cp-tree.h (CONSTRUCTOR_IS_DEPENDENT): New.
4427 * pt.c (instantiation_dependent_r): Consider a CONSTRUCTOR with
4428 CONSTRUCTOR_IS_DEPENDENT instantiation-dependent.
4429 * semantics.c (finish_compound_literal): When the compound literal
4430 isn't instantiation-dependent and the type isn't type-dependent,
4431 fall back to the normal processing. Set CONSTRUCTOR_IS_DEPENDENT.
4433 PR c++/89024 - ICE with incomplete enum type.
4434 * call.c (standard_conversion): When converting an
4435 ARITHMETIC_TYPE_P to an incomplete type, return NULL.
4437 2019-01-25 Paolo Carlini <paolo.carlini@oracle.com>
4440 * call.c (build_op_delete_call): Implement 7.6.2.5/(10.1).
4441 * decl2.c (coerce_delete_type): Use build_pointer_type instead
4444 2019-01-24 Jason Merrill <jason@redhat.com>
4446 PR c++/89001 - mangling of reference temporaries
4447 * cp-tree.h (struct saved_scope): Add ref_temp_count.
4448 (current_ref_temp_count): New macro.
4449 * mangle.c (mangle_ref_init_variable): Use it.
4450 * typeck2.c (store_init_value): Clear it.
4451 * call.c (make_temporary_var_for_ref_to_temp): Copy public and
4454 2019-01-24 Jakub Jelinek <jakub@redhat.com>
4457 * semantics.c (finish_omp_cancel): Diagnose more than one if
4458 on #pragma omp cancel with different modifiers. Use
4459 maybe_convert_cond when not in template or build_x_binary_op
4462 2019-01-23 Marek Polacek <polacek@redhat.com>
4464 PR c++/88757 - qualified name treated wrongly as type.
4465 * parser.c (cp_parser_direct_declarator): Don't treat qualified-ids
4466 in parameter-list as types if name lookup for declarator-id didn't
4467 find one or more function templates.
4469 2019-01-23 Jakub Jelinek <jakub@redhat.com>
4472 * cp-gimplify.c (genericize_cp_loop): Call begin_bc_block only
4473 after genericizing cond and incr expressions.
4476 * cp-gimplify.c (genericize_switch_stmt): Move cond genericization
4477 before the begin_bc_block call.
4479 2019-01-21 Jason Merrill <jason@redhat.com>
4481 PR c++/87893 - constexpr ctor ICE on ARM.
4482 PR c++/88293 - ICE with comma expression.
4483 * constexpr.c (initialized_type): Don't shortcut non-void type.
4484 Handle COMPOUND_EXPR.
4485 (cxx_eval_outermost_constant_expr): Return early for void type.
4487 2019-01-21 Jakub Jelinek <jakub@redhat.com>
4490 * optimize.c (cxx_copy_decl): New function.
4491 (clone_body): Use it instead of copy_decl_no_change.
4494 * typeck.c (cp_build_binary_op): Don't instrument
4495 SANITIZE_POINTER_COMPARE if processing_template_decl.
4496 (pointer_diff): Similarly for SANITIZE_POINTER_SUBTRACT.
4498 2019-01-18 Jason Merrill <jason@redhat.com>
4500 PR c++/88875 - error with explicit list constructor.
4501 * call.c (reference_binding): Don't modify EXPR. Set
4502 need_temporary_p on the ck_user conversion for a temporary.
4503 (convert_like_real): Check it.
4505 2019-01-18 H.J. Lu <hongjiu.lu@intel.com>
4509 * call.c (convert_for_arg_passing): Upate the
4510 warn_for_address_or_pointer_of_packed_member call.
4511 * typeck.c (convert_for_assignment): Likewise.
4513 2019-01-17 Jason Merrill <jason@redhat.com>
4515 PR c++/86205 - ICE with ?: of throw and template-id.
4516 * pt.c (resolve_nondeduced_context_or_error): Split out from...
4517 * typeck.c (decay_conversion): ...here.
4518 * call.c (build_conditional_expr_1): Use it.
4520 PR c++/86740, ICE with constexpr if and nested generic lambdas.
4521 * tree.c (cp_walk_subtrees): Handle LAMBDA_EXPR.
4523 2019-01-17 Paolo Carlini <paolo.carlini@oracle.com>
4525 * decl.c (grokdeclarator): Use typespec_loc in error messages
4526 about 'auto' and trailing return type.
4528 2019-01-17 David Malcolm <dmalcolm@redhat.com>
4531 * class.c (add_method): Don't use DECL_DESTRUCTOR_P on
4534 2019-01-17 Nathan Sidwell <nathan@acm.org>
4537 * semantics.c (process_outer_var_ref): Only skip dependent types
4540 2019-01-17 Alexandre Oliva <aoliva@redhat.com>
4543 * cp-tree.h (saved_scope): Add suppress_location_wrappers.
4544 * name-lookup.c (do_push_to_top_level): Save and reset it.
4545 (do_pop_from_top_level): Restore it.
4548 * pt.c (make_template_placeholder): Use auto_identifier.
4549 (is_auto): Drop CLASS_PLACEHOLDER_TEMPLATE test.
4550 * error.c (dump_type): Handle template placeholders.
4551 * cxx-pretty-print.c (pp_cx_unqualified_id): Likewise.
4554 * cvt.c (convert_to_void): Handle all cdtor calls as if
4557 2019-01-16 Paolo Carlini <paolo.carlini@oracle.com>
4559 * decl.c (grokdeclarator): Use locations[ds_storage_class] in
4560 error messages about ill-formed uses of mutable.
4562 2019-01-16 Marek Polacek <polacek@redhat.com>
4564 PR c++/78244 - narrowing conversion in template not detected.
4565 * call.c (perform_implicit_conversion_flags): Set
4566 IMPLICIT_CONV_EXPR_BRACED_INIT.
4567 * cp-tree.h (IMPLICIT_CONV_EXPR_BRACED_INIT): New.
4568 * pt.c (tsubst_copy_and_build): Use it.
4570 2019-01-15 David Malcolm <dmalcolm@redhat.com>
4573 * pt.c (build_deduction_guide): Bail out if tsubst_arg_types
4576 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com>
4578 * decl.c (start_decl): Improve error location.
4579 * decl2.c (grokfield): Likewise.
4581 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com>
4583 * decl.c (grokdeclarator): Move further up the location_t loc
4584 declaration and use the location when building a TYPE_DECL for
4586 * decl2.c (grokbitfield): Use DECL_SOURCE_LOCATION in the error
4587 about an ill-formed bit-field as typedef.
4589 2019-01-14 Marek Polacek <polacek@redhat.com>
4591 PR c++/88830 - ICE with abstract class.
4592 * decl2.c (maybe_emit_vtables): Check CLASSTYPE_LAZY_DESTRUCTOR.
4595 PR c++/88825 - ICE with bogus function return type deduction.
4596 * typeck.c (can_do_nrvo_p): Check error_mark_node.
4598 2019-01-14 Tom Honermann <tom@honermann.net>
4600 Implement P0482R5, char8_t: A type for UTF-8 characters and strings
4601 * cvt.c (type_promotes_to): Handle char8_t promotion.
4602 * decl.c (grokdeclarator): Handle invalid type specifier
4603 combinations involving char8_t.
4604 * lex.c (init_reswords): Add char8_t as a reserved word.
4605 * mangle.c (write_builtin_type): Add name mangling for char8_t (Du).
4606 * parser.c (cp_keyword_starts_decl_specifier_p)
4607 (cp_parser_simple_type_specifier): Recognize char8_t as a simple
4609 (cp_parser_string_literal): Use char8_array_type_node for the type
4611 (cp_parser_set_decl_spec_type): Tolerate char8_t typedefs in system
4613 * rtti.c (emit_support_tinfos): type_info support for char8_t.
4614 * tree.c (char_type_p): Recognize char8_t as a character type.
4615 * typeck.c (string_conv_p): Handle conversions of u8 string
4616 literals of char8_t type.
4617 (check_literal_operator_args): Handle UDLs with u8 string literals
4619 * typeck2.c (ordinary_char_type_p): New.
4620 (digest_init_r): Disallow initializing a char array with a u8 string
4623 2019-01-14 Martin Liska <mliska@suse.cz>
4625 PR gcov-profile/88263
4626 * decl2.c (get_tls_wrapper_fn): Use DECL_SOURCE_LOCATION
4627 as location of the TLS wrapper.
4629 2019-01-12 Paolo Carlini <paolo.carlini@oracle.com>
4631 * decl.c (cp_finish_decl): Improve error location.
4632 * decl2.c (grokfield): Likewise, improve two locations.
4634 2019-01-11 Marek Polacek <polacek@redhat.com>
4636 PR c++/88692, c++/87882 - -Wredundant-move false positive with *this.
4637 * typeck.c (maybe_warn_pessimizing_move): Return if ARG isn't
4640 2019-01-11 Jason Merrill <jason@redhat.com>
4642 PR c++/88312 - pack expansion of decltype.
4643 * pt.c (instantiation_dependent_r): A template non-type parameter
4644 pack is instantiation-dependent.
4646 2019-01-11 Jason Merrill <jason@redhat.com>
4648 PR c++/88613 - ICE with use of const var in lambda.
4649 * expr.c (mark_use): Fix location wrapper handling.
4650 * cp-gimplify.c (cp_fold_maybe_rvalue): Call mark_rvalue_use.
4652 2019-01-11 Tobias Burnus <burnus@net-b.de>
4655 * decl2.c (maybe_emit_vtables): If needed, generate code for
4656 the destructor of an abstract class.
4657 (mark_used): Update comment for older function-name change.
4659 2019-01-11 Paolo Carlini <paolo.carlini@oracle.com>
4661 * decl.c (start_decl): Improve error location.
4662 (grokdeclarator): Likewise, improve two locations.
4664 2019-01-09 Sandra Loosemore <sandra@codesourcery.com>
4668 * cp-tree.h: Mechanically replace "can not" with "cannot".
4669 * parser.c: Likewise.
4672 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com>
4674 * decl.c (grok_reference_init): Improve error location.
4675 (grokdeclarator): Likewise, improve two locations.
4677 2019-01-08 Marek Polacek <polacek@redhat.com>
4679 PR c++/88538 - braced-init-list in template-argument-list.
4680 * parser.c (cp_parser_template_argument): Handle braced-init-list when
4683 PR c++/88548 - this accepted in static member functions.
4684 * parser.c (cp_debug_parser): Adjust printing of
4685 local_variables_forbidden_p.
4686 (cp_parser_new): Set local_variables_forbidden_p to 0 rather than false.
4687 (cp_parser_primary_expression): When checking
4688 local_variables_forbidden_p, use THIS_FORBIDDEN or
4689 LOCAL_VARS_FORBIDDEN.
4690 (cp_parser_lambda_body): Update the type of
4691 local_variables_forbidden_p. Set it to 0 rather than false.
4692 (cp_parser_condition): Adjust call to cp_parser_declarator.
4693 (cp_parser_explicit_instantiation): Likewise.
4694 (cp_parser_init_declarator): Likewise.
4695 (cp_parser_declarator): New parameter. Use it.
4696 (cp_parser_direct_declarator): New parameter. Use it to set
4697 local_variables_forbidden_p. Adjust call to cp_parser_declarator.
4698 (cp_parser_type_id_1): Adjust call to cp_parser_declarator.
4699 (cp_parser_parameter_declaration): Likewise.
4700 (cp_parser_default_argument): Update the type of
4701 local_variables_forbidden_p. Set it to LOCAL_VARS_AND_THIS_FORBIDDEN
4703 (cp_parser_member_declaration): Tell cp_parser_declarator if we saw
4704 'static' or 'friend'.
4705 (cp_parser_exception_declaration): Adjust call to cp_parser_declarator.
4706 (cp_parser_late_parsing_default_args): Update the type of
4707 local_variables_forbidden_p. Set it to LOCAL_VARS_AND_THIS_FORBIDDEN
4709 (cp_parser_cache_defarg): Adjust call to cp_parser_declarator.
4710 (cp_parser_objc_class_ivars): Likewise.
4711 (cp_parser_objc_struct_declaration): Likewise.
4712 (cp_parser_omp_for_loop_init): Likewise.
4713 * parser.h (cp_parser): Change the type of local_variables_forbidden_p
4715 (LOCAL_VARS_FORBIDDEN, LOCAL_VARS_AND_THIS_FORBIDDEN, THIS_FORBIDDEN):
4718 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com>
4720 * decl.c (start_decl): Improve permerror location.
4722 2019-01-08 Jonathan Wakely <jwakely@redhat.com>
4723 Jakub Jelinek <jakub@redhat.com>
4726 * decl.c (finish_function): For -Wreturn-type don't add a return *this;
4727 fixit hint if current_class_ref is NULL. Use a single if instead of
4730 2019-01-07 Paolo Carlini <paolo.carlini@oracle.com>
4732 * decl.c (start_decl): Improve two error_at locations.
4733 (expand_static_init): Likewise.
4735 2019-01-07 Marek Polacek <polacek@redhat.com>
4737 PR c++/88741 - wrong error with initializer-string.
4738 * decl.c (cp_complete_array_type): Strip any location wrappers.
4740 2019-01-07 Bernd Edlinger <bernd.edlinger@hotmail.de>
4746 * cp-tree.h (LOOKUP_ALLOW_FLEXARRAY_INIT): New flag value.
4747 * typeck2.c (digest_init_r): Raise an error for non-static
4748 initialization of a flexible array member.
4749 (process_init_constructor, massage_init_elt,
4750 process_init_constructor_array, process_init_constructor_record,
4751 process_init_constructor_union, process_init_constructor): Add the
4752 flags parameter and pass it thru.
4753 (store_init_value): Pass LOOKUP_ALLOW_FLEXARRAY_INIT parameter to
4754 digest_init_flags for static decls.
4756 2019-01-07 Jakub Jelinek <jakub@redhat.com>
4759 * cp-tree.h (cp_build_vec_convert): Declare.
4760 * parser.c (cp_parser_postfix_expression): Parse
4761 __builtin_convertvector.
4762 * constexpr.c: Include fold-const-call.h.
4763 (cxx_eval_internal_function): Handle IFN_VEC_CONVERT.
4764 (potential_constant_expression_1): Likewise.
4765 * semantics.c (cp_build_vec_convert): New function.
4766 * pt.c (tsubst_copy_and_build): Handle CALL_EXPR to
4769 2019-01-03 Jakub Jelinek <jakub@redhat.com>
4772 * decl.c (builtin_function_1): Return result of pushdecl_top_level
4773 or pushdecl rather than decl.
4775 2019-01-03 Paolo Carlini <paolo.carlini@oracle.com>
4777 * tree.c (handle_nodiscard_attribute): Improve warning location.
4779 2019-01-02 Marek Polacek <polacek@redhat.com>
4781 PR c++/88612 - ICE with -Waddress-of-packed-member.
4782 * call.c (convert_for_arg_passing): Only give warnings with tf_warning.
4783 * typeck.c (convert_for_assignment): Likewise.
4785 PR c++/88631 - CTAD failing for value-initialization.
4786 * typeck2.c (build_functional_cast): Try deducing the template
4787 arguments even if there are no arguments to deduce from.
4789 2019-01-01 Jakub Jelinek <jakub@redhat.com>
4791 Update copyright years.
4793 Copyright (C) 2019 Free Software Foundation, Inc.
4795 Copying and distribution of this file, with or without modification,
4796 are permitted in any medium without royalty provided the copyright
4797 notice and this notice are preserved.