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