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