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