1 2018-12-20 H.J. Lu <hongjiu.lu@intel.com>
4 * call.c (convert_for_arg_passing): Call
5 warn_for_address_or_pointer_of_packed_member.
6 * typeck.c (convert_for_assignment): Likewise.
8 2018-12-20 Jakub Jelinek <jakub@redhat.com>
11 * parser.c (cp_parser_class_specifier_1): If
12 cp_parser_check_type_definition fails, skip default arguments, NSDMIs,
13 etc. like for erroneous template args.
15 * cp-tree.h (cp_fully_fold_init): Declare.
16 * cp-gimplify.c (cp_fully_fold_init): New function.
17 * typeck2.c (split_nonconstant_init, store_init_value): Use it
18 instead of cp_fully_fold.
20 2018-12-19 Segher Boessenkool <segher@kernel.crashing.org>
22 * parser.c (cp_parser_asm_definition): Do not allow any asm qualifiers
25 2018-12-19 Segher Boessenkool <segher@kernel.crashing.org>
27 * parser.c (cp_parser_asm_definition) <RID_CONST, RID_RESTRICT>: Give
28 a more specific error message (instead of just falling through).
30 2018-12-19 Segher Boessenkool <segher@kernel.crashing.org>
32 * parser.c (cp_parser_asm_definition): Rewrite the loop to work without
33 "done" boolean variable.
34 * parser.c (cp_parser_asm_definition): Keep track of the location each
35 asm qualifier is first seen; use that to give nicer "duplicate asm
38 2018-12-19 Segher Boessenkool <segher@kernel.crashing.org>
40 * parser.c (cp_parser_asm_definition): Rewrite the loop to work without
41 "done" boolean variable.
43 2018-12-19 David Malcolm <dmalcolm@redhat.com>
46 * typeck.c (convert_for_assignment): Capture location of rhs
47 before stripping, and if available. Use the location when
48 complaining about bad conversions, labelling it with the
49 rhstype if the location was present.
50 * typeck2.c (digest_init_r): Capture location of init before
53 2018-12-19 David Malcolm <dmalcolm@redhat.com>
56 * call.c (op_error): Convert 1st param from location_t to
57 const op_location_t &. Use binary_op_rich_location for binary
59 (build_conditional_expr_1): Convert 1st param from location_t to
60 const op_location_t &.
61 (build_conditional_expr): Likewise.
62 (build_new_op_1): Likewise.
63 (build_new_op): Likewise.
64 * cp-tree.h (build_conditional_expr): Likewise.
65 (build_new_op): Likewise.
66 (build_x_binary_op): Likewise.
67 (cp_build_binary_op): Likewise.
68 * parser.c (cp_parser_primary_expression): Build a location
69 for id-expression nodes.
70 (cp_parser_binary_expression): Use an op_location_t when
71 calling build_x_binary_op.
72 (cp_parser_operator): Build a location for user-defined literals.
73 * typeck.c (build_x_binary_op): Convert 1st param from location_t
74 to const op_location_t &.
75 (cp_build_binary_op): Likewise. Use binary_op_rich_location.
77 2018-12-19 David Malcolm <dmalcolm@redhat.com>
81 * call.c (build_conditional_expr_1): Strip location wrappers when
82 checking for CONST_DECL.
83 (conversion_null_warnings): Use location of "expr" if available.
84 * class.c (fixed_type_or_null): Handle location wrappers.
85 * constexpr.c (potential_constant_expression_1): Likewise.
86 * cvt.c (ignore_overflows): Strip location wrappers when
87 checking for INTEGER_CST, and re-wrap the result if present.
88 (ocp_convert): Call fold_for_warn before checking for INTEGER_CST.
89 * decl.c (reshape_init_r): Strip any location wrapper.
90 (undeduced_auto_decl): Likewise.
91 * expr.c (mark_discarded_use): Likewise for expr.
92 * init.c (build_aggr_init): Likewise before checking init for
94 (warn_placement_new_too_small): Call fold_for_warn on adj before
95 checking for CONSTANT_CLASS_P, and on nelts. Strip any location
96 wrapper from op0 and on oper before checking for VAR_P.
97 * parser.c (cp_parser_primary_expression): Call
98 maybe_add_location_wrapper on numeric and string literals.
99 (cp_parser_postfix_expression): Strip any location wrapper when
100 checking for DECL_IS_BUILTIN_CONSTANT_P.
101 (cp_parser_unary_expression): Ensure that folding of NEGATE_EXPR
102 around a constant happens in the presence of location wrappers and
103 returns a wrapped result.
104 (cp_parser_has_attribute_expression): Strip any location wrapper
106 (cp_parser_binary_expression): Strip any location wrapper when
107 checking for DECL_P on the lhs.
108 (cp_parser_decltype): Strip any location wrapper from result of
109 cp_parser_decltype_expr.
110 (cp_parser_mem_initializer): Add location wrappers to the
111 parenthesized expression list.
112 (cp_parser_template_parameter_list): Don't create wrapper nodes
113 within a template-parameter-list.
114 (cp_parser_template_argument_list): Don't create wrapper nodes
115 within a template-argument-list.
116 (cp_parser_parameter_declaration): Strip location wrappers from
118 (cp_parser_gnu_attribute_list): Don't create wrapper nodes.
119 (cp_parser_std_attribute_spec_seq): Likewise.
120 (cp_parser_omp_all_clauses): Don't create wrapper nodes within
122 (cp_parser_omp_for_loop): Likewise.
123 (cp_parser_omp_declare_reduction_exprs): Likewise.
124 * pt.c (convert_nontype_argument_function): Strip location
125 wrappers from fn_no_ptr before checking for FUNCTION_DECL.
126 (tsubst_default_argument): Move note about which callsite led to
127 instantiation to after the check_default_argument call.
128 (do_auto_deduction): Likewise from init before checking for
130 * semantics.c (force_paren_expr): Likewise from expr before
132 (finish_parenthesized_expr): Likewise from expr before
133 checking for STRING_CST.
134 (perform_koenig_lookup): Likewise from fn.
135 (finish_call_expr): Likewise.
136 (finish_id_expression): Rename to...
137 (finish_id_expression_1): ...this, calling
138 maybe_add_location_wrapper on the result.
139 (capture_decltype): Use lookup_name_real rather than value_member
140 when looking up decl within the capture-list.
141 * tree.c (cp_stabilize_reference): Strip any location wrapper.
142 (builtin_valid_in_constant_expr_p): Likewise.
143 (strip_typedefs_expr): Strip any location wrapper before checking
144 for decls or constants.
145 (is_overloaded_fn): Likewise.
146 (maybe_get_fns): Likewise.
147 (selftest::test_lvalue_kind): Verify lvalue_p.
148 * typeck.c (cxx_sizeof_expr): Strip any location wrapper.
149 (cxx_alignof_expr): Likewise.
150 (is_bitfield_expr_with_lowered_type): Handle location wrappers.
151 (cp_build_array_ref): Call maybe_constant_value on "idx".
152 (cp_build_binary_op): Strip location wrapper from first_arg before
153 checking for PARM_DECL. Likewise for op1 before checking for
154 INTEGER_CST in two places. Likewise for orig_op0 and orig_op1
155 when checking for STRING_CST.
156 (cp_build_addr_expr_1): Likewise for arg when checking for
158 (cp_build_modify_expr): Likewise for newrhs when checking for
160 (convert_for_assignment): Don't strip location wrappers when
161 stripping NON_LVALUE_EXPR.
162 (maybe_warn_about_returning_address_of_local): Strip location
163 wrapper from whats_returned before checking for DECL_P.
164 (can_do_nrvo_p): Strip location wrapper from retval.
165 (treat_lvalue_as_rvalue_p): Likewise.
166 (check_return_expr): Likewise.
167 * typeck2.c (cxx_incomplete_type_diagnostic): Strip location
168 wrapper from value before checking for VAR_P or PARM_DECL.
169 (digest_init_r): Strip location wrapper from init. When
170 copying "init", also copy the wrapped node.
172 2018-12-19 Jakub Jelinek <jakub@redhat.com>
175 * constexpr.c (cxx_eval_constant_expression) <case CONSTRUCTOR>: Do
176 re-process TREE_CONSTANT CONSTRUCTORs if they aren't reduced constant
179 2018-12-19 Alexandre Oliva <aoliva@redhat.com>
182 * pt.c (convert_template_argument): Canonicalize type after
186 * method.c (do_build_copy_constructor): Guard cvquals init and
187 loop over fields to run for non-inherited ctors only.
188 (synthesize_method): Retain location of inherited ctor.
190 2018-12-17 Jakub Jelinek <jakub@redhat.com>
193 * cp-gimplify.c (cp_fold) <case ADDR_EXPR>: For offsetof-like folding,
194 call maybe_constant_value on val to see if it is INTEGER_CST.
196 2018-12-17 Jonathan Wakely <jwakely@redhat.com>
199 * typeck.c (build_static_cast): Print a note when the destination
200 type or the operand is a pointer/reference to incomplete class type.
202 2018-12-16 Jakub Jelinek <jakub@redhat.com>
205 * except.c (verify_library_fn): New function.
206 (declare_library_fn): Use it. Initialize TM even if the non-TM
207 library function has been user declared.
208 (do_end_catch): Don't set TREE_NOTHROW on error_mark_node.
209 (expand_start_catch_block): Don't call initialize_handler_parm
211 (build_throw): Use verify_library_fn. Initialize TM even if the
212 non-TM library function has been user declared. Don't crash if
213 any library fn is error_mark_node.
215 2018-12-14 Jason Merrill <jason@redhat.com>
217 * pt.c (tsubst_expr) [DECL_EXPR]: Ignore class-scope bindings when
218 looking up a capture proxy.
220 2018-12-15 Paolo Carlini <paolo.carlini@oracle.com>
223 * decl.c (check_tag_decl): A decltype with no declarator
224 doesn't declare anything.
226 2018-12-14 Alexandre Oliva <aoliva@redhat.com>
229 * pt.c (tsubst_exception_specification): Handle
230 DEFERRED_NOEXCEPT with !defer_ok.
232 2018-12-14 Jason Merrill <jason@redhat.com>
235 * parser.c (cp_parser_template_id): Rearrange deferred access
236 checks into the firewall.
238 2018-12-14 Jakub Jelinek <jakub@redhat.com>
242 * init.c (build_vec_init): Change num_initialized_elts type from int
243 to HOST_WIDE_INT. Build a RANGE_EXPR if e needs to be repeated more
246 2018-12-13 Marek Polacek <polacek@redhat.com>
248 PR c++/88216 - ICE with class type in non-type template parameter.
249 * mangle.c (write_expression): Handle TARGET_EXPR and
251 * pt.c (convert_nontype_argument): Don't call
252 get_template_parm_object for value-dependent expressions.
254 2018-12-13 Nathan Sidwell <nathan@acm.org>
257 * class.c (finish_struct): Set DECL_CONTEXT of template assign op.
258 * name-lookup.c (get_class_binding_direct): Don't strip using-decl
260 * parser.c (cp_parser_postfix_expression): Cope with using decl in
262 * semantics.c (finish_id_expr): Likewise.
264 2018-12-12 Paolo Carlini <paolo.carlini@oracle.com>
266 * decl.c (grokdeclarator): Fix location of error message about
267 static data member definition.
269 2018-12-12 Jakub Jelinek <jakub@redhat.com>
272 * cp-tree.h (maybe_constant_value): Add manifestly_const_eval
274 * constexpr.c (struct constexpr_call): Rename pretend_const_required
275 member to manifestly_const_eval.
276 (struct constexpr_ctx): Likewise.
277 (constexpr_call_hasher::equal): Adjust users.
278 (cxx_eval_builtin_function_call): Likewise. Formatting fix.
279 (cxx_eval_call_expression): Adjust users.
280 (cxx_eval_outermost_constant_expr, maybe_constant_init_1,
281 maybe_constant_init): Rename pretend_const_required argument to
282 manifestly_const_eval, adjust function comments.
283 (maybe_constant_value): Add manifestly_const_eval argument. If true,
284 don't cache and call cxx_eval_outermost_constant_expr with true as
285 manifestly_const_eval.
286 * decl.c (compute_array_index_type_loc): Call maybe_constant_value
287 with true as manifestly_const_eval.
290 * constexpr.c (struct constexpr_call): Add pretend_const_required
292 (constexpr_call_hasher::equal): Return false if pretend_const_required
294 (cxx_eval_call_expression): Adjust new_call initialization. Hash in
295 ctx->pretend_const_required.
297 2018-12-11 Jakub Jelinek <jakub@redhat.com>
300 * class.c (build_vtbl_initializer): For TARGET_VTABLE_USES_DESCRIPTORS
301 bump index for each added word.
302 * constexpr.c (find_array_ctor_elt): Add forward declaration.
303 (cxx_eval_call_expression): Handle TARGET_VTABLE_USES_DESCRIPTORS
305 (cxx_eval_constant_expression) <case OBJ_TYPE_REF>: Divide token
306 by TARGET_VTABLE_USES_DESCRIPTORS if non-zero.
308 2018-12-11 Marek Polacek <polacek@redhat.com>
310 PR c++/86608 - reading constexpr volatile variable.
311 * constexpr.c (potential_constant_expression_1): Check want_rval
312 instead of checking if we have a decl.
313 * decl2.c (decl_maybe_constant_var_p): Don't consider volatile
314 constexpr variables as maybe constant.
316 2018-12-11 Paolo Carlini <paolo.carlini@oracle.com>
318 * decl.c (grokvardecl): Add location_t parameter and use it
319 in build_lang_decl_loc and build_decl calls.
320 (grokdeclarator): Move up loc declaration and use it in the
321 grokvardecl call too.
323 2018-12-09 Cesar Philippidis <cesar@codesourcery.com>
325 * parser.c (cp_parser_oacc_kernels_parallel): Adjust EXPR_LOCATION
326 on the combined acc loop.
328 2018-12-07 Paolo Carlini <paolo.carlini@oracle.com>
330 * decl2.c (grokbitfield): Use DECL_SOURCE_LOCATION in error messages
331 about bit-fields with function type, warn_if_not_aligned type, and
332 static bit-fields; avoid DECL_NAME for unnamed declarations.
334 2018-12-07 Jakub Jelinek <jakub@redhat.com>
337 * call.c (make_temporary_var_for_ref_to_temp): Call pushdecl even for
341 * constexpr.c (adjust_temp_type): Handle EMPTY_CLASS_EXPR.
343 2018-12-06 Paolo Carlini <paolo.carlini@oracle.com>
345 * class.c (check_bitfield_decl): In error message about non-integral
346 type print the type itself too.
347 * decl.c (grokdeclarator): Do not ICE on unnamed bit-fields declared
348 friends; when calling build_decl for a FIELD_DECL possibly pass the
351 2018-12-06 Alexandre Oliva <aoliva@redhat.com>
354 * pt.c (tsubst_friend_class): Enter tsubsted class context.
357 * except.c (build_noexcept_spec): Resolve nondependent
360 2018-12-06 Jason Merrill <jason@redhat.com>
362 PR c++/88136 - -Wdeprecated-copy false positives
363 * class.c (classtype_has_depr_implicit_copy): Rename from
364 classtype_has_user_copy_or_dtor.
365 * method.c (lazily_declare_fn): Adjust.
366 * decl2.c (cp_warn_deprecated_use): Refer to -Wdeprecated-copy-dtor
367 if deprecation is due to a destructor.
369 2018-12-06 Marek Polacek <polacek@redhat.com>
371 PR c++/88373 - wrong parse error with ~.
372 * parser.c (cp_parser_template_name): Check tag_type for
375 2018-12-06 Segher Boessenkool <segher@kernel.crashing.org>
377 * cp-tree.h (finish_asm_stmt): Update declaration.
378 * parser.c (cp_parser_asm_definition): Detect the inline keyword
379 after asm. Pass a flag for it to finish_asm_stmt.
380 * pt.c (tsubst_expr): Pass the ASM_INLINE_P flag to finish_asm_stmt.
381 * semantics.c (finish_asm_stmt): Add inline_p parameter. Use it to
384 2018-12-06 Segher Boessenkool <segher@kernel.crashing.org>
387 * parser.c (cp_parser_asm_definition): Update grammar. Allow any
388 combination of volatile and goto, in any order, without repetitions.
390 2018-12-06 David Malcolm <dmalcolm@redhat.com>
393 * call.c (conversion_null_warnings): Try to use the location of
394 the expression for the warnings. Add notes showing the parameter
395 of the function decl, where available.
396 (get_fndecl_argument_location): For implicitly-declared functions,
397 use the fndecl location rather than that of the param.
398 (maybe_inform_about_fndecl_for_bogus_argument_init): New function.
399 (convert_like_real): Use it in various places to avoid repetition.
400 (complain_about_bad_argument): Likewise.
401 * cp-tree.h (maybe_inform_about_fndecl_for_bogus_argument_init):
403 * decl2.c (check_default_args): Put all diagnostics for the fndecl
404 into a diagnostic group. Use the location of the parameter when
405 complaining about parameters with missing default arguments in
406 preference to that of the fndecl. Attempt to record the location
407 of the first parameter with a default argument and emit a note
408 for the first parameter that's missing one.
409 * typeck.c (convert_arguments): When complaining about parameters
410 with incomplete types, attempt to use the location of the
411 argument. Where available, add a note showing the pertinent
412 parameter in the fndecl.
413 (convert_for_assignment): When complaining about bad conversions
414 at function calls, use the location of the unstripped argument.
415 (convert_for_initialization): When checking for bogus references,
416 add an auto_diagnostic_group, and update the note to use the
417 location of the pertinent parameter, rather than just the callee.
419 2018-12-06 Paolo Carlini <paolo.carlini@oracle.com>
421 * decl2.c (grokbitfield): Use DECL_SOURCE_LOCATION in error message;
422 print the type too; fix thinko in INDIRECT_TYPE_P use.
424 2018-12-05 Alexandre Oliva <aoliva@redhat.com>
427 * constexpr.c (adjust_temp_type): Test for type equality with
429 (constexpr_call_hasher::equal): Likewise.
431 2018-12-04 Paolo Carlini <paolo.carlini@oracle.com>
434 * decl.c (grokdeclarator): Avoid crashing on an anonymous bit-field
437 2018-12-04 Marek Polacek <polacek@redhat.com>
439 PR c++/88184 - ICE when treating name as template-name.
440 * pt.c (lookup_template_function): Always build the TEMPLATE_ID_EXPR
441 with unknown_type_node.
443 2018-12-04 Julian Brown <julian@codesourcery.com>
445 * parser.c (cp_parser_oacc_wait_list): Fix error message and avoid
446 duplicate diagnostic.
448 2018-12-04 Jakub Jelinek <jakub@redhat.com>
451 * typeck.c (build_class_member_access_expr): If unary_complex_lvalue
452 turned xvalue_p into non-xvalue_p, call move on it.
454 2018-12-02 Jakub Jelinek <jakub@redhat.com>
457 * parser.c (cp_parser_skip_to_closing_parenthesis_1,
458 cp_parser_skip_to_end_of_statement,
459 cp_parser_skip_to_end_of_block_or_statement,
460 cp_parser_skip_to_closing_brace,
461 cp_parser_skip_to_closing_square_bracket,
462 cp_parser_skip_balanced_tokens): Don't treat CPP_PRAGMA_EOL specially
463 if in_pragma is false.
465 2018-12-01 Marek Polacek <polacek@redhat.com>
467 Implement P0634R3, Down with typename!
468 * parser.c (CP_PARSER_FLAGS_TYPENAME_OPTIONAL): New enumerator.
469 (cp_parser_type_name): Remove declaration.
470 (cp_parser_postfix_expression): Pass CP_PARSER_FLAGS_TYPENAME_OPTIONAL
471 to cp_parser_type_id.
472 (cp_parser_new_type_id): Pass CP_PARSER_FLAGS_TYPENAME_OPTIONAL to
473 cp_parser_type_specifier_seq.
474 (cp_parser_lambda_declarator_opt): Pass
475 CP_PARSER_FLAGS_TYPENAME_OPTIONAL to
476 cp_parser_parameter_declaration_clause.
477 (cp_parser_condition): Pass CP_PARSER_FLAGS_NONE to
478 cp_parser_declarator.
479 (cp_parser_simple_declaration): Pass CP_PARSER_FLAGS_NONE to
480 cp_parser_init_declarator.
481 (cp_parser_conversion_type_id): Pass CP_PARSER_FLAGS_NONE to
482 cp_parser_type_specifier_seq.
483 (cp_parser_default_type_template_argument): Pass
484 CP_PARSER_FLAGS_TYPENAME_OPTIONAL to cp_parser_type_id.
485 (cp_parser_template_parameter): Pass CP_PARSER_FLAGS_TYPENAME_OPTIONAL
486 to cp_parser_parameter_declaration.
487 (cp_parser_explicit_instantiation): Pass CP_PARSER_FLAGS_NONE to
488 cp_parser_declarator.
489 (cp_parser_simple_type_specifier): Adjust call to cp_parser_type_name
490 to relay if we should treat the typename keyword as optional. Maybe
491 call cp_parser_make_typename_type is parsing a template-id and it's
493 (cp_parser_type_name): Remove unused function.
494 (cp_parser_enum_specifier): Pass to CP_PARSER_FLAGS_NONE
495 cp_parser_type_specifier_seq.
496 (cp_parser_alias_declaration): Pass CP_PARSER_FLAGS_TYPENAME_OPTIONAL
497 to cp_parser_type_id.
498 (cp_parser_init_declarator): New parameter. Pass it down to
499 cp_parser_declarator.
500 (cp_parser_declarator): New parameter. Pass CP_PARSER_FLAGS_NONE to
501 cp_parser_declarator. Pass the new parameter to
502 cp_parser_direct_declarator.
503 (cp_parser_direct_declarator): New parameter. Pass it to
504 cp_parser_parameter_declaration_clause and cp_parser_declarator.
505 (cp_parser_declarator_id):
506 (cp_parser_type_id_1): New parameter. Pass it to
507 cp_parser_type_specifier_seq. Adjust call to cp_parser_declarator.
508 (cp_parser_type_id): New parameter. Pass it to cp_parser_type_id_1.
509 (cp_parser_template_type_arg): Pass CP_PARSER_FLAGS_NONE to
511 (cp_parser_trailing_type_id): Pass CP_PARSER_FLAGS_TYPENAME_OPTIONAL
512 to cp_parser_type_id_1.
513 (cp_parser_type_specifier_seq): New parameter.
514 (function_being_declared_is_template_p):
515 (cp_parser_parameter_declaration_clause): New parameter. Pass it to
516 cp_parser_parameter_declaration_list.
517 (cp_parser_parameter_declaration_list): New parameter. Pass it to
518 cp_parser_parameter_declaration.
519 (cp_parser_parameter_declaration): New parameter. Pass it to
520 cp_parser_decl_specifier_seq. Pass CP_PARSER_FLAGS_NONE to
521 cp_parser_declarator.
522 (cp_parser_member_declaration): Adjust call to
523 cp_parser_decl_specifier_seq to also include
524 CP_PARSER_FLAGS_TYPENAME_OPTIONAL. Pass
525 CP_PARSER_FLAGS_TYPENAME_OPTIONAL to cp_parser_declarator.
526 (cp_parser_exception_declaration): Pass CP_PARSER_FLAGS_NONE to
527 cp_parser_type_specifier_seq and cp_parser_declarator.
528 (cp_parser_requirement_parameter_list): Pass CP_PARSER_FLAGS_NONE to
529 cp_parser_parameter_declaration_clause.
530 (cp_parser_constructor_declarator_p): Resolve the TYPENAME_TYPE.
531 (cp_parser_single_declaration): Pass CP_PARSER_FLAGS_TYPENAME_OPTIONAL
532 to cp_parser_decl_specifier_seq and cp_parser_init_declarator.
533 (cp_parser_cache_defarg): Pass CP_PARSER_FLAGS_NONE to
534 cp_parser_declarator and cp_parser_parameter_declaration_list.
535 (cp_parser_objc_method_tail_params_opt): Pass CP_PARSER_FLAGS_NONE to
536 cp_parser_parameter_declaration.
537 (cp_parser_objc_class_ivars): Pass CP_PARSER_FLAGS_NONE to
538 cp_parser_declarator.
539 (cp_parser_objc_try_catch_finally_statement): Pass CP_PARSER_FLAGS_NONE
540 to cp_parser_parameter_declaration
541 (cp_parser_objc_struct_declaration): Pass CP_PARSER_FLAGS_NONE to
542 cp_parser_declarator.
543 (cp_parser_omp_for_loop_init): Pass CP_PARSER_FLAGS_NONE to
544 cp_parser_declarator and cp_parser_type_specifier_seq.
546 2018-11-30 David Malcolm <dmalcolm@redhat.com>
548 * typeck2.c: Include "gcc-rich-location.h".
549 (cxx_incomplete_type_diagnostic): When complaining about possibly
550 missing parens, add a fix-it hint if the member function takes no
553 2018-11-30 James Norris <jnorris@codesourcery.com>
555 * parser.c (cp_parser_oacc_enter_exit_data): Use existing local
558 2018-11-29 Paolo Carlini <paolo.carlini@oracle.com>
560 * decl.c (compute_array_index_type_loc): New, like the current
561 compute_array_index_type but takes a location_t too.
562 (compute_array_index_type): Forward to the latter.
563 (create_array_type_for_decl): Use compute_array_index_type_loc.
565 2018-11-29 David Malcolm <dmalcolm@redhat.com>
568 * cp-name-hint.h (suggest_alternative_in_scoped_enum): New decl.
569 * error.c (dump_scope): Ensure that we print any scope for values
570 of unscoped enums. Print the scope of values of scoped enums.
571 (qualified_name_lookup_error): Offer suggestions for failures
572 within scoped enums by calling suggest_alternative_in_scoped_enum.
573 * name-lookup.c (class namespace_hints): Update comment to mention
575 (namespace_hints::namespace_hints): Call
576 maybe_add_candidate_for_scoped_enum.
577 (namespace_hints::maybe_add_candidate_for_scoped_enum): New member
578 (suggest_alternatives_for): Update comment to mention scoped
580 (suggest_alternative_in_scoped_enum): New function.
582 2018-11-28 Marek Polacek <polacek@redhat.com>
584 Implement P1094R2, Nested inline namespaces.
585 * parser.c (cp_parser_namespace_definition): Parse the optional inline
586 keyword in a nested-namespace-definition. Adjust push_namespace call.
589 2018-11-28 Nathan Sidwell <nathan@acm.org>
592 * class.c (finish_struct): In a template, add artificial using
595 2018-11-28 Jan Hubicka <hubicka@ucw.cz>
597 * except.c (do_allocate_exception): Annotate __cxa_allocate_exception
600 2018-11-28 Marek Polacek <polacek@redhat.com>
602 PR c++/88222 - ICE with bit-field with invalid type.
603 * decl.c (grokdeclarator): Check if declarator is null.
605 2018-11-28 Jakub Jelinek <jakub@redhat.com>
608 * typeck2.c (digest_init_r): Re-add handing of signed/unsigned char
609 strings and add it to the initialization of wide array from non-wide
610 string diagnostics too.
612 2018-11-27 Jakub Jelinek <jakub@redhat.com>
615 * decl.c (grokdeclarator): Don't diagnose deduction guide errors
619 * class.c (fixup_attribute_variants): Also propagate TYPE_PACKED
622 2018-11-26 Marek Polacek <polacek@redhat.com>
624 PR c++/88120 - ICE when calling save_expr in a template.
625 * typeck.c (cp_build_binary_op): Call cp_save_expr instead of
628 2018-11-22 Jakub Jelinek <jakub@redhat.com>
631 * parser.c (cp_parser_operator): Use str.get_value () instead of just
632 str in USERDEF_LITERAL_VALUE and USERDEF_LITERAL_SUFFIX_ID arguments.
634 2018-11-21 Jakub Jelinek <jakub@redhat.com>
637 * method.c (maybe_explain_implicit_delete): If
638 FUNCTION_FIRST_USER_PARMTYPE (decl) is NULL, set const_p to false
642 * parser.c (cp_parser_primary_expression): Use
643 id_expression.get_location () instead of id_expr_token->location.
644 Adjust the range from id_expr_token->location to
645 id_expressio.get_finish ().
646 (cp_parser_operator_function_id): Pass location of the operator
647 token down to cp_parser_operator.
648 (cp_parser_operator): Add start_loc argument, always construct a
649 location with caret at start_loc and range from start_loc to the
650 finish of the last token.
653 * parser.c (cp_parser_linkage_specification): Remove useless
654 dereference of the consume_open method result.
656 2018-11-20 Martin Sebor <msebor@redhat.com>
658 * cp-tree.h (cp_check_const_attributes): Declare.
659 * decl2.c (cp_check_const_attributes): Declare extern.
660 * parser.c (cp_parser_has_attribute_expression): New function.
661 (cp_parser_unary_expression): Handle RID_HAS_ATTRIBUTE_EXPRESSION.
662 (cp_parser_gnu_attribute_list): Add argument.
664 2018-11-20 Jakub Jelinek <jakub@redhat.com>
667 * constexpr.c (cxx_eval_constant_expression) <case OBJ_TYPE_REF>: Punt
668 if get_base_address of ADDR_EXPR operand is not a DECL_P.
670 2018-11-19 Marek Polacek <polacek@redhat.com>
672 PR c++/87781 - detect invalid elaborated-type-specifier.
673 * parser.c (cp_parser_elaborated_type_specifier): Ensure that
674 typename follows a nested-name-specifier.
676 2018-11-18 Paolo Carlini <paolo.carlini@oracle.com>
678 * decl2.c (grokfield): Remove obsolete _vptr check; fix
679 explicit template argument list error location.
681 2018-11-16 Kamlesh Kumar <kamleshbhalui@gmail.com>
685 * parser.c (cp_parser_noexcept_specification_opt): Call
686 inject_this_parameter.
688 2018-11-16 Jason Merrill <jason@redhat.com>
690 Implement P0479R5, [[likely]] and [[unlikely]].
691 * tree.c (handle_likeliness_attribute): New.
692 (std_attribute_table): Add likely/unlikely.
693 * cp-gimplify.c (lookup_hotness_attribute, remove_hotness_attribute)
694 (process_stmt_hotness_attribute, first_stmt): New.
695 (genericize_if_stmt): Check for duplicate predictions.
696 * parser.c (cp_parser_statement): Call
697 process_stmt_hotness_attribute.
698 (cp_parser_label_for_labeled_statement): Apply attributes to case.
699 * decl.c (finish_case_label): Give label in template type void.
700 * pt.c (tsubst_expr) [CASE_LABEL_EXPR]: Copy attributes.
701 [PREDICT_EXPR]: Handle.
703 2018-11-16 Nathan Sidwell <nathan@acm.org>
705 Remove ovl_used, it is no longer needed
706 * cp-tree.h (OVL_USED_P): Delete.
707 (lookup_keep): Delete.
708 * friend.c (add_friend): Don't call it.
709 * parser.c (lookup_literal_operator): Likewise.
710 (cp_parser_primary_expression): Likewise.
711 * semantics.c (perform_koenig_lookup): Likewise.
712 * pt.c (tsubst_copy <OVERLOAD>): Don't assert OVL_USED_P.
713 * tree.c (ovl_copy): Delete.
714 (ovl_insert): Remove OVL_USED_P checks.
715 (ovl_iterator::reveal_node): Likewise.
716 (ovl_iterator::remove__node): Likewise.
717 (ovl_used, lookup_keep): Delete.
720 * parser.c (lookup_literal_operator): Mark overload for keeping
721 when inside template. Refactor.
723 2018-11-15 Nathan Sidwell <nathan@acm.org>
727 * typeck.c (finish_class_member_access_expr): Conversion operator
728 to dependent type is dependent.
730 2018-11-15 Paolo Carlini <paolo.carlini@oracle.com>
732 * constexpr.c (ensure_literal_type_for_constexpr_object): Use
733 DECL_SOURCE_LOCATION in error_at calls.
735 2018-11-15 Nathan Sidwell <nathan@acm.org>
738 * cp-tree.h (enum special_function_kind): Add sfk_virtual_destructor.
739 * method.c (type_has_trivial_fn): Add it.
740 (SFK_DTOR_P): Likewise.
741 (synthesized_method_base_walk): Don't check access of vbases of
742 abstract classes when sfk_virtual_destructor.
743 (synthesized_method_walk): Skip vbases of abstract classes except
744 when sfk_virtual_destructor.
745 (get_defaulted_eh_spec): Set sfk_virtual_destructor as needed.
747 * cp-tree.h (enum special_function_kind): Reorder and comment.
748 * method.c (SFK_CTOR_P, SFK_DTOR_P, SFK_ASSIGN_P, SFK_COPY_P)
749 (SFK_MOVE_P): New predicates.
750 (walk_field_subobs, synthesized_method_base_walk): Drop
751 copy_arg_p, move_p, assign_p args. Use new SFK predicates. Order
752 parameters consistently.
753 (synthesized_method_walk): Drop ctor_p, copy_arg_p, move_p,
754 assign_p calculations. Use new SFK predicates. Adjust calls to
757 2018-11-14 Paolo Carlini <paolo.carlini@oracle.com>
759 * parser.c (make_id_declarator): Add location_t parameter.
760 (cp_parser_lambda_declarator_opt): Adjust call.
761 (cp_parser_decomposition_declaration): Likewise.
762 (cp_parser_alias_declaration): Likewise.
763 (cp_parser_direct_declarator): Likewise.
764 (cp_parser_member_declaration): Likewise.
765 (cp_parser_objc_class_ivars): Likewise.
766 * decl.c (grokdeclarator): Use declarator->id_loc in two error
769 2018-11-14 Jakub Jelinek <jakub@redhat.com>
771 P1236R1 - Signed integers are two's complement
772 * constexpr.c (cxx_eval_check_shift_p): Disable the signed LSHIFT_EXPR
775 2018-11-13 David Malcolm <dmalcolm@redhat.com>
777 * call.c: Replace "source_location" with "location_t".
778 * cp-tree.h: Likewise.
780 * name-lookup.c: Likewise.
781 * parser.c: Likewise.
782 * typeck.c: Likewise.
784 2018-11-12 Jason Merrill <jason@redhat.com>
786 Implement P0315R4, Lambdas in unevaluated contexts.
787 * decl2.c (min_vis_expr_r): Handle LAMBDA_EXPR.
788 * mangle.c (write_expression): Handle LAMBDA_EXPR.
789 * parser.c (cp_parser_lambda_expression): Allow lambdas in
790 unevaluated context. Start the tentative firewall sooner.
791 (cp_parser_lambda_body): Use cp_evaluated.
792 * pt.c (iterative_hash_template_arg): Handle LAMBDA_EXPR.
793 (tsubst_function_decl): Substitute a lambda even if it isn't
795 (tsubst_lambda_expr): Use cp_evaluated. Always complain.
796 (tsubst_copy_and_build) [LAMBDA_EXPR]: Do nothing if tf_partial.
797 * semantics.c (begin_class_definition): Allow in template parm list.
798 * tree.c (strip_typedefs_expr): Pass through LAMBDA_EXPR.
799 (cp_tree_equal): Handle LAMBDA_EXPR.
801 * pt.c (fn_type_unification): If we have a full set of explicit
802 arguments, go straight to substitution.
804 * decl2.c (min_vis_expr_r, expr_visibility): New.
805 (min_vis_r): Call expr_visibility.
806 (constrain_visibility_for_template): Likewise.
808 Implement P0722R3, destroying operator delete.
809 * call.c (std_destroying_delete_t_p, destroying_delete_p): New.
810 (aligned_deallocation_fn_p, usual_deallocation_fn_p): Use
812 (build_op_delete_call): Handle destroying delete.
813 * decl2.c (coerce_delete_type): Handle destroying delete.
814 * init.c (build_delete): Don't call dtor with destroying delete.
815 * optimize.c (build_delete_destructor_body): Likewise.
817 Implement P0780R2, pack expansion in lambda init-capture.
818 * parser.c (cp_parser_lambda_introducer): Parse pack init-capture.
819 * pt.c (tsubst_pack_expansion): Handle init-capture packs.
820 (lookup_init_capture_pack): New.
821 (tsubst_expr) [DECL_EXPR]: Use it.
822 (tsubst_lambda_expr): Remember field pack expansions for
825 * cp-tree.h (struct cp_evaluated): New.
826 * init.c (get_nsdmi): Use it.
827 * parser.c (cp_parser_enclosed_template_argument_list): Use it.
828 * pt.c (coerce_template_parms, tsubst_aggr_type): Use it.
830 2018-11-09 Jakub Jelinek <jakub@redhat.com>
832 * parser.c (cp_parser_omp_clause_final, cp_parser_omp_clause_if): Use
833 cp_parser_assignment_expression instead of cp_parser_condition.
834 (cp_parser_omp_clause_num_threads, cp_parser_omp_clause_num_tasks,
835 cp_parser_omp_clause_grainsize, cp_parser_omp_clause_priority,
836 cp_parser_omp_clause_num_teams, cp_parser_omp_clause_thread_limit,
837 cp_parser_omp_clause_linear, cp_parser_omp_clause_device): Use
838 cp_parser_assignment_expression instead of cp_parser_expression.
839 (cp_parser_omp_clause_hint): Likewise. Formatting fix.
841 * parser.c (cp_parser_omp_clause_reduction): Call sorry_at on
842 reduction clause with inscan modifier.
844 * parser.c (cp_parser_omp_requires): Call sorry_at on requires
845 clauses other than atomic_default_mem_order.
847 2018-11-09 Martin Sebor <msebor@redhat.com>
850 * pt.c (warn_spec_missing_attributes): Move code to attribs.c.
851 Call decls_mismatched_attributes.
853 2018-11-08 Jakub Jelinek <jakub@redhat.com>
855 * constexpr.c (potential_constant_expression_1): Handle OMP_DEPOBJ.
856 * cp-gimplify.c (cp_genericize_r): Handle
857 OMP_CLAUSE_{IN,TASK}_REDUCTION.
858 (cxx_omp_predetermined_sharing_1): Don't return
859 OMP_CLAUSE_DEFAULT_SHARED for const qualified decls with no mutable
860 member. Return OMP_CLAUSE_DEFAULT_FIRSTPRIVATE for this pointer.
861 * cp-objcp-common.c (cp_common_init_ts): Handle OMP_DEPOBJ.
862 * cp-tree.def (OMP_DEPOBJ): New tree code.
863 * cp-tree.h (OMP_ATOMIC_DEPENDENT_P): Return true also for first
864 argument being OMP_CLAUSE.
865 (OMP_DEPOBJ_DEPOBJ, OMP_DEPOBJ_CLAUSES): Define.
866 (cp_convert_omp_range_for, cp_finish_omp_range_for): Declare.
867 (finish_omp_atomic): Add LOC, CLAUSES and MO arguments. Remove
869 (finish_omp_for_block): Declare.
870 (finish_omp_flush): Add MO argument.
871 (finish_omp_depobj): Declare.
872 * cxx-pretty-print.c (cxx_pretty_printer::statement): Handle
874 * dump.c (cp_dump_tree): Likewise.
875 * lex.c (cxx_init): Likewise.
876 * parser.c: Include memmodel.h.
877 (cp_parser_for): Pass false as new is_omp argument to
879 (cp_parser_range_for): Add IS_OMP argument, return before finalizing
881 (cp_parser_omp_clause_name): Handle nontemporal, in_reduction and
882 task_reduction clauses.
883 (cp_parser_omp_var_list_no_open): Handle
884 OMP_CLAUSE_{IN,TASK}_REDUCTION. For OMP_CLAUSE_DEPEND, parse clause
885 operands as either an array section, or lvalue assignment expression.
886 (cp_parser_omp_clause_if): Handle cancel and simd modifiers.
887 (cp_parser_omp_clause_defaultmap): Parse new kinds of defaultmap
889 (cp_parser_omp_clause_reduction): Add IS_OMP and KIND arguments.
890 Parse reduction modifiers. Pass KIND to c_parser_omp_variable_list.
891 (cp_parser_omp_clause_lastprivate, cp_parser_omp_iterators): New
893 (cp_parser_omp_clause_depend): Parse iterator modifier and handle
894 iterators. Parse mutexinoutset and depobj kinds.
895 (cp_parser_oacc_all_clauses): Adjust cp_parser_omp_clause_reduction
897 (cp_parser_omp_all_clauses): Likewise. Handle
898 PRAGMA_OMP_CLAUSE_NONTEMPORAL and
899 PRAGMA_OMP_CLAUSE_{IN,TASK}_REDUCTION. Call
900 cp_parser_omp_clause_lastprivate for OpenMP lastprivate clause.
901 (cp_parser_omp_atomic): Pass pragma_tok->location as
902 LOC to finish_omp_atomic. Parse hint and memory order clauses.
903 Handle default memory order from requires directive if any. Adjust
904 finish_omp_atomic caller.
905 (cp_parser_omp_critical): Allow comma in between (name) and hint
907 (cp_parser_omp_depobj): New function.
908 (cp_parser_omp_flush): Parse flush with memory-order-clause.
909 (cp_parser_omp_for_cond): Allow NE_EXPR even in OpenMP loops.
910 (cp_convert_omp_range_for, cp_finish_omp_range_for): New functions.
911 (cp_parser_omp_for_loop): Parse C++11 range for loops among omp
912 loops. Handle OMP_CLAUSE_IN_REDUCTION like OMP_CLAUSE_REDUCTION.
913 (OMP_SIMD_CLAUSE_MASK): Add if and nontemporal clauses.
914 (cp_parser_omp_simd, cp_parser_omp_for): Call keep_next_level before
915 begin_omp_structured_block and call finish_omp_for_block on
916 finish_omp_structured_block result.
917 (cp_parser_omp_master): Add p_name, mask and cclauses arguments.
918 Allow to be called while parsing combined parallel master.
919 Parse combined master taskloop{, simd}.
920 (cp_parser_omp_parallel): Parse combined
921 parallel master{, taskloop{, simd}} constructs.
922 (cp_parser_omp_single): Use SET_EXPR_LOCATION.
923 (OMP_TASK_CLAUSE_MASK): Add in_reduction clause.
924 (OMP_TASKWAIT_CLAUSE_MASK): Define.
925 (cp_parser_omp_taskwait): Handle taskwait with depend clauses.
926 (OMP_TASKGROUP_CLAUSE_MASK): Define.
927 (cp_parser_omp_taskgroup): Parse taskgroup clauses, adjust
928 c_finish_omp_taskgroup caller.
929 (cp_parser_omp_distribute): Call keep_next_level before
930 begin_omp_structured_block and call finish_omp_for_block on
931 finish_omp_structured_block result.
932 (cp_parser_omp_teams): Force a BIND_EXPR with BLOCK around teams
934 (cp_parser_omp_target_data): Allow target data with only
935 use_device_ptr clauses.
936 (cp_parser_omp_target): Set OMP_REQUIRES_TARGET_USED bit in
938 (cp_parser_omp_requires): New function.
939 (OMP_TASKLOOP_CLAUSE_MASK): Add reduction and in_reduction clauses.
940 (cp_parser_omp_taskloop): Add forward declaration. Disallow
941 in_reduction clause when combined with parallel master. Call
942 keep_next_level before begin_omp_structured_block and call
943 finish_omp_for_block on finish_omp_structured_block result.
944 (cp_parser_omp_construct): Adjust cp_parser_omp_master caller.
945 (cp_parser_pragma): Handle PRAGMA_OMP_DEPOBJ and PRAGMA_OMP_REQUIRES.
946 * pt.c (tsubst_omp_clause_decl): Add iterators_cache argument.
947 Adjust recursive calls. Handle iterators.
948 (tsubst_omp_clauses): Handle OMP_CLAUSE_{IN,TASK}_REDUCTION and
949 OMP_CLAUSE_NONTEMPORAL. Adjust tsubst_omp_clause_decl callers.
950 (tsubst_decomp_names):
951 (tsubst_omp_for_iterator): Change orig_declv into a reference.
952 Handle range for loops. Move orig_declv handling after declv/initv
954 (tsubst_expr): Force a BIND_EXPR with BLOCK around teams body.
955 Adjust finish_omp_atomic caller. Call keep_next_level before
956 begin_omp_structured_block. Call cp_finish_omp_range_for for range
957 for loops and use {begin,finish}_omp_structured_block instead of
958 {push,pop}_stmt_list if there are any range for loops. Call
959 finish_omp_for_block on finish_omp_structured_block result.
960 Handle OMP_DEPOBJ. Handle taskwait with depend clauses. For
961 OMP_ATOMIC call tsubst_omp_clauses on clauses if any, adjust
962 finish_omp_atomic caller. Use OMP_ATOMIC_MEMORY_ORDER rather
963 than OMP_ATOMIC_SEQ_CST. Handle clauses on OMP_TASKGROUP.
964 (dependent_omp_for_p): Always return true for range for loops if
965 processing_template_decl. Return true if class type iterator
966 does not have INTEGER_CST increment.
967 * semantics.c: Include memmodel.h.
968 (handle_omp_array_sections_1): Handle OMP_CLAUSE_{IN,TASK}_REDUCTION
969 like OMP_CLAUSE_REDUCTION.
970 (handle_omp_array_sections): Likewise. Call save_expr on array
971 reductions before calling build_index_type. Handle depend clauses
973 (finish_omp_reduction_clause): Call save_expr for whole array
974 reduction sizes. Don't mark OMP_CLAUSE_DECL addressable if it has
975 reference type. Do mark decl_placeholder addressable if needed.
976 Use error_at with OMP_CLAUSE_LOCATION (c) as first argument instead
978 (cp_omp_finish_iterators): New function.
979 (finish_omp_clauses): Don't diagnose nonmonotonic clause with static,
980 runtime or auto schedule kinds. Diagnose nogroup clause used with
981 reduction clause(s). Handle depend clause with
982 OMP_CLAUSE_DEPEND_DEPOBJ. Diagnose bit-fields. Require
983 omp_depend_t type for OMP_CLAUSE_DEPEND_DEPOBJ kinds and
984 some different type for other kinds. Use cp_build_addr_expr
985 and cp_build_indirect_ref instead of cxx_mark_addressable.
986 Handle depend clauses with iterators. Only handle static data members
987 in the special case that const qualified vars may be specified in
988 firstprivate clause. Complain if const qualified vars without mutable
989 members are mentioned in data-sharing clauses other than firstprivate
990 or shared. Use error_at with OMP_CLAUSE_LOCATION (c) as first
991 argument instead of error. Diagnose more than one nontemporal clause
992 refering to the same variable. Use error_at rather than error for
993 priority and hint clause diagnostics. Fix pasto for hint clause.
994 Diagnose hint expression that doesn't fold into INTEGER_CST.
995 Diagnose if clause with modifier other than cancel. Handle
996 OMP_CLAUSE_{IN,TASK}_REDUCTION like OMP_CLAUSE_REDUCTION. Allow any
997 lvalue as OMP_CLAUSE_DEPEND operand (besides array section), adjust
999 (handle_omp_for_class_iterator): Don't create a new TREE_LIST if one
1000 has been created already for range for, just fill TREE_PURPOSE and
1001 TREE_VALUE. Call cp_fully_fold on incr.
1002 (finish_omp_for): Don't check cond/incr if cond is global_namespace.
1003 Pass to c_omp_check_loop_iv_exprs orig_declv if non-NULL. Don't
1004 use IS_EMPTY_STMT on NULL pre_body. Adjust c_finish_omp_for caller.
1005 (finish_omp_for_block): New function.
1006 (finish_omp_atomic): Add LOC argument, pass it through
1007 to c_finish_omp_atomic and set it as location of OMP_ATOMIC* trees.
1008 Remove SEQ_CST argument. Add CLAUSES and MO arguments. Adjust
1009 c_finish_omp_atomic caller. Stick clauses if any into first argument
1010 of wrapping OMP_ATOMIC.
1011 (finish_omp_depobj): New function.
1012 (finish_omp_flush): Add MO argument, if not
1013 MEMMODEL_LAST, emit __atomic_thread_fence call with the given value.
1014 (finish_omp_cancel): Diagnose if clause with modifier other than
1017 2018-11-07 Nathan Sidwell <nathan@acm.org>
1020 * cp-tree.h (struct tree_overload): Fix comment.
1021 * tree.c (ovl_iterator::reveal_node): Propagate OVL_DEDUP_P.
1023 2018-11-04 Jason Merrill <jason@redhat.com>
1025 Implement UDL changes from P0732R2.
1026 * cp-tree.h (struct releasing_vec): Move from mangle.c.
1028 * parser.c (cp_parser_userdef_string_literal): Use it. Handle
1029 passing the string to a single template parameter of class type.
1030 (cp_parser_template_declaration_after_parameters): Allow it.
1031 Pedwarn about the character pack template that was proposed but not
1032 accepted for C++14, and don't suggest it.
1034 Implement P0732R2, class types in non-type template parameters.
1035 * error.c (dump_simple_decl): Look through a template parm object.
1036 * mangle.c (write_template_arg): Likewise.
1037 (mangle_template_parm_object): New.
1038 * pt.c (template_parm_object_p, get_template_parm_object): New.
1039 (invalid_tparm_referent_p): Factor from convert_nontype_argument.
1040 (convert_nontype_argument, invalid_nontype_parm_type_p): Handle
1041 class-type template arguments.
1042 * tree.c (lvalue_kind): Likewise.
1044 * cvt.c (ocp_convert): Don't wrap a CONSTRUCTOR in a NOP_EXPR.
1045 * constexpr.c (initialized_type): Fix AGGR_INIT_EXPR handling.
1046 (cxx_eval_vec_init_1): Correct type of AGGR_INIT_EXPR.
1047 (cxx_eval_outermost_constant_expr): Make sure a CONSTRUCTOR has the
1048 right type. Don't wrap a CONSTRUCTOR if one was passed in.
1049 * tree.c (build_aggr_init_expr): Check for void.
1051 PR c++/60503 - wrong lambda attribute syntax.
1052 * parser.c (cp_parser_lambda_declarator_opt): Fix attribute
1055 2018-11-02 Nathan Sidwell <nathan@acm.org>
1057 * decl.c (duplicate_decls): Refactor checks.
1059 2018-11-01 Marek Polacek <polacek@redhat.com>
1061 Implement P0846R0, ADL and function templates.
1062 * decl.c (grokfndecl): Allow FUNCTION_DECL in assert.
1063 * lex.c (unqualified_fn_lookup_error): Handle TEMPLATE_ID_EXPR.
1064 * parser.c (cp_parser_postfix_expression): Do ADL for a template-name.
1065 (cp_parser_template_id): Give errors if parsing the template argument
1066 list didn't go well. Allow FUNCTION_DECL in assert.
1067 (cp_parser_template_name): Consider a name to refer to a template if
1068 it is an unqualified-id followed by a <. Don't return the identifier
1069 if the decl is a function and dependent.
1070 * pt.c (tsubst_copy) <case OVERLOAD>: Remove assert.
1072 2018-11-01 Nathan Sidwell <nathan@acm.org>
1074 * cp-tree.h (struct lang_function): Delete x_local_names field.
1075 (struct lang_decl_base): Rename u2sel to spare.
1076 (struct lang_decl_min): Remove lang_decl_u2 union. Keep access
1078 (LANG_DECL_U2_CHECK): Delete.
1079 (DECL_DISCRIMINATOR_P): Require function scope.
1080 (DECL_DISCRIMINATOR): Adjust.
1081 (DECL_DISCRIMINATOR_SET_P): Delete.
1082 (DECL_CAPTURED_VARIABLE, DECL_ACCESS, THUnK_VIRTUAL_OFFSET): Adjust.
1083 (local_classes): Don't declare.
1084 (determine_local_discriminator): Declare.
1085 * decl.c (push_local_name): Delete.
1086 (local_entities, determina_local_discrminator): New.
1087 (duplicate_decls): Copy DECL_ACCESS. Fix formatting.
1088 (cp_finish_decl): Use determine_local_discriminator.
1089 (save_function_data): Drop x_local_names.
1090 (finish_function): Drop local_names.
1091 * decl2.c (finish_anon_union): Use determine_local_disciminator.
1092 * mangle.c (write_unnamed_type_name): Use
1093 discriminator_for_local_entity.
1094 (local_class_index): Delete.
1095 (discriminator_for_local_entity): Reimplement.
1096 (write_local_name): Adjust discriminator code.
1097 * name-lookup.c (do_pushtag): Call determine_local_discrimiator.
1098 * semantics.c (finish_omp_threadprivate): Drop DECL_DISCRIMINATOR
1100 * class.c (local_classes): Delete.
1101 (init_class_processing): Don't init it.
1103 2018-11-01 Martin Liska <mliska@suse.cz>
1104 Jason Merrill <jason@redhat.com>
1109 * cp-tree.h (DECL_FNAME_P): New macro.
1110 * decl.c (cp_make_fname_decl): Set DECL_DECLARED_CONSTEXPR_P,
1111 DECL_VALUE_EXPR, DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P.
1113 * lambda.c (is_capture_proxy): Use DECL_FNAME_P.
1114 * pt.c (tsubst_expr): Handle DECL_PRETTY_FUNCTION_P.
1116 2018-10-31 Nathan Sidwell <nathan@acm.org>
1118 * cp-tree.h (OVL_DEDUP_P): New.
1119 * name-lookup.c (name_lookup::add_overload): Check OVL_DEDUP_P.
1120 (get_class_binding_direct): Likwise.
1121 * tree.c (ovl_make): Propagate OVL_DEDUP_P.
1122 (ovl_copy): Copy it.
1123 (ovl_insert): Do not keep using-decls ordered.
1124 (lookup_maybe_add): Adjust comment.
1126 2018-10-30 Marek Polacek <polacek@redhat.com>
1128 Implement P0892R2, explicit(bool).
1129 * call.c (add_template_candidate_real): Return if the declaration is
1130 explicit and we're only looking for non-converting constructor.
1131 * cp-tree.h (lang_decl_fn): Add has_dependent_explicit_spec_p bit.
1132 (DECL_HAS_DEPENDENT_EXPLICIT_SPEC_P): New macro.
1133 (cp_decl_specifier_seq): Add explicit_specifier field.
1134 (build_explicit_specifier, store_explicit_specifier): Declare.
1135 * decl.c (grokdeclarator): Call store_explicit_specifier.
1136 (build_explicit_specifier): New function.
1137 * parser.c (cp_parser_function_specifier_opt) <case RID_EXPLICIT>:
1138 Parse C++20 explicit(bool).
1139 * pt.c (store_explicit_specifier, lookup_explicit_specifier): New.
1140 (tsubst_function_decl): Handle explicit(dependent-expr).
1142 2018-10-30 Paolo Carlini <paolo.carlini@oracle.com>
1144 * decl.c (grokdeclarator): Use declarator->id_loc in diagnostic
1145 about flexible array members.
1147 2018-10-29 David Malcolm <dmalcolm@redhat.com>
1149 * cp-name-hint.h: New file.
1150 * cp-tree.h (expr_to_string): New decl.
1151 (suggest_alternatives_for): Move to cp-name-hint.h, changing
1152 return type from bool to name_hint.
1153 (suggest_alternative_in_explicit_scope): Likewise.
1154 * error.c: Define INCLUDE_UNIQUE_PTR. Include "cp-name-hint.h".
1155 (expr_to_string): Make non-static.
1156 (qualified_name_lookup_error): For the non-"::" case, take
1157 responsibity for issuing any suggestion from
1158 suggest_alternative_in_explicit_scope, as it changes from
1159 returning a bool to returning a name_hint. Replace fallback call
1160 to suggest_alternatives_for to a call to
1161 suggest_alternatives_in_other_namespaces, capturing the fact that
1162 we don't have enough location information to issue a fix-it hint
1163 for this case. Update the error to support emitting a fix-it hint
1164 where appropriate. For the "::" case, take responsibility for
1165 issuing any suggestion from suggest_alternatives_for, supporting
1166 emitting a fix-it hint.
1167 * lex.c: Define INCLUDE_UNIQUE_PTR. Include "gcc-rich-location.h"
1168 and "cp-name-hint.h".
1169 (unqualified_name_lookup_error): Take responsibility for issuing
1170 any suggestion from suggest_alternatives_for, supporting emitting
1172 * name-lookup.c (class namespace_limit_reached): New subclass of
1173 deferred_diagnostic.
1174 (class show_candidate_location): Likewise.
1175 (class suggest_alternatives): Likewise.
1176 (class namespace_hints): New class.
1177 (suggest_alternatives_for): Convert return type from bool to
1178 name_hint, replacing all direct diagnostic emission by setting
1179 suggestions on the return value, or creating deferred diagnostics.
1180 Specifically, split out initial traversal of namespaces into
1181 namespace_hints' ctor, and maybe_decorate_with_limit, and move the
1182 rest of the implementation to
1183 namespace_hints::convert_candidates_to_name_hint and
1184 suggest_alternatives_for_1.
1185 (namespace_hints::namespace_hints): New ctor, adapted from
1186 suggest_alternatives_for's initial namespace traversal, storing
1187 location and name, and converting locals "candidates", "limited"
1188 and "limit" into members.
1189 (namespace_hints::convert_candidates_to_name_hint): New member
1191 (namespace_hints::maybe_decorate_with_limit): New member function.
1192 (suggest_alternatives_for_1): New function, based on second half
1193 of old implementation of suggest_alternatives_for, converting from
1194 immediate emission of suggestions to using name_hint.
1195 (suggest_alternatives_in_other_namespaces): New function.
1196 (maybe_suggest_missing_std_header): Convert from immediate
1197 emission of suggestions to using name_hint, moving emission
1198 implementation to...
1199 (class missing_std_header): New subclass of deferred_diagnostic.
1200 (maybe_suggest_missing_header): Convert return type from bool to
1202 (suggest_alternative_in_explicit_scope): Convert from immediate
1203 emission of suggestions to using name_hint.
1204 * parser.c: Replace include of "c-family/name-hint.h" with
1206 (cp_parser_diagnose_invalid_type_name): Update
1207 "is there a suggestion" logic for change to
1208 name_hint::operator bool. Take responsibility for emitting
1209 fix-it hints from suggest_alternative_in_explicit_scope.
1210 (cp_parser_namespace_name): Take responsibility for emitting
1211 fix-it hints from suggest_alternative_in_explicit_scope. Don't
1212 emit the "expected namespace-name" error if we've already emitted
1213 an "is not a namespace-name" error.
1215 2018-10-29 David Malcolm <dmalcolm@redhat.com>
1218 * call.c (build_over_call): Eliminate the "arglocs" array, and the
1219 call to maybe_constant_value when building "fargs".
1221 2018-10-29 Paolo Carlini <paolo.carlini@oracle.com>
1223 * decl.c (create_array_type_for_decl): Add location_t parameter
1225 (grokdeclarator): Adjust call.
1227 2018-10-29 Marek Polacek <polacek@redhat.com>
1229 PR c++/87594 - constexpr rejects-valid with range-based for.
1230 * constexpr.c (potential_constant_expression_1): If the condition
1231 can't be evaluated, return true.
1233 2018-10-29 Joseph Myers <joseph@codesourcery.com>
1234 Julian Brown <julian@codesourcery.com>
1237 * semantics.c (handle_omp_array_sections_1): Allow array
1238 sections with "this" pointer for OpenACC.
1240 2018-10-25 Jason Merrill <jason@redhat.com>
1242 * parser.c (cp_parser_sizeof_operand): Remove redundant use of
1245 2018-10-24 Jakub Jelinek <jakub@redhat.com>
1248 * parser.c (cp_parser_std_attribute): Canonicalize attr_ns, and when
1249 :: is not present and attr_ns non-NULL, canonicalize also attr_id.
1250 (cp_parser_attribute_spec): Fix comment typo.
1252 2018-10-24 Martin Sebor <msebor@redhat.com>
1255 * call.c (maybe_warn_class_memaccess): Tighten up.
1257 2018-10-17 David Malcolm <dmalcolm@redhat.com>
1259 * Make-lang.in (selftest-c++): New.
1260 (CPP_SELFTEST_FLAGS, CPP_SELFTEST_DEPS, s-selftest-c++)
1261 (selftest-c++-gdb, selftest-c++-valgrind): Move here from
1264 2018-10-17 Paolo Carlini <paolo.carlini@oracle.com>
1267 * tree.c (build_cplus_new): Avoid duplicate diagnostic about
1268 incomplete type, early return error_mark_node if the second
1269 argument is error_mark_node.
1271 2018-10-12 Nathan Sidwell <nathan@acm.org>
1273 * parser.h (struct cp_parser): Drop implicit_extern_c.
1274 * parser.c (cp_debug_parser): Drop implicit_extern_c.
1275 (cp_parser_new): Likewise.
1276 (cp_parser_translation_unit): Handle implicit extern c here. Call
1277 cp_parser_toplevel_declaration.
1278 (cp_parser_toplevel_declaration): New, broken out of ...
1279 (cp_parser_declaration_seq_opt): ... here. Call it. Drop
1280 implicit extern C handling.
1282 2018-10-11 Will Wray <wjwray@gmail.com>
1285 * cxx-pretty-print.c (pp_cxx_enumeration_constant): New function.
1286 (cxx_pretty_printer::constant): Use it.
1288 2018-10-11 David Malcolm <dmalcolm@redhat.com>
1291 * call.c (enforce_access): Move diagnostics to...
1292 (complain_about_access): ...this new function.
1293 * cp-tree.h (class access_failure_info): Rename split out field
1294 "m_field_decl" into "m_decl" and "m_diag_decl".
1295 (access_failure_info::record_access_failure): Add tree param.
1296 (access_failure_info::was_inaccessible_p): New accessor.
1297 (access_failure_info::get_decl): New accessor.
1298 (access_failure_info::get_diag_decl): New accessor.
1299 (access_failure_info::get_any_accessor): New member function.
1300 (access_failure_info::add_fixit_hint): New static member function.
1301 (complain_about_access): New decl.
1302 * typeck.c (access_failure_info::record_access_failure): Update
1303 for change to fields.
1304 (access_failure_info::maybe_suggest_accessor): Split out into...
1305 (access_failure_info::get_any_accessor): ...this new function...
1306 (access_failure_info::add_fixit_hint): ...and this new function.
1307 (finish_class_member_access_expr): Split out "has no member named"
1308 error-handling into...
1309 (complain_about_unrecognized_member): ...this new function, and
1310 check that the guessed name is accessible along the access path.
1311 Only provide a spell-correction fix-it hint if it is; otherwise,
1312 attempt to issue an accessor fix-it hint.
1314 2018-10-11 Nathan Sidwell <nathan@acm.org>
1316 * parser.c (cp_parser_translation_unit): Return void. Don't fail
1317 at first extra }, simplify logic.
1318 (c_parse_file): Call finish_translation_unit here.
1320 2018-10-11 Jakub Jelinek <jakub@redhat.com>
1323 * typeck.c (maybe_warn_about_returning_address_of_local): If
1324 whats_returned is a structured binding identifier and the structured
1325 binding is a reference, recurse on its initializer.
1328 * rtti.c (get_tinfo_decl_dynamic): Use unlowered_expr_type instead
1331 2018-10-10 Marek Polacek <polacek@redhat.com>
1333 PR c++/87567 - constexpr rejects call to non-constexpr function.
1334 * constexpr.c (potential_constant_expression_1) <case FOR_STMT>: Return
1335 true if the condition is always false.
1336 <case WHILE_STMT>: Likewise.
1338 2018-10-09 Paolo Carlini <paolo.carlini@oracle.com>
1341 * pt.c (convert_template_argument): Immediately return error_mark_node
1342 if the second argument is erroneous.
1343 * parser.c (cp_parser_type_id): Add location_t * parameter.
1344 (cp_parser_type_id_1): Likewise.
1345 (cp_parser_alias_declaration): Adjust cp_parser_type_id call,
1346 obtain the location of the type and save it.
1347 (cp_parser_template_type_arg): Adjust.
1348 (cp_parser_trailing_type_id): Likewise.
1349 * decl.c (grokdeclarator): Improve error message for 'auto' in
1352 2018-10-08 Paolo Carlini <paolo.carlini@oracle.com>
1355 * pt.c (do_decl_instantiation): Per 12.6.8/5, a concept cannot be
1356 explicitly instantiated.
1358 2018-10-05 David Malcolm <dmalcolm@redhat.com>
1361 * call.c (build_over_call): Build a vec of locations of the
1362 arguments before the call to maybe_constant_value, and pass to
1363 check_function_arguments.
1364 * cp-lang.c (LANG_HOOKS_GET_SUBSTRING_LOCATION): Define as
1365 c_get_substring_location.
1366 * parser.c (cp_parser_string_literal): Capture string
1367 concatenation locations.
1369 2018-10-04 Nathan Sidwell <nathan@acm.org>
1371 * lang-specs.h: Use string contatenation, not line splicing.
1373 2018-10-03 Jason Merrill <jason@redhat.com>
1375 Implement P0840, language support for empty objects.
1376 * tree.c (handle_no_unique_addr_attribute): New.
1377 (cxx_attribute_table): Add [[no_unique_address]].
1378 * class.c (field_poverlapping_p): New.
1379 (layout_class_type): Check it. Adjust DECL_SIZE of potentially
1381 (layout_empty_base_or_field): Rename from layout_empty_base, handle
1383 (build_base_field, record_subobject_offsets): Adjust.
1385 2018-10-03 Martin Liska <mliska@suse.cz>
1387 PR gcov-profile/86109
1388 * parser.c (cp_parser_lambda_declarator_opt):
1389 Set DECL_LAMBDA_FUNCTION for lambdas.
1391 2018-10-02 Richard Biener <rguenther@suse.de>
1393 * name-lookup.c (check_local_shadow): Do not test DECL_FROM_INLINE.
1395 2018-09-28 Eric Botcazou <ebotcazou@adacore.com>
1396 Pierre-Marie de Rodat <derodat@adacore.com>
1398 * method.c (use_thunk): Adjust call to cgraph_node::create_thunk.
1400 2018-09-28 Richard Biener <rguenther@suse.de>
1402 * error.c (cp_print_error_function): Simplify by eliding
1403 the BLOCK_ABSTRACT_ORIGIN chasing.
1405 2018-09-27 Paolo Carlini <paolo.carlini@oracle.com>
1408 * semantics.c (finish_unary_op_expr): Check return value of
1409 build_x_unary_op for error_mark_node.
1411 2018-09-25 Jakub Jelinek <jakub@redhat.com>
1414 * constexpr.c (cxx_eval_constant_expression) <case OBJ_TYPE_REF>: Only
1415 look through COMPONENT_REFs with DECL_FIELD_IS_BASE FIELD_DECLs.
1417 2018-09-25 Martin Liska <mliska@suse.cz>
1419 * name-lookup.c (namespace_scope_ht_size): Remove
1421 * parser.c (cp_lexer_next_token_is_not_keyword): Likewise.
1423 2018-09-24 Paolo Carlini <paolo.carlini@oracle.com>
1426 * method.c (lazily_declare_fn): During error-recovery add_method
1429 2018-09-21 Marek Polacek <polacek@redhat.com>
1431 PR c++/87372 - __func__ constexpr evaluation.
1432 * constexpr.c (maybe_constant_init_1): Pass false for strict down to
1433 cxx_eval_outermost_constant_expr.
1435 2018-09-20 Marek Polacek <polacek@redhat.com>
1437 PR c++/87109 - wrong ctor with maybe-rvalue semantics.
1438 * call.c (build_user_type_conversion_1): Refine the maybe-rvalue
1439 check to only return if we're converting the return value to a base
1442 2018-09-20 Allan Sandfeld Jensen <allan.jensen@qt.io>
1444 * g++spec.c (lang_specific_driver): Handle -r like -nostdlib.
1446 2018-09-20 Jason Merrill <jason@redhat.com>
1448 PR c++/87075 - ICE with constexpr array initialization.
1449 * constexpr.c (cxx_eval_vec_init_1): Handle trivial initialization.
1451 2018-09-19 Marek Polacek <polacek@redhat.com>
1453 Add -Wclass-conversion.
1454 * decl.c (grok_op_properties): Change a warning from -Wconversion to
1455 -Wclass-conversion. Make it print the types.
1457 2018-09-19 Paolo Carlini <paolo.carlini@oracle.com>
1460 * parser.c (cp_parser_initializer_list): Assign error_mark_node
1461 to the index upon error.
1463 2018-09-19 Marek Polacek <polacek@redhat.com>
1465 PR c++/87357 - missing -Wconversion warning
1466 * decl.c (grok_op_properties): Remove diagnostic parts mentioning
1467 a conversion to a reference to void. Use
1468 same_type_ignoring_top_level_qualifiers_p rather than comparing types
1471 2018-09-18 Marek Polacek <polacek@redhat.com>
1473 P1064R0 - Allowing Virtual Function Calls in Constant Expressions
1474 * call.c (build_over_call): No longer check if we're outside a template
1476 * class.c (build_vtbl_initializer): Build vtable's constructor with
1478 * constexpr.c (cxx_eval_constant_expression): Don't ignore _vptr's
1479 initializer. Handle OBJ_TYPE_REF.
1480 (potential_constant_expression_1): Handle OBJ_TYPE_REF.
1481 * decl.c (maybe_commonize_var): Bail out for any DECL_ARTIFICIAL.
1482 (initialize_artificial_var): Mark the variable as constexpr.
1483 (grokdeclarator): Change error to pedwarn. Only warn when
1484 pedantic and not C++2a.
1486 2018-09-18 Paolo Carlini <paolo.carlini@oracle.com>
1489 * cp-tree.h (NON_ERROR): New.
1490 * pt.c (auto_hash::hash): Use it.
1491 (do_auto_deduction): Likewise.
1493 2018-09-18 Nathan Sidwell <nathan@acm.org>
1496 * name-lookup.c (check_local_shadow): Ignore auto types.
1498 2018-09-17 David Malcolm <dmalcolm@redhat.com>
1500 * error.c (range_label_for_type_mismatch::get_text): Update for
1503 2018-09-13 Bernd Edlinger <bernd.edlinger@hotmail.de>
1505 * typeck2.c (digest_init_r): Fix overlength strings.
1507 2018-09-13 Ville Voutilainen <ville.voutilainen@gmail.com>
1510 * method.c (constructible_expr): We're in an unevaluated context
1511 in all cases, not just for class targets.
1513 2018-09-12 David Malcolm <dmalcolm@redhat.com>
1516 * call.c (struct conversion_info): Add "loc" field.
1517 (arg_conversion_rejection): Add "loc" param, using it to
1518 initialize the new field.
1519 (bad_arg_conversion_rejection): Likewise.
1520 (explicit_conversion_rejection): Initialize the new field to
1522 (template_conversion_rejection): Likewise.
1523 (add_function_candidate): Pass on the argument location to the new
1524 param of arg_conversion_rejection.
1525 (add_conv_candidate): Likewise.
1526 (build_builtin_candidate): Likewise.
1527 (build_user_type_conversion_1): Likewise.
1528 (single_z_candidate): New function.
1529 (maybe_get_bad_conversion_for_unmatched_call): New function.
1530 (complain_about_bad_argument): New function, based on part of
1531 convert_for_assignment.
1532 (build_new_method_call_1): Split out handling of the "no viable
1533 candidates" case into...
1534 (complain_about_no_candidates_for_method_call): ...this new
1535 function, and use the new functions above to special-case the
1536 handling of a single non-viable candidate due to a bad argument.
1537 * cp-tree.h (complain_about_bad_argument): New decl.
1538 * typeck.c (convert_for_assignment): Split out one error-handling
1539 case into complain_about_bad_argument.
1541 2018-09-09 Cesar Philippidis <cesar@codesourcery.com>
1542 Julian Brown <julian@codesourcery.com>
1545 * semantics.c (finish_omp_clauses): Treat C++ references the same in
1548 2018-08-28 Martin Liska <mliska@suse.cz>
1550 * constexpr.c (cxx_eval_call_expression): Add quotes
1551 to -fconstexpr-depth=.
1553 2018-09-10 Marek Polacek <polacek@redhat.com>
1555 * class.c (build_vtbl_ref): Remove.
1556 (build_vtbl_ref_1): Rename to build_vtbl_ref.
1557 (build_vfn_ref): Call build_vtbl_ref instead of build_vtbl_ref_1.
1559 2018-09-08 Marek Polacek <polacek@redhat.com>
1561 PR c++/87150 - wrong ctor with maybe-rvalue semantics.
1562 * call.c (struct conversion): Update commentary.
1563 (standard_conversion): Set rvaluedness_matches_p if LOOKUP_PREFER_RVALUE
1566 2018-09-08 Jason Merrill <jason@redhat.com>
1568 PR c++/86678 - constexpr function with non-constant after return.
1569 * constexpr.c (potential_constant_expression_1): Add jump_target.
1570 (breaks): Check for BREAK_STMT.
1571 (continues): Check for CONTINUE_STMT.
1573 2018-09-08 Marek Polacek <polacek@redhat.com>
1575 * cxx-pretty-print.c (cxx_pretty_printer::statement) <case
1576 RANGE_FOR_SMT>: Handle RANGE_FOR_INIT_STMT.
1578 2018-09-07 Marek Polacek <polacek@redhat.com>
1580 PR c++/87152 - range-based for loops with initializer broken in templates.
1581 * constexpr.c (potential_constant_expression_1) <case RANGE_FOR_STMT>:
1582 Recur into RANGE_FOR_INIT_STMT.
1583 * cp-tree.def: Add RANGE_FOR_INIT_STMT to RANGE_FOR_STMT.
1584 * cp-tree.h (RANGE_FOR_INIT_STMT): Define.
1585 * dump.c (cp_dump_tree) <case RANGE_FOR_STMT>: Also dump
1586 RANGE_FOR_INIT_STMT.
1587 * pt.c (tsubst_expr) <case RANGE_FOR_STMT>: Recur into
1588 RANGE_FOR_INIT_STMT.
1589 * semantics.c (begin_range_for_stmt): Adjust call to build_stmt.
1590 Do put the init statement in RANGE_FOR_INIT_STMT.
1591 (finish_range_for_decl): Pop it for templates.
1593 2018-09-06 Bernd Edlinger <bernd.edlinger@hotmail.de>
1595 * decl.c (check_initializer): Call cp_complete_array_type.
1597 2018-09-05 Marek Polacek <polacek@redhat.com>
1599 PR c++/87109, wrong overload with ref-qualifiers.
1600 * call.c (build_user_type_conversion_1): Use NULL instead of 0. Bail
1601 out if performing the maybe-rvalue overload resolution and a conversion
1602 function is getting called.
1604 PR c++/86982, -Wreturn-local-addr and std::move and std::forward.
1605 * typeck.c (maybe_warn_about_returning_address_of_local): Handle calls
1606 to std::move or std::forward.
1607 (is_std_forward_p): New function.
1609 2018-09-05 Pádraig Brady <p@draigbrady.com>
1612 * lambda.c (prune_lambda_captures): Protect against const_vars.get
1615 2018-09-04 Marek Polacek <polacek@redhat.com>
1617 * cp-tree.h (treat_lvalue_as_rvalue_p): Declare.
1618 * except.c (build_throw): Use it. Use CP_TYPE_VOLATILE_P.
1619 * typeck.c (treat_lvalue_as_rvalue_p): No longer static. Add PARM_OK
1621 (maybe_warn_pessimizing_move): Adjust treat_lvalue_as_rvalue_p call.
1622 (check_return_expr): Likewise.
1624 2018-09-03 Paolo Carlini <paolo.carlini@oracle.com>
1627 * constraint.cc (finish_shorthand_constraint): Early return if the
1628 constraint is erroneous.
1630 2018-09-02 Bernd Edlinger <bernd.edlinger@hotmail.de>
1632 * decl.c (eval_check_narrowing): Remove.
1633 (check_initializer): Move call to braced_list_to_string from here ...
1634 * typeck2.c (store_init_value): ... to here.
1635 (digest_init_r): Remove handing of signed/unsigned char strings.
1637 2018-08-31 Nathan Sidwell <nathan@acm.org>
1641 * name-lookup.c (name_lookup::search_namespace): Don't look at
1642 inlines when searching for NULL names.
1644 * decl.c (decls_match): Remove SYSTEM_IMPLICIT_EXTERN_C matching
1645 of return types and parms.
1646 * parser.c (cp_parser_parameter_declaration_clause): Likewise,
1647 '()' always means '(void)'.
1649 2018-08-29 Jakub Jelinek <jakub@redhat.com>
1652 * decl.c (begin_destructor_body): If current_class_type has
1653 virtual bases and the primary base is nearly empty virtual base,
1654 voidify clearing of vptr and make it conditional on in-charge
1657 2018-08-29 Paolo Carlini <paolo.carlini@oracle.com>
1660 * parser.c (cp_parser_introduction_list): If cp_parser_identifier
1661 returns error_mark_node early exit the loop.
1662 (cp_parser_template_introduction): Improve error-recovery, remove
1663 error call about empty introduction-list.
1665 2018-08-29 David Malcolm <dmalcolm@redhat.com>
1668 * call.c (print_conversion_rejection): Add "fn" param and use it
1669 for "no known conversion" messages to underline the pertinent
1671 (print_z_candidate): Supply "fn" to the new param above.
1673 2018-08-29 Jakub Jelinek <jakub@redhat.com>
1676 * pt.c (tsubst_expr) <case RANGE_FOR_STMT>: If
1677 processing_template_decl and decl is structured binding decl, call
1680 2018-08-28 Paolo Carlini <paolo.carlini@oracle.com>
1683 * decl.c (finish_case_label): If the type is erroneous early
1684 return error_mark_node.
1686 2018-08-27 David Malcolm <dmalcolm@redhat.com>
1689 * parser.c (cp_parser_diagnose_invalid_type_name): Add fix-it
1692 2018-08-27 Jakub Jelinek <jakub@redhat.com>
1695 * cp-tree.h (cxx_readonly_error): Add location_t argument.
1696 * typeck2.c (cxx_readonly_error): Add LOC argument, pass it to
1697 ERROR_FOR_ASSIGNMENT macro and readonly_error. Add LOC argument
1698 to ERROR_FOR_ASSIGNMENT macro, use error_at instead of error and
1699 pass LOC to it. Formatting fixes.
1700 * typeck.c (cp_build_unary_op): Pass location to cxx_readonly_error.
1701 (cp_build_modify_expr): Pass loc to cxx_readonly_error.
1702 * semantics.c (finish_asm_stmt): Pass input_location to
1705 2018-08-27 David Malcolm <dmalcolm@redhat.com>
1708 * decl.c (grokdeclarator): Update for conversion of show_caret_p
1710 * error.c (cp_printer): Likewise.
1711 * name-lookup.c (maybe_suggest_missing_std_header): Update call to
1712 maybe_add_include_fixit to suggest overriding the location, as it
1714 * parser.c (cp_parser_string_literal): Update for conversion of
1715 show_caret_p to a tri-state.
1716 (cp_parser_elaborated_type_specifier): Likewise.
1717 (set_and_check_decl_spec_loc): Likewise.
1718 * pt.c (listify): Update call to maybe_add_include_fixit to not
1719 override the location, as it is for an error.
1720 * rtti.c (typeid_ok_p): Likewise.
1722 2018-08-27 Martin Liska <mliska@suse.cz>
1724 * call.c (build_call_a): Use new function
1725 fndecl_built_in_p and remove check for FUNCTION_DECL if
1727 (build_cxx_call): Likewise.
1728 * constexpr.c (constexpr_fn_retval): Likewise.
1729 (cxx_eval_builtin_function_call): Likewise.
1730 (cxx_eval_call_expression): Likewise.
1731 (potential_constant_expression_1): Likewise.
1732 * cp-gimplify.c (cp_gimplify_expr): Likewise.
1733 (cp_fold): Likewise.
1734 * decl.c (decls_match): Likewise.
1735 (validate_constexpr_redeclaration): Likewise.
1736 (duplicate_decls): Likewise.
1737 (make_rtl_for_nonlocal_decl): Likewise.
1738 * name-lookup.c (consider_binding_level): Likewise.
1739 (cp_emit_debug_info_for_using): Likewise.
1740 * semantics.c (finish_call_expr): Likewise.
1741 * tree.c (builtin_valid_in_constant_expr_p): Likewise.
1743 2018-08-26 Marek Polacek <polacek@redhat.com>
1746 * typeck.c (maybe_warn_pessimizing_move): Do nothing in a template.
1748 PR c++/87029, Implement -Wredundant-move.
1749 * typeck.c (treat_lvalue_as_rvalue_p): New function.
1750 (maybe_warn_pessimizing_move): Call convert_from_reference.
1751 Warn about redundant moves.
1753 2018-08-24 Marek Polacek <polacek@redhat.com>
1757 * decl.c (grokdeclarator): Disallow functions with trailing return
1758 type with decltype(auto) as its type. Also check the function if
1759 it's inner declarator doesn't exist
1761 2018-08-21 Marek Polacek <polacek@redhat.com>
1764 * parser.c (cp_parser_lambda_introducer): Give error if a non-local
1765 lambda has a capture-default.
1767 2018-08-21 Paolo Carlini <paolo.carlini@oracle.com>
1769 * decl.c (check_static_variable_definition): Change to return void.
1771 2018-08-21 Marek Polacek <polacek@redhat.com>
1773 PR c++/86981, Implement -Wpessimizing-move.
1774 * typeck.c (decl_in_std_namespace_p): New.
1775 (is_std_move_p): New.
1776 (maybe_warn_pessimizing_move): New.
1777 (can_do_nrvo_p): New, factored out of ...
1778 (check_return_expr): ... here. Warn about potentially harmful
1779 std::move in a return statement.
1782 * call.c (standard_conversion): Set check_narrowing.
1783 * typeck2.c (check_narrowing): Use CP_INTEGRAL_TYPE_P rather
1784 than comparing with INTEGER_TYPE.
1786 * cp-tree.h: Fix typo.
1788 2018-08-20 David Malcolm <dmalcolm@redhat.com>
1791 * call.c (build_user_type_conversion_1): Add auto_diagnostic_group
1793 (print_error_for_call_failure): Likewise.
1794 (build_op_call_1): Likewise.
1795 (build_conditional_expr_1): Likewise.
1796 (build_new_op_1): Likewise.
1797 (build_op_delete_call): Likewise.
1798 (convert_like_real): Likewise.
1799 (build_over_call): Likewise.
1800 (build_new_method_call_1): Likewise.
1802 * class.c (check_tag): Likewise.
1803 (finish_struct_anon_r): Likewise.
1804 (one_inherited_ctor): Likewise.
1805 (finalize_literal_type_property): Likewise.
1806 (explain_non_literal_class): Likewise.
1807 (find_flexarrays): Likewise.
1808 (resolve_address_of_overloaded_function): Likewise.
1809 * constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
1810 (is_valid_constexpr_fn): Likewise.
1811 (cx_check_missing_mem_inits): Likewise.
1812 * cp-gimplify.c (cp_genericize_r): Likewise.
1813 * cvt.c (maybe_warn_nodiscard): Likewise.
1814 * decl.c (warn_extern_redeclared_static): Likewise.
1815 (check_redeclaration_exception_specification): Likewise.
1816 (check_no_redeclaration_friend_default_args): Likewise.
1817 (duplicate_decls): Likewise.
1818 (redeclaration_error_message): Likewise.
1819 (warn_misplaced_attr_for_class_type): Likewise.
1820 * decl2.c (finish_static_data_member_decl): Likewise.
1821 (no_linkage_error): Likewise.
1822 (cp_warn_deprecated_use): Likewise.
1823 * error.c (qualified_name_lookup_error): Likewise.
1824 * friend.c (make_friend_class): Likewise.
1825 (do_friend): Likewise.
1826 * init.c (perform_member_init): Likewise.
1827 (build_new_1): Likewise.
1828 (build_vec_delete_1): Likewise.
1829 (build_delete): Likewise.
1830 * lex.c (unqualified_name_lookup_error): Likewise.
1831 * name-lookup.c (check_extern_c_conflict): Likewise.
1832 (inform_shadowed): New function.
1833 (check_local_shadow): Add auto_diagnostic_group instances,
1834 replacing goto "inform_shadowed" label with call to subroutine.
1835 (set_local_extern_decl_linkage): Add auto_diagnostic_group
1837 * parser.c (cp_parser_diagnose_invalid_type_name): Likewise.
1838 (cp_parser_namespace_name): Likewise.
1839 * pt.c (check_specialization_namespace): Likewise.
1840 (check_template_variable): Likewise.
1841 (warn_spec_missing_attributes): Likewise.
1842 (check_explicit_specialization): Likewise.
1843 (process_partial_specialization): Likewise.
1844 (lookup_template_class_1): Likewise.
1845 (finish_template_variable): Likewise.
1846 (do_auto_deduction): Likewise.
1847 * search.c (check_final_overrider): Likewise.
1848 (look_for_overrides_r): Likewise.
1849 * tree.c (maybe_warn_parm_abi): Likewise.
1850 * typeck.c (cxx_sizeof_expr): Likewise.
1851 (cp_build_function_call_vec): Likewise.
1852 (cp_build_binary_op): Likewise.
1853 (convert_for_assignment): Likewise.
1854 (maybe_warn_about_returning_address_of_local): Likewise.
1855 * typeck2.c (abstract_virtuals_error_sfinae): Likewise.
1856 (check_narrowing): Likewise.
1858 2018-08-17 David Malcolm <dmalcolm@redhat.com>
1860 * typeck.c (string_conv_p): Extract location from EXP and use it
1861 in preference to input_location when issuing warnings.
1863 2018-08-15 David Malcolm <dmalcolm@redhat.com>
1865 * call.c: Include "gcc-rich-location.h".
1866 (convert_like_real): Add range label for "invalid conversion"
1868 (perform_implicit_conversion_flags): Add type label to the
1869 "could not convert" error.
1870 * error.c: Include "gcc-rich-location.h".
1871 (range_label_for_type_mismatch::get_text): New function.
1872 * typeck.c (convert_for_assignment): Add type label to
1873 the "cannot convert" error if a location is available.
1875 2018-08-15 Paolo Carlini <paolo.carlini@oracle.com>
1877 * decl.c (check_previous_goto_1): When decl_jump_unsafe returns 2
1878 emit an error instead of a permerror.
1880 2018-08-13 Marek Polacek <polacek@redhat.com>
1883 * call.c (struct conversion): Add check_narrowing_const_only.
1884 (build_converted_constant_expr): Set check_narrowing and
1885 check_narrowing_const_only. Give error if expr is error node.
1886 (convert_like_real): Pass it to check_narrowing.
1887 * cp-tree.h (check_narrowing): Add a default parameter.
1888 * decl.c (compute_array_index_type): Use input_location instead of
1890 * pt.c (convert_nontype_argument): Return NULL_TREE if tf_error.
1891 * typeck2.c (check_narrowing): Don't warn for instantiation-dependent
1892 expressions. Call maybe_constant_value instead of
1893 fold_non_dependent_expr. Don't mention { } in diagnostic. Only check
1894 narrowing for constants if CONST_ONLY.
1896 2018-08-13 Martin Sebor <msebor@redhat.com>
1898 PR tree-optimization/71625
1899 * decl.c (check_initializer): Call braced_list_to_string.
1900 (eval_check_narrowing): New function.
1901 * gcc/cp/typeck2.c (digest_init_r): Accept strings literals
1902 as initilizers for all narrow character types.
1904 2018-08-13 Marek Polacek <polacek@redhat.com>
1906 P0806R2 - Deprecate implicit capture of this via [=]
1907 * lambda.c (add_default_capture): Formatting fixes. Warn about
1908 deprecated implicit capture of this via [=].
1911 * decl.c (create_array_type_for_decl): Handle null name.
1913 2018-08-10 Jason Merrill <jason@redhat.com>
1915 PR c++/86728 - C variadic generic lambda.
1916 * parser.c (cp_parser_parameter_declaration): Don't turn 'auto' into
1917 a pack if it's followed by a declarator-id.
1919 2018-08-08 Jakub Jelinek <jakub@redhat.com>
1921 P0595R1 - is_constant_evaluated
1922 * cp-tree.h (enum cp_built_in_function): New.
1923 (maybe_constant_init): Add pretend_const_required argument.
1924 * typeck2.c (store_init_value): Pass true as new argument to
1925 maybe_constant_init.
1926 * constexpr.c (constexpr_fn_retval): Check also DECL_BUILT_IN_CLASS
1927 for BUILT_IN_UNREACHABLE.
1928 (struct constexpr_ctx): Add pretend_const_required field.
1929 (cxx_eval_builtin_function_call): Use DECL_IS_BUILTIN_CONSTANT_P
1930 macro. Handle CP_BUILT_IN_IS_CONSTANT_EVALUATED. Check also
1931 DECL_BUILT_IN_CLASS for BUILT_IN_UNREACHABLE.
1932 (cxx_eval_outermost_constant_expr): Add pretend_const_required
1933 argument, initialize pretend_const_required field in ctx. If the
1934 result is TREE_CONSTANT and non_constant_p, retry with
1935 pretend_const_required false if it was true.
1936 (is_sub_constant_expr): Initialize pretend_const_required_field in
1938 (cxx_constant_value): Pass true as pretend_const_required to
1939 cxx_eval_outermost_constant_expr.
1940 (maybe_constant_value): Pass false as pretend_const_required to
1941 cxx_eval_outermost_constant_expr.
1942 (fold_non_dependent_expr): Likewise.
1943 (maybe_constant_init_1): Add pretend_const_required argument, pass it
1944 down to cxx_eval_outermost_constant_expr. Pass !allow_non_constant
1945 instead of false as strict to cxx_eval_outermost_constant_expr.
1946 (maybe_constant_init): Add pretend_const_required argument, pass it
1947 down to maybe_constant_init_1.
1948 (cxx_constant_init): Pass true as pretend_const_required to
1949 maybe_constant_init_1.
1950 * cp-gimplify.c (cp_gimplify_expr): Handle CALL_EXPRs to
1951 CP_BUILT_IN_IS_CONSTANT_EVALUATED.
1952 (cp_fold): Don't fold CP_BUILT_IN_IS_CONSTANT_EVALUATED calls.
1953 * decl.c: Include langhooks.h.
1954 (cxx_init_decl_processing): Register __builtin_is_constant_evaluated
1956 * tree.c (builtin_valid_in_constant_expr_p): Return true for
1957 CP_BUILT_IN_IS_CONSTANT_EVALUATED.
1958 * pt.c (declare_integer_pack): Initialize DECL_FUNCTION_CODE.
1961 * pt.c (tsubst_expr): For structured bindings, call tsubst_decomp_names
1962 before tsubst_init, not after it.
1965 * constexpr.c (cxx_eval_binary_expression): For arithmetics involving
1966 NULL pointer set *non_constant_p to true.
1967 (cxx_eval_component_reference): For dereferencing of a NULL pointer,
1968 set *non_constant_p to true and return t.
1970 2018-08-07 Paolo Carlini <paolo.carlini@oracle.com>
1972 PR c++/59480, DR 136
1973 * decl.c (check_no_redeclaration_friend_default_args): New.
1974 (duplicate_decls): Use the latter; also check that a friend
1975 declaration specifying default arguments is a definition.
1977 2018-08-07 Ville Voutilainen <ville.voutilainen@gmail.com>
1980 * name-lookup.c (check_local_shadow): Reject captures and parameters
1983 2018-08-06 Marek Polacek <polacek@redhat.com>
1986 * constexpr.c (cxx_eval_statement_list): Handle continue.
1988 2018-08-03 David Malcolm <dmalcolm@redhat.com>
1989 Jonathan Wakely <jwakely@redhat.com>
1991 * decl.c: Include "gcc-rich-location.h".
1992 (add_return_star_this_fixit): New function.
1993 (finish_function): When warning about missing return statements in
1994 functions returning non-void, add a "return *this;" fix-it hint for
1995 assignment operators.
1997 2018-08-03 Jason Merrill <jason@redhat.com>
2000 * class.c (build_base_path): Use currently_open_class.
2002 2018-08-02 David Malcolm <dmalcolm@redhat.com>
2004 * error.c (cxx_print_error_function): Duplicate "file" before
2005 passing it to pp_set_prefix.
2006 (cp_print_error_function): Use pp_take_prefix when saving the
2009 2018-08-02 Richard Biener <rguenther@suse.de>
2012 * class.c (layout_class_type): Copy TYPE_TYPELESS_STORAGE
2013 to the CLASSTYPE_AS_BASE.
2015 2018-08-01 Martin Sebor <msebor@redhat.com>
2017 PR tree-optimization/86650
2018 * error.c (cp_printer): Move usage of EXPR_LOCATION (t) and
2019 TREE_BLOCK (t) from within percent_K_format to this callsite.
2021 2018-08-01 Paolo Carlini <paolo.carlini@oracle.com>
2024 * class.c (note_name_declared_in_class): Use location_of in permerror
2025 instead of DECL_SOURCE_LOCATION (for OVERLOADs).
2027 2018-07-31 Tom de Vries <tdevries@suse.de>
2030 * optimize.c (update_cloned_parm): Copy DECL_BY_REFERENCE.
2032 2018-07-31 Jakub Jelinek <jakub@redhat.com>
2034 P1008R1 - prohibit aggregates with user-declared constructors
2035 * class.c (check_bases_and_members): For C++2a set
2036 CLASSTYPE_NON_AGGREGATE based on TYPE_HAS_USER_CONSTRUCTOR rather than
2037 type_has_user_provided_or_explicit_constructor.
2039 2018-07-31 Martin Liska <mliska@suse.cz>
2042 * parser.c (cp_parser_condition): Initialize non_constant_p
2045 2018-07-28 David Malcolm <dmalcolm@redhat.com>
2047 * error.c (cp_printer): In the leading comment, move "%H" and "%I"
2048 into alphabetical order, and add missing "%G" and "%K". Within
2049 the switch statement, move cases 'G', 'H', 'I' and 'K' so that the
2050 cases are in alphabetical order.
2052 2018-07-25 Jakub Jelinek <jakub@redhat.com>
2054 * cp-tree.h (enum cp_tree_index): Add
2055 CPTI_{ABI_TAG,ALIGNED,BEGIN,END,GET,TUPLE_{ELEMENT,SIZE}}_IDENTIFIER
2056 and CPTI_{GNU,TYPE,VALUE,FUN,CLOSURE}_IDENTIFIER.
2057 (abi_tag_identifier, aligned_identifier, begin_identifier,
2058 end_identifier, get__identifier, gnu_identifier,
2059 tuple_element_identifier, tuple_size_identifier, type_identifier,
2060 value_identifier, fun_identifier, closure_identifier): Define.
2061 * decl.c (initialize_predefined_identifiers): Initialize the above
2063 (get_tuple_size): Use tuple_size_identifier instead of
2064 get_identifier ("tuple_size") and value_identifier instead of
2065 get_identifier ("value").
2066 (get_tuple_element_type): Use tuple_element_identifier instead of
2067 get_identifier ("tuple_element") and type_identifier instead of
2068 get_identifier ("type").
2069 (get_tuple_decomp_init): Use get__identifier instead of
2070 get_identifier ("get").
2071 * lambda.c (maybe_add_lambda_conv_op): Use fun_identifier instead of
2072 get_identifier ("_FUN").
2073 * parser.c (cp_parser_lambda_declarator_opt): Use closure_identifier
2074 instead of get_identifier ("__closure").
2075 (cp_parser_std_attribute): Use gnu_identifier instead of
2076 get_identifier ("gnu").
2077 (cp_parser_std_attribute_spec): Likewise. Use aligned_identifier
2078 instead of get_identifier ("aligned").
2079 * class.c (check_abi_tags, inherit_targ_abi_tags): Use
2080 abi_tag_identifier instead of get_identifier ("abi_tag").
2083 * cp-tree.h (enum cp_tree_index): Add
2084 CPTI_FOR_{RANGE,BEGIN,END}{,_}_IDENTIFIER.
2085 (for_range__identifier, for_begin__identifier, for_end__identifier,
2086 for_range_identifier, for_begin_identifier, for_end_identifier):
2088 * decl.c (initialize_predefined_identifiers): Initialize
2089 for_{range,begin,end}{,_}_identifier.
2090 * parser.c (build_range_temp): Use for_range__identifier instead of
2091 get_identifier ("__for_range").
2092 (cp_convert_range_for): Use for_begin__identifier and
2093 for_end__identifier instead of get_identifier ("__for_begin") and
2094 get_identifier ("__for_end").
2095 * semantics.c (finish_for_stmt): Rename "__for_{range,begin,end} "
2096 local symbols to "__for_{range,begin,end}".
2098 2018-07-23 Jakub Jelinek <jakub@redhat.com>
2101 * cp-gimplify.c (cp_fold): Don't fold comparisons into other kind
2102 of expressions other than INTEGER_CST regardless of TREE_NO_WARNING
2103 or warn_nonnull_compare.
2105 2018-07-19 Paolo Carlini <paolo.carlini@oracle.com>
2107 Revert fix for c++/59480 (and testsuite followup)
2109 2019-07-18 Paolo Carlini <paolo.carlini@oracle.com>
2111 PR c++/59480, DR 136
2112 * decl.c (check_no_redeclaration_friend_default_args): New.
2113 (duplicate_decls): Use the latter; also check that a friend
2114 declaration specifying default arguments is a definition.
2116 2018-07-18 Jakub Jelinek <jakub@redhat.com>
2119 * parser.c (cp_parser_decl_specifier_seq): Diagnose invalid type
2120 specifier if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR.
2122 2018-07-18 Marek Polacek <polacek@redhat.com>
2124 PR c++/86190 - bogus -Wsign-conversion warning
2125 * typeck.c (cp_build_binary_op): Fix formatting. Add a warning
2128 2018-07-18 Paolo Carlini <paolo.carlini@oracle.com>
2130 PR c++/59480, DR 136
2131 * decl.c (check_no_redeclaration_friend_default_args): New.
2132 (duplicate_decls): Use the latter; also check that a friend
2133 declaration specifying default arguments is a definition.
2135 2018-07-18 Paolo Carlini <paolo.carlini@oracle.com>
2137 * class.c (note_name_declared_in_class): Prefer permerror + inform
2138 to a pair of permerrors; use DECL_SOURCE_LOCATION.
2140 2018-07-18 Richard Biener <rguenther@suse.de>
2143 * decl2.c (c_parse_final_cleanups): Call write_out_vars before
2144 start_static_storage_duration_function sets current_function_decl.
2146 2018-07-17 Jason Merrill <jason@redhat.com>
2148 PR c++/86480 - nested variadic lambda and constexpr if.
2149 * pt.c (find_parameter_packs_r) [IF_STMT]: Don't walk into
2151 * tree.c (cp_walk_subtrees) [DECLTYPE_TYPE]: Set
2152 cp_unevaluated_operand.
2153 [ALIGNOF_EXPR] [SIZEOF_EXPR] [NOEXCEPT_EXPR]: Likewise.
2155 2018-07-16 Paolo Carlini <paolo.carlini@oracle.com>
2157 * class.c (resolve_address_of_overloaded_function): Don't emit an
2158 inform if the matching permerror returns false.
2159 * pt.c (check_specialization_namespace): Likewise.
2161 2018-07-16 Jakub Jelinek <jakub@redhat.com>
2165 * cp-gimplify.c (cp_genericize_r): When using extern_decl_map, or
2166 in TREE_USED flag from stmt to h->to.
2168 2018-07-13 Nathan Sidwell <nathan@acm.org>
2171 * pt.c (lookup_template_class_1): Use tsubst_aggr_type for
2172 contexts that are classes.
2173 * parser.c (cp_parser_template_id): Combine entering_scope decl &
2176 2018-07-12 Jakub Jelinek <jakub@redhat.com>
2178 * decl2.c (cplus_decl_attributes): Don't diagnose vars without mappable
2179 type here, instead add "omp declare target implicit" attribute. Add
2180 that attribute instead of "omp declare target" also when
2181 processing_template_decl.
2182 * decl.c (cp_finish_decl): Diagnose vars without mappable type here,
2183 and before calling cp_omp_mappable_type call complete_type.
2185 2018-07-10 Jakub Jelinek <jakub@redhat.com>
2188 * cp-gimplify.c (cp_maybe_instrument_return): Skip trailing
2192 * semantics.c (handle_omp_for_class_iterator): Remove lastp argument,
2193 instead of setting *lastp turn orig_declv elt into a TREE_LIST.
2194 (finish_omp_for): Adjust handle_omp_for_class_iterator caller.
2195 * pt.c (tsubst_omp_for_iterator): Allow OMP_FOR_ORIG_DECLS to contain
2196 TREE_LIST for both the original class iterator and the "last" helper
2199 2018-07-09 Paolo Carlini <paolo.carlini@oracle.com>
2201 * decl.c (grokdeclarator): Use rich_location::add_range in three
2202 more places; include gcc-rich-location.h.
2204 2018-07-07 Aldy Hernandez <aldyh@redhat.com>
2206 * decl.c (build_enumerator): Change overflow type to overflow_type.
2207 * init.c (build_new_1): Same.
2209 2018-07-05 Nathan Sidwell <nathan@acm.org>
2211 * cp/decl.c (decls_match): Check SYSTEM_IMPLICIT_EXTERN_C not
2212 NO_IMPLICIT_EXTERN_C.
2213 * cp/parser.c (cp_parser_parameter_declaration_clause): Likewise.
2215 2018-07-04 Ville Voutilainen <ville.voutilainen@gmail.com>
2218 * method.c (is_trivially_xible): Return false
2219 if is_xible_helper returns a NULL_TREE.
2221 2018-07-03 Paolo Carlini <paolo.carlini@oracle.com>
2223 * decl.c (min_location): New.
2224 (smallest_type_quals_location): Use the latter.
2225 (check_concept_fn): Use DECL_SOURCE_LOCATION.
2226 (grokdeclarator): Use accurate locations in a number of error
2227 messages involving ds_thread, ds_storage_class, ds_virtual,
2228 ds_constexpr, ds_typedef and ds_friend; exploit min_location.
2230 2018-07-03 Marek Polacek <polacek@redhat.com>
2233 * typeck.c (cp_build_binary_op): Check c_inhibit_evaluation_warnings.
2235 2018-07-03 Jason Merrill <jason@redhat.com>
2237 PR c++/86378 - functional cast in noexcept-specifier.
2238 * tree.c (strip_typedefs_expr) [TREE_LIST]: Fix iteration.
2240 2018-07-02 Paolo Carlini <paolo.carlini@oracle.com>
2242 * parser.c (set_and_check_decl_spec_loc): Use rich_location::add_range
2243 in error message about __thread and thread_local at the same time.
2245 2018-06-29 Marek Polacek <polacek@redhat.com>
2248 * tree.c (cp_save_expr): Don't call save_expr for TARGET_EXPRs.
2250 2018-06-28 David Malcolm <dmalcolm@redhat.com>
2252 * parser.c (cp_parser_error_1): After issuing a conflict marker
2253 error, consume tokens until the end of the source line.
2255 2018-06-28 Jason Merrill <jason@redhat.com>
2257 PR c++/86342 - -Wdeprecated-copy and system headers.
2258 * decl2.c (cp_warn_deprecated_use): Don't warn about declarations
2261 2018-06-27 David Malcolm <dmalcolm@redhat.com>
2264 * name-lookup.c (consider_binding_level): Filter out names that
2265 match anon_aggrname_p.
2267 2018-06-27 Jason Merrill <jason@redhat.com>
2269 * name-lookup.c (do_pushtag): If we skip a class level, also skip
2272 2018-06-26 Jason Merrill <jason@redhat.com>
2274 PR c++/86320 - memory-hog with std::array of pair
2275 * typeck2.c (process_init_constructor_array): Only compute a
2276 constant initializer once.
2278 PR c++/80290 - memory-hog with std::pair.
2279 * pt.c (fn_type_unification): Add convs parameter.
2280 (check_non_deducible_conversion): Remember conversion.
2281 (check_non_deducible_conversions): New. Do checks here.
2282 (type_unification_real): Not here. Remove flags parm.
2283 * call.c (add_function_candidate): Make convs a parameter.
2284 Don't recalculate the conversion if it's already set.
2285 (add_template_candidate_real): Allocate convs here.
2286 (good_conversion, conv_flags): New.
2288 2018-06-26 Jakub Jelinek <jakub@redhat.com>
2291 * parser.c (cp_parser_omp_for_loop_init): Change for_block argument
2292 type from vec<tree, va_gc> * to vec<tree, va_gc> *&.
2294 2018-06-23 Paolo Carlini <paolo.carlini@oracle.com>
2296 * decl.c (bad_specifiers): Add const location_t* parameter and
2297 use locations in error messages about 'inline' and 'virtual'.
2298 (mark_inline_variable): Add location_t parameter and use it in
2299 error_at and pedwarn messages.
2300 (grokdeclarator): Use declspecs->locations[ds_constexpr],
2301 declspecs->locations[ds_concept], declspecs->locations[ds_virtual],
2302 declspecs->locations[ds_inline] in many error messages; adjust
2303 bad_specifiers and mark_inline_variable calls.
2304 (grokvardecl): Use declspecs->locations[ds_concept] in error message.
2306 2018-06-22 Jason Merrill <jason@redhat.com>
2308 PR c++/86219 - ICE with erroneous initializer in template.
2309 * constexpr.c (fold_non_dependent_expr): Add complain parm.
2310 * call.c, expr.c, init.c, pt.c, semantics.c, typeck.c, typeck2.c:
2312 * call.c (build_cxx_call): Don't mess with builtins in a template.
2313 * typeck2.c (store_init_value): If fold_non_dependent_expr didn't
2314 produce a constant value, go back to the uninstantiated form.
2316 Avoid taking the address of something just because it's in parens.
2317 * constexpr.c (same_type_ignoring_tlq_and_bounds_p): New.
2318 (cxx_fold_indirect_ref): Use it.
2319 (cxx_eval_constant_expression) [VIEW_CONVERT_EXPR]: Use it.
2320 * cp-tree.h (REF_PARENTHESIZED_P): Allow VIEW_CONVERT_EXPR.
2321 * semantics.c (force_paren_expr): Use VIEW_CONVERT_EXPR instead of
2322 static_cast to reference type.
2323 (maybe_undo_parenthesized_ref): Handle VIEW_CONVERT_EXPR.
2325 2018-06-21 Jason Merrill <jason@redhat.com>
2327 * pt.c (tsubst) [TEMPLATE_TYPE_PARM]: Use TEMPLATE_PARM_DESCENDANTS.
2329 * name-lookup.c (do_push_to_top_level): Don't allocate
2331 (do_pop_from_top_level): Release current_lang_base.
2333 Let -fmem-report see callers of cxx_make_type.
2334 * lex.c (cxx_make_type): Add MEM_STAT_DECL.
2335 (make_class_type): Likewise.
2336 (cxx_make_type_hook): New.
2337 * cp-objcp-common.h (LANG_HOOKS_MAKE_TYPE): Use cxx_make_type_hook.
2339 2018-06-20 Nathan Sidwell <nathan@acm.org>
2342 * friend.c (add_friend): Keep lookup sets of tempate sets.
2344 2018-06-20 Paolo Carlini <paolo.carlini@oracle.com>
2346 * decl.c (grokfndecl): Add const cp_decl_specifier_seq* parameter;
2347 tidy handling of a null location_t argument; use proper location
2348 information in a few additional error messages.
2349 (grokdeclarator): Update calls.
2351 2018-06-20 Chung-Lin Tang <cltang@codesourcery.com>
2352 Thomas Schwinge <thomas@codesourcery.com>
2353 Cesar Philippidis <cesar@codesourcery.com>
2355 * parser.c (cp_parser_omp_clause_name): Add support for finalize
2356 and if_present. Make present_or_{copy,copyin,copyout,create} aliases
2357 to their non-present_or_* counterparts. Make 'self' an alias to
2358 PRAGMA_OACC_CLAUSE_HOST.
2359 (cp_parser_oacc_data_clause): Update GOMP mappings for
2360 PRAGMA_OACC_CLAUSE_{COPY,COPYIN,COPYOUT,CREATE,DELETE}. Remove
2361 PRAGMA_OACC_CLAUSE_{SELF,PRESENT_OR_*}.
2362 (cp_parser_oacc_all_clauses): Handle finalize and if_present clauses.
2363 Remove support for present_or_* clauses.
2364 (OACC_KERNELS_CLAUSE_MASK): Remove PRESENT_OR_* clauses.
2365 (OACC_PARALLEL_CLAUSE_MASK): Likewise.
2366 (OACC_DECLARE_CLAUSE_MASK): Likewise.
2367 (OACC_DATA_CLAUSE_MASK): Likewise.
2368 (OACC_ENTER_DATA_CLAUSE_MASK): Remove PRESENT_OR_* clauses.
2369 (OACC_EXIT_DATA_CLAUSE_MASK): Add FINALIZE clause.
2370 (OACC_UPDATE_CLAUSE_MASK): Remove SELF, add IF_PRESENT.
2371 (cp_parser_oacc_declare): Remove PRESENT_OR_* clauses.
2372 * pt.c (tsubst_omp_clauses): Handle IF_PRESENT and FINALIZE.
2373 * semantics.c (finish_omp_clauses): Handle IF_PRESENT and FINALIZE.
2375 2018-06-20 Marek Polacek <polacek@redhat.com>
2378 * constexpr.c (cxx_eval_constant_expression): Handle ABSU_EXPR.
2379 (fold_simple_1): Likewise.
2380 * error.c (dump_expr): Likewise.
2382 2018-06-20 Nathan Sidwell <nathan@acm.org>
2385 * cp-tree.h (lookup_keep): Drop KEEP parm.
2386 (lookup_list_keep): Delete.
2387 (maybe_get_fns): Declare.
2388 * parser.c (cp_parser_primary_expression): Call lookup_keep here.
2389 (cp_parser_template_id): Not here ...
2390 * decl.c (cp_finish_decl): ... nor here ...
2391 * init.c (build_raw_new_expr): ... nor here ...
2392 * pt.c (process_template_parm): ... nor here ...
2393 * semantics.c (perform_koenig_lookup): Call lookup_keep.
2394 (finish_call_expr): Not here.
2395 * tree.c (ovl_cache): Delete.
2396 (ovl_make, ovl_copy): No cache.
2397 (lookup_keep): Always keep.
2398 (lookup_list_keep): Delete.
2399 (maybe_get_fns): New, broken out of ...
2400 (get_fns): ... here. Call it.
2401 (built_min_nt_loc, build_min, build_min_non_dep): Drop lookup_keep.
2402 (build_min_nt_call_vec): Likewise.
2404 2018-06-19 Jason Merrill <jason@redhat.com>
2406 * cp-tree.h (CONSTRUCTOR_NO_IMPLICIT_ZERO): Remove.
2407 * constexpr.c: Use CONSTRUCTOR_NO_CLEARING instead.
2409 PR c++/86182 - ICE with anonymous union passed to template.
2410 * pt.c (tsubst_expr) [DECL_EXPR]: Handle an anonymous union type
2411 used to declare a named variable.
2413 2018-06-18 Jason Merrill <jason@redhat.com>
2415 * tree.c (cp_expr_location): New.
2416 * cp-tree.h (cp_expr_loc_or_loc): New.
2417 * call.c, cvt.c, constexpr.c, constraint.cc, cp-gimplify.c, decl.c,
2418 error.c, init.c, lex.c, parser.c, pt.c, semantics.c, typeck.c,
2419 typeck2.c: Use it instead of EXPR_LOC_OR_LOC.
2421 * parser.c (cp_parser_lambda_expression): Use a range for
2422 LAMBDA_EXPR_LOCATION.
2424 PR c++/86200 - ICE with unexpanded pack in lambda parameter.
2425 * pt.c (find_parameter_packs_r) [LAMBDA_EXPR]: Also look into the
2428 PR c++/81060 - ICE with unexpanded parameter pack.
2429 * pt.c (check_for_bare_parameter_packs): Add loc parameter.
2430 * decl.c (grokdeclarator): Call it for qualifying_scope.
2432 PR c++/86171 - ICE with recursive alias instantiation.
2433 * pt.c (tsubst_decl): Handle recursive alias instantiation.
2435 2018-06-18 Paolo Carlini <paolo.carlini@oracle.com>
2437 * decl.c (duplicate_decls): Consistently use DECL_SOURCE_LOCATION
2438 in errors about redefined default arguments; tidy.
2440 2018-06-16 Kugan Vivekanandarajah <kuganv@linaro.org>
2442 * constexpr.c (potential_constant_expression_1): Handle ABSU_EXPR.
2443 * cp-gimplify.c (cp_fold): Likewise.
2445 2018-06-15 Jason Merrill <jason@redhat.com>
2447 PR c++/86147 - wrong capture for template argument.
2448 * expr.c (mark_use): Look through NOP_EXPR.
2450 * name-lookup.c (do_pushtag): Don't look through complete types, but
2451 don't add to them either. Get context from current_binding_level.
2452 * pt.c (tsubst_default_argument): Use push_to/pop_from_top_level.
2454 * decl.c (start_enum): Do compare dependent underlying type.
2456 PR c++/82882 - ICE with lambda in template default argument.
2457 * lambda.c (record_null_lambda_scope): New.
2458 * pt.c (tsubst_lambda_expr): Use it.
2459 * name-lookup.c (do_pushtag): Don't give a lambda DECL_CONTEXT of a
2460 function that isn't open.
2462 * tree.c (maybe_warn_parm_abi): Inform the location of the class.
2464 2018-06-14 Marek Polacek <polacek@redhat.com>
2467 * decl2.c (cp_check_const_attributes): Skip trees that are not
2470 2018-06-14 Jakub Jelinek <jakub@redhat.com>
2472 P0624R2 - Default constructible and assignable stateless lambdas
2473 * method.c (synthesized_method_walk): For C++2a don't mark
2474 sfk_constructor or sfk_copy_assignment as deleted if lambda has
2477 2018-06-14 Paolo Carlini <paolo.carlini@oracle.com>
2479 * decl.c (duplicate_decls): Use DECL_SOURCE_LOCATION in
2480 OPT_Wshadow warning_at.
2481 (grokfndecl): Consistently use the location_t argument in
2482 literal operator diagnostic messages.
2483 (grokdeclarator): Use declspecs->locations[ds_storage_class]
2485 * decl2.c (finish_static_data_member_decl): Use DECL_SOURCE_LOCATION
2488 2018-06-13 Jason Merrill <jason@redhat.com>
2490 PR c++/86099 - ICE with trivial copy and non-trivial default ctor.
2491 * constexpr.c (instantiate_cx_fn_r): Don't synthesize trivial
2494 PR c++/86094 - wrong code with defaulted move ctor.
2495 * class.c (classtype_has_non_deleted_move_ctor): New.
2496 * tree.c (maybe_warn_parm_abi, type_has_nontrivial_copy_init):
2497 Handle v12 breakage.
2499 2018-06-12 Jason Merrill <jason@redhat.com>
2501 PR c++/86098 - ICE with template placeholder for TTP.
2502 * typeck.c (structural_comptypes) [TEMPLATE_TYPE_PARM]: Check
2503 CLASS_PLACEHOLDER_TEMPLATE.
2505 2018-06-12 Paolo Carlini <paolo.carlini@oracle.com>
2507 * decl2.c (coerce_new_type, coerce_delete_type): Add location_t
2508 parameter and adjust error_at calls.
2509 * decl.c (grok_op_properties): Adjust calls.
2510 * cp-tree.h (oerce_new_type, coerce_delete_type): Adjust decls.
2512 2018-06-12 Marek Polacek <polacek@redhat.com>
2514 Core issue 1331 - const mismatch with defaulted copy constructor
2515 * class.c (check_bases_and_members): When checking a defaulted
2516 function, mark it as deleted rather than giving an error.
2518 2018-06-11 Jason Merrill <jason@redhat.com>
2520 PR c++/85792 -Wctor-dtor-privacy and inherited constructor.
2521 * class.c (maybe_warn_about_overly_private_class): Handle inherited
2524 PR c++/85963 - -Wunused-but-set with ?: in template.
2525 * pt.c (tsubst_copy_and_build) [COND_EXPR]: Call mark_rvalue_use.
2527 2018-06-11 Paolo Carlini <paolo.carlini@oracle.com>
2529 * decl.c (grok_op_properties): Consistently use the location
2530 of the decl; remove special casing of POSTINCREMENT_EXPR and
2531 POSTDECREMENT_EXPR wrt default arguments.
2533 2018-06-05 Jason Merrill <jason@redhat.com>
2535 * constexpr.c (cxx_eval_binary_expression): Special case comparison
2536 of pointers to members of the same union.
2538 2018-06-11 Jason Merrill <jason@redhat.com>
2540 PR c++/86094 - wrong code with defaulted move ctor.
2541 * tree.c (type_has_nontrivial_copy_init): Fix move ctor handling.
2543 2018-06-10 Paolo Carlini <paolo.carlini@oracle.com>
2545 * decl.c (grokfndecl): Use the location_t argument in two more places.
2547 2018-06-06 Marek Polacek <polacek@redhat.com>
2550 * pt.c (unify): If ELTTYPE has no deducible template parms, skip
2551 deduction from the list elements.
2552 (type_unification_real): Check convertibility of list elements.
2554 2018-06-06 Jason Merrill <jason@redhat.com>
2556 PR c++/86060 - ICE on range for with -std=c++98.
2557 * parser.c (cp_parser_init_statement): Don't clobber *decl after
2560 PR c++/85710 - ICE with -Wmemset-elt-size.
2561 * semantics.c (finish_call_expr): Call warn_for_memset here.
2562 * parser.c (cp_parser_postfix_expression): Not here.
2563 (literal_integer_zerop): No longer static.
2564 * pt.c (build_non_dependent_expr): Don't wrap CONST_DECL.
2566 2018-06-05 Marek Polacek <polacek@redhat.com>
2569 * tree.c (cp_tree_equal): Handle USING_DECL.
2571 2018-06-05 Jason Merrill <jason@redhat.com>
2573 PR c++/85731 - wrong error with qualified-id in template.
2574 * semantics.c (finish_qualified_id_expr): build_qualified_name
2575 for unbound names in the current class.
2577 2018-06-04 Jason Merrill <jason@redhat.com>
2579 PR c++/61806 - missed SFINAE with partial specialization.
2580 * cp-tree.h (deferring_access_check_sentinel): Add deferring_kind
2581 parameter to constructor.
2582 * pt.c (instantiate_class_template_1): Enable access checking
2583 before call to most_specialized_partial_spec.
2585 PR c++/85765 - SFINAE and non-type default template arg.
2586 * pt.c (type_unification_real): Do full semantic processing if
2587 substituting a partial args list replaces all template parms.
2589 2018-06-03 Jason Merrill <jason@redhat.com>
2591 PR c++/85739 - ICE with pointer to member template parm.
2592 * cvt.c (perform_qualification_conversions): Use cp_fold_convert.
2594 2018-06-02 Jason Merrill <jason@redhat.com>
2596 PR c++/85761 - ICE with ill-formed use of const outer variable.
2597 * expr.c (mark_use): Handle location wrappers.
2599 2018-06-01 Jason Merrill <jason@redhat.com>
2601 PR c++/85764 - bogus 'this' not captured error.
2602 * lambda.c (resolvable_dummy_lambda): Use nonlambda_method_basetype.
2603 (nonlambda_method_basetype): Handle NSDMI.
2605 CWG 1581: When are constexpr member functions defined?
2606 * constexpr.c (instantiate_cx_fn_r, instantiate_constexpr_fns): New.
2607 (cxx_eval_outermost_constant_expr): Call instantiate_constexpr_fns.
2609 PR c++/58281 - explicit instantiation of constexpr
2610 * pt.c (mark_decl_instantiated): Clear DECL_EXTERNAL.
2612 * pt.c (instantiate_decl): Any defaulted function is defined.
2614 2018-05-30 Jonathan Wakely <jwakely@redhat.com>
2617 * call.c (resolve_args): Use location of expression, not current input
2620 2018-05-30 Ville Voutilainen <ville.voutilainen@gmail.com>
2622 Do not warn about zero-as-null when NULL is used.
2623 * call.c (conversion_null_warnings): Check for pointer
2624 types converted from zero constants.
2625 (convert_like_real): Add a warning sentinel at the end.
2626 * tree.c (maybe_warn_zero_as_null_pointer_constant): Also
2629 2018-05-30 Jason Merrill <jason@redhat.com>
2631 PR c++/85807 - ICE with call in template NSDMI.
2632 * init.c (get_nsdmi): Use push_to/pop_from_top_level.
2633 * tree.c (bot_manip): Don't set_flags_from_callee in a template.
2635 PR c++/85873 - constant initializer_list array not in .rodata.
2636 * tree.c (build_target_expr): Set TREE_READONLY.
2637 * call.c (set_up_extended_ref_temp): Set TREE_READONLY.
2639 * parser.c (cp_parser_check_condition_declarator): Handle
2640 cp_error_declarator.
2642 2018-05-30 Jonathan Wakely <jwakely@redhat.com>
2644 * typeck.c (cxx_sizeof_or_alignof_type): Return size_one_node instead
2645 of using it in dead store.
2647 2018-05-29 Jason Merrill <jason@redhat.com>
2649 PR c++/67445 - returning temporary initializer_list.
2650 PR c++/67711 - assigning from temporary initializer_list.
2651 PR c++/48562 - new initializer_list.
2652 * typeck.c (maybe_warn_about_returning_address_of_local): Also warn
2653 about returning local initializer_list.
2654 * cp-tree.h (AUTO_TEMP_NAME, TEMP_NAME_P): Remove.
2655 * call.c (build_over_call): Warn about assignment from temporary
2657 * init.c (build_new_1): Warn about 'new std::initializer_list'.
2658 (find_list_begin, maybe_warn_list_ctor): New.
2659 (perform_member_init): Use maybe_warn_list_ctor.
2661 2018-05-29 Marek Polacek <polacek@redhat.com>
2664 * init.c (build_new): Handle deducing a class with new
2665 with more than one argument.
2667 2018-05-29 Jakub Jelinek <jakub@redhat.com>
2670 * init.c (build_aggr_init): For structured binding initialized from
2671 array call mark_rvalue_use on the initializer.
2673 2018-05-28 Bernd Edlinger <bernd.edlinger@hotmail.de>
2675 * decl2.c (start_static_storage_duration_function): Use
2676 splay_tree_delete_pointers.
2678 2018-05-25 Jason Merrill <jason@redhat.com>
2680 PR c++/85815 - reference to member of enclosing template.
2681 * search.c (lookup_base): Use currently_open_class.
2682 (lookup_member): Use it regardless of -fconcepts.
2683 * parser.c (cp_parser_postfix_dot_deref_expression): Check it.
2685 CWG 616, 1213 - value category of subobject references.
2686 * tree.c (lvalue_kind): Fix handling of ARRAY_REF of pointer.
2688 2018-05-24 Jason Merrill <jason@redhat.com>
2690 PR c++/85842 - -Wreturn-type, constexpr if and generic lambda.
2691 * pt.c (tsubst_lambda_expr): Copy current_function_returns_* to
2694 2018-05-24 Ville Voutilainen <ville.voutilainen@gmail.com>
2696 Pedwarn on a non-standard position of a C++ attribute.
2697 * parser.c (cp_parser_namespace_definition): Pedwarn about attributes
2698 after the namespace name.
2700 2018-05-24 Paolo Carlini <paolo.carlini@oracle.com>
2702 * cp-tree.h (INDIRECT_TYPE_P): New.
2703 * call.c (build_trivial_dtor_call, maybe_warn_class_memaccess,
2704 joust): Use it instead of POINTER_TYPE_P.
2705 * class.c (update_vtable_entry_for_fn, find_flexarrays,
2706 * fixed_type_or_null, resolves_to_fixed_type_p): Likewise.
2707 * constexpr.c (cxx_eval_binary_expression, cxx_fold_indirect_ref,
2708 * cxx_eval_increment_expression, potential_constant_expression_1):
2710 * cp-gimplify.c (cp_gimplify_expr, cp_genericize_r): Likewise.
2711 * cp-objcp-common.c (cxx_get_alias_set): Likewise.
2712 * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call,
2713 cp_ubsan_maybe_instrument_downcast): Likewise.
2714 * cvt.c (cp_convert_to_pointer, ocp_convert,
2715 cp_get_fndecl_from_callee, maybe_warn_nodiscard, convert): Likewise.
2716 * cxx-pretty-print.c (cxx_pretty_printer::abstract_declarator,
2717 pp_cxx_offsetof_expression_1): Likewise.
2718 * decl.c (grokparms, static_fn_type): Likewise.
2719 * decl2.c (grokbitfield): Likewise.
2720 * error.c (dump_expr): Likewise.
2721 * except.c (initialize_handler_parm, check_noexcept_r): Likewise.
2722 * init.c (warn_placement_new_too_small): Likewise.
2723 * lambda.c (build_capture_proxy, add_capture): Likewise.
2724 * parser.c (cp_parser_omp_for_loop): Likewise.
2725 * pt.c (convert_nontype_argument, fn_type_unification,
2726 uses_deducible_template_parms, check_cv_quals_for_unify,
2727 dependent_type_p_r): Likewise.
2728 * search.c (check_final_overrider): Likewise.
2729 * semantics.c (handle_omp_array_sections, finish_omp_clauses,
2730 finish_omp_for): Likewise.
2731 * tree.c (cp_build_qualified_type_real): Likewise.
2732 * typeck.c (build_class_member_access_expr,
2733 finish_class_member_access_expr, build_x_indirect_ref,
2734 cp_build_indirect_ref_1, cp_build_binary_op, build_const_cast_1):
2737 2018-05-24 Jason Merrill <jason@redhat.com>
2739 PR c++/85864 - literal template and default template arg.
2740 * pt.c (instantiation_dependent_r): Handle NONTYPE_ARGUMENT_PACK.
2742 2018-05-24 Marek Polacek <polacek@redhat.com>
2745 * init.c (build_new_1): Use fold_non_dependent_expr. Use a dedicated
2746 variable for its result. Fix a condition.
2747 (build_new): Use fold_non_dependent_expr. Tweak a condition.
2749 2018-05-23 Jason Merrill <jason@redhat.com>
2751 Fix cast to rvalue reference from prvalue.
2752 * cvt.c (diagnose_ref_binding): Handle rvalue reference.
2753 * rtti.c (build_dynamic_cast_1): Don't try to build a reference to
2754 non-class type. Handle xvalue argument.
2755 * typeck.c (build_reinterpret_cast_1): Allow cast from prvalue to
2757 * semantics.c (finish_compound_literal): Do direct-initialization,
2758 not cast, to initialize a reference.
2760 CWG 616, 1213 - value category of subobject references.
2761 * tree.c (lvalue_kind): A reference to a subobject of a prvalue is
2763 * typeck2.c (build_m_component_ref): Likewise.
2764 * typeck.c (cp_build_addr_expr_1, lvalue_or_else): Remove diagnostic
2765 distinction between temporary and xvalue.
2767 2018-05-23 Marek Polacek <polacek@redhat.com>
2769 Implement P0614R1, Range-based for statements with initializer.
2770 * parser.c (cp_parser_range_based_for_with_init_p): New.
2771 (cp_parser_init_statement): Use it. Parse the optional init-statement
2772 for a range-based for loop.
2773 (cp_parser_skip_to_closing_parenthesis_1): Handle balancing ?:.
2775 2018-05-22 Jason Merrill <jason@redhat.com>
2777 PR c++/81420 - not extending temporary lifetime.
2778 * call.c (extend_ref_init_temps_1): Handle ARRAY_REF.
2779 * class.c (build_base_path): Avoid redundant move of an rvalue.
2781 PR c++/85866 - error with .* in default template arg.
2782 * pt.c (tsubst_copy_and_build): Handle partial instantiation.
2784 2018-05-21 Paolo Carlini <paolo.carlini@oracle.com>
2786 * parser.c (cp_parser_parameter_declaration_list): Remove
2788 (cp_parser_parameter_declaration_clause): Adjust.
2789 (cp_parser_cache_defarg): Likewise.
2791 2018-05-21 Paolo Carlini <paolo.carlini@oracle.com>
2794 * parser.c (cp_parser_maybe_commit_to_declaration,
2795 cp_parser_check_condition_declarator): New.
2796 (cp_parser_simple_declaration): Use the first above.
2797 (cp_parser_condition): Use both the above; enforce
2798 [stmt.stmt]/2 about the declarator not specifying
2799 a function or an array; improve error-recovery.
2801 2018-05-20 Jason Merrill <jason@redhat.com>
2803 PR libstdc++/85843 - warning in logic_error copy constructor.
2804 * class.c (type_has_user_nondefault_constructor): Check for a
2805 user-provided ctor, not user-declared.
2807 2018-05-19 Jason Merrill <jason@redhat.com>
2809 * pt.c (tsubst_pack_expansion): Sorry rather than abort
2810 on __integer_pack as subexpression of pattern.
2812 2018-05-18 Jason Merrill <jason@redhat.com>
2814 PR c++/58407 - deprecated implicit copy ops.
2815 * call.c (build_over_call): Warn about deprecated trivial fns.
2816 * class.c (classtype_has_user_copy_or_dtor): New.
2817 (type_build_ctor_call): Check TREE_DEPRECATED.
2818 (type_build_dtor_call): Likewise.
2819 * decl2.c (cp_warn_deprecated_use): Move from tree.c.
2820 Add checks. Return bool. Handle -Wdeprecated-copy.
2821 (mark_used): Use it.
2822 * decl.c (grokdeclarator): Remove redundant checks.
2823 * typeck2.c (build_functional_cast): Likewise.
2824 * method.c (lazily_declare_fn): Mark deprecated copy ops.
2825 * init.c (build_aggr_init): Only set TREE_USED if there are
2828 2018-05-18 Cesar Philippidis <cesar@codesourcery.com>
2831 * cp-gimplify.c (cp_genericize_r): Call genericize_omp_for_stmt for
2834 2018-05-18 Richard Sandiford <richard.sandiford@linaro.org>
2836 * constexpr.c (cxx_eval_constant_expression): Remove FMA_EXPR handling.
2837 (potential_constant_expression_1): Likewise.
2839 2018-05-16 Marek Polacek <polacek@redhat.com>
2842 * call.c (set_flags_from_callee): Handle AGGR_INIT_EXPRs too.
2843 * tree.c (bot_manip): Call set_flags_from_callee for
2844 AGGR_INIT_EXPRs too.
2846 2018-05-15 Jason Merrill <jason@redhat.com>
2848 * cp-tree.h (cp_expr): Remove copy constructor.
2849 * mangle.c (struct releasing_vec): Declare copy constructor.
2851 * constexpr.c (cxx_eval_vec_init_1): Pass tf_none if ctx->quiet.
2853 PR c++/64372 - CWG 1560, gratuitous lvalue-rvalue conversion in ?:
2854 * call.c (build_conditional_expr_1): Don't force_rvalue when one arm
2855 is a throw-expression.
2857 2018-05-15 Paolo Carlini <paolo.carlini@oracle.com>
2859 * cp-tree.h (DECL_MAYBE_IN_CHARGE_CDTOR_P): New.
2860 (FOR_EACH_CLONE): Update.
2861 * decl.c (grokdeclarator): Use it.
2862 * decl2.c (vague_linkage_p): Likewise.
2863 * mangle.c (mangle_decl): Likewise.
2864 * method.c (lazily_declare_fn): Likewise.
2865 * optimize.c (can_alias_cdtor, maybe_clone_body): Likewise.
2866 * repo.c (repo_emit_p): Likewise.
2867 * tree.c (decl_linkage): Likewise.
2869 2018-05-14 Jason Merrill <jason@redhat.com>
2871 Handle TYPE_HAS_LATE_RETURN_TYPE like ref-qualifier and eh spec.
2872 * tree.c (build_cp_fntype_variant): New.
2873 (build_ref_qualified_type, build_exception_variant)
2874 (strip_typedefs, cxx_copy_lang_qualifiers): Use it.
2875 (cxx_type_hash_eq, cp_check_qualified_type): Check
2876 TYPE_HAS_LATE_RETURN_TYPE.
2877 (cp_build_type_attribute_variant): Check cxx_type_hash_eq.
2878 (cp_build_qualified_type_real): No need to preserve C++ qualifiers.
2879 * class.c (build_clone): Use cxx_copy_lang_qualifiers.
2880 (adjust_clone_args): Likewise.
2881 * decl.c (grokfndecl): Add late_return_type_p parameter. Use
2882 build_cp_fntype_variant.
2883 (grokdeclarator): Pass late_return_type_p to grokfndecl.
2884 (check_function_type): Use cxx_copy_lang_qualifiers.
2885 (static_fn_type): Use cxx_copy_lang_qualifiers.
2886 * decl2.c (build_memfn_type, maybe_retrofit_in_chrg)
2887 (cp_reconstruct_complex_type, coerce_new_type, coerce_delete_type)
2888 (change_return_type): Use cxx_copy_lang_qualifiers.
2889 * mangle.c (write_type): Use cxx_copy_lang_qualifiers.
2890 * parser.c (cp_parser_lambda_declarator_opt): Represent an explicit
2891 return type on the declarator like a normal trailing return type.
2892 * pt.c (tsubst_function_type): Use build_cp_fntype_variant.
2893 (copy_default_args_to_explicit_spec): Use cxx_copy_lang_qualifiers.
2894 * typeck.c (merge_types): Use build_cp_fntype_variant.
2896 2018-05-14 Paolo Carlini <paolo.carlini@oracle.com>
2898 * cp-tree.h (TYPE_REF_P): New.
2899 (TYPE_OBJ_P, TYPE_REF_OBJ_P, TYPE_REFFN_P): Update.
2900 * call.c (build_list_conv, build_aggr_conv, standard_conversion,
2901 direct_reference_binding, reference_binding, implicit_conversion,
2902 add_builtin_candidate, build_user_type_conversion_1, build_op_call_1,
2903 build_new_op_1, build_x_va_arg, conv_binds_ref_to_prvalue,
2904 build_over_call, perform_implicit_conversion_flags,
2905 extend_ref_init_temps, type_has_extended_temps): Use it.
2906 * class.c (one_inheriting_sig, check_field_decls,
2907 check_bases_and_members, find_flexarrays, finish_struct,
2908 fixed_type_or_null): Likewise.
2909 * constexpr.c (literal_type_p, cxx_bind_parameters_in_call,
2910 non_const_var_error, cxx_eval_constant_expression,
2911 potential_constant_expression_1): Likewise.
2912 * cp-gimplify.c (omp_var_to_track, omp_cxx_notice_variable,
2913 cp_genericize_r, cxx_omp_privatize_by_reference,
2914 cxx_omp_const_qual_no_mutable, cxx_omp_finish_clause,
2915 cp_fold_maybe_rvalue): Likewise.
2916 * cp-ubsan.c (cp_ubsan_maybe_instrument_downcast): Likewise.
2917 * cvt.c (build_up_reference, convert_to_reference,
2918 convert_from_reference, convert_to_void, noexcept_conv_p,
2919 fnptr_conv_p): Likewise.
2920 * decl.c (poplevel, check_for_uninitialized_const_var,
2921 check_initializer, initialize_local_var, cp_finish_decl,
2922 get_tuple_decomp_init, cp_finish_decomp, grokdeclarator, copy_fn_p,
2923 move_signature_fn_p, grok_op_properties, finish_function): Likewise.
2924 * decl2.c (grok_array_decl, cp_reconstruct_complex_type,
2925 decl_maybe_constant_var_p): Likewise.
2926 * error.c (dump_type_prefix, dump_expr): Likewise.
2927 * except.c (initialize_handler_parm, complete_ptr_ref_or_void_ptr_p,
2928 is_admissible_throw_operand_or_catch_parameter): Likewise.
2929 * expr.c (mark_use): Likewise.
2930 * init.c (build_zero_init_1, build_value_init_noctor,
2931 perform_member_init, diagnose_uninitialized_cst_or_ref_member_1,
2932 build_new, build_delete): Likewise.
2933 * lambda.c (build_lambda_object): Likewise.
2934 * mangle.c (write_expression, write_template_arg): Likewise.
2935 * method.c (forward_parm, do_build_copy_constructor,
2936 do_build_copy_assign, build_stub_object, constructible_expr,
2937 walk_field_subobs): Likewise.
2938 * parser.c (cp_parser_omp_for_loop_init,
2939 cp_parser_omp_declare_reduction_exprs,
2940 cp_parser_omp_declare_reduction): Likewise.
2941 * pt.c (convert_nontype_argument_function, convert_nontype_argument,
2942 convert_template_argument, tsubst_pack_expansion,
2943 tsubst_function_decl, tsubst_decl, tsubst, tsubst_copy_and_build,
2944 maybe_adjust_types_for_deduction, check_cv_quals_for_unify, unify,
2945 more_specialized_fn, invalid_nontype_parm_type_p, dependent_type_p_r,
2946 value_dependent_expression_p, build_deduction_guide): Likewise.
2947 * semantics.c (finish_handler_parms, finish_non_static_data_member,
2948 finish_compound_literal, omp_privatize_field,
2949 handle_omp_array_sections_1, handle_omp_array_sections,
2950 cp_check_omp_declare_reduction, finish_omp_reduction_clause,
2951 finish_omp_declare_simd_methods, cp_finish_omp_clause_depend_sink,
2952 finish_omp_clauses, finish_decltype_type, capture_decltype,
2953 finish_builtin_launder): Likewise.
2954 * tree.c (lvalue_kind, cp_build_reference_type, move,
2955 cp_build_qualified_type_real, stabilize_expr, stabilize_init): Likewise.
2956 * typeck.c (cxx_safe_arg_type_equiv_p, build_class_member_access_expr,
2957 cp_build_indirect_ref_1, convert_arguments, warn_for_null_address,
2958 cp_build_addr_expr_1, maybe_warn_about_useless_cast,
2959 build_static_cast_1, build_static_cast, build_reinterpret_cast_1,
2960 build_const_cast_1, cp_build_c_cast, cp_build_modify_expr,
2961 convert_for_initialization,
2962 maybe_warn_about_returning_address_of_local, check_return_expr,
2963 cp_type_quals, casts_away_constness, non_reference): Likewise.
2964 * typeck2.c (cxx_readonly_error, store_init_value,
2965 process_init_constructor_record, build_x_arrow, build_functional_cast,
2966 add_exception_specifier): Likewise.
2968 2018-05-14 Jason Merrill <jason@redhat.com>
2970 * pt.c (tsubst) [ARRAY_TYPE]: Check valid_array_size_p.
2971 (tsubst_copy_and_build) [NEW_EXPR]: Clear in_decl.
2973 2018-05-11 Jakub Jelinek <jakub@redhat.com>
2976 * cp-tree.h (cxx_omp_predetermined_sharing_1): New prototype.
2977 * cp-gimplify.c (cxx_omp_predetermined_sharing): New wrapper around
2978 cxx_omp_predetermined_sharing_1. Rename old function to ...
2979 (cxx_omp_predetermined_sharing_1): ... this.
2980 * semantics.c (finish_omp_clauses): Use cxx_omp_predetermined_sharing_1
2981 instead of cxx_omp_predetermined_sharing.
2983 2018-05-10 Jason Merrill <jason@redhat.com>
2985 * decl.c (cp_finish_decl): Don't instantiate auto variable.
2986 (check_static_variable_definition): Allow auto.
2987 * constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
2989 * cp-tree.h (DECL_CONSTRUCTOR_P): Use DECL_CXX_CONSTRUCTOR_P.
2990 (DECL_DESTRUCTOR_P): Use DECL_CXX_DESTRUCTOR_P.
2992 Core issue 2310 - conversion to base of incomplete type.
2993 * class.c (build_base_path): Check COMPLETE_TYPE_P for source type.
2995 CWG 2267 - list-initialization of reference temporary
2996 * call.c (reference_binding): List-initializing a reference
2997 temporary is copy-list-initialization.
2999 * parser.c (cp_parser_class_head): Use num_template_headers_for_class.
3001 * pt.c (instantiate_decl): Make sure we aren't trying to do a nested
3002 instantiation in template context.
3004 * class.c (vbase_has_user_provided_move_assign): Use
3007 * lambda.c (lambda_expr_this_capture): Improve logic.
3009 * decl.c (make_typename_type): s/parameters/arguments/.
3010 * parser.c (cp_parser_nested_name_specifier_opt): Likewise.
3011 * pt.c (make_pack_expansion): Correct error message.
3013 2018-05-10 Jakub Jelinek <jakub@redhat.com>
3016 * cp-gimplify.c (cp_fold): Use fold_offsetof rather than
3017 fold_offsetof_1, pass TREE_TYPE (x) as TYPE to it and drop the
3020 2018-05-10 Eric Botcazou <ebotcazou@adacore.com>
3023 * decl2.c (adjust_var_decl_tls_model): New static function.
3024 (comdat_linkage): Call it on a variable.
3025 (maybe_make_one_only): Likewise.
3027 2018-05-09 Paolo Carlini <paolo.carlini@oracle.com>
3031 2018-05-08 Paolo Carlini <paolo.carlini@oracle.com>
3034 * parser.c (cp_parser_parameter_declaration_list): When the
3035 entire parameter-declaration-list is erroneous maybe call
3036 abort_fully_implicit_template.
3038 2018-05-08 Jason Merrill <jason@redhat.com>
3040 PR c++/85706 - class deduction under decltype
3041 * pt.c (for_each_template_parm_r): Handle DECLTYPE_TYPE. Clear
3042 *walk_subtrees whether or not we walked into the operand.
3043 (type_uses_auto): Only look at deduced contexts.
3045 2018-05-08 Paolo Carlini <paolo.carlini@oracle.com>
3048 * parser.c (cp_parser_parameter_declaration_list): When the
3049 entire parameter-declaration-list is erroneous maybe call
3050 abort_fully_implicit_template.
3052 2018-05-08 Marek Polacek <polacek@redhat.com>
3055 * semantics.c (finish_if_stmt_cond): See through typedefs.
3057 2018-05-07 Jason Merrill <jason@redhat.com>
3059 PR c++/85646 - lambda visibility.
3060 * decl2.c (determine_visibility): Don't mess with template arguments
3061 from the containing scope.
3062 (vague_linkage_p): Check DECL_ABSTRACT_P before looking at a 'tor
3065 2018-05-07 Nathan Sidwell <nathan@acm.org>
3067 Remove fno-for-scope
3068 * cp-tree.h (DECL_ERROR_REPORTED, DECL_DEAD_FOR_LOCAL)
3069 (DECL_HAS_SHADOWED_FOR_VAR_P, DECL_SHADOWED_FOR_VAR)
3070 (SET_DECL_SHADOWED_FOR_VAR): Delete.
3071 (decl_shadowed_for_var_lookup, decl_shadowed_for_var_insert)
3072 (check_for_out_of_scope_variable, init_shadowed_var_for_decl):
3074 * name-lookup.h (struct cp_binding_level): Remove
3075 dead_vars_from_for field.
3076 * cp-lang.c (cp_init_ts): Delete.
3077 (LANG_HOOKS_INIT_TS): Override to cp_common_init_ts.
3078 * cp-objcp-common.c (shadowed_var_for_decl): Delete.
3079 (decl_shadowed_for_var_lookup, decl_shadowed_for_var_insert)
3080 (init_shadowed_var_for_decl): Delete.
3081 * decl.c (poplevel): Remove shadowed for var handling.
3082 (cxx_init_decl_processing): Remove -ffor-scope deprecation.
3083 * name-lookup.c (find_local_binding): Remove shadowed for var
3085 (check_local_shadow): Likewise.
3086 (check_for_out_of_scope_variable): Delete.
3087 * parser.c (cp_parser_primary_expression): Remove shadowed for var
3089 * pt.c (tsubst_decl): Remove DECL_DEAD_FOR_LOCAL setting.
3090 * semantics.c (begin_for_scope): Always have a scope.
3091 (begin_for_stmt, finish_for_stmt): Remove ARM-for scope handling.
3092 (begin_range_for_stmt, finish_id_expression): Likewise.
3094 2018-05-07 Jason Merrill <jason@redhat.com>
3096 PR c++/85618 - ICE with initialized VLA.
3097 * tree.c (vla_type_p): New.
3098 * typeck2.c (store_init_value, split_nonconstant_init_1): Check it
3099 rather than array_of_runtime_bound_p.
3101 2018-05-05 Paolo Carlini <paolo.carlini@oracle.com>
3103 * cvt.c (ocp_convert): Early handle the special case of a
3104 null_ptr_cst_p expr converted to a NULLPTR_TYPE_P type.
3106 2018-05-03 Jason Merrill <jason@redhat.com>
3108 PR c++/85600 - virtual delete failure.
3109 * init.c (build_delete): Always save_expr when deleting.
3111 2018-05-03 Nathan Sidwell <nathan@acm.org>
3113 * decl.c (cxx_init_decl_processing): Remove flag_friend_injection.
3114 * name-lookup.c (do_pushdecl): Likewise.
3116 2018-05-02 Paolo Carlini <paolo.carlini@oracle.com>
3117 Jason Merrill <jason@redhat.com>
3120 * name-lookup.c (check_local_shadow): Don't handle static old
3121 declarations in the block handling locals shadowing locals.
3123 2018-05-01 Jason Merrill <jason@redhat.com>
3125 PR c++/85587 - error with scoped enum in template.
3126 * semantics.c (finish_qualified_id_expr): Don't return an
3127 unqualified IDENTIFIER_NODE.
3129 2018-04-30 Jason Merrill <jason@redhat.com>
3131 PR c++/85580 - extern "C" and local variables
3132 * name-lookup.c (check_extern_c_conflict): Ignore local decls.
3134 PR c++/84701 - unsigned typeof.
3135 * decl.c (grokdeclarator): Overhaul diagnostics for invalid use
3136 of long/short/signed/unsigned.
3138 PR c++/85305 - pack in lambda init-capture.
3139 * parser.c (cp_parser_initializer): Add subexpression_p parm; don't
3140 check_for_bare_parameter_packs in a subexpression.
3141 (cp_parser_lambda_introducer): Use it.
3143 PR c++/61982 - dead stores to destroyed objects.
3144 * call.c (build_trivial_dtor_call): New, assigns a clobber.
3145 (build_over_call, build_special_member_call): Use it.
3146 * cp-tree.h: Declare it.
3147 * init.c (build_delete): Remove trivial path.
3149 * init.c (build_dtor_call): Use build_special_member_call.
3150 (build_delete): Remove redundant uses of save_addr.
3152 * decl.c (build_clobber_this): Use build_clobber.
3154 2018-04-27 Jakub Jelinek <jakub@redhat.com>
3157 * init.c (build_zero_init_1): For zero initialization of
3158 NULLPTR_TYPE_P type use build_int_cst directly.
3160 2018-04-27 David Malcolm <dmalcolm@redhat.com>
3163 * name-lookup.c (consider_binding_level): Skip compiler-generated
3165 * search.c (lookup_field_fuzzy_info::fuzzy_lookup_field): Flatten
3166 nested if statements into a series of rejection tests. Reject
3167 lambda-ignored entities as suggestions.
3169 2018-04-27 Jason Merrill <jason@redhat.com>
3171 * cvt.c (cp_fold_convert): Use convert_ptrmem.
3172 * typeck.c (convert_ptrmem): Add a NOP even if no adjustment.
3174 2018-04-27 Paolo Carlini <paolo.carlini@oracle.com>
3177 * decl.c (grokdeclarator): Clear friendp upon definition in local
3178 class definition error.
3180 2018-04-27 Jason Merrill <jason@redhat.com>
3182 PR c++/85545 - ICE with noexcept PMF conversion.
3183 * cvt.c (cp_fold_convert): Pass PMF CONSTRUCTORs to
3185 * typeck.c (build_ptrmemfunc): Don't build a NOP_EXPR for zero
3187 (build_ptrmemfunc_access_expr): Special-case CONSTRUCTORs.
3189 2018-04-27 Nathan Sidwell <nathan@acm.org>
3191 * typeck.c (convert_ptrmem): Move local var decls to initialization.
3193 * cp-tree.h (TEMPLATE_INFO): Fix comments.
3194 (TI_PENDING_TEMPLATE_FLAG): Check TEMPLATE_INFO.
3195 (NON_DEFAULT_TEMPLATE_ARG_COUNT): Wrap line.
3196 (dump, print_other_binding_stacks): Remove declarations.
3197 * name-lookup.c (print_other_binding_stack): Make static.
3198 * pt.c (build_template_decl): Make static.
3200 2018-04-26 Jason Merrill <jason@redhat.com>
3202 PR c++/85545 - ICE with noexcept PMF conversion.
3203 * cvt.c (cp_fold_convert): Handle PMF CONSTRUCTORs directly.
3205 2018-04-25 Nathan Sidwell <nathan@acm.org>
3209 * cp-tree.h (REINTERPRET_CAST_P): New.
3210 * constexpr.c (cxx_eval_constant_expression) <case NOP_EXPR>:
3211 Reject REINTERPET_CAST_P conversions. Use cplus_expand_constant
3212 for non-trivial PTRMEM_CST cases.
3213 * typeck.c (build_nop_reinterpret): New.
3214 (build_reinterpret_cast_1): Use it. Set REINTERPRET_CAST_P on
3215 NOP_EXPRs returned by cp_convert.
3217 2018-04-23 Jason Merrill <jason@redhat.com>
3219 PR c++/69560 - wrong alignof(double) on x86.
3220 CWG 1879 - Inadequate definition of alignment requirement.
3221 * cp-tree.h (ALIGNOF_EXPR_STD_P): New.
3222 * typeck.c (cxx_sizeof_or_alignof_type): Add std_alignof parm.
3223 (cxx_sizeof_expr, cxx_sizeof_nowarn, cxx_alignas_expr)
3224 (cxx_alignof_expr): Pass it.
3225 * parser.c (cp_parser_unary_expression): Pass it.
3226 * pt.c (tsubst_copy): Copy it.
3227 (tsubst_copy_and_build): Pass it.
3228 * decl.c (fold_sizeof_expr): Pass it.
3230 2018-04-23 Jakub Jelinek <jakub@redhat.com>
3231 Jason Merrill <jason@redhat.com>
3233 PR c++/85470 - wrong error with static data member.
3234 * decl.c (check_initializer): Check DECL_INITIALIZED_IN_CLASS_P.
3235 * typeck2.c (store_init_value): Likewise.
3237 2018-04-20 Jakub Jelinek <jakub@redhat.com>
3240 * cp-tree.h (tinst_level): Remove in_system_header_p member,
3241 change refcount member from unsigned char to unsigned short,
3242 add refcount_infinity static data member, adjust comments.
3243 * pt.c (tinst_level::refcount_infinity): Define.
3244 (inc_refcount_use): Remove assert, don't increment if refcount
3245 is already refcount_infinity, adjust comment.
3246 (dec_refcount_use): Remove assert, don't decrement if refcount
3247 is refcount_infinity, adjust comment.
3248 (push_tinst_level_loc): Formatting fix.
3250 2018-04-19 Paolo Carlini <paolo.carlini@oracle.com>
3253 * pt.c (lookup_template_class_1): Check pushtag return value for
3256 2018-04-19 Alexandre Oliva <aoliva@redhat.com>
3259 * cp-tree.h (tinst_level::free): Fix whitespace.
3261 2018-04-18 Paolo Carlini <paolo.carlini@oracle.com>
3264 * pt.c (tsubst_lambda_expr): Check begin_lambda_type return value
3265 for error_mark_node.
3267 2018-04-18 Jakub Jelinek <jakub@redhat.com>
3270 * typeck.c (cp_build_addr_expr_1): Move handling of offsetof-like
3271 tricks from here to ...
3272 * cp-gimplify.c (cp_fold) <case ADDR_EXPR>: ... here. Only use it
3273 if INDIRECT_REF's operand is INTEGER_CST cast to pointer type.
3275 2018-04-18 Alexandre Oliva <aoliva@redhat.com>
3278 * cp-tree.h (struct tinst_level): Split decl into tldcl and
3279 targs. Add private split_list_p, tree_list_p, and not_list_p
3280 inline const predicates; to_list private member function
3281 declaration; free public member function declaration; list_p,
3282 get_node and maybe_get_node accessors, and refcount data
3283 member. Narrow errors to unsigned short.
3284 * error.c (print_instantiation_full_context): Use new
3286 (print_instantiation_partial_context_line): Likewise. Drop
3287 const from tinst_level-typed parameter.
3288 * mangle.c (mangle_decl_string): Likewise.
3289 * pt.c (freelist): New template class.
3290 (tree_list_freelist_head): New var.
3291 (tree_list_freelist): New fn, along with specializations.
3292 (tinst_level_freelist_head): New var.
3293 (pending_template_freelist_head): Likewise.
3294 (tinst_level_freelist, pending_template_freelist): New fns.
3295 (tinst_level::to_list, tinst_level::free): Define.
3296 (inc_refcount_use, dec_refcount_use): New fns for tinst_level.
3297 (set_refcount_ptr): New template fn.
3298 (add_pending_template): Adjust for refcounting, freelists and
3300 (neglectable_inst_p): Take a NULL d as a non-DECL.
3301 (limit_bad_template_recursion): Use new accessors.
3302 (push_tinst_level): New overload to create the list.
3303 (push_tinst_level_loc): Make it static, split decl into two
3304 args, adjust tests and initialization to cope with split
3305 lists, use freelist, adjust for refcounting.
3306 (push_tinst_level_loc): New wrapper with the old interface.
3307 (pop_tinst_level): Adjust for refcounting.
3308 (record_last_problematic_instantiation): Likewise.
3309 (reopen_tinst_level): Likewise. Use new accessors.
3310 (instantiate_alias_template): Adjust for split list.
3311 (fn_type_unification): Likewise.
3312 (get_partial_spec_bindings): Likewise.
3313 (instantiate_pending_templates): Use new accessors. Adjust
3314 for refcount. Release pending_template to freelist.
3315 (instantiating_current_function_p): Use new accessors.
3317 2018-04-16 Alexandre Oliva <aoliva@redhat.com>
3320 * parser.c (cp_parser_builtin_offset): Reject type definitions.
3321 * mangle.c (nested_anon_class_index): Avoid crash returning -1
3322 if we've seen errors.
3324 2018-04-12 David Malcolm <dmalcolm@redhat.com>
3327 * name-lookup.c (macro_use_before_def::maybe_make): New function,
3328 checking that the use is indeed before the definition.
3329 (macro_use_before_def::macro_use_before_def): Make private.
3330 (macro_use_before_def::~macro_use_before_def): Make private. Move
3331 check for UNKNOWN_LOCATION to macro_use_before_def::maybe_make.
3332 (lookup_name_fuzzy): Call macro_use_before_def::maybe_make rather
3333 than using new directly.
3335 2018-04-12 Jason Merrill <jason@redhat.com>
3337 PR c++/85356 - ICE with pointer to member function.
3338 * pt.c (maybe_instantiate_noexcept): Do instantiate in templates if
3339 flag_noexcept_type. Build the new spec within the function context.
3340 * except.c (build_noexcept_spec): Do get constant value in templates
3341 if flag_noexcept_type.
3342 * decl.c (check_redeclaration_exception_specification): Don't
3343 instantiate noexcept on a dependent declaration.
3345 2018-04-12 Marek Polacek <polacek@redhat.com>
3348 * constexpr.c (reduced_constant_expression_p): Return false for null
3351 2018-04-11 Marek Polacek <polacek@redhat.com>
3354 * constexpr.c (potential_constant_expression_1): Consider conversions
3355 from classes to literal types potentially constant.
3357 2018-04-10 Paolo Carlini <paolo.carlini@oracle.com>
3360 * init.c (build_zero_init_1): Handle NULLPTR_TYPE_P being true of
3361 the type like TYPE_PTR_OR_PTRMEM_P.
3363 2018-04-10 Jason Merrill <jason@redhat.com>
3365 PR debug/65821 - wrong location for main().
3366 * call.c (clear_location_r, convert_default_arg): Revert.
3367 * tree.c (break_out_target_exprs): Add clear_location parm.
3368 (struct bot_data): New.
3369 (bot_manip): Clear location if requested.
3370 * init.c (get_nsdmi): Pass clear_location.
3372 2018-04-10 David Malcolm <dmalcolm@redhat.com>
3375 * call.c (get_fndecl_argument_location): Make non-static.
3376 * cp-tree.h (get_fndecl_argument_location): New decl.
3377 * typeck.c (convert_for_assignment): When complaining due to
3378 conversions for an argument, show the location of the parameter
3381 2018-04-10 Jakub Jelinek <jakub@redhat.com>
3383 PR c++/85312 - P0962 cleanup
3384 * parser.c (cp_parser_perform_range_for_lookup): Remove unreachable
3387 2018-04-10 Jason Merrill <jason@redhat.com>
3389 PR debug/65821 - wrong location for main().
3390 * call.c (clear_location_r): New.
3391 (convert_default_arg): Use it.
3392 * tree.c (bot_manip): Remove builtin_LINE/FILE handling.
3394 PR c++/85285 - ICE with flexible array after substitution.
3395 * pt.c (instantiate_class_template_1): Check for flexible array in
3398 2018-04-09 Paolo Carlini <paolo.carlini@oracle.com>
3401 * decl.c (cp_finish_decomp): In a template, if the type is incomplete
3402 issue a pedwarn and defer trying to do bindings.
3404 2018-04-09 Jason Merrill <jason@redhat.com>
3406 PR c++/85279 - dump_expr doesn't understand decltype.
3407 * error.c (dump_expr): Handle DECLTYPE_TYPE.
3409 PR c++/85262 - ICE with redundant qualification on constructor.
3410 * call.c (build_new_method_call_1): Move make_args_non_dependent
3411 after A::A() handling.
3413 PR c++/85277 - ICE with invalid offsetof.
3414 * semantics.c (finish_offsetof): Avoid passing non-DECL to %qD.
3415 Adjust -Winvalid-offsetof diagnostic to say conditionally supported.
3417 PR c++/85264 - ICE with excess template-parameter-list.
3418 * parser.c (cp_parser_check_template_parameters): Add template_id_p
3419 parameter. Don't allow an extra template header if true.
3420 (cp_parser_class_head): Pass template_id_p.
3421 (cp_parser_elaborated_type_specifier): Likewise.
3422 (cp_parser_alias_declaration): Likewise.
3423 (cp_parser_check_declarator_template_parameters): Likewise.
3425 2018-04-09 Jakub Jelinek <jakub@redhat.com>
3428 * parser.c (cp_parser_simple_declaration): For structured bindings,
3429 if *maybe_range_for_decl is NULL after parsing it, set it to
3432 2018-04-09 Jason Merrill <jason@redhat.com>
3434 PR c++/85256 - ICE capturing pointer to VLA.
3435 * lambda.c (add_capture): Distinguish between variable-size and
3436 variably-modified types.
3438 2018-04-06 Jason Merrill <jason@redhat.com>
3440 PR c++/85214 - ICE with alias, generic lambda, constexpr if.
3441 * pt.c (extract_locals_r): Remember local typedefs.
3443 2018-04-06 David Malcolm <dmalcolm@redhat.com>
3446 * name-lookup.c (struct std_name_hint): Move out of
3447 get_std_name_hint; add field "min_dialect".
3448 (get_std_name_hint): Add min_dialect values to all initializers.
3449 Add <any>, <atomic>, <bitset>, <condition_variable>, <functional>,
3450 <future>, <istream>, <iterator>, <ostream>, <mutex>, <optional>,
3451 <shared_mutex>, <string_view>, <thread>, and <variant>.
3452 Add fstream, ifstream, and ofstream to <fstream>.
3453 Add istringstream, ostringstream, and stringstream to <sstream>.
3454 Add basic_string to <string>.
3455 Add tuple_element and tuple_size to <tuple>.
3456 Add declval to <utility>.
3457 Fix ordering of <queue> and <tuple>.
3458 Return a std_name_hint, rather than a const char *.
3459 (get_cxx_dialect_name): New function.
3460 (maybe_suggest_missing_std_header): Detect names that aren't yet
3461 available in the current dialect, and instead of suggesting a
3462 missing #include, warn about the dialect.
3464 2018-04-06 Jakub Jelinek <jakub@redhat.com>
3467 * pt.c (tsubst_decomp_names): Return error_mark_node and assert
3468 errorcount is set if tsubst doesn't return a VAR_DECL.
3470 2018-04-06 David Malcolm <dmalcolm@redhat.com>
3473 * name-lookup.c (using_directives_contain_std_p): New function.
3474 (has_using_namespace_std_directive_p): New function.
3475 (suggest_alternatives_for): Simplify if/else logic using early
3476 returns. If no candidates were found, and there's a
3477 "using namespace std;" directive, call
3478 maybe_suggest_missing_std_header.
3479 (maybe_suggest_missing_header): Split later part of the function
3481 (maybe_suggest_missing_std_header): New.
3483 2018-04-06 Jason Merrill <jason@redhat.com>
3485 PR c++/85242 - ICE with class definition in template parm.
3486 * cp-tree.h (PROCESSING_REAL_TEMPLATE_DECL_P): False if
3487 processing_template_parmlist.
3489 PR c++/85240 - LTO ICE with using of undeduced auto fn.
3490 * cp-gimplify.c (cp_genericize_r): Discard using of undeduced auto.
3492 2018-04-05 Jakub Jelinek <jakub@redhat.com>
3495 * pt.c (tsubst_decomp_names): Don't fail or ICE if DECL_CHAIN (decl3)
3496 is not prev, if prev == decl.
3499 * decl.c (start_decl): For DECL_DECOMPOSITION_P decls, don't call
3500 maybe_apply_pragma_weak here...
3501 (cp_maybe_mangle_decomp): ... but call it here instead.
3503 2018-04-05 Jason Merrill <jason@redhat.com>
3505 PR c++/85136 - ICE with designated init in template.
3506 * decl.c (maybe_deduce_size_from_array_init): Handle dependent
3507 designated initializer.
3508 (check_array_designated_initializer): Update ce->index with the
3511 PR c++/83808 - ICE with VLA initialization.
3512 * typeck2.c (process_init_constructor_array): Don't require a VLA
3513 initializer to have VLA type.
3515 2018-04-05 Paolo Carlini <paolo.carlini@oracle.com>
3518 * call.c (convert_like_real): Fail gracefully for a broken
3519 std::initializer_list, missing a definition.
3521 * name-lookup.c (do_pushtag): Tweak message, use %< and %>.
3523 2018-04-05 Paolo Carlini <paolo.carlini@oracle.com>
3526 * decl.c (grokdeclarator): Fix diagnostic about typedef name used
3527 as nested-name-specifier, keep type and TREE_TYPE (decl) in sync.
3529 2018-04-05 Jason Merrill <jason@redhat.com>
3531 PR c++/82152 - ICE with class deduction and inherited ctor.
3532 * pt.c (do_class_deduction): Ignore inherited ctors.
3534 PR c++/84665 - ICE with array of empty class.
3535 * decl2.c (cp_check_const_attributes): Use fold_non_dependent_expr.
3537 PR c++/85228 - ICE with lambda in enumerator in template.
3538 * pt.c (bt_instantiate_type_proc): Don't assume
3539 CLASSTYPE_TEMPLATE_INFO is non-null.
3541 2018-04-05 Ville Voutilainen <ville.voutilainen@gmail.com>
3544 * decl.c (find_decomp_class_base): Check accessibility instead
3545 of declared access, adjust diagnostic.
3547 2018-04-05 Ville Voutilainen <ville.voutilainen@gmail.com>
3550 * decl.c (get_tuple_decomp_init): Check the templatedness
3553 2018-04-05 Jason Merrill <jason@redhat.com>
3555 PR c++/85200 - ICE with constexpr if in generic lambda.
3556 * pt.c (extract_locals_r): Don't record the local specs of variables
3557 declared within the pattern.
3559 2018-04-05 Alexandre Oliva <aoliva@redhat.com>
3562 * pt.c (check_auto_in_tmpl_args): New.
3563 (tsubst_qualified_id): Use it to reject template args
3564 referencing auto for non-type templates.
3565 * parser.c (cp_parser_template_id): Likewise.
3566 * cp-tree.h (check_auto_in_tmpl_args): Declare.
3567 * typeck2.c (build_functional_cast): Report correct location
3568 for invalid use of auto.
3570 2018-04-04 Jason Merrill <jason@redhat.com>
3572 PR c++/85215 - ICE with copy-init from conversion.
3573 * call.c (merge_conversion_sequences): Fix type of direct binding
3576 PR c++/84938 - ICE with division by ~-1.
3577 * call.c (set_up_extended_ref_temp): Call cp_fully_fold.
3579 PR c++/84936 - ICE with unexpanded pack in mem-initializer.
3580 * parser.c (cp_parser_mem_initializer_list): Call
3581 check_for_bare_parameter_packs.
3583 2018-04-04 Jakub Jelinek <jakub@redhat.com>
3586 * constexpr.c (cxx_eval_builtin_function_call): For calls to
3587 builtin_valid_in_constant_expr_p functions, don't call
3588 cxx_eval_constant_expression if argument is not
3589 potential_constant_expression.
3592 * cp-tree.h (calculate_bases, calculate_direct_bases): Add complain
3594 * semantics.c (calculate_bases): Add complain argument. Use
3595 complete_type_or_maybe_complain instead of just complete_type and
3596 return an empty vector if it fails. Move make_tree_vector () call
3597 after early return. Formatting fixes.
3598 (calculate_direct_bases): Likewise. Call release_tree_vector at the
3600 (dfs_calculate_bases_post, calculate_bases_helper): Formatting fixes.
3601 * pt.c (tsubst_pack_expansion): Adjust calculate_bases and
3602 calculate_direct_bases callers, formatting fixes.
3604 2018-04-04 Jason Merrill <jason@redhat.com>
3606 PR c++/85006 - -fconcepts ICE with A<auto...> return type
3607 * pt.c (tsubst_pack_expansion): Allow unsubstituted auto pack.
3609 PR c++/85200 - ICE with constexpr if in generic lambda.
3610 * tree.c (cp_walk_subtrees): Walk into DECL_EXPR in templates.
3612 PR c++/84221 - bogus -Wunused with attribute and template.
3613 * decl2.c (is_late_template_attribute): Handle unused and used
3614 normally on non-TYPE_DECL.
3616 PR c++/85135 - ICE with omitted template arguments.
3617 * decl.c (grokdeclarator): Catch deduced class type in trailing
3620 PR c++/85133 - ICE with missing concept initializer.
3621 * decl.c (cp_finish_decl): If a concept initializer is missing, use
3624 PR c++/85118 - wrong error with generic lambda and std::bind.
3625 * call.c (add_template_conv_candidate): Disable if there are any
3628 PR c++/85141 - ICE with compound assignment and static member fn.
3629 * typeck.c (cp_build_modify_expr): Call decay_conversion for RHS of
3630 compound assignment.
3632 PR c++/85148 - ICE with 'this' in array NSDMI.
3633 * tree.c (replace_placeholders_r): Use handled_component_p.
3635 2018-04-04 Ville Voutilainen <ville.voutilainen@gmail.com>
3638 * decl.c (grokfndecl): Handle standard UDL diagnostics here..
3639 * parser.c (cp_parser_unqualified_id): ..not here.
3641 2018-04-04 Alexandre Oliva <aoliva@redhat.com>
3644 * typeck.c (cp_build_addr_expr_1): Mark FUNCTION_DECL as
3646 * decl2.c (mark_used): Return without effects if tf_conv.
3648 2018-04-03 Jason Merrill <jason@redhat.com>
3650 PR c++/85092 - C++17 ICE with unused list constructor.
3651 * call.c (conv_binds_ref_to_prvalue): Also count ck_identity
3654 PR c++/85113 - ICE with constexpr and __builtin_constant_p.
3655 * constexpr.c (cxx_eval_builtin_function_call): Only defer
3656 __builtin_constant_p if ctx->quiet.
3658 2018-04-03 Paolo Carlini <paolo.carlini@oracle.com>
3661 * pt.c (rewrite_template_parm): If the first argument is
3662 error_mark_node return it immediately.
3663 (build_deduction_guide): Check the return value of the
3664 latter for error_mark_node.
3665 (do_class_deduction): Check the return value of the latter.
3667 2018-04-03 Jason Merrill <jason@redhat.com>
3669 * semantics.c (finish_if_stmt_cond): Use
3670 instantiation_dependent_expression_p.
3672 PR c++/85149 - generic lambda and constexpr if.
3673 * pt.c (build_extra_args, add_extra_args): Split from
3674 tsubst_pack_expansion.
3675 (tsubst_expr) [IF_STMT]: Use them.
3676 * cp-tree.h (IF_STMT_EXTRA_ARGS): New.
3678 * typeck.c (merge_types): Limit matching attribute shortcut to
3681 2018-04-03 Jakub Jelinek <jakub@redhat.com>
3684 * pt.c (fixed_parameter_pack_p_1): Punt if parm is error_mark_node.
3687 * name-lookup.c (handle_namespace_attrs): Return early if attributes
3691 * decl.c (cp_finish_decl): If ensure_literal_type_for_constexpr_object
3692 fails, after clearing DECL_DECLARED_CONSTEXPR_P don't return early,
3693 instead for static data members clear init and set DECL_EXTERNAL.
3695 2018-04-02 Jason Merrill <jason@redhat.com>
3697 PR c++/64095 - auto... parameter pack.
3698 * parser.c (cp_parser_parameter_declaration): Handle turning autos
3700 (cp_parser_parameter_declaration_list): Not here.
3702 2018-03-31 Alexandre Oliva <aoliva@redhat.com>
3705 * class.c (instantiate_type): Peel off SAVE_EXPR before
3708 2018-03-30 Jason Merrill <jason@redhat.com>
3710 * typeck2.c (process_init_constructor_record): Use
3711 init_list_type_node for the CONSTRUCTOR around an anonymous union
3712 designated initializer.
3714 2018-03-30 Jakub Jelinek <jakub@redhat.com>
3717 * semantics.c (finish_omp_reduction_clause): If
3718 OMP_CLAUSE_REDUCTION_PLACEHOLDER is error_mark_node, return true
3719 even if processing_template_decl.
3721 2018-03-29 David Malcolm <dmalcolm@redhat.com>
3724 * name-lookup.c (get_std_name_hint): Add names from <memory>,
3725 <tuple>, and <utility>.
3727 2018-03-29 Jason Merrill <jason@redhat.com>
3729 PR c++/85093 - too many template args with pack expansion.
3730 * pt.c (coerce_template_parms): Keep pack expansion args that will
3733 2018-03-29 Jason Merrill <jason@redhat.com>
3735 * pt.c (build_non_dependent_expr): Propagate expr location.
3737 2018-03-27 Jason Merrill <jason@redhat.com>
3739 PR c++/85060 - wrong-code with call to base member in template.
3740 * search.c (any_dependent_bases_p): Check uses_template_parms
3741 rather than processing_template_decl.
3743 2018-03-29 David Malcolm <dmalcolm@redhat.com>
3746 * typeck.c (convert_for_assignment): When complaining due to
3747 conversions for an argument, attempt to use the location of the
3750 2018-03-28 Paolo Carlini <paolo.carlini@oracle.com>
3753 * pt.c (tsubst_default_argument): Early return if the type of the
3754 parameter is erroneous.
3756 2018-03-28 Alexandre Oliva <aoliva@redhat.com>
3759 * decl2.c (note_vague_linkage_fn): Don't defer uninstantiated
3763 * tree.c (strip_typedefs_expr): Reject STATEMENT_LISTs.
3765 2018-03-27 Paolo Carlini <paolo.carlini@oracle.com>
3768 * method.c (defaulted_late_check): Partially revert r253321 changes,
3769 do not early return upon error.
3771 2018-03-27 Jakub Jelinek <jakub@redhat.com>
3774 * cp-gimplify.c (cp_fold) <case CONSTRUCTOR>: For ctors with vector
3775 type call fold to generate VECTOR_CSTs when possible.
3778 * tree.c (cp_build_reference_type): If to_type is error_mark_node,
3779 return it right away.
3781 2018-03-27 Volker Reichelt <v.reichelt@netcologne.de>
3783 * search.c (check_final_overrider): Use inform instead of error
3784 for the diagnostics of the overridden functions. Tweak wording.
3786 2018-03-27 Jakub Jelinek <jakub@redhat.com>
3789 * class.c (update_vtable_entry_for_fn): Don't ICE if base_binfo
3790 is NULL. Assert if thunk_binfo is NULL then errorcount is non-zero.
3792 2018-03-27 Paolo Carlini <paolo.carlini@oracle.com>
3793 Jason Merrill <jason@redhat.com>
3796 * init.c (build_aggr_init): When initializing from array,
3797 reject anything but CONSTRUCTORs and TARGET_EXPRs.
3798 (build_vec_init): Handle separately ARRAY_TYPEs.
3800 2018-03-26 Jason Merrill <jason@redhat.com>
3802 PR c++/85062 - ICE with alignas in wrong place.
3803 * decl.c (grokdeclarator): Ignore attributes on type-specifiers
3806 PR c++/85049 - ICE with __integer_pack.
3807 * pt.c (unify_pack_expansion): Don't try to deduce generated packs.
3808 * cp-tree.h (TEMPLATE_PARM_P): New.
3810 2018-03-23 Jason Merrill <jason@redhat.com>
3812 PR c++/78489 - wrong SFINAE behavior.
3815 * pt.c (type_unification_real): Don't defer substitution failure.
3817 2018-03-23 Jakub Jelinek <jakub@redhat.com>
3820 * decl.c (compute_array_index_type): Set osize to mark_rvalue_use
3824 * pt.c (tsubst_copy_and_build) <case FIX_TRUNC_EXPR>: Replace
3825 cp_build_unary_op call with gcc_unreachable ().
3827 2018-03-23 Marek Polacek <polacek@redhat.com>
3830 * cxx-pretty-print.c (cxx_pretty_printer::multiplicative_expression):
3831 Handle EXACT_DIV_EXPR and RDIV_EXPR. Tweak condition.
3832 (cxx_pretty_printer::expression): Handle EXACT_DIV_EXPR and RDIV_EXPR.
3834 2018-03-23 Ville Voutilainen <ville.voutilainen@gmail.com>
3837 * parser.c (cp_parser_perform_range_for_lookup): Change
3838 the condition for deciding whether to use members.
3840 2018-03-23 Marek Polacek <polacek@redhat.com>
3843 * semantics.c (finish_offsetof): Don't allow CONST_DECLs.
3845 2018-03-23 Alexandre Oliva <aoliva@redhat.com>
3848 * parser.c (cp_parser_alias_declaration): Call
3849 parser_check_template_parameters.
3852 * pt.c (resolve_typename_type): Drop assert that stopped
3853 simplification to template-independent types. Add assert to
3854 verify the initial scope is template dependent.
3855 * parser.c (cp_parser_parse_and_diagnose_invalid_type_name):
3856 Reparse the id expression as a type-name, not a declarator.
3859 * init.c (build_vec_init): Error at parenthesized array init.
3864 * cp-tree.h (temp_override): New template class, generalizing
3865 a cleanup that was only used...
3866 * parser.c (cp_parser_parameter_declaration_clause):
3867 ... here for auto_is_implicit_function_template_parm_p.
3868 (cp_parser_gnu_attributes_opt): Use it here as well.
3869 (cp_parser_std_attribute): Likewise.
3871 2018-03-22 Marek Polacek <polacek@redhat.com>
3874 * semantics.c (finish_if_stmt_cond): Check if the type of the condition
3877 2018-03-21 Jason Merrill <jason@redhat.com>
3879 PR c++/81311 - wrong C++17 overload resolution.
3880 * call.c (build_user_type_conversion_1): Remove C++17 code.
3881 (conv_binds_ref_to_prvalue): New.
3882 (build_over_call): Handle C++17 copy elision.
3883 (build_special_member_call): Only do C++17 copy elision here if the
3884 argument is already the right type.
3886 2018-03-21 Alexandre Oliva <aoliva@redhat.com>
3889 * init.c (build_vec_init): Silence error, former sorry,
3894 * parser.c (abort_fully_implicit_template_p): New.
3895 (cp_parser_skip_to_end_of_statement): Use it.
3896 (cp_parser_skip_to_end_of_block_or_statement): Likewise.
3897 (finish_fully_implicit_template_p): Clear
3898 implicit_template_parms and implicit_template_scope.
3900 2018-03-21 Paolo Carlini <paolo.carlini@oracle.com>
3903 * decl.c (maybe_deduce_size_from_array_init): Set TREE_TYPE to
3904 error_mark_node when check_array_designated_initializer fails.
3906 2018-03-21 Jakub Jelinek <jakub@redhat.com>
3909 * cp-tree.h (genericize_compound_lvalue): Declare.
3910 * typeck.c (genericize_compound_lvalue): New function.
3911 (unary_complex_lvalue, cp_build_modify_expr): Use it.
3912 * semantics.c (finish_asm_stmt): Replace MODIFY_EXPR, PREINCREMENT_EXPR
3913 and PREDECREMENT_EXPR in output and "m" constrained input operands with
3914 COMPOUND_EXPR. Call cxx_mark_addressable on the rightmost
3915 COMPOUND_EXPR operand.
3917 2018-03-21 Nathan Sidwell <nathan@acm.org>
3920 * tree.c (decl_linkage): Use DECL_CLONED_FUNCTION_P.
3921 * decl2.c (vague_linkage_p): Likewise.
3923 2018-03-21 David Malcolm <dmalcolm@redhat.com>
3926 * constexpr.c (constexpr_fn_retval): Make non-"static".
3927 * cp-tree.h (constexpr_fn_retval): New decl.
3928 * search.c (direct_accessor_p): Update leading comment.
3929 (reference_accessor_p): Likewise.
3930 (field_accessor_p): Replace check that function body is a
3931 RETURN_EXPR with a call to constexpr_fn_retval. Fix
3932 indentation of "field_type" decl.
3934 2018-03-21 Nathan Sidwell <nathan@acm.org>
3937 * name-lookup.c (do_pushtag): Permit lambdas to be pushed into
3940 2018-03-21 Martin Sebor <msebor@redhat.com>
3943 * call.c (first_non_public_field): New template and function.
3944 (first_non_trivial_field): New function.
3945 (maybe_warn_class_memaccess): Call them.
3947 2018-03-21 David Malcolm <dmalcolm@redhat.com>
3950 * search.c (field_accessor_p): Use class_of_this_parm rather than
3951 type_of_this_parm, to check that "this" is a "const T *", rather
3954 2018-03-21 Nathan Sidwell <nathan@acm.org>
3956 * class.c (finish_struct_anon_r): Refactor, deprecate anything
3957 other than public non-static data members.
3958 * parser.c (cp_parser_init_declarator): Deprecate attributes after
3959 parenthesized initializer.
3962 * name-lookup.c (update_binding): Correct logic for local binding
3965 2018-03-21 Marek Polacek <polacek@redhat.com>
3967 PR c++/71638, ICE with NSDMI and reference.
3968 * constexpr.c (cxx_eval_bare_aggregate): Update constructor's flags
3969 even when we replace an element.
3971 2018-03-20 Marek Polacek <polacek@redhat.com>
3973 PR c++/84978, ICE with NRVO.
3974 * constexpr.c (cxx_eval_constant_expression): Handle the case when
3975 a RESULT_DECL isn't in the hash map.
3977 2018-03-20 Jason Merrill <jason@redhat.com>
3979 PR c++/84978, ICE with NRVO.
3980 * cvt.c (cp_get_fndecl_from_callee): Add fold parameter.
3981 (cp_get_callee_fndecl_nofold): New.
3982 * cp-gimplify.c (cp_genericize_r): Use it instead.
3983 * call.c (check_self_delegation): Likewise.
3985 2018-03-20 Nathan Sidwell <nathan@acm.org>
3988 * name-lookup.c (pushdecl_class_level): Push anon-struct's
3989 member_vec, if there is one.
3992 * cp-tree.h (lookup_list_keep): Declare.
3993 * tree.c (lookup_list_keep): New, broken out of ...
3994 (build_min): ... here. Call it.
3995 * decl.c (cp_finish_decl): Call lookup_list_keep.
3997 2018-03-19 Jason Merrill <jason@redhat.com>
3999 PR c++/84937 - ICE with class deduction and auto.
4000 * pt.c (rewrite_template_parm): Fix auto handling.
4002 2018-03-19 Marek Polacek <polacek@redhat.com>
4005 * pt.c (enclosing_instantiation_of): Check if fn is null.
4008 * constexpr.c (cxx_eval_bare_aggregate): Update constructor's flags
4009 as we evaluate the elements.
4010 (cxx_eval_constant_expression): Verify constructor's flags
4013 2018-03-19 Jason Merrill <jason@redhat.com>
4015 PR c++/71834 - template-id with too few arguments.
4016 * pt.c (coerce_template_parms): Check fixed_parameter_pack_p.
4018 2018-03-19 Nathan Sidwell <nathan@acm.org>
4021 * lambda.c (maybe_add_lambda_conv_op): Force C++ linkage.
4022 * pt.c (build_template_decl): Propagate language linkage.
4025 * name-lookup.c (set_local_extern_decl_linkage): Defend against
4028 2018-03-16 Jakub Jelinek <jakub@redhat.com>
4031 * parser.c (cp_parser_lambda_introducer): Remove trailing space from
4033 * method.c (synthesize_method): Likewise.
4034 * pt.c (convert_nontype_argument): Likewise.
4036 2018-03-16 Jason Merrill <jason@redhat.com>
4038 PR c++/84720 - ICE with rvalue ref non-type argument.
4039 * pt.c (invalid_nontype_parm_type_p): Prohibit rvalue reference.
4040 (convert_nontype_argument): Revert earlier change.
4042 PR c++/80227 - SFINAE and negative array size.
4043 * decl.c (compute_array_index_type): Use
4044 build_converted_constant_expr and valid_constant_size_p.
4046 PR c++/84906 - silent wrong code with ambiguous conversion.
4047 * call.c (build_user_type_conversion_1): Set need_temporary_p on
4048 ambiguous conversion.
4049 (convert_like_real): Check it.
4051 PR c++/83937 - wrong C++17 handling of init-list ctor argument.
4052 * call.c (build_special_member_call): Don't convert an init-list
4053 argument directly to the class type.
4055 2018-03-16 Jakub Jelinek <jakub@redhat.com>
4059 * cp-tree.h (CONSTRUCTOR_PLACEHOLDER_BOUNDARY): Define.
4060 (find_placeholder): Declare.
4061 * tree.c (struct replace_placeholders_t): Add exp member.
4062 (replace_placeholders_r): Don't walk into ctors with
4063 CONSTRUCTOR_PLACEHOLDER_BOUNDARY flag set, unless they are equal to
4064 d->exp. Replace PLACEHOLDER_EXPR with unshare_expr (x) rather than x.
4065 (replace_placeholders): Initialize data.exp.
4066 (find_placeholders_r, find_placeholders): New functions.
4067 * typeck2.c (process_init_constructor_record,
4068 process_init_constructor_union): Set CONSTRUCTOR_PLACEHOLDER_BOUNDARY
4069 if adding NSDMI on which find_placeholder returns true.
4070 * call.c (build_over_call): Don't call replace_placeholders here.
4071 * cp-gimplify.c (cp_genericize_r): Set TARGET_EXPR_NO_ELIDE on
4072 TARGET_EXPRs with CONSTRUCTOR_PLACEHOLDER_BOUNDARY set on
4073 TARGET_EXPR_INITIAL.
4074 (cp_fold): Copy over CONSTRUCTOR_PLACEHOLDER_BOUNDARY bit to new
4077 2018-03-16 Jason Merrill <jason@redhat.com>
4079 PR c++/83911 - ICE with multiversioned constructor.
4080 * cp-gimplify.c (cp_genericize_r): Replace versioned function with
4082 * call.c (build_over_call): Not here.
4084 2018-03-16 Jakub Jelinek <jakub@redhat.com>
4087 * decl.c (reshape_init_class): Don't assert d->cur->index == field
4088 if d->cur->index is a FIELD_DECL, instead set field to d->cur->index.
4090 2018-03-15 Jakub Jelinek <jakub@redhat.com>
4093 * cp-tree.h (cp_warn_deprecated_use): Declare.
4094 * tree.c (cp_warn_deprecated_use): New function.
4095 * typeck2.c (build_functional_cast): Use it.
4096 * decl.c (grokparms): Likewise.
4097 (grokdeclarator): Likewise. Temporarily push nested class scope
4098 around grokparms call for out of class member definitions.
4100 2018-03-14 Jason Merrill <jason@redhat.com>
4102 PR c++/84820 - no error for invalid qualified-id.
4103 * parser.c (cp_parser_make_indirect_declarator): Don't wrap
4104 cp_error_declarator.
4106 PR c++/84801 - ICE with unexpanded pack in lambda.
4107 * pt.c (check_for_bare_parameter_packs): Don't return early for a
4108 lambda in non-template context.
4110 PR c++/81236 - auto variable and auto function
4111 * pt.c (tsubst_baselink): Update the type of the BASELINK after
4114 2018-03-14 Jason Merrill <jason@redhat.com>
4116 PR c++/83916 - ICE with template template parameters.
4117 * pt.c (convert_template_argument): Don't substitute into type of
4118 non-type parameter if we don't have enough arg levels.
4121 2018-03-14 Marek Polacek <polacek@redhat.com>
4124 * semantics.c (finish_static_assert): Check
4125 instantiation_dependent_expression_p instead of
4126 {type,value}_dependent_expression_p.
4128 2018-03-13 Paolo Carlini <paolo.carlini@oracle.com>
4129 Jason Merrill <jason@redhat.com>
4131 PR c++/82336 - link error with list-init default argument.
4132 * decl.c (check_default_argument): Unshare an initializer list.
4134 2018-03-13 Jakub Jelinek <jakub@redhat.com>
4137 * decl.c (duplicate_decls): For redefinition of built-in, use error
4138 and return error_mark_node. For redeclaration, return error_mark_node
4139 rather than olddecl if !flag_permissive.
4141 2018-03-13 Jason Merrill <jason@redhat.com>
4143 PR c++/82565 - ICE with concepts and generic lambda.
4144 * pt.c (instantiate_decl): Clear fn_context for lambdas.
4146 2018-03-13 Jason Merrill <jason@redhat.com>
4148 PR c++/84720 - ICE with rvalue ref non-type argument.
4149 * pt.c (convert_nontype_argument): Handle rvalue references.
4151 PR c++/84839 - ICE with decltype of parameter pack.
4152 * pt.c (tsubst_pack_expansion): Set cp_unevaluated_operand while
4153 instantiating dummy parms.
4155 * parser.c (cp_parser_simple_type_specifier): Pedwarn about auto
4156 parameter even without -Wpedantic.
4158 PR c++/84798 - ICE with auto in abstract function declarator.
4159 * parser.c (cp_parser_parameter_declaration_clause): Check
4160 parser->default_arg_ok_p.
4162 2018-03-13 Jakub Jelinek <jakub@redhat.com>
4165 * constexpr.c (find_array_ctor_elt): Don't use elt reference after
4166 first potential CONSTRUCTOR_ELTS reallocation. Convert dindex to
4167 sizetype. Formatting fixes.
4169 2018-03-12 Jason Merrill <jason@redhat.com>
4171 PR c++/84355 - ICE with deduction for member class template.
4172 * pt.c (tsubst) [TEMPLATE_TYPE_PARM]: Always substitute into
4173 CLASS_PLACEHOLDER_TEMPLATE.
4175 PR c++/84802 - ICE capturing uninstantiated class.
4176 * lambda.c (build_capture_proxy): Call complete_type.
4178 2018-03-09 Jason Merrill <jason@redhat.com>
4180 PR c++/84770 - ICE with typedef and parameter pack.
4181 * pt.c (verify_unstripped_args_1): Split out from
4182 verify_unstripped_args.
4184 PR c++/84785 - ICE with alias template and default targs.
4185 * pt.c (type_unification_real): Set processing_template_decl if
4188 PR c++/84752 - ICE with capture of constexpr array.
4189 * call.c (standard_conversion): Set rvaluedness_matches_p on the
4190 identity conversion under ck_lvalue.
4192 2018-03-09 Jason Merrill <jason@redhat.com>
4193 Paolo Carlini <paolo.carlini@oracle.com>
4197 * pt.c (any_erroneous_template_args_p): New.
4198 * cp-tree.h (any_erroneous_template_args_p): Declare it.
4199 * parser.c (cp_parser_class_specifier_1): Use it.
4201 2018-03-09 Jason Merrill <jason@redhat.com>
4203 PR c++/84726 - unnecessary capture of constant vars.
4204 * cp-tree.h (LAMBDA_CAPTURE_EXPLICIT_P)
4205 (LAMBDA_EXPR_CAPTURE_OPTIMIZED): New.
4206 * expr.c (mark_use): Set LAMBDA_EXPR_CAPTURE_OPTIMIZED.
4207 * lambda.c (is_constant_capture_proxy)
4208 (current_lambda_expr, var_to_maybe_prune, mark_const_cap_r)
4209 (prune_lambda_captures): New.
4210 (finish_lambda_function): Call prune_lambda_captures.
4212 2018-03-09 Jason Merrill <jason@redhat.com>
4213 Jakub Jelinek <jakub@redhat.com>
4216 * call.c (convert_arg_to_ellipsis): Instead of cp_build_addr_expr
4217 build ADDR_EXPR with REFERENCE_TYPE.
4218 (build_over_call): For purposes of check_function_arguments, if
4219 argarray[j] is ADDR_EXPR with REFERENCE_TYPE created above, use
4220 its operand rather than the argument itself.
4222 2018-03-09 Jakub Jelinek <jakub@redhat.com>
4225 * decl.c (duplicate_decls): Don't override __* prefixed builtins
4226 except for __[^b]*_chk, instead issue permerror and for -fpermissive
4227 also a note and return olddecl.
4229 2018-03-09 Nathan Sidwell <nathan@acm.org>
4232 * name-lookup.c (do_pushdecl_with_scope): Only clear
4233 current_function_decl when pushing a non-class (i.e. namespace)
4236 2018-03-08 Jason Merrill <jason@redhat.com>
4237 Jakub Jelinek <jakub@redhat.com>
4240 * call.c (build_over_call): In templates set TREE_USED (first_fn) when
4241 not calling mark_used for the benefit of -Wunused-function warning.
4243 2018-03-06 Jason Merrill <jason@redhat.com>
4245 * lambda.c (is_capture_proxy_with_ref): Remove.
4246 * constexpr.c, expr.c, cp-tree.h, semantics.c: Adjust.
4248 2018-03-06 Marek Polacek <polacek@redhat.com>
4251 * constexpr.c (cxx_bind_parameters_in_call): Unshare evaluated
4254 2018-03-06 Alexandre Oliva <aoliva@redhat.com>
4257 * tree.c (lvalue_kind): Use presence/absence of REFERENCE_TYPE
4258 only while processing template decls.
4259 * typeck.c (build_x_conditional_expr): Move wrapping of
4260 reference type around type...
4261 * call.c (build_conditional_expr_1): ... here. Rename
4262 is_lvalue to is_glvalue.
4263 * parser.c (cp_parser_fold_expression): Catch REFERENCE_REF_P
4264 INDIRECT_REF of COND_EXPR too.
4267 * init.c (build_zero_init_1): Zero-initialize references.
4270 * semantics.c (finish_stmt_expr_expr): Reject unresolved
4271 overloads used as stmt expr values.
4273 2018-03-05 Jason Merrill <jason@redhat.com>
4275 PR c++/84708 - ICE with lambda in local class NSDMI.
4276 * lambda.c (lambda_expr_this_capture): Handle local class NSDMI
4279 2018-03-05 Jakub Jelinek <jakub@redhat.com>
4282 * constexpr.c (constexpr_call_hasher::equal): Return false if
4283 lhs->hash != rhs->hash. Change return 1 to return true and
4284 return 0 to return false.
4286 2018-03-05 Nathan Sidwell <nathan@acm.org>
4289 * pt.c (process_template_arg): Mark lookup_keep on a default arg.
4291 2018-03-05 Marek Polacek <polacek@redhat.com>
4294 * decl.c (duplicate_decls): Check DECL_NAME before accessing
4297 2018-03-05 Nathan Sidwell <nathan@acm.org>
4300 * friend.c (do_friend): Restore check for identifier_p inside
4303 2018-03-05 Paolo Carlini <paolo.carlini@oracle.com>
4306 * parser.c (cp_parser_lambda_introducer): Reject any capture not
4307 involving a VAR_DECL or a PARM_DECL.
4309 2018-03-05 Pádraig Brady <P@draigBrady.com>
4310 Jason Merrill <jason@redhat.com>
4311 Nathan Sidwell <nathan@acm.org>
4314 * decl2.c (get_tls_init_fn): Check TYPE_HAS_TRIVIAL_DFLT too.
4316 2018-03-03 Jason Merrill <jason@redhat.com>
4318 PR c++/84686 - missing volatile loads.
4319 * cvt.c (convert_to_void): Call maybe_undo_parenthesized_ref.
4321 2018-03-03 Paolo Carlini <paolo.carlini@oracle.com>
4324 * optimize.c (maybe_thunk_body): Bail out immediately if either
4325 fns[0] or fns[1] is null.
4327 2018-03-02 Marek Polacek <polacek@redhat.com>
4330 * constexpr.c (get_array_or_vector_nelts): New.
4331 (cxx_eval_array_reference): Use it.
4332 (cxx_eval_vec_init_1): Likewise.
4333 (cxx_eval_store_expression): Likewise.
4335 2018-03-02 Jason Merrill <jason@redhat.com>
4337 * semantics.c (force_paren_expr): Remove redundant test.
4339 2018-03-02 Marek Polacek <polacek@redhat.com>
4342 * decl.c (cp_complete_array_type): Check error_mark_node.
4345 * typeck.c (cp_perform_integral_promotions): Check the result of
4348 2018-03-02 Jakub Jelinek <jakub@redhat.com>
4351 * pt.c (tsubst_copy_and_build) <case TEMPLATE_ID_EXPR>: Use
4352 RETURN instead of return.
4353 <case POINTER_PLUS_EXPR>: Likewise.
4354 <case CONVERT_EXPR>: If op0 is error_mark_node, just return
4355 it instead of wrapping it into CONVERT_EXPR.
4357 2018-03-02 Jason Merrill <jason@redhat.com>
4360 * pt.c (type_dependent_expression_p): Check DECL_LANG_SPECIFIC.
4362 2018-03-02 Marek Polacek <polacek@redhat.com>
4365 * cp-gimplify.c (cp_fully_fold): Unwrap TARGET_EXPR or a CONSTRUCTOR
4366 wrapped in VIEW_CONVERT_EXPR.
4368 2018-03-01 Martin Sebor <msebor@redhat.com>
4371 * decl.c (check_redeclaration_no_default_args): Merge attributes
4372 specified on redeclarations of the same function template.
4375 2018-03-01 Marek Polacek <polacek@redhat.com>
4376 Jason Merrill <jason@redhat.com>
4379 * semantics.c (force_paren_expr): Create a PAREN_EXPR when in
4381 (maybe_undo_parenthesized_ref): Unwrap PAREN_EXPR.
4382 * typeck2.c (store_init_value): Call fold_non_dependent_expr instead
4383 of instantiate_non_dependent_expr.
4384 * tree.c (lvalue_kind): Handle PAREN_EXPR like NON_DEPENDENT_EXPR.
4386 2018-03-01 Nathan Sidwell <nathan@acm.org>
4389 * name-lookup.c (member_vec_dedup): Remove manually peeled
4390 iteration. Ignore dependent ctor inheritance.
4392 2018-03-01 Jason Merrill <jason@redhat.com>
4394 PR c++/71569 - decltype of template.
4395 * parser.c (cp_parser_decltype_expr): Handle missing template args.
4397 2018-03-01 Marek Polacek <polacek@redhat.com>
4400 * constexpr.c (require_rvalue_constant_expression): New function.
4401 * cp-tree.h: Declare it.
4402 * semantics.c (finish_static_assert): Use it instead of
4403 require_potential_rvalue_constant_expression.
4405 2018-03-01 Jason Merrill <jason@redhat.com>
4406 Alexandre Oliva <aoliva@redhat.com>
4408 PR c++/71569 - ICE with redundant args on member variable template.
4409 * decl.c (start_decl): Handle partial specialization of member
4411 * pt.c (determine_specialization): Allow partial specialization
4412 of member variable template without specializing enclosing class.
4413 (process_partial_specialization): Improve error message.
4415 2018-02-28 Jason Merrill <jason@redhat.com>
4417 PR c++/71784 - ICE with ref-qualifier and explicit specialization.
4418 * pt.c (determine_specialization): Check ref-qualifier.
4420 2018-02-28 Jakub Jelinek <jakub@redhat.com>
4423 * parser.c (cp_parser_attributes_opt): Formatting fix.
4424 (cp_parser_skip_balanced_tokens, cp_parser_skip_gnu_attributes_opt,
4425 cp_parser_skip_std_attribute_spec_seq, cp_parser_skip_attributes_opt):
4427 (cp_parser_member_declaration): Use cp_parser_skip_attributes_opt
4428 instead of tentative parse to peek over optional attribute tokens
4429 to check for CPP_COLON after them.
4433 * pt.c (INCLUDE_STRING): Remove define.
4434 (warn_spec_missing_attributes): Use pretty_printer instead of
4435 std::string. Fix up inform call so that the list of attributes
4438 2018-02-28 Martin Sebor <msebor@redhat.com>
4441 * decl.c (duplicate_decls): Fully merge attributes const, pure,
4444 2018-02-28 Nathan Sidwell <nathan@acm.org>
4447 * name-lookup.h (search_anon_aggr): Add defaulted WANT_TYPE arg.
4448 * name-lookup.c (fields_linear_search): Look in an anon-aggr
4449 regardless of want_type.
4450 (search_anon_aggr): Just use get_class_binding_direct.
4452 2018-02-28 Jakub Jelinek <jakub@redhat.com>
4454 * decl.c (cp_finish_decomp): Don't adjust eltscnt when calling
4457 2018-02-27 Martin Sebor <msebor@redhat.com>
4459 * pt.c: Avoid including <string> directly.
4461 2018-02-27 Martin Sebor <msebor@redhat.com>
4465 * cp-tree.h (warn_spec_missing_attributes): New function.
4466 ((check_explicit_specialization): Add an argument. Call the above
4468 * decl.c (duplicate_decls): Avoid applying primary function template's
4469 attributes to its explicit specializations.
4470 cp/pt.c (warn_spec_missing_attributes): Define.
4472 2018-02-27 HÃ¥kon Sandsmark <hsandsmark@gmail.com>
4474 PR c++/71546 - lambda init-capture with qualified-id.
4475 * parser.c (cp_parser_lambda_introducer): Clear scope after
4476 each lambda capture.
4478 2018-02-27 Nathan Sidwell <nathan@acm.org>
4481 * name-lookup.h (get_member_slot): Rename ...
4482 (find_member_slot): ... here.
4483 (add_member_slot): New.
4484 * name-lookup.c (member_vec_linear_search): No need to check for
4486 (get_member_slot): Rename ...
4487 (find_member_slot): ... here. Don't add slot for incomplete class.
4488 (add_member_slot): New.
4489 * class.c (add_method): Adjust get_member_slot rename. Bail out
4490 if push_class_level_binding fails. Create slot and grok
4491 properties once we're committed to insertion.
4493 2018-02-27 Jason Merrill <jason@redhat.com>
4495 PR c++/84489 - dependent default template argument
4496 * pt.c (type_unification_real): Handle early substitution failure.
4498 2018-02-26 Jason Merrill <jason@redhat.com>
4500 PR c++/84560 - ICE capturing multi-dimensional VLA.
4501 * tree.c (array_of_runtime_bound_p): False if the element is
4504 PR c++/84441 - ICE with base initialized from ?:
4505 * call.c (unsafe_copy_elision_p): Handle COND_EXPR.
4507 PR c++/84520 - ICE with generic lambda in NSDMI.
4508 * lambda.c (lambda_expr_this_capture): Don't look for fake NSDMI
4509 'this' in a generic lambda instantiation.
4511 PR c++/84559 - ICE with constexpr VLA.
4512 * constexpr.c (ensure_literal_type_for_constexpr_object): Check
4513 for constexpr variable with VLA type.
4515 2018-02-26 Jakub Jelinek <jakub@redhat.com>
4518 * constexpr.c (cxx_eval_vec_init_1): For reuse, treat NULL eltinit like
4519 a valid constant initializer. Formatting fixes.
4521 2018-02-26 Paolo Carlini <paolo.carlini@oracle.com>
4524 * pt.c (tsubst_attributes): Handle correctly tsubst_attribute
4525 returning NULL_TREE.
4526 (apply_late_template_attributes): Likewise.
4528 2018-02-26 Jakub Jelinek <jakub@redhat.com>
4531 * parser.c (cp_parser_omp_var_list_no_open): Only call
4532 cp_parser_lookup_name_simple on names satisfying identifier_p.
4533 (cp_parser_oacc_routine): Likewise.
4535 2018-02-26 Jason Merrill <jason@redhat.com>
4537 PR c++/84551 - ICE with concepts and -g.
4538 * parser.c (add_debug_begin_stmt): Do nothing in a concept.
4540 2018-02-26 Marek Polacek <polacek@redhat.com>
4543 * tree.c (replace_placeholders_r): Only check TREE_CONSTANT on
4546 2018-02-26 Jason Merrill <jason@redhat.com>
4548 PR c++/84447 - ICE with deleted inherited ctor with default arg.
4549 * call.c (build_over_call): Handle deleted functions in one place.
4551 2018-02-26 Paolo Carlini <paolo.carlini@oracle.com>
4554 * decl.c (redeclaration_error_message): Don't try to use
4555 DECL_DECLARED_CONSTEXPR_P on CONST_DECLs.
4557 2018-02-26 Paolo Carlini <paolo.carlini@oracle.com>
4559 * lambda.c (build_capture_proxy): Define static.
4560 * cp-tree.h (build_capture_proxy): Remove.
4562 2018-02-26 Marek Polacek <polacek@redhat.com>
4565 * name-lookup.c (suggest_alternative_in_explicit_scope): Return false
4566 if name is error node.
4568 2018-02-25 Jason Merrill <jason@redhat.com>
4570 PR c++/84015 - ICE with class deduction and auto template parm.
4571 * pt.c (rewrite_template_parm): Use tf_partial in first tsubst.
4573 2018-02-24 Marek Polacek <polacek@redhat.com>
4576 * constexpr.c (maybe_constant_init_1): New function.
4577 (maybe_constant_init): Make it a wrapper around maybe_constant_init_1.
4578 (cxx_constant_init): New function.
4579 * cp-tree.h (cxx_constant_init): Declare.
4580 * typeck2.c (store_init_value): Call cxx_constant_init instead of
4581 cxx_constant_value. Move the maybe_constant_init call under an 'else'.
4583 2018-02-22 Jason Merrill <jason@redhat.com>
4585 PR c++/70468 - ICE with constructor delegation via typedef.
4586 * pt.c (tsubst_initializer_list): Check for other mem-initializers
4587 with constructor delegation.
4589 2018-02-22 Jason Merrill <jason@redhat.com>
4591 PR c++/84424 - ICE with constexpr and __builtin_shuffle.
4592 * constexpr.c (reduced_constant_expression_p): Handle CONSTRUCTOR of
4595 2018-02-22 Marek Polacek <polacek@redhat.com>
4598 * parser.c (cp_parser_braced_list): Use require_open instead of
4601 2018-02-21 Jason Merrill <jason@redhat.com>
4603 PR c++/84454 - ICE with pack expansion in signature.
4604 * error.c (find_typenames_r): Also stop on EXPR_PACK_EXPANSION.
4606 2018-02-20 Siddhesh Poyarekar <siddhesh@sourceware.org>
4608 * cp-objcp-common.c (cxx_block_may_fallthru): Add case for
4611 2018-02-20 Paolo Carlini <paolo.carlini@oracle.com>
4614 * parser.c (cp_parser_init_declarator): Don't call start_lambda_scope
4617 2018-02-20 Jakub Jelinek <jakub@redhat.com>
4620 * class.c (fixed_type_or_null) <case CALL_EXPR>: Only test
4621 TREE_HAS_CONSTRUCTOR if instance is not an internal function call.
4624 * tree.c (bot_manip): If build_cplus_new or break_out_target_exprs
4625 returns error_mark_node, return it immediately.
4626 (break_out_target_exprs): If cp_walk_tree with bot_manip returns
4627 error_mark_node, return error_mark_node.
4630 * pt.c (tsubst_lambda_expr): If not nested, increment temporarily
4631 function_depth to avoid GC during finish_lambda_function.
4633 2018-02-19 Jason Merrill <jason@redhat.com>
4635 PR c++/84429 - ICE capturing VLA.
4636 * lambda.c (build_capture_proxy): Handle reference refs.
4638 2018-02-19 Jakub Jelinek <jakub@redhat.com>
4641 * parser.c (cp_parser_binary_expression): For no_toplevel_fold_p, if
4642 either operand is error_mark_node, set current.lhs to that instead of
4643 creating a binary op with error_mark_node operands.
4646 * constexpr.c (potential_constant_expression_1): Handle OMP_SIMD.
4648 2018-02-19 Paolo Carlini <paolo.carlini@oracle.com>
4651 * decl.c (grokdeclarator): Early return error_mark_node upon
4652 ill-formed friend declaration.
4654 2018-02-16 Marek Polacek <polacek@redhat.com>
4655 Jakub Jelinek <jakub@redhat.com>
4658 * constexpr.c (cxx_eval_constant_expression) <case RETURN_EXPR>: Don't
4659 set *jump_target to anything if jump_target is NULL.
4661 2018-02-16 Jason Merrill <jason@redhat.com>
4663 PR c++/84151 - unnecessary volatile load with static member.
4664 * call.c (build_new_method_call_1): Avoid loading from a volatile
4665 lvalue used as the object argument for a static member function.
4667 PR c++/81853 - using-directive and constexpr.
4668 * constexpr.c (cxx_eval_constant_expression): Handle USING_STMT.
4670 PR c++/84420 - ICE with structured binding in lambda.
4671 * lambda.c (is_capture_proxy): Check DECL_DECOMPOSITION_P.
4673 PR c++/83835 - C++17 error with constructor ctors.
4674 * call.c (build_special_member_call): Set TARGET_EXPR_DIRECT_INIT_P.
4676 PR c++/82664 - ICE with reference to function template parm.
4677 * pt.c (convert_nontype_argument_function): Avoid obfuscationg
4680 PR c++/82764 - C++17 ICE with empty base
4681 * class.c (build_base_field_1): Set DECL_SIZE to zero for empty base.
4683 2018-02-16 Jason Merrill <jason@redhat.com>
4685 PR c++/84421 - type-dependent if constexpr
4686 * semantics.c (finish_if_stmt_cond): Check type_dependent_expression_p.
4688 2018-02-16 Nathan Sidwell <nathan@acm.org>
4690 Deprecate -ffriend-injection.
4691 * decl.c (cxx_init_decl_processing): Emit warning on option.
4692 * name-lookup.c (do_pushdecl): Emit warning if we push a visible
4695 2018-02-16 Paolo Carlini <paolo.carlini@oracle.com>
4698 * decl.c (check_special_function_return_type): Reject template
4699 template parameter in deduction guide.
4701 2018-02-16 Nathan Sidwell <nathan@acm.org>
4704 * name-lookup.c (do_pushdecl): Bail out on bad local friend injection.
4706 2018-02-15 Jason Merrill <jason@redhat.com>
4708 PR c++/83227 - C++17 ICE with init-list derived-to-base conversion.
4709 * call.c (convert_like_real): Don't use the copy-list-initialization
4710 shortcut for ck_base.
4712 PR c++/84045 - ICE with typedef and noexcept.
4713 * except.c (build_noexcept_spec): Use strip_typedefs_expr.
4715 PR c++/84376 - ICE with omitted template arguments.
4716 * pt.c (dguide_name_p): Check for IDENTIFIER_NODE.
4718 PR c++/84368 - wrong error with local variable in variadic lambda.
4719 * pt.c (tsubst_pack_expansion): Fix handling of non-packs in
4720 local_specializations.
4722 2018-02-15 Paolo Carlini <paolo.carlini@oracle.com>
4725 * constraint.cc (tsubst_constraint_info): Handle an error_mark_node
4728 2018-02-14 Paolo Carlini <paolo.carlini@oracle.com>
4731 * pt.c (do_auto_deduction): Don't check the TREE_TYPE of a null
4734 2018-02-14 Nathan Sidwell <nathan@acm.org>
4736 * decl2.c (mark_vtable_entries): Set input_location to decl's.
4737 (c_parse_final_cleanups): Restore input_location after emitting
4740 2018-02-14 Paolo Carlini <paolo.carlini@oracle.com>
4742 * cp-tree.h (do_auto_deduction (tree, tree, tree)): Remove.
4743 (do_auto_deduction (tree, tree, tree, tsubst_flags_t,
4744 auto_deduction_context, tree, int): Add defaults.
4745 * pt.c (do_auto_deduction (tree, tree, tree)): Remove definition.
4746 (tsubst_omp_for_iterator): Adjust do_auto_deduction call, forward
4747 tsubst_flags_t argument.
4748 * init.c (build_new): Likewise.
4750 2018-02-13 Jakub Jelinek <jakub@redhat.com>
4753 * typeck.c (check_return_expr): Don't emit -Weffc++ warning
4754 about return other than *this in assignment operators if
4755 retval is type dependent expression.
4757 2018-02-13 Paolo Carlini <paolo.carlini@oracle.com>
4760 * call.c (build_conditional_expr_1): Use cp_save_expr instead of
4761 save_expr for the G++ extension.
4763 2018-02-13 Jason Merrill <jason@redhat.com>
4765 PR c++/84080 - ICE with return type deduction and specialization.
4766 * pt.c (determine_specialization): Check uses_template_parms.
4768 Fix more variadic capture issues.
4769 * pt.c (find_parameter_packs_r): Also look at explicit captures.
4770 (check_for_bare_parameter_packs): Check current_class_type for
4772 (extract_locals_r): Handle seeing a full instantiation of a pack.
4773 (tsubst_pack_expansion): Likewise. Force lambda capture.
4774 * parser.c (cp_parser_lambda_introducer): Don't
4775 check_for_bare_parameter_packs.
4777 PR c++/84338 - wrong variadic sizeof.
4778 * pt.c (argument_pack_select_arg): Like the macro, but look through
4780 (tsubst, tsubst_copy, dependent_template_arg_p): Use it.
4781 (extract_fnparm_pack): Do make_pack_expansion.
4782 (extract_locals_r): Do strip a pack expansion.
4783 * cp-tree.h (ARGUMENT_PACK_SELECT_ARG): Remove.
4785 2018-02-12 Jakub Jelinek <jakub@redhat.com>
4788 * parser.c (cp_parser_binary_expression): Use build_min instead of
4789 build2_loc to build the no_toplevel_fold_p toplevel binary expression.
4791 2018-02-12 Nathan Sidwell <nathan@acm.org>
4794 * parser.c (cp_parser_decltype): Push and pop
4795 deferring_access_checks. Reorganize to avoid goto.
4797 2018-02-12 Richard Biener <rguenther@suse.de>
4800 * constexpr.c (cxx_eval_vec_init_1): Use a RANGE_EXPR to compact
4801 uniform constructors and delay allocating them fully.
4803 2018-02-09 Jason Merrill <jason@redhat.com>
4805 PR c++/84036 - ICE with variadic capture.
4806 Handle variadic capture proxies more like non-variadic.
4807 * lambda.c (build_capture_proxy): Remove workaround.
4808 * pt.c (find_parameter_packs_r): The proxy is a pack.
4809 (instantiate_class_template_1): Remove dead lambda code.
4810 (extract_fnparm_pack): Don't make_pack_expansion.
4811 (extract_locals_r): Don't strip a pack expansion.
4812 (tsubst_pack_expansion): Handle proxy packs. Use
4813 PACK_EXPANSION_EXTRA_ARGS less.
4814 (tsubst_decl) [FIELD_DECL]: Don't register_specialization.
4815 (tsubst_copy) [FIELD_DECL]: Don't retrieve*_specialization.
4816 [VAR_DECL]: Handle ARGUMENT_PACK_SELECT.
4817 (tsubst_expr) [DECL_EXPR]: Handle proxy packs.
4818 (tsubst_copy_and_build) [VAR_DECL]: Handle proxy packs normally.
4820 2018-02-10 Jakub Jelinek <jakub@redhat.com>
4823 * tree.c (cp_free_lang_data): Revert 2018-01-23 change.
4825 2018-02-09 Jason Merrill <jason@redhat.com>
4827 PR c++/81917 - ICE with void_t and partial specialization.
4828 * pt.c (instantiate_class_template_1): Set TYPE_BEING_DEFINED before
4829 calling most_specialized_partial_spec.
4831 2018-02-09 Nathan Sidwell <nathan@acm.org>
4834 * typeck.c (cp_build_indirect_ref_1, build_reinterpret_cast_1):
4835 Pass expr location to strict_aliasing_warning.
4837 2018-02-09 Jason Merrill <jason@redhat.com>
4839 PR c++/84296 - ICE with qualified-id in template.
4841 * pt.c (unknown_base_ref_p): New.
4842 (instantiation_dependent_scope_ref_p): Use it instead of
4843 any_dependent_bases_p.
4845 2018-02-09 Marek Polacek <polacek@redhat.com>
4846 Jakub Jelinek <jakub@redhat.com>
4849 * constexpr.c (cxx_fold_indirect_ref): Sync some changes from
4850 fold_indirect_ref_1, including poly_*int64. Verify first that
4851 tree_fits_poly_int64_p (op01). Formatting fixes.
4853 2018-02-08 Paolo Carlini <paolo.carlini@oracle.com>
4855 * constexpr.c (cxx_eval_component_reference): Use INDIRECT_REF_P.
4856 * lambda.c (build_capture_proxy): Likewise.
4857 * search.c (field_access_p): Likewise.
4858 * semantics.c (omp_clause_decl, omp_privatize_field,
4859 finish_omp_clauses): Likewise.
4861 2018-02-08 Paolo Carlini <paolo.carlini@oracle.com>
4864 * typeck.c (decay_conversion): Use mark_rvalue_use for the special
4865 case of nullptr too.
4867 2018-02-08 Nathan Sidwell <nathan@acm.org>
4869 * class.c (finish_struct): Fix std:initializer_list diagnostic
4872 2018-02-08 Paolo Carlini <paolo.carlini@oracle.com>
4875 * pt.c (tsubst_copy_and_build): Use force_paren_expr for INDIRECT_REF.
4877 2018-02-07 Jakub Jelinek <jakub@redhat.com>
4880 * parser.c (cp_parser_dot_deref_incomplete): New function.
4881 (cp_parser_postfix_dot_deref_expression): Use it.
4883 2018-02-07 David Malcolm <dmalcolm@redhat.com>
4887 * name-lookup.c (suggest_rid_p): New function.
4888 (lookup_name_fuzzy): Replace enum-rid-filtering logic with call to
4891 2018-02-07 Jason Merrill <jason@redhat.com>
4893 PR c++/84182 - ICE with captured lambda
4895 * pt.c (extract_locals_r, extract_local_specs): New.
4896 (tsubst_pack_expansion): Use them.
4898 2018-02-07 Martin Liska <mliska@suse.cz>
4901 * class.c (add_method): Append argument value.
4902 * cp-tree.h (maybe_version_functions): Add new argument.
4903 * decl.c (decls_match): Call it if a declaration does not
4904 have DECL_FUNCTION_VERSIONED.
4905 (maybe_version_functions): record argument is added.
4907 2018-02-05 Marek Polacek <polacek@redhat.com>
4909 * class.c: Remove unused global variables.
4910 (build_primary_vtable): Don't gather statistics.
4911 (print_class_statistics): Remove.
4912 * cp-tree.h (print_class_statistics): Remove.
4913 * tree.c (cxx_print_statistics): Don't call print_class_statistics.
4915 2018-02-02 Paolo Carlini <paolo.carlini@oracle.com>
4917 * class.c (is_really_empty_class): Use DECL_UNNAMED_BIT_FIELD.
4918 * constexpr.c (cx_check_missing_mem_inits): Likewise.
4919 * decl.c (next_initializable_field, find_decomp_class_base,
4920 cp_finish_decomp): Likewise.
4921 * typeck2.c (process_init_constructor_record): Likewise.
4923 2018-02-02 Jason Merrill <jason@redhat.com>
4925 PR c++/84181 - ICE with lambda parm in template argument.
4926 * tree.c (strip_typedefs_expr): Use cp_tree_operand_length.
4928 2018-02-01 Jason Merrill <jason@redhat.com>
4930 PR c++/84160 - ICE with nested variadic capture.
4931 * lambda.c (is_capture_proxy_with_ref): New.
4932 (insert_capture_proxy): Don't set DECL_CAPTURED_VARIABLE from a
4934 * expr.c (mark_use): Use is_capture_proxy_with_ref.
4935 * constexpr.c (potential_constant_expression_1): Likewise.
4936 * semantics.c (process_outer_var_ref): Likewise.
4938 2018-02-01 Marek Polacek <polacek@redhat.com>
4941 * typeck.c (build_address): Relax the assert when
4942 processing_template_decl.
4944 2018-02-01 Jason Merrill <jason@redhat.com>
4946 PR c++/84126 - ICE with variadic generic lambda
4949 * pt.c (tsubst_pack_expansion): Handle function parameter_packs in
4950 PACK_EXPANSION_EXTRA_ARGS.
4952 2018-02-01 Paolo Carlini <paolo.carlini@oracle.com>
4955 * call.c (convert_like_real): If w're initializing from {} explicitly
4956 call abstract_virtuals_error_sfinae.
4958 2018-01-31 Jason Merrill <jason@redhat.com>
4959 Jakub Jelinek <jakub@redhat.com>
4962 * constexpr.c (cxx_eval_outermost_constant_expr): Build NOP_EXPR
4963 around non-constant ADDR_EXPRs rather than clearing TREE_CONSTANT
4966 2018-01-31 Jakub Jelinek <jakub@redhat.com>
4969 * constexpr.c (diag_array_subscript): Emit different diagnostics
4970 if TYPE_DOMAIN (arraytype) is NULL.
4971 (cxx_eval_array_reference, cxx_eval_store_expression): For arrays
4972 with NULL TYPE_DOMAIN use size_zero_node as nelts.
4974 2018-01-31 Paolo Carlini <paolo.carlini@oracle.com>
4977 * semantics.c (finish_qualified_id_expr): When handling an
4978 UNBOUND_CLASS_TEMPLATE only adjust qualifying_class and expr.
4980 2018-01-31 Marek Polacek <polacek@redhat.com>
4983 * cp-gimplify.c (cp_fold): Check if X is an error node before
4984 calling useless_type_conversion_p.
4986 2018-01-30 Jason Merrill <jason@redhat.com>
4988 PR c++/84091 - ICE with local class in lambda in template.
4989 * decl2.c (determine_visibility): Look for outer containing template
4992 PR c++/84098 - ICE with lambda in template NSDMI.
4993 * pt.c (instantiate_class_template_1): Ignore more lambdas.
4995 2018-01-29 Jason Merrill <jason@redhat.com>
4997 PR c++/68810 - wrong location for reinterpret_cast error.
4998 * cvt.c (cp_convert_to_pointer): Always build a CONVERT_EXPR when
5001 2018-01-29 Marek Polacek <polacek@redhat.com>
5004 * constexpr.c (cxx_fold_indirect_ref): Compute ((foo *)&fooarray)[1]
5005 => fooarray[1] in offset_int.
5007 2018-01-29 Jason Merrill <jason@redhat.com>
5009 PR c++/83942 - wrong unused warning with static_cast.
5010 * cvt.c (ocp_convert): Call mark_rvalue_use.
5012 2018-01-26 Jason Merrill <jason@redhat.com>
5014 PR c++/83956 - wrong dtor error with anonymous union
5015 * method.c (walk_field_subobs): Variant members only affect
5017 (maybe_explain_implicit_delete): Pass &deleted_p for diagnostic.
5019 PR c++/84036 - ICE with variadic capture.
5021 * pt.c (tsubst_pack_expansion): When optimizing a simple
5022 substitution, pull a single pack expansion out of its pack.
5024 PR c++/82514 - ICE with local class in generic lambda.
5025 * pt.c (regenerated_lambda_fn_p): Remove.
5026 (enclosing_instantiation_of): Don't use it.
5027 (tsubst_function_decl): Call enclosing_instantiation_of.
5029 * pt.c (lookup_template_class_1): Add sanity check.
5030 * name-lookup.c (do_pushtag): Don't add closures to local_classes.
5032 2018-01-25 Jakub Jelinek <jakub@redhat.com>
5035 * decl.c (find_decomp_class_base): Ignore unnamed bitfields. Ignore
5036 recursive calls that return ret.
5037 (cp_finish_decomp): Ignore unnamed bitfields.
5039 2018-01-23 Jason Merrill <jason@redhat.com>
5041 PR c++/82249 - wrong mismatched pack length error.
5042 * pt.c (extract_fnparm_pack, tsubst_pack_expansion): Handle
5043 unsubstituted function parameter pack.
5045 2018-01-23 Paolo Carlini <paolo.carlini@oracle.com>
5048 * decl.c (check_for_uninitialized_const_var): Not static; add
5049 bool and tsubst_flags_t parameters; adjust to be used both in
5050 constexpr context and not.
5051 * constexpr.c (potential_constant_expression_1): Use the above.
5052 * cp-tree.h (check_for_uninitialized_const_var): Declare.
5054 2018-01-23 Jason Merrill <jason@redhat.com>
5056 PR c++/83947 - ICE with auto declarations.
5057 * pt.c (do_auto_deduction): Don't deduce from an auto decl.
5058 * decl.c (undeduced_auto_decl): Limit to vars and fns.
5060 2018-01-23 David Malcolm <dmalcolm@redhat.com>
5063 * pt.c (tsubst_copy_and_build) <CONSTRUCTOR>: Remove early bailout
5064 for pointer to member function types.
5066 2018-01-23 Jakub Jelinek <jakub@redhat.com>
5069 * tree.c (cp_free_lang_data): Change DECL_VALUE_EXPR of
5070 DECL_OMP_PRIVATIZED_MEMBER vars to error_mark_node.
5072 2018-01-23 Nathan Sidwell <nathan@acm.org>
5075 * pt.c (tsubst_baselink): Remove optype assert.
5076 * ptree.c (cxx_print_xnode): <case BASELINK> Print BASELINK_OPTYPE.
5078 2018-01-23 Jakub Jelinek <jakub@redhat.com>
5081 * decl.c (cp_finish_decomp): Diagnose if reference structure binding
5082 refers to incomplete type.
5084 2018-01-23 Nathan Sidwell <nathan@acm.org>
5086 Deprecate ARM-era for scope handling
5087 * decl.c (poplevel): Flag_new_for_scope is a boolean-like.
5088 (cxx_init_decl_processing): Deprecate flag_new_for_scope being
5090 * name-lookup.c (check_for_out_of_scope_variable): Deprecate and
5092 * semantics.c (begin_for_scope): Flag_new_for_scope is
5094 (finish_for_stmt, begin_range_for_stmt): Likewise.
5096 2018-01-22 Jason Merrill <jason@redhat.com>
5099 * decl2.c (determine_visibility): Fix template_decl handling
5100 instead of blocking it.
5102 PR c++/83720 - ICE with lambda and LTO.
5103 * decl2.c (determine_visibility): Clear template_decl for
5104 function-scope decls. Propagate anonymous linkage from containing
5107 2018-01-22 Marek Polacek <polacek@redhat.com>
5110 * typeck2.c (split_nonconstant_init_1): Return false if we didn't
5113 2018-01-22 Ville Voutilainen <ville.voutilainen@gmail.com>
5116 * decl.c (grokdeclarator): Don't diagnose extra parens
5119 2018-01-19 Jakub Jelinek <jakub@redhat.com>
5122 * call.c (joust): Use TREE_TYPE (source) if source is
5123 a POINTER_TYPE_P rather than if ! DECL_CONSTRUCTOR_P (w->fn).
5126 * typeck.c (convert_for_assignment): Suppress warn_ignored_qualifiers
5127 for direct enum init.
5128 * decl.c (reshape_init): Likewise.
5130 2018-01-19 Marek Polacek <polacek@redhat.com>
5132 * constexpr.c (fold_simple): Simplify.
5134 2018-01-18 Jason Merrill <jason@redhat.com>
5137 * search.c (any_dependent_bases_p): Handle null TREE_BINFO.
5138 * pt.c (instantiation_dependent_scope_ref_p): True if
5139 any_dependent_bases_p.
5141 2018-01-18 Paolo Carlini <paolo.carlini@oracle.com>
5143 * cp-tree.h: Fix comment typo (DECL_NON_TRIVIALLY_INITIALIZED_P
5144 vs DECL_NONTRIVIALLY_INITIALIZED_P).
5146 2018-01-18 Jason Merrill <jason@redhat.com>
5148 PR c++/82461 - constexpr list-initialized member
5149 * constexpr.c (potential_constant_expression_1): Check
5150 TARGET_EXPR_DIRECT_INIT_P.
5152 2018-01-18 Paolo Carlini <paolo.carlini@oracle.com>
5155 * decl.c (xref_basetypes): Early return upon error about derived
5158 2018-01-18 Nathan Sidwell <nathan@acm.org>
5161 * cp-tree.h (mark_use): Declare.
5162 * expr.c (mark_use): Make extern.
5163 * call.c (direct_reference_binding): Set inner conv's
5164 rvaluedness_matches_p, if it is an identity.
5165 (convert_like_real): Mark lvalue or rvalue use for identity as
5166 rvaledness_matches_p demands.
5168 2018-01-18 Jakub Jelinek <jakub@redhat.com>
5171 * parser.c (attr_chainon): New function.
5172 (cp_parser_label_for_labeled_statement, cp_parser_decl_specifier_seq,
5173 cp_parser_namespace_definition, cp_parser_init_declarator,
5174 cp_parser_type_specifier_seq, cp_parser_parameter_declaration,
5175 cp_parser_gnu_attributes_opt): Use it.
5176 (cp_parser_member_declaration, cp_parser_objc_class_ivars,
5177 cp_parser_objc_struct_declaration): Likewise. Don't reset
5178 prefix_attributes if attributes is error_mark_node.
5180 2018-01-17 Paolo Carlini <paolo.carlini@oracle.com>
5183 * decl.c (grokdeclarator): Do not append the error_mark_node
5184 due to an erroneous optional attribute-specifier-seq.
5186 2018-01-17 Jakub Jelinek <jakub@redhat.com>
5189 * cp-gimplify.c (cp_maybe_instrument_return): Handle
5192 2018-01-17 Paolo Carlini <paolo.carlini@oracle.com>
5195 * constexpr.c (ensure_literal_type_for_constexpr_object): Return
5196 error_mark_node when we give an error.
5197 * decl.c (cp_finish_decl): Use the latter.
5199 2018-01-17 Nathan Sidwell <nathan@acm.org>
5202 * init.c (build_raw_new_expr): Scan list for lookups to keep.
5204 2018-01-17 David Malcolm <dmalcolm@redhat.com>
5207 * expr.c (fold_for_warn): Move from c-common.c, reducing to just
5208 the C++ part. If processing a template, call
5209 fold_non_dependent_expr rather than fully folding.
5211 2018-01-17 Jason Merrill <jason@redhat.com>
5213 PR c++/81067 - redundant NULL warning.
5214 * call.c (convert_like_real): Restore null_node handling.
5216 2018-01-17 Jason Merrill <jason@redhat.com>
5218 PR c++/81843 - ICE with variadic member template.
5220 * pt.c (unify_pack_expansion): Don't try to deduce enclosing
5223 2018-01-17 David Malcolm <dmalcolm@redhat.com>
5226 * pt.c (type_dependent_expression_p): Strip any location wrapper
5227 before testing tree codes.
5228 (selftest::test_type_dependent_expression_p): New function.
5229 (selftest::cp_pt_c_tests): Call it.
5231 2018-01-17 Nathan Sidwell <nathan@acm.org>
5234 * pt.c (tsubst_expr) <case RANGE_FOR_STMT>: Rebuild a range_for if
5235 this not a final instantiation.
5237 2018-01-16 Jason Merrill <jason@redhat.com>
5239 PR c++/83714 - ICE checking return in template.
5240 * typeck.c (check_return_expr): Call build_non_dependent_expr.
5242 2018-01-16 Jakub Jelinek <jakub@redhat.com>
5245 * pt.c (tsubst_copy_and_build) <case CALL_EXPR>: If function
5246 is AGGR_INIT_EXPR rather than CALL_EXPR, set AGGR_INIT_FROM_THUNK_P
5247 instead of CALL_FROM_THUNK_P.
5250 * name-lookup.c (member_vec_dedup): Return early if len is 0.
5251 (resort_type_member_vec, set_class_bindings,
5252 insert_late_enum_def_bindings): Use vec qsort method instead of
5253 calling qsort directly.
5255 2018-01-15 Martin Sebor <msebor@redhat.com>
5258 * class.c (find_flexarrays): Make a record of multiple flexible array
5261 2018-01-12 Jason Merrill <jason@redhat.com>
5263 PR c++/83186 - ICE with static_cast of list-initialized temporary.
5264 * typeck.c (build_static_cast): Use build_non_dependent_expr.
5266 2018-01-12 Nathan Sidwell <nathan@acm.org>
5268 * cp-tree.h (mark_rvalue_use): Add parm name.
5269 * expr.c (mark_lvalue_use, mark_lvalue_use_nonread): Move next to
5271 * call.c (convert_like_real): Fix formatting.
5273 2018-01-11 Jason Merrill <jason@redhat.com>
5275 PR c++/82728 - wrong -Wunused-but-set-variable
5278 * call.c (perform_implicit_conversion_flags): Call mark_rvalue_use.
5279 * decl.c (case_conversion): Likewise.
5280 * semantics.c (finish_static_assert): Call
5281 perform_implicit_conversion_flags.
5283 2018-01-11 Nathan Sidwell <nathan@acm.org>
5285 * method.c (enum mangling_flags): Delete long-dead enum.
5287 2018-01-10 Paolo Carlini <paolo.carlini@oracle.com>
5289 * parser.c (cp_parser_std_attribute_spec): When
5290 token_pair::require_open / require_close return false simply
5291 return error_mark_node, avoid duplicate cp_parser_error about
5292 expected '(' / ')', respectively.
5294 2018-01-10 David Malcolm <dmalcolm@redhat.com>
5297 * call.c (null_ptr_cst_p): Strip location wrappers when
5298 converting from '0' to a pointer type in C++11 onwards.
5299 (conversion_null_warnings): Replace comparison with null_node with
5300 call to null_node_p.
5301 (build_over_call): Likewise.
5302 * cp-gimplify.c (cp_fold): Remove the early bailout when
5303 processing_template_decl.
5304 * cp-lang.c (selftest::run_cp_tests): Call
5305 selftest::cp_pt_c_tests and selftest::cp_tree_c_tests.
5306 * cp-tree.h (cp_expr::maybe_add_location_wrapper): New method.
5307 (selftest::run_cp_tests): Move decl to bottom of file.
5308 (null_node_p): New inline function.
5309 (selftest::cp_pt_c_tests): New decl.
5310 (selftest::cp_tree_c_tests): New decl.
5311 * cvt.c (build_expr_type_conversion): Replace comparison with
5312 null_node with call to null_node_p.
5313 * error.c (args_to_string): Likewise.
5314 * except.c (build_throw): Likewise.
5315 * mangle.c (write_expression): Skip location wrapper nodes.
5316 * parser.c (literal_integer_zerop): New function.
5317 (cp_parser_postfix_expression): Call maybe_add_location_wrapper on
5318 the result for RID_TYPEID. Pass true for new "wrap_locations_p"
5319 param of cp_parser_parenthesized_expression_list. When calling
5320 warn_for_memset, replace integer_zerop calls with
5321 literal_integer_zerop, eliminating the double logical negation
5322 cast to bool. Eliminate the special-casing for CONST_DECL in
5323 favor of the fold_for_warn within warn_for_memset.
5324 (cp_parser_parenthesized_expression_list): Add "wrap_locations_p"
5325 param, defaulting to false. Convert "expr" to a cp_expr, and call
5326 maybe_add_location_wrapper on it when wrap_locations_p is true.
5327 (cp_parser_unary_expression): Call maybe_add_location_wrapper on
5328 the result for RID_ALIGNOF and RID_SIZEOF.
5329 (cp_parser_builtin_offsetof): Likewise.
5330 * pt.c: Include "selftest.h".
5331 (tsubst_copy): Handle location wrappers.
5332 (tsubst_copy_and_build): Likewise.
5333 (build_non_dependent_expr): Likewise.
5334 (selftest::test_build_non_dependent_expr): New function.
5335 (selftest::cp_pt_c_tests): New function.
5336 * tree.c: Include "selftest.h".
5337 (lvalue_kind): Handle VIEW_CONVERT_EXPR location wrapper nodes.
5338 (selftest::test_lvalue_kind): New function.
5339 (selftest::cp_tree_c_tests): New function.
5340 * typeck.c (string_conv_p): Strip any location wrapper from "exp".
5341 (cp_build_binary_op): Replace comparison with null_node with call
5343 (build_address): Use location of operand when building address
5346 2018-01-10 Marek Polacek <polacek@redhat.com>
5349 * call.c (build_conditional_expr_1): Check complain before warning.
5350 * pt.c (tsubst_copy_and_build) <case COND_EXPR>: Suppress
5351 -Wduplicated-branches.
5353 2018-01-10 Jakub Jelinek <jakub@redhat.com>
5356 * call.c (maybe_warn_class_memaccess): Add forward declaration.
5357 Change last argument from tree * to const vec<tree, va_gc> *, adjust
5358 args uses and check number of operands too. Don't strip away any
5359 nops. Use maybe_constant_value when looking for INTEGER_CST args.
5360 Deal with src argument not having pointer type. Check
5361 tree_fits_uhwi_p before calling tree_to_uhwi. Remove useless
5363 (build_over_call): Call maybe_warn_class_memaccess here on the
5365 (build_cxx_call): Rather than here on converted arguments.
5367 2018-01-10 Paolo Carlini <paolo.carlini@oracle.com>
5370 * init.c (build_vec_init): Avoid building an INIT_EXPR with
5371 error_mark_node as second argument.
5373 2018-01-09 Jakub Jelinek <jakub@redhat.com>
5376 * constexpr.c (cxx_eval_statement_list): Ignore DEBUG_BEGIN_STMTs
5377 in STATEMENT_LIST. Remove unneeded assert.
5379 2018-01-03 Richard Sandiford <richard.sandiford@linaro.org>
5380 Alan Hayward <alan.hayward@arm.com>
5381 David Sherwood <david.sherwood@arm.com>
5383 * constexpr.c (cxx_eval_array_reference): Handle polynomial
5385 (cxx_fold_indirect_ref): Handle polynomial TYPE_VECTOR_SUBPARTS.
5386 * call.c (build_conditional_expr_1): Likewise.
5387 * decl.c (cp_finish_decomp): Likewise.
5388 * mangle.c (write_type): Likewise.
5389 * typeck.c (structural_comptypes): Likewise.
5390 (cp_build_binary_op): Likewise.
5391 * typeck2.c (process_init_constructor_array): Likewise.
5393 2018-01-03 Jakub Jelinek <jakub@redhat.com>
5396 * typeck.c (build_static_cast_1): For static casts to reference types,
5397 call build_base_path with flag_delete_null_pointer_checks as nonnull
5398 instead of always false. When -fsanitize=null, call
5399 ubsan_maybe_instrument_reference on the NULL reference INTEGER_CST.
5400 * cp-gimplify.c (cp_genericize_r): Don't walk subtrees of UBSAN_NULL
5401 call if the first argument is INTEGER_CST with REFERENCE_TYPE.
5403 2018-01-03 Nathan Sidwell <nathan@acm.org>
5406 * method.c (make_alias_for): Copy DECL_CONTEXT.
5408 2018-01-03 Marek Polacek <polacek@redhat.com>
5411 * decl.c (grokdeclarator): Don't warn about MVP in typename context.
5413 2018-01-03 Jakub Jelinek <jakub@redhat.com>
5415 PR preprocessor/83602
5416 * name-lookup.c (lookup_name_fuzzy): Don't use macro_use_before_def
5420 * cp-gimplify.c (cp_fold) <case NOP_EXPR>: If the operand folds to
5421 error_mark_node, return error_mark_node.
5423 Update copyright years.
5425 2018-01-02 Jakub Jelinek <jakub@redhat.com>
5428 * tree.c (replace_placeholders_r): Pass NULL as last argument to
5429 cp_walk_tree instead of d->pset. If non-TREE_CONSTANT and
5430 non-PLACEHOLDER_EXPR tree has been seen already, set *walk_subtrees
5431 to false and return.
5432 (replace_placeholders): Pass NULL instead of &pset as last argument
5435 2018-01-02 Nathan Sidwell <nathan@acm.org>
5437 * constexpr.c (cxx_bind_parameters_in_call): Remove unneeded local
5440 Copyright (C) 2018 Free Software Foundation, Inc.
5442 Copying and distribution of this file, with or without modification,
5443 are permitted in any medium without royalty provided the copyright
5444 notice and this notice are preserved.