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