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