1 2018-12-04 Paolo Carlini <paolo.carlini@oracle.com>
4 * decl.c (grokdeclarator): Avoid crashing on an anonymous bit-field
7 2018-12-04 Marek Polacek <polacek@redhat.com>
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.
13 2018-12-04 Julian Brown <julian@codesourcery.com>
15 * parser.c (cp_parser_oacc_wait_list): Fix error message and avoid
18 2018-12-04 Jakub Jelinek <jakub@redhat.com>
21 * typeck.c (build_class_member_access_expr): If unary_complex_lvalue
22 turned xvalue_p into non-xvalue_p, call move on it.
24 2018-12-02 Jakub Jelinek <jakub@redhat.com>
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.
35 2018-12-01 Marek Polacek <polacek@redhat.com>
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
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
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
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
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
68 (cp_parser_init_declarator): New parameter. Pass it down to
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
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
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.
116 2018-11-30 David Malcolm <dmalcolm@redhat.com>
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
123 2018-11-30 James Norris <jnorris@codesourcery.com>
125 * parser.c (cp_parser_oacc_enter_exit_data): Use existing local
128 2018-11-29 Paolo Carlini <paolo.carlini@oracle.com>
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.
135 2018-11-29 David Malcolm <dmalcolm@redhat.com>
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
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
150 (suggest_alternative_in_scoped_enum): New function.
152 2018-11-28 Marek Polacek <polacek@redhat.com>
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.
159 2018-11-28 Nathan Sidwell <nathan@acm.org>
162 * class.c (finish_struct): In a template, add artificial using
165 2018-11-28 Jan Hubicka <hubicka@ucw.cz>
167 * except.c (do_allocate_exception): Annotate __cxa_allocate_exception
170 2018-11-28 Marek Polacek <polacek@redhat.com>
172 PR c++/88222 - ICE with bit-field with invalid type.
173 * decl.c (grokdeclarator): Check if declarator is null.
175 2018-11-28 Jakub Jelinek <jakub@redhat.com>
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.
182 2018-11-27 Jakub Jelinek <jakub@redhat.com>
185 * decl.c (grokdeclarator): Don't diagnose deduction guide errors
189 * class.c (fixup_attribute_variants): Also propagate TYPE_PACKED
192 2018-11-26 Marek Polacek <polacek@redhat.com>
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
198 2018-11-22 Jakub Jelinek <jakub@redhat.com>
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.
204 2018-11-21 Jakub Jelinek <jakub@redhat.com>
207 * method.c (maybe_explain_implicit_delete): If
208 FUNCTION_FIRST_USER_PARMTYPE (decl) is NULL, set const_p to false
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.
223 * parser.c (cp_parser_linkage_specification): Remove useless
224 dereference of the consume_open method result.
226 2018-11-20 Martin Sebor <msebor@redhat.com>
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.
234 2018-11-20 Jakub Jelinek <jakub@redhat.com>
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.
240 2018-11-19 Marek Polacek <polacek@redhat.com>
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.
246 2018-11-18 Paolo Carlini <paolo.carlini@oracle.com>
248 * decl2.c (grokfield): Remove obsolete _vptr check; fix
249 explicit template argument list error location.
251 2018-11-16 Kamlesh Kumar <kamleshbhalui@gmail.com>
255 * parser.c (cp_parser_noexcept_specification_opt): Call
256 inject_this_parameter.
258 2018-11-16 Jason Merrill <jason@redhat.com>
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.
273 2018-11-16 Nathan Sidwell <nathan@acm.org>
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.
290 * parser.c (lookup_literal_operator): Mark overload for keeping
291 when inside template. Refactor.
293 2018-11-15 Nathan Sidwell <nathan@acm.org>
297 * typeck.c (finish_class_member_access_expr): Conversion operator
298 to dependent type is dependent.
300 2018-11-15 Paolo Carlini <paolo.carlini@oracle.com>
302 * constexpr.c (ensure_literal_type_for_constexpr_object): Use
303 DECL_SOURCE_LOCATION in error_at calls.
305 2018-11-15 Nathan Sidwell <nathan@acm.org>
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.
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
327 2018-11-14 Paolo Carlini <paolo.carlini@oracle.com>
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
339 2018-11-14 Jakub Jelinek <jakub@redhat.com>
341 P1236R1 - Signed integers are two's complement
342 * constexpr.c (cxx_eval_check_shift_p): Disable the signed LSHIFT_EXPR
345 2018-11-13 David Malcolm <dmalcolm@redhat.com>
347 * call.c: Replace "source_location" with "location_t".
348 * cp-tree.h: Likewise.
350 * name-lookup.c: Likewise.
351 * parser.c: Likewise.
352 * typeck.c: Likewise.
354 2018-11-12 Jason Merrill <jason@redhat.com>
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
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.
371 * pt.c (fn_type_unification): If we have a full set of explicit
372 arguments, go straight to substitution.
374 * decl2.c (min_vis_expr_r, expr_visibility): New.
375 (min_vis_r): Call expr_visibility.
376 (constrain_visibility_for_template): Likewise.
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
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.
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
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.
400 2018-11-09 Jakub Jelinek <jakub@redhat.com>
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.
411 * parser.c (cp_parser_omp_clause_reduction): Call sorry_at on
412 reduction clause with inscan modifier.
414 * parser.c (cp_parser_omp_requires): Call sorry_at on requires
415 clauses other than atomic_default_mem_order.
417 2018-11-09 Martin Sebor <msebor@redhat.com>
420 * pt.c (warn_spec_missing_attributes): Move code to attribs.c.
421 Call decls_mismatched_attributes.
423 2018-11-08 Jakub Jelinek <jakub@redhat.com>
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
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
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
449 (cp_parser_range_for): Add IS_OMP argument, return before finalizing
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
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
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
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
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
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
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
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
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
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
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
587 2018-11-07 Nathan Sidwell <nathan@acm.org>
590 * cp-tree.h (struct tree_overload): Fix comment.
591 * tree.c (ovl_iterator::reveal_node): Propagate OVL_DEDUP_P.
593 2018-11-04 Jason Merrill <jason@redhat.com>
595 Implement UDL changes from P0732R2.
596 * cp-tree.h (struct releasing_vec): Move from mangle.c.
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.
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.
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.
621 PR c++/60503 - wrong lambda attribute syntax.
622 * parser.c (cp_parser_lambda_declarator_opt): Fix attribute
625 2018-11-02 Nathan Sidwell <nathan@acm.org>
627 * decl.c (duplicate_decls): Refactor checks.
629 2018-11-01 Marek Polacek <polacek@redhat.com>
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.
642 2018-11-01 Nathan Sidwell <nathan@acm.org>
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
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
670 * class.c (local_classes): Delete.
671 (init_class_processing): Don't init it.
673 2018-11-01 Martin Liska <mliska@suse.cz>
674 Jason Merrill <jason@redhat.com>
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.
683 * lambda.c (is_capture_proxy): Use DECL_FNAME_P.
684 * pt.c (tsubst_expr): Handle DECL_PRETTY_FUNCTION_P.
686 2018-10-31 Nathan Sidwell <nathan@acm.org>
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.
693 (ovl_insert): Do not keep using-decls ordered.
694 (lookup_maybe_add): Adjust comment.
696 2018-10-30 Marek Polacek <polacek@redhat.com>
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).
712 2018-10-30 Paolo Carlini <paolo.carlini@oracle.com>
714 * decl.c (grokdeclarator): Use declarator->id_loc in diagnostic
715 about flexible array members.
717 2018-10-29 David Malcolm <dmalcolm@redhat.com>
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
742 * name-lookup.c (class namespace_limit_reached): New subclass of
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
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
769 (class missing_std_header): New subclass of deferred_diagnostic.
770 (maybe_suggest_missing_header): Convert return type from bool to
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
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.
785 2018-10-29 David Malcolm <dmalcolm@redhat.com>
788 * call.c (build_over_call): Eliminate the "arglocs" array, and the
789 call to maybe_constant_value when building "fargs".
791 2018-10-29 Paolo Carlini <paolo.carlini@oracle.com>
793 * decl.c (create_array_type_for_decl): Add location_t parameter
795 (grokdeclarator): Adjust call.
797 2018-10-29 Marek Polacek <polacek@redhat.com>
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.
803 2018-10-29 Joseph Myers <joseph@codesourcery.com>
804 Julian Brown <julian@codesourcery.com>
807 * semantics.c (handle_omp_array_sections_1): Allow array
808 sections with "this" pointer for OpenACC.
810 2018-10-25 Jason Merrill <jason@redhat.com>
812 * parser.c (cp_parser_sizeof_operand): Remove redundant use of
815 2018-10-24 Jakub Jelinek <jakub@redhat.com>
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.
822 2018-10-24 Martin Sebor <msebor@redhat.com>
825 * call.c (maybe_warn_class_memaccess): Tighten up.
827 2018-10-17 David Malcolm <dmalcolm@redhat.com>
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
834 2018-10-17 Paolo Carlini <paolo.carlini@oracle.com>
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.
841 2018-10-12 Nathan Sidwell <nathan@acm.org>
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.
852 2018-10-11 Will Wray <wjwray@gmail.com>
855 * cxx-pretty-print.c (pp_cxx_enumeration_constant): New function.
856 (cxx_pretty_printer::constant): Use it.
858 2018-10-11 David Malcolm <dmalcolm@redhat.com>
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.
884 2018-10-11 Nathan Sidwell <nathan@acm.org>
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.
890 2018-10-11 Jakub Jelinek <jakub@redhat.com>
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.
898 * rtti.c (get_tinfo_decl_dynamic): Use unlowered_expr_type instead
901 2018-10-10 Marek Polacek <polacek@redhat.com>
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.
908 2018-10-09 Paolo Carlini <paolo.carlini@oracle.com>
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
922 2018-10-08 Paolo Carlini <paolo.carlini@oracle.com>
925 * pt.c (do_decl_instantiation): Per 12.6.8/5, a concept cannot be
926 explicitly instantiated.
928 2018-10-05 David Malcolm <dmalcolm@redhat.com>
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.
939 2018-10-04 Nathan Sidwell <nathan@acm.org>
941 * lang-specs.h: Use string contatenation, not line splicing.
943 2018-10-03 Jason Merrill <jason@redhat.com>
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
951 (layout_empty_base_or_field): Rename from layout_empty_base, handle
953 (build_base_field, record_subobject_offsets): Adjust.
955 2018-10-03 Martin Liska <mliska@suse.cz>
957 PR gcov-profile/86109
958 * parser.c (cp_parser_lambda_declarator_opt):
959 Set DECL_LAMBDA_FUNCTION for lambdas.
961 2018-10-02 Richard Biener <rguenther@suse.de>
963 * name-lookup.c (check_local_shadow): Do not test DECL_FROM_INLINE.
965 2018-09-28 Eric Botcazou <ebotcazou@adacore.com>
966 Pierre-Marie de Rodat <derodat@adacore.com>
968 * method.c (use_thunk): Adjust call to cgraph_node::create_thunk.
970 2018-09-28 Richard Biener <rguenther@suse.de>
972 * error.c (cp_print_error_function): Simplify by eliding
973 the BLOCK_ABSTRACT_ORIGIN chasing.
975 2018-09-27 Paolo Carlini <paolo.carlini@oracle.com>
978 * semantics.c (finish_unary_op_expr): Check return value of
979 build_x_unary_op for error_mark_node.
981 2018-09-25 Jakub Jelinek <jakub@redhat.com>
984 * constexpr.c (cxx_eval_constant_expression) <case OBJ_TYPE_REF>: Only
985 look through COMPONENT_REFs with DECL_FIELD_IS_BASE FIELD_DECLs.
987 2018-09-25 Martin Liska <mliska@suse.cz>
989 * name-lookup.c (namespace_scope_ht_size): Remove
991 * parser.c (cp_lexer_next_token_is_not_keyword): Likewise.
993 2018-09-24 Paolo Carlini <paolo.carlini@oracle.com>
996 * method.c (lazily_declare_fn): During error-recovery add_method
999 2018-09-21 Marek Polacek <polacek@redhat.com>
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.
1005 2018-09-20 Marek Polacek <polacek@redhat.com>
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
1012 2018-09-20 Allan Sandfeld Jensen <allan.jensen@qt.io>
1014 * g++spec.c (lang_specific_driver): Handle -r like -nostdlib.
1016 2018-09-20 Jason Merrill <jason@redhat.com>
1018 PR c++/87075 - ICE with constexpr array initialization.
1019 * constexpr.c (cxx_eval_vec_init_1): Handle trivial initialization.
1021 2018-09-19 Marek Polacek <polacek@redhat.com>
1023 Add -Wclass-conversion.
1024 * decl.c (grok_op_properties): Change a warning from -Wconversion to
1025 -Wclass-conversion. Make it print the types.
1027 2018-09-19 Paolo Carlini <paolo.carlini@oracle.com>
1030 * parser.c (cp_parser_initializer_list): Assign error_mark_node
1031 to the index upon error.
1033 2018-09-19 Marek Polacek <polacek@redhat.com>
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
1041 2018-09-18 Marek Polacek <polacek@redhat.com>
1043 P1064R0 - Allowing Virtual Function Calls in Constant Expressions
1044 * call.c (build_over_call): No longer check if we're outside a template
1046 * class.c (build_vtbl_initializer): Build vtable's constructor with
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.
1056 2018-09-18 Paolo Carlini <paolo.carlini@oracle.com>
1059 * cp-tree.h (NON_ERROR): New.
1060 * pt.c (auto_hash::hash): Use it.
1061 (do_auto_deduction): Likewise.
1063 2018-09-18 Nathan Sidwell <nathan@acm.org>
1066 * name-lookup.c (check_local_shadow): Ignore auto types.
1068 2018-09-17 David Malcolm <dmalcolm@redhat.com>
1070 * error.c (range_label_for_type_mismatch::get_text): Update for
1073 2018-09-13 Bernd Edlinger <bernd.edlinger@hotmail.de>
1075 * typeck2.c (digest_init_r): Fix overlength strings.
1077 2018-09-13 Ville Voutilainen <ville.voutilainen@gmail.com>
1080 * method.c (constructible_expr): We're in an unevaluated context
1081 in all cases, not just for class targets.
1083 2018-09-12 David Malcolm <dmalcolm@redhat.com>
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
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.
1111 2018-09-09 Cesar Philippidis <cesar@codesourcery.com>
1112 Julian Brown <julian@codesourcery.com>
1115 * semantics.c (finish_omp_clauses): Treat C++ references the same in
1118 2018-08-28 Martin Liska <mliska@suse.cz>
1120 * constexpr.c (cxx_eval_call_expression): Add quotes
1121 to -fconstexpr-depth=.
1123 2018-09-10 Marek Polacek <polacek@redhat.com>
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.
1129 2018-09-08 Marek Polacek <polacek@redhat.com>
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
1136 2018-09-08 Jason Merrill <jason@redhat.com>
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.
1143 2018-09-08 Marek Polacek <polacek@redhat.com>
1145 * cxx-pretty-print.c (cxx_pretty_printer::statement) <case
1146 RANGE_FOR_SMT>: Handle RANGE_FOR_INIT_STMT.
1148 2018-09-07 Marek Polacek <polacek@redhat.com>
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.
1163 2018-09-06 Bernd Edlinger <bernd.edlinger@hotmail.de>
1165 * decl.c (check_initializer): Call cp_complete_array_type.
1167 2018-09-05 Marek Polacek <polacek@redhat.com>
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.
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.
1179 2018-09-05 Pádraig Brady <p@draigbrady.com>
1182 * lambda.c (prune_lambda_captures): Protect against const_vars.get
1185 2018-09-04 Marek Polacek <polacek@redhat.com>
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
1191 (maybe_warn_pessimizing_move): Adjust treat_lvalue_as_rvalue_p call.
1192 (check_return_expr): Likewise.
1194 2018-09-03 Paolo Carlini <paolo.carlini@oracle.com>
1197 * constraint.cc (finish_shorthand_constraint): Early return if the
1198 constraint is erroneous.
1200 2018-09-02 Bernd Edlinger <bernd.edlinger@hotmail.de>
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.
1207 2018-08-31 Nathan Sidwell <nathan@acm.org>
1211 * name-lookup.c (name_lookup::search_namespace): Don't look at
1212 inlines when searching for NULL names.
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)'.
1219 2018-08-29 Jakub Jelinek <jakub@redhat.com>
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
1227 2018-08-29 Paolo Carlini <paolo.carlini@oracle.com>
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.
1235 2018-08-29 David Malcolm <dmalcolm@redhat.com>
1238 * call.c (print_conversion_rejection): Add "fn" param and use it
1239 for "no known conversion" messages to underline the pertinent
1241 (print_z_candidate): Supply "fn" to the new param above.
1243 2018-08-29 Jakub Jelinek <jakub@redhat.com>
1246 * pt.c (tsubst_expr) <case RANGE_FOR_STMT>: If
1247 processing_template_decl and decl is structured binding decl, call
1250 2018-08-28 Paolo Carlini <paolo.carlini@oracle.com>
1253 * decl.c (finish_case_label): If the type is erroneous early
1254 return error_mark_node.
1256 2018-08-27 David Malcolm <dmalcolm@redhat.com>
1259 * parser.c (cp_parser_diagnose_invalid_type_name): Add fix-it
1262 2018-08-27 Jakub Jelinek <jakub@redhat.com>
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
1275 2018-08-27 David Malcolm <dmalcolm@redhat.com>
1278 * decl.c (grokdeclarator): Update for conversion of show_caret_p
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
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.
1292 2018-08-27 Martin Liska <mliska@suse.cz>
1294 * call.c (build_call_a): Use new function
1295 fndecl_built_in_p and remove check for FUNCTION_DECL if
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.
1313 2018-08-26 Marek Polacek <polacek@redhat.com>
1316 * typeck.c (maybe_warn_pessimizing_move): Do nothing in a template.
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.
1323 2018-08-24 Marek Polacek <polacek@redhat.com>
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
1331 2018-08-21 Marek Polacek <polacek@redhat.com>
1334 * parser.c (cp_parser_lambda_introducer): Give error if a non-local
1335 lambda has a capture-default.
1337 2018-08-21 Paolo Carlini <paolo.carlini@oracle.com>
1339 * decl.c (check_static_variable_definition): Change to return void.
1341 2018-08-21 Marek Polacek <polacek@redhat.com>
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.
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.
1356 * cp-tree.h: Fix typo.
1358 2018-08-20 David Malcolm <dmalcolm@redhat.com>
1361 * call.c (build_user_type_conversion_1): Add auto_diagnostic_group
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.
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
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.
1428 2018-08-17 David Malcolm <dmalcolm@redhat.com>
1430 * typeck.c (string_conv_p): Extract location from EXP and use it
1431 in preference to input_location when issuing warnings.
1433 2018-08-15 David Malcolm <dmalcolm@redhat.com>
1435 * call.c: Include "gcc-rich-location.h".
1436 (convert_like_real): Add range label for "invalid conversion"
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.
1445 2018-08-15 Paolo Carlini <paolo.carlini@oracle.com>
1447 * decl.c (check_previous_goto_1): When decl_jump_unsafe returns 2
1448 emit an error instead of a permerror.
1450 2018-08-13 Marek Polacek <polacek@redhat.com>
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
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.
1466 2018-08-13 Martin Sebor <msebor@redhat.com>
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.
1474 2018-08-13 Marek Polacek <polacek@redhat.com>
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 [=].
1481 * decl.c (create_array_type_for_decl): Handle null name.
1483 2018-08-10 Jason Merrill <jason@redhat.com>
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.
1489 2018-08-08 Jakub Jelinek <jakub@redhat.com>
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
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
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.
1531 * pt.c (tsubst_expr): For structured bindings, call tsubst_decomp_names
1532 before tsubst_init, not after it.
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.
1540 2018-08-07 Paolo Carlini <paolo.carlini@oracle.com>
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.
1547 2018-08-07 Ville Voutilainen <ville.voutilainen@gmail.com>
1550 * name-lookup.c (check_local_shadow): Reject captures and parameters
1553 2018-08-06 Marek Polacek <polacek@redhat.com>
1556 * constexpr.c (cxx_eval_statement_list): Handle continue.
1558 2018-08-03 David Malcolm <dmalcolm@redhat.com>
1559 Jonathan Wakely <jwakely@redhat.com>
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.
1567 2018-08-03 Jason Merrill <jason@redhat.com>
1570 * class.c (build_base_path): Use currently_open_class.
1572 2018-08-02 David Malcolm <dmalcolm@redhat.com>
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
1579 2018-08-02 Richard Biener <rguenther@suse.de>
1582 * class.c (layout_class_type): Copy TYPE_TYPELESS_STORAGE
1583 to the CLASSTYPE_AS_BASE.
1585 2018-08-01 Martin Sebor <msebor@redhat.com>
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.
1591 2018-08-01 Paolo Carlini <paolo.carlini@oracle.com>
1594 * class.c (note_name_declared_in_class): Use location_of in permerror
1595 instead of DECL_SOURCE_LOCATION (for OVERLOADs).
1597 2018-07-31 Tom de Vries <tdevries@suse.de>
1600 * optimize.c (update_cloned_parm): Copy DECL_BY_REFERENCE.
1602 2018-07-31 Jakub Jelinek <jakub@redhat.com>
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.
1609 2018-07-31 Martin Liska <mliska@suse.cz>
1612 * parser.c (cp_parser_condition): Initialize non_constant_p
1615 2018-07-28 David Malcolm <dmalcolm@redhat.com>
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.
1622 2018-07-25 Jakub Jelinek <jakub@redhat.com>
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
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").
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):
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}".
1668 2018-07-23 Jakub Jelinek <jakub@redhat.com>
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.
1675 2018-07-19 Paolo Carlini <paolo.carlini@oracle.com>
1677 Revert fix for c++/59480 (and testsuite followup)
1679 2019-07-18 Paolo Carlini <paolo.carlini@oracle.com>
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.
1686 2018-07-18 Jakub Jelinek <jakub@redhat.com>
1689 * parser.c (cp_parser_decl_specifier_seq): Diagnose invalid type
1690 specifier if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR.
1692 2018-07-18 Marek Polacek <polacek@redhat.com>
1694 PR c++/86190 - bogus -Wsign-conversion warning
1695 * typeck.c (cp_build_binary_op): Fix formatting. Add a warning
1698 2018-07-18 Paolo Carlini <paolo.carlini@oracle.com>
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.
1705 2018-07-18 Paolo Carlini <paolo.carlini@oracle.com>
1707 * class.c (note_name_declared_in_class): Prefer permerror + inform
1708 to a pair of permerrors; use DECL_SOURCE_LOCATION.
1710 2018-07-18 Richard Biener <rguenther@suse.de>
1713 * decl2.c (c_parse_final_cleanups): Call write_out_vars before
1714 start_static_storage_duration_function sets current_function_decl.
1716 2018-07-17 Jason Merrill <jason@redhat.com>
1718 PR c++/86480 - nested variadic lambda and constexpr if.
1719 * pt.c (find_parameter_packs_r) [IF_STMT]: Don't walk into
1721 * tree.c (cp_walk_subtrees) [DECLTYPE_TYPE]: Set
1722 cp_unevaluated_operand.
1723 [ALIGNOF_EXPR] [SIZEOF_EXPR] [NOEXCEPT_EXPR]: Likewise.
1725 2018-07-16 Paolo Carlini <paolo.carlini@oracle.com>
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.
1731 2018-07-16 Jakub Jelinek <jakub@redhat.com>
1735 * cp-gimplify.c (cp_genericize_r): When using extern_decl_map, or
1736 in TREE_USED flag from stmt to h->to.
1738 2018-07-13 Nathan Sidwell <nathan@acm.org>
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 &
1746 2018-07-12 Jakub Jelinek <jakub@redhat.com>
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.
1755 2018-07-10 Jakub Jelinek <jakub@redhat.com>
1758 * cp-gimplify.c (cp_maybe_instrument_return): Skip trailing
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
1769 2018-07-09 Paolo Carlini <paolo.carlini@oracle.com>
1771 * decl.c (grokdeclarator): Use rich_location::add_range in three
1772 more places; include gcc-rich-location.h.
1774 2018-07-07 Aldy Hernandez <aldyh@redhat.com>
1776 * decl.c (build_enumerator): Change overflow type to overflow_type.
1777 * init.c (build_new_1): Same.
1779 2018-07-05 Nathan Sidwell <nathan@acm.org>
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.
1785 2018-07-04 Ville Voutilainen <ville.voutilainen@gmail.com>
1788 * method.c (is_trivially_xible): Return false
1789 if is_xible_helper returns a NULL_TREE.
1791 2018-07-03 Paolo Carlini <paolo.carlini@oracle.com>
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.
1800 2018-07-03 Marek Polacek <polacek@redhat.com>
1803 * typeck.c (cp_build_binary_op): Check c_inhibit_evaluation_warnings.
1805 2018-07-03 Jason Merrill <jason@redhat.com>
1807 PR c++/86378 - functional cast in noexcept-specifier.
1808 * tree.c (strip_typedefs_expr) [TREE_LIST]: Fix iteration.
1810 2018-07-02 Paolo Carlini <paolo.carlini@oracle.com>
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.
1815 2018-06-29 Marek Polacek <polacek@redhat.com>
1818 * tree.c (cp_save_expr): Don't call save_expr for TARGET_EXPRs.
1820 2018-06-28 David Malcolm <dmalcolm@redhat.com>
1822 * parser.c (cp_parser_error_1): After issuing a conflict marker
1823 error, consume tokens until the end of the source line.
1825 2018-06-28 Jason Merrill <jason@redhat.com>
1827 PR c++/86342 - -Wdeprecated-copy and system headers.
1828 * decl2.c (cp_warn_deprecated_use): Don't warn about declarations
1831 2018-06-27 David Malcolm <dmalcolm@redhat.com>
1834 * name-lookup.c (consider_binding_level): Filter out names that
1835 match anon_aggrname_p.
1837 2018-06-27 Jason Merrill <jason@redhat.com>
1839 * name-lookup.c (do_pushtag): If we skip a class level, also skip
1842 2018-06-26 Jason Merrill <jason@redhat.com>
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.
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.
1858 2018-06-26 Jakub Jelinek <jakub@redhat.com>
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> *&.
1864 2018-06-23 Paolo Carlini <paolo.carlini@oracle.com>
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.
1876 2018-06-22 Jason Merrill <jason@redhat.com>
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:
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.
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.
1895 2018-06-21 Jason Merrill <jason@redhat.com>
1897 * pt.c (tsubst) [TEMPLATE_TYPE_PARM]: Use TEMPLATE_PARM_DESCENDANTS.
1899 * name-lookup.c (do_push_to_top_level): Don't allocate
1901 (do_pop_from_top_level): Release current_lang_base.
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.
1909 2018-06-20 Nathan Sidwell <nathan@acm.org>
1912 * friend.c (add_friend): Keep lookup sets of tempate sets.
1914 2018-06-20 Paolo Carlini <paolo.carlini@oracle.com>
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.
1921 2018-06-20 Chung-Lin Tang <cltang@codesourcery.com>
1922 Thomas Schwinge <thomas@codesourcery.com>
1923 Cesar Philippidis <cesar@codesourcery.com>
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.
1945 2018-06-20 Marek Polacek <polacek@redhat.com>
1948 * constexpr.c (cxx_eval_constant_expression): Handle ABSU_EXPR.
1949 (fold_simple_1): Likewise.
1950 * error.c (dump_expr): Likewise.
1952 2018-06-20 Nathan Sidwell <nathan@acm.org>
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.
1974 2018-06-19 Jason Merrill <jason@redhat.com>
1976 * cp-tree.h (CONSTRUCTOR_NO_IMPLICIT_ZERO): Remove.
1977 * constexpr.c: Use CONSTRUCTOR_NO_CLEARING instead.
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.
1983 2018-06-18 Jason Merrill <jason@redhat.com>
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.
1991 * parser.c (cp_parser_lambda_expression): Use a range for
1992 LAMBDA_EXPR_LOCATION.
1994 PR c++/86200 - ICE with unexpanded pack in lambda parameter.
1995 * pt.c (find_parameter_packs_r) [LAMBDA_EXPR]: Also look into the
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.
2002 PR c++/86171 - ICE with recursive alias instantiation.
2003 * pt.c (tsubst_decl): Handle recursive alias instantiation.
2005 2018-06-18 Paolo Carlini <paolo.carlini@oracle.com>
2007 * decl.c (duplicate_decls): Consistently use DECL_SOURCE_LOCATION
2008 in errors about redefined default arguments; tidy.
2010 2018-06-16 Kugan Vivekanandarajah <kuganv@linaro.org>
2012 * constexpr.c (potential_constant_expression_1): Handle ABSU_EXPR.
2013 * cp-gimplify.c (cp_fold): Likewise.
2015 2018-06-15 Jason Merrill <jason@redhat.com>
2017 PR c++/86147 - wrong capture for template argument.
2018 * expr.c (mark_use): Look through NOP_EXPR.
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.
2024 * decl.c (start_enum): Do compare dependent underlying type.
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.
2032 * tree.c (maybe_warn_parm_abi): Inform the location of the class.
2034 2018-06-14 Marek Polacek <polacek@redhat.com>
2037 * decl2.c (cp_check_const_attributes): Skip trees that are not
2040 2018-06-14 Jakub Jelinek <jakub@redhat.com>
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
2047 2018-06-14 Paolo Carlini <paolo.carlini@oracle.com>
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]
2055 * decl2.c (finish_static_data_member_decl): Use DECL_SOURCE_LOCATION
2058 2018-06-13 Jason Merrill <jason@redhat.com>
2060 PR c++/86099 - ICE with trivial copy and non-trivial default ctor.
2061 * constexpr.c (instantiate_cx_fn_r): Don't synthesize trivial
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.
2069 2018-06-12 Jason Merrill <jason@redhat.com>
2071 PR c++/86098 - ICE with template placeholder for TTP.
2072 * typeck.c (structural_comptypes) [TEMPLATE_TYPE_PARM]: Check
2073 CLASS_PLACEHOLDER_TEMPLATE.
2075 2018-06-12 Paolo Carlini <paolo.carlini@oracle.com>
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.
2082 2018-06-12 Marek Polacek <polacek@redhat.com>
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.
2088 2018-06-11 Jason Merrill <jason@redhat.com>
2090 PR c++/85792 -Wctor-dtor-privacy and inherited constructor.
2091 * class.c (maybe_warn_about_overly_private_class): Handle inherited
2094 PR c++/85963 - -Wunused-but-set with ?: in template.
2095 * pt.c (tsubst_copy_and_build) [COND_EXPR]: Call mark_rvalue_use.
2097 2018-06-11 Paolo Carlini <paolo.carlini@oracle.com>
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.
2103 2018-06-05 Jason Merrill <jason@redhat.com>
2105 * constexpr.c (cxx_eval_binary_expression): Special case comparison
2106 of pointers to members of the same union.
2108 2018-06-11 Jason Merrill <jason@redhat.com>
2110 PR c++/86094 - wrong code with defaulted move ctor.
2111 * tree.c (type_has_nontrivial_copy_init): Fix move ctor handling.
2113 2018-06-10 Paolo Carlini <paolo.carlini@oracle.com>
2115 * decl.c (grokfndecl): Use the location_t argument in two more places.
2117 2018-06-06 Marek Polacek <polacek@redhat.com>
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.
2124 2018-06-06 Jason Merrill <jason@redhat.com>
2126 PR c++/86060 - ICE on range for with -std=c++98.
2127 * parser.c (cp_parser_init_statement): Don't clobber *decl after
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.
2136 2018-06-05 Marek Polacek <polacek@redhat.com>
2139 * tree.c (cp_tree_equal): Handle USING_DECL.
2141 2018-06-05 Jason Merrill <jason@redhat.com>
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.
2147 2018-06-04 Jason Merrill <jason@redhat.com>
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.
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.
2159 2018-06-03 Jason Merrill <jason@redhat.com>
2161 PR c++/85739 - ICE with pointer to member template parm.
2162 * cvt.c (perform_qualification_conversions): Use cp_fold_convert.
2164 2018-06-02 Jason Merrill <jason@redhat.com>
2166 PR c++/85761 - ICE with ill-formed use of const outer variable.
2167 * expr.c (mark_use): Handle location wrappers.
2169 2018-06-01 Jason Merrill <jason@redhat.com>
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.
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.
2179 PR c++/58281 - explicit instantiation of constexpr
2180 * pt.c (mark_decl_instantiated): Clear DECL_EXTERNAL.
2182 * pt.c (instantiate_decl): Any defaulted function is defined.
2184 2018-05-30 Jonathan Wakely <jwakely@redhat.com>
2187 * call.c (resolve_args): Use location of expression, not current input
2190 2018-05-30 Ville Voutilainen <ville.voutilainen@gmail.com>
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
2199 2018-05-30 Jason Merrill <jason@redhat.com>
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.
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.
2209 * parser.c (cp_parser_check_condition_declarator): Handle
2210 cp_error_declarator.
2212 2018-05-30 Jonathan Wakely <jwakely@redhat.com>
2214 * typeck.c (cxx_sizeof_or_alignof_type): Return size_one_node instead
2215 of using it in dead store.
2217 2018-05-29 Jason Merrill <jason@redhat.com>
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
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.
2231 2018-05-29 Marek Polacek <polacek@redhat.com>
2234 * init.c (build_new): Handle deducing a class with new
2235 with more than one argument.
2237 2018-05-29 Jakub Jelinek <jakub@redhat.com>
2240 * init.c (build_aggr_init): For structured binding initialized from
2241 array call mark_rvalue_use on the initializer.
2243 2018-05-28 Bernd Edlinger <bernd.edlinger@hotmail.de>
2245 * decl2.c (start_static_storage_duration_function): Use
2246 splay_tree_delete_pointers.
2248 2018-05-25 Jason Merrill <jason@redhat.com>
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.
2255 CWG 616, 1213 - value category of subobject references.
2256 * tree.c (lvalue_kind): Fix handling of ARRAY_REF of pointer.
2258 2018-05-24 Jason Merrill <jason@redhat.com>
2260 PR c++/85842 - -Wreturn-type, constexpr if and generic lambda.
2261 * pt.c (tsubst_lambda_expr): Copy current_function_returns_* to
2264 2018-05-24 Ville Voutilainen <ville.voutilainen@gmail.com>
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.
2270 2018-05-24 Paolo Carlini <paolo.carlini@oracle.com>
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):
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):
2307 2018-05-24 Jason Merrill <jason@redhat.com>
2309 PR c++/85864 - literal template and default template arg.
2310 * pt.c (instantiation_dependent_r): Handle NONTYPE_ARGUMENT_PACK.
2312 2018-05-24 Marek Polacek <polacek@redhat.com>
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.
2319 2018-05-23 Jason Merrill <jason@redhat.com>
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
2327 * semantics.c (finish_compound_literal): Do direct-initialization,
2328 not cast, to initialize a reference.
2330 CWG 616, 1213 - value category of subobject references.
2331 * tree.c (lvalue_kind): A reference to a subobject of a prvalue is
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.
2337 2018-05-23 Marek Polacek <polacek@redhat.com>
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 ?:.
2345 2018-05-22 Jason Merrill <jason@redhat.com>
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.
2351 PR c++/85866 - error with .* in default template arg.
2352 * pt.c (tsubst_copy_and_build): Handle partial instantiation.
2354 2018-05-21 Paolo Carlini <paolo.carlini@oracle.com>
2356 * parser.c (cp_parser_parameter_declaration_list): Remove
2358 (cp_parser_parameter_declaration_clause): Adjust.
2359 (cp_parser_cache_defarg): Likewise.
2361 2018-05-21 Paolo Carlini <paolo.carlini@oracle.com>
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.
2371 2018-05-20 Jason Merrill <jason@redhat.com>
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.
2377 2018-05-19 Jason Merrill <jason@redhat.com>
2379 * pt.c (tsubst_pack_expansion): Sorry rather than abort
2380 on __integer_pack as subexpression of pattern.
2382 2018-05-18 Jason Merrill <jason@redhat.com>
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
2398 2018-05-18 Cesar Philippidis <cesar@codesourcery.com>
2401 * cp-gimplify.c (cp_genericize_r): Call genericize_omp_for_stmt for
2404 2018-05-18 Richard Sandiford <richard.sandiford@linaro.org>
2406 * constexpr.c (cxx_eval_constant_expression): Remove FMA_EXPR handling.
2407 (potential_constant_expression_1): Likewise.
2409 2018-05-16 Marek Polacek <polacek@redhat.com>
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.
2416 2018-05-15 Jason Merrill <jason@redhat.com>
2418 * cp-tree.h (cp_expr): Remove copy constructor.
2419 * mangle.c (struct releasing_vec): Declare copy constructor.
2421 * constexpr.c (cxx_eval_vec_init_1): Pass tf_none if ctx->quiet.
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.
2427 2018-05-15 Paolo Carlini <paolo.carlini@oracle.com>
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.
2439 2018-05-14 Jason Merrill <jason@redhat.com>
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.
2466 2018-05-14 Paolo Carlini <paolo.carlini@oracle.com>
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.
2538 2018-05-14 Jason Merrill <jason@redhat.com>
2540 * pt.c (tsubst) [ARRAY_TYPE]: Check valid_array_size_p.
2541 (tsubst_copy_and_build) [NEW_EXPR]: Clear in_decl.
2543 2018-05-11 Jakub Jelinek <jakub@redhat.com>
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.
2553 2018-05-10 Jason Merrill <jason@redhat.com>
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.
2559 * cp-tree.h (DECL_CONSTRUCTOR_P): Use DECL_CXX_CONSTRUCTOR_P.
2560 (DECL_DESTRUCTOR_P): Use DECL_CXX_DESTRUCTOR_P.
2562 Core issue 2310 - conversion to base of incomplete type.
2563 * class.c (build_base_path): Check COMPLETE_TYPE_P for source type.
2565 CWG 2267 - list-initialization of reference temporary
2566 * call.c (reference_binding): List-initializing a reference
2567 temporary is copy-list-initialization.
2569 * parser.c (cp_parser_class_head): Use num_template_headers_for_class.
2571 * pt.c (instantiate_decl): Make sure we aren't trying to do a nested
2572 instantiation in template context.
2574 * class.c (vbase_has_user_provided_move_assign): Use
2577 * lambda.c (lambda_expr_this_capture): Improve logic.
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.
2583 2018-05-10 Jakub Jelinek <jakub@redhat.com>
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
2590 2018-05-10 Eric Botcazou <ebotcazou@adacore.com>
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.
2597 2018-05-09 Paolo Carlini <paolo.carlini@oracle.com>
2601 2018-05-08 Paolo Carlini <paolo.carlini@oracle.com>
2604 * parser.c (cp_parser_parameter_declaration_list): When the
2605 entire parameter-declaration-list is erroneous maybe call
2606 abort_fully_implicit_template.
2608 2018-05-08 Jason Merrill <jason@redhat.com>
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.
2615 2018-05-08 Paolo Carlini <paolo.carlini@oracle.com>
2618 * parser.c (cp_parser_parameter_declaration_list): When the
2619 entire parameter-declaration-list is erroneous maybe call
2620 abort_fully_implicit_template.
2622 2018-05-08 Marek Polacek <polacek@redhat.com>
2625 * semantics.c (finish_if_stmt_cond): See through typedefs.
2627 2018-05-07 Jason Merrill <jason@redhat.com>
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
2635 2018-05-07 Nathan Sidwell <nathan@acm.org>
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):
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
2655 (check_local_shadow): Likewise.
2656 (check_for_out_of_scope_variable): Delete.
2657 * parser.c (cp_parser_primary_expression): Remove shadowed for var
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.
2664 2018-05-07 Jason Merrill <jason@redhat.com>
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.
2671 2018-05-05 Paolo Carlini <paolo.carlini@oracle.com>
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.
2676 2018-05-03 Jason Merrill <jason@redhat.com>
2678 PR c++/85600 - virtual delete failure.
2679 * init.c (build_delete): Always save_expr when deleting.
2681 2018-05-03 Nathan Sidwell <nathan@acm.org>
2683 * decl.c (cxx_init_decl_processing): Remove flag_friend_injection.
2684 * name-lookup.c (do_pushdecl): Likewise.
2686 2018-05-02 Paolo Carlini <paolo.carlini@oracle.com>
2687 Jason Merrill <jason@redhat.com>
2690 * name-lookup.c (check_local_shadow): Don't handle static old
2691 declarations in the block handling locals shadowing locals.
2693 2018-05-01 Jason Merrill <jason@redhat.com>
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.
2699 2018-04-30 Jason Merrill <jason@redhat.com>
2701 PR c++/85580 - extern "C" and local variables
2702 * name-lookup.c (check_extern_c_conflict): Ignore local decls.
2704 PR c++/84701 - unsigned typeof.
2705 * decl.c (grokdeclarator): Overhaul diagnostics for invalid use
2706 of long/short/signed/unsigned.
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.
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.
2719 * init.c (build_dtor_call): Use build_special_member_call.
2720 (build_delete): Remove redundant uses of save_addr.
2722 * decl.c (build_clobber_this): Use build_clobber.
2724 2018-04-27 Jakub Jelinek <jakub@redhat.com>
2727 * init.c (build_zero_init_1): For zero initialization of
2728 NULLPTR_TYPE_P type use build_int_cst directly.
2730 2018-04-27 David Malcolm <dmalcolm@redhat.com>
2733 * name-lookup.c (consider_binding_level): Skip compiler-generated
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.
2739 2018-04-27 Jason Merrill <jason@redhat.com>
2741 * cvt.c (cp_fold_convert): Use convert_ptrmem.
2742 * typeck.c (convert_ptrmem): Add a NOP even if no adjustment.
2744 2018-04-27 Paolo Carlini <paolo.carlini@oracle.com>
2747 * decl.c (grokdeclarator): Clear friendp upon definition in local
2748 class definition error.
2750 2018-04-27 Jason Merrill <jason@redhat.com>
2752 PR c++/85545 - ICE with noexcept PMF conversion.
2753 * cvt.c (cp_fold_convert): Pass PMF CONSTRUCTORs to
2755 * typeck.c (build_ptrmemfunc): Don't build a NOP_EXPR for zero
2757 (build_ptrmemfunc_access_expr): Special-case CONSTRUCTORs.
2759 2018-04-27 Nathan Sidwell <nathan@acm.org>
2761 * typeck.c (convert_ptrmem): Move local var decls to initialization.
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.
2770 2018-04-26 Jason Merrill <jason@redhat.com>
2772 PR c++/85545 - ICE with noexcept PMF conversion.
2773 * cvt.c (cp_fold_convert): Handle PMF CONSTRUCTORs directly.
2775 2018-04-25 Nathan Sidwell <nathan@acm.org>
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.
2787 2018-04-23 Jason Merrill <jason@redhat.com>
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.
2800 2018-04-23 Jakub Jelinek <jakub@redhat.com>
2801 Jason Merrill <jason@redhat.com>
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.
2807 2018-04-20 Jakub Jelinek <jakub@redhat.com>
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.
2820 2018-04-19 Paolo Carlini <paolo.carlini@oracle.com>
2823 * pt.c (lookup_template_class_1): Check pushtag return value for
2826 2018-04-19 Alexandre Oliva <aoliva@redhat.com>
2829 * cp-tree.h (tinst_level::free): Fix whitespace.
2831 2018-04-18 Paolo Carlini <paolo.carlini@oracle.com>
2834 * pt.c (tsubst_lambda_expr): Check begin_lambda_type return value
2835 for error_mark_node.
2837 2018-04-18 Jakub Jelinek <jakub@redhat.com>
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.
2845 2018-04-18 Alexandre Oliva <aoliva@redhat.com>
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
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
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.
2887 2018-04-16 Alexandre Oliva <aoliva@redhat.com>
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.
2894 2018-04-12 David Malcolm <dmalcolm@redhat.com>
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.
2905 2018-04-12 Jason Merrill <jason@redhat.com>
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.
2915 2018-04-12 Marek Polacek <polacek@redhat.com>
2918 * constexpr.c (reduced_constant_expression_p): Return false for null
2921 2018-04-11 Marek Polacek <polacek@redhat.com>
2924 * constexpr.c (potential_constant_expression_1): Consider conversions
2925 from classes to literal types potentially constant.
2927 2018-04-10 Paolo Carlini <paolo.carlini@oracle.com>
2930 * init.c (build_zero_init_1): Handle NULLPTR_TYPE_P being true of
2931 the type like TYPE_PTR_OR_PTRMEM_P.
2933 2018-04-10 Jason Merrill <jason@redhat.com>
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.
2942 2018-04-10 David Malcolm <dmalcolm@redhat.com>
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
2951 2018-04-10 Jakub Jelinek <jakub@redhat.com>
2953 PR c++/85312 - P0962 cleanup
2954 * parser.c (cp_parser_perform_range_for_lookup): Remove unreachable
2957 2018-04-10 Jason Merrill <jason@redhat.com>
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.
2964 PR c++/85285 - ICE with flexible array after substitution.
2965 * pt.c (instantiate_class_template_1): Check for flexible array in
2968 2018-04-09 Paolo Carlini <paolo.carlini@oracle.com>
2971 * decl.c (cp_finish_decomp): In a template, if the type is incomplete
2972 issue a pedwarn and defer trying to do bindings.
2974 2018-04-09 Jason Merrill <jason@redhat.com>
2976 PR c++/85279 - dump_expr doesn't understand decltype.
2977 * error.c (dump_expr): Handle DECLTYPE_TYPE.
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.
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.
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.
2995 2018-04-09 Jakub Jelinek <jakub@redhat.com>
2998 * parser.c (cp_parser_simple_declaration): For structured bindings,
2999 if *maybe_range_for_decl is NULL after parsing it, set it to
3002 2018-04-09 Jason Merrill <jason@redhat.com>
3004 PR c++/85256 - ICE capturing pointer to VLA.
3005 * lambda.c (add_capture): Distinguish between variable-size and
3006 variably-modified types.
3008 2018-04-06 Jason Merrill <jason@redhat.com>
3010 PR c++/85214 - ICE with alias, generic lambda, constexpr if.
3011 * pt.c (extract_locals_r): Remember local typedefs.
3013 2018-04-06 David Malcolm <dmalcolm@redhat.com>
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.
3034 2018-04-06 Jakub Jelinek <jakub@redhat.com>
3037 * pt.c (tsubst_decomp_names): Return error_mark_node and assert
3038 errorcount is set if tsubst doesn't return a VAR_DECL.
3040 2018-04-06 David Malcolm <dmalcolm@redhat.com>
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
3051 (maybe_suggest_missing_std_header): New.
3053 2018-04-06 Jason Merrill <jason@redhat.com>
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.
3059 PR c++/85240 - LTO ICE with using of undeduced auto fn.
3060 * cp-gimplify.c (cp_genericize_r): Discard using of undeduced auto.
3062 2018-04-05 Jakub Jelinek <jakub@redhat.com>
3065 * pt.c (tsubst_decomp_names): Don't fail or ICE if DECL_CHAIN (decl3)
3066 is not prev, if prev == decl.
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.
3073 2018-04-05 Jason Merrill <jason@redhat.com>
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
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.
3085 2018-04-05 Paolo Carlini <paolo.carlini@oracle.com>
3088 * call.c (convert_like_real): Fail gracefully for a broken
3089 std::initializer_list, missing a definition.
3091 * name-lookup.c (do_pushtag): Tweak message, use %< and %>.
3093 2018-04-05 Paolo Carlini <paolo.carlini@oracle.com>
3096 * decl.c (grokdeclarator): Fix diagnostic about typedef name used
3097 as nested-name-specifier, keep type and TREE_TYPE (decl) in sync.
3099 2018-04-05 Jason Merrill <jason@redhat.com>
3101 PR c++/82152 - ICE with class deduction and inherited ctor.
3102 * pt.c (do_class_deduction): Ignore inherited ctors.
3104 PR c++/84665 - ICE with array of empty class.
3105 * decl2.c (cp_check_const_attributes): Use fold_non_dependent_expr.
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.
3111 2018-04-05 Ville Voutilainen <ville.voutilainen@gmail.com>
3114 * decl.c (find_decomp_class_base): Check accessibility instead
3115 of declared access, adjust diagnostic.
3117 2018-04-05 Ville Voutilainen <ville.voutilainen@gmail.com>
3120 * decl.c (get_tuple_decomp_init): Check the templatedness
3123 2018-04-05 Jason Merrill <jason@redhat.com>
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.
3129 2018-04-05 Alexandre Oliva <aoliva@redhat.com>
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.
3140 2018-04-04 Jason Merrill <jason@redhat.com>
3142 PR c++/85215 - ICE with copy-init from conversion.
3143 * call.c (merge_conversion_sequences): Fix type of direct binding
3146 PR c++/84938 - ICE with division by ~-1.
3147 * call.c (set_up_extended_ref_temp): Call cp_fully_fold.
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.
3153 2018-04-04 Jakub Jelinek <jakub@redhat.com>
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.
3162 * cp-tree.h (calculate_bases, calculate_direct_bases): Add complain
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
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.
3174 2018-04-04 Jason Merrill <jason@redhat.com>
3176 PR c++/85006 - -fconcepts ICE with A<auto...> return type
3177 * pt.c (tsubst_pack_expansion): Allow unsubstituted auto pack.
3179 PR c++/85200 - ICE with constexpr if in generic lambda.
3180 * tree.c (cp_walk_subtrees): Walk into DECL_EXPR in templates.
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.
3186 PR c++/85135 - ICE with omitted template arguments.
3187 * decl.c (grokdeclarator): Catch deduced class type in trailing
3190 PR c++/85133 - ICE with missing concept initializer.
3191 * decl.c (cp_finish_decl): If a concept initializer is missing, use
3194 PR c++/85118 - wrong error with generic lambda and std::bind.
3195 * call.c (add_template_conv_candidate): Disable if there are any
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.
3202 PR c++/85148 - ICE with 'this' in array NSDMI.
3203 * tree.c (replace_placeholders_r): Use handled_component_p.
3205 2018-04-04 Ville Voutilainen <ville.voutilainen@gmail.com>
3208 * decl.c (grokfndecl): Handle standard UDL diagnostics here..
3209 * parser.c (cp_parser_unqualified_id): ..not here.
3211 2018-04-04 Alexandre Oliva <aoliva@redhat.com>
3214 * typeck.c (cp_build_addr_expr_1): Mark FUNCTION_DECL as
3216 * decl2.c (mark_used): Return without effects if tf_conv.
3218 2018-04-03 Jason Merrill <jason@redhat.com>
3220 PR c++/85092 - C++17 ICE with unused list constructor.
3221 * call.c (conv_binds_ref_to_prvalue): Also count ck_identity
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.
3228 2018-04-03 Paolo Carlini <paolo.carlini@oracle.com>
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.
3237 2018-04-03 Jason Merrill <jason@redhat.com>
3239 * semantics.c (finish_if_stmt_cond): Use
3240 instantiation_dependent_expression_p.
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.
3248 * typeck.c (merge_types): Limit matching attribute shortcut to
3251 2018-04-03 Jakub Jelinek <jakub@redhat.com>
3254 * pt.c (fixed_parameter_pack_p_1): Punt if parm is error_mark_node.
3257 * name-lookup.c (handle_namespace_attrs): Return early if attributes
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.
3265 2018-04-02 Jason Merrill <jason@redhat.com>
3267 PR c++/64095 - auto... parameter pack.
3268 * parser.c (cp_parser_parameter_declaration): Handle turning autos
3270 (cp_parser_parameter_declaration_list): Not here.
3272 2018-03-31 Alexandre Oliva <aoliva@redhat.com>
3275 * class.c (instantiate_type): Peel off SAVE_EXPR before
3278 2018-03-30 Jason Merrill <jason@redhat.com>
3280 * typeck2.c (process_init_constructor_record): Use
3281 init_list_type_node for the CONSTRUCTOR around an anonymous union
3282 designated initializer.
3284 2018-03-30 Jakub Jelinek <jakub@redhat.com>
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.
3291 2018-03-29 David Malcolm <dmalcolm@redhat.com>
3294 * name-lookup.c (get_std_name_hint): Add names from <memory>,
3295 <tuple>, and <utility>.
3297 2018-03-29 Jason Merrill <jason@redhat.com>
3299 PR c++/85093 - too many template args with pack expansion.
3300 * pt.c (coerce_template_parms): Keep pack expansion args that will
3303 2018-03-29 Jason Merrill <jason@redhat.com>
3305 * pt.c (build_non_dependent_expr): Propagate expr location.
3307 2018-03-27 Jason Merrill <jason@redhat.com>
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.
3313 2018-03-29 David Malcolm <dmalcolm@redhat.com>
3316 * typeck.c (convert_for_assignment): When complaining due to
3317 conversions for an argument, attempt to use the location of the
3320 2018-03-28 Paolo Carlini <paolo.carlini@oracle.com>
3323 * pt.c (tsubst_default_argument): Early return if the type of the
3324 parameter is erroneous.
3326 2018-03-28 Alexandre Oliva <aoliva@redhat.com>
3329 * decl2.c (note_vague_linkage_fn): Don't defer uninstantiated
3333 * tree.c (strip_typedefs_expr): Reject STATEMENT_LISTs.
3335 2018-03-27 Paolo Carlini <paolo.carlini@oracle.com>
3338 * method.c (defaulted_late_check): Partially revert r253321 changes,
3339 do not early return upon error.
3341 2018-03-27 Jakub Jelinek <jakub@redhat.com>
3344 * cp-gimplify.c (cp_fold) <case CONSTRUCTOR>: For ctors with vector
3345 type call fold to generate VECTOR_CSTs when possible.
3348 * tree.c (cp_build_reference_type): If to_type is error_mark_node,
3349 return it right away.
3351 2018-03-27 Volker Reichelt <v.reichelt@netcologne.de>
3353 * search.c (check_final_overrider): Use inform instead of error
3354 for the diagnostics of the overridden functions. Tweak wording.
3356 2018-03-27 Jakub Jelinek <jakub@redhat.com>
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.
3362 2018-03-27 Paolo Carlini <paolo.carlini@oracle.com>
3363 Jason Merrill <jason@redhat.com>
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.
3370 2018-03-26 Jason Merrill <jason@redhat.com>
3372 PR c++/85062 - ICE with alignas in wrong place.
3373 * decl.c (grokdeclarator): Ignore attributes on type-specifiers
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.
3380 2018-03-23 Jason Merrill <jason@redhat.com>
3382 PR c++/78489 - wrong SFINAE behavior.
3385 * pt.c (type_unification_real): Don't defer substitution failure.
3387 2018-03-23 Jakub Jelinek <jakub@redhat.com>
3390 * decl.c (compute_array_index_type): Set osize to mark_rvalue_use
3394 * pt.c (tsubst_copy_and_build) <case FIX_TRUNC_EXPR>: Replace
3395 cp_build_unary_op call with gcc_unreachable ().
3397 2018-03-23 Marek Polacek <polacek@redhat.com>
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.
3404 2018-03-23 Ville Voutilainen <ville.voutilainen@gmail.com>
3407 * parser.c (cp_parser_perform_range_for_lookup): Change
3408 the condition for deciding whether to use members.
3410 2018-03-23 Marek Polacek <polacek@redhat.com>
3413 * semantics.c (finish_offsetof): Don't allow CONST_DECLs.
3415 2018-03-23 Alexandre Oliva <aoliva@redhat.com>
3418 * parser.c (cp_parser_alias_declaration): Call
3419 parser_check_template_parameters.
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.
3429 * init.c (build_vec_init): Error at parenthesized array init.
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.
3441 2018-03-22 Marek Polacek <polacek@redhat.com>
3444 * semantics.c (finish_if_stmt_cond): Check if the type of the condition
3447 2018-03-21 Jason Merrill <jason@redhat.com>
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.
3456 2018-03-21 Alexandre Oliva <aoliva@redhat.com>
3459 * init.c (build_vec_init): Silence error, former sorry,
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.
3470 2018-03-21 Paolo Carlini <paolo.carlini@oracle.com>
3473 * decl.c (maybe_deduce_size_from_array_init): Set TREE_TYPE to
3474 error_mark_node when check_array_designated_initializer fails.
3476 2018-03-21 Jakub Jelinek <jakub@redhat.com>
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.
3487 2018-03-21 Nathan Sidwell <nathan@acm.org>
3490 * tree.c (decl_linkage): Use DECL_CLONED_FUNCTION_P.
3491 * decl2.c (vague_linkage_p): Likewise.
3493 2018-03-21 David Malcolm <dmalcolm@redhat.com>
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.
3504 2018-03-21 Nathan Sidwell <nathan@acm.org>
3507 * name-lookup.c (do_pushtag): Permit lambdas to be pushed into
3510 2018-03-21 Martin Sebor <msebor@redhat.com>
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.
3517 2018-03-21 David Malcolm <dmalcolm@redhat.com>
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
3524 2018-03-21 Nathan Sidwell <nathan@acm.org>
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.
3532 * name-lookup.c (update_binding): Correct logic for local binding
3535 2018-03-21 Marek Polacek <polacek@redhat.com>
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.
3541 2018-03-20 Marek Polacek <polacek@redhat.com>
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.
3547 2018-03-20 Jason Merrill <jason@redhat.com>
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.
3555 2018-03-20 Nathan Sidwell <nathan@acm.org>
3558 * name-lookup.c (pushdecl_class_level): Push anon-struct's
3559 member_vec, if there is one.
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.
3567 2018-03-19 Jason Merrill <jason@redhat.com>
3569 PR c++/84937 - ICE with class deduction and auto.
3570 * pt.c (rewrite_template_parm): Fix auto handling.
3572 2018-03-19 Marek Polacek <polacek@redhat.com>
3575 * pt.c (enclosing_instantiation_of): Check if fn is null.
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
3583 2018-03-19 Jason Merrill <jason@redhat.com>
3585 PR c++/71834 - template-id with too few arguments.
3586 * pt.c (coerce_template_parms): Check fixed_parameter_pack_p.
3588 2018-03-19 Nathan Sidwell <nathan@acm.org>
3591 * lambda.c (maybe_add_lambda_conv_op): Force C++ linkage.
3592 * pt.c (build_template_decl): Propagate language linkage.
3595 * name-lookup.c (set_local_extern_decl_linkage): Defend against
3598 2018-03-16 Jakub Jelinek <jakub@redhat.com>
3601 * parser.c (cp_parser_lambda_introducer): Remove trailing space from
3603 * method.c (synthesize_method): Likewise.
3604 * pt.c (convert_nontype_argument): Likewise.
3606 2018-03-16 Jason Merrill <jason@redhat.com>
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.
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.
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.
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.
3625 2018-03-16 Jakub Jelinek <jakub@redhat.com>
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
3647 2018-03-16 Jason Merrill <jason@redhat.com>
3649 PR c++/83911 - ICE with multiversioned constructor.
3650 * cp-gimplify.c (cp_genericize_r): Replace versioned function with
3652 * call.c (build_over_call): Not here.
3654 2018-03-16 Jakub Jelinek <jakub@redhat.com>
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.
3660 2018-03-15 Jakub Jelinek <jakub@redhat.com>
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.
3670 2018-03-14 Jason Merrill <jason@redhat.com>
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.
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.
3680 PR c++/81236 - auto variable and auto function
3681 * pt.c (tsubst_baselink): Update the type of the BASELINK after
3684 2018-03-14 Jason Merrill <jason@redhat.com>
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.
3691 2018-03-14 Marek Polacek <polacek@redhat.com>
3694 * semantics.c (finish_static_assert): Check
3695 instantiation_dependent_expression_p instead of
3696 {type,value}_dependent_expression_p.
3698 2018-03-13 Paolo Carlini <paolo.carlini@oracle.com>
3699 Jason Merrill <jason@redhat.com>
3701 PR c++/82336 - link error with list-init default argument.
3702 * decl.c (check_default_argument): Unshare an initializer list.
3704 2018-03-13 Jakub Jelinek <jakub@redhat.com>
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.
3711 2018-03-13 Jason Merrill <jason@redhat.com>
3713 PR c++/82565 - ICE with concepts and generic lambda.
3714 * pt.c (instantiate_decl): Clear fn_context for lambdas.
3716 2018-03-13 Jason Merrill <jason@redhat.com>
3718 PR c++/84720 - ICE with rvalue ref non-type argument.
3719 * pt.c (convert_nontype_argument): Handle rvalue references.
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.
3725 * parser.c (cp_parser_simple_type_specifier): Pedwarn about auto
3726 parameter even without -Wpedantic.
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.
3732 2018-03-13 Jakub Jelinek <jakub@redhat.com>
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.
3739 2018-03-12 Jason Merrill <jason@redhat.com>
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.
3745 PR c++/84802 - ICE capturing uninstantiated class.
3746 * lambda.c (build_capture_proxy): Call complete_type.
3748 2018-03-09 Jason Merrill <jason@redhat.com>
3750 PR c++/84770 - ICE with typedef and parameter pack.
3751 * pt.c (verify_unstripped_args_1): Split out from
3752 verify_unstripped_args.
3754 PR c++/84785 - ICE with alias template and default targs.
3755 * pt.c (type_unification_real): Set processing_template_decl if
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.
3762 2018-03-09 Jason Merrill <jason@redhat.com>
3763 Paolo Carlini <paolo.carlini@oracle.com>
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.
3771 2018-03-09 Jason Merrill <jason@redhat.com>
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.
3782 2018-03-09 Jason Merrill <jason@redhat.com>
3783 Jakub Jelinek <jakub@redhat.com>
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.
3792 2018-03-09 Jakub Jelinek <jakub@redhat.com>
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.
3799 2018-03-09 Nathan Sidwell <nathan@acm.org>
3802 * name-lookup.c (do_pushdecl_with_scope): Only clear
3803 current_function_decl when pushing a non-class (i.e. namespace)
3806 2018-03-08 Jason Merrill <jason@redhat.com>
3807 Jakub Jelinek <jakub@redhat.com>
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.
3813 2018-03-06 Jason Merrill <jason@redhat.com>
3815 * lambda.c (is_capture_proxy_with_ref): Remove.
3816 * constexpr.c, expr.c, cp-tree.h, semantics.c: Adjust.
3818 2018-03-06 Marek Polacek <polacek@redhat.com>
3821 * constexpr.c (cxx_bind_parameters_in_call): Unshare evaluated
3824 2018-03-06 Alexandre Oliva <aoliva@redhat.com>
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.
3837 * init.c (build_zero_init_1): Zero-initialize references.
3840 * semantics.c (finish_stmt_expr_expr): Reject unresolved
3841 overloads used as stmt expr values.
3843 2018-03-05 Jason Merrill <jason@redhat.com>
3845 PR c++/84708 - ICE with lambda in local class NSDMI.
3846 * lambda.c (lambda_expr_this_capture): Handle local class NSDMI
3849 2018-03-05 Jakub Jelinek <jakub@redhat.com>
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.
3856 2018-03-05 Nathan Sidwell <nathan@acm.org>
3859 * pt.c (process_template_arg): Mark lookup_keep on a default arg.
3861 2018-03-05 Marek Polacek <polacek@redhat.com>
3864 * decl.c (duplicate_decls): Check DECL_NAME before accessing
3867 2018-03-05 Nathan Sidwell <nathan@acm.org>
3870 * friend.c (do_friend): Restore check for identifier_p inside
3873 2018-03-05 Paolo Carlini <paolo.carlini@oracle.com>
3876 * parser.c (cp_parser_lambda_introducer): Reject any capture not
3877 involving a VAR_DECL or a PARM_DECL.
3879 2018-03-05 Pádraig Brady <P@draigBrady.com>
3880 Jason Merrill <jason@redhat.com>
3881 Nathan Sidwell <nathan@acm.org>
3884 * decl2.c (get_tls_init_fn): Check TYPE_HAS_TRIVIAL_DFLT too.
3886 2018-03-03 Jason Merrill <jason@redhat.com>
3888 PR c++/84686 - missing volatile loads.
3889 * cvt.c (convert_to_void): Call maybe_undo_parenthesized_ref.
3891 2018-03-03 Paolo Carlini <paolo.carlini@oracle.com>
3894 * optimize.c (maybe_thunk_body): Bail out immediately if either
3895 fns[0] or fns[1] is null.
3897 2018-03-02 Marek Polacek <polacek@redhat.com>
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.
3905 2018-03-02 Jason Merrill <jason@redhat.com>
3907 * semantics.c (force_paren_expr): Remove redundant test.
3909 2018-03-02 Marek Polacek <polacek@redhat.com>
3912 * decl.c (cp_complete_array_type): Check error_mark_node.
3915 * typeck.c (cp_perform_integral_promotions): Check the result of
3918 2018-03-02 Jakub Jelinek <jakub@redhat.com>
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.
3927 2018-03-02 Jason Merrill <jason@redhat.com>
3930 * pt.c (type_dependent_expression_p): Check DECL_LANG_SPECIFIC.
3932 2018-03-02 Marek Polacek <polacek@redhat.com>
3935 * cp-gimplify.c (cp_fully_fold): Unwrap TARGET_EXPR or a CONSTRUCTOR
3936 wrapped in VIEW_CONVERT_EXPR.
3938 2018-03-01 Martin Sebor <msebor@redhat.com>
3941 * decl.c (check_redeclaration_no_default_args): Merge attributes
3942 specified on redeclarations of the same function template.
3945 2018-03-01 Marek Polacek <polacek@redhat.com>
3946 Jason Merrill <jason@redhat.com>
3949 * semantics.c (force_paren_expr): Create a PAREN_EXPR when in
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.
3956 2018-03-01 Nathan Sidwell <nathan@acm.org>
3959 * name-lookup.c (member_vec_dedup): Remove manually peeled
3960 iteration. Ignore dependent ctor inheritance.
3962 2018-03-01 Jason Merrill <jason@redhat.com>
3964 PR c++/71569 - decltype of template.
3965 * parser.c (cp_parser_decltype_expr): Handle missing template args.
3967 2018-03-01 Marek Polacek <polacek@redhat.com>
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.
3975 2018-03-01 Jason Merrill <jason@redhat.com>
3976 Alexandre Oliva <aoliva@redhat.com>
3978 PR c++/71569 - ICE with redundant args on member variable template.
3979 * decl.c (start_decl): Handle partial specialization of member
3981 * pt.c (determine_specialization): Allow partial specialization
3982 of member variable template without specializing enclosing class.
3983 (process_partial_specialization): Improve error message.
3985 2018-02-28 Jason Merrill <jason@redhat.com>
3987 PR c++/71784 - ICE with ref-qualifier and explicit specialization.
3988 * pt.c (determine_specialization): Check ref-qualifier.
3990 2018-02-28 Jakub Jelinek <jakub@redhat.com>
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):
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.
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
4008 2018-02-28 Martin Sebor <msebor@redhat.com>
4011 * decl.c (duplicate_decls): Fully merge attributes const, pure,
4014 2018-02-28 Nathan Sidwell <nathan@acm.org>
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.
4022 2018-02-28 Jakub Jelinek <jakub@redhat.com>
4024 * decl.c (cp_finish_decomp): Don't adjust eltscnt when calling
4027 2018-02-27 Martin Sebor <msebor@redhat.com>
4029 * pt.c: Avoid including <string> directly.
4031 2018-02-27 Martin Sebor <msebor@redhat.com>
4035 * cp-tree.h (warn_spec_missing_attributes): New function.
4036 ((check_explicit_specialization): Add an argument. Call the above
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.
4042 2018-02-27 HÃ¥kon Sandsmark <hsandsmark@gmail.com>
4044 PR c++/71546 - lambda init-capture with qualified-id.
4045 * parser.c (cp_parser_lambda_introducer): Clear scope after
4046 each lambda capture.
4048 2018-02-27 Nathan Sidwell <nathan@acm.org>
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
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.
4063 2018-02-27 Jason Merrill <jason@redhat.com>
4065 PR c++/84489 - dependent default template argument
4066 * pt.c (type_unification_real): Handle early substitution failure.
4068 2018-02-26 Jason Merrill <jason@redhat.com>
4070 PR c++/84560 - ICE capturing multi-dimensional VLA.
4071 * tree.c (array_of_runtime_bound_p): False if the element is
4074 PR c++/84441 - ICE with base initialized from ?:
4075 * call.c (unsafe_copy_elision_p): Handle COND_EXPR.
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.
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.
4085 2018-02-26 Jakub Jelinek <jakub@redhat.com>
4088 * constexpr.c (cxx_eval_vec_init_1): For reuse, treat NULL eltinit like
4089 a valid constant initializer. Formatting fixes.
4091 2018-02-26 Paolo Carlini <paolo.carlini@oracle.com>
4094 * pt.c (tsubst_attributes): Handle correctly tsubst_attribute
4095 returning NULL_TREE.
4096 (apply_late_template_attributes): Likewise.
4098 2018-02-26 Jakub Jelinek <jakub@redhat.com>
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.
4105 2018-02-26 Jason Merrill <jason@redhat.com>
4107 PR c++/84551 - ICE with concepts and -g.
4108 * parser.c (add_debug_begin_stmt): Do nothing in a concept.
4110 2018-02-26 Marek Polacek <polacek@redhat.com>
4113 * tree.c (replace_placeholders_r): Only check TREE_CONSTANT on
4116 2018-02-26 Jason Merrill <jason@redhat.com>
4118 PR c++/84447 - ICE with deleted inherited ctor with default arg.
4119 * call.c (build_over_call): Handle deleted functions in one place.
4121 2018-02-26 Paolo Carlini <paolo.carlini@oracle.com>
4124 * decl.c (redeclaration_error_message): Don't try to use
4125 DECL_DECLARED_CONSTEXPR_P on CONST_DECLs.
4127 2018-02-26 Paolo Carlini <paolo.carlini@oracle.com>
4129 * lambda.c (build_capture_proxy): Define static.
4130 * cp-tree.h (build_capture_proxy): Remove.
4132 2018-02-26 Marek Polacek <polacek@redhat.com>
4135 * name-lookup.c (suggest_alternative_in_explicit_scope): Return false
4136 if name is error node.
4138 2018-02-25 Jason Merrill <jason@redhat.com>
4140 PR c++/84015 - ICE with class deduction and auto template parm.
4141 * pt.c (rewrite_template_parm): Use tf_partial in first tsubst.
4143 2018-02-24 Marek Polacek <polacek@redhat.com>
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'.
4153 2018-02-22 Jason Merrill <jason@redhat.com>
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.
4159 2018-02-22 Jason Merrill <jason@redhat.com>
4161 PR c++/84424 - ICE with constexpr and __builtin_shuffle.
4162 * constexpr.c (reduced_constant_expression_p): Handle CONSTRUCTOR of
4165 2018-02-22 Marek Polacek <polacek@redhat.com>
4168 * parser.c (cp_parser_braced_list): Use require_open instead of
4171 2018-02-21 Jason Merrill <jason@redhat.com>
4173 PR c++/84454 - ICE with pack expansion in signature.
4174 * error.c (find_typenames_r): Also stop on EXPR_PACK_EXPANSION.
4176 2018-02-20 Siddhesh Poyarekar <siddhesh@sourceware.org>
4178 * cp-objcp-common.c (cxx_block_may_fallthru): Add case for
4181 2018-02-20 Paolo Carlini <paolo.carlini@oracle.com>
4184 * parser.c (cp_parser_init_declarator): Don't call start_lambda_scope
4187 2018-02-20 Jakub Jelinek <jakub@redhat.com>
4190 * class.c (fixed_type_or_null) <case CALL_EXPR>: Only test
4191 TREE_HAS_CONSTRUCTOR if instance is not an internal function call.
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.
4200 * pt.c (tsubst_lambda_expr): If not nested, increment temporarily
4201 function_depth to avoid GC during finish_lambda_function.
4203 2018-02-19 Jason Merrill <jason@redhat.com>
4205 PR c++/84429 - ICE capturing VLA.
4206 * lambda.c (build_capture_proxy): Handle reference refs.
4208 2018-02-19 Jakub Jelinek <jakub@redhat.com>
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.
4216 * constexpr.c (potential_constant_expression_1): Handle OMP_SIMD.
4218 2018-02-19 Paolo Carlini <paolo.carlini@oracle.com>
4221 * decl.c (grokdeclarator): Early return error_mark_node upon
4222 ill-formed friend declaration.
4224 2018-02-16 Marek Polacek <polacek@redhat.com>
4225 Jakub Jelinek <jakub@redhat.com>
4228 * constexpr.c (cxx_eval_constant_expression) <case RETURN_EXPR>: Don't
4229 set *jump_target to anything if jump_target is NULL.
4231 2018-02-16 Jason Merrill <jason@redhat.com>
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.
4237 PR c++/81853 - using-directive and constexpr.
4238 * constexpr.c (cxx_eval_constant_expression): Handle USING_STMT.
4240 PR c++/84420 - ICE with structured binding in lambda.
4241 * lambda.c (is_capture_proxy): Check DECL_DECOMPOSITION_P.
4243 PR c++/83835 - C++17 error with constructor ctors.
4244 * call.c (build_special_member_call): Set TARGET_EXPR_DIRECT_INIT_P.
4246 PR c++/82664 - ICE with reference to function template parm.
4247 * pt.c (convert_nontype_argument_function): Avoid obfuscationg
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.
4253 2018-02-16 Jason Merrill <jason@redhat.com>
4255 PR c++/84421 - type-dependent if constexpr
4256 * semantics.c (finish_if_stmt_cond): Check type_dependent_expression_p.
4258 2018-02-16 Nathan Sidwell <nathan@acm.org>
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
4265 2018-02-16 Paolo Carlini <paolo.carlini@oracle.com>
4268 * decl.c (check_special_function_return_type): Reject template
4269 template parameter in deduction guide.
4271 2018-02-16 Nathan Sidwell <nathan@acm.org>
4274 * name-lookup.c (do_pushdecl): Bail out on bad local friend injection.
4276 2018-02-15 Jason Merrill <jason@redhat.com>
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.
4282 PR c++/84045 - ICE with typedef and noexcept.
4283 * except.c (build_noexcept_spec): Use strip_typedefs_expr.
4285 PR c++/84376 - ICE with omitted template arguments.
4286 * pt.c (dguide_name_p): Check for IDENTIFIER_NODE.
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.
4292 2018-02-15 Paolo Carlini <paolo.carlini@oracle.com>
4295 * constraint.cc (tsubst_constraint_info): Handle an error_mark_node
4298 2018-02-14 Paolo Carlini <paolo.carlini@oracle.com>
4301 * pt.c (do_auto_deduction): Don't check the TREE_TYPE of a null
4304 2018-02-14 Nathan Sidwell <nathan@acm.org>
4306 * decl2.c (mark_vtable_entries): Set input_location to decl's.
4307 (c_parse_final_cleanups): Restore input_location after emitting
4310 2018-02-14 Paolo Carlini <paolo.carlini@oracle.com>
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.
4320 2018-02-13 Jakub Jelinek <jakub@redhat.com>
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.
4327 2018-02-13 Paolo Carlini <paolo.carlini@oracle.com>
4330 * call.c (build_conditional_expr_1): Use cp_save_expr instead of
4331 save_expr for the G++ extension.
4333 2018-02-13 Jason Merrill <jason@redhat.com>
4335 PR c++/84080 - ICE with return type deduction and specialization.
4336 * pt.c (determine_specialization): Check uses_template_parms.
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
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.
4347 PR c++/84338 - wrong variadic sizeof.
4348 * pt.c (argument_pack_select_arg): Like the macro, but look through
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.
4355 2018-02-12 Jakub Jelinek <jakub@redhat.com>
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.
4361 2018-02-12 Nathan Sidwell <nathan@acm.org>
4364 * parser.c (cp_parser_decltype): Push and pop
4365 deferring_access_checks. Reorganize to avoid goto.
4367 2018-02-12 Richard Biener <rguenther@suse.de>
4370 * constexpr.c (cxx_eval_vec_init_1): Use a RANGE_EXPR to compact
4371 uniform constructors and delay allocating them fully.
4373 2018-02-09 Jason Merrill <jason@redhat.com>
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.
4390 2018-02-10 Jakub Jelinek <jakub@redhat.com>
4393 * tree.c (cp_free_lang_data): Revert 2018-01-23 change.
4395 2018-02-09 Jason Merrill <jason@redhat.com>
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.
4401 2018-02-09 Nathan Sidwell <nathan@acm.org>
4404 * typeck.c (cp_build_indirect_ref_1, build_reinterpret_cast_1):
4405 Pass expr location to strict_aliasing_warning.
4407 2018-02-09 Jason Merrill <jason@redhat.com>
4409 PR c++/84296 - ICE with qualified-id in template.
4411 * pt.c (unknown_base_ref_p): New.
4412 (instantiation_dependent_scope_ref_p): Use it instead of
4413 any_dependent_bases_p.
4415 2018-02-09 Marek Polacek <polacek@redhat.com>
4416 Jakub Jelinek <jakub@redhat.com>
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.
4423 2018-02-08 Paolo Carlini <paolo.carlini@oracle.com>
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.
4431 2018-02-08 Paolo Carlini <paolo.carlini@oracle.com>
4434 * typeck.c (decay_conversion): Use mark_rvalue_use for the special
4435 case of nullptr too.
4437 2018-02-08 Nathan Sidwell <nathan@acm.org>
4439 * class.c (finish_struct): Fix std:initializer_list diagnostic
4442 2018-02-08 Paolo Carlini <paolo.carlini@oracle.com>
4445 * pt.c (tsubst_copy_and_build): Use force_paren_expr for INDIRECT_REF.
4447 2018-02-07 Jakub Jelinek <jakub@redhat.com>
4450 * parser.c (cp_parser_dot_deref_incomplete): New function.
4451 (cp_parser_postfix_dot_deref_expression): Use it.
4453 2018-02-07 David Malcolm <dmalcolm@redhat.com>
4457 * name-lookup.c (suggest_rid_p): New function.
4458 (lookup_name_fuzzy): Replace enum-rid-filtering logic with call to
4461 2018-02-07 Jason Merrill <jason@redhat.com>
4463 PR c++/84182 - ICE with captured lambda
4465 * pt.c (extract_locals_r, extract_local_specs): New.
4466 (tsubst_pack_expansion): Use them.
4468 2018-02-07 Martin Liska <mliska@suse.cz>
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.
4477 2018-02-05 Marek Polacek <polacek@redhat.com>
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.
4485 2018-02-02 Paolo Carlini <paolo.carlini@oracle.com>
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.
4493 2018-02-02 Jason Merrill <jason@redhat.com>
4495 PR c++/84181 - ICE with lambda parm in template argument.
4496 * tree.c (strip_typedefs_expr): Use cp_tree_operand_length.
4498 2018-02-01 Jason Merrill <jason@redhat.com>
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
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.
4508 2018-02-01 Marek Polacek <polacek@redhat.com>
4511 * typeck.c (build_address): Relax the assert when
4512 processing_template_decl.
4514 2018-02-01 Jason Merrill <jason@redhat.com>
4516 PR c++/84126 - ICE with variadic generic lambda
4519 * pt.c (tsubst_pack_expansion): Handle function parameter_packs in
4520 PACK_EXPANSION_EXTRA_ARGS.
4522 2018-02-01 Paolo Carlini <paolo.carlini@oracle.com>
4525 * call.c (convert_like_real): If w're initializing from {} explicitly
4526 call abstract_virtuals_error_sfinae.
4528 2018-01-31 Jason Merrill <jason@redhat.com>
4529 Jakub Jelinek <jakub@redhat.com>
4532 * constexpr.c (cxx_eval_outermost_constant_expr): Build NOP_EXPR
4533 around non-constant ADDR_EXPRs rather than clearing TREE_CONSTANT
4536 2018-01-31 Jakub Jelinek <jakub@redhat.com>
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.
4544 2018-01-31 Paolo Carlini <paolo.carlini@oracle.com>
4547 * semantics.c (finish_qualified_id_expr): When handling an
4548 UNBOUND_CLASS_TEMPLATE only adjust qualifying_class and expr.
4550 2018-01-31 Marek Polacek <polacek@redhat.com>
4553 * cp-gimplify.c (cp_fold): Check if X is an error node before
4554 calling useless_type_conversion_p.
4556 2018-01-30 Jason Merrill <jason@redhat.com>
4558 PR c++/84091 - ICE with local class in lambda in template.
4559 * decl2.c (determine_visibility): Look for outer containing template
4562 PR c++/84098 - ICE with lambda in template NSDMI.
4563 * pt.c (instantiate_class_template_1): Ignore more lambdas.
4565 2018-01-29 Jason Merrill <jason@redhat.com>
4567 PR c++/68810 - wrong location for reinterpret_cast error.
4568 * cvt.c (cp_convert_to_pointer): Always build a CONVERT_EXPR when
4571 2018-01-29 Marek Polacek <polacek@redhat.com>
4574 * constexpr.c (cxx_fold_indirect_ref): Compute ((foo *)&fooarray)[1]
4575 => fooarray[1] in offset_int.
4577 2018-01-29 Jason Merrill <jason@redhat.com>
4579 PR c++/83942 - wrong unused warning with static_cast.
4580 * cvt.c (ocp_convert): Call mark_rvalue_use.
4582 2018-01-26 Jason Merrill <jason@redhat.com>
4584 PR c++/83956 - wrong dtor error with anonymous union
4585 * method.c (walk_field_subobs): Variant members only affect
4587 (maybe_explain_implicit_delete): Pass &deleted_p for diagnostic.
4589 PR c++/84036 - ICE with variadic capture.
4591 * pt.c (tsubst_pack_expansion): When optimizing a simple
4592 substitution, pull a single pack expansion out of its pack.
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.
4599 * pt.c (lookup_template_class_1): Add sanity check.
4600 * name-lookup.c (do_pushtag): Don't add closures to local_classes.
4602 2018-01-25 Jakub Jelinek <jakub@redhat.com>
4605 * decl.c (find_decomp_class_base): Ignore unnamed bitfields. Ignore
4606 recursive calls that return ret.
4607 (cp_finish_decomp): Ignore unnamed bitfields.
4609 2018-01-23 Jason Merrill <jason@redhat.com>
4611 PR c++/82249 - wrong mismatched pack length error.
4612 * pt.c (extract_fnparm_pack, tsubst_pack_expansion): Handle
4613 unsubstituted function parameter pack.
4615 2018-01-23 Paolo Carlini <paolo.carlini@oracle.com>
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.
4624 2018-01-23 Jason Merrill <jason@redhat.com>
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.
4630 2018-01-23 David Malcolm <dmalcolm@redhat.com>
4633 * pt.c (tsubst_copy_and_build) <CONSTRUCTOR>: Remove early bailout
4634 for pointer to member function types.
4636 2018-01-23 Jakub Jelinek <jakub@redhat.com>
4639 * tree.c (cp_free_lang_data): Change DECL_VALUE_EXPR of
4640 DECL_OMP_PRIVATIZED_MEMBER vars to error_mark_node.
4642 2018-01-23 Nathan Sidwell <nathan@acm.org>
4645 * pt.c (tsubst_baselink): Remove optype assert.
4646 * ptree.c (cxx_print_xnode): <case BASELINK> Print BASELINK_OPTYPE.
4648 2018-01-23 Jakub Jelinek <jakub@redhat.com>
4651 * decl.c (cp_finish_decomp): Diagnose if reference structure binding
4652 refers to incomplete type.
4654 2018-01-23 Nathan Sidwell <nathan@acm.org>
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
4660 * name-lookup.c (check_for_out_of_scope_variable): Deprecate and
4662 * semantics.c (begin_for_scope): Flag_new_for_scope is
4664 (finish_for_stmt, begin_range_for_stmt): Likewise.
4666 2018-01-22 Jason Merrill <jason@redhat.com>
4669 * decl2.c (determine_visibility): Fix template_decl handling
4670 instead of blocking it.
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
4677 2018-01-22 Marek Polacek <polacek@redhat.com>
4680 * typeck2.c (split_nonconstant_init_1): Return false if we didn't
4683 2018-01-22 Ville Voutilainen <ville.voutilainen@gmail.com>
4686 * decl.c (grokdeclarator): Don't diagnose extra parens
4689 2018-01-19 Jakub Jelinek <jakub@redhat.com>
4692 * call.c (joust): Use TREE_TYPE (source) if source is
4693 a POINTER_TYPE_P rather than if ! DECL_CONSTRUCTOR_P (w->fn).
4696 * typeck.c (convert_for_assignment): Suppress warn_ignored_qualifiers
4697 for direct enum init.
4698 * decl.c (reshape_init): Likewise.
4700 2018-01-19 Marek Polacek <polacek@redhat.com>
4702 * constexpr.c (fold_simple): Simplify.
4704 2018-01-18 Jason Merrill <jason@redhat.com>
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.
4711 2018-01-18 Paolo Carlini <paolo.carlini@oracle.com>
4713 * cp-tree.h: Fix comment typo (DECL_NON_TRIVIALLY_INITIALIZED_P
4714 vs DECL_NONTRIVIALLY_INITIALIZED_P).
4716 2018-01-18 Jason Merrill <jason@redhat.com>
4718 PR c++/82461 - constexpr list-initialized member
4719 * constexpr.c (potential_constant_expression_1): Check
4720 TARGET_EXPR_DIRECT_INIT_P.
4722 2018-01-18 Paolo Carlini <paolo.carlini@oracle.com>
4725 * decl.c (xref_basetypes): Early return upon error about derived
4728 2018-01-18 Nathan Sidwell <nathan@acm.org>
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.
4738 2018-01-18 Jakub Jelinek <jakub@redhat.com>
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.
4750 2018-01-17 Paolo Carlini <paolo.carlini@oracle.com>
4753 * decl.c (grokdeclarator): Do not append the error_mark_node
4754 due to an erroneous optional attribute-specifier-seq.
4756 2018-01-17 Jakub Jelinek <jakub@redhat.com>
4759 * cp-gimplify.c (cp_maybe_instrument_return): Handle
4762 2018-01-17 Paolo Carlini <paolo.carlini@oracle.com>
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.
4769 2018-01-17 Nathan Sidwell <nathan@acm.org>
4772 * init.c (build_raw_new_expr): Scan list for lookups to keep.
4774 2018-01-17 David Malcolm <dmalcolm@redhat.com>
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.
4781 2018-01-17 Jason Merrill <jason@redhat.com>
4783 PR c++/81067 - redundant NULL warning.
4784 * call.c (convert_like_real): Restore null_node handling.
4786 2018-01-17 Jason Merrill <jason@redhat.com>
4788 PR c++/81843 - ICE with variadic member template.
4790 * pt.c (unify_pack_expansion): Don't try to deduce enclosing
4793 2018-01-17 David Malcolm <dmalcolm@redhat.com>
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.
4801 2018-01-17 Nathan Sidwell <nathan@acm.org>
4804 * pt.c (tsubst_expr) <case RANGE_FOR_STMT>: Rebuild a range_for if
4805 this not a final instantiation.
4807 2018-01-16 Jason Merrill <jason@redhat.com>
4809 PR c++/83714 - ICE checking return in template.
4810 * typeck.c (check_return_expr): Call build_non_dependent_expr.
4812 2018-01-16 Jakub Jelinek <jakub@redhat.com>
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.
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.
4825 2018-01-15 Martin Sebor <msebor@redhat.com>
4828 * class.c (find_flexarrays): Make a record of multiple flexible array
4831 2018-01-12 Jason Merrill <jason@redhat.com>
4833 PR c++/83186 - ICE with static_cast of list-initialized temporary.
4834 * typeck.c (build_static_cast): Use build_non_dependent_expr.
4836 2018-01-12 Nathan Sidwell <nathan@acm.org>
4838 * cp-tree.h (mark_rvalue_use): Add parm name.
4839 * expr.c (mark_lvalue_use, mark_lvalue_use_nonread): Move next to
4841 * call.c (convert_like_real): Fix formatting.
4843 2018-01-11 Jason Merrill <jason@redhat.com>
4845 PR c++/82728 - wrong -Wunused-but-set-variable
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.
4853 2018-01-11 Nathan Sidwell <nathan@acm.org>
4855 * method.c (enum mangling_flags): Delete long-dead enum.
4857 2018-01-10 Paolo Carlini <paolo.carlini@oracle.com>
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.
4864 2018-01-10 David Malcolm <dmalcolm@redhat.com>
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
4913 (build_address): Use location of operand when building address
4916 2018-01-10 Marek Polacek <polacek@redhat.com>
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.
4923 2018-01-10 Jakub Jelinek <jakub@redhat.com>
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
4933 (build_over_call): Call maybe_warn_class_memaccess here on the
4935 (build_cxx_call): Rather than here on converted arguments.
4937 2018-01-10 Paolo Carlini <paolo.carlini@oracle.com>
4940 * init.c (build_vec_init): Avoid building an INIT_EXPR with
4941 error_mark_node as second argument.
4943 2018-01-09 Jakub Jelinek <jakub@redhat.com>
4946 * constexpr.c (cxx_eval_statement_list): Ignore DEBUG_BEGIN_STMTs
4947 in STATEMENT_LIST. Remove unneeded assert.
4949 2018-01-03 Richard Sandiford <richard.sandiford@linaro.org>
4950 Alan Hayward <alan.hayward@arm.com>
4951 David Sherwood <david.sherwood@arm.com>
4953 * constexpr.c (cxx_eval_array_reference): Handle polynomial
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.
4963 2018-01-03 Jakub Jelinek <jakub@redhat.com>
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.
4973 2018-01-03 Nathan Sidwell <nathan@acm.org>
4976 * method.c (make_alias_for): Copy DECL_CONTEXT.
4978 2018-01-03 Marek Polacek <polacek@redhat.com>
4981 * decl.c (grokdeclarator): Don't warn about MVP in typename context.
4983 2018-01-03 Jakub Jelinek <jakub@redhat.com>
4985 PR preprocessor/83602
4986 * name-lookup.c (lookup_name_fuzzy): Don't use macro_use_before_def
4990 * cp-gimplify.c (cp_fold) <case NOP_EXPR>: If the operand folds to
4991 error_mark_node, return error_mark_node.
4993 Update copyright years.
4995 2018-01-02 Jakub Jelinek <jakub@redhat.com>
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
5005 2018-01-02 Nathan Sidwell <nathan@acm.org>
5007 * constexpr.c (cxx_bind_parameters_in_call): Remove unneeded local
5010 Copyright (C) 2018 Free Software Foundation, Inc.
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.