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