1 2019-11-04 Jason Merrill <jason@redhat.com>
3 * constexpr.c (explain_invalid_constexpr_fn): Show location of fn.
5 * pt.c (maybe_instantiate_noexcept): Only update clones if we
8 * typeck.c (contextual_conv_bool): New.
10 * name-lookup.c (lookup_qualified_name): Add wrapper overload taking
11 C string rather than identifier.
12 * parser.c (cp_parser_userdef_numeric_literal): Use it.
13 * rtti.c (emit_support_tinfos): Use it.
14 * cp-tree.h (ovl_op_identifier): Change to inline functions.
15 (build_x_binary_op): Add wrapper with fewer parms.
17 2019-11-05 Jason Merrill <jason@redhat.com>
19 * decl2.c (mark_used): Diagnose use of a function with unsatisfied
21 * typeck.c (cp_build_function_call_vec): Not here.
23 2019-11-05 Nathan Sidwell <nathan@acm.org>
26 * parser.c (cp_parser_error_1): Check EOF and UNKNOWN_LOCATION
27 when skipping over version control marker.
29 2019-11-05 Jakub Jelinek <jakub@redhat.com>
32 * constexpr.c (potential_constant_expression_1): Return true rather
33 than false for PREDICT_EXPR.
35 * decl.c (omp_declare_variant_finalize_one): Call
36 declare_simd_adjust_this not just on the context, but also on the
37 variant-id expression for methods. Don't call
38 cp_get_callee_fndecl_nofold, call cp_get_callee and only if it is
39 safe cp_get_fndecl_from_callee. Don't try to print as %qD
41 * pt.c (tsubst_attribute): Handle "omp declare variant base"
43 (tsubst_function_decl): Call omp_declare_variant_finalize
44 if there are any "omp declare variant base" attributes left.
46 2019-11-04 Kamlesh Kumar <kamleshbhalui@gmail.com>
48 PR c++/91979 - mangling nullptr expression
49 * mangle.c (write_template_arg_literal): Handle nullptr
52 2019-11-04 Jason Merrill <jason@redhat.com>
54 * typeck.c (check_return_expr): Avoid redundant error.
56 2019-11-02 Paolo Carlini <paolo.carlini@oracle.com>
58 * typeck.c (composite_pointer_type): Add a const op_location_t&
59 parameter and use it in diagnostics.
60 (composite_pointer_error): Likewise.
61 (composite_pointer_type_r): Add a const op_location_t&
62 parameter and forward it.
63 (cp_build_binary_op): Adjust calls.
64 (common_pointer_type): Likewise.
65 * call.c (add_builtin_candidate): Likewise.
66 (build_conditional_expr_1): Likewise.
67 * cp-tree.h (composite_pointer_type): Update declaration.
69 * typeck.c (cxx_sizeof_expr): Use cp_expr_loc_or_input_loc
71 (cxx_alignof_expr): Likewise.
72 (lvalue_or_else): Likewise.
74 2019-11-02 Jakub Jelinek <jakub@redhat.com>
76 * decl.c (omp_declare_variant_finalize_one): Use
77 omp_get_context_selector instead of c_omp_get_context_selector.
80 * parser.c (cp_parser_decl_specifier_seq): Don't parse attributes
81 if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR.
83 PR c++/88335 - Implement P1073R3: Immediate functions
84 * cp-tree.h (struct lang_decl_fn): Add immediate_fn_p bit.
85 (DECL_IMMEDIATE_FUNCTION_P, SET_DECL_IMMEDIATE_FUNCTION_P): Define.
86 (enum cp_decl_spec): Add ds_consteval.
87 (fold_non_dependent_expr): Add another tree argument defaulted to
89 * name-lookup.h (struct cp_binding_level): Add immediate_fn_ctx_p
91 * parser.c (cp_keyword_starts_decl_specifier_p): Adjust comments
92 for C++11 and C++20 specifiers. Handle RID_CONSTEVAL.
93 (CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR): Adjust comment.
94 (CP_PARSER_FLAGS_CONSTEVAL): New.
95 (cp_parser_skip_balanced_tokens): New forward declaration.
96 (cp_parser_lambda_declarator_opt): Handle ds_consteval. Set
97 current_binding_level->immediate_fn_ctx_p before parsing parameter
98 list if decl-specifier-seq contains consteval specifier.
99 (cp_parser_decl_specifier_seq): Handle RID_CONSTEVAL.
100 (cp_parser_explicit_instantiation): Diagnose explicit instantiation
101 with consteval specifier.
102 (cp_parser_init_declarator): For consteval or into flags
103 CP_PARSER_FLAGS_CONSTEVAL.
104 (cp_parser_direct_declarator): If CP_PARSER_FLAGS_CONSTEVAL, set
105 current_binding_level->immediate_fn_ctx_p in the sk_function_parms
107 (set_and_check_decl_spec_loc): Add consteval entry, formatting fix.
108 * call.c (build_addr_func): For direct calls to immediate functions
109 use build_address rather than decay_conversion.
110 (build_over_call): Evaluate immediate function invocations.
111 * error.c (dump_function_decl): Handle DECL_IMMEDIATE_FUNCTION_P.
112 * semantics.c (expand_or_defer_fn_1): Use tentative linkage and don't
113 call mark_needed for immediate functions.
114 * typeck.c (cxx_sizeof_or_alignof_expr): Likewise. Formatting fix.
115 (cp_build_addr_expr_1): Reject taking address of immediate function
116 outside of immediate function.
117 * decl.c (validate_constexpr_redeclaration): Diagnose consteval
118 vs. non-consteval or vice versa redeclaration. Use
119 SET_DECL_IMMEDIATE_FUNCTION_P if new_decl is immediate function.
120 (check_tag_decl): Use %qs with keyword string to simplify translation.
122 (start_decl): Adjust diagnostics for static or thread_local variables
123 in immediate functions.
124 (grokfndecl): Call sorry_at on virtual consteval. Use %qs with keyword
125 to string to simplify translation. Diagnose consteval main. Use
126 SET_DECL_IMMEDIATE_FUNCTION_P for consteval.
127 (grokdeclarator): Handle consteval. Use %qs with keyword strings to
128 simplify translation. Use separate ifs instead of chained else if
129 for invalid specifiers. For constinit clear constinit_p rather than
131 * constexpr.c (find_immediate_fndecl): New function.
132 (cxx_eval_outermost_constant_expr): Allow consteval calls returning
133 void. Diagnose returning address of immediate function from consteval
135 (fold_non_dependent_expr_template): Add OBJECT argument, pass it
136 through to cxx_eval_outermost_constant_expr.
137 (fold_non_dependent_expr): Add OBJECT argument, pass it through to
138 fold_non_dependent_expr_template.
139 (fold_non_dependent_init): Adjust fold_non_dependent_expr_template
141 * method.c (defaulted_late_check): Adjust diagnostics for consteval.
142 * lambda.c (maybe_add_lambda_conv_op): Copy over
143 DECL_DECLARED_CONSTEXPR_P and DECL_IMMEDIATE_FUNCTION_P bits from
144 callop to both artificial functions.
145 * init.c (build_value_init): Don't do further processing if
146 build_special_member_call returned a TREE_CONSTANT. Formatting fix.
148 PR c++/91369 - Implement P0784R7: constexpr new
149 * cp-tree.h (CALL_FROM_NEW_OR_DELETE_P): Define.
150 * init.c (build_new_1, build_vec_delete_1, build_delete): Set
151 CALL_FROM_NEW_OR_DELETE_P on the CALL_EXPR to allocator functions.
152 * constexpr.c (is_std_allocator_allocate): Only allow
153 global replaceable allocator functions if CALL_FROM_NEW_OR_DELETE_P
154 or in std::allocate<T>::{,de}allocate.
155 (potential_constant_expression_1): Likewise.
157 2019-11-01 Nathan Sidwell <nathan@acm.org>
159 * class.c (check_field_decls): Refactor.
161 2019-10-31 Jakub Jelinek <jakub@redhat.com>
164 * cp-tree.h (type_initializer_zero_p): Declare.
165 * decl.c (reshape_init_array_1): Formatting fix.
166 * tree.c (type_initializer_zero_p): New function. Moved from
167 ../tree.c, use next_initializable_field, formatting fix. Return
168 false for TYPE_NON_AGGREGATE_CLASS types.
170 2019-10-30 Jason Merrill <jason@redhat.com>
172 PR c++/92268 - hard error satisfying return-type-requirement
173 * constraint.cc (type_deducible_p): Check for substitution failure.
174 (diagnose_compound_requirement): Adjust diagnostic.
175 * pt.c (do_auto_deduction): Don't pass cargs to
176 constraints_satisfied_p.
178 2019-10-30 Jakub Jelinek <jakub@redhat.com>
180 PR c++/91369 - Implement P0784R7: constexpr new
181 * constexpr.c (cxx_replaceable_global_alloc_fn): Don't return true
183 (cxx_placement_new_fn, is_std_construct_at): New functions.
184 (cxx_eval_call_expression): Allow placement new in std::construct_at.
185 (potential_constant_expression_1): Likewise.
187 * typeck.c (decl_in_std_namespace_p): Return true also for decls
188 in inline namespaces inside of std namespace.
190 2019-10-30 Bernd Edlinger <bernd.edlinger@hotmail.de>
193 * name-lookup.c (check_local_shadow): Shadowing TYPE_DECLs
194 is always a -Wshadow=compatible-local warning, unless
197 2019-10-30 Jason Merrill <jason@redhat.com>
199 * cxx-pretty-print.c (get_fold_operator): Use OVL_OP_INFO.
201 2019-10-30 Marek Polacek <polacek@redhat.com>
203 PR c++/92134 - constinit malfunction in static data member.
204 * decl2.c (grokfield): Set LOOKUP_CONSTINIT.
206 2019-10-30 Jakub Jelinek <jakub@redhat.com>
208 * cp-tree.h (omp_declare_variant_finalize, build_local_temp): Declare.
209 * decl.c: Include omp-general.h.
210 (declare_simd_adjust_this): Add forward declaration.
211 (omp_declare_variant_finalize_one, omp_declare_variant_finalize): New
213 (cp_finish_decl, finish_function): Call omp_declare_variant_finalize.
214 * parser.c (cp_finish_omp_declare_variant): Adjust parsing of the
215 variant id-expression and propagate enough information to
216 omp_declare_variant_finalize_one in the attribute so that it can
218 * class.c (finish_struct): Call omp_declare_variant_finalize.
219 * tree.c (build_local_temp): No longer static, remove forward
222 2019-10-30 Paolo Carlini <paolo.carlini@oracle.com>
224 * typeck.c (cp_build_modify_expr): Prefer error + inform to
225 error + error in one place.
226 (get_delta_difference_1): Likewise.
227 (get_delta_difference): Likewise, in two places.
229 2019-10-29 Paolo Carlini <paolo.carlini@oracle.com>
231 * typeck.c (build_x_unary_op): Use the location_t argument in
234 2019-10-29 Marek Polacek <polacek@redhat.com>
236 PR c++/90998 - ICE with copy elision in init by ctor and -Wconversion.
237 * call.c (joust): Don't attempt to warn if ->second_conv is null.
239 2019-10-29 Jakub Jelinek <jakub@redhat.com>
242 * cp-gimplify.c (cp_gimplify_expr): If gimplify_to_rvalue changes the
243 function pointer type, re-add cast to the original one.
245 2019-10-29 Marek Polacek <polacek@redhat.com>
247 PR c++/91548 - fix detecting modifying const objects for ARRAY_REF.
248 * constexpr.c (cxx_eval_store_expression): Don't call
249 modifying_const_object_p for ARRAY_REF.
251 2019-10-29 Richard Sandiford <richard.sandiford@arm.com>
253 * cp-objcp-common.h (cxx_simulate_enum_decl): Declare.
254 (LANG_HOOKS_SIMULATE_ENUM_DECL): Define to the above.
255 * decl.c (cxx_simulate_enum_decl): New function.
257 2019-10-29 Richard Sandiford <richard.sandiford@arm.com>
259 * cp-tree.h (cxx_simulate_builtin_function_decl): Declare.
260 * decl.c (cxx_simulate_builtin_function_decl): New function.
261 * cp-objcp-common.h (LANG_HOOKS_SIMULATE_BUILTIN_FUNCTION_DECL):
264 2019-10-28 Martin Sebor <msebor@redhat.com>
267 * cp-objcp-common.c (names_builtin_p): Define new function.
269 2019-10-28 Nathan Sidwell <nathan@acm.org>
271 * parser.h (struct cp_token): Drop {ENUM,BOOL}_BITFIELD C-ism.
272 Add tree_check_p flag, use as nested union discriminator.
273 (struct cp_lexer): Add saved_type & saved_keyword fields.
274 * parser.c (eof_token): Delete.
275 (cp_lexer_new_main): Always init last_token to last token of
277 (cp_lexer_new_from_tokens): Overlay EOF token at end of range.
278 (cp_lexer_destroy): Restore token under the EOF.
279 (cp_lexer_previous_token_position): No check for eof_token here.
280 (cp_lexer_get_preprocessor_token): Clear tree_check_p.
281 (cp_lexer_peek_nth_token): Check CPP_EOF not eof_token.
282 (cp_lexer_consume_token): Assert not CPP_EOF, no check for
284 (cp_lexer_purge_token): Likewise.
285 (cp_lexer_purge_tokens_after): No check for EOF token.
286 (cp_parser_nested_name_specifier, cp_parser_decltype)
287 (cp_parser_template_id): Set tree_check_p.
289 2019-10-24 Jakub Jelinek <jakub@redhat.com>
291 * decl2.c (cplus_decl_attributes): Add "omp declare target block"
292 attribute in between declare target and end declare target
295 * call.c (convert_arg_to_ellipsis): Add missing space in string
298 2019-10-24 Marek Polacek <polacek@redhat.com>
300 * decl.c (reshape_init_r): Add missing space.
302 2019-10-24 Nathan Sidwell <nathan@acm.org>
304 * pt.c (reduce_template_parm_level): Attach the new TPI to the new
306 (convert_generic_types_to_packs): Pass the copied type to
307 reduce_templatE_parm_level.
309 2019-10-23 Nathan Sidwell <nathan@acm.org>
311 * cp-tree.c (CPTI_STD_IDENTIFIER): Delete.
312 (std_identifier): Delete.
313 (DECL_NAME_SPACE_STD_P): Compare against std_node.
314 * decl.c (initialize_predefined_identifiers): 'std' is not needed.
315 (cxx_init_decl_processing): Adjust creation of ::std. Use
316 {push,pop}_nested_namespace.
317 (cxx_builtin_function): Use {push,pop}_nested_namespace.
318 * except.c (init_exception_processing): Likewise.
319 * rtti.c (init_rtti_processing): Likewise.
321 2019-10-23 Jason Merrill <jason@redhat.com>
323 Implement P1286R2, Contra CWG1778
324 * method.c (defaulted_late_check): Don't check explicit
325 exception-specification on defaulted function.
326 (after_nsdmi_defaulted_late_checks): Remove.
327 * parser.h (struct cp_unparsed_functions_entry): Remove classes.
328 * parser.c (unparsed_classes): Remove.
329 (push_unparsed_function_queues, cp_parser_class_specifier_1):
332 2019-10-23 Jakub Jelinek <jakub@redhat.com>
334 * constexpr.c (cxx_eval_constant_expression) <case CLEANUP_STMT>:
335 Temporarily change input_location to CLEANUP_STMT location.
337 2019-10-22 Jakub Jelinek <jakub@redhat.com>
339 PR tree-optimization/85887
340 * decl.c (expand_static_init): Drop ECF_LEAF from __cxa_guard_acquire
341 and __cxa_guard_release.
343 2019-10-22 Marc Glisse <marc.glisse@inria.fr>
346 * constexpr.c (cxx_eval_builtin_function_call): Only set
347 force_folding_builtin_constant_p if manifestly_const_eval.
349 2019-10-22 Richard Sandiford <richard.sandiford@arm.com>
351 * cp-tree.h (STF_USER_VISIBLE): New constant.
352 (strip_typedefs, strip_typedefs_expr): Take a flags argument.
353 * tree.c (strip_typedefs, strip_typedefs_expr): Likewise,
354 updating mutual calls accordingly. When STF_USER_VISIBLE is true,
355 only look through typedefs if user_facing_original_type_p.
356 * error.c (dump_template_bindings, type_to_string): Pass
357 STF_USER_VISIBLE to strip_typedefs.
358 (dump_type): Likewise, unless pp_c_flag_gnu_v3 is set.
360 2019-10-21 Kamlesh Kumar <kamleshbhalui@gmail.com>
361 Jason Merrill <jason@redhat.com>
363 PR c++/83534 - typeinfo of noexcept function
364 * rtti.c (get_tinfo_decl_dynamic): Do not call
365 TYPE_MAIN_VARIANT for function.
366 (get_typeid): Likewise.
368 2019-10-21 Paolo Carlini <paolo.carlini@oracle.com>
370 * parser.c (cp_parser_class_head): Improve error recovery upon
371 extra qualification error.
373 2019-10-21 Jakub Jelinek <jakub@redhat.com>
376 * constexpr.c (cxx_eval_component_reference, cxx_eval_bit_field_ref):
377 Use STRIP_ANY_LOCATION_WRAPPER on CONSTRUCTOR elts.
379 2019-10-21 Marek Polacek <polacek@redhat.com>
381 PR c++/92062 - ODR-use ignored for static member of class template.
382 * pt.c (has_value_dependent_address): Strip location wrappers.
384 2019-10-21 Marek Polacek <polacek@redhat.com>
386 PR c++/92106 - ICE with structured bindings and -Wreturn-local-addr.
387 * typeck.c (maybe_warn_about_returning_address_of_local): Avoid
388 recursing on null initializer and return false instead.
390 2019-10-17 JeanHeyd Meneide <phdofthehouse@gmail.com>
392 Implement p1301 [[nodiscard("should have a reason")]] + p1771 DR
393 * tree.c (handle_nodiscard_attribute): Handle C++2a nodiscard
395 (std_attribute_table) Increase nodiscard argument handling
396 max_length from 0 to 1.
397 * parser.c (cp_parser_check_std_attribute): Add requirement
398 that nodiscard only be seen once in attribute-list.
399 (cp_parser_std_attribute): Check that empty parenthesis lists are
400 not specified for attributes that have max_length > 0 (e.g.
402 * cvt.c (maybe_warn_nodiscard): Add nodiscard message to
403 output, if applicable.
404 (convert_to_void): Allow constructors to be nodiscard-able (P1771).
406 2019-10-18 Nathan Sidwell <nathan@acm.org>
408 * cp-tree.h (struct lang_type): Remove was_anonymous.
409 (TYPE_WAS_UNNAMED): Implement by checking TYPE_DECL &
411 * decl.c (name_unnamed_type): Don't set TYPE_WAS_UNNAMED.
413 2019-10-17 Paolo Carlini <paolo.carlini@oracle.com>
415 * decl.c (grokfndecl): Remove redundant use of in_system_header_at.
416 (compute_array_index_type_loc): Likewise.
417 (grokdeclarator): Likewise.
418 * error.c (cp_printer): Likewise.
419 * lambda.c (add_default_capture): Likewise.
420 * parser.c (cp_parser_primary_expression): Likewise.
421 (cp_parser_selection_statement): Likewise.
422 (cp_parser_toplevel_declaration): Likewise.
423 (cp_parser_enumerator_list): Likewise.
424 (cp_parser_using_declaration): Likewise.
425 (cp_parser_member_declaration): Likewise.
426 (cp_parser_exception_specification_opt): Likewise.
427 (cp_parser_std_attribute_spec): Likewise.
428 * pt.c (do_decl_instantiation): Likewise.
429 (do_type_instantiation): Likewise.
430 * typeck.c (cp_build_unary_op): Likewise.
432 * decl.c (check_tag_decl): Pass to in_system_header_at the same
433 location used for the permerror.
434 (grokdeclarator): Likewise.
436 * decl.c (check_tag_decl): Use locations[ds_typedef] in error_at.
438 2019-10-17 Jason Merrill <jason@redhat.com>
440 * cp-gimplify.c (cp_gimplify_expr): Use get_initialized_tmp_var.
441 (gimplify_to_rvalue): Remove default NULL argument.
443 2019-10-17 Nathan Sidwell <nathan@acm.org>
445 * decl.c (builtin_function_1): Merge into ...
446 (cxx_builtin_function): ... here. Nadger the decl before maybe
447 copying it. Set the context.
448 (cxx_builtin_function_ext_scope): Push to top level, then call
449 cxx_builtin_function.
451 2019-10-16 Luis Machado <luis.machado@linaro.org>
453 * cp-gimplify.c: Fix reference to non-existing tree-gimple.c file.
455 2019-10-16 Jakub Jelinek <jakub@redhat.com>
457 * decl.c (cxx_maybe_build_cleanup): When clearing location of cleanup,
458 if cleanup is a nop, clear location of its operand too.
460 2019-10-15 Andrew Sutton <asutton@lock3software.com>
462 Finish moving constraint and logic functionality of out pt.c.
463 Reimplement and re-enable subsumption caching.
465 * config-lang.in (gtfiles): Add logic.cc.
466 * constraint.cc (atomic_constraints_identical_p): Add assertions.
467 (hash_atomic_constraint): Likewise.
468 (constraints_equivalent_p): New.
469 (inchash::add_constraint): New.
470 (iterative_hash_constraint): New.
471 (decl_constraints): Moved from pt.c.
472 (get_constraints): Likewise.
473 (set_constraints): Likewise.
474 (remove_constraints): Likewise.
475 * cp-tree.h (CONSTR_P): New.
476 (init_constraint_processing): Remove.
477 (constraints_equivalent_p, iterative_hash_constraint): Declare.
478 * decl.c (cxx_init_decl_processing): Don't initialize constraints.
479 * logic.cc (subsumption_entry): Moved from pt.c.
480 (subsumption_hasher): Likewise.
481 (subsumption_cache): Likewise.
482 (lookup_subsumption): Likewise.
483 (save_subsumption): Likewise.
484 (subsumes_constraints_nonnull): Use subsumption cache.
485 * pt.c: Move aforementioned declarations out of this file.
486 (init_constraint_processing): Remove.
488 2019-10-15 Andrew Sutton <asutton@lock3software.com>
490 * parser.c (cp_parser_constructor_declarator_p): Pass an empty
491 decl-specifier-seq to make sure we parse type constraints as part
494 2019-10-15 Nathan Sidwell <nathan@acm.org>
496 * class.c (build_clones): Break out of clone_function_decl. Just
498 (clone_function_decl): Call build_clones, then maybe add them to
501 * class.c (build_clone): Refactor to clarify recursiveness.
503 2019-10-14 Jason Merrill <jason@redhat.com>
505 PR c++/91930 - ICE with constrained inherited default ctor.
506 * name-lookup.c (do_class_using_decl): Set TYPE_HAS_USER_CONSTRUCTOR
507 for inherited constructor.
509 2019-10-14 Paolo Carlini <paolo.carlini@oracle.com>
511 * decl.c (check_tag_decl): Use DECL_SOURCE_LOCATION.
513 2019-10-14 Jakub Jelinek <jakub@redhat.com>
516 * semantics.c (handle_omp_array_sections_1): Temporarily disable
517 -fstrong-eval-order also for in_reduction and task_reduction clauses.
519 * parser.c (cp_parser_omp_all_clauses): Change bool NESTED_P argument
520 into int NESTED, if it is 2, diagnose missing commas in between
522 (cp_parser_omp_context_selector): Pass 2 as last argument to
523 cp_parser_omp_all_clauses.
525 2019-10-12 Jakub Jelinek <jakub@redhat.com>
527 * parser.c (cp_parser_omp_context_selector): Improve error recovery.
528 For simd properties, put them directly into TREE_VALUE.
529 (cp_finish_omp_declare_variant): Add "omp declare variant base"
530 attribute rather than "omp declare variant".
532 2019-10-11 Marek Polacek <polacek@redhat.com>
534 PR c++/92049 - extra error with -fchecking=2.
535 * pt.c (build_non_dependent_expr): Call fold_non_dependent_expr
538 2019-10-11 Paolo Carlini <paolo.carlini@oracle.com>
540 * typeck.c (cp_build_binary_op): Do not handle RROTATE_EXPR and
542 * constexpr.c (cxx_eval_constant_expression): Likewise.
543 (potential_constant_expression_1): Likewise.
544 * pt.c (tsubst_copy): Likewise.
546 2019-10-11 Jason Merrill <jason@redhat.com>
548 * decl2.c (mark_used): Don't clobber DECL_SOURCE_LOCATION on
549 explicitly defaulted functions.
550 * method.c (synthesize_method): Likewise.
552 2019-10-11 Jakub Jelinek <jakub@redhat.com>
555 * decl2.c (grok_array_decl): For -fstrong-eval-order, when array ref
556 operands have been swapped and at least one operand has side-effects,
557 revert the swapping before calling build_array_ref.
558 * typeck.c (cp_build_array_ref): For non-ARRAY_TYPE array ref with
559 side-effects on the index operand, if -fstrong-eval-order use
560 save_expr around the array operand.
561 (cp_build_binary_op): For shifts with side-effects in the second
562 operand, wrap first operand into SAVE_EXPR and evaluate it before
564 * semantics.c (handle_omp_array_sections_1): Temporarily disable
565 flag_strong_eval_order during OMP_CLAUSE_REDUCTION array section
567 * cp-gimplify.c (gimplify_to_rvalue): New function.
568 (cp_gimplify_expr): Use it.
570 2019-10-10 Marek Polacek <polacek@redhat.com>
572 * typeck.c (comp_ptr_ttypes_real): Change the return type to bool.
573 Use false instead of 0.
575 2019-10-10 Jakub Jelinek <jakub@redhat.com>
577 * parser.h (struct cp_omp_declare_simd_data): Add variant_p member.
578 * parser.c (cp_ensure_no_omp_declare_simd): Handle both declare simd
580 (cp_parser_oacc_all_clauses): Formatting fix.
581 (cp_parser_omp_all_clauses): Add NESTED_P argument, if true, terminate
582 processing on closing paren and don't skip to end of pragma line.
583 (cp_parser_omp_declare_simd): Add VARIANT_P argument. Handle also
585 (omp_construct_selectors, omp_device_selectors,
586 omp_implementation_selectors, omp_user_selectors): New variables.
587 (cp_parser_omp_context_selector,
588 cp_parser_omp_context_selector_specification,
589 cp_finish_omp_declare_variant): New functions.
590 (cp_parser_late_parsing_omp_declare_simd): Handle also declare variant.
591 (cp_parser_omp_declare): Handle declare variant.
593 2019-10-09 Jason Merrill <jason@redhat.com>
595 * cp-tree.h (template_info_decl_check): Check ENABLE_TREE_CHECKING.
597 2019-10-09 Marek Polacek <polacek@redhat.com>
599 PR c++/91364 - P0388R4: Permit conversions to arrays of unknown bound.
600 PR c++/69531 - DR 1307: Differently bounded array parameters.
601 PR c++/88128 - DR 330: Qual convs and pointers to arrays of pointers.
602 * call.c (build_array_conv): Build ck_identity at the beginning
604 (standard_conversion): Pass bounds_none to comp_ptr_ttypes_const.
605 (maybe_warn_array_conv): New.
606 (convert_like_real): Call it. Add an error message about converting
607 from arrays of unknown bounds.
608 (conv_get_original_expr): New.
609 (nelts_initialized_by_list_init): New.
610 (conv_binds_to_array_of_unknown_bound): New.
611 (compare_ics): Implement list-initialization ranking based on
612 array sizes, as specified in DR 1307 and P0388R.
613 * cp-tree.h (comp_ptr_ttypes_const): Adjust declaration.
614 (compare_bounds_t): New enum.
615 * typeck.c (comp_array_types): New bool and compare_bounds_t
616 parameters. Use them.
617 (structural_comptypes): Adjust the call to comp_array_types.
618 (similar_type_p): Handle ARRAY_TYPE.
619 (build_const_cast_1): Pass bounds_none to comp_ptr_ttypes_const.
620 (comp_ptr_ttypes_real): Don't check cv-quals of ARRAY_TYPEs. Use
621 comp_array_types to compare array types. Look through arrays as per
623 (comp_ptr_ttypes_const): Use comp_array_types to compare array types.
624 Look through arrays as per DR 330.
626 2019-10-09 Marek Polacek <polacek@redhat.com>
628 PR c++/92032 - DR 1601: Promotion of enum with fixed underlying type.
629 * call.c (standard_conversion): When converting an enumeration with
630 a fixed underlying type to the underlying type, give it the cr_promotion
632 (compare_ics): Implement a tiebreaker as per CWG 1601.
634 2019-10-08 Andrew Sutton <asutton@lock3software.com>
635 Jason Merrill <jason@redhat.com>
637 Update the concepts implementation to conform to the C++20
638 specification, improve compile times, and generally clean up
640 * call.c (build_new_function_call): Don't evaluate concepts here.
641 (constraint_failure): Don't record the template.
642 (print_z_candidate): Don't extract the template.
643 * class.c (add_method): When overloading, hide ineligible special
645 (check_methods): Set TYPE_HAS_COMPLEX_* here.
646 * constexpr.c (cxx_eval_constant_expression): Evaluate concepts.
647 (maybe_initialize_fundef_copies_table): Remove.
648 (get_fundef_copy): Use hash_map_safe_get_or_insert.
649 (clear_cv_and_fold_caches): Clear the satisfaction cache.
650 * constraint.cc (known_non_bool_p): New.
651 (parsing_constraint_expression_sentinel): Renamed from
652 expanding_constraint_sentinel.
653 (check_constraint_operands): New.
654 (check_constraint_atom): New.
655 (finish_constraint_binary_op): New.
656 (finish_constraint_or_expr): Likewise.
657 (finish_constraint_and_expr): Likewise.
658 (finish_constraint_primary_expr): Likewise.
659 (combine_constraint_expressions): New.
660 (finish_requires_expr): Add location parm.
661 (get_concept_definition): Return the initializer of concept definitions.
662 (get_template_head_requirements): New.
663 (get_trailing_function_requirements): New.
664 (deduce_constrained_parameter): Check if the identifier or template-id
665 is a concept definition.
666 (resolve_concept_definition_check): Removed.
667 (resolve_variable_concept_check): Removed.
668 (resolve_concept_check): New.
669 (resolve_constraint_check): Handle concept definitions.
670 converting arguments.
671 (function_concept_check_p): Removed.
672 (variable_concept_check_p): Removed.
673 (unpack_concept_check): New.
674 (get_concept_check_template): New.
675 (build_call_check): Moved and renamed to build_function_check.
676 (build_concept_check_arguments): make static.
677 (build_function_check): Always do overload resolution
678 in order to force conversion of template arguments (i.e., actually
679 check that the use of a concept is valid).
680 (build_standard_check): Renamed from build_real_concept_check.
681 (build_real_concept_check): Build checks for C++2a concepts by
682 (build_wildcard_concept_check): New.
683 (build_concept_check): Use build_real_concept_check. New overload.
684 (build_constraints): Save expressions, not normalized constraints.
685 (build_concept_id): New. Pass tf_warning_or_error.
686 (build_type_constraint): New.
687 (finish_type_constraints): New.
688 (associate_classtype_constraints): Also add constraints to union
689 types. Note the original declaration in errors. Don't return
690 error_mark_node in order to avoid an assertion later.
691 (push_down_pack_expansion): Remove.
692 (finish_shorthand_constraint): Make fold expressions, not naked
693 parameter packs. Always apply the constraint to each template argument.
694 (check_introduction_list): New. Fail if not enough
695 names are introduced.
696 (finish_template_introduction): Don't normalize constraints. Pass
697 tsubst flags. Check for insufficient introductions.
698 (placeholder_extract_concept_and_args): Handle the template-id case.
699 Unpack function concept checks correctly.
700 (tsubst_simple_requirement): Return errors if they occur. Don't
701 process as a template.
702 (tsubst_type_requirement): Likewise.
703 (type_deducible_p): New. Wrap the input expression in parens for the
704 purpose of deduction.
705 (expression_convertible_t): New.
706 (tsubst_compound_requirement): Use new deduction, conversion predicates.
707 (tsubst_nested_requirement): Return errors if they occur. Don't
708 process as a template. Instantiate and evaluate the nested requirement.
709 (tsubst_valid_expression_requirement): New.
710 (tsubst_simple_requirement): Use tsubst_valid_expression_requirement.
711 (tsubst_compound_requirement): Use tsubst_valid_expression_requirement.
712 (check_constaint_variables): New.
713 (tsubst_constraint_variables): Check that type substitutions are valid.
714 (tsubst_requires_expr): Likewise. Produce new requires-exprs during
715 template substitution. Copy the previous local specialization stack,
716 so references to non-local parameters can be found. Use cp_unevaluated.
717 (tsubst_constraint): New. Don't evaluate concept checks.
719 (norm_info): New. Used to build a normalization tree for concept check
721 (debug_parameter_mapping): New.
722 (debug_argument_list): New.
723 (expand_concept): Removed.
724 (normalize_logical_operation): Pass subst_info through call.
725 (normalize_pack_expansion): Remove.
726 (normalize_simple_requirement): Removed
727 (normalize_type_requirement): Removed
728 (normalize_compound_requirement): Removed
729 (normalize_nested_requirement): Removed
730 (normalize_requirement): Removed
731 (normalize_requirements): Removed
732 (normalize_requires_expression): Removed
733 (normalize_variable_concept_check): Removed.
734 (normalize_function_concept_check): Removed.
735 (normalize_concept_check): Merged all normalize_*_check here.
736 Substitute through written template arguments before normalizing the
737 definition. Only substitute the innermost template arguments.
738 (check_for_logical_overloads): Delete.
739 (map_arguments): New. Associate template parameters with arguments.
740 (build_parameter_mapping): New. Extract used parameters.
741 (normalize_expression): Rewrite.
742 (normalize_conjunction): Removed
743 (normalize_disjunction): Removed
744 (normalize_predicate_constraint): Removed
745 (normalize_parameterized_constraint): Removed
746 (normalized_map): New variable.
747 (get_normalized_constraints): New entry point for normalization.
749 (get_normalized_constraints_from_info): New.
750 (get_normalized_constraints_from_decl): New. Turn on template processing
751 prior to normalization. Handle inheriting ctors. Build the
752 normalization arguments from the full set of template parameters of the
753 most general template. This guarantees that we have no concrete arguments
754 in the parameter mapping (e.g., from template members of class
755 templates). Cache normalizations.
756 (normalize_concept_definition): New. Cache normalizations.
757 (normalize_template_requirements): New.
758 (normalize_nontemplate_requirements): New.
759 (normalize_constraint_expression): New.
760 (tsubst_parameter_mapping): New.
761 (get_mapped_args): New.
762 (parameter_mapping_equivalent_p): New. Use template_args_equal.
763 (atomic_constraints_identical_p): New.
764 (hash_atomic_constraint): New.
765 (satisfying_constraint_p): New. Guard against recursive evaluation of
766 constraints during satisfaction.
767 (satisfy_conjunction): New.
768 (satisfy_disjunction): New.
769 (sat_entry): New class for hashing satisfaction results.
770 (sat_hasher): New hash traits.
772 (get_satisfaction): New. Returns cached satisfaction result.
773 (save_satisfaction): New. Caches a satisfaction result.
774 (clear_satisfaction_cache): New.
775 (satisfaction_cache): New. Helps manage satisfaction cache requests.
776 (decl_satisfied_cache): New.
778 (satisfy_constraint_r): New.
779 (satisfy_constraint): Use new satisfaction algorithm.
780 (evaluate_concept_check): New.
781 (evaluate_concept): Removed.
782 (evaluate_function_concept): Removed.
783 (evaluate_variable_concept): Removed.
784 (satisfy_constraint_expression): New.
785 (constraint_expression_satisfied_p): New.
786 (constraints_satisfied_p): Use strip_inheriting_ctors. Use
787 push_/pop_access_scope.
788 (more_constrained): Normalize before calling out to subsumption. Allow
789 classes as arguments.
790 (strictly_subsumes): Allow non-templates as arguments. Accept a new
792 (weakly_subsumes): New.
793 (at_least_as_constrained): Removed.
794 (diagnose_other_expression): Removed.
795 (diagnose_predicate_constraint): Removed.
796 (diagnose_pack_expansion): Removed.
797 (diagnose_check_constraint): Removed.
798 (diagnose_logical_constraint): Removed.
799 (diagnose_expression_constraint): Removed.
800 (diagnose_type_constraint): Removed.
801 (diagnose_implicit_conversion_constraint): Removed.
802 (diagnose_argument_deduction_constraint): Removed.
803 (diagnose_exception_constraint): Removed.
804 (diagnose_parameterized_constraint): Removed.
805 (diagnose_argument_deduction_constraint): Removed.
806 (diagnose_argument_deduction_constraint): Removed.
807 (diagnose_argument_deduction_constraint): Removed.
808 (diagnose_trait_expr): New.
809 (diagnose_requires_expr): New.
810 (diagnose_atomic_constraint): New.
811 (diagnose_valid_expression) Stop wrongly diagnosing valid expressions.
812 Don't substitute as if in template decls. This causes substitution
813 to generate expressions that aren't suitable for use with the noexcept
815 (diagnose_valid_type) Likewise.
816 (diagnose_compound_requirement) Actually emit diagnostics for
817 the causes of errors.Call force_paren_expr_uneval.
818 (diagnose_declaration_constraints): Turn on template processing to
819 suppress certain analyses.
820 * cp-objcp-common.c (cp_common_init_ts): Make concepts typed.
821 (cp_get_debug_type): Use hash_map_safe_*.
822 * cp-tree.h: New function declarations for semantic actions, other
823 facilities. Remove declaration no longer used or needed. Remove
824 unused _CONSTR macros.
825 (LANG_DECL_HAS_MIN): Add CONCEPT_DECL.
826 (template_info_decl_check): Factor macro check into an inline function.
827 (DECL_TEMPLATE_INFO): Use new check facility.
828 (finish_concept_definition): New. Don't invalid concept declarations
829 with invalid initializers.
830 (find_template_parameters): New.
831 (concept_definition_p): New.
832 (concept_check_p): New.
833 (variable_concept_check_p): New.
834 (force_paren_expr_uneval): New.
835 (ovl_iterator::using_p): A USING_DECL by itself was also
836 introduced by a using-declaration.
837 (struct tree_template_info): Use tree_base instead of
838 tree_common. Add tmpl and args fields.
839 (TI_TEMPLATE, TI_ARGS): Adjust.
840 (DECLTYPE_FOR_INIT_CAPTURE): Remove.
841 (CONSTR_CHECK, CONSTR_INFO, CONSTR_EXPR, CONSTR_CONTEXT): New.
842 (ATOMIC_CONSTR_MAP, TRAIT_EXPR_LOCATION): New.
843 (struct tree_trait_expr): Add locus field.
844 (enum tsubst_flags): Add tf_norm as a hint to generate normalization
845 context when diagnosing constraint failure.
846 * cp-tree.def: Remove unused _CONSTR nodes and rename PRED_CONSTR
849 * cxx-pretty-print.c: Remove constraint printing code.
850 (pp_cxx_concept_definition): New.
851 (pp_cxx_template_declaration): Print concept definitions.
852 (pp_cxx_check_constraint): Update printing for concept definitions.
853 (pp_cxx_nested_name_specifier): Fix a weird
854 case where we're printing '::::' for concepts.
855 (simple_type_specifier): Print requirements for placeholder types.
856 (pp_cxx_constrained_type_spec): Print the associated requirements of
858 (pp_cxx_compound_requirement): Add space before the '->'.
859 (pp_cxx_parameter_mapping): Print the parameter mapping.
860 (pp_cxx_atomic_constraint): Use the function above.
861 * decl.c (redeclaration_error_message): New error for concepts.
862 (grokdeclarator): Check for and disallow decltype(auto) in parameter
864 (grokfndecl): Don't normalize constraints. Add check for constraints
866 (grokvardecl): Don't normalize constraints.
867 (grok_special_member_properties): Don't set TYPE_HAS_COMPLEX_*.
868 (function_requirements_equivalent_p): New. Compare trailing
869 requires clauses. Compare combined constraints in pre-C++20 mode.
870 (decls_match): Compare trailing requires clauses. Compare template
871 heads for function templates. Remove old constraint comparison.
872 Simplify comparison of functions, function templates.
873 (duplicate_function_template_decls): New. Refactor a nasty if
874 condition into a single predicate.
875 (require_deduced_type): Don't complain if we already complained about
877 (finish_function): Perform auto deduction to ensure that constraints
878 are checked even when functions contain no return statements. Only do
879 auto deduction if we haven't previously seen any return statements.
880 This prevents multiple diagnostics of the same error.
881 (store_decomp_type): Remove.
882 (cp_finish_decomp): Use hash_map_safe_put.
883 * error.c: Remove constraint printing code.
884 (dump_decl): Dump concept definitions. Handle wildcard declarations.
885 (dump_template_decl): Likewise.
886 (dump_type): Print associated requirements for placeholder
888 (rebuild_concept_check): New.
889 (maybe_print_single_constraint_context): New.
890 (maybe_print_constraint_context): Recursively print nested contexts.
891 * init.c (get_nsdmi): Use hash_map_safe_*.
892 * lambda.c (maybe_add_lambda_conv_op): Bail if deduction failed.
893 (add_capture): Copy parameter packs from init.
894 (lambda_capture_field_type): Always use auto for init-capture.
895 * logic.cc: Completely rewrite.
896 (constraint_hash): New.
897 (clause/ctor): Save atoms in the hash table.
898 (replace): Save atoms during replacement.
899 (insert): Save atoms during insertion.
900 (contains): Only search the hash table for containment.
901 (clause): Keep a hash of atomic constraints.
902 (clause::clause): Explicitly copy the hash table when copying.
903 (disjunction_p, conjunction_p, atomic_p, dnf_size, cnf_size): New.
904 (diagnose_constraint_size): New.
905 (subsumes_constraints_nonnull): Compare the sizes of normalized formula
906 to determine the cheapest decomposition.
907 * name-lookup.c (diagnose_name_conflict): Diagnose name issues with
909 (matching_fn_p): Check constraints.
910 (push_class_level_binding_1): Move overloaded functions case down,
911 accept FUNCTION_DECL as target_decl.
912 * parser.c (enum required_token): New required token for auto.
913 (make_location): Add overload taking lexer as last parm.
914 (cp_parser_required_error): Diagnose missing auto.
915 (cp_parser_diagnose_ungrouped_constraint_plain): New.
916 (cp_parser_diagnose_ungrouped_constraint_plain): New.
917 (cp_parser_constraint_primary_expression): New. Tentatively parse the
918 primary expression. If that fails tentatively parse a lower
919 precedence expression in order to diagnose the error.
920 (cp_parser_check_non_logical_constraint): New. Performs a trial
921 parse of the right-hand-side of non-logical operators in order to
922 generate good diagnostics.
923 (cp_parser_constraint_logical_and_expression): New.
924 (cp_parser_constraint_logical_or_expression): New.
925 (cp_parser_requires_clause_expression): New.
926 (cp_parser_requires_clause): Renamed to cp_parser_constraint_expression.
927 (cp_parser_requires_clause_opt): Parse the requires-clause differently
928 in -fconcepts and -std=c++2a modes.
929 (cp_parser_requirement_list): Rename to cp_parser_requirement_seq.
930 Rewrite so that semicolons are parsed
931 along with requirements, not the sequence.
932 (cp_parser_simple_requirement): Expect a semicolon at end.
933 (cp_parser_compound_requirement): Expect a semicolon at end. Only
934 allow trailing-return-type with -fconcepts-ts.
935 (cp_parser_nested_requirement): Expect a semicolon at end. Parse
936 constraint-expressions.
937 (cp_parser_concept_definition): New. Don't fail parsing the concept
938 definition if the initializer is ill-formed. Don't declare the concept
939 before parsing the initializer.
940 (cp_parser_constraint_expression): Declare earlier.
941 (cp_parser_type_requirement): Current scope is not valid.
942 (cp_parser_requires_expression): Commit to the tentative parse.
943 (cp_parser_decl_specifier_seq): Warn when concept appears to be used
945 (cp_parser_template_declaration_after_parameters): Parse concept
947 (cp_parser_template_id): Don't try to resolve a concept template-id yet.
948 (cp_parser_template_id_expr): Resolve it as a concept check.
949 (cp_parser_decl_specifier_seq): Warn on 'concept bool'.
950 (cp_parser_type_parameter): Combine expressions not
952 (cp_parser_explicit_template_declaration): Combine expressions not
954 (cp_parser_maybe_concept_name): Removed.
955 (cp_parser_simple_type_specifier): Handle an error condition of
956 a bad constrained type specifier. Expect auto or decltype after
957 a concept name. Also handle the case where we have a template-id
959 (cp_parser_template_introduction): Diagnose errors on invalid
960 introductions. Give up if it doesn't start with a concept name.
961 Pedwarn if not -fconcepts-ts.
962 (synthesize_implicit_template_parm): Don't do consistent binding.
963 Use a new flag for constrained parameters. Combine expressions,
964 not constraints. Fail if we get a placeholder in block scope.
965 Placeholders that do not constrain types are not allowed in parameter
966 declarations, so don't handle them.
967 (cp_parser_placeholder_type_specifier): New. Implement parsing of
968 placeholder type specifiers following a concept name or partial
969 concept check. Disallow decltype(auto) parameters.
970 (cp_parser_nested_name_specifier_opt): If the token is already
971 CPP_NESTED_NAME_SPECIFIER, leave it alone.
972 (cp_parser_id_expression, cp_parser_unqualified_id): Call
973 cp_parser_template_id_expr.
974 (cp_parser_placeholder_type_specifier): Add tentative parm. Don't
975 expect a WILDCARD_DECL.
976 (cp_parser_trait_expr): Pass trait_loc down.
977 (cp_parser_postfix_expression): Do set location of dependent member
979 * pt.c (finish_concept_definition): New.
980 (push_template_decl_real): Handle concept definitions.
981 (start_concept_definition): Let push_template_decl_real handle the
982 creation of the template.
983 (get_constraints): Return null if the table hasn't been initialized.
984 (tsubst_copy_and_build): Build template-id expressions for concept
986 [TRAIT_EXPR]: Pass trait_loc down.
987 (lookup_template_class_1): Add the template name to the constraint
989 (lookup_and_finish_template_variable): Build concept checks
990 with the correct arguments.
991 (tsubst_function_decl): Don't substitute through constraints.
992 Always associate constraints with functions.
993 (template_parm_level_and_index): Make non-static.
994 (for_each_template_parm_r): Handle requires expressions.
995 (keep_template_parm): New.
996 (find_template_parameters): New.
997 (more_specialized_fn): Change how winners and losers are chosen.
998 (make_constrained_auto): Don't normalize constraints.
999 (template_parameters_equivalent_p): New. Compare template
1000 parameters. Add a comparison for implicitly vs. explicitly declared
1002 (template_parameter_lists_equivalent_p): New. Compare template
1004 (template_requirements_equivalent_p): New.
1005 (template_heads_equivalent_p): New. Compare template heads.
1006 (template_parameter_constraints_equivalent_p): New.
1007 (is_compatible_template_arg): Use weakly_subsumes.
1008 (maybe_new_partial_specialization): Use new constraint comparison
1009 for finding specializations.
1010 (process_partial_specialization): Pass main template as argument.
1011 (more_specialized_partial_spec): Don't immediately return when
1013 (make_constrained_auto): Handle concept definitions.
1014 (do_auto_deduction): Update auto deduction for new concept model.
1015 Extract the function concept correctly; rename constr to check to
1016 reflect the kind of node.
1017 (tsubst): Adjust wildcard argument during substitution.
1018 [DECLTYPE_TYPE]: Remove init-capture handling.
1019 (tsubst_copy_and_build): Build concept checks, not template ids.
1020 Defer checks of function concepts. Handle concepts before variable
1021 templates. Handle calls to function concepts explicitly.
1022 (coerce_template_parms): Use concept_definition_p. Handle a deduction
1023 error where a potentially empty pack can be supplied after the last
1024 parameter of a concept.
1025 (finish_template_variable): Don't process concepts here.
1026 (instantiation_dependent_r): Use concept_check_p.
1027 (tsubst_template_args): Make non-static.
1028 (make_constrained_placeholder_type): New. Refactored from
1029 make_constrained_auto.
1030 (make_constrained_auto) Use make_constrained_placeholder_type.
1031 (make_constrained_decltype_auto) New.
1032 (tsubst_function_parms): New.
1033 (value_dependent_expression_p) [TEMPLATE_ID_EXPR]: Use
1034 concept_definition_p.
1035 (push_access_scope, pop_access_scope): No longer static.
1036 (tsubst_template_parm): Substitute TEMPLATE_PARM_CONSTRAINTS.
1037 (tsubst_friend_function): Use tsubst_constraint. Use generic_targs_for.
1038 (get_underlying_template) Use generic_targs_for.
1039 (uses_parameter_packs): Return tree.
1040 (gen_elem_of_pack_expansion_instantiation): Don't push
1041 local_specialization_stack.
1042 (prepend_one_capture): New.
1043 (tsubst_lambda_expr): Use prepend_one_capture. Don't touch
1044 local_specializations.
1045 (template_parms_level_to_args): No longer static.
1046 (add_outermost_template_args): Likewise.
1047 (find_template_parameter_info): New. Provide context for finding
1048 template parameters.
1049 (keep_template_parm): Don't keep parameters declared at depth levels
1050 greater than those of the template parameters of the source declaration.
1051 Don't propagate cv-qualified types. Return 0, so we find all template
1052 parameters, not the just first.
1053 (any_template_parm_r): New. Handle cases that are mishandled by
1054 for_each_template_parm_r.
1055 (generic_targs_for): Factor out of coerce_template_args_for_ttp.
1056 (tsubst_argument_pack): Factor out of tsubst_template_args.
1057 (constraint_sat_entry): Removed.
1058 (constraint_sat_hasher): Removed.
1059 (concept_spec_entry): Removed.
1060 (concept_spec_hasher): Removed.
1061 (constraint_memos): Removed.
1062 (concept_memos): Removed.
1063 (lookup_constraint_satisfaction): Removed.
1064 (memoize_constraint_satisfaction): Removed.
1065 (lookup_concept_satisfaction): Removed.
1066 (memoize_concept_satisfaction): Removed.
1067 (concept_expansions): Removed.
1068 (get_concept_expansion): Removed.
1069 (save_concept_expansion): Removed.
1070 (init_constraint_processing): Remove initialization of non-existing
1072 (find_template_requirement): New. Search for the sub-requirement
1073 within the associated constraints.
1074 (convert_generic_types_to_packs): Also transform the associated
1075 constraint and update the current template requirements.
1076 (store_defaulted_ttp, lookup_defaulted_ttp): Remove.
1077 (add_defaults_to_ttp): Use hash_map_safe_*.
1078 * semantics.c (finish_call_expr): Diagnose calls to concepts.
1079 Handle concept checks explicitly.
1080 (finish_id_expression): Evaluate variable concepts as part of
1081 id-expression processing. Don't treat variable concepts as variables,
1082 and don't process function concepts as plain id-expressions.
1083 (force_paren_expr): Add even_uneval parm.
1084 (finish_trait_expr): Add location parm.
1085 * tree.c (special_memfn_p): New.
1086 (cp_expr_location): Handle TRAIT_EXPR.
1087 * typeck.c (check_return_expr): Actually use the diagnostic kind
1088 when performing return-type deduction.
1089 * typeck2.c (build_functional_cast): Don't rely on the location of
1092 2019-10-09 Paolo Carlini <paolo.carlini@oracle.com>
1094 * decl.c (grok_ctor_properties): Use DECL_SOURCE_LOCATION.
1095 * typeck.c (cp_build_binary_op): Use the op_location_t argument
1096 in many error messages.
1098 2019-10-08 Martin Sebor <msebor@redhat.com>
1101 * call.c (maybe_warn_class_memaccess): Handle arrays.
1103 2019-10-07 Paolo Carlini <paolo.carlini@oracle.com>
1105 * call.c (resolve_args): Use cp_expr_loc_or_input_loc in one place.
1106 * decl.c (grokdeclarator): Use id_loc in one place.
1107 * decl2.c (build_anon_union_vars): Use DECL_SOURCE_LOCATION.
1108 * parser.c (cp_parser_delete_expression): Fix the location of the
1109 returned expression.
1110 (cp_parser_throw_expression): Likewise.
1111 * pt.c (determine_specialization): Use DECL_SOURCE_LOCATION.
1113 2019-10-05 Jakub Jelinek <jakub@redhat.com>
1115 PR c++/91369 - Implement P0784R7: constexpr new
1116 * cp-tree.h (enum cp_tree_index): Add CPTI_HEAP_UNINIT_IDENTIFIER,
1117 CPTI_HEAP_IDENTIFIER and CPTI_HEAP_DELETED_IDENTIFIER.
1118 (heap_uninit_identifier, heap_identifier, heap_deleted_identifier):
1120 (type_has_constexpr_destructor, build_new_constexpr_heap_type,
1121 cxx_constant_dtor): Declare.
1122 * class.c (type_maybe_constexpr_default_constructor): Make static.
1123 (type_maybe_constexpr_destructor, type_has_constexpr_destructor): New
1125 (finalize_literal_type_property): For c++2a, don't clear
1126 CLASSTYPE_LITERAL_P for types without trivial destructors unless they
1127 have non-constexpr destructors.
1128 (explain_non_literal_class): For c++2a, complain about non-constexpr
1129 destructors rather than about non-trivial destructors.
1130 * constexpr.c: Include stor-layout.h.
1131 (struct constexpr_global_ctx): New type.
1132 (struct constexpr_ctx): Add global field, remove values and
1133 constexpr_ops_count.
1134 (cxx_replaceable_global_alloc_fn): New inline function.
1135 (cxx_eval_call_expression): For c++2a allow calls to replaceable
1136 global allocation functions, for new return address of a heap uninit
1137 var, for delete record its deletion. Change ctx->values->{get,put} to
1138 ctx->global->values.{get,put}.
1139 (non_const_var_error): Add auto_diagnostic_group sentinel. Emit
1140 special diagnostics for heap variables.
1141 (cxx_eval_store_expression): Change ctx->values->{get,put} to
1142 ctx->global->values.{get,put}.
1143 (cxx_eval_loop_expr): Initialize jump_target if NULL. Change
1144 new_ctx.values->remove to ctx->global->values.remove.
1145 (cxx_eval_constant_expression): Change *ctx->constexpr_ops_count
1146 to ctx->global->constexpr_ops_count. Change ctx->values->{get,put} to
1147 ctx->global->values.{get,put}.
1148 <case NOP_EXPR>: Formatting fix. On cast of replaceable global
1149 allocation function to some pointer type, adjust the type of
1150 the heap variable and change name from heap_uninit_identifier
1152 (find_heap_var_refs): New function.
1153 (cxx_eval_outermost_constant_expr): Add constexpr_dtor argument,
1154 handle evaluation of constexpr dtors and add tracking of heap
1155 variables. Use tf_no_cleanup for get_target_expr_with_sfinae.
1156 (cxx_constant_value): Adjust cxx_eval_outermost_constant_expr caller.
1157 (cxx_constant_dtor): New function.
1158 (maybe_constant_value, fold_non_dependent_expr_template,
1159 maybe_constant_init_1): Adjust cxx_eval_outermost_constant_expr
1161 (potential_constant_expression_1): Ignore clobbers. Allow
1162 COND_EXPR_IS_VEC_DELETE for c++2a.
1163 * decl.c (initialize_predefined_identifiers): Add heap identifiers.
1164 (decl_maybe_constant_destruction): New function.
1165 (cp_finish_decl): Don't clear TREE_READONLY for constexpr variables
1166 with non-trivial, but constexpr destructors.
1167 (register_dtor_fn): For constexpr variables with constexpr non-trivial
1168 destructors call cxx_maybe_build_cleanup instead of adding destructor
1170 (expand_static_init): For constexpr variables with constexpr
1171 non-trivial destructors call cxx_maybe_build_cleanup.
1172 (grokdeclarator): Allow constexpr destructors for c++2a. Formatting
1174 (cxx_maybe_build_cleanup): For constexpr variables with constexpr
1175 non-trivial destructors call cxx_constant_dtor instead of adding
1176 destructor calls at runtime.
1177 * init.c: Include stor-layout.h.
1178 (build_new_constexpr_heap_type, maybe_wrap_new_for_constexpr): New
1180 (build_new_1): For c++2a and new[], add cast around the alloc call
1181 to help constexpr evaluation figure out the type of the heap storage.
1182 (build_vec_delete_1): Set DECL_INITIAL of tbase and emit a DECL_EXPR
1183 for it instead of initializing an uninitialized variable.
1184 * method.c: Include intl.h.
1185 (SFK_CTOR_P, SFK_DTOR_P, SFK_ASSIGN_P, SFK_COPY_P, SFK_MOVE_P): Move
1186 definitions earlier.
1187 (process_subob_fn): Add sfk argument, adjust non-constexpr call
1188 diagnostics based on it.
1189 (walk_field_subobs): Formatting fixes. Adjust process_subob_fn caller.
1190 (synthesized_method_base_walk): Likewise.
1191 (synthesized_method_walk): Set *constexpr_p to true for dtors in c++2a.
1192 Fix up DR number in comment.
1193 (implicitly_declare_fn): Formatting fix.
1194 * typeck2.c (store_init_value): Don't call cp_fully_fold_init on
1195 initializers of automatic non-constexpr variables in constexpr
1198 2019-10-04 Jakub Jelinek <jakub@redhat.com>
1201 * constexpr.c (cxx_fold_indirect_ref_1): New function.
1202 (cxx_fold_indirect_ref): Use it.
1205 * cp-gimplify.c (cp_gimplify_expr) <case CALL_EXPR>: For
1206 -fstrong-eval-order ensure CALL_EXPR_FN side-effects are evaluated
1207 before any arguments. Additionally, ensure CALL_EXPR_FN that isn't
1208 invariant nor OBJ_TYPE_REF nor SSA_NAME is forced into a temporary.
1210 2019-10-03 Paolo Carlini <paolo.carlini@oracle.com>
1212 * init.c (build_new): Use cp_expr_loc_or_input_loc in two places.
1213 * name-lookup.c (do_pushdecl): Use DECL_SOURCE_LOCATION.
1214 (push_class_level_binding_1): Likewise.
1215 (set_decl_namespace): Likewise.
1217 2019-10-03 Jakub Jelinek <jakub@redhat.com>
1219 * constexpr.c (cxx_eval_constant_expression) <case CLEANUP_STMT>: If
1220 not skipping upon entry to body, run cleanup with the same *jump_target
1221 as it started to run the cleanup even if the body returns, breaks or
1223 (potential_constant_expression_1): Allow CLEANUP_STMT.
1225 * constexpr.c (cxx_eval_store_expression): Formatting fix. Handle
1226 const_object_being_modified with array type.
1228 2019-10-02 Jason Merrill <jason@redhat.com>
1230 * typeck2.c (store_init_value): Only clear_cv_and_fold_caches if the
1233 2019-09-30 Jason Merrill <jason@redhat.com>
1235 Use hash_map_safe_* functions.
1236 * constexpr.c (maybe_initialize_fundef_copies_table): Remove.
1237 (get_fundef_copy): Use hash_map_safe_get_or_insert.
1238 * cp-objcp-common.c (cp_get_debug_type): Use hash_map_safe_*.
1239 * decl.c (store_decomp_type): Remove.
1240 (cp_finish_decomp): Use hash_map_safe_put.
1241 * init.c (get_nsdmi): Use hash_map_safe_*.
1242 * pt.c (store_defaulted_ttp, lookup_defaulted_ttp): Remove.
1243 (add_defaults_to_ttp): Use hash_map_safe_*.
1245 2019-10-02 Richard Biener <rguenther@suse.de>
1248 * decl.c (build_ptrmemfunc_type): Mark pointer-to-member
1249 fat pointer structure members as DECL_NONADDRESSABLE_P.
1251 2019-09-28 Marek Polacek <polacek@redhat.com>
1253 PR c++/91889 - follow-up fix for DR 2352.
1254 * call.c (involves_qualification_conversion_p): New function.
1255 (direct_reference_binding): Build a ck_qual if the conversion
1256 would involve a qualification conversion.
1257 (convert_like_real): Strip the conversion created by the ck_qual
1258 in direct_reference_binding.
1260 PR c++/91921 - stray warning with -Woverloaded-virtual.
1261 * class.c (warn_hidden): Only emit the second part of
1262 -Woverloaded-virtual if the first part was issued. Use inform instead
1265 PR c++/91923 - failure-to-SFINAE with class type NTTP in C++17.
1266 * pt.c (invalid_nontype_parm_type_p): Only emit errors when
1269 2019-09-27 Jakub Jelinek <jakub@redhat.com>
1272 * parser.c (cp_parser_omp_var_list_no_open): Parse predefined
1274 * semantics.c (finish_omp_clauses): Allow predefined variables in
1275 shared and firstprivate clauses, even when they are predetermined
1277 * cp-gimplify.c (cxx_omp_predetermined_sharing_1): Return
1278 OMP_CLAUSE_DEFAULT_SHARED for predefined variables.
1280 2019-09-27 Jason Merrill <jason@redhat.com>
1282 * constexpr.c (cxx_fold_indirect_ref): Use similar_type_p.
1283 (cxx_eval_indirect_ref): Likewise. Improve error location.
1285 * cp-tree.h (class iloc_sentinel): New.
1286 * decl.c (grokdeclarator, finish_enum_value_list): Use it.
1287 * mangle.c (mangle_decl_string): Use it.
1288 * pt.c (perform_typedefs_access_check): Use it.
1290 2019-09-27 Richard Sandiford <richard.sandiford@arm.com>
1292 * cp-tree.h (build_cxx_call): Take the original function decl
1293 as an optional final parameter.
1294 (cp_build_function_call_vec): Likewise.
1295 * call.c (build_cxx_call): Likewise. Pass all built-in calls to
1296 check_builtin_function_arguments.
1297 * typeck.c (build_function_call_vec): Take the original function
1298 decl as an optional final parameter and pass it to
1299 cp_build_function_call_vec.
1300 (cp_build_function_call_vec): Take the original function
1301 decl as an optional final parameter and pass it to build_cxx_call.
1303 2019-09-25 Marek Polacek <polacek@redhat.com>
1305 PR c++/91877 - ICE with converting member of packed struct.
1306 * call.c (convert_like_real): Use similar_type_p in an assert.
1308 2019-09-25 Paolo Carlini <paolo.carlini@oracle.com>
1310 * name-lookup.c (check_extern_c_conflict): Use DECL_SOURCE_LOCATION.
1311 (check_local_shadow): Use it in three additional places.
1313 2019-09-24 Jason Merrill <jason@redhat.com>
1315 * parser.c (cp_parser_postfix_expression): Do set location of
1316 dependent member call.
1318 2019-09-24 Marek Polacek <polacek@redhat.com>
1320 PR c++/91868 - improve -Wshadow location.
1321 * name-lookup.c (check_local_shadow): Use DECL_SOURCE_LOCATION
1322 instead of input_location.
1324 PR c++/91845 - ICE with invalid pointer-to-member.
1325 * expr.c (mark_use): Use error_operand_p.
1326 * typeck2.c (build_m_component_ref): Check error_operand_p after
1327 calling mark_[lr]value_use.
1329 2019-09-23 Paolo Carlini <paolo.carlini@oracle.com>
1331 * pt.c (check_explicit_specialization): Use cp_expr_loc_or_input_loc.
1332 (process_partial_specialization): Likewise.
1333 (convert_nontype_argument_function): Likewise.
1334 (invalid_tparm_referent_p): Likewise.
1335 (convert_template_argument): Likewise.
1336 (check_valid_ptrmem_cst_expr): Tidy.
1338 2019-09-23 Jason Merrill <jason@redhat.com>
1340 PR c++/91809 - bit-field and ellipsis.
1341 * call.c (convert_arg_to_ellipsis): Don't call decay_conversion for
1342 arithmetic arguments.
1344 2019-09-23 Marek Polacek <polacek@redhat.com>
1346 PR c++/91844 - Implement CWG 2352, Similar types and reference binding.
1347 * call.c (reference_related_p): Use similar_type_p instead of
1349 (reference_compatible_p): Update implementation to match CWG 2352.
1350 * cp-tree.h (similar_type_p): Declare.
1351 * typeck.c (similar_type_p): New.
1353 2019-09-22 Marek Polacek <polacek@redhat.com>
1355 PR c++/91819 - ICE with operator++ and enum.
1356 * call.c (build_new_op_1): Set arg2_type.
1358 2019-09-17 Jason Merrill <jason@redhat.com>
1360 * parser.c (cp_parser_statement): Handle [[likely]] on
1363 2019-09-19 Jason Merrill <jason@redhat.com>
1366 * call.c (build_new_op_1): Don't apply any standard conversions to
1367 the operands of a built-in operator. Don't suppress conversions in
1369 * typeck.c (cp_build_unary_op): Do integral promotions for enums.
1371 2019-09-16 Paolo Carlini <paolo.carlini@oracle.com>
1373 * decl.c (grokdeclarator): Use declspecs->locations and
1374 declarator->id_loc in a few error messages.
1375 * pt.c (finish_member_template_decl): Use DECL_SOURCE_LOCATION.
1376 (push_template_decl_real): Likewise.
1378 2019-09-15 Jason Merrill <jason@redhat.com>
1380 PR c++/30277 - int-width bit-field promotion.
1381 PR c++/33819 - long bit-field promotion.
1382 * typeck.c (cp_perform_integral_promotions): Handle large bit-fields
1383 properly. Handle 32-bit non-int bit-fields properly.
1384 (is_bitfield_expr_with_lowered_type): Don't look through NOP_EXPR.
1386 PR c++/82165 - enum bitfields and operator overloading.
1387 * call.c (build_new_op_1): Use unlowered_expr_type.
1389 * call.c (build_new_op_1): Don't apply any standard conversions to
1390 the operands of a built-in operator. Don't suppress conversions in
1392 * typeck.c (cp_build_unary_op): Do integral promotions for enums.
1394 2019-09-15 Marek Polacek <polacek@redhat.com>
1396 PR c++/91740 - ICE with constexpr call and ?: in ARRAY_REF.
1397 * pt.c (build_non_dependent_expr): Call build_non_dependent_expr for
1400 2019-09-15 Nathan Sidwell <nathan@acm.org>
1402 * cp-tree.h (DECL_CLONED_FUNCTION_P): Reimplement using
1403 IDENTIFIER_CDTOR_P, correct documentation.
1404 (DECL_CLONED_FUNCTION): Directly access field.
1405 (decl_cloned_function_p): Delete.
1406 * class.c (decl_cloned_function_p): Delete.
1407 * pt.c (instantiate_template_1): Check DECL_CHAIN is a decl.
1409 2019-09-11 Nathan Sidwell <nathan@acm.org>
1411 * c-objcp-common.c (cp-objcp-common.c): Alphababetize and
1412 correctly mark all C++ nodes.
1413 * decl.c (cp_tree_node_structure): Alphabetize.
1415 2019-09-10 Marek Polacek <polacek@redhat.com>
1417 PR c++/91673 - ICE with noexcept in alias-declaration.
1418 * parser.c (CP_PARSER_FLAGS_DELAY_NOEXCEPT): New parser flag.
1419 (cp_parser_lambda_declarator_opt): Pass CP_PARSER_FLAGS_NONE to
1420 cp_parser_exception_specification_opt.
1421 (cp_parser_direct_declarator): Adjust a call to
1422 cp_parser_exception_specification_opt.
1423 (cp_parser_member_declaration): Pass CP_PARSER_FLAGS_DELAY_NOEXCEPT
1424 to cp_parser_declarator if not processing a friend or typedef
1426 (cp_parser_late_noexcept_specifier): Adjust a call to
1427 cp_parser_noexcept_specification_opt.
1428 (cp_parser_noexcept_specification_opt): New parameter for parser flags,
1429 drop the FRIEND_P parameter. Use the new parameter.
1430 (cp_parser_exception_specification_opt): Likewise.
1431 (cp_parser_transaction): Adjust a call to
1432 cp_parser_noexcept_specification_opt.
1433 (cp_parser_transaction_expression): Likewise.
1435 2019-09-10 Marek Polacek <polacek@redhat.com>
1437 PR c++/91705 - constexpr evaluation rejects ++/-- on floats.
1438 * constexpr.c (cxx_eval_increment_expression): Call fold_simple on
1441 2019-09-10 Paolo Carlini <paolo.carlini@oracle.com>
1443 * decl.c (has_designator_problem): Use cp_expr_loc_or_input_loc
1445 (build_enumerator): Likewise.
1446 (cp_finish_decl): Use DECL_SOURCE_LOCATION.
1447 (grokdeclarator): Use id_loc in two error_at; change errror
1448 message about constinit together constexpr to use two ranges.
1450 2019-09-09 Marek Polacek <polacek@redhat.com>
1452 PR c++/84374 - diagnose invalid uses of decltype(auto).
1453 * decl.c (grokdeclarator): Diagnose wrong usage of decltype(auto) in
1454 a function declaration.
1456 2019-09-06 Nathan Sidwell <nathan@acm.org>
1459 * cp-tree.h (IDENTIFIER_REPO_CHOSEN, DECL_REPO_AVAILABLE_P): Delete.
1460 (struct lang_decl_base): Remove repo_available_p.
1461 * decl.c (duplicate_decls): Don't copy DECL_REPO_AVAILABLE_P.
1463 (Reserve TREE_LANG_FLAG_3 for modules.
1464 * cp-tree.h (DECL_CONSTRUCTION_VTABLE_P): Delete.
1465 (DECL_NON_TRIVIALLY_INITIALIZED_P): Move to TREE_LANG_FLAG_6.
1466 * class.c (build_ctor_vtbl_group): Don't set
1467 DECL_CONSTRUCTION_VTABLE_P.
1468 * decl2.c (determine_visibility_from_class): Don't check
1469 DECL_CONSTRUCTION_VTABLE_P anymore.
1471 2019-09-06 Martin Liska <mliska@suse.cz>
1474 * Make-lang.in: Remove repo.o.
1475 * config-lang.in: Likewise.
1476 * cp-tree.h (init_repo): Remove declarations
1477 of repo-related functions.
1478 (repo_emit_p): Likewise.
1479 (repo_export_class_p): Likewise.
1480 (finish_repo): Likewise.
1481 * decl2.c (import_export_class): Always
1483 (mark_needed): Remove -frepo from comment.
1484 (import_export_decl): Similarly here.
1485 (c_parse_final_cleanups): Remove call of finish_repo.
1486 * lex.c (cxx_init): Remove call to init_repo.
1487 * optimize.c (can_alias_cdtor): Remove dead condition.
1488 * pt.c (push_template_decl_real): Update comment.
1489 (instantiate_decl): Remove dead code used for -frepo.
1492 2019-09-05 Marek Polacek <polacek@redhat.com>
1494 PR c++/91644 - ICE with constinit in function template.
1495 * decl.c (start_decl): Call retrofit_lang_decl for constinit variables.
1496 * pt.c (tsubst_expr): Pass LOOKUP_CONSTINIT down to cp_finish_decl for
1497 constinit variables.
1499 2019-09-05 Nathan Sidwell <nathan@acm.org>
1501 * cp-tree.h (DECL_VTABLE_OR_VTT_P): Forward to DECL_VIRTUAL_P.
1503 2019-09-04 Marek Polacek <polacek@redhat.com>
1505 * call.c (build_over_call): Remove -fdeduce-init-list implementation.
1506 * pt.c (unify): Likewise.
1508 2019-09-01 Marek Polacek <polacek@redhat.com>
1510 PR c++/91129 - wrong error with binary op in template argument.
1511 * typeck.c (warn_for_null_address): Use fold_for_warn instead of
1512 fold_non_dependent_expr.
1513 (cp_build_binary_op): Likewise.
1515 2019-08-30 Jason Merrill <jason@redhat.com>
1517 Add source location to TRAIT_EXPR.
1518 * cp-tree.h (TRAIT_EXPR_LOCATION): New.
1519 (struct tree_trait_expr): Add locus field.
1520 * parser.c (cp_parser_trait_expr): Pass trait_loc down.
1521 * pt.c (tsubst_copy_and_build) [TRAIT_EXPR]: Likewise.
1522 * semantics.c (finish_trait_expr): Add location parm.
1523 * tree.c (cp_expr_location): Handle TRAIT_EXPR.
1525 2019-08-29 Paolo Carlini <paolo.carlini@oracle.com>
1527 * decl.c (check_var_type): Add location_t parameter and use it.
1528 (grokdeclarator): Adjust call.
1529 * pt.c (tsubst_decl): Likewise.
1530 * cp-tree.h: Adjust declaration.
1532 2019-08-28 Marek Polacek <polacek@redhat.com>
1534 Implement P1152R4: Deprecating some uses of volatile.
1536 * cp-gimplify.c (cp_fold): Set TREE_THIS_VOLATILE.
1537 * decl.c (grokdeclarator): Warn about a volatile-qualified structured
1538 binding and return type.
1539 (grokparms): Warn about a volatile-qualified function parameter.
1540 * expr.c (mark_use) <case MODIFY_EXPR>: Emit a -Wvolatile warning.
1541 * typeck.c (cp_build_unary_op): Emit a -Wvolatile warning for pre and
1542 post ++/-- on a volatile operand.
1543 (genericize_compound_lvalue): Use a better location. Don't lose
1545 (cp_build_modify_expr): Emit a -Wvolatile warning for a compound
1546 assignment whose LHS is volatile-qualified. Build the assignment with
1547 a more precise location.
1549 2019-08-28 Marek Polacek <polacek@redhat.com>
1551 PR c++/91360 - Implement C++20 P1143R2: constinit.
1552 * cp-tree.h (TINFO_VAR_DECLARED_CONSTINIT): Define.
1553 (LOOKUP_CONSTINIT): Define.
1554 (enum cp_decl_spec): Add ds_constinit.
1555 * decl.c (check_tag_decl): Give an error for constinit in type
1557 (check_initializer): Also check LOOKUP_CONSTINIT.
1558 (cp_finish_decl): Add checking for a constinit declaration. Set
1559 TINFO_VAR_DECLARED_CONSTINIT.
1560 (grokdeclarator): Add checking for a declaration with the constinit
1562 * lex.c (init_reswords): Handle D_CXX20.
1563 * parser.c (cp_lexer_get_preprocessor_token): Pass a better location
1564 to warning_at. Warn about C++20 keywords.
1565 (cp_keyword_starts_decl_specifier_p): Handle RID_CONSTINIT.
1566 (cp_parser_diagnose_invalid_type_name): Add an inform about constinit.
1567 (cp_parser_decomposition_declaration): Maybe pass LOOKUP_CONSTINIT to
1569 (cp_parser_decl_specifier_seq): Handle RID_CONSTINIT.
1570 (cp_parser_init_declarator): Maybe pass LOOKUP_CONSTINIT to
1572 (set_and_check_decl_spec_loc): Add "constinit".
1573 * pt.c (tsubst_decl): Set TINFO_VAR_DECLARED_CONSTINIT.
1574 (instantiate_decl): Maybe pass LOOKUP_CONSTINIT to cp_finish_decl.
1575 * typeck2.c (store_init_value): If a constinit variable wasn't
1576 initialized using a constant initializer, give an error.
1578 2019-08-28 Nathan Sidwell <nathan@acm.org>
1581 * name-lookup.c (cp_emit_debug_info): Check for builtins during
1584 2019-08-27 Marek Polacek <polacek@redhat.com>
1586 PR c++/81676 - bogus -Wunused warnings in constexpr if.
1587 * semantics.c (maybe_mark_exp_read_r): New function.
1588 (finish_if_stmt): Call it on THEN_CLAUSE and ELSE_CLAUSE.
1590 PR c++/91428 - warn about std::is_constant_evaluated in if constexpr.
1591 * cp-tree.h (decl_in_std_namespace_p): Declare.
1592 * semantics.c (is_std_constant_evaluated_p): New.
1593 (finish_if_stmt_cond): Warn about "std::is_constant_evaluated ()" in
1595 * typeck.c (decl_in_std_namespace_p): No longer static.
1597 2019-08-26 Jason Merrill <jason@redhat.com>
1599 * decl.c (duplicate_decls): Always merge DECL_DECLARED_CONSTEXPR_P.
1601 2019-08-26 Marek Polacek <polacek@redhat.com>
1603 PR c++/91545 - ICE in constexpr store evaluation.
1604 * constexpr.c (cxx_eval_store_expression): Check FIELD_DECL instead
1607 2019-08-24 Nathan Sidwell <nathan@acm.org>
1609 * class.c (check_for_overrides): Conversion operators need
1612 2019-08-24 Paolo Carlini <paolo.carlini@oracle.com>
1614 * semantics.c (finish_switch_cond): Improve error message location.
1616 2019-08-23 Jason Merrill <jason@redhat.com>
1618 * decl2.c (decl_dependent_p): New.
1619 (mark_used): Check it instead of just processing_template_decl.
1621 2019-08-23 Jason Merrill <jason@redhat.com>
1623 * parser.c (cp_parser_nested_name_specifier_opt): Avoid redundant
1626 2019-08-23 Marek Polacek <polacek@redhat.com>
1628 PR c++/91521 - wrong error with operator->.
1629 * decl.c (grokdeclarator): Return error_mark_node for an invalid
1630 trailing return type.
1632 PR c++/79817 - attribute deprecated on namespace.
1633 * cp-tree.h (cp_warn_deprecated_use_scopes): Declare.
1634 * decl.c (grokdeclarator): Call cp_warn_deprecated_use_scopes.
1635 (type_is_deprecated): Likewise.
1636 * decl2.c (cp_warn_deprecated_use_scopes): New function.
1637 * name-lookup.c (handle_namespace_attrs): Handle attribute deprecated.
1638 * parser.c (cp_parser_namespace_alias_definition): Call
1639 cp_warn_deprecated_use_scopes.
1640 (cp_parser_using_declaration): Likewise.
1641 (cp_parser_using_directive): Likewise.
1642 * semantics.c (finish_id_expression_1): Likewise.
1644 2019-08-23 Nathan Sidwell <nathan@acm.org>
1646 * class.c (check_for_override): Checking IDENTIFIER_VIRTUAL_P is
1647 sufficient, reorder DECL_OVERRIDE_P check.
1649 2019-08-23 Iain Sandoe <iain@sandoe.co.uk>
1652 * parser.c (cp_parser_initial_pragma): Call c_common_no_more_pch ()
1653 after determining that the first token is not
1654 PRAGMA_GCC_PCH_PREPROCESS.
1656 2019-08-22 Marek Polacek <polacek@redhat.com>
1658 PR c++/91304 - prefix attributes ignored in condition.
1659 * parser.c (cp_parser_condition): Handle prefix attributes.
1661 2019-08-21 Richard Sandiford <richard.sandiford@arm.com>
1664 * decl.c (duplicate_decls): Call copy_attributes_to_builtin inside
1665 the BUILT_IN_NORMAL block rather than afterward.
1667 2019-08-19 Marek Polacek <polacek@redhat.com>
1669 PR c++/91264 - detect modifying const objects in constexpr.
1670 * constexpr.c (modifying_const_object_error): New function.
1671 (cxx_eval_call_expression): Set TREE_READONLY on a CONSTRUCTOR of
1672 a const-qualified object after it's been fully constructed.
1673 (modifying_const_object_p): New function.
1674 (cxx_eval_store_expression): Detect modifying a const object
1675 during constant expression evaluation.
1676 (cxx_eval_increment_expression): Use a better location when building
1678 (cxx_eval_constant_expression) <case DECL_EXPR>: Mark a constant
1679 object's constructor TREE_READONLY.
1681 2019-08-15 Jason Merrill <jason@redhat.com>
1683 PR c++/90393 - ICE with thow in ?:
1685 PR c++/64372, DR 1560 - Gratuitous lvalue-to-rvalue conversion in ?:
1686 * tree.c (lvalue_kind): Handle throw in one arm.
1687 * typeck.c (rationalize_conditional_expr): Likewise.
1688 (cp_build_modify_expr): Likewise.
1690 2019-08-14 Jason Merrill <jason@redhat.com>
1692 Implement P0848R3, Conditionally Trivial Special Member Functions.
1693 * tree.c (special_memfn_p): New.
1694 * class.c (add_method): When overloading, hide ineligible special
1696 (check_methods): Set TYPE_HAS_COMPLEX_* here.
1697 * decl.c (grok_special_member_properties): Not here.
1698 * name-lookup.c (push_class_level_binding_1): Move overloaded
1699 functions case down, accept FUNCTION_DECL as target_decl.
1701 2019-08-14 Jonathan Wakely <jwakely@redhat.com>
1704 * name-lookup.c (get_std_name_hint): Fix min_dialect field for
1705 complex_literals and make_unique entries.
1707 2019-08-14 Jakub Jelinek <jakub@redhat.com>
1708 Marek Polacek <polacek@redhat.com>
1710 PR c++/91391 - bogus -Wcomma-subscript warning.
1711 * parser.c (cp_parser_postfix_open_square_expression): Don't warn about
1712 a deprecated comma here. Pass warn_comma_subscript down to
1713 cp_parser_expression.
1714 (cp_parser_expression): New bool parameter. Warn about uses of a comma
1715 operator within a subscripting expression.
1716 (cp_parser_skip_to_closing_square_bracket): Revert to pre-r274121 state.
1717 (cp_parser_skip_to_closing_square_bracket_1): Remove.
1719 2019-08-14 Jonathan Wakely <jwakely@redhat.com>
1721 * name-lookup.c (get_std_name_hint): Add more entries.
1723 2019-08-14 Paolo Carlini <paolo.carlini@oracle.com>
1725 * decl2.c (grok_array_decl): Use the location of the open square
1726 bracket in error message about invalid types.
1728 2019-08-14 Paolo Carlini <paolo.carlini@oracle.com>
1730 * decl.c (grokdeclarator): Check here for typedef a function
1731 definition or a member function definition.
1732 (start_function): Adjust.
1733 (grokmethod): Likewise.
1735 2019-08-13 Richard Sandiford <richard.sandiford@arm.com>
1738 * decl.c (duplicate_decls): Use copy_decl_built_in_function.
1739 * pt.c (declare_integer_pack): Use set_decl_built_in_function.
1741 2019-08-13 Marek Polacek <polacek@redhat.com>
1743 PR c++/90473 - wrong code with nullptr in default argument.
1744 * call.c (null_ptr_cst_p): Update quote from the standard.
1745 * decl.c (check_default_argument): Don't return nullptr when the arg
1748 2019-08-13 Marek Polacek <polacek@redhat.com>
1750 * cp-tree.h (DECL_MUTABLE_P): Use FIELD_DECL_CHECK.
1752 2019-08-10 Jakub Jelinek <jakub@redhat.com>
1754 * parser.c (cp_parser_omp_clause_name): Parse device_type.
1755 (cp_parser_omp_clause_device_type): New function.
1756 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_DEVICE_TYPE.
1757 (OMP_DECLARE_TARGET_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_DEVICE_TYPE.
1758 (cp_parser_omp_declare_target): Handle device_type clauses. Remove
1759 diagnostics for declare target with clauses nested in clause-less
1760 declare target declaration-definition-seq.
1761 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_DEVICE_TYPE.
1763 2019-08-09 Jakub Jelinek <jakub@redhat.com>
1765 * parser.c (check_no_duplicate_clause): Simplify using
1767 (cp_parser_omp_clause_if): Fix up printing of target {enter,exit} data
1768 directive name modifiers.
1771 * parser.c (cp_parser_omp_clause_dist_schedule): Comment out the
1772 check_no_duplicate_clause call, instead emit a warning for duplicate
1773 dist_schedule clauses.
1775 2019-08-08 Paolo Carlini <paolo.carlini@oracle.com>
1777 * decl.c (grokdeclarator): Use id_loc and EXPR_LOCATION in
1778 a few error messages.
1780 2019-08-08 Marek Polacek <polacek@redhat.com>
1782 PR c++/87519 - bogus warning with -Wsign-conversion.
1783 * typeck.c (cp_build_binary_op): Use same_type_p instead of comparing
1786 * constexpr.c (inline_asm_in_constexpr_error): New.
1787 (cxx_eval_constant_expression) <case ASM_EXPR>: Call it.
1788 (potential_constant_expression_1) <case ASM_EXPR>: Likewise.
1790 2019-08-08 Jakub Jelinek <jakub@redhat.com>
1792 * semantics.c (finish_omp_clauses): For C_ORT_OMP
1793 OMP_CLAUSE_USE_DEVICE_* clauses use oacc_reduction_head bitmap
1794 instead of generic_head to track duplicates.
1796 2019-08-07 Marek Polacek <polacek@redhat.com>
1798 PR c++/81429 - wrong parsing of constructor with C++11 attribute.
1799 * parser.c (cp_parser_constructor_declarator_p): Handle the scenario
1800 when a parameter declaration begins with [[attribute]].
1802 2019-08-07 Marek Polacek <polacek@redhat.com>
1804 PR c++/91346 - Implement P1668R1, allow unevaluated asm in constexpr.
1805 * constexpr.c (cxx_eval_constant_expression): Handle ASM_EXPR.
1806 (potential_constant_expression_1) <case ASM_EXPR>: Allow.
1807 * cp-tree.h (finish_asm_stmt): Adjust.
1808 * parser.c (cp_parser_asm_definition): Grab the locaion of "asm" and
1809 use it. Change an error to a pedwarn. Allow asm in C++2a, warn
1811 * pt.c (tsubst_expr): Pass a location down to finish_asm_stmt.
1812 * semantics.c (finish_asm_stmt): New location_t parameter. Use it.
1814 2019-08-07 Jakub Jelinek <jakub@redhat.com>
1816 * parser.c (cp_parser_omp_clause_name): Parse use_device_addr clause.
1817 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR.
1818 (OMP_TARGET_DATA_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR.
1819 (cp_parser_omp_target_data): Handle PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR
1820 like PRAGMA_OMP_CLAUSE_USE_DEVICE_PTR, adjust diagnostics about no
1821 map or use_device_* clauses.
1822 * semantics.c (finish_omp_clauses): For OMP_CLAUSE_USE_DEVICE_PTR
1823 in OpenMP, require pointer or reference to pointer type rather than
1824 pointer or array or reference to pointer or array type. Handle
1825 OMP_CLAUSE_USE_DEVICE_ADDR.
1826 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_USE_DEVICE_ADDR.
1828 2019-08-06 Jason Merrill <jason@redhat.com>
1830 PR c++/91378 - ICE with noexcept and auto return type.
1831 * pt.c (maybe_instantiate_noexcept): push_to_top_level.
1833 2019-08-06 Paolo Carlini <paolo.carlini@oracle.com>
1835 * decl.c (check_array_designated_initializer): Use
1836 cp_expr_loc_or_input_loc in one place.
1838 2019-08-06 Jakub Jelinek <jakub@redhat.com>
1840 * parser.c (cp_parser_omp_for_loop): For OMP_LOOP, ignore parallel
1841 clauses and predetermine iterator as lastprivate.
1842 * semantics.c (handle_omp_for_class_iterator): Use
1843 OMP_CLAUSE_LASTPRIVATE_LOOP_IV instead of
1844 OMP_CLAUSE_LASTPRIVATE_TASKLOOP_IV, set it for lastprivate also
1845 on OMP_LOOP construct. If a clause is missing for class iterator
1846 on OMP_LOOP, add firstprivate clause, and if there is private
1847 clause, turn it into firstprivate too.
1848 (finish_omp_for): Formatting fix. For OMP_LOOP, adjust
1849 OMP_CLAUSE_LASTPRIVATE_LOOP_IV clause CP_CLAUSE_INFO, so that it
1850 uses copy ctor instead of default ctor.
1851 * cp-gimplify.c (cp_gimplify_expr): Handle OMP_LOOP like
1853 (cp_fold_r): Likewise.
1854 (cp_genericize_r): Likewise.
1855 (cxx_omp_finish_clause): Also finish lastprivate clause with
1856 OMP_CLAUSE_LASTPRIVATE_LOOP_IV flag.
1857 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_BIND.
1858 (tsubst_omp_for_iterator): For OMP_LOOP, ignore parallel
1859 clauses and predetermine iterator as lastprivate.
1860 * constexpr.c (potential_constant_expression_1): Handle OMP_LOOP
1861 like OMP_DISTRIBUTE etc.
1863 2019-08-05 Marek Polacek <polacek@redhat.com>
1865 DR 2413 - typename in conversion-function-ids.
1866 * parser.c (cp_parser_conversion_type_id): Call
1867 cp_parser_type_specifier_seq with CP_PARSER_FLAGS_TYPENAME_OPTIONAL
1868 instead of CP_PARSER_FLAGS_NONE.
1870 2019-08-05 Paolo Carlini <paolo.carlini@oracle.com>
1872 * cp-tree.h (cp_expr_loc_or_input_loc): New.
1873 (cxx_incomplete_type_diagnostic): Use it.
1874 * call.c (build_converted_constant_expr_internal, convert_like_real,
1875 convert_arg_to_ellipsis, convert_for_arg_passing, build_over_call,
1876 build_cxx_call, perform_implicit_conversion_flags,
1877 initialize_reference): Likewise.
1878 * constexpr.c (cxx_eval_internal_function, cxx_eval_call_expression,
1879 eval_and_check_array_index, cxx_eval_store_expression,
1880 cxx_eval_statement_list, cxx_eval_loop_expr,
1881 cxx_eval_constant_expression, potential_constant_expression_1):
1883 * constraint.cc (check_for_logical_overloads,
1884 satisfy_predicate_constraint): Likewise.
1885 * cp-gimplify.c (cp_gimplify_expr): Likewise.
1886 * cvt.c (cp_convert_to_pointer, convert_to_reference,
1887 cp_convert_and_check, ocp_convert, maybe_warn_nodiscard): Likewise.
1888 * decl.c (pop_switch): Likewise.
1889 * decl2.c (delete_sanity): Likewise.
1890 * error.c (location_of): Likewise.
1891 * init.c (maybe_warn_list_ctor, build_aggr_init,
1892 warn_placement_new_too_small, build_new_1, build_vec_init): Likewise.
1893 * lex.c (unqualified_name_lookup_error): Likewise.
1894 * parser.c (cp_parser_initializer_list, cp_parser_omp_for_cond):
1896 * pt.c (check_for_bare_parameter_packs, check_valid_ptrmem_cst_expr,
1897 unify_arg_conversion, convert_nontype_argument,
1898 tsubst_copy_and_build, resolve_typename_type): Likewise.
1899 * semantics.c (maybe_convert_cond, finish_call_expr,
1900 cp_build_vec_convert): Likewise.
1901 * typeck.c (decay_conversion, rationalize_conditional_expr,
1902 cp_build_unary_op, build_x_compound_expr_from_list,
1903 maybe_warn_about_returning_address_of_local,
1904 maybe_warn_pessimizing_move): Likewise.
1905 * typeck2.c (check_narrowing, digest_init_r,
1906 process_init_constructor_array): Likewise.
1908 2019-08-05 Tom Honermann <tom@honermann.net>
1910 * parser.c (cp_parser_template_declaration_after_parameters): Enable
1911 class template argument deduction for non-type template parameters
1912 in literal operator templates.
1914 2019-08-05 Marek Polacek <polacek@redhat.com>
1916 PR c++/91338 - Implement P1161R3: Deprecate a[b,c].
1917 * parser.c (cp_parser_postfix_open_square_expression): Warn about uses
1918 of a comma operator within a subscripting expression.
1919 (cp_parser_skip_to_closing_square_bracket_1): New function, made out
1921 (cp_parser_skip_to_closing_square_bracket): ...this.
1923 2019-08-05 Jason Merrill <jason@redhat.com>
1925 * semantics.c (force_paren_expr): Preserve location.
1927 2019-08-02 Marek Polacek <polacek@redhat.com>
1929 PR c++/91230 - wrong error with __PRETTY_FUNCTION__ and generic lambda.
1930 * pt.c (value_dependent_expression_p): Consider __PRETTY_FUNCTION__
1931 inside a template function value-dependent.
1933 2019-08-02 Paolo Carlini <paolo.carlini@oracle.com>
1935 * tree.c (handle_nodiscard_attribute): Do not warn about nodiscard
1936 applied to a constructor.
1938 2019-08-02 Martin Liska <mliska@suse.cz>
1940 * decl.c (grok_op_properties):
1941 Mark DECL_SET_IS_OPERATOR_DELETE for user-provided delete operators.
1943 2019-08-01 Martin Sebor <msebor@redhat.com>
1946 * decl.c (reshape_init_array_1): Avoid truncating initializer
1947 lists containing string literals.
1949 2019-08-01 Marek Polacek <polacek@redhat.com>
1951 PR c++/90805 - detect narrowing in case values.
1952 * decl.c (case_conversion): Detect narrowing in case values.
1954 2019-07-31 Paolo Carlini <paolo.carlini@oracle.com>
1956 * decl2.c (delete_sanity): Improve diagnostic locations, use
1957 cp_expr_loc_or_loc in four places.
1959 2019-07-31 Jason Merrill <jason@redhat.com>
1961 PR c++/90538 - multiple expansions of capture packs
1962 * cp-tree.h (DECLTYPE_FOR_INIT_CAPTURE): Remove.
1963 * lambda.c (add_capture): Copy parameter packs from init.
1964 (lambda_capture_field_type): Always use auto for init-capture.
1965 * pt.c (uses_parameter_packs): Return tree.
1966 (tsubst) [DECLTYPE_TYPE]: Remove init-capture handling.
1967 (gen_elem_of_pack_expansion_instantiation): Don't push
1968 local_specialization_stack.
1969 (prepend_one_capture): New.
1970 (tsubst_lambda_expr): Use it. Don't touch local_specializations.
1971 (do_auto_deduction): Avoid redundant error.
1973 Fix copy_node of TEMPLATE_INFO.
1974 * cp-tree.h (struct tree_template_info): Use tree_base instead of
1975 tree_common. Add tmpl and args fields.
1976 (TI_TEMPLATE, TI_ARGS): Adjust.
1978 2019-07-30 Martin Liska <mliska@suse.cz>
1980 PR tree-optimization/91270
1981 * tree-ssa-dce.c (propagate_necessity): Mark 2nd argument
1982 of delete operator as needed.
1984 2019-07-25 Martin Liska <mliska@suse.cz>
1985 Dominik Infuhr <dominik.infuehr@theobroma-systems.com>
1988 * decl.c (cxx_init_decl_processing): Mark delete operators
1989 with DECL_SET_IS_OPERATOR_DELETE.
1991 2019-07-25 Martin Liska <mliska@suse.cz>
1993 * decl.c (duplicate_decls): Use new macros
1994 (e.g. DECL_SET_LAMBDA_FUNCTION and DECL_LAMBDA_FUNCTION_P).
1995 (cxx_init_decl_processing): Likewise.
1996 (grok_op_properties): Likewise.
1997 * parser.c (cp_parser_lambda_declarator_opt): Likewise.
1999 2019-07-24 Martin Sebor <msebor@redhat.com>
2002 * decl.c (finish_function): Use lang_mask.
2004 2019-07-20 Jason Merrill <jason@redhat.com>
2006 * cp-tree.h (ovl_iterator::using_p): A USING_DECL by itself was also
2007 introduced by a using-declaration.
2009 2019-07-20 Jason Merrill <jason@redhat.com>
2011 Reduce memory consumption for push/pop_access_scope.
2012 * name-lookup.c (leave_scope): Do add class levels other than
2013 previous_class_level to free_binding_level.
2014 (invalidate_class_lookup_cache): Move from class.c, add to
2016 * pt.c (saved_access_scope): Change from list to vec.
2018 2019-07-20 Jakub Jelinek <jakub@redhat.com>
2020 * cp-tree.h (OMP_FOR_GIMPLIFYING_P): Use OMP_LOOPING_CHECK
2021 instead of OMP_LOOP_CHECK.
2022 * parser.c (cp_parser_omp_clause_name): Handle bind clause.
2023 (cp_parser_omp_clause_bind): New function.
2024 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_BIND.
2025 (OMP_LOOP_CLAUSE_MASK): Define.
2026 (cp_parser_omp_loop): New function.
2027 (cp_parser_omp_parallel, cp_parser_omp_teams): Handle parsing of
2028 loop combined with parallel or teams.
2029 (cp_parser_omp_construct): Handle PRAGMA_OMP_LOOP.
2030 (cp_parser_pragma): Likewise.
2031 * pt.c (tsubst_expr): Handle OMP_LOOP.
2032 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_BIND.
2034 2019-07-19 Jason Merrill <jason@redhat.com>
2036 PR c++/90101 - dependent class non-type parameter.
2037 * pt.c (invalid_nontype_parm_type_p): Check for dependent class type.
2039 2019-07-18 Jason Merrill <jason@redhat.com>
2041 PR c++/90098 - partial specialization and class non-type parms.
2044 * call.c (build_converted_constant_expr_internal): Don't copy.
2045 * pt.c (process_partial_specialization): Allow VIEW_CONVERT_EXPR
2046 around class non-type parameter.
2047 (unify) [TEMPLATE_PARM_INDEX]: Ignore cv-quals.
2049 2019-07-16 Jason Merrill <jason@redhat.com>
2051 * parser.c (make_location): Add overload taking cp_lexer* as last
2054 * parser.c (cp_parser_simple_type_specifier): Separate tentative
2055 parses for optional type-spec and CTAD.
2057 * parser.c (cp_parser_nested_name_specifier_opt): If the token is
2058 already CPP_NESTED_NAME_SPECIFIER, leave it alone.
2060 2019-07-12 Jakub Jelinek <jakub@redhat.com>
2062 * parser.c (cp_parser_omp_clause_name): Handle order clause.
2063 (cp_parser_omp_clause_order): New function.
2064 (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_ORDER.
2065 (OMP_SIMD_CLAUSE_MASK, OMP_FOR_CLAUSE_MASK): Add
2066 PRAGMA_OMP_CLAUSE_ORDER.
2067 * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_ORDER.
2068 * pt.c (tsubst_omp_clauses): Likewise.
2070 2019-07-10 Paolo Carlini <paolo.carlini@oracle.com>
2072 * decl.c (get_type_quals,
2073 smallest_type_location (const cp_decl_specifier_seq*)): New.
2074 (check_tag_decl): Use smallest_type_location in error_at about
2075 multiple types in one declaration.
2076 (grokdeclarator): Use locations[ds_complex] in error_at about
2077 complex invalid; use locations[ds_storage_class] in error_at
2078 about static cdtor; use id_loc in error_at about flexible
2079 array member in union; use get_type_quals.
2081 2019-07-09 Martin Sebor <msebor@redhat.com>
2084 * cp-tree.h: Change class-key of PODs to struct and others to class.
2086 * semantics.c (finalize_nrv_r): Same.
2088 2019-07-09 Martin Sebor <msebor@redhat.com>
2091 * constexpr.c (cxx_eval_call_expression): Change class-key from class
2092 to struct and vice versa to match convention and avoid -Wclass-is-pod
2093 and -Wstruct-no-pod.
2094 * constraint.cc (get_concept_definition): Same.
2096 * cxx-pretty-print.h: Same.
2098 * logic.cc (term_list::replace): Same.
2099 * name-lookup.c (find_local_binding): Same.
2100 * pt.c (tsubst_binary_right_fold): Same.
2101 * search.c (field_accessor_p): Same.
2102 * semantics.c (expand_or_defer_fn): Same.
2104 2019-07-08 Jakub Jelinek <jakub@redhat.com>
2107 * decl2.c (cp_omp_mappable_type_1): Don't emit any note for
2108 error_mark_node type.
2110 2019-07-05 Jakub Jelinek <jakub@redhat.com>
2114 * call.c (build_new_method_call_1): Remove set but not used variable
2117 2019-07-05 Paolo Carlini <paolo.carlini@oracle.com>
2119 PR c++/67184 (again)
2121 * call.c (build_over_call): Devirtualize user-defined operators
2122 coming from a base too.
2123 (build_new_method_call_1): Do not devirtualize here.
2125 2019-07-04 Marek Polacek <polacek@redhat.com>
2128 PR c++/83374 - __is_standard_layout wrong for a class with repeated
2130 * class.c (check_bases): Set CLASSTYPE_NON_STD_LAYOUT for a class if
2131 CLASSTYPE_REPEATED_BASE_P is true.
2133 2019-07-04 Andrew Stubbs <ams@codesourcery.com>
2135 * cp-tree.h (cp_omp_emit_unmappable_type_notes): New prototype.
2136 * decl.c (cp_finish_decl): Call cp_omp_emit_unmappable_type_notes.
2137 * decl2.c (cp_omp_mappable_type): Move contents to ...
2138 (cp_omp_mappable_type_1): ... here and add note output.
2139 (cp_omp_emit_unmappable_type_notes): New function.
2140 * semantics.c (finish_omp_clauses): Call
2141 cp_omp_emit_unmappable_type_notes in four places.
2143 2019-07-03 Martin Liska <mliska@suse.cz>
2145 * call.c (build_new_op_1): Remove dead assignemts.
2146 * typeck.c (cp_build_binary_op): Likewise.
2148 2019-06-27 Jason Merrill <jason@redhat.com>
2150 PR c++/55442 - memory-hog with highly recursive constexpr.
2151 * constexpr.c (push_cx_call_context): Return depth.
2152 (cxx_eval_call_expression): Don't cache past constexpr_cache_depth.
2154 2019-06-27 Jan Hubicka <jh@suse.cz>
2156 * class.c (layout_class_type): Set TYPE_CXX_ODR_P for as-base
2159 2019-06-27 Martin Liska <mliska@suse.cz>
2161 * class.c (adjust_clone_args): Remove obviously
2163 (dump_class_hierarchy_r): Likewise.
2164 * decl.c (check_initializer): Likewise.
2165 * parser.c (cp_parser_lambda_expression): Likewise.
2166 * pt.c (unify_bound_ttp_args): Likewise.
2167 (convert_template_argument): Likewise.
2168 * rtti.c (build_headof): Likewise.
2169 * typeck.c (convert_for_initialization): Likewise.
2171 2019-06-25 Jason Merrill <jason@redhat.com>
2173 PR c++/70462 - unnecessary base ctor variant with final.
2174 * optimize.c (populate_clone_array): Skip base variant if
2176 (maybe_clone_body): We don't need an alias if we are only defining
2179 * class.c (resolves_to_fixed_type_p): Check CLASSTYPE_FINAL.
2181 2019-06-25 Jakub Jelinek <jakub@redhat.com>
2184 * constexpr.c (cxx_eval_array_reference): Don't look through VCE from
2185 vector type if lval.
2187 2019-06-25 Jozef Lawrynowicz <jozef.l@mittosystems.com>
2189 * lex.c (init_reswords): Create keyword for "__intN__" type.
2190 * cp-tree.h (cp_decl_specifier_seq): New bitfield "int_n_alt".
2191 * decl.c (grokdeclarator): Don't pedwarn about "__intN" ISO
2192 C incompatibility if alternate "__intN__" form is used.
2193 * parser.c (cp_parser_simple_type_specifier): Set
2194 decl_specs->int_n_alt if "__intN__" form is used.
2196 2019-06-24 Jan Hubicka <jh@suse.cz>
2198 * lex.c (cxx_make_type): Set TYPE_CXX_ODR_P.
2200 2019-06-24 Jason Merrill <jason@redhat.com>
2202 * class.c (layout_class_type): Don't use a separate
2203 CLASSTYPE_AS_BASE if it's the same size.
2205 2019-06-23 Marek Polacek <polacek@redhat.com>
2207 * call.c (convert_default_arg): Use DEFERRED_PARSE instead of
2209 * cp-objcp-common.c (cp_tree_size): Likewise. Use tree_deferred_parse
2210 instead of tree_default_arg.
2211 * cp-tree.def: Rename DEFAULT_ARG to DEFERRED_PARSE.
2212 * cp-tree.h: Rename DEFARG_TOKENS to DEFPARSE_TOKENS. Rename
2213 DEFARG_INSTANTIATIONS to DEFPARSE_INSTANTIATIONS. Rename
2214 tree_default_arg to tree_deferred_parse.
2215 (UNPARSED_NOEXCEPT_SPEC_P): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2216 (cp_tree_node_structure_enum): Rename TS_CP_DEFAULT_ARG to
2217 TS_CP_DEFERRED_PARSE.
2218 (lang_tree_node): Rename tree_default_arg to tree_deferred_parse.
2219 Rename default_arg to deferred_parse. Use TS_CP_DEFERRED_PARSE instead
2220 of TS_CP_DEFAULT_ARG.
2221 (defarg_location): Remove declaration.
2222 (defparse_location): Add declaration.
2223 * decl.c (grokfndecl): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2224 Call defparse_location instead of defarg_location.
2225 (check_default_argument): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2226 (cp_tree_node_structure): Likewise. Use TS_CP_DEFERRED_PARSE instead
2227 of TS_CP_DEFAULT_ARG.
2228 * decl2.c (grokfield): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2229 * error.c (dump_expr): Likewise.
2230 (location_of): Likewise.
2231 * init.c (get_nsdmi): Likewise.
2232 * parser.c (cp_parser_save_noexcept): Likewise. Use DEFPARSE_TOKENS
2233 instead of DEFARG_TOKENS.
2234 (cp_parser_late_noexcept_specifier): Likewise.
2235 (cp_parser_late_parse_one_default_arg): Use DEFPARSE_TOKENS instead
2237 (cp_parser_late_parsing_default_args): Use DEFERRED_PARSE instead of
2238 DEFAULT_ARG. Use DEFPARSE_INSTANTIATIONS instead of
2239 DEFARG_INSTANTIATIONS.
2240 (cp_parser_cache_defarg): Use DEFERRED_PARSE instead of DEFAULT_ARG.
2241 Use DEFPARSE_TOKENS instead of DEFARG_TOKENS. Use
2242 DEFPARSE_INSTANTIATIONS instead of DEFARG_INSTANTIATIONS.
2243 (defparse_location): Renamed from defarg_location.
2244 * pt.c (tsubst_default_argument): Use DEFERRED_PARSE instead of
2246 (tsubst_arg_types): Likewise.
2247 (dependent_type_p_r): Likewise.
2248 * tree.c (cp_tree_equal): Likewise.
2249 (cp_walk_subtrees): Likewise.
2250 * typeck.c (convert_arguments): Likewise.
2252 2019-06-22 Marek Polacek <polacek@redhat.com>
2254 PR c++/86476 - noexcept-specifier is a complete-class context.
2256 * cp-tree.def (DEFAULT_ARG): Update commentary.
2257 * cp-tree.h (UNPARSED_NOEXCEPT_SPEC_P): New macro.
2258 (tree_default_arg): Use tree_base instead of tree_common.
2259 (do_push_parm_decls, maybe_check_overriding_exception_spec): Declare.
2260 * decl.c (do_push_parm_decls): New function, broken out of...
2261 (store_parm_decls): ...here. Call it.
2262 * except.c (nothrow_spec_p): Accept DEFAULT_ARG in the assert.
2263 * parser.c (cp_parser_noexcept_specification_opt,
2264 cp_parser_late_noexcept_specifier, noexcept_override_late_checks):
2266 (unparsed_noexcepts): New macro.
2267 (push_unparsed_function_queues): Update initializer.
2268 (cp_parser_direct_declarator): Pass FRIEND_P to
2269 cp_parser_exception_specification_opt.
2270 (inject_parm_decls): New.
2271 (pop_injected_parms): New.
2272 (cp_parser_class_specifier_1): Implement delayed parsing of
2273 noexcept-specifiers.
2274 (cp_parser_save_noexcept): New.
2275 (cp_parser_late_noexcept_specifier): New.
2276 (noexcept_override_late_checks): New.
2277 (cp_parser_noexcept_specification_opt): Add FRIEND_P parameter. Call
2278 cp_parser_save_noexcept instead of the normal processing if needed.
2279 (cp_parser_exception_specification_opt): Add FRIEND_P parameter and
2280 pass it to cp_parser_noexcept_specification_opt.
2281 (cp_parser_save_member_function_body): Fix comment.
2282 (cp_parser_save_default_args): Maybe save the noexcept-specifier to
2284 (cp_parser_transaction): Update call to
2285 cp_parser_noexcept_specification_opt.
2286 (cp_parser_transaction_expression): Likewise.
2287 * parser.h (cp_unparsed_functions_entry): Add new field to carry
2288 a noexcept-specifier.
2289 * pt.c (dependent_type_p_r): Handle unparsed noexcept expression.
2290 * search.c (maybe_check_overriding_exception_spec): New function, broken
2292 (check_final_overrider): ...here. Call
2293 maybe_check_overriding_exception_spec.
2294 * tree.c (canonical_eh_spec): Handle UNPARSED_NOEXCEPT_SPEC_P.
2295 (cp_tree_equal): Handle DEFAULT_ARG.
2297 PR c++/90881 - bogus -Wunused-value in unevaluated context.
2298 * cvt.c (convert_to_void): Don't emit unused warnings in
2299 an unevaluated context.
2301 2019-06-22 Paolo Carlini <paolo.carlini@oracle.com>
2303 * decl.c (grokdeclarator): Use id_loc, typespec_loc, and
2304 locations[ds_storage_class] in a few additional places.
2306 2019-06-21 Paolo Carlini <paolo.carlini@oracle.com>
2310 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com>
2314 * call.c (build_over_call): Devirtualize when the final overrider
2315 comes from the base.
2317 2019-06-21 Marek Polacek <polacek@redhat.com>
2319 PR c++/61490 - qualified-id in friend function definition.
2320 * decl.c (grokdeclarator): Diagnose qualified-id in friend function
2321 definition. Improve location for diagnostics of friend functions.
2323 PR c++/60223 - ICE with T{} in non-deduced context.
2324 * pt.c (unify): Allow COMPOUND_LITERAL_P in a non-deduced context.
2326 PR c++/64235 - missing syntax error with invalid alignas.
2327 * parser.c (cp_parser_std_attribute_spec): Commit to tentative parse
2328 if there's a missing close paren.
2330 PR c++/90490 - fix decltype issues in noexcept-specifier.
2331 * except.c (build_noexcept_spec): Call
2332 instantiate_non_dependent_expr_sfinae before
2333 build_converted_constant_expr instead of calling
2334 instantiate_non_dependent_expr after it. Add
2335 processing_template_decl_sentinel.
2337 2019-06-21 Jakub Jelinek <jakub@redhat.com>
2340 * semantics.c (finish_omp_clauses): Don't reject references to
2341 incomplete types if processing_template_decl.
2343 2019-06-19 Marek Polacek <polacek@redhat.com>
2345 PR c++/60364 - noreturn after first decl not diagnosed.
2346 * decl.c (duplicate_decls): Give an error when a function is
2347 declared [[noreturn]] after its first declaration.
2348 * parser.c (cp_parser_std_attribute): Don't treat C++11 noreturn
2349 attribute as equivalent to GNU's.
2350 * tree.c (std_attribute_table): Add noreturn.
2352 2019-06-19 Jakub Jelinek <jakub@redhat.com>
2354 * cp-gimplify.c (cp_genericize_r): Handle OMP_CLAUSE_{IN,EX}CLUSIVE
2355 like OMP_CLAUSE_SHARED.
2357 2019-06-18 Jason Merrill <jason@redhat.com>
2359 * constexpr.c (cxx_eval_store_expression): Delay target evaluation.
2361 2019-06-18 Jason Merrill <jason@redhat.com>
2363 * constexpr.c (eval_and_check_array_index): Split out from...
2364 (cxx_eval_array_reference): ...here.
2365 (cxx_eval_store_expression): Use it here, too.
2366 (diag_array_subscript): Take location. Strip location wrapper.
2368 2019-06-18 Jason Merrill <jason@redhat.com>
2370 * constexpr.c (cxx_eval_constant_expression): Handle conversion from
2371 and then to the same type.
2373 2019-06-18 Jason Merrill <jason@redhat.com>
2375 * constexpr.c (unshare_constructor): Add MEM_STAT_DECL.
2377 2019-06-17 Jakub Jelinek <jakub@redhat.com>
2379 * semantics.c (finish_omp_clauses): For OMP_CLAUSE_REDUCTION_INSCAN
2380 set need_copy_assignment.
2382 2019-06-17 Marek Polacek <polacek@redhat.com>
2384 PR c++/83820 - excessive attribute arguments not detected.
2385 * parser.c (cp_parser_std_attribute): Detect excessive arguments.
2387 2019-06-17 Nathan Sidwell <nathan@acm.org>
2390 * name-lookup.c (lookup_type_scope_1): Calll qualify_lookup before
2393 2019-06-14 Marek Polacek <polacek@redhat.com>
2395 PR c++/90884 - stray note with -Wctor-dtor-privacy.
2396 * class.c (maybe_warn_about_overly_private_class): Guard the call to
2399 2019-06-12 Jason Merrill <jason@redhat.com>
2401 PR c++/85552 - wrong instantiation of dtor for DMI.
2402 * typeck2.c (digest_nsdmi_init): Set tf_no_cleanup for direct-init.
2404 2019-06-13 Paolo Carlini <paolo.carlini@oracle.com>
2406 * decl.c (grokdeclarator): Use id_loc in five additional places
2407 in the last part of the function.
2409 2019-06-13 Paolo Carlini <paolo.carlini@oracle.com>
2411 * decl.c (grokdeclarator): Move further up the declaration of
2412 id_loc, use it immediately, update its value after the loop
2413 over declarator, use it again in the final part of function;
2414 improve locations of error messages about multiple data types
2415 and conflicting specifiers.
2417 2019-06-13 Richard Biener <rguenther@suse.de>
2420 * typeck2.c (split_nonconstant_init_1): Properly count
2421 num_split_elts, optimize single constructor elt removal.
2423 2019-06-12 Marek Polacek <polacek@redhat.com>
2425 PR c++/66999 - 'this' captured by reference.
2426 * parser.c (cp_parser_lambda_introducer): Reject `&this'. Use
2427 cp_lexer_nth_token_is instead of cp_lexer_peek_nth_token.
2429 PR c++/90825 - endless recursion when evaluating sizeof.
2430 PR c++/90832 - endless recursion when evaluating sizeof.
2431 * constexpr.c (cxx_eval_constant_expression): Don't recurse on the
2432 result of fold_sizeof_expr if is returns a SIZEOF_EXPR.
2433 * typeck.c (cxx_sizeof_expr): Only return a SIZEOF_EXPR if the operand
2434 is instantiation-dependent.
2436 PR c++/90736 - bogus error with alignof.
2437 * constexpr.c (adjust_temp_type): Use cv_unqualified type.
2439 2019-06-11 Matthew Beliveau <mbelivea@redhat.com>
2441 PR c++/90449 - add -Winaccessible-base option.
2442 * class.c (warn_about_ambiguous_bases): Changed name to:
2443 maybe_warn_about_inaccessible_bases.
2444 (maybe_warn_about_inaccessible_bases): Implemented new
2445 Winaccessible-base warning option for both direct and virtual
2447 (layout_class_type): Call to warn_about_ambiguous_bases changed to fit
2450 2019-06-11 Richard Biener <rguenther@suse.de>
2453 * typeck2.c (split_nonconstant_init_1): Avoid ordered remove
2454 from CONSTRUCTOR by marking to remove elements and doing all
2455 of them in a O(n) scan.
2457 2019-06-11 Jakub Jelinek <jakub@redhat.com>
2460 * init.c (constant_value_1): Handle VECTOR_CST DECL_INITIAL for
2461 !DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P decls like CONSTRUCTOR.
2463 2019-06-11 Martin Liska <mliska@suse.cz>
2466 * pt.c (init_template_processing): Disable hash table
2467 sanitization for decl_specializations and type_specializations.
2469 2019-06-10 Jason Merrill <jason@redhat.com>
2471 * constexpr.c (free_constructor): New.
2472 (cxx_eval_call_expression): Free parameter value CONSTRUCTORs.
2474 * constexpr.c (unshare_constructor): Only unshare if T is itself a
2476 (cxx_eval_call_expression): Don't call it on the result here.
2478 Reduce constexpr_call memory consumption.
2479 * constexpr.c (cxx_bind_parameters_in_call): Use TREE_VEC rather
2481 (constexpr_call_hasher::equal, cxx_bind_parameters_in_call)
2482 (cxx_eval_call_expression): Adjust.
2484 2019-06-10 Jakub Jelinek <jakub@redhat.com>
2486 * parser.c (cp_parser_omp_clause_reduction): Don't sorry_at on inscan
2488 (cp_parser_omp_scan_loop_body): New function.
2489 (cp_parser_omp_for_loop): Call cp_parser_omp_scan_loop_body if there
2490 are inscan reduction clauses.
2491 (cp_parser_pragma): Reject PRAGMA_OMP_SCAN.
2492 * semantics.c (finish_omp_clauses): Reject mixing inscan with
2493 non-inscan reductions on the same construct, or inscan reductions with
2494 ordered or schedule clauses, or inscan array reductions.
2495 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_{IN,EX}CLUSIVE.
2496 (tsubst_expr): Handle OMP_SCAN.
2498 2019-06-07 Jason Merrill <jason@redhat.com>
2500 * constexpr.c (cxx_eval_constant_expression): Call
2501 STRIP_ANY_LOCATION_WRAPPER early.
2502 [CONVERT_EXPR]: Don't build anything for conversion to void.
2503 [ADDR_EXPR]: ggc_free unused ADDR_EXPR.
2505 2019-06-05 Martin Sebor <msebor@redhat.com>
2508 * typeck.c (maybe_warn_about_returning_address_of_local): Only
2509 consider functions returning pointers as candidates for
2510 -Wreturn-local-addr.
2512 2019-06-05 Paolo Carlini <paolo.carlini@oracle.com>
2514 * decl.c (smallest_type_location): New.
2515 (check_special_function_return_type): Use it.
2516 (grokdeclarator): Lkewise.
2518 2019-06-05 Paolo Carlini <paolo.carlini@oracle.com>
2520 * decl.c (grokdeclarator): Use locations[ds_friend]
2523 2019-06-05 Martin Sebor <msebor@redhat.com>
2525 * call.c (build_conditional_expr_1): Adjust quoting and hyphenation.
2526 (convert_like_real): Same.
2527 (convert_arg_to_ellipsis): Same.
2528 * constexpr.c (diag_array_subscript): Same.
2529 * constraint.cc (diagnose_trait_expression): Same.
2530 * cvt.c (ocp_convert): Same.
2531 * decl.c (start_decl): Same.
2532 (check_for_uninitialized_const_var): Same.
2534 (check_special_function_return_type): Same.
2535 (finish_enum_value_list): Same.
2536 (start_preparsed_function): Same.
2537 * parser.c (cp_parser_decl_specifier_seq): Same.
2538 * typeck.c (cp_build_binary_op): Same.
2539 (build_static_cast_1): Same.
2541 2019-06-04 Nina Dinka Ranns <dinka.ranns@gmail.com>
2543 PR c++/63149 - Wrong auto deduction from braced-init-list.
2544 * pt.c (listify_autos): use non cv qualified auto_node in
2545 std::initializer_list<auto>.
2547 2019-06-04 Paolo Carlini <paolo.carlini@oracle.com>
2549 * decl.c (grokdeclarator): Use declarator->id_loc in two
2552 2019-06-04 Nathan Sidwell <nathan@acm.org>
2554 * name-lookup.c (lookup_type_scope_1): Reimplement, handle local
2555 and namespace scopes separately.
2557 2019-06-04 Harald van Dijk <harald@gigawatt.nl>
2559 PR c++/60531 - Wrong error about unresolved overloaded function
2560 * typeck.c (cp_build_binary_op): See if overload can be resolved.
2561 (cp_build_unary_op): Ditto.
2563 2019-06-04 Jason Merrill <jason@redhat.com>
2565 Reduce accumulated garbage in constexpr evaluation.
2566 * constexpr.c (cxx_eval_call_expression): ggc_free any bindings we
2568 (cxx_eval_increment_expression): ggc_free the MODIFY_EXPR after
2571 2019-06-04 Jakub Jelinek <jakub@redhat.com>
2573 * cp-tree.h (CP_OMP_CLAUSE_INFO): Allow for any clauses up to _condvar_
2574 instead of only up to linear.
2576 2019-06-03 Paolo Carlini <paolo.carlini@oracle.com>
2578 * parser.c (cp_parser_unqualified_id): Use build_min_nt_loc in
2581 2019-06-01 Ville Voutilainen <ville.voutilainen@gmail.com>
2584 * class.c (fixup_type_variants): Handle CLASSTYPE_FINAL.
2586 2019-05-31 Nathan Sidwell <nathan@acm.org>
2588 * cp-tree.h (IDENTIFIER_LAMBDA_P): New.
2590 (LAMBDA_TYPE_P, TYPE_UNNAMED_P): Likewise.
2591 (LAMBDANAME_PREFIX, LAMBDANAME_FORMAT): Delete.
2592 (make_lambda_name): Don't declare.
2593 * error.c (dump_aggr_type): Check for lambdas before other
2595 * lambda.c (begin_lambda_type): Use make_anon_name.
2596 * cp-lang.c (cxx_dwarf_name): Lambda names smell anonymous.
2597 * mangle.c (write_local_name): Likewise.
2598 * name-lookup.c (lambda_cnt, make_lambda_name): Delete.
2600 2019-05-30 Marek Polacek <polacek@redhat.com>
2602 * cp-tree.h (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Fix a typo.
2604 2019-05-31 Paolo Carlini <paolo.carlini@oracle.com>
2606 * decl.c (grokdeclarator): Use declarator->id_loc in five
2609 2019-05-29 Jakub Jelinek <jakub@redhat.com>
2612 * tree.c (lvalue_kind): Return clk_none for expressions with
2615 2019-05-29 Paolo Carlini <paolo.carlini@oracle.com>
2618 * parser.c (cp_parser_sizeof_operand): When the type-id production
2619 did not work out commit to the tentative parse.
2621 2019-05-29 Jakub Jelinek <jakub@redhat.com>
2623 P1091R3 - Extending structured bindings to be more like var decls
2624 P1381R1 - Reference capture of structured bindings
2625 * decl.c (cp_maybe_mangle_decomp): Handle TREE_STATIC decls even at
2627 (cp_finish_decomp): Copy over various decl properties from decl to
2628 v[i] in the tuple case.
2629 (grokdeclarator): Allow static, thread_local and __thread for C++2a
2630 and use pedwarn instead of error for older standard revisions.
2631 Make other structured binding diagnostic messages more i18n friendly.
2633 2019-05-28 Nathan Sidwell <nathan@acm.org>
2635 * decl.c (duplicate_decls): Assert a template newdecl has no
2638 2019-05-28 Marek Polacek <polacek@redhat.com>
2640 PR c++/90548 - ICE with generic lambda and empty pack.
2641 * pt.c (tsubst_copy_and_build): Handle pack expansion properly.
2643 2019-05-28 Nathan Sidwell <nathan@acm.org>
2645 * cp-tree.h (make_anon_name): Drop declaration.
2646 (TYPE_UNNAMED_P): Use IDENTIFIER_ANON_P.
2647 * cp-lang.c (cxx_dwarf_name): Likewise.
2648 * class.c (find_flexarrays): Likewise.
2649 * decl.c (name_unnamed_type, xref_tag_1): Likewise.
2650 * error.c (dump_aggr_type): Likewise.
2651 * pt.c (push_template_decl_real): Likewise.
2652 * name-lookup.c (consider_binding_level): Likewise.
2653 (anon_cnt, make_anon_name): Delete.
2655 2019-05-25 Marek Polacek <polacek@redhat.com>
2657 PR c++/90572 - wrong disambiguation in friend declaration.
2658 * parser.c (cp_parser_constructor_declarator_p): Don't allow missing
2659 typename for friend declarations.
2661 2019-05-23 Jonathan Wakely <jwakely@redhat.com>
2663 * cp-tree.h (CP_AGGREGATE_TYPE_P): Fix whitespace.
2665 * init.c (std_placement_new_fn_p): Remove outdated TODO comment that
2666 was resolved by r254694.
2668 2019-05-22 Jason Merrill <jason@redhat.com>
2670 PR c++/20408 - unnecessary code for empty struct.
2671 * call.c (build_call_a): Use simple_empty_class_p.
2673 PR c++/86485 - -Wmaybe-unused with empty class ?:
2674 * cp-gimplify.c (simple_empty_class_p): Also true for MODIFY_EXPR.
2676 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com>
2678 * parser.c (cp_parser_template_declaration_after_parameters): Use
2679 DECL_SOURCE_LOCATION in literal operator template errors.
2681 2019-05-21 Paolo Carlini <paolo.carlini@oracle.com>
2685 * call.c (build_over_call): Devirtualize when the final overrider
2686 comes from the base.
2688 2019-05-21 Nathan Sidwell <nathan@acm.org>
2690 * name-lookup.c (do_nonmember_using_decl): Drop INSERT_P
2691 parameter. Document.
2692 (finish_nonmember_using_decl): Adjust do_nonmember_using_decl
2693 calls. Remove stray FIXME comment.
2695 * name-lookup.h (struct cp_binding_level): Drop usings field.
2696 (finish_namespace_using_decl, finish_local_using_decl): Replace with ...
2697 (finish_nonmember_using_decl): ... this.
2698 * name-lookup.c (push_using_decl_1, push_using_decl):
2699 (do_nonmember_using_decl): ... here. Add INSERT_P arg. Reimplement.
2700 (validate_nonmember_using_decl, finish_namespace_using_decl)
2701 (finish_local_using_decl): Replace with ...
2702 (finish_nonmember_using_decl): ... this. Drop DECL parm.
2703 * parser.c (cp_parser_using_declaration): Don't do lookup here.
2704 * pt.c (tsubst_expr): Do not do using decl lookup here.
2706 2019-05-21 Eric Botcazou <ebotcazou@adacore.com>
2708 * decl2.c (cpp_check) <IS_ASSIGNMENT_OPERATOR>: New case.
2710 2019-05-20 Marek Polacek <polacek@redhat.com>
2712 CWG 2094 - volatile scalars are trivially copyable.
2714 * tree.c (trivially_copyable_p): Don't check CP_TYPE_VOLATILE_P for
2717 2019-05-20 Marek Polacek <polacek@redhat.com>
2719 * pt.c (convert_template_argument): Add a diagnostic for the
2720 [temp.arg]/2 ambiguity case.
2722 * name-lookup.c (finish_using_directive): Don't issue inform() if the
2723 warning didn't trigger. Add quoting. Tweak the inform message.
2725 2019-05-20 Paolo Carlini <paolo.carlini@oracle.com>
2727 * cp-tree.h: Remove remnants of CONV_NONCONVERTING.
2729 2019-05-20 Nathan Sidwell <nathan@acm.org>
2731 * name-lookup.c (finish_namespace_using_directive)
2732 (finish_local_using_directive): Merge to ...
2733 (finish_using_directive): ... here. Handle both contexts.
2734 * name-lookup.h (finish_namespace_using_directive)
2735 (finish_local_using_directive): Replace with ...
2736 (finish_using_directive): ... this.
2737 * parser.c (cp_parser_using_directive): Adjust.
2738 * pt.c (tsubst_expr): Likewise.
2740 * cp-tree.h (struct lang_decl_ns): Remove usings field.
2741 (DECL_NAMESPACE_USING): Delete.
2742 * name-lookup.c (name_lookup::search_usings): Use namespace's
2744 (name_lookup::queue_namespae): Likewise.
2745 (finish_namespace_using_directive, push_namespace): Likewise.
2746 (has_using_namespace_std_directive): Just search the entire
2749 2019-05-20 Jonathan Wakely <jwakely@redhat.com>
2751 PR c++/90532 Ensure __is_constructible(T[]) is false
2752 * method.c (is_xible_helper): Return error_mark_node for construction
2753 of an array of unknown bound.
2755 2019-05-17 Thomas Schwinge <thomas@codesourcery.com>
2758 * parser.c (cp_finalize_oacc_routine): Rework checking if already
2759 marked with an OpenACC 'routine' directive.
2762 * parser.c (cp_parser_oacc_routine)
2763 (cp_parser_late_parsing_oacc_routine): Normalize order of clauses.
2764 (cp_finalize_oacc_routine): Call oacc_verify_routine_clauses.
2767 * parser.c (cp_finalize_oacc_routine): Refer to OpenACC 'routine'
2768 clauses from "omp declare target" attribute.
2770 2019-05-16 Martin Sebor <msebor@redhat.com>
2772 * call.c (print_z_candidate): Wrap diagnostic text in a gettext
2774 (print_z_candidates): Same.
2775 (build_conditional_expr_1): Quote keywords, operators, and types
2777 (build_op_delete_call): Same.
2778 (maybe_print_user_conv_context): Wrap diagnostic text in a gettext
2780 (convert_like_real): Same.
2781 (convert_arg_to_ellipsis): Quote keywords, operators, and types
2783 (build_over_call): Same.
2784 (joust): Break up an overlong line. Wrap diagnostic text in a gettext
2786 * constexpr.c (cxx_eval_check_shift_p): Spell out >= in English.
2787 (cxx_eval_constant_expression): Quote keywords, operators, and types
2789 (potential_constant_expression_1): Same.
2790 * cp-gimplify.c (cp_genericize_r): Same.
2791 * cvt.c (maybe_warn_nodiscard): Quote keywords, operators, and types
2793 (type_promotes_to): Same.
2794 * decl.c (check_previous_goto_1): Same.
2797 (cp_finish_decl): Avoid parenthesizing a sentence for consistency.
2798 (grok_op_properties): Quote keywords, operators, and types
2800 * decl2.c (grokfield): Same.
2801 (coerce_delete_type): Same.
2802 * except.c (is_admissible_throw_operand_or_catch_parameter): Same.
2803 * friend.c (do_friend): Quote C++ tokens.
2804 * init.c (build_new_1): Quote keywords, operators, and types
2806 (build_vec_delete_1): Same.
2807 (build_delete): Same.
2808 * lex.c (parse_strconst_pragma): Same.
2809 (handle_pragma_implementation): Same.
2810 (unqualified_fn_lookup_error): Same.
2811 * mangle.c (write_type): Same.
2812 * method.c (defaulted_late_check): Avoid two consecutive punctuators.
2813 * name-lookup.c (cp_binding_level_debug): Remove a trailing newline.
2814 (pop_everything): Same.
2815 * parser.c (cp_lexer_start_debugging): Quote a macro name.
2817 (cp_lexer_stop_debugging): Same.
2818 (cp_parser_userdef_numeric_literal): Quote a C++ header name
2820 (cp_parser_nested_name_specifier_opt): Quote keywords, operators,
2821 and types in diagnostics.
2822 (cp_parser_question_colon_clause): Same.
2823 (cp_parser_asm_definition): Same.
2824 (cp_parser_init_declarator): Same.
2825 (cp_parser_template_declaration_after_parameters): Avoid capitalizing
2826 a sentence in a diagnostic.
2827 (cp_parser_omp_declare_reduction): Quote keywords, operators, and types
2829 (cp_parser_transaction): Same.
2830 * pt.c (maybe_process_partial_specialization): Replace second call
2831 to permerror with inform for consistency with other uses.
2832 (expand_integer_pack): Quote keywords, operators, and types
2834 * rtti.c (get_typeid): Quote keywords, operators, and types
2836 (build_dynamic_cast_1): Same.
2837 * semantics.c (finish_asm_stmt): Same.
2838 (finish_label_decl): Same.
2839 (finish_bases): Same.
2840 (finish_offsetof): Same.
2841 (cp_check_omp_declare_reduction): Same.
2842 (finish_decltype_type): Same.
2843 * tree.c (handle_init_priority_attribute): Same. Add detail
2845 (maybe_warn_zero_as_null_pointer_constant): Same.
2846 * typeck.c (cp_build_binary_op): Quote keywords, operators, and types
2848 (cp_build_unary_op): Same.
2849 (check_for_casting_away_constness): Same.
2850 (build_static_cast): Same.
2851 (build_const_cast_1): Same.
2852 (maybe_warn_about_returning_address_of_local): Same.
2853 (check_return_expr): Same.
2854 * typeck2.c (abstract_virtuals_error_sfinae): Same.
2855 (digest_init_r): Replace a tab with spaces in a diagnostic.
2856 (build_functional_cast): Quote keywords, operators, and types
2859 2019-05-15 Jakub Jelinek <jakub@redhat.com>
2862 * cp-gimplify.c (genericize_cp_loop): Emit a DEBUG_BEGIN_STMT
2863 before the condition (or if missing or constant non-zero at the end
2864 of the loop. Emit a DEBUG_BEGIN_STMT before the increment expression
2865 if any. Don't call protected_set_expr_location on incr if it already
2868 2019-05-15 Marek Polacek <polacek@redhat.com>
2870 CWG 2096 - constraints on literal unions.
2871 * class.c (check_field_decls): Initialize booleans directly. A union
2872 is literal if at least one of its non-static data members is of
2873 non-volatile literal type.
2875 2019-05-15 Paolo Carlini <paolo.carlini@oracle.com>
2877 * cp-tree.h (REFERENCE_VLA_OK): Remove.
2878 * lambda.c (build_capture_proxy): Remove use of the above.
2880 2019-05-15 Paolo Carlini <paolo.carlini@oracle.com>
2882 * call.c (perform_overload_resolution, build_new_method_call_1):
2883 Use OVL_P; remove redundant TEMPLATE_DECL checks.
2884 * decl.c (grokfndecl): Likewise.
2885 * mangle.c (write_expression): Likewise.
2886 * parser.c (cp_parser_template_id): Likewise.
2887 * pt.c (resolve_overloaded_unification, type_dependent_expression_p):
2889 * search.c (build_baselink): Likewise.
2890 * tree.c (is_overloaded_fn, dependent_name, maybe_get_fns): Likewise.
2892 2019-05-14 Paolo Carlini <paolo.carlini@oracle.com>
2894 PR preprocessor/90382
2895 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
2898 2019-05-13 Jason Merrill <jason@redhat.com>
2900 Use releasing_vec more broadly.
2901 * cp-tree.h (struct releasing_vec): Replace get_ref method with
2903 (vec_safe_push, vec_safe_reserve, vec_safe_length, vec_safe_splice):
2904 Forwarding functions for releasing_vec.
2905 (release_tree_vector): Declare but don't define.
2906 * call.c (build_op_delete_call, build_temp, call_copy_ctor)
2907 (perform_direct_initialization_if_possible): Use releasing_vec.
2908 * constexpr.c (cxx_eval_vec_init_1, cxx_eval_store_expression):
2910 * cp-gimplify.c (cp_fold): Likewise.
2911 * cvt.c (force_rvalue, ocp_convert): Likewise.
2912 * decl.c (get_tuple_decomp_init): Likewise.
2913 * except.c (build_throw): Likewise.
2914 * init.c (perform_member_init, expand_default_init): Likewise.
2915 * method.c (do_build_copy_assign, locate_fn_flags): Likewise.
2916 * parser.c (cp_parser_userdef_char_literal)
2917 (cp_parser_userdef_numeric_literal)
2918 (cp_parser_userdef_string_literal)
2919 (cp_parser_perform_range_for_lookup)
2920 (cp_parser_range_for_member_function, cp_parser_omp_for_loop)
2921 (cp_parser_omp_for_loop_init): Likewise.
2922 * pt.c (tsubst_copy_and_build, do_class_deduction): Likewise.
2923 * semantics.c (calculate_direct_bases, calculate_bases)
2924 (finish_omp_barrier, finish_omp_flush, finish_omp_taskwait)
2925 (finish_omp_taskyield, finish_omp_cancel)
2926 (finish_omp_cancellation_point): Likewise.
2927 * tree.c (build_vec_init_elt, strip_typedefs, strip_typedefs_expr)
2928 (build_min_non_dep_op_overload): Likewise.
2929 * typeck.c (build_function_call_vec, cp_build_function_call_nary)
2930 (cp_build_modify_expr): Likewise.
2931 * typeck2.c (build_functional_cast): Likewise.
2933 2019-05-11 Paolo Carlini <paolo.carlini@oracle.com>
2935 * typeck.c (cp_build_function_call_vec): When mark_used fails
2936 unconditionally return error_mark_node.
2938 2019-05-10 Paolo Carlini <paolo.carlini@oracle.com>
2940 * decl.c (grokvardecl): Use an accurate location in error message
2941 about main as a global variable.
2943 2019-05-10 Paolo Carlini <paolo.carlini@oracle.com>
2945 * call.c (build_call_a): Use FUNC_OR_METHOD_TYPE_P.
2946 * cp-gimplify.c (cp_fold): Likewise.
2947 * cp-objcp-common.c (cp_type_dwarf_attribute): Likewise.
2948 * cp-tree.h (TYPE_OBJ_P, TYPE_PTROBV_P): Likewise.
2949 * cvt.c (perform_qualification_conversions): Likewise.
2950 * decl.c (grokdeclarator): Likewise.
2951 * decl2.c (build_memfn_type): Likewise.
2952 * mangle.c (canonicalize_for_substitution, write_type): Likewise.
2953 * parser.c (cp_parser_omp_declare_reduction): Likewise.
2954 * pt.c (check_explicit_specialization, uses_deducible_template_parms,
2955 check_cv_quals_for_unify, dependent_type_p_r): Likewise.
2956 * rtti.c (ptr_initializer): Likewise.
2957 * semantics.c (finish_asm_stmt, finish_offsetof,
2958 cp_check_omp_declare_reduction): Likewise.
2959 * tree.c (cp_build_qualified_type_real,
2960 cp_build_type_attribute_variant, cxx_type_hash_eq,
2961 cxx_copy_lang_qualifiers, cp_free_lang_data): Likewise.
2962 * typeck.c (structural_comptypes, convert_arguments,
2963 cp_build_addr_expr_1, unary_complex_lvalue, cp_build_c_cast,
2964 cp_build_modify_expr, comp_ptr_ttypes_real, type_memfn_rqual):
2967 2019-05-10 Marek Polacek <polacek@redhat.com>
2969 PR c++/78010 - bogus -Wsuggest-override warning on final function.
2970 * class.c (check_for_override): Don't warn for final functions.
2972 2019-05-10 Jakub Jelinek <jakub@redhat.com>
2975 * config-lang.in (gtfiles): Remove c-family/c-lex.c, add
2976 c-family/c-cppbuiltin.c.
2978 2019-05-09 Paolo Carlini <paolo.carlini@oracle.com>
2982 2018-04-26 Paolo Carlini <paolo.carlini@oracle.com>
2984 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
2987 2019-05-08 Nathan Sidwell <nathan@acm.org>
2989 Kill DECL_SAVED_FUNCTION_DATA .
2990 * cp-tree.h (language_function): Remove x_auto_return_pattern.
2991 (current_function_auto_return_pattern): Delete.
2992 (lang_decl_fn): Replace saved_language_function with
2993 saved_auto_return type.
2994 (DECL_SAVED_FUNCTION_DATA): Delete.
2995 (DECL_SAVED_AUTO_RETURN_TYPE): New.
2996 (FNDECL_USED_AUTO): Correct documentation.
2997 * decl.c (duplicate_decls): Adjust AUTO return handling.
2998 (start_preparsed_function): Replace
2999 current_function_auto_return_pattern with
3000 DECL_SAVED_AUTO_RETURN_TYPE. Remove DECL_SAVED_FUNCTION_DATA
3002 (finish_function): Likewise.
3003 (save_function_data): Delete.
3004 (fndecl_declared_return_type): Reimplement.
3005 * mangle.c (write_unqualified_name): Use DECL_SAVED_AUTO_RETURN_TYPE.
3006 * method.c (make_thunk, make_alias_for): Likewise.
3007 * parser.c (cp_parser_jump_statement): Likewise.
3008 * pt.c (do_auto_deduction): Likewise.
3009 * typeck.c (check_return_expr): Likewise.
3011 2019-05-06 Jason Merrill <jason@redhat.com>
3013 PR c++/90171 - reorganize usual_deallocation_fn_p
3014 * call.c (struct dealloc_info): New.
3015 (usual_deallocation_fn_p): Take a dealloc_info*.
3016 (aligned_deallocation_fn_p, sized_deallocation_fn_p): Remove.
3017 (build_op_delete_call): Adjust.
3019 2019-05-07 Jason Merrill <jason@redhat.com>
3021 PR c++/86485 - -Wmaybe-unused with empty class ?:
3022 * typeck.c (build_static_cast_1): Use cp_build_addr_expr.
3024 * pt.c (type_dependent_expression_p): A non-type template parm with
3025 a placeholder type is type-dependent.
3027 2019-05-06 Marek Polacek <polacek@redhat.com>
3029 PR c++/90265 - ICE with generic lambda.
3030 * pt.c (tsubst_copy_and_build): Use a dedicated variable for the last
3031 element in the vector.
3033 2019-05-03 Martin Liska <mliska@suse.cz>
3035 * call.c (build_aggr_conv): Use is_empty instead of
3036 elements () == 0 (and similar usages).
3037 * parser.c (cp_parser_lambda_introducer): Likewise.
3039 2019-05-02 Nathan Sidwell <nathan@acm.org>
3041 * semantics.c (finish_id_expression_1): Remove unreachable code.
3043 2019-05-01 Nathan Sidwell <nathan@acm.org>
3045 * name-lookup.h (get_class_binding_direct): Change final arg to
3047 (get_class_binding): Likewise.
3048 * name-lookup.c (get_class_binding_direct): Replace TYPE_OR_FNS
3049 arg with WANT_TYPE bool. Simplify.
3050 (get_class_binding): Adjust final arg.
3051 * decl.c (reshape_init_class): Adjust get_class_binding calls.
3053 2019-04-30 Nathan Sidwell <nathan@acm.org>
3055 * cp-objcp-common.c (cp_common_init_ts): Use MARK_TS_EXP for _EXPR
3056 nodes. Call c_common_init_ts.
3058 2019-04-29 Nathan Sidwell <nathan@acm.org>
3060 * decl.c (duplicate_decls): Add whitespace, move comments into
3062 * method.c (explain_implicit_non_constexpr): Refactor.
3063 * pt.c (check_explicit_specialization): Fix indentation.
3064 * semantics.c (process_outer_var_ref): Reformat.
3065 (finish_id_expression_1): Use STRIP_TEMPLATE.
3067 2019-04-26 Jonathan Wakely <jwakely@redhat.com>
3069 PR c++/90243 - orphaned note in uninstantiated constexpr function
3070 * decl.c (check_for_uninitialized_const_var): Suppress notes if no
3073 2019-04-26 Paolo Carlini <paolo.carlini@oracle.com>
3076 * decl.c (grokdeclarator): Set type to error_mark_node
3077 upon error about template placeholder type non followed
3078 by a simple declarator-id.
3080 2019-04-26 Paolo Carlini <paolo.carlini@oracle.com>
3082 * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
3085 2019-04-24 Jason Merrill <jason@redhat.com>
3087 PR c++/90227 - error with template parameter packs.
3088 * pt.c (coerce_template_parms): Do add empty pack when
3091 2019-04-24 Richard Biener <rguenther@suse.de>
3093 * call.c (null_ptr_cst_p): Order checks according to expensiveness.
3094 (conversion_null_warnings): Likewise.
3095 * typeck.c (same_type_ignoring_top_level_qualifiers_p): Return
3096 early if type1 == type2.
3098 2019-04-22 Jason Merrill <jason@redhat.com>
3100 PR c++/87366 - wrong error with alias template.
3101 * typeck.c (structural_comptypes): When comparing_specializations,
3102 aliases are unequal.
3103 (comptypes): When comparing_specializations, do structural
3106 2019-04-19 Jason Merrill <jason@redhat.com>
3108 PR c++/90190 - CTAD with list-constructor.
3109 * pt.c (do_class_deduction): Don't try the single element deduction
3110 if the single element is also a braced list.
3112 PR c++/90171 - ICE with destroying delete with size_t parm.
3113 * call.c (sized_deallocation_fn_p): New. Use it instead of
3114 second_parm_is_size_t in most cases.
3115 (second_parm_is_size_t): Don't check for aligned.
3117 2019-04-19 Paolo Carlini <paolo.carlini@oracle.com>
3120 * pt.c (fn_type_unification): When handling null explicit
3121 arguments do not special case non-parameter packs.
3123 2019-04-19 Jakub Jelinek <jakub@redhat.com>
3126 * pt.c (process_template_parm): Set decl to pushdecl result. If
3127 !is_non_type, also set parm to that.
3130 * decl.c (struct cp_switch): Remove outside_range_p member.
3131 (push_switch): Don't clear it.
3132 (pop_switch): Adjust c_do_switch_warnings caller.
3133 (finish_case_label): Adjust c_add_case_label caller.
3136 * decl.c (duplicate_decls): If remove is main variant and
3137 DECL_ORIGINAL_TYPE is some other type, remove a DECL_ORIGINAL_TYPE
3138 variant that has newdecl as TYPE_NAME if any.
3140 2019-04-18 Jason Merrill <jason@redhat.com>
3142 PR c++/87554 - ICE with extern template and reference member.
3143 * decl.c (cp_finish_decl): Don't set DECL_INITIAL of external vars.
3145 2019-04-17 Jason Merrill <jason@redhat.com>
3147 PR c++/90047 - ICE with enable_if alias template.
3148 * pt.c (tsubst_decl) [TYPE_DECL]: Don't put an erroneous decl in the
3149 hash table when we're in SFINAE context.
3151 2019-04-17 Marek Polacek <polacek@redhat.com>
3153 PR c++/90124 - bogus error with incomplete type in decltype.
3154 * typeck.c (build_class_member_access_expr): Check
3155 cp_unevaluated_operand.
3157 2019-04-12 Jakub Jelinek <jakub@redhat.com>
3160 * decl.c (duplicate_decls): When newdecl's type is its main variant,
3161 don't try to remove it from the variant list, but instead assert
3164 2019-04-12 Martin Sebor <msebor@redhat.com>
3168 * parser.c (cp_parser_has_attribute_expression): Handle assignment
3171 2019-04-12 Jason Merrill <jason@redhat.com>
3173 * call.c (null_member_pointer_value_p): Handle an empty CONSTRUCTOR
3176 2019-04-12 Marek Polacek <polacek@redhat.com>
3178 * except.c (build_noexcept_spec): Use build_converted_constant_bool_expr
3179 instead of perform_implicit_conversion_flags.
3181 PR c++/87603 - constexpr functions are no longer noexcept.
3182 * constexpr.c (is_sub_constant_expr): Remove unused function.
3183 * cp-tree.h (is_sub_constant_expr): Remove declaration.
3184 * except.c (check_noexcept_r): Don't consider a call to a constexpr
3187 2019-04-11 Jakub Jelinek <jakub@redhat.com>
3189 PR translation/90035
3190 * parser.h (struct cp_parser): Add
3191 type_definition_forbidden_message_arg member.
3192 * parser.c (cp_debug_parser): Print it.
3193 (cp_parser_check_type_definition): Pass
3194 parser->type_definition_forbidden_message_arg as second argument to
3196 (cp_parser_has_attribute_expression, cp_parser_sizeof_operand): Set
3197 parser->type_definition_forbidden_message_arg and use G_() with
3198 %qs for parser->type_definition_forbidden_message instead of
3199 building untranslatable message using concat.
3201 2019-04-09 Jakub Jelinek <jakub@redhat.com>
3203 PR translation/90011
3204 * typeck2.c (check_narrowing): Remove trailing space from diagnostics.
3206 2019-04-08 Marek Polacek <polacek@redhat.com>
3208 * typeck2.c (digest_init_r): Don't condition the object slicing warning
3211 2019-04-08 Paolo Carlini <paolo.carlini@oracle.com>
3214 * semantics.c (trait_expr_value): Don't use TYPE_NOTHROW_P
3215 when maybe_instantiate_noexcept fails.
3216 (classtype_has_nothrow_assign_or_copy_p): Likewise.
3217 * method.c (implicitly_declare_fn): Avoid passing error_mark_node
3218 to build_exception_variant.
3220 2019-04-05 Marek Polacek <polacek@redhat.com>
3222 PR c++/87145 - bogus error converting class type in template arg list.
3223 * pt.c (convert_nontype_argument): Don't call
3224 build_converted_constant_expr if it could involve calling a conversion
3225 function with a instantiation-dependent constructor as its argument.
3227 2019-04-05 Martin Sebor <msebor@redhat.com>
3230 * decl.c (reshape_init_array_1): Avoid treating empty strings
3231 as zeros in array initializers.
3232 Use trivial_type_p () instead of TYPE_HAS_TRIVIAL_DFLT().
3234 2019-04-04 Jason Merrill <jason@redhat.com>
3236 PR c++/89948 - ICE with break in statement-expr.
3237 * constexpr.c (cxx_eval_statement_list): Jumping out of a
3238 statement-expr is non-constant.
3240 2019-04-04 Jason Merrill <jason@redhat.com>
3242 PR c++/89966 - error with non-type auto tparm.
3243 * pt.c (do_auto_deduction): Clear tf_partial.
3245 2019-04-04 Jason Merrill <jason@redhat.com>
3247 PR c++/86986 - ICE with TTP with parameter pack.
3248 * pt.c (coerce_template_parameter_pack): Only look at the type of a
3249 non-type parameter pack.
3250 (fixed_parameter_pack_p_1): Don't recurse into the type of a
3251 non-type parameter pack.
3252 (coerce_template_template_parms): Call add_outermost_template_args.
3254 2019-04-04 Martin Sebor <msebor@redhat.com>
3260 * decl.c (reshape_init_array_1): Strip trailing zero-initializers
3261 from arrays of trivial type and known size.
3262 * mangle.c (write_expression): Convert braced initializer lists
3264 (write_expression): Trim trailing zero-initializers from arrays
3266 (write_template_arg_literal): Mangle strings the same as braced
3269 2019-04-03 Jason Merrill <jason@redhat.com>
3271 PR c++/81866 - ICE with member template and default targ.
3272 * pt.c (tsubst_template_decl): Handle getting a type from
3273 retrieve_specialization.
3275 PR c++/86586 - -fcompare-debug=-Wsign-compare.
3276 * typeck.c (cp_build_binary_op): Don't fold for -Wsign-compare.
3278 PR c++/89331 - ICE with offsetof in incomplete class.
3279 * semantics.c (finish_offsetof): Handle error_mark_node.
3280 * typeck.c (build_class_member_access_expr): Call
3281 complete_type_or_maybe_complain before converting to base.
3283 PR c++/89917 - ICE with lambda in variadic mem-init.
3284 * pt.c (make_pack_expansion): Change type_pack_expansion_p to false.
3286 2019-04-01 Jason Merrill <jason@redhat.com>
3288 PR c++/86946 - ICE with function call in template argument.
3290 * pt.c (iterative_hash_template_arg) [CALL_EXPR]: Use
3293 2019-04-01 Paolo Carlini <paolo.carlini@oracle.com>
3296 * pt.c (tsubst_copy): Deal with lookup_name not returing a variable.
3298 2019-03-31 Marek Polacek <polacek@redhat.com>
3300 PR c++/89852 - ICE with C++11 functional cast with { }.
3301 * constexpr.c (fold_non_dependent_expr_template): New static function
3303 (fold_non_dependent_expr): ...here.
3304 (fold_non_dependent_init): New function.
3305 * cp-tree.h (fold_non_dependent_init): Declare.
3306 * typeck2.c (massage_init_elt): Call fold_non_dependent_init instead
3307 of fold_non_dependent_expr. Don't call maybe_constant_init.
3309 2019-03-30 Jason Merrill <jason@redhat.com>
3311 PR c++/89744 - ICE with specialization of member class template.
3312 * pt.c (lookup_template_class_1): If the partial instantiation is
3313 explicitly specialized, adjust.
3314 (maybe_process_partial_specialization): Also adjust
3317 2019-03-29 Jakub Jelinek <jakub@redhat.com>
3320 * typeck.c: Include gimplify.h.
3321 (cp_build_modify_expr) <case COND_EXPR>: Unshare rhs before using it
3322 for second time. Formatting fixes.
3324 2019-03-29 Marek Polacek <polacek@redhat.com>
3326 PR c++/89876 - ICE with deprecated conversion.
3327 * call.c (convert_like_real): Only give warnings with tf_warning.
3329 2019-03-28 Marek Polacek <polacek@redhat.com>
3331 PR c++/89612 - ICE with member friend template with noexcept.
3332 * pt.c (maybe_instantiate_noexcept): For function templates, use their
3333 template result (function decl). Don't set up local specializations.
3334 Temporarily turn on processing_template_decl. Update the template type
3337 PR c++/89836 - bool constant expression and explicit conversions.
3338 * call.c (build_converted_constant_expr_internal): New function,
3340 (build_converted_constant_expr): ...this. New.
3341 (build_converted_constant_bool_expr): New.
3342 * cp-tree.h (build_converted_constant_bool_expr): Declare.
3343 * decl.c (build_explicit_specifier): Call
3344 build_converted_constant_bool_expr.
3346 2019-03-28 Jakub Jelinek <jakub@redhat.com>
3349 * constexpr.c (struct check_for_return_continue_data): New type.
3350 (check_for_return_continue): New function.
3351 (potential_constant_expression_1) <case SWITCH_STMT>: Walk
3352 SWITCH_STMT_BODY to find RETURN_EXPRs or CONTINUE_STMTs not nested
3353 in loop bodies and set *jump_target to that if found.
3355 2019-03-27 Jason Merrill <jason@redhat.com>
3357 PR c++/89831 - error with qualified-id in const member function.
3358 * semantics.c (finish_non_static_data_member): Use object cv-quals
3359 in scoped case, too.
3361 PR c++/89421 - ICE with lambda in template parameter list.
3362 * parser.c (cp_parser_lambda_expression): Also reject a lambda in a
3363 template parameter list before C++20.
3364 * pt.c (type_dependent_expression_p): True for LAMBDA_EXPR.
3365 * semantics.c (begin_class_definition): Restore error about defining
3366 non-lambda class in template parm list.
3368 2019-03-26 Jason Merrill <jason@redhat.com>
3370 PR c++/86932 - missed SFINAE with empty pack.
3371 * pt.c (coerce_template_parms): Don't add an empty pack if
3373 (fn_type_unification): Pass tf_partial to coerce_template_parms.
3375 PR c++/86429 - constexpr variable in lambda.
3378 * constexpr.c (cxx_eval_constant_expression): In a lambda function,
3379 try evaluating the captured variable directly.
3381 2019-03-26 Jakub Jelinek <jakub@redhat.com>
3384 * semantics.c (finish_omp_atomic): Add warning_sentinel for
3385 -Wunused-value around finish_expr_stmt call.
3387 2019-03-25 Paolo Carlini <paolo.carlini@oracle.com>
3391 * parser.c (cp_parser_binary_expression): Don't call cp_fully_fold
3392 to undo the disabling of warnings.
3394 2019-03-25 Jason Merrill <jason@redhat.com>
3396 PR c++/87748 - substitution failure error with decltype.
3397 * pt.c (most_specialized_partial_spec): Clear
3398 processing_template_decl.
3400 2019-03-25 Marek Polacek <polacek@redhat.com>
3402 PR c++/89214 - ICE when initializing aggregates with bases.
3403 * typeck2.c (digest_init_r): Warn about object slicing instead of
3406 PR c++/89705 - ICE with reference binding with conversion function.
3407 * call.c (reference_binding): If the result of the conversion function
3408 is a prvalue of non-class type, use the cv-unqualified type.
3410 2019-03-25 Nathan Sidwell <nathan@acm.org>
3412 * lambda.c (maybe_add_lambda_conv_op): Don't add to comdat group.
3414 2019-03-22 Jakub Jelinek <jakub@redhat.com>
3417 * cp-tree.h (get_tls_wrapper_fn): Remove declaration.
3418 (maybe_get_tls_wrapper_call): Declare.
3419 * decl2.c (get_tls_wrapper_fn): Make static.
3420 (maybe_get_tls_wrapper_call): New function.
3421 * typeck.c (build_class_member_access_expr): Handle accesses to TLS
3423 * semantics.c (finish_qualified_id_expr): Likewise.
3424 (finish_id_expression_1): Use maybe_get_tls_wrapper_call.
3425 * pt.c (tsubst_copy_and_build): Likewise.
3428 * constexpr.c (struct constexpr_ctx): Add constexpr_ops_count member.
3429 (cxx_eval_constant_expression): When not skipping, not constant class
3430 or location wrapper, increment *ctx->constexpr_ops_count and if it is
3431 above constexpr_loop_nest_limit, diagnose failure.
3432 (cxx_eval_outermost_constant_expr): Add constexpr_ops_count and
3433 initialize ctx.constexpr_ops_count to its address.
3434 (is_sub_constant_expr): Likewise.
3436 2019-03-21 Jakub Jelinek <jakub@redhat.com>
3439 * call.c (filed_in_pset): Change pset from hash_set<tree> * to
3440 hash_set<tree, true> &, adjust uses accordingly.
3441 (build_aggr_conv): Change pset from hash_set<tree> *
3442 to hash_set<tree, true>. Replace goto fail; with return NULL;,
3446 * parser.c (cp_parser_lambda_introducer): Add ids and first_capture_id
3447 variables, check for duplicates in this function.
3448 * lambda.c (add_capture): Don't check for duplicates nor use
3450 (register_capture_members): Don't clear IDENTIFIER_MARKED here.
3452 2019-03-21 Paolo Carlini <paolo.carlini@oracle.com>
3455 * method.c (after_nsdmi_defaulted_late_checks): Avoid passing
3456 error_mark_node to comp_except_specs.
3458 2019-03-20 Jason Merrill <jason@redhat.com>
3460 PR c++/87480 - decltype of member access in default template arg
3461 * pt.c (type_unification_real): Accept a dependent result in
3464 2019-03-19 Martin Sebor <msebor@redhat.com>
3466 PR tree-optimization/89688
3467 * typeck2.c (store_init_value): Call braced_lists_to_string for more
3468 kinds of initializers.
3470 2019-03-18 Jason Merrill <jason@redhat.com>
3472 PR c++/89630 - ICE with dependent using-decl as template arg.
3473 * tree.c (cp_tree_equal): Always return false for USING_DECL.
3475 PR c++/89761 - ICE with sizeof... in pack expansion.
3476 * pt.c (argument_pack_element_is_expansion_p): Handle
3477 ARGUMENT_PACK_SELECT.
3479 PR c++/89640 - GNU attributes on lambda.
3480 * parser.c (cp_parser_lambda_declarator_opt): Allow GNU attributes.
3482 PR c++/89682 - wrong access error in default argument.
3483 * pt.c (tsubst_default_argument): Don't defer access checks.
3485 2019-03-18 Paolo Carlini <paolo.carlini@oracle.com>
3488 * semantics.c (finish_non_static_data_member): Check return value
3489 of context_for_name_lookup and immediately return error_mark_node
3492 2019-03-17 Jason Merrill <jason@redhat.com>
3494 PR c++/89571 - ICE with ill-formed noexcept on constructor.
3495 * pt.c (maybe_instantiate_noexcept): Only return false if defaulted.
3496 (regenerate_decl_from_template): Use it for noexcept-specs.
3498 2019-03-14 Jason Merrill <jason@redhat.com>
3500 * parser.c (cp_parser_decl_specifier_seq): Support C++20
3501 concept-definition syntax without 'bool'.
3503 2019-03-14 Jakub Jelinek <jakub@redhat.com>
3506 * semantics.c (finish_qualified_id_expr): Reject variable templates.
3509 * constexpr.c (struct constexpr_ctx): Change save_exprs type from
3510 hash_set<tree> to vec<tree>.
3511 (cxx_eval_call_expression): Adjust for save_exprs being a vec instead
3513 (cxx_eval_loop_expr): Likewise. Truncate the vector after each
3514 removal of SAVE_EXPRs from values.
3515 (cxx_eval_constant_expression) <case SAVE_EXPR>: Call safe_push
3516 method on save_exprs instead of add.
3518 2019-03-13 Jason Merrill <jason@redhat.com>
3520 PR c++/86521 - C++17 copy elision in initialization by constructor.
3521 * call.c (joust_maybe_elide_copy): New.
3524 2019-03-13 Marek Polacek <polacek@redhat.com>
3526 PR c++/88979 - further P0634 fix for constructors.
3527 * parser.c (cp_parser_decl_specifier_seq): Pass flags to
3528 cp_parser_constructor_declarator_p.
3529 (cp_parser_direct_declarator): Allow missing typename for constructor
3531 (cp_parser_constructor_declarator_p): Add FLAGS parameter. Pass it to
3532 cp_parser_type_specifier.
3534 PR c++/89686 - mixing init-capture and simple-capture in lambda.
3535 * parser.c (cp_parser_lambda_introducer): Give error when combining
3536 init-capture and simple-capture.
3538 PR c++/89660 - bogus error with -Wredundant-move.
3539 * typeck.c (maybe_warn_pessimizing_move): Only accept (T &) &arg
3540 as the std::move's argument. Don't call convert_for_initialization
3541 when warn_redundant_move isn't on.
3543 2019-03-11 Jason Merrill <jason@redhat.com>
3545 PR c++/86521 - wrong overload resolution with ref-qualifiers.
3546 * call.c (build_user_type_conversion_1): Don't use a conversion to a
3547 reference of the wrong rvalueness for direct binding.
3549 2019-03-11 Martin Liska <mliska@suse.cz>
3551 * cvt.c (build_expr_type_conversion): Wrap apostrophes
3552 in gcc internal format with %'.
3553 * decl.c (check_no_redeclaration_friend_default_args): Likewise.
3554 (grokfndecl): Likewise.
3555 * name-lookup.c (do_pushtag): Likewise.
3556 * pt.c (unify_parameter_deduction_failure): Likewise.
3557 (unify_template_deduction_failure): Likewise.
3559 2019-03-11 Martin Liska <mliska@suse.cz>
3561 * call.c (convert_arg_to_ellipsis): Wrap an option name
3562 in a string format message and fix GNU coding style.
3563 (build_over_call): Likewise.
3564 * class.c (check_field_decl): Likewise.
3565 (layout_nonempty_base_or_field): Likewise.
3566 * constexpr.c (cxx_eval_loop_expr): Likewise.
3567 * cvt.c (type_promotes_to): Likewise.
3568 * decl.c (cxx_init_decl_processing): Likewise.
3569 (mark_inline_variable): Likewise.
3570 (grokdeclarator): Likewise.
3571 * decl2.c (record_mangling): Likewise.
3572 * error.c (maybe_warn_cpp0x): Likewise.
3573 * except.c (doing_eh): Likewise.
3574 * mangle.c (maybe_check_abi_tags): Likewise.
3575 * parser.c (cp_parser_diagnose_invalid_type_name): Likewise.
3576 (cp_parser_userdef_numeric_literal): Likewise.
3577 (cp_parser_primary_expression): Likewise.
3578 (cp_parser_unqualified_id): Likewise.
3579 (cp_parser_pseudo_destructor_name): Likewise.
3580 (cp_parser_builtin_offsetof): Likewise.
3581 (cp_parser_lambda_expression): Likewise.
3582 (cp_parser_lambda_introducer): Likewise.
3583 (cp_parser_lambda_declarator_opt): Likewise.
3584 (cp_parser_selection_statement): Likewise.
3585 (cp_parser_init_statement): Likewise.
3586 (cp_parser_decomposition_declaration): Likewise.
3587 (cp_parser_function_specifier_opt): Likewise.
3588 (cp_parser_static_assert): Likewise.
3589 (cp_parser_simple_type_specifier): Likewise.
3590 (cp_parser_namespace_definition): Likewise.
3591 (cp_parser_using_declaration): Likewise.
3592 (cp_parser_ctor_initializer_opt_and_function_body): Likewise.
3593 (cp_parser_initializer_list): Likewise.
3594 (cp_parser_type_parameter_key): Likewise.
3595 (cp_parser_member_declaration): Likewise.
3596 (cp_parser_try_block): Likewise.
3597 (cp_parser_std_attribute_spec): Likewise.
3598 (cp_parser_requires_clause_opt): Likewise.
3599 * pt.c (check_template_variable): Likewise.
3600 (check_default_tmpl_args): Likewise.
3601 (push_tinst_level_loc): Likewise.
3602 (instantiate_pending_templates): Likewise.
3603 (invalid_nontype_parm_type_p): Likewise.
3604 * repo.c (get_base_filename): Likewise.
3605 * rtti.c (typeid_ok_p): Likewise.
3606 (build_dynamic_cast_1): Likewise.
3607 * tree.c (maybe_warn_parm_abi): Likewise.
3609 2019-03-08 Jakub Jelinek <jakub@redhat.com>
3612 * parser.c (cp_parser_template_declaration_after_parameters): Avoid
3613 one space before " at the end of line and another after " on another
3614 line in a string literal.
3616 PR tree-optimization/89550
3617 * semantics.c (maybe_convert_cond): Only set TREE_NO_WARNING if
3618 warning_at returned true.
3619 * decl2.c (c_parse_final_cleanups): Likewise.
3620 * typeck.c (convert_for_assignment): Likewise.
3621 * decl.c (finish_function): Likewise.
3624 * parser.c (cp_parser_asm_definition): Just warn instead of error
3625 on volatile qualifier outside of function body.
3628 * constexpr.c (potential_constant_expression_1): Reject
3629 REINTERPRET_CAST_P NOP_EXPRs.
3632 * call.c (joust): Call print_z_candidate only if pedwarn returned
3635 2019-03-07 Jason Merrill <jason@redhat.com>
3637 PR c++/88123 - lambda and using-directive.
3638 * name-lookup.c (op_unqualified_lookup)
3639 (maybe_save_operator_binding, discard_operator_bindings)
3640 (push_operator_bindings): New.
3641 * typeck.c (build_x_binary_op, build_x_unary_op): Call
3642 maybe_save_operator_binding.
3643 * decl.c (start_preparsed_function): Call push_operator_bindings.
3644 * tree.c (cp_free_lang_data): Call discard_operator_bindings.
3646 PR c++/88820 - ICE with CTAD and member template used in DMI.
3647 * pt.c (do_class_deduction): Handle parm used as its own arg.
3649 2019-03-07 Jakub Jelinek <jakub@redhat.com>
3652 * parser.c (cp_parser_asm_definition): Parse asm qualifiers even
3653 at toplevel, but diagnose them.
3655 2019-03-06 Jason Merrill <jason@redhat.com>
3657 PR c++/89381 - implicit copy and using-declaration.
3658 * class.c (classtype_has_move_assign_or_move_ctor_p): Don't consider
3659 op= brought in by a using-declaration.
3661 2019-03-06 Jakub Jelinek <jakub@redhat.com>
3664 * init.c (build_value_init_noctor): Ignore flexible array members.
3666 2019-03-06 Jason Merrill <jason@redhat.com>
3668 PR c++/89576 - if constexpr of lambda capture.
3669 * semantics.c (maybe_convert_cond): Do convert a non-dependent
3670 condition in a template.
3671 * typeck.c (condition_conversion): Handle being called in a
3674 2019-03-06 Marek Polacek <polacek@redhat.com>
3676 PR c++/87378 - bogus -Wredundant-move warning.
3677 * typeck.c (maybe_warn_pessimizing_move): See if the maybe-rvalue
3678 overload resolution would actually succeed.
3680 2019-03-05 Jason Merrill <jason@redhat.com>
3682 * class.c (is_really_empty_class): Add ignore_vptr parm.
3683 (trivial_default_constructor_is_constexpr): Pass it.
3684 * call.c (build_over_call): Pass it.
3685 * constexpr.c (cxx_eval_constant_expression): Pass it instead of
3686 checking TYPE_POLYMORPHIC_P.
3687 (cxx_eval_component_reference, potential_constant_expression_1):
3689 * cp-gimplify.c (simple_empty_class_p): Pass it.
3690 * init.c (expand_aggr_init_1): Pass it.
3692 2019-03-04 Paolo Carlini <paolo.carlini@oracle.com>
3695 * parser.c (cp_parser_class_head): Reject TYPE_BEING_DEFINED too.
3697 2019-03-04 Jakub Jelinek <jakub@redhat.com>
3700 * call.c (field_in_pset): New function.
3701 (build_aggr_conv): Handle CONSTRUCTOR_IS_DESIGNATED_INIT correctly.
3703 2019-03-02 Jakub Jelinek <jakub@redhat.com>
3706 * cp-tree.h (CONSTRUCTOR_IS_DESIGNATED_INIT): Define.
3707 * parser.c (cp_parser_braced_list): Adjust cp_parser_initializer_list
3708 caller, set CONSTRUCTOR_IS_DESIGNATED_INIT.
3709 (cp_parser_initializer_list): Add designated parameter, set *designated
3710 to a bool whether any designators were parsed.
3711 * decl.c (reshape_init): Copy over CONSTRUCTOR_IS_DESIGNATED_INIT if
3713 * pt.c (tsubst_copy_and_build): Likewise.
3714 * call.c (implicit_conversion): If CONSTRUCTOR_IS_DESIGNATED_INIT,
3715 don't call build_list_conv, nor build_complex_conv, nor attempt to
3716 convert a single element initializer to scalar.
3718 2019-03-01 Marek Polacek <polacek@redhat.com>
3720 PR c++/89537 - missing location for error with non-static member fn.
3721 * call.c (resolve_args): Use EXPR_LOCATION.
3722 * typeck.c (build_class_member_access_expr): Use input_location.
3724 PR c++/89532 - ICE with incomplete type in decltype.
3725 * semantics.c (finish_compound_literal): Return error_mark_node
3726 if digest_init_flags returns error_mark_node.
3728 2019-03-01 Jakub Jelinek <jakub@redhat.com>
3730 Implement P1002R1, Try-catch blocks in constexpr functions
3732 * parser.c (cp_parser_ctor_initializer_opt_and_function_body):
3733 Diagnose constexpr ctor or function with function-try-block with
3734 pedwarn for c++17 and earlier. Formatting fix.
3735 (cp_parser_try_block): Use pedwarn instead of error and only for
3736 c++17 and earlier when try block appears in constexpr function.
3737 * constexpr.c (build_constexpr_constructor_member_initializers):
3738 Handle TRY_BLOCK here instead of erroring on it.
3740 2019-02-28 Jason Merrill <jason@redhat.com>
3742 PR c++/88183 - ICE with .* fold-expression.
3743 * pt.c (fold_expression) [DOTSTAR_EXPR]: Remove special handling.
3745 PR c++/86969 - ICE with constexpr if and recursive generic lambdas.
3746 * class.c, lambda.c, pt.c: Revert earlier change.
3747 * lambda.c (add_capture): Don't special-case capture of dependent
3750 * name-lookup.c (print_binding_level): Print this_entity.
3752 2019-02-27 Marek Polacek <polacek@redhat.com>
3754 PR c++/88857 - ICE with value-initialization of argument in template.
3755 * call.c (convert_like_real): Don't call build_value_init in template.
3757 2019-02-27 Jason Merrill <jason@redhat.com>
3759 PR c++/86969 - ICE with constexpr if and recursive generic lambdas.
3760 * semantics.c (process_outer_var_ref): Do capture dependent vars.
3761 * class.c (finish_struct): Only add TAG_DEFN if T is in
3762 current_function_decl.
3763 * lambda.c (vla_capture_type): Force the capture type out into the
3764 lambda's enclosing function.
3765 (add_capture): Pass in the lambda.
3766 * pt.c (tsubst_lambda_expr): complete_type a VLA capture type.
3768 2019-02-27 Marek Polacek <polacek@redhat.com>
3770 PR c++/89511 - ICE with using-declaration and unscoped enumerator.
3771 * parser.c (cp_parser_using_declaration): For an unscoped enum
3772 only use its context if it's not a function declaration.
3774 2019-02-27 Paolo Carlini <paolo.carlini@oracle.com>
3777 * method.c (process_subob_fn): When maybe_instantiate_noexcept
3778 returns false don't call merge_exception_specifiers.
3780 2019-02-27 Paolo Carlini <paolo.carlini@oracle.com>
3783 * parser.c (cp_parser_noexcept_specification_opt): Return NULL_TREE
3784 for a non-constant parsed expression.
3786 2019-02-26 Jakub Jelinek <jakub@redhat.com>
3789 * constexpr.c (cxx_eval_store_expression): When changing active union
3790 member, set no_zero_init.
3792 2019-02-23 Marek Polacek <polacek@redhat.com>
3794 PR c++/88294 - ICE with non-constant noexcept-specifier.
3795 * pt.c (maybe_instantiate_noexcept): Set up the list of local
3796 specializations. Set current_class_{ptr,ref}.
3798 2019-02-22 David Malcolm <dmalcolm@redhat.com>
3801 * parser.c (cp_parser_unqualified_id): Capture and use locations
3804 2019-02-22 Marek Polacek <polacek@redhat.com>
3806 PR c++/89420 - ICE with CAST_EXPR in explicit-specifier.
3807 * decl.c (build_explicit_specifier): Don't check
3808 processing_template_decl. Call instantiation_dependent_expression_p
3809 instead of value_dependent_expression_p. Call
3810 instantiate_non_dependent_expr_sfinae before
3811 build_converted_constant_expr instead of calling
3812 instantiate_non_dependent_expr after it. Add
3813 processing_template_decl_sentinel.
3815 2019-02-22 Thomas Schwinge <thomas@codesourcery.com>
3817 * parser.c (cp_parser_oacc_simple_clause): Remove parser formal
3818 parameter, move loc formal parameter to the front. Adjust all
3820 (cp_parser_oacc_shape_clause): Add loc formal parameter. Adjust
3823 2019-02-21 Jason Merrill <jason@redhat.com>
3825 PR c++/87685 - generic lambda 'this' capture error.
3826 * lambda.c (lambda_expr_this_capture): Change add_capture_p to int.
3827 (maybe_generic_this_capture): Pass -1.
3829 PR c++/88394 - ICE with VLA init-capture.
3830 * lambda.c (is_normal_capture_proxy): Check DECL_CAPTURED_VARIABLE.
3832 PR c++/88869 - C++17 ICE with CTAD and explicit specialization.
3833 * pt.c (do_class_deduction): Don't include explicit specialization
3836 PR c++/89422 - ICE with -g and lambda in default arg in template.
3837 * pt.c (tsubst_function_decl): SET_DECL_FRIEND_CONTEXT sooner.
3839 2019-02-21 Jason Merrill <jason@redhat.com>
3841 PR c++/88419 - C++17 ICE with class template arg deduction.
3842 * pt.c (make_template_placeholder): Set TYPE_CANONICAL after
3843 CLASS_PLACEHOLDER_TEMPLATE.
3845 2019-02-21 Jakub Jelinek <jakub@redhat.com>
3848 * constexpr.c (struct constexpr_fundef): Add parms and result members.
3849 (retrieve_constexpr_fundef): Adjust for the above change.
3850 (register_constexpr_fundef): Save constexpr body with copy_fn,
3851 temporarily set DECL_CONTEXT on DECL_RESULT before that.
3852 (get_fundef_copy): Change FUN argument to FUNDEF with
3853 constexpr_fundef * type, grab body and parms/result out of
3854 constexpr_fundef struct and temporarily change it for copy_fn calls
3856 (cxx_eval_builtin_function_call): For __builtin_FUNCTION temporarily
3857 adjust current_function_decl from ctx->call context. Test
3858 !potential_constant_expression instead of !is_constant_expression.
3859 (cxx_bind_parameters_in_call): Grab parameters from new_call. Undo
3860 convert_for_arg_passing changes for TREE_ADDRESSABLE type passing.
3861 (cxx_eval_call_expression): Adjust get_fundef_copy caller.
3862 (cxx_eval_conditional_expression): For IF_STMT, allow then or else
3863 operands to be NULL.
3864 (label_matches): Handle BREAK_STMT and CONTINUE_STMT.
3865 (cxx_eval_loop_expr): Add support for FOR_STMT, WHILE_STMT and DO_STMT.
3866 (cxx_eval_switch_expr): Add support for SWITCH_STMT.
3867 (cxx_eval_constant_expression): Handle IF_STMT, FOR_STMT, WHILE_STMT,
3868 DO_STMT, CONTINUE_STMT, SWITCH_STMT, BREAK_STMT and CONTINUE_STMT.
3869 For SIZEOF_EXPR, recurse on the result of fold_sizeof_expr. Ignore
3870 DECL_EXPR with USING_DECL operand.
3871 * lambda.c (maybe_add_lambda_conv_op): Build thisarg using
3872 build_int_cst to make it a valid constant expression.
3874 2019-02-20 Jason Merrill <jason@redhat.com>
3876 PR c++/88690 - C++17 ICE with empty base in aggregate.
3877 * typeck2.c (process_init_constructor_record): Skip trivial
3878 initialization of an empty base.
3880 2019-02-21 Richard Biener <rguenther@suse.de>
3883 * vtable-class-hierarchy.c (vtv_generate_init_routine): Do not
3884 make symtab process new functions here.
3886 2019-02-20 Jason Merrill <jason@redhat.com>
3888 PR c++/87921 - wrong error with inline static data member.
3889 * decl2.c (finish_static_data_member_decl): Don't set DECL_IN_AGGR_P
3890 for a non-template inline variable. Do nothing for an
3891 already-instantiated variable.
3892 (c_parse_final_cleanups): Check DECL_IN_AGGR_P without
3894 * decl.c (check_initializer): Likewise.
3895 (make_rtl_for_nonlocal_decl): Likewise.
3896 * pt.c (instantiate_decl): Likewise.
3897 * typeck2.c (store_init_value): Likewise.
3899 2019-02-20 Jakub Jelinek <jakub@redhat.com>
3902 * decl2.c (c_parse_final_cleanups): Move TREE_ASM_WRITTEN setting
3903 for flag_syntax_only from here...
3904 * semantics.c (expand_or_defer_fn_1): ... here.
3907 * decl.c (maybe_commonize_var): When clearing TREE_PUBLIC and
3908 DECL_COMMON, set DECL_INTERFACE_KNOWN.
3911 * constexpr.c (cxx_eval_store_expression): Diagnose changing of active
3912 union member for -std=c++17 and earlier.
3914 2019-02-19 Jason Merrill <jason@redhat.com>
3916 PR c++/87513 - 'sorry' mangling PMF template-id.
3917 * mangle.c (write_expression): Handle SCOPE_REF to BASELINK.
3919 2019-02-19 Jason Merrill <jason@redhat.com>
3921 PR c++/88380 - wrong-code with flexible array and NSDMI.
3922 * typeck2.c (process_init_constructor_record): Skip flexarrays.
3924 2019-02-20 will wray <wjwray@gmail.com>
3926 PR c++/88572 - wrong handling of braces on scalar init.
3927 * decl.c (reshape_init_r): Allow braces around scalar initializer
3928 within aggregate init. Reject double braced-init of scalar
3931 2019-02-20 Paolo Carlini <paolo.carlini@oracle.com>
3934 * pt.c (tsubst_init): Diagnose an initializer expanding to an
3935 empty list of expressions; tweak wrt dependent types.
3936 (regenerate_decl_from_template): For VAR_DECLs call tsubst_init
3937 instead of tsubst_expr.
3939 2019-02-19 Jason Merrill <jason@redhat.com>
3941 PR c++/88368 - wrong 'use of deleted function'
3942 * method.c (walk_field_subobs): Remember errors from get_nsdmi.
3943 (get_defaulted_eh_spec): Call push_tinst_level.
3944 * pt.c (maybe_instantiate_noexcept): Keep error_mark_node.
3945 * typeck2.c (merge_exception_specifiers): Handle error_mark_node.
3947 2019-02-19 Chung-Lin Tang <cltang@codesourcery.com>
3950 * parser.c (cp_parser_oacc_clause_wait): Add representation of wait
3951 clause without argument as 'wait (GOMP_ASYNC_NOVAL)', adjust comments.
3953 2019-02-19 Jakub Jelinek <jakub@redhat.com>
3956 * lambda.c (maybe_generic_this_capture): Don't check
3957 DECL_NONSTATIC_MEMBER_FUNCTION_P on USING_DECLs.
3960 * typeck.c (build_reinterpret_cast_1): Don't handle void to
3961 && conversion go through build_target_expr_with_type.
3964 * error.c (qualified_name_lookup_error): Only call
3965 suggest_alternative_in_scoped_enum if name is IDENTIFIER_NODE.
3967 2019-02-19 Tom Honermann <tom@honermann.net>
3969 * name-lookup.c (get_std_name_hint): Added u8string as a name hint.
3971 2019-02-18 Jason Merrill <jason@redhat.com>
3973 PR c++/89336 - multiple stores in constexpr stmt.
3974 * constexpr.c (cxx_eval_store_expression): Preevaluate scalar or
3977 * pt.c (check_explicit_specialization): If the declarator is a
3978 template-id, only check whether the arguments are dependent.
3980 Improve duplicate [[likely]] diagnostic.
3981 * parser.c (cp_parser_statement): Make attrs_loc a range. Pass it
3982 to process_stmt_hotness_attribute.
3983 * cp-gimplify.c (process_stmt_hotness_attribute): Take attrs_loc.
3984 (genericize_if_stmt): Use likely/unlikely instead of predictor_name.
3986 2019-02-17 Marek Polacek <polacek@redhat.com>
3988 PR c++/89217 - ICE with list-initialization in range-based for loop.
3989 * constexpr.c (unshare_constructor): No longer static.
3990 * cp-tree.h (unshare_constructor): Declare.
3991 * semantics.c (finish_compound_literal): When dealing with a
3992 non-dependent expression in a template, return the original
3993 expression. Pass LOOKUP_NO_NARROWING to digest_init_flags.
3995 2019-02-13 Marek Polacek <polacek@redhat.com>
3997 PR c++/89297 - ICE with OVERLOAD in template.
3998 * semantics.c (finish_compound_literal): Call
3999 instantiate_non_dependent_expr_sfinae.
4001 2019-02-13 Alexandre Oliva <aoliva@redhat.com>
4004 * cp-tree.h (USING_DECL_SCOPE): Use result rather than type.
4005 * name-lookup.c (strip_using_decl): Use USING_DECL_SCOPE.
4006 * search.c (protected_accessible_p): Follow USING_DECL_DECLS.
4007 (shared_member_p): Likewise.
4008 (lookup_member): Likewise.
4009 * decl.c (grok_special_member_properties): Skip USING_DECLs.
4010 * semantics.c (finish_omp_declare_simd_methods): Likewise.
4011 (finish_qualified_id_expr): Do not call shared_member_p with
4015 * pt.c (tsubst_lambda_expr): Avoid duplicate tsubsting.
4016 Move cp_evaluated resetting before signature tsubsting.
4017 (gen_elem_of_pack_expansion_instantiation): Separate local
4018 specializations per index.
4020 2019-02-13 David Malcolm <dmalcolm@redhat.com>
4023 * class.c (add_method): Drop destructor assertion.
4025 2019-02-13 Paolo Carlini <paolo.carlini@oracle.com>
4028 * decl.c (make_typename_type): Allow for TYPE_PACK_EXPANSION as
4029 context (the first argument).
4030 * pt.c (tsubst, case TYPENAME_TYPE): Handle TYPE_PACK_EXPANSION
4033 2019-02-12 Jason Merrill <jason@redhat.com>
4035 PR c++/89144 - link error with constexpr initializer_list.
4036 * call.c (convert_like_real) [ck_list]: Don't allocate a temporary
4037 array for an empty list.
4038 * typeck2.c (store_init_value): Don't use cxx_constant_init in a
4041 2019-02-11 Jason Merrill <jason@redhat.com>
4043 PR c++/89241 - ICE with __func__ in lambda in template.
4044 * pt.c (enclosing_instantiation_of): Also check
4045 instantiated_lambda_fn_p for the template context.
4047 2019-02-11 Marek Polacek <polacek@redhat.com>
4049 PR c++/89212 - ICE converting nullptr to pointer-to-member-function.
4050 * pt.c (tsubst_copy_and_build) <case CONSTRUCTOR>: Return early for
4051 null member pointer value.
4053 2019-02-11 Jakub Jelinek <jakub@redhat.com>
4056 * pt.c (convert_nontype_argument): Pass true as manifestly_const_eval
4057 to maybe_constant_value calls.
4059 2019-02-11 Marek Polacek <polacek@redhat.com>
4061 * typeck2.c (digest_init_r): Remove commented code.
4063 2019-02-11 Martin Sebor <msebor@redhat.com>
4066 * decl.c (compute_array_index_type_loc): Preserve signed sizes
4067 for diagnostics. Call valid_array_size_p instead of error.
4068 * init.c (build_new_1): Compute size for diagnostic. Call
4069 invalid_array_size_error
4070 (build_new): Call valid_array_size_p instead of error.
4072 2019-02-07 Alexandre Oliva <aoliva@redhat.com>
4075 * call.c (compare_ics): Deal with ck_aggr in either cs.
4077 2019-02-06 David Malcolm <dmalcolm@redhat.com>
4080 * call.c (get_location_for_expr_unwinding_for_system_header): New
4082 (conversion_null_warnings): Use it when getting locations for
4083 EXPR, effectively adding a call to
4084 get_location_for_expr_unwinding_for_system_header for
4085 -Wconversion-null and making use of EXPR_LOCATION for
4086 -Wzero-as-null-pointer-constant.
4088 2019-02-05 Jakub Jelinek <jakub@redhat.com>
4091 * optimize.c (maybe_thunk_body): Clear TREE_ADDRESSABLE on
4092 PARM_DECLs of the thunk.
4093 * lambda.c (maybe_add_lambda_conv_op): Likewise.
4095 2019-02-05 Marek Polacek <polacek@redhat.com>
4097 PR c++/89158 - by-value capture of constexpr variable broken.
4098 * call.c (convert_like_real) <case ck_user>: Call mark_exp_read
4099 instead of mark_rvalue_use.
4101 2019-02-05 Alexandre Oliva <aoliva@redhat.com>
4104 * pt.c (instantiates_primary_template_p): New.
4105 (type_dependent_expression_p): Use it.
4107 2019-02-01 Jason Merrill <jason@redhat.com>
4109 PR c++/88761 - ICE with reference capture of constant.
4110 * lambda.c (mark_const_cap_r): Do walk subtrees of DECL_EXPR for
4113 2019-02-01 Marek Polacek <polacek@redhat.com>
4115 PR c++/88325 - ICE with invalid out-of-line template member definition.
4116 * parser.c (cp_parser_class_name): Don't call make_typename_type
4119 2019-02-01 Jakub Jelinek <jakub@redhat.com>
4122 * parser.c (cp_parser_gnu_attributes_opt): Set ok to false
4123 if require_open failed.
4125 2019-01-31 Marek Polacek <polacek@redhat.com>
4127 PR c++/89083, c++/80864 - ICE with list initialization in template.
4128 * constexpr.c (adjust_temp_type): Use copy_node and change the type
4129 instead of using build_constructor.
4130 * decl.c (reshape_init_r): Don't reshape a digested initializer.
4131 Return the initializer for COMPOUND_LITERAL_P.
4133 PR c++/88983 - ICE with switch in constexpr function.
4134 * constexpr.c (cxx_eval_switch_expr): Use SWITCH_COND and SWITCH_BODY.
4135 (cxx_eval_constant_expression) <case COND_EXPR>: Don't look for the
4136 label in the else branch if we found it in the then branch.
4138 2019-01-30 Jason Merrill <jason@redhat.com>
4140 PR c++/88752 - ICE with lambda and constexpr if.
4141 * cp-tree.h (LAMBDA_EXPR_INSTANTIATED): New.
4142 * pt.c (tsubst_lambda_expr): Set it.
4143 (instantiated_lambda_fn_p): Check it.
4144 (enclosing_instantiation_of): Use it.
4146 2019-01-31 Jakub Jelinek <jakub@redhat.com>
4149 * cxx-pretty-print.c (pp_cxx_enumeration_constant): Print always as
4150 a C cast in pp_c_flag_gnu_v3 mode.
4152 2019-01-30 Jakub Jelinek <jakub@redhat.com>
4155 * lambda.c (is_capture_proxy): Don't return true for
4156 DECL_OMP_PRIVATIZED_MEMBER artificial vars.
4158 2019-01-30 Marek Polacek <polacek@redhat.com>
4160 PR c++/89119 - ICE with value-initialization in template.
4161 * pt.c (tsubst_copy_and_build): Handle RANGE_EXPR.
4163 2019-01-29 Jason Merrill <jason@redhat.com>
4165 PR c++/86943 - wrong code converting lambda to function pointer.
4166 * lambda.c (maybe_add_lambda_conv_op): Use a template-id in the
4167 call. Only forward parms for decltype.
4168 * pt.c (tsubst_copy_and_build) [CALL_EXPR]: Handle CALL_FROM_THUNK_P
4170 * typeck.c (check_return_expr): Don't mess with a thunk call.
4172 2019-01-28 Jason Merrill <jason@redhat.com>
4174 PR c++/89089 - ICE with [[no_unique_address]].
4175 PR c++/88865 - wrong layout with [[no_unique_address]].
4176 * class.c (check_field_decls): A potentially-overlapping field makes
4177 the class non-layout-POD, but not non-empty.
4178 (end_of_class): Always consider empty data members.
4179 (layout_class_type): Set DECL_SIZE for empty fields.
4181 2019-01-28 Marek Polacek <polacek@redhat.com>
4183 PR c++/88358 - name wrongly treated as type.
4184 * parser.c (cp_parser_direct_declarator): Don't assume a qualified-id
4185 in parameter-list is a type if the function's declarator-id is not
4188 2019-01-27 Marek Polacek <polacek@redhat.com>
4190 PR c++/88815 - narrowing conversion lost in decltype.
4191 PR c++/78244 - narrowing conversion in template not detected.
4192 * cp-tree.h (CONSTRUCTOR_IS_DEPENDENT): New.
4193 * pt.c (instantiation_dependent_r): Consider a CONSTRUCTOR with
4194 CONSTRUCTOR_IS_DEPENDENT instantiation-dependent.
4195 * semantics.c (finish_compound_literal): When the compound literal
4196 isn't instantiation-dependent and the type isn't type-dependent,
4197 fall back to the normal processing. Set CONSTRUCTOR_IS_DEPENDENT.
4199 PR c++/89024 - ICE with incomplete enum type.
4200 * call.c (standard_conversion): When converting an
4201 ARITHMETIC_TYPE_P to an incomplete type, return NULL.
4203 2019-01-25 Paolo Carlini <paolo.carlini@oracle.com>
4206 * call.c (build_op_delete_call): Implement 7.6.2.5/(10.1).
4207 * decl2.c (coerce_delete_type): Use build_pointer_type instead
4210 2019-01-24 Jason Merrill <jason@redhat.com>
4212 PR c++/89001 - mangling of reference temporaries
4213 * cp-tree.h (struct saved_scope): Add ref_temp_count.
4214 (current_ref_temp_count): New macro.
4215 * mangle.c (mangle_ref_init_variable): Use it.
4216 * typeck2.c (store_init_value): Clear it.
4217 * call.c (make_temporary_var_for_ref_to_temp): Copy public and
4220 2019-01-24 Jakub Jelinek <jakub@redhat.com>
4223 * semantics.c (finish_omp_cancel): Diagnose more than one if
4224 on #pragma omp cancel with different modifiers. Use
4225 maybe_convert_cond when not in template or build_x_binary_op
4228 2019-01-23 Marek Polacek <polacek@redhat.com>
4230 PR c++/88757 - qualified name treated wrongly as type.
4231 * parser.c (cp_parser_direct_declarator): Don't treat qualified-ids
4232 in parameter-list as types if name lookup for declarator-id didn't
4233 find one or more function templates.
4235 2019-01-23 Jakub Jelinek <jakub@redhat.com>
4238 * cp-gimplify.c (genericize_cp_loop): Call begin_bc_block only
4239 after genericizing cond and incr expressions.
4242 * cp-gimplify.c (genericize_switch_stmt): Move cond genericization
4243 before the begin_bc_block call.
4245 2019-01-21 Jason Merrill <jason@redhat.com>
4247 PR c++/87893 - constexpr ctor ICE on ARM.
4248 PR c++/88293 - ICE with comma expression.
4249 * constexpr.c (initialized_type): Don't shortcut non-void type.
4250 Handle COMPOUND_EXPR.
4251 (cxx_eval_outermost_constant_expr): Return early for void type.
4253 2019-01-21 Jakub Jelinek <jakub@redhat.com>
4256 * optimize.c (cxx_copy_decl): New function.
4257 (clone_body): Use it instead of copy_decl_no_change.
4260 * typeck.c (cp_build_binary_op): Don't instrument
4261 SANITIZE_POINTER_COMPARE if processing_template_decl.
4262 (pointer_diff): Similarly for SANITIZE_POINTER_SUBTRACT.
4264 2019-01-18 Jason Merrill <jason@redhat.com>
4266 PR c++/88875 - error with explicit list constructor.
4267 * call.c (reference_binding): Don't modify EXPR. Set
4268 need_temporary_p on the ck_user conversion for a temporary.
4269 (convert_like_real): Check it.
4271 2019-01-18 H.J. Lu <hongjiu.lu@intel.com>
4275 * call.c (convert_for_arg_passing): Upate the
4276 warn_for_address_or_pointer_of_packed_member call.
4277 * typeck.c (convert_for_assignment): Likewise.
4279 2019-01-17 Jason Merrill <jason@redhat.com>
4281 PR c++/86205 - ICE with ?: of throw and template-id.
4282 * pt.c (resolve_nondeduced_context_or_error): Split out from...
4283 * typeck.c (decay_conversion): ...here.
4284 * call.c (build_conditional_expr_1): Use it.
4286 PR c++/86740, ICE with constexpr if and nested generic lambdas.
4287 * tree.c (cp_walk_subtrees): Handle LAMBDA_EXPR.
4289 2019-01-17 Paolo Carlini <paolo.carlini@oracle.com>
4291 * decl.c (grokdeclarator): Use typespec_loc in error messages
4292 about 'auto' and trailing return type.
4294 2019-01-17 David Malcolm <dmalcolm@redhat.com>
4297 * class.c (add_method): Don't use DECL_DESTRUCTOR_P on
4300 2019-01-17 Nathan Sidwell <nathan@acm.org>
4303 * semantics.c (process_outer_var_ref): Only skip dependent types
4306 2019-01-17 Alexandre Oliva <aoliva@redhat.com>
4309 * cp-tree.h (saved_scope): Add suppress_location_wrappers.
4310 * name-lookup.c (do_push_to_top_level): Save and reset it.
4311 (do_pop_from_top_level): Restore it.
4314 * pt.c (make_template_placeholder): Use auto_identifier.
4315 (is_auto): Drop CLASS_PLACEHOLDER_TEMPLATE test.
4316 * error.c (dump_type): Handle template placeholders.
4317 * cxx-pretty-print.c (pp_cx_unqualified_id): Likewise.
4320 * cvt.c (convert_to_void): Handle all cdtor calls as if
4323 2019-01-16 Paolo Carlini <paolo.carlini@oracle.com>
4325 * decl.c (grokdeclarator): Use locations[ds_storage_class] in
4326 error messages about ill-formed uses of mutable.
4328 2019-01-16 Marek Polacek <polacek@redhat.com>
4330 PR c++/78244 - narrowing conversion in template not detected.
4331 * call.c (perform_implicit_conversion_flags): Set
4332 IMPLICIT_CONV_EXPR_BRACED_INIT.
4333 * cp-tree.h (IMPLICIT_CONV_EXPR_BRACED_INIT): New.
4334 * pt.c (tsubst_copy_and_build): Use it.
4336 2019-01-15 David Malcolm <dmalcolm@redhat.com>
4339 * pt.c (build_deduction_guide): Bail out if tsubst_arg_types
4342 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com>
4344 * decl.c (start_decl): Improve error location.
4345 * decl2.c (grokfield): Likewise.
4347 2019-01-15 Paolo Carlini <paolo.carlini@oracle.com>
4349 * decl.c (grokdeclarator): Move further up the location_t loc
4350 declaration and use the location when building a TYPE_DECL for
4352 * decl2.c (grokbitfield): Use DECL_SOURCE_LOCATION in the error
4353 about an ill-formed bit-field as typedef.
4355 2019-01-14 Marek Polacek <polacek@redhat.com>
4357 PR c++/88830 - ICE with abstract class.
4358 * decl2.c (maybe_emit_vtables): Check CLASSTYPE_LAZY_DESTRUCTOR.
4361 PR c++/88825 - ICE with bogus function return type deduction.
4362 * typeck.c (can_do_nrvo_p): Check error_mark_node.
4364 2019-01-14 Tom Honermann <tom@honermann.net>
4366 Implement P0482R5, char8_t: A type for UTF-8 characters and strings
4367 * cvt.c (type_promotes_to): Handle char8_t promotion.
4368 * decl.c (grokdeclarator): Handle invalid type specifier
4369 combinations involving char8_t.
4370 * lex.c (init_reswords): Add char8_t as a reserved word.
4371 * mangle.c (write_builtin_type): Add name mangling for char8_t (Du).
4372 * parser.c (cp_keyword_starts_decl_specifier_p)
4373 (cp_parser_simple_type_specifier): Recognize char8_t as a simple
4375 (cp_parser_string_literal): Use char8_array_type_node for the type
4377 (cp_parser_set_decl_spec_type): Tolerate char8_t typedefs in system
4379 * rtti.c (emit_support_tinfos): type_info support for char8_t.
4380 * tree.c (char_type_p): Recognize char8_t as a character type.
4381 * typeck.c (string_conv_p): Handle conversions of u8 string
4382 literals of char8_t type.
4383 (check_literal_operator_args): Handle UDLs with u8 string literals
4385 * typeck2.c (ordinary_char_type_p): New.
4386 (digest_init_r): Disallow initializing a char array with a u8 string
4389 2019-01-14 Martin Liska <mliska@suse.cz>
4391 PR gcov-profile/88263
4392 * decl2.c (get_tls_wrapper_fn): Use DECL_SOURCE_LOCATION
4393 as location of the TLS wrapper.
4395 2019-01-12 Paolo Carlini <paolo.carlini@oracle.com>
4397 * decl.c (cp_finish_decl): Improve error location.
4398 * decl2.c (grokfield): Likewise, improve two locations.
4400 2019-01-11 Marek Polacek <polacek@redhat.com>
4402 PR c++/88692, c++/87882 - -Wredundant-move false positive with *this.
4403 * typeck.c (maybe_warn_pessimizing_move): Return if ARG isn't
4406 2019-01-11 Jason Merrill <jason@redhat.com>
4408 PR c++/88312 - pack expansion of decltype.
4409 * pt.c (instantiation_dependent_r): A template non-type parameter
4410 pack is instantiation-dependent.
4412 2019-01-11 Jason Merrill <jason@redhat.com>
4414 PR c++/88613 - ICE with use of const var in lambda.
4415 * expr.c (mark_use): Fix location wrapper handling.
4416 * cp-gimplify.c (cp_fold_maybe_rvalue): Call mark_rvalue_use.
4418 2019-01-11 Tobias Burnus <burnus@net-b.de>
4421 * decl2.c (maybe_emit_vtables): If needed, generate code for
4422 the destructor of an abstract class.
4423 (mark_used): Update comment for older function-name change.
4425 2019-01-11 Paolo Carlini <paolo.carlini@oracle.com>
4427 * decl.c (start_decl): Improve error location.
4428 (grokdeclarator): Likewise, improve two locations.
4430 2019-01-09 Sandra Loosemore <sandra@codesourcery.com>
4434 * cp-tree.h: Mechanically replace "can not" with "cannot".
4435 * parser.c: Likewise.
4438 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com>
4440 * decl.c (grok_reference_init): Improve error location.
4441 (grokdeclarator): Likewise, improve two locations.
4443 2019-01-08 Marek Polacek <polacek@redhat.com>
4445 PR c++/88538 - braced-init-list in template-argument-list.
4446 * parser.c (cp_parser_template_argument): Handle braced-init-list when
4449 PR c++/88548 - this accepted in static member functions.
4450 * parser.c (cp_debug_parser): Adjust printing of
4451 local_variables_forbidden_p.
4452 (cp_parser_new): Set local_variables_forbidden_p to 0 rather than false.
4453 (cp_parser_primary_expression): When checking
4454 local_variables_forbidden_p, use THIS_FORBIDDEN or
4455 LOCAL_VARS_FORBIDDEN.
4456 (cp_parser_lambda_body): Update the type of
4457 local_variables_forbidden_p. Set it to 0 rather than false.
4458 (cp_parser_condition): Adjust call to cp_parser_declarator.
4459 (cp_parser_explicit_instantiation): Likewise.
4460 (cp_parser_init_declarator): Likewise.
4461 (cp_parser_declarator): New parameter. Use it.
4462 (cp_parser_direct_declarator): New parameter. Use it to set
4463 local_variables_forbidden_p. Adjust call to cp_parser_declarator.
4464 (cp_parser_type_id_1): Adjust call to cp_parser_declarator.
4465 (cp_parser_parameter_declaration): Likewise.
4466 (cp_parser_default_argument): Update the type of
4467 local_variables_forbidden_p. Set it to LOCAL_VARS_AND_THIS_FORBIDDEN
4469 (cp_parser_member_declaration): Tell cp_parser_declarator if we saw
4470 'static' or 'friend'.
4471 (cp_parser_exception_declaration): Adjust call to cp_parser_declarator.
4472 (cp_parser_late_parsing_default_args): Update the type of
4473 local_variables_forbidden_p. Set it to LOCAL_VARS_AND_THIS_FORBIDDEN
4475 (cp_parser_cache_defarg): Adjust call to cp_parser_declarator.
4476 (cp_parser_objc_class_ivars): Likewise.
4477 (cp_parser_objc_struct_declaration): Likewise.
4478 (cp_parser_omp_for_loop_init): Likewise.
4479 * parser.h (cp_parser): Change the type of local_variables_forbidden_p
4481 (LOCAL_VARS_FORBIDDEN, LOCAL_VARS_AND_THIS_FORBIDDEN, THIS_FORBIDDEN):
4484 2019-01-08 Paolo Carlini <paolo.carlini@oracle.com>
4486 * decl.c (start_decl): Improve permerror location.
4488 2019-01-08 Jonathan Wakely <jwakely@redhat.com>
4489 Jakub Jelinek <jakub@redhat.com>
4492 * decl.c (finish_function): For -Wreturn-type don't add a return *this;
4493 fixit hint if current_class_ref is NULL. Use a single if instead of
4496 2019-01-07 Paolo Carlini <paolo.carlini@oracle.com>
4498 * decl.c (start_decl): Improve two error_at locations.
4499 (expand_static_init): Likewise.
4501 2019-01-07 Marek Polacek <polacek@redhat.com>
4503 PR c++/88741 - wrong error with initializer-string.
4504 * decl.c (cp_complete_array_type): Strip any location wrappers.
4506 2019-01-07 Bernd Edlinger <bernd.edlinger@hotmail.de>
4512 * cp-tree.h (LOOKUP_ALLOW_FLEXARRAY_INIT): New flag value.
4513 * typeck2.c (digest_init_r): Raise an error for non-static
4514 initialization of a flexible array member.
4515 (process_init_constructor, massage_init_elt,
4516 process_init_constructor_array, process_init_constructor_record,
4517 process_init_constructor_union, process_init_constructor): Add the
4518 flags parameter and pass it thru.
4519 (store_init_value): Pass LOOKUP_ALLOW_FLEXARRAY_INIT parameter to
4520 digest_init_flags for static decls.
4522 2019-01-07 Jakub Jelinek <jakub@redhat.com>
4525 * cp-tree.h (cp_build_vec_convert): Declare.
4526 * parser.c (cp_parser_postfix_expression): Parse
4527 __builtin_convertvector.
4528 * constexpr.c: Include fold-const-call.h.
4529 (cxx_eval_internal_function): Handle IFN_VEC_CONVERT.
4530 (potential_constant_expression_1): Likewise.
4531 * semantics.c (cp_build_vec_convert): New function.
4532 * pt.c (tsubst_copy_and_build): Handle CALL_EXPR to
4535 2019-01-03 Jakub Jelinek <jakub@redhat.com>
4538 * decl.c (builtin_function_1): Return result of pushdecl_top_level
4539 or pushdecl rather than decl.
4541 2019-01-03 Paolo Carlini <paolo.carlini@oracle.com>
4543 * tree.c (handle_nodiscard_attribute): Improve warning location.
4545 2019-01-02 Marek Polacek <polacek@redhat.com>
4547 PR c++/88612 - ICE with -Waddress-of-packed-member.
4548 * call.c (convert_for_arg_passing): Only give warnings with tf_warning.
4549 * typeck.c (convert_for_assignment): Likewise.
4551 PR c++/88631 - CTAD failing for value-initialization.
4552 * typeck2.c (build_functional_cast): Try deducing the template
4553 arguments even if there are no arguments to deduce from.
4555 2019-01-01 Jakub Jelinek <jakub@redhat.com>
4557 Update copyright years.
4559 Copyright (C) 2019 Free Software Foundation, Inc.
4561 Copying and distribution of this file, with or without modification,
4562 are permitted in any medium without royalty provided the copyright
4563 notice and this notice are preserved.