PR c++/89119 - ICE with value-initialization in template.
[official-gcc.git] / gcc / cp / ChangeLog
blob4b90951885897ed79457794d09df3674dd3343b8
1 2019-01-30  Marek Polacek  <polacek@redhat.com>
3         PR c++/89119 - ICE with value-initialization in template.
4         * pt.c (tsubst_copy_and_build): Handle RANGE_EXPR.
6 2019-01-29  Jason Merrill  <jason@redhat.com>
8         PR c++/86943 - wrong code converting lambda to function pointer.
9         * lambda.c (maybe_add_lambda_conv_op): Use a template-id in the
10         call.  Only forward parms for decltype.
11         * pt.c (tsubst_copy_and_build) [CALL_EXPR]: Handle CALL_FROM_THUNK_P
12         specially.
13         * typeck.c (check_return_expr): Don't mess with a thunk call.
15 2019-01-28  Jason Merrill  <jason@redhat.com>
17         PR c++/89089 - ICE with [[no_unique_address]].
18         PR c++/88865 - wrong layout with [[no_unique_address]].
19         * class.c (check_field_decls): A potentially-overlapping field makes
20         the class non-layout-POD, but not non-empty.
21         (end_of_class): Always consider empty data members.
22         (layout_class_type): Set DECL_SIZE for empty fields.
24 2019-01-28  Marek Polacek  <polacek@redhat.com>
26         PR c++/88358 - name wrongly treated as type.
27         * parser.c (cp_parser_direct_declarator): Don't assume a qualified-id
28         in parameter-list is a type if the function's declarator-id is not
29         qualified.
31 2019-01-27  Marek Polacek  <polacek@redhat.com>
33         PR c++/88815 - narrowing conversion lost in decltype.
34         PR c++/78244 - narrowing conversion in template not detected.
35         * cp-tree.h (CONSTRUCTOR_IS_DEPENDENT): New.
36         * pt.c (instantiation_dependent_r): Consider a CONSTRUCTOR with
37         CONSTRUCTOR_IS_DEPENDENT instantiation-dependent.
38         * semantics.c (finish_compound_literal): When the compound literal
39         isn't instantiation-dependent and the type isn't type-dependent,
40         fall back to the normal processing.  Set CONSTRUCTOR_IS_DEPENDENT.
42         PR c++/89024 - ICE with incomplete enum type.
43         * call.c (standard_conversion): When converting an
44         ARITHMETIC_TYPE_P to an incomplete type, return NULL.
45         
46 2019-01-25  Paolo Carlini  <paolo.carlini@oracle.com>
48         PR c++/88969
49         * call.c (build_op_delete_call): Implement 7.6.2.5/(10.1).
50         * decl2.c (coerce_delete_type): Use build_pointer_type instead
51         of TYPE_POINTER_TO.
53 2019-01-24  Jason Merrill  <jason@redhat.com>
55         PR c++/89001 - mangling of reference temporaries
56         * cp-tree.h (struct saved_scope): Add ref_temp_count.
57         (current_ref_temp_count): New macro.
58         * mangle.c (mangle_ref_init_variable): Use it.
59         * typeck2.c (store_init_value): Clear it.
60         * call.c (make_temporary_var_for_ref_to_temp): Copy public and
61         comdat.
63 2019-01-24  Jakub Jelinek  <jakub@redhat.com>
65         PR c++/88976
66         * semantics.c (finish_omp_cancel): Diagnose more than one if
67         on #pragma omp cancel with different modifiers.  Use
68         maybe_convert_cond when not in template or build_x_binary_op
69         otherwise.
71 2019-01-23  Marek Polacek  <polacek@redhat.com>
73         PR c++/88757 - qualified name treated wrongly as type.
74         * parser.c (cp_parser_direct_declarator): Don't treat qualified-ids
75         in parameter-list as types if name lookup for declarator-id didn't
76         find one or more function templates.
78 2019-01-23  Jakub Jelinek  <jakub@redhat.com>
80         PR c/44715
81         * cp-gimplify.c (genericize_cp_loop): Call begin_bc_block only
82         after genericizing cond and incr expressions.
84         PR c++/88984
85         * cp-gimplify.c (genericize_switch_stmt): Move cond genericization
86         before the begin_bc_block call.
88 2019-01-21  Jason Merrill  <jason@redhat.com>
90         PR c++/87893 - constexpr ctor ICE on ARM.
91         PR c++/88293 - ICE with comma expression.
92         * constexpr.c (initialized_type): Don't shortcut non-void type.
93         Handle COMPOUND_EXPR.
94         (cxx_eval_outermost_constant_expr): Return early for void type.
96 2019-01-21  Jakub Jelinek  <jakub@redhat.com>
98         PR c++/88949
99         * optimize.c (cxx_copy_decl): New function.
100         (clone_body): Use it instead of copy_decl_no_change.
102         PR sanitizer/88901
103         * typeck.c (cp_build_binary_op): Don't instrument
104         SANITIZE_POINTER_COMPARE if processing_template_decl.
105         (pointer_diff): Similarly for SANITIZE_POINTER_SUBTRACT.
107 2019-01-18  Jason Merrill  <jason@redhat.com>
109         PR c++/88875 - error with explicit list constructor.
110         * call.c (reference_binding): Don't modify EXPR.  Set
111         need_temporary_p on the ck_user conversion for a temporary.
112         (convert_like_real): Check it.
114 2019-01-18  H.J. Lu  <hongjiu.lu@intel.com>
116         PR c/51628
117         PR c/88664
118         * call.c (convert_for_arg_passing): Upate the
119         warn_for_address_or_pointer_of_packed_member call.
120         * typeck.c (convert_for_assignment): Likewise.
122 2019-01-17  Jason Merrill  <jason@redhat.com>
124         PR c++/86205 - ICE with ?: of throw and template-id.
125         * pt.c (resolve_nondeduced_context_or_error): Split out from...
126         * typeck.c (decay_conversion): ...here.
127         * call.c (build_conditional_expr_1): Use it.
129         PR c++/86740, ICE with constexpr if and nested generic lambdas.
130         * tree.c (cp_walk_subtrees): Handle LAMBDA_EXPR.
132 2019-01-17  Paolo Carlini  <paolo.carlini@oracle.com>
134         * decl.c (grokdeclarator): Use typespec_loc in error messages
135         about 'auto' and trailing return type.
137 2019-01-17  David Malcolm  <dmalcolm@redhat.com>
139         PR c++/88699
140         * class.c (add_method): Don't use DECL_DESTRUCTOR_P on
141         USING_DECLs.
143 2019-01-17  Nathan Sidwell  <nathan@acm.org>
145         PR c++/86610
146         * semantics.c (process_outer_var_ref): Only skip dependent types
147         in templates.
149 2019-01-17  Alexandre Oliva <aoliva@redhat.com>
151         PR c++/87768
152         * cp-tree.h (saved_scope): Add suppress_location_wrappers.
153         * name-lookup.c (do_push_to_top_level): Save and reset it.
154         (do_pop_from_top_level): Restore it.
156         PR c++/86648
157         * pt.c (make_template_placeholder): Use auto_identifier.
158         (is_auto): Drop CLASS_PLACEHOLDER_TEMPLATE test.
159         * error.c (dump_type): Handle template placeholders.
160         * cxx-pretty-print.c (pp_cx_unqualified_id): Likewise.
162         PR c++/88146
163         * cvt.c (convert_to_void): Handle all cdtor calls as if
164         returning void.
166 2019-01-16  Paolo Carlini  <paolo.carlini@oracle.com>
168         * decl.c (grokdeclarator): Use locations[ds_storage_class] in
169         error messages about ill-formed uses of mutable.
171 2019-01-16  Marek Polacek  <polacek@redhat.com>
173         PR c++/78244 - narrowing conversion in template not detected.
174         * call.c (perform_implicit_conversion_flags): Set
175         IMPLICIT_CONV_EXPR_BRACED_INIT.
176         * cp-tree.h (IMPLICIT_CONV_EXPR_BRACED_INIT): New.
177         * pt.c (tsubst_copy_and_build): Use it.
179 2019-01-15  David Malcolm  <dmalcolm@redhat.com>
181         PR c++/88795
182         * pt.c (build_deduction_guide): Bail out if tsubst_arg_types
183         fails.
185 2019-01-15  Paolo Carlini  <paolo.carlini@oracle.com>
187         * decl.c (start_decl): Improve error location.
188         * decl2.c (grokfield): Likewise.
190 2019-01-15  Paolo Carlini  <paolo.carlini@oracle.com>
192         * decl.c (grokdeclarator): Move further up the location_t loc
193         declaration and use the location when building a TYPE_DECL for
194         a typedef name.
195         * decl2.c (grokbitfield): Use DECL_SOURCE_LOCATION in the error
196         about an ill-formed bit-field as typedef.
198 2019-01-14  Marek Polacek  <polacek@redhat.com>
200         PR c++/88830 - ICE with abstract class.
201         * decl2.c (maybe_emit_vtables): Check CLASSTYPE_LAZY_DESTRUCTOR.
202         Fix formatting.
204         PR c++/88825 - ICE with bogus function return type deduction.
205         * typeck.c (can_do_nrvo_p): Check error_mark_node.
207 2019-01-14  Tom Honermann  <tom@honermann.net>
209         Implement P0482R5, char8_t: A type for UTF-8 characters and strings
210         * cvt.c (type_promotes_to): Handle char8_t promotion.
211         * decl.c (grokdeclarator): Handle invalid type specifier
212         combinations involving char8_t.
213         * lex.c (init_reswords): Add char8_t as a reserved word.
214         * mangle.c (write_builtin_type): Add name mangling for char8_t (Du).
215         * parser.c (cp_keyword_starts_decl_specifier_p)
216         (cp_parser_simple_type_specifier): Recognize char8_t as a simple
217         type specifier.
218         (cp_parser_string_literal): Use char8_array_type_node for the type
219         of CPP_UTF8STRING.
220         (cp_parser_set_decl_spec_type): Tolerate char8_t typedefs in system
221         headers.
222         * rtti.c (emit_support_tinfos): type_info support for char8_t.
223         * tree.c (char_type_p): Recognize char8_t as a character type.
224         * typeck.c (string_conv_p): Handle conversions of u8 string
225         literals of char8_t type.
226         (check_literal_operator_args): Handle UDLs with u8 string literals
227         of char8_t type.
228         * typeck2.c (ordinary_char_type_p): New.
229         (digest_init_r): Disallow initializing a char array with a u8 string
230         literal.
232 2019-01-14  Martin Liska  <mliska@suse.cz>
234         PR gcov-profile/88263
235         * decl2.c (get_tls_wrapper_fn): Use DECL_SOURCE_LOCATION
236         as location of the TLS wrapper.
238 2019-01-12  Paolo Carlini  <paolo.carlini@oracle.com>
240         * decl.c (cp_finish_decl): Improve error location.
241         * decl2.c (grokfield): Likewise, improve two locations.
243 2019-01-11  Marek Polacek  <polacek@redhat.com>
245         PR c++/88692, c++/87882 - -Wredundant-move false positive with *this.
246         * typeck.c (maybe_warn_pessimizing_move): Return if ARG isn't
247         ADDR_EXPR.
249 2019-01-11  Jason Merrill  <jason@redhat.com>
251         PR c++/88312 - pack expansion of decltype.
252         * pt.c (instantiation_dependent_r): A template non-type parameter
253         pack is instantiation-dependent.
255 2019-01-11  Jason Merrill  <jason@redhat.com>
257         PR c++/88613 - ICE with use of const var in lambda.
258         * expr.c (mark_use): Fix location wrapper handling.
259         * cp-gimplify.c (cp_fold_maybe_rvalue): Call mark_rvalue_use.
261 2019-01-11  Tobias Burnus  <burnus@net-b.de>
263         PR C++/88114
264         * decl2.c (maybe_emit_vtables): If needed, generate code for
265         the destructor of an abstract class.
266         (mark_used): Update comment for older function-name change.
268 2019-01-11  Paolo Carlini  <paolo.carlini@oracle.com>
270         * decl.c (start_decl): Improve error location.
271         (grokdeclarator): Likewise, improve two locations.
273 2019-01-09  Sandra Loosemore  <sandra@codesourcery.com>
275         PR other/16615
277         * cp-tree.h: Mechanically replace "can not" with "cannot".
278         * parser.c: Likewise.
279         * pt.c: Likewise.
281 2019-01-08  Paolo Carlini  <paolo.carlini@oracle.com>
283         * decl.c (grok_reference_init): Improve error location.
284         (grokdeclarator): Likewise, improve two locations.
286 2019-01-08  Marek Polacek  <polacek@redhat.com>
288         PR c++/88538 - braced-init-list in template-argument-list.
289         * parser.c (cp_parser_template_argument): Handle braced-init-list when
290         in C++20.
292         PR c++/88548 - this accepted in static member functions.
293         * parser.c (cp_debug_parser): Adjust printing of
294         local_variables_forbidden_p.
295         (cp_parser_new): Set local_variables_forbidden_p to 0 rather than false.
296         (cp_parser_primary_expression): When checking
297         local_variables_forbidden_p, use THIS_FORBIDDEN or
298         LOCAL_VARS_FORBIDDEN.
299         (cp_parser_lambda_body): Update the type of
300         local_variables_forbidden_p.  Set it to 0 rather than false.
301         (cp_parser_condition): Adjust call to cp_parser_declarator.
302         (cp_parser_explicit_instantiation): Likewise.
303         (cp_parser_init_declarator): Likewise.
304         (cp_parser_declarator): New parameter.  Use it.
305         (cp_parser_direct_declarator): New parameter.  Use it to set
306         local_variables_forbidden_p.  Adjust call to cp_parser_declarator.
307         (cp_parser_type_id_1): Adjust call to cp_parser_declarator.
308         (cp_parser_parameter_declaration): Likewise.
309         (cp_parser_default_argument): Update the type of
310         local_variables_forbidden_p.  Set it to LOCAL_VARS_AND_THIS_FORBIDDEN
311         rather than true.
312         (cp_parser_member_declaration): Tell cp_parser_declarator if we saw
313         'static' or 'friend'.
314         (cp_parser_exception_declaration): Adjust call to cp_parser_declarator.
315         (cp_parser_late_parsing_default_args): Update the type of
316         local_variables_forbidden_p.  Set it to LOCAL_VARS_AND_THIS_FORBIDDEN
317         rather than true.
318         (cp_parser_cache_defarg): Adjust call to cp_parser_declarator.
319         (cp_parser_objc_class_ivars): Likewise.
320         (cp_parser_objc_struct_declaration): Likewise.
321         (cp_parser_omp_for_loop_init): Likewise.
322         * parser.h (cp_parser): Change the type of local_variables_forbidden_p
323         to unsigned char.
324         (LOCAL_VARS_FORBIDDEN, LOCAL_VARS_AND_THIS_FORBIDDEN, THIS_FORBIDDEN):
325         Define.
327 2019-01-08  Paolo Carlini  <paolo.carlini@oracle.com>
329         * decl.c (start_decl): Improve permerror location.
331 2019-01-08  Jonathan Wakely  <jwakely@redhat.com>
332             Jakub Jelinek  <jakub@redhat.com>
334         PR c++/88554
335         * decl.c (finish_function): For -Wreturn-type don't add a return *this;
336         fixit hint if current_class_ref is NULL.  Use a single if instead of
337         two nested ones.
339 2019-01-07  Paolo Carlini  <paolo.carlini@oracle.com>
341         * decl.c (start_decl): Improve two error_at locations.
342         (expand_static_init): Likewise.
344 2019-01-07  Marek Polacek  <polacek@redhat.com>
346         PR c++/88741 - wrong error with initializer-string.
347         * decl.c (cp_complete_array_type): Strip any location wrappers.
349 2019-01-07  Bernd Edlinger  <bernd.edlinger@hotmail.de>
351         PR c++/88261
352         PR c++/69338
353         PR c++/69696
354         PR c++/69697
355         * cp-tree.h (LOOKUP_ALLOW_FLEXARRAY_INIT): New flag value.
356         * typeck2.c (digest_init_r): Raise an error for non-static
357         initialization of a flexible array member.
358         (process_init_constructor, massage_init_elt,
359         process_init_constructor_array, process_init_constructor_record,
360         process_init_constructor_union, process_init_constructor): Add the
361         flags parameter and pass it thru.
362         (store_init_value): Pass LOOKUP_ALLOW_FLEXARRAY_INIT parameter to
363         digest_init_flags for static decls.
365 2019-01-07  Jakub Jelinek  <jakub@redhat.com>
367         PR c++/85052
368         * cp-tree.h (cp_build_vec_convert): Declare.
369         * parser.c (cp_parser_postfix_expression): Parse
370         __builtin_convertvector.
371         * constexpr.c: Include fold-const-call.h.
372         (cxx_eval_internal_function): Handle IFN_VEC_CONVERT.
373         (potential_constant_expression_1): Likewise.
374         * semantics.c (cp_build_vec_convert): New function.
375         * pt.c (tsubst_copy_and_build): Handle CALL_EXPR to
376         IFN_VEC_CONVERT.
378 2019-01-03  Jakub Jelinek  <jakub@redhat.com>
380         PR c++/88636
381         * decl.c (builtin_function_1): Return result of pushdecl_top_level
382         or pushdecl rather than decl.
384 2019-01-03  Paolo Carlini  <paolo.carlini@oracle.com>
386         * tree.c (handle_nodiscard_attribute): Improve warning location.
388 2019-01-02  Marek Polacek  <polacek@redhat.com>
390         PR c++/88612 - ICE with -Waddress-of-packed-member.
391         * call.c (convert_for_arg_passing): Only give warnings with tf_warning.
392         * typeck.c (convert_for_assignment): Likewise.
394         PR c++/88631 - CTAD failing for value-initialization.
395         * typeck2.c (build_functional_cast): Try deducing the template
396         arguments even if there are no arguments to deduce from.
398 2019-01-01  Jakub Jelinek  <jakub@redhat.com>
400         Update copyright years.
402 Copyright (C) 2019 Free Software Foundation, Inc.
404 Copying and distribution of this file, with or without modification,
405 are permitted in any medium without royalty provided the copyright
406 notice and this notice are preserved.