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