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