re PR c++/84636 (internal compiler error: Segmentation fault (identifier_p()/grokdecl...
[gcc.git] / gcc / cp / ChangeLog
1 2018-12-04 Paolo Carlini <paolo.carlini@oracle.com>
2
3 PR c++/84636
4 * decl.c (grokdeclarator): Avoid crashing on an anonymous bit-field
5 with function type.
6
7 2018-12-04 Marek Polacek <polacek@redhat.com>
8
9 PR c++/88184 - ICE when treating name as template-name.
10 * pt.c (lookup_template_function): Always build the TEMPLATE_ID_EXPR
11 with unknown_type_node.
12
13 2018-12-04 Julian Brown <julian@codesourcery.com>
14
15 * parser.c (cp_parser_oacc_wait_list): Fix error message and avoid
16 duplicate diagnostic.
17
18 2018-12-04 Jakub Jelinek <jakub@redhat.com>
19
20 PR c++/88103
21 * typeck.c (build_class_member_access_expr): If unary_complex_lvalue
22 turned xvalue_p into non-xvalue_p, call move on it.
23
24 2018-12-02 Jakub Jelinek <jakub@redhat.com>
25
26 PR c++/88258
27 * parser.c (cp_parser_skip_to_closing_parenthesis_1,
28 cp_parser_skip_to_end_of_statement,
29 cp_parser_skip_to_end_of_block_or_statement,
30 cp_parser_skip_to_closing_brace,
31 cp_parser_skip_to_closing_square_bracket,
32 cp_parser_skip_balanced_tokens): Don't treat CPP_PRAGMA_EOL specially
33 if in_pragma is false.
34
35 2018-12-01 Marek Polacek <polacek@redhat.com>
36
37 Implement P0634R3, Down with typename!
38 * parser.c (CP_PARSER_FLAGS_TYPENAME_OPTIONAL): New enumerator.
39 (cp_parser_type_name): Remove declaration.
40 (cp_parser_postfix_expression): Pass CP_PARSER_FLAGS_TYPENAME_OPTIONAL
41 to cp_parser_type_id.
42 (cp_parser_new_type_id): Pass CP_PARSER_FLAGS_TYPENAME_OPTIONAL to
43 cp_parser_type_specifier_seq.
44 (cp_parser_lambda_declarator_opt): Pass
45 CP_PARSER_FLAGS_TYPENAME_OPTIONAL to
46 cp_parser_parameter_declaration_clause.
47 (cp_parser_condition): Pass CP_PARSER_FLAGS_NONE to
48 cp_parser_declarator.
49 (cp_parser_simple_declaration): Pass CP_PARSER_FLAGS_NONE to
50 cp_parser_init_declarator.
51 (cp_parser_conversion_type_id): Pass CP_PARSER_FLAGS_NONE to
52 cp_parser_type_specifier_seq.
53 (cp_parser_default_type_template_argument): Pass
54 CP_PARSER_FLAGS_TYPENAME_OPTIONAL to cp_parser_type_id.
55 (cp_parser_template_parameter): Pass CP_PARSER_FLAGS_TYPENAME_OPTIONAL
56 to cp_parser_parameter_declaration.
57 (cp_parser_explicit_instantiation): Pass CP_PARSER_FLAGS_NONE to
58 cp_parser_declarator.
59 (cp_parser_simple_type_specifier): Adjust call to cp_parser_type_name
60 to relay if we should treat the typename keyword as optional. Maybe
61 call cp_parser_make_typename_type is parsing a template-id and it's
62 not a TYPE_DECL.
63 (cp_parser_type_name): Remove unused function.
64 (cp_parser_enum_specifier): Pass to CP_PARSER_FLAGS_NONE
65 cp_parser_type_specifier_seq.
66 (cp_parser_alias_declaration): Pass CP_PARSER_FLAGS_TYPENAME_OPTIONAL
67 to cp_parser_type_id.
68 (cp_parser_init_declarator): New parameter. Pass it down to
69 cp_parser_declarator.
70 (cp_parser_declarator): New parameter. Pass CP_PARSER_FLAGS_NONE to
71 cp_parser_declarator. Pass the new parameter to
72 cp_parser_direct_declarator.
73 (cp_parser_direct_declarator): New parameter. Pass it to
74 cp_parser_parameter_declaration_clause and cp_parser_declarator.
75 (cp_parser_declarator_id):
76 (cp_parser_type_id_1): New parameter. Pass it to
77 cp_parser_type_specifier_seq. Adjust call to cp_parser_declarator.
78 (cp_parser_type_id): New parameter. Pass it to cp_parser_type_id_1.
79 (cp_parser_template_type_arg): Pass CP_PARSER_FLAGS_NONE to
80 cp_parser_type_id_1.
81 (cp_parser_trailing_type_id): Pass CP_PARSER_FLAGS_TYPENAME_OPTIONAL
82 to cp_parser_type_id_1.
83 (cp_parser_type_specifier_seq): New parameter.
84 (function_being_declared_is_template_p):
85 (cp_parser_parameter_declaration_clause): New parameter. Pass it to
86 cp_parser_parameter_declaration_list.
87 (cp_parser_parameter_declaration_list): New parameter. Pass it to
88 cp_parser_parameter_declaration.
89 (cp_parser_parameter_declaration): New parameter. Pass it to
90 cp_parser_decl_specifier_seq. Pass CP_PARSER_FLAGS_NONE to
91 cp_parser_declarator.
92 (cp_parser_member_declaration): Adjust call to
93 cp_parser_decl_specifier_seq to also include
94 CP_PARSER_FLAGS_TYPENAME_OPTIONAL. Pass
95 CP_PARSER_FLAGS_TYPENAME_OPTIONAL to cp_parser_declarator.
96 (cp_parser_exception_declaration): Pass CP_PARSER_FLAGS_NONE to
97 cp_parser_type_specifier_seq and cp_parser_declarator.
98 (cp_parser_requirement_parameter_list): Pass CP_PARSER_FLAGS_NONE to
99 cp_parser_parameter_declaration_clause.
100 (cp_parser_constructor_declarator_p): Resolve the TYPENAME_TYPE.
101 (cp_parser_single_declaration): Pass CP_PARSER_FLAGS_TYPENAME_OPTIONAL
102 to cp_parser_decl_specifier_seq and cp_parser_init_declarator.
103 (cp_parser_cache_defarg): Pass CP_PARSER_FLAGS_NONE to
104 cp_parser_declarator and cp_parser_parameter_declaration_list.
105 (cp_parser_objc_method_tail_params_opt): Pass CP_PARSER_FLAGS_NONE to
106 cp_parser_parameter_declaration.
107 (cp_parser_objc_class_ivars): Pass CP_PARSER_FLAGS_NONE to
108 cp_parser_declarator.
109 (cp_parser_objc_try_catch_finally_statement): Pass CP_PARSER_FLAGS_NONE
110 to cp_parser_parameter_declaration
111 (cp_parser_objc_struct_declaration): Pass CP_PARSER_FLAGS_NONE to
112 cp_parser_declarator.
113 (cp_parser_omp_for_loop_init): Pass CP_PARSER_FLAGS_NONE to
114 cp_parser_declarator and cp_parser_type_specifier_seq.
115
116 2018-11-30 David Malcolm <dmalcolm@redhat.com>
117
118 * typeck2.c: Include "gcc-rich-location.h".
119 (cxx_incomplete_type_diagnostic): When complaining about possibly
120 missing parens, add a fix-it hint if the member function takes no
121 additional params.
122
123 2018-11-30 James Norris <jnorris@codesourcery.com>
124
125 * parser.c (cp_parser_oacc_enter_exit_data): Use existing local
126 variable.
127
128 2018-11-29 Paolo Carlini <paolo.carlini@oracle.com>
129
130 * decl.c (compute_array_index_type_loc): New, like the current
131 compute_array_index_type but takes a location_t too.
132 (compute_array_index_type): Forward to the latter.
133 (create_array_type_for_decl): Use compute_array_index_type_loc.
134
135 2018-11-29 David Malcolm <dmalcolm@redhat.com>
136
137 PR c++/88121
138 * cp-name-hint.h (suggest_alternative_in_scoped_enum): New decl.
139 * error.c (dump_scope): Ensure that we print any scope for values
140 of unscoped enums. Print the scope of values of scoped enums.
141 (qualified_name_lookup_error): Offer suggestions for failures
142 within scoped enums by calling suggest_alternative_in_scoped_enum.
143 * name-lookup.c (class namespace_hints): Update comment to mention
144 scoped enums.
145 (namespace_hints::namespace_hints): Call
146 maybe_add_candidate_for_scoped_enum.
147 (namespace_hints::maybe_add_candidate_for_scoped_enum): New member
148 (suggest_alternatives_for): Update comment to mention scoped
149 enums.
150 (suggest_alternative_in_scoped_enum): New function.
151
152 2018-11-28 Marek Polacek <polacek@redhat.com>
153
154 Implement P1094R2, Nested inline namespaces.
155 * parser.c (cp_parser_namespace_definition): Parse the optional inline
156 keyword in a nested-namespace-definition. Adjust push_namespace call.
157 Formatting fix.
158
159 2018-11-28 Nathan Sidwell <nathan@acm.org>
160
161 PR c++/87531
162 * class.c (finish_struct): In a template, add artificial using
163 decl for operator=.
164
165 2018-11-28 Jan Hubicka <hubicka@ucw.cz>
166
167 * except.c (do_allocate_exception): Annotate __cxa_allocate_exception
168 as COLD.
169
170 2018-11-28 Marek Polacek <polacek@redhat.com>
171
172 PR c++/88222 - ICE with bit-field with invalid type.
173 * decl.c (grokdeclarator): Check if declarator is null.
174
175 2018-11-28 Jakub Jelinek <jakub@redhat.com>
176
177 PR c++/87476
178 * typeck2.c (digest_init_r): Re-add handing of signed/unsigned char
179 strings and add it to the initialization of wide array from non-wide
180 string diagnostics too.
181
182 2018-11-27 Jakub Jelinek <jakub@redhat.com>
183
184 PR c++/88187
185 * decl.c (grokdeclarator): Don't diagnose deduction guide errors
186 if !funcdecl_p.
187
188 PR c++/88181
189 * class.c (fixup_attribute_variants): Also propagate TYPE_PACKED
190 to variants.
191
192 2018-11-26 Marek Polacek <polacek@redhat.com>
193
194 PR c++/88120 - ICE when calling save_expr in a template.
195 * typeck.c (cp_build_binary_op): Call cp_save_expr instead of
196 save_expr.
197
198 2018-11-22 Jakub Jelinek <jakub@redhat.com>
199
200 PR c++/87386
201 * parser.c (cp_parser_operator): Use str.get_value () instead of just
202 str in USERDEF_LITERAL_VALUE and USERDEF_LITERAL_SUFFIX_ID arguments.
203
204 2018-11-21 Jakub Jelinek <jakub@redhat.com>
205
206 PR c++/88122
207 * method.c (maybe_explain_implicit_delete): If
208 FUNCTION_FIRST_USER_PARMTYPE (decl) is NULL, set const_p to false
209 instead of ICEing.
210
211 PR c++/87386
212 * parser.c (cp_parser_primary_expression): Use
213 id_expression.get_location () instead of id_expr_token->location.
214 Adjust the range from id_expr_token->location to
215 id_expressio.get_finish ().
216 (cp_parser_operator_function_id): Pass location of the operator
217 token down to cp_parser_operator.
218 (cp_parser_operator): Add start_loc argument, always construct a
219 location with caret at start_loc and range from start_loc to the
220 finish of the last token.
221
222 PR c++/87393
223 * parser.c (cp_parser_linkage_specification): Remove useless
224 dereference of the consume_open method result.
225
226 2018-11-20 Martin Sebor <msebor@redhat.com>
227
228 * cp-tree.h (cp_check_const_attributes): Declare.
229 * decl2.c (cp_check_const_attributes): Declare extern.
230 * parser.c (cp_parser_has_attribute_expression): New function.
231 (cp_parser_unary_expression): Handle RID_HAS_ATTRIBUTE_EXPRESSION.
232 (cp_parser_gnu_attribute_list): Add argument.
233
234 2018-11-20 Jakub Jelinek <jakub@redhat.com>
235
236 PR c++/88110
237 * constexpr.c (cxx_eval_constant_expression) <case OBJ_TYPE_REF>: Punt
238 if get_base_address of ADDR_EXPR operand is not a DECL_P.
239
240 2018-11-19 Marek Polacek <polacek@redhat.com>
241
242 PR c++/87781 - detect invalid elaborated-type-specifier.
243 * parser.c (cp_parser_elaborated_type_specifier): Ensure that
244 typename follows a nested-name-specifier.
245
246 2018-11-18 Paolo Carlini <paolo.carlini@oracle.com>
247
248 * decl2.c (grokfield): Remove obsolete _vptr check; fix
249 explicit template argument list error location.
250
251 2018-11-16 Kamlesh Kumar <kamleshbhalui@gmail.com>
252
253 DR 1207
254 PR c++/52869
255 * parser.c (cp_parser_noexcept_specification_opt): Call
256 inject_this_parameter.
257
258 2018-11-16 Jason Merrill <jason@redhat.com>
259
260 Implement P0479R5, [[likely]] and [[unlikely]].
261 * tree.c (handle_likeliness_attribute): New.
262 (std_attribute_table): Add likely/unlikely.
263 * cp-gimplify.c (lookup_hotness_attribute, remove_hotness_attribute)
264 (process_stmt_hotness_attribute, first_stmt): New.
265 (genericize_if_stmt): Check for duplicate predictions.
266 * parser.c (cp_parser_statement): Call
267 process_stmt_hotness_attribute.
268 (cp_parser_label_for_labeled_statement): Apply attributes to case.
269 * decl.c (finish_case_label): Give label in template type void.
270 * pt.c (tsubst_expr) [CASE_LABEL_EXPR]: Copy attributes.
271 [PREDICT_EXPR]: Handle.
272
273 2018-11-16 Nathan Sidwell <nathan@acm.org>
274
275 Remove ovl_used, it is no longer needed
276 * cp-tree.h (OVL_USED_P): Delete.
277 (lookup_keep): Delete.
278 * friend.c (add_friend): Don't call it.
279 * parser.c (lookup_literal_operator): Likewise.
280 (cp_parser_primary_expression): Likewise.
281 * semantics.c (perform_koenig_lookup): Likewise.
282 * pt.c (tsubst_copy <OVERLOAD>): Don't assert OVL_USED_P.
283 * tree.c (ovl_copy): Delete.
284 (ovl_insert): Remove OVL_USED_P checks.
285 (ovl_iterator::reveal_node): Likewise.
286 (ovl_iterator::remove__node): Likewise.
287 (ovl_used, lookup_keep): Delete.
288
289 PR c++/87269
290 * parser.c (lookup_literal_operator): Mark overload for keeping
291 when inside template. Refactor.
292
293 2018-11-15 Nathan Sidwell <nathan@acm.org>
294
295 PR c++/86246
296 PR c++/87989
297 * typeck.c (finish_class_member_access_expr): Conversion operator
298 to dependent type is dependent.
299
300 2018-11-15 Paolo Carlini <paolo.carlini@oracle.com>
301
302 * constexpr.c (ensure_literal_type_for_constexpr_object): Use
303 DECL_SOURCE_LOCATION in error_at calls.
304
305 2018-11-15 Nathan Sidwell <nathan@acm.org>
306
307 DR 2336
308 * cp-tree.h (enum special_function_kind): Add sfk_virtual_destructor.
309 * method.c (type_has_trivial_fn): Add it.
310 (SFK_DTOR_P): Likewise.
311 (synthesized_method_base_walk): Don't check access of vbases of
312 abstract classes when sfk_virtual_destructor.
313 (synthesized_method_walk): Skip vbases of abstract classes except
314 when sfk_virtual_destructor.
315 (get_defaulted_eh_spec): Set sfk_virtual_destructor as needed.
316
317 * cp-tree.h (enum special_function_kind): Reorder and comment.
318 * method.c (SFK_CTOR_P, SFK_DTOR_P, SFK_ASSIGN_P, SFK_COPY_P)
319 (SFK_MOVE_P): New predicates.
320 (walk_field_subobs, synthesized_method_base_walk): Drop
321 copy_arg_p, move_p, assign_p args. Use new SFK predicates. Order
322 parameters consistently.
323 (synthesized_method_walk): Drop ctor_p, copy_arg_p, move_p,
324 assign_p calculations. Use new SFK predicates. Adjust calls to
325 worker functions.
326
327 2018-11-14 Paolo Carlini <paolo.carlini@oracle.com>
328
329 * parser.c (make_id_declarator): Add location_t parameter.
330 (cp_parser_lambda_declarator_opt): Adjust call.
331 (cp_parser_decomposition_declaration): Likewise.
332 (cp_parser_alias_declaration): Likewise.
333 (cp_parser_direct_declarator): Likewise.
334 (cp_parser_member_declaration): Likewise.
335 (cp_parser_objc_class_ivars): Likewise.
336 * decl.c (grokdeclarator): Use declarator->id_loc in two error
337 messages.
338
339 2018-11-14 Jakub Jelinek <jakub@redhat.com>
340
341 P1236R1 - Signed integers are two's complement
342 * constexpr.c (cxx_eval_check_shift_p): Disable the signed LSHIFT_EXPR
343 checks for c++2a.
344
345 2018-11-13 David Malcolm <dmalcolm@redhat.com>
346
347 * call.c: Replace "source_location" with "location_t".
348 * cp-tree.h: Likewise.
349 * cvt.c: Likewise.
350 * name-lookup.c: Likewise.
351 * parser.c: Likewise.
352 * typeck.c: Likewise.
353
354 2018-11-12 Jason Merrill <jason@redhat.com>
355
356 Implement P0315R4, Lambdas in unevaluated contexts.
357 * decl2.c (min_vis_expr_r): Handle LAMBDA_EXPR.
358 * mangle.c (write_expression): Handle LAMBDA_EXPR.
359 * parser.c (cp_parser_lambda_expression): Allow lambdas in
360 unevaluated context. Start the tentative firewall sooner.
361 (cp_parser_lambda_body): Use cp_evaluated.
362 * pt.c (iterative_hash_template_arg): Handle LAMBDA_EXPR.
363 (tsubst_function_decl): Substitute a lambda even if it isn't
364 dependent.
365 (tsubst_lambda_expr): Use cp_evaluated. Always complain.
366 (tsubst_copy_and_build) [LAMBDA_EXPR]: Do nothing if tf_partial.
367 * semantics.c (begin_class_definition): Allow in template parm list.
368 * tree.c (strip_typedefs_expr): Pass through LAMBDA_EXPR.
369 (cp_tree_equal): Handle LAMBDA_EXPR.
370
371 * pt.c (fn_type_unification): If we have a full set of explicit
372 arguments, go straight to substitution.
373
374 * decl2.c (min_vis_expr_r, expr_visibility): New.
375 (min_vis_r): Call expr_visibility.
376 (constrain_visibility_for_template): Likewise.
377
378 Implement P0722R3, destroying operator delete.
379 * call.c (std_destroying_delete_t_p, destroying_delete_p): New.
380 (aligned_deallocation_fn_p, usual_deallocation_fn_p): Use
381 destroying_delete_p.
382 (build_op_delete_call): Handle destroying delete.
383 * decl2.c (coerce_delete_type): Handle destroying delete.
384 * init.c (build_delete): Don't call dtor with destroying delete.
385 * optimize.c (build_delete_destructor_body): Likewise.
386
387 Implement P0780R2, pack expansion in lambda init-capture.
388 * parser.c (cp_parser_lambda_introducer): Parse pack init-capture.
389 * pt.c (tsubst_pack_expansion): Handle init-capture packs.
390 (lookup_init_capture_pack): New.
391 (tsubst_expr) [DECL_EXPR]: Use it.
392 (tsubst_lambda_expr): Remember field pack expansions for
393 init-captures.
394
395 * cp-tree.h (struct cp_evaluated): New.
396 * init.c (get_nsdmi): Use it.
397 * parser.c (cp_parser_enclosed_template_argument_list): Use it.
398 * pt.c (coerce_template_parms, tsubst_aggr_type): Use it.
399
400 2018-11-09 Jakub Jelinek <jakub@redhat.com>
401
402 * parser.c (cp_parser_omp_clause_final, cp_parser_omp_clause_if): Use
403 cp_parser_assignment_expression instead of cp_parser_condition.
404 (cp_parser_omp_clause_num_threads, cp_parser_omp_clause_num_tasks,
405 cp_parser_omp_clause_grainsize, cp_parser_omp_clause_priority,
406 cp_parser_omp_clause_num_teams, cp_parser_omp_clause_thread_limit,
407 cp_parser_omp_clause_linear, cp_parser_omp_clause_device): Use
408 cp_parser_assignment_expression instead of cp_parser_expression.
409 (cp_parser_omp_clause_hint): Likewise. Formatting fix.
410
411 * parser.c (cp_parser_omp_clause_reduction): Call sorry_at on
412 reduction clause with inscan modifier.
413
414 * parser.c (cp_parser_omp_requires): Call sorry_at on requires
415 clauses other than atomic_default_mem_order.
416
417 2018-11-09 Martin Sebor <msebor@redhat.com>
418
419 PR middle-end/81824
420 * pt.c (warn_spec_missing_attributes): Move code to attribs.c.
421 Call decls_mismatched_attributes.
422
423 2018-11-08 Jakub Jelinek <jakub@redhat.com>
424
425 * constexpr.c (potential_constant_expression_1): Handle OMP_DEPOBJ.
426 * cp-gimplify.c (cp_genericize_r): Handle
427 OMP_CLAUSE_{IN,TASK}_REDUCTION.
428 (cxx_omp_predetermined_sharing_1): Don't return
429 OMP_CLAUSE_DEFAULT_SHARED for const qualified decls with no mutable
430 member. Return OMP_CLAUSE_DEFAULT_FIRSTPRIVATE for this pointer.
431 * cp-objcp-common.c (cp_common_init_ts): Handle OMP_DEPOBJ.
432 * cp-tree.def (OMP_DEPOBJ): New tree code.
433 * cp-tree.h (OMP_ATOMIC_DEPENDENT_P): Return true also for first
434 argument being OMP_CLAUSE.
435 (OMP_DEPOBJ_DEPOBJ, OMP_DEPOBJ_CLAUSES): Define.
436 (cp_convert_omp_range_for, cp_finish_omp_range_for): Declare.
437 (finish_omp_atomic): Add LOC, CLAUSES and MO arguments. Remove
438 SEQ_CST argument.
439 (finish_omp_for_block): Declare.
440 (finish_omp_flush): Add MO argument.
441 (finish_omp_depobj): Declare.
442 * cxx-pretty-print.c (cxx_pretty_printer::statement): Handle
443 OMP_DEPOBJ.
444 * dump.c (cp_dump_tree): Likewise.
445 * lex.c (cxx_init): Likewise.
446 * parser.c: Include memmodel.h.
447 (cp_parser_for): Pass false as new is_omp argument to
448 cp_parser_range_for.
449 (cp_parser_range_for): Add IS_OMP argument, return before finalizing
450 if it is true.
451 (cp_parser_omp_clause_name): Handle nontemporal, in_reduction and
452 task_reduction clauses.
453 (cp_parser_omp_var_list_no_open): Handle
454 OMP_CLAUSE_{IN,TASK}_REDUCTION. For OMP_CLAUSE_DEPEND, parse clause
455 operands as either an array section, or lvalue assignment expression.
456 (cp_parser_omp_clause_if): Handle cancel and simd modifiers.
457 (cp_parser_omp_clause_defaultmap): Parse new kinds of defaultmap
458 clause.
459 (cp_parser_omp_clause_reduction): Add IS_OMP and KIND arguments.
460 Parse reduction modifiers. Pass KIND to c_parser_omp_variable_list.
461 (cp_parser_omp_clause_lastprivate, cp_parser_omp_iterators): New
462 functions.
463 (cp_parser_omp_clause_depend): Parse iterator modifier and handle
464 iterators. Parse mutexinoutset and depobj kinds.
465 (cp_parser_oacc_all_clauses): Adjust cp_parser_omp_clause_reduction
466 callers.
467 (cp_parser_omp_all_clauses): Likewise. Handle
468 PRAGMA_OMP_CLAUSE_NONTEMPORAL and
469 PRAGMA_OMP_CLAUSE_{IN,TASK}_REDUCTION. Call
470 cp_parser_omp_clause_lastprivate for OpenMP lastprivate clause.
471 (cp_parser_omp_atomic): Pass pragma_tok->location as
472 LOC to finish_omp_atomic. Parse hint and memory order clauses.
473 Handle default memory order from requires directive if any. Adjust
474 finish_omp_atomic caller.
475 (cp_parser_omp_critical): Allow comma in between (name) and hint
476 clause.
477 (cp_parser_omp_depobj): New function.
478 (cp_parser_omp_flush): Parse flush with memory-order-clause.
479 (cp_parser_omp_for_cond): Allow NE_EXPR even in OpenMP loops.
480 (cp_convert_omp_range_for, cp_finish_omp_range_for): New functions.
481 (cp_parser_omp_for_loop): Parse C++11 range for loops among omp
482 loops. Handle OMP_CLAUSE_IN_REDUCTION like OMP_CLAUSE_REDUCTION.
483 (OMP_SIMD_CLAUSE_MASK): Add if and nontemporal clauses.
484 (cp_parser_omp_simd, cp_parser_omp_for): Call keep_next_level before
485 begin_omp_structured_block and call finish_omp_for_block on
486 finish_omp_structured_block result.
487 (cp_parser_omp_master): Add p_name, mask and cclauses arguments.
488 Allow to be called while parsing combined parallel master.
489 Parse combined master taskloop{, simd}.
490 (cp_parser_omp_parallel): Parse combined
491 parallel master{, taskloop{, simd}} constructs.
492 (cp_parser_omp_single): Use SET_EXPR_LOCATION.
493 (OMP_TASK_CLAUSE_MASK): Add in_reduction clause.
494 (OMP_TASKWAIT_CLAUSE_MASK): Define.
495 (cp_parser_omp_taskwait): Handle taskwait with depend clauses.
496 (OMP_TASKGROUP_CLAUSE_MASK): Define.
497 (cp_parser_omp_taskgroup): Parse taskgroup clauses, adjust
498 c_finish_omp_taskgroup caller.
499 (cp_parser_omp_distribute): Call keep_next_level before
500 begin_omp_structured_block and call finish_omp_for_block on
501 finish_omp_structured_block result.
502 (cp_parser_omp_teams): Force a BIND_EXPR with BLOCK around teams
503 body.
504 (cp_parser_omp_target_data): Allow target data with only
505 use_device_ptr clauses.
506 (cp_parser_omp_target): Set OMP_REQUIRES_TARGET_USED bit in
507 omp_requires_mask.
508 (cp_parser_omp_requires): New function.
509 (OMP_TASKLOOP_CLAUSE_MASK): Add reduction and in_reduction clauses.
510 (cp_parser_omp_taskloop): Add forward declaration. Disallow
511 in_reduction clause when combined with parallel master. Call
512 keep_next_level before begin_omp_structured_block and call
513 finish_omp_for_block on finish_omp_structured_block result.
514 (cp_parser_omp_construct): Adjust cp_parser_omp_master caller.
515 (cp_parser_pragma): Handle PRAGMA_OMP_DEPOBJ and PRAGMA_OMP_REQUIRES.
516 * pt.c (tsubst_omp_clause_decl): Add iterators_cache argument.
517 Adjust recursive calls. Handle iterators.
518 (tsubst_omp_clauses): Handle OMP_CLAUSE_{IN,TASK}_REDUCTION and
519 OMP_CLAUSE_NONTEMPORAL. Adjust tsubst_omp_clause_decl callers.
520 (tsubst_decomp_names):
521 (tsubst_omp_for_iterator): Change orig_declv into a reference.
522 Handle range for loops. Move orig_declv handling after declv/initv
523 handling.
524 (tsubst_expr): Force a BIND_EXPR with BLOCK around teams body.
525 Adjust finish_omp_atomic caller. Call keep_next_level before
526 begin_omp_structured_block. Call cp_finish_omp_range_for for range
527 for loops and use {begin,finish}_omp_structured_block instead of
528 {push,pop}_stmt_list if there are any range for loops. Call
529 finish_omp_for_block on finish_omp_structured_block result.
530 Handle OMP_DEPOBJ. Handle taskwait with depend clauses. For
531 OMP_ATOMIC call tsubst_omp_clauses on clauses if any, adjust
532 finish_omp_atomic caller. Use OMP_ATOMIC_MEMORY_ORDER rather
533 than OMP_ATOMIC_SEQ_CST. Handle clauses on OMP_TASKGROUP.
534 (dependent_omp_for_p): Always return true for range for loops if
535 processing_template_decl. Return true if class type iterator
536 does not have INTEGER_CST increment.
537 * semantics.c: Include memmodel.h.
538 (handle_omp_array_sections_1): Handle OMP_CLAUSE_{IN,TASK}_REDUCTION
539 like OMP_CLAUSE_REDUCTION.
540 (handle_omp_array_sections): Likewise. Call save_expr on array
541 reductions before calling build_index_type. Handle depend clauses
542 with iterators.
543 (finish_omp_reduction_clause): Call save_expr for whole array
544 reduction sizes. Don't mark OMP_CLAUSE_DECL addressable if it has
545 reference type. Do mark decl_placeholder addressable if needed.
546 Use error_at with OMP_CLAUSE_LOCATION (c) as first argument instead
547 of error.
548 (cp_omp_finish_iterators): New function.
549 (finish_omp_clauses): Don't diagnose nonmonotonic clause with static,
550 runtime or auto schedule kinds. Diagnose nogroup clause used with
551 reduction clause(s). Handle depend clause with
552 OMP_CLAUSE_DEPEND_DEPOBJ. Diagnose bit-fields. Require
553 omp_depend_t type for OMP_CLAUSE_DEPEND_DEPOBJ kinds and
554 some different type for other kinds. Use cp_build_addr_expr
555 and cp_build_indirect_ref instead of cxx_mark_addressable.
556 Handle depend clauses with iterators. Only handle static data members
557 in the special case that const qualified vars may be specified in
558 firstprivate clause. Complain if const qualified vars without mutable
559 members are mentioned in data-sharing clauses other than firstprivate
560 or shared. Use error_at with OMP_CLAUSE_LOCATION (c) as first
561 argument instead of error. Diagnose more than one nontemporal clause
562 refering to the same variable. Use error_at rather than error for
563 priority and hint clause diagnostics. Fix pasto for hint clause.
564 Diagnose hint expression that doesn't fold into INTEGER_CST.
565 Diagnose if clause with modifier other than cancel. Handle
566 OMP_CLAUSE_{IN,TASK}_REDUCTION like OMP_CLAUSE_REDUCTION. Allow any
567 lvalue as OMP_CLAUSE_DEPEND operand (besides array section), adjust
568 diagnostics.
569 (handle_omp_for_class_iterator): Don't create a new TREE_LIST if one
570 has been created already for range for, just fill TREE_PURPOSE and
571 TREE_VALUE. Call cp_fully_fold on incr.
572 (finish_omp_for): Don't check cond/incr if cond is global_namespace.
573 Pass to c_omp_check_loop_iv_exprs orig_declv if non-NULL. Don't
574 use IS_EMPTY_STMT on NULL pre_body. Adjust c_finish_omp_for caller.
575 (finish_omp_for_block): New function.
576 (finish_omp_atomic): Add LOC argument, pass it through
577 to c_finish_omp_atomic and set it as location of OMP_ATOMIC* trees.
578 Remove SEQ_CST argument. Add CLAUSES and MO arguments. Adjust
579 c_finish_omp_atomic caller. Stick clauses if any into first argument
580 of wrapping OMP_ATOMIC.
581 (finish_omp_depobj): New function.
582 (finish_omp_flush): Add MO argument, if not
583 MEMMODEL_LAST, emit __atomic_thread_fence call with the given value.
584 (finish_omp_cancel): Diagnose if clause with modifier other than
585 cancel.
586
587 2018-11-07 Nathan Sidwell <nathan@acm.org>
588
589 PR c++/87904
590 * cp-tree.h (struct tree_overload): Fix comment.
591 * tree.c (ovl_iterator::reveal_node): Propagate OVL_DEDUP_P.
592
593 2018-11-04 Jason Merrill <jason@redhat.com>
594
595 Implement UDL changes from P0732R2.
596 * cp-tree.h (struct releasing_vec): Move from mangle.c.
597 Add get_ref method.
598 * parser.c (cp_parser_userdef_string_literal): Use it. Handle
599 passing the string to a single template parameter of class type.
600 (cp_parser_template_declaration_after_parameters): Allow it.
601 Pedwarn about the character pack template that was proposed but not
602 accepted for C++14, and don't suggest it.
603
604 Implement P0732R2, class types in non-type template parameters.
605 * error.c (dump_simple_decl): Look through a template parm object.
606 * mangle.c (write_template_arg): Likewise.
607 (mangle_template_parm_object): New.
608 * pt.c (template_parm_object_p, get_template_parm_object): New.
609 (invalid_tparm_referent_p): Factor from convert_nontype_argument.
610 (convert_nontype_argument, invalid_nontype_parm_type_p): Handle
611 class-type template arguments.
612 * tree.c (lvalue_kind): Likewise.
613
614 * cvt.c (ocp_convert): Don't wrap a CONSTRUCTOR in a NOP_EXPR.
615 * constexpr.c (initialized_type): Fix AGGR_INIT_EXPR handling.
616 (cxx_eval_vec_init_1): Correct type of AGGR_INIT_EXPR.
617 (cxx_eval_outermost_constant_expr): Make sure a CONSTRUCTOR has the
618 right type. Don't wrap a CONSTRUCTOR if one was passed in.
619 * tree.c (build_aggr_init_expr): Check for void.
620
621 PR c++/60503 - wrong lambda attribute syntax.
622 * parser.c (cp_parser_lambda_declarator_opt): Fix attribute
623 handling.
624
625 2018-11-02 Nathan Sidwell <nathan@acm.org>
626
627 * decl.c (duplicate_decls): Refactor checks.
628
629 2018-11-01 Marek Polacek <polacek@redhat.com>
630
631 Implement P0846R0, ADL and function templates.
632 * decl.c (grokfndecl): Allow FUNCTION_DECL in assert.
633 * lex.c (unqualified_fn_lookup_error): Handle TEMPLATE_ID_EXPR.
634 * parser.c (cp_parser_postfix_expression): Do ADL for a template-name.
635 (cp_parser_template_id): Give errors if parsing the template argument
636 list didn't go well. Allow FUNCTION_DECL in assert.
637 (cp_parser_template_name): Consider a name to refer to a template if
638 it is an unqualified-id followed by a <. Don't return the identifier
639 if the decl is a function and dependent.
640 * pt.c (tsubst_copy) <case OVERLOAD>: Remove assert.
641
642 2018-11-01 Nathan Sidwell <nathan@acm.org>
643
644 * cp-tree.h (struct lang_function): Delete x_local_names field.
645 (struct lang_decl_base): Rename u2sel to spare.
646 (struct lang_decl_min): Remove lang_decl_u2 union. Keep access
647 field.
648 (LANG_DECL_U2_CHECK): Delete.
649 (DECL_DISCRIMINATOR_P): Require function scope.
650 (DECL_DISCRIMINATOR): Adjust.
651 (DECL_DISCRIMINATOR_SET_P): Delete.
652 (DECL_CAPTURED_VARIABLE, DECL_ACCESS, THUnK_VIRTUAL_OFFSET): Adjust.
653 (local_classes): Don't declare.
654 (determine_local_discriminator): Declare.
655 * decl.c (push_local_name): Delete.
656 (local_entities, determina_local_discrminator): New.
657 (duplicate_decls): Copy DECL_ACCESS. Fix formatting.
658 (cp_finish_decl): Use determine_local_discriminator.
659 (save_function_data): Drop x_local_names.
660 (finish_function): Drop local_names.
661 * decl2.c (finish_anon_union): Use determine_local_disciminator.
662 * mangle.c (write_unnamed_type_name): Use
663 discriminator_for_local_entity.
664 (local_class_index): Delete.
665 (discriminator_for_local_entity): Reimplement.
666 (write_local_name): Adjust discriminator code.
667 * name-lookup.c (do_pushtag): Call determine_local_discrimiator.
668 * semantics.c (finish_omp_threadprivate): Drop DECL_DISCRIMINATOR
669 handling.
670 * class.c (local_classes): Delete.
671 (init_class_processing): Don't init it.
672
673 2018-11-01 Martin Liska <mliska@suse.cz>
674 Jason Merrill <jason@redhat.com>
675
676 PR c++/64266
677 PR bootstrap/70422
678 PR ipa/81277
679 * cp-tree.h (DECL_FNAME_P): New macro.
680 * decl.c (cp_make_fname_decl): Set DECL_DECLARED_CONSTEXPR_P,
681 DECL_VALUE_EXPR, DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P.
682 (cp_finish_decl):
683 * lambda.c (is_capture_proxy): Use DECL_FNAME_P.
684 * pt.c (tsubst_expr): Handle DECL_PRETTY_FUNCTION_P.
685
686 2018-10-31 Nathan Sidwell <nathan@acm.org>
687
688 * cp-tree.h (OVL_DEDUP_P): New.
689 * name-lookup.c (name_lookup::add_overload): Check OVL_DEDUP_P.
690 (get_class_binding_direct): Likwise.
691 * tree.c (ovl_make): Propagate OVL_DEDUP_P.
692 (ovl_copy): Copy it.
693 (ovl_insert): Do not keep using-decls ordered.
694 (lookup_maybe_add): Adjust comment.
695
696 2018-10-30 Marek Polacek <polacek@redhat.com>
697
698 Implement P0892R2, explicit(bool).
699 * call.c (add_template_candidate_real): Return if the declaration is
700 explicit and we're only looking for non-converting constructor.
701 * cp-tree.h (lang_decl_fn): Add has_dependent_explicit_spec_p bit.
702 (DECL_HAS_DEPENDENT_EXPLICIT_SPEC_P): New macro.
703 (cp_decl_specifier_seq): Add explicit_specifier field.
704 (build_explicit_specifier, store_explicit_specifier): Declare.
705 * decl.c (grokdeclarator): Call store_explicit_specifier.
706 (build_explicit_specifier): New function.
707 * parser.c (cp_parser_function_specifier_opt) <case RID_EXPLICIT>:
708 Parse C++20 explicit(bool).
709 * pt.c (store_explicit_specifier, lookup_explicit_specifier): New.
710 (tsubst_function_decl): Handle explicit(dependent-expr).
711
712 2018-10-30 Paolo Carlini <paolo.carlini@oracle.com>
713
714 * decl.c (grokdeclarator): Use declarator->id_loc in diagnostic
715 about flexible array members.
716
717 2018-10-29 David Malcolm <dmalcolm@redhat.com>
718
719 * cp-name-hint.h: New file.
720 * cp-tree.h (expr_to_string): New decl.
721 (suggest_alternatives_for): Move to cp-name-hint.h, changing
722 return type from bool to name_hint.
723 (suggest_alternative_in_explicit_scope): Likewise.
724 * error.c: Define INCLUDE_UNIQUE_PTR. Include "cp-name-hint.h".
725 (expr_to_string): Make non-static.
726 (qualified_name_lookup_error): For the non-"::" case, take
727 responsibity for issuing any suggestion from
728 suggest_alternative_in_explicit_scope, as it changes from
729 returning a bool to returning a name_hint. Replace fallback call
730 to suggest_alternatives_for to a call to
731 suggest_alternatives_in_other_namespaces, capturing the fact that
732 we don't have enough location information to issue a fix-it hint
733 for this case. Update the error to support emitting a fix-it hint
734 where appropriate. For the "::" case, take responsibility for
735 issuing any suggestion from suggest_alternatives_for, supporting
736 emitting a fix-it hint.
737 * lex.c: Define INCLUDE_UNIQUE_PTR. Include "gcc-rich-location.h"
738 and "cp-name-hint.h".
739 (unqualified_name_lookup_error): Take responsibility for issuing
740 any suggestion from suggest_alternatives_for, supporting emitting
741 a fix-it hint.
742 * name-lookup.c (class namespace_limit_reached): New subclass of
743 deferred_diagnostic.
744 (class show_candidate_location): Likewise.
745 (class suggest_alternatives): Likewise.
746 (class namespace_hints): New class.
747 (suggest_alternatives_for): Convert return type from bool to
748 name_hint, replacing all direct diagnostic emission by setting
749 suggestions on the return value, or creating deferred diagnostics.
750 Specifically, split out initial traversal of namespaces into
751 namespace_hints' ctor, and maybe_decorate_with_limit, and move the
752 rest of the implementation to
753 namespace_hints::convert_candidates_to_name_hint and
754 suggest_alternatives_for_1.
755 (namespace_hints::namespace_hints): New ctor, adapted from
756 suggest_alternatives_for's initial namespace traversal, storing
757 location and name, and converting locals "candidates", "limited"
758 and "limit" into members.
759 (namespace_hints::convert_candidates_to_name_hint): New member
760 function.
761 (namespace_hints::maybe_decorate_with_limit): New member function.
762 (suggest_alternatives_for_1): New function, based on second half
763 of old implementation of suggest_alternatives_for, converting from
764 immediate emission of suggestions to using name_hint.
765 (suggest_alternatives_in_other_namespaces): New function.
766 (maybe_suggest_missing_std_header): Convert from immediate
767 emission of suggestions to using name_hint, moving emission
768 implementation to...
769 (class missing_std_header): New subclass of deferred_diagnostic.
770 (maybe_suggest_missing_header): Convert return type from bool to
771 name_hint.
772 (suggest_alternative_in_explicit_scope): Convert from immediate
773 emission of suggestions to using name_hint.
774 * parser.c: Replace include of "c-family/name-hint.h" with
775 "cp-name-hint.h".
776 (cp_parser_diagnose_invalid_type_name): Update
777 "is there a suggestion" logic for change to
778 name_hint::operator bool. Take responsibility for emitting
779 fix-it hints from suggest_alternative_in_explicit_scope.
780 (cp_parser_namespace_name): Take responsibility for emitting
781 fix-it hints from suggest_alternative_in_explicit_scope. Don't
782 emit the "expected namespace-name" error if we've already emitted
783 an "is not a namespace-name" error.
784
785 2018-10-29 David Malcolm <dmalcolm@redhat.com>
786
787 PR c++/56856
788 * call.c (build_over_call): Eliminate the "arglocs" array, and the
789 call to maybe_constant_value when building "fargs".
790
791 2018-10-29 Paolo Carlini <paolo.carlini@oracle.com>
792
793 * decl.c (create_array_type_for_decl): Add location_t parameter
794 and use it.
795 (grokdeclarator): Adjust call.
796
797 2018-10-29 Marek Polacek <polacek@redhat.com>
798
799 PR c++/87594 - constexpr rejects-valid with range-based for.
800 * constexpr.c (potential_constant_expression_1): If the condition
801 can't be evaluated, return true.
802
803 2018-10-29 Joseph Myers <joseph@codesourcery.com>
804 Julian Brown <julian@codesourcery.com>
805
806 PR c++/66053
807 * semantics.c (handle_omp_array_sections_1): Allow array
808 sections with "this" pointer for OpenACC.
809
810 2018-10-25 Jason Merrill <jason@redhat.com>
811
812 * parser.c (cp_parser_sizeof_operand): Remove redundant use of
813 grokdeclarator.
814
815 2018-10-24 Jakub Jelinek <jakub@redhat.com>
816
817 PR c++/86288
818 * parser.c (cp_parser_std_attribute): Canonicalize attr_ns, and when
819 :: is not present and attr_ns non-NULL, canonicalize also attr_id.
820 (cp_parser_attribute_spec): Fix comment typo.
821
822 2018-10-24 Martin Sebor <msebor@redhat.com>
823
824 PR c++/84851
825 * call.c (maybe_warn_class_memaccess): Tighten up.
826
827 2018-10-17 David Malcolm <dmalcolm@redhat.com>
828
829 * Make-lang.in (selftest-c++): New.
830 (CPP_SELFTEST_FLAGS, CPP_SELFTEST_DEPS, s-selftest-c++)
831 (selftest-c++-gdb, selftest-c++-valgrind): Move here from
832 gcc/Makefile.in.
833
834 2018-10-17 Paolo Carlini <paolo.carlini@oracle.com>
835
836 PR c++/84705
837 * tree.c (build_cplus_new): Avoid duplicate diagnostic about
838 incomplete type, early return error_mark_node if the second
839 argument is error_mark_node.
840
841 2018-10-12 Nathan Sidwell <nathan@acm.org>
842
843 * parser.h (struct cp_parser): Drop implicit_extern_c.
844 * parser.c (cp_debug_parser): Drop implicit_extern_c.
845 (cp_parser_new): Likewise.
846 (cp_parser_translation_unit): Handle implicit extern c here. Call
847 cp_parser_toplevel_declaration.
848 (cp_parser_toplevel_declaration): New, broken out of ...
849 (cp_parser_declaration_seq_opt): ... here. Call it. Drop
850 implicit extern C handling.
851
852 2018-10-11 Will Wray <wjwray@gmail.com>
853
854 PR c++/87364
855 * cxx-pretty-print.c (pp_cxx_enumeration_constant): New function.
856 (cxx_pretty_printer::constant): Use it.
857
858 2018-10-11 David Malcolm <dmalcolm@redhat.com>
859
860 PR c++/84993
861 * call.c (enforce_access): Move diagnostics to...
862 (complain_about_access): ...this new function.
863 * cp-tree.h (class access_failure_info): Rename split out field
864 "m_field_decl" into "m_decl" and "m_diag_decl".
865 (access_failure_info::record_access_failure): Add tree param.
866 (access_failure_info::was_inaccessible_p): New accessor.
867 (access_failure_info::get_decl): New accessor.
868 (access_failure_info::get_diag_decl): New accessor.
869 (access_failure_info::get_any_accessor): New member function.
870 (access_failure_info::add_fixit_hint): New static member function.
871 (complain_about_access): New decl.
872 * typeck.c (access_failure_info::record_access_failure): Update
873 for change to fields.
874 (access_failure_info::maybe_suggest_accessor): Split out into...
875 (access_failure_info::get_any_accessor): ...this new function...
876 (access_failure_info::add_fixit_hint): ...and this new function.
877 (finish_class_member_access_expr): Split out "has no member named"
878 error-handling into...
879 (complain_about_unrecognized_member): ...this new function, and
880 check that the guessed name is accessible along the access path.
881 Only provide a spell-correction fix-it hint if it is; otherwise,
882 attempt to issue an accessor fix-it hint.
883
884 2018-10-11 Nathan Sidwell <nathan@acm.org>
885
886 * parser.c (cp_parser_translation_unit): Return void. Don't fail
887 at first extra }, simplify logic.
888 (c_parse_file): Call finish_translation_unit here.
889
890 2018-10-11 Jakub Jelinek <jakub@redhat.com>
891
892 PR c++/87582
893 * typeck.c (maybe_warn_about_returning_address_of_local): If
894 whats_returned is a structured binding identifier and the structured
895 binding is a reference, recurse on its initializer.
896
897 PR c++/87547
898 * rtti.c (get_tinfo_decl_dynamic): Use unlowered_expr_type instead
899 of TREE_TYPE.
900
901 2018-10-10 Marek Polacek <polacek@redhat.com>
902
903 PR c++/87567 - constexpr rejects call to non-constexpr function.
904 * constexpr.c (potential_constant_expression_1) <case FOR_STMT>: Return
905 true if the condition is always false.
906 <case WHILE_STMT>: Likewise.
907
908 2018-10-09 Paolo Carlini <paolo.carlini@oracle.com>
909
910 PR c++/84423
911 * pt.c (convert_template_argument): Immediately return error_mark_node
912 if the second argument is erroneous.
913 * parser.c (cp_parser_type_id): Add location_t * parameter.
914 (cp_parser_type_id_1): Likewise.
915 (cp_parser_alias_declaration): Adjust cp_parser_type_id call,
916 obtain the location of the type and save it.
917 (cp_parser_template_type_arg): Adjust.
918 (cp_parser_trailing_type_id): Likewise.
919 * decl.c (grokdeclarator): Improve error message for 'auto' in
920 alias declaration.
921
922 2018-10-08 Paolo Carlini <paolo.carlini@oracle.com>
923
924 PR c++/71128
925 * pt.c (do_decl_instantiation): Per 12.6.8/5, a concept cannot be
926 explicitly instantiated.
927
928 2018-10-05 David Malcolm <dmalcolm@redhat.com>
929
930 PR c++/56856
931 * call.c (build_over_call): Build a vec of locations of the
932 arguments before the call to maybe_constant_value, and pass to
933 check_function_arguments.
934 * cp-lang.c (LANG_HOOKS_GET_SUBSTRING_LOCATION): Define as
935 c_get_substring_location.
936 * parser.c (cp_parser_string_literal): Capture string
937 concatenation locations.
938
939 2018-10-04 Nathan Sidwell <nathan@acm.org>
940
941 * lang-specs.h: Use string contatenation, not line splicing.
942
943 2018-10-03 Jason Merrill <jason@redhat.com>
944
945 Implement P0840, language support for empty objects.
946 * tree.c (handle_no_unique_addr_attribute): New.
947 (cxx_attribute_table): Add [[no_unique_address]].
948 * class.c (field_poverlapping_p): New.
949 (layout_class_type): Check it. Adjust DECL_SIZE of potentially
950 overlapping fields.
951 (layout_empty_base_or_field): Rename from layout_empty_base, handle
952 FIELD_DECL as well.
953 (build_base_field, record_subobject_offsets): Adjust.
954
955 2018-10-03 Martin Liska <mliska@suse.cz>
956
957 PR gcov-profile/86109
958 * parser.c (cp_parser_lambda_declarator_opt):
959 Set DECL_LAMBDA_FUNCTION for lambdas.
960
961 2018-10-02 Richard Biener <rguenther@suse.de>
962
963 * name-lookup.c (check_local_shadow): Do not test DECL_FROM_INLINE.
964
965 2018-09-28 Eric Botcazou <ebotcazou@adacore.com>
966 Pierre-Marie de Rodat <derodat@adacore.com>
967
968 * method.c (use_thunk): Adjust call to cgraph_node::create_thunk.
969
970 2018-09-28 Richard Biener <rguenther@suse.de>
971
972 * error.c (cp_print_error_function): Simplify by eliding
973 the BLOCK_ABSTRACT_ORIGIN chasing.
974
975 2018-09-27 Paolo Carlini <paolo.carlini@oracle.com>
976
977 PR c++/84940
978 * semantics.c (finish_unary_op_expr): Check return value of
979 build_x_unary_op for error_mark_node.
980
981 2018-09-25 Jakub Jelinek <jakub@redhat.com>
982
983 PR c++/87398
984 * constexpr.c (cxx_eval_constant_expression) <case OBJ_TYPE_REF>: Only
985 look through COMPONENT_REFs with DECL_FIELD_IS_BASE FIELD_DECLs.
986
987 2018-09-25 Martin Liska <mliska@suse.cz>
988
989 * name-lookup.c (namespace_scope_ht_size): Remove
990 unused function.
991 * parser.c (cp_lexer_next_token_is_not_keyword): Likewise.
992
993 2018-09-24 Paolo Carlini <paolo.carlini@oracle.com>
994
995 PR c++/85070
996 * method.c (lazily_declare_fn): During error-recovery add_method
997 may return false.
998
999 2018-09-21 Marek Polacek <polacek@redhat.com>
1000
1001 PR c++/87372 - __func__ constexpr evaluation.
1002 * constexpr.c (maybe_constant_init_1): Pass false for strict down to
1003 cxx_eval_outermost_constant_expr.
1004
1005 2018-09-20 Marek Polacek <polacek@redhat.com>
1006
1007 PR c++/87109 - wrong ctor with maybe-rvalue semantics.
1008 * call.c (build_user_type_conversion_1): Refine the maybe-rvalue
1009 check to only return if we're converting the return value to a base
1010 class.
1011
1012 2018-09-20 Allan Sandfeld Jensen <allan.jensen@qt.io>
1013
1014 * g++spec.c (lang_specific_driver): Handle -r like -nostdlib.
1015
1016 2018-09-20 Jason Merrill <jason@redhat.com>
1017
1018 PR c++/87075 - ICE with constexpr array initialization.
1019 * constexpr.c (cxx_eval_vec_init_1): Handle trivial initialization.
1020
1021 2018-09-19 Marek Polacek <polacek@redhat.com>
1022
1023 Add -Wclass-conversion.
1024 * decl.c (grok_op_properties): Change a warning from -Wconversion to
1025 -Wclass-conversion. Make it print the types.
1026
1027 2018-09-19 Paolo Carlini <paolo.carlini@oracle.com>
1028
1029 PR c++/87324
1030 * parser.c (cp_parser_initializer_list): Assign error_mark_node
1031 to the index upon error.
1032
1033 2018-09-19 Marek Polacek <polacek@redhat.com>
1034
1035 PR c++/87357 - missing -Wconversion warning
1036 * decl.c (grok_op_properties): Remove diagnostic parts mentioning
1037 a conversion to a reference to void. Use
1038 same_type_ignoring_top_level_qualifiers_p rather than comparing types
1039 directly.
1040
1041 2018-09-18 Marek Polacek <polacek@redhat.com>
1042
1043 P1064R0 - Allowing Virtual Function Calls in Constant Expressions
1044 * call.c (build_over_call): No longer check if we're outside a template
1045 function.
1046 * class.c (build_vtbl_initializer): Build vtable's constructor with
1047 indexes.
1048 * constexpr.c (cxx_eval_constant_expression): Don't ignore _vptr's
1049 initializer. Handle OBJ_TYPE_REF.
1050 (potential_constant_expression_1): Handle OBJ_TYPE_REF.
1051 * decl.c (maybe_commonize_var): Bail out for any DECL_ARTIFICIAL.
1052 (initialize_artificial_var): Mark the variable as constexpr.
1053 (grokdeclarator): Change error to pedwarn. Only warn when
1054 pedantic and not C++2a.
1055
1056 2018-09-18 Paolo Carlini <paolo.carlini@oracle.com>
1057
1058 PR c++/85065
1059 * cp-tree.h (NON_ERROR): New.
1060 * pt.c (auto_hash::hash): Use it.
1061 (do_auto_deduction): Likewise.
1062
1063 2018-09-18 Nathan Sidwell <nathan@acm.org>
1064
1065 PR c++/86881
1066 * name-lookup.c (check_local_shadow): Ignore auto types.
1067
1068 2018-09-17 David Malcolm <dmalcolm@redhat.com>
1069
1070 * error.c (range_label_for_type_mismatch::get_text): Update for
1071 new param.
1072
1073 2018-09-13 Bernd Edlinger <bernd.edlinger@hotmail.de>
1074
1075 * typeck2.c (digest_init_r): Fix overlength strings.
1076
1077 2018-09-13 Ville Voutilainen <ville.voutilainen@gmail.com>
1078
1079 PR c++/87093
1080 * method.c (constructible_expr): We're in an unevaluated context
1081 in all cases, not just for class targets.
1082
1083 2018-09-12 David Malcolm <dmalcolm@redhat.com>
1084
1085 PR c++/85110
1086 * call.c (struct conversion_info): Add "loc" field.
1087 (arg_conversion_rejection): Add "loc" param, using it to
1088 initialize the new field.
1089 (bad_arg_conversion_rejection): Likewise.
1090 (explicit_conversion_rejection): Initialize the new field to
1091 UNKNOWN_LOCATION.
1092 (template_conversion_rejection): Likewise.
1093 (add_function_candidate): Pass on the argument location to the new
1094 param of arg_conversion_rejection.
1095 (add_conv_candidate): Likewise.
1096 (build_builtin_candidate): Likewise.
1097 (build_user_type_conversion_1): Likewise.
1098 (single_z_candidate): New function.
1099 (maybe_get_bad_conversion_for_unmatched_call): New function.
1100 (complain_about_bad_argument): New function, based on part of
1101 convert_for_assignment.
1102 (build_new_method_call_1): Split out handling of the "no viable
1103 candidates" case into...
1104 (complain_about_no_candidates_for_method_call): ...this new
1105 function, and use the new functions above to special-case the
1106 handling of a single non-viable candidate due to a bad argument.
1107 * cp-tree.h (complain_about_bad_argument): New decl.
1108 * typeck.c (convert_for_assignment): Split out one error-handling
1109 case into complain_about_bad_argument.
1110
1111 2018-09-09 Cesar Philippidis <cesar@codesourcery.com>
1112 Julian Brown <julian@codesourcery.com>
1113
1114 PR middle-end/86336
1115 * semantics.c (finish_omp_clauses): Treat C++ references the same in
1116 OpenACC as OpenMP.
1117
1118 2018-08-28 Martin Liska <mliska@suse.cz>
1119
1120 * constexpr.c (cxx_eval_call_expression): Add quotes
1121 to -fconstexpr-depth=.
1122
1123 2018-09-10 Marek Polacek <polacek@redhat.com>
1124
1125 * class.c (build_vtbl_ref): Remove.
1126 (build_vtbl_ref_1): Rename to build_vtbl_ref.
1127 (build_vfn_ref): Call build_vtbl_ref instead of build_vtbl_ref_1.
1128
1129 2018-09-08 Marek Polacek <polacek@redhat.com>
1130
1131 PR c++/87150 - wrong ctor with maybe-rvalue semantics.
1132 * call.c (struct conversion): Update commentary.
1133 (standard_conversion): Set rvaluedness_matches_p if LOOKUP_PREFER_RVALUE
1134 for ck_base.
1135
1136 2018-09-08 Jason Merrill <jason@redhat.com>
1137
1138 PR c++/86678 - constexpr function with non-constant after return.
1139 * constexpr.c (potential_constant_expression_1): Add jump_target.
1140 (breaks): Check for BREAK_STMT.
1141 (continues): Check for CONTINUE_STMT.
1142
1143 2018-09-08 Marek Polacek <polacek@redhat.com>
1144
1145 * cxx-pretty-print.c (cxx_pretty_printer::statement) <case
1146 RANGE_FOR_SMT>: Handle RANGE_FOR_INIT_STMT.
1147
1148 2018-09-07 Marek Polacek <polacek@redhat.com>
1149
1150 PR c++/87152 - range-based for loops with initializer broken in templates.
1151 * constexpr.c (potential_constant_expression_1) <case RANGE_FOR_STMT>:
1152 Recur into RANGE_FOR_INIT_STMT.
1153 * cp-tree.def: Add RANGE_FOR_INIT_STMT to RANGE_FOR_STMT.
1154 * cp-tree.h (RANGE_FOR_INIT_STMT): Define.
1155 * dump.c (cp_dump_tree) <case RANGE_FOR_STMT>: Also dump
1156 RANGE_FOR_INIT_STMT.
1157 * pt.c (tsubst_expr) <case RANGE_FOR_STMT>: Recur into
1158 RANGE_FOR_INIT_STMT.
1159 * semantics.c (begin_range_for_stmt): Adjust call to build_stmt.
1160 Do put the init statement in RANGE_FOR_INIT_STMT.
1161 (finish_range_for_decl): Pop it for templates.
1162
1163 2018-09-06 Bernd Edlinger <bernd.edlinger@hotmail.de>
1164
1165 * decl.c (check_initializer): Call cp_complete_array_type.
1166
1167 2018-09-05 Marek Polacek <polacek@redhat.com>
1168
1169 PR c++/87109, wrong overload with ref-qualifiers.
1170 * call.c (build_user_type_conversion_1): Use NULL instead of 0. Bail
1171 out if performing the maybe-rvalue overload resolution and a conversion
1172 function is getting called.
1173
1174 PR c++/86982, -Wreturn-local-addr and std::move and std::forward.
1175 * typeck.c (maybe_warn_about_returning_address_of_local): Handle calls
1176 to std::move or std::forward.
1177 (is_std_forward_p): New function.
1178
1179 2018-09-05 Pádraig Brady <p@draigbrady.com>
1180
1181 PR c++/87185
1182 * lambda.c (prune_lambda_captures): Protect against const_vars.get
1183 returning NULL.
1184
1185 2018-09-04 Marek Polacek <polacek@redhat.com>
1186
1187 * cp-tree.h (treat_lvalue_as_rvalue_p): Declare.
1188 * except.c (build_throw): Use it. Use CP_TYPE_VOLATILE_P.
1189 * typeck.c (treat_lvalue_as_rvalue_p): No longer static. Add PARM_OK
1190 parameter.
1191 (maybe_warn_pessimizing_move): Adjust treat_lvalue_as_rvalue_p call.
1192 (check_return_expr): Likewise.
1193
1194 2018-09-03 Paolo Carlini <paolo.carlini@oracle.com>
1195
1196 PR c++/84980
1197 * constraint.cc (finish_shorthand_constraint): Early return if the
1198 constraint is erroneous.
1199
1200 2018-09-02 Bernd Edlinger <bernd.edlinger@hotmail.de>
1201
1202 * decl.c (eval_check_narrowing): Remove.
1203 (check_initializer): Move call to braced_list_to_string from here ...
1204 * typeck2.c (store_init_value): ... to here.
1205 (digest_init_r): Remove handing of signed/unsigned char strings.
1206
1207 2018-08-31 Nathan Sidwell <nathan@acm.org>
1208
1209 PR c++/87155
1210 PR c++/84707
1211 * name-lookup.c (name_lookup::search_namespace): Don't look at
1212 inlines when searching for NULL names.
1213
1214 * decl.c (decls_match): Remove SYSTEM_IMPLICIT_EXTERN_C matching
1215 of return types and parms.
1216 * parser.c (cp_parser_parameter_declaration_clause): Likewise,
1217 '()' always means '(void)'.
1218
1219 2018-08-29 Jakub Jelinek <jakub@redhat.com>
1220
1221 PR c++/87095
1222 * decl.c (begin_destructor_body): If current_class_type has
1223 virtual bases and the primary base is nearly empty virtual base,
1224 voidify clearing of vptr and make it conditional on in-charge
1225 argument.
1226
1227 2018-08-29 Paolo Carlini <paolo.carlini@oracle.com>
1228
1229 PR c++/85265
1230 * parser.c (cp_parser_introduction_list): If cp_parser_identifier
1231 returns error_mark_node early exit the loop.
1232 (cp_parser_template_introduction): Improve error-recovery, remove
1233 error call about empty introduction-list.
1234
1235 2018-08-29 David Malcolm <dmalcolm@redhat.com>
1236
1237 PR c++/85110
1238 * call.c (print_conversion_rejection): Add "fn" param and use it
1239 for "no known conversion" messages to underline the pertinent
1240 param.
1241 (print_z_candidate): Supply "fn" to the new param above.
1242
1243 2018-08-29 Jakub Jelinek <jakub@redhat.com>
1244
1245 PR c++/87122
1246 * pt.c (tsubst_expr) <case RANGE_FOR_STMT>: If
1247 processing_template_decl and decl is structured binding decl, call
1248 cp_finish_decomp.
1249
1250 2018-08-28 Paolo Carlini <paolo.carlini@oracle.com>
1251
1252 PR c++/86546
1253 * decl.c (finish_case_label): If the type is erroneous early
1254 return error_mark_node.
1255
1256 2018-08-27 David Malcolm <dmalcolm@redhat.com>
1257
1258 PR c++/63392
1259 * parser.c (cp_parser_diagnose_invalid_type_name): Add fix-it
1260 hint.
1261
1262 2018-08-27 Jakub Jelinek <jakub@redhat.com>
1263
1264 PR c++/86993
1265 * cp-tree.h (cxx_readonly_error): Add location_t argument.
1266 * typeck2.c (cxx_readonly_error): Add LOC argument, pass it to
1267 ERROR_FOR_ASSIGNMENT macro and readonly_error. Add LOC argument
1268 to ERROR_FOR_ASSIGNMENT macro, use error_at instead of error and
1269 pass LOC to it. Formatting fixes.
1270 * typeck.c (cp_build_unary_op): Pass location to cxx_readonly_error.
1271 (cp_build_modify_expr): Pass loc to cxx_readonly_error.
1272 * semantics.c (finish_asm_stmt): Pass input_location to
1273 cxx_readonly_error.
1274
1275 2018-08-27 David Malcolm <dmalcolm@redhat.com>
1276
1277 PR c++/87091
1278 * decl.c (grokdeclarator): Update for conversion of show_caret_p
1279 to a tri-state.
1280 * error.c (cp_printer): Likewise.
1281 * name-lookup.c (maybe_suggest_missing_std_header): Update call to
1282 maybe_add_include_fixit to suggest overriding the location, as it
1283 is for a note.
1284 * parser.c (cp_parser_string_literal): Update for conversion of
1285 show_caret_p to a tri-state.
1286 (cp_parser_elaborated_type_specifier): Likewise.
1287 (set_and_check_decl_spec_loc): Likewise.
1288 * pt.c (listify): Update call to maybe_add_include_fixit to not
1289 override the location, as it is for an error.
1290 * rtti.c (typeid_ok_p): Likewise.
1291
1292 2018-08-27 Martin Liska <mliska@suse.cz>
1293
1294 * call.c (build_call_a): Use new function
1295 fndecl_built_in_p and remove check for FUNCTION_DECL if
1296 possible.
1297 (build_cxx_call): Likewise.
1298 * constexpr.c (constexpr_fn_retval): Likewise.
1299 (cxx_eval_builtin_function_call): Likewise.
1300 (cxx_eval_call_expression): Likewise.
1301 (potential_constant_expression_1): Likewise.
1302 * cp-gimplify.c (cp_gimplify_expr): Likewise.
1303 (cp_fold): Likewise.
1304 * decl.c (decls_match): Likewise.
1305 (validate_constexpr_redeclaration): Likewise.
1306 (duplicate_decls): Likewise.
1307 (make_rtl_for_nonlocal_decl): Likewise.
1308 * name-lookup.c (consider_binding_level): Likewise.
1309 (cp_emit_debug_info_for_using): Likewise.
1310 * semantics.c (finish_call_expr): Likewise.
1311 * tree.c (builtin_valid_in_constant_expr_p): Likewise.
1312
1313 2018-08-26 Marek Polacek <polacek@redhat.com>
1314
1315 PR c++/87080
1316 * typeck.c (maybe_warn_pessimizing_move): Do nothing in a template.
1317
1318 PR c++/87029, Implement -Wredundant-move.
1319 * typeck.c (treat_lvalue_as_rvalue_p): New function.
1320 (maybe_warn_pessimizing_move): Call convert_from_reference.
1321 Warn about redundant moves.
1322
1323 2018-08-24 Marek Polacek <polacek@redhat.com>
1324
1325 PR c++/67012
1326 PR c++/86942
1327 * decl.c (grokdeclarator): Disallow functions with trailing return
1328 type with decltype(auto) as its type. Also check the function if
1329 it's inner declarator doesn't exist
1330
1331 2018-08-21 Marek Polacek <polacek@redhat.com>
1332
1333 PR c++/86499
1334 * parser.c (cp_parser_lambda_introducer): Give error if a non-local
1335 lambda has a capture-default.
1336
1337 2018-08-21 Paolo Carlini <paolo.carlini@oracle.com>
1338
1339 * decl.c (check_static_variable_definition): Change to return void.
1340
1341 2018-08-21 Marek Polacek <polacek@redhat.com>
1342
1343 PR c++/86981, Implement -Wpessimizing-move.
1344 * typeck.c (decl_in_std_namespace_p): New.
1345 (is_std_move_p): New.
1346 (maybe_warn_pessimizing_move): New.
1347 (can_do_nrvo_p): New, factored out of ...
1348 (check_return_expr): ... here. Warn about potentially harmful
1349 std::move in a return statement.
1350
1351 PR c++/65043
1352 * call.c (standard_conversion): Set check_narrowing.
1353 * typeck2.c (check_narrowing): Use CP_INTEGRAL_TYPE_P rather
1354 than comparing with INTEGER_TYPE.
1355
1356 * cp-tree.h: Fix typo.
1357
1358 2018-08-20 David Malcolm <dmalcolm@redhat.com>
1359
1360 PR other/84889
1361 * call.c (build_user_type_conversion_1): Add auto_diagnostic_group
1362 instance(s).
1363 (print_error_for_call_failure): Likewise.
1364 (build_op_call_1): Likewise.
1365 (build_conditional_expr_1): Likewise.
1366 (build_new_op_1): Likewise.
1367 (build_op_delete_call): Likewise.
1368 (convert_like_real): Likewise.
1369 (build_over_call): Likewise.
1370 (build_new_method_call_1): Likewise.
1371 (joust): Likewise.
1372 * class.c (check_tag): Likewise.
1373 (finish_struct_anon_r): Likewise.
1374 (one_inherited_ctor): Likewise.
1375 (finalize_literal_type_property): Likewise.
1376 (explain_non_literal_class): Likewise.
1377 (find_flexarrays): Likewise.
1378 (resolve_address_of_overloaded_function): Likewise.
1379 * constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
1380 (is_valid_constexpr_fn): Likewise.
1381 (cx_check_missing_mem_inits): Likewise.
1382 * cp-gimplify.c (cp_genericize_r): Likewise.
1383 * cvt.c (maybe_warn_nodiscard): Likewise.
1384 * decl.c (warn_extern_redeclared_static): Likewise.
1385 (check_redeclaration_exception_specification): Likewise.
1386 (check_no_redeclaration_friend_default_args): Likewise.
1387 (duplicate_decls): Likewise.
1388 (redeclaration_error_message): Likewise.
1389 (warn_misplaced_attr_for_class_type): Likewise.
1390 * decl2.c (finish_static_data_member_decl): Likewise.
1391 (no_linkage_error): Likewise.
1392 (cp_warn_deprecated_use): Likewise.
1393 * error.c (qualified_name_lookup_error): Likewise.
1394 * friend.c (make_friend_class): Likewise.
1395 (do_friend): Likewise.
1396 * init.c (perform_member_init): Likewise.
1397 (build_new_1): Likewise.
1398 (build_vec_delete_1): Likewise.
1399 (build_delete): Likewise.
1400 * lex.c (unqualified_name_lookup_error): Likewise.
1401 * name-lookup.c (check_extern_c_conflict): Likewise.
1402 (inform_shadowed): New function.
1403 (check_local_shadow): Add auto_diagnostic_group instances,
1404 replacing goto "inform_shadowed" label with call to subroutine.
1405 (set_local_extern_decl_linkage): Add auto_diagnostic_group
1406 instance(s).
1407 * parser.c (cp_parser_diagnose_invalid_type_name): Likewise.
1408 (cp_parser_namespace_name): Likewise.
1409 * pt.c (check_specialization_namespace): Likewise.
1410 (check_template_variable): Likewise.
1411 (warn_spec_missing_attributes): Likewise.
1412 (check_explicit_specialization): Likewise.
1413 (process_partial_specialization): Likewise.
1414 (lookup_template_class_1): Likewise.
1415 (finish_template_variable): Likewise.
1416 (do_auto_deduction): Likewise.
1417 * search.c (check_final_overrider): Likewise.
1418 (look_for_overrides_r): Likewise.
1419 * tree.c (maybe_warn_parm_abi): Likewise.
1420 * typeck.c (cxx_sizeof_expr): Likewise.
1421 (cp_build_function_call_vec): Likewise.
1422 (cp_build_binary_op): Likewise.
1423 (convert_for_assignment): Likewise.
1424 (maybe_warn_about_returning_address_of_local): Likewise.
1425 * typeck2.c (abstract_virtuals_error_sfinae): Likewise.
1426 (check_narrowing): Likewise.
1427
1428 2018-08-17 David Malcolm <dmalcolm@redhat.com>
1429
1430 * typeck.c (string_conv_p): Extract location from EXP and use it
1431 in preference to input_location when issuing warnings.
1432
1433 2018-08-15 David Malcolm <dmalcolm@redhat.com>
1434
1435 * call.c: Include "gcc-rich-location.h".
1436 (convert_like_real): Add range label for "invalid conversion"
1437 diagnostic.
1438 (perform_implicit_conversion_flags): Add type label to the
1439 "could not convert" error.
1440 * error.c: Include "gcc-rich-location.h".
1441 (range_label_for_type_mismatch::get_text): New function.
1442 * typeck.c (convert_for_assignment): Add type label to
1443 the "cannot convert" error if a location is available.
1444
1445 2018-08-15 Paolo Carlini <paolo.carlini@oracle.com>
1446
1447 * decl.c (check_previous_goto_1): When decl_jump_unsafe returns 2
1448 emit an error instead of a permerror.
1449
1450 2018-08-13 Marek Polacek <polacek@redhat.com>
1451
1452 PR c++/57891
1453 * call.c (struct conversion): Add check_narrowing_const_only.
1454 (build_converted_constant_expr): Set check_narrowing and
1455 check_narrowing_const_only. Give error if expr is error node.
1456 (convert_like_real): Pass it to check_narrowing.
1457 * cp-tree.h (check_narrowing): Add a default parameter.
1458 * decl.c (compute_array_index_type): Use input_location instead of
1459 location_of.
1460 * pt.c (convert_nontype_argument): Return NULL_TREE if tf_error.
1461 * typeck2.c (check_narrowing): Don't warn for instantiation-dependent
1462 expressions. Call maybe_constant_value instead of
1463 fold_non_dependent_expr. Don't mention { } in diagnostic. Only check
1464 narrowing for constants if CONST_ONLY.
1465
1466 2018-08-13 Martin Sebor <msebor@redhat.com>
1467
1468 PR tree-optimization/71625
1469 * decl.c (check_initializer): Call braced_list_to_string.
1470 (eval_check_narrowing): New function.
1471 * gcc/cp/typeck2.c (digest_init_r): Accept strings literals
1472 as initilizers for all narrow character types.
1473
1474 2018-08-13 Marek Polacek <polacek@redhat.com>
1475
1476 P0806R2 - Deprecate implicit capture of this via [=]
1477 * lambda.c (add_default_capture): Formatting fixes. Warn about
1478 deprecated implicit capture of this via [=].
1479
1480 PR c++/86915
1481 * decl.c (create_array_type_for_decl): Handle null name.
1482
1483 2018-08-10 Jason Merrill <jason@redhat.com>
1484
1485 PR c++/86728 - C variadic generic lambda.
1486 * parser.c (cp_parser_parameter_declaration): Don't turn 'auto' into
1487 a pack if it's followed by a declarator-id.
1488
1489 2018-08-08 Jakub Jelinek <jakub@redhat.com>
1490
1491 P0595R1 - is_constant_evaluated
1492 * cp-tree.h (enum cp_built_in_function): New.
1493 (maybe_constant_init): Add pretend_const_required argument.
1494 * typeck2.c (store_init_value): Pass true as new argument to
1495 maybe_constant_init.
1496 * constexpr.c (constexpr_fn_retval): Check also DECL_BUILT_IN_CLASS
1497 for BUILT_IN_UNREACHABLE.
1498 (struct constexpr_ctx): Add pretend_const_required field.
1499 (cxx_eval_builtin_function_call): Use DECL_IS_BUILTIN_CONSTANT_P
1500 macro. Handle CP_BUILT_IN_IS_CONSTANT_EVALUATED. Check also
1501 DECL_BUILT_IN_CLASS for BUILT_IN_UNREACHABLE.
1502 (cxx_eval_outermost_constant_expr): Add pretend_const_required
1503 argument, initialize pretend_const_required field in ctx. If the
1504 result is TREE_CONSTANT and non_constant_p, retry with
1505 pretend_const_required false if it was true.
1506 (is_sub_constant_expr): Initialize pretend_const_required_field in
1507 ctx.
1508 (cxx_constant_value): Pass true as pretend_const_required to
1509 cxx_eval_outermost_constant_expr.
1510 (maybe_constant_value): Pass false as pretend_const_required to
1511 cxx_eval_outermost_constant_expr.
1512 (fold_non_dependent_expr): Likewise.
1513 (maybe_constant_init_1): Add pretend_const_required argument, pass it
1514 down to cxx_eval_outermost_constant_expr. Pass !allow_non_constant
1515 instead of false as strict to cxx_eval_outermost_constant_expr.
1516 (maybe_constant_init): Add pretend_const_required argument, pass it
1517 down to maybe_constant_init_1.
1518 (cxx_constant_init): Pass true as pretend_const_required to
1519 maybe_constant_init_1.
1520 * cp-gimplify.c (cp_gimplify_expr): Handle CALL_EXPRs to
1521 CP_BUILT_IN_IS_CONSTANT_EVALUATED.
1522 (cp_fold): Don't fold CP_BUILT_IN_IS_CONSTANT_EVALUATED calls.
1523 * decl.c: Include langhooks.h.
1524 (cxx_init_decl_processing): Register __builtin_is_constant_evaluated
1525 built-in.
1526 * tree.c (builtin_valid_in_constant_expr_p): Return true for
1527 CP_BUILT_IN_IS_CONSTANT_EVALUATED.
1528 * pt.c (declare_integer_pack): Initialize DECL_FUNCTION_CODE.
1529
1530 PR c++/86836
1531 * pt.c (tsubst_expr): For structured bindings, call tsubst_decomp_names
1532 before tsubst_init, not after it.
1533
1534 PR c++/86738
1535 * constexpr.c (cxx_eval_binary_expression): For arithmetics involving
1536 NULL pointer set *non_constant_p to true.
1537 (cxx_eval_component_reference): For dereferencing of a NULL pointer,
1538 set *non_constant_p to true and return t.
1539
1540 2018-08-07 Paolo Carlini <paolo.carlini@oracle.com>
1541
1542 PR c++/59480, DR 136
1543 * decl.c (check_no_redeclaration_friend_default_args): New.
1544 (duplicate_decls): Use the latter; also check that a friend
1545 declaration specifying default arguments is a definition.
1546
1547 2018-08-07 Ville Voutilainen <ville.voutilainen@gmail.com>
1548
1549 PR c++/79133
1550 * name-lookup.c (check_local_shadow): Reject captures and parameters
1551 with the same name.
1552
1553 2018-08-06 Marek Polacek <polacek@redhat.com>
1554
1555 PR c++/86767
1556 * constexpr.c (cxx_eval_statement_list): Handle continue.
1557
1558 2018-08-03 David Malcolm <dmalcolm@redhat.com>
1559 Jonathan Wakely <jwakely@redhat.com>
1560
1561 * decl.c: Include "gcc-rich-location.h".
1562 (add_return_star_this_fixit): New function.
1563 (finish_function): When warning about missing return statements in
1564 functions returning non-void, add a "return *this;" fix-it hint for
1565 assignment operators.
1566
1567 2018-08-03 Jason Merrill <jason@redhat.com>
1568
1569 PR c++/86706
1570 * class.c (build_base_path): Use currently_open_class.
1571
1572 2018-08-02 David Malcolm <dmalcolm@redhat.com>
1573
1574 * error.c (cxx_print_error_function): Duplicate "file" before
1575 passing it to pp_set_prefix.
1576 (cp_print_error_function): Use pp_take_prefix when saving the
1577 existing prefix.
1578
1579 2018-08-02 Richard Biener <rguenther@suse.de>
1580
1581 PR c++/86763
1582 * class.c (layout_class_type): Copy TYPE_TYPELESS_STORAGE
1583 to the CLASSTYPE_AS_BASE.
1584
1585 2018-08-01 Martin Sebor <msebor@redhat.com>
1586
1587 PR tree-optimization/86650
1588 * error.c (cp_printer): Move usage of EXPR_LOCATION (t) and
1589 TREE_BLOCK (t) from within percent_K_format to this callsite.
1590
1591 2018-08-01 Paolo Carlini <paolo.carlini@oracle.com>
1592
1593 PR c++/86661
1594 * class.c (note_name_declared_in_class): Use location_of in permerror
1595 instead of DECL_SOURCE_LOCATION (for OVERLOADs).
1596
1597 2018-07-31 Tom de Vries <tdevries@suse.de>
1598
1599 PR debug/86687
1600 * optimize.c (update_cloned_parm): Copy DECL_BY_REFERENCE.
1601
1602 2018-07-31 Jakub Jelinek <jakub@redhat.com>
1603
1604 P1008R1 - prohibit aggregates with user-declared constructors
1605 * class.c (check_bases_and_members): For C++2a set
1606 CLASSTYPE_NON_AGGREGATE based on TYPE_HAS_USER_CONSTRUCTOR rather than
1607 type_has_user_provided_or_explicit_constructor.
1608
1609 2018-07-31 Martin Liska <mliska@suse.cz>
1610
1611 PR c++/86653
1612 * parser.c (cp_parser_condition): Initialize non_constant_p
1613 to false.
1614
1615 2018-07-28 David Malcolm <dmalcolm@redhat.com>
1616
1617 * error.c (cp_printer): In the leading comment, move "%H" and "%I"
1618 into alphabetical order, and add missing "%G" and "%K". Within
1619 the switch statement, move cases 'G', 'H', 'I' and 'K' so that the
1620 cases are in alphabetical order.
1621
1622 2018-07-25 Jakub Jelinek <jakub@redhat.com>
1623
1624 * cp-tree.h (enum cp_tree_index): Add
1625 CPTI_{ABI_TAG,ALIGNED,BEGIN,END,GET,TUPLE_{ELEMENT,SIZE}}_IDENTIFIER
1626 and CPTI_{GNU,TYPE,VALUE,FUN,CLOSURE}_IDENTIFIER.
1627 (abi_tag_identifier, aligned_identifier, begin_identifier,
1628 end_identifier, get__identifier, gnu_identifier,
1629 tuple_element_identifier, tuple_size_identifier, type_identifier,
1630 value_identifier, fun_identifier, closure_identifier): Define.
1631 * decl.c (initialize_predefined_identifiers): Initialize the above
1632 identifiers.
1633 (get_tuple_size): Use tuple_size_identifier instead of
1634 get_identifier ("tuple_size") and value_identifier instead of
1635 get_identifier ("value").
1636 (get_tuple_element_type): Use tuple_element_identifier instead of
1637 get_identifier ("tuple_element") and type_identifier instead of
1638 get_identifier ("type").
1639 (get_tuple_decomp_init): Use get__identifier instead of
1640 get_identifier ("get").
1641 * lambda.c (maybe_add_lambda_conv_op): Use fun_identifier instead of
1642 get_identifier ("_FUN").
1643 * parser.c (cp_parser_lambda_declarator_opt): Use closure_identifier
1644 instead of get_identifier ("__closure").
1645 (cp_parser_std_attribute): Use gnu_identifier instead of
1646 get_identifier ("gnu").
1647 (cp_parser_std_attribute_spec): Likewise. Use aligned_identifier
1648 instead of get_identifier ("aligned").
1649 * class.c (check_abi_tags, inherit_targ_abi_tags): Use
1650 abi_tag_identifier instead of get_identifier ("abi_tag").
1651
1652 PR c++/85515
1653 * cp-tree.h (enum cp_tree_index): Add
1654 CPTI_FOR_{RANGE,BEGIN,END}{,_}_IDENTIFIER.
1655 (for_range__identifier, for_begin__identifier, for_end__identifier,
1656 for_range_identifier, for_begin_identifier, for_end_identifier):
1657 Define.
1658 * decl.c (initialize_predefined_identifiers): Initialize
1659 for_{range,begin,end}{,_}_identifier.
1660 * parser.c (build_range_temp): Use for_range__identifier instead of
1661 get_identifier ("__for_range").
1662 (cp_convert_range_for): Use for_begin__identifier and
1663 for_end__identifier instead of get_identifier ("__for_begin") and
1664 get_identifier ("__for_end").
1665 * semantics.c (finish_for_stmt): Rename "__for_{range,begin,end} "
1666 local symbols to "__for_{range,begin,end}".
1667
1668 2018-07-23 Jakub Jelinek <jakub@redhat.com>
1669
1670 PR c++/86569
1671 * cp-gimplify.c (cp_fold): Don't fold comparisons into other kind
1672 of expressions other than INTEGER_CST regardless of TREE_NO_WARNING
1673 or warn_nonnull_compare.
1674
1675 2018-07-19 Paolo Carlini <paolo.carlini@oracle.com>
1676
1677 Revert fix for c++/59480 (and testsuite followup)
1678
1679 2019-07-18 Paolo Carlini <paolo.carlini@oracle.com>
1680
1681 PR c++/59480, DR 136
1682 * decl.c (check_no_redeclaration_friend_default_args): New.
1683 (duplicate_decls): Use the latter; also check that a friend
1684 declaration specifying default arguments is a definition.
1685
1686 2018-07-18 Jakub Jelinek <jakub@redhat.com>
1687
1688 PR c++/86550
1689 * parser.c (cp_parser_decl_specifier_seq): Diagnose invalid type
1690 specifier if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR.
1691
1692 2018-07-18 Marek Polacek <polacek@redhat.com>
1693
1694 PR c++/86190 - bogus -Wsign-conversion warning
1695 * typeck.c (cp_build_binary_op): Fix formatting. Add a warning
1696 sentinel.
1697
1698 2018-07-18 Paolo Carlini <paolo.carlini@oracle.com>
1699
1700 PR c++/59480, DR 136
1701 * decl.c (check_no_redeclaration_friend_default_args): New.
1702 (duplicate_decls): Use the latter; also check that a friend
1703 declaration specifying default arguments is a definition.
1704
1705 2018-07-18 Paolo Carlini <paolo.carlini@oracle.com>
1706
1707 * class.c (note_name_declared_in_class): Prefer permerror + inform
1708 to a pair of permerrors; use DECL_SOURCE_LOCATION.
1709
1710 2018-07-18 Richard Biener <rguenther@suse.de>
1711
1712 PR debug/86523
1713 * decl2.c (c_parse_final_cleanups): Call write_out_vars before
1714 start_static_storage_duration_function sets current_function_decl.
1715
1716 2018-07-17 Jason Merrill <jason@redhat.com>
1717
1718 PR c++/86480 - nested variadic lambda and constexpr if.
1719 * pt.c (find_parameter_packs_r) [IF_STMT]: Don't walk into
1720 IF_STMT_EXTRA_ARGS.
1721 * tree.c (cp_walk_subtrees) [DECLTYPE_TYPE]: Set
1722 cp_unevaluated_operand.
1723 [ALIGNOF_EXPR] [SIZEOF_EXPR] [NOEXCEPT_EXPR]: Likewise.
1724
1725 2018-07-16 Paolo Carlini <paolo.carlini@oracle.com>
1726
1727 * class.c (resolve_address_of_overloaded_function): Don't emit an
1728 inform if the matching permerror returns false.
1729 * pt.c (check_specialization_namespace): Likewise.
1730
1731 2018-07-16 Jakub Jelinek <jakub@redhat.com>
1732
1733 PR c++/3698
1734 PR c++/86208
1735 * cp-gimplify.c (cp_genericize_r): When using extern_decl_map, or
1736 in TREE_USED flag from stmt to h->to.
1737
1738 2018-07-13 Nathan Sidwell <nathan@acm.org>
1739
1740 PR c++/86374
1741 * pt.c (lookup_template_class_1): Use tsubst_aggr_type for
1742 contexts that are classes.
1743 * parser.c (cp_parser_template_id): Combine entering_scope decl &
1744 initializer.
1745
1746 2018-07-12 Jakub Jelinek <jakub@redhat.com>
1747
1748 * decl2.c (cplus_decl_attributes): Don't diagnose vars without mappable
1749 type here, instead add "omp declare target implicit" attribute. Add
1750 that attribute instead of "omp declare target" also when
1751 processing_template_decl.
1752 * decl.c (cp_finish_decl): Diagnose vars without mappable type here,
1753 and before calling cp_omp_mappable_type call complete_type.
1754
1755 2018-07-10 Jakub Jelinek <jakub@redhat.com>
1756
1757 PR sanitizer/86406
1758 * cp-gimplify.c (cp_maybe_instrument_return): Skip trailing
1759 DEBUG_BEGIN_STMTs.
1760
1761 PR c++/86443
1762 * semantics.c (handle_omp_for_class_iterator): Remove lastp argument,
1763 instead of setting *lastp turn orig_declv elt into a TREE_LIST.
1764 (finish_omp_for): Adjust handle_omp_for_class_iterator caller.
1765 * pt.c (tsubst_omp_for_iterator): Allow OMP_FOR_ORIG_DECLS to contain
1766 TREE_LIST for both the original class iterator and the "last" helper
1767 var.
1768
1769 2018-07-09 Paolo Carlini <paolo.carlini@oracle.com>
1770
1771 * decl.c (grokdeclarator): Use rich_location::add_range in three
1772 more places; include gcc-rich-location.h.
1773
1774 2018-07-07 Aldy Hernandez <aldyh@redhat.com>
1775
1776 * decl.c (build_enumerator): Change overflow type to overflow_type.
1777 * init.c (build_new_1): Same.
1778
1779 2018-07-05 Nathan Sidwell <nathan@acm.org>
1780
1781 * cp/decl.c (decls_match): Check SYSTEM_IMPLICIT_EXTERN_C not
1782 NO_IMPLICIT_EXTERN_C.
1783 * cp/parser.c (cp_parser_parameter_declaration_clause): Likewise.
1784
1785 2018-07-04 Ville Voutilainen <ville.voutilainen@gmail.com>
1786
1787 PR c++/86398
1788 * method.c (is_trivially_xible): Return false
1789 if is_xible_helper returns a NULL_TREE.
1790
1791 2018-07-03 Paolo Carlini <paolo.carlini@oracle.com>
1792
1793 * decl.c (min_location): New.
1794 (smallest_type_quals_location): Use the latter.
1795 (check_concept_fn): Use DECL_SOURCE_LOCATION.
1796 (grokdeclarator): Use accurate locations in a number of error
1797 messages involving ds_thread, ds_storage_class, ds_virtual,
1798 ds_constexpr, ds_typedef and ds_friend; exploit min_location.
1799
1800 2018-07-03 Marek Polacek <polacek@redhat.com>
1801
1802 PR c++/86201
1803 * typeck.c (cp_build_binary_op): Check c_inhibit_evaluation_warnings.
1804
1805 2018-07-03 Jason Merrill <jason@redhat.com>
1806
1807 PR c++/86378 - functional cast in noexcept-specifier.
1808 * tree.c (strip_typedefs_expr) [TREE_LIST]: Fix iteration.
1809
1810 2018-07-02 Paolo Carlini <paolo.carlini@oracle.com>
1811
1812 * parser.c (set_and_check_decl_spec_loc): Use rich_location::add_range
1813 in error message about __thread and thread_local at the same time.
1814
1815 2018-06-29 Marek Polacek <polacek@redhat.com>
1816
1817 PR c++/86184
1818 * tree.c (cp_save_expr): Don't call save_expr for TARGET_EXPRs.
1819
1820 2018-06-28 David Malcolm <dmalcolm@redhat.com>
1821
1822 * parser.c (cp_parser_error_1): After issuing a conflict marker
1823 error, consume tokens until the end of the source line.
1824
1825 2018-06-28 Jason Merrill <jason@redhat.com>
1826
1827 PR c++/86342 - -Wdeprecated-copy and system headers.
1828 * decl2.c (cp_warn_deprecated_use): Don't warn about declarations
1829 in system headers.
1830
1831 2018-06-27 David Malcolm <dmalcolm@redhat.com>
1832
1833 PR c++/86329
1834 * name-lookup.c (consider_binding_level): Filter out names that
1835 match anon_aggrname_p.
1836
1837 2018-06-27 Jason Merrill <jason@redhat.com>
1838
1839 * name-lookup.c (do_pushtag): If we skip a class level, also skip
1840 its template level.
1841
1842 2018-06-26 Jason Merrill <jason@redhat.com>
1843
1844 PR c++/86320 - memory-hog with std::array of pair
1845 * typeck2.c (process_init_constructor_array): Only compute a
1846 constant initializer once.
1847
1848 PR c++/80290 - memory-hog with std::pair.
1849 * pt.c (fn_type_unification): Add convs parameter.
1850 (check_non_deducible_conversion): Remember conversion.
1851 (check_non_deducible_conversions): New. Do checks here.
1852 (type_unification_real): Not here. Remove flags parm.
1853 * call.c (add_function_candidate): Make convs a parameter.
1854 Don't recalculate the conversion if it's already set.
1855 (add_template_candidate_real): Allocate convs here.
1856 (good_conversion, conv_flags): New.
1857
1858 2018-06-26 Jakub Jelinek <jakub@redhat.com>
1859
1860 PR c++/86291
1861 * parser.c (cp_parser_omp_for_loop_init): Change for_block argument
1862 type from vec<tree, va_gc> * to vec<tree, va_gc> *&.
1863
1864 2018-06-23 Paolo Carlini <paolo.carlini@oracle.com>
1865
1866 * decl.c (bad_specifiers): Add const location_t* parameter and
1867 use locations in error messages about 'inline' and 'virtual'.
1868 (mark_inline_variable): Add location_t parameter and use it in
1869 error_at and pedwarn messages.
1870 (grokdeclarator): Use declspecs->locations[ds_constexpr],
1871 declspecs->locations[ds_concept], declspecs->locations[ds_virtual],
1872 declspecs->locations[ds_inline] in many error messages; adjust
1873 bad_specifiers and mark_inline_variable calls.
1874 (grokvardecl): Use declspecs->locations[ds_concept] in error message.
1875
1876 2018-06-22 Jason Merrill <jason@redhat.com>
1877
1878 PR c++/86219 - ICE with erroneous initializer in template.
1879 * constexpr.c (fold_non_dependent_expr): Add complain parm.
1880 * call.c, expr.c, init.c, pt.c, semantics.c, typeck.c, typeck2.c:
1881 Pass it.
1882 * call.c (build_cxx_call): Don't mess with builtins in a template.
1883 * typeck2.c (store_init_value): If fold_non_dependent_expr didn't
1884 produce a constant value, go back to the uninstantiated form.
1885
1886 Avoid taking the address of something just because it's in parens.
1887 * constexpr.c (same_type_ignoring_tlq_and_bounds_p): New.
1888 (cxx_fold_indirect_ref): Use it.
1889 (cxx_eval_constant_expression) [VIEW_CONVERT_EXPR]: Use it.
1890 * cp-tree.h (REF_PARENTHESIZED_P): Allow VIEW_CONVERT_EXPR.
1891 * semantics.c (force_paren_expr): Use VIEW_CONVERT_EXPR instead of
1892 static_cast to reference type.
1893 (maybe_undo_parenthesized_ref): Handle VIEW_CONVERT_EXPR.
1894
1895 2018-06-21 Jason Merrill <jason@redhat.com>
1896
1897 * pt.c (tsubst) [TEMPLATE_TYPE_PARM]: Use TEMPLATE_PARM_DESCENDANTS.
1898
1899 * name-lookup.c (do_push_to_top_level): Don't allocate
1900 current_lang_base.
1901 (do_pop_from_top_level): Release current_lang_base.
1902
1903 Let -fmem-report see callers of cxx_make_type.
1904 * lex.c (cxx_make_type): Add MEM_STAT_DECL.
1905 (make_class_type): Likewise.
1906 (cxx_make_type_hook): New.
1907 * cp-objcp-common.h (LANG_HOOKS_MAKE_TYPE): Use cxx_make_type_hook.
1908
1909 2018-06-20 Nathan Sidwell <nathan@acm.org>
1910
1911 PR c++/85634
1912 * friend.c (add_friend): Keep lookup sets of tempate sets.
1913
1914 2018-06-20 Paolo Carlini <paolo.carlini@oracle.com>
1915
1916 * decl.c (grokfndecl): Add const cp_decl_specifier_seq* parameter;
1917 tidy handling of a null location_t argument; use proper location
1918 information in a few additional error messages.
1919 (grokdeclarator): Update calls.
1920
1921 2018-06-20 Chung-Lin Tang <cltang@codesourcery.com>
1922 Thomas Schwinge <thomas@codesourcery.com>
1923 Cesar Philippidis <cesar@codesourcery.com>
1924
1925 * parser.c (cp_parser_omp_clause_name): Add support for finalize
1926 and if_present. Make present_or_{copy,copyin,copyout,create} aliases
1927 to their non-present_or_* counterparts. Make 'self' an alias to
1928 PRAGMA_OACC_CLAUSE_HOST.
1929 (cp_parser_oacc_data_clause): Update GOMP mappings for
1930 PRAGMA_OACC_CLAUSE_{COPY,COPYIN,COPYOUT,CREATE,DELETE}. Remove
1931 PRAGMA_OACC_CLAUSE_{SELF,PRESENT_OR_*}.
1932 (cp_parser_oacc_all_clauses): Handle finalize and if_present clauses.
1933 Remove support for present_or_* clauses.
1934 (OACC_KERNELS_CLAUSE_MASK): Remove PRESENT_OR_* clauses.
1935 (OACC_PARALLEL_CLAUSE_MASK): Likewise.
1936 (OACC_DECLARE_CLAUSE_MASK): Likewise.
1937 (OACC_DATA_CLAUSE_MASK): Likewise.
1938 (OACC_ENTER_DATA_CLAUSE_MASK): Remove PRESENT_OR_* clauses.
1939 (OACC_EXIT_DATA_CLAUSE_MASK): Add FINALIZE clause.
1940 (OACC_UPDATE_CLAUSE_MASK): Remove SELF, add IF_PRESENT.
1941 (cp_parser_oacc_declare): Remove PRESENT_OR_* clauses.
1942 * pt.c (tsubst_omp_clauses): Handle IF_PRESENT and FINALIZE.
1943 * semantics.c (finish_omp_clauses): Handle IF_PRESENT and FINALIZE.
1944
1945 2018-06-20 Marek Polacek <polacek@redhat.com>
1946
1947 PR c++/86240
1948 * constexpr.c (cxx_eval_constant_expression): Handle ABSU_EXPR.
1949 (fold_simple_1): Likewise.
1950 * error.c (dump_expr): Likewise.
1951
1952 2018-06-20 Nathan Sidwell <nathan@acm.org>
1953
1954 PR c++/85634
1955 * cp-tree.h (lookup_keep): Drop KEEP parm.
1956 (lookup_list_keep): Delete.
1957 (maybe_get_fns): Declare.
1958 * parser.c (cp_parser_primary_expression): Call lookup_keep here.
1959 (cp_parser_template_id): Not here ...
1960 * decl.c (cp_finish_decl): ... nor here ...
1961 * init.c (build_raw_new_expr): ... nor here ...
1962 * pt.c (process_template_parm): ... nor here ...
1963 * semantics.c (perform_koenig_lookup): Call lookup_keep.
1964 (finish_call_expr): Not here.
1965 * tree.c (ovl_cache): Delete.
1966 (ovl_make, ovl_copy): No cache.
1967 (lookup_keep): Always keep.
1968 (lookup_list_keep): Delete.
1969 (maybe_get_fns): New, broken out of ...
1970 (get_fns): ... here. Call it.
1971 (built_min_nt_loc, build_min, build_min_non_dep): Drop lookup_keep.
1972 (build_min_nt_call_vec): Likewise.
1973
1974 2018-06-19 Jason Merrill <jason@redhat.com>
1975
1976 * cp-tree.h (CONSTRUCTOR_NO_IMPLICIT_ZERO): Remove.
1977 * constexpr.c: Use CONSTRUCTOR_NO_CLEARING instead.
1978
1979 PR c++/86182 - ICE with anonymous union passed to template.
1980 * pt.c (tsubst_expr) [DECL_EXPR]: Handle an anonymous union type
1981 used to declare a named variable.
1982
1983 2018-06-18 Jason Merrill <jason@redhat.com>
1984
1985 * tree.c (cp_expr_location): New.
1986 * cp-tree.h (cp_expr_loc_or_loc): New.
1987 * call.c, cvt.c, constexpr.c, constraint.cc, cp-gimplify.c, decl.c,
1988 error.c, init.c, lex.c, parser.c, pt.c, semantics.c, typeck.c,
1989 typeck2.c: Use it instead of EXPR_LOC_OR_LOC.
1990
1991 * parser.c (cp_parser_lambda_expression): Use a range for
1992 LAMBDA_EXPR_LOCATION.
1993
1994 PR c++/86200 - ICE with unexpanded pack in lambda parameter.
1995 * pt.c (find_parameter_packs_r) [LAMBDA_EXPR]: Also look into the
1996 function type.
1997
1998 PR c++/81060 - ICE with unexpanded parameter pack.
1999 * pt.c (check_for_bare_parameter_packs): Add loc parameter.
2000 * decl.c (grokdeclarator): Call it for qualifying_scope.
2001
2002 PR c++/86171 - ICE with recursive alias instantiation.
2003 * pt.c (tsubst_decl): Handle recursive alias instantiation.
2004
2005 2018-06-18 Paolo Carlini <paolo.carlini@oracle.com>
2006
2007 * decl.c (duplicate_decls): Consistently use DECL_SOURCE_LOCATION
2008 in errors about redefined default arguments; tidy.
2009
2010 2018-06-16 Kugan Vivekanandarajah <kuganv@linaro.org>
2011
2012 * constexpr.c (potential_constant_expression_1): Handle ABSU_EXPR.
2013 * cp-gimplify.c (cp_fold): Likewise.
2014
2015 2018-06-15 Jason Merrill <jason@redhat.com>
2016
2017 PR c++/86147 - wrong capture for template argument.
2018 * expr.c (mark_use): Look through NOP_EXPR.
2019
2020 * name-lookup.c (do_pushtag): Don't look through complete types, but
2021 don't add to them either. Get context from current_binding_level.
2022 * pt.c (tsubst_default_argument): Use push_to/pop_from_top_level.
2023
2024 * decl.c (start_enum): Do compare dependent underlying type.
2025
2026 PR c++/82882 - ICE with lambda in template default argument.
2027 * lambda.c (record_null_lambda_scope): New.
2028 * pt.c (tsubst_lambda_expr): Use it.
2029 * name-lookup.c (do_pushtag): Don't give a lambda DECL_CONTEXT of a
2030 function that isn't open.
2031
2032 * tree.c (maybe_warn_parm_abi): Inform the location of the class.
2033
2034 2018-06-14 Marek Polacek <polacek@redhat.com>
2035
2036 PR c++/86063
2037 * decl2.c (cp_check_const_attributes): Skip trees that are not
2038 TREE_LISTs.
2039
2040 2018-06-14 Jakub Jelinek <jakub@redhat.com>
2041
2042 P0624R2 - Default constructible and assignable stateless lambdas
2043 * method.c (synthesized_method_walk): For C++2a don't mark
2044 sfk_constructor or sfk_copy_assignment as deleted if lambda has
2045 no lambda-captures.
2046
2047 2018-06-14 Paolo Carlini <paolo.carlini@oracle.com>
2048
2049 * decl.c (duplicate_decls): Use DECL_SOURCE_LOCATION in
2050 OPT_Wshadow warning_at.
2051 (grokfndecl): Consistently use the location_t argument in
2052 literal operator diagnostic messages.
2053 (grokdeclarator): Use declspecs->locations[ds_storage_class]
2054 in error_at call.
2055 * decl2.c (finish_static_data_member_decl): Use DECL_SOURCE_LOCATION
2056 in permerror call.
2057
2058 2018-06-13 Jason Merrill <jason@redhat.com>
2059
2060 PR c++/86099 - ICE with trivial copy and non-trivial default ctor.
2061 * constexpr.c (instantiate_cx_fn_r): Don't synthesize trivial
2062 constructors.
2063
2064 PR c++/86094 - wrong code with defaulted move ctor.
2065 * class.c (classtype_has_non_deleted_move_ctor): New.
2066 * tree.c (maybe_warn_parm_abi, type_has_nontrivial_copy_init):
2067 Handle v12 breakage.
2068
2069 2018-06-12 Jason Merrill <jason@redhat.com>
2070
2071 PR c++/86098 - ICE with template placeholder for TTP.
2072 * typeck.c (structural_comptypes) [TEMPLATE_TYPE_PARM]: Check
2073 CLASS_PLACEHOLDER_TEMPLATE.
2074
2075 2018-06-12 Paolo Carlini <paolo.carlini@oracle.com>
2076
2077 * decl2.c (coerce_new_type, coerce_delete_type): Add location_t
2078 parameter and adjust error_at calls.
2079 * decl.c (grok_op_properties): Adjust calls.
2080 * cp-tree.h (oerce_new_type, coerce_delete_type): Adjust decls.
2081
2082 2018-06-12 Marek Polacek <polacek@redhat.com>
2083
2084 Core issue 1331 - const mismatch with defaulted copy constructor
2085 * class.c (check_bases_and_members): When checking a defaulted
2086 function, mark it as deleted rather than giving an error.
2087
2088 2018-06-11 Jason Merrill <jason@redhat.com>
2089
2090 PR c++/85792 -Wctor-dtor-privacy and inherited constructor.
2091 * class.c (maybe_warn_about_overly_private_class): Handle inherited
2092 constructors.
2093
2094 PR c++/85963 - -Wunused-but-set with ?: in template.
2095 * pt.c (tsubst_copy_and_build) [COND_EXPR]: Call mark_rvalue_use.
2096
2097 2018-06-11 Paolo Carlini <paolo.carlini@oracle.com>
2098
2099 * decl.c (grok_op_properties): Consistently use the location
2100 of the decl; remove special casing of POSTINCREMENT_EXPR and
2101 POSTDECREMENT_EXPR wrt default arguments.
2102
2103 2018-06-05 Jason Merrill <jason@redhat.com>
2104
2105 * constexpr.c (cxx_eval_binary_expression): Special case comparison
2106 of pointers to members of the same union.
2107
2108 2018-06-11 Jason Merrill <jason@redhat.com>
2109
2110 PR c++/86094 - wrong code with defaulted move ctor.
2111 * tree.c (type_has_nontrivial_copy_init): Fix move ctor handling.
2112
2113 2018-06-10 Paolo Carlini <paolo.carlini@oracle.com>
2114
2115 * decl.c (grokfndecl): Use the location_t argument in two more places.
2116
2117 2018-06-06 Marek Polacek <polacek@redhat.com>
2118
2119 PR c++/85977
2120 * pt.c (unify): If ELTTYPE has no deducible template parms, skip
2121 deduction from the list elements.
2122 (type_unification_real): Check convertibility of list elements.
2123
2124 2018-06-06 Jason Merrill <jason@redhat.com>
2125
2126 PR c++/86060 - ICE on range for with -std=c++98.
2127 * parser.c (cp_parser_init_statement): Don't clobber *decl after
2128 pedwarn.
2129
2130 PR c++/85710 - ICE with -Wmemset-elt-size.
2131 * semantics.c (finish_call_expr): Call warn_for_memset here.
2132 * parser.c (cp_parser_postfix_expression): Not here.
2133 (literal_integer_zerop): No longer static.
2134 * pt.c (build_non_dependent_expr): Don't wrap CONST_DECL.
2135
2136 2018-06-05 Marek Polacek <polacek@redhat.com>
2137
2138 PR c++/85976
2139 * tree.c (cp_tree_equal): Handle USING_DECL.
2140
2141 2018-06-05 Jason Merrill <jason@redhat.com>
2142
2143 PR c++/85731 - wrong error with qualified-id in template.
2144 * semantics.c (finish_qualified_id_expr): build_qualified_name
2145 for unbound names in the current class.
2146
2147 2018-06-04 Jason Merrill <jason@redhat.com>
2148
2149 PR c++/61806 - missed SFINAE with partial specialization.
2150 * cp-tree.h (deferring_access_check_sentinel): Add deferring_kind
2151 parameter to constructor.
2152 * pt.c (instantiate_class_template_1): Enable access checking
2153 before call to most_specialized_partial_spec.
2154
2155 PR c++/85765 - SFINAE and non-type default template arg.
2156 * pt.c (type_unification_real): Do full semantic processing if
2157 substituting a partial args list replaces all template parms.
2158
2159 2018-06-03 Jason Merrill <jason@redhat.com>
2160
2161 PR c++/85739 - ICE with pointer to member template parm.
2162 * cvt.c (perform_qualification_conversions): Use cp_fold_convert.
2163
2164 2018-06-02 Jason Merrill <jason@redhat.com>
2165
2166 PR c++/85761 - ICE with ill-formed use of const outer variable.
2167 * expr.c (mark_use): Handle location wrappers.
2168
2169 2018-06-01 Jason Merrill <jason@redhat.com>
2170
2171 PR c++/85764 - bogus 'this' not captured error.
2172 * lambda.c (resolvable_dummy_lambda): Use nonlambda_method_basetype.
2173 (nonlambda_method_basetype): Handle NSDMI.
2174
2175 CWG 1581: When are constexpr member functions defined?
2176 * constexpr.c (instantiate_cx_fn_r, instantiate_constexpr_fns): New.
2177 (cxx_eval_outermost_constant_expr): Call instantiate_constexpr_fns.
2178
2179 PR c++/58281 - explicit instantiation of constexpr
2180 * pt.c (mark_decl_instantiated): Clear DECL_EXTERNAL.
2181
2182 * pt.c (instantiate_decl): Any defaulted function is defined.
2183
2184 2018-05-30 Jonathan Wakely <jwakely@redhat.com>
2185
2186 PR c++/77777
2187 * call.c (resolve_args): Use location of expression, not current input
2188 location.
2189
2190 2018-05-30 Ville Voutilainen <ville.voutilainen@gmail.com>
2191
2192 Do not warn about zero-as-null when NULL is used.
2193 * call.c (conversion_null_warnings): Check for pointer
2194 types converted from zero constants.
2195 (convert_like_real): Add a warning sentinel at the end.
2196 * tree.c (maybe_warn_zero_as_null_pointer_constant): Also
2197 check null_node_p.
2198
2199 2018-05-30 Jason Merrill <jason@redhat.com>
2200
2201 PR c++/85807 - ICE with call in template NSDMI.
2202 * init.c (get_nsdmi): Use push_to/pop_from_top_level.
2203 * tree.c (bot_manip): Don't set_flags_from_callee in a template.
2204
2205 PR c++/85873 - constant initializer_list array not in .rodata.
2206 * tree.c (build_target_expr): Set TREE_READONLY.
2207 * call.c (set_up_extended_ref_temp): Set TREE_READONLY.
2208
2209 * parser.c (cp_parser_check_condition_declarator): Handle
2210 cp_error_declarator.
2211
2212 2018-05-30 Jonathan Wakely <jwakely@redhat.com>
2213
2214 * typeck.c (cxx_sizeof_or_alignof_type): Return size_one_node instead
2215 of using it in dead store.
2216
2217 2018-05-29 Jason Merrill <jason@redhat.com>
2218
2219 PR c++/67445 - returning temporary initializer_list.
2220 PR c++/67711 - assigning from temporary initializer_list.
2221 PR c++/48562 - new initializer_list.
2222 * typeck.c (maybe_warn_about_returning_address_of_local): Also warn
2223 about returning local initializer_list.
2224 * cp-tree.h (AUTO_TEMP_NAME, TEMP_NAME_P): Remove.
2225 * call.c (build_over_call): Warn about assignment from temporary
2226 init_list.
2227 * init.c (build_new_1): Warn about 'new std::initializer_list'.
2228 (find_list_begin, maybe_warn_list_ctor): New.
2229 (perform_member_init): Use maybe_warn_list_ctor.
2230
2231 2018-05-29 Marek Polacek <polacek@redhat.com>
2232
2233 PR c++/85883
2234 * init.c (build_new): Handle deducing a class with new
2235 with more than one argument.
2236
2237 2018-05-29 Jakub Jelinek <jakub@redhat.com>
2238
2239 PR c++/85952
2240 * init.c (build_aggr_init): For structured binding initialized from
2241 array call mark_rvalue_use on the initializer.
2242
2243 2018-05-28 Bernd Edlinger <bernd.edlinger@hotmail.de>
2244
2245 * decl2.c (start_static_storage_duration_function): Use
2246 splay_tree_delete_pointers.
2247
2248 2018-05-25 Jason Merrill <jason@redhat.com>
2249
2250 PR c++/85815 - reference to member of enclosing template.
2251 * search.c (lookup_base): Use currently_open_class.
2252 (lookup_member): Use it regardless of -fconcepts.
2253 * parser.c (cp_parser_postfix_dot_deref_expression): Check it.
2254
2255 CWG 616, 1213 - value category of subobject references.
2256 * tree.c (lvalue_kind): Fix handling of ARRAY_REF of pointer.
2257
2258 2018-05-24 Jason Merrill <jason@redhat.com>
2259
2260 PR c++/85842 - -Wreturn-type, constexpr if and generic lambda.
2261 * pt.c (tsubst_lambda_expr): Copy current_function_returns_* to
2262 generic lambda.
2263
2264 2018-05-24 Ville Voutilainen <ville.voutilainen@gmail.com>
2265
2266 Pedwarn on a non-standard position of a C++ attribute.
2267 * parser.c (cp_parser_namespace_definition): Pedwarn about attributes
2268 after the namespace name.
2269
2270 2018-05-24 Paolo Carlini <paolo.carlini@oracle.com>
2271
2272 * cp-tree.h (INDIRECT_TYPE_P): New.
2273 * call.c (build_trivial_dtor_call, maybe_warn_class_memaccess,
2274 joust): Use it instead of POINTER_TYPE_P.
2275 * class.c (update_vtable_entry_for_fn, find_flexarrays,
2276 * fixed_type_or_null, resolves_to_fixed_type_p): Likewise.
2277 * constexpr.c (cxx_eval_binary_expression, cxx_fold_indirect_ref,
2278 * cxx_eval_increment_expression, potential_constant_expression_1):
2279 Likewise.
2280 * cp-gimplify.c (cp_gimplify_expr, cp_genericize_r): Likewise.
2281 * cp-objcp-common.c (cxx_get_alias_set): Likewise.
2282 * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call,
2283 cp_ubsan_maybe_instrument_downcast): Likewise.
2284 * cvt.c (cp_convert_to_pointer, ocp_convert,
2285 cp_get_fndecl_from_callee, maybe_warn_nodiscard, convert): Likewise.
2286 * cxx-pretty-print.c (cxx_pretty_printer::abstract_declarator,
2287 pp_cxx_offsetof_expression_1): Likewise.
2288 * decl.c (grokparms, static_fn_type): Likewise.
2289 * decl2.c (grokbitfield): Likewise.
2290 * error.c (dump_expr): Likewise.
2291 * except.c (initialize_handler_parm, check_noexcept_r): Likewise.
2292 * init.c (warn_placement_new_too_small): Likewise.
2293 * lambda.c (build_capture_proxy, add_capture): Likewise.
2294 * parser.c (cp_parser_omp_for_loop): Likewise.
2295 * pt.c (convert_nontype_argument, fn_type_unification,
2296 uses_deducible_template_parms, check_cv_quals_for_unify,
2297 dependent_type_p_r): Likewise.
2298 * search.c (check_final_overrider): Likewise.
2299 * semantics.c (handle_omp_array_sections, finish_omp_clauses,
2300 finish_omp_for): Likewise.
2301 * tree.c (cp_build_qualified_type_real): Likewise.
2302 * typeck.c (build_class_member_access_expr,
2303 finish_class_member_access_expr, build_x_indirect_ref,
2304 cp_build_indirect_ref_1, cp_build_binary_op, build_const_cast_1):
2305 Likewise.
2306
2307 2018-05-24 Jason Merrill <jason@redhat.com>
2308
2309 PR c++/85864 - literal template and default template arg.
2310 * pt.c (instantiation_dependent_r): Handle NONTYPE_ARGUMENT_PACK.
2311
2312 2018-05-24 Marek Polacek <polacek@redhat.com>
2313
2314 PR c++/85847
2315 * init.c (build_new_1): Use fold_non_dependent_expr. Use a dedicated
2316 variable for its result. Fix a condition.
2317 (build_new): Use fold_non_dependent_expr. Tweak a condition.
2318
2319 2018-05-23 Jason Merrill <jason@redhat.com>
2320
2321 Fix cast to rvalue reference from prvalue.
2322 * cvt.c (diagnose_ref_binding): Handle rvalue reference.
2323 * rtti.c (build_dynamic_cast_1): Don't try to build a reference to
2324 non-class type. Handle xvalue argument.
2325 * typeck.c (build_reinterpret_cast_1): Allow cast from prvalue to
2326 rvalue reference.
2327 * semantics.c (finish_compound_literal): Do direct-initialization,
2328 not cast, to initialize a reference.
2329
2330 CWG 616, 1213 - value category of subobject references.
2331 * tree.c (lvalue_kind): A reference to a subobject of a prvalue is
2332 an xvalue.
2333 * typeck2.c (build_m_component_ref): Likewise.
2334 * typeck.c (cp_build_addr_expr_1, lvalue_or_else): Remove diagnostic
2335 distinction between temporary and xvalue.
2336
2337 2018-05-23 Marek Polacek <polacek@redhat.com>
2338
2339 Implement P0614R1, Range-based for statements with initializer.
2340 * parser.c (cp_parser_range_based_for_with_init_p): New.
2341 (cp_parser_init_statement): Use it. Parse the optional init-statement
2342 for a range-based for loop.
2343 (cp_parser_skip_to_closing_parenthesis_1): Handle balancing ?:.
2344
2345 2018-05-22 Jason Merrill <jason@redhat.com>
2346
2347 PR c++/81420 - not extending temporary lifetime.
2348 * call.c (extend_ref_init_temps_1): Handle ARRAY_REF.
2349 * class.c (build_base_path): Avoid redundant move of an rvalue.
2350
2351 PR c++/85866 - error with .* in default template arg.
2352 * pt.c (tsubst_copy_and_build): Handle partial instantiation.
2353
2354 2018-05-21 Paolo Carlini <paolo.carlini@oracle.com>
2355
2356 * parser.c (cp_parser_parameter_declaration_list): Remove
2357 bool* parameter.
2358 (cp_parser_parameter_declaration_clause): Adjust.
2359 (cp_parser_cache_defarg): Likewise.
2360
2361 2018-05-21 Paolo Carlini <paolo.carlini@oracle.com>
2362
2363 PR c++/84588
2364 * parser.c (cp_parser_maybe_commit_to_declaration,
2365 cp_parser_check_condition_declarator): New.
2366 (cp_parser_simple_declaration): Use the first above.
2367 (cp_parser_condition): Use both the above; enforce
2368 [stmt.stmt]/2 about the declarator not specifying
2369 a function or an array; improve error-recovery.
2370
2371 2018-05-20 Jason Merrill <jason@redhat.com>
2372
2373 PR libstdc++/85843 - warning in logic_error copy constructor.
2374 * class.c (type_has_user_nondefault_constructor): Check for a
2375 user-provided ctor, not user-declared.
2376
2377 2018-05-19 Jason Merrill <jason@redhat.com>
2378
2379 * pt.c (tsubst_pack_expansion): Sorry rather than abort
2380 on __integer_pack as subexpression of pattern.
2381
2382 2018-05-18 Jason Merrill <jason@redhat.com>
2383
2384 PR c++/58407 - deprecated implicit copy ops.
2385 * call.c (build_over_call): Warn about deprecated trivial fns.
2386 * class.c (classtype_has_user_copy_or_dtor): New.
2387 (type_build_ctor_call): Check TREE_DEPRECATED.
2388 (type_build_dtor_call): Likewise.
2389 * decl2.c (cp_warn_deprecated_use): Move from tree.c.
2390 Add checks. Return bool. Handle -Wdeprecated-copy.
2391 (mark_used): Use it.
2392 * decl.c (grokdeclarator): Remove redundant checks.
2393 * typeck2.c (build_functional_cast): Likewise.
2394 * method.c (lazily_declare_fn): Mark deprecated copy ops.
2395 * init.c (build_aggr_init): Only set TREE_USED if there are
2396 side-effects.
2397
2398 2018-05-18 Cesar Philippidis <cesar@codesourcery.com>
2399
2400 PR c++/85782
2401 * cp-gimplify.c (cp_genericize_r): Call genericize_omp_for_stmt for
2402 OACC_LOOPs.
2403
2404 2018-05-18 Richard Sandiford <richard.sandiford@linaro.org>
2405
2406 * constexpr.c (cxx_eval_constant_expression): Remove FMA_EXPR handling.
2407 (potential_constant_expression_1): Likewise.
2408
2409 2018-05-16 Marek Polacek <polacek@redhat.com>
2410
2411 PR c++/85363
2412 * call.c (set_flags_from_callee): Handle AGGR_INIT_EXPRs too.
2413 * tree.c (bot_manip): Call set_flags_from_callee for
2414 AGGR_INIT_EXPRs too.
2415
2416 2018-05-15 Jason Merrill <jason@redhat.com>
2417
2418 * cp-tree.h (cp_expr): Remove copy constructor.
2419 * mangle.c (struct releasing_vec): Declare copy constructor.
2420
2421 * constexpr.c (cxx_eval_vec_init_1): Pass tf_none if ctx->quiet.
2422
2423 PR c++/64372 - CWG 1560, gratuitous lvalue-rvalue conversion in ?:
2424 * call.c (build_conditional_expr_1): Don't force_rvalue when one arm
2425 is a throw-expression.
2426
2427 2018-05-15 Paolo Carlini <paolo.carlini@oracle.com>
2428
2429 * cp-tree.h (DECL_MAYBE_IN_CHARGE_CDTOR_P): New.
2430 (FOR_EACH_CLONE): Update.
2431 * decl.c (grokdeclarator): Use it.
2432 * decl2.c (vague_linkage_p): Likewise.
2433 * mangle.c (mangle_decl): Likewise.
2434 * method.c (lazily_declare_fn): Likewise.
2435 * optimize.c (can_alias_cdtor, maybe_clone_body): Likewise.
2436 * repo.c (repo_emit_p): Likewise.
2437 * tree.c (decl_linkage): Likewise.
2438
2439 2018-05-14 Jason Merrill <jason@redhat.com>
2440
2441 Handle TYPE_HAS_LATE_RETURN_TYPE like ref-qualifier and eh spec.
2442 * tree.c (build_cp_fntype_variant): New.
2443 (build_ref_qualified_type, build_exception_variant)
2444 (strip_typedefs, cxx_copy_lang_qualifiers): Use it.
2445 (cxx_type_hash_eq, cp_check_qualified_type): Check
2446 TYPE_HAS_LATE_RETURN_TYPE.
2447 (cp_build_type_attribute_variant): Check cxx_type_hash_eq.
2448 (cp_build_qualified_type_real): No need to preserve C++ qualifiers.
2449 * class.c (build_clone): Use cxx_copy_lang_qualifiers.
2450 (adjust_clone_args): Likewise.
2451 * decl.c (grokfndecl): Add late_return_type_p parameter. Use
2452 build_cp_fntype_variant.
2453 (grokdeclarator): Pass late_return_type_p to grokfndecl.
2454 (check_function_type): Use cxx_copy_lang_qualifiers.
2455 (static_fn_type): Use cxx_copy_lang_qualifiers.
2456 * decl2.c (build_memfn_type, maybe_retrofit_in_chrg)
2457 (cp_reconstruct_complex_type, coerce_new_type, coerce_delete_type)
2458 (change_return_type): Use cxx_copy_lang_qualifiers.
2459 * mangle.c (write_type): Use cxx_copy_lang_qualifiers.
2460 * parser.c (cp_parser_lambda_declarator_opt): Represent an explicit
2461 return type on the declarator like a normal trailing return type.
2462 * pt.c (tsubst_function_type): Use build_cp_fntype_variant.
2463 (copy_default_args_to_explicit_spec): Use cxx_copy_lang_qualifiers.
2464 * typeck.c (merge_types): Use build_cp_fntype_variant.
2465
2466 2018-05-14 Paolo Carlini <paolo.carlini@oracle.com>
2467
2468 * cp-tree.h (TYPE_REF_P): New.
2469 (TYPE_OBJ_P, TYPE_REF_OBJ_P, TYPE_REFFN_P): Update.
2470 * call.c (build_list_conv, build_aggr_conv, standard_conversion,
2471 direct_reference_binding, reference_binding, implicit_conversion,
2472 add_builtin_candidate, build_user_type_conversion_1, build_op_call_1,
2473 build_new_op_1, build_x_va_arg, conv_binds_ref_to_prvalue,
2474 build_over_call, perform_implicit_conversion_flags,
2475 extend_ref_init_temps, type_has_extended_temps): Use it.
2476 * class.c (one_inheriting_sig, check_field_decls,
2477 check_bases_and_members, find_flexarrays, finish_struct,
2478 fixed_type_or_null): Likewise.
2479 * constexpr.c (literal_type_p, cxx_bind_parameters_in_call,
2480 non_const_var_error, cxx_eval_constant_expression,
2481 potential_constant_expression_1): Likewise.
2482 * cp-gimplify.c (omp_var_to_track, omp_cxx_notice_variable,
2483 cp_genericize_r, cxx_omp_privatize_by_reference,
2484 cxx_omp_const_qual_no_mutable, cxx_omp_finish_clause,
2485 cp_fold_maybe_rvalue): Likewise.
2486 * cp-ubsan.c (cp_ubsan_maybe_instrument_downcast): Likewise.
2487 * cvt.c (build_up_reference, convert_to_reference,
2488 convert_from_reference, convert_to_void, noexcept_conv_p,
2489 fnptr_conv_p): Likewise.
2490 * decl.c (poplevel, check_for_uninitialized_const_var,
2491 check_initializer, initialize_local_var, cp_finish_decl,
2492 get_tuple_decomp_init, cp_finish_decomp, grokdeclarator, copy_fn_p,
2493 move_signature_fn_p, grok_op_properties, finish_function): Likewise.
2494 * decl2.c (grok_array_decl, cp_reconstruct_complex_type,
2495 decl_maybe_constant_var_p): Likewise.
2496 * error.c (dump_type_prefix, dump_expr): Likewise.
2497 * except.c (initialize_handler_parm, complete_ptr_ref_or_void_ptr_p,
2498 is_admissible_throw_operand_or_catch_parameter): Likewise.
2499 * expr.c (mark_use): Likewise.
2500 * init.c (build_zero_init_1, build_value_init_noctor,
2501 perform_member_init, diagnose_uninitialized_cst_or_ref_member_1,
2502 build_new, build_delete): Likewise.
2503 * lambda.c (build_lambda_object): Likewise.
2504 * mangle.c (write_expression, write_template_arg): Likewise.
2505 * method.c (forward_parm, do_build_copy_constructor,
2506 do_build_copy_assign, build_stub_object, constructible_expr,
2507 walk_field_subobs): Likewise.
2508 * parser.c (cp_parser_omp_for_loop_init,
2509 cp_parser_omp_declare_reduction_exprs,
2510 cp_parser_omp_declare_reduction): Likewise.
2511 * pt.c (convert_nontype_argument_function, convert_nontype_argument,
2512 convert_template_argument, tsubst_pack_expansion,
2513 tsubst_function_decl, tsubst_decl, tsubst, tsubst_copy_and_build,
2514 maybe_adjust_types_for_deduction, check_cv_quals_for_unify, unify,
2515 more_specialized_fn, invalid_nontype_parm_type_p, dependent_type_p_r,
2516 value_dependent_expression_p, build_deduction_guide): Likewise.
2517 * semantics.c (finish_handler_parms, finish_non_static_data_member,
2518 finish_compound_literal, omp_privatize_field,
2519 handle_omp_array_sections_1, handle_omp_array_sections,
2520 cp_check_omp_declare_reduction, finish_omp_reduction_clause,
2521 finish_omp_declare_simd_methods, cp_finish_omp_clause_depend_sink,
2522 finish_omp_clauses, finish_decltype_type, capture_decltype,
2523 finish_builtin_launder): Likewise.
2524 * tree.c (lvalue_kind, cp_build_reference_type, move,
2525 cp_build_qualified_type_real, stabilize_expr, stabilize_init): Likewise.
2526 * typeck.c (cxx_safe_arg_type_equiv_p, build_class_member_access_expr,
2527 cp_build_indirect_ref_1, convert_arguments, warn_for_null_address,
2528 cp_build_addr_expr_1, maybe_warn_about_useless_cast,
2529 build_static_cast_1, build_static_cast, build_reinterpret_cast_1,
2530 build_const_cast_1, cp_build_c_cast, cp_build_modify_expr,
2531 convert_for_initialization,
2532 maybe_warn_about_returning_address_of_local, check_return_expr,
2533 cp_type_quals, casts_away_constness, non_reference): Likewise.
2534 * typeck2.c (cxx_readonly_error, store_init_value,
2535 process_init_constructor_record, build_x_arrow, build_functional_cast,
2536 add_exception_specifier): Likewise.
2537
2538 2018-05-14 Jason Merrill <jason@redhat.com>
2539
2540 * pt.c (tsubst) [ARRAY_TYPE]: Check valid_array_size_p.
2541 (tsubst_copy_and_build) [NEW_EXPR]: Clear in_decl.
2542
2543 2018-05-11 Jakub Jelinek <jakub@redhat.com>
2544
2545 PR c/85696
2546 * cp-tree.h (cxx_omp_predetermined_sharing_1): New prototype.
2547 * cp-gimplify.c (cxx_omp_predetermined_sharing): New wrapper around
2548 cxx_omp_predetermined_sharing_1. Rename old function to ...
2549 (cxx_omp_predetermined_sharing_1): ... this.
2550 * semantics.c (finish_omp_clauses): Use cxx_omp_predetermined_sharing_1
2551 instead of cxx_omp_predetermined_sharing.
2552
2553 2018-05-10 Jason Merrill <jason@redhat.com>
2554
2555 * decl.c (cp_finish_decl): Don't instantiate auto variable.
2556 (check_static_variable_definition): Allow auto.
2557 * constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
2558
2559 * cp-tree.h (DECL_CONSTRUCTOR_P): Use DECL_CXX_CONSTRUCTOR_P.
2560 (DECL_DESTRUCTOR_P): Use DECL_CXX_DESTRUCTOR_P.
2561
2562 Core issue 2310 - conversion to base of incomplete type.
2563 * class.c (build_base_path): Check COMPLETE_TYPE_P for source type.
2564
2565 CWG 2267 - list-initialization of reference temporary
2566 * call.c (reference_binding): List-initializing a reference
2567 temporary is copy-list-initialization.
2568
2569 * parser.c (cp_parser_class_head): Use num_template_headers_for_class.
2570
2571 * pt.c (instantiate_decl): Make sure we aren't trying to do a nested
2572 instantiation in template context.
2573
2574 * class.c (vbase_has_user_provided_move_assign): Use
2575 user_provided_p.
2576
2577 * lambda.c (lambda_expr_this_capture): Improve logic.
2578
2579 * decl.c (make_typename_type): s/parameters/arguments/.
2580 * parser.c (cp_parser_nested_name_specifier_opt): Likewise.
2581 * pt.c (make_pack_expansion): Correct error message.
2582
2583 2018-05-10 Jakub Jelinek <jakub@redhat.com>
2584
2585 PR c++/85662
2586 * cp-gimplify.c (cp_fold): Use fold_offsetof rather than
2587 fold_offsetof_1, pass TREE_TYPE (x) as TYPE to it and drop the
2588 fold_convert.
2589
2590 2018-05-10 Eric Botcazou <ebotcazou@adacore.com>
2591
2592 PR c++/85400
2593 * decl2.c (adjust_var_decl_tls_model): New static function.
2594 (comdat_linkage): Call it on a variable.
2595 (maybe_make_one_only): Likewise.
2596
2597 2018-05-09 Paolo Carlini <paolo.carlini@oracle.com>
2598
2599 PR c++/85713
2600 Revert:
2601 2018-05-08 Paolo Carlini <paolo.carlini@oracle.com>
2602
2603 PR c++/84588
2604 * parser.c (cp_parser_parameter_declaration_list): When the
2605 entire parameter-declaration-list is erroneous maybe call
2606 abort_fully_implicit_template.
2607
2608 2018-05-08 Jason Merrill <jason@redhat.com>
2609
2610 PR c++/85706 - class deduction under decltype
2611 * pt.c (for_each_template_parm_r): Handle DECLTYPE_TYPE. Clear
2612 *walk_subtrees whether or not we walked into the operand.
2613 (type_uses_auto): Only look at deduced contexts.
2614
2615 2018-05-08 Paolo Carlini <paolo.carlini@oracle.com>
2616
2617 PR c++/84588
2618 * parser.c (cp_parser_parameter_declaration_list): When the
2619 entire parameter-declaration-list is erroneous maybe call
2620 abort_fully_implicit_template.
2621
2622 2018-05-08 Marek Polacek <polacek@redhat.com>
2623
2624 PR c++/85695
2625 * semantics.c (finish_if_stmt_cond): See through typedefs.
2626
2627 2018-05-07 Jason Merrill <jason@redhat.com>
2628
2629 PR c++/85646 - lambda visibility.
2630 * decl2.c (determine_visibility): Don't mess with template arguments
2631 from the containing scope.
2632 (vague_linkage_p): Check DECL_ABSTRACT_P before looking at a 'tor
2633 thunk.
2634
2635 2018-05-07 Nathan Sidwell <nathan@acm.org>
2636
2637 Remove fno-for-scope
2638 * cp-tree.h (DECL_ERROR_REPORTED, DECL_DEAD_FOR_LOCAL)
2639 (DECL_HAS_SHADOWED_FOR_VAR_P, DECL_SHADOWED_FOR_VAR)
2640 (SET_DECL_SHADOWED_FOR_VAR): Delete.
2641 (decl_shadowed_for_var_lookup, decl_shadowed_for_var_insert)
2642 (check_for_out_of_scope_variable, init_shadowed_var_for_decl):
2643 Don't declare.
2644 * name-lookup.h (struct cp_binding_level): Remove
2645 dead_vars_from_for field.
2646 * cp-lang.c (cp_init_ts): Delete.
2647 (LANG_HOOKS_INIT_TS): Override to cp_common_init_ts.
2648 * cp-objcp-common.c (shadowed_var_for_decl): Delete.
2649 (decl_shadowed_for_var_lookup, decl_shadowed_for_var_insert)
2650 (init_shadowed_var_for_decl): Delete.
2651 * decl.c (poplevel): Remove shadowed for var handling.
2652 (cxx_init_decl_processing): Remove -ffor-scope deprecation.
2653 * name-lookup.c (find_local_binding): Remove shadowed for var
2654 handling.
2655 (check_local_shadow): Likewise.
2656 (check_for_out_of_scope_variable): Delete.
2657 * parser.c (cp_parser_primary_expression): Remove shadowed for var
2658 handling.
2659 * pt.c (tsubst_decl): Remove DECL_DEAD_FOR_LOCAL setting.
2660 * semantics.c (begin_for_scope): Always have a scope.
2661 (begin_for_stmt, finish_for_stmt): Remove ARM-for scope handling.
2662 (begin_range_for_stmt, finish_id_expression): Likewise.
2663
2664 2018-05-07 Jason Merrill <jason@redhat.com>
2665
2666 PR c++/85618 - ICE with initialized VLA.
2667 * tree.c (vla_type_p): New.
2668 * typeck2.c (store_init_value, split_nonconstant_init_1): Check it
2669 rather than array_of_runtime_bound_p.
2670
2671 2018-05-05 Paolo Carlini <paolo.carlini@oracle.com>
2672
2673 * cvt.c (ocp_convert): Early handle the special case of a
2674 null_ptr_cst_p expr converted to a NULLPTR_TYPE_P type.
2675
2676 2018-05-03 Jason Merrill <jason@redhat.com>
2677
2678 PR c++/85600 - virtual delete failure.
2679 * init.c (build_delete): Always save_expr when deleting.
2680
2681 2018-05-03 Nathan Sidwell <nathan@acm.org>
2682
2683 * decl.c (cxx_init_decl_processing): Remove flag_friend_injection.
2684 * name-lookup.c (do_pushdecl): Likewise.
2685
2686 2018-05-02 Paolo Carlini <paolo.carlini@oracle.com>
2687 Jason Merrill <jason@redhat.com>
2688
2689 PR c++/68374
2690 * name-lookup.c (check_local_shadow): Don't handle static old
2691 declarations in the block handling locals shadowing locals.
2692
2693 2018-05-01 Jason Merrill <jason@redhat.com>
2694
2695 PR c++/85587 - error with scoped enum in template.
2696 * semantics.c (finish_qualified_id_expr): Don't return an
2697 unqualified IDENTIFIER_NODE.
2698
2699 2018-04-30 Jason Merrill <jason@redhat.com>
2700
2701 PR c++/85580 - extern "C" and local variables
2702 * name-lookup.c (check_extern_c_conflict): Ignore local decls.
2703
2704 PR c++/84701 - unsigned typeof.
2705 * decl.c (grokdeclarator): Overhaul diagnostics for invalid use
2706 of long/short/signed/unsigned.
2707
2708 PR c++/85305 - pack in lambda init-capture.
2709 * parser.c (cp_parser_initializer): Add subexpression_p parm; don't
2710 check_for_bare_parameter_packs in a subexpression.
2711 (cp_parser_lambda_introducer): Use it.
2712
2713 PR c++/61982 - dead stores to destroyed objects.
2714 * call.c (build_trivial_dtor_call): New, assigns a clobber.
2715 (build_over_call, build_special_member_call): Use it.
2716 * cp-tree.h: Declare it.
2717 * init.c (build_delete): Remove trivial path.
2718
2719 * init.c (build_dtor_call): Use build_special_member_call.
2720 (build_delete): Remove redundant uses of save_addr.
2721
2722 * decl.c (build_clobber_this): Use build_clobber.
2723
2724 2018-04-27 Jakub Jelinek <jakub@redhat.com>
2725
2726 PR c++/85553
2727 * init.c (build_zero_init_1): For zero initialization of
2728 NULLPTR_TYPE_P type use build_int_cst directly.
2729
2730 2018-04-27 David Malcolm <dmalcolm@redhat.com>
2731
2732 PR c++/85515
2733 * name-lookup.c (consider_binding_level): Skip compiler-generated
2734 variables.
2735 * search.c (lookup_field_fuzzy_info::fuzzy_lookup_field): Flatten
2736 nested if statements into a series of rejection tests. Reject
2737 lambda-ignored entities as suggestions.
2738
2739 2018-04-27 Jason Merrill <jason@redhat.com>
2740
2741 * cvt.c (cp_fold_convert): Use convert_ptrmem.
2742 * typeck.c (convert_ptrmem): Add a NOP even if no adjustment.
2743
2744 2018-04-27 Paolo Carlini <paolo.carlini@oracle.com>
2745
2746 PR c++/84691
2747 * decl.c (grokdeclarator): Clear friendp upon definition in local
2748 class definition error.
2749
2750 2018-04-27 Jason Merrill <jason@redhat.com>
2751
2752 PR c++/85545 - ICE with noexcept PMF conversion.
2753 * cvt.c (cp_fold_convert): Pass PMF CONSTRUCTORs to
2754 build_ptrmemfunc.
2755 * typeck.c (build_ptrmemfunc): Don't build a NOP_EXPR for zero
2756 adjustment.
2757 (build_ptrmemfunc_access_expr): Special-case CONSTRUCTORs.
2758
2759 2018-04-27 Nathan Sidwell <nathan@acm.org>
2760
2761 * typeck.c (convert_ptrmem): Move local var decls to initialization.
2762
2763 * cp-tree.h (TEMPLATE_INFO): Fix comments.
2764 (TI_PENDING_TEMPLATE_FLAG): Check TEMPLATE_INFO.
2765 (NON_DEFAULT_TEMPLATE_ARG_COUNT): Wrap line.
2766 (dump, print_other_binding_stacks): Remove declarations.
2767 * name-lookup.c (print_other_binding_stack): Make static.
2768 * pt.c (build_template_decl): Make static.
2769
2770 2018-04-26 Jason Merrill <jason@redhat.com>
2771
2772 PR c++/85545 - ICE with noexcept PMF conversion.
2773 * cvt.c (cp_fold_convert): Handle PMF CONSTRUCTORs directly.
2774
2775 2018-04-25 Nathan Sidwell <nathan@acm.org>
2776
2777 PR c++/85437
2778 PR c++/49171
2779 * cp-tree.h (REINTERPRET_CAST_P): New.
2780 * constexpr.c (cxx_eval_constant_expression) <case NOP_EXPR>:
2781 Reject REINTERPET_CAST_P conversions. Use cplus_expand_constant
2782 for non-trivial PTRMEM_CST cases.
2783 * typeck.c (build_nop_reinterpret): New.
2784 (build_reinterpret_cast_1): Use it. Set REINTERPRET_CAST_P on
2785 NOP_EXPRs returned by cp_convert.
2786
2787 2018-04-23 Jason Merrill <jason@redhat.com>
2788
2789 PR c++/69560 - wrong alignof(double) on x86.
2790 CWG 1879 - Inadequate definition of alignment requirement.
2791 * cp-tree.h (ALIGNOF_EXPR_STD_P): New.
2792 * typeck.c (cxx_sizeof_or_alignof_type): Add std_alignof parm.
2793 (cxx_sizeof_expr, cxx_sizeof_nowarn, cxx_alignas_expr)
2794 (cxx_alignof_expr): Pass it.
2795 * parser.c (cp_parser_unary_expression): Pass it.
2796 * pt.c (tsubst_copy): Copy it.
2797 (tsubst_copy_and_build): Pass it.
2798 * decl.c (fold_sizeof_expr): Pass it.
2799
2800 2018-04-23 Jakub Jelinek <jakub@redhat.com>
2801 Jason Merrill <jason@redhat.com>
2802
2803 PR c++/85470 - wrong error with static data member.
2804 * decl.c (check_initializer): Check DECL_INITIALIZED_IN_CLASS_P.
2805 * typeck2.c (store_init_value): Likewise.
2806
2807 2018-04-20 Jakub Jelinek <jakub@redhat.com>
2808
2809 PR c++/85462
2810 * cp-tree.h (tinst_level): Remove in_system_header_p member,
2811 change refcount member from unsigned char to unsigned short,
2812 add refcount_infinity static data member, adjust comments.
2813 * pt.c (tinst_level::refcount_infinity): Define.
2814 (inc_refcount_use): Remove assert, don't increment if refcount
2815 is already refcount_infinity, adjust comment.
2816 (dec_refcount_use): Remove assert, don't decrement if refcount
2817 is refcount_infinity, adjust comment.
2818 (push_tinst_level_loc): Formatting fix.
2819
2820 2018-04-19 Paolo Carlini <paolo.carlini@oracle.com>
2821
2822 PR c++/84611
2823 * pt.c (lookup_template_class_1): Check pushtag return value for
2824 error_mark_node.
2825
2826 2018-04-19 Alexandre Oliva <aoliva@redhat.com>
2827
2828 PR c++/80290
2829 * cp-tree.h (tinst_level::free): Fix whitespace.
2830
2831 2018-04-18 Paolo Carlini <paolo.carlini@oracle.com>
2832
2833 PR c++/84630
2834 * pt.c (tsubst_lambda_expr): Check begin_lambda_type return value
2835 for error_mark_node.
2836
2837 2018-04-18 Jakub Jelinek <jakub@redhat.com>
2838
2839 PR c++/84463
2840 * typeck.c (cp_build_addr_expr_1): Move handling of offsetof-like
2841 tricks from here to ...
2842 * cp-gimplify.c (cp_fold) <case ADDR_EXPR>: ... here. Only use it
2843 if INDIRECT_REF's operand is INTEGER_CST cast to pointer type.
2844
2845 2018-04-18 Alexandre Oliva <aoliva@redhat.com>
2846
2847 PR c++/80290
2848 * cp-tree.h (struct tinst_level): Split decl into tldcl and
2849 targs. Add private split_list_p, tree_list_p, and not_list_p
2850 inline const predicates; to_list private member function
2851 declaration; free public member function declaration; list_p,
2852 get_node and maybe_get_node accessors, and refcount data
2853 member. Narrow errors to unsigned short.
2854 * error.c (print_instantiation_full_context): Use new
2855 accessors.
2856 (print_instantiation_partial_context_line): Likewise. Drop
2857 const from tinst_level-typed parameter.
2858 * mangle.c (mangle_decl_string): Likewise.
2859 * pt.c (freelist): New template class.
2860 (tree_list_freelist_head): New var.
2861 (tree_list_freelist): New fn, along with specializations.
2862 (tinst_level_freelist_head): New var.
2863 (pending_template_freelist_head): Likewise.
2864 (tinst_level_freelist, pending_template_freelist): New fns.
2865 (tinst_level::to_list, tinst_level::free): Define.
2866 (inc_refcount_use, dec_refcount_use): New fns for tinst_level.
2867 (set_refcount_ptr): New template fn.
2868 (add_pending_template): Adjust for refcounting, freelists and
2869 new accessors.
2870 (neglectable_inst_p): Take a NULL d as a non-DECL.
2871 (limit_bad_template_recursion): Use new accessors.
2872 (push_tinst_level): New overload to create the list.
2873 (push_tinst_level_loc): Make it static, split decl into two
2874 args, adjust tests and initialization to cope with split
2875 lists, use freelist, adjust for refcounting.
2876 (push_tinst_level_loc): New wrapper with the old interface.
2877 (pop_tinst_level): Adjust for refcounting.
2878 (record_last_problematic_instantiation): Likewise.
2879 (reopen_tinst_level): Likewise. Use new accessors.
2880 (instantiate_alias_template): Adjust for split list.
2881 (fn_type_unification): Likewise.
2882 (get_partial_spec_bindings): Likewise.
2883 (instantiate_pending_templates): Use new accessors. Adjust
2884 for refcount. Release pending_template to freelist.
2885 (instantiating_current_function_p): Use new accessors.
2886
2887 2018-04-16 Alexandre Oliva <aoliva@redhat.com>
2888
2889 PR c++/85039
2890 * parser.c (cp_parser_builtin_offset): Reject type definitions.
2891 * mangle.c (nested_anon_class_index): Avoid crash returning -1
2892 if we've seen errors.
2893
2894 2018-04-12 David Malcolm <dmalcolm@redhat.com>
2895
2896 PR c++/85385
2897 * name-lookup.c (macro_use_before_def::maybe_make): New function,
2898 checking that the use is indeed before the definition.
2899 (macro_use_before_def::macro_use_before_def): Make private.
2900 (macro_use_before_def::~macro_use_before_def): Make private. Move
2901 check for UNKNOWN_LOCATION to macro_use_before_def::maybe_make.
2902 (lookup_name_fuzzy): Call macro_use_before_def::maybe_make rather
2903 than using new directly.
2904
2905 2018-04-12 Jason Merrill <jason@redhat.com>
2906
2907 PR c++/85356 - ICE with pointer to member function.
2908 * pt.c (maybe_instantiate_noexcept): Do instantiate in templates if
2909 flag_noexcept_type. Build the new spec within the function context.
2910 * except.c (build_noexcept_spec): Do get constant value in templates
2911 if flag_noexcept_type.
2912 * decl.c (check_redeclaration_exception_specification): Don't
2913 instantiate noexcept on a dependent declaration.
2914
2915 2018-04-12 Marek Polacek <polacek@redhat.com>
2916
2917 PR c++/85258
2918 * constexpr.c (reduced_constant_expression_p): Return false for null
2919 trees.
2920
2921 2018-04-11 Marek Polacek <polacek@redhat.com>
2922
2923 PR c++/85032
2924 * constexpr.c (potential_constant_expression_1): Consider conversions
2925 from classes to literal types potentially constant.
2926
2927 2018-04-10 Paolo Carlini <paolo.carlini@oracle.com>
2928
2929 PR c++/70808
2930 * init.c (build_zero_init_1): Handle NULLPTR_TYPE_P being true of
2931 the type like TYPE_PTR_OR_PTRMEM_P.
2932
2933 2018-04-10 Jason Merrill <jason@redhat.com>
2934
2935 PR debug/65821 - wrong location for main().
2936 * call.c (clear_location_r, convert_default_arg): Revert.
2937 * tree.c (break_out_target_exprs): Add clear_location parm.
2938 (struct bot_data): New.
2939 (bot_manip): Clear location if requested.
2940 * init.c (get_nsdmi): Pass clear_location.
2941
2942 2018-04-10 David Malcolm <dmalcolm@redhat.com>
2943
2944 PR c++/85110
2945 * call.c (get_fndecl_argument_location): Make non-static.
2946 * cp-tree.h (get_fndecl_argument_location): New decl.
2947 * typeck.c (convert_for_assignment): When complaining due to
2948 conversions for an argument, show the location of the parameter
2949 within the decl.
2950
2951 2018-04-10 Jakub Jelinek <jakub@redhat.com>
2952
2953 PR c++/85312 - P0962 cleanup
2954 * parser.c (cp_parser_perform_range_for_lookup): Remove unreachable
2955 diagnostics.
2956
2957 2018-04-10 Jason Merrill <jason@redhat.com>
2958
2959 PR debug/65821 - wrong location for main().
2960 * call.c (clear_location_r): New.
2961 (convert_default_arg): Use it.
2962 * tree.c (bot_manip): Remove builtin_LINE/FILE handling.
2963
2964 PR c++/85285 - ICE with flexible array after substitution.
2965 * pt.c (instantiate_class_template_1): Check for flexible array in
2966 union.
2967
2968 2018-04-09 Paolo Carlini <paolo.carlini@oracle.com>
2969
2970 PR c++/85227
2971 * decl.c (cp_finish_decomp): In a template, if the type is incomplete
2972 issue a pedwarn and defer trying to do bindings.
2973
2974 2018-04-09 Jason Merrill <jason@redhat.com>
2975
2976 PR c++/85279 - dump_expr doesn't understand decltype.
2977 * error.c (dump_expr): Handle DECLTYPE_TYPE.
2978
2979 PR c++/85262 - ICE with redundant qualification on constructor.
2980 * call.c (build_new_method_call_1): Move make_args_non_dependent
2981 after A::A() handling.
2982
2983 PR c++/85277 - ICE with invalid offsetof.
2984 * semantics.c (finish_offsetof): Avoid passing non-DECL to %qD.
2985 Adjust -Winvalid-offsetof diagnostic to say conditionally supported.
2986
2987 PR c++/85264 - ICE with excess template-parameter-list.
2988 * parser.c (cp_parser_check_template_parameters): Add template_id_p
2989 parameter. Don't allow an extra template header if true.
2990 (cp_parser_class_head): Pass template_id_p.
2991 (cp_parser_elaborated_type_specifier): Likewise.
2992 (cp_parser_alias_declaration): Likewise.
2993 (cp_parser_check_declarator_template_parameters): Likewise.
2994
2995 2018-04-09 Jakub Jelinek <jakub@redhat.com>
2996
2997 PR c++/85194
2998 * parser.c (cp_parser_simple_declaration): For structured bindings,
2999 if *maybe_range_for_decl is NULL after parsing it, set it to
3000 error_mark_node.
3001
3002 2018-04-09 Jason Merrill <jason@redhat.com>
3003
3004 PR c++/85256 - ICE capturing pointer to VLA.
3005 * lambda.c (add_capture): Distinguish between variable-size and
3006 variably-modified types.
3007
3008 2018-04-06 Jason Merrill <jason@redhat.com>
3009
3010 PR c++/85214 - ICE with alias, generic lambda, constexpr if.
3011 * pt.c (extract_locals_r): Remember local typedefs.
3012
3013 2018-04-06 David Malcolm <dmalcolm@redhat.com>
3014
3015 PR c++/84269
3016 * name-lookup.c (struct std_name_hint): Move out of
3017 get_std_name_hint; add field "min_dialect".
3018 (get_std_name_hint): Add min_dialect values to all initializers.
3019 Add <any>, <atomic>, <bitset>, <condition_variable>, <functional>,
3020 <future>, <istream>, <iterator>, <ostream>, <mutex>, <optional>,
3021 <shared_mutex>, <string_view>, <thread>, and <variant>.
3022 Add fstream, ifstream, and ofstream to <fstream>.
3023 Add istringstream, ostringstream, and stringstream to <sstream>.
3024 Add basic_string to <string>.
3025 Add tuple_element and tuple_size to <tuple>.
3026 Add declval to <utility>.
3027 Fix ordering of <queue> and <tuple>.
3028 Return a std_name_hint, rather than a const char *.
3029 (get_cxx_dialect_name): New function.
3030 (maybe_suggest_missing_std_header): Detect names that aren't yet
3031 available in the current dialect, and instead of suggesting a
3032 missing #include, warn about the dialect.
3033
3034 2018-04-06 Jakub Jelinek <jakub@redhat.com>
3035
3036 PR c++/85210
3037 * pt.c (tsubst_decomp_names): Return error_mark_node and assert
3038 errorcount is set if tsubst doesn't return a VAR_DECL.
3039
3040 2018-04-06 David Malcolm <dmalcolm@redhat.com>
3041
3042 PR c++/85021
3043 * name-lookup.c (using_directives_contain_std_p): New function.
3044 (has_using_namespace_std_directive_p): New function.
3045 (suggest_alternatives_for): Simplify if/else logic using early
3046 returns. If no candidates were found, and there's a
3047 "using namespace std;" directive, call
3048 maybe_suggest_missing_std_header.
3049 (maybe_suggest_missing_header): Split later part of the function
3050 into..
3051 (maybe_suggest_missing_std_header): New.
3052
3053 2018-04-06 Jason Merrill <jason@redhat.com>
3054
3055 PR c++/85242 - ICE with class definition in template parm.
3056 * cp-tree.h (PROCESSING_REAL_TEMPLATE_DECL_P): False if
3057 processing_template_parmlist.
3058
3059 PR c++/85240 - LTO ICE with using of undeduced auto fn.
3060 * cp-gimplify.c (cp_genericize_r): Discard using of undeduced auto.
3061
3062 2018-04-05 Jakub Jelinek <jakub@redhat.com>
3063
3064 PR c++/85209
3065 * pt.c (tsubst_decomp_names): Don't fail or ICE if DECL_CHAIN (decl3)
3066 is not prev, if prev == decl.
3067
3068 PR c++/85208
3069 * decl.c (start_decl): For DECL_DECOMPOSITION_P decls, don't call
3070 maybe_apply_pragma_weak here...
3071 (cp_maybe_mangle_decomp): ... but call it here instead.
3072
3073 2018-04-05 Jason Merrill <jason@redhat.com>
3074
3075 PR c++/85136 - ICE with designated init in template.
3076 * decl.c (maybe_deduce_size_from_array_init): Handle dependent
3077 designated initializer.
3078 (check_array_designated_initializer): Update ce->index with the
3079 constant value.
3080
3081 PR c++/83808 - ICE with VLA initialization.
3082 * typeck2.c (process_init_constructor_array): Don't require a VLA
3083 initializer to have VLA type.
3084
3085 2018-04-05 Paolo Carlini <paolo.carlini@oracle.com>
3086
3087 PR c++/80956
3088 * call.c (convert_like_real): Fail gracefully for a broken
3089 std::initializer_list, missing a definition.
3090
3091 * name-lookup.c (do_pushtag): Tweak message, use %< and %>.
3092
3093 2018-04-05 Paolo Carlini <paolo.carlini@oracle.com>
3094
3095 PR c++/84792
3096 * decl.c (grokdeclarator): Fix diagnostic about typedef name used
3097 as nested-name-specifier, keep type and TREE_TYPE (decl) in sync.
3098
3099 2018-04-05 Jason Merrill <jason@redhat.com>
3100
3101 PR c++/82152 - ICE with class deduction and inherited ctor.
3102 * pt.c (do_class_deduction): Ignore inherited ctors.
3103
3104 PR c++/84665 - ICE with array of empty class.
3105 * decl2.c (cp_check_const_attributes): Use fold_non_dependent_expr.
3106
3107 PR c++/85228 - ICE with lambda in enumerator in template.
3108 * pt.c (bt_instantiate_type_proc): Don't assume
3109 CLASSTYPE_TEMPLATE_INFO is non-null.
3110
3111 2018-04-05 Ville Voutilainen <ville.voutilainen@gmail.com>
3112
3113 Implement P0969
3114 * decl.c (find_decomp_class_base): Check accessibility instead
3115 of declared access, adjust diagnostic.
3116
3117 2018-04-05 Ville Voutilainen <ville.voutilainen@gmail.com>
3118
3119 Implement P0961
3120 * decl.c (get_tuple_decomp_init): Check the templatedness
3121 of a member get.
3122
3123 2018-04-05 Jason Merrill <jason@redhat.com>
3124
3125 PR c++/85200 - ICE with constexpr if in generic lambda.
3126 * pt.c (extract_locals_r): Don't record the local specs of variables
3127 declared within the pattern.
3128
3129 2018-04-05 Alexandre Oliva <aoliva@redhat.com>
3130
3131 PR c++/84979
3132 * pt.c (check_auto_in_tmpl_args): New.
3133 (tsubst_qualified_id): Use it to reject template args
3134 referencing auto for non-type templates.
3135 * parser.c (cp_parser_template_id): Likewise.
3136 * cp-tree.h (check_auto_in_tmpl_args): Declare.
3137 * typeck2.c (build_functional_cast): Report correct location
3138 for invalid use of auto.
3139
3140 2018-04-04 Jason Merrill <jason@redhat.com>
3141
3142 PR c++/85215 - ICE with copy-init from conversion.
3143 * call.c (merge_conversion_sequences): Fix type of direct binding
3144 sequence.
3145
3146 PR c++/84938 - ICE with division by ~-1.
3147 * call.c (set_up_extended_ref_temp): Call cp_fully_fold.
3148
3149 PR c++/84936 - ICE with unexpanded pack in mem-initializer.
3150 * parser.c (cp_parser_mem_initializer_list): Call
3151 check_for_bare_parameter_packs.
3152
3153 2018-04-04 Jakub Jelinek <jakub@redhat.com>
3154
3155 PR inline-asm/85172
3156 * constexpr.c (cxx_eval_builtin_function_call): For calls to
3157 builtin_valid_in_constant_expr_p functions, don't call
3158 cxx_eval_constant_expression if argument is not
3159 potential_constant_expression.
3160
3161 PR c++/85146
3162 * cp-tree.h (calculate_bases, calculate_direct_bases): Add complain
3163 argument.
3164 * semantics.c (calculate_bases): Add complain argument. Use
3165 complete_type_or_maybe_complain instead of just complete_type and
3166 return an empty vector if it fails. Move make_tree_vector () call
3167 after early return. Formatting fixes.
3168 (calculate_direct_bases): Likewise. Call release_tree_vector at the
3169 end.
3170 (dfs_calculate_bases_post, calculate_bases_helper): Formatting fixes.
3171 * pt.c (tsubst_pack_expansion): Adjust calculate_bases and
3172 calculate_direct_bases callers, formatting fixes.
3173
3174 2018-04-04 Jason Merrill <jason@redhat.com>
3175
3176 PR c++/85006 - -fconcepts ICE with A<auto...> return type
3177 * pt.c (tsubst_pack_expansion): Allow unsubstituted auto pack.
3178
3179 PR c++/85200 - ICE with constexpr if in generic lambda.
3180 * tree.c (cp_walk_subtrees): Walk into DECL_EXPR in templates.
3181
3182 PR c++/84221 - bogus -Wunused with attribute and template.
3183 * decl2.c (is_late_template_attribute): Handle unused and used
3184 normally on non-TYPE_DECL.
3185
3186 PR c++/85135 - ICE with omitted template arguments.
3187 * decl.c (grokdeclarator): Catch deduced class type in trailing
3188 return type.
3189
3190 PR c++/85133 - ICE with missing concept initializer.
3191 * decl.c (cp_finish_decl): If a concept initializer is missing, use
3192 true.
3193
3194 PR c++/85118 - wrong error with generic lambda and std::bind.
3195 * call.c (add_template_conv_candidate): Disable if there are any
3196 call operators.
3197
3198 PR c++/85141 - ICE with compound assignment and static member fn.
3199 * typeck.c (cp_build_modify_expr): Call decay_conversion for RHS of
3200 compound assignment.
3201
3202 PR c++/85148 - ICE with 'this' in array NSDMI.
3203 * tree.c (replace_placeholders_r): Use handled_component_p.
3204
3205 2018-04-04 Ville Voutilainen <ville.voutilainen@gmail.com>
3206
3207 PR c++/65923
3208 * decl.c (grokfndecl): Handle standard UDL diagnostics here..
3209 * parser.c (cp_parser_unqualified_id): ..not here.
3210
3211 2018-04-04 Alexandre Oliva <aoliva@redhat.com>
3212
3213 PR c++/84943
3214 * typeck.c (cp_build_addr_expr_1): Mark FUNCTION_DECL as
3215 used.
3216 * decl2.c (mark_used): Return without effects if tf_conv.
3217
3218 2018-04-03 Jason Merrill <jason@redhat.com>
3219
3220 PR c++/85092 - C++17 ICE with unused list constructor.
3221 * call.c (conv_binds_ref_to_prvalue): Also count ck_identity
3222 from a TARGET_EXPR.
3223
3224 PR c++/85113 - ICE with constexpr and __builtin_constant_p.
3225 * constexpr.c (cxx_eval_builtin_function_call): Only defer
3226 __builtin_constant_p if ctx->quiet.
3227
3228 2018-04-03 Paolo Carlini <paolo.carlini@oracle.com>
3229
3230 PR c++/84768
3231 * pt.c (rewrite_template_parm): If the first argument is
3232 error_mark_node return it immediately.
3233 (build_deduction_guide): Check the return value of the
3234 latter for error_mark_node.
3235 (do_class_deduction): Check the return value of the latter.
3236
3237 2018-04-03 Jason Merrill <jason@redhat.com>
3238
3239 * semantics.c (finish_if_stmt_cond): Use
3240 instantiation_dependent_expression_p.
3241
3242 PR c++/85149 - generic lambda and constexpr if.
3243 * pt.c (build_extra_args, add_extra_args): Split from
3244 tsubst_pack_expansion.
3245 (tsubst_expr) [IF_STMT]: Use them.
3246 * cp-tree.h (IF_STMT_EXTRA_ARGS): New.
3247
3248 * typeck.c (merge_types): Limit matching attribute shortcut to
3249 the default case.
3250
3251 2018-04-03 Jakub Jelinek <jakub@redhat.com>
3252
3253 PR c++/85147
3254 * pt.c (fixed_parameter_pack_p_1): Punt if parm is error_mark_node.
3255
3256 PR c++/85140
3257 * name-lookup.c (handle_namespace_attrs): Return early if attributes
3258 is error_mark_node.
3259
3260 PR c++/85134
3261 * decl.c (cp_finish_decl): If ensure_literal_type_for_constexpr_object
3262 fails, after clearing DECL_DECLARED_CONSTEXPR_P don't return early,
3263 instead for static data members clear init and set DECL_EXTERNAL.
3264
3265 2018-04-02 Jason Merrill <jason@redhat.com>
3266
3267 PR c++/64095 - auto... parameter pack.
3268 * parser.c (cp_parser_parameter_declaration): Handle turning autos
3269 into packs here.
3270 (cp_parser_parameter_declaration_list): Not here.
3271
3272 2018-03-31 Alexandre Oliva <aoliva@redhat.com>
3273
3274 PR c++/85027
3275 * class.c (instantiate_type): Peel off SAVE_EXPR before
3276 BASELINK.
3277
3278 2018-03-30 Jason Merrill <jason@redhat.com>
3279
3280 * typeck2.c (process_init_constructor_record): Use
3281 init_list_type_node for the CONSTRUCTOR around an anonymous union
3282 designated initializer.
3283
3284 2018-03-30 Jakub Jelinek <jakub@redhat.com>
3285
3286 PR c++/84791
3287 * semantics.c (finish_omp_reduction_clause): If
3288 OMP_CLAUSE_REDUCTION_PLACEHOLDER is error_mark_node, return true
3289 even if processing_template_decl.
3290
3291 2018-03-29 David Malcolm <dmalcolm@redhat.com>
3292
3293 PR c++/84269
3294 * name-lookup.c (get_std_name_hint): Add names from <memory>,
3295 <tuple>, and <utility>.
3296
3297 2018-03-29 Jason Merrill <jason@redhat.com>
3298
3299 PR c++/85093 - too many template args with pack expansion.
3300 * pt.c (coerce_template_parms): Keep pack expansion args that will
3301 need to be empty.
3302
3303 2018-03-29 Jason Merrill <jason@redhat.com>
3304
3305 * pt.c (build_non_dependent_expr): Propagate expr location.
3306
3307 2018-03-27 Jason Merrill <jason@redhat.com>
3308
3309 PR c++/85060 - wrong-code with call to base member in template.
3310 * search.c (any_dependent_bases_p): Check uses_template_parms
3311 rather than processing_template_decl.
3312
3313 2018-03-29 David Malcolm <dmalcolm@redhat.com>
3314
3315 PR c++/85110
3316 * typeck.c (convert_for_assignment): When complaining due to
3317 conversions for an argument, attempt to use the location of the
3318 argument.
3319
3320 2018-03-28 Paolo Carlini <paolo.carlini@oracle.com>
3321
3322 PR c++/85028
3323 * pt.c (tsubst_default_argument): Early return if the type of the
3324 parameter is erroneous.
3325
3326 2018-03-28 Alexandre Oliva <aoliva@redhat.com>
3327
3328 PR c++/84973
3329 * decl2.c (note_vague_linkage_fn): Don't defer uninstantiated
3330 templates.
3331
3332 PR c++/84968
3333 * tree.c (strip_typedefs_expr): Reject STATEMENT_LISTs.
3334
3335 2018-03-27 Paolo Carlini <paolo.carlini@oracle.com>
3336
3337 PR c++/85067
3338 * method.c (defaulted_late_check): Partially revert r253321 changes,
3339 do not early return upon error.
3340
3341 2018-03-27 Jakub Jelinek <jakub@redhat.com>
3342
3343 PR c++/85077
3344 * cp-gimplify.c (cp_fold) <case CONSTRUCTOR>: For ctors with vector
3345 type call fold to generate VECTOR_CSTs when possible.
3346
3347 PR c++/85076
3348 * tree.c (cp_build_reference_type): If to_type is error_mark_node,
3349 return it right away.
3350
3351 2018-03-27 Volker Reichelt <v.reichelt@netcologne.de>
3352
3353 * search.c (check_final_overrider): Use inform instead of error
3354 for the diagnostics of the overridden functions. Tweak wording.
3355
3356 2018-03-27 Jakub Jelinek <jakub@redhat.com>
3357
3358 PR c++/85068
3359 * class.c (update_vtable_entry_for_fn): Don't ICE if base_binfo
3360 is NULL. Assert if thunk_binfo is NULL then errorcount is non-zero.
3361
3362 2018-03-27 Paolo Carlini <paolo.carlini@oracle.com>
3363 Jason Merrill <jason@redhat.com>
3364
3365 PR c++/84632
3366 * init.c (build_aggr_init): When initializing from array,
3367 reject anything but CONSTRUCTORs and TARGET_EXPRs.
3368 (build_vec_init): Handle separately ARRAY_TYPEs.
3369
3370 2018-03-26 Jason Merrill <jason@redhat.com>
3371
3372 PR c++/85062 - ICE with alignas in wrong place.
3373 * decl.c (grokdeclarator): Ignore attributes on type-specifiers
3374 here.
3375
3376 PR c++/85049 - ICE with __integer_pack.
3377 * pt.c (unify_pack_expansion): Don't try to deduce generated packs.
3378 * cp-tree.h (TEMPLATE_PARM_P): New.
3379
3380 2018-03-23 Jason Merrill <jason@redhat.com>
3381
3382 PR c++/78489 - wrong SFINAE behavior.
3383
3384 PR c++/84489
3385 * pt.c (type_unification_real): Don't defer substitution failure.
3386
3387 2018-03-23 Jakub Jelinek <jakub@redhat.com>
3388
3389 PR c++/85015
3390 * decl.c (compute_array_index_type): Set osize to mark_rvalue_use
3391 result.
3392
3393 PR c++/84942
3394 * pt.c (tsubst_copy_and_build) <case FIX_TRUNC_EXPR>: Replace
3395 cp_build_unary_op call with gcc_unreachable ().
3396
3397 2018-03-23 Marek Polacek <polacek@redhat.com>
3398
3399 PR c++/85045
3400 * cxx-pretty-print.c (cxx_pretty_printer::multiplicative_expression):
3401 Handle EXACT_DIV_EXPR and RDIV_EXPR. Tweak condition.
3402 (cxx_pretty_printer::expression): Handle EXACT_DIV_EXPR and RDIV_EXPR.
3403
3404 2018-03-23 Ville Voutilainen <ville.voutilainen@gmail.com>
3405
3406 Implement P0962
3407 * parser.c (cp_parser_perform_range_for_lookup): Change
3408 the condition for deciding whether to use members.
3409
3410 2018-03-23 Marek Polacek <polacek@redhat.com>
3411
3412 PR c++/85033
3413 * semantics.c (finish_offsetof): Don't allow CONST_DECLs.
3414
3415 2018-03-23 Alexandre Oliva <aoliva@redhat.com>
3416
3417 PR c++/71251
3418 * parser.c (cp_parser_alias_declaration): Call
3419 parser_check_template_parameters.
3420
3421 PR c++/84789
3422 * pt.c (resolve_typename_type): Drop assert that stopped
3423 simplification to template-independent types. Add assert to
3424 verify the initial scope is template dependent.
3425 * parser.c (cp_parser_parse_and_diagnose_invalid_type_name):
3426 Reparse the id expression as a type-name, not a declarator.
3427
3428 PR c++/84729
3429 * init.c (build_vec_init): Error at parenthesized array init.
3430
3431 PR c++/84610
3432 PR c++/84642
3433 PR c++/84942
3434 * cp-tree.h (temp_override): New template class, generalizing
3435 a cleanup that was only used...
3436 * parser.c (cp_parser_parameter_declaration_clause):
3437 ... here for auto_is_implicit_function_template_parm_p.
3438 (cp_parser_gnu_attributes_opt): Use it here as well.
3439 (cp_parser_std_attribute): Likewise.
3440
3441 2018-03-22 Marek Polacek <polacek@redhat.com>
3442
3443 PR c++/84854
3444 * semantics.c (finish_if_stmt_cond): Check if the type of the condition
3445 is boolean.
3446
3447 2018-03-21 Jason Merrill <jason@redhat.com>
3448
3449 PR c++/81311 - wrong C++17 overload resolution.
3450 * call.c (build_user_type_conversion_1): Remove C++17 code.
3451 (conv_binds_ref_to_prvalue): New.
3452 (build_over_call): Handle C++17 copy elision.
3453 (build_special_member_call): Only do C++17 copy elision here if the
3454 argument is already the right type.
3455
3456 2018-03-21 Alexandre Oliva <aoliva@redhat.com>
3457
3458 PR c++/71965
3459 * init.c (build_vec_init): Silence error, former sorry,
3460 without tf_error.
3461
3462 PR c++/84610
3463 PR c++/84642
3464 * parser.c (abort_fully_implicit_template_p): New.
3465 (cp_parser_skip_to_end_of_statement): Use it.
3466 (cp_parser_skip_to_end_of_block_or_statement): Likewise.
3467 (finish_fully_implicit_template_p): Clear
3468 implicit_template_parms and implicit_template_scope.
3469
3470 2018-03-21 Paolo Carlini <paolo.carlini@oracle.com>
3471
3472 PR c++/84972
3473 * decl.c (maybe_deduce_size_from_array_init): Set TREE_TYPE to
3474 error_mark_node when check_array_designated_initializer fails.
3475
3476 2018-03-21 Jakub Jelinek <jakub@redhat.com>
3477
3478 PR c++/84961
3479 * cp-tree.h (genericize_compound_lvalue): Declare.
3480 * typeck.c (genericize_compound_lvalue): New function.
3481 (unary_complex_lvalue, cp_build_modify_expr): Use it.
3482 * semantics.c (finish_asm_stmt): Replace MODIFY_EXPR, PREINCREMENT_EXPR
3483 and PREDECREMENT_EXPR in output and "m" constrained input operands with
3484 COMPOUND_EXPR. Call cxx_mark_addressable on the rightmost
3485 COMPOUND_EXPR operand.
3486
3487 2018-03-21 Nathan Sidwell <nathan@acm.org>
3488
3489 PR c++/85008
3490 * tree.c (decl_linkage): Use DECL_CLONED_FUNCTION_P.
3491 * decl2.c (vague_linkage_p): Likewise.
3492
3493 2018-03-21 David Malcolm <dmalcolm@redhat.com>
3494
3495 PR c++/84994
3496 * constexpr.c (constexpr_fn_retval): Make non-"static".
3497 * cp-tree.h (constexpr_fn_retval): New decl.
3498 * search.c (direct_accessor_p): Update leading comment.
3499 (reference_accessor_p): Likewise.
3500 (field_accessor_p): Replace check that function body is a
3501 RETURN_EXPR with a call to constexpr_fn_retval. Fix
3502 indentation of "field_type" decl.
3503
3504 2018-03-21 Nathan Sidwell <nathan@acm.org>
3505
3506 PR c++/84804
3507 * name-lookup.c (do_pushtag): Permit lambdas to be pushed into
3508 complete classes.
3509
3510 2018-03-21 Martin Sebor <msebor@redhat.com>
3511
3512 PR c++/84850
3513 * call.c (first_non_public_field): New template and function.
3514 (first_non_trivial_field): New function.
3515 (maybe_warn_class_memaccess): Call them.
3516
3517 2018-03-21 David Malcolm <dmalcolm@redhat.com>
3518
3519 PR c++/84892
3520 * search.c (field_accessor_p): Use class_of_this_parm rather than
3521 type_of_this_parm, to check that "this" is a "const T *", rather
3522 than a "T *const".
3523
3524 2018-03-21 Nathan Sidwell <nathan@acm.org>
3525
3526 * class.c (finish_struct_anon_r): Refactor, deprecate anything
3527 other than public non-static data members.
3528 * parser.c (cp_parser_init_declarator): Deprecate attributes after
3529 parenthesized initializer.
3530
3531 PR c++/84836
3532 * name-lookup.c (update_binding): Correct logic for local binding
3533 update.
3534
3535 2018-03-21 Marek Polacek <polacek@redhat.com>
3536
3537 PR c++/71638, ICE with NSDMI and reference.
3538 * constexpr.c (cxx_eval_bare_aggregate): Update constructor's flags
3539 even when we replace an element.
3540
3541 2018-03-20 Marek Polacek <polacek@redhat.com>
3542
3543 PR c++/84978, ICE with NRVO.
3544 * constexpr.c (cxx_eval_constant_expression): Handle the case when
3545 a RESULT_DECL isn't in the hash map.
3546
3547 2018-03-20 Jason Merrill <jason@redhat.com>
3548
3549 PR c++/84978, ICE with NRVO.
3550 * cvt.c (cp_get_fndecl_from_callee): Add fold parameter.
3551 (cp_get_callee_fndecl_nofold): New.
3552 * cp-gimplify.c (cp_genericize_r): Use it instead.
3553 * call.c (check_self_delegation): Likewise.
3554
3555 2018-03-20 Nathan Sidwell <nathan@acm.org>
3556
3557 PR c++/84962
3558 * name-lookup.c (pushdecl_class_level): Push anon-struct's
3559 member_vec, if there is one.
3560
3561 PR c++/84970
3562 * cp-tree.h (lookup_list_keep): Declare.
3563 * tree.c (lookup_list_keep): New, broken out of ...
3564 (build_min): ... here. Call it.
3565 * decl.c (cp_finish_decl): Call lookup_list_keep.
3566
3567 2018-03-19 Jason Merrill <jason@redhat.com>
3568
3569 PR c++/84937 - ICE with class deduction and auto.
3570 * pt.c (rewrite_template_parm): Fix auto handling.
3571
3572 2018-03-19 Marek Polacek <polacek@redhat.com>
3573
3574 PR c++/84925
3575 * pt.c (enclosing_instantiation_of): Check if fn is null.
3576
3577 PR c++/84927
3578 * constexpr.c (cxx_eval_bare_aggregate): Update constructor's flags
3579 as we evaluate the elements.
3580 (cxx_eval_constant_expression): Verify constructor's flags
3581 unconditionally.
3582
3583 2018-03-19 Jason Merrill <jason@redhat.com>
3584
3585 PR c++/71834 - template-id with too few arguments.
3586 * pt.c (coerce_template_parms): Check fixed_parameter_pack_p.
3587
3588 2018-03-19 Nathan Sidwell <nathan@acm.org>
3589
3590 PR c++/84835
3591 * lambda.c (maybe_add_lambda_conv_op): Force C++ linkage.
3592 * pt.c (build_template_decl): Propagate language linkage.
3593
3594 PR c++/84812
3595 * name-lookup.c (set_local_extern_decl_linkage): Defend against
3596 ambiguous lookups.
3597
3598 2018-03-16 Jakub Jelinek <jakub@redhat.com>
3599
3600 PR c/84910
3601 * parser.c (cp_parser_lambda_introducer): Remove trailing space from
3602 diagnostics.
3603 * method.c (synthesize_method): Likewise.
3604 * pt.c (convert_nontype_argument): Likewise.
3605
3606 2018-03-16 Jason Merrill <jason@redhat.com>
3607
3608 PR c++/84720 - ICE with rvalue ref non-type argument.
3609 * pt.c (invalid_nontype_parm_type_p): Prohibit rvalue reference.
3610 (convert_nontype_argument): Revert earlier change.
3611
3612 PR c++/80227 - SFINAE and negative array size.
3613 * decl.c (compute_array_index_type): Use
3614 build_converted_constant_expr and valid_constant_size_p.
3615
3616 PR c++/84906 - silent wrong code with ambiguous conversion.
3617 * call.c (build_user_type_conversion_1): Set need_temporary_p on
3618 ambiguous conversion.
3619 (convert_like_real): Check it.
3620
3621 PR c++/83937 - wrong C++17 handling of init-list ctor argument.
3622 * call.c (build_special_member_call): Don't convert an init-list
3623 argument directly to the class type.
3624
3625 2018-03-16 Jakub Jelinek <jakub@redhat.com>
3626
3627 PR c++/79937
3628 PR c++/82410
3629 * cp-tree.h (CONSTRUCTOR_PLACEHOLDER_BOUNDARY): Define.
3630 (find_placeholder): Declare.
3631 * tree.c (struct replace_placeholders_t): Add exp member.
3632 (replace_placeholders_r): Don't walk into ctors with
3633 CONSTRUCTOR_PLACEHOLDER_BOUNDARY flag set, unless they are equal to
3634 d->exp. Replace PLACEHOLDER_EXPR with unshare_expr (x) rather than x.
3635 (replace_placeholders): Initialize data.exp.
3636 (find_placeholders_r, find_placeholders): New functions.
3637 * typeck2.c (process_init_constructor_record,
3638 process_init_constructor_union): Set CONSTRUCTOR_PLACEHOLDER_BOUNDARY
3639 if adding NSDMI on which find_placeholder returns true.
3640 * call.c (build_over_call): Don't call replace_placeholders here.
3641 * cp-gimplify.c (cp_genericize_r): Set TARGET_EXPR_NO_ELIDE on
3642 TARGET_EXPRs with CONSTRUCTOR_PLACEHOLDER_BOUNDARY set on
3643 TARGET_EXPR_INITIAL.
3644 (cp_fold): Copy over CONSTRUCTOR_PLACEHOLDER_BOUNDARY bit to new
3645 ctor.
3646
3647 2018-03-16 Jason Merrill <jason@redhat.com>
3648
3649 PR c++/83911 - ICE with multiversioned constructor.
3650 * cp-gimplify.c (cp_genericize_r): Replace versioned function with
3651 dispatchere here.
3652 * call.c (build_over_call): Not here.
3653
3654 2018-03-16 Jakub Jelinek <jakub@redhat.com>
3655
3656 PR c++/84874
3657 * decl.c (reshape_init_class): Don't assert d->cur->index == field
3658 if d->cur->index is a FIELD_DECL, instead set field to d->cur->index.
3659
3660 2018-03-15 Jakub Jelinek <jakub@redhat.com>
3661
3662 PR c++/84222
3663 * cp-tree.h (cp_warn_deprecated_use): Declare.
3664 * tree.c (cp_warn_deprecated_use): New function.
3665 * typeck2.c (build_functional_cast): Use it.
3666 * decl.c (grokparms): Likewise.
3667 (grokdeclarator): Likewise. Temporarily push nested class scope
3668 around grokparms call for out of class member definitions.
3669
3670 2018-03-14 Jason Merrill <jason@redhat.com>
3671
3672 PR c++/84820 - no error for invalid qualified-id.
3673 * parser.c (cp_parser_make_indirect_declarator): Don't wrap
3674 cp_error_declarator.
3675
3676 PR c++/84801 - ICE with unexpanded pack in lambda.
3677 * pt.c (check_for_bare_parameter_packs): Don't return early for a
3678 lambda in non-template context.
3679
3680 PR c++/81236 - auto variable and auto function
3681 * pt.c (tsubst_baselink): Update the type of the BASELINK after
3682 mark_used.
3683
3684 2018-03-14 Jason Merrill <jason@redhat.com>
3685
3686 PR c++/83916 - ICE with template template parameters.
3687 * pt.c (convert_template_argument): Don't substitute into type of
3688 non-type parameter if we don't have enough arg levels.
3689 (unify): Likewise.
3690
3691 2018-03-14 Marek Polacek <polacek@redhat.com>
3692
3693 PR c++/84596
3694 * semantics.c (finish_static_assert): Check
3695 instantiation_dependent_expression_p instead of
3696 {type,value}_dependent_expression_p.
3697
3698 2018-03-13 Paolo Carlini <paolo.carlini@oracle.com>
3699 Jason Merrill <jason@redhat.com>
3700
3701 PR c++/82336 - link error with list-init default argument.
3702 * decl.c (check_default_argument): Unshare an initializer list.
3703
3704 2018-03-13 Jakub Jelinek <jakub@redhat.com>
3705
3706 PR c++/84843
3707 * decl.c (duplicate_decls): For redefinition of built-in, use error
3708 and return error_mark_node. For redeclaration, return error_mark_node
3709 rather than olddecl if !flag_permissive.
3710
3711 2018-03-13 Jason Merrill <jason@redhat.com>
3712
3713 PR c++/82565 - ICE with concepts and generic lambda.
3714 * pt.c (instantiate_decl): Clear fn_context for lambdas.
3715
3716 2018-03-13 Jason Merrill <jason@redhat.com>
3717
3718 PR c++/84720 - ICE with rvalue ref non-type argument.
3719 * pt.c (convert_nontype_argument): Handle rvalue references.
3720
3721 PR c++/84839 - ICE with decltype of parameter pack.
3722 * pt.c (tsubst_pack_expansion): Set cp_unevaluated_operand while
3723 instantiating dummy parms.
3724
3725 * parser.c (cp_parser_simple_type_specifier): Pedwarn about auto
3726 parameter even without -Wpedantic.
3727
3728 PR c++/84798 - ICE with auto in abstract function declarator.
3729 * parser.c (cp_parser_parameter_declaration_clause): Check
3730 parser->default_arg_ok_p.
3731
3732 2018-03-13 Jakub Jelinek <jakub@redhat.com>
3733
3734 PR c++/84808
3735 * constexpr.c (find_array_ctor_elt): Don't use elt reference after
3736 first potential CONSTRUCTOR_ELTS reallocation. Convert dindex to
3737 sizetype. Formatting fixes.
3738
3739 2018-03-12 Jason Merrill <jason@redhat.com>
3740
3741 PR c++/84355 - ICE with deduction for member class template.
3742 * pt.c (tsubst) [TEMPLATE_TYPE_PARM]: Always substitute into
3743 CLASS_PLACEHOLDER_TEMPLATE.
3744
3745 PR c++/84802 - ICE capturing uninstantiated class.
3746 * lambda.c (build_capture_proxy): Call complete_type.
3747
3748 2018-03-09 Jason Merrill <jason@redhat.com>
3749
3750 PR c++/84770 - ICE with typedef and parameter pack.
3751 * pt.c (verify_unstripped_args_1): Split out from
3752 verify_unstripped_args.
3753
3754 PR c++/84785 - ICE with alias template and default targs.
3755 * pt.c (type_unification_real): Set processing_template_decl if
3756 saw_undeduced == 1.
3757
3758 PR c++/84752 - ICE with capture of constexpr array.
3759 * call.c (standard_conversion): Set rvaluedness_matches_p on the
3760 identity conversion under ck_lvalue.
3761
3762 2018-03-09 Jason Merrill <jason@redhat.com>
3763 Paolo Carlini <paolo.carlini@oracle.com>
3764
3765 PR c++/71169
3766 PR c++/71832
3767 * pt.c (any_erroneous_template_args_p): New.
3768 * cp-tree.h (any_erroneous_template_args_p): Declare it.
3769 * parser.c (cp_parser_class_specifier_1): Use it.
3770
3771 2018-03-09 Jason Merrill <jason@redhat.com>
3772
3773 PR c++/84726 - unnecessary capture of constant vars.
3774 * cp-tree.h (LAMBDA_CAPTURE_EXPLICIT_P)
3775 (LAMBDA_EXPR_CAPTURE_OPTIMIZED): New.
3776 * expr.c (mark_use): Set LAMBDA_EXPR_CAPTURE_OPTIMIZED.
3777 * lambda.c (is_constant_capture_proxy)
3778 (current_lambda_expr, var_to_maybe_prune, mark_const_cap_r)
3779 (prune_lambda_captures): New.
3780 (finish_lambda_function): Call prune_lambda_captures.
3781
3782 2018-03-09 Jason Merrill <jason@redhat.com>
3783 Jakub Jelinek <jakub@redhat.com>
3784
3785 PR c++/84076
3786 * call.c (convert_arg_to_ellipsis): Instead of cp_build_addr_expr
3787 build ADDR_EXPR with REFERENCE_TYPE.
3788 (build_over_call): For purposes of check_function_arguments, if
3789 argarray[j] is ADDR_EXPR with REFERENCE_TYPE created above, use
3790 its operand rather than the argument itself.
3791
3792 2018-03-09 Jakub Jelinek <jakub@redhat.com>
3793
3794 PR c++/84724
3795 * decl.c (duplicate_decls): Don't override __* prefixed builtins
3796 except for __[^b]*_chk, instead issue permerror and for -fpermissive
3797 also a note and return olddecl.
3798
3799 2018-03-09 Nathan Sidwell <nathan@acm.org>
3800
3801 PR c++/84733
3802 * name-lookup.c (do_pushdecl_with_scope): Only clear
3803 current_function_decl when pushing a non-class (i.e. namespace)
3804 scope.
3805
3806 2018-03-08 Jason Merrill <jason@redhat.com>
3807 Jakub Jelinek <jakub@redhat.com>
3808
3809 PR c++/80598
3810 * call.c (build_over_call): In templates set TREE_USED (first_fn) when
3811 not calling mark_used for the benefit of -Wunused-function warning.
3812
3813 2018-03-06 Jason Merrill <jason@redhat.com>
3814
3815 * lambda.c (is_capture_proxy_with_ref): Remove.
3816 * constexpr.c, expr.c, cp-tree.h, semantics.c: Adjust.
3817
3818 2018-03-06 Marek Polacek <polacek@redhat.com>
3819
3820 PR c++/84684
3821 * constexpr.c (cxx_bind_parameters_in_call): Unshare evaluated
3822 arguments.
3823
3824 2018-03-06 Alexandre Oliva <aoliva@redhat.com>
3825
3826 PR c++/84231
3827 * tree.c (lvalue_kind): Use presence/absence of REFERENCE_TYPE
3828 only while processing template decls.
3829 * typeck.c (build_x_conditional_expr): Move wrapping of
3830 reference type around type...
3831 * call.c (build_conditional_expr_1): ... here. Rename
3832 is_lvalue to is_glvalue.
3833 * parser.c (cp_parser_fold_expression): Catch REFERENCE_REF_P
3834 INDIRECT_REF of COND_EXPR too.
3835
3836 PR c++/84593
3837 * init.c (build_zero_init_1): Zero-initialize references.
3838
3839 PR c++/84492
3840 * semantics.c (finish_stmt_expr_expr): Reject unresolved
3841 overloads used as stmt expr values.
3842
3843 2018-03-05 Jason Merrill <jason@redhat.com>
3844
3845 PR c++/84708 - ICE with lambda in local class NSDMI.
3846 * lambda.c (lambda_expr_this_capture): Handle local class NSDMI
3847 context.
3848
3849 2018-03-05 Jakub Jelinek <jakub@redhat.com>
3850
3851 PR c++/84684
3852 * constexpr.c (constexpr_call_hasher::equal): Return false if
3853 lhs->hash != rhs->hash. Change return 1 to return true and
3854 return 0 to return false.
3855
3856 2018-03-05 Nathan Sidwell <nathan@acm.org>
3857
3858 PR c++/84702
3859 * pt.c (process_template_arg): Mark lookup_keep on a default arg.
3860
3861 2018-03-05 Marek Polacek <polacek@redhat.com>
3862
3863 PR c++/84707
3864 * decl.c (duplicate_decls): Check DECL_NAME before accessing
3865 UDLIT_OPER_P.
3866
3867 2018-03-05 Nathan Sidwell <nathan@acm.org>
3868
3869 PR c++/84694
3870 * friend.c (do_friend): Restore check for identifier_p inside
3871 TEMPLATE_ID_EXPR.
3872
3873 2018-03-05 Paolo Carlini <paolo.carlini@oracle.com>
3874
3875 PR c++/84618
3876 * parser.c (cp_parser_lambda_introducer): Reject any capture not
3877 involving a VAR_DECL or a PARM_DECL.
3878
3879 2018-03-05 Pádraig Brady <P@draigBrady.com>
3880 Jason Merrill <jason@redhat.com>
3881 Nathan Sidwell <nathan@acm.org>
3882
3883 PR c++/84497
3884 * decl2.c (get_tls_init_fn): Check TYPE_HAS_TRIVIAL_DFLT too.
3885
3886 2018-03-03 Jason Merrill <jason@redhat.com>
3887
3888 PR c++/84686 - missing volatile loads.
3889 * cvt.c (convert_to_void): Call maybe_undo_parenthesized_ref.
3890
3891 2018-03-03 Paolo Carlini <paolo.carlini@oracle.com>
3892
3893 PR c++/71464
3894 * optimize.c (maybe_thunk_body): Bail out immediately if either
3895 fns[0] or fns[1] is null.
3896
3897 2018-03-02 Marek Polacek <polacek@redhat.com>
3898
3899 PR c++/84578
3900 * constexpr.c (get_array_or_vector_nelts): New.
3901 (cxx_eval_array_reference): Use it.
3902 (cxx_eval_vec_init_1): Likewise.
3903 (cxx_eval_store_expression): Likewise.
3904
3905 2018-03-02 Jason Merrill <jason@redhat.com>
3906
3907 * semantics.c (force_paren_expr): Remove redundant test.
3908
3909 2018-03-02 Marek Polacek <polacek@redhat.com>
3910
3911 PR c++/84663
3912 * decl.c (cp_complete_array_type): Check error_mark_node.
3913
3914 PR c++/84664
3915 * typeck.c (cp_perform_integral_promotions): Check the result of
3916 mark_rvalue_use.
3917
3918 2018-03-02 Jakub Jelinek <jakub@redhat.com>
3919
3920 PR c++/84662
3921 * pt.c (tsubst_copy_and_build) <case TEMPLATE_ID_EXPR>: Use
3922 RETURN instead of return.
3923 <case POINTER_PLUS_EXPR>: Likewise.
3924 <case CONVERT_EXPR>: If op0 is error_mark_node, just return
3925 it instead of wrapping it into CONVERT_EXPR.
3926
3927 2018-03-02 Jason Merrill <jason@redhat.com>
3928
3929 Fix MIPS16 ICE.
3930 * pt.c (type_dependent_expression_p): Check DECL_LANG_SPECIFIC.
3931
3932 2018-03-02 Marek Polacek <polacek@redhat.com>
3933
3934 PR c++/84590
3935 * cp-gimplify.c (cp_fully_fold): Unwrap TARGET_EXPR or a CONSTRUCTOR
3936 wrapped in VIEW_CONVERT_EXPR.
3937
3938 2018-03-01 Martin Sebor <msebor@redhat.com>
3939
3940 PR c++/84294
3941 * decl.c (check_redeclaration_no_default_args): Merge attributes
3942 specified on redeclarations of the same function template.
3943 Remove dead code.
3944
3945 2018-03-01 Marek Polacek <polacek@redhat.com>
3946 Jason Merrill <jason@redhat.com>
3947
3948 PR c++/84582
3949 * semantics.c (force_paren_expr): Create a PAREN_EXPR when in
3950 a template.
3951 (maybe_undo_parenthesized_ref): Unwrap PAREN_EXPR.
3952 * typeck2.c (store_init_value): Call fold_non_dependent_expr instead
3953 of instantiate_non_dependent_expr.
3954 * tree.c (lvalue_kind): Handle PAREN_EXPR like NON_DEPENDENT_EXPR.
3955
3956 2018-03-01 Nathan Sidwell <nathan@acm.org>
3957
3958 PR c++/84434
3959 * name-lookup.c (member_vec_dedup): Remove manually peeled
3960 iteration. Ignore dependent ctor inheritance.
3961
3962 2018-03-01 Jason Merrill <jason@redhat.com>
3963
3964 PR c++/71569 - decltype of template.
3965 * parser.c (cp_parser_decltype_expr): Handle missing template args.
3966
3967 2018-03-01 Marek Polacek <polacek@redhat.com>
3968
3969 PR c++/84596
3970 * constexpr.c (require_rvalue_constant_expression): New function.
3971 * cp-tree.h: Declare it.
3972 * semantics.c (finish_static_assert): Use it instead of
3973 require_potential_rvalue_constant_expression.
3974
3975 2018-03-01 Jason Merrill <jason@redhat.com>
3976 Alexandre Oliva <aoliva@redhat.com>
3977
3978 PR c++/71569 - ICE with redundant args on member variable template.
3979 * decl.c (start_decl): Handle partial specialization of member
3980 variable template.
3981 * pt.c (determine_specialization): Allow partial specialization
3982 of member variable template without specializing enclosing class.
3983 (process_partial_specialization): Improve error message.
3984
3985 2018-02-28 Jason Merrill <jason@redhat.com>
3986
3987 PR c++/71784 - ICE with ref-qualifier and explicit specialization.
3988 * pt.c (determine_specialization): Check ref-qualifier.
3989
3990 2018-02-28 Jakub Jelinek <jakub@redhat.com>
3991
3992 PR c++/84609
3993 * parser.c (cp_parser_attributes_opt): Formatting fix.
3994 (cp_parser_skip_balanced_tokens, cp_parser_skip_gnu_attributes_opt,
3995 cp_parser_skip_std_attribute_spec_seq, cp_parser_skip_attributes_opt):
3996 New functions.
3997 (cp_parser_member_declaration): Use cp_parser_skip_attributes_opt
3998 instead of tentative parse to peek over optional attribute tokens
3999 to check for CPP_COLON after them.
4000
4001 PR c++/83871
4002 PR c++/83503
4003 * pt.c (INCLUDE_STRING): Remove define.
4004 (warn_spec_missing_attributes): Use pretty_printer instead of
4005 std::string. Fix up inform call so that the list of attributes
4006 is in %s argument.
4007
4008 2018-02-28 Martin Sebor <msebor@redhat.com>
4009
4010 PR testsuite/84617
4011 * decl.c (duplicate_decls): Fully merge attributes const, pure,
4012 and malloc.
4013
4014 2018-02-28 Nathan Sidwell <nathan@acm.org>
4015
4016 PR c++/84602
4017 * name-lookup.h (search_anon_aggr): Add defaulted WANT_TYPE arg.
4018 * name-lookup.c (fields_linear_search): Look in an anon-aggr
4019 regardless of want_type.
4020 (search_anon_aggr): Just use get_class_binding_direct.
4021
4022 2018-02-28 Jakub Jelinek <jakub@redhat.com>
4023
4024 * decl.c (cp_finish_decomp): Don't adjust eltscnt when calling
4025 inform_n.
4026
4027 2018-02-27 Martin Sebor <msebor@redhat.com>
4028
4029 * pt.c: Avoid including <string> directly.
4030
4031 2018-02-27 Martin Sebor <msebor@redhat.com>
4032
4033 PR c++/83871
4034 PR c++/83503
4035 * cp-tree.h (warn_spec_missing_attributes): New function.
4036 ((check_explicit_specialization): Add an argument. Call the above
4037 function.
4038 * decl.c (duplicate_decls): Avoid applying primary function template's
4039 attributes to its explicit specializations.
4040 cp/pt.c (warn_spec_missing_attributes): Define.
4041
4042 2018-02-27 HÃ¥kon Sandsmark <hsandsmark@gmail.com>
4043
4044 PR c++/71546 - lambda init-capture with qualified-id.
4045 * parser.c (cp_parser_lambda_introducer): Clear scope after
4046 each lambda capture.
4047
4048 2018-02-27 Nathan Sidwell <nathan@acm.org>
4049
4050 PR c++/84426
4051 * name-lookup.h (get_member_slot): Rename ...
4052 (find_member_slot): ... here.
4053 (add_member_slot): New.
4054 * name-lookup.c (member_vec_linear_search): No need to check for
4055 NULL slot.
4056 (get_member_slot): Rename ...
4057 (find_member_slot): ... here. Don't add slot for incomplete class.
4058 (add_member_slot): New.
4059 * class.c (add_method): Adjust get_member_slot rename. Bail out
4060 if push_class_level_binding fails. Create slot and grok
4061 properties once we're committed to insertion.
4062
4063 2018-02-27 Jason Merrill <jason@redhat.com>
4064
4065 PR c++/84489 - dependent default template argument
4066 * pt.c (type_unification_real): Handle early substitution failure.
4067
4068 2018-02-26 Jason Merrill <jason@redhat.com>
4069
4070 PR c++/84560 - ICE capturing multi-dimensional VLA.
4071 * tree.c (array_of_runtime_bound_p): False if the element is
4072 variably-modified.
4073
4074 PR c++/84441 - ICE with base initialized from ?:
4075 * call.c (unsafe_copy_elision_p): Handle COND_EXPR.
4076
4077 PR c++/84520 - ICE with generic lambda in NSDMI.
4078 * lambda.c (lambda_expr_this_capture): Don't look for fake NSDMI
4079 'this' in a generic lambda instantiation.
4080
4081 PR c++/84559 - ICE with constexpr VLA.
4082 * constexpr.c (ensure_literal_type_for_constexpr_object): Check
4083 for constexpr variable with VLA type.
4084
4085 2018-02-26 Jakub Jelinek <jakub@redhat.com>
4086
4087 PR c++/84558
4088 * constexpr.c (cxx_eval_vec_init_1): For reuse, treat NULL eltinit like
4089 a valid constant initializer. Formatting fixes.
4090
4091 2018-02-26 Paolo Carlini <paolo.carlini@oracle.com>
4092
4093 PR c++/84540
4094 * pt.c (tsubst_attributes): Handle correctly tsubst_attribute
4095 returning NULL_TREE.
4096 (apply_late_template_attributes): Likewise.
4097
4098 2018-02-26 Jakub Jelinek <jakub@redhat.com>
4099
4100 PR c++/84557
4101 * parser.c (cp_parser_omp_var_list_no_open): Only call
4102 cp_parser_lookup_name_simple on names satisfying identifier_p.
4103 (cp_parser_oacc_routine): Likewise.
4104
4105 2018-02-26 Jason Merrill <jason@redhat.com>
4106
4107 PR c++/84551 - ICE with concepts and -g.
4108 * parser.c (add_debug_begin_stmt): Do nothing in a concept.
4109
4110 2018-02-26 Marek Polacek <polacek@redhat.com>
4111
4112 PR c++/84325
4113 * tree.c (replace_placeholders_r): Only check TREE_CONSTANT on
4114 non-types.
4115
4116 2018-02-26 Jason Merrill <jason@redhat.com>
4117
4118 PR c++/84447 - ICE with deleted inherited ctor with default arg.
4119 * call.c (build_over_call): Handle deleted functions in one place.
4120
4121 2018-02-26 Paolo Carlini <paolo.carlini@oracle.com>
4122
4123 PR c++/84533
4124 * decl.c (redeclaration_error_message): Don't try to use
4125 DECL_DECLARED_CONSTEXPR_P on CONST_DECLs.
4126
4127 2018-02-26 Paolo Carlini <paolo.carlini@oracle.com>
4128
4129 * lambda.c (build_capture_proxy): Define static.
4130 * cp-tree.h (build_capture_proxy): Remove.
4131
4132 2018-02-26 Marek Polacek <polacek@redhat.com>
4133
4134 PR c++/84537
4135 * name-lookup.c (suggest_alternative_in_explicit_scope): Return false
4136 if name is error node.
4137
4138 2018-02-25 Jason Merrill <jason@redhat.com>
4139
4140 PR c++/84015 - ICE with class deduction and auto template parm.
4141 * pt.c (rewrite_template_parm): Use tf_partial in first tsubst.
4142
4143 2018-02-24 Marek Polacek <polacek@redhat.com>
4144
4145 PR c++/83692
4146 * constexpr.c (maybe_constant_init_1): New function.
4147 (maybe_constant_init): Make it a wrapper around maybe_constant_init_1.
4148 (cxx_constant_init): New function.
4149 * cp-tree.h (cxx_constant_init): Declare.
4150 * typeck2.c (store_init_value): Call cxx_constant_init instead of
4151 cxx_constant_value. Move the maybe_constant_init call under an 'else'.
4152
4153 2018-02-22 Jason Merrill <jason@redhat.com>
4154
4155 PR c++/70468 - ICE with constructor delegation via typedef.
4156 * pt.c (tsubst_initializer_list): Check for other mem-initializers
4157 with constructor delegation.
4158
4159 2018-02-22 Jason Merrill <jason@redhat.com>
4160
4161 PR c++/84424 - ICE with constexpr and __builtin_shuffle.
4162 * constexpr.c (reduced_constant_expression_p): Handle CONSTRUCTOR of
4163 VECTOR_TYPE.
4164
4165 2018-02-22 Marek Polacek <polacek@redhat.com>
4166
4167 PR c++/84493
4168 * parser.c (cp_parser_braced_list): Use require_open instead of
4169 consume_open.
4170
4171 2018-02-21 Jason Merrill <jason@redhat.com>
4172
4173 PR c++/84454 - ICE with pack expansion in signature.
4174 * error.c (find_typenames_r): Also stop on EXPR_PACK_EXPANSION.
4175
4176 2018-02-20 Siddhesh Poyarekar <siddhesh@sourceware.org>
4177
4178 * cp-objcp-common.c (cxx_block_may_fallthru): Add case for
4179 IF_STMT.
4180
4181 2018-02-20 Paolo Carlini <paolo.carlini@oracle.com>
4182
4183 PR c++/84446
4184 * parser.c (cp_parser_init_declarator): Don't call start_lambda_scope
4185 on error_mark_node.
4186
4187 2018-02-20 Jakub Jelinek <jakub@redhat.com>
4188
4189 PR c++/84445
4190 * class.c (fixed_type_or_null) <case CALL_EXPR>: Only test
4191 TREE_HAS_CONSTRUCTOR if instance is not an internal function call.
4192
4193 PR c++/84449
4194 * tree.c (bot_manip): If build_cplus_new or break_out_target_exprs
4195 returns error_mark_node, return it immediately.
4196 (break_out_target_exprs): If cp_walk_tree with bot_manip returns
4197 error_mark_node, return error_mark_node.
4198
4199 PR c++/84455
4200 * pt.c (tsubst_lambda_expr): If not nested, increment temporarily
4201 function_depth to avoid GC during finish_lambda_function.
4202
4203 2018-02-19 Jason Merrill <jason@redhat.com>
4204
4205 PR c++/84429 - ICE capturing VLA.
4206 * lambda.c (build_capture_proxy): Handle reference refs.
4207
4208 2018-02-19 Jakub Jelinek <jakub@redhat.com>
4209
4210 PR c++/84448
4211 * parser.c (cp_parser_binary_expression): For no_toplevel_fold_p, if
4212 either operand is error_mark_node, set current.lhs to that instead of
4213 creating a binary op with error_mark_node operands.
4214
4215 PR c++/84430
4216 * constexpr.c (potential_constant_expression_1): Handle OMP_SIMD.
4217
4218 2018-02-19 Paolo Carlini <paolo.carlini@oracle.com>
4219
4220 PR c++/84348
4221 * decl.c (grokdeclarator): Early return error_mark_node upon
4222 ill-formed friend declaration.
4223
4224 2018-02-16 Marek Polacek <polacek@redhat.com>
4225 Jakub Jelinek <jakub@redhat.com>
4226
4227 PR c++/84192
4228 * constexpr.c (cxx_eval_constant_expression) <case RETURN_EXPR>: Don't
4229 set *jump_target to anything if jump_target is NULL.
4230
4231 2018-02-16 Jason Merrill <jason@redhat.com>
4232
4233 PR c++/84151 - unnecessary volatile load with static member.
4234 * call.c (build_new_method_call_1): Avoid loading from a volatile
4235 lvalue used as the object argument for a static member function.
4236
4237 PR c++/81853 - using-directive and constexpr.
4238 * constexpr.c (cxx_eval_constant_expression): Handle USING_STMT.
4239
4240 PR c++/84420 - ICE with structured binding in lambda.
4241 * lambda.c (is_capture_proxy): Check DECL_DECOMPOSITION_P.
4242
4243 PR c++/83835 - C++17 error with constructor ctors.
4244 * call.c (build_special_member_call): Set TARGET_EXPR_DIRECT_INIT_P.
4245
4246 PR c++/82664 - ICE with reference to function template parm.
4247 * pt.c (convert_nontype_argument_function): Avoid obfuscationg
4248 NOP_EXPRs.
4249
4250 PR c++/82764 - C++17 ICE with empty base
4251 * class.c (build_base_field_1): Set DECL_SIZE to zero for empty base.
4252
4253 2018-02-16 Jason Merrill <jason@redhat.com>
4254
4255 PR c++/84421 - type-dependent if constexpr
4256 * semantics.c (finish_if_stmt_cond): Check type_dependent_expression_p.
4257
4258 2018-02-16 Nathan Sidwell <nathan@acm.org>
4259
4260 Deprecate -ffriend-injection.
4261 * decl.c (cxx_init_decl_processing): Emit warning on option.
4262 * name-lookup.c (do_pushdecl): Emit warning if we push a visible
4263 friend.
4264
4265 2018-02-16 Paolo Carlini <paolo.carlini@oracle.com>
4266
4267 PR c++/82468
4268 * decl.c (check_special_function_return_type): Reject template
4269 template parameter in deduction guide.
4270
4271 2018-02-16 Nathan Sidwell <nathan@acm.org>
4272
4273 PR c++/84375
4274 * name-lookup.c (do_pushdecl): Bail out on bad local friend injection.
4275
4276 2018-02-15 Jason Merrill <jason@redhat.com>
4277
4278 PR c++/83227 - C++17 ICE with init-list derived-to-base conversion.
4279 * call.c (convert_like_real): Don't use the copy-list-initialization
4280 shortcut for ck_base.
4281
4282 PR c++/84045 - ICE with typedef and noexcept.
4283 * except.c (build_noexcept_spec): Use strip_typedefs_expr.
4284
4285 PR c++/84376 - ICE with omitted template arguments.
4286 * pt.c (dguide_name_p): Check for IDENTIFIER_NODE.
4287
4288 PR c++/84368 - wrong error with local variable in variadic lambda.
4289 * pt.c (tsubst_pack_expansion): Fix handling of non-packs in
4290 local_specializations.
4291
4292 2018-02-15 Paolo Carlini <paolo.carlini@oracle.com>
4293
4294 PR c++/84330
4295 * constraint.cc (tsubst_constraint_info): Handle an error_mark_node
4296 as first argument.
4297
4298 2018-02-14 Paolo Carlini <paolo.carlini@oracle.com>
4299
4300 PR c++/84350
4301 * pt.c (do_auto_deduction): Don't check the TREE_TYPE of a null
4302 init, early return.
4303
4304 2018-02-14 Nathan Sidwell <nathan@acm.org>
4305
4306 * decl2.c (mark_vtable_entries): Set input_location to decl's.
4307 (c_parse_final_cleanups): Restore input_location after emitting
4308 vtables.
4309
4310 2018-02-14 Paolo Carlini <paolo.carlini@oracle.com>
4311
4312 * cp-tree.h (do_auto_deduction (tree, tree, tree)): Remove.
4313 (do_auto_deduction (tree, tree, tree, tsubst_flags_t,
4314 auto_deduction_context, tree, int): Add defaults.
4315 * pt.c (do_auto_deduction (tree, tree, tree)): Remove definition.
4316 (tsubst_omp_for_iterator): Adjust do_auto_deduction call, forward
4317 tsubst_flags_t argument.
4318 * init.c (build_new): Likewise.
4319
4320 2018-02-13 Jakub Jelinek <jakub@redhat.com>
4321
4322 PR c++/84364
4323 * typeck.c (check_return_expr): Don't emit -Weffc++ warning
4324 about return other than *this in assignment operators if
4325 retval is type dependent expression.
4326
4327 2018-02-13 Paolo Carlini <paolo.carlini@oracle.com>
4328
4329 PR c++/84333
4330 * call.c (build_conditional_expr_1): Use cp_save_expr instead of
4331 save_expr for the G++ extension.
4332
4333 2018-02-13 Jason Merrill <jason@redhat.com>
4334
4335 PR c++/84080 - ICE with return type deduction and specialization.
4336 * pt.c (determine_specialization): Check uses_template_parms.
4337
4338 Fix more variadic capture issues.
4339 * pt.c (find_parameter_packs_r): Also look at explicit captures.
4340 (check_for_bare_parameter_packs): Check current_class_type for
4341 lambda context.
4342 (extract_locals_r): Handle seeing a full instantiation of a pack.
4343 (tsubst_pack_expansion): Likewise. Force lambda capture.
4344 * parser.c (cp_parser_lambda_introducer): Don't
4345 check_for_bare_parameter_packs.
4346
4347 PR c++/84338 - wrong variadic sizeof.
4348 * pt.c (argument_pack_select_arg): Like the macro, but look through
4349 a pack expansion.
4350 (tsubst, tsubst_copy, dependent_template_arg_p): Use it.
4351 (extract_fnparm_pack): Do make_pack_expansion.
4352 (extract_locals_r): Do strip a pack expansion.
4353 * cp-tree.h (ARGUMENT_PACK_SELECT_ARG): Remove.
4354
4355 2018-02-12 Jakub Jelinek <jakub@redhat.com>
4356
4357 PR c++/84341
4358 * parser.c (cp_parser_binary_expression): Use build_min instead of
4359 build2_loc to build the no_toplevel_fold_p toplevel binary expression.
4360
4361 2018-02-12 Nathan Sidwell <nathan@acm.org>
4362
4363 PR c++/84263
4364 * parser.c (cp_parser_decltype): Push and pop
4365 deferring_access_checks. Reorganize to avoid goto.
4366
4367 2018-02-12 Richard Biener <rguenther@suse.de>
4368
4369 PR c++/84281
4370 * constexpr.c (cxx_eval_vec_init_1): Use a RANGE_EXPR to compact
4371 uniform constructors and delay allocating them fully.
4372
4373 2018-02-09 Jason Merrill <jason@redhat.com>
4374
4375 PR c++/84036 - ICE with variadic capture.
4376 Handle variadic capture proxies more like non-variadic.
4377 * lambda.c (build_capture_proxy): Remove workaround.
4378 * pt.c (find_parameter_packs_r): The proxy is a pack.
4379 (instantiate_class_template_1): Remove dead lambda code.
4380 (extract_fnparm_pack): Don't make_pack_expansion.
4381 (extract_locals_r): Don't strip a pack expansion.
4382 (tsubst_pack_expansion): Handle proxy packs. Use
4383 PACK_EXPANSION_EXTRA_ARGS less.
4384 (tsubst_decl) [FIELD_DECL]: Don't register_specialization.
4385 (tsubst_copy) [FIELD_DECL]: Don't retrieve*_specialization.
4386 [VAR_DECL]: Handle ARGUMENT_PACK_SELECT.
4387 (tsubst_expr) [DECL_EXPR]: Handle proxy packs.
4388 (tsubst_copy_and_build) [VAR_DECL]: Handle proxy packs normally.
4389
4390 2018-02-10 Jakub Jelinek <jakub@redhat.com>
4391
4392 PR sanitizer/83987
4393 * tree.c (cp_free_lang_data): Revert 2018-01-23 change.
4394
4395 2018-02-09 Jason Merrill <jason@redhat.com>
4396
4397 PR c++/81917 - ICE with void_t and partial specialization.
4398 * pt.c (instantiate_class_template_1): Set TYPE_BEING_DEFINED before
4399 calling most_specialized_partial_spec.
4400
4401 2018-02-09 Nathan Sidwell <nathan@acm.org>
4402
4403 PR c/84293
4404 * typeck.c (cp_build_indirect_ref_1, build_reinterpret_cast_1):
4405 Pass expr location to strict_aliasing_warning.
4406
4407 2018-02-09 Jason Merrill <jason@redhat.com>
4408
4409 PR c++/84296 - ICE with qualified-id in template.
4410 PR c++/83714
4411 * pt.c (unknown_base_ref_p): New.
4412 (instantiation_dependent_scope_ref_p): Use it instead of
4413 any_dependent_bases_p.
4414
4415 2018-02-09 Marek Polacek <polacek@redhat.com>
4416 Jakub Jelinek <jakub@redhat.com>
4417
4418 PR c++/83659
4419 * constexpr.c (cxx_fold_indirect_ref): Sync some changes from
4420 fold_indirect_ref_1, including poly_*int64. Verify first that
4421 tree_fits_poly_int64_p (op01). Formatting fixes.
4422
4423 2018-02-08 Paolo Carlini <paolo.carlini@oracle.com>
4424
4425 * constexpr.c (cxx_eval_component_reference): Use INDIRECT_REF_P.
4426 * lambda.c (build_capture_proxy): Likewise.
4427 * search.c (field_access_p): Likewise.
4428 * semantics.c (omp_clause_decl, omp_privatize_field,
4429 finish_omp_clauses): Likewise.
4430
4431 2018-02-08 Paolo Carlini <paolo.carlini@oracle.com>
4432
4433 PR c++/83806
4434 * typeck.c (decay_conversion): Use mark_rvalue_use for the special
4435 case of nullptr too.
4436
4437 2018-02-08 Nathan Sidwell <nathan@acm.org>
4438
4439 * class.c (finish_struct): Fix std:initializer_list diagnostic
4440 formatting.
4441
4442 2018-02-08 Paolo Carlini <paolo.carlini@oracle.com>
4443
4444 PR c++/83204
4445 * pt.c (tsubst_copy_and_build): Use force_paren_expr for INDIRECT_REF.
4446
4447 2018-02-07 Jakub Jelinek <jakub@redhat.com>
4448
4449 PR c++/84082
4450 * parser.c (cp_parser_dot_deref_incomplete): New function.
4451 (cp_parser_postfix_dot_deref_expression): Use it.
4452
4453 2018-02-07 David Malcolm <dmalcolm@redhat.com>
4454
4455 PR c++/81610
4456 PR c++/80567
4457 * name-lookup.c (suggest_rid_p): New function.
4458 (lookup_name_fuzzy): Replace enum-rid-filtering logic with call to
4459 suggest_rid_p.
4460
4461 2018-02-07 Jason Merrill <jason@redhat.com>
4462
4463 PR c++/84182 - ICE with captured lambda
4464 PR c++/84181
4465 * pt.c (extract_locals_r, extract_local_specs): New.
4466 (tsubst_pack_expansion): Use them.
4467
4468 2018-02-07 Martin Liska <mliska@suse.cz>
4469
4470 PR c++/84059.
4471 * class.c (add_method): Append argument value.
4472 * cp-tree.h (maybe_version_functions): Add new argument.
4473 * decl.c (decls_match): Call it if a declaration does not
4474 have DECL_FUNCTION_VERSIONED.
4475 (maybe_version_functions): record argument is added.
4476
4477 2018-02-05 Marek Polacek <polacek@redhat.com>
4478
4479 * class.c: Remove unused global variables.
4480 (build_primary_vtable): Don't gather statistics.
4481 (print_class_statistics): Remove.
4482 * cp-tree.h (print_class_statistics): Remove.
4483 * tree.c (cxx_print_statistics): Don't call print_class_statistics.
4484
4485 2018-02-02 Paolo Carlini <paolo.carlini@oracle.com>
4486
4487 * class.c (is_really_empty_class): Use DECL_UNNAMED_BIT_FIELD.
4488 * constexpr.c (cx_check_missing_mem_inits): Likewise.
4489 * decl.c (next_initializable_field, find_decomp_class_base,
4490 cp_finish_decomp): Likewise.
4491 * typeck2.c (process_init_constructor_record): Likewise.
4492
4493 2018-02-02 Jason Merrill <jason@redhat.com>
4494
4495 PR c++/84181 - ICE with lambda parm in template argument.
4496 * tree.c (strip_typedefs_expr): Use cp_tree_operand_length.
4497
4498 2018-02-01 Jason Merrill <jason@redhat.com>
4499
4500 PR c++/84160 - ICE with nested variadic capture.
4501 * lambda.c (is_capture_proxy_with_ref): New.
4502 (insert_capture_proxy): Don't set DECL_CAPTURED_VARIABLE from a
4503 COMPONENT_REF.
4504 * expr.c (mark_use): Use is_capture_proxy_with_ref.
4505 * constexpr.c (potential_constant_expression_1): Likewise.
4506 * semantics.c (process_outer_var_ref): Likewise.
4507
4508 2018-02-01 Marek Polacek <polacek@redhat.com>
4509
4510 PR c++/84125
4511 * typeck.c (build_address): Relax the assert when
4512 processing_template_decl.
4513
4514 2018-02-01 Jason Merrill <jason@redhat.com>
4515
4516 PR c++/84126 - ICE with variadic generic lambda
4517 PR c++/84036
4518 PR c++/82249
4519 * pt.c (tsubst_pack_expansion): Handle function parameter_packs in
4520 PACK_EXPANSION_EXTRA_ARGS.
4521
4522 2018-02-01 Paolo Carlini <paolo.carlini@oracle.com>
4523
4524 PR c++/83796
4525 * call.c (convert_like_real): If w're initializing from {} explicitly
4526 call abstract_virtuals_error_sfinae.
4527
4528 2018-01-31 Jason Merrill <jason@redhat.com>
4529 Jakub Jelinek <jakub@redhat.com>
4530
4531 PR c++/83993
4532 * constexpr.c (cxx_eval_outermost_constant_expr): Build NOP_EXPR
4533 around non-constant ADDR_EXPRs rather than clearing TREE_CONSTANT
4534 on ADDR_EXPR.
4535
4536 2018-01-31 Jakub Jelinek <jakub@redhat.com>
4537
4538 PR c++/83993
4539 * constexpr.c (diag_array_subscript): Emit different diagnostics
4540 if TYPE_DOMAIN (arraytype) is NULL.
4541 (cxx_eval_array_reference, cxx_eval_store_expression): For arrays
4542 with NULL TYPE_DOMAIN use size_zero_node as nelts.
4543
4544 2018-01-31 Paolo Carlini <paolo.carlini@oracle.com>
4545
4546 PR c++/84092
4547 * semantics.c (finish_qualified_id_expr): When handling an
4548 UNBOUND_CLASS_TEMPLATE only adjust qualifying_class and expr.
4549
4550 2018-01-31 Marek Polacek <polacek@redhat.com>
4551
4552 PR c++/84138
4553 * cp-gimplify.c (cp_fold): Check if X is an error node before
4554 calling useless_type_conversion_p.
4555
4556 2018-01-30 Jason Merrill <jason@redhat.com>
4557
4558 PR c++/84091 - ICE with local class in lambda in template.
4559 * decl2.c (determine_visibility): Look for outer containing template
4560 instantiation.
4561
4562 PR c++/84098 - ICE with lambda in template NSDMI.
4563 * pt.c (instantiate_class_template_1): Ignore more lambdas.
4564
4565 2018-01-29 Jason Merrill <jason@redhat.com>
4566
4567 PR c++/68810 - wrong location for reinterpret_cast error.
4568 * cvt.c (cp_convert_to_pointer): Always build a CONVERT_EXPR when
4569 !dofold.
4570
4571 2018-01-29 Marek Polacek <polacek@redhat.com>
4572
4573 PR c++/83996
4574 * constexpr.c (cxx_fold_indirect_ref): Compute ((foo *)&fooarray)[1]
4575 => fooarray[1] in offset_int.
4576
4577 2018-01-29 Jason Merrill <jason@redhat.com>
4578
4579 PR c++/83942 - wrong unused warning with static_cast.
4580 * cvt.c (ocp_convert): Call mark_rvalue_use.
4581
4582 2018-01-26 Jason Merrill <jason@redhat.com>
4583
4584 PR c++/83956 - wrong dtor error with anonymous union
4585 * method.c (walk_field_subobs): Variant members only affect
4586 deletedness.
4587 (maybe_explain_implicit_delete): Pass &deleted_p for diagnostic.
4588
4589 PR c++/84036 - ICE with variadic capture.
4590 PR c++/82249
4591 * pt.c (tsubst_pack_expansion): When optimizing a simple
4592 substitution, pull a single pack expansion out of its pack.
4593
4594 PR c++/82514 - ICE with local class in generic lambda.
4595 * pt.c (regenerated_lambda_fn_p): Remove.
4596 (enclosing_instantiation_of): Don't use it.
4597 (tsubst_function_decl): Call enclosing_instantiation_of.
4598
4599 * pt.c (lookup_template_class_1): Add sanity check.
4600 * name-lookup.c (do_pushtag): Don't add closures to local_classes.
4601
4602 2018-01-25 Jakub Jelinek <jakub@redhat.com>
4603
4604 PR c++/84031
4605 * decl.c (find_decomp_class_base): Ignore unnamed bitfields. Ignore
4606 recursive calls that return ret.
4607 (cp_finish_decomp): Ignore unnamed bitfields.
4608
4609 2018-01-23 Jason Merrill <jason@redhat.com>
4610
4611 PR c++/82249 - wrong mismatched pack length error.
4612 * pt.c (extract_fnparm_pack, tsubst_pack_expansion): Handle
4613 unsubstituted function parameter pack.
4614
4615 2018-01-23 Paolo Carlini <paolo.carlini@oracle.com>
4616
4617 PR c++/83921
4618 * decl.c (check_for_uninitialized_const_var): Not static; add
4619 bool and tsubst_flags_t parameters; adjust to be used both in
4620 constexpr context and not.
4621 * constexpr.c (potential_constant_expression_1): Use the above.
4622 * cp-tree.h (check_for_uninitialized_const_var): Declare.
4623
4624 2018-01-23 Jason Merrill <jason@redhat.com>
4625
4626 PR c++/83947 - ICE with auto declarations.
4627 * pt.c (do_auto_deduction): Don't deduce from an auto decl.
4628 * decl.c (undeduced_auto_decl): Limit to vars and fns.
4629
4630 2018-01-23 David Malcolm <dmalcolm@redhat.com>
4631
4632 PR c++/83974
4633 * pt.c (tsubst_copy_and_build) <CONSTRUCTOR>: Remove early bailout
4634 for pointer to member function types.
4635
4636 2018-01-23 Jakub Jelinek <jakub@redhat.com>
4637
4638 PR sanitizer/83987
4639 * tree.c (cp_free_lang_data): Change DECL_VALUE_EXPR of
4640 DECL_OMP_PRIVATIZED_MEMBER vars to error_mark_node.
4641
4642 2018-01-23 Nathan Sidwell <nathan@acm.org>
4643
4644 PR c++/83988
4645 * pt.c (tsubst_baselink): Remove optype assert.
4646 * ptree.c (cxx_print_xnode): <case BASELINK> Print BASELINK_OPTYPE.
4647
4648 2018-01-23 Jakub Jelinek <jakub@redhat.com>
4649
4650 PR c++/83958
4651 * decl.c (cp_finish_decomp): Diagnose if reference structure binding
4652 refers to incomplete type.
4653
4654 2018-01-23 Nathan Sidwell <nathan@acm.org>
4655
4656 Deprecate ARM-era for scope handling
4657 * decl.c (poplevel): Flag_new_for_scope is a boolean-like.
4658 (cxx_init_decl_processing): Deprecate flag_new_for_scope being
4659 cleared.
4660 * name-lookup.c (check_for_out_of_scope_variable): Deprecate and
4661 cleanup handling.
4662 * semantics.c (begin_for_scope): Flag_new_for_scope is
4663 boolean-like.
4664 (finish_for_stmt, begin_range_for_stmt): Likewise.
4665
4666 2018-01-22 Jason Merrill <jason@redhat.com>
4667
4668 PR c++/83720
4669 * decl2.c (determine_visibility): Fix template_decl handling
4670 instead of blocking it.
4671
4672 PR c++/83720 - ICE with lambda and LTO.
4673 * decl2.c (determine_visibility): Clear template_decl for
4674 function-scope decls. Propagate anonymous linkage from containing
4675 function.
4676
4677 2018-01-22 Marek Polacek <polacek@redhat.com>
4678
4679 PR c++/81933
4680 * typeck2.c (split_nonconstant_init_1): Return false if we didn't
4681 split out anything.
4682
4683 2018-01-22 Ville Voutilainen <ville.voutilainen@gmail.com>
4684
4685 PR c++/83895
4686 * decl.c (grokdeclarator): Don't diagnose extra parens
4687 on typedefs.
4688
4689 2018-01-19 Jakub Jelinek <jakub@redhat.com>
4690
4691 PR c++/81167
4692 * call.c (joust): Use TREE_TYPE (source) if source is
4693 a POINTER_TYPE_P rather than if ! DECL_CONSTRUCTOR_P (w->fn).
4694
4695 PR c++/83919
4696 * typeck.c (convert_for_assignment): Suppress warn_ignored_qualifiers
4697 for direct enum init.
4698 * decl.c (reshape_init): Likewise.
4699
4700 2018-01-19 Marek Polacek <polacek@redhat.com>
4701
4702 * constexpr.c (fold_simple): Simplify.
4703
4704 2018-01-18 Jason Merrill <jason@redhat.com>
4705
4706 PR c++/83714
4707 * search.c (any_dependent_bases_p): Handle null TREE_BINFO.
4708 * pt.c (instantiation_dependent_scope_ref_p): True if
4709 any_dependent_bases_p.
4710
4711 2018-01-18 Paolo Carlini <paolo.carlini@oracle.com>
4712
4713 * cp-tree.h: Fix comment typo (DECL_NON_TRIVIALLY_INITIALIZED_P
4714 vs DECL_NONTRIVIALLY_INITIALIZED_P).
4715
4716 2018-01-18 Jason Merrill <jason@redhat.com>
4717
4718 PR c++/82461 - constexpr list-initialized member
4719 * constexpr.c (potential_constant_expression_1): Check
4720 TARGET_EXPR_DIRECT_INIT_P.
4721
4722 2018-01-18 Paolo Carlini <paolo.carlini@oracle.com>
4723
4724 PR c++/81013
4725 * decl.c (xref_basetypes): Early return upon error about derived
4726 union.
4727
4728 2018-01-18 Nathan Sidwell <nathan@acm.org>
4729
4730 PR c++/83160
4731 * cp-tree.h (mark_use): Declare.
4732 * expr.c (mark_use): Make extern.
4733 * call.c (direct_reference_binding): Set inner conv's
4734 rvaluedness_matches_p, if it is an identity.
4735 (convert_like_real): Mark lvalue or rvalue use for identity as
4736 rvaledness_matches_p demands.
4737
4738 2018-01-18 Jakub Jelinek <jakub@redhat.com>
4739
4740 PR c++/83824
4741 * parser.c (attr_chainon): New function.
4742 (cp_parser_label_for_labeled_statement, cp_parser_decl_specifier_seq,
4743 cp_parser_namespace_definition, cp_parser_init_declarator,
4744 cp_parser_type_specifier_seq, cp_parser_parameter_declaration,
4745 cp_parser_gnu_attributes_opt): Use it.
4746 (cp_parser_member_declaration, cp_parser_objc_class_ivars,
4747 cp_parser_objc_struct_declaration): Likewise. Don't reset
4748 prefix_attributes if attributes is error_mark_node.
4749
4750 2018-01-17 Paolo Carlini <paolo.carlini@oracle.com>
4751
4752 PR c++/78344
4753 * decl.c (grokdeclarator): Do not append the error_mark_node
4754 due to an erroneous optional attribute-specifier-seq.
4755
4756 2018-01-17 Jakub Jelinek <jakub@redhat.com>
4757
4758 PR c++/83897
4759 * cp-gimplify.c (cp_maybe_instrument_return): Handle
4760 CLEANUP_POINT_EXPR.
4761
4762 2018-01-17 Paolo Carlini <paolo.carlini@oracle.com>
4763
4764 PR c++/81054
4765 * constexpr.c (ensure_literal_type_for_constexpr_object): Return
4766 error_mark_node when we give an error.
4767 * decl.c (cp_finish_decl): Use the latter.
4768
4769 2018-01-17 Nathan Sidwell <nathan@acm.org>
4770
4771 PR c++/83287
4772 * init.c (build_raw_new_expr): Scan list for lookups to keep.
4773
4774 2018-01-17 David Malcolm <dmalcolm@redhat.com>
4775
4776 PR c++/83814
4777 * expr.c (fold_for_warn): Move from c-common.c, reducing to just
4778 the C++ part. If processing a template, call
4779 fold_non_dependent_expr rather than fully folding.
4780
4781 2018-01-17 Jason Merrill <jason@redhat.com>
4782
4783 PR c++/81067 - redundant NULL warning.
4784 * call.c (convert_like_real): Restore null_node handling.
4785
4786 2018-01-17 Jason Merrill <jason@redhat.com>
4787
4788 PR c++/81843 - ICE with variadic member template.
4789 PR c++/72801
4790 * pt.c (unify_pack_expansion): Don't try to deduce enclosing
4791 template args.
4792
4793 2018-01-17 David Malcolm <dmalcolm@redhat.com>
4794
4795 PR c++/83799
4796 * pt.c (type_dependent_expression_p): Strip any location wrapper
4797 before testing tree codes.
4798 (selftest::test_type_dependent_expression_p): New function.
4799 (selftest::cp_pt_c_tests): Call it.
4800
4801 2018-01-17 Nathan Sidwell <nathan@acm.org>
4802
4803 PR c++/83739
4804 * pt.c (tsubst_expr) <case RANGE_FOR_STMT>: Rebuild a range_for if
4805 this not a final instantiation.
4806
4807 2018-01-16 Jason Merrill <jason@redhat.com>
4808
4809 PR c++/83714 - ICE checking return in template.
4810 * typeck.c (check_return_expr): Call build_non_dependent_expr.
4811
4812 2018-01-16 Jakub Jelinek <jakub@redhat.com>
4813
4814 PR c++/83817
4815 * pt.c (tsubst_copy_and_build) <case CALL_EXPR>: If function
4816 is AGGR_INIT_EXPR rather than CALL_EXPR, set AGGR_INIT_FROM_THUNK_P
4817 instead of CALL_FROM_THUNK_P.
4818
4819 PR c++/83825
4820 * name-lookup.c (member_vec_dedup): Return early if len is 0.
4821 (resort_type_member_vec, set_class_bindings,
4822 insert_late_enum_def_bindings): Use vec qsort method instead of
4823 calling qsort directly.
4824
4825 2018-01-15 Martin Sebor <msebor@redhat.com>
4826
4827 PR c++/83588
4828 * class.c (find_flexarrays): Make a record of multiple flexible array
4829 members.
4830
4831 2018-01-12 Jason Merrill <jason@redhat.com>
4832
4833 PR c++/83186 - ICE with static_cast of list-initialized temporary.
4834 * typeck.c (build_static_cast): Use build_non_dependent_expr.
4835
4836 2018-01-12 Nathan Sidwell <nathan@acm.org>
4837
4838 * cp-tree.h (mark_rvalue_use): Add parm name.
4839 * expr.c (mark_lvalue_use, mark_lvalue_use_nonread): Move next to
4840 mark_rvalue_use.
4841 * call.c (convert_like_real): Fix formatting.
4842
4843 2018-01-11 Jason Merrill <jason@redhat.com>
4844
4845 PR c++/82728 - wrong -Wunused-but-set-variable
4846 PR c++/82799
4847 PR c++/83690
4848 * call.c (perform_implicit_conversion_flags): Call mark_rvalue_use.
4849 * decl.c (case_conversion): Likewise.
4850 * semantics.c (finish_static_assert): Call
4851 perform_implicit_conversion_flags.
4852
4853 2018-01-11 Nathan Sidwell <nathan@acm.org>
4854
4855 * method.c (enum mangling_flags): Delete long-dead enum.
4856
4857 2018-01-10 Paolo Carlini <paolo.carlini@oracle.com>
4858
4859 * parser.c (cp_parser_std_attribute_spec): When
4860 token_pair::require_open / require_close return false simply
4861 return error_mark_node, avoid duplicate cp_parser_error about
4862 expected '(' / ')', respectively.
4863
4864 2018-01-10 David Malcolm <dmalcolm@redhat.com>
4865
4866 PR c++/43486
4867 * call.c (null_ptr_cst_p): Strip location wrappers when
4868 converting from '0' to a pointer type in C++11 onwards.
4869 (conversion_null_warnings): Replace comparison with null_node with
4870 call to null_node_p.
4871 (build_over_call): Likewise.
4872 * cp-gimplify.c (cp_fold): Remove the early bailout when
4873 processing_template_decl.
4874 * cp-lang.c (selftest::run_cp_tests): Call
4875 selftest::cp_pt_c_tests and selftest::cp_tree_c_tests.
4876 * cp-tree.h (cp_expr::maybe_add_location_wrapper): New method.
4877 (selftest::run_cp_tests): Move decl to bottom of file.
4878 (null_node_p): New inline function.
4879 (selftest::cp_pt_c_tests): New decl.
4880 (selftest::cp_tree_c_tests): New decl.
4881 * cvt.c (build_expr_type_conversion): Replace comparison with
4882 null_node with call to null_node_p.
4883 * error.c (args_to_string): Likewise.
4884 * except.c (build_throw): Likewise.
4885 * mangle.c (write_expression): Skip location wrapper nodes.
4886 * parser.c (literal_integer_zerop): New function.
4887 (cp_parser_postfix_expression): Call maybe_add_location_wrapper on
4888 the result for RID_TYPEID. Pass true for new "wrap_locations_p"
4889 param of cp_parser_parenthesized_expression_list. When calling
4890 warn_for_memset, replace integer_zerop calls with
4891 literal_integer_zerop, eliminating the double logical negation
4892 cast to bool. Eliminate the special-casing for CONST_DECL in
4893 favor of the fold_for_warn within warn_for_memset.
4894 (cp_parser_parenthesized_expression_list): Add "wrap_locations_p"
4895 param, defaulting to false. Convert "expr" to a cp_expr, and call
4896 maybe_add_location_wrapper on it when wrap_locations_p is true.
4897 (cp_parser_unary_expression): Call maybe_add_location_wrapper on
4898 the result for RID_ALIGNOF and RID_SIZEOF.
4899 (cp_parser_builtin_offsetof): Likewise.
4900 * pt.c: Include "selftest.h".
4901 (tsubst_copy): Handle location wrappers.
4902 (tsubst_copy_and_build): Likewise.
4903 (build_non_dependent_expr): Likewise.
4904 (selftest::test_build_non_dependent_expr): New function.
4905 (selftest::cp_pt_c_tests): New function.
4906 * tree.c: Include "selftest.h".
4907 (lvalue_kind): Handle VIEW_CONVERT_EXPR location wrapper nodes.
4908 (selftest::test_lvalue_kind): New function.
4909 (selftest::cp_tree_c_tests): New function.
4910 * typeck.c (string_conv_p): Strip any location wrapper from "exp".
4911 (cp_build_binary_op): Replace comparison with null_node with call
4912 to null_node_p.
4913 (build_address): Use location of operand when building address
4914 expression.
4915
4916 2018-01-10 Marek Polacek <polacek@redhat.com>
4917
4918 PR c++/82541
4919 * call.c (build_conditional_expr_1): Check complain before warning.
4920 * pt.c (tsubst_copy_and_build) <case COND_EXPR>: Suppress
4921 -Wduplicated-branches.
4922
4923 2018-01-10 Jakub Jelinek <jakub@redhat.com>
4924
4925 PR c++/81327
4926 * call.c (maybe_warn_class_memaccess): Add forward declaration.
4927 Change last argument from tree * to const vec<tree, va_gc> *, adjust
4928 args uses and check number of operands too. Don't strip away any
4929 nops. Use maybe_constant_value when looking for INTEGER_CST args.
4930 Deal with src argument not having pointer type. Check
4931 tree_fits_uhwi_p before calling tree_to_uhwi. Remove useless
4932 test.
4933 (build_over_call): Call maybe_warn_class_memaccess here on the
4934 original arguments.
4935 (build_cxx_call): Rather than here on converted arguments.
4936
4937 2018-01-10 Paolo Carlini <paolo.carlini@oracle.com>
4938
4939 PR c++/81055
4940 * init.c (build_vec_init): Avoid building an INIT_EXPR with
4941 error_mark_node as second argument.
4942
4943 2018-01-09 Jakub Jelinek <jakub@redhat.com>
4944
4945 PR c++/83734
4946 * constexpr.c (cxx_eval_statement_list): Ignore DEBUG_BEGIN_STMTs
4947 in STATEMENT_LIST. Remove unneeded assert.
4948
4949 2018-01-03 Richard Sandiford <richard.sandiford@linaro.org>
4950 Alan Hayward <alan.hayward@arm.com>
4951 David Sherwood <david.sherwood@arm.com>
4952
4953 * constexpr.c (cxx_eval_array_reference): Handle polynomial
4954 VECTOR_CST_NELTS.
4955 (cxx_fold_indirect_ref): Handle polynomial TYPE_VECTOR_SUBPARTS.
4956 * call.c (build_conditional_expr_1): Likewise.
4957 * decl.c (cp_finish_decomp): Likewise.
4958 * mangle.c (write_type): Likewise.
4959 * typeck.c (structural_comptypes): Likewise.
4960 (cp_build_binary_op): Likewise.
4961 * typeck2.c (process_init_constructor_array): Likewise.
4962
4963 2018-01-03 Jakub Jelinek <jakub@redhat.com>
4964
4965 PR c++/83555
4966 * typeck.c (build_static_cast_1): For static casts to reference types,
4967 call build_base_path with flag_delete_null_pointer_checks as nonnull
4968 instead of always false. When -fsanitize=null, call
4969 ubsan_maybe_instrument_reference on the NULL reference INTEGER_CST.
4970 * cp-gimplify.c (cp_genericize_r): Don't walk subtrees of UBSAN_NULL
4971 call if the first argument is INTEGER_CST with REFERENCE_TYPE.
4972
4973 2018-01-03 Nathan Sidwell <nathan@acm.org>
4974
4975 PR c++/83667
4976 * method.c (make_alias_for): Copy DECL_CONTEXT.
4977
4978 2018-01-03 Marek Polacek <polacek@redhat.com>
4979
4980 PR c++/83592
4981 * decl.c (grokdeclarator): Don't warn about MVP in typename context.
4982
4983 2018-01-03 Jakub Jelinek <jakub@redhat.com>
4984
4985 PR preprocessor/83602
4986 * name-lookup.c (lookup_name_fuzzy): Don't use macro_use_before_def
4987 for builtin macros.
4988
4989 PR c++/83634
4990 * cp-gimplify.c (cp_fold) <case NOP_EXPR>: If the operand folds to
4991 error_mark_node, return error_mark_node.
4992
4993 Update copyright years.
4994
4995 2018-01-02 Jakub Jelinek <jakub@redhat.com>
4996
4997 PR c++/83556
4998 * tree.c (replace_placeholders_r): Pass NULL as last argument to
4999 cp_walk_tree instead of d->pset. If non-TREE_CONSTANT and
5000 non-PLACEHOLDER_EXPR tree has been seen already, set *walk_subtrees
5001 to false and return.
5002 (replace_placeholders): Pass NULL instead of &pset as last argument
5003 to cp_walk_tree.
5004
5005 2018-01-02 Nathan Sidwell <nathan@acm.org>
5006
5007 * constexpr.c (cxx_bind_parameters_in_call): Remove unneeded local
5008 lval var.
5009 \f
5010 Copyright (C) 2018 Free Software Foundation, Inc.
5011
5012 Copying and distribution of this file, with or without modification,
5013 are permitted in any medium without royalty provided the copyright
5014 notice and this notice are preserved.