PR c++/83993
[official-gcc.git] / gcc / cp / ChangeLog
blobc8df8f12f14cc27eb625270defe3425ca04c6676
1 2018-01-31  Jakub Jelinek  <jakub@redhat.com>
3         PR c++/83993
4         * constexpr.c (diag_array_subscript): Emit different diagnostics
5         if TYPE_DOMAIN (arraytype) is NULL.
6         (cxx_eval_array_reference, cxx_eval_store_expression): For arrays
7         with NULL TYPE_DOMAIN use size_zero_node as nelts.
9 2018-01-31  Paolo Carlini  <paolo.carlini@oracle.com>
11         PR c++/84092
12         * semantics.c (finish_qualified_id_expr): When handling an
13         UNBOUND_CLASS_TEMPLATE only adjust qualifying_class and expr.
15 2018-01-31  Marek Polacek  <polacek@redhat.com>
17         PR c++/84138
18         * cp-gimplify.c (cp_fold): Check if X is an error node before
19         calling useless_type_conversion_p.
21 2018-01-30  Jason Merrill  <jason@redhat.com>
23         PR c++/84091 - ICE with local class in lambda in template.
24         * decl2.c (determine_visibility): Look for outer containing template
25         instantiation.
27         PR c++/84098 - ICE with lambda in template NSDMI.
28         * pt.c (instantiate_class_template_1): Ignore more lambdas.
30 2018-01-29  Jason Merrill  <jason@redhat.com>
32         PR c++/68810 - wrong location for reinterpret_cast error.
33         * cvt.c (cp_convert_to_pointer): Always build a CONVERT_EXPR when
34         !dofold.
36 2018-01-29  Marek Polacek  <polacek@redhat.com>
38         PR c++/83996
39         * constexpr.c (cxx_fold_indirect_ref): Compute ((foo *)&fooarray)[1]
40         => fooarray[1] in offset_int.
42 2018-01-29  Jason Merrill  <jason@redhat.com>
44         PR c++/83942 - wrong unused warning with static_cast.
45         * cvt.c (ocp_convert): Call mark_rvalue_use.
47 2018-01-26  Jason Merrill  <jason@redhat.com>
49         PR c++/83956 - wrong dtor error with anonymous union
50         * method.c (walk_field_subobs): Variant members only affect
51         deletedness.
52         (maybe_explain_implicit_delete): Pass &deleted_p for diagnostic.
54         PR c++/84036 - ICE with variadic capture.
55         PR c++/82249
56         * pt.c (tsubst_pack_expansion): When optimizing a simple
57         substitution, pull a single pack expansion out of its pack.
59         PR c++/82514 - ICE with local class in generic lambda.
60         * pt.c (regenerated_lambda_fn_p): Remove.
61         (enclosing_instantiation_of): Don't use it.
62         (tsubst_function_decl): Call enclosing_instantiation_of.
64         * pt.c (lookup_template_class_1): Add sanity check.
65         * name-lookup.c (do_pushtag): Don't add closures to local_classes.
67 2018-01-25  Jakub Jelinek  <jakub@redhat.com>
69         PR c++/84031
70         * decl.c (find_decomp_class_base): Ignore unnamed bitfields.  Ignore
71         recursive calls that return ret.
72         (cp_finish_decomp): Ignore unnamed bitfields.
74 2018-01-23  Jason Merrill  <jason@redhat.com>
76         PR c++/82249 - wrong mismatched pack length error.
77         * pt.c (extract_fnparm_pack, tsubst_pack_expansion): Handle
78         unsubstituted function parameter pack.
80 2018-01-23  Paolo Carlini  <paolo.carlini@oracle.com>
82         PR c++/83921
83         * decl.c (check_for_uninitialized_const_var): Not static; add
84         bool and tsubst_flags_t parameters; adjust to be used both in
85         constexpr context and not.
86         * constexpr.c (potential_constant_expression_1): Use the above.
87         * cp-tree.h (check_for_uninitialized_const_var): Declare.
89 2018-01-23  Jason Merrill  <jason@redhat.com>
91         PR c++/83947 - ICE with auto declarations.
92         * pt.c (do_auto_deduction): Don't deduce from an auto decl.
93         * decl.c (undeduced_auto_decl): Limit to vars and fns.
95 2018-01-23  David Malcolm  <dmalcolm@redhat.com>
97         PR c++/83974
98         * pt.c (tsubst_copy_and_build) <CONSTRUCTOR>: Remove early bailout
99         for pointer to member function types.
101 2018-01-23  Jakub Jelinek  <jakub@redhat.com>
103         PR sanitizer/83987
104         * tree.c (cp_free_lang_data): Change DECL_VALUE_EXPR of
105         DECL_OMP_PRIVATIZED_MEMBER vars to error_mark_node.
107 2018-01-23  Nathan Sidwell  <nathan@acm.org>
109         PR c++/83988
110         * pt.c (tsubst_baselink): Remove optype assert.
111         * ptree.c (cxx_print_xnode): <case BASELINK> Print BASELINK_OPTYPE.
113 2018-01-23  Jakub Jelinek  <jakub@redhat.com>
115         PR c++/83958
116         * decl.c (cp_finish_decomp): Diagnose if reference structure binding
117         refers to incomplete type.
119 2018-01-23  Nathan Sidwell  <nathan@acm.org>
121         Deprecate ARM-era for scope handling
122         * decl.c (poplevel): Flag_new_for_scope is a boolean-like.
123         (cxx_init_decl_processing): Deprecate flag_new_for_scope being
124         cleared.
125         * name-lookup.c (check_for_out_of_scope_variable): Deprecate and
126         cleanup handling.
127         * semantics.c (begin_for_scope): Flag_new_for_scope is
128         boolean-like.
129         (finish_for_stmt, begin_range_for_stmt): Likewise.
131 2018-01-22  Jason Merrill  <jason@redhat.com>
133         PR c++/83720
134         * decl2.c (determine_visibility): Fix template_decl handling
135         instead of blocking it.
137         PR c++/83720 - ICE with lambda and LTO.
138         * decl2.c (determine_visibility): Clear template_decl for
139         function-scope decls.  Propagate anonymous linkage from containing
140         function.
142 2018-01-22  Marek Polacek  <polacek@redhat.com>
144         PR c++/81933
145         * typeck2.c (split_nonconstant_init_1): Return false if we didn't
146         split out anything.
148 2018-01-22  Ville Voutilainen  <ville.voutilainen@gmail.com>
150         PR c++/83895
151         * decl.c (grokdeclarator): Don't diagnose extra parens
152         on typedefs.
154 2018-01-19  Jakub Jelinek  <jakub@redhat.com>
156         PR c++/81167
157         * call.c (joust): Use TREE_TYPE (source) if source is
158         a POINTER_TYPE_P rather than if ! DECL_CONSTRUCTOR_P (w->fn).
160         PR c++/83919
161         * typeck.c (convert_for_assignment): Suppress warn_ignored_qualifiers
162         for direct enum init.
163         * decl.c (reshape_init): Likewise.
165 2018-01-19  Marek Polacek  <polacek@redhat.com>
167         * constexpr.c (fold_simple): Simplify.
169 2018-01-18  Jason Merrill  <jason@redhat.com>
171         PR c++/83714
172         * search.c (any_dependent_bases_p): Handle null TREE_BINFO.
173         * pt.c (instantiation_dependent_scope_ref_p): True if
174         any_dependent_bases_p.
176 2018-01-18  Paolo Carlini  <paolo.carlini@oracle.com>
178         * cp-tree.h: Fix comment typo (DECL_NON_TRIVIALLY_INITIALIZED_P
179         vs DECL_NONTRIVIALLY_INITIALIZED_P).
181 2018-01-18  Jason Merrill  <jason@redhat.com>
183         PR c++/82461 - constexpr list-initialized member
184         * constexpr.c (potential_constant_expression_1): Check
185         TARGET_EXPR_DIRECT_INIT_P.
187 2018-01-18  Paolo Carlini  <paolo.carlini@oracle.com>
189         PR c++/81013
190         * decl.c (xref_basetypes): Early return upon error about derived
191         union.
193 2018-01-18  Nathan Sidwell  <nathan@acm.org>
195         PR c++/83160
196         * cp-tree.h (mark_use): Declare.
197         * expr.c (mark_use): Make extern.
198         * call.c (direct_reference_binding): Set inner conv's
199         rvaluedness_matches_p, if it is an identity.
200         (convert_like_real): Mark lvalue or rvalue use for identity as
201         rvaledness_matches_p demands.
203 2018-01-18  Jakub Jelinek  <jakub@redhat.com>
205         PR c++/83824
206         * parser.c (attr_chainon): New function.
207         (cp_parser_label_for_labeled_statement, cp_parser_decl_specifier_seq,
208         cp_parser_namespace_definition, cp_parser_init_declarator,
209         cp_parser_type_specifier_seq, cp_parser_parameter_declaration,
210         cp_parser_gnu_attributes_opt): Use it.
211         (cp_parser_member_declaration, cp_parser_objc_class_ivars,
212         cp_parser_objc_struct_declaration): Likewise.  Don't reset
213         prefix_attributes if attributes is error_mark_node.
215 2018-01-17  Paolo Carlini  <paolo.carlini@oracle.com>
217         PR c++/78344
218         * decl.c (grokdeclarator): Do not append the error_mark_node
219         due to an erroneous optional attribute-specifier-seq.
221 2018-01-17  Jakub Jelinek  <jakub@redhat.com>
223         PR c++/83897
224         * cp-gimplify.c (cp_maybe_instrument_return): Handle
225         CLEANUP_POINT_EXPR.
227 2018-01-17  Paolo Carlini  <paolo.carlini@oracle.com>
229         PR c++/81054
230         * constexpr.c (ensure_literal_type_for_constexpr_object): Return
231         error_mark_node when we give an error.
232         * decl.c (cp_finish_decl): Use the latter.
234 2018-01-17  Nathan Sidwell  <nathan@acm.org>
236         PR c++/83287
237         * init.c (build_raw_new_expr): Scan list for lookups to keep.
239 2018-01-17  David Malcolm  <dmalcolm@redhat.com>
241         PR c++/83814
242         * expr.c (fold_for_warn): Move from c-common.c, reducing to just
243         the C++ part.  If processing a template, call
244         fold_non_dependent_expr rather than fully folding.
246 2018-01-17  Jason Merrill  <jason@redhat.com>
248         PR c++/81067 - redundant NULL warning.
249         * call.c (convert_like_real): Restore null_node handling.
251 2018-01-17  Jason Merrill  <jason@redhat.com>
253         PR c++/81843 - ICE with variadic member template.
254         PR c++/72801
255         * pt.c (unify_pack_expansion): Don't try to deduce enclosing
256         template args.
258 2018-01-17  David Malcolm  <dmalcolm@redhat.com>
260         PR c++/83799
261         * pt.c (type_dependent_expression_p): Strip any location wrapper
262         before testing tree codes.
263         (selftest::test_type_dependent_expression_p): New function.
264         (selftest::cp_pt_c_tests): Call it.
266 2018-01-17  Nathan Sidwell  <nathan@acm.org>
268         PR c++/83739
269         * pt.c (tsubst_expr) <case RANGE_FOR_STMT>: Rebuild a range_for if
270         this not a final instantiation.
272 2018-01-16  Jason Merrill  <jason@redhat.com>
274         PR c++/83714 - ICE checking return in template.
275         * typeck.c (check_return_expr): Call build_non_dependent_expr.
277 2018-01-16  Jakub Jelinek  <jakub@redhat.com>
279         PR c++/83817
280         * pt.c (tsubst_copy_and_build) <case CALL_EXPR>: If function
281         is AGGR_INIT_EXPR rather than CALL_EXPR, set AGGR_INIT_FROM_THUNK_P
282         instead of CALL_FROM_THUNK_P.
284         PR c++/83825
285         * name-lookup.c (member_vec_dedup): Return early if len is 0.
286         (resort_type_member_vec, set_class_bindings,
287         insert_late_enum_def_bindings): Use vec qsort method instead of
288         calling qsort directly.
290 2018-01-15  Martin Sebor  <msebor@redhat.com>
292         PR c++/83588
293         * class.c (find_flexarrays): Make a record of multiple flexible array
294         members.
296 2018-01-12  Jason Merrill  <jason@redhat.com>
298         PR c++/83186 - ICE with static_cast of list-initialized temporary.
299         * typeck.c (build_static_cast): Use build_non_dependent_expr.
301 2018-01-12  Nathan Sidwell  <nathan@acm.org>
303         * cp-tree.h (mark_rvalue_use): Add parm name.
304         * expr.c (mark_lvalue_use, mark_lvalue_use_nonread): Move next to
305         mark_rvalue_use.
306         * call.c (convert_like_real): Fix formatting.
308 2018-01-11  Jason Merrill  <jason@redhat.com>
310         PR c++/82728 - wrong -Wunused-but-set-variable
311         PR c++/82799
312         PR c++/83690
313         * call.c (perform_implicit_conversion_flags): Call mark_rvalue_use.
314         * decl.c (case_conversion): Likewise.
315         * semantics.c (finish_static_assert): Call
316         perform_implicit_conversion_flags.
318 2018-01-11  Nathan Sidwell  <nathan@acm.org>
320         * method.c (enum mangling_flags): Delete long-dead enum.
322 2018-01-10  Paolo Carlini  <paolo.carlini@oracle.com>
324         * parser.c (cp_parser_std_attribute_spec): When
325         token_pair::require_open / require_close return false simply
326         return error_mark_node, avoid duplicate cp_parser_error about
327         expected '(' / ')', respectively.
329 2018-01-10  David Malcolm  <dmalcolm@redhat.com>
331         PR c++/43486
332         * call.c (null_ptr_cst_p): Strip location wrappers when
333         converting from '0' to a pointer type in C++11 onwards.
334         (conversion_null_warnings): Replace comparison with null_node with
335         call to null_node_p.
336         (build_over_call): Likewise.
337         * cp-gimplify.c (cp_fold): Remove the early bailout when
338         processing_template_decl.
339         * cp-lang.c (selftest::run_cp_tests): Call
340         selftest::cp_pt_c_tests and selftest::cp_tree_c_tests.
341         * cp-tree.h (cp_expr::maybe_add_location_wrapper): New method.
342         (selftest::run_cp_tests): Move decl to bottom of file.
343         (null_node_p): New inline function.
344         (selftest::cp_pt_c_tests): New decl.
345         (selftest::cp_tree_c_tests): New decl.
346         * cvt.c (build_expr_type_conversion): Replace comparison with
347         null_node with call to null_node_p.
348         * error.c (args_to_string): Likewise.
349         * except.c (build_throw): Likewise.
350         * mangle.c (write_expression): Skip location wrapper nodes.
351         * parser.c (literal_integer_zerop): New function.
352         (cp_parser_postfix_expression): Call maybe_add_location_wrapper on
353         the result for RID_TYPEID. Pass true for new "wrap_locations_p"
354         param of cp_parser_parenthesized_expression_list.  When calling
355         warn_for_memset, replace integer_zerop calls with
356         literal_integer_zerop, eliminating the double logical negation
357         cast to bool.  Eliminate the special-casing for CONST_DECL in
358         favor of the fold_for_warn within warn_for_memset.
359         (cp_parser_parenthesized_expression_list): Add "wrap_locations_p"
360         param, defaulting to false.  Convert "expr" to a cp_expr, and call
361         maybe_add_location_wrapper on it when wrap_locations_p is true.
362         (cp_parser_unary_expression): Call maybe_add_location_wrapper on
363         the result for RID_ALIGNOF and RID_SIZEOF.
364         (cp_parser_builtin_offsetof): Likewise.
365         * pt.c: Include "selftest.h".
366         (tsubst_copy): Handle location wrappers.
367         (tsubst_copy_and_build): Likewise.
368         (build_non_dependent_expr): Likewise.
369         (selftest::test_build_non_dependent_expr): New function.
370         (selftest::cp_pt_c_tests): New function.
371         * tree.c: Include "selftest.h".
372         (lvalue_kind): Handle VIEW_CONVERT_EXPR location wrapper nodes.
373         (selftest::test_lvalue_kind): New function.
374         (selftest::cp_tree_c_tests): New function.
375         * typeck.c (string_conv_p): Strip any location wrapper from "exp".
376         (cp_build_binary_op): Replace comparison with null_node with call
377         to null_node_p.
378         (build_address): Use location of operand when building address
379         expression.
381 2018-01-10  Marek Polacek  <polacek@redhat.com>
383         PR c++/82541
384         * call.c (build_conditional_expr_1): Check complain before warning.
385         * pt.c (tsubst_copy_and_build) <case COND_EXPR>: Suppress
386         -Wduplicated-branches.
388 2018-01-10  Jakub Jelinek  <jakub@redhat.com>
390         PR c++/81327
391         * call.c (maybe_warn_class_memaccess): Add forward declaration.
392         Change last argument from tree * to const vec<tree, va_gc> *, adjust
393         args uses and check number of operands too.  Don't strip away any
394         nops.  Use maybe_constant_value when looking for INTEGER_CST args.
395         Deal with src argument not having pointer type.  Check
396         tree_fits_uhwi_p before calling tree_to_uhwi.  Remove useless
397         test.
398         (build_over_call): Call maybe_warn_class_memaccess here on the
399         original arguments.
400         (build_cxx_call): Rather than here on converted arguments.
402 2018-01-10  Paolo Carlini  <paolo.carlini@oracle.com>
404         PR c++/81055
405         * init.c (build_vec_init): Avoid building an INIT_EXPR with
406         error_mark_node as second argument.
408 2018-01-09  Jakub Jelinek  <jakub@redhat.com>
410         PR c++/83734
411         * constexpr.c (cxx_eval_statement_list): Ignore DEBUG_BEGIN_STMTs
412         in STATEMENT_LIST.  Remove unneeded assert.
414 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
415             Alan Hayward  <alan.hayward@arm.com>
416             David Sherwood  <david.sherwood@arm.com>
418         * constexpr.c (cxx_eval_array_reference): Handle polynomial
419         VECTOR_CST_NELTS.
420         (cxx_fold_indirect_ref): Handle polynomial TYPE_VECTOR_SUBPARTS.
421         * call.c (build_conditional_expr_1): Likewise.
422         * decl.c (cp_finish_decomp): Likewise.
423         * mangle.c (write_type): Likewise.
424         * typeck.c (structural_comptypes): Likewise.
425         (cp_build_binary_op): Likewise.
426         * typeck2.c (process_init_constructor_array): Likewise.
428 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
430         PR c++/83555
431         * typeck.c (build_static_cast_1): For static casts to reference types,
432         call build_base_path with flag_delete_null_pointer_checks as nonnull
433         instead of always false.  When -fsanitize=null, call
434         ubsan_maybe_instrument_reference on the NULL reference INTEGER_CST.
435         * cp-gimplify.c (cp_genericize_r): Don't walk subtrees of UBSAN_NULL
436         call if the first argument is INTEGER_CST with REFERENCE_TYPE.
438 2018-01-03  Nathan Sidwell  <nathan@acm.org>
440         PR c++/83667
441         * method.c (make_alias_for): Copy DECL_CONTEXT.
443 2018-01-03  Marek Polacek  <polacek@redhat.com>
445         PR c++/83592
446         * decl.c (grokdeclarator): Don't warn about MVP in typename context.
448 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
450         PR preprocessor/83602
451         * name-lookup.c (lookup_name_fuzzy): Don't use macro_use_before_def
452         for builtin macros.
454         PR c++/83634
455         * cp-gimplify.c (cp_fold) <case NOP_EXPR>: If the operand folds to
456         error_mark_node, return error_mark_node.
458         Update copyright years.
460 2018-01-02  Jakub Jelinek  <jakub@redhat.com>
462         PR c++/83556
463         * tree.c (replace_placeholders_r): Pass NULL as last argument to
464         cp_walk_tree instead of d->pset.  If non-TREE_CONSTANT and
465         non-PLACEHOLDER_EXPR tree has been seen already, set *walk_subtrees
466         to false and return.
467         (replace_placeholders): Pass NULL instead of &pset as last argument
468         to cp_walk_tree.
470 2018-01-02  Nathan Sidwell  <nathan@acm.org>
472         * constexpr.c (cxx_bind_parameters_in_call): Remove unneeded local
473         lval var.
475 Copyright (C) 2018 Free Software Foundation, Inc.
477 Copying and distribution of this file, with or without modification,
478 are permitted in any medium without royalty provided the copyright
479 notice and this notice are preserved.