1 2018-12-19 David Malcolm <dmalcolm@redhat.com>
4 * typeck.c (convert_for_assignment): Capture location of rhs
5 before stripping, and if available. Use the location when
6 complaining about bad conversions, labelling it with the
7 rhstype if the location was present.
8 * typeck2.c (digest_init_r): Capture location of init before
11 2018-12-19 David Malcolm <dmalcolm@redhat.com>
14 * call.c (op_error): Convert 1st param from location_t to
15 const op_location_t &. Use binary_op_rich_location for binary
17 (build_conditional_expr_1): Convert 1st param from location_t to
18 const op_location_t &.
19 (build_conditional_expr): Likewise.
20 (build_new_op_1): Likewise.
21 (build_new_op): Likewise.
22 * cp-tree.h (build_conditional_expr): Likewise.
23 (build_new_op): Likewise.
24 (build_x_binary_op): Likewise.
25 (cp_build_binary_op): Likewise.
26 * parser.c (cp_parser_primary_expression): Build a location
27 for id-expression nodes.
28 (cp_parser_binary_expression): Use an op_location_t when
29 calling build_x_binary_op.
30 (cp_parser_operator): Build a location for user-defined literals.
31 * typeck.c (build_x_binary_op): Convert 1st param from location_t
32 to const op_location_t &.
33 (cp_build_binary_op): Likewise. Use binary_op_rich_location.
35 2018-12-19 David Malcolm <dmalcolm@redhat.com>
39 * call.c (build_conditional_expr_1): Strip location wrappers when
40 checking for CONST_DECL.
41 (conversion_null_warnings): Use location of "expr" if available.
42 * class.c (fixed_type_or_null): Handle location wrappers.
43 * constexpr.c (potential_constant_expression_1): Likewise.
44 * cvt.c (ignore_overflows): Strip location wrappers when
45 checking for INTEGER_CST, and re-wrap the result if present.
46 (ocp_convert): Call fold_for_warn before checking for INTEGER_CST.
47 * decl.c (reshape_init_r): Strip any location wrapper.
48 (undeduced_auto_decl): Likewise.
49 * expr.c (mark_discarded_use): Likewise for expr.
50 * init.c (build_aggr_init): Likewise before checking init for
52 (warn_placement_new_too_small): Call fold_for_warn on adj before
53 checking for CONSTANT_CLASS_P, and on nelts. Strip any location
54 wrapper from op0 and on oper before checking for VAR_P.
55 * parser.c (cp_parser_primary_expression): Call
56 maybe_add_location_wrapper on numeric and string literals.
57 (cp_parser_postfix_expression): Strip any location wrapper when
58 checking for DECL_IS_BUILTIN_CONSTANT_P.
59 (cp_parser_unary_expression): Ensure that folding of NEGATE_EXPR
60 around a constant happens in the presence of location wrappers and
61 returns a wrapped result.
62 (cp_parser_has_attribute_expression): Strip any location wrapper
64 (cp_parser_binary_expression): Strip any location wrapper when
65 checking for DECL_P on the lhs.
66 (cp_parser_decltype): Strip any location wrapper from result of
67 cp_parser_decltype_expr.
68 (cp_parser_mem_initializer): Add location wrappers to the
69 parenthesized expression list.
70 (cp_parser_template_parameter_list): Don't create wrapper nodes
71 within a template-parameter-list.
72 (cp_parser_template_argument_list): Don't create wrapper nodes
73 within a template-argument-list.
74 (cp_parser_parameter_declaration): Strip location wrappers from
76 (cp_parser_gnu_attribute_list): Don't create wrapper nodes.
77 (cp_parser_std_attribute_spec_seq): Likewise.
78 (cp_parser_omp_all_clauses): Don't create wrapper nodes within
80 (cp_parser_omp_for_loop): Likewise.
81 (cp_parser_omp_declare_reduction_exprs): Likewise.
82 * pt.c (convert_nontype_argument_function): Strip location
83 wrappers from fn_no_ptr before checking for FUNCTION_DECL.
84 (tsubst_default_argument): Move note about which callsite led to
85 instantiation to after the check_default_argument call.
86 (do_auto_deduction): Likewise from init before checking for
88 * semantics.c (force_paren_expr): Likewise from expr before
90 (finish_parenthesized_expr): Likewise from expr before
91 checking for STRING_CST.
92 (perform_koenig_lookup): Likewise from fn.
93 (finish_call_expr): Likewise.
94 (finish_id_expression): Rename to...
95 (finish_id_expression_1): ...this, calling
96 maybe_add_location_wrapper on the result.
97 (capture_decltype): Use lookup_name_real rather than value_member
98 when looking up decl within the capture-list.
99 * tree.c (cp_stabilize_reference): Strip any location wrapper.
100 (builtin_valid_in_constant_expr_p): Likewise.
101 (strip_typedefs_expr): Strip any location wrapper before checking
102 for decls or constants.
103 (is_overloaded_fn): Likewise.
104 (maybe_get_fns): Likewise.
105 (selftest::test_lvalue_kind): Verify lvalue_p.
106 * typeck.c (cxx_sizeof_expr): Strip any location wrapper.
107 (cxx_alignof_expr): Likewise.
108 (is_bitfield_expr_with_lowered_type): Handle location wrappers.
109 (cp_build_array_ref): Call maybe_constant_value on "idx".
110 (cp_build_binary_op): Strip location wrapper from first_arg before
111 checking for PARM_DECL. Likewise for op1 before checking for
112 INTEGER_CST in two places. Likewise for orig_op0 and orig_op1
113 when checking for STRING_CST.
114 (cp_build_addr_expr_1): Likewise for arg when checking for
116 (cp_build_modify_expr): Likewise for newrhs when checking for
118 (convert_for_assignment): Don't strip location wrappers when
119 stripping NON_LVALUE_EXPR.
120 (maybe_warn_about_returning_address_of_local): Strip location
121 wrapper from whats_returned before checking for DECL_P.
122 (can_do_nrvo_p): Strip location wrapper from retval.
123 (treat_lvalue_as_rvalue_p): Likewise.
124 (check_return_expr): Likewise.
125 * typeck2.c (cxx_incomplete_type_diagnostic): Strip location
126 wrapper from value before checking for VAR_P or PARM_DECL.
127 (digest_init_r): Strip location wrapper from init. When
128 copying "init", also copy the wrapped node.
130 2018-12-19 Jakub Jelinek <jakub@redhat.com>
133 * constexpr.c (cxx_eval_constant_expression) <case CONSTRUCTOR>: Do
134 re-process TREE_CONSTANT CONSTRUCTORs if they aren't reduced constant
137 2018-12-19 Alexandre Oliva <aoliva@redhat.com>
140 * pt.c (convert_template_argument): Canonicalize type after
144 * method.c (do_build_copy_constructor): Guard cvquals init and
145 loop over fields to run for non-inherited ctors only.
146 (synthesize_method): Retain location of inherited ctor.
148 2018-12-17 Jakub Jelinek <jakub@redhat.com>
151 * cp-gimplify.c (cp_fold) <case ADDR_EXPR>: For offsetof-like folding,
152 call maybe_constant_value on val to see if it is INTEGER_CST.
154 2018-12-17 Jonathan Wakely <jwakely@redhat.com>
157 * typeck.c (build_static_cast): Print a note when the destination
158 type or the operand is a pointer/reference to incomplete class type.
160 2018-12-16 Jakub Jelinek <jakub@redhat.com>
163 * except.c (verify_library_fn): New function.
164 (declare_library_fn): Use it. Initialize TM even if the non-TM
165 library function has been user declared.
166 (do_end_catch): Don't set TREE_NOTHROW on error_mark_node.
167 (expand_start_catch_block): Don't call initialize_handler_parm
169 (build_throw): Use verify_library_fn. Initialize TM even if the
170 non-TM library function has been user declared. Don't crash if
171 any library fn is error_mark_node.
173 2018-12-14 Jason Merrill <jason@redhat.com>
175 * pt.c (tsubst_expr) [DECL_EXPR]: Ignore class-scope bindings when
176 looking up a capture proxy.
178 2018-12-15 Paolo Carlini <paolo.carlini@oracle.com>
181 * decl.c (check_tag_decl): A decltype with no declarator
182 doesn't declare anything.
184 2018-12-14 Alexandre Oliva <aoliva@redhat.com>
187 * pt.c (tsubst_exception_specification): Handle
188 DEFERRED_NOEXCEPT with !defer_ok.
190 2018-12-14 Jason Merrill <jason@redhat.com>
193 * parser.c (cp_parser_template_id): Rearrange deferred access
194 checks into the firewall.
196 2018-12-14 Jakub Jelinek <jakub@redhat.com>
200 * init.c (build_vec_init): Change num_initialized_elts type from int
201 to HOST_WIDE_INT. Build a RANGE_EXPR if e needs to be repeated more
204 2018-12-13 Marek Polacek <polacek@redhat.com>
206 PR c++/88216 - ICE with class type in non-type template parameter.
207 * mangle.c (write_expression): Handle TARGET_EXPR and
209 * pt.c (convert_nontype_argument): Don't call
210 get_template_parm_object for value-dependent expressions.
212 2018-12-13 Nathan Sidwell <nathan@acm.org>
215 * class.c (finish_struct): Set DECL_CONTEXT of template assign op.
216 * name-lookup.c (get_class_binding_direct): Don't strip using-decl
218 * parser.c (cp_parser_postfix_expression): Cope with using decl in
220 * semantics.c (finish_id_expr): Likewise.
222 2018-12-12 Paolo Carlini <paolo.carlini@oracle.com>
224 * decl.c (grokdeclarator): Fix location of error message about
225 static data member definition.
227 2018-12-12 Jakub Jelinek <jakub@redhat.com>
230 * cp-tree.h (maybe_constant_value): Add manifestly_const_eval
232 * constexpr.c (struct constexpr_call): Rename pretend_const_required
233 member to manifestly_const_eval.
234 (struct constexpr_ctx): Likewise.
235 (constexpr_call_hasher::equal): Adjust users.
236 (cxx_eval_builtin_function_call): Likewise. Formatting fix.
237 (cxx_eval_call_expression): Adjust users.
238 (cxx_eval_outermost_constant_expr, maybe_constant_init_1,
239 maybe_constant_init): Rename pretend_const_required argument to
240 manifestly_const_eval, adjust function comments.
241 (maybe_constant_value): Add manifestly_const_eval argument. If true,
242 don't cache and call cxx_eval_outermost_constant_expr with true as
243 manifestly_const_eval.
244 * decl.c (compute_array_index_type_loc): Call maybe_constant_value
245 with true as manifestly_const_eval.
248 * constexpr.c (struct constexpr_call): Add pretend_const_required
250 (constexpr_call_hasher::equal): Return false if pretend_const_required
252 (cxx_eval_call_expression): Adjust new_call initialization. Hash in
253 ctx->pretend_const_required.
255 2018-12-11 Jakub Jelinek <jakub@redhat.com>
258 * class.c (build_vtbl_initializer): For TARGET_VTABLE_USES_DESCRIPTORS
259 bump index for each added word.
260 * constexpr.c (find_array_ctor_elt): Add forward declaration.
261 (cxx_eval_call_expression): Handle TARGET_VTABLE_USES_DESCRIPTORS
263 (cxx_eval_constant_expression) <case OBJ_TYPE_REF>: Divide token
264 by TARGET_VTABLE_USES_DESCRIPTORS if non-zero.
266 2018-12-11 Marek Polacek <polacek@redhat.com>
268 PR c++/86608 - reading constexpr volatile variable.
269 * constexpr.c (potential_constant_expression_1): Check want_rval
270 instead of checking if we have a decl.
271 * decl2.c (decl_maybe_constant_var_p): Don't consider volatile
272 constexpr variables as maybe constant.
274 2018-12-11 Paolo Carlini <paolo.carlini@oracle.com>
276 * decl.c (grokvardecl): Add location_t parameter and use it
277 in build_lang_decl_loc and build_decl calls.
278 (grokdeclarator): Move up loc declaration and use it in the
279 grokvardecl call too.
281 2018-12-09 Cesar Philippidis <cesar@codesourcery.com>
283 * parser.c (cp_parser_oacc_kernels_parallel): Adjust EXPR_LOCATION
284 on the combined acc loop.
286 2018-12-07 Paolo Carlini <paolo.carlini@oracle.com>
288 * decl2.c (grokbitfield): Use DECL_SOURCE_LOCATION in error messages
289 about bit-fields with function type, warn_if_not_aligned type, and
290 static bit-fields; avoid DECL_NAME for unnamed declarations.
292 2018-12-07 Jakub Jelinek <jakub@redhat.com>
295 * call.c (make_temporary_var_for_ref_to_temp): Call pushdecl even for
299 * constexpr.c (adjust_temp_type): Handle EMPTY_CLASS_EXPR.
301 2018-12-06 Paolo Carlini <paolo.carlini@oracle.com>
303 * class.c (check_bitfield_decl): In error message about non-integral
304 type print the type itself too.
305 * decl.c (grokdeclarator): Do not ICE on unnamed bit-fields declared
306 friends; when calling build_decl for a FIELD_DECL possibly pass the
309 2018-12-06 Alexandre Oliva <aoliva@redhat.com>
312 * pt.c (tsubst_friend_class): Enter tsubsted class context.
315 * except.c (build_noexcept_spec): Resolve nondependent
318 2018-12-06 Jason Merrill <jason@redhat.com>
320 PR c++/88136 - -Wdeprecated-copy false positives
321 * class.c (classtype_has_depr_implicit_copy): Rename from
322 classtype_has_user_copy_or_dtor.
323 * method.c (lazily_declare_fn): Adjust.
324 * decl2.c (cp_warn_deprecated_use): Refer to -Wdeprecated-copy-dtor
325 if deprecation is due to a destructor.
327 2018-12-06 Marek Polacek <polacek@redhat.com>
329 PR c++/88373 - wrong parse error with ~.
330 * parser.c (cp_parser_template_name): Check tag_type for
333 2018-12-06 Segher Boessenkool <segher@kernel.crashing.org>
335 * cp-tree.h (finish_asm_stmt): Update declaration.
336 * parser.c (cp_parser_asm_definition): Detect the inline keyword
337 after asm. Pass a flag for it to finish_asm_stmt.
338 * pt.c (tsubst_expr): Pass the ASM_INLINE_P flag to finish_asm_stmt.
339 * semantics.c (finish_asm_stmt): Add inline_p parameter. Use it to
342 2018-12-06 Segher Boessenkool <segher@kernel.crashing.org>
345 * parser.c (cp_parser_asm_definition): Update grammar. Allow any
346 combination of volatile and goto, in any order, without repetitions.
348 2018-12-06 David Malcolm <dmalcolm@redhat.com>
351 * call.c (conversion_null_warnings): Try to use the location of
352 the expression for the warnings. Add notes showing the parameter
353 of the function decl, where available.
354 (get_fndecl_argument_location): For implicitly-declared functions,
355 use the fndecl location rather than that of the param.
356 (maybe_inform_about_fndecl_for_bogus_argument_init): New function.
357 (convert_like_real): Use it in various places to avoid repetition.
358 (complain_about_bad_argument): Likewise.
359 * cp-tree.h (maybe_inform_about_fndecl_for_bogus_argument_init):
361 * decl2.c (check_default_args): Put all diagnostics for the fndecl
362 into a diagnostic group. Use the location of the parameter when
363 complaining about parameters with missing default arguments in
364 preference to that of the fndecl. Attempt to record the location
365 of the first parameter with a default argument and emit a note
366 for the first parameter that's missing one.
367 * typeck.c (convert_arguments): When complaining about parameters
368 with incomplete types, attempt to use the location of the
369 argument. Where available, add a note showing the pertinent
370 parameter in the fndecl.
371 (convert_for_assignment): When complaining about bad conversions
372 at function calls, use the location of the unstripped argument.
373 (convert_for_initialization): When checking for bogus references,
374 add an auto_diagnostic_group, and update the note to use the
375 location of the pertinent parameter, rather than just the callee.
377 2018-12-06 Paolo Carlini <paolo.carlini@oracle.com>
379 * decl2.c (grokbitfield): Use DECL_SOURCE_LOCATION in error message;
380 print the type too; fix thinko in INDIRECT_TYPE_P use.
382 2018-12-05 Alexandre Oliva <aoliva@redhat.com>
385 * constexpr.c (adjust_temp_type): Test for type equality with
387 (constexpr_call_hasher::equal): Likewise.
389 2018-12-04 Paolo Carlini <paolo.carlini@oracle.com>
392 * decl.c (grokdeclarator): Avoid crashing on an anonymous bit-field
395 2018-12-04 Marek Polacek <polacek@redhat.com>
397 PR c++/88184 - ICE when treating name as template-name.
398 * pt.c (lookup_template_function): Always build the TEMPLATE_ID_EXPR
399 with unknown_type_node.
401 2018-12-04 Julian Brown <julian@codesourcery.com>
403 * parser.c (cp_parser_oacc_wait_list): Fix error message and avoid
404 duplicate diagnostic.
406 2018-12-04 Jakub Jelinek <jakub@redhat.com>
409 * typeck.c (build_class_member_access_expr): If unary_complex_lvalue
410 turned xvalue_p into non-xvalue_p, call move on it.
412 2018-12-02 Jakub Jelinek <jakub@redhat.com>
415 * parser.c (cp_parser_skip_to_closing_parenthesis_1,
416 cp_parser_skip_to_end_of_statement,
417 cp_parser_skip_to_end_of_block_or_statement,
418 cp_parser_skip_to_closing_brace,
419 cp_parser_skip_to_closing_square_bracket,
420 cp_parser_skip_balanced_tokens): Don't treat CPP_PRAGMA_EOL specially
421 if in_pragma is false.
423 2018-12-01 Marek Polacek <polacek@redhat.com>
425 Implement P0634R3, Down with typename!
426 * parser.c (CP_PARSER_FLAGS_TYPENAME_OPTIONAL): New enumerator.
427 (cp_parser_type_name): Remove declaration.
428 (cp_parser_postfix_expression): Pass CP_PARSER_FLAGS_TYPENAME_OPTIONAL
429 to cp_parser_type_id.
430 (cp_parser_new_type_id): Pass CP_PARSER_FLAGS_TYPENAME_OPTIONAL to
431 cp_parser_type_specifier_seq.
432 (cp_parser_lambda_declarator_opt): Pass
433 CP_PARSER_FLAGS_TYPENAME_OPTIONAL to
434 cp_parser_parameter_declaration_clause.
435 (cp_parser_condition): Pass CP_PARSER_FLAGS_NONE to
436 cp_parser_declarator.
437 (cp_parser_simple_declaration): Pass CP_PARSER_FLAGS_NONE to
438 cp_parser_init_declarator.
439 (cp_parser_conversion_type_id): Pass CP_PARSER_FLAGS_NONE to
440 cp_parser_type_specifier_seq.
441 (cp_parser_default_type_template_argument): Pass
442 CP_PARSER_FLAGS_TYPENAME_OPTIONAL to cp_parser_type_id.
443 (cp_parser_template_parameter): Pass CP_PARSER_FLAGS_TYPENAME_OPTIONAL
444 to cp_parser_parameter_declaration.
445 (cp_parser_explicit_instantiation): Pass CP_PARSER_FLAGS_NONE to
446 cp_parser_declarator.
447 (cp_parser_simple_type_specifier): Adjust call to cp_parser_type_name
448 to relay if we should treat the typename keyword as optional. Maybe
449 call cp_parser_make_typename_type is parsing a template-id and it's
451 (cp_parser_type_name): Remove unused function.
452 (cp_parser_enum_specifier): Pass to CP_PARSER_FLAGS_NONE
453 cp_parser_type_specifier_seq.
454 (cp_parser_alias_declaration): Pass CP_PARSER_FLAGS_TYPENAME_OPTIONAL
455 to cp_parser_type_id.
456 (cp_parser_init_declarator): New parameter. Pass it down to
457 cp_parser_declarator.
458 (cp_parser_declarator): New parameter. Pass CP_PARSER_FLAGS_NONE to
459 cp_parser_declarator. Pass the new parameter to
460 cp_parser_direct_declarator.
461 (cp_parser_direct_declarator): New parameter. Pass it to
462 cp_parser_parameter_declaration_clause and cp_parser_declarator.
463 (cp_parser_declarator_id):
464 (cp_parser_type_id_1): New parameter. Pass it to
465 cp_parser_type_specifier_seq. Adjust call to cp_parser_declarator.
466 (cp_parser_type_id): New parameter. Pass it to cp_parser_type_id_1.
467 (cp_parser_template_type_arg): Pass CP_PARSER_FLAGS_NONE to
469 (cp_parser_trailing_type_id): Pass CP_PARSER_FLAGS_TYPENAME_OPTIONAL
470 to cp_parser_type_id_1.
471 (cp_parser_type_specifier_seq): New parameter.
472 (function_being_declared_is_template_p):
473 (cp_parser_parameter_declaration_clause): New parameter. Pass it to
474 cp_parser_parameter_declaration_list.
475 (cp_parser_parameter_declaration_list): New parameter. Pass it to
476 cp_parser_parameter_declaration.
477 (cp_parser_parameter_declaration): New parameter. Pass it to
478 cp_parser_decl_specifier_seq. Pass CP_PARSER_FLAGS_NONE to
479 cp_parser_declarator.
480 (cp_parser_member_declaration): Adjust call to
481 cp_parser_decl_specifier_seq to also include
482 CP_PARSER_FLAGS_TYPENAME_OPTIONAL. Pass
483 CP_PARSER_FLAGS_TYPENAME_OPTIONAL to cp_parser_declarator.
484 (cp_parser_exception_declaration): Pass CP_PARSER_FLAGS_NONE to
485 cp_parser_type_specifier_seq and cp_parser_declarator.
486 (cp_parser_requirement_parameter_list): Pass CP_PARSER_FLAGS_NONE to
487 cp_parser_parameter_declaration_clause.
488 (cp_parser_constructor_declarator_p): Resolve the TYPENAME_TYPE.
489 (cp_parser_single_declaration): Pass CP_PARSER_FLAGS_TYPENAME_OPTIONAL
490 to cp_parser_decl_specifier_seq and cp_parser_init_declarator.
491 (cp_parser_cache_defarg): Pass CP_PARSER_FLAGS_NONE to
492 cp_parser_declarator and cp_parser_parameter_declaration_list.
493 (cp_parser_objc_method_tail_params_opt): Pass CP_PARSER_FLAGS_NONE to
494 cp_parser_parameter_declaration.
495 (cp_parser_objc_class_ivars): Pass CP_PARSER_FLAGS_NONE to
496 cp_parser_declarator.
497 (cp_parser_objc_try_catch_finally_statement): Pass CP_PARSER_FLAGS_NONE
498 to cp_parser_parameter_declaration
499 (cp_parser_objc_struct_declaration): Pass CP_PARSER_FLAGS_NONE to
500 cp_parser_declarator.
501 (cp_parser_omp_for_loop_init): Pass CP_PARSER_FLAGS_NONE to
502 cp_parser_declarator and cp_parser_type_specifier_seq.
504 2018-11-30 David Malcolm <dmalcolm@redhat.com>
506 * typeck2.c: Include "gcc-rich-location.h".
507 (cxx_incomplete_type_diagnostic): When complaining about possibly
508 missing parens, add a fix-it hint if the member function takes no
511 2018-11-30 James Norris <jnorris@codesourcery.com>
513 * parser.c (cp_parser_oacc_enter_exit_data): Use existing local
516 2018-11-29 Paolo Carlini <paolo.carlini@oracle.com>
518 * decl.c (compute_array_index_type_loc): New, like the current
519 compute_array_index_type but takes a location_t too.
520 (compute_array_index_type): Forward to the latter.
521 (create_array_type_for_decl): Use compute_array_index_type_loc.
523 2018-11-29 David Malcolm <dmalcolm@redhat.com>
526 * cp-name-hint.h (suggest_alternative_in_scoped_enum): New decl.
527 * error.c (dump_scope): Ensure that we print any scope for values
528 of unscoped enums. Print the scope of values of scoped enums.
529 (qualified_name_lookup_error): Offer suggestions for failures
530 within scoped enums by calling suggest_alternative_in_scoped_enum.
531 * name-lookup.c (class namespace_hints): Update comment to mention
533 (namespace_hints::namespace_hints): Call
534 maybe_add_candidate_for_scoped_enum.
535 (namespace_hints::maybe_add_candidate_for_scoped_enum): New member
536 (suggest_alternatives_for): Update comment to mention scoped
538 (suggest_alternative_in_scoped_enum): New function.
540 2018-11-28 Marek Polacek <polacek@redhat.com>
542 Implement P1094R2, Nested inline namespaces.
543 * parser.c (cp_parser_namespace_definition): Parse the optional inline
544 keyword in a nested-namespace-definition. Adjust push_namespace call.
547 2018-11-28 Nathan Sidwell <nathan@acm.org>
550 * class.c (finish_struct): In a template, add artificial using
553 2018-11-28 Jan Hubicka <hubicka@ucw.cz>
555 * except.c (do_allocate_exception): Annotate __cxa_allocate_exception
558 2018-11-28 Marek Polacek <polacek@redhat.com>
560 PR c++/88222 - ICE with bit-field with invalid type.
561 * decl.c (grokdeclarator): Check if declarator is null.
563 2018-11-28 Jakub Jelinek <jakub@redhat.com>
566 * typeck2.c (digest_init_r): Re-add handing of signed/unsigned char
567 strings and add it to the initialization of wide array from non-wide
568 string diagnostics too.
570 2018-11-27 Jakub Jelinek <jakub@redhat.com>
573 * decl.c (grokdeclarator): Don't diagnose deduction guide errors
577 * class.c (fixup_attribute_variants): Also propagate TYPE_PACKED
580 2018-11-26 Marek Polacek <polacek@redhat.com>
582 PR c++/88120 - ICE when calling save_expr in a template.
583 * typeck.c (cp_build_binary_op): Call cp_save_expr instead of
586 2018-11-22 Jakub Jelinek <jakub@redhat.com>
589 * parser.c (cp_parser_operator): Use str.get_value () instead of just
590 str in USERDEF_LITERAL_VALUE and USERDEF_LITERAL_SUFFIX_ID arguments.
592 2018-11-21 Jakub Jelinek <jakub@redhat.com>
595 * method.c (maybe_explain_implicit_delete): If
596 FUNCTION_FIRST_USER_PARMTYPE (decl) is NULL, set const_p to false
600 * parser.c (cp_parser_primary_expression): Use
601 id_expression.get_location () instead of id_expr_token->location.
602 Adjust the range from id_expr_token->location to
603 id_expressio.get_finish ().
604 (cp_parser_operator_function_id): Pass location of the operator
605 token down to cp_parser_operator.
606 (cp_parser_operator): Add start_loc argument, always construct a
607 location with caret at start_loc and range from start_loc to the
608 finish of the last token.
611 * parser.c (cp_parser_linkage_specification): Remove useless
612 dereference of the consume_open method result.
614 2018-11-20 Martin Sebor <msebor@redhat.com>
616 * cp-tree.h (cp_check_const_attributes): Declare.
617 * decl2.c (cp_check_const_attributes): Declare extern.
618 * parser.c (cp_parser_has_attribute_expression): New function.
619 (cp_parser_unary_expression): Handle RID_HAS_ATTRIBUTE_EXPRESSION.
620 (cp_parser_gnu_attribute_list): Add argument.
622 2018-11-20 Jakub Jelinek <jakub@redhat.com>
625 * constexpr.c (cxx_eval_constant_expression) <case OBJ_TYPE_REF>: Punt
626 if get_base_address of ADDR_EXPR operand is not a DECL_P.
628 2018-11-19 Marek Polacek <polacek@redhat.com>
630 PR c++/87781 - detect invalid elaborated-type-specifier.
631 * parser.c (cp_parser_elaborated_type_specifier): Ensure that
632 typename follows a nested-name-specifier.
634 2018-11-18 Paolo Carlini <paolo.carlini@oracle.com>
636 * decl2.c (grokfield): Remove obsolete _vptr check; fix
637 explicit template argument list error location.
639 2018-11-16 Kamlesh Kumar <kamleshbhalui@gmail.com>
643 * parser.c (cp_parser_noexcept_specification_opt): Call
644 inject_this_parameter.
646 2018-11-16 Jason Merrill <jason@redhat.com>
648 Implement P0479R5, [[likely]] and [[unlikely]].
649 * tree.c (handle_likeliness_attribute): New.
650 (std_attribute_table): Add likely/unlikely.
651 * cp-gimplify.c (lookup_hotness_attribute, remove_hotness_attribute)
652 (process_stmt_hotness_attribute, first_stmt): New.
653 (genericize_if_stmt): Check for duplicate predictions.
654 * parser.c (cp_parser_statement): Call
655 process_stmt_hotness_attribute.
656 (cp_parser_label_for_labeled_statement): Apply attributes to case.
657 * decl.c (finish_case_label): Give label in template type void.
658 * pt.c (tsubst_expr) [CASE_LABEL_EXPR]: Copy attributes.
659 [PREDICT_EXPR]: Handle.
661 2018-11-16 Nathan Sidwell <nathan@acm.org>
663 Remove ovl_used, it is no longer needed
664 * cp-tree.h (OVL_USED_P): Delete.
665 (lookup_keep): Delete.
666 * friend.c (add_friend): Don't call it.
667 * parser.c (lookup_literal_operator): Likewise.
668 (cp_parser_primary_expression): Likewise.
669 * semantics.c (perform_koenig_lookup): Likewise.
670 * pt.c (tsubst_copy <OVERLOAD>): Don't assert OVL_USED_P.
671 * tree.c (ovl_copy): Delete.
672 (ovl_insert): Remove OVL_USED_P checks.
673 (ovl_iterator::reveal_node): Likewise.
674 (ovl_iterator::remove__node): Likewise.
675 (ovl_used, lookup_keep): Delete.
678 * parser.c (lookup_literal_operator): Mark overload for keeping
679 when inside template. Refactor.
681 2018-11-15 Nathan Sidwell <nathan@acm.org>
685 * typeck.c (finish_class_member_access_expr): Conversion operator
686 to dependent type is dependent.
688 2018-11-15 Paolo Carlini <paolo.carlini@oracle.com>
690 * constexpr.c (ensure_literal_type_for_constexpr_object): Use
691 DECL_SOURCE_LOCATION in error_at calls.
693 2018-11-15 Nathan Sidwell <nathan@acm.org>
696 * cp-tree.h (enum special_function_kind): Add sfk_virtual_destructor.
697 * method.c (type_has_trivial_fn): Add it.
698 (SFK_DTOR_P): Likewise.
699 (synthesized_method_base_walk): Don't check access of vbases of
700 abstract classes when sfk_virtual_destructor.
701 (synthesized_method_walk): Skip vbases of abstract classes except
702 when sfk_virtual_destructor.
703 (get_defaulted_eh_spec): Set sfk_virtual_destructor as needed.
705 * cp-tree.h (enum special_function_kind): Reorder and comment.
706 * method.c (SFK_CTOR_P, SFK_DTOR_P, SFK_ASSIGN_P, SFK_COPY_P)
707 (SFK_MOVE_P): New predicates.
708 (walk_field_subobs, synthesized_method_base_walk): Drop
709 copy_arg_p, move_p, assign_p args. Use new SFK predicates. Order
710 parameters consistently.
711 (synthesized_method_walk): Drop ctor_p, copy_arg_p, move_p,
712 assign_p calculations. Use new SFK predicates. Adjust calls to
715 2018-11-14 Paolo Carlini <paolo.carlini@oracle.com>
717 * parser.c (make_id_declarator): Add location_t parameter.
718 (cp_parser_lambda_declarator_opt): Adjust call.
719 (cp_parser_decomposition_declaration): Likewise.
720 (cp_parser_alias_declaration): Likewise.
721 (cp_parser_direct_declarator): Likewise.
722 (cp_parser_member_declaration): Likewise.
723 (cp_parser_objc_class_ivars): Likewise.
724 * decl.c (grokdeclarator): Use declarator->id_loc in two error
727 2018-11-14 Jakub Jelinek <jakub@redhat.com>
729 P1236R1 - Signed integers are two's complement
730 * constexpr.c (cxx_eval_check_shift_p): Disable the signed LSHIFT_EXPR
733 2018-11-13 David Malcolm <dmalcolm@redhat.com>
735 * call.c: Replace "source_location" with "location_t".
736 * cp-tree.h: Likewise.
738 * name-lookup.c: Likewise.
739 * parser.c: Likewise.
740 * typeck.c: Likewise.
742 2018-11-12 Jason Merrill <jason@redhat.com>
744 Implement P0315R4, Lambdas in unevaluated contexts.
745 * decl2.c (min_vis_expr_r): Handle LAMBDA_EXPR.
746 * mangle.c (write_expression): Handle LAMBDA_EXPR.
747 * parser.c (cp_parser_lambda_expression): Allow lambdas in
748 unevaluated context. Start the tentative firewall sooner.
749 (cp_parser_lambda_body): Use cp_evaluated.
750 * pt.c (iterative_hash_template_arg): Handle LAMBDA_EXPR.
751 (tsubst_function_decl): Substitute a lambda even if it isn't
753 (tsubst_lambda_expr): Use cp_evaluated. Always complain.
754 (tsubst_copy_and_build) [LAMBDA_EXPR]: Do nothing if tf_partial.
755 * semantics.c (begin_class_definition): Allow in template parm list.
756 * tree.c (strip_typedefs_expr): Pass through LAMBDA_EXPR.
757 (cp_tree_equal): Handle LAMBDA_EXPR.
759 * pt.c (fn_type_unification): If we have a full set of explicit
760 arguments, go straight to substitution.
762 * decl2.c (min_vis_expr_r, expr_visibility): New.
763 (min_vis_r): Call expr_visibility.
764 (constrain_visibility_for_template): Likewise.
766 Implement P0722R3, destroying operator delete.
767 * call.c (std_destroying_delete_t_p, destroying_delete_p): New.
768 (aligned_deallocation_fn_p, usual_deallocation_fn_p): Use
770 (build_op_delete_call): Handle destroying delete.
771 * decl2.c (coerce_delete_type): Handle destroying delete.
772 * init.c (build_delete): Don't call dtor with destroying delete.
773 * optimize.c (build_delete_destructor_body): Likewise.
775 Implement P0780R2, pack expansion in lambda init-capture.
776 * parser.c (cp_parser_lambda_introducer): Parse pack init-capture.
777 * pt.c (tsubst_pack_expansion): Handle init-capture packs.
778 (lookup_init_capture_pack): New.
779 (tsubst_expr) [DECL_EXPR]: Use it.
780 (tsubst_lambda_expr): Remember field pack expansions for
783 * cp-tree.h (struct cp_evaluated): New.
784 * init.c (get_nsdmi): Use it.
785 * parser.c (cp_parser_enclosed_template_argument_list): Use it.
786 * pt.c (coerce_template_parms, tsubst_aggr_type): Use it.
788 2018-11-09 Jakub Jelinek <jakub@redhat.com>
790 * parser.c (cp_parser_omp_clause_final, cp_parser_omp_clause_if): Use
791 cp_parser_assignment_expression instead of cp_parser_condition.
792 (cp_parser_omp_clause_num_threads, cp_parser_omp_clause_num_tasks,
793 cp_parser_omp_clause_grainsize, cp_parser_omp_clause_priority,
794 cp_parser_omp_clause_num_teams, cp_parser_omp_clause_thread_limit,
795 cp_parser_omp_clause_linear, cp_parser_omp_clause_device): Use
796 cp_parser_assignment_expression instead of cp_parser_expression.
797 (cp_parser_omp_clause_hint): Likewise. Formatting fix.
799 * parser.c (cp_parser_omp_clause_reduction): Call sorry_at on
800 reduction clause with inscan modifier.
802 * parser.c (cp_parser_omp_requires): Call sorry_at on requires
803 clauses other than atomic_default_mem_order.
805 2018-11-09 Martin Sebor <msebor@redhat.com>
808 * pt.c (warn_spec_missing_attributes): Move code to attribs.c.
809 Call decls_mismatched_attributes.
811 2018-11-08 Jakub Jelinek <jakub@redhat.com>
813 * constexpr.c (potential_constant_expression_1): Handle OMP_DEPOBJ.
814 * cp-gimplify.c (cp_genericize_r): Handle
815 OMP_CLAUSE_{IN,TASK}_REDUCTION.
816 (cxx_omp_predetermined_sharing_1): Don't return
817 OMP_CLAUSE_DEFAULT_SHARED for const qualified decls with no mutable
818 member. Return OMP_CLAUSE_DEFAULT_FIRSTPRIVATE for this pointer.
819 * cp-objcp-common.c (cp_common_init_ts): Handle OMP_DEPOBJ.
820 * cp-tree.def (OMP_DEPOBJ): New tree code.
821 * cp-tree.h (OMP_ATOMIC_DEPENDENT_P): Return true also for first
822 argument being OMP_CLAUSE.
823 (OMP_DEPOBJ_DEPOBJ, OMP_DEPOBJ_CLAUSES): Define.
824 (cp_convert_omp_range_for, cp_finish_omp_range_for): Declare.
825 (finish_omp_atomic): Add LOC, CLAUSES and MO arguments. Remove
827 (finish_omp_for_block): Declare.
828 (finish_omp_flush): Add MO argument.
829 (finish_omp_depobj): Declare.
830 * cxx-pretty-print.c (cxx_pretty_printer::statement): Handle
832 * dump.c (cp_dump_tree): Likewise.
833 * lex.c (cxx_init): Likewise.
834 * parser.c: Include memmodel.h.
835 (cp_parser_for): Pass false as new is_omp argument to
837 (cp_parser_range_for): Add IS_OMP argument, return before finalizing
839 (cp_parser_omp_clause_name): Handle nontemporal, in_reduction and
840 task_reduction clauses.
841 (cp_parser_omp_var_list_no_open): Handle
842 OMP_CLAUSE_{IN,TASK}_REDUCTION. For OMP_CLAUSE_DEPEND, parse clause
843 operands as either an array section, or lvalue assignment expression.
844 (cp_parser_omp_clause_if): Handle cancel and simd modifiers.
845 (cp_parser_omp_clause_defaultmap): Parse new kinds of defaultmap
847 (cp_parser_omp_clause_reduction): Add IS_OMP and KIND arguments.
848 Parse reduction modifiers. Pass KIND to c_parser_omp_variable_list.
849 (cp_parser_omp_clause_lastprivate, cp_parser_omp_iterators): New
851 (cp_parser_omp_clause_depend): Parse iterator modifier and handle
852 iterators. Parse mutexinoutset and depobj kinds.
853 (cp_parser_oacc_all_clauses): Adjust cp_parser_omp_clause_reduction
855 (cp_parser_omp_all_clauses): Likewise. Handle
856 PRAGMA_OMP_CLAUSE_NONTEMPORAL and
857 PRAGMA_OMP_CLAUSE_{IN,TASK}_REDUCTION. Call
858 cp_parser_omp_clause_lastprivate for OpenMP lastprivate clause.
859 (cp_parser_omp_atomic): Pass pragma_tok->location as
860 LOC to finish_omp_atomic. Parse hint and memory order clauses.
861 Handle default memory order from requires directive if any. Adjust
862 finish_omp_atomic caller.
863 (cp_parser_omp_critical): Allow comma in between (name) and hint
865 (cp_parser_omp_depobj): New function.
866 (cp_parser_omp_flush): Parse flush with memory-order-clause.
867 (cp_parser_omp_for_cond): Allow NE_EXPR even in OpenMP loops.
868 (cp_convert_omp_range_for, cp_finish_omp_range_for): New functions.
869 (cp_parser_omp_for_loop): Parse C++11 range for loops among omp
870 loops. Handle OMP_CLAUSE_IN_REDUCTION like OMP_CLAUSE_REDUCTION.
871 (OMP_SIMD_CLAUSE_MASK): Add if and nontemporal clauses.
872 (cp_parser_omp_simd, cp_parser_omp_for): Call keep_next_level before
873 begin_omp_structured_block and call finish_omp_for_block on
874 finish_omp_structured_block result.
875 (cp_parser_omp_master): Add p_name, mask and cclauses arguments.
876 Allow to be called while parsing combined parallel master.
877 Parse combined master taskloop{, simd}.
878 (cp_parser_omp_parallel): Parse combined
879 parallel master{, taskloop{, simd}} constructs.
880 (cp_parser_omp_single): Use SET_EXPR_LOCATION.
881 (OMP_TASK_CLAUSE_MASK): Add in_reduction clause.
882 (OMP_TASKWAIT_CLAUSE_MASK): Define.
883 (cp_parser_omp_taskwait): Handle taskwait with depend clauses.
884 (OMP_TASKGROUP_CLAUSE_MASK): Define.
885 (cp_parser_omp_taskgroup): Parse taskgroup clauses, adjust
886 c_finish_omp_taskgroup caller.
887 (cp_parser_omp_distribute): Call keep_next_level before
888 begin_omp_structured_block and call finish_omp_for_block on
889 finish_omp_structured_block result.
890 (cp_parser_omp_teams): Force a BIND_EXPR with BLOCK around teams
892 (cp_parser_omp_target_data): Allow target data with only
893 use_device_ptr clauses.
894 (cp_parser_omp_target): Set OMP_REQUIRES_TARGET_USED bit in
896 (cp_parser_omp_requires): New function.
897 (OMP_TASKLOOP_CLAUSE_MASK): Add reduction and in_reduction clauses.
898 (cp_parser_omp_taskloop): Add forward declaration. Disallow
899 in_reduction clause when combined with parallel master. Call
900 keep_next_level before begin_omp_structured_block and call
901 finish_omp_for_block on finish_omp_structured_block result.
902 (cp_parser_omp_construct): Adjust cp_parser_omp_master caller.
903 (cp_parser_pragma): Handle PRAGMA_OMP_DEPOBJ and PRAGMA_OMP_REQUIRES.
904 * pt.c (tsubst_omp_clause_decl): Add iterators_cache argument.
905 Adjust recursive calls. Handle iterators.
906 (tsubst_omp_clauses): Handle OMP_CLAUSE_{IN,TASK}_REDUCTION and
907 OMP_CLAUSE_NONTEMPORAL. Adjust tsubst_omp_clause_decl callers.
908 (tsubst_decomp_names):
909 (tsubst_omp_for_iterator): Change orig_declv into a reference.
910 Handle range for loops. Move orig_declv handling after declv/initv
912 (tsubst_expr): Force a BIND_EXPR with BLOCK around teams body.
913 Adjust finish_omp_atomic caller. Call keep_next_level before
914 begin_omp_structured_block. Call cp_finish_omp_range_for for range
915 for loops and use {begin,finish}_omp_structured_block instead of
916 {push,pop}_stmt_list if there are any range for loops. Call
917 finish_omp_for_block on finish_omp_structured_block result.
918 Handle OMP_DEPOBJ. Handle taskwait with depend clauses. For
919 OMP_ATOMIC call tsubst_omp_clauses on clauses if any, adjust
920 finish_omp_atomic caller. Use OMP_ATOMIC_MEMORY_ORDER rather
921 than OMP_ATOMIC_SEQ_CST. Handle clauses on OMP_TASKGROUP.
922 (dependent_omp_for_p): Always return true for range for loops if
923 processing_template_decl. Return true if class type iterator
924 does not have INTEGER_CST increment.
925 * semantics.c: Include memmodel.h.
926 (handle_omp_array_sections_1): Handle OMP_CLAUSE_{IN,TASK}_REDUCTION
927 like OMP_CLAUSE_REDUCTION.
928 (handle_omp_array_sections): Likewise. Call save_expr on array
929 reductions before calling build_index_type. Handle depend clauses
931 (finish_omp_reduction_clause): Call save_expr for whole array
932 reduction sizes. Don't mark OMP_CLAUSE_DECL addressable if it has
933 reference type. Do mark decl_placeholder addressable if needed.
934 Use error_at with OMP_CLAUSE_LOCATION (c) as first argument instead
936 (cp_omp_finish_iterators): New function.
937 (finish_omp_clauses): Don't diagnose nonmonotonic clause with static,
938 runtime or auto schedule kinds. Diagnose nogroup clause used with
939 reduction clause(s). Handle depend clause with
940 OMP_CLAUSE_DEPEND_DEPOBJ. Diagnose bit-fields. Require
941 omp_depend_t type for OMP_CLAUSE_DEPEND_DEPOBJ kinds and
942 some different type for other kinds. Use cp_build_addr_expr
943 and cp_build_indirect_ref instead of cxx_mark_addressable.
944 Handle depend clauses with iterators. Only handle static data members
945 in the special case that const qualified vars may be specified in
946 firstprivate clause. Complain if const qualified vars without mutable
947 members are mentioned in data-sharing clauses other than firstprivate
948 or shared. Use error_at with OMP_CLAUSE_LOCATION (c) as first
949 argument instead of error. Diagnose more than one nontemporal clause
950 refering to the same variable. Use error_at rather than error for
951 priority and hint clause diagnostics. Fix pasto for hint clause.
952 Diagnose hint expression that doesn't fold into INTEGER_CST.
953 Diagnose if clause with modifier other than cancel. Handle
954 OMP_CLAUSE_{IN,TASK}_REDUCTION like OMP_CLAUSE_REDUCTION. Allow any
955 lvalue as OMP_CLAUSE_DEPEND operand (besides array section), adjust
957 (handle_omp_for_class_iterator): Don't create a new TREE_LIST if one
958 has been created already for range for, just fill TREE_PURPOSE and
959 TREE_VALUE. Call cp_fully_fold on incr.
960 (finish_omp_for): Don't check cond/incr if cond is global_namespace.
961 Pass to c_omp_check_loop_iv_exprs orig_declv if non-NULL. Don't
962 use IS_EMPTY_STMT on NULL pre_body. Adjust c_finish_omp_for caller.
963 (finish_omp_for_block): New function.
964 (finish_omp_atomic): Add LOC argument, pass it through
965 to c_finish_omp_atomic and set it as location of OMP_ATOMIC* trees.
966 Remove SEQ_CST argument. Add CLAUSES and MO arguments. Adjust
967 c_finish_omp_atomic caller. Stick clauses if any into first argument
968 of wrapping OMP_ATOMIC.
969 (finish_omp_depobj): New function.
970 (finish_omp_flush): Add MO argument, if not
971 MEMMODEL_LAST, emit __atomic_thread_fence call with the given value.
972 (finish_omp_cancel): Diagnose if clause with modifier other than
975 2018-11-07 Nathan Sidwell <nathan@acm.org>
978 * cp-tree.h (struct tree_overload): Fix comment.
979 * tree.c (ovl_iterator::reveal_node): Propagate OVL_DEDUP_P.
981 2018-11-04 Jason Merrill <jason@redhat.com>
983 Implement UDL changes from P0732R2.
984 * cp-tree.h (struct releasing_vec): Move from mangle.c.
986 * parser.c (cp_parser_userdef_string_literal): Use it. Handle
987 passing the string to a single template parameter of class type.
988 (cp_parser_template_declaration_after_parameters): Allow it.
989 Pedwarn about the character pack template that was proposed but not
990 accepted for C++14, and don't suggest it.
992 Implement P0732R2, class types in non-type template parameters.
993 * error.c (dump_simple_decl): Look through a template parm object.
994 * mangle.c (write_template_arg): Likewise.
995 (mangle_template_parm_object): New.
996 * pt.c (template_parm_object_p, get_template_parm_object): New.
997 (invalid_tparm_referent_p): Factor from convert_nontype_argument.
998 (convert_nontype_argument, invalid_nontype_parm_type_p): Handle
999 class-type template arguments.
1000 * tree.c (lvalue_kind): Likewise.
1002 * cvt.c (ocp_convert): Don't wrap a CONSTRUCTOR in a NOP_EXPR.
1003 * constexpr.c (initialized_type): Fix AGGR_INIT_EXPR handling.
1004 (cxx_eval_vec_init_1): Correct type of AGGR_INIT_EXPR.
1005 (cxx_eval_outermost_constant_expr): Make sure a CONSTRUCTOR has the
1006 right type. Don't wrap a CONSTRUCTOR if one was passed in.
1007 * tree.c (build_aggr_init_expr): Check for void.
1009 PR c++/60503 - wrong lambda attribute syntax.
1010 * parser.c (cp_parser_lambda_declarator_opt): Fix attribute
1013 2018-11-02 Nathan Sidwell <nathan@acm.org>
1015 * decl.c (duplicate_decls): Refactor checks.
1017 2018-11-01 Marek Polacek <polacek@redhat.com>
1019 Implement P0846R0, ADL and function templates.
1020 * decl.c (grokfndecl): Allow FUNCTION_DECL in assert.
1021 * lex.c (unqualified_fn_lookup_error): Handle TEMPLATE_ID_EXPR.
1022 * parser.c (cp_parser_postfix_expression): Do ADL for a template-name.
1023 (cp_parser_template_id): Give errors if parsing the template argument
1024 list didn't go well. Allow FUNCTION_DECL in assert.
1025 (cp_parser_template_name): Consider a name to refer to a template if
1026 it is an unqualified-id followed by a <. Don't return the identifier
1027 if the decl is a function and dependent.
1028 * pt.c (tsubst_copy) <case OVERLOAD>: Remove assert.
1030 2018-11-01 Nathan Sidwell <nathan@acm.org>
1032 * cp-tree.h (struct lang_function): Delete x_local_names field.
1033 (struct lang_decl_base): Rename u2sel to spare.
1034 (struct lang_decl_min): Remove lang_decl_u2 union. Keep access
1036 (LANG_DECL_U2_CHECK): Delete.
1037 (DECL_DISCRIMINATOR_P): Require function scope.
1038 (DECL_DISCRIMINATOR): Adjust.
1039 (DECL_DISCRIMINATOR_SET_P): Delete.
1040 (DECL_CAPTURED_VARIABLE, DECL_ACCESS, THUnK_VIRTUAL_OFFSET): Adjust.
1041 (local_classes): Don't declare.
1042 (determine_local_discriminator): Declare.
1043 * decl.c (push_local_name): Delete.
1044 (local_entities, determina_local_discrminator): New.
1045 (duplicate_decls): Copy DECL_ACCESS. Fix formatting.
1046 (cp_finish_decl): Use determine_local_discriminator.
1047 (save_function_data): Drop x_local_names.
1048 (finish_function): Drop local_names.
1049 * decl2.c (finish_anon_union): Use determine_local_disciminator.
1050 * mangle.c (write_unnamed_type_name): Use
1051 discriminator_for_local_entity.
1052 (local_class_index): Delete.
1053 (discriminator_for_local_entity): Reimplement.
1054 (write_local_name): Adjust discriminator code.
1055 * name-lookup.c (do_pushtag): Call determine_local_discrimiator.
1056 * semantics.c (finish_omp_threadprivate): Drop DECL_DISCRIMINATOR
1058 * class.c (local_classes): Delete.
1059 (init_class_processing): Don't init it.
1061 2018-11-01 Martin Liska <mliska@suse.cz>
1062 Jason Merrill <jason@redhat.com>
1067 * cp-tree.h (DECL_FNAME_P): New macro.
1068 * decl.c (cp_make_fname_decl): Set DECL_DECLARED_CONSTEXPR_P,
1069 DECL_VALUE_EXPR, DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P.
1071 * lambda.c (is_capture_proxy): Use DECL_FNAME_P.
1072 * pt.c (tsubst_expr): Handle DECL_PRETTY_FUNCTION_P.
1074 2018-10-31 Nathan Sidwell <nathan@acm.org>
1076 * cp-tree.h (OVL_DEDUP_P): New.
1077 * name-lookup.c (name_lookup::add_overload): Check OVL_DEDUP_P.
1078 (get_class_binding_direct): Likwise.
1079 * tree.c (ovl_make): Propagate OVL_DEDUP_P.
1080 (ovl_copy): Copy it.
1081 (ovl_insert): Do not keep using-decls ordered.
1082 (lookup_maybe_add): Adjust comment.
1084 2018-10-30 Marek Polacek <polacek@redhat.com>
1086 Implement P0892R2, explicit(bool).
1087 * call.c (add_template_candidate_real): Return if the declaration is
1088 explicit and we're only looking for non-converting constructor.
1089 * cp-tree.h (lang_decl_fn): Add has_dependent_explicit_spec_p bit.
1090 (DECL_HAS_DEPENDENT_EXPLICIT_SPEC_P): New macro.
1091 (cp_decl_specifier_seq): Add explicit_specifier field.
1092 (build_explicit_specifier, store_explicit_specifier): Declare.
1093 * decl.c (grokdeclarator): Call store_explicit_specifier.
1094 (build_explicit_specifier): New function.
1095 * parser.c (cp_parser_function_specifier_opt) <case RID_EXPLICIT>:
1096 Parse C++20 explicit(bool).
1097 * pt.c (store_explicit_specifier, lookup_explicit_specifier): New.
1098 (tsubst_function_decl): Handle explicit(dependent-expr).
1100 2018-10-30 Paolo Carlini <paolo.carlini@oracle.com>
1102 * decl.c (grokdeclarator): Use declarator->id_loc in diagnostic
1103 about flexible array members.
1105 2018-10-29 David Malcolm <dmalcolm@redhat.com>
1107 * cp-name-hint.h: New file.
1108 * cp-tree.h (expr_to_string): New decl.
1109 (suggest_alternatives_for): Move to cp-name-hint.h, changing
1110 return type from bool to name_hint.
1111 (suggest_alternative_in_explicit_scope): Likewise.
1112 * error.c: Define INCLUDE_UNIQUE_PTR. Include "cp-name-hint.h".
1113 (expr_to_string): Make non-static.
1114 (qualified_name_lookup_error): For the non-"::" case, take
1115 responsibity for issuing any suggestion from
1116 suggest_alternative_in_explicit_scope, as it changes from
1117 returning a bool to returning a name_hint. Replace fallback call
1118 to suggest_alternatives_for to a call to
1119 suggest_alternatives_in_other_namespaces, capturing the fact that
1120 we don't have enough location information to issue a fix-it hint
1121 for this case. Update the error to support emitting a fix-it hint
1122 where appropriate. For the "::" case, take responsibility for
1123 issuing any suggestion from suggest_alternatives_for, supporting
1124 emitting a fix-it hint.
1125 * lex.c: Define INCLUDE_UNIQUE_PTR. Include "gcc-rich-location.h"
1126 and "cp-name-hint.h".
1127 (unqualified_name_lookup_error): Take responsibility for issuing
1128 any suggestion from suggest_alternatives_for, supporting emitting
1130 * name-lookup.c (class namespace_limit_reached): New subclass of
1131 deferred_diagnostic.
1132 (class show_candidate_location): Likewise.
1133 (class suggest_alternatives): Likewise.
1134 (class namespace_hints): New class.
1135 (suggest_alternatives_for): Convert return type from bool to
1136 name_hint, replacing all direct diagnostic emission by setting
1137 suggestions on the return value, or creating deferred diagnostics.
1138 Specifically, split out initial traversal of namespaces into
1139 namespace_hints' ctor, and maybe_decorate_with_limit, and move the
1140 rest of the implementation to
1141 namespace_hints::convert_candidates_to_name_hint and
1142 suggest_alternatives_for_1.
1143 (namespace_hints::namespace_hints): New ctor, adapted from
1144 suggest_alternatives_for's initial namespace traversal, storing
1145 location and name, and converting locals "candidates", "limited"
1146 and "limit" into members.
1147 (namespace_hints::convert_candidates_to_name_hint): New member
1149 (namespace_hints::maybe_decorate_with_limit): New member function.
1150 (suggest_alternatives_for_1): New function, based on second half
1151 of old implementation of suggest_alternatives_for, converting from
1152 immediate emission of suggestions to using name_hint.
1153 (suggest_alternatives_in_other_namespaces): New function.
1154 (maybe_suggest_missing_std_header): Convert from immediate
1155 emission of suggestions to using name_hint, moving emission
1156 implementation to...
1157 (class missing_std_header): New subclass of deferred_diagnostic.
1158 (maybe_suggest_missing_header): Convert return type from bool to
1160 (suggest_alternative_in_explicit_scope): Convert from immediate
1161 emission of suggestions to using name_hint.
1162 * parser.c: Replace include of "c-family/name-hint.h" with
1164 (cp_parser_diagnose_invalid_type_name): Update
1165 "is there a suggestion" logic for change to
1166 name_hint::operator bool. Take responsibility for emitting
1167 fix-it hints from suggest_alternative_in_explicit_scope.
1168 (cp_parser_namespace_name): Take responsibility for emitting
1169 fix-it hints from suggest_alternative_in_explicit_scope. Don't
1170 emit the "expected namespace-name" error if we've already emitted
1171 an "is not a namespace-name" error.
1173 2018-10-29 David Malcolm <dmalcolm@redhat.com>
1176 * call.c (build_over_call): Eliminate the "arglocs" array, and the
1177 call to maybe_constant_value when building "fargs".
1179 2018-10-29 Paolo Carlini <paolo.carlini@oracle.com>
1181 * decl.c (create_array_type_for_decl): Add location_t parameter
1183 (grokdeclarator): Adjust call.
1185 2018-10-29 Marek Polacek <polacek@redhat.com>
1187 PR c++/87594 - constexpr rejects-valid with range-based for.
1188 * constexpr.c (potential_constant_expression_1): If the condition
1189 can't be evaluated, return true.
1191 2018-10-29 Joseph Myers <joseph@codesourcery.com>
1192 Julian Brown <julian@codesourcery.com>
1195 * semantics.c (handle_omp_array_sections_1): Allow array
1196 sections with "this" pointer for OpenACC.
1198 2018-10-25 Jason Merrill <jason@redhat.com>
1200 * parser.c (cp_parser_sizeof_operand): Remove redundant use of
1203 2018-10-24 Jakub Jelinek <jakub@redhat.com>
1206 * parser.c (cp_parser_std_attribute): Canonicalize attr_ns, and when
1207 :: is not present and attr_ns non-NULL, canonicalize also attr_id.
1208 (cp_parser_attribute_spec): Fix comment typo.
1210 2018-10-24 Martin Sebor <msebor@redhat.com>
1213 * call.c (maybe_warn_class_memaccess): Tighten up.
1215 2018-10-17 David Malcolm <dmalcolm@redhat.com>
1217 * Make-lang.in (selftest-c++): New.
1218 (CPP_SELFTEST_FLAGS, CPP_SELFTEST_DEPS, s-selftest-c++)
1219 (selftest-c++-gdb, selftest-c++-valgrind): Move here from
1222 2018-10-17 Paolo Carlini <paolo.carlini@oracle.com>
1225 * tree.c (build_cplus_new): Avoid duplicate diagnostic about
1226 incomplete type, early return error_mark_node if the second
1227 argument is error_mark_node.
1229 2018-10-12 Nathan Sidwell <nathan@acm.org>
1231 * parser.h (struct cp_parser): Drop implicit_extern_c.
1232 * parser.c (cp_debug_parser): Drop implicit_extern_c.
1233 (cp_parser_new): Likewise.
1234 (cp_parser_translation_unit): Handle implicit extern c here. Call
1235 cp_parser_toplevel_declaration.
1236 (cp_parser_toplevel_declaration): New, broken out of ...
1237 (cp_parser_declaration_seq_opt): ... here. Call it. Drop
1238 implicit extern C handling.
1240 2018-10-11 Will Wray <wjwray@gmail.com>
1243 * cxx-pretty-print.c (pp_cxx_enumeration_constant): New function.
1244 (cxx_pretty_printer::constant): Use it.
1246 2018-10-11 David Malcolm <dmalcolm@redhat.com>
1249 * call.c (enforce_access): Move diagnostics to...
1250 (complain_about_access): ...this new function.
1251 * cp-tree.h (class access_failure_info): Rename split out field
1252 "m_field_decl" into "m_decl" and "m_diag_decl".
1253 (access_failure_info::record_access_failure): Add tree param.
1254 (access_failure_info::was_inaccessible_p): New accessor.
1255 (access_failure_info::get_decl): New accessor.
1256 (access_failure_info::get_diag_decl): New accessor.
1257 (access_failure_info::get_any_accessor): New member function.
1258 (access_failure_info::add_fixit_hint): New static member function.
1259 (complain_about_access): New decl.
1260 * typeck.c (access_failure_info::record_access_failure): Update
1261 for change to fields.
1262 (access_failure_info::maybe_suggest_accessor): Split out into...
1263 (access_failure_info::get_any_accessor): ...this new function...
1264 (access_failure_info::add_fixit_hint): ...and this new function.
1265 (finish_class_member_access_expr): Split out "has no member named"
1266 error-handling into...
1267 (complain_about_unrecognized_member): ...this new function, and
1268 check that the guessed name is accessible along the access path.
1269 Only provide a spell-correction fix-it hint if it is; otherwise,
1270 attempt to issue an accessor fix-it hint.
1272 2018-10-11 Nathan Sidwell <nathan@acm.org>
1274 * parser.c (cp_parser_translation_unit): Return void. Don't fail
1275 at first extra }, simplify logic.
1276 (c_parse_file): Call finish_translation_unit here.
1278 2018-10-11 Jakub Jelinek <jakub@redhat.com>
1281 * typeck.c (maybe_warn_about_returning_address_of_local): If
1282 whats_returned is a structured binding identifier and the structured
1283 binding is a reference, recurse on its initializer.
1286 * rtti.c (get_tinfo_decl_dynamic): Use unlowered_expr_type instead
1289 2018-10-10 Marek Polacek <polacek@redhat.com>
1291 PR c++/87567 - constexpr rejects call to non-constexpr function.
1292 * constexpr.c (potential_constant_expression_1) <case FOR_STMT>: Return
1293 true if the condition is always false.
1294 <case WHILE_STMT>: Likewise.
1296 2018-10-09 Paolo Carlini <paolo.carlini@oracle.com>
1299 * pt.c (convert_template_argument): Immediately return error_mark_node
1300 if the second argument is erroneous.
1301 * parser.c (cp_parser_type_id): Add location_t * parameter.
1302 (cp_parser_type_id_1): Likewise.
1303 (cp_parser_alias_declaration): Adjust cp_parser_type_id call,
1304 obtain the location of the type and save it.
1305 (cp_parser_template_type_arg): Adjust.
1306 (cp_parser_trailing_type_id): Likewise.
1307 * decl.c (grokdeclarator): Improve error message for 'auto' in
1310 2018-10-08 Paolo Carlini <paolo.carlini@oracle.com>
1313 * pt.c (do_decl_instantiation): Per 12.6.8/5, a concept cannot be
1314 explicitly instantiated.
1316 2018-10-05 David Malcolm <dmalcolm@redhat.com>
1319 * call.c (build_over_call): Build a vec of locations of the
1320 arguments before the call to maybe_constant_value, and pass to
1321 check_function_arguments.
1322 * cp-lang.c (LANG_HOOKS_GET_SUBSTRING_LOCATION): Define as
1323 c_get_substring_location.
1324 * parser.c (cp_parser_string_literal): Capture string
1325 concatenation locations.
1327 2018-10-04 Nathan Sidwell <nathan@acm.org>
1329 * lang-specs.h: Use string contatenation, not line splicing.
1331 2018-10-03 Jason Merrill <jason@redhat.com>
1333 Implement P0840, language support for empty objects.
1334 * tree.c (handle_no_unique_addr_attribute): New.
1335 (cxx_attribute_table): Add [[no_unique_address]].
1336 * class.c (field_poverlapping_p): New.
1337 (layout_class_type): Check it. Adjust DECL_SIZE of potentially
1339 (layout_empty_base_or_field): Rename from layout_empty_base, handle
1341 (build_base_field, record_subobject_offsets): Adjust.
1343 2018-10-03 Martin Liska <mliska@suse.cz>
1345 PR gcov-profile/86109
1346 * parser.c (cp_parser_lambda_declarator_opt):
1347 Set DECL_LAMBDA_FUNCTION for lambdas.
1349 2018-10-02 Richard Biener <rguenther@suse.de>
1351 * name-lookup.c (check_local_shadow): Do not test DECL_FROM_INLINE.
1353 2018-09-28 Eric Botcazou <ebotcazou@adacore.com>
1354 Pierre-Marie de Rodat <derodat@adacore.com>
1356 * method.c (use_thunk): Adjust call to cgraph_node::create_thunk.
1358 2018-09-28 Richard Biener <rguenther@suse.de>
1360 * error.c (cp_print_error_function): Simplify by eliding
1361 the BLOCK_ABSTRACT_ORIGIN chasing.
1363 2018-09-27 Paolo Carlini <paolo.carlini@oracle.com>
1366 * semantics.c (finish_unary_op_expr): Check return value of
1367 build_x_unary_op for error_mark_node.
1369 2018-09-25 Jakub Jelinek <jakub@redhat.com>
1372 * constexpr.c (cxx_eval_constant_expression) <case OBJ_TYPE_REF>: Only
1373 look through COMPONENT_REFs with DECL_FIELD_IS_BASE FIELD_DECLs.
1375 2018-09-25 Martin Liska <mliska@suse.cz>
1377 * name-lookup.c (namespace_scope_ht_size): Remove
1379 * parser.c (cp_lexer_next_token_is_not_keyword): Likewise.
1381 2018-09-24 Paolo Carlini <paolo.carlini@oracle.com>
1384 * method.c (lazily_declare_fn): During error-recovery add_method
1387 2018-09-21 Marek Polacek <polacek@redhat.com>
1389 PR c++/87372 - __func__ constexpr evaluation.
1390 * constexpr.c (maybe_constant_init_1): Pass false for strict down to
1391 cxx_eval_outermost_constant_expr.
1393 2018-09-20 Marek Polacek <polacek@redhat.com>
1395 PR c++/87109 - wrong ctor with maybe-rvalue semantics.
1396 * call.c (build_user_type_conversion_1): Refine the maybe-rvalue
1397 check to only return if we're converting the return value to a base
1400 2018-09-20 Allan Sandfeld Jensen <allan.jensen@qt.io>
1402 * g++spec.c (lang_specific_driver): Handle -r like -nostdlib.
1404 2018-09-20 Jason Merrill <jason@redhat.com>
1406 PR c++/87075 - ICE with constexpr array initialization.
1407 * constexpr.c (cxx_eval_vec_init_1): Handle trivial initialization.
1409 2018-09-19 Marek Polacek <polacek@redhat.com>
1411 Add -Wclass-conversion.
1412 * decl.c (grok_op_properties): Change a warning from -Wconversion to
1413 -Wclass-conversion. Make it print the types.
1415 2018-09-19 Paolo Carlini <paolo.carlini@oracle.com>
1418 * parser.c (cp_parser_initializer_list): Assign error_mark_node
1419 to the index upon error.
1421 2018-09-19 Marek Polacek <polacek@redhat.com>
1423 PR c++/87357 - missing -Wconversion warning
1424 * decl.c (grok_op_properties): Remove diagnostic parts mentioning
1425 a conversion to a reference to void. Use
1426 same_type_ignoring_top_level_qualifiers_p rather than comparing types
1429 2018-09-18 Marek Polacek <polacek@redhat.com>
1431 P1064R0 - Allowing Virtual Function Calls in Constant Expressions
1432 * call.c (build_over_call): No longer check if we're outside a template
1434 * class.c (build_vtbl_initializer): Build vtable's constructor with
1436 * constexpr.c (cxx_eval_constant_expression): Don't ignore _vptr's
1437 initializer. Handle OBJ_TYPE_REF.
1438 (potential_constant_expression_1): Handle OBJ_TYPE_REF.
1439 * decl.c (maybe_commonize_var): Bail out for any DECL_ARTIFICIAL.
1440 (initialize_artificial_var): Mark the variable as constexpr.
1441 (grokdeclarator): Change error to pedwarn. Only warn when
1442 pedantic and not C++2a.
1444 2018-09-18 Paolo Carlini <paolo.carlini@oracle.com>
1447 * cp-tree.h (NON_ERROR): New.
1448 * pt.c (auto_hash::hash): Use it.
1449 (do_auto_deduction): Likewise.
1451 2018-09-18 Nathan Sidwell <nathan@acm.org>
1454 * name-lookup.c (check_local_shadow): Ignore auto types.
1456 2018-09-17 David Malcolm <dmalcolm@redhat.com>
1458 * error.c (range_label_for_type_mismatch::get_text): Update for
1461 2018-09-13 Bernd Edlinger <bernd.edlinger@hotmail.de>
1463 * typeck2.c (digest_init_r): Fix overlength strings.
1465 2018-09-13 Ville Voutilainen <ville.voutilainen@gmail.com>
1468 * method.c (constructible_expr): We're in an unevaluated context
1469 in all cases, not just for class targets.
1471 2018-09-12 David Malcolm <dmalcolm@redhat.com>
1474 * call.c (struct conversion_info): Add "loc" field.
1475 (arg_conversion_rejection): Add "loc" param, using it to
1476 initialize the new field.
1477 (bad_arg_conversion_rejection): Likewise.
1478 (explicit_conversion_rejection): Initialize the new field to
1480 (template_conversion_rejection): Likewise.
1481 (add_function_candidate): Pass on the argument location to the new
1482 param of arg_conversion_rejection.
1483 (add_conv_candidate): Likewise.
1484 (build_builtin_candidate): Likewise.
1485 (build_user_type_conversion_1): Likewise.
1486 (single_z_candidate): New function.
1487 (maybe_get_bad_conversion_for_unmatched_call): New function.
1488 (complain_about_bad_argument): New function, based on part of
1489 convert_for_assignment.
1490 (build_new_method_call_1): Split out handling of the "no viable
1491 candidates" case into...
1492 (complain_about_no_candidates_for_method_call): ...this new
1493 function, and use the new functions above to special-case the
1494 handling of a single non-viable candidate due to a bad argument.
1495 * cp-tree.h (complain_about_bad_argument): New decl.
1496 * typeck.c (convert_for_assignment): Split out one error-handling
1497 case into complain_about_bad_argument.
1499 2018-09-09 Cesar Philippidis <cesar@codesourcery.com>
1500 Julian Brown <julian@codesourcery.com>
1503 * semantics.c (finish_omp_clauses): Treat C++ references the same in
1506 2018-08-28 Martin Liska <mliska@suse.cz>
1508 * constexpr.c (cxx_eval_call_expression): Add quotes
1509 to -fconstexpr-depth=.
1511 2018-09-10 Marek Polacek <polacek@redhat.com>
1513 * class.c (build_vtbl_ref): Remove.
1514 (build_vtbl_ref_1): Rename to build_vtbl_ref.
1515 (build_vfn_ref): Call build_vtbl_ref instead of build_vtbl_ref_1.
1517 2018-09-08 Marek Polacek <polacek@redhat.com>
1519 PR c++/87150 - wrong ctor with maybe-rvalue semantics.
1520 * call.c (struct conversion): Update commentary.
1521 (standard_conversion): Set rvaluedness_matches_p if LOOKUP_PREFER_RVALUE
1524 2018-09-08 Jason Merrill <jason@redhat.com>
1526 PR c++/86678 - constexpr function with non-constant after return.
1527 * constexpr.c (potential_constant_expression_1): Add jump_target.
1528 (breaks): Check for BREAK_STMT.
1529 (continues): Check for CONTINUE_STMT.
1531 2018-09-08 Marek Polacek <polacek@redhat.com>
1533 * cxx-pretty-print.c (cxx_pretty_printer::statement) <case
1534 RANGE_FOR_SMT>: Handle RANGE_FOR_INIT_STMT.
1536 2018-09-07 Marek Polacek <polacek@redhat.com>
1538 PR c++/87152 - range-based for loops with initializer broken in templates.
1539 * constexpr.c (potential_constant_expression_1) <case RANGE_FOR_STMT>:
1540 Recur into RANGE_FOR_INIT_STMT.
1541 * cp-tree.def: Add RANGE_FOR_INIT_STMT to RANGE_FOR_STMT.
1542 * cp-tree.h (RANGE_FOR_INIT_STMT): Define.
1543 * dump.c (cp_dump_tree) <case RANGE_FOR_STMT>: Also dump
1544 RANGE_FOR_INIT_STMT.
1545 * pt.c (tsubst_expr) <case RANGE_FOR_STMT>: Recur into
1546 RANGE_FOR_INIT_STMT.
1547 * semantics.c (begin_range_for_stmt): Adjust call to build_stmt.
1548 Do put the init statement in RANGE_FOR_INIT_STMT.
1549 (finish_range_for_decl): Pop it for templates.
1551 2018-09-06 Bernd Edlinger <bernd.edlinger@hotmail.de>
1553 * decl.c (check_initializer): Call cp_complete_array_type.
1555 2018-09-05 Marek Polacek <polacek@redhat.com>
1557 PR c++/87109, wrong overload with ref-qualifiers.
1558 * call.c (build_user_type_conversion_1): Use NULL instead of 0. Bail
1559 out if performing the maybe-rvalue overload resolution and a conversion
1560 function is getting called.
1562 PR c++/86982, -Wreturn-local-addr and std::move and std::forward.
1563 * typeck.c (maybe_warn_about_returning_address_of_local): Handle calls
1564 to std::move or std::forward.
1565 (is_std_forward_p): New function.
1567 2018-09-05 Pádraig Brady <p@draigbrady.com>
1570 * lambda.c (prune_lambda_captures): Protect against const_vars.get
1573 2018-09-04 Marek Polacek <polacek@redhat.com>
1575 * cp-tree.h (treat_lvalue_as_rvalue_p): Declare.
1576 * except.c (build_throw): Use it. Use CP_TYPE_VOLATILE_P.
1577 * typeck.c (treat_lvalue_as_rvalue_p): No longer static. Add PARM_OK
1579 (maybe_warn_pessimizing_move): Adjust treat_lvalue_as_rvalue_p call.
1580 (check_return_expr): Likewise.
1582 2018-09-03 Paolo Carlini <paolo.carlini@oracle.com>
1585 * constraint.cc (finish_shorthand_constraint): Early return if the
1586 constraint is erroneous.
1588 2018-09-02 Bernd Edlinger <bernd.edlinger@hotmail.de>
1590 * decl.c (eval_check_narrowing): Remove.
1591 (check_initializer): Move call to braced_list_to_string from here ...
1592 * typeck2.c (store_init_value): ... to here.
1593 (digest_init_r): Remove handing of signed/unsigned char strings.
1595 2018-08-31 Nathan Sidwell <nathan@acm.org>
1599 * name-lookup.c (name_lookup::search_namespace): Don't look at
1600 inlines when searching for NULL names.
1602 * decl.c (decls_match): Remove SYSTEM_IMPLICIT_EXTERN_C matching
1603 of return types and parms.
1604 * parser.c (cp_parser_parameter_declaration_clause): Likewise,
1605 '()' always means '(void)'.
1607 2018-08-29 Jakub Jelinek <jakub@redhat.com>
1610 * decl.c (begin_destructor_body): If current_class_type has
1611 virtual bases and the primary base is nearly empty virtual base,
1612 voidify clearing of vptr and make it conditional on in-charge
1615 2018-08-29 Paolo Carlini <paolo.carlini@oracle.com>
1618 * parser.c (cp_parser_introduction_list): If cp_parser_identifier
1619 returns error_mark_node early exit the loop.
1620 (cp_parser_template_introduction): Improve error-recovery, remove
1621 error call about empty introduction-list.
1623 2018-08-29 David Malcolm <dmalcolm@redhat.com>
1626 * call.c (print_conversion_rejection): Add "fn" param and use it
1627 for "no known conversion" messages to underline the pertinent
1629 (print_z_candidate): Supply "fn" to the new param above.
1631 2018-08-29 Jakub Jelinek <jakub@redhat.com>
1634 * pt.c (tsubst_expr) <case RANGE_FOR_STMT>: If
1635 processing_template_decl and decl is structured binding decl, call
1638 2018-08-28 Paolo Carlini <paolo.carlini@oracle.com>
1641 * decl.c (finish_case_label): If the type is erroneous early
1642 return error_mark_node.
1644 2018-08-27 David Malcolm <dmalcolm@redhat.com>
1647 * parser.c (cp_parser_diagnose_invalid_type_name): Add fix-it
1650 2018-08-27 Jakub Jelinek <jakub@redhat.com>
1653 * cp-tree.h (cxx_readonly_error): Add location_t argument.
1654 * typeck2.c (cxx_readonly_error): Add LOC argument, pass it to
1655 ERROR_FOR_ASSIGNMENT macro and readonly_error. Add LOC argument
1656 to ERROR_FOR_ASSIGNMENT macro, use error_at instead of error and
1657 pass LOC to it. Formatting fixes.
1658 * typeck.c (cp_build_unary_op): Pass location to cxx_readonly_error.
1659 (cp_build_modify_expr): Pass loc to cxx_readonly_error.
1660 * semantics.c (finish_asm_stmt): Pass input_location to
1663 2018-08-27 David Malcolm <dmalcolm@redhat.com>
1666 * decl.c (grokdeclarator): Update for conversion of show_caret_p
1668 * error.c (cp_printer): Likewise.
1669 * name-lookup.c (maybe_suggest_missing_std_header): Update call to
1670 maybe_add_include_fixit to suggest overriding the location, as it
1672 * parser.c (cp_parser_string_literal): Update for conversion of
1673 show_caret_p to a tri-state.
1674 (cp_parser_elaborated_type_specifier): Likewise.
1675 (set_and_check_decl_spec_loc): Likewise.
1676 * pt.c (listify): Update call to maybe_add_include_fixit to not
1677 override the location, as it is for an error.
1678 * rtti.c (typeid_ok_p): Likewise.
1680 2018-08-27 Martin Liska <mliska@suse.cz>
1682 * call.c (build_call_a): Use new function
1683 fndecl_built_in_p and remove check for FUNCTION_DECL if
1685 (build_cxx_call): Likewise.
1686 * constexpr.c (constexpr_fn_retval): Likewise.
1687 (cxx_eval_builtin_function_call): Likewise.
1688 (cxx_eval_call_expression): Likewise.
1689 (potential_constant_expression_1): Likewise.
1690 * cp-gimplify.c (cp_gimplify_expr): Likewise.
1691 (cp_fold): Likewise.
1692 * decl.c (decls_match): Likewise.
1693 (validate_constexpr_redeclaration): Likewise.
1694 (duplicate_decls): Likewise.
1695 (make_rtl_for_nonlocal_decl): Likewise.
1696 * name-lookup.c (consider_binding_level): Likewise.
1697 (cp_emit_debug_info_for_using): Likewise.
1698 * semantics.c (finish_call_expr): Likewise.
1699 * tree.c (builtin_valid_in_constant_expr_p): Likewise.
1701 2018-08-26 Marek Polacek <polacek@redhat.com>
1704 * typeck.c (maybe_warn_pessimizing_move): Do nothing in a template.
1706 PR c++/87029, Implement -Wredundant-move.
1707 * typeck.c (treat_lvalue_as_rvalue_p): New function.
1708 (maybe_warn_pessimizing_move): Call convert_from_reference.
1709 Warn about redundant moves.
1711 2018-08-24 Marek Polacek <polacek@redhat.com>
1715 * decl.c (grokdeclarator): Disallow functions with trailing return
1716 type with decltype(auto) as its type. Also check the function if
1717 it's inner declarator doesn't exist
1719 2018-08-21 Marek Polacek <polacek@redhat.com>
1722 * parser.c (cp_parser_lambda_introducer): Give error if a non-local
1723 lambda has a capture-default.
1725 2018-08-21 Paolo Carlini <paolo.carlini@oracle.com>
1727 * decl.c (check_static_variable_definition): Change to return void.
1729 2018-08-21 Marek Polacek <polacek@redhat.com>
1731 PR c++/86981, Implement -Wpessimizing-move.
1732 * typeck.c (decl_in_std_namespace_p): New.
1733 (is_std_move_p): New.
1734 (maybe_warn_pessimizing_move): New.
1735 (can_do_nrvo_p): New, factored out of ...
1736 (check_return_expr): ... here. Warn about potentially harmful
1737 std::move in a return statement.
1740 * call.c (standard_conversion): Set check_narrowing.
1741 * typeck2.c (check_narrowing): Use CP_INTEGRAL_TYPE_P rather
1742 than comparing with INTEGER_TYPE.
1744 * cp-tree.h: Fix typo.
1746 2018-08-20 David Malcolm <dmalcolm@redhat.com>
1749 * call.c (build_user_type_conversion_1): Add auto_diagnostic_group
1751 (print_error_for_call_failure): Likewise.
1752 (build_op_call_1): Likewise.
1753 (build_conditional_expr_1): Likewise.
1754 (build_new_op_1): Likewise.
1755 (build_op_delete_call): Likewise.
1756 (convert_like_real): Likewise.
1757 (build_over_call): Likewise.
1758 (build_new_method_call_1): Likewise.
1760 * class.c (check_tag): Likewise.
1761 (finish_struct_anon_r): Likewise.
1762 (one_inherited_ctor): Likewise.
1763 (finalize_literal_type_property): Likewise.
1764 (explain_non_literal_class): Likewise.
1765 (find_flexarrays): Likewise.
1766 (resolve_address_of_overloaded_function): Likewise.
1767 * constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
1768 (is_valid_constexpr_fn): Likewise.
1769 (cx_check_missing_mem_inits): Likewise.
1770 * cp-gimplify.c (cp_genericize_r): Likewise.
1771 * cvt.c (maybe_warn_nodiscard): Likewise.
1772 * decl.c (warn_extern_redeclared_static): Likewise.
1773 (check_redeclaration_exception_specification): Likewise.
1774 (check_no_redeclaration_friend_default_args): Likewise.
1775 (duplicate_decls): Likewise.
1776 (redeclaration_error_message): Likewise.
1777 (warn_misplaced_attr_for_class_type): Likewise.
1778 * decl2.c (finish_static_data_member_decl): Likewise.
1779 (no_linkage_error): Likewise.
1780 (cp_warn_deprecated_use): Likewise.
1781 * error.c (qualified_name_lookup_error): Likewise.
1782 * friend.c (make_friend_class): Likewise.
1783 (do_friend): Likewise.
1784 * init.c (perform_member_init): Likewise.
1785 (build_new_1): Likewise.
1786 (build_vec_delete_1): Likewise.
1787 (build_delete): Likewise.
1788 * lex.c (unqualified_name_lookup_error): Likewise.
1789 * name-lookup.c (check_extern_c_conflict): Likewise.
1790 (inform_shadowed): New function.
1791 (check_local_shadow): Add auto_diagnostic_group instances,
1792 replacing goto "inform_shadowed" label with call to subroutine.
1793 (set_local_extern_decl_linkage): Add auto_diagnostic_group
1795 * parser.c (cp_parser_diagnose_invalid_type_name): Likewise.
1796 (cp_parser_namespace_name): Likewise.
1797 * pt.c (check_specialization_namespace): Likewise.
1798 (check_template_variable): Likewise.
1799 (warn_spec_missing_attributes): Likewise.
1800 (check_explicit_specialization): Likewise.
1801 (process_partial_specialization): Likewise.
1802 (lookup_template_class_1): Likewise.
1803 (finish_template_variable): Likewise.
1804 (do_auto_deduction): Likewise.
1805 * search.c (check_final_overrider): Likewise.
1806 (look_for_overrides_r): Likewise.
1807 * tree.c (maybe_warn_parm_abi): Likewise.
1808 * typeck.c (cxx_sizeof_expr): Likewise.
1809 (cp_build_function_call_vec): Likewise.
1810 (cp_build_binary_op): Likewise.
1811 (convert_for_assignment): Likewise.
1812 (maybe_warn_about_returning_address_of_local): Likewise.
1813 * typeck2.c (abstract_virtuals_error_sfinae): Likewise.
1814 (check_narrowing): Likewise.
1816 2018-08-17 David Malcolm <dmalcolm@redhat.com>
1818 * typeck.c (string_conv_p): Extract location from EXP and use it
1819 in preference to input_location when issuing warnings.
1821 2018-08-15 David Malcolm <dmalcolm@redhat.com>
1823 * call.c: Include "gcc-rich-location.h".
1824 (convert_like_real): Add range label for "invalid conversion"
1826 (perform_implicit_conversion_flags): Add type label to the
1827 "could not convert" error.
1828 * error.c: Include "gcc-rich-location.h".
1829 (range_label_for_type_mismatch::get_text): New function.
1830 * typeck.c (convert_for_assignment): Add type label to
1831 the "cannot convert" error if a location is available.
1833 2018-08-15 Paolo Carlini <paolo.carlini@oracle.com>
1835 * decl.c (check_previous_goto_1): When decl_jump_unsafe returns 2
1836 emit an error instead of a permerror.
1838 2018-08-13 Marek Polacek <polacek@redhat.com>
1841 * call.c (struct conversion): Add check_narrowing_const_only.
1842 (build_converted_constant_expr): Set check_narrowing and
1843 check_narrowing_const_only. Give error if expr is error node.
1844 (convert_like_real): Pass it to check_narrowing.
1845 * cp-tree.h (check_narrowing): Add a default parameter.
1846 * decl.c (compute_array_index_type): Use input_location instead of
1848 * pt.c (convert_nontype_argument): Return NULL_TREE if tf_error.
1849 * typeck2.c (check_narrowing): Don't warn for instantiation-dependent
1850 expressions. Call maybe_constant_value instead of
1851 fold_non_dependent_expr. Don't mention { } in diagnostic. Only check
1852 narrowing for constants if CONST_ONLY.
1854 2018-08-13 Martin Sebor <msebor@redhat.com>
1856 PR tree-optimization/71625
1857 * decl.c (check_initializer): Call braced_list_to_string.
1858 (eval_check_narrowing): New function.
1859 * gcc/cp/typeck2.c (digest_init_r): Accept strings literals
1860 as initilizers for all narrow character types.
1862 2018-08-13 Marek Polacek <polacek@redhat.com>
1864 P0806R2 - Deprecate implicit capture of this via [=]
1865 * lambda.c (add_default_capture): Formatting fixes. Warn about
1866 deprecated implicit capture of this via [=].
1869 * decl.c (create_array_type_for_decl): Handle null name.
1871 2018-08-10 Jason Merrill <jason@redhat.com>
1873 PR c++/86728 - C variadic generic lambda.
1874 * parser.c (cp_parser_parameter_declaration): Don't turn 'auto' into
1875 a pack if it's followed by a declarator-id.
1877 2018-08-08 Jakub Jelinek <jakub@redhat.com>
1879 P0595R1 - is_constant_evaluated
1880 * cp-tree.h (enum cp_built_in_function): New.
1881 (maybe_constant_init): Add pretend_const_required argument.
1882 * typeck2.c (store_init_value): Pass true as new argument to
1883 maybe_constant_init.
1884 * constexpr.c (constexpr_fn_retval): Check also DECL_BUILT_IN_CLASS
1885 for BUILT_IN_UNREACHABLE.
1886 (struct constexpr_ctx): Add pretend_const_required field.
1887 (cxx_eval_builtin_function_call): Use DECL_IS_BUILTIN_CONSTANT_P
1888 macro. Handle CP_BUILT_IN_IS_CONSTANT_EVALUATED. Check also
1889 DECL_BUILT_IN_CLASS for BUILT_IN_UNREACHABLE.
1890 (cxx_eval_outermost_constant_expr): Add pretend_const_required
1891 argument, initialize pretend_const_required field in ctx. If the
1892 result is TREE_CONSTANT and non_constant_p, retry with
1893 pretend_const_required false if it was true.
1894 (is_sub_constant_expr): Initialize pretend_const_required_field in
1896 (cxx_constant_value): Pass true as pretend_const_required to
1897 cxx_eval_outermost_constant_expr.
1898 (maybe_constant_value): Pass false as pretend_const_required to
1899 cxx_eval_outermost_constant_expr.
1900 (fold_non_dependent_expr): Likewise.
1901 (maybe_constant_init_1): Add pretend_const_required argument, pass it
1902 down to cxx_eval_outermost_constant_expr. Pass !allow_non_constant
1903 instead of false as strict to cxx_eval_outermost_constant_expr.
1904 (maybe_constant_init): Add pretend_const_required argument, pass it
1905 down to maybe_constant_init_1.
1906 (cxx_constant_init): Pass true as pretend_const_required to
1907 maybe_constant_init_1.
1908 * cp-gimplify.c (cp_gimplify_expr): Handle CALL_EXPRs to
1909 CP_BUILT_IN_IS_CONSTANT_EVALUATED.
1910 (cp_fold): Don't fold CP_BUILT_IN_IS_CONSTANT_EVALUATED calls.
1911 * decl.c: Include langhooks.h.
1912 (cxx_init_decl_processing): Register __builtin_is_constant_evaluated
1914 * tree.c (builtin_valid_in_constant_expr_p): Return true for
1915 CP_BUILT_IN_IS_CONSTANT_EVALUATED.
1916 * pt.c (declare_integer_pack): Initialize DECL_FUNCTION_CODE.
1919 * pt.c (tsubst_expr): For structured bindings, call tsubst_decomp_names
1920 before tsubst_init, not after it.
1923 * constexpr.c (cxx_eval_binary_expression): For arithmetics involving
1924 NULL pointer set *non_constant_p to true.
1925 (cxx_eval_component_reference): For dereferencing of a NULL pointer,
1926 set *non_constant_p to true and return t.
1928 2018-08-07 Paolo Carlini <paolo.carlini@oracle.com>
1930 PR c++/59480, DR 136
1931 * decl.c (check_no_redeclaration_friend_default_args): New.
1932 (duplicate_decls): Use the latter; also check that a friend
1933 declaration specifying default arguments is a definition.
1935 2018-08-07 Ville Voutilainen <ville.voutilainen@gmail.com>
1938 * name-lookup.c (check_local_shadow): Reject captures and parameters
1941 2018-08-06 Marek Polacek <polacek@redhat.com>
1944 * constexpr.c (cxx_eval_statement_list): Handle continue.
1946 2018-08-03 David Malcolm <dmalcolm@redhat.com>
1947 Jonathan Wakely <jwakely@redhat.com>
1949 * decl.c: Include "gcc-rich-location.h".
1950 (add_return_star_this_fixit): New function.
1951 (finish_function): When warning about missing return statements in
1952 functions returning non-void, add a "return *this;" fix-it hint for
1953 assignment operators.
1955 2018-08-03 Jason Merrill <jason@redhat.com>
1958 * class.c (build_base_path): Use currently_open_class.
1960 2018-08-02 David Malcolm <dmalcolm@redhat.com>
1962 * error.c (cxx_print_error_function): Duplicate "file" before
1963 passing it to pp_set_prefix.
1964 (cp_print_error_function): Use pp_take_prefix when saving the
1967 2018-08-02 Richard Biener <rguenther@suse.de>
1970 * class.c (layout_class_type): Copy TYPE_TYPELESS_STORAGE
1971 to the CLASSTYPE_AS_BASE.
1973 2018-08-01 Martin Sebor <msebor@redhat.com>
1975 PR tree-optimization/86650
1976 * error.c (cp_printer): Move usage of EXPR_LOCATION (t) and
1977 TREE_BLOCK (t) from within percent_K_format to this callsite.
1979 2018-08-01 Paolo Carlini <paolo.carlini@oracle.com>
1982 * class.c (note_name_declared_in_class): Use location_of in permerror
1983 instead of DECL_SOURCE_LOCATION (for OVERLOADs).
1985 2018-07-31 Tom de Vries <tdevries@suse.de>
1988 * optimize.c (update_cloned_parm): Copy DECL_BY_REFERENCE.
1990 2018-07-31 Jakub Jelinek <jakub@redhat.com>
1992 P1008R1 - prohibit aggregates with user-declared constructors
1993 * class.c (check_bases_and_members): For C++2a set
1994 CLASSTYPE_NON_AGGREGATE based on TYPE_HAS_USER_CONSTRUCTOR rather than
1995 type_has_user_provided_or_explicit_constructor.
1997 2018-07-31 Martin Liska <mliska@suse.cz>
2000 * parser.c (cp_parser_condition): Initialize non_constant_p
2003 2018-07-28 David Malcolm <dmalcolm@redhat.com>
2005 * error.c (cp_printer): In the leading comment, move "%H" and "%I"
2006 into alphabetical order, and add missing "%G" and "%K". Within
2007 the switch statement, move cases 'G', 'H', 'I' and 'K' so that the
2008 cases are in alphabetical order.
2010 2018-07-25 Jakub Jelinek <jakub@redhat.com>
2012 * cp-tree.h (enum cp_tree_index): Add
2013 CPTI_{ABI_TAG,ALIGNED,BEGIN,END,GET,TUPLE_{ELEMENT,SIZE}}_IDENTIFIER
2014 and CPTI_{GNU,TYPE,VALUE,FUN,CLOSURE}_IDENTIFIER.
2015 (abi_tag_identifier, aligned_identifier, begin_identifier,
2016 end_identifier, get__identifier, gnu_identifier,
2017 tuple_element_identifier, tuple_size_identifier, type_identifier,
2018 value_identifier, fun_identifier, closure_identifier): Define.
2019 * decl.c (initialize_predefined_identifiers): Initialize the above
2021 (get_tuple_size): Use tuple_size_identifier instead of
2022 get_identifier ("tuple_size") and value_identifier instead of
2023 get_identifier ("value").
2024 (get_tuple_element_type): Use tuple_element_identifier instead of
2025 get_identifier ("tuple_element") and type_identifier instead of
2026 get_identifier ("type").
2027 (get_tuple_decomp_init): Use get__identifier instead of
2028 get_identifier ("get").
2029 * lambda.c (maybe_add_lambda_conv_op): Use fun_identifier instead of
2030 get_identifier ("_FUN").
2031 * parser.c (cp_parser_lambda_declarator_opt): Use closure_identifier
2032 instead of get_identifier ("__closure").
2033 (cp_parser_std_attribute): Use gnu_identifier instead of
2034 get_identifier ("gnu").
2035 (cp_parser_std_attribute_spec): Likewise. Use aligned_identifier
2036 instead of get_identifier ("aligned").
2037 * class.c (check_abi_tags, inherit_targ_abi_tags): Use
2038 abi_tag_identifier instead of get_identifier ("abi_tag").
2041 * cp-tree.h (enum cp_tree_index): Add
2042 CPTI_FOR_{RANGE,BEGIN,END}{,_}_IDENTIFIER.
2043 (for_range__identifier, for_begin__identifier, for_end__identifier,
2044 for_range_identifier, for_begin_identifier, for_end_identifier):
2046 * decl.c (initialize_predefined_identifiers): Initialize
2047 for_{range,begin,end}{,_}_identifier.
2048 * parser.c (build_range_temp): Use for_range__identifier instead of
2049 get_identifier ("__for_range").
2050 (cp_convert_range_for): Use for_begin__identifier and
2051 for_end__identifier instead of get_identifier ("__for_begin") and
2052 get_identifier ("__for_end").
2053 * semantics.c (finish_for_stmt): Rename "__for_{range,begin,end} "
2054 local symbols to "__for_{range,begin,end}".
2056 2018-07-23 Jakub Jelinek <jakub@redhat.com>
2059 * cp-gimplify.c (cp_fold): Don't fold comparisons into other kind
2060 of expressions other than INTEGER_CST regardless of TREE_NO_WARNING
2061 or warn_nonnull_compare.
2063 2018-07-19 Paolo Carlini <paolo.carlini@oracle.com>
2065 Revert fix for c++/59480 (and testsuite followup)
2067 2019-07-18 Paolo Carlini <paolo.carlini@oracle.com>
2069 PR c++/59480, DR 136
2070 * decl.c (check_no_redeclaration_friend_default_args): New.
2071 (duplicate_decls): Use the latter; also check that a friend
2072 declaration specifying default arguments is a definition.
2074 2018-07-18 Jakub Jelinek <jakub@redhat.com>
2077 * parser.c (cp_parser_decl_specifier_seq): Diagnose invalid type
2078 specifier if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR.
2080 2018-07-18 Marek Polacek <polacek@redhat.com>
2082 PR c++/86190 - bogus -Wsign-conversion warning
2083 * typeck.c (cp_build_binary_op): Fix formatting. Add a warning
2086 2018-07-18 Paolo Carlini <paolo.carlini@oracle.com>
2088 PR c++/59480, DR 136
2089 * decl.c (check_no_redeclaration_friend_default_args): New.
2090 (duplicate_decls): Use the latter; also check that a friend
2091 declaration specifying default arguments is a definition.
2093 2018-07-18 Paolo Carlini <paolo.carlini@oracle.com>
2095 * class.c (note_name_declared_in_class): Prefer permerror + inform
2096 to a pair of permerrors; use DECL_SOURCE_LOCATION.
2098 2018-07-18 Richard Biener <rguenther@suse.de>
2101 * decl2.c (c_parse_final_cleanups): Call write_out_vars before
2102 start_static_storage_duration_function sets current_function_decl.
2104 2018-07-17 Jason Merrill <jason@redhat.com>
2106 PR c++/86480 - nested variadic lambda and constexpr if.
2107 * pt.c (find_parameter_packs_r) [IF_STMT]: Don't walk into
2109 * tree.c (cp_walk_subtrees) [DECLTYPE_TYPE]: Set
2110 cp_unevaluated_operand.
2111 [ALIGNOF_EXPR] [SIZEOF_EXPR] [NOEXCEPT_EXPR]: Likewise.
2113 2018-07-16 Paolo Carlini <paolo.carlini@oracle.com>
2115 * class.c (resolve_address_of_overloaded_function): Don't emit an
2116 inform if the matching permerror returns false.
2117 * pt.c (check_specialization_namespace): Likewise.
2119 2018-07-16 Jakub Jelinek <jakub@redhat.com>
2123 * cp-gimplify.c (cp_genericize_r): When using extern_decl_map, or
2124 in TREE_USED flag from stmt to h->to.
2126 2018-07-13 Nathan Sidwell <nathan@acm.org>
2129 * pt.c (lookup_template_class_1): Use tsubst_aggr_type for
2130 contexts that are classes.
2131 * parser.c (cp_parser_template_id): Combine entering_scope decl &
2134 2018-07-12 Jakub Jelinek <jakub@redhat.com>
2136 * decl2.c (cplus_decl_attributes): Don't diagnose vars without mappable
2137 type here, instead add "omp declare target implicit" attribute. Add
2138 that attribute instead of "omp declare target" also when
2139 processing_template_decl.
2140 * decl.c (cp_finish_decl): Diagnose vars without mappable type here,
2141 and before calling cp_omp_mappable_type call complete_type.
2143 2018-07-10 Jakub Jelinek <jakub@redhat.com>
2146 * cp-gimplify.c (cp_maybe_instrument_return): Skip trailing
2150 * semantics.c (handle_omp_for_class_iterator): Remove lastp argument,
2151 instead of setting *lastp turn orig_declv elt into a TREE_LIST.
2152 (finish_omp_for): Adjust handle_omp_for_class_iterator caller.
2153 * pt.c (tsubst_omp_for_iterator): Allow OMP_FOR_ORIG_DECLS to contain
2154 TREE_LIST for both the original class iterator and the "last" helper
2157 2018-07-09 Paolo Carlini <paolo.carlini@oracle.com>
2159 * decl.c (grokdeclarator): Use rich_location::add_range in three
2160 more places; include gcc-rich-location.h.
2162 2018-07-07 Aldy Hernandez <aldyh@redhat.com>
2164 * decl.c (build_enumerator): Change overflow type to overflow_type.
2165 * init.c (build_new_1): Same.
2167 2018-07-05 Nathan Sidwell <nathan@acm.org>
2169 * cp/decl.c (decls_match): Check SYSTEM_IMPLICIT_EXTERN_C not
2170 NO_IMPLICIT_EXTERN_C.
2171 * cp/parser.c (cp_parser_parameter_declaration_clause): Likewise.
2173 2018-07-04 Ville Voutilainen <ville.voutilainen@gmail.com>
2176 * method.c (is_trivially_xible): Return false
2177 if is_xible_helper returns a NULL_TREE.
2179 2018-07-03 Paolo Carlini <paolo.carlini@oracle.com>
2181 * decl.c (min_location): New.
2182 (smallest_type_quals_location): Use the latter.
2183 (check_concept_fn): Use DECL_SOURCE_LOCATION.
2184 (grokdeclarator): Use accurate locations in a number of error
2185 messages involving ds_thread, ds_storage_class, ds_virtual,
2186 ds_constexpr, ds_typedef and ds_friend; exploit min_location.
2188 2018-07-03 Marek Polacek <polacek@redhat.com>
2191 * typeck.c (cp_build_binary_op): Check c_inhibit_evaluation_warnings.
2193 2018-07-03 Jason Merrill <jason@redhat.com>
2195 PR c++/86378 - functional cast in noexcept-specifier.
2196 * tree.c (strip_typedefs_expr) [TREE_LIST]: Fix iteration.
2198 2018-07-02 Paolo Carlini <paolo.carlini@oracle.com>
2200 * parser.c (set_and_check_decl_spec_loc): Use rich_location::add_range
2201 in error message about __thread and thread_local at the same time.
2203 2018-06-29 Marek Polacek <polacek@redhat.com>
2206 * tree.c (cp_save_expr): Don't call save_expr for TARGET_EXPRs.
2208 2018-06-28 David Malcolm <dmalcolm@redhat.com>
2210 * parser.c (cp_parser_error_1): After issuing a conflict marker
2211 error, consume tokens until the end of the source line.
2213 2018-06-28 Jason Merrill <jason@redhat.com>
2215 PR c++/86342 - -Wdeprecated-copy and system headers.
2216 * decl2.c (cp_warn_deprecated_use): Don't warn about declarations
2219 2018-06-27 David Malcolm <dmalcolm@redhat.com>
2222 * name-lookup.c (consider_binding_level): Filter out names that
2223 match anon_aggrname_p.
2225 2018-06-27 Jason Merrill <jason@redhat.com>
2227 * name-lookup.c (do_pushtag): If we skip a class level, also skip
2230 2018-06-26 Jason Merrill <jason@redhat.com>
2232 PR c++/86320 - memory-hog with std::array of pair
2233 * typeck2.c (process_init_constructor_array): Only compute a
2234 constant initializer once.
2236 PR c++/80290 - memory-hog with std::pair.
2237 * pt.c (fn_type_unification): Add convs parameter.
2238 (check_non_deducible_conversion): Remember conversion.
2239 (check_non_deducible_conversions): New. Do checks here.
2240 (type_unification_real): Not here. Remove flags parm.
2241 * call.c (add_function_candidate): Make convs a parameter.
2242 Don't recalculate the conversion if it's already set.
2243 (add_template_candidate_real): Allocate convs here.
2244 (good_conversion, conv_flags): New.
2246 2018-06-26 Jakub Jelinek <jakub@redhat.com>
2249 * parser.c (cp_parser_omp_for_loop_init): Change for_block argument
2250 type from vec<tree, va_gc> * to vec<tree, va_gc> *&.
2252 2018-06-23 Paolo Carlini <paolo.carlini@oracle.com>
2254 * decl.c (bad_specifiers): Add const location_t* parameter and
2255 use locations in error messages about 'inline' and 'virtual'.
2256 (mark_inline_variable): Add location_t parameter and use it in
2257 error_at and pedwarn messages.
2258 (grokdeclarator): Use declspecs->locations[ds_constexpr],
2259 declspecs->locations[ds_concept], declspecs->locations[ds_virtual],
2260 declspecs->locations[ds_inline] in many error messages; adjust
2261 bad_specifiers and mark_inline_variable calls.
2262 (grokvardecl): Use declspecs->locations[ds_concept] in error message.
2264 2018-06-22 Jason Merrill <jason@redhat.com>
2266 PR c++/86219 - ICE with erroneous initializer in template.
2267 * constexpr.c (fold_non_dependent_expr): Add complain parm.
2268 * call.c, expr.c, init.c, pt.c, semantics.c, typeck.c, typeck2.c:
2270 * call.c (build_cxx_call): Don't mess with builtins in a template.
2271 * typeck2.c (store_init_value): If fold_non_dependent_expr didn't
2272 produce a constant value, go back to the uninstantiated form.
2274 Avoid taking the address of something just because it's in parens.
2275 * constexpr.c (same_type_ignoring_tlq_and_bounds_p): New.
2276 (cxx_fold_indirect_ref): Use it.
2277 (cxx_eval_constant_expression) [VIEW_CONVERT_EXPR]: Use it.
2278 * cp-tree.h (REF_PARENTHESIZED_P): Allow VIEW_CONVERT_EXPR.
2279 * semantics.c (force_paren_expr): Use VIEW_CONVERT_EXPR instead of
2280 static_cast to reference type.
2281 (maybe_undo_parenthesized_ref): Handle VIEW_CONVERT_EXPR.
2283 2018-06-21 Jason Merrill <jason@redhat.com>
2285 * pt.c (tsubst) [TEMPLATE_TYPE_PARM]: Use TEMPLATE_PARM_DESCENDANTS.
2287 * name-lookup.c (do_push_to_top_level): Don't allocate
2289 (do_pop_from_top_level): Release current_lang_base.
2291 Let -fmem-report see callers of cxx_make_type.
2292 * lex.c (cxx_make_type): Add MEM_STAT_DECL.
2293 (make_class_type): Likewise.
2294 (cxx_make_type_hook): New.
2295 * cp-objcp-common.h (LANG_HOOKS_MAKE_TYPE): Use cxx_make_type_hook.
2297 2018-06-20 Nathan Sidwell <nathan@acm.org>
2300 * friend.c (add_friend): Keep lookup sets of tempate sets.
2302 2018-06-20 Paolo Carlini <paolo.carlini@oracle.com>
2304 * decl.c (grokfndecl): Add const cp_decl_specifier_seq* parameter;
2305 tidy handling of a null location_t argument; use proper location
2306 information in a few additional error messages.
2307 (grokdeclarator): Update calls.
2309 2018-06-20 Chung-Lin Tang <cltang@codesourcery.com>
2310 Thomas Schwinge <thomas@codesourcery.com>
2311 Cesar Philippidis <cesar@codesourcery.com>
2313 * parser.c (cp_parser_omp_clause_name): Add support for finalize
2314 and if_present. Make present_or_{copy,copyin,copyout,create} aliases
2315 to their non-present_or_* counterparts. Make 'self' an alias to
2316 PRAGMA_OACC_CLAUSE_HOST.
2317 (cp_parser_oacc_data_clause): Update GOMP mappings for
2318 PRAGMA_OACC_CLAUSE_{COPY,COPYIN,COPYOUT,CREATE,DELETE}. Remove
2319 PRAGMA_OACC_CLAUSE_{SELF,PRESENT_OR_*}.
2320 (cp_parser_oacc_all_clauses): Handle finalize and if_present clauses.
2321 Remove support for present_or_* clauses.
2322 (OACC_KERNELS_CLAUSE_MASK): Remove PRESENT_OR_* clauses.
2323 (OACC_PARALLEL_CLAUSE_MASK): Likewise.
2324 (OACC_DECLARE_CLAUSE_MASK): Likewise.
2325 (OACC_DATA_CLAUSE_MASK): Likewise.
2326 (OACC_ENTER_DATA_CLAUSE_MASK): Remove PRESENT_OR_* clauses.
2327 (OACC_EXIT_DATA_CLAUSE_MASK): Add FINALIZE clause.
2328 (OACC_UPDATE_CLAUSE_MASK): Remove SELF, add IF_PRESENT.
2329 (cp_parser_oacc_declare): Remove PRESENT_OR_* clauses.
2330 * pt.c (tsubst_omp_clauses): Handle IF_PRESENT and FINALIZE.
2331 * semantics.c (finish_omp_clauses): Handle IF_PRESENT and FINALIZE.
2333 2018-06-20 Marek Polacek <polacek@redhat.com>
2336 * constexpr.c (cxx_eval_constant_expression): Handle ABSU_EXPR.
2337 (fold_simple_1): Likewise.
2338 * error.c (dump_expr): Likewise.
2340 2018-06-20 Nathan Sidwell <nathan@acm.org>
2343 * cp-tree.h (lookup_keep): Drop KEEP parm.
2344 (lookup_list_keep): Delete.
2345 (maybe_get_fns): Declare.
2346 * parser.c (cp_parser_primary_expression): Call lookup_keep here.
2347 (cp_parser_template_id): Not here ...
2348 * decl.c (cp_finish_decl): ... nor here ...
2349 * init.c (build_raw_new_expr): ... nor here ...
2350 * pt.c (process_template_parm): ... nor here ...
2351 * semantics.c (perform_koenig_lookup): Call lookup_keep.
2352 (finish_call_expr): Not here.
2353 * tree.c (ovl_cache): Delete.
2354 (ovl_make, ovl_copy): No cache.
2355 (lookup_keep): Always keep.
2356 (lookup_list_keep): Delete.
2357 (maybe_get_fns): New, broken out of ...
2358 (get_fns): ... here. Call it.
2359 (built_min_nt_loc, build_min, build_min_non_dep): Drop lookup_keep.
2360 (build_min_nt_call_vec): Likewise.
2362 2018-06-19 Jason Merrill <jason@redhat.com>
2364 * cp-tree.h (CONSTRUCTOR_NO_IMPLICIT_ZERO): Remove.
2365 * constexpr.c: Use CONSTRUCTOR_NO_CLEARING instead.
2367 PR c++/86182 - ICE with anonymous union passed to template.
2368 * pt.c (tsubst_expr) [DECL_EXPR]: Handle an anonymous union type
2369 used to declare a named variable.
2371 2018-06-18 Jason Merrill <jason@redhat.com>
2373 * tree.c (cp_expr_location): New.
2374 * cp-tree.h (cp_expr_loc_or_loc): New.
2375 * call.c, cvt.c, constexpr.c, constraint.cc, cp-gimplify.c, decl.c,
2376 error.c, init.c, lex.c, parser.c, pt.c, semantics.c, typeck.c,
2377 typeck2.c: Use it instead of EXPR_LOC_OR_LOC.
2379 * parser.c (cp_parser_lambda_expression): Use a range for
2380 LAMBDA_EXPR_LOCATION.
2382 PR c++/86200 - ICE with unexpanded pack in lambda parameter.
2383 * pt.c (find_parameter_packs_r) [LAMBDA_EXPR]: Also look into the
2386 PR c++/81060 - ICE with unexpanded parameter pack.
2387 * pt.c (check_for_bare_parameter_packs): Add loc parameter.
2388 * decl.c (grokdeclarator): Call it for qualifying_scope.
2390 PR c++/86171 - ICE with recursive alias instantiation.
2391 * pt.c (tsubst_decl): Handle recursive alias instantiation.
2393 2018-06-18 Paolo Carlini <paolo.carlini@oracle.com>
2395 * decl.c (duplicate_decls): Consistently use DECL_SOURCE_LOCATION
2396 in errors about redefined default arguments; tidy.
2398 2018-06-16 Kugan Vivekanandarajah <kuganv@linaro.org>
2400 * constexpr.c (potential_constant_expression_1): Handle ABSU_EXPR.
2401 * cp-gimplify.c (cp_fold): Likewise.
2403 2018-06-15 Jason Merrill <jason@redhat.com>
2405 PR c++/86147 - wrong capture for template argument.
2406 * expr.c (mark_use): Look through NOP_EXPR.
2408 * name-lookup.c (do_pushtag): Don't look through complete types, but
2409 don't add to them either. Get context from current_binding_level.
2410 * pt.c (tsubst_default_argument): Use push_to/pop_from_top_level.
2412 * decl.c (start_enum): Do compare dependent underlying type.
2414 PR c++/82882 - ICE with lambda in template default argument.
2415 * lambda.c (record_null_lambda_scope): New.
2416 * pt.c (tsubst_lambda_expr): Use it.
2417 * name-lookup.c (do_pushtag): Don't give a lambda DECL_CONTEXT of a
2418 function that isn't open.
2420 * tree.c (maybe_warn_parm_abi): Inform the location of the class.
2422 2018-06-14 Marek Polacek <polacek@redhat.com>
2425 * decl2.c (cp_check_const_attributes): Skip trees that are not
2428 2018-06-14 Jakub Jelinek <jakub@redhat.com>
2430 P0624R2 - Default constructible and assignable stateless lambdas
2431 * method.c (synthesized_method_walk): For C++2a don't mark
2432 sfk_constructor or sfk_copy_assignment as deleted if lambda has
2435 2018-06-14 Paolo Carlini <paolo.carlini@oracle.com>
2437 * decl.c (duplicate_decls): Use DECL_SOURCE_LOCATION in
2438 OPT_Wshadow warning_at.
2439 (grokfndecl): Consistently use the location_t argument in
2440 literal operator diagnostic messages.
2441 (grokdeclarator): Use declspecs->locations[ds_storage_class]
2443 * decl2.c (finish_static_data_member_decl): Use DECL_SOURCE_LOCATION
2446 2018-06-13 Jason Merrill <jason@redhat.com>
2448 PR c++/86099 - ICE with trivial copy and non-trivial default ctor.
2449 * constexpr.c (instantiate_cx_fn_r): Don't synthesize trivial
2452 PR c++/86094 - wrong code with defaulted move ctor.
2453 * class.c (classtype_has_non_deleted_move_ctor): New.
2454 * tree.c (maybe_warn_parm_abi, type_has_nontrivial_copy_init):
2455 Handle v12 breakage.
2457 2018-06-12 Jason Merrill <jason@redhat.com>
2459 PR c++/86098 - ICE with template placeholder for TTP.
2460 * typeck.c (structural_comptypes) [TEMPLATE_TYPE_PARM]: Check
2461 CLASS_PLACEHOLDER_TEMPLATE.
2463 2018-06-12 Paolo Carlini <paolo.carlini@oracle.com>
2465 * decl2.c (coerce_new_type, coerce_delete_type): Add location_t
2466 parameter and adjust error_at calls.
2467 * decl.c (grok_op_properties): Adjust calls.
2468 * cp-tree.h (oerce_new_type, coerce_delete_type): Adjust decls.
2470 2018-06-12 Marek Polacek <polacek@redhat.com>
2472 Core issue 1331 - const mismatch with defaulted copy constructor
2473 * class.c (check_bases_and_members): When checking a defaulted
2474 function, mark it as deleted rather than giving an error.
2476 2018-06-11 Jason Merrill <jason@redhat.com>
2478 PR c++/85792 -Wctor-dtor-privacy and inherited constructor.
2479 * class.c (maybe_warn_about_overly_private_class): Handle inherited
2482 PR c++/85963 - -Wunused-but-set with ?: in template.
2483 * pt.c (tsubst_copy_and_build) [COND_EXPR]: Call mark_rvalue_use.
2485 2018-06-11 Paolo Carlini <paolo.carlini@oracle.com>
2487 * decl.c (grok_op_properties): Consistently use the location
2488 of the decl; remove special casing of POSTINCREMENT_EXPR and
2489 POSTDECREMENT_EXPR wrt default arguments.
2491 2018-06-05 Jason Merrill <jason@redhat.com>
2493 * constexpr.c (cxx_eval_binary_expression): Special case comparison
2494 of pointers to members of the same union.
2496 2018-06-11 Jason Merrill <jason@redhat.com>
2498 PR c++/86094 - wrong code with defaulted move ctor.
2499 * tree.c (type_has_nontrivial_copy_init): Fix move ctor handling.
2501 2018-06-10 Paolo Carlini <paolo.carlini@oracle.com>
2503 * decl.c (grokfndecl): Use the location_t argument in two more places.
2505 2018-06-06 Marek Polacek <polacek@redhat.com>
2508 * pt.c (unify): If ELTTYPE has no deducible template parms, skip
2509 deduction from the list elements.
2510 (type_unification_real): Check convertibility of list elements.
2512 2018-06-06 Jason Merrill <jason@redhat.com>
2514 PR c++/86060 - ICE on range for with -std=c++98.
2515 * parser.c (cp_parser_init_statement): Don't clobber *decl after
2518 PR c++/85710 - ICE with -Wmemset-elt-size.
2519 * semantics.c (finish_call_expr): Call warn_for_memset here.
2520 * parser.c (cp_parser_postfix_expression): Not here.
2521 (literal_integer_zerop): No longer static.
2522 * pt.c (build_non_dependent_expr): Don't wrap CONST_DECL.
2524 2018-06-05 Marek Polacek <polacek@redhat.com>
2527 * tree.c (cp_tree_equal): Handle USING_DECL.
2529 2018-06-05 Jason Merrill <jason@redhat.com>
2531 PR c++/85731 - wrong error with qualified-id in template.
2532 * semantics.c (finish_qualified_id_expr): build_qualified_name
2533 for unbound names in the current class.
2535 2018-06-04 Jason Merrill <jason@redhat.com>
2537 PR c++/61806 - missed SFINAE with partial specialization.
2538 * cp-tree.h (deferring_access_check_sentinel): Add deferring_kind
2539 parameter to constructor.
2540 * pt.c (instantiate_class_template_1): Enable access checking
2541 before call to most_specialized_partial_spec.
2543 PR c++/85765 - SFINAE and non-type default template arg.
2544 * pt.c (type_unification_real): Do full semantic processing if
2545 substituting a partial args list replaces all template parms.
2547 2018-06-03 Jason Merrill <jason@redhat.com>
2549 PR c++/85739 - ICE with pointer to member template parm.
2550 * cvt.c (perform_qualification_conversions): Use cp_fold_convert.
2552 2018-06-02 Jason Merrill <jason@redhat.com>
2554 PR c++/85761 - ICE with ill-formed use of const outer variable.
2555 * expr.c (mark_use): Handle location wrappers.
2557 2018-06-01 Jason Merrill <jason@redhat.com>
2559 PR c++/85764 - bogus 'this' not captured error.
2560 * lambda.c (resolvable_dummy_lambda): Use nonlambda_method_basetype.
2561 (nonlambda_method_basetype): Handle NSDMI.
2563 CWG 1581: When are constexpr member functions defined?
2564 * constexpr.c (instantiate_cx_fn_r, instantiate_constexpr_fns): New.
2565 (cxx_eval_outermost_constant_expr): Call instantiate_constexpr_fns.
2567 PR c++/58281 - explicit instantiation of constexpr
2568 * pt.c (mark_decl_instantiated): Clear DECL_EXTERNAL.
2570 * pt.c (instantiate_decl): Any defaulted function is defined.
2572 2018-05-30 Jonathan Wakely <jwakely@redhat.com>
2575 * call.c (resolve_args): Use location of expression, not current input
2578 2018-05-30 Ville Voutilainen <ville.voutilainen@gmail.com>
2580 Do not warn about zero-as-null when NULL is used.
2581 * call.c (conversion_null_warnings): Check for pointer
2582 types converted from zero constants.
2583 (convert_like_real): Add a warning sentinel at the end.
2584 * tree.c (maybe_warn_zero_as_null_pointer_constant): Also
2587 2018-05-30 Jason Merrill <jason@redhat.com>
2589 PR c++/85807 - ICE with call in template NSDMI.
2590 * init.c (get_nsdmi): Use push_to/pop_from_top_level.
2591 * tree.c (bot_manip): Don't set_flags_from_callee in a template.
2593 PR c++/85873 - constant initializer_list array not in .rodata.
2594 * tree.c (build_target_expr): Set TREE_READONLY.
2595 * call.c (set_up_extended_ref_temp): Set TREE_READONLY.
2597 * parser.c (cp_parser_check_condition_declarator): Handle
2598 cp_error_declarator.
2600 2018-05-30 Jonathan Wakely <jwakely@redhat.com>
2602 * typeck.c (cxx_sizeof_or_alignof_type): Return size_one_node instead
2603 of using it in dead store.
2605 2018-05-29 Jason Merrill <jason@redhat.com>
2607 PR c++/67445 - returning temporary initializer_list.
2608 PR c++/67711 - assigning from temporary initializer_list.
2609 PR c++/48562 - new initializer_list.
2610 * typeck.c (maybe_warn_about_returning_address_of_local): Also warn
2611 about returning local initializer_list.
2612 * cp-tree.h (AUTO_TEMP_NAME, TEMP_NAME_P): Remove.
2613 * call.c (build_over_call): Warn about assignment from temporary
2615 * init.c (build_new_1): Warn about 'new std::initializer_list'.
2616 (find_list_begin, maybe_warn_list_ctor): New.
2617 (perform_member_init): Use maybe_warn_list_ctor.
2619 2018-05-29 Marek Polacek <polacek@redhat.com>
2622 * init.c (build_new): Handle deducing a class with new
2623 with more than one argument.
2625 2018-05-29 Jakub Jelinek <jakub@redhat.com>
2628 * init.c (build_aggr_init): For structured binding initialized from
2629 array call mark_rvalue_use on the initializer.
2631 2018-05-28 Bernd Edlinger <bernd.edlinger@hotmail.de>
2633 * decl2.c (start_static_storage_duration_function): Use
2634 splay_tree_delete_pointers.
2636 2018-05-25 Jason Merrill <jason@redhat.com>
2638 PR c++/85815 - reference to member of enclosing template.
2639 * search.c (lookup_base): Use currently_open_class.
2640 (lookup_member): Use it regardless of -fconcepts.
2641 * parser.c (cp_parser_postfix_dot_deref_expression): Check it.
2643 CWG 616, 1213 - value category of subobject references.
2644 * tree.c (lvalue_kind): Fix handling of ARRAY_REF of pointer.
2646 2018-05-24 Jason Merrill <jason@redhat.com>
2648 PR c++/85842 - -Wreturn-type, constexpr if and generic lambda.
2649 * pt.c (tsubst_lambda_expr): Copy current_function_returns_* to
2652 2018-05-24 Ville Voutilainen <ville.voutilainen@gmail.com>
2654 Pedwarn on a non-standard position of a C++ attribute.
2655 * parser.c (cp_parser_namespace_definition): Pedwarn about attributes
2656 after the namespace name.
2658 2018-05-24 Paolo Carlini <paolo.carlini@oracle.com>
2660 * cp-tree.h (INDIRECT_TYPE_P): New.
2661 * call.c (build_trivial_dtor_call, maybe_warn_class_memaccess,
2662 joust): Use it instead of POINTER_TYPE_P.
2663 * class.c (update_vtable_entry_for_fn, find_flexarrays,
2664 * fixed_type_or_null, resolves_to_fixed_type_p): Likewise.
2665 * constexpr.c (cxx_eval_binary_expression, cxx_fold_indirect_ref,
2666 * cxx_eval_increment_expression, potential_constant_expression_1):
2668 * cp-gimplify.c (cp_gimplify_expr, cp_genericize_r): Likewise.
2669 * cp-objcp-common.c (cxx_get_alias_set): Likewise.
2670 * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call,
2671 cp_ubsan_maybe_instrument_downcast): Likewise.
2672 * cvt.c (cp_convert_to_pointer, ocp_convert,
2673 cp_get_fndecl_from_callee, maybe_warn_nodiscard, convert): Likewise.
2674 * cxx-pretty-print.c (cxx_pretty_printer::abstract_declarator,
2675 pp_cxx_offsetof_expression_1): Likewise.
2676 * decl.c (grokparms, static_fn_type): Likewise.
2677 * decl2.c (grokbitfield): Likewise.
2678 * error.c (dump_expr): Likewise.
2679 * except.c (initialize_handler_parm, check_noexcept_r): Likewise.
2680 * init.c (warn_placement_new_too_small): Likewise.
2681 * lambda.c (build_capture_proxy, add_capture): Likewise.
2682 * parser.c (cp_parser_omp_for_loop): Likewise.
2683 * pt.c (convert_nontype_argument, fn_type_unification,
2684 uses_deducible_template_parms, check_cv_quals_for_unify,
2685 dependent_type_p_r): Likewise.
2686 * search.c (check_final_overrider): Likewise.
2687 * semantics.c (handle_omp_array_sections, finish_omp_clauses,
2688 finish_omp_for): Likewise.
2689 * tree.c (cp_build_qualified_type_real): Likewise.
2690 * typeck.c (build_class_member_access_expr,
2691 finish_class_member_access_expr, build_x_indirect_ref,
2692 cp_build_indirect_ref_1, cp_build_binary_op, build_const_cast_1):
2695 2018-05-24 Jason Merrill <jason@redhat.com>
2697 PR c++/85864 - literal template and default template arg.
2698 * pt.c (instantiation_dependent_r): Handle NONTYPE_ARGUMENT_PACK.
2700 2018-05-24 Marek Polacek <polacek@redhat.com>
2703 * init.c (build_new_1): Use fold_non_dependent_expr. Use a dedicated
2704 variable for its result. Fix a condition.
2705 (build_new): Use fold_non_dependent_expr. Tweak a condition.
2707 2018-05-23 Jason Merrill <jason@redhat.com>
2709 Fix cast to rvalue reference from prvalue.
2710 * cvt.c (diagnose_ref_binding): Handle rvalue reference.
2711 * rtti.c (build_dynamic_cast_1): Don't try to build a reference to
2712 non-class type. Handle xvalue argument.
2713 * typeck.c (build_reinterpret_cast_1): Allow cast from prvalue to
2715 * semantics.c (finish_compound_literal): Do direct-initialization,
2716 not cast, to initialize a reference.
2718 CWG 616, 1213 - value category of subobject references.
2719 * tree.c (lvalue_kind): A reference to a subobject of a prvalue is
2721 * typeck2.c (build_m_component_ref): Likewise.
2722 * typeck.c (cp_build_addr_expr_1, lvalue_or_else): Remove diagnostic
2723 distinction between temporary and xvalue.
2725 2018-05-23 Marek Polacek <polacek@redhat.com>
2727 Implement P0614R1, Range-based for statements with initializer.
2728 * parser.c (cp_parser_range_based_for_with_init_p): New.
2729 (cp_parser_init_statement): Use it. Parse the optional init-statement
2730 for a range-based for loop.
2731 (cp_parser_skip_to_closing_parenthesis_1): Handle balancing ?:.
2733 2018-05-22 Jason Merrill <jason@redhat.com>
2735 PR c++/81420 - not extending temporary lifetime.
2736 * call.c (extend_ref_init_temps_1): Handle ARRAY_REF.
2737 * class.c (build_base_path): Avoid redundant move of an rvalue.
2739 PR c++/85866 - error with .* in default template arg.
2740 * pt.c (tsubst_copy_and_build): Handle partial instantiation.
2742 2018-05-21 Paolo Carlini <paolo.carlini@oracle.com>
2744 * parser.c (cp_parser_parameter_declaration_list): Remove
2746 (cp_parser_parameter_declaration_clause): Adjust.
2747 (cp_parser_cache_defarg): Likewise.
2749 2018-05-21 Paolo Carlini <paolo.carlini@oracle.com>
2752 * parser.c (cp_parser_maybe_commit_to_declaration,
2753 cp_parser_check_condition_declarator): New.
2754 (cp_parser_simple_declaration): Use the first above.
2755 (cp_parser_condition): Use both the above; enforce
2756 [stmt.stmt]/2 about the declarator not specifying
2757 a function or an array; improve error-recovery.
2759 2018-05-20 Jason Merrill <jason@redhat.com>
2761 PR libstdc++/85843 - warning in logic_error copy constructor.
2762 * class.c (type_has_user_nondefault_constructor): Check for a
2763 user-provided ctor, not user-declared.
2765 2018-05-19 Jason Merrill <jason@redhat.com>
2767 * pt.c (tsubst_pack_expansion): Sorry rather than abort
2768 on __integer_pack as subexpression of pattern.
2770 2018-05-18 Jason Merrill <jason@redhat.com>
2772 PR c++/58407 - deprecated implicit copy ops.
2773 * call.c (build_over_call): Warn about deprecated trivial fns.
2774 * class.c (classtype_has_user_copy_or_dtor): New.
2775 (type_build_ctor_call): Check TREE_DEPRECATED.
2776 (type_build_dtor_call): Likewise.
2777 * decl2.c (cp_warn_deprecated_use): Move from tree.c.
2778 Add checks. Return bool. Handle -Wdeprecated-copy.
2779 (mark_used): Use it.
2780 * decl.c (grokdeclarator): Remove redundant checks.
2781 * typeck2.c (build_functional_cast): Likewise.
2782 * method.c (lazily_declare_fn): Mark deprecated copy ops.
2783 * init.c (build_aggr_init): Only set TREE_USED if there are
2786 2018-05-18 Cesar Philippidis <cesar@codesourcery.com>
2789 * cp-gimplify.c (cp_genericize_r): Call genericize_omp_for_stmt for
2792 2018-05-18 Richard Sandiford <richard.sandiford@linaro.org>
2794 * constexpr.c (cxx_eval_constant_expression): Remove FMA_EXPR handling.
2795 (potential_constant_expression_1): Likewise.
2797 2018-05-16 Marek Polacek <polacek@redhat.com>
2800 * call.c (set_flags_from_callee): Handle AGGR_INIT_EXPRs too.
2801 * tree.c (bot_manip): Call set_flags_from_callee for
2802 AGGR_INIT_EXPRs too.
2804 2018-05-15 Jason Merrill <jason@redhat.com>
2806 * cp-tree.h (cp_expr): Remove copy constructor.
2807 * mangle.c (struct releasing_vec): Declare copy constructor.
2809 * constexpr.c (cxx_eval_vec_init_1): Pass tf_none if ctx->quiet.
2811 PR c++/64372 - CWG 1560, gratuitous lvalue-rvalue conversion in ?:
2812 * call.c (build_conditional_expr_1): Don't force_rvalue when one arm
2813 is a throw-expression.
2815 2018-05-15 Paolo Carlini <paolo.carlini@oracle.com>
2817 * cp-tree.h (DECL_MAYBE_IN_CHARGE_CDTOR_P): New.
2818 (FOR_EACH_CLONE): Update.
2819 * decl.c (grokdeclarator): Use it.
2820 * decl2.c (vague_linkage_p): Likewise.
2821 * mangle.c (mangle_decl): Likewise.
2822 * method.c (lazily_declare_fn): Likewise.
2823 * optimize.c (can_alias_cdtor, maybe_clone_body): Likewise.
2824 * repo.c (repo_emit_p): Likewise.
2825 * tree.c (decl_linkage): Likewise.
2827 2018-05-14 Jason Merrill <jason@redhat.com>
2829 Handle TYPE_HAS_LATE_RETURN_TYPE like ref-qualifier and eh spec.
2830 * tree.c (build_cp_fntype_variant): New.
2831 (build_ref_qualified_type, build_exception_variant)
2832 (strip_typedefs, cxx_copy_lang_qualifiers): Use it.
2833 (cxx_type_hash_eq, cp_check_qualified_type): Check
2834 TYPE_HAS_LATE_RETURN_TYPE.
2835 (cp_build_type_attribute_variant): Check cxx_type_hash_eq.
2836 (cp_build_qualified_type_real): No need to preserve C++ qualifiers.
2837 * class.c (build_clone): Use cxx_copy_lang_qualifiers.
2838 (adjust_clone_args): Likewise.
2839 * decl.c (grokfndecl): Add late_return_type_p parameter. Use
2840 build_cp_fntype_variant.
2841 (grokdeclarator): Pass late_return_type_p to grokfndecl.
2842 (check_function_type): Use cxx_copy_lang_qualifiers.
2843 (static_fn_type): Use cxx_copy_lang_qualifiers.
2844 * decl2.c (build_memfn_type, maybe_retrofit_in_chrg)
2845 (cp_reconstruct_complex_type, coerce_new_type, coerce_delete_type)
2846 (change_return_type): Use cxx_copy_lang_qualifiers.
2847 * mangle.c (write_type): Use cxx_copy_lang_qualifiers.
2848 * parser.c (cp_parser_lambda_declarator_opt): Represent an explicit
2849 return type on the declarator like a normal trailing return type.
2850 * pt.c (tsubst_function_type): Use build_cp_fntype_variant.
2851 (copy_default_args_to_explicit_spec): Use cxx_copy_lang_qualifiers.
2852 * typeck.c (merge_types): Use build_cp_fntype_variant.
2854 2018-05-14 Paolo Carlini <paolo.carlini@oracle.com>
2856 * cp-tree.h (TYPE_REF_P): New.
2857 (TYPE_OBJ_P, TYPE_REF_OBJ_P, TYPE_REFFN_P): Update.
2858 * call.c (build_list_conv, build_aggr_conv, standard_conversion,
2859 direct_reference_binding, reference_binding, implicit_conversion,
2860 add_builtin_candidate, build_user_type_conversion_1, build_op_call_1,
2861 build_new_op_1, build_x_va_arg, conv_binds_ref_to_prvalue,
2862 build_over_call, perform_implicit_conversion_flags,
2863 extend_ref_init_temps, type_has_extended_temps): Use it.
2864 * class.c (one_inheriting_sig, check_field_decls,
2865 check_bases_and_members, find_flexarrays, finish_struct,
2866 fixed_type_or_null): Likewise.
2867 * constexpr.c (literal_type_p, cxx_bind_parameters_in_call,
2868 non_const_var_error, cxx_eval_constant_expression,
2869 potential_constant_expression_1): Likewise.
2870 * cp-gimplify.c (omp_var_to_track, omp_cxx_notice_variable,
2871 cp_genericize_r, cxx_omp_privatize_by_reference,
2872 cxx_omp_const_qual_no_mutable, cxx_omp_finish_clause,
2873 cp_fold_maybe_rvalue): Likewise.
2874 * cp-ubsan.c (cp_ubsan_maybe_instrument_downcast): Likewise.
2875 * cvt.c (build_up_reference, convert_to_reference,
2876 convert_from_reference, convert_to_void, noexcept_conv_p,
2877 fnptr_conv_p): Likewise.
2878 * decl.c (poplevel, check_for_uninitialized_const_var,
2879 check_initializer, initialize_local_var, cp_finish_decl,
2880 get_tuple_decomp_init, cp_finish_decomp, grokdeclarator, copy_fn_p,
2881 move_signature_fn_p, grok_op_properties, finish_function): Likewise.
2882 * decl2.c (grok_array_decl, cp_reconstruct_complex_type,
2883 decl_maybe_constant_var_p): Likewise.
2884 * error.c (dump_type_prefix, dump_expr): Likewise.
2885 * except.c (initialize_handler_parm, complete_ptr_ref_or_void_ptr_p,
2886 is_admissible_throw_operand_or_catch_parameter): Likewise.
2887 * expr.c (mark_use): Likewise.
2888 * init.c (build_zero_init_1, build_value_init_noctor,
2889 perform_member_init, diagnose_uninitialized_cst_or_ref_member_1,
2890 build_new, build_delete): Likewise.
2891 * lambda.c (build_lambda_object): Likewise.
2892 * mangle.c (write_expression, write_template_arg): Likewise.
2893 * method.c (forward_parm, do_build_copy_constructor,
2894 do_build_copy_assign, build_stub_object, constructible_expr,
2895 walk_field_subobs): Likewise.
2896 * parser.c (cp_parser_omp_for_loop_init,
2897 cp_parser_omp_declare_reduction_exprs,
2898 cp_parser_omp_declare_reduction): Likewise.
2899 * pt.c (convert_nontype_argument_function, convert_nontype_argument,
2900 convert_template_argument, tsubst_pack_expansion,
2901 tsubst_function_decl, tsubst_decl, tsubst, tsubst_copy_and_build,
2902 maybe_adjust_types_for_deduction, check_cv_quals_for_unify, unify,
2903 more_specialized_fn, invalid_nontype_parm_type_p, dependent_type_p_r,
2904 value_dependent_expression_p, build_deduction_guide): Likewise.
2905 * semantics.c (finish_handler_parms, finish_non_static_data_member,
2906 finish_compound_literal, omp_privatize_field,
2907 handle_omp_array_sections_1, handle_omp_array_sections,
2908 cp_check_omp_declare_reduction, finish_omp_reduction_clause,
2909 finish_omp_declare_simd_methods, cp_finish_omp_clause_depend_sink,
2910 finish_omp_clauses, finish_decltype_type, capture_decltype,
2911 finish_builtin_launder): Likewise.
2912 * tree.c (lvalue_kind, cp_build_reference_type, move,
2913 cp_build_qualified_type_real, stabilize_expr, stabilize_init): Likewise.
2914 * typeck.c (cxx_safe_arg_type_equiv_p, build_class_member_access_expr,
2915 cp_build_indirect_ref_1, convert_arguments, warn_for_null_address,
2916 cp_build_addr_expr_1, maybe_warn_about_useless_cast,
2917 build_static_cast_1, build_static_cast, build_reinterpret_cast_1,
2918 build_const_cast_1, cp_build_c_cast, cp_build_modify_expr,
2919 convert_for_initialization,
2920 maybe_warn_about_returning_address_of_local, check_return_expr,
2921 cp_type_quals, casts_away_constness, non_reference): Likewise.
2922 * typeck2.c (cxx_readonly_error, store_init_value,
2923 process_init_constructor_record, build_x_arrow, build_functional_cast,
2924 add_exception_specifier): Likewise.
2926 2018-05-14 Jason Merrill <jason@redhat.com>
2928 * pt.c (tsubst) [ARRAY_TYPE]: Check valid_array_size_p.
2929 (tsubst_copy_and_build) [NEW_EXPR]: Clear in_decl.
2931 2018-05-11 Jakub Jelinek <jakub@redhat.com>
2934 * cp-tree.h (cxx_omp_predetermined_sharing_1): New prototype.
2935 * cp-gimplify.c (cxx_omp_predetermined_sharing): New wrapper around
2936 cxx_omp_predetermined_sharing_1. Rename old function to ...
2937 (cxx_omp_predetermined_sharing_1): ... this.
2938 * semantics.c (finish_omp_clauses): Use cxx_omp_predetermined_sharing_1
2939 instead of cxx_omp_predetermined_sharing.
2941 2018-05-10 Jason Merrill <jason@redhat.com>
2943 * decl.c (cp_finish_decl): Don't instantiate auto variable.
2944 (check_static_variable_definition): Allow auto.
2945 * constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
2947 * cp-tree.h (DECL_CONSTRUCTOR_P): Use DECL_CXX_CONSTRUCTOR_P.
2948 (DECL_DESTRUCTOR_P): Use DECL_CXX_DESTRUCTOR_P.
2950 Core issue 2310 - conversion to base of incomplete type.
2951 * class.c (build_base_path): Check COMPLETE_TYPE_P for source type.
2953 CWG 2267 - list-initialization of reference temporary
2954 * call.c (reference_binding): List-initializing a reference
2955 temporary is copy-list-initialization.
2957 * parser.c (cp_parser_class_head): Use num_template_headers_for_class.
2959 * pt.c (instantiate_decl): Make sure we aren't trying to do a nested
2960 instantiation in template context.
2962 * class.c (vbase_has_user_provided_move_assign): Use
2965 * lambda.c (lambda_expr_this_capture): Improve logic.
2967 * decl.c (make_typename_type): s/parameters/arguments/.
2968 * parser.c (cp_parser_nested_name_specifier_opt): Likewise.
2969 * pt.c (make_pack_expansion): Correct error message.
2971 2018-05-10 Jakub Jelinek <jakub@redhat.com>
2974 * cp-gimplify.c (cp_fold): Use fold_offsetof rather than
2975 fold_offsetof_1, pass TREE_TYPE (x) as TYPE to it and drop the
2978 2018-05-10 Eric Botcazou <ebotcazou@adacore.com>
2981 * decl2.c (adjust_var_decl_tls_model): New static function.
2982 (comdat_linkage): Call it on a variable.
2983 (maybe_make_one_only): Likewise.
2985 2018-05-09 Paolo Carlini <paolo.carlini@oracle.com>
2989 2018-05-08 Paolo Carlini <paolo.carlini@oracle.com>
2992 * parser.c (cp_parser_parameter_declaration_list): When the
2993 entire parameter-declaration-list is erroneous maybe call
2994 abort_fully_implicit_template.
2996 2018-05-08 Jason Merrill <jason@redhat.com>
2998 PR c++/85706 - class deduction under decltype
2999 * pt.c (for_each_template_parm_r): Handle DECLTYPE_TYPE. Clear
3000 *walk_subtrees whether or not we walked into the operand.
3001 (type_uses_auto): Only look at deduced contexts.
3003 2018-05-08 Paolo Carlini <paolo.carlini@oracle.com>
3006 * parser.c (cp_parser_parameter_declaration_list): When the
3007 entire parameter-declaration-list is erroneous maybe call
3008 abort_fully_implicit_template.
3010 2018-05-08 Marek Polacek <polacek@redhat.com>
3013 * semantics.c (finish_if_stmt_cond): See through typedefs.
3015 2018-05-07 Jason Merrill <jason@redhat.com>
3017 PR c++/85646 - lambda visibility.
3018 * decl2.c (determine_visibility): Don't mess with template arguments
3019 from the containing scope.
3020 (vague_linkage_p): Check DECL_ABSTRACT_P before looking at a 'tor
3023 2018-05-07 Nathan Sidwell <nathan@acm.org>
3025 Remove fno-for-scope
3026 * cp-tree.h (DECL_ERROR_REPORTED, DECL_DEAD_FOR_LOCAL)
3027 (DECL_HAS_SHADOWED_FOR_VAR_P, DECL_SHADOWED_FOR_VAR)
3028 (SET_DECL_SHADOWED_FOR_VAR): Delete.
3029 (decl_shadowed_for_var_lookup, decl_shadowed_for_var_insert)
3030 (check_for_out_of_scope_variable, init_shadowed_var_for_decl):
3032 * name-lookup.h (struct cp_binding_level): Remove
3033 dead_vars_from_for field.
3034 * cp-lang.c (cp_init_ts): Delete.
3035 (LANG_HOOKS_INIT_TS): Override to cp_common_init_ts.
3036 * cp-objcp-common.c (shadowed_var_for_decl): Delete.
3037 (decl_shadowed_for_var_lookup, decl_shadowed_for_var_insert)
3038 (init_shadowed_var_for_decl): Delete.
3039 * decl.c (poplevel): Remove shadowed for var handling.
3040 (cxx_init_decl_processing): Remove -ffor-scope deprecation.
3041 * name-lookup.c (find_local_binding): Remove shadowed for var
3043 (check_local_shadow): Likewise.
3044 (check_for_out_of_scope_variable): Delete.
3045 * parser.c (cp_parser_primary_expression): Remove shadowed for var
3047 * pt.c (tsubst_decl): Remove DECL_DEAD_FOR_LOCAL setting.
3048 * semantics.c (begin_for_scope): Always have a scope.
3049 (begin_for_stmt, finish_for_stmt): Remove ARM-for scope handling.
3050 (begin_range_for_stmt, finish_id_expression): Likewise.
3052 2018-05-07 Jason Merrill <jason@redhat.com>
3054 PR c++/85618 - ICE with initialized VLA.
3055 * tree.c (vla_type_p): New.
3056 * typeck2.c (store_init_value, split_nonconstant_init_1): Check it
3057 rather than array_of_runtime_bound_p.
3059 2018-05-05 Paolo Carlini <paolo.carlini@oracle.com>
3061 * cvt.c (ocp_convert): Early handle the special case of a
3062 null_ptr_cst_p expr converted to a NULLPTR_TYPE_P type.
3064 2018-05-03 Jason Merrill <jason@redhat.com>
3066 PR c++/85600 - virtual delete failure.
3067 * init.c (build_delete): Always save_expr when deleting.
3069 2018-05-03 Nathan Sidwell <nathan@acm.org>
3071 * decl.c (cxx_init_decl_processing): Remove flag_friend_injection.
3072 * name-lookup.c (do_pushdecl): Likewise.
3074 2018-05-02 Paolo Carlini <paolo.carlini@oracle.com>
3075 Jason Merrill <jason@redhat.com>
3078 * name-lookup.c (check_local_shadow): Don't handle static old
3079 declarations in the block handling locals shadowing locals.
3081 2018-05-01 Jason Merrill <jason@redhat.com>
3083 PR c++/85587 - error with scoped enum in template.
3084 * semantics.c (finish_qualified_id_expr): Don't return an
3085 unqualified IDENTIFIER_NODE.
3087 2018-04-30 Jason Merrill <jason@redhat.com>
3089 PR c++/85580 - extern "C" and local variables
3090 * name-lookup.c (check_extern_c_conflict): Ignore local decls.
3092 PR c++/84701 - unsigned typeof.
3093 * decl.c (grokdeclarator): Overhaul diagnostics for invalid use
3094 of long/short/signed/unsigned.
3096 PR c++/85305 - pack in lambda init-capture.
3097 * parser.c (cp_parser_initializer): Add subexpression_p parm; don't
3098 check_for_bare_parameter_packs in a subexpression.
3099 (cp_parser_lambda_introducer): Use it.
3101 PR c++/61982 - dead stores to destroyed objects.
3102 * call.c (build_trivial_dtor_call): New, assigns a clobber.
3103 (build_over_call, build_special_member_call): Use it.
3104 * cp-tree.h: Declare it.
3105 * init.c (build_delete): Remove trivial path.
3107 * init.c (build_dtor_call): Use build_special_member_call.
3108 (build_delete): Remove redundant uses of save_addr.
3110 * decl.c (build_clobber_this): Use build_clobber.
3112 2018-04-27 Jakub Jelinek <jakub@redhat.com>
3115 * init.c (build_zero_init_1): For zero initialization of
3116 NULLPTR_TYPE_P type use build_int_cst directly.
3118 2018-04-27 David Malcolm <dmalcolm@redhat.com>
3121 * name-lookup.c (consider_binding_level): Skip compiler-generated
3123 * search.c (lookup_field_fuzzy_info::fuzzy_lookup_field): Flatten
3124 nested if statements into a series of rejection tests. Reject
3125 lambda-ignored entities as suggestions.
3127 2018-04-27 Jason Merrill <jason@redhat.com>
3129 * cvt.c (cp_fold_convert): Use convert_ptrmem.
3130 * typeck.c (convert_ptrmem): Add a NOP even if no adjustment.
3132 2018-04-27 Paolo Carlini <paolo.carlini@oracle.com>
3135 * decl.c (grokdeclarator): Clear friendp upon definition in local
3136 class definition error.
3138 2018-04-27 Jason Merrill <jason@redhat.com>
3140 PR c++/85545 - ICE with noexcept PMF conversion.
3141 * cvt.c (cp_fold_convert): Pass PMF CONSTRUCTORs to
3143 * typeck.c (build_ptrmemfunc): Don't build a NOP_EXPR for zero
3145 (build_ptrmemfunc_access_expr): Special-case CONSTRUCTORs.
3147 2018-04-27 Nathan Sidwell <nathan@acm.org>
3149 * typeck.c (convert_ptrmem): Move local var decls to initialization.
3151 * cp-tree.h (TEMPLATE_INFO): Fix comments.
3152 (TI_PENDING_TEMPLATE_FLAG): Check TEMPLATE_INFO.
3153 (NON_DEFAULT_TEMPLATE_ARG_COUNT): Wrap line.
3154 (dump, print_other_binding_stacks): Remove declarations.
3155 * name-lookup.c (print_other_binding_stack): Make static.
3156 * pt.c (build_template_decl): Make static.
3158 2018-04-26 Jason Merrill <jason@redhat.com>
3160 PR c++/85545 - ICE with noexcept PMF conversion.
3161 * cvt.c (cp_fold_convert): Handle PMF CONSTRUCTORs directly.
3163 2018-04-25 Nathan Sidwell <nathan@acm.org>
3167 * cp-tree.h (REINTERPRET_CAST_P): New.
3168 * constexpr.c (cxx_eval_constant_expression) <case NOP_EXPR>:
3169 Reject REINTERPET_CAST_P conversions. Use cplus_expand_constant
3170 for non-trivial PTRMEM_CST cases.
3171 * typeck.c (build_nop_reinterpret): New.
3172 (build_reinterpret_cast_1): Use it. Set REINTERPRET_CAST_P on
3173 NOP_EXPRs returned by cp_convert.
3175 2018-04-23 Jason Merrill <jason@redhat.com>
3177 PR c++/69560 - wrong alignof(double) on x86.
3178 CWG 1879 - Inadequate definition of alignment requirement.
3179 * cp-tree.h (ALIGNOF_EXPR_STD_P): New.
3180 * typeck.c (cxx_sizeof_or_alignof_type): Add std_alignof parm.
3181 (cxx_sizeof_expr, cxx_sizeof_nowarn, cxx_alignas_expr)
3182 (cxx_alignof_expr): Pass it.
3183 * parser.c (cp_parser_unary_expression): Pass it.
3184 * pt.c (tsubst_copy): Copy it.
3185 (tsubst_copy_and_build): Pass it.
3186 * decl.c (fold_sizeof_expr): Pass it.
3188 2018-04-23 Jakub Jelinek <jakub@redhat.com>
3189 Jason Merrill <jason@redhat.com>
3191 PR c++/85470 - wrong error with static data member.
3192 * decl.c (check_initializer): Check DECL_INITIALIZED_IN_CLASS_P.
3193 * typeck2.c (store_init_value): Likewise.
3195 2018-04-20 Jakub Jelinek <jakub@redhat.com>
3198 * cp-tree.h (tinst_level): Remove in_system_header_p member,
3199 change refcount member from unsigned char to unsigned short,
3200 add refcount_infinity static data member, adjust comments.
3201 * pt.c (tinst_level::refcount_infinity): Define.
3202 (inc_refcount_use): Remove assert, don't increment if refcount
3203 is already refcount_infinity, adjust comment.
3204 (dec_refcount_use): Remove assert, don't decrement if refcount
3205 is refcount_infinity, adjust comment.
3206 (push_tinst_level_loc): Formatting fix.
3208 2018-04-19 Paolo Carlini <paolo.carlini@oracle.com>
3211 * pt.c (lookup_template_class_1): Check pushtag return value for
3214 2018-04-19 Alexandre Oliva <aoliva@redhat.com>
3217 * cp-tree.h (tinst_level::free): Fix whitespace.
3219 2018-04-18 Paolo Carlini <paolo.carlini@oracle.com>
3222 * pt.c (tsubst_lambda_expr): Check begin_lambda_type return value
3223 for error_mark_node.
3225 2018-04-18 Jakub Jelinek <jakub@redhat.com>
3228 * typeck.c (cp_build_addr_expr_1): Move handling of offsetof-like
3229 tricks from here to ...
3230 * cp-gimplify.c (cp_fold) <case ADDR_EXPR>: ... here. Only use it
3231 if INDIRECT_REF's operand is INTEGER_CST cast to pointer type.
3233 2018-04-18 Alexandre Oliva <aoliva@redhat.com>
3236 * cp-tree.h (struct tinst_level): Split decl into tldcl and
3237 targs. Add private split_list_p, tree_list_p, and not_list_p
3238 inline const predicates; to_list private member function
3239 declaration; free public member function declaration; list_p,
3240 get_node and maybe_get_node accessors, and refcount data
3241 member. Narrow errors to unsigned short.
3242 * error.c (print_instantiation_full_context): Use new
3244 (print_instantiation_partial_context_line): Likewise. Drop
3245 const from tinst_level-typed parameter.
3246 * mangle.c (mangle_decl_string): Likewise.
3247 * pt.c (freelist): New template class.
3248 (tree_list_freelist_head): New var.
3249 (tree_list_freelist): New fn, along with specializations.
3250 (tinst_level_freelist_head): New var.
3251 (pending_template_freelist_head): Likewise.
3252 (tinst_level_freelist, pending_template_freelist): New fns.
3253 (tinst_level::to_list, tinst_level::free): Define.
3254 (inc_refcount_use, dec_refcount_use): New fns for tinst_level.
3255 (set_refcount_ptr): New template fn.
3256 (add_pending_template): Adjust for refcounting, freelists and
3258 (neglectable_inst_p): Take a NULL d as a non-DECL.
3259 (limit_bad_template_recursion): Use new accessors.
3260 (push_tinst_level): New overload to create the list.
3261 (push_tinst_level_loc): Make it static, split decl into two
3262 args, adjust tests and initialization to cope with split
3263 lists, use freelist, adjust for refcounting.
3264 (push_tinst_level_loc): New wrapper with the old interface.
3265 (pop_tinst_level): Adjust for refcounting.
3266 (record_last_problematic_instantiation): Likewise.
3267 (reopen_tinst_level): Likewise. Use new accessors.
3268 (instantiate_alias_template): Adjust for split list.
3269 (fn_type_unification): Likewise.
3270 (get_partial_spec_bindings): Likewise.
3271 (instantiate_pending_templates): Use new accessors. Adjust
3272 for refcount. Release pending_template to freelist.
3273 (instantiating_current_function_p): Use new accessors.
3275 2018-04-16 Alexandre Oliva <aoliva@redhat.com>
3278 * parser.c (cp_parser_builtin_offset): Reject type definitions.
3279 * mangle.c (nested_anon_class_index): Avoid crash returning -1
3280 if we've seen errors.
3282 2018-04-12 David Malcolm <dmalcolm@redhat.com>
3285 * name-lookup.c (macro_use_before_def::maybe_make): New function,
3286 checking that the use is indeed before the definition.
3287 (macro_use_before_def::macro_use_before_def): Make private.
3288 (macro_use_before_def::~macro_use_before_def): Make private. Move
3289 check for UNKNOWN_LOCATION to macro_use_before_def::maybe_make.
3290 (lookup_name_fuzzy): Call macro_use_before_def::maybe_make rather
3291 than using new directly.
3293 2018-04-12 Jason Merrill <jason@redhat.com>
3295 PR c++/85356 - ICE with pointer to member function.
3296 * pt.c (maybe_instantiate_noexcept): Do instantiate in templates if
3297 flag_noexcept_type. Build the new spec within the function context.
3298 * except.c (build_noexcept_spec): Do get constant value in templates
3299 if flag_noexcept_type.
3300 * decl.c (check_redeclaration_exception_specification): Don't
3301 instantiate noexcept on a dependent declaration.
3303 2018-04-12 Marek Polacek <polacek@redhat.com>
3306 * constexpr.c (reduced_constant_expression_p): Return false for null
3309 2018-04-11 Marek Polacek <polacek@redhat.com>
3312 * constexpr.c (potential_constant_expression_1): Consider conversions
3313 from classes to literal types potentially constant.
3315 2018-04-10 Paolo Carlini <paolo.carlini@oracle.com>
3318 * init.c (build_zero_init_1): Handle NULLPTR_TYPE_P being true of
3319 the type like TYPE_PTR_OR_PTRMEM_P.
3321 2018-04-10 Jason Merrill <jason@redhat.com>
3323 PR debug/65821 - wrong location for main().
3324 * call.c (clear_location_r, convert_default_arg): Revert.
3325 * tree.c (break_out_target_exprs): Add clear_location parm.
3326 (struct bot_data): New.
3327 (bot_manip): Clear location if requested.
3328 * init.c (get_nsdmi): Pass clear_location.
3330 2018-04-10 David Malcolm <dmalcolm@redhat.com>
3333 * call.c (get_fndecl_argument_location): Make non-static.
3334 * cp-tree.h (get_fndecl_argument_location): New decl.
3335 * typeck.c (convert_for_assignment): When complaining due to
3336 conversions for an argument, show the location of the parameter
3339 2018-04-10 Jakub Jelinek <jakub@redhat.com>
3341 PR c++/85312 - P0962 cleanup
3342 * parser.c (cp_parser_perform_range_for_lookup): Remove unreachable
3345 2018-04-10 Jason Merrill <jason@redhat.com>
3347 PR debug/65821 - wrong location for main().
3348 * call.c (clear_location_r): New.
3349 (convert_default_arg): Use it.
3350 * tree.c (bot_manip): Remove builtin_LINE/FILE handling.
3352 PR c++/85285 - ICE with flexible array after substitution.
3353 * pt.c (instantiate_class_template_1): Check for flexible array in
3356 2018-04-09 Paolo Carlini <paolo.carlini@oracle.com>
3359 * decl.c (cp_finish_decomp): In a template, if the type is incomplete
3360 issue a pedwarn and defer trying to do bindings.
3362 2018-04-09 Jason Merrill <jason@redhat.com>
3364 PR c++/85279 - dump_expr doesn't understand decltype.
3365 * error.c (dump_expr): Handle DECLTYPE_TYPE.
3367 PR c++/85262 - ICE with redundant qualification on constructor.
3368 * call.c (build_new_method_call_1): Move make_args_non_dependent
3369 after A::A() handling.
3371 PR c++/85277 - ICE with invalid offsetof.
3372 * semantics.c (finish_offsetof): Avoid passing non-DECL to %qD.
3373 Adjust -Winvalid-offsetof diagnostic to say conditionally supported.
3375 PR c++/85264 - ICE with excess template-parameter-list.
3376 * parser.c (cp_parser_check_template_parameters): Add template_id_p
3377 parameter. Don't allow an extra template header if true.
3378 (cp_parser_class_head): Pass template_id_p.
3379 (cp_parser_elaborated_type_specifier): Likewise.
3380 (cp_parser_alias_declaration): Likewise.
3381 (cp_parser_check_declarator_template_parameters): Likewise.
3383 2018-04-09 Jakub Jelinek <jakub@redhat.com>
3386 * parser.c (cp_parser_simple_declaration): For structured bindings,
3387 if *maybe_range_for_decl is NULL after parsing it, set it to
3390 2018-04-09 Jason Merrill <jason@redhat.com>
3392 PR c++/85256 - ICE capturing pointer to VLA.
3393 * lambda.c (add_capture): Distinguish between variable-size and
3394 variably-modified types.
3396 2018-04-06 Jason Merrill <jason@redhat.com>
3398 PR c++/85214 - ICE with alias, generic lambda, constexpr if.
3399 * pt.c (extract_locals_r): Remember local typedefs.
3401 2018-04-06 David Malcolm <dmalcolm@redhat.com>
3404 * name-lookup.c (struct std_name_hint): Move out of
3405 get_std_name_hint; add field "min_dialect".
3406 (get_std_name_hint): Add min_dialect values to all initializers.
3407 Add <any>, <atomic>, <bitset>, <condition_variable>, <functional>,
3408 <future>, <istream>, <iterator>, <ostream>, <mutex>, <optional>,
3409 <shared_mutex>, <string_view>, <thread>, and <variant>.
3410 Add fstream, ifstream, and ofstream to <fstream>.
3411 Add istringstream, ostringstream, and stringstream to <sstream>.
3412 Add basic_string to <string>.
3413 Add tuple_element and tuple_size to <tuple>.
3414 Add declval to <utility>.
3415 Fix ordering of <queue> and <tuple>.
3416 Return a std_name_hint, rather than a const char *.
3417 (get_cxx_dialect_name): New function.
3418 (maybe_suggest_missing_std_header): Detect names that aren't yet
3419 available in the current dialect, and instead of suggesting a
3420 missing #include, warn about the dialect.
3422 2018-04-06 Jakub Jelinek <jakub@redhat.com>
3425 * pt.c (tsubst_decomp_names): Return error_mark_node and assert
3426 errorcount is set if tsubst doesn't return a VAR_DECL.
3428 2018-04-06 David Malcolm <dmalcolm@redhat.com>
3431 * name-lookup.c (using_directives_contain_std_p): New function.
3432 (has_using_namespace_std_directive_p): New function.
3433 (suggest_alternatives_for): Simplify if/else logic using early
3434 returns. If no candidates were found, and there's a
3435 "using namespace std;" directive, call
3436 maybe_suggest_missing_std_header.
3437 (maybe_suggest_missing_header): Split later part of the function
3439 (maybe_suggest_missing_std_header): New.
3441 2018-04-06 Jason Merrill <jason@redhat.com>
3443 PR c++/85242 - ICE with class definition in template parm.
3444 * cp-tree.h (PROCESSING_REAL_TEMPLATE_DECL_P): False if
3445 processing_template_parmlist.
3447 PR c++/85240 - LTO ICE with using of undeduced auto fn.
3448 * cp-gimplify.c (cp_genericize_r): Discard using of undeduced auto.
3450 2018-04-05 Jakub Jelinek <jakub@redhat.com>
3453 * pt.c (tsubst_decomp_names): Don't fail or ICE if DECL_CHAIN (decl3)
3454 is not prev, if prev == decl.
3457 * decl.c (start_decl): For DECL_DECOMPOSITION_P decls, don't call
3458 maybe_apply_pragma_weak here...
3459 (cp_maybe_mangle_decomp): ... but call it here instead.
3461 2018-04-05 Jason Merrill <jason@redhat.com>
3463 PR c++/85136 - ICE with designated init in template.
3464 * decl.c (maybe_deduce_size_from_array_init): Handle dependent
3465 designated initializer.
3466 (check_array_designated_initializer): Update ce->index with the
3469 PR c++/83808 - ICE with VLA initialization.
3470 * typeck2.c (process_init_constructor_array): Don't require a VLA
3471 initializer to have VLA type.
3473 2018-04-05 Paolo Carlini <paolo.carlini@oracle.com>
3476 * call.c (convert_like_real): Fail gracefully for a broken
3477 std::initializer_list, missing a definition.
3479 * name-lookup.c (do_pushtag): Tweak message, use %< and %>.
3481 2018-04-05 Paolo Carlini <paolo.carlini@oracle.com>
3484 * decl.c (grokdeclarator): Fix diagnostic about typedef name used
3485 as nested-name-specifier, keep type and TREE_TYPE (decl) in sync.
3487 2018-04-05 Jason Merrill <jason@redhat.com>
3489 PR c++/82152 - ICE with class deduction and inherited ctor.
3490 * pt.c (do_class_deduction): Ignore inherited ctors.
3492 PR c++/84665 - ICE with array of empty class.
3493 * decl2.c (cp_check_const_attributes): Use fold_non_dependent_expr.
3495 PR c++/85228 - ICE with lambda in enumerator in template.
3496 * pt.c (bt_instantiate_type_proc): Don't assume
3497 CLASSTYPE_TEMPLATE_INFO is non-null.
3499 2018-04-05 Ville Voutilainen <ville.voutilainen@gmail.com>
3502 * decl.c (find_decomp_class_base): Check accessibility instead
3503 of declared access, adjust diagnostic.
3505 2018-04-05 Ville Voutilainen <ville.voutilainen@gmail.com>
3508 * decl.c (get_tuple_decomp_init): Check the templatedness
3511 2018-04-05 Jason Merrill <jason@redhat.com>
3513 PR c++/85200 - ICE with constexpr if in generic lambda.
3514 * pt.c (extract_locals_r): Don't record the local specs of variables
3515 declared within the pattern.
3517 2018-04-05 Alexandre Oliva <aoliva@redhat.com>
3520 * pt.c (check_auto_in_tmpl_args): New.
3521 (tsubst_qualified_id): Use it to reject template args
3522 referencing auto for non-type templates.
3523 * parser.c (cp_parser_template_id): Likewise.
3524 * cp-tree.h (check_auto_in_tmpl_args): Declare.
3525 * typeck2.c (build_functional_cast): Report correct location
3526 for invalid use of auto.
3528 2018-04-04 Jason Merrill <jason@redhat.com>
3530 PR c++/85215 - ICE with copy-init from conversion.
3531 * call.c (merge_conversion_sequences): Fix type of direct binding
3534 PR c++/84938 - ICE with division by ~-1.
3535 * call.c (set_up_extended_ref_temp): Call cp_fully_fold.
3537 PR c++/84936 - ICE with unexpanded pack in mem-initializer.
3538 * parser.c (cp_parser_mem_initializer_list): Call
3539 check_for_bare_parameter_packs.
3541 2018-04-04 Jakub Jelinek <jakub@redhat.com>
3544 * constexpr.c (cxx_eval_builtin_function_call): For calls to
3545 builtin_valid_in_constant_expr_p functions, don't call
3546 cxx_eval_constant_expression if argument is not
3547 potential_constant_expression.
3550 * cp-tree.h (calculate_bases, calculate_direct_bases): Add complain
3552 * semantics.c (calculate_bases): Add complain argument. Use
3553 complete_type_or_maybe_complain instead of just complete_type and
3554 return an empty vector if it fails. Move make_tree_vector () call
3555 after early return. Formatting fixes.
3556 (calculate_direct_bases): Likewise. Call release_tree_vector at the
3558 (dfs_calculate_bases_post, calculate_bases_helper): Formatting fixes.
3559 * pt.c (tsubst_pack_expansion): Adjust calculate_bases and
3560 calculate_direct_bases callers, formatting fixes.
3562 2018-04-04 Jason Merrill <jason@redhat.com>
3564 PR c++/85006 - -fconcepts ICE with A<auto...> return type
3565 * pt.c (tsubst_pack_expansion): Allow unsubstituted auto pack.
3567 PR c++/85200 - ICE with constexpr if in generic lambda.
3568 * tree.c (cp_walk_subtrees): Walk into DECL_EXPR in templates.
3570 PR c++/84221 - bogus -Wunused with attribute and template.
3571 * decl2.c (is_late_template_attribute): Handle unused and used
3572 normally on non-TYPE_DECL.
3574 PR c++/85135 - ICE with omitted template arguments.
3575 * decl.c (grokdeclarator): Catch deduced class type in trailing
3578 PR c++/85133 - ICE with missing concept initializer.
3579 * decl.c (cp_finish_decl): If a concept initializer is missing, use
3582 PR c++/85118 - wrong error with generic lambda and std::bind.
3583 * call.c (add_template_conv_candidate): Disable if there are any
3586 PR c++/85141 - ICE with compound assignment and static member fn.
3587 * typeck.c (cp_build_modify_expr): Call decay_conversion for RHS of
3588 compound assignment.
3590 PR c++/85148 - ICE with 'this' in array NSDMI.
3591 * tree.c (replace_placeholders_r): Use handled_component_p.
3593 2018-04-04 Ville Voutilainen <ville.voutilainen@gmail.com>
3596 * decl.c (grokfndecl): Handle standard UDL diagnostics here..
3597 * parser.c (cp_parser_unqualified_id): ..not here.
3599 2018-04-04 Alexandre Oliva <aoliva@redhat.com>
3602 * typeck.c (cp_build_addr_expr_1): Mark FUNCTION_DECL as
3604 * decl2.c (mark_used): Return without effects if tf_conv.
3606 2018-04-03 Jason Merrill <jason@redhat.com>
3608 PR c++/85092 - C++17 ICE with unused list constructor.
3609 * call.c (conv_binds_ref_to_prvalue): Also count ck_identity
3612 PR c++/85113 - ICE with constexpr and __builtin_constant_p.
3613 * constexpr.c (cxx_eval_builtin_function_call): Only defer
3614 __builtin_constant_p if ctx->quiet.
3616 2018-04-03 Paolo Carlini <paolo.carlini@oracle.com>
3619 * pt.c (rewrite_template_parm): If the first argument is
3620 error_mark_node return it immediately.
3621 (build_deduction_guide): Check the return value of the
3622 latter for error_mark_node.
3623 (do_class_deduction): Check the return value of the latter.
3625 2018-04-03 Jason Merrill <jason@redhat.com>
3627 * semantics.c (finish_if_stmt_cond): Use
3628 instantiation_dependent_expression_p.
3630 PR c++/85149 - generic lambda and constexpr if.
3631 * pt.c (build_extra_args, add_extra_args): Split from
3632 tsubst_pack_expansion.
3633 (tsubst_expr) [IF_STMT]: Use them.
3634 * cp-tree.h (IF_STMT_EXTRA_ARGS): New.
3636 * typeck.c (merge_types): Limit matching attribute shortcut to
3639 2018-04-03 Jakub Jelinek <jakub@redhat.com>
3642 * pt.c (fixed_parameter_pack_p_1): Punt if parm is error_mark_node.
3645 * name-lookup.c (handle_namespace_attrs): Return early if attributes
3649 * decl.c (cp_finish_decl): If ensure_literal_type_for_constexpr_object
3650 fails, after clearing DECL_DECLARED_CONSTEXPR_P don't return early,
3651 instead for static data members clear init and set DECL_EXTERNAL.
3653 2018-04-02 Jason Merrill <jason@redhat.com>
3655 PR c++/64095 - auto... parameter pack.
3656 * parser.c (cp_parser_parameter_declaration): Handle turning autos
3658 (cp_parser_parameter_declaration_list): Not here.
3660 2018-03-31 Alexandre Oliva <aoliva@redhat.com>
3663 * class.c (instantiate_type): Peel off SAVE_EXPR before
3666 2018-03-30 Jason Merrill <jason@redhat.com>
3668 * typeck2.c (process_init_constructor_record): Use
3669 init_list_type_node for the CONSTRUCTOR around an anonymous union
3670 designated initializer.
3672 2018-03-30 Jakub Jelinek <jakub@redhat.com>
3675 * semantics.c (finish_omp_reduction_clause): If
3676 OMP_CLAUSE_REDUCTION_PLACEHOLDER is error_mark_node, return true
3677 even if processing_template_decl.
3679 2018-03-29 David Malcolm <dmalcolm@redhat.com>
3682 * name-lookup.c (get_std_name_hint): Add names from <memory>,
3683 <tuple>, and <utility>.
3685 2018-03-29 Jason Merrill <jason@redhat.com>
3687 PR c++/85093 - too many template args with pack expansion.
3688 * pt.c (coerce_template_parms): Keep pack expansion args that will
3691 2018-03-29 Jason Merrill <jason@redhat.com>
3693 * pt.c (build_non_dependent_expr): Propagate expr location.
3695 2018-03-27 Jason Merrill <jason@redhat.com>
3697 PR c++/85060 - wrong-code with call to base member in template.
3698 * search.c (any_dependent_bases_p): Check uses_template_parms
3699 rather than processing_template_decl.
3701 2018-03-29 David Malcolm <dmalcolm@redhat.com>
3704 * typeck.c (convert_for_assignment): When complaining due to
3705 conversions for an argument, attempt to use the location of the
3708 2018-03-28 Paolo Carlini <paolo.carlini@oracle.com>
3711 * pt.c (tsubst_default_argument): Early return if the type of the
3712 parameter is erroneous.
3714 2018-03-28 Alexandre Oliva <aoliva@redhat.com>
3717 * decl2.c (note_vague_linkage_fn): Don't defer uninstantiated
3721 * tree.c (strip_typedefs_expr): Reject STATEMENT_LISTs.
3723 2018-03-27 Paolo Carlini <paolo.carlini@oracle.com>
3726 * method.c (defaulted_late_check): Partially revert r253321 changes,
3727 do not early return upon error.
3729 2018-03-27 Jakub Jelinek <jakub@redhat.com>
3732 * cp-gimplify.c (cp_fold) <case CONSTRUCTOR>: For ctors with vector
3733 type call fold to generate VECTOR_CSTs when possible.
3736 * tree.c (cp_build_reference_type): If to_type is error_mark_node,
3737 return it right away.
3739 2018-03-27 Volker Reichelt <v.reichelt@netcologne.de>
3741 * search.c (check_final_overrider): Use inform instead of error
3742 for the diagnostics of the overridden functions. Tweak wording.
3744 2018-03-27 Jakub Jelinek <jakub@redhat.com>
3747 * class.c (update_vtable_entry_for_fn): Don't ICE if base_binfo
3748 is NULL. Assert if thunk_binfo is NULL then errorcount is non-zero.
3750 2018-03-27 Paolo Carlini <paolo.carlini@oracle.com>
3751 Jason Merrill <jason@redhat.com>
3754 * init.c (build_aggr_init): When initializing from array,
3755 reject anything but CONSTRUCTORs and TARGET_EXPRs.
3756 (build_vec_init): Handle separately ARRAY_TYPEs.
3758 2018-03-26 Jason Merrill <jason@redhat.com>
3760 PR c++/85062 - ICE with alignas in wrong place.
3761 * decl.c (grokdeclarator): Ignore attributes on type-specifiers
3764 PR c++/85049 - ICE with __integer_pack.
3765 * pt.c (unify_pack_expansion): Don't try to deduce generated packs.
3766 * cp-tree.h (TEMPLATE_PARM_P): New.
3768 2018-03-23 Jason Merrill <jason@redhat.com>
3770 PR c++/78489 - wrong SFINAE behavior.
3773 * pt.c (type_unification_real): Don't defer substitution failure.
3775 2018-03-23 Jakub Jelinek <jakub@redhat.com>
3778 * decl.c (compute_array_index_type): Set osize to mark_rvalue_use
3782 * pt.c (tsubst_copy_and_build) <case FIX_TRUNC_EXPR>: Replace
3783 cp_build_unary_op call with gcc_unreachable ().
3785 2018-03-23 Marek Polacek <polacek@redhat.com>
3788 * cxx-pretty-print.c (cxx_pretty_printer::multiplicative_expression):
3789 Handle EXACT_DIV_EXPR and RDIV_EXPR. Tweak condition.
3790 (cxx_pretty_printer::expression): Handle EXACT_DIV_EXPR and RDIV_EXPR.
3792 2018-03-23 Ville Voutilainen <ville.voutilainen@gmail.com>
3795 * parser.c (cp_parser_perform_range_for_lookup): Change
3796 the condition for deciding whether to use members.
3798 2018-03-23 Marek Polacek <polacek@redhat.com>
3801 * semantics.c (finish_offsetof): Don't allow CONST_DECLs.
3803 2018-03-23 Alexandre Oliva <aoliva@redhat.com>
3806 * parser.c (cp_parser_alias_declaration): Call
3807 parser_check_template_parameters.
3810 * pt.c (resolve_typename_type): Drop assert that stopped
3811 simplification to template-independent types. Add assert to
3812 verify the initial scope is template dependent.
3813 * parser.c (cp_parser_parse_and_diagnose_invalid_type_name):
3814 Reparse the id expression as a type-name, not a declarator.
3817 * init.c (build_vec_init): Error at parenthesized array init.
3822 * cp-tree.h (temp_override): New template class, generalizing
3823 a cleanup that was only used...
3824 * parser.c (cp_parser_parameter_declaration_clause):
3825 ... here for auto_is_implicit_function_template_parm_p.
3826 (cp_parser_gnu_attributes_opt): Use it here as well.
3827 (cp_parser_std_attribute): Likewise.
3829 2018-03-22 Marek Polacek <polacek@redhat.com>
3832 * semantics.c (finish_if_stmt_cond): Check if the type of the condition
3835 2018-03-21 Jason Merrill <jason@redhat.com>
3837 PR c++/81311 - wrong C++17 overload resolution.
3838 * call.c (build_user_type_conversion_1): Remove C++17 code.
3839 (conv_binds_ref_to_prvalue): New.
3840 (build_over_call): Handle C++17 copy elision.
3841 (build_special_member_call): Only do C++17 copy elision here if the
3842 argument is already the right type.
3844 2018-03-21 Alexandre Oliva <aoliva@redhat.com>
3847 * init.c (build_vec_init): Silence error, former sorry,
3852 * parser.c (abort_fully_implicit_template_p): New.
3853 (cp_parser_skip_to_end_of_statement): Use it.
3854 (cp_parser_skip_to_end_of_block_or_statement): Likewise.
3855 (finish_fully_implicit_template_p): Clear
3856 implicit_template_parms and implicit_template_scope.
3858 2018-03-21 Paolo Carlini <paolo.carlini@oracle.com>
3861 * decl.c (maybe_deduce_size_from_array_init): Set TREE_TYPE to
3862 error_mark_node when check_array_designated_initializer fails.
3864 2018-03-21 Jakub Jelinek <jakub@redhat.com>
3867 * cp-tree.h (genericize_compound_lvalue): Declare.
3868 * typeck.c (genericize_compound_lvalue): New function.
3869 (unary_complex_lvalue, cp_build_modify_expr): Use it.
3870 * semantics.c (finish_asm_stmt): Replace MODIFY_EXPR, PREINCREMENT_EXPR
3871 and PREDECREMENT_EXPR in output and "m" constrained input operands with
3872 COMPOUND_EXPR. Call cxx_mark_addressable on the rightmost
3873 COMPOUND_EXPR operand.
3875 2018-03-21 Nathan Sidwell <nathan@acm.org>
3878 * tree.c (decl_linkage): Use DECL_CLONED_FUNCTION_P.
3879 * decl2.c (vague_linkage_p): Likewise.
3881 2018-03-21 David Malcolm <dmalcolm@redhat.com>
3884 * constexpr.c (constexpr_fn_retval): Make non-"static".
3885 * cp-tree.h (constexpr_fn_retval): New decl.
3886 * search.c (direct_accessor_p): Update leading comment.
3887 (reference_accessor_p): Likewise.
3888 (field_accessor_p): Replace check that function body is a
3889 RETURN_EXPR with a call to constexpr_fn_retval. Fix
3890 indentation of "field_type" decl.
3892 2018-03-21 Nathan Sidwell <nathan@acm.org>
3895 * name-lookup.c (do_pushtag): Permit lambdas to be pushed into
3898 2018-03-21 Martin Sebor <msebor@redhat.com>
3901 * call.c (first_non_public_field): New template and function.
3902 (first_non_trivial_field): New function.
3903 (maybe_warn_class_memaccess): Call them.
3905 2018-03-21 David Malcolm <dmalcolm@redhat.com>
3908 * search.c (field_accessor_p): Use class_of_this_parm rather than
3909 type_of_this_parm, to check that "this" is a "const T *", rather
3912 2018-03-21 Nathan Sidwell <nathan@acm.org>
3914 * class.c (finish_struct_anon_r): Refactor, deprecate anything
3915 other than public non-static data members.
3916 * parser.c (cp_parser_init_declarator): Deprecate attributes after
3917 parenthesized initializer.
3920 * name-lookup.c (update_binding): Correct logic for local binding
3923 2018-03-21 Marek Polacek <polacek@redhat.com>
3925 PR c++/71638, ICE with NSDMI and reference.
3926 * constexpr.c (cxx_eval_bare_aggregate): Update constructor's flags
3927 even when we replace an element.
3929 2018-03-20 Marek Polacek <polacek@redhat.com>
3931 PR c++/84978, ICE with NRVO.
3932 * constexpr.c (cxx_eval_constant_expression): Handle the case when
3933 a RESULT_DECL isn't in the hash map.
3935 2018-03-20 Jason Merrill <jason@redhat.com>
3937 PR c++/84978, ICE with NRVO.
3938 * cvt.c (cp_get_fndecl_from_callee): Add fold parameter.
3939 (cp_get_callee_fndecl_nofold): New.
3940 * cp-gimplify.c (cp_genericize_r): Use it instead.
3941 * call.c (check_self_delegation): Likewise.
3943 2018-03-20 Nathan Sidwell <nathan@acm.org>
3946 * name-lookup.c (pushdecl_class_level): Push anon-struct's
3947 member_vec, if there is one.
3950 * cp-tree.h (lookup_list_keep): Declare.
3951 * tree.c (lookup_list_keep): New, broken out of ...
3952 (build_min): ... here. Call it.
3953 * decl.c (cp_finish_decl): Call lookup_list_keep.
3955 2018-03-19 Jason Merrill <jason@redhat.com>
3957 PR c++/84937 - ICE with class deduction and auto.
3958 * pt.c (rewrite_template_parm): Fix auto handling.
3960 2018-03-19 Marek Polacek <polacek@redhat.com>
3963 * pt.c (enclosing_instantiation_of): Check if fn is null.
3966 * constexpr.c (cxx_eval_bare_aggregate): Update constructor's flags
3967 as we evaluate the elements.
3968 (cxx_eval_constant_expression): Verify constructor's flags
3971 2018-03-19 Jason Merrill <jason@redhat.com>
3973 PR c++/71834 - template-id with too few arguments.
3974 * pt.c (coerce_template_parms): Check fixed_parameter_pack_p.
3976 2018-03-19 Nathan Sidwell <nathan@acm.org>
3979 * lambda.c (maybe_add_lambda_conv_op): Force C++ linkage.
3980 * pt.c (build_template_decl): Propagate language linkage.
3983 * name-lookup.c (set_local_extern_decl_linkage): Defend against
3986 2018-03-16 Jakub Jelinek <jakub@redhat.com>
3989 * parser.c (cp_parser_lambda_introducer): Remove trailing space from
3991 * method.c (synthesize_method): Likewise.
3992 * pt.c (convert_nontype_argument): Likewise.
3994 2018-03-16 Jason Merrill <jason@redhat.com>
3996 PR c++/84720 - ICE with rvalue ref non-type argument.
3997 * pt.c (invalid_nontype_parm_type_p): Prohibit rvalue reference.
3998 (convert_nontype_argument): Revert earlier change.
4000 PR c++/80227 - SFINAE and negative array size.
4001 * decl.c (compute_array_index_type): Use
4002 build_converted_constant_expr and valid_constant_size_p.
4004 PR c++/84906 - silent wrong code with ambiguous conversion.
4005 * call.c (build_user_type_conversion_1): Set need_temporary_p on
4006 ambiguous conversion.
4007 (convert_like_real): Check it.
4009 PR c++/83937 - wrong C++17 handling of init-list ctor argument.
4010 * call.c (build_special_member_call): Don't convert an init-list
4011 argument directly to the class type.
4013 2018-03-16 Jakub Jelinek <jakub@redhat.com>
4017 * cp-tree.h (CONSTRUCTOR_PLACEHOLDER_BOUNDARY): Define.
4018 (find_placeholder): Declare.
4019 * tree.c (struct replace_placeholders_t): Add exp member.
4020 (replace_placeholders_r): Don't walk into ctors with
4021 CONSTRUCTOR_PLACEHOLDER_BOUNDARY flag set, unless they are equal to
4022 d->exp. Replace PLACEHOLDER_EXPR with unshare_expr (x) rather than x.
4023 (replace_placeholders): Initialize data.exp.
4024 (find_placeholders_r, find_placeholders): New functions.
4025 * typeck2.c (process_init_constructor_record,
4026 process_init_constructor_union): Set CONSTRUCTOR_PLACEHOLDER_BOUNDARY
4027 if adding NSDMI on which find_placeholder returns true.
4028 * call.c (build_over_call): Don't call replace_placeholders here.
4029 * cp-gimplify.c (cp_genericize_r): Set TARGET_EXPR_NO_ELIDE on
4030 TARGET_EXPRs with CONSTRUCTOR_PLACEHOLDER_BOUNDARY set on
4031 TARGET_EXPR_INITIAL.
4032 (cp_fold): Copy over CONSTRUCTOR_PLACEHOLDER_BOUNDARY bit to new
4035 2018-03-16 Jason Merrill <jason@redhat.com>
4037 PR c++/83911 - ICE with multiversioned constructor.
4038 * cp-gimplify.c (cp_genericize_r): Replace versioned function with
4040 * call.c (build_over_call): Not here.
4042 2018-03-16 Jakub Jelinek <jakub@redhat.com>
4045 * decl.c (reshape_init_class): Don't assert d->cur->index == field
4046 if d->cur->index is a FIELD_DECL, instead set field to d->cur->index.
4048 2018-03-15 Jakub Jelinek <jakub@redhat.com>
4051 * cp-tree.h (cp_warn_deprecated_use): Declare.
4052 * tree.c (cp_warn_deprecated_use): New function.
4053 * typeck2.c (build_functional_cast): Use it.
4054 * decl.c (grokparms): Likewise.
4055 (grokdeclarator): Likewise. Temporarily push nested class scope
4056 around grokparms call for out of class member definitions.
4058 2018-03-14 Jason Merrill <jason@redhat.com>
4060 PR c++/84820 - no error for invalid qualified-id.
4061 * parser.c (cp_parser_make_indirect_declarator): Don't wrap
4062 cp_error_declarator.
4064 PR c++/84801 - ICE with unexpanded pack in lambda.
4065 * pt.c (check_for_bare_parameter_packs): Don't return early for a
4066 lambda in non-template context.
4068 PR c++/81236 - auto variable and auto function
4069 * pt.c (tsubst_baselink): Update the type of the BASELINK after
4072 2018-03-14 Jason Merrill <jason@redhat.com>
4074 PR c++/83916 - ICE with template template parameters.
4075 * pt.c (convert_template_argument): Don't substitute into type of
4076 non-type parameter if we don't have enough arg levels.
4079 2018-03-14 Marek Polacek <polacek@redhat.com>
4082 * semantics.c (finish_static_assert): Check
4083 instantiation_dependent_expression_p instead of
4084 {type,value}_dependent_expression_p.
4086 2018-03-13 Paolo Carlini <paolo.carlini@oracle.com>
4087 Jason Merrill <jason@redhat.com>
4089 PR c++/82336 - link error with list-init default argument.
4090 * decl.c (check_default_argument): Unshare an initializer list.
4092 2018-03-13 Jakub Jelinek <jakub@redhat.com>
4095 * decl.c (duplicate_decls): For redefinition of built-in, use error
4096 and return error_mark_node. For redeclaration, return error_mark_node
4097 rather than olddecl if !flag_permissive.
4099 2018-03-13 Jason Merrill <jason@redhat.com>
4101 PR c++/82565 - ICE with concepts and generic lambda.
4102 * pt.c (instantiate_decl): Clear fn_context for lambdas.
4104 2018-03-13 Jason Merrill <jason@redhat.com>
4106 PR c++/84720 - ICE with rvalue ref non-type argument.
4107 * pt.c (convert_nontype_argument): Handle rvalue references.
4109 PR c++/84839 - ICE with decltype of parameter pack.
4110 * pt.c (tsubst_pack_expansion): Set cp_unevaluated_operand while
4111 instantiating dummy parms.
4113 * parser.c (cp_parser_simple_type_specifier): Pedwarn about auto
4114 parameter even without -Wpedantic.
4116 PR c++/84798 - ICE with auto in abstract function declarator.
4117 * parser.c (cp_parser_parameter_declaration_clause): Check
4118 parser->default_arg_ok_p.
4120 2018-03-13 Jakub Jelinek <jakub@redhat.com>
4123 * constexpr.c (find_array_ctor_elt): Don't use elt reference after
4124 first potential CONSTRUCTOR_ELTS reallocation. Convert dindex to
4125 sizetype. Formatting fixes.
4127 2018-03-12 Jason Merrill <jason@redhat.com>
4129 PR c++/84355 - ICE with deduction for member class template.
4130 * pt.c (tsubst) [TEMPLATE_TYPE_PARM]: Always substitute into
4131 CLASS_PLACEHOLDER_TEMPLATE.
4133 PR c++/84802 - ICE capturing uninstantiated class.
4134 * lambda.c (build_capture_proxy): Call complete_type.
4136 2018-03-09 Jason Merrill <jason@redhat.com>
4138 PR c++/84770 - ICE with typedef and parameter pack.
4139 * pt.c (verify_unstripped_args_1): Split out from
4140 verify_unstripped_args.
4142 PR c++/84785 - ICE with alias template and default targs.
4143 * pt.c (type_unification_real): Set processing_template_decl if
4146 PR c++/84752 - ICE with capture of constexpr array.
4147 * call.c (standard_conversion): Set rvaluedness_matches_p on the
4148 identity conversion under ck_lvalue.
4150 2018-03-09 Jason Merrill <jason@redhat.com>
4151 Paolo Carlini <paolo.carlini@oracle.com>
4155 * pt.c (any_erroneous_template_args_p): New.
4156 * cp-tree.h (any_erroneous_template_args_p): Declare it.
4157 * parser.c (cp_parser_class_specifier_1): Use it.
4159 2018-03-09 Jason Merrill <jason@redhat.com>
4161 PR c++/84726 - unnecessary capture of constant vars.
4162 * cp-tree.h (LAMBDA_CAPTURE_EXPLICIT_P)
4163 (LAMBDA_EXPR_CAPTURE_OPTIMIZED): New.
4164 * expr.c (mark_use): Set LAMBDA_EXPR_CAPTURE_OPTIMIZED.
4165 * lambda.c (is_constant_capture_proxy)
4166 (current_lambda_expr, var_to_maybe_prune, mark_const_cap_r)
4167 (prune_lambda_captures): New.
4168 (finish_lambda_function): Call prune_lambda_captures.
4170 2018-03-09 Jason Merrill <jason@redhat.com>
4171 Jakub Jelinek <jakub@redhat.com>
4174 * call.c (convert_arg_to_ellipsis): Instead of cp_build_addr_expr
4175 build ADDR_EXPR with REFERENCE_TYPE.
4176 (build_over_call): For purposes of check_function_arguments, if
4177 argarray[j] is ADDR_EXPR with REFERENCE_TYPE created above, use
4178 its operand rather than the argument itself.
4180 2018-03-09 Jakub Jelinek <jakub@redhat.com>
4183 * decl.c (duplicate_decls): Don't override __* prefixed builtins
4184 except for __[^b]*_chk, instead issue permerror and for -fpermissive
4185 also a note and return olddecl.
4187 2018-03-09 Nathan Sidwell <nathan@acm.org>
4190 * name-lookup.c (do_pushdecl_with_scope): Only clear
4191 current_function_decl when pushing a non-class (i.e. namespace)
4194 2018-03-08 Jason Merrill <jason@redhat.com>
4195 Jakub Jelinek <jakub@redhat.com>
4198 * call.c (build_over_call): In templates set TREE_USED (first_fn) when
4199 not calling mark_used for the benefit of -Wunused-function warning.
4201 2018-03-06 Jason Merrill <jason@redhat.com>
4203 * lambda.c (is_capture_proxy_with_ref): Remove.
4204 * constexpr.c, expr.c, cp-tree.h, semantics.c: Adjust.
4206 2018-03-06 Marek Polacek <polacek@redhat.com>
4209 * constexpr.c (cxx_bind_parameters_in_call): Unshare evaluated
4212 2018-03-06 Alexandre Oliva <aoliva@redhat.com>
4215 * tree.c (lvalue_kind): Use presence/absence of REFERENCE_TYPE
4216 only while processing template decls.
4217 * typeck.c (build_x_conditional_expr): Move wrapping of
4218 reference type around type...
4219 * call.c (build_conditional_expr_1): ... here. Rename
4220 is_lvalue to is_glvalue.
4221 * parser.c (cp_parser_fold_expression): Catch REFERENCE_REF_P
4222 INDIRECT_REF of COND_EXPR too.
4225 * init.c (build_zero_init_1): Zero-initialize references.
4228 * semantics.c (finish_stmt_expr_expr): Reject unresolved
4229 overloads used as stmt expr values.
4231 2018-03-05 Jason Merrill <jason@redhat.com>
4233 PR c++/84708 - ICE with lambda in local class NSDMI.
4234 * lambda.c (lambda_expr_this_capture): Handle local class NSDMI
4237 2018-03-05 Jakub Jelinek <jakub@redhat.com>
4240 * constexpr.c (constexpr_call_hasher::equal): Return false if
4241 lhs->hash != rhs->hash. Change return 1 to return true and
4242 return 0 to return false.
4244 2018-03-05 Nathan Sidwell <nathan@acm.org>
4247 * pt.c (process_template_arg): Mark lookup_keep on a default arg.
4249 2018-03-05 Marek Polacek <polacek@redhat.com>
4252 * decl.c (duplicate_decls): Check DECL_NAME before accessing
4255 2018-03-05 Nathan Sidwell <nathan@acm.org>
4258 * friend.c (do_friend): Restore check for identifier_p inside
4261 2018-03-05 Paolo Carlini <paolo.carlini@oracle.com>
4264 * parser.c (cp_parser_lambda_introducer): Reject any capture not
4265 involving a VAR_DECL or a PARM_DECL.
4267 2018-03-05 Pádraig Brady <P@draigBrady.com>
4268 Jason Merrill <jason@redhat.com>
4269 Nathan Sidwell <nathan@acm.org>
4272 * decl2.c (get_tls_init_fn): Check TYPE_HAS_TRIVIAL_DFLT too.
4274 2018-03-03 Jason Merrill <jason@redhat.com>
4276 PR c++/84686 - missing volatile loads.
4277 * cvt.c (convert_to_void): Call maybe_undo_parenthesized_ref.
4279 2018-03-03 Paolo Carlini <paolo.carlini@oracle.com>
4282 * optimize.c (maybe_thunk_body): Bail out immediately if either
4283 fns[0] or fns[1] is null.
4285 2018-03-02 Marek Polacek <polacek@redhat.com>
4288 * constexpr.c (get_array_or_vector_nelts): New.
4289 (cxx_eval_array_reference): Use it.
4290 (cxx_eval_vec_init_1): Likewise.
4291 (cxx_eval_store_expression): Likewise.
4293 2018-03-02 Jason Merrill <jason@redhat.com>
4295 * semantics.c (force_paren_expr): Remove redundant test.
4297 2018-03-02 Marek Polacek <polacek@redhat.com>
4300 * decl.c (cp_complete_array_type): Check error_mark_node.
4303 * typeck.c (cp_perform_integral_promotions): Check the result of
4306 2018-03-02 Jakub Jelinek <jakub@redhat.com>
4309 * pt.c (tsubst_copy_and_build) <case TEMPLATE_ID_EXPR>: Use
4310 RETURN instead of return.
4311 <case POINTER_PLUS_EXPR>: Likewise.
4312 <case CONVERT_EXPR>: If op0 is error_mark_node, just return
4313 it instead of wrapping it into CONVERT_EXPR.
4315 2018-03-02 Jason Merrill <jason@redhat.com>
4318 * pt.c (type_dependent_expression_p): Check DECL_LANG_SPECIFIC.
4320 2018-03-02 Marek Polacek <polacek@redhat.com>
4323 * cp-gimplify.c (cp_fully_fold): Unwrap TARGET_EXPR or a CONSTRUCTOR
4324 wrapped in VIEW_CONVERT_EXPR.
4326 2018-03-01 Martin Sebor <msebor@redhat.com>
4329 * decl.c (check_redeclaration_no_default_args): Merge attributes
4330 specified on redeclarations of the same function template.
4333 2018-03-01 Marek Polacek <polacek@redhat.com>
4334 Jason Merrill <jason@redhat.com>
4337 * semantics.c (force_paren_expr): Create a PAREN_EXPR when in
4339 (maybe_undo_parenthesized_ref): Unwrap PAREN_EXPR.
4340 * typeck2.c (store_init_value): Call fold_non_dependent_expr instead
4341 of instantiate_non_dependent_expr.
4342 * tree.c (lvalue_kind): Handle PAREN_EXPR like NON_DEPENDENT_EXPR.
4344 2018-03-01 Nathan Sidwell <nathan@acm.org>
4347 * name-lookup.c (member_vec_dedup): Remove manually peeled
4348 iteration. Ignore dependent ctor inheritance.
4350 2018-03-01 Jason Merrill <jason@redhat.com>
4352 PR c++/71569 - decltype of template.
4353 * parser.c (cp_parser_decltype_expr): Handle missing template args.
4355 2018-03-01 Marek Polacek <polacek@redhat.com>
4358 * constexpr.c (require_rvalue_constant_expression): New function.
4359 * cp-tree.h: Declare it.
4360 * semantics.c (finish_static_assert): Use it instead of
4361 require_potential_rvalue_constant_expression.
4363 2018-03-01 Jason Merrill <jason@redhat.com>
4364 Alexandre Oliva <aoliva@redhat.com>
4366 PR c++/71569 - ICE with redundant args on member variable template.
4367 * decl.c (start_decl): Handle partial specialization of member
4369 * pt.c (determine_specialization): Allow partial specialization
4370 of member variable template without specializing enclosing class.
4371 (process_partial_specialization): Improve error message.
4373 2018-02-28 Jason Merrill <jason@redhat.com>
4375 PR c++/71784 - ICE with ref-qualifier and explicit specialization.
4376 * pt.c (determine_specialization): Check ref-qualifier.
4378 2018-02-28 Jakub Jelinek <jakub@redhat.com>
4381 * parser.c (cp_parser_attributes_opt): Formatting fix.
4382 (cp_parser_skip_balanced_tokens, cp_parser_skip_gnu_attributes_opt,
4383 cp_parser_skip_std_attribute_spec_seq, cp_parser_skip_attributes_opt):
4385 (cp_parser_member_declaration): Use cp_parser_skip_attributes_opt
4386 instead of tentative parse to peek over optional attribute tokens
4387 to check for CPP_COLON after them.
4391 * pt.c (INCLUDE_STRING): Remove define.
4392 (warn_spec_missing_attributes): Use pretty_printer instead of
4393 std::string. Fix up inform call so that the list of attributes
4396 2018-02-28 Martin Sebor <msebor@redhat.com>
4399 * decl.c (duplicate_decls): Fully merge attributes const, pure,
4402 2018-02-28 Nathan Sidwell <nathan@acm.org>
4405 * name-lookup.h (search_anon_aggr): Add defaulted WANT_TYPE arg.
4406 * name-lookup.c (fields_linear_search): Look in an anon-aggr
4407 regardless of want_type.
4408 (search_anon_aggr): Just use get_class_binding_direct.
4410 2018-02-28 Jakub Jelinek <jakub@redhat.com>
4412 * decl.c (cp_finish_decomp): Don't adjust eltscnt when calling
4415 2018-02-27 Martin Sebor <msebor@redhat.com>
4417 * pt.c: Avoid including <string> directly.
4419 2018-02-27 Martin Sebor <msebor@redhat.com>
4423 * cp-tree.h (warn_spec_missing_attributes): New function.
4424 ((check_explicit_specialization): Add an argument. Call the above
4426 * decl.c (duplicate_decls): Avoid applying primary function template's
4427 attributes to its explicit specializations.
4428 cp/pt.c (warn_spec_missing_attributes): Define.
4430 2018-02-27 HÃ¥kon Sandsmark <hsandsmark@gmail.com>
4432 PR c++/71546 - lambda init-capture with qualified-id.
4433 * parser.c (cp_parser_lambda_introducer): Clear scope after
4434 each lambda capture.
4436 2018-02-27 Nathan Sidwell <nathan@acm.org>
4439 * name-lookup.h (get_member_slot): Rename ...
4440 (find_member_slot): ... here.
4441 (add_member_slot): New.
4442 * name-lookup.c (member_vec_linear_search): No need to check for
4444 (get_member_slot): Rename ...
4445 (find_member_slot): ... here. Don't add slot for incomplete class.
4446 (add_member_slot): New.
4447 * class.c (add_method): Adjust get_member_slot rename. Bail out
4448 if push_class_level_binding fails. Create slot and grok
4449 properties once we're committed to insertion.
4451 2018-02-27 Jason Merrill <jason@redhat.com>
4453 PR c++/84489 - dependent default template argument
4454 * pt.c (type_unification_real): Handle early substitution failure.
4456 2018-02-26 Jason Merrill <jason@redhat.com>
4458 PR c++/84560 - ICE capturing multi-dimensional VLA.
4459 * tree.c (array_of_runtime_bound_p): False if the element is
4462 PR c++/84441 - ICE with base initialized from ?:
4463 * call.c (unsafe_copy_elision_p): Handle COND_EXPR.
4465 PR c++/84520 - ICE with generic lambda in NSDMI.
4466 * lambda.c (lambda_expr_this_capture): Don't look for fake NSDMI
4467 'this' in a generic lambda instantiation.
4469 PR c++/84559 - ICE with constexpr VLA.
4470 * constexpr.c (ensure_literal_type_for_constexpr_object): Check
4471 for constexpr variable with VLA type.
4473 2018-02-26 Jakub Jelinek <jakub@redhat.com>
4476 * constexpr.c (cxx_eval_vec_init_1): For reuse, treat NULL eltinit like
4477 a valid constant initializer. Formatting fixes.
4479 2018-02-26 Paolo Carlini <paolo.carlini@oracle.com>
4482 * pt.c (tsubst_attributes): Handle correctly tsubst_attribute
4483 returning NULL_TREE.
4484 (apply_late_template_attributes): Likewise.
4486 2018-02-26 Jakub Jelinek <jakub@redhat.com>
4489 * parser.c (cp_parser_omp_var_list_no_open): Only call
4490 cp_parser_lookup_name_simple on names satisfying identifier_p.
4491 (cp_parser_oacc_routine): Likewise.
4493 2018-02-26 Jason Merrill <jason@redhat.com>
4495 PR c++/84551 - ICE with concepts and -g.
4496 * parser.c (add_debug_begin_stmt): Do nothing in a concept.
4498 2018-02-26 Marek Polacek <polacek@redhat.com>
4501 * tree.c (replace_placeholders_r): Only check TREE_CONSTANT on
4504 2018-02-26 Jason Merrill <jason@redhat.com>
4506 PR c++/84447 - ICE with deleted inherited ctor with default arg.
4507 * call.c (build_over_call): Handle deleted functions in one place.
4509 2018-02-26 Paolo Carlini <paolo.carlini@oracle.com>
4512 * decl.c (redeclaration_error_message): Don't try to use
4513 DECL_DECLARED_CONSTEXPR_P on CONST_DECLs.
4515 2018-02-26 Paolo Carlini <paolo.carlini@oracle.com>
4517 * lambda.c (build_capture_proxy): Define static.
4518 * cp-tree.h (build_capture_proxy): Remove.
4520 2018-02-26 Marek Polacek <polacek@redhat.com>
4523 * name-lookup.c (suggest_alternative_in_explicit_scope): Return false
4524 if name is error node.
4526 2018-02-25 Jason Merrill <jason@redhat.com>
4528 PR c++/84015 - ICE with class deduction and auto template parm.
4529 * pt.c (rewrite_template_parm): Use tf_partial in first tsubst.
4531 2018-02-24 Marek Polacek <polacek@redhat.com>
4534 * constexpr.c (maybe_constant_init_1): New function.
4535 (maybe_constant_init): Make it a wrapper around maybe_constant_init_1.
4536 (cxx_constant_init): New function.
4537 * cp-tree.h (cxx_constant_init): Declare.
4538 * typeck2.c (store_init_value): Call cxx_constant_init instead of
4539 cxx_constant_value. Move the maybe_constant_init call under an 'else'.
4541 2018-02-22 Jason Merrill <jason@redhat.com>
4543 PR c++/70468 - ICE with constructor delegation via typedef.
4544 * pt.c (tsubst_initializer_list): Check for other mem-initializers
4545 with constructor delegation.
4547 2018-02-22 Jason Merrill <jason@redhat.com>
4549 PR c++/84424 - ICE with constexpr and __builtin_shuffle.
4550 * constexpr.c (reduced_constant_expression_p): Handle CONSTRUCTOR of
4553 2018-02-22 Marek Polacek <polacek@redhat.com>
4556 * parser.c (cp_parser_braced_list): Use require_open instead of
4559 2018-02-21 Jason Merrill <jason@redhat.com>
4561 PR c++/84454 - ICE with pack expansion in signature.
4562 * error.c (find_typenames_r): Also stop on EXPR_PACK_EXPANSION.
4564 2018-02-20 Siddhesh Poyarekar <siddhesh@sourceware.org>
4566 * cp-objcp-common.c (cxx_block_may_fallthru): Add case for
4569 2018-02-20 Paolo Carlini <paolo.carlini@oracle.com>
4572 * parser.c (cp_parser_init_declarator): Don't call start_lambda_scope
4575 2018-02-20 Jakub Jelinek <jakub@redhat.com>
4578 * class.c (fixed_type_or_null) <case CALL_EXPR>: Only test
4579 TREE_HAS_CONSTRUCTOR if instance is not an internal function call.
4582 * tree.c (bot_manip): If build_cplus_new or break_out_target_exprs
4583 returns error_mark_node, return it immediately.
4584 (break_out_target_exprs): If cp_walk_tree with bot_manip returns
4585 error_mark_node, return error_mark_node.
4588 * pt.c (tsubst_lambda_expr): If not nested, increment temporarily
4589 function_depth to avoid GC during finish_lambda_function.
4591 2018-02-19 Jason Merrill <jason@redhat.com>
4593 PR c++/84429 - ICE capturing VLA.
4594 * lambda.c (build_capture_proxy): Handle reference refs.
4596 2018-02-19 Jakub Jelinek <jakub@redhat.com>
4599 * parser.c (cp_parser_binary_expression): For no_toplevel_fold_p, if
4600 either operand is error_mark_node, set current.lhs to that instead of
4601 creating a binary op with error_mark_node operands.
4604 * constexpr.c (potential_constant_expression_1): Handle OMP_SIMD.
4606 2018-02-19 Paolo Carlini <paolo.carlini@oracle.com>
4609 * decl.c (grokdeclarator): Early return error_mark_node upon
4610 ill-formed friend declaration.
4612 2018-02-16 Marek Polacek <polacek@redhat.com>
4613 Jakub Jelinek <jakub@redhat.com>
4616 * constexpr.c (cxx_eval_constant_expression) <case RETURN_EXPR>: Don't
4617 set *jump_target to anything if jump_target is NULL.
4619 2018-02-16 Jason Merrill <jason@redhat.com>
4621 PR c++/84151 - unnecessary volatile load with static member.
4622 * call.c (build_new_method_call_1): Avoid loading from a volatile
4623 lvalue used as the object argument for a static member function.
4625 PR c++/81853 - using-directive and constexpr.
4626 * constexpr.c (cxx_eval_constant_expression): Handle USING_STMT.
4628 PR c++/84420 - ICE with structured binding in lambda.
4629 * lambda.c (is_capture_proxy): Check DECL_DECOMPOSITION_P.
4631 PR c++/83835 - C++17 error with constructor ctors.
4632 * call.c (build_special_member_call): Set TARGET_EXPR_DIRECT_INIT_P.
4634 PR c++/82664 - ICE with reference to function template parm.
4635 * pt.c (convert_nontype_argument_function): Avoid obfuscationg
4638 PR c++/82764 - C++17 ICE with empty base
4639 * class.c (build_base_field_1): Set DECL_SIZE to zero for empty base.
4641 2018-02-16 Jason Merrill <jason@redhat.com>
4643 PR c++/84421 - type-dependent if constexpr
4644 * semantics.c (finish_if_stmt_cond): Check type_dependent_expression_p.
4646 2018-02-16 Nathan Sidwell <nathan@acm.org>
4648 Deprecate -ffriend-injection.
4649 * decl.c (cxx_init_decl_processing): Emit warning on option.
4650 * name-lookup.c (do_pushdecl): Emit warning if we push a visible
4653 2018-02-16 Paolo Carlini <paolo.carlini@oracle.com>
4656 * decl.c (check_special_function_return_type): Reject template
4657 template parameter in deduction guide.
4659 2018-02-16 Nathan Sidwell <nathan@acm.org>
4662 * name-lookup.c (do_pushdecl): Bail out on bad local friend injection.
4664 2018-02-15 Jason Merrill <jason@redhat.com>
4666 PR c++/83227 - C++17 ICE with init-list derived-to-base conversion.
4667 * call.c (convert_like_real): Don't use the copy-list-initialization
4668 shortcut for ck_base.
4670 PR c++/84045 - ICE with typedef and noexcept.
4671 * except.c (build_noexcept_spec): Use strip_typedefs_expr.
4673 PR c++/84376 - ICE with omitted template arguments.
4674 * pt.c (dguide_name_p): Check for IDENTIFIER_NODE.
4676 PR c++/84368 - wrong error with local variable in variadic lambda.
4677 * pt.c (tsubst_pack_expansion): Fix handling of non-packs in
4678 local_specializations.
4680 2018-02-15 Paolo Carlini <paolo.carlini@oracle.com>
4683 * constraint.cc (tsubst_constraint_info): Handle an error_mark_node
4686 2018-02-14 Paolo Carlini <paolo.carlini@oracle.com>
4689 * pt.c (do_auto_deduction): Don't check the TREE_TYPE of a null
4692 2018-02-14 Nathan Sidwell <nathan@acm.org>
4694 * decl2.c (mark_vtable_entries): Set input_location to decl's.
4695 (c_parse_final_cleanups): Restore input_location after emitting
4698 2018-02-14 Paolo Carlini <paolo.carlini@oracle.com>
4700 * cp-tree.h (do_auto_deduction (tree, tree, tree)): Remove.
4701 (do_auto_deduction (tree, tree, tree, tsubst_flags_t,
4702 auto_deduction_context, tree, int): Add defaults.
4703 * pt.c (do_auto_deduction (tree, tree, tree)): Remove definition.
4704 (tsubst_omp_for_iterator): Adjust do_auto_deduction call, forward
4705 tsubst_flags_t argument.
4706 * init.c (build_new): Likewise.
4708 2018-02-13 Jakub Jelinek <jakub@redhat.com>
4711 * typeck.c (check_return_expr): Don't emit -Weffc++ warning
4712 about return other than *this in assignment operators if
4713 retval is type dependent expression.
4715 2018-02-13 Paolo Carlini <paolo.carlini@oracle.com>
4718 * call.c (build_conditional_expr_1): Use cp_save_expr instead of
4719 save_expr for the G++ extension.
4721 2018-02-13 Jason Merrill <jason@redhat.com>
4723 PR c++/84080 - ICE with return type deduction and specialization.
4724 * pt.c (determine_specialization): Check uses_template_parms.
4726 Fix more variadic capture issues.
4727 * pt.c (find_parameter_packs_r): Also look at explicit captures.
4728 (check_for_bare_parameter_packs): Check current_class_type for
4730 (extract_locals_r): Handle seeing a full instantiation of a pack.
4731 (tsubst_pack_expansion): Likewise. Force lambda capture.
4732 * parser.c (cp_parser_lambda_introducer): Don't
4733 check_for_bare_parameter_packs.
4735 PR c++/84338 - wrong variadic sizeof.
4736 * pt.c (argument_pack_select_arg): Like the macro, but look through
4738 (tsubst, tsubst_copy, dependent_template_arg_p): Use it.
4739 (extract_fnparm_pack): Do make_pack_expansion.
4740 (extract_locals_r): Do strip a pack expansion.
4741 * cp-tree.h (ARGUMENT_PACK_SELECT_ARG): Remove.
4743 2018-02-12 Jakub Jelinek <jakub@redhat.com>
4746 * parser.c (cp_parser_binary_expression): Use build_min instead of
4747 build2_loc to build the no_toplevel_fold_p toplevel binary expression.
4749 2018-02-12 Nathan Sidwell <nathan@acm.org>
4752 * parser.c (cp_parser_decltype): Push and pop
4753 deferring_access_checks. Reorganize to avoid goto.
4755 2018-02-12 Richard Biener <rguenther@suse.de>
4758 * constexpr.c (cxx_eval_vec_init_1): Use a RANGE_EXPR to compact
4759 uniform constructors and delay allocating them fully.
4761 2018-02-09 Jason Merrill <jason@redhat.com>
4763 PR c++/84036 - ICE with variadic capture.
4764 Handle variadic capture proxies more like non-variadic.
4765 * lambda.c (build_capture_proxy): Remove workaround.
4766 * pt.c (find_parameter_packs_r): The proxy is a pack.
4767 (instantiate_class_template_1): Remove dead lambda code.
4768 (extract_fnparm_pack): Don't make_pack_expansion.
4769 (extract_locals_r): Don't strip a pack expansion.
4770 (tsubst_pack_expansion): Handle proxy packs. Use
4771 PACK_EXPANSION_EXTRA_ARGS less.
4772 (tsubst_decl) [FIELD_DECL]: Don't register_specialization.
4773 (tsubst_copy) [FIELD_DECL]: Don't retrieve*_specialization.
4774 [VAR_DECL]: Handle ARGUMENT_PACK_SELECT.
4775 (tsubst_expr) [DECL_EXPR]: Handle proxy packs.
4776 (tsubst_copy_and_build) [VAR_DECL]: Handle proxy packs normally.
4778 2018-02-10 Jakub Jelinek <jakub@redhat.com>
4781 * tree.c (cp_free_lang_data): Revert 2018-01-23 change.
4783 2018-02-09 Jason Merrill <jason@redhat.com>
4785 PR c++/81917 - ICE with void_t and partial specialization.
4786 * pt.c (instantiate_class_template_1): Set TYPE_BEING_DEFINED before
4787 calling most_specialized_partial_spec.
4789 2018-02-09 Nathan Sidwell <nathan@acm.org>
4792 * typeck.c (cp_build_indirect_ref_1, build_reinterpret_cast_1):
4793 Pass expr location to strict_aliasing_warning.
4795 2018-02-09 Jason Merrill <jason@redhat.com>
4797 PR c++/84296 - ICE with qualified-id in template.
4799 * pt.c (unknown_base_ref_p): New.
4800 (instantiation_dependent_scope_ref_p): Use it instead of
4801 any_dependent_bases_p.
4803 2018-02-09 Marek Polacek <polacek@redhat.com>
4804 Jakub Jelinek <jakub@redhat.com>
4807 * constexpr.c (cxx_fold_indirect_ref): Sync some changes from
4808 fold_indirect_ref_1, including poly_*int64. Verify first that
4809 tree_fits_poly_int64_p (op01). Formatting fixes.
4811 2018-02-08 Paolo Carlini <paolo.carlini@oracle.com>
4813 * constexpr.c (cxx_eval_component_reference): Use INDIRECT_REF_P.
4814 * lambda.c (build_capture_proxy): Likewise.
4815 * search.c (field_access_p): Likewise.
4816 * semantics.c (omp_clause_decl, omp_privatize_field,
4817 finish_omp_clauses): Likewise.
4819 2018-02-08 Paolo Carlini <paolo.carlini@oracle.com>
4822 * typeck.c (decay_conversion): Use mark_rvalue_use for the special
4823 case of nullptr too.
4825 2018-02-08 Nathan Sidwell <nathan@acm.org>
4827 * class.c (finish_struct): Fix std:initializer_list diagnostic
4830 2018-02-08 Paolo Carlini <paolo.carlini@oracle.com>
4833 * pt.c (tsubst_copy_and_build): Use force_paren_expr for INDIRECT_REF.
4835 2018-02-07 Jakub Jelinek <jakub@redhat.com>
4838 * parser.c (cp_parser_dot_deref_incomplete): New function.
4839 (cp_parser_postfix_dot_deref_expression): Use it.
4841 2018-02-07 David Malcolm <dmalcolm@redhat.com>
4845 * name-lookup.c (suggest_rid_p): New function.
4846 (lookup_name_fuzzy): Replace enum-rid-filtering logic with call to
4849 2018-02-07 Jason Merrill <jason@redhat.com>
4851 PR c++/84182 - ICE with captured lambda
4853 * pt.c (extract_locals_r, extract_local_specs): New.
4854 (tsubst_pack_expansion): Use them.
4856 2018-02-07 Martin Liska <mliska@suse.cz>
4859 * class.c (add_method): Append argument value.
4860 * cp-tree.h (maybe_version_functions): Add new argument.
4861 * decl.c (decls_match): Call it if a declaration does not
4862 have DECL_FUNCTION_VERSIONED.
4863 (maybe_version_functions): record argument is added.
4865 2018-02-05 Marek Polacek <polacek@redhat.com>
4867 * class.c: Remove unused global variables.
4868 (build_primary_vtable): Don't gather statistics.
4869 (print_class_statistics): Remove.
4870 * cp-tree.h (print_class_statistics): Remove.
4871 * tree.c (cxx_print_statistics): Don't call print_class_statistics.
4873 2018-02-02 Paolo Carlini <paolo.carlini@oracle.com>
4875 * class.c (is_really_empty_class): Use DECL_UNNAMED_BIT_FIELD.
4876 * constexpr.c (cx_check_missing_mem_inits): Likewise.
4877 * decl.c (next_initializable_field, find_decomp_class_base,
4878 cp_finish_decomp): Likewise.
4879 * typeck2.c (process_init_constructor_record): Likewise.
4881 2018-02-02 Jason Merrill <jason@redhat.com>
4883 PR c++/84181 - ICE with lambda parm in template argument.
4884 * tree.c (strip_typedefs_expr): Use cp_tree_operand_length.
4886 2018-02-01 Jason Merrill <jason@redhat.com>
4888 PR c++/84160 - ICE with nested variadic capture.
4889 * lambda.c (is_capture_proxy_with_ref): New.
4890 (insert_capture_proxy): Don't set DECL_CAPTURED_VARIABLE from a
4892 * expr.c (mark_use): Use is_capture_proxy_with_ref.
4893 * constexpr.c (potential_constant_expression_1): Likewise.
4894 * semantics.c (process_outer_var_ref): Likewise.
4896 2018-02-01 Marek Polacek <polacek@redhat.com>
4899 * typeck.c (build_address): Relax the assert when
4900 processing_template_decl.
4902 2018-02-01 Jason Merrill <jason@redhat.com>
4904 PR c++/84126 - ICE with variadic generic lambda
4907 * pt.c (tsubst_pack_expansion): Handle function parameter_packs in
4908 PACK_EXPANSION_EXTRA_ARGS.
4910 2018-02-01 Paolo Carlini <paolo.carlini@oracle.com>
4913 * call.c (convert_like_real): If w're initializing from {} explicitly
4914 call abstract_virtuals_error_sfinae.
4916 2018-01-31 Jason Merrill <jason@redhat.com>
4917 Jakub Jelinek <jakub@redhat.com>
4920 * constexpr.c (cxx_eval_outermost_constant_expr): Build NOP_EXPR
4921 around non-constant ADDR_EXPRs rather than clearing TREE_CONSTANT
4924 2018-01-31 Jakub Jelinek <jakub@redhat.com>
4927 * constexpr.c (diag_array_subscript): Emit different diagnostics
4928 if TYPE_DOMAIN (arraytype) is NULL.
4929 (cxx_eval_array_reference, cxx_eval_store_expression): For arrays
4930 with NULL TYPE_DOMAIN use size_zero_node as nelts.
4932 2018-01-31 Paolo Carlini <paolo.carlini@oracle.com>
4935 * semantics.c (finish_qualified_id_expr): When handling an
4936 UNBOUND_CLASS_TEMPLATE only adjust qualifying_class and expr.
4938 2018-01-31 Marek Polacek <polacek@redhat.com>
4941 * cp-gimplify.c (cp_fold): Check if X is an error node before
4942 calling useless_type_conversion_p.
4944 2018-01-30 Jason Merrill <jason@redhat.com>
4946 PR c++/84091 - ICE with local class in lambda in template.
4947 * decl2.c (determine_visibility): Look for outer containing template
4950 PR c++/84098 - ICE with lambda in template NSDMI.
4951 * pt.c (instantiate_class_template_1): Ignore more lambdas.
4953 2018-01-29 Jason Merrill <jason@redhat.com>
4955 PR c++/68810 - wrong location for reinterpret_cast error.
4956 * cvt.c (cp_convert_to_pointer): Always build a CONVERT_EXPR when
4959 2018-01-29 Marek Polacek <polacek@redhat.com>
4962 * constexpr.c (cxx_fold_indirect_ref): Compute ((foo *)&fooarray)[1]
4963 => fooarray[1] in offset_int.
4965 2018-01-29 Jason Merrill <jason@redhat.com>
4967 PR c++/83942 - wrong unused warning with static_cast.
4968 * cvt.c (ocp_convert): Call mark_rvalue_use.
4970 2018-01-26 Jason Merrill <jason@redhat.com>
4972 PR c++/83956 - wrong dtor error with anonymous union
4973 * method.c (walk_field_subobs): Variant members only affect
4975 (maybe_explain_implicit_delete): Pass &deleted_p for diagnostic.
4977 PR c++/84036 - ICE with variadic capture.
4979 * pt.c (tsubst_pack_expansion): When optimizing a simple
4980 substitution, pull a single pack expansion out of its pack.
4982 PR c++/82514 - ICE with local class in generic lambda.
4983 * pt.c (regenerated_lambda_fn_p): Remove.
4984 (enclosing_instantiation_of): Don't use it.
4985 (tsubst_function_decl): Call enclosing_instantiation_of.
4987 * pt.c (lookup_template_class_1): Add sanity check.
4988 * name-lookup.c (do_pushtag): Don't add closures to local_classes.
4990 2018-01-25 Jakub Jelinek <jakub@redhat.com>
4993 * decl.c (find_decomp_class_base): Ignore unnamed bitfields. Ignore
4994 recursive calls that return ret.
4995 (cp_finish_decomp): Ignore unnamed bitfields.
4997 2018-01-23 Jason Merrill <jason@redhat.com>
4999 PR c++/82249 - wrong mismatched pack length error.
5000 * pt.c (extract_fnparm_pack, tsubst_pack_expansion): Handle
5001 unsubstituted function parameter pack.
5003 2018-01-23 Paolo Carlini <paolo.carlini@oracle.com>
5006 * decl.c (check_for_uninitialized_const_var): Not static; add
5007 bool and tsubst_flags_t parameters; adjust to be used both in
5008 constexpr context and not.
5009 * constexpr.c (potential_constant_expression_1): Use the above.
5010 * cp-tree.h (check_for_uninitialized_const_var): Declare.
5012 2018-01-23 Jason Merrill <jason@redhat.com>
5014 PR c++/83947 - ICE with auto declarations.
5015 * pt.c (do_auto_deduction): Don't deduce from an auto decl.
5016 * decl.c (undeduced_auto_decl): Limit to vars and fns.
5018 2018-01-23 David Malcolm <dmalcolm@redhat.com>
5021 * pt.c (tsubst_copy_and_build) <CONSTRUCTOR>: Remove early bailout
5022 for pointer to member function types.
5024 2018-01-23 Jakub Jelinek <jakub@redhat.com>
5027 * tree.c (cp_free_lang_data): Change DECL_VALUE_EXPR of
5028 DECL_OMP_PRIVATIZED_MEMBER vars to error_mark_node.
5030 2018-01-23 Nathan Sidwell <nathan@acm.org>
5033 * pt.c (tsubst_baselink): Remove optype assert.
5034 * ptree.c (cxx_print_xnode): <case BASELINK> Print BASELINK_OPTYPE.
5036 2018-01-23 Jakub Jelinek <jakub@redhat.com>
5039 * decl.c (cp_finish_decomp): Diagnose if reference structure binding
5040 refers to incomplete type.
5042 2018-01-23 Nathan Sidwell <nathan@acm.org>
5044 Deprecate ARM-era for scope handling
5045 * decl.c (poplevel): Flag_new_for_scope is a boolean-like.
5046 (cxx_init_decl_processing): Deprecate flag_new_for_scope being
5048 * name-lookup.c (check_for_out_of_scope_variable): Deprecate and
5050 * semantics.c (begin_for_scope): Flag_new_for_scope is
5052 (finish_for_stmt, begin_range_for_stmt): Likewise.
5054 2018-01-22 Jason Merrill <jason@redhat.com>
5057 * decl2.c (determine_visibility): Fix template_decl handling
5058 instead of blocking it.
5060 PR c++/83720 - ICE with lambda and LTO.
5061 * decl2.c (determine_visibility): Clear template_decl for
5062 function-scope decls. Propagate anonymous linkage from containing
5065 2018-01-22 Marek Polacek <polacek@redhat.com>
5068 * typeck2.c (split_nonconstant_init_1): Return false if we didn't
5071 2018-01-22 Ville Voutilainen <ville.voutilainen@gmail.com>
5074 * decl.c (grokdeclarator): Don't diagnose extra parens
5077 2018-01-19 Jakub Jelinek <jakub@redhat.com>
5080 * call.c (joust): Use TREE_TYPE (source) if source is
5081 a POINTER_TYPE_P rather than if ! DECL_CONSTRUCTOR_P (w->fn).
5084 * typeck.c (convert_for_assignment): Suppress warn_ignored_qualifiers
5085 for direct enum init.
5086 * decl.c (reshape_init): Likewise.
5088 2018-01-19 Marek Polacek <polacek@redhat.com>
5090 * constexpr.c (fold_simple): Simplify.
5092 2018-01-18 Jason Merrill <jason@redhat.com>
5095 * search.c (any_dependent_bases_p): Handle null TREE_BINFO.
5096 * pt.c (instantiation_dependent_scope_ref_p): True if
5097 any_dependent_bases_p.
5099 2018-01-18 Paolo Carlini <paolo.carlini@oracle.com>
5101 * cp-tree.h: Fix comment typo (DECL_NON_TRIVIALLY_INITIALIZED_P
5102 vs DECL_NONTRIVIALLY_INITIALIZED_P).
5104 2018-01-18 Jason Merrill <jason@redhat.com>
5106 PR c++/82461 - constexpr list-initialized member
5107 * constexpr.c (potential_constant_expression_1): Check
5108 TARGET_EXPR_DIRECT_INIT_P.
5110 2018-01-18 Paolo Carlini <paolo.carlini@oracle.com>
5113 * decl.c (xref_basetypes): Early return upon error about derived
5116 2018-01-18 Nathan Sidwell <nathan@acm.org>
5119 * cp-tree.h (mark_use): Declare.
5120 * expr.c (mark_use): Make extern.
5121 * call.c (direct_reference_binding): Set inner conv's
5122 rvaluedness_matches_p, if it is an identity.
5123 (convert_like_real): Mark lvalue or rvalue use for identity as
5124 rvaledness_matches_p demands.
5126 2018-01-18 Jakub Jelinek <jakub@redhat.com>
5129 * parser.c (attr_chainon): New function.
5130 (cp_parser_label_for_labeled_statement, cp_parser_decl_specifier_seq,
5131 cp_parser_namespace_definition, cp_parser_init_declarator,
5132 cp_parser_type_specifier_seq, cp_parser_parameter_declaration,
5133 cp_parser_gnu_attributes_opt): Use it.
5134 (cp_parser_member_declaration, cp_parser_objc_class_ivars,
5135 cp_parser_objc_struct_declaration): Likewise. Don't reset
5136 prefix_attributes if attributes is error_mark_node.
5138 2018-01-17 Paolo Carlini <paolo.carlini@oracle.com>
5141 * decl.c (grokdeclarator): Do not append the error_mark_node
5142 due to an erroneous optional attribute-specifier-seq.
5144 2018-01-17 Jakub Jelinek <jakub@redhat.com>
5147 * cp-gimplify.c (cp_maybe_instrument_return): Handle
5150 2018-01-17 Paolo Carlini <paolo.carlini@oracle.com>
5153 * constexpr.c (ensure_literal_type_for_constexpr_object): Return
5154 error_mark_node when we give an error.
5155 * decl.c (cp_finish_decl): Use the latter.
5157 2018-01-17 Nathan Sidwell <nathan@acm.org>
5160 * init.c (build_raw_new_expr): Scan list for lookups to keep.
5162 2018-01-17 David Malcolm <dmalcolm@redhat.com>
5165 * expr.c (fold_for_warn): Move from c-common.c, reducing to just
5166 the C++ part. If processing a template, call
5167 fold_non_dependent_expr rather than fully folding.
5169 2018-01-17 Jason Merrill <jason@redhat.com>
5171 PR c++/81067 - redundant NULL warning.
5172 * call.c (convert_like_real): Restore null_node handling.
5174 2018-01-17 Jason Merrill <jason@redhat.com>
5176 PR c++/81843 - ICE with variadic member template.
5178 * pt.c (unify_pack_expansion): Don't try to deduce enclosing
5181 2018-01-17 David Malcolm <dmalcolm@redhat.com>
5184 * pt.c (type_dependent_expression_p): Strip any location wrapper
5185 before testing tree codes.
5186 (selftest::test_type_dependent_expression_p): New function.
5187 (selftest::cp_pt_c_tests): Call it.
5189 2018-01-17 Nathan Sidwell <nathan@acm.org>
5192 * pt.c (tsubst_expr) <case RANGE_FOR_STMT>: Rebuild a range_for if
5193 this not a final instantiation.
5195 2018-01-16 Jason Merrill <jason@redhat.com>
5197 PR c++/83714 - ICE checking return in template.
5198 * typeck.c (check_return_expr): Call build_non_dependent_expr.
5200 2018-01-16 Jakub Jelinek <jakub@redhat.com>
5203 * pt.c (tsubst_copy_and_build) <case CALL_EXPR>: If function
5204 is AGGR_INIT_EXPR rather than CALL_EXPR, set AGGR_INIT_FROM_THUNK_P
5205 instead of CALL_FROM_THUNK_P.
5208 * name-lookup.c (member_vec_dedup): Return early if len is 0.
5209 (resort_type_member_vec, set_class_bindings,
5210 insert_late_enum_def_bindings): Use vec qsort method instead of
5211 calling qsort directly.
5213 2018-01-15 Martin Sebor <msebor@redhat.com>
5216 * class.c (find_flexarrays): Make a record of multiple flexible array
5219 2018-01-12 Jason Merrill <jason@redhat.com>
5221 PR c++/83186 - ICE with static_cast of list-initialized temporary.
5222 * typeck.c (build_static_cast): Use build_non_dependent_expr.
5224 2018-01-12 Nathan Sidwell <nathan@acm.org>
5226 * cp-tree.h (mark_rvalue_use): Add parm name.
5227 * expr.c (mark_lvalue_use, mark_lvalue_use_nonread): Move next to
5229 * call.c (convert_like_real): Fix formatting.
5231 2018-01-11 Jason Merrill <jason@redhat.com>
5233 PR c++/82728 - wrong -Wunused-but-set-variable
5236 * call.c (perform_implicit_conversion_flags): Call mark_rvalue_use.
5237 * decl.c (case_conversion): Likewise.
5238 * semantics.c (finish_static_assert): Call
5239 perform_implicit_conversion_flags.
5241 2018-01-11 Nathan Sidwell <nathan@acm.org>
5243 * method.c (enum mangling_flags): Delete long-dead enum.
5245 2018-01-10 Paolo Carlini <paolo.carlini@oracle.com>
5247 * parser.c (cp_parser_std_attribute_spec): When
5248 token_pair::require_open / require_close return false simply
5249 return error_mark_node, avoid duplicate cp_parser_error about
5250 expected '(' / ')', respectively.
5252 2018-01-10 David Malcolm <dmalcolm@redhat.com>
5255 * call.c (null_ptr_cst_p): Strip location wrappers when
5256 converting from '0' to a pointer type in C++11 onwards.
5257 (conversion_null_warnings): Replace comparison with null_node with
5258 call to null_node_p.
5259 (build_over_call): Likewise.
5260 * cp-gimplify.c (cp_fold): Remove the early bailout when
5261 processing_template_decl.
5262 * cp-lang.c (selftest::run_cp_tests): Call
5263 selftest::cp_pt_c_tests and selftest::cp_tree_c_tests.
5264 * cp-tree.h (cp_expr::maybe_add_location_wrapper): New method.
5265 (selftest::run_cp_tests): Move decl to bottom of file.
5266 (null_node_p): New inline function.
5267 (selftest::cp_pt_c_tests): New decl.
5268 (selftest::cp_tree_c_tests): New decl.
5269 * cvt.c (build_expr_type_conversion): Replace comparison with
5270 null_node with call to null_node_p.
5271 * error.c (args_to_string): Likewise.
5272 * except.c (build_throw): Likewise.
5273 * mangle.c (write_expression): Skip location wrapper nodes.
5274 * parser.c (literal_integer_zerop): New function.
5275 (cp_parser_postfix_expression): Call maybe_add_location_wrapper on
5276 the result for RID_TYPEID. Pass true for new "wrap_locations_p"
5277 param of cp_parser_parenthesized_expression_list. When calling
5278 warn_for_memset, replace integer_zerop calls with
5279 literal_integer_zerop, eliminating the double logical negation
5280 cast to bool. Eliminate the special-casing for CONST_DECL in
5281 favor of the fold_for_warn within warn_for_memset.
5282 (cp_parser_parenthesized_expression_list): Add "wrap_locations_p"
5283 param, defaulting to false. Convert "expr" to a cp_expr, and call
5284 maybe_add_location_wrapper on it when wrap_locations_p is true.
5285 (cp_parser_unary_expression): Call maybe_add_location_wrapper on
5286 the result for RID_ALIGNOF and RID_SIZEOF.
5287 (cp_parser_builtin_offsetof): Likewise.
5288 * pt.c: Include "selftest.h".
5289 (tsubst_copy): Handle location wrappers.
5290 (tsubst_copy_and_build): Likewise.
5291 (build_non_dependent_expr): Likewise.
5292 (selftest::test_build_non_dependent_expr): New function.
5293 (selftest::cp_pt_c_tests): New function.
5294 * tree.c: Include "selftest.h".
5295 (lvalue_kind): Handle VIEW_CONVERT_EXPR location wrapper nodes.
5296 (selftest::test_lvalue_kind): New function.
5297 (selftest::cp_tree_c_tests): New function.
5298 * typeck.c (string_conv_p): Strip any location wrapper from "exp".
5299 (cp_build_binary_op): Replace comparison with null_node with call
5301 (build_address): Use location of operand when building address
5304 2018-01-10 Marek Polacek <polacek@redhat.com>
5307 * call.c (build_conditional_expr_1): Check complain before warning.
5308 * pt.c (tsubst_copy_and_build) <case COND_EXPR>: Suppress
5309 -Wduplicated-branches.
5311 2018-01-10 Jakub Jelinek <jakub@redhat.com>
5314 * call.c (maybe_warn_class_memaccess): Add forward declaration.
5315 Change last argument from tree * to const vec<tree, va_gc> *, adjust
5316 args uses and check number of operands too. Don't strip away any
5317 nops. Use maybe_constant_value when looking for INTEGER_CST args.
5318 Deal with src argument not having pointer type. Check
5319 tree_fits_uhwi_p before calling tree_to_uhwi. Remove useless
5321 (build_over_call): Call maybe_warn_class_memaccess here on the
5323 (build_cxx_call): Rather than here on converted arguments.
5325 2018-01-10 Paolo Carlini <paolo.carlini@oracle.com>
5328 * init.c (build_vec_init): Avoid building an INIT_EXPR with
5329 error_mark_node as second argument.
5331 2018-01-09 Jakub Jelinek <jakub@redhat.com>
5334 * constexpr.c (cxx_eval_statement_list): Ignore DEBUG_BEGIN_STMTs
5335 in STATEMENT_LIST. Remove unneeded assert.
5337 2018-01-03 Richard Sandiford <richard.sandiford@linaro.org>
5338 Alan Hayward <alan.hayward@arm.com>
5339 David Sherwood <david.sherwood@arm.com>
5341 * constexpr.c (cxx_eval_array_reference): Handle polynomial
5343 (cxx_fold_indirect_ref): Handle polynomial TYPE_VECTOR_SUBPARTS.
5344 * call.c (build_conditional_expr_1): Likewise.
5345 * decl.c (cp_finish_decomp): Likewise.
5346 * mangle.c (write_type): Likewise.
5347 * typeck.c (structural_comptypes): Likewise.
5348 (cp_build_binary_op): Likewise.
5349 * typeck2.c (process_init_constructor_array): Likewise.
5351 2018-01-03 Jakub Jelinek <jakub@redhat.com>
5354 * typeck.c (build_static_cast_1): For static casts to reference types,
5355 call build_base_path with flag_delete_null_pointer_checks as nonnull
5356 instead of always false. When -fsanitize=null, call
5357 ubsan_maybe_instrument_reference on the NULL reference INTEGER_CST.
5358 * cp-gimplify.c (cp_genericize_r): Don't walk subtrees of UBSAN_NULL
5359 call if the first argument is INTEGER_CST with REFERENCE_TYPE.
5361 2018-01-03 Nathan Sidwell <nathan@acm.org>
5364 * method.c (make_alias_for): Copy DECL_CONTEXT.
5366 2018-01-03 Marek Polacek <polacek@redhat.com>
5369 * decl.c (grokdeclarator): Don't warn about MVP in typename context.
5371 2018-01-03 Jakub Jelinek <jakub@redhat.com>
5373 PR preprocessor/83602
5374 * name-lookup.c (lookup_name_fuzzy): Don't use macro_use_before_def
5378 * cp-gimplify.c (cp_fold) <case NOP_EXPR>: If the operand folds to
5379 error_mark_node, return error_mark_node.
5381 Update copyright years.
5383 2018-01-02 Jakub Jelinek <jakub@redhat.com>
5386 * tree.c (replace_placeholders_r): Pass NULL as last argument to
5387 cp_walk_tree instead of d->pset. If non-TREE_CONSTANT and
5388 non-PLACEHOLDER_EXPR tree has been seen already, set *walk_subtrees
5389 to false and return.
5390 (replace_placeholders): Pass NULL instead of &pset as last argument
5393 2018-01-02 Nathan Sidwell <nathan@acm.org>
5395 * constexpr.c (cxx_bind_parameters_in_call): Remove unneeded local
5398 Copyright (C) 2018 Free Software Foundation, Inc.
5400 Copying and distribution of this file, with or without modification,
5401 are permitted in any medium without royalty provided the copyright
5402 notice and this notice are preserved.