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