PR c++/82514 - ICE with local class in generic lambda.
[official-gcc.git] / gcc / cp / ChangeLog
blobfd3ff717403d0cb7c6a3516789631e4007863965
1 2018-01-26  Jason Merrill  <jason@redhat.com>
3         PR c++/82514 - ICE with local class in generic lambda.
4         * pt.c (regenerated_lambda_fn_p): Remove.
5         (enclosing_instantiation_of): Don't use it.
6         (tsubst_function_decl): Call enclosing_instantiation_of.
8         * pt.c (lookup_template_class_1): Add sanity check.
9         * name-lookup.c (do_pushtag): Don't add closures to local_classes.
11 2018-01-25  Jakub Jelinek  <jakub@redhat.com>
13         PR c++/84031
14         * decl.c (find_decomp_class_base): Ignore unnamed bitfields.  Ignore
15         recursive calls that return ret.
16         (cp_finish_decomp): Ignore unnamed bitfields.
18 2018-01-23  Jason Merrill  <jason@redhat.com>
20         PR c++/82249 - wrong mismatched pack length error.
21         * pt.c (extract_fnparm_pack, tsubst_pack_expansion): Handle
22         unsubstituted function parameter pack.
24 2018-01-23  Paolo Carlini  <paolo.carlini@oracle.com>
26         PR c++/83921
27         * decl.c (check_for_uninitialized_const_var): Not static; add
28         bool and tsubst_flags_t parameters; adjust to be used both in
29         constexpr context and not.
30         * constexpr.c (potential_constant_expression_1): Use the above.
31         * cp-tree.h (check_for_uninitialized_const_var): Declare.
33 2018-01-23  Jason Merrill  <jason@redhat.com>
35         PR c++/83947 - ICE with auto declarations.
36         * pt.c (do_auto_deduction): Don't deduce from an auto decl.
37         * decl.c (undeduced_auto_decl): Limit to vars and fns.
39 2018-01-23  David Malcolm  <dmalcolm@redhat.com>
41         PR c++/83974
42         * pt.c (tsubst_copy_and_build) <CONSTRUCTOR>: Remove early bailout
43         for pointer to member function types.
45 2018-01-23  Jakub Jelinek  <jakub@redhat.com>
47         PR sanitizer/83987
48         * tree.c (cp_free_lang_data): Change DECL_VALUE_EXPR of
49         DECL_OMP_PRIVATIZED_MEMBER vars to error_mark_node.
51 2018-01-23  Nathan Sidwell  <nathan@acm.org>
53         PR c++/83988
54         * pt.c (tsubst_baselink): Remove optype assert.
55         * ptree.c (cxx_print_xnode): <case BASELINK> Print BASELINK_OPTYPE.
57 2018-01-23  Jakub Jelinek  <jakub@redhat.com>
59         PR c++/83958
60         * decl.c (cp_finish_decomp): Diagnose if reference structure binding
61         refers to incomplete type.
63 2018-01-23  Nathan Sidwell  <nathan@acm.org>
65         Deprecate ARM-era for scope handling
66         * decl.c (poplevel): Flag_new_for_scope is a boolean-like.
67         (cxx_init_decl_processing): Deprecate flag_new_for_scope being
68         cleared.
69         * name-lookup.c (check_for_out_of_scope_variable): Deprecate and
70         cleanup handling.
71         * semantics.c (begin_for_scope): Flag_new_for_scope is
72         boolean-like.
73         (finish_for_stmt, begin_range_for_stmt): Likewise.
75 2018-01-22  Jason Merrill  <jason@redhat.com>
77         PR c++/83720
78         * decl2.c (determine_visibility): Fix template_decl handling
79         instead of blocking it.
81         PR c++/83720 - ICE with lambda and LTO.
82         * decl2.c (determine_visibility): Clear template_decl for
83         function-scope decls.  Propagate anonymous linkage from containing
84         function.
86 2018-01-22  Marek Polacek  <polacek@redhat.com>
88         PR c++/81933
89         * typeck2.c (split_nonconstant_init_1): Return false if we didn't
90         split out anything.
92 2018-01-22  Ville Voutilainen  <ville.voutilainen@gmail.com>
94         PR c++/83895
95         * decl.c (grokdeclarator): Don't diagnose extra parens
96         on typedefs.
98 2018-01-19  Jakub Jelinek  <jakub@redhat.com>
100         PR c++/81167
101         * call.c (joust): Use TREE_TYPE (source) if source is
102         a POINTER_TYPE_P rather than if ! DECL_CONSTRUCTOR_P (w->fn).
104         PR c++/83919
105         * typeck.c (convert_for_assignment): Suppress warn_ignored_qualifiers
106         for direct enum init.
107         * decl.c (reshape_init): Likewise.
109 2018-01-19  Marek Polacek  <polacek@redhat.com>
111         * constexpr.c (fold_simple): Simplify.
113 2018-01-18  Jason Merrill  <jason@redhat.com>
115         PR c++/83714
116         * search.c (any_dependent_bases_p): Handle null TREE_BINFO.
117         * pt.c (instantiation_dependent_scope_ref_p): True if
118         any_dependent_bases_p.
120 2018-01-18  Paolo Carlini  <paolo.carlini@oracle.com>
122         * cp-tree.h: Fix comment typo (DECL_NON_TRIVIALLY_INITIALIZED_P
123         vs DECL_NONTRIVIALLY_INITIALIZED_P).
125 2018-01-18  Jason Merrill  <jason@redhat.com>
127         PR c++/82461 - constexpr list-initialized member
128         * constexpr.c (potential_constant_expression_1): Check
129         TARGET_EXPR_DIRECT_INIT_P.
131 2018-01-18  Paolo Carlini  <paolo.carlini@oracle.com>
133         PR c++/81013
134         * decl.c (xref_basetypes): Early return upon error about derived
135         union.
137 2018-01-18  Nathan Sidwell  <nathan@acm.org>
139         PR c++/83160
140         * cp-tree.h (mark_use): Declare.
141         * expr.c (mark_use): Make extern.
142         * call.c (direct_reference_binding): Set inner conv's
143         rvaluedness_matches_p, if it is an identity.
144         (convert_like_real): Mark lvalue or rvalue use for identity as
145         rvaledness_matches_p demands.
147 2018-01-18  Jakub Jelinek  <jakub@redhat.com>
149         PR c++/83824
150         * parser.c (attr_chainon): New function.
151         (cp_parser_label_for_labeled_statement, cp_parser_decl_specifier_seq,
152         cp_parser_namespace_definition, cp_parser_init_declarator,
153         cp_parser_type_specifier_seq, cp_parser_parameter_declaration,
154         cp_parser_gnu_attributes_opt): Use it.
155         (cp_parser_member_declaration, cp_parser_objc_class_ivars,
156         cp_parser_objc_struct_declaration): Likewise.  Don't reset
157         prefix_attributes if attributes is error_mark_node.
159 2018-01-17  Paolo Carlini  <paolo.carlini@oracle.com>
161         PR c++/78344
162         * decl.c (grokdeclarator): Do not append the error_mark_node
163         due to an erroneous optional attribute-specifier-seq.
165 2018-01-17  Jakub Jelinek  <jakub@redhat.com>
167         PR c++/83897
168         * cp-gimplify.c (cp_maybe_instrument_return): Handle
169         CLEANUP_POINT_EXPR.
171 2018-01-17  Paolo Carlini  <paolo.carlini@oracle.com>
173         PR c++/81054
174         * constexpr.c (ensure_literal_type_for_constexpr_object): Return
175         error_mark_node when we give an error.
176         * decl.c (cp_finish_decl): Use the latter.
178 2018-01-17  Nathan Sidwell  <nathan@acm.org>
180         PR c++/83287
181         * init.c (build_raw_new_expr): Scan list for lookups to keep.
183 2018-01-17  David Malcolm  <dmalcolm@redhat.com>
185         PR c++/83814
186         * expr.c (fold_for_warn): Move from c-common.c, reducing to just
187         the C++ part.  If processing a template, call
188         fold_non_dependent_expr rather than fully folding.
190 2018-01-17  Jason Merrill  <jason@redhat.com>
192         PR c++/81067 - redundant NULL warning.
193         * call.c (convert_like_real): Restore null_node handling.
195 2018-01-17  Jason Merrill  <jason@redhat.com>
197         PR c++/81843 - ICE with variadic member template.
198         PR c++/72801
199         * pt.c (unify_pack_expansion): Don't try to deduce enclosing
200         template args.
202 2018-01-17  David Malcolm  <dmalcolm@redhat.com>
204         PR c++/83799
205         * pt.c (type_dependent_expression_p): Strip any location wrapper
206         before testing tree codes.
207         (selftest::test_type_dependent_expression_p): New function.
208         (selftest::cp_pt_c_tests): Call it.
210 2018-01-17  Nathan Sidwell  <nathan@acm.org>
212         PR c++/83739
213         * pt.c (tsubst_expr) <case RANGE_FOR_STMT>: Rebuild a range_for if
214         this not a final instantiation.
216 2018-01-16  Jason Merrill  <jason@redhat.com>
218         PR c++/83714 - ICE checking return in template.
219         * typeck.c (check_return_expr): Call build_non_dependent_expr.
221 2018-01-16  Jakub Jelinek  <jakub@redhat.com>
223         PR c++/83817
224         * pt.c (tsubst_copy_and_build) <case CALL_EXPR>: If function
225         is AGGR_INIT_EXPR rather than CALL_EXPR, set AGGR_INIT_FROM_THUNK_P
226         instead of CALL_FROM_THUNK_P.
228         PR c++/83825
229         * name-lookup.c (member_vec_dedup): Return early if len is 0.
230         (resort_type_member_vec, set_class_bindings,
231         insert_late_enum_def_bindings): Use vec qsort method instead of
232         calling qsort directly.
234 2018-01-15  Martin Sebor  <msebor@redhat.com>
236         PR c++/83588
237         * class.c (find_flexarrays): Make a record of multiple flexible array
238         members.
240 2018-01-12  Jason Merrill  <jason@redhat.com>
242         PR c++/83186 - ICE with static_cast of list-initialized temporary.
243         * typeck.c (build_static_cast): Use build_non_dependent_expr.
245 2018-01-12  Nathan Sidwell  <nathan@acm.org>
247         * cp-tree.h (mark_rvalue_use): Add parm name.
248         * expr.c (mark_lvalue_use, mark_lvalue_use_nonread): Move next to
249         mark_rvalue_use.
250         * call.c (convert_like_real): Fix formatting.
252 2018-01-11  Jason Merrill  <jason@redhat.com>
254         PR c++/82728 - wrong -Wunused-but-set-variable
255         PR c++/82799
256         PR c++/83690
257         * call.c (perform_implicit_conversion_flags): Call mark_rvalue_use.
258         * decl.c (case_conversion): Likewise.
259         * semantics.c (finish_static_assert): Call
260         perform_implicit_conversion_flags.
262 2018-01-11  Nathan Sidwell  <nathan@acm.org>
264         * method.c (enum mangling_flags): Delete long-dead enum.
266 2018-01-10  Paolo Carlini  <paolo.carlini@oracle.com>
268         * parser.c (cp_parser_std_attribute_spec): When
269         token_pair::require_open / require_close return false simply
270         return error_mark_node, avoid duplicate cp_parser_error about
271         expected '(' / ')', respectively.
273 2018-01-10  David Malcolm  <dmalcolm@redhat.com>
275         PR c++/43486
276         * call.c (null_ptr_cst_p): Strip location wrappers when
277         converting from '0' to a pointer type in C++11 onwards.
278         (conversion_null_warnings): Replace comparison with null_node with
279         call to null_node_p.
280         (build_over_call): Likewise.
281         * cp-gimplify.c (cp_fold): Remove the early bailout when
282         processing_template_decl.
283         * cp-lang.c (selftest::run_cp_tests): Call
284         selftest::cp_pt_c_tests and selftest::cp_tree_c_tests.
285         * cp-tree.h (cp_expr::maybe_add_location_wrapper): New method.
286         (selftest::run_cp_tests): Move decl to bottom of file.
287         (null_node_p): New inline function.
288         (selftest::cp_pt_c_tests): New decl.
289         (selftest::cp_tree_c_tests): New decl.
290         * cvt.c (build_expr_type_conversion): Replace comparison with
291         null_node with call to null_node_p.
292         * error.c (args_to_string): Likewise.
293         * except.c (build_throw): Likewise.
294         * mangle.c (write_expression): Skip location wrapper nodes.
295         * parser.c (literal_integer_zerop): New function.
296         (cp_parser_postfix_expression): Call maybe_add_location_wrapper on
297         the result for RID_TYPEID. Pass true for new "wrap_locations_p"
298         param of cp_parser_parenthesized_expression_list.  When calling
299         warn_for_memset, replace integer_zerop calls with
300         literal_integer_zerop, eliminating the double logical negation
301         cast to bool.  Eliminate the special-casing for CONST_DECL in
302         favor of the fold_for_warn within warn_for_memset.
303         (cp_parser_parenthesized_expression_list): Add "wrap_locations_p"
304         param, defaulting to false.  Convert "expr" to a cp_expr, and call
305         maybe_add_location_wrapper on it when wrap_locations_p is true.
306         (cp_parser_unary_expression): Call maybe_add_location_wrapper on
307         the result for RID_ALIGNOF and RID_SIZEOF.
308         (cp_parser_builtin_offsetof): Likewise.
309         * pt.c: Include "selftest.h".
310         (tsubst_copy): Handle location wrappers.
311         (tsubst_copy_and_build): Likewise.
312         (build_non_dependent_expr): Likewise.
313         (selftest::test_build_non_dependent_expr): New function.
314         (selftest::cp_pt_c_tests): New function.
315         * tree.c: Include "selftest.h".
316         (lvalue_kind): Handle VIEW_CONVERT_EXPR location wrapper nodes.
317         (selftest::test_lvalue_kind): New function.
318         (selftest::cp_tree_c_tests): New function.
319         * typeck.c (string_conv_p): Strip any location wrapper from "exp".
320         (cp_build_binary_op): Replace comparison with null_node with call
321         to null_node_p.
322         (build_address): Use location of operand when building address
323         expression.
325 2018-01-10  Marek Polacek  <polacek@redhat.com>
327         PR c++/82541
328         * call.c (build_conditional_expr_1): Check complain before warning.
329         * pt.c (tsubst_copy_and_build) <case COND_EXPR>: Suppress
330         -Wduplicated-branches.
332 2018-01-10  Jakub Jelinek  <jakub@redhat.com>
334         PR c++/81327
335         * call.c (maybe_warn_class_memaccess): Add forward declaration.
336         Change last argument from tree * to const vec<tree, va_gc> *, adjust
337         args uses and check number of operands too.  Don't strip away any
338         nops.  Use maybe_constant_value when looking for INTEGER_CST args.
339         Deal with src argument not having pointer type.  Check
340         tree_fits_uhwi_p before calling tree_to_uhwi.  Remove useless
341         test.
342         (build_over_call): Call maybe_warn_class_memaccess here on the
343         original arguments.
344         (build_cxx_call): Rather than here on converted arguments.
346 2018-01-10  Paolo Carlini  <paolo.carlini@oracle.com>
348         PR c++/81055
349         * init.c (build_vec_init): Avoid building an INIT_EXPR with
350         error_mark_node as second argument.
352 2018-01-09  Jakub Jelinek  <jakub@redhat.com>
354         PR c++/83734
355         * constexpr.c (cxx_eval_statement_list): Ignore DEBUG_BEGIN_STMTs
356         in STATEMENT_LIST.  Remove unneeded assert.
358 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
359             Alan Hayward  <alan.hayward@arm.com>
360             David Sherwood  <david.sherwood@arm.com>
362         * constexpr.c (cxx_eval_array_reference): Handle polynomial
363         VECTOR_CST_NELTS.
364         (cxx_fold_indirect_ref): Handle polynomial TYPE_VECTOR_SUBPARTS.
365         * call.c (build_conditional_expr_1): Likewise.
366         * decl.c (cp_finish_decomp): Likewise.
367         * mangle.c (write_type): Likewise.
368         * typeck.c (structural_comptypes): Likewise.
369         (cp_build_binary_op): Likewise.
370         * typeck2.c (process_init_constructor_array): Likewise.
372 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
374         PR c++/83555
375         * typeck.c (build_static_cast_1): For static casts to reference types,
376         call build_base_path with flag_delete_null_pointer_checks as nonnull
377         instead of always false.  When -fsanitize=null, call
378         ubsan_maybe_instrument_reference on the NULL reference INTEGER_CST.
379         * cp-gimplify.c (cp_genericize_r): Don't walk subtrees of UBSAN_NULL
380         call if the first argument is INTEGER_CST with REFERENCE_TYPE.
382 2018-01-03  Nathan Sidwell  <nathan@acm.org>
384         PR c++/83667
385         * method.c (make_alias_for): Copy DECL_CONTEXT.
387 2018-01-03  Marek Polacek  <polacek@redhat.com>
389         PR c++/83592
390         * decl.c (grokdeclarator): Don't warn about MVP in typename context.
392 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
394         PR preprocessor/83602
395         * name-lookup.c (lookup_name_fuzzy): Don't use macro_use_before_def
396         for builtin macros.
398         PR c++/83634
399         * cp-gimplify.c (cp_fold) <case NOP_EXPR>: If the operand folds to
400         error_mark_node, return error_mark_node.
402         Update copyright years.
404 2018-01-02  Jakub Jelinek  <jakub@redhat.com>
406         PR c++/83556
407         * tree.c (replace_placeholders_r): Pass NULL as last argument to
408         cp_walk_tree instead of d->pset.  If non-TREE_CONSTANT and
409         non-PLACEHOLDER_EXPR tree has been seen already, set *walk_subtrees
410         to false and return.
411         (replace_placeholders): Pass NULL instead of &pset as last argument
412         to cp_walk_tree.
414 2018-01-02  Nathan Sidwell  <nathan@acm.org>
416         * constexpr.c (cxx_bind_parameters_in_call): Remove unneeded local
417         lval var.
419 Copyright (C) 2018 Free Software Foundation, Inc.
421 Copying and distribution of this file, with or without modification,
422 are permitted in any medium without royalty provided the copyright
423 notice and this notice are preserved.