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