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