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