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