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