C++: avoid most reserved words as misspelling suggestions (PR c++/81610 and PR c...
[official-gcc.git] / gcc / cp / ChangeLog
blob42c3cbf4b3cbb35cc66b2ccf9c4703ea89c77cbc
1 2018-02-07  David Malcolm  <dmalcolm@redhat.com>
3         PR c++/81610
4         PR c++/80567
5         * name-lookup.c (suggest_rid_p): New function.
6         (lookup_name_fuzzy): Replace enum-rid-filtering logic with call to
7         suggest_rid_p.
9 2018-02-07  Jason Merrill  <jason@redhat.com>
11         PR c++/84182 - ICE with captured lambda
12         PR c++/84181
13         * pt.c (extract_locals_r, extract_local_specs): New.
14         (tsubst_pack_expansion): Use them.
16 2018-02-07  Martin Liska  <mliska@suse.cz>
18         PR c++/84059.
19         * class.c (add_method): Append argument value.
20         * cp-tree.h (maybe_version_functions): Add new argument.
21         * decl.c (decls_match): Call it if a declaration does not
22         have DECL_FUNCTION_VERSIONED.
23         (maybe_version_functions): record argument is added.
25 2018-02-05  Marek Polacek  <polacek@redhat.com>
27         * class.c: Remove unused global variables.
28         (build_primary_vtable): Don't gather statistics.
29         (print_class_statistics): Remove.
30         * cp-tree.h (print_class_statistics): Remove.
31         * tree.c (cxx_print_statistics): Don't call print_class_statistics.
33 2018-02-02  Paolo Carlini  <paolo.carlini@oracle.com>
35         * class.c (is_really_empty_class): Use DECL_UNNAMED_BIT_FIELD.
36         * constexpr.c (cx_check_missing_mem_inits): Likewise.
37         * decl.c (next_initializable_field, find_decomp_class_base,
38         cp_finish_decomp): Likewise.
39         * typeck2.c (process_init_constructor_record): Likewise.
41 2018-02-02  Jason Merrill  <jason@redhat.com>
43         PR c++/84181 - ICE with lambda parm in template argument.
44         * tree.c (strip_typedefs_expr): Use cp_tree_operand_length.
46 2018-02-01  Jason Merrill  <jason@redhat.com>
48         PR c++/84160 - ICE with nested variadic capture.
49         * lambda.c (is_capture_proxy_with_ref): New.
50         (insert_capture_proxy): Don't set DECL_CAPTURED_VARIABLE from a
51         COMPONENT_REF.
52         * expr.c (mark_use): Use is_capture_proxy_with_ref.
53         * constexpr.c (potential_constant_expression_1): Likewise.
54         * semantics.c (process_outer_var_ref): Likewise.
56 2018-02-01  Marek Polacek  <polacek@redhat.com>
58         PR c++/84125
59         * typeck.c (build_address): Relax the assert when
60         processing_template_decl.
62 2018-02-01  Jason Merrill  <jason@redhat.com>
64         PR c++/84126 - ICE with variadic generic lambda
65         PR c++/84036
66         PR c++/82249
67         * pt.c (tsubst_pack_expansion): Handle function parameter_packs in
68         PACK_EXPANSION_EXTRA_ARGS.
70 2018-02-01  Paolo Carlini  <paolo.carlini@oracle.com>
72         PR c++/83796
73         * call.c (convert_like_real): If w're initializing from {} explicitly
74         call abstract_virtuals_error_sfinae.
76 2018-01-31  Jason Merrill  <jason@redhat.com>
77             Jakub Jelinek  <jakub@redhat.com>
79         PR c++/83993
80         * constexpr.c (cxx_eval_outermost_constant_expr): Build NOP_EXPR
81         around non-constant ADDR_EXPRs rather than clearing TREE_CONSTANT
82         on ADDR_EXPR.
84 2018-01-31  Jakub Jelinek  <jakub@redhat.com>
86         PR c++/83993
87         * constexpr.c (diag_array_subscript): Emit different diagnostics
88         if TYPE_DOMAIN (arraytype) is NULL.
89         (cxx_eval_array_reference, cxx_eval_store_expression): For arrays
90         with NULL TYPE_DOMAIN use size_zero_node as nelts.
92 2018-01-31  Paolo Carlini  <paolo.carlini@oracle.com>
94         PR c++/84092
95         * semantics.c (finish_qualified_id_expr): When handling an
96         UNBOUND_CLASS_TEMPLATE only adjust qualifying_class and expr.
98 2018-01-31  Marek Polacek  <polacek@redhat.com>
100         PR c++/84138
101         * cp-gimplify.c (cp_fold): Check if X is an error node before
102         calling useless_type_conversion_p.
104 2018-01-30  Jason Merrill  <jason@redhat.com>
106         PR c++/84091 - ICE with local class in lambda in template.
107         * decl2.c (determine_visibility): Look for outer containing template
108         instantiation.
110         PR c++/84098 - ICE with lambda in template NSDMI.
111         * pt.c (instantiate_class_template_1): Ignore more lambdas.
113 2018-01-29  Jason Merrill  <jason@redhat.com>
115         PR c++/68810 - wrong location for reinterpret_cast error.
116         * cvt.c (cp_convert_to_pointer): Always build a CONVERT_EXPR when
117         !dofold.
119 2018-01-29  Marek Polacek  <polacek@redhat.com>
121         PR c++/83996
122         * constexpr.c (cxx_fold_indirect_ref): Compute ((foo *)&fooarray)[1]
123         => fooarray[1] in offset_int.
125 2018-01-29  Jason Merrill  <jason@redhat.com>
127         PR c++/83942 - wrong unused warning with static_cast.
128         * cvt.c (ocp_convert): Call mark_rvalue_use.
130 2018-01-26  Jason Merrill  <jason@redhat.com>
132         PR c++/83956 - wrong dtor error with anonymous union
133         * method.c (walk_field_subobs): Variant members only affect
134         deletedness.
135         (maybe_explain_implicit_delete): Pass &deleted_p for diagnostic.
137         PR c++/84036 - ICE with variadic capture.
138         PR c++/82249
139         * pt.c (tsubst_pack_expansion): When optimizing a simple
140         substitution, pull a single pack expansion out of its pack.
142         PR c++/82514 - ICE with local class in generic lambda.
143         * pt.c (regenerated_lambda_fn_p): Remove.
144         (enclosing_instantiation_of): Don't use it.
145         (tsubst_function_decl): Call enclosing_instantiation_of.
147         * pt.c (lookup_template_class_1): Add sanity check.
148         * name-lookup.c (do_pushtag): Don't add closures to local_classes.
150 2018-01-25  Jakub Jelinek  <jakub@redhat.com>
152         PR c++/84031
153         * decl.c (find_decomp_class_base): Ignore unnamed bitfields.  Ignore
154         recursive calls that return ret.
155         (cp_finish_decomp): Ignore unnamed bitfields.
157 2018-01-23  Jason Merrill  <jason@redhat.com>
159         PR c++/82249 - wrong mismatched pack length error.
160         * pt.c (extract_fnparm_pack, tsubst_pack_expansion): Handle
161         unsubstituted function parameter pack.
163 2018-01-23  Paolo Carlini  <paolo.carlini@oracle.com>
165         PR c++/83921
166         * decl.c (check_for_uninitialized_const_var): Not static; add
167         bool and tsubst_flags_t parameters; adjust to be used both in
168         constexpr context and not.
169         * constexpr.c (potential_constant_expression_1): Use the above.
170         * cp-tree.h (check_for_uninitialized_const_var): Declare.
172 2018-01-23  Jason Merrill  <jason@redhat.com>
174         PR c++/83947 - ICE with auto declarations.
175         * pt.c (do_auto_deduction): Don't deduce from an auto decl.
176         * decl.c (undeduced_auto_decl): Limit to vars and fns.
178 2018-01-23  David Malcolm  <dmalcolm@redhat.com>
180         PR c++/83974
181         * pt.c (tsubst_copy_and_build) <CONSTRUCTOR>: Remove early bailout
182         for pointer to member function types.
184 2018-01-23  Jakub Jelinek  <jakub@redhat.com>
186         PR sanitizer/83987
187         * tree.c (cp_free_lang_data): Change DECL_VALUE_EXPR of
188         DECL_OMP_PRIVATIZED_MEMBER vars to error_mark_node.
190 2018-01-23  Nathan Sidwell  <nathan@acm.org>
192         PR c++/83988
193         * pt.c (tsubst_baselink): Remove optype assert.
194         * ptree.c (cxx_print_xnode): <case BASELINK> Print BASELINK_OPTYPE.
196 2018-01-23  Jakub Jelinek  <jakub@redhat.com>
198         PR c++/83958
199         * decl.c (cp_finish_decomp): Diagnose if reference structure binding
200         refers to incomplete type.
202 2018-01-23  Nathan Sidwell  <nathan@acm.org>
204         Deprecate ARM-era for scope handling
205         * decl.c (poplevel): Flag_new_for_scope is a boolean-like.
206         (cxx_init_decl_processing): Deprecate flag_new_for_scope being
207         cleared.
208         * name-lookup.c (check_for_out_of_scope_variable): Deprecate and
209         cleanup handling.
210         * semantics.c (begin_for_scope): Flag_new_for_scope is
211         boolean-like.
212         (finish_for_stmt, begin_range_for_stmt): Likewise.
214 2018-01-22  Jason Merrill  <jason@redhat.com>
216         PR c++/83720
217         * decl2.c (determine_visibility): Fix template_decl handling
218         instead of blocking it.
220         PR c++/83720 - ICE with lambda and LTO.
221         * decl2.c (determine_visibility): Clear template_decl for
222         function-scope decls.  Propagate anonymous linkage from containing
223         function.
225 2018-01-22  Marek Polacek  <polacek@redhat.com>
227         PR c++/81933
228         * typeck2.c (split_nonconstant_init_1): Return false if we didn't
229         split out anything.
231 2018-01-22  Ville Voutilainen  <ville.voutilainen@gmail.com>
233         PR c++/83895
234         * decl.c (grokdeclarator): Don't diagnose extra parens
235         on typedefs.
237 2018-01-19  Jakub Jelinek  <jakub@redhat.com>
239         PR c++/81167
240         * call.c (joust): Use TREE_TYPE (source) if source is
241         a POINTER_TYPE_P rather than if ! DECL_CONSTRUCTOR_P (w->fn).
243         PR c++/83919
244         * typeck.c (convert_for_assignment): Suppress warn_ignored_qualifiers
245         for direct enum init.
246         * decl.c (reshape_init): Likewise.
248 2018-01-19  Marek Polacek  <polacek@redhat.com>
250         * constexpr.c (fold_simple): Simplify.
252 2018-01-18  Jason Merrill  <jason@redhat.com>
254         PR c++/83714
255         * search.c (any_dependent_bases_p): Handle null TREE_BINFO.
256         * pt.c (instantiation_dependent_scope_ref_p): True if
257         any_dependent_bases_p.
259 2018-01-18  Paolo Carlini  <paolo.carlini@oracle.com>
261         * cp-tree.h: Fix comment typo (DECL_NON_TRIVIALLY_INITIALIZED_P
262         vs DECL_NONTRIVIALLY_INITIALIZED_P).
264 2018-01-18  Jason Merrill  <jason@redhat.com>
266         PR c++/82461 - constexpr list-initialized member
267         * constexpr.c (potential_constant_expression_1): Check
268         TARGET_EXPR_DIRECT_INIT_P.
270 2018-01-18  Paolo Carlini  <paolo.carlini@oracle.com>
272         PR c++/81013
273         * decl.c (xref_basetypes): Early return upon error about derived
274         union.
276 2018-01-18  Nathan Sidwell  <nathan@acm.org>
278         PR c++/83160
279         * cp-tree.h (mark_use): Declare.
280         * expr.c (mark_use): Make extern.
281         * call.c (direct_reference_binding): Set inner conv's
282         rvaluedness_matches_p, if it is an identity.
283         (convert_like_real): Mark lvalue or rvalue use for identity as
284         rvaledness_matches_p demands.
286 2018-01-18  Jakub Jelinek  <jakub@redhat.com>
288         PR c++/83824
289         * parser.c (attr_chainon): New function.
290         (cp_parser_label_for_labeled_statement, cp_parser_decl_specifier_seq,
291         cp_parser_namespace_definition, cp_parser_init_declarator,
292         cp_parser_type_specifier_seq, cp_parser_parameter_declaration,
293         cp_parser_gnu_attributes_opt): Use it.
294         (cp_parser_member_declaration, cp_parser_objc_class_ivars,
295         cp_parser_objc_struct_declaration): Likewise.  Don't reset
296         prefix_attributes if attributes is error_mark_node.
298 2018-01-17  Paolo Carlini  <paolo.carlini@oracle.com>
300         PR c++/78344
301         * decl.c (grokdeclarator): Do not append the error_mark_node
302         due to an erroneous optional attribute-specifier-seq.
304 2018-01-17  Jakub Jelinek  <jakub@redhat.com>
306         PR c++/83897
307         * cp-gimplify.c (cp_maybe_instrument_return): Handle
308         CLEANUP_POINT_EXPR.
310 2018-01-17  Paolo Carlini  <paolo.carlini@oracle.com>
312         PR c++/81054
313         * constexpr.c (ensure_literal_type_for_constexpr_object): Return
314         error_mark_node when we give an error.
315         * decl.c (cp_finish_decl): Use the latter.
317 2018-01-17  Nathan Sidwell  <nathan@acm.org>
319         PR c++/83287
320         * init.c (build_raw_new_expr): Scan list for lookups to keep.
322 2018-01-17  David Malcolm  <dmalcolm@redhat.com>
324         PR c++/83814
325         * expr.c (fold_for_warn): Move from c-common.c, reducing to just
326         the C++ part.  If processing a template, call
327         fold_non_dependent_expr rather than fully folding.
329 2018-01-17  Jason Merrill  <jason@redhat.com>
331         PR c++/81067 - redundant NULL warning.
332         * call.c (convert_like_real): Restore null_node handling.
334 2018-01-17  Jason Merrill  <jason@redhat.com>
336         PR c++/81843 - ICE with variadic member template.
337         PR c++/72801
338         * pt.c (unify_pack_expansion): Don't try to deduce enclosing
339         template args.
341 2018-01-17  David Malcolm  <dmalcolm@redhat.com>
343         PR c++/83799
344         * pt.c (type_dependent_expression_p): Strip any location wrapper
345         before testing tree codes.
346         (selftest::test_type_dependent_expression_p): New function.
347         (selftest::cp_pt_c_tests): Call it.
349 2018-01-17  Nathan Sidwell  <nathan@acm.org>
351         PR c++/83739
352         * pt.c (tsubst_expr) <case RANGE_FOR_STMT>: Rebuild a range_for if
353         this not a final instantiation.
355 2018-01-16  Jason Merrill  <jason@redhat.com>
357         PR c++/83714 - ICE checking return in template.
358         * typeck.c (check_return_expr): Call build_non_dependent_expr.
360 2018-01-16  Jakub Jelinek  <jakub@redhat.com>
362         PR c++/83817
363         * pt.c (tsubst_copy_and_build) <case CALL_EXPR>: If function
364         is AGGR_INIT_EXPR rather than CALL_EXPR, set AGGR_INIT_FROM_THUNK_P
365         instead of CALL_FROM_THUNK_P.
367         PR c++/83825
368         * name-lookup.c (member_vec_dedup): Return early if len is 0.
369         (resort_type_member_vec, set_class_bindings,
370         insert_late_enum_def_bindings): Use vec qsort method instead of
371         calling qsort directly.
373 2018-01-15  Martin Sebor  <msebor@redhat.com>
375         PR c++/83588
376         * class.c (find_flexarrays): Make a record of multiple flexible array
377         members.
379 2018-01-12  Jason Merrill  <jason@redhat.com>
381         PR c++/83186 - ICE with static_cast of list-initialized temporary.
382         * typeck.c (build_static_cast): Use build_non_dependent_expr.
384 2018-01-12  Nathan Sidwell  <nathan@acm.org>
386         * cp-tree.h (mark_rvalue_use): Add parm name.
387         * expr.c (mark_lvalue_use, mark_lvalue_use_nonread): Move next to
388         mark_rvalue_use.
389         * call.c (convert_like_real): Fix formatting.
391 2018-01-11  Jason Merrill  <jason@redhat.com>
393         PR c++/82728 - wrong -Wunused-but-set-variable
394         PR c++/82799
395         PR c++/83690
396         * call.c (perform_implicit_conversion_flags): Call mark_rvalue_use.
397         * decl.c (case_conversion): Likewise.
398         * semantics.c (finish_static_assert): Call
399         perform_implicit_conversion_flags.
401 2018-01-11  Nathan Sidwell  <nathan@acm.org>
403         * method.c (enum mangling_flags): Delete long-dead enum.
405 2018-01-10  Paolo Carlini  <paolo.carlini@oracle.com>
407         * parser.c (cp_parser_std_attribute_spec): When
408         token_pair::require_open / require_close return false simply
409         return error_mark_node, avoid duplicate cp_parser_error about
410         expected '(' / ')', respectively.
412 2018-01-10  David Malcolm  <dmalcolm@redhat.com>
414         PR c++/43486
415         * call.c (null_ptr_cst_p): Strip location wrappers when
416         converting from '0' to a pointer type in C++11 onwards.
417         (conversion_null_warnings): Replace comparison with null_node with
418         call to null_node_p.
419         (build_over_call): Likewise.
420         * cp-gimplify.c (cp_fold): Remove the early bailout when
421         processing_template_decl.
422         * cp-lang.c (selftest::run_cp_tests): Call
423         selftest::cp_pt_c_tests and selftest::cp_tree_c_tests.
424         * cp-tree.h (cp_expr::maybe_add_location_wrapper): New method.
425         (selftest::run_cp_tests): Move decl to bottom of file.
426         (null_node_p): New inline function.
427         (selftest::cp_pt_c_tests): New decl.
428         (selftest::cp_tree_c_tests): New decl.
429         * cvt.c (build_expr_type_conversion): Replace comparison with
430         null_node with call to null_node_p.
431         * error.c (args_to_string): Likewise.
432         * except.c (build_throw): Likewise.
433         * mangle.c (write_expression): Skip location wrapper nodes.
434         * parser.c (literal_integer_zerop): New function.
435         (cp_parser_postfix_expression): Call maybe_add_location_wrapper on
436         the result for RID_TYPEID. Pass true for new "wrap_locations_p"
437         param of cp_parser_parenthesized_expression_list.  When calling
438         warn_for_memset, replace integer_zerop calls with
439         literal_integer_zerop, eliminating the double logical negation
440         cast to bool.  Eliminate the special-casing for CONST_DECL in
441         favor of the fold_for_warn within warn_for_memset.
442         (cp_parser_parenthesized_expression_list): Add "wrap_locations_p"
443         param, defaulting to false.  Convert "expr" to a cp_expr, and call
444         maybe_add_location_wrapper on it when wrap_locations_p is true.
445         (cp_parser_unary_expression): Call maybe_add_location_wrapper on
446         the result for RID_ALIGNOF and RID_SIZEOF.
447         (cp_parser_builtin_offsetof): Likewise.
448         * pt.c: Include "selftest.h".
449         (tsubst_copy): Handle location wrappers.
450         (tsubst_copy_and_build): Likewise.
451         (build_non_dependent_expr): Likewise.
452         (selftest::test_build_non_dependent_expr): New function.
453         (selftest::cp_pt_c_tests): New function.
454         * tree.c: Include "selftest.h".
455         (lvalue_kind): Handle VIEW_CONVERT_EXPR location wrapper nodes.
456         (selftest::test_lvalue_kind): New function.
457         (selftest::cp_tree_c_tests): New function.
458         * typeck.c (string_conv_p): Strip any location wrapper from "exp".
459         (cp_build_binary_op): Replace comparison with null_node with call
460         to null_node_p.
461         (build_address): Use location of operand when building address
462         expression.
464 2018-01-10  Marek Polacek  <polacek@redhat.com>
466         PR c++/82541
467         * call.c (build_conditional_expr_1): Check complain before warning.
468         * pt.c (tsubst_copy_and_build) <case COND_EXPR>: Suppress
469         -Wduplicated-branches.
471 2018-01-10  Jakub Jelinek  <jakub@redhat.com>
473         PR c++/81327
474         * call.c (maybe_warn_class_memaccess): Add forward declaration.
475         Change last argument from tree * to const vec<tree, va_gc> *, adjust
476         args uses and check number of operands too.  Don't strip away any
477         nops.  Use maybe_constant_value when looking for INTEGER_CST args.
478         Deal with src argument not having pointer type.  Check
479         tree_fits_uhwi_p before calling tree_to_uhwi.  Remove useless
480         test.
481         (build_over_call): Call maybe_warn_class_memaccess here on the
482         original arguments.
483         (build_cxx_call): Rather than here on converted arguments.
485 2018-01-10  Paolo Carlini  <paolo.carlini@oracle.com>
487         PR c++/81055
488         * init.c (build_vec_init): Avoid building an INIT_EXPR with
489         error_mark_node as second argument.
491 2018-01-09  Jakub Jelinek  <jakub@redhat.com>
493         PR c++/83734
494         * constexpr.c (cxx_eval_statement_list): Ignore DEBUG_BEGIN_STMTs
495         in STATEMENT_LIST.  Remove unneeded assert.
497 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
498             Alan Hayward  <alan.hayward@arm.com>
499             David Sherwood  <david.sherwood@arm.com>
501         * constexpr.c (cxx_eval_array_reference): Handle polynomial
502         VECTOR_CST_NELTS.
503         (cxx_fold_indirect_ref): Handle polynomial TYPE_VECTOR_SUBPARTS.
504         * call.c (build_conditional_expr_1): Likewise.
505         * decl.c (cp_finish_decomp): Likewise.
506         * mangle.c (write_type): Likewise.
507         * typeck.c (structural_comptypes): Likewise.
508         (cp_build_binary_op): Likewise.
509         * typeck2.c (process_init_constructor_array): Likewise.
511 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
513         PR c++/83555
514         * typeck.c (build_static_cast_1): For static casts to reference types,
515         call build_base_path with flag_delete_null_pointer_checks as nonnull
516         instead of always false.  When -fsanitize=null, call
517         ubsan_maybe_instrument_reference on the NULL reference INTEGER_CST.
518         * cp-gimplify.c (cp_genericize_r): Don't walk subtrees of UBSAN_NULL
519         call if the first argument is INTEGER_CST with REFERENCE_TYPE.
521 2018-01-03  Nathan Sidwell  <nathan@acm.org>
523         PR c++/83667
524         * method.c (make_alias_for): Copy DECL_CONTEXT.
526 2018-01-03  Marek Polacek  <polacek@redhat.com>
528         PR c++/83592
529         * decl.c (grokdeclarator): Don't warn about MVP in typename context.
531 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
533         PR preprocessor/83602
534         * name-lookup.c (lookup_name_fuzzy): Don't use macro_use_before_def
535         for builtin macros.
537         PR c++/83634
538         * cp-gimplify.c (cp_fold) <case NOP_EXPR>: If the operand folds to
539         error_mark_node, return error_mark_node.
541         Update copyright years.
543 2018-01-02  Jakub Jelinek  <jakub@redhat.com>
545         PR c++/83556
546         * tree.c (replace_placeholders_r): Pass NULL as last argument to
547         cp_walk_tree instead of d->pset.  If non-TREE_CONSTANT and
548         non-PLACEHOLDER_EXPR tree has been seen already, set *walk_subtrees
549         to false and return.
550         (replace_placeholders): Pass NULL instead of &pset as last argument
551         to cp_walk_tree.
553 2018-01-02  Nathan Sidwell  <nathan@acm.org>
555         * constexpr.c (cxx_bind_parameters_in_call): Remove unneeded local
556         lval var.
558 Copyright (C) 2018 Free Software Foundation, Inc.
560 Copying and distribution of this file, with or without modification,
561 are permitted in any medium without royalty provided the copyright
562 notice and this notice are preserved.