1 2018-11-02 Nathan Sidwell <nathan@acm.org>
3 * decl.c (duplicate_decls): Refactor checks.
5 2018-11-01 Marek Polacek <polacek@redhat.com>
7 Implement P0846R0, ADL and function templates.
8 * decl.c (grokfndecl): Allow FUNCTION_DECL in assert.
9 * lex.c (unqualified_fn_lookup_error): Handle TEMPLATE_ID_EXPR.
10 * parser.c (cp_parser_postfix_expression): Do ADL for a template-name.
11 (cp_parser_template_id): Give errors if parsing the template argument
12 list didn't go well. Allow FUNCTION_DECL in assert.
13 (cp_parser_template_name): Consider a name to refer to a template if
14 it is an unqualified-id followed by a <. Don't return the identifier
15 if the decl is a function and dependent.
16 * pt.c (tsubst_copy) <case OVERLOAD>: Remove assert.
18 2018-11-01 Nathan Sidwell <nathan@acm.org>
20 * cp-tree.h (struct lang_function): Delete x_local_names field.
21 (struct lang_decl_base): Rename u2sel to spare.
22 (struct lang_decl_min): Remove lang_decl_u2 union. Keep access
24 (LANG_DECL_U2_CHECK): Delete.
25 (DECL_DISCRIMINATOR_P): Require function scope.
26 (DECL_DISCRIMINATOR): Adjust.
27 (DECL_DISCRIMINATOR_SET_P): Delete.
28 (DECL_CAPTURED_VARIABLE, DECL_ACCESS, THUnK_VIRTUAL_OFFSET): Adjust.
29 (local_classes): Don't declare.
30 (determine_local_discriminator): Declare.
31 * decl.c (push_local_name): Delete.
32 (local_entities, determina_local_discrminator): New.
33 (duplicate_decls): Copy DECL_ACCESS. Fix formatting.
34 (cp_finish_decl): Use determine_local_discriminator.
35 (save_function_data): Drop x_local_names.
36 (finish_function): Drop local_names.
37 * decl2.c (finish_anon_union): Use determine_local_disciminator.
38 * mangle.c (write_unnamed_type_name): Use
39 discriminator_for_local_entity.
40 (local_class_index): Delete.
41 (discriminator_for_local_entity): Reimplement.
42 (write_local_name): Adjust discriminator code.
43 * name-lookup.c (do_pushtag): Call determine_local_discrimiator.
44 * semantics.c (finish_omp_threadprivate): Drop DECL_DISCRIMINATOR
46 * class.c (local_classes): Delete.
47 (init_class_processing): Don't init it.
49 2018-11-01 Martin Liska <mliska@suse.cz>
50 Jason Merrill <jason@redhat.com>
55 * cp-tree.h (DECL_FNAME_P): New macro.
56 * decl.c (cp_make_fname_decl): Set DECL_DECLARED_CONSTEXPR_P,
57 DECL_VALUE_EXPR, DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P.
59 * lambda.c (is_capture_proxy): Use DECL_FNAME_P.
60 * pt.c (tsubst_expr): Handle DECL_PRETTY_FUNCTION_P.
62 2018-10-31 Nathan Sidwell <nathan@acm.org>
64 * cp-tree.h (OVL_DEDUP_P): New.
65 * name-lookup.c (name_lookup::add_overload): Check OVL_DEDUP_P.
66 (get_class_binding_direct): Likwise.
67 * tree.c (ovl_make): Propagate OVL_DEDUP_P.
69 (ovl_insert): Do not keep using-decls ordered.
70 (lookup_maybe_add): Adjust comment.
72 2018-10-30 Marek Polacek <polacek@redhat.com>
74 Implement P0892R2, explicit(bool).
75 * call.c (add_template_candidate_real): Return if the declaration is
76 explicit and we're only looking for non-converting constructor.
77 * cp-tree.h (lang_decl_fn): Add has_dependent_explicit_spec_p bit.
78 (DECL_HAS_DEPENDENT_EXPLICIT_SPEC_P): New macro.
79 (cp_decl_specifier_seq): Add explicit_specifier field.
80 (build_explicit_specifier, store_explicit_specifier): Declare.
81 * decl.c (grokdeclarator): Call store_explicit_specifier.
82 (build_explicit_specifier): New function.
83 * parser.c (cp_parser_function_specifier_opt) <case RID_EXPLICIT>:
84 Parse C++20 explicit(bool).
85 * pt.c (store_explicit_specifier, lookup_explicit_specifier): New.
86 (tsubst_function_decl): Handle explicit(dependent-expr).
88 2018-10-30 Paolo Carlini <paolo.carlini@oracle.com>
90 * decl.c (grokdeclarator): Use declarator->id_loc in diagnostic
91 about flexible array members.
93 2018-10-29 David Malcolm <dmalcolm@redhat.com>
95 * cp-name-hint.h: New file.
96 * cp-tree.h (expr_to_string): New decl.
97 (suggest_alternatives_for): Move to cp-name-hint.h, changing
98 return type from bool to name_hint.
99 (suggest_alternative_in_explicit_scope): Likewise.
100 * error.c: Define INCLUDE_UNIQUE_PTR. Include "cp-name-hint.h".
101 (expr_to_string): Make non-static.
102 (qualified_name_lookup_error): For the non-"::" case, take
103 responsibity for issuing any suggestion from
104 suggest_alternative_in_explicit_scope, as it changes from
105 returning a bool to returning a name_hint. Replace fallback call
106 to suggest_alternatives_for to a call to
107 suggest_alternatives_in_other_namespaces, capturing the fact that
108 we don't have enough location information to issue a fix-it hint
109 for this case. Update the error to support emitting a fix-it hint
110 where appropriate. For the "::" case, take responsibility for
111 issuing any suggestion from suggest_alternatives_for, supporting
112 emitting a fix-it hint.
113 * lex.c: Define INCLUDE_UNIQUE_PTR. Include "gcc-rich-location.h"
114 and "cp-name-hint.h".
115 (unqualified_name_lookup_error): Take responsibility for issuing
116 any suggestion from suggest_alternatives_for, supporting emitting
118 * name-lookup.c (class namespace_limit_reached): New subclass of
120 (class show_candidate_location): Likewise.
121 (class suggest_alternatives): Likewise.
122 (class namespace_hints): New class.
123 (suggest_alternatives_for): Convert return type from bool to
124 name_hint, replacing all direct diagnostic emission by setting
125 suggestions on the return value, or creating deferred diagnostics.
126 Specifically, split out initial traversal of namespaces into
127 namespace_hints' ctor, and maybe_decorate_with_limit, and move the
128 rest of the implementation to
129 namespace_hints::convert_candidates_to_name_hint and
130 suggest_alternatives_for_1.
131 (namespace_hints::namespace_hints): New ctor, adapted from
132 suggest_alternatives_for's initial namespace traversal, storing
133 location and name, and converting locals "candidates", "limited"
134 and "limit" into members.
135 (namespace_hints::convert_candidates_to_name_hint): New member
137 (namespace_hints::maybe_decorate_with_limit): New member function.
138 (suggest_alternatives_for_1): New function, based on second half
139 of old implementation of suggest_alternatives_for, converting from
140 immediate emission of suggestions to using name_hint.
141 (suggest_alternatives_in_other_namespaces): New function.
142 (maybe_suggest_missing_std_header): Convert from immediate
143 emission of suggestions to using name_hint, moving emission
145 (class missing_std_header): New subclass of deferred_diagnostic.
146 (maybe_suggest_missing_header): Convert return type from bool to
148 (suggest_alternative_in_explicit_scope): Convert from immediate
149 emission of suggestions to using name_hint.
150 * parser.c: Replace include of "c-family/name-hint.h" with
152 (cp_parser_diagnose_invalid_type_name): Update
153 "is there a suggestion" logic for change to
154 name_hint::operator bool. Take responsibility for emitting
155 fix-it hints from suggest_alternative_in_explicit_scope.
156 (cp_parser_namespace_name): Take responsibility for emitting
157 fix-it hints from suggest_alternative_in_explicit_scope. Don't
158 emit the "expected namespace-name" error if we've already emitted
159 an "is not a namespace-name" error.
161 2018-10-29 David Malcolm <dmalcolm@redhat.com>
164 * call.c (build_over_call): Eliminate the "arglocs" array, and the
165 call to maybe_constant_value when building "fargs".
167 2018-10-29 Paolo Carlini <paolo.carlini@oracle.com>
169 * decl.c (create_array_type_for_decl): Add location_t parameter
171 (grokdeclarator): Adjust call.
173 2018-10-29 Marek Polacek <polacek@redhat.com>
175 PR c++/87594 - constexpr rejects-valid with range-based for.
176 * constexpr.c (potential_constant_expression_1): If the condition
177 can't be evaluated, return true.
179 2018-10-29 Joseph Myers <joseph@codesourcery.com>
180 Julian Brown <julian@codesourcery.com>
183 * semantics.c (handle_omp_array_sections_1): Allow array
184 sections with "this" pointer for OpenACC.
186 2018-10-25 Jason Merrill <jason@redhat.com>
188 * parser.c (cp_parser_sizeof_operand): Remove redundant use of
191 2018-10-24 Jakub Jelinek <jakub@redhat.com>
194 * parser.c (cp_parser_std_attribute): Canonicalize attr_ns, and when
195 :: is not present and attr_ns non-NULL, canonicalize also attr_id.
196 (cp_parser_attribute_spec): Fix comment typo.
198 2018-10-24 Martin Sebor <msebor@redhat.com>
201 * call.c (maybe_warn_class_memaccess): Tighten up.
203 2018-10-17 David Malcolm <dmalcolm@redhat.com>
205 * Make-lang.in (selftest-c++): New.
206 (CPP_SELFTEST_FLAGS, CPP_SELFTEST_DEPS, s-selftest-c++)
207 (selftest-c++-gdb, selftest-c++-valgrind): Move here from
210 2018-10-17 Paolo Carlini <paolo.carlini@oracle.com>
213 * tree.c (build_cplus_new): Avoid duplicate diagnostic about
214 incomplete type, early return error_mark_node if the second
215 argument is error_mark_node.
217 2018-10-12 Nathan Sidwell <nathan@acm.org>
219 * parser.h (struct cp_parser): Drop implicit_extern_c.
220 * parser.c (cp_debug_parser): Drop implicit_extern_c.
221 (cp_parser_new): Likewise.
222 (cp_parser_translation_unit): Handle implicit extern c here. Call
223 cp_parser_toplevel_declaration.
224 (cp_parser_toplevel_declaration): New, broken out of ...
225 (cp_parser_declaration_seq_opt): ... here. Call it. Drop
226 implicit extern C handling.
228 2018-10-11 Will Wray <wjwray@gmail.com>
231 * cxx-pretty-print.c (pp_cxx_enumeration_constant): New function.
232 (cxx_pretty_printer::constant): Use it.
234 2018-10-11 David Malcolm <dmalcolm@redhat.com>
237 * call.c (enforce_access): Move diagnostics to...
238 (complain_about_access): ...this new function.
239 * cp-tree.h (class access_failure_info): Rename split out field
240 "m_field_decl" into "m_decl" and "m_diag_decl".
241 (access_failure_info::record_access_failure): Add tree param.
242 (access_failure_info::was_inaccessible_p): New accessor.
243 (access_failure_info::get_decl): New accessor.
244 (access_failure_info::get_diag_decl): New accessor.
245 (access_failure_info::get_any_accessor): New member function.
246 (access_failure_info::add_fixit_hint): New static member function.
247 (complain_about_access): New decl.
248 * typeck.c (access_failure_info::record_access_failure): Update
249 for change to fields.
250 (access_failure_info::maybe_suggest_accessor): Split out into...
251 (access_failure_info::get_any_accessor): ...this new function...
252 (access_failure_info::add_fixit_hint): ...and this new function.
253 (finish_class_member_access_expr): Split out "has no member named"
254 error-handling into...
255 (complain_about_unrecognized_member): ...this new function, and
256 check that the guessed name is accessible along the access path.
257 Only provide a spell-correction fix-it hint if it is; otherwise,
258 attempt to issue an accessor fix-it hint.
260 2018-10-11 Nathan Sidwell <nathan@acm.org>
262 * parser.c (cp_parser_translation_unit): Return void. Don't fail
263 at first extra }, simplify logic.
264 (c_parse_file): Call finish_translation_unit here.
266 2018-10-11 Jakub Jelinek <jakub@redhat.com>
269 * typeck.c (maybe_warn_about_returning_address_of_local): If
270 whats_returned is a structured binding identifier and the structured
271 binding is a reference, recurse on its initializer.
274 * rtti.c (get_tinfo_decl_dynamic): Use unlowered_expr_type instead
277 2018-10-10 Marek Polacek <polacek@redhat.com>
279 PR c++/87567 - constexpr rejects call to non-constexpr function.
280 * constexpr.c (potential_constant_expression_1) <case FOR_STMT>: Return
281 true if the condition is always false.
282 <case WHILE_STMT>: Likewise.
284 2018-10-09 Paolo Carlini <paolo.carlini@oracle.com>
287 * pt.c (convert_template_argument): Immediately return error_mark_node
288 if the second argument is erroneous.
289 * parser.c (cp_parser_type_id): Add location_t * parameter.
290 (cp_parser_type_id_1): Likewise.
291 (cp_parser_alias_declaration): Adjust cp_parser_type_id call,
292 obtain the location of the type and save it.
293 (cp_parser_template_type_arg): Adjust.
294 (cp_parser_trailing_type_id): Likewise.
295 * decl.c (grokdeclarator): Improve error message for 'auto' in
298 2018-10-08 Paolo Carlini <paolo.carlini@oracle.com>
301 * pt.c (do_decl_instantiation): Per 12.6.8/5, a concept cannot be
302 explicitly instantiated.
304 2018-10-05 David Malcolm <dmalcolm@redhat.com>
307 * call.c (build_over_call): Build a vec of locations of the
308 arguments before the call to maybe_constant_value, and pass to
309 check_function_arguments.
310 * cp-lang.c (LANG_HOOKS_GET_SUBSTRING_LOCATION): Define as
311 c_get_substring_location.
312 * parser.c (cp_parser_string_literal): Capture string
313 concatenation locations.
315 2018-10-04 Nathan Sidwell <nathan@acm.org>
317 * lang-specs.h: Use string contatenation, not line splicing.
319 2018-10-03 Jason Merrill <jason@redhat.com>
321 Implement P0840, language support for empty objects.
322 * tree.c (handle_no_unique_addr_attribute): New.
323 (cxx_attribute_table): Add [[no_unique_address]].
324 * class.c (field_poverlapping_p): New.
325 (layout_class_type): Check it. Adjust DECL_SIZE of potentially
327 (layout_empty_base_or_field): Rename from layout_empty_base, handle
329 (build_base_field, record_subobject_offsets): Adjust.
331 2018-10-03 Martin Liska <mliska@suse.cz>
333 PR gcov-profile/86109
334 * parser.c (cp_parser_lambda_declarator_opt):
335 Set DECL_LAMBDA_FUNCTION for lambdas.
337 2018-10-02 Richard Biener <rguenther@suse.de>
339 * name-lookup.c (check_local_shadow): Do not test DECL_FROM_INLINE.
341 2018-09-28 Eric Botcazou <ebotcazou@adacore.com>
342 Pierre-Marie de Rodat <derodat@adacore.com>
344 * method.c (use_thunk): Adjust call to cgraph_node::create_thunk.
346 2018-09-28 Richard Biener <rguenther@suse.de>
348 * error.c (cp_print_error_function): Simplify by eliding
349 the BLOCK_ABSTRACT_ORIGIN chasing.
351 2018-09-27 Paolo Carlini <paolo.carlini@oracle.com>
354 * semantics.c (finish_unary_op_expr): Check return value of
355 build_x_unary_op for error_mark_node.
357 2018-09-25 Jakub Jelinek <jakub@redhat.com>
360 * constexpr.c (cxx_eval_constant_expression) <case OBJ_TYPE_REF>: Only
361 look through COMPONENT_REFs with DECL_FIELD_IS_BASE FIELD_DECLs.
363 2018-09-25 Martin Liska <mliska@suse.cz>
365 * name-lookup.c (namespace_scope_ht_size): Remove
367 * parser.c (cp_lexer_next_token_is_not_keyword): Likewise.
369 2018-09-24 Paolo Carlini <paolo.carlini@oracle.com>
372 * method.c (lazily_declare_fn): During error-recovery add_method
375 2018-09-21 Marek Polacek <polacek@redhat.com>
377 PR c++/87372 - __func__ constexpr evaluation.
378 * constexpr.c (maybe_constant_init_1): Pass false for strict down to
379 cxx_eval_outermost_constant_expr.
381 2018-09-20 Marek Polacek <polacek@redhat.com>
383 PR c++/87109 - wrong ctor with maybe-rvalue semantics.
384 * call.c (build_user_type_conversion_1): Refine the maybe-rvalue
385 check to only return if we're converting the return value to a base
388 2018-09-20 Allan Sandfeld Jensen <allan.jensen@qt.io>
390 * g++spec.c (lang_specific_driver): Handle -r like -nostdlib.
392 2018-09-20 Jason Merrill <jason@redhat.com>
394 PR c++/87075 - ICE with constexpr array initialization.
395 * constexpr.c (cxx_eval_vec_init_1): Handle trivial initialization.
397 2018-09-19 Marek Polacek <polacek@redhat.com>
399 Add -Wclass-conversion.
400 * decl.c (grok_op_properties): Change a warning from -Wconversion to
401 -Wclass-conversion. Make it print the types.
403 2018-09-19 Paolo Carlini <paolo.carlini@oracle.com>
406 * parser.c (cp_parser_initializer_list): Assign error_mark_node
407 to the index upon error.
409 2018-09-19 Marek Polacek <polacek@redhat.com>
411 PR c++/87357 - missing -Wconversion warning
412 * decl.c (grok_op_properties): Remove diagnostic parts mentioning
413 a conversion to a reference to void. Use
414 same_type_ignoring_top_level_qualifiers_p rather than comparing types
417 2018-09-18 Marek Polacek <polacek@redhat.com>
419 P1064R0 - Allowing Virtual Function Calls in Constant Expressions
420 * call.c (build_over_call): No longer check if we're outside a template
422 * class.c (build_vtbl_initializer): Build vtable's constructor with
424 * constexpr.c (cxx_eval_constant_expression): Don't ignore _vptr's
425 initializer. Handle OBJ_TYPE_REF.
426 (potential_constant_expression_1): Handle OBJ_TYPE_REF.
427 * decl.c (maybe_commonize_var): Bail out for any DECL_ARTIFICIAL.
428 (initialize_artificial_var): Mark the variable as constexpr.
429 (grokdeclarator): Change error to pedwarn. Only warn when
430 pedantic and not C++2a.
432 2018-09-18 Paolo Carlini <paolo.carlini@oracle.com>
435 * cp-tree.h (NON_ERROR): New.
436 * pt.c (auto_hash::hash): Use it.
437 (do_auto_deduction): Likewise.
439 2018-09-18 Nathan Sidwell <nathan@acm.org>
442 * name-lookup.c (check_local_shadow): Ignore auto types.
444 2018-09-17 David Malcolm <dmalcolm@redhat.com>
446 * error.c (range_label_for_type_mismatch::get_text): Update for
449 2018-09-13 Bernd Edlinger <bernd.edlinger@hotmail.de>
451 * typeck2.c (digest_init_r): Fix overlength strings.
453 2018-09-13 Ville Voutilainen <ville.voutilainen@gmail.com>
456 * method.c (constructible_expr): We're in an unevaluated context
457 in all cases, not just for class targets.
459 2018-09-12 David Malcolm <dmalcolm@redhat.com>
462 * call.c (struct conversion_info): Add "loc" field.
463 (arg_conversion_rejection): Add "loc" param, using it to
464 initialize the new field.
465 (bad_arg_conversion_rejection): Likewise.
466 (explicit_conversion_rejection): Initialize the new field to
468 (template_conversion_rejection): Likewise.
469 (add_function_candidate): Pass on the argument location to the new
470 param of arg_conversion_rejection.
471 (add_conv_candidate): Likewise.
472 (build_builtin_candidate): Likewise.
473 (build_user_type_conversion_1): Likewise.
474 (single_z_candidate): New function.
475 (maybe_get_bad_conversion_for_unmatched_call): New function.
476 (complain_about_bad_argument): New function, based on part of
477 convert_for_assignment.
478 (build_new_method_call_1): Split out handling of the "no viable
479 candidates" case into...
480 (complain_about_no_candidates_for_method_call): ...this new
481 function, and use the new functions above to special-case the
482 handling of a single non-viable candidate due to a bad argument.
483 * cp-tree.h (complain_about_bad_argument): New decl.
484 * typeck.c (convert_for_assignment): Split out one error-handling
485 case into complain_about_bad_argument.
487 2018-09-09 Cesar Philippidis <cesar@codesourcery.com>
488 Julian Brown <julian@codesourcery.com>
491 * semantics.c (finish_omp_clauses): Treat C++ references the same in
494 2018-08-28 Martin Liska <mliska@suse.cz>
496 * constexpr.c (cxx_eval_call_expression): Add quotes
497 to -fconstexpr-depth=.
499 2018-09-10 Marek Polacek <polacek@redhat.com>
501 * class.c (build_vtbl_ref): Remove.
502 (build_vtbl_ref_1): Rename to build_vtbl_ref.
503 (build_vfn_ref): Call build_vtbl_ref instead of build_vtbl_ref_1.
505 2018-09-08 Marek Polacek <polacek@redhat.com>
507 PR c++/87150 - wrong ctor with maybe-rvalue semantics.
508 * call.c (struct conversion): Update commentary.
509 (standard_conversion): Set rvaluedness_matches_p if LOOKUP_PREFER_RVALUE
512 2018-09-08 Jason Merrill <jason@redhat.com>
514 PR c++/86678 - constexpr function with non-constant after return.
515 * constexpr.c (potential_constant_expression_1): Add jump_target.
516 (breaks): Check for BREAK_STMT.
517 (continues): Check for CONTINUE_STMT.
519 2018-09-08 Marek Polacek <polacek@redhat.com>
521 * cxx-pretty-print.c (cxx_pretty_printer::statement) <case
522 RANGE_FOR_SMT>: Handle RANGE_FOR_INIT_STMT.
524 2018-09-07 Marek Polacek <polacek@redhat.com>
526 PR c++/87152 - range-based for loops with initializer broken in templates.
527 * constexpr.c (potential_constant_expression_1) <case RANGE_FOR_STMT>:
528 Recur into RANGE_FOR_INIT_STMT.
529 * cp-tree.def: Add RANGE_FOR_INIT_STMT to RANGE_FOR_STMT.
530 * cp-tree.h (RANGE_FOR_INIT_STMT): Define.
531 * dump.c (cp_dump_tree) <case RANGE_FOR_STMT>: Also dump
533 * pt.c (tsubst_expr) <case RANGE_FOR_STMT>: Recur into
535 * semantics.c (begin_range_for_stmt): Adjust call to build_stmt.
536 Do put the init statement in RANGE_FOR_INIT_STMT.
537 (finish_range_for_decl): Pop it for templates.
539 2018-09-06 Bernd Edlinger <bernd.edlinger@hotmail.de>
541 * decl.c (check_initializer): Call cp_complete_array_type.
543 2018-09-05 Marek Polacek <polacek@redhat.com>
545 PR c++/87109, wrong overload with ref-qualifiers.
546 * call.c (build_user_type_conversion_1): Use NULL instead of 0. Bail
547 out if performing the maybe-rvalue overload resolution and a conversion
548 function is getting called.
550 PR c++/86982, -Wreturn-local-addr and std::move and std::forward.
551 * typeck.c (maybe_warn_about_returning_address_of_local): Handle calls
552 to std::move or std::forward.
553 (is_std_forward_p): New function.
555 2018-09-05 Pádraig Brady <p@draigbrady.com>
558 * lambda.c (prune_lambda_captures): Protect against const_vars.get
561 2018-09-04 Marek Polacek <polacek@redhat.com>
563 * cp-tree.h (treat_lvalue_as_rvalue_p): Declare.
564 * except.c (build_throw): Use it. Use CP_TYPE_VOLATILE_P.
565 * typeck.c (treat_lvalue_as_rvalue_p): No longer static. Add PARM_OK
567 (maybe_warn_pessimizing_move): Adjust treat_lvalue_as_rvalue_p call.
568 (check_return_expr): Likewise.
570 2018-09-03 Paolo Carlini <paolo.carlini@oracle.com>
573 * constraint.cc (finish_shorthand_constraint): Early return if the
574 constraint is erroneous.
576 2018-09-02 Bernd Edlinger <bernd.edlinger@hotmail.de>
578 * decl.c (eval_check_narrowing): Remove.
579 (check_initializer): Move call to braced_list_to_string from here ...
580 * typeck2.c (store_init_value): ... to here.
581 (digest_init_r): Remove handing of signed/unsigned char strings.
583 2018-08-31 Nathan Sidwell <nathan@acm.org>
587 * name-lookup.c (name_lookup::search_namespace): Don't look at
588 inlines when searching for NULL names.
590 * decl.c (decls_match): Remove SYSTEM_IMPLICIT_EXTERN_C matching
591 of return types and parms.
592 * parser.c (cp_parser_parameter_declaration_clause): Likewise,
593 '()' always means '(void)'.
595 2018-08-29 Jakub Jelinek <jakub@redhat.com>
598 * decl.c (begin_destructor_body): If current_class_type has
599 virtual bases and the primary base is nearly empty virtual base,
600 voidify clearing of vptr and make it conditional on in-charge
603 2018-08-29 Paolo Carlini <paolo.carlini@oracle.com>
606 * parser.c (cp_parser_introduction_list): If cp_parser_identifier
607 returns error_mark_node early exit the loop.
608 (cp_parser_template_introduction): Improve error-recovery, remove
609 error call about empty introduction-list.
611 2018-08-29 David Malcolm <dmalcolm@redhat.com>
614 * call.c (print_conversion_rejection): Add "fn" param and use it
615 for "no known conversion" messages to underline the pertinent
617 (print_z_candidate): Supply "fn" to the new param above.
619 2018-08-29 Jakub Jelinek <jakub@redhat.com>
622 * pt.c (tsubst_expr) <case RANGE_FOR_STMT>: If
623 processing_template_decl and decl is structured binding decl, call
626 2018-08-28 Paolo Carlini <paolo.carlini@oracle.com>
629 * decl.c (finish_case_label): If the type is erroneous early
630 return error_mark_node.
632 2018-08-27 David Malcolm <dmalcolm@redhat.com>
635 * parser.c (cp_parser_diagnose_invalid_type_name): Add fix-it
638 2018-08-27 Jakub Jelinek <jakub@redhat.com>
641 * cp-tree.h (cxx_readonly_error): Add location_t argument.
642 * typeck2.c (cxx_readonly_error): Add LOC argument, pass it to
643 ERROR_FOR_ASSIGNMENT macro and readonly_error. Add LOC argument
644 to ERROR_FOR_ASSIGNMENT macro, use error_at instead of error and
645 pass LOC to it. Formatting fixes.
646 * typeck.c (cp_build_unary_op): Pass location to cxx_readonly_error.
647 (cp_build_modify_expr): Pass loc to cxx_readonly_error.
648 * semantics.c (finish_asm_stmt): Pass input_location to
651 2018-08-27 David Malcolm <dmalcolm@redhat.com>
654 * decl.c (grokdeclarator): Update for conversion of show_caret_p
656 * error.c (cp_printer): Likewise.
657 * name-lookup.c (maybe_suggest_missing_std_header): Update call to
658 maybe_add_include_fixit to suggest overriding the location, as it
660 * parser.c (cp_parser_string_literal): Update for conversion of
661 show_caret_p to a tri-state.
662 (cp_parser_elaborated_type_specifier): Likewise.
663 (set_and_check_decl_spec_loc): Likewise.
664 * pt.c (listify): Update call to maybe_add_include_fixit to not
665 override the location, as it is for an error.
666 * rtti.c (typeid_ok_p): Likewise.
668 2018-08-27 Martin Liska <mliska@suse.cz>
670 * call.c (build_call_a): Use new function
671 fndecl_built_in_p and remove check for FUNCTION_DECL if
673 (build_cxx_call): Likewise.
674 * constexpr.c (constexpr_fn_retval): Likewise.
675 (cxx_eval_builtin_function_call): Likewise.
676 (cxx_eval_call_expression): Likewise.
677 (potential_constant_expression_1): Likewise.
678 * cp-gimplify.c (cp_gimplify_expr): Likewise.
680 * decl.c (decls_match): Likewise.
681 (validate_constexpr_redeclaration): Likewise.
682 (duplicate_decls): Likewise.
683 (make_rtl_for_nonlocal_decl): Likewise.
684 * name-lookup.c (consider_binding_level): Likewise.
685 (cp_emit_debug_info_for_using): Likewise.
686 * semantics.c (finish_call_expr): Likewise.
687 * tree.c (builtin_valid_in_constant_expr_p): Likewise.
689 2018-08-26 Marek Polacek <polacek@redhat.com>
692 * typeck.c (maybe_warn_pessimizing_move): Do nothing in a template.
694 PR c++/87029, Implement -Wredundant-move.
695 * typeck.c (treat_lvalue_as_rvalue_p): New function.
696 (maybe_warn_pessimizing_move): Call convert_from_reference.
697 Warn about redundant moves.
699 2018-08-24 Marek Polacek <polacek@redhat.com>
703 * decl.c (grokdeclarator): Disallow functions with trailing return
704 type with decltype(auto) as its type. Also check the function if
705 it's inner declarator doesn't exist
707 2018-08-21 Marek Polacek <polacek@redhat.com>
710 * parser.c (cp_parser_lambda_introducer): Give error if a non-local
711 lambda has a capture-default.
713 2018-08-21 Paolo Carlini <paolo.carlini@oracle.com>
715 * decl.c (check_static_variable_definition): Change to return void.
717 2018-08-21 Marek Polacek <polacek@redhat.com>
719 PR c++/86981, Implement -Wpessimizing-move.
720 * typeck.c (decl_in_std_namespace_p): New.
721 (is_std_move_p): New.
722 (maybe_warn_pessimizing_move): New.
723 (can_do_nrvo_p): New, factored out of ...
724 (check_return_expr): ... here. Warn about potentially harmful
725 std::move in a return statement.
728 * call.c (standard_conversion): Set check_narrowing.
729 * typeck2.c (check_narrowing): Use CP_INTEGRAL_TYPE_P rather
730 than comparing with INTEGER_TYPE.
732 * cp-tree.h: Fix typo.
734 2018-08-20 David Malcolm <dmalcolm@redhat.com>
737 * call.c (build_user_type_conversion_1): Add auto_diagnostic_group
739 (print_error_for_call_failure): Likewise.
740 (build_op_call_1): Likewise.
741 (build_conditional_expr_1): Likewise.
742 (build_new_op_1): Likewise.
743 (build_op_delete_call): Likewise.
744 (convert_like_real): Likewise.
745 (build_over_call): Likewise.
746 (build_new_method_call_1): Likewise.
748 * class.c (check_tag): Likewise.
749 (finish_struct_anon_r): Likewise.
750 (one_inherited_ctor): Likewise.
751 (finalize_literal_type_property): Likewise.
752 (explain_non_literal_class): Likewise.
753 (find_flexarrays): Likewise.
754 (resolve_address_of_overloaded_function): Likewise.
755 * constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
756 (is_valid_constexpr_fn): Likewise.
757 (cx_check_missing_mem_inits): Likewise.
758 * cp-gimplify.c (cp_genericize_r): Likewise.
759 * cvt.c (maybe_warn_nodiscard): Likewise.
760 * decl.c (warn_extern_redeclared_static): Likewise.
761 (check_redeclaration_exception_specification): Likewise.
762 (check_no_redeclaration_friend_default_args): Likewise.
763 (duplicate_decls): Likewise.
764 (redeclaration_error_message): Likewise.
765 (warn_misplaced_attr_for_class_type): Likewise.
766 * decl2.c (finish_static_data_member_decl): Likewise.
767 (no_linkage_error): Likewise.
768 (cp_warn_deprecated_use): Likewise.
769 * error.c (qualified_name_lookup_error): Likewise.
770 * friend.c (make_friend_class): Likewise.
771 (do_friend): Likewise.
772 * init.c (perform_member_init): Likewise.
773 (build_new_1): Likewise.
774 (build_vec_delete_1): Likewise.
775 (build_delete): Likewise.
776 * lex.c (unqualified_name_lookup_error): Likewise.
777 * name-lookup.c (check_extern_c_conflict): Likewise.
778 (inform_shadowed): New function.
779 (check_local_shadow): Add auto_diagnostic_group instances,
780 replacing goto "inform_shadowed" label with call to subroutine.
781 (set_local_extern_decl_linkage): Add auto_diagnostic_group
783 * parser.c (cp_parser_diagnose_invalid_type_name): Likewise.
784 (cp_parser_namespace_name): Likewise.
785 * pt.c (check_specialization_namespace): Likewise.
786 (check_template_variable): Likewise.
787 (warn_spec_missing_attributes): Likewise.
788 (check_explicit_specialization): Likewise.
789 (process_partial_specialization): Likewise.
790 (lookup_template_class_1): Likewise.
791 (finish_template_variable): Likewise.
792 (do_auto_deduction): Likewise.
793 * search.c (check_final_overrider): Likewise.
794 (look_for_overrides_r): Likewise.
795 * tree.c (maybe_warn_parm_abi): Likewise.
796 * typeck.c (cxx_sizeof_expr): Likewise.
797 (cp_build_function_call_vec): Likewise.
798 (cp_build_binary_op): Likewise.
799 (convert_for_assignment): Likewise.
800 (maybe_warn_about_returning_address_of_local): Likewise.
801 * typeck2.c (abstract_virtuals_error_sfinae): Likewise.
802 (check_narrowing): Likewise.
804 2018-08-17 David Malcolm <dmalcolm@redhat.com>
806 * typeck.c (string_conv_p): Extract location from EXP and use it
807 in preference to input_location when issuing warnings.
809 2018-08-15 David Malcolm <dmalcolm@redhat.com>
811 * call.c: Include "gcc-rich-location.h".
812 (convert_like_real): Add range label for "invalid conversion"
814 (perform_implicit_conversion_flags): Add type label to the
815 "could not convert" error.
816 * error.c: Include "gcc-rich-location.h".
817 (range_label_for_type_mismatch::get_text): New function.
818 * typeck.c (convert_for_assignment): Add type label to
819 the "cannot convert" error if a location is available.
821 2018-08-15 Paolo Carlini <paolo.carlini@oracle.com>
823 * decl.c (check_previous_goto_1): When decl_jump_unsafe returns 2
824 emit an error instead of a permerror.
826 2018-08-13 Marek Polacek <polacek@redhat.com>
829 * call.c (struct conversion): Add check_narrowing_const_only.
830 (build_converted_constant_expr): Set check_narrowing and
831 check_narrowing_const_only. Give error if expr is error node.
832 (convert_like_real): Pass it to check_narrowing.
833 * cp-tree.h (check_narrowing): Add a default parameter.
834 * decl.c (compute_array_index_type): Use input_location instead of
836 * pt.c (convert_nontype_argument): Return NULL_TREE if tf_error.
837 * typeck2.c (check_narrowing): Don't warn for instantiation-dependent
838 expressions. Call maybe_constant_value instead of
839 fold_non_dependent_expr. Don't mention { } in diagnostic. Only check
840 narrowing for constants if CONST_ONLY.
842 2018-08-13 Martin Sebor <msebor@redhat.com>
844 PR tree-optimization/71625
845 * decl.c (check_initializer): Call braced_list_to_string.
846 (eval_check_narrowing): New function.
847 * gcc/cp/typeck2.c (digest_init_r): Accept strings literals
848 as initilizers for all narrow character types.
850 2018-08-13 Marek Polacek <polacek@redhat.com>
852 P0806R2 - Deprecate implicit capture of this via [=]
853 * lambda.c (add_default_capture): Formatting fixes. Warn about
854 deprecated implicit capture of this via [=].
857 * decl.c (create_array_type_for_decl): Handle null name.
859 2018-08-10 Jason Merrill <jason@redhat.com>
861 PR c++/86728 - C variadic generic lambda.
862 * parser.c (cp_parser_parameter_declaration): Don't turn 'auto' into
863 a pack if it's followed by a declarator-id.
865 2018-08-08 Jakub Jelinek <jakub@redhat.com>
867 P0595R1 - is_constant_evaluated
868 * cp-tree.h (enum cp_built_in_function): New.
869 (maybe_constant_init): Add pretend_const_required argument.
870 * typeck2.c (store_init_value): Pass true as new argument to
872 * constexpr.c (constexpr_fn_retval): Check also DECL_BUILT_IN_CLASS
873 for BUILT_IN_UNREACHABLE.
874 (struct constexpr_ctx): Add pretend_const_required field.
875 (cxx_eval_builtin_function_call): Use DECL_IS_BUILTIN_CONSTANT_P
876 macro. Handle CP_BUILT_IN_IS_CONSTANT_EVALUATED. Check also
877 DECL_BUILT_IN_CLASS for BUILT_IN_UNREACHABLE.
878 (cxx_eval_outermost_constant_expr): Add pretend_const_required
879 argument, initialize pretend_const_required field in ctx. If the
880 result is TREE_CONSTANT and non_constant_p, retry with
881 pretend_const_required false if it was true.
882 (is_sub_constant_expr): Initialize pretend_const_required_field in
884 (cxx_constant_value): Pass true as pretend_const_required to
885 cxx_eval_outermost_constant_expr.
886 (maybe_constant_value): Pass false as pretend_const_required to
887 cxx_eval_outermost_constant_expr.
888 (fold_non_dependent_expr): Likewise.
889 (maybe_constant_init_1): Add pretend_const_required argument, pass it
890 down to cxx_eval_outermost_constant_expr. Pass !allow_non_constant
891 instead of false as strict to cxx_eval_outermost_constant_expr.
892 (maybe_constant_init): Add pretend_const_required argument, pass it
893 down to maybe_constant_init_1.
894 (cxx_constant_init): Pass true as pretend_const_required to
895 maybe_constant_init_1.
896 * cp-gimplify.c (cp_gimplify_expr): Handle CALL_EXPRs to
897 CP_BUILT_IN_IS_CONSTANT_EVALUATED.
898 (cp_fold): Don't fold CP_BUILT_IN_IS_CONSTANT_EVALUATED calls.
899 * decl.c: Include langhooks.h.
900 (cxx_init_decl_processing): Register __builtin_is_constant_evaluated
902 * tree.c (builtin_valid_in_constant_expr_p): Return true for
903 CP_BUILT_IN_IS_CONSTANT_EVALUATED.
904 * pt.c (declare_integer_pack): Initialize DECL_FUNCTION_CODE.
907 * pt.c (tsubst_expr): For structured bindings, call tsubst_decomp_names
908 before tsubst_init, not after it.
911 * constexpr.c (cxx_eval_binary_expression): For arithmetics involving
912 NULL pointer set *non_constant_p to true.
913 (cxx_eval_component_reference): For dereferencing of a NULL pointer,
914 set *non_constant_p to true and return t.
916 2018-08-07 Paolo Carlini <paolo.carlini@oracle.com>
919 * decl.c (check_no_redeclaration_friend_default_args): New.
920 (duplicate_decls): Use the latter; also check that a friend
921 declaration specifying default arguments is a definition.
923 2018-08-07 Ville Voutilainen <ville.voutilainen@gmail.com>
926 * name-lookup.c (check_local_shadow): Reject captures and parameters
929 2018-08-06 Marek Polacek <polacek@redhat.com>
932 * constexpr.c (cxx_eval_statement_list): Handle continue.
934 2018-08-03 David Malcolm <dmalcolm@redhat.com>
935 Jonathan Wakely <jwakely@redhat.com>
937 * decl.c: Include "gcc-rich-location.h".
938 (add_return_star_this_fixit): New function.
939 (finish_function): When warning about missing return statements in
940 functions returning non-void, add a "return *this;" fix-it hint for
941 assignment operators.
943 2018-08-03 Jason Merrill <jason@redhat.com>
946 * class.c (build_base_path): Use currently_open_class.
948 2018-08-02 David Malcolm <dmalcolm@redhat.com>
950 * error.c (cxx_print_error_function): Duplicate "file" before
951 passing it to pp_set_prefix.
952 (cp_print_error_function): Use pp_take_prefix when saving the
955 2018-08-02 Richard Biener <rguenther@suse.de>
958 * class.c (layout_class_type): Copy TYPE_TYPELESS_STORAGE
959 to the CLASSTYPE_AS_BASE.
961 2018-08-01 Martin Sebor <msebor@redhat.com>
963 PR tree-optimization/86650
964 * error.c (cp_printer): Move usage of EXPR_LOCATION (t) and
965 TREE_BLOCK (t) from within percent_K_format to this callsite.
967 2018-08-01 Paolo Carlini <paolo.carlini@oracle.com>
970 * class.c (note_name_declared_in_class): Use location_of in permerror
971 instead of DECL_SOURCE_LOCATION (for OVERLOADs).
973 2018-07-31 Tom de Vries <tdevries@suse.de>
976 * optimize.c (update_cloned_parm): Copy DECL_BY_REFERENCE.
978 2018-07-31 Jakub Jelinek <jakub@redhat.com>
980 P1008R1 - prohibit aggregates with user-declared constructors
981 * class.c (check_bases_and_members): For C++2a set
982 CLASSTYPE_NON_AGGREGATE based on TYPE_HAS_USER_CONSTRUCTOR rather than
983 type_has_user_provided_or_explicit_constructor.
985 2018-07-31 Martin Liska <mliska@suse.cz>
988 * parser.c (cp_parser_condition): Initialize non_constant_p
991 2018-07-28 David Malcolm <dmalcolm@redhat.com>
993 * error.c (cp_printer): In the leading comment, move "%H" and "%I"
994 into alphabetical order, and add missing "%G" and "%K". Within
995 the switch statement, move cases 'G', 'H', 'I' and 'K' so that the
996 cases are in alphabetical order.
998 2018-07-25 Jakub Jelinek <jakub@redhat.com>
1000 * cp-tree.h (enum cp_tree_index): Add
1001 CPTI_{ABI_TAG,ALIGNED,BEGIN,END,GET,TUPLE_{ELEMENT,SIZE}}_IDENTIFIER
1002 and CPTI_{GNU,TYPE,VALUE,FUN,CLOSURE}_IDENTIFIER.
1003 (abi_tag_identifier, aligned_identifier, begin_identifier,
1004 end_identifier, get__identifier, gnu_identifier,
1005 tuple_element_identifier, tuple_size_identifier, type_identifier,
1006 value_identifier, fun_identifier, closure_identifier): Define.
1007 * decl.c (initialize_predefined_identifiers): Initialize the above
1009 (get_tuple_size): Use tuple_size_identifier instead of
1010 get_identifier ("tuple_size") and value_identifier instead of
1011 get_identifier ("value").
1012 (get_tuple_element_type): Use tuple_element_identifier instead of
1013 get_identifier ("tuple_element") and type_identifier instead of
1014 get_identifier ("type").
1015 (get_tuple_decomp_init): Use get__identifier instead of
1016 get_identifier ("get").
1017 * lambda.c (maybe_add_lambda_conv_op): Use fun_identifier instead of
1018 get_identifier ("_FUN").
1019 * parser.c (cp_parser_lambda_declarator_opt): Use closure_identifier
1020 instead of get_identifier ("__closure").
1021 (cp_parser_std_attribute): Use gnu_identifier instead of
1022 get_identifier ("gnu").
1023 (cp_parser_std_attribute_spec): Likewise. Use aligned_identifier
1024 instead of get_identifier ("aligned").
1025 * class.c (check_abi_tags, inherit_targ_abi_tags): Use
1026 abi_tag_identifier instead of get_identifier ("abi_tag").
1029 * cp-tree.h (enum cp_tree_index): Add
1030 CPTI_FOR_{RANGE,BEGIN,END}{,_}_IDENTIFIER.
1031 (for_range__identifier, for_begin__identifier, for_end__identifier,
1032 for_range_identifier, for_begin_identifier, for_end_identifier):
1034 * decl.c (initialize_predefined_identifiers): Initialize
1035 for_{range,begin,end}{,_}_identifier.
1036 * parser.c (build_range_temp): Use for_range__identifier instead of
1037 get_identifier ("__for_range").
1038 (cp_convert_range_for): Use for_begin__identifier and
1039 for_end__identifier instead of get_identifier ("__for_begin") and
1040 get_identifier ("__for_end").
1041 * semantics.c (finish_for_stmt): Rename "__for_{range,begin,end} "
1042 local symbols to "__for_{range,begin,end}".
1044 2018-07-23 Jakub Jelinek <jakub@redhat.com>
1047 * cp-gimplify.c (cp_fold): Don't fold comparisons into other kind
1048 of expressions other than INTEGER_CST regardless of TREE_NO_WARNING
1049 or warn_nonnull_compare.
1051 2018-07-19 Paolo Carlini <paolo.carlini@oracle.com>
1053 Revert fix for c++/59480 (and testsuite followup)
1055 2019-07-18 Paolo Carlini <paolo.carlini@oracle.com>
1057 PR c++/59480, DR 136
1058 * decl.c (check_no_redeclaration_friend_default_args): New.
1059 (duplicate_decls): Use the latter; also check that a friend
1060 declaration specifying default arguments is a definition.
1062 2018-07-18 Jakub Jelinek <jakub@redhat.com>
1065 * parser.c (cp_parser_decl_specifier_seq): Diagnose invalid type
1066 specifier if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR.
1068 2018-07-18 Marek Polacek <polacek@redhat.com>
1070 PR c++/86190 - bogus -Wsign-conversion warning
1071 * typeck.c (cp_build_binary_op): Fix formatting. Add a warning
1074 2018-07-18 Paolo Carlini <paolo.carlini@oracle.com>
1076 PR c++/59480, DR 136
1077 * decl.c (check_no_redeclaration_friend_default_args): New.
1078 (duplicate_decls): Use the latter; also check that a friend
1079 declaration specifying default arguments is a definition.
1081 2018-07-18 Paolo Carlini <paolo.carlini@oracle.com>
1083 * class.c (note_name_declared_in_class): Prefer permerror + inform
1084 to a pair of permerrors; use DECL_SOURCE_LOCATION.
1086 2018-07-18 Richard Biener <rguenther@suse.de>
1089 * decl2.c (c_parse_final_cleanups): Call write_out_vars before
1090 start_static_storage_duration_function sets current_function_decl.
1092 2018-07-17 Jason Merrill <jason@redhat.com>
1094 PR c++/86480 - nested variadic lambda and constexpr if.
1095 * pt.c (find_parameter_packs_r) [IF_STMT]: Don't walk into
1097 * tree.c (cp_walk_subtrees) [DECLTYPE_TYPE]: Set
1098 cp_unevaluated_operand.
1099 [ALIGNOF_EXPR] [SIZEOF_EXPR] [NOEXCEPT_EXPR]: Likewise.
1101 2018-07-16 Paolo Carlini <paolo.carlini@oracle.com>
1103 * class.c (resolve_address_of_overloaded_function): Don't emit an
1104 inform if the matching permerror returns false.
1105 * pt.c (check_specialization_namespace): Likewise.
1107 2018-07-16 Jakub Jelinek <jakub@redhat.com>
1111 * cp-gimplify.c (cp_genericize_r): When using extern_decl_map, or
1112 in TREE_USED flag from stmt to h->to.
1114 2018-07-13 Nathan Sidwell <nathan@acm.org>
1117 * pt.c (lookup_template_class_1): Use tsubst_aggr_type for
1118 contexts that are classes.
1119 * parser.c (cp_parser_template_id): Combine entering_scope decl &
1122 2018-07-12 Jakub Jelinek <jakub@redhat.com>
1124 * decl2.c (cplus_decl_attributes): Don't diagnose vars without mappable
1125 type here, instead add "omp declare target implicit" attribute. Add
1126 that attribute instead of "omp declare target" also when
1127 processing_template_decl.
1128 * decl.c (cp_finish_decl): Diagnose vars without mappable type here,
1129 and before calling cp_omp_mappable_type call complete_type.
1131 2018-07-10 Jakub Jelinek <jakub@redhat.com>
1134 * cp-gimplify.c (cp_maybe_instrument_return): Skip trailing
1138 * semantics.c (handle_omp_for_class_iterator): Remove lastp argument,
1139 instead of setting *lastp turn orig_declv elt into a TREE_LIST.
1140 (finish_omp_for): Adjust handle_omp_for_class_iterator caller.
1141 * pt.c (tsubst_omp_for_iterator): Allow OMP_FOR_ORIG_DECLS to contain
1142 TREE_LIST for both the original class iterator and the "last" helper
1145 2018-07-09 Paolo Carlini <paolo.carlini@oracle.com>
1147 * decl.c (grokdeclarator): Use rich_location::add_range in three
1148 more places; include gcc-rich-location.h.
1150 2018-07-07 Aldy Hernandez <aldyh@redhat.com>
1152 * decl.c (build_enumerator): Change overflow type to overflow_type.
1153 * init.c (build_new_1): Same.
1155 2018-07-05 Nathan Sidwell <nathan@acm.org>
1157 * cp/decl.c (decls_match): Check SYSTEM_IMPLICIT_EXTERN_C not
1158 NO_IMPLICIT_EXTERN_C.
1159 * cp/parser.c (cp_parser_parameter_declaration_clause): Likewise.
1161 2018-07-04 Ville Voutilainen <ville.voutilainen@gmail.com>
1164 * method.c (is_trivially_xible): Return false
1165 if is_xible_helper returns a NULL_TREE.
1167 2018-07-03 Paolo Carlini <paolo.carlini@oracle.com>
1169 * decl.c (min_location): New.
1170 (smallest_type_quals_location): Use the latter.
1171 (check_concept_fn): Use DECL_SOURCE_LOCATION.
1172 (grokdeclarator): Use accurate locations in a number of error
1173 messages involving ds_thread, ds_storage_class, ds_virtual,
1174 ds_constexpr, ds_typedef and ds_friend; exploit min_location.
1176 2018-07-03 Marek Polacek <polacek@redhat.com>
1179 * typeck.c (cp_build_binary_op): Check c_inhibit_evaluation_warnings.
1181 2018-07-03 Jason Merrill <jason@redhat.com>
1183 PR c++/86378 - functional cast in noexcept-specifier.
1184 * tree.c (strip_typedefs_expr) [TREE_LIST]: Fix iteration.
1186 2018-07-02 Paolo Carlini <paolo.carlini@oracle.com>
1188 * parser.c (set_and_check_decl_spec_loc): Use rich_location::add_range
1189 in error message about __thread and thread_local at the same time.
1191 2018-06-29 Marek Polacek <polacek@redhat.com>
1194 * tree.c (cp_save_expr): Don't call save_expr for TARGET_EXPRs.
1196 2018-06-28 David Malcolm <dmalcolm@redhat.com>
1198 * parser.c (cp_parser_error_1): After issuing a conflict marker
1199 error, consume tokens until the end of the source line.
1201 2018-06-28 Jason Merrill <jason@redhat.com>
1203 PR c++/86342 - -Wdeprecated-copy and system headers.
1204 * decl2.c (cp_warn_deprecated_use): Don't warn about declarations
1207 2018-06-27 David Malcolm <dmalcolm@redhat.com>
1210 * name-lookup.c (consider_binding_level): Filter out names that
1211 match anon_aggrname_p.
1213 2018-06-27 Jason Merrill <jason@redhat.com>
1215 * name-lookup.c (do_pushtag): If we skip a class level, also skip
1218 2018-06-26 Jason Merrill <jason@redhat.com>
1220 PR c++/86320 - memory-hog with std::array of pair
1221 * typeck2.c (process_init_constructor_array): Only compute a
1222 constant initializer once.
1224 PR c++/80290 - memory-hog with std::pair.
1225 * pt.c (fn_type_unification): Add convs parameter.
1226 (check_non_deducible_conversion): Remember conversion.
1227 (check_non_deducible_conversions): New. Do checks here.
1228 (type_unification_real): Not here. Remove flags parm.
1229 * call.c (add_function_candidate): Make convs a parameter.
1230 Don't recalculate the conversion if it's already set.
1231 (add_template_candidate_real): Allocate convs here.
1232 (good_conversion, conv_flags): New.
1234 2018-06-26 Jakub Jelinek <jakub@redhat.com>
1237 * parser.c (cp_parser_omp_for_loop_init): Change for_block argument
1238 type from vec<tree, va_gc> * to vec<tree, va_gc> *&.
1240 2018-06-23 Paolo Carlini <paolo.carlini@oracle.com>
1242 * decl.c (bad_specifiers): Add const location_t* parameter and
1243 use locations in error messages about 'inline' and 'virtual'.
1244 (mark_inline_variable): Add location_t parameter and use it in
1245 error_at and pedwarn messages.
1246 (grokdeclarator): Use declspecs->locations[ds_constexpr],
1247 declspecs->locations[ds_concept], declspecs->locations[ds_virtual],
1248 declspecs->locations[ds_inline] in many error messages; adjust
1249 bad_specifiers and mark_inline_variable calls.
1250 (grokvardecl): Use declspecs->locations[ds_concept] in error message.
1252 2018-06-22 Jason Merrill <jason@redhat.com>
1254 PR c++/86219 - ICE with erroneous initializer in template.
1255 * constexpr.c (fold_non_dependent_expr): Add complain parm.
1256 * call.c, expr.c, init.c, pt.c, semantics.c, typeck.c, typeck2.c:
1258 * call.c (build_cxx_call): Don't mess with builtins in a template.
1259 * typeck2.c (store_init_value): If fold_non_dependent_expr didn't
1260 produce a constant value, go back to the uninstantiated form.
1262 Avoid taking the address of something just because it's in parens.
1263 * constexpr.c (same_type_ignoring_tlq_and_bounds_p): New.
1264 (cxx_fold_indirect_ref): Use it.
1265 (cxx_eval_constant_expression) [VIEW_CONVERT_EXPR]: Use it.
1266 * cp-tree.h (REF_PARENTHESIZED_P): Allow VIEW_CONVERT_EXPR.
1267 * semantics.c (force_paren_expr): Use VIEW_CONVERT_EXPR instead of
1268 static_cast to reference type.
1269 (maybe_undo_parenthesized_ref): Handle VIEW_CONVERT_EXPR.
1271 2018-06-21 Jason Merrill <jason@redhat.com>
1273 * pt.c (tsubst) [TEMPLATE_TYPE_PARM]: Use TEMPLATE_PARM_DESCENDANTS.
1275 * name-lookup.c (do_push_to_top_level): Don't allocate
1277 (do_pop_from_top_level): Release current_lang_base.
1279 Let -fmem-report see callers of cxx_make_type.
1280 * lex.c (cxx_make_type): Add MEM_STAT_DECL.
1281 (make_class_type): Likewise.
1282 (cxx_make_type_hook): New.
1283 * cp-objcp-common.h (LANG_HOOKS_MAKE_TYPE): Use cxx_make_type_hook.
1285 2018-06-20 Nathan Sidwell <nathan@acm.org>
1288 * friend.c (add_friend): Keep lookup sets of tempate sets.
1290 2018-06-20 Paolo Carlini <paolo.carlini@oracle.com>
1292 * decl.c (grokfndecl): Add const cp_decl_specifier_seq* parameter;
1293 tidy handling of a null location_t argument; use proper location
1294 information in a few additional error messages.
1295 (grokdeclarator): Update calls.
1297 2018-06-20 Chung-Lin Tang <cltang@codesourcery.com>
1298 Thomas Schwinge <thomas@codesourcery.com>
1299 Cesar Philippidis <cesar@codesourcery.com>
1301 * parser.c (cp_parser_omp_clause_name): Add support for finalize
1302 and if_present. Make present_or_{copy,copyin,copyout,create} aliases
1303 to their non-present_or_* counterparts. Make 'self' an alias to
1304 PRAGMA_OACC_CLAUSE_HOST.
1305 (cp_parser_oacc_data_clause): Update GOMP mappings for
1306 PRAGMA_OACC_CLAUSE_{COPY,COPYIN,COPYOUT,CREATE,DELETE}. Remove
1307 PRAGMA_OACC_CLAUSE_{SELF,PRESENT_OR_*}.
1308 (cp_parser_oacc_all_clauses): Handle finalize and if_present clauses.
1309 Remove support for present_or_* clauses.
1310 (OACC_KERNELS_CLAUSE_MASK): Remove PRESENT_OR_* clauses.
1311 (OACC_PARALLEL_CLAUSE_MASK): Likewise.
1312 (OACC_DECLARE_CLAUSE_MASK): Likewise.
1313 (OACC_DATA_CLAUSE_MASK): Likewise.
1314 (OACC_ENTER_DATA_CLAUSE_MASK): Remove PRESENT_OR_* clauses.
1315 (OACC_EXIT_DATA_CLAUSE_MASK): Add FINALIZE clause.
1316 (OACC_UPDATE_CLAUSE_MASK): Remove SELF, add IF_PRESENT.
1317 (cp_parser_oacc_declare): Remove PRESENT_OR_* clauses.
1318 * pt.c (tsubst_omp_clauses): Handle IF_PRESENT and FINALIZE.
1319 * semantics.c (finish_omp_clauses): Handle IF_PRESENT and FINALIZE.
1321 2018-06-20 Marek Polacek <polacek@redhat.com>
1324 * constexpr.c (cxx_eval_constant_expression): Handle ABSU_EXPR.
1325 (fold_simple_1): Likewise.
1326 * error.c (dump_expr): Likewise.
1328 2018-06-20 Nathan Sidwell <nathan@acm.org>
1331 * cp-tree.h (lookup_keep): Drop KEEP parm.
1332 (lookup_list_keep): Delete.
1333 (maybe_get_fns): Declare.
1334 * parser.c (cp_parser_primary_expression): Call lookup_keep here.
1335 (cp_parser_template_id): Not here ...
1336 * decl.c (cp_finish_decl): ... nor here ...
1337 * init.c (build_raw_new_expr): ... nor here ...
1338 * pt.c (process_template_parm): ... nor here ...
1339 * semantics.c (perform_koenig_lookup): Call lookup_keep.
1340 (finish_call_expr): Not here.
1341 * tree.c (ovl_cache): Delete.
1342 (ovl_make, ovl_copy): No cache.
1343 (lookup_keep): Always keep.
1344 (lookup_list_keep): Delete.
1345 (maybe_get_fns): New, broken out of ...
1346 (get_fns): ... here. Call it.
1347 (built_min_nt_loc, build_min, build_min_non_dep): Drop lookup_keep.
1348 (build_min_nt_call_vec): Likewise.
1350 2018-06-19 Jason Merrill <jason@redhat.com>
1352 * cp-tree.h (CONSTRUCTOR_NO_IMPLICIT_ZERO): Remove.
1353 * constexpr.c: Use CONSTRUCTOR_NO_CLEARING instead.
1355 PR c++/86182 - ICE with anonymous union passed to template.
1356 * pt.c (tsubst_expr) [DECL_EXPR]: Handle an anonymous union type
1357 used to declare a named variable.
1359 2018-06-18 Jason Merrill <jason@redhat.com>
1361 * tree.c (cp_expr_location): New.
1362 * cp-tree.h (cp_expr_loc_or_loc): New.
1363 * call.c, cvt.c, constexpr.c, constraint.cc, cp-gimplify.c, decl.c,
1364 error.c, init.c, lex.c, parser.c, pt.c, semantics.c, typeck.c,
1365 typeck2.c: Use it instead of EXPR_LOC_OR_LOC.
1367 * parser.c (cp_parser_lambda_expression): Use a range for
1368 LAMBDA_EXPR_LOCATION.
1370 PR c++/86200 - ICE with unexpanded pack in lambda parameter.
1371 * pt.c (find_parameter_packs_r) [LAMBDA_EXPR]: Also look into the
1374 PR c++/81060 - ICE with unexpanded parameter pack.
1375 * pt.c (check_for_bare_parameter_packs): Add loc parameter.
1376 * decl.c (grokdeclarator): Call it for qualifying_scope.
1378 PR c++/86171 - ICE with recursive alias instantiation.
1379 * pt.c (tsubst_decl): Handle recursive alias instantiation.
1381 2018-06-18 Paolo Carlini <paolo.carlini@oracle.com>
1383 * decl.c (duplicate_decls): Consistently use DECL_SOURCE_LOCATION
1384 in errors about redefined default arguments; tidy.
1386 2018-06-16 Kugan Vivekanandarajah <kuganv@linaro.org>
1388 * constexpr.c (potential_constant_expression_1): Handle ABSU_EXPR.
1389 * cp-gimplify.c (cp_fold): Likewise.
1391 2018-06-15 Jason Merrill <jason@redhat.com>
1393 PR c++/86147 - wrong capture for template argument.
1394 * expr.c (mark_use): Look through NOP_EXPR.
1396 * name-lookup.c (do_pushtag): Don't look through complete types, but
1397 don't add to them either. Get context from current_binding_level.
1398 * pt.c (tsubst_default_argument): Use push_to/pop_from_top_level.
1400 * decl.c (start_enum): Do compare dependent underlying type.
1402 PR c++/82882 - ICE with lambda in template default argument.
1403 * lambda.c (record_null_lambda_scope): New.
1404 * pt.c (tsubst_lambda_expr): Use it.
1405 * name-lookup.c (do_pushtag): Don't give a lambda DECL_CONTEXT of a
1406 function that isn't open.
1408 * tree.c (maybe_warn_parm_abi): Inform the location of the class.
1410 2018-06-14 Marek Polacek <polacek@redhat.com>
1413 * decl2.c (cp_check_const_attributes): Skip trees that are not
1416 2018-06-14 Jakub Jelinek <jakub@redhat.com>
1418 P0624R2 - Default constructible and assignable stateless lambdas
1419 * method.c (synthesized_method_walk): For C++2a don't mark
1420 sfk_constructor or sfk_copy_assignment as deleted if lambda has
1423 2018-06-14 Paolo Carlini <paolo.carlini@oracle.com>
1425 * decl.c (duplicate_decls): Use DECL_SOURCE_LOCATION in
1426 OPT_Wshadow warning_at.
1427 (grokfndecl): Consistently use the location_t argument in
1428 literal operator diagnostic messages.
1429 (grokdeclarator): Use declspecs->locations[ds_storage_class]
1431 * decl2.c (finish_static_data_member_decl): Use DECL_SOURCE_LOCATION
1434 2018-06-13 Jason Merrill <jason@redhat.com>
1436 PR c++/86099 - ICE with trivial copy and non-trivial default ctor.
1437 * constexpr.c (instantiate_cx_fn_r): Don't synthesize trivial
1440 PR c++/86094 - wrong code with defaulted move ctor.
1441 * class.c (classtype_has_non_deleted_move_ctor): New.
1442 * tree.c (maybe_warn_parm_abi, type_has_nontrivial_copy_init):
1443 Handle v12 breakage.
1445 2018-06-12 Jason Merrill <jason@redhat.com>
1447 PR c++/86098 - ICE with template placeholder for TTP.
1448 * typeck.c (structural_comptypes) [TEMPLATE_TYPE_PARM]: Check
1449 CLASS_PLACEHOLDER_TEMPLATE.
1451 2018-06-12 Paolo Carlini <paolo.carlini@oracle.com>
1453 * decl2.c (coerce_new_type, coerce_delete_type): Add location_t
1454 parameter and adjust error_at calls.
1455 * decl.c (grok_op_properties): Adjust calls.
1456 * cp-tree.h (oerce_new_type, coerce_delete_type): Adjust decls.
1458 2018-06-12 Marek Polacek <polacek@redhat.com>
1460 Core issue 1331 - const mismatch with defaulted copy constructor
1461 * class.c (check_bases_and_members): When checking a defaulted
1462 function, mark it as deleted rather than giving an error.
1464 2018-06-11 Jason Merrill <jason@redhat.com>
1466 PR c++/85792 -Wctor-dtor-privacy and inherited constructor.
1467 * class.c (maybe_warn_about_overly_private_class): Handle inherited
1470 PR c++/85963 - -Wunused-but-set with ?: in template.
1471 * pt.c (tsubst_copy_and_build) [COND_EXPR]: Call mark_rvalue_use.
1473 2018-06-11 Paolo Carlini <paolo.carlini@oracle.com>
1475 * decl.c (grok_op_properties): Consistently use the location
1476 of the decl; remove special casing of POSTINCREMENT_EXPR and
1477 POSTDECREMENT_EXPR wrt default arguments.
1479 2018-06-05 Jason Merrill <jason@redhat.com>
1481 * constexpr.c (cxx_eval_binary_expression): Special case comparison
1482 of pointers to members of the same union.
1484 2018-06-11 Jason Merrill <jason@redhat.com>
1486 PR c++/86094 - wrong code with defaulted move ctor.
1487 * tree.c (type_has_nontrivial_copy_init): Fix move ctor handling.
1489 2018-06-10 Paolo Carlini <paolo.carlini@oracle.com>
1491 * decl.c (grokfndecl): Use the location_t argument in two more places.
1493 2018-06-06 Marek Polacek <polacek@redhat.com>
1496 * pt.c (unify): If ELTTYPE has no deducible template parms, skip
1497 deduction from the list elements.
1498 (type_unification_real): Check convertibility of list elements.
1500 2018-06-06 Jason Merrill <jason@redhat.com>
1502 PR c++/86060 - ICE on range for with -std=c++98.
1503 * parser.c (cp_parser_init_statement): Don't clobber *decl after
1506 PR c++/85710 - ICE with -Wmemset-elt-size.
1507 * semantics.c (finish_call_expr): Call warn_for_memset here.
1508 * parser.c (cp_parser_postfix_expression): Not here.
1509 (literal_integer_zerop): No longer static.
1510 * pt.c (build_non_dependent_expr): Don't wrap CONST_DECL.
1512 2018-06-05 Marek Polacek <polacek@redhat.com>
1515 * tree.c (cp_tree_equal): Handle USING_DECL.
1517 2018-06-05 Jason Merrill <jason@redhat.com>
1519 PR c++/85731 - wrong error with qualified-id in template.
1520 * semantics.c (finish_qualified_id_expr): build_qualified_name
1521 for unbound names in the current class.
1523 2018-06-04 Jason Merrill <jason@redhat.com>
1525 PR c++/61806 - missed SFINAE with partial specialization.
1526 * cp-tree.h (deferring_access_check_sentinel): Add deferring_kind
1527 parameter to constructor.
1528 * pt.c (instantiate_class_template_1): Enable access checking
1529 before call to most_specialized_partial_spec.
1531 PR c++/85765 - SFINAE and non-type default template arg.
1532 * pt.c (type_unification_real): Do full semantic processing if
1533 substituting a partial args list replaces all template parms.
1535 2018-06-03 Jason Merrill <jason@redhat.com>
1537 PR c++/85739 - ICE with pointer to member template parm.
1538 * cvt.c (perform_qualification_conversions): Use cp_fold_convert.
1540 2018-06-02 Jason Merrill <jason@redhat.com>
1542 PR c++/85761 - ICE with ill-formed use of const outer variable.
1543 * expr.c (mark_use): Handle location wrappers.
1545 2018-06-01 Jason Merrill <jason@redhat.com>
1547 PR c++/85764 - bogus 'this' not captured error.
1548 * lambda.c (resolvable_dummy_lambda): Use nonlambda_method_basetype.
1549 (nonlambda_method_basetype): Handle NSDMI.
1551 CWG 1581: When are constexpr member functions defined?
1552 * constexpr.c (instantiate_cx_fn_r, instantiate_constexpr_fns): New.
1553 (cxx_eval_outermost_constant_expr): Call instantiate_constexpr_fns.
1555 PR c++/58281 - explicit instantiation of constexpr
1556 * pt.c (mark_decl_instantiated): Clear DECL_EXTERNAL.
1558 * pt.c (instantiate_decl): Any defaulted function is defined.
1560 2018-05-30 Jonathan Wakely <jwakely@redhat.com>
1563 * call.c (resolve_args): Use location of expression, not current input
1566 2018-05-30 Ville Voutilainen <ville.voutilainen@gmail.com>
1568 Do not warn about zero-as-null when NULL is used.
1569 * call.c (conversion_null_warnings): Check for pointer
1570 types converted from zero constants.
1571 (convert_like_real): Add a warning sentinel at the end.
1572 * tree.c (maybe_warn_zero_as_null_pointer_constant): Also
1575 2018-05-30 Jason Merrill <jason@redhat.com>
1577 PR c++/85807 - ICE with call in template NSDMI.
1578 * init.c (get_nsdmi): Use push_to/pop_from_top_level.
1579 * tree.c (bot_manip): Don't set_flags_from_callee in a template.
1581 PR c++/85873 - constant initializer_list array not in .rodata.
1582 * tree.c (build_target_expr): Set TREE_READONLY.
1583 * call.c (set_up_extended_ref_temp): Set TREE_READONLY.
1585 * parser.c (cp_parser_check_condition_declarator): Handle
1586 cp_error_declarator.
1588 2018-05-30 Jonathan Wakely <jwakely@redhat.com>
1590 * typeck.c (cxx_sizeof_or_alignof_type): Return size_one_node instead
1591 of using it in dead store.
1593 2018-05-29 Jason Merrill <jason@redhat.com>
1595 PR c++/67445 - returning temporary initializer_list.
1596 PR c++/67711 - assigning from temporary initializer_list.
1597 PR c++/48562 - new initializer_list.
1598 * typeck.c (maybe_warn_about_returning_address_of_local): Also warn
1599 about returning local initializer_list.
1600 * cp-tree.h (AUTO_TEMP_NAME, TEMP_NAME_P): Remove.
1601 * call.c (build_over_call): Warn about assignment from temporary
1603 * init.c (build_new_1): Warn about 'new std::initializer_list'.
1604 (find_list_begin, maybe_warn_list_ctor): New.
1605 (perform_member_init): Use maybe_warn_list_ctor.
1607 2018-05-29 Marek Polacek <polacek@redhat.com>
1610 * init.c (build_new): Handle deducing a class with new
1611 with more than one argument.
1613 2018-05-29 Jakub Jelinek <jakub@redhat.com>
1616 * init.c (build_aggr_init): For structured binding initialized from
1617 array call mark_rvalue_use on the initializer.
1619 2018-05-28 Bernd Edlinger <bernd.edlinger@hotmail.de>
1621 * decl2.c (start_static_storage_duration_function): Use
1622 splay_tree_delete_pointers.
1624 2018-05-25 Jason Merrill <jason@redhat.com>
1626 PR c++/85815 - reference to member of enclosing template.
1627 * search.c (lookup_base): Use currently_open_class.
1628 (lookup_member): Use it regardless of -fconcepts.
1629 * parser.c (cp_parser_postfix_dot_deref_expression): Check it.
1631 CWG 616, 1213 - value category of subobject references.
1632 * tree.c (lvalue_kind): Fix handling of ARRAY_REF of pointer.
1634 2018-05-24 Jason Merrill <jason@redhat.com>
1636 PR c++/85842 - -Wreturn-type, constexpr if and generic lambda.
1637 * pt.c (tsubst_lambda_expr): Copy current_function_returns_* to
1640 2018-05-24 Ville Voutilainen <ville.voutilainen@gmail.com>
1642 Pedwarn on a non-standard position of a C++ attribute.
1643 * parser.c (cp_parser_namespace_definition): Pedwarn about attributes
1644 after the namespace name.
1646 2018-05-24 Paolo Carlini <paolo.carlini@oracle.com>
1648 * cp-tree.h (INDIRECT_TYPE_P): New.
1649 * call.c (build_trivial_dtor_call, maybe_warn_class_memaccess,
1650 joust): Use it instead of POINTER_TYPE_P.
1651 * class.c (update_vtable_entry_for_fn, find_flexarrays,
1652 * fixed_type_or_null, resolves_to_fixed_type_p): Likewise.
1653 * constexpr.c (cxx_eval_binary_expression, cxx_fold_indirect_ref,
1654 * cxx_eval_increment_expression, potential_constant_expression_1):
1656 * cp-gimplify.c (cp_gimplify_expr, cp_genericize_r): Likewise.
1657 * cp-objcp-common.c (cxx_get_alias_set): Likewise.
1658 * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call,
1659 cp_ubsan_maybe_instrument_downcast): Likewise.
1660 * cvt.c (cp_convert_to_pointer, ocp_convert,
1661 cp_get_fndecl_from_callee, maybe_warn_nodiscard, convert): Likewise.
1662 * cxx-pretty-print.c (cxx_pretty_printer::abstract_declarator,
1663 pp_cxx_offsetof_expression_1): Likewise.
1664 * decl.c (grokparms, static_fn_type): Likewise.
1665 * decl2.c (grokbitfield): Likewise.
1666 * error.c (dump_expr): Likewise.
1667 * except.c (initialize_handler_parm, check_noexcept_r): Likewise.
1668 * init.c (warn_placement_new_too_small): Likewise.
1669 * lambda.c (build_capture_proxy, add_capture): Likewise.
1670 * parser.c (cp_parser_omp_for_loop): Likewise.
1671 * pt.c (convert_nontype_argument, fn_type_unification,
1672 uses_deducible_template_parms, check_cv_quals_for_unify,
1673 dependent_type_p_r): Likewise.
1674 * search.c (check_final_overrider): Likewise.
1675 * semantics.c (handle_omp_array_sections, finish_omp_clauses,
1676 finish_omp_for): Likewise.
1677 * tree.c (cp_build_qualified_type_real): Likewise.
1678 * typeck.c (build_class_member_access_expr,
1679 finish_class_member_access_expr, build_x_indirect_ref,
1680 cp_build_indirect_ref_1, cp_build_binary_op, build_const_cast_1):
1683 2018-05-24 Jason Merrill <jason@redhat.com>
1685 PR c++/85864 - literal template and default template arg.
1686 * pt.c (instantiation_dependent_r): Handle NONTYPE_ARGUMENT_PACK.
1688 2018-05-24 Marek Polacek <polacek@redhat.com>
1691 * init.c (build_new_1): Use fold_non_dependent_expr. Use a dedicated
1692 variable for its result. Fix a condition.
1693 (build_new): Use fold_non_dependent_expr. Tweak a condition.
1695 2018-05-23 Jason Merrill <jason@redhat.com>
1697 Fix cast to rvalue reference from prvalue.
1698 * cvt.c (diagnose_ref_binding): Handle rvalue reference.
1699 * rtti.c (build_dynamic_cast_1): Don't try to build a reference to
1700 non-class type. Handle xvalue argument.
1701 * typeck.c (build_reinterpret_cast_1): Allow cast from prvalue to
1703 * semantics.c (finish_compound_literal): Do direct-initialization,
1704 not cast, to initialize a reference.
1706 CWG 616, 1213 - value category of subobject references.
1707 * tree.c (lvalue_kind): A reference to a subobject of a prvalue is
1709 * typeck2.c (build_m_component_ref): Likewise.
1710 * typeck.c (cp_build_addr_expr_1, lvalue_or_else): Remove diagnostic
1711 distinction between temporary and xvalue.
1713 2018-05-23 Marek Polacek <polacek@redhat.com>
1715 Implement P0614R1, Range-based for statements with initializer.
1716 * parser.c (cp_parser_range_based_for_with_init_p): New.
1717 (cp_parser_init_statement): Use it. Parse the optional init-statement
1718 for a range-based for loop.
1719 (cp_parser_skip_to_closing_parenthesis_1): Handle balancing ?:.
1721 2018-05-22 Jason Merrill <jason@redhat.com>
1723 PR c++/81420 - not extending temporary lifetime.
1724 * call.c (extend_ref_init_temps_1): Handle ARRAY_REF.
1725 * class.c (build_base_path): Avoid redundant move of an rvalue.
1727 PR c++/85866 - error with .* in default template arg.
1728 * pt.c (tsubst_copy_and_build): Handle partial instantiation.
1730 2018-05-21 Paolo Carlini <paolo.carlini@oracle.com>
1732 * parser.c (cp_parser_parameter_declaration_list): Remove
1734 (cp_parser_parameter_declaration_clause): Adjust.
1735 (cp_parser_cache_defarg): Likewise.
1737 2018-05-21 Paolo Carlini <paolo.carlini@oracle.com>
1740 * parser.c (cp_parser_maybe_commit_to_declaration,
1741 cp_parser_check_condition_declarator): New.
1742 (cp_parser_simple_declaration): Use the first above.
1743 (cp_parser_condition): Use both the above; enforce
1744 [stmt.stmt]/2 about the declarator not specifying
1745 a function or an array; improve error-recovery.
1747 2018-05-20 Jason Merrill <jason@redhat.com>
1749 PR libstdc++/85843 - warning in logic_error copy constructor.
1750 * class.c (type_has_user_nondefault_constructor): Check for a
1751 user-provided ctor, not user-declared.
1753 2018-05-19 Jason Merrill <jason@redhat.com>
1755 * pt.c (tsubst_pack_expansion): Sorry rather than abort
1756 on __integer_pack as subexpression of pattern.
1758 2018-05-18 Jason Merrill <jason@redhat.com>
1760 PR c++/58407 - deprecated implicit copy ops.
1761 * call.c (build_over_call): Warn about deprecated trivial fns.
1762 * class.c (classtype_has_user_copy_or_dtor): New.
1763 (type_build_ctor_call): Check TREE_DEPRECATED.
1764 (type_build_dtor_call): Likewise.
1765 * decl2.c (cp_warn_deprecated_use): Move from tree.c.
1766 Add checks. Return bool. Handle -Wdeprecated-copy.
1767 (mark_used): Use it.
1768 * decl.c (grokdeclarator): Remove redundant checks.
1769 * typeck2.c (build_functional_cast): Likewise.
1770 * method.c (lazily_declare_fn): Mark deprecated copy ops.
1771 * init.c (build_aggr_init): Only set TREE_USED if there are
1774 2018-05-18 Cesar Philippidis <cesar@codesourcery.com>
1777 * cp-gimplify.c (cp_genericize_r): Call genericize_omp_for_stmt for
1780 2018-05-18 Richard Sandiford <richard.sandiford@linaro.org>
1782 * constexpr.c (cxx_eval_constant_expression): Remove FMA_EXPR handling.
1783 (potential_constant_expression_1): Likewise.
1785 2018-05-16 Marek Polacek <polacek@redhat.com>
1788 * call.c (set_flags_from_callee): Handle AGGR_INIT_EXPRs too.
1789 * tree.c (bot_manip): Call set_flags_from_callee for
1790 AGGR_INIT_EXPRs too.
1792 2018-05-15 Jason Merrill <jason@redhat.com>
1794 * cp-tree.h (cp_expr): Remove copy constructor.
1795 * mangle.c (struct releasing_vec): Declare copy constructor.
1797 * constexpr.c (cxx_eval_vec_init_1): Pass tf_none if ctx->quiet.
1799 PR c++/64372 - CWG 1560, gratuitous lvalue-rvalue conversion in ?:
1800 * call.c (build_conditional_expr_1): Don't force_rvalue when one arm
1801 is a throw-expression.
1803 2018-05-15 Paolo Carlini <paolo.carlini@oracle.com>
1805 * cp-tree.h (DECL_MAYBE_IN_CHARGE_CDTOR_P): New.
1806 (FOR_EACH_CLONE): Update.
1807 * decl.c (grokdeclarator): Use it.
1808 * decl2.c (vague_linkage_p): Likewise.
1809 * mangle.c (mangle_decl): Likewise.
1810 * method.c (lazily_declare_fn): Likewise.
1811 * optimize.c (can_alias_cdtor, maybe_clone_body): Likewise.
1812 * repo.c (repo_emit_p): Likewise.
1813 * tree.c (decl_linkage): Likewise.
1815 2018-05-14 Jason Merrill <jason@redhat.com>
1817 Handle TYPE_HAS_LATE_RETURN_TYPE like ref-qualifier and eh spec.
1818 * tree.c (build_cp_fntype_variant): New.
1819 (build_ref_qualified_type, build_exception_variant)
1820 (strip_typedefs, cxx_copy_lang_qualifiers): Use it.
1821 (cxx_type_hash_eq, cp_check_qualified_type): Check
1822 TYPE_HAS_LATE_RETURN_TYPE.
1823 (cp_build_type_attribute_variant): Check cxx_type_hash_eq.
1824 (cp_build_qualified_type_real): No need to preserve C++ qualifiers.
1825 * class.c (build_clone): Use cxx_copy_lang_qualifiers.
1826 (adjust_clone_args): Likewise.
1827 * decl.c (grokfndecl): Add late_return_type_p parameter. Use
1828 build_cp_fntype_variant.
1829 (grokdeclarator): Pass late_return_type_p to grokfndecl.
1830 (check_function_type): Use cxx_copy_lang_qualifiers.
1831 (static_fn_type): Use cxx_copy_lang_qualifiers.
1832 * decl2.c (build_memfn_type, maybe_retrofit_in_chrg)
1833 (cp_reconstruct_complex_type, coerce_new_type, coerce_delete_type)
1834 (change_return_type): Use cxx_copy_lang_qualifiers.
1835 * mangle.c (write_type): Use cxx_copy_lang_qualifiers.
1836 * parser.c (cp_parser_lambda_declarator_opt): Represent an explicit
1837 return type on the declarator like a normal trailing return type.
1838 * pt.c (tsubst_function_type): Use build_cp_fntype_variant.
1839 (copy_default_args_to_explicit_spec): Use cxx_copy_lang_qualifiers.
1840 * typeck.c (merge_types): Use build_cp_fntype_variant.
1842 2018-05-14 Paolo Carlini <paolo.carlini@oracle.com>
1844 * cp-tree.h (TYPE_REF_P): New.
1845 (TYPE_OBJ_P, TYPE_REF_OBJ_P, TYPE_REFFN_P): Update.
1846 * call.c (build_list_conv, build_aggr_conv, standard_conversion,
1847 direct_reference_binding, reference_binding, implicit_conversion,
1848 add_builtin_candidate, build_user_type_conversion_1, build_op_call_1,
1849 build_new_op_1, build_x_va_arg, conv_binds_ref_to_prvalue,
1850 build_over_call, perform_implicit_conversion_flags,
1851 extend_ref_init_temps, type_has_extended_temps): Use it.
1852 * class.c (one_inheriting_sig, check_field_decls,
1853 check_bases_and_members, find_flexarrays, finish_struct,
1854 fixed_type_or_null): Likewise.
1855 * constexpr.c (literal_type_p, cxx_bind_parameters_in_call,
1856 non_const_var_error, cxx_eval_constant_expression,
1857 potential_constant_expression_1): Likewise.
1858 * cp-gimplify.c (omp_var_to_track, omp_cxx_notice_variable,
1859 cp_genericize_r, cxx_omp_privatize_by_reference,
1860 cxx_omp_const_qual_no_mutable, cxx_omp_finish_clause,
1861 cp_fold_maybe_rvalue): Likewise.
1862 * cp-ubsan.c (cp_ubsan_maybe_instrument_downcast): Likewise.
1863 * cvt.c (build_up_reference, convert_to_reference,
1864 convert_from_reference, convert_to_void, noexcept_conv_p,
1865 fnptr_conv_p): Likewise.
1866 * decl.c (poplevel, check_for_uninitialized_const_var,
1867 check_initializer, initialize_local_var, cp_finish_decl,
1868 get_tuple_decomp_init, cp_finish_decomp, grokdeclarator, copy_fn_p,
1869 move_signature_fn_p, grok_op_properties, finish_function): Likewise.
1870 * decl2.c (grok_array_decl, cp_reconstruct_complex_type,
1871 decl_maybe_constant_var_p): Likewise.
1872 * error.c (dump_type_prefix, dump_expr): Likewise.
1873 * except.c (initialize_handler_parm, complete_ptr_ref_or_void_ptr_p,
1874 is_admissible_throw_operand_or_catch_parameter): Likewise.
1875 * expr.c (mark_use): Likewise.
1876 * init.c (build_zero_init_1, build_value_init_noctor,
1877 perform_member_init, diagnose_uninitialized_cst_or_ref_member_1,
1878 build_new, build_delete): Likewise.
1879 * lambda.c (build_lambda_object): Likewise.
1880 * mangle.c (write_expression, write_template_arg): Likewise.
1881 * method.c (forward_parm, do_build_copy_constructor,
1882 do_build_copy_assign, build_stub_object, constructible_expr,
1883 walk_field_subobs): Likewise.
1884 * parser.c (cp_parser_omp_for_loop_init,
1885 cp_parser_omp_declare_reduction_exprs,
1886 cp_parser_omp_declare_reduction): Likewise.
1887 * pt.c (convert_nontype_argument_function, convert_nontype_argument,
1888 convert_template_argument, tsubst_pack_expansion,
1889 tsubst_function_decl, tsubst_decl, tsubst, tsubst_copy_and_build,
1890 maybe_adjust_types_for_deduction, check_cv_quals_for_unify, unify,
1891 more_specialized_fn, invalid_nontype_parm_type_p, dependent_type_p_r,
1892 value_dependent_expression_p, build_deduction_guide): Likewise.
1893 * semantics.c (finish_handler_parms, finish_non_static_data_member,
1894 finish_compound_literal, omp_privatize_field,
1895 handle_omp_array_sections_1, handle_omp_array_sections,
1896 cp_check_omp_declare_reduction, finish_omp_reduction_clause,
1897 finish_omp_declare_simd_methods, cp_finish_omp_clause_depend_sink,
1898 finish_omp_clauses, finish_decltype_type, capture_decltype,
1899 finish_builtin_launder): Likewise.
1900 * tree.c (lvalue_kind, cp_build_reference_type, move,
1901 cp_build_qualified_type_real, stabilize_expr, stabilize_init): Likewise.
1902 * typeck.c (cxx_safe_arg_type_equiv_p, build_class_member_access_expr,
1903 cp_build_indirect_ref_1, convert_arguments, warn_for_null_address,
1904 cp_build_addr_expr_1, maybe_warn_about_useless_cast,
1905 build_static_cast_1, build_static_cast, build_reinterpret_cast_1,
1906 build_const_cast_1, cp_build_c_cast, cp_build_modify_expr,
1907 convert_for_initialization,
1908 maybe_warn_about_returning_address_of_local, check_return_expr,
1909 cp_type_quals, casts_away_constness, non_reference): Likewise.
1910 * typeck2.c (cxx_readonly_error, store_init_value,
1911 process_init_constructor_record, build_x_arrow, build_functional_cast,
1912 add_exception_specifier): Likewise.
1914 2018-05-14 Jason Merrill <jason@redhat.com>
1916 * pt.c (tsubst) [ARRAY_TYPE]: Check valid_array_size_p.
1917 (tsubst_copy_and_build) [NEW_EXPR]: Clear in_decl.
1919 2018-05-11 Jakub Jelinek <jakub@redhat.com>
1922 * cp-tree.h (cxx_omp_predetermined_sharing_1): New prototype.
1923 * cp-gimplify.c (cxx_omp_predetermined_sharing): New wrapper around
1924 cxx_omp_predetermined_sharing_1. Rename old function to ...
1925 (cxx_omp_predetermined_sharing_1): ... this.
1926 * semantics.c (finish_omp_clauses): Use cxx_omp_predetermined_sharing_1
1927 instead of cxx_omp_predetermined_sharing.
1929 2018-05-10 Jason Merrill <jason@redhat.com>
1931 * decl.c (cp_finish_decl): Don't instantiate auto variable.
1932 (check_static_variable_definition): Allow auto.
1933 * constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
1935 * cp-tree.h (DECL_CONSTRUCTOR_P): Use DECL_CXX_CONSTRUCTOR_P.
1936 (DECL_DESTRUCTOR_P): Use DECL_CXX_DESTRUCTOR_P.
1938 Core issue 2310 - conversion to base of incomplete type.
1939 * class.c (build_base_path): Check COMPLETE_TYPE_P for source type.
1941 CWG 2267 - list-initialization of reference temporary
1942 * call.c (reference_binding): List-initializing a reference
1943 temporary is copy-list-initialization.
1945 * parser.c (cp_parser_class_head): Use num_template_headers_for_class.
1947 * pt.c (instantiate_decl): Make sure we aren't trying to do a nested
1948 instantiation in template context.
1950 * class.c (vbase_has_user_provided_move_assign): Use
1953 * lambda.c (lambda_expr_this_capture): Improve logic.
1955 * decl.c (make_typename_type): s/parameters/arguments/.
1956 * parser.c (cp_parser_nested_name_specifier_opt): Likewise.
1957 * pt.c (make_pack_expansion): Correct error message.
1959 2018-05-10 Jakub Jelinek <jakub@redhat.com>
1962 * cp-gimplify.c (cp_fold): Use fold_offsetof rather than
1963 fold_offsetof_1, pass TREE_TYPE (x) as TYPE to it and drop the
1966 2018-05-10 Eric Botcazou <ebotcazou@adacore.com>
1969 * decl2.c (adjust_var_decl_tls_model): New static function.
1970 (comdat_linkage): Call it on a variable.
1971 (maybe_make_one_only): Likewise.
1973 2018-05-09 Paolo Carlini <paolo.carlini@oracle.com>
1977 2018-05-08 Paolo Carlini <paolo.carlini@oracle.com>
1980 * parser.c (cp_parser_parameter_declaration_list): When the
1981 entire parameter-declaration-list is erroneous maybe call
1982 abort_fully_implicit_template.
1984 2018-05-08 Jason Merrill <jason@redhat.com>
1986 PR c++/85706 - class deduction under decltype
1987 * pt.c (for_each_template_parm_r): Handle DECLTYPE_TYPE. Clear
1988 *walk_subtrees whether or not we walked into the operand.
1989 (type_uses_auto): Only look at deduced contexts.
1991 2018-05-08 Paolo Carlini <paolo.carlini@oracle.com>
1994 * parser.c (cp_parser_parameter_declaration_list): When the
1995 entire parameter-declaration-list is erroneous maybe call
1996 abort_fully_implicit_template.
1998 2018-05-08 Marek Polacek <polacek@redhat.com>
2001 * semantics.c (finish_if_stmt_cond): See through typedefs.
2003 2018-05-07 Jason Merrill <jason@redhat.com>
2005 PR c++/85646 - lambda visibility.
2006 * decl2.c (determine_visibility): Don't mess with template arguments
2007 from the containing scope.
2008 (vague_linkage_p): Check DECL_ABSTRACT_P before looking at a 'tor
2011 2018-05-07 Nathan Sidwell <nathan@acm.org>
2013 Remove fno-for-scope
2014 * cp-tree.h (DECL_ERROR_REPORTED, DECL_DEAD_FOR_LOCAL)
2015 (DECL_HAS_SHADOWED_FOR_VAR_P, DECL_SHADOWED_FOR_VAR)
2016 (SET_DECL_SHADOWED_FOR_VAR): Delete.
2017 (decl_shadowed_for_var_lookup, decl_shadowed_for_var_insert)
2018 (check_for_out_of_scope_variable, init_shadowed_var_for_decl):
2020 * name-lookup.h (struct cp_binding_level): Remove
2021 dead_vars_from_for field.
2022 * cp-lang.c (cp_init_ts): Delete.
2023 (LANG_HOOKS_INIT_TS): Override to cp_common_init_ts.
2024 * cp-objcp-common.c (shadowed_var_for_decl): Delete.
2025 (decl_shadowed_for_var_lookup, decl_shadowed_for_var_insert)
2026 (init_shadowed_var_for_decl): Delete.
2027 * decl.c (poplevel): Remove shadowed for var handling.
2028 (cxx_init_decl_processing): Remove -ffor-scope deprecation.
2029 * name-lookup.c (find_local_binding): Remove shadowed for var
2031 (check_local_shadow): Likewise.
2032 (check_for_out_of_scope_variable): Delete.
2033 * parser.c (cp_parser_primary_expression): Remove shadowed for var
2035 * pt.c (tsubst_decl): Remove DECL_DEAD_FOR_LOCAL setting.
2036 * semantics.c (begin_for_scope): Always have a scope.
2037 (begin_for_stmt, finish_for_stmt): Remove ARM-for scope handling.
2038 (begin_range_for_stmt, finish_id_expression): Likewise.
2040 2018-05-07 Jason Merrill <jason@redhat.com>
2042 PR c++/85618 - ICE with initialized VLA.
2043 * tree.c (vla_type_p): New.
2044 * typeck2.c (store_init_value, split_nonconstant_init_1): Check it
2045 rather than array_of_runtime_bound_p.
2047 2018-05-05 Paolo Carlini <paolo.carlini@oracle.com>
2049 * cvt.c (ocp_convert): Early handle the special case of a
2050 null_ptr_cst_p expr converted to a NULLPTR_TYPE_P type.
2052 2018-05-03 Jason Merrill <jason@redhat.com>
2054 PR c++/85600 - virtual delete failure.
2055 * init.c (build_delete): Always save_expr when deleting.
2057 2018-05-03 Nathan Sidwell <nathan@acm.org>
2059 * decl.c (cxx_init_decl_processing): Remove flag_friend_injection.
2060 * name-lookup.c (do_pushdecl): Likewise.
2062 2018-05-02 Paolo Carlini <paolo.carlini@oracle.com>
2063 Jason Merrill <jason@redhat.com>
2066 * name-lookup.c (check_local_shadow): Don't handle static old
2067 declarations in the block handling locals shadowing locals.
2069 2018-05-01 Jason Merrill <jason@redhat.com>
2071 PR c++/85587 - error with scoped enum in template.
2072 * semantics.c (finish_qualified_id_expr): Don't return an
2073 unqualified IDENTIFIER_NODE.
2075 2018-04-30 Jason Merrill <jason@redhat.com>
2077 PR c++/85580 - extern "C" and local variables
2078 * name-lookup.c (check_extern_c_conflict): Ignore local decls.
2080 PR c++/84701 - unsigned typeof.
2081 * decl.c (grokdeclarator): Overhaul diagnostics for invalid use
2082 of long/short/signed/unsigned.
2084 PR c++/85305 - pack in lambda init-capture.
2085 * parser.c (cp_parser_initializer): Add subexpression_p parm; don't
2086 check_for_bare_parameter_packs in a subexpression.
2087 (cp_parser_lambda_introducer): Use it.
2089 PR c++/61982 - dead stores to destroyed objects.
2090 * call.c (build_trivial_dtor_call): New, assigns a clobber.
2091 (build_over_call, build_special_member_call): Use it.
2092 * cp-tree.h: Declare it.
2093 * init.c (build_delete): Remove trivial path.
2095 * init.c (build_dtor_call): Use build_special_member_call.
2096 (build_delete): Remove redundant uses of save_addr.
2098 * decl.c (build_clobber_this): Use build_clobber.
2100 2018-04-27 Jakub Jelinek <jakub@redhat.com>
2103 * init.c (build_zero_init_1): For zero initialization of
2104 NULLPTR_TYPE_P type use build_int_cst directly.
2106 2018-04-27 David Malcolm <dmalcolm@redhat.com>
2109 * name-lookup.c (consider_binding_level): Skip compiler-generated
2111 * search.c (lookup_field_fuzzy_info::fuzzy_lookup_field): Flatten
2112 nested if statements into a series of rejection tests. Reject
2113 lambda-ignored entities as suggestions.
2115 2018-04-27 Jason Merrill <jason@redhat.com>
2117 * cvt.c (cp_fold_convert): Use convert_ptrmem.
2118 * typeck.c (convert_ptrmem): Add a NOP even if no adjustment.
2120 2018-04-27 Paolo Carlini <paolo.carlini@oracle.com>
2123 * decl.c (grokdeclarator): Clear friendp upon definition in local
2124 class definition error.
2126 2018-04-27 Jason Merrill <jason@redhat.com>
2128 PR c++/85545 - ICE with noexcept PMF conversion.
2129 * cvt.c (cp_fold_convert): Pass PMF CONSTRUCTORs to
2131 * typeck.c (build_ptrmemfunc): Don't build a NOP_EXPR for zero
2133 (build_ptrmemfunc_access_expr): Special-case CONSTRUCTORs.
2135 2018-04-27 Nathan Sidwell <nathan@acm.org>
2137 * typeck.c (convert_ptrmem): Move local var decls to initialization.
2139 * cp-tree.h (TEMPLATE_INFO): Fix comments.
2140 (TI_PENDING_TEMPLATE_FLAG): Check TEMPLATE_INFO.
2141 (NON_DEFAULT_TEMPLATE_ARG_COUNT): Wrap line.
2142 (dump, print_other_binding_stacks): Remove declarations.
2143 * name-lookup.c (print_other_binding_stack): Make static.
2144 * pt.c (build_template_decl): Make static.
2146 2018-04-26 Jason Merrill <jason@redhat.com>
2148 PR c++/85545 - ICE with noexcept PMF conversion.
2149 * cvt.c (cp_fold_convert): Handle PMF CONSTRUCTORs directly.
2151 2018-04-25 Nathan Sidwell <nathan@acm.org>
2155 * cp-tree.h (REINTERPRET_CAST_P): New.
2156 * constexpr.c (cxx_eval_constant_expression) <case NOP_EXPR>:
2157 Reject REINTERPET_CAST_P conversions. Use cplus_expand_constant
2158 for non-trivial PTRMEM_CST cases.
2159 * typeck.c (build_nop_reinterpret): New.
2160 (build_reinterpret_cast_1): Use it. Set REINTERPRET_CAST_P on
2161 NOP_EXPRs returned by cp_convert.
2163 2018-04-23 Jason Merrill <jason@redhat.com>
2165 PR c++/69560 - wrong alignof(double) on x86.
2166 CWG 1879 - Inadequate definition of alignment requirement.
2167 * cp-tree.h (ALIGNOF_EXPR_STD_P): New.
2168 * typeck.c (cxx_sizeof_or_alignof_type): Add std_alignof parm.
2169 (cxx_sizeof_expr, cxx_sizeof_nowarn, cxx_alignas_expr)
2170 (cxx_alignof_expr): Pass it.
2171 * parser.c (cp_parser_unary_expression): Pass it.
2172 * pt.c (tsubst_copy): Copy it.
2173 (tsubst_copy_and_build): Pass it.
2174 * decl.c (fold_sizeof_expr): Pass it.
2176 2018-04-23 Jakub Jelinek <jakub@redhat.com>
2177 Jason Merrill <jason@redhat.com>
2179 PR c++/85470 - wrong error with static data member.
2180 * decl.c (check_initializer): Check DECL_INITIALIZED_IN_CLASS_P.
2181 * typeck2.c (store_init_value): Likewise.
2183 2018-04-20 Jakub Jelinek <jakub@redhat.com>
2186 * cp-tree.h (tinst_level): Remove in_system_header_p member,
2187 change refcount member from unsigned char to unsigned short,
2188 add refcount_infinity static data member, adjust comments.
2189 * pt.c (tinst_level::refcount_infinity): Define.
2190 (inc_refcount_use): Remove assert, don't increment if refcount
2191 is already refcount_infinity, adjust comment.
2192 (dec_refcount_use): Remove assert, don't decrement if refcount
2193 is refcount_infinity, adjust comment.
2194 (push_tinst_level_loc): Formatting fix.
2196 2018-04-19 Paolo Carlini <paolo.carlini@oracle.com>
2199 * pt.c (lookup_template_class_1): Check pushtag return value for
2202 2018-04-19 Alexandre Oliva <aoliva@redhat.com>
2205 * cp-tree.h (tinst_level::free): Fix whitespace.
2207 2018-04-18 Paolo Carlini <paolo.carlini@oracle.com>
2210 * pt.c (tsubst_lambda_expr): Check begin_lambda_type return value
2211 for error_mark_node.
2213 2018-04-18 Jakub Jelinek <jakub@redhat.com>
2216 * typeck.c (cp_build_addr_expr_1): Move handling of offsetof-like
2217 tricks from here to ...
2218 * cp-gimplify.c (cp_fold) <case ADDR_EXPR>: ... here. Only use it
2219 if INDIRECT_REF's operand is INTEGER_CST cast to pointer type.
2221 2018-04-18 Alexandre Oliva <aoliva@redhat.com>
2224 * cp-tree.h (struct tinst_level): Split decl into tldcl and
2225 targs. Add private split_list_p, tree_list_p, and not_list_p
2226 inline const predicates; to_list private member function
2227 declaration; free public member function declaration; list_p,
2228 get_node and maybe_get_node accessors, and refcount data
2229 member. Narrow errors to unsigned short.
2230 * error.c (print_instantiation_full_context): Use new
2232 (print_instantiation_partial_context_line): Likewise. Drop
2233 const from tinst_level-typed parameter.
2234 * mangle.c (mangle_decl_string): Likewise.
2235 * pt.c (freelist): New template class.
2236 (tree_list_freelist_head): New var.
2237 (tree_list_freelist): New fn, along with specializations.
2238 (tinst_level_freelist_head): New var.
2239 (pending_template_freelist_head): Likewise.
2240 (tinst_level_freelist, pending_template_freelist): New fns.
2241 (tinst_level::to_list, tinst_level::free): Define.
2242 (inc_refcount_use, dec_refcount_use): New fns for tinst_level.
2243 (set_refcount_ptr): New template fn.
2244 (add_pending_template): Adjust for refcounting, freelists and
2246 (neglectable_inst_p): Take a NULL d as a non-DECL.
2247 (limit_bad_template_recursion): Use new accessors.
2248 (push_tinst_level): New overload to create the list.
2249 (push_tinst_level_loc): Make it static, split decl into two
2250 args, adjust tests and initialization to cope with split
2251 lists, use freelist, adjust for refcounting.
2252 (push_tinst_level_loc): New wrapper with the old interface.
2253 (pop_tinst_level): Adjust for refcounting.
2254 (record_last_problematic_instantiation): Likewise.
2255 (reopen_tinst_level): Likewise. Use new accessors.
2256 (instantiate_alias_template): Adjust for split list.
2257 (fn_type_unification): Likewise.
2258 (get_partial_spec_bindings): Likewise.
2259 (instantiate_pending_templates): Use new accessors. Adjust
2260 for refcount. Release pending_template to freelist.
2261 (instantiating_current_function_p): Use new accessors.
2263 2018-04-16 Alexandre Oliva <aoliva@redhat.com>
2266 * parser.c (cp_parser_builtin_offset): Reject type definitions.
2267 * mangle.c (nested_anon_class_index): Avoid crash returning -1
2268 if we've seen errors.
2270 2018-04-12 David Malcolm <dmalcolm@redhat.com>
2273 * name-lookup.c (macro_use_before_def::maybe_make): New function,
2274 checking that the use is indeed before the definition.
2275 (macro_use_before_def::macro_use_before_def): Make private.
2276 (macro_use_before_def::~macro_use_before_def): Make private. Move
2277 check for UNKNOWN_LOCATION to macro_use_before_def::maybe_make.
2278 (lookup_name_fuzzy): Call macro_use_before_def::maybe_make rather
2279 than using new directly.
2281 2018-04-12 Jason Merrill <jason@redhat.com>
2283 PR c++/85356 - ICE with pointer to member function.
2284 * pt.c (maybe_instantiate_noexcept): Do instantiate in templates if
2285 flag_noexcept_type. Build the new spec within the function context.
2286 * except.c (build_noexcept_spec): Do get constant value in templates
2287 if flag_noexcept_type.
2288 * decl.c (check_redeclaration_exception_specification): Don't
2289 instantiate noexcept on a dependent declaration.
2291 2018-04-12 Marek Polacek <polacek@redhat.com>
2294 * constexpr.c (reduced_constant_expression_p): Return false for null
2297 2018-04-11 Marek Polacek <polacek@redhat.com>
2300 * constexpr.c (potential_constant_expression_1): Consider conversions
2301 from classes to literal types potentially constant.
2303 2018-04-10 Paolo Carlini <paolo.carlini@oracle.com>
2306 * init.c (build_zero_init_1): Handle NULLPTR_TYPE_P being true of
2307 the type like TYPE_PTR_OR_PTRMEM_P.
2309 2018-04-10 Jason Merrill <jason@redhat.com>
2311 PR debug/65821 - wrong location for main().
2312 * call.c (clear_location_r, convert_default_arg): Revert.
2313 * tree.c (break_out_target_exprs): Add clear_location parm.
2314 (struct bot_data): New.
2315 (bot_manip): Clear location if requested.
2316 * init.c (get_nsdmi): Pass clear_location.
2318 2018-04-10 David Malcolm <dmalcolm@redhat.com>
2321 * call.c (get_fndecl_argument_location): Make non-static.
2322 * cp-tree.h (get_fndecl_argument_location): New decl.
2323 * typeck.c (convert_for_assignment): When complaining due to
2324 conversions for an argument, show the location of the parameter
2327 2018-04-10 Jakub Jelinek <jakub@redhat.com>
2329 PR c++/85312 - P0962 cleanup
2330 * parser.c (cp_parser_perform_range_for_lookup): Remove unreachable
2333 2018-04-10 Jason Merrill <jason@redhat.com>
2335 PR debug/65821 - wrong location for main().
2336 * call.c (clear_location_r): New.
2337 (convert_default_arg): Use it.
2338 * tree.c (bot_manip): Remove builtin_LINE/FILE handling.
2340 PR c++/85285 - ICE with flexible array after substitution.
2341 * pt.c (instantiate_class_template_1): Check for flexible array in
2344 2018-04-09 Paolo Carlini <paolo.carlini@oracle.com>
2347 * decl.c (cp_finish_decomp): In a template, if the type is incomplete
2348 issue a pedwarn and defer trying to do bindings.
2350 2018-04-09 Jason Merrill <jason@redhat.com>
2352 PR c++/85279 - dump_expr doesn't understand decltype.
2353 * error.c (dump_expr): Handle DECLTYPE_TYPE.
2355 PR c++/85262 - ICE with redundant qualification on constructor.
2356 * call.c (build_new_method_call_1): Move make_args_non_dependent
2357 after A::A() handling.
2359 PR c++/85277 - ICE with invalid offsetof.
2360 * semantics.c (finish_offsetof): Avoid passing non-DECL to %qD.
2361 Adjust -Winvalid-offsetof diagnostic to say conditionally supported.
2363 PR c++/85264 - ICE with excess template-parameter-list.
2364 * parser.c (cp_parser_check_template_parameters): Add template_id_p
2365 parameter. Don't allow an extra template header if true.
2366 (cp_parser_class_head): Pass template_id_p.
2367 (cp_parser_elaborated_type_specifier): Likewise.
2368 (cp_parser_alias_declaration): Likewise.
2369 (cp_parser_check_declarator_template_parameters): Likewise.
2371 2018-04-09 Jakub Jelinek <jakub@redhat.com>
2374 * parser.c (cp_parser_simple_declaration): For structured bindings,
2375 if *maybe_range_for_decl is NULL after parsing it, set it to
2378 2018-04-09 Jason Merrill <jason@redhat.com>
2380 PR c++/85256 - ICE capturing pointer to VLA.
2381 * lambda.c (add_capture): Distinguish between variable-size and
2382 variably-modified types.
2384 2018-04-06 Jason Merrill <jason@redhat.com>
2386 PR c++/85214 - ICE with alias, generic lambda, constexpr if.
2387 * pt.c (extract_locals_r): Remember local typedefs.
2389 2018-04-06 David Malcolm <dmalcolm@redhat.com>
2392 * name-lookup.c (struct std_name_hint): Move out of
2393 get_std_name_hint; add field "min_dialect".
2394 (get_std_name_hint): Add min_dialect values to all initializers.
2395 Add <any>, <atomic>, <bitset>, <condition_variable>, <functional>,
2396 <future>, <istream>, <iterator>, <ostream>, <mutex>, <optional>,
2397 <shared_mutex>, <string_view>, <thread>, and <variant>.
2398 Add fstream, ifstream, and ofstream to <fstream>.
2399 Add istringstream, ostringstream, and stringstream to <sstream>.
2400 Add basic_string to <string>.
2401 Add tuple_element and tuple_size to <tuple>.
2402 Add declval to <utility>.
2403 Fix ordering of <queue> and <tuple>.
2404 Return a std_name_hint, rather than a const char *.
2405 (get_cxx_dialect_name): New function.
2406 (maybe_suggest_missing_std_header): Detect names that aren't yet
2407 available in the current dialect, and instead of suggesting a
2408 missing #include, warn about the dialect.
2410 2018-04-06 Jakub Jelinek <jakub@redhat.com>
2413 * pt.c (tsubst_decomp_names): Return error_mark_node and assert
2414 errorcount is set if tsubst doesn't return a VAR_DECL.
2416 2018-04-06 David Malcolm <dmalcolm@redhat.com>
2419 * name-lookup.c (using_directives_contain_std_p): New function.
2420 (has_using_namespace_std_directive_p): New function.
2421 (suggest_alternatives_for): Simplify if/else logic using early
2422 returns. If no candidates were found, and there's a
2423 "using namespace std;" directive, call
2424 maybe_suggest_missing_std_header.
2425 (maybe_suggest_missing_header): Split later part of the function
2427 (maybe_suggest_missing_std_header): New.
2429 2018-04-06 Jason Merrill <jason@redhat.com>
2431 PR c++/85242 - ICE with class definition in template parm.
2432 * cp-tree.h (PROCESSING_REAL_TEMPLATE_DECL_P): False if
2433 processing_template_parmlist.
2435 PR c++/85240 - LTO ICE with using of undeduced auto fn.
2436 * cp-gimplify.c (cp_genericize_r): Discard using of undeduced auto.
2438 2018-04-05 Jakub Jelinek <jakub@redhat.com>
2441 * pt.c (tsubst_decomp_names): Don't fail or ICE if DECL_CHAIN (decl3)
2442 is not prev, if prev == decl.
2445 * decl.c (start_decl): For DECL_DECOMPOSITION_P decls, don't call
2446 maybe_apply_pragma_weak here...
2447 (cp_maybe_mangle_decomp): ... but call it here instead.
2449 2018-04-05 Jason Merrill <jason@redhat.com>
2451 PR c++/85136 - ICE with designated init in template.
2452 * decl.c (maybe_deduce_size_from_array_init): Handle dependent
2453 designated initializer.
2454 (check_array_designated_initializer): Update ce->index with the
2457 PR c++/83808 - ICE with VLA initialization.
2458 * typeck2.c (process_init_constructor_array): Don't require a VLA
2459 initializer to have VLA type.
2461 2018-04-05 Paolo Carlini <paolo.carlini@oracle.com>
2464 * call.c (convert_like_real): Fail gracefully for a broken
2465 std::initializer_list, missing a definition.
2467 * name-lookup.c (do_pushtag): Tweak message, use %< and %>.
2469 2018-04-05 Paolo Carlini <paolo.carlini@oracle.com>
2472 * decl.c (grokdeclarator): Fix diagnostic about typedef name used
2473 as nested-name-specifier, keep type and TREE_TYPE (decl) in sync.
2475 2018-04-05 Jason Merrill <jason@redhat.com>
2477 PR c++/82152 - ICE with class deduction and inherited ctor.
2478 * pt.c (do_class_deduction): Ignore inherited ctors.
2480 PR c++/84665 - ICE with array of empty class.
2481 * decl2.c (cp_check_const_attributes): Use fold_non_dependent_expr.
2483 PR c++/85228 - ICE with lambda in enumerator in template.
2484 * pt.c (bt_instantiate_type_proc): Don't assume
2485 CLASSTYPE_TEMPLATE_INFO is non-null.
2487 2018-04-05 Ville Voutilainen <ville.voutilainen@gmail.com>
2490 * decl.c (find_decomp_class_base): Check accessibility instead
2491 of declared access, adjust diagnostic.
2493 2018-04-05 Ville Voutilainen <ville.voutilainen@gmail.com>
2496 * decl.c (get_tuple_decomp_init): Check the templatedness
2499 2018-04-05 Jason Merrill <jason@redhat.com>
2501 PR c++/85200 - ICE with constexpr if in generic lambda.
2502 * pt.c (extract_locals_r): Don't record the local specs of variables
2503 declared within the pattern.
2505 2018-04-05 Alexandre Oliva <aoliva@redhat.com>
2508 * pt.c (check_auto_in_tmpl_args): New.
2509 (tsubst_qualified_id): Use it to reject template args
2510 referencing auto for non-type templates.
2511 * parser.c (cp_parser_template_id): Likewise.
2512 * cp-tree.h (check_auto_in_tmpl_args): Declare.
2513 * typeck2.c (build_functional_cast): Report correct location
2514 for invalid use of auto.
2516 2018-04-04 Jason Merrill <jason@redhat.com>
2518 PR c++/85215 - ICE with copy-init from conversion.
2519 * call.c (merge_conversion_sequences): Fix type of direct binding
2522 PR c++/84938 - ICE with division by ~-1.
2523 * call.c (set_up_extended_ref_temp): Call cp_fully_fold.
2525 PR c++/84936 - ICE with unexpanded pack in mem-initializer.
2526 * parser.c (cp_parser_mem_initializer_list): Call
2527 check_for_bare_parameter_packs.
2529 2018-04-04 Jakub Jelinek <jakub@redhat.com>
2532 * constexpr.c (cxx_eval_builtin_function_call): For calls to
2533 builtin_valid_in_constant_expr_p functions, don't call
2534 cxx_eval_constant_expression if argument is not
2535 potential_constant_expression.
2538 * cp-tree.h (calculate_bases, calculate_direct_bases): Add complain
2540 * semantics.c (calculate_bases): Add complain argument. Use
2541 complete_type_or_maybe_complain instead of just complete_type and
2542 return an empty vector if it fails. Move make_tree_vector () call
2543 after early return. Formatting fixes.
2544 (calculate_direct_bases): Likewise. Call release_tree_vector at the
2546 (dfs_calculate_bases_post, calculate_bases_helper): Formatting fixes.
2547 * pt.c (tsubst_pack_expansion): Adjust calculate_bases and
2548 calculate_direct_bases callers, formatting fixes.
2550 2018-04-04 Jason Merrill <jason@redhat.com>
2552 PR c++/85006 - -fconcepts ICE with A<auto...> return type
2553 * pt.c (tsubst_pack_expansion): Allow unsubstituted auto pack.
2555 PR c++/85200 - ICE with constexpr if in generic lambda.
2556 * tree.c (cp_walk_subtrees): Walk into DECL_EXPR in templates.
2558 PR c++/84221 - bogus -Wunused with attribute and template.
2559 * decl2.c (is_late_template_attribute): Handle unused and used
2560 normally on non-TYPE_DECL.
2562 PR c++/85135 - ICE with omitted template arguments.
2563 * decl.c (grokdeclarator): Catch deduced class type in trailing
2566 PR c++/85133 - ICE with missing concept initializer.
2567 * decl.c (cp_finish_decl): If a concept initializer is missing, use
2570 PR c++/85118 - wrong error with generic lambda and std::bind.
2571 * call.c (add_template_conv_candidate): Disable if there are any
2574 PR c++/85141 - ICE with compound assignment and static member fn.
2575 * typeck.c (cp_build_modify_expr): Call decay_conversion for RHS of
2576 compound assignment.
2578 PR c++/85148 - ICE with 'this' in array NSDMI.
2579 * tree.c (replace_placeholders_r): Use handled_component_p.
2581 2018-04-04 Ville Voutilainen <ville.voutilainen@gmail.com>
2584 * decl.c (grokfndecl): Handle standard UDL diagnostics here..
2585 * parser.c (cp_parser_unqualified_id): ..not here.
2587 2018-04-04 Alexandre Oliva <aoliva@redhat.com>
2590 * typeck.c (cp_build_addr_expr_1): Mark FUNCTION_DECL as
2592 * decl2.c (mark_used): Return without effects if tf_conv.
2594 2018-04-03 Jason Merrill <jason@redhat.com>
2596 PR c++/85092 - C++17 ICE with unused list constructor.
2597 * call.c (conv_binds_ref_to_prvalue): Also count ck_identity
2600 PR c++/85113 - ICE with constexpr and __builtin_constant_p.
2601 * constexpr.c (cxx_eval_builtin_function_call): Only defer
2602 __builtin_constant_p if ctx->quiet.
2604 2018-04-03 Paolo Carlini <paolo.carlini@oracle.com>
2607 * pt.c (rewrite_template_parm): If the first argument is
2608 error_mark_node return it immediately.
2609 (build_deduction_guide): Check the return value of the
2610 latter for error_mark_node.
2611 (do_class_deduction): Check the return value of the latter.
2613 2018-04-03 Jason Merrill <jason@redhat.com>
2615 * semantics.c (finish_if_stmt_cond): Use
2616 instantiation_dependent_expression_p.
2618 PR c++/85149 - generic lambda and constexpr if.
2619 * pt.c (build_extra_args, add_extra_args): Split from
2620 tsubst_pack_expansion.
2621 (tsubst_expr) [IF_STMT]: Use them.
2622 * cp-tree.h (IF_STMT_EXTRA_ARGS): New.
2624 * typeck.c (merge_types): Limit matching attribute shortcut to
2627 2018-04-03 Jakub Jelinek <jakub@redhat.com>
2630 * pt.c (fixed_parameter_pack_p_1): Punt if parm is error_mark_node.
2633 * name-lookup.c (handle_namespace_attrs): Return early if attributes
2637 * decl.c (cp_finish_decl): If ensure_literal_type_for_constexpr_object
2638 fails, after clearing DECL_DECLARED_CONSTEXPR_P don't return early,
2639 instead for static data members clear init and set DECL_EXTERNAL.
2641 2018-04-02 Jason Merrill <jason@redhat.com>
2643 PR c++/64095 - auto... parameter pack.
2644 * parser.c (cp_parser_parameter_declaration): Handle turning autos
2646 (cp_parser_parameter_declaration_list): Not here.
2648 2018-03-31 Alexandre Oliva <aoliva@redhat.com>
2651 * class.c (instantiate_type): Peel off SAVE_EXPR before
2654 2018-03-30 Jason Merrill <jason@redhat.com>
2656 * typeck2.c (process_init_constructor_record): Use
2657 init_list_type_node for the CONSTRUCTOR around an anonymous union
2658 designated initializer.
2660 2018-03-30 Jakub Jelinek <jakub@redhat.com>
2663 * semantics.c (finish_omp_reduction_clause): If
2664 OMP_CLAUSE_REDUCTION_PLACEHOLDER is error_mark_node, return true
2665 even if processing_template_decl.
2667 2018-03-29 David Malcolm <dmalcolm@redhat.com>
2670 * name-lookup.c (get_std_name_hint): Add names from <memory>,
2671 <tuple>, and <utility>.
2673 2018-03-29 Jason Merrill <jason@redhat.com>
2675 PR c++/85093 - too many template args with pack expansion.
2676 * pt.c (coerce_template_parms): Keep pack expansion args that will
2679 2018-03-29 Jason Merrill <jason@redhat.com>
2681 * pt.c (build_non_dependent_expr): Propagate expr location.
2683 2018-03-27 Jason Merrill <jason@redhat.com>
2685 PR c++/85060 - wrong-code with call to base member in template.
2686 * search.c (any_dependent_bases_p): Check uses_template_parms
2687 rather than processing_template_decl.
2689 2018-03-29 David Malcolm <dmalcolm@redhat.com>
2692 * typeck.c (convert_for_assignment): When complaining due to
2693 conversions for an argument, attempt to use the location of the
2696 2018-03-28 Paolo Carlini <paolo.carlini@oracle.com>
2699 * pt.c (tsubst_default_argument): Early return if the type of the
2700 parameter is erroneous.
2702 2018-03-28 Alexandre Oliva <aoliva@redhat.com>
2705 * decl2.c (note_vague_linkage_fn): Don't defer uninstantiated
2709 * tree.c (strip_typedefs_expr): Reject STATEMENT_LISTs.
2711 2018-03-27 Paolo Carlini <paolo.carlini@oracle.com>
2714 * method.c (defaulted_late_check): Partially revert r253321 changes,
2715 do not early return upon error.
2717 2018-03-27 Jakub Jelinek <jakub@redhat.com>
2720 * cp-gimplify.c (cp_fold) <case CONSTRUCTOR>: For ctors with vector
2721 type call fold to generate VECTOR_CSTs when possible.
2724 * tree.c (cp_build_reference_type): If to_type is error_mark_node,
2725 return it right away.
2727 2018-03-27 Volker Reichelt <v.reichelt@netcologne.de>
2729 * search.c (check_final_overrider): Use inform instead of error
2730 for the diagnostics of the overridden functions. Tweak wording.
2732 2018-03-27 Jakub Jelinek <jakub@redhat.com>
2735 * class.c (update_vtable_entry_for_fn): Don't ICE if base_binfo
2736 is NULL. Assert if thunk_binfo is NULL then errorcount is non-zero.
2738 2018-03-27 Paolo Carlini <paolo.carlini@oracle.com>
2739 Jason Merrill <jason@redhat.com>
2742 * init.c (build_aggr_init): When initializing from array,
2743 reject anything but CONSTRUCTORs and TARGET_EXPRs.
2744 (build_vec_init): Handle separately ARRAY_TYPEs.
2746 2018-03-26 Jason Merrill <jason@redhat.com>
2748 PR c++/85062 - ICE with alignas in wrong place.
2749 * decl.c (grokdeclarator): Ignore attributes on type-specifiers
2752 PR c++/85049 - ICE with __integer_pack.
2753 * pt.c (unify_pack_expansion): Don't try to deduce generated packs.
2754 * cp-tree.h (TEMPLATE_PARM_P): New.
2756 2018-03-23 Jason Merrill <jason@redhat.com>
2758 PR c++/78489 - wrong SFINAE behavior.
2761 * pt.c (type_unification_real): Don't defer substitution failure.
2763 2018-03-23 Jakub Jelinek <jakub@redhat.com>
2766 * decl.c (compute_array_index_type): Set osize to mark_rvalue_use
2770 * pt.c (tsubst_copy_and_build) <case FIX_TRUNC_EXPR>: Replace
2771 cp_build_unary_op call with gcc_unreachable ().
2773 2018-03-23 Marek Polacek <polacek@redhat.com>
2776 * cxx-pretty-print.c (cxx_pretty_printer::multiplicative_expression):
2777 Handle EXACT_DIV_EXPR and RDIV_EXPR. Tweak condition.
2778 (cxx_pretty_printer::expression): Handle EXACT_DIV_EXPR and RDIV_EXPR.
2780 2018-03-23 Ville Voutilainen <ville.voutilainen@gmail.com>
2783 * parser.c (cp_parser_perform_range_for_lookup): Change
2784 the condition for deciding whether to use members.
2786 2018-03-23 Marek Polacek <polacek@redhat.com>
2789 * semantics.c (finish_offsetof): Don't allow CONST_DECLs.
2791 2018-03-23 Alexandre Oliva <aoliva@redhat.com>
2794 * parser.c (cp_parser_alias_declaration): Call
2795 parser_check_template_parameters.
2798 * pt.c (resolve_typename_type): Drop assert that stopped
2799 simplification to template-independent types. Add assert to
2800 verify the initial scope is template dependent.
2801 * parser.c (cp_parser_parse_and_diagnose_invalid_type_name):
2802 Reparse the id expression as a type-name, not a declarator.
2805 * init.c (build_vec_init): Error at parenthesized array init.
2810 * cp-tree.h (temp_override): New template class, generalizing
2811 a cleanup that was only used...
2812 * parser.c (cp_parser_parameter_declaration_clause):
2813 ... here for auto_is_implicit_function_template_parm_p.
2814 (cp_parser_gnu_attributes_opt): Use it here as well.
2815 (cp_parser_std_attribute): Likewise.
2817 2018-03-22 Marek Polacek <polacek@redhat.com>
2820 * semantics.c (finish_if_stmt_cond): Check if the type of the condition
2823 2018-03-21 Jason Merrill <jason@redhat.com>
2825 PR c++/81311 - wrong C++17 overload resolution.
2826 * call.c (build_user_type_conversion_1): Remove C++17 code.
2827 (conv_binds_ref_to_prvalue): New.
2828 (build_over_call): Handle C++17 copy elision.
2829 (build_special_member_call): Only do C++17 copy elision here if the
2830 argument is already the right type.
2832 2018-03-21 Alexandre Oliva <aoliva@redhat.com>
2835 * init.c (build_vec_init): Silence error, former sorry,
2840 * parser.c (abort_fully_implicit_template_p): New.
2841 (cp_parser_skip_to_end_of_statement): Use it.
2842 (cp_parser_skip_to_end_of_block_or_statement): Likewise.
2843 (finish_fully_implicit_template_p): Clear
2844 implicit_template_parms and implicit_template_scope.
2846 2018-03-21 Paolo Carlini <paolo.carlini@oracle.com>
2849 * decl.c (maybe_deduce_size_from_array_init): Set TREE_TYPE to
2850 error_mark_node when check_array_designated_initializer fails.
2852 2018-03-21 Jakub Jelinek <jakub@redhat.com>
2855 * cp-tree.h (genericize_compound_lvalue): Declare.
2856 * typeck.c (genericize_compound_lvalue): New function.
2857 (unary_complex_lvalue, cp_build_modify_expr): Use it.
2858 * semantics.c (finish_asm_stmt): Replace MODIFY_EXPR, PREINCREMENT_EXPR
2859 and PREDECREMENT_EXPR in output and "m" constrained input operands with
2860 COMPOUND_EXPR. Call cxx_mark_addressable on the rightmost
2861 COMPOUND_EXPR operand.
2863 2018-03-21 Nathan Sidwell <nathan@acm.org>
2866 * tree.c (decl_linkage): Use DECL_CLONED_FUNCTION_P.
2867 * decl2.c (vague_linkage_p): Likewise.
2869 2018-03-21 David Malcolm <dmalcolm@redhat.com>
2872 * constexpr.c (constexpr_fn_retval): Make non-"static".
2873 * cp-tree.h (constexpr_fn_retval): New decl.
2874 * search.c (direct_accessor_p): Update leading comment.
2875 (reference_accessor_p): Likewise.
2876 (field_accessor_p): Replace check that function body is a
2877 RETURN_EXPR with a call to constexpr_fn_retval. Fix
2878 indentation of "field_type" decl.
2880 2018-03-21 Nathan Sidwell <nathan@acm.org>
2883 * name-lookup.c (do_pushtag): Permit lambdas to be pushed into
2886 2018-03-21 Martin Sebor <msebor@redhat.com>
2889 * call.c (first_non_public_field): New template and function.
2890 (first_non_trivial_field): New function.
2891 (maybe_warn_class_memaccess): Call them.
2893 2018-03-21 David Malcolm <dmalcolm@redhat.com>
2896 * search.c (field_accessor_p): Use class_of_this_parm rather than
2897 type_of_this_parm, to check that "this" is a "const T *", rather
2900 2018-03-21 Nathan Sidwell <nathan@acm.org>
2902 * class.c (finish_struct_anon_r): Refactor, deprecate anything
2903 other than public non-static data members.
2904 * parser.c (cp_parser_init_declarator): Deprecate attributes after
2905 parenthesized initializer.
2908 * name-lookup.c (update_binding): Correct logic for local binding
2911 2018-03-21 Marek Polacek <polacek@redhat.com>
2913 PR c++/71638, ICE with NSDMI and reference.
2914 * constexpr.c (cxx_eval_bare_aggregate): Update constructor's flags
2915 even when we replace an element.
2917 2018-03-20 Marek Polacek <polacek@redhat.com>
2919 PR c++/84978, ICE with NRVO.
2920 * constexpr.c (cxx_eval_constant_expression): Handle the case when
2921 a RESULT_DECL isn't in the hash map.
2923 2018-03-20 Jason Merrill <jason@redhat.com>
2925 PR c++/84978, ICE with NRVO.
2926 * cvt.c (cp_get_fndecl_from_callee): Add fold parameter.
2927 (cp_get_callee_fndecl_nofold): New.
2928 * cp-gimplify.c (cp_genericize_r): Use it instead.
2929 * call.c (check_self_delegation): Likewise.
2931 2018-03-20 Nathan Sidwell <nathan@acm.org>
2934 * name-lookup.c (pushdecl_class_level): Push anon-struct's
2935 member_vec, if there is one.
2938 * cp-tree.h (lookup_list_keep): Declare.
2939 * tree.c (lookup_list_keep): New, broken out of ...
2940 (build_min): ... here. Call it.
2941 * decl.c (cp_finish_decl): Call lookup_list_keep.
2943 2018-03-19 Jason Merrill <jason@redhat.com>
2945 PR c++/84937 - ICE with class deduction and auto.
2946 * pt.c (rewrite_template_parm): Fix auto handling.
2948 2018-03-19 Marek Polacek <polacek@redhat.com>
2951 * pt.c (enclosing_instantiation_of): Check if fn is null.
2954 * constexpr.c (cxx_eval_bare_aggregate): Update constructor's flags
2955 as we evaluate the elements.
2956 (cxx_eval_constant_expression): Verify constructor's flags
2959 2018-03-19 Jason Merrill <jason@redhat.com>
2961 PR c++/71834 - template-id with too few arguments.
2962 * pt.c (coerce_template_parms): Check fixed_parameter_pack_p.
2964 2018-03-19 Nathan Sidwell <nathan@acm.org>
2967 * lambda.c (maybe_add_lambda_conv_op): Force C++ linkage.
2968 * pt.c (build_template_decl): Propagate language linkage.
2971 * name-lookup.c (set_local_extern_decl_linkage): Defend against
2974 2018-03-16 Jakub Jelinek <jakub@redhat.com>
2977 * parser.c (cp_parser_lambda_introducer): Remove trailing space from
2979 * method.c (synthesize_method): Likewise.
2980 * pt.c (convert_nontype_argument): Likewise.
2982 2018-03-16 Jason Merrill <jason@redhat.com>
2984 PR c++/84720 - ICE with rvalue ref non-type argument.
2985 * pt.c (invalid_nontype_parm_type_p): Prohibit rvalue reference.
2986 (convert_nontype_argument): Revert earlier change.
2988 PR c++/80227 - SFINAE and negative array size.
2989 * decl.c (compute_array_index_type): Use
2990 build_converted_constant_expr and valid_constant_size_p.
2992 PR c++/84906 - silent wrong code with ambiguous conversion.
2993 * call.c (build_user_type_conversion_1): Set need_temporary_p on
2994 ambiguous conversion.
2995 (convert_like_real): Check it.
2997 PR c++/83937 - wrong C++17 handling of init-list ctor argument.
2998 * call.c (build_special_member_call): Don't convert an init-list
2999 argument directly to the class type.
3001 2018-03-16 Jakub Jelinek <jakub@redhat.com>
3005 * cp-tree.h (CONSTRUCTOR_PLACEHOLDER_BOUNDARY): Define.
3006 (find_placeholder): Declare.
3007 * tree.c (struct replace_placeholders_t): Add exp member.
3008 (replace_placeholders_r): Don't walk into ctors with
3009 CONSTRUCTOR_PLACEHOLDER_BOUNDARY flag set, unless they are equal to
3010 d->exp. Replace PLACEHOLDER_EXPR with unshare_expr (x) rather than x.
3011 (replace_placeholders): Initialize data.exp.
3012 (find_placeholders_r, find_placeholders): New functions.
3013 * typeck2.c (process_init_constructor_record,
3014 process_init_constructor_union): Set CONSTRUCTOR_PLACEHOLDER_BOUNDARY
3015 if adding NSDMI on which find_placeholder returns true.
3016 * call.c (build_over_call): Don't call replace_placeholders here.
3017 * cp-gimplify.c (cp_genericize_r): Set TARGET_EXPR_NO_ELIDE on
3018 TARGET_EXPRs with CONSTRUCTOR_PLACEHOLDER_BOUNDARY set on
3019 TARGET_EXPR_INITIAL.
3020 (cp_fold): Copy over CONSTRUCTOR_PLACEHOLDER_BOUNDARY bit to new
3023 2018-03-16 Jason Merrill <jason@redhat.com>
3025 PR c++/83911 - ICE with multiversioned constructor.
3026 * cp-gimplify.c (cp_genericize_r): Replace versioned function with
3028 * call.c (build_over_call): Not here.
3030 2018-03-16 Jakub Jelinek <jakub@redhat.com>
3033 * decl.c (reshape_init_class): Don't assert d->cur->index == field
3034 if d->cur->index is a FIELD_DECL, instead set field to d->cur->index.
3036 2018-03-15 Jakub Jelinek <jakub@redhat.com>
3039 * cp-tree.h (cp_warn_deprecated_use): Declare.
3040 * tree.c (cp_warn_deprecated_use): New function.
3041 * typeck2.c (build_functional_cast): Use it.
3042 * decl.c (grokparms): Likewise.
3043 (grokdeclarator): Likewise. Temporarily push nested class scope
3044 around grokparms call for out of class member definitions.
3046 2018-03-14 Jason Merrill <jason@redhat.com>
3048 PR c++/84820 - no error for invalid qualified-id.
3049 * parser.c (cp_parser_make_indirect_declarator): Don't wrap
3050 cp_error_declarator.
3052 PR c++/84801 - ICE with unexpanded pack in lambda.
3053 * pt.c (check_for_bare_parameter_packs): Don't return early for a
3054 lambda in non-template context.
3056 PR c++/81236 - auto variable and auto function
3057 * pt.c (tsubst_baselink): Update the type of the BASELINK after
3060 2018-03-14 Jason Merrill <jason@redhat.com>
3062 PR c++/83916 - ICE with template template parameters.
3063 * pt.c (convert_template_argument): Don't substitute into type of
3064 non-type parameter if we don't have enough arg levels.
3067 2018-03-14 Marek Polacek <polacek@redhat.com>
3070 * semantics.c (finish_static_assert): Check
3071 instantiation_dependent_expression_p instead of
3072 {type,value}_dependent_expression_p.
3074 2018-03-13 Paolo Carlini <paolo.carlini@oracle.com>
3075 Jason Merrill <jason@redhat.com>
3077 PR c++/82336 - link error with list-init default argument.
3078 * decl.c (check_default_argument): Unshare an initializer list.
3080 2018-03-13 Jakub Jelinek <jakub@redhat.com>
3083 * decl.c (duplicate_decls): For redefinition of built-in, use error
3084 and return error_mark_node. For redeclaration, return error_mark_node
3085 rather than olddecl if !flag_permissive.
3087 2018-03-13 Jason Merrill <jason@redhat.com>
3089 PR c++/82565 - ICE with concepts and generic lambda.
3090 * pt.c (instantiate_decl): Clear fn_context for lambdas.
3092 2018-03-13 Jason Merrill <jason@redhat.com>
3094 PR c++/84720 - ICE with rvalue ref non-type argument.
3095 * pt.c (convert_nontype_argument): Handle rvalue references.
3097 PR c++/84839 - ICE with decltype of parameter pack.
3098 * pt.c (tsubst_pack_expansion): Set cp_unevaluated_operand while
3099 instantiating dummy parms.
3101 * parser.c (cp_parser_simple_type_specifier): Pedwarn about auto
3102 parameter even without -Wpedantic.
3104 PR c++/84798 - ICE with auto in abstract function declarator.
3105 * parser.c (cp_parser_parameter_declaration_clause): Check
3106 parser->default_arg_ok_p.
3108 2018-03-13 Jakub Jelinek <jakub@redhat.com>
3111 * constexpr.c (find_array_ctor_elt): Don't use elt reference after
3112 first potential CONSTRUCTOR_ELTS reallocation. Convert dindex to
3113 sizetype. Formatting fixes.
3115 2018-03-12 Jason Merrill <jason@redhat.com>
3117 PR c++/84355 - ICE with deduction for member class template.
3118 * pt.c (tsubst) [TEMPLATE_TYPE_PARM]: Always substitute into
3119 CLASS_PLACEHOLDER_TEMPLATE.
3121 PR c++/84802 - ICE capturing uninstantiated class.
3122 * lambda.c (build_capture_proxy): Call complete_type.
3124 2018-03-09 Jason Merrill <jason@redhat.com>
3126 PR c++/84770 - ICE with typedef and parameter pack.
3127 * pt.c (verify_unstripped_args_1): Split out from
3128 verify_unstripped_args.
3130 PR c++/84785 - ICE with alias template and default targs.
3131 * pt.c (type_unification_real): Set processing_template_decl if
3134 PR c++/84752 - ICE with capture of constexpr array.
3135 * call.c (standard_conversion): Set rvaluedness_matches_p on the
3136 identity conversion under ck_lvalue.
3138 2018-03-09 Jason Merrill <jason@redhat.com>
3139 Paolo Carlini <paolo.carlini@oracle.com>
3143 * pt.c (any_erroneous_template_args_p): New.
3144 * cp-tree.h (any_erroneous_template_args_p): Declare it.
3145 * parser.c (cp_parser_class_specifier_1): Use it.
3147 2018-03-09 Jason Merrill <jason@redhat.com>
3149 PR c++/84726 - unnecessary capture of constant vars.
3150 * cp-tree.h (LAMBDA_CAPTURE_EXPLICIT_P)
3151 (LAMBDA_EXPR_CAPTURE_OPTIMIZED): New.
3152 * expr.c (mark_use): Set LAMBDA_EXPR_CAPTURE_OPTIMIZED.
3153 * lambda.c (is_constant_capture_proxy)
3154 (current_lambda_expr, var_to_maybe_prune, mark_const_cap_r)
3155 (prune_lambda_captures): New.
3156 (finish_lambda_function): Call prune_lambda_captures.
3158 2018-03-09 Jason Merrill <jason@redhat.com>
3159 Jakub Jelinek <jakub@redhat.com>
3162 * call.c (convert_arg_to_ellipsis): Instead of cp_build_addr_expr
3163 build ADDR_EXPR with REFERENCE_TYPE.
3164 (build_over_call): For purposes of check_function_arguments, if
3165 argarray[j] is ADDR_EXPR with REFERENCE_TYPE created above, use
3166 its operand rather than the argument itself.
3168 2018-03-09 Jakub Jelinek <jakub@redhat.com>
3171 * decl.c (duplicate_decls): Don't override __* prefixed builtins
3172 except for __[^b]*_chk, instead issue permerror and for -fpermissive
3173 also a note and return olddecl.
3175 2018-03-09 Nathan Sidwell <nathan@acm.org>
3178 * name-lookup.c (do_pushdecl_with_scope): Only clear
3179 current_function_decl when pushing a non-class (i.e. namespace)
3182 2018-03-08 Jason Merrill <jason@redhat.com>
3183 Jakub Jelinek <jakub@redhat.com>
3186 * call.c (build_over_call): In templates set TREE_USED (first_fn) when
3187 not calling mark_used for the benefit of -Wunused-function warning.
3189 2018-03-06 Jason Merrill <jason@redhat.com>
3191 * lambda.c (is_capture_proxy_with_ref): Remove.
3192 * constexpr.c, expr.c, cp-tree.h, semantics.c: Adjust.
3194 2018-03-06 Marek Polacek <polacek@redhat.com>
3197 * constexpr.c (cxx_bind_parameters_in_call): Unshare evaluated
3200 2018-03-06 Alexandre Oliva <aoliva@redhat.com>
3203 * tree.c (lvalue_kind): Use presence/absence of REFERENCE_TYPE
3204 only while processing template decls.
3205 * typeck.c (build_x_conditional_expr): Move wrapping of
3206 reference type around type...
3207 * call.c (build_conditional_expr_1): ... here. Rename
3208 is_lvalue to is_glvalue.
3209 * parser.c (cp_parser_fold_expression): Catch REFERENCE_REF_P
3210 INDIRECT_REF of COND_EXPR too.
3213 * init.c (build_zero_init_1): Zero-initialize references.
3216 * semantics.c (finish_stmt_expr_expr): Reject unresolved
3217 overloads used as stmt expr values.
3219 2018-03-05 Jason Merrill <jason@redhat.com>
3221 PR c++/84708 - ICE with lambda in local class NSDMI.
3222 * lambda.c (lambda_expr_this_capture): Handle local class NSDMI
3225 2018-03-05 Jakub Jelinek <jakub@redhat.com>
3228 * constexpr.c (constexpr_call_hasher::equal): Return false if
3229 lhs->hash != rhs->hash. Change return 1 to return true and
3230 return 0 to return false.
3232 2018-03-05 Nathan Sidwell <nathan@acm.org>
3235 * pt.c (process_template_arg): Mark lookup_keep on a default arg.
3237 2018-03-05 Marek Polacek <polacek@redhat.com>
3240 * decl.c (duplicate_decls): Check DECL_NAME before accessing
3243 2018-03-05 Nathan Sidwell <nathan@acm.org>
3246 * friend.c (do_friend): Restore check for identifier_p inside
3249 2018-03-05 Paolo Carlini <paolo.carlini@oracle.com>
3252 * parser.c (cp_parser_lambda_introducer): Reject any capture not
3253 involving a VAR_DECL or a PARM_DECL.
3255 2018-03-05 Pádraig Brady <P@draigBrady.com>
3256 Jason Merrill <jason@redhat.com>
3257 Nathan Sidwell <nathan@acm.org>
3260 * decl2.c (get_tls_init_fn): Check TYPE_HAS_TRIVIAL_DFLT too.
3262 2018-03-03 Jason Merrill <jason@redhat.com>
3264 PR c++/84686 - missing volatile loads.
3265 * cvt.c (convert_to_void): Call maybe_undo_parenthesized_ref.
3267 2018-03-03 Paolo Carlini <paolo.carlini@oracle.com>
3270 * optimize.c (maybe_thunk_body): Bail out immediately if either
3271 fns[0] or fns[1] is null.
3273 2018-03-02 Marek Polacek <polacek@redhat.com>
3276 * constexpr.c (get_array_or_vector_nelts): New.
3277 (cxx_eval_array_reference): Use it.
3278 (cxx_eval_vec_init_1): Likewise.
3279 (cxx_eval_store_expression): Likewise.
3281 2018-03-02 Jason Merrill <jason@redhat.com>
3283 * semantics.c (force_paren_expr): Remove redundant test.
3285 2018-03-02 Marek Polacek <polacek@redhat.com>
3288 * decl.c (cp_complete_array_type): Check error_mark_node.
3291 * typeck.c (cp_perform_integral_promotions): Check the result of
3294 2018-03-02 Jakub Jelinek <jakub@redhat.com>
3297 * pt.c (tsubst_copy_and_build) <case TEMPLATE_ID_EXPR>: Use
3298 RETURN instead of return.
3299 <case POINTER_PLUS_EXPR>: Likewise.
3300 <case CONVERT_EXPR>: If op0 is error_mark_node, just return
3301 it instead of wrapping it into CONVERT_EXPR.
3303 2018-03-02 Jason Merrill <jason@redhat.com>
3306 * pt.c (type_dependent_expression_p): Check DECL_LANG_SPECIFIC.
3308 2018-03-02 Marek Polacek <polacek@redhat.com>
3311 * cp-gimplify.c (cp_fully_fold): Unwrap TARGET_EXPR or a CONSTRUCTOR
3312 wrapped in VIEW_CONVERT_EXPR.
3314 2018-03-01 Martin Sebor <msebor@redhat.com>
3317 * decl.c (check_redeclaration_no_default_args): Merge attributes
3318 specified on redeclarations of the same function template.
3321 2018-03-01 Marek Polacek <polacek@redhat.com>
3322 Jason Merrill <jason@redhat.com>
3325 * semantics.c (force_paren_expr): Create a PAREN_EXPR when in
3327 (maybe_undo_parenthesized_ref): Unwrap PAREN_EXPR.
3328 * typeck2.c (store_init_value): Call fold_non_dependent_expr instead
3329 of instantiate_non_dependent_expr.
3330 * tree.c (lvalue_kind): Handle PAREN_EXPR like NON_DEPENDENT_EXPR.
3332 2018-03-01 Nathan Sidwell <nathan@acm.org>
3335 * name-lookup.c (member_vec_dedup): Remove manually peeled
3336 iteration. Ignore dependent ctor inheritance.
3338 2018-03-01 Jason Merrill <jason@redhat.com>
3340 PR c++/71569 - decltype of template.
3341 * parser.c (cp_parser_decltype_expr): Handle missing template args.
3343 2018-03-01 Marek Polacek <polacek@redhat.com>
3346 * constexpr.c (require_rvalue_constant_expression): New function.
3347 * cp-tree.h: Declare it.
3348 * semantics.c (finish_static_assert): Use it instead of
3349 require_potential_rvalue_constant_expression.
3351 2018-03-01 Jason Merrill <jason@redhat.com>
3352 Alexandre Oliva <aoliva@redhat.com>
3354 PR c++/71569 - ICE with redundant args on member variable template.
3355 * decl.c (start_decl): Handle partial specialization of member
3357 * pt.c (determine_specialization): Allow partial specialization
3358 of member variable template without specializing enclosing class.
3359 (process_partial_specialization): Improve error message.
3361 2018-02-28 Jason Merrill <jason@redhat.com>
3363 PR c++/71784 - ICE with ref-qualifier and explicit specialization.
3364 * pt.c (determine_specialization): Check ref-qualifier.
3366 2018-02-28 Jakub Jelinek <jakub@redhat.com>
3369 * parser.c (cp_parser_attributes_opt): Formatting fix.
3370 (cp_parser_skip_balanced_tokens, cp_parser_skip_gnu_attributes_opt,
3371 cp_parser_skip_std_attribute_spec_seq, cp_parser_skip_attributes_opt):
3373 (cp_parser_member_declaration): Use cp_parser_skip_attributes_opt
3374 instead of tentative parse to peek over optional attribute tokens
3375 to check for CPP_COLON after them.
3379 * pt.c (INCLUDE_STRING): Remove define.
3380 (warn_spec_missing_attributes): Use pretty_printer instead of
3381 std::string. Fix up inform call so that the list of attributes
3384 2018-02-28 Martin Sebor <msebor@redhat.com>
3387 * decl.c (duplicate_decls): Fully merge attributes const, pure,
3390 2018-02-28 Nathan Sidwell <nathan@acm.org>
3393 * name-lookup.h (search_anon_aggr): Add defaulted WANT_TYPE arg.
3394 * name-lookup.c (fields_linear_search): Look in an anon-aggr
3395 regardless of want_type.
3396 (search_anon_aggr): Just use get_class_binding_direct.
3398 2018-02-28 Jakub Jelinek <jakub@redhat.com>
3400 * decl.c (cp_finish_decomp): Don't adjust eltscnt when calling
3403 2018-02-27 Martin Sebor <msebor@redhat.com>
3405 * pt.c: Avoid including <string> directly.
3407 2018-02-27 Martin Sebor <msebor@redhat.com>
3411 * cp-tree.h (warn_spec_missing_attributes): New function.
3412 ((check_explicit_specialization): Add an argument. Call the above
3414 * decl.c (duplicate_decls): Avoid applying primary function template's
3415 attributes to its explicit specializations.
3416 cp/pt.c (warn_spec_missing_attributes): Define.
3418 2018-02-27 HÃ¥kon Sandsmark <hsandsmark@gmail.com>
3420 PR c++/71546 - lambda init-capture with qualified-id.
3421 * parser.c (cp_parser_lambda_introducer): Clear scope after
3422 each lambda capture.
3424 2018-02-27 Nathan Sidwell <nathan@acm.org>
3427 * name-lookup.h (get_member_slot): Rename ...
3428 (find_member_slot): ... here.
3429 (add_member_slot): New.
3430 * name-lookup.c (member_vec_linear_search): No need to check for
3432 (get_member_slot): Rename ...
3433 (find_member_slot): ... here. Don't add slot for incomplete class.
3434 (add_member_slot): New.
3435 * class.c (add_method): Adjust get_member_slot rename. Bail out
3436 if push_class_level_binding fails. Create slot and grok
3437 properties once we're committed to insertion.
3439 2018-02-27 Jason Merrill <jason@redhat.com>
3441 PR c++/84489 - dependent default template argument
3442 * pt.c (type_unification_real): Handle early substitution failure.
3444 2018-02-26 Jason Merrill <jason@redhat.com>
3446 PR c++/84560 - ICE capturing multi-dimensional VLA.
3447 * tree.c (array_of_runtime_bound_p): False if the element is
3450 PR c++/84441 - ICE with base initialized from ?:
3451 * call.c (unsafe_copy_elision_p): Handle COND_EXPR.
3453 PR c++/84520 - ICE with generic lambda in NSDMI.
3454 * lambda.c (lambda_expr_this_capture): Don't look for fake NSDMI
3455 'this' in a generic lambda instantiation.
3457 PR c++/84559 - ICE with constexpr VLA.
3458 * constexpr.c (ensure_literal_type_for_constexpr_object): Check
3459 for constexpr variable with VLA type.
3461 2018-02-26 Jakub Jelinek <jakub@redhat.com>
3464 * constexpr.c (cxx_eval_vec_init_1): For reuse, treat NULL eltinit like
3465 a valid constant initializer. Formatting fixes.
3467 2018-02-26 Paolo Carlini <paolo.carlini@oracle.com>
3470 * pt.c (tsubst_attributes): Handle correctly tsubst_attribute
3471 returning NULL_TREE.
3472 (apply_late_template_attributes): Likewise.
3474 2018-02-26 Jakub Jelinek <jakub@redhat.com>
3477 * parser.c (cp_parser_omp_var_list_no_open): Only call
3478 cp_parser_lookup_name_simple on names satisfying identifier_p.
3479 (cp_parser_oacc_routine): Likewise.
3481 2018-02-26 Jason Merrill <jason@redhat.com>
3483 PR c++/84551 - ICE with concepts and -g.
3484 * parser.c (add_debug_begin_stmt): Do nothing in a concept.
3486 2018-02-26 Marek Polacek <polacek@redhat.com>
3489 * tree.c (replace_placeholders_r): Only check TREE_CONSTANT on
3492 2018-02-26 Jason Merrill <jason@redhat.com>
3494 PR c++/84447 - ICE with deleted inherited ctor with default arg.
3495 * call.c (build_over_call): Handle deleted functions in one place.
3497 2018-02-26 Paolo Carlini <paolo.carlini@oracle.com>
3500 * decl.c (redeclaration_error_message): Don't try to use
3501 DECL_DECLARED_CONSTEXPR_P on CONST_DECLs.
3503 2018-02-26 Paolo Carlini <paolo.carlini@oracle.com>
3505 * lambda.c (build_capture_proxy): Define static.
3506 * cp-tree.h (build_capture_proxy): Remove.
3508 2018-02-26 Marek Polacek <polacek@redhat.com>
3511 * name-lookup.c (suggest_alternative_in_explicit_scope): Return false
3512 if name is error node.
3514 2018-02-25 Jason Merrill <jason@redhat.com>
3516 PR c++/84015 - ICE with class deduction and auto template parm.
3517 * pt.c (rewrite_template_parm): Use tf_partial in first tsubst.
3519 2018-02-24 Marek Polacek <polacek@redhat.com>
3522 * constexpr.c (maybe_constant_init_1): New function.
3523 (maybe_constant_init): Make it a wrapper around maybe_constant_init_1.
3524 (cxx_constant_init): New function.
3525 * cp-tree.h (cxx_constant_init): Declare.
3526 * typeck2.c (store_init_value): Call cxx_constant_init instead of
3527 cxx_constant_value. Move the maybe_constant_init call under an 'else'.
3529 2018-02-22 Jason Merrill <jason@redhat.com>
3531 PR c++/70468 - ICE with constructor delegation via typedef.
3532 * pt.c (tsubst_initializer_list): Check for other mem-initializers
3533 with constructor delegation.
3535 2018-02-22 Jason Merrill <jason@redhat.com>
3537 PR c++/84424 - ICE with constexpr and __builtin_shuffle.
3538 * constexpr.c (reduced_constant_expression_p): Handle CONSTRUCTOR of
3541 2018-02-22 Marek Polacek <polacek@redhat.com>
3544 * parser.c (cp_parser_braced_list): Use require_open instead of
3547 2018-02-21 Jason Merrill <jason@redhat.com>
3549 PR c++/84454 - ICE with pack expansion in signature.
3550 * error.c (find_typenames_r): Also stop on EXPR_PACK_EXPANSION.
3552 2018-02-20 Siddhesh Poyarekar <siddhesh@sourceware.org>
3554 * cp-objcp-common.c (cxx_block_may_fallthru): Add case for
3557 2018-02-20 Paolo Carlini <paolo.carlini@oracle.com>
3560 * parser.c (cp_parser_init_declarator): Don't call start_lambda_scope
3563 2018-02-20 Jakub Jelinek <jakub@redhat.com>
3566 * class.c (fixed_type_or_null) <case CALL_EXPR>: Only test
3567 TREE_HAS_CONSTRUCTOR if instance is not an internal function call.
3570 * tree.c (bot_manip): If build_cplus_new or break_out_target_exprs
3571 returns error_mark_node, return it immediately.
3572 (break_out_target_exprs): If cp_walk_tree with bot_manip returns
3573 error_mark_node, return error_mark_node.
3576 * pt.c (tsubst_lambda_expr): If not nested, increment temporarily
3577 function_depth to avoid GC during finish_lambda_function.
3579 2018-02-19 Jason Merrill <jason@redhat.com>
3581 PR c++/84429 - ICE capturing VLA.
3582 * lambda.c (build_capture_proxy): Handle reference refs.
3584 2018-02-19 Jakub Jelinek <jakub@redhat.com>
3587 * parser.c (cp_parser_binary_expression): For no_toplevel_fold_p, if
3588 either operand is error_mark_node, set current.lhs to that instead of
3589 creating a binary op with error_mark_node operands.
3592 * constexpr.c (potential_constant_expression_1): Handle OMP_SIMD.
3594 2018-02-19 Paolo Carlini <paolo.carlini@oracle.com>
3597 * decl.c (grokdeclarator): Early return error_mark_node upon
3598 ill-formed friend declaration.
3600 2018-02-16 Marek Polacek <polacek@redhat.com>
3601 Jakub Jelinek <jakub@redhat.com>
3604 * constexpr.c (cxx_eval_constant_expression) <case RETURN_EXPR>: Don't
3605 set *jump_target to anything if jump_target is NULL.
3607 2018-02-16 Jason Merrill <jason@redhat.com>
3609 PR c++/84151 - unnecessary volatile load with static member.
3610 * call.c (build_new_method_call_1): Avoid loading from a volatile
3611 lvalue used as the object argument for a static member function.
3613 PR c++/81853 - using-directive and constexpr.
3614 * constexpr.c (cxx_eval_constant_expression): Handle USING_STMT.
3616 PR c++/84420 - ICE with structured binding in lambda.
3617 * lambda.c (is_capture_proxy): Check DECL_DECOMPOSITION_P.
3619 PR c++/83835 - C++17 error with constructor ctors.
3620 * call.c (build_special_member_call): Set TARGET_EXPR_DIRECT_INIT_P.
3622 PR c++/82664 - ICE with reference to function template parm.
3623 * pt.c (convert_nontype_argument_function): Avoid obfuscationg
3626 PR c++/82764 - C++17 ICE with empty base
3627 * class.c (build_base_field_1): Set DECL_SIZE to zero for empty base.
3629 2018-02-16 Jason Merrill <jason@redhat.com>
3631 PR c++/84421 - type-dependent if constexpr
3632 * semantics.c (finish_if_stmt_cond): Check type_dependent_expression_p.
3634 2018-02-16 Nathan Sidwell <nathan@acm.org>
3636 Deprecate -ffriend-injection.
3637 * decl.c (cxx_init_decl_processing): Emit warning on option.
3638 * name-lookup.c (do_pushdecl): Emit warning if we push a visible
3641 2018-02-16 Paolo Carlini <paolo.carlini@oracle.com>
3644 * decl.c (check_special_function_return_type): Reject template
3645 template parameter in deduction guide.
3647 2018-02-16 Nathan Sidwell <nathan@acm.org>
3650 * name-lookup.c (do_pushdecl): Bail out on bad local friend injection.
3652 2018-02-15 Jason Merrill <jason@redhat.com>
3654 PR c++/83227 - C++17 ICE with init-list derived-to-base conversion.
3655 * call.c (convert_like_real): Don't use the copy-list-initialization
3656 shortcut for ck_base.
3658 PR c++/84045 - ICE with typedef and noexcept.
3659 * except.c (build_noexcept_spec): Use strip_typedefs_expr.
3661 PR c++/84376 - ICE with omitted template arguments.
3662 * pt.c (dguide_name_p): Check for IDENTIFIER_NODE.
3664 PR c++/84368 - wrong error with local variable in variadic lambda.
3665 * pt.c (tsubst_pack_expansion): Fix handling of non-packs in
3666 local_specializations.
3668 2018-02-15 Paolo Carlini <paolo.carlini@oracle.com>
3671 * constraint.cc (tsubst_constraint_info): Handle an error_mark_node
3674 2018-02-14 Paolo Carlini <paolo.carlini@oracle.com>
3677 * pt.c (do_auto_deduction): Don't check the TREE_TYPE of a null
3680 2018-02-14 Nathan Sidwell <nathan@acm.org>
3682 * decl2.c (mark_vtable_entries): Set input_location to decl's.
3683 (c_parse_final_cleanups): Restore input_location after emitting
3686 2018-02-14 Paolo Carlini <paolo.carlini@oracle.com>
3688 * cp-tree.h (do_auto_deduction (tree, tree, tree)): Remove.
3689 (do_auto_deduction (tree, tree, tree, tsubst_flags_t,
3690 auto_deduction_context, tree, int): Add defaults.
3691 * pt.c (do_auto_deduction (tree, tree, tree)): Remove definition.
3692 (tsubst_omp_for_iterator): Adjust do_auto_deduction call, forward
3693 tsubst_flags_t argument.
3694 * init.c (build_new): Likewise.
3696 2018-02-13 Jakub Jelinek <jakub@redhat.com>
3699 * typeck.c (check_return_expr): Don't emit -Weffc++ warning
3700 about return other than *this in assignment operators if
3701 retval is type dependent expression.
3703 2018-02-13 Paolo Carlini <paolo.carlini@oracle.com>
3706 * call.c (build_conditional_expr_1): Use cp_save_expr instead of
3707 save_expr for the G++ extension.
3709 2018-02-13 Jason Merrill <jason@redhat.com>
3711 PR c++/84080 - ICE with return type deduction and specialization.
3712 * pt.c (determine_specialization): Check uses_template_parms.
3714 Fix more variadic capture issues.
3715 * pt.c (find_parameter_packs_r): Also look at explicit captures.
3716 (check_for_bare_parameter_packs): Check current_class_type for
3718 (extract_locals_r): Handle seeing a full instantiation of a pack.
3719 (tsubst_pack_expansion): Likewise. Force lambda capture.
3720 * parser.c (cp_parser_lambda_introducer): Don't
3721 check_for_bare_parameter_packs.
3723 PR c++/84338 - wrong variadic sizeof.
3724 * pt.c (argument_pack_select_arg): Like the macro, but look through
3726 (tsubst, tsubst_copy, dependent_template_arg_p): Use it.
3727 (extract_fnparm_pack): Do make_pack_expansion.
3728 (extract_locals_r): Do strip a pack expansion.
3729 * cp-tree.h (ARGUMENT_PACK_SELECT_ARG): Remove.
3731 2018-02-12 Jakub Jelinek <jakub@redhat.com>
3734 * parser.c (cp_parser_binary_expression): Use build_min instead of
3735 build2_loc to build the no_toplevel_fold_p toplevel binary expression.
3737 2018-02-12 Nathan Sidwell <nathan@acm.org>
3740 * parser.c (cp_parser_decltype): Push and pop
3741 deferring_access_checks. Reorganize to avoid goto.
3743 2018-02-12 Richard Biener <rguenther@suse.de>
3746 * constexpr.c (cxx_eval_vec_init_1): Use a RANGE_EXPR to compact
3747 uniform constructors and delay allocating them fully.
3749 2018-02-09 Jason Merrill <jason@redhat.com>
3751 PR c++/84036 - ICE with variadic capture.
3752 Handle variadic capture proxies more like non-variadic.
3753 * lambda.c (build_capture_proxy): Remove workaround.
3754 * pt.c (find_parameter_packs_r): The proxy is a pack.
3755 (instantiate_class_template_1): Remove dead lambda code.
3756 (extract_fnparm_pack): Don't make_pack_expansion.
3757 (extract_locals_r): Don't strip a pack expansion.
3758 (tsubst_pack_expansion): Handle proxy packs. Use
3759 PACK_EXPANSION_EXTRA_ARGS less.
3760 (tsubst_decl) [FIELD_DECL]: Don't register_specialization.
3761 (tsubst_copy) [FIELD_DECL]: Don't retrieve*_specialization.
3762 [VAR_DECL]: Handle ARGUMENT_PACK_SELECT.
3763 (tsubst_expr) [DECL_EXPR]: Handle proxy packs.
3764 (tsubst_copy_and_build) [VAR_DECL]: Handle proxy packs normally.
3766 2018-02-10 Jakub Jelinek <jakub@redhat.com>
3769 * tree.c (cp_free_lang_data): Revert 2018-01-23 change.
3771 2018-02-09 Jason Merrill <jason@redhat.com>
3773 PR c++/81917 - ICE with void_t and partial specialization.
3774 * pt.c (instantiate_class_template_1): Set TYPE_BEING_DEFINED before
3775 calling most_specialized_partial_spec.
3777 2018-02-09 Nathan Sidwell <nathan@acm.org>
3780 * typeck.c (cp_build_indirect_ref_1, build_reinterpret_cast_1):
3781 Pass expr location to strict_aliasing_warning.
3783 2018-02-09 Jason Merrill <jason@redhat.com>
3785 PR c++/84296 - ICE with qualified-id in template.
3787 * pt.c (unknown_base_ref_p): New.
3788 (instantiation_dependent_scope_ref_p): Use it instead of
3789 any_dependent_bases_p.
3791 2018-02-09 Marek Polacek <polacek@redhat.com>
3792 Jakub Jelinek <jakub@redhat.com>
3795 * constexpr.c (cxx_fold_indirect_ref): Sync some changes from
3796 fold_indirect_ref_1, including poly_*int64. Verify first that
3797 tree_fits_poly_int64_p (op01). Formatting fixes.
3799 2018-02-08 Paolo Carlini <paolo.carlini@oracle.com>
3801 * constexpr.c (cxx_eval_component_reference): Use INDIRECT_REF_P.
3802 * lambda.c (build_capture_proxy): Likewise.
3803 * search.c (field_access_p): Likewise.
3804 * semantics.c (omp_clause_decl, omp_privatize_field,
3805 finish_omp_clauses): Likewise.
3807 2018-02-08 Paolo Carlini <paolo.carlini@oracle.com>
3810 * typeck.c (decay_conversion): Use mark_rvalue_use for the special
3811 case of nullptr too.
3813 2018-02-08 Nathan Sidwell <nathan@acm.org>
3815 * class.c (finish_struct): Fix std:initializer_list diagnostic
3818 2018-02-08 Paolo Carlini <paolo.carlini@oracle.com>
3821 * pt.c (tsubst_copy_and_build): Use force_paren_expr for INDIRECT_REF.
3823 2018-02-07 Jakub Jelinek <jakub@redhat.com>
3826 * parser.c (cp_parser_dot_deref_incomplete): New function.
3827 (cp_parser_postfix_dot_deref_expression): Use it.
3829 2018-02-07 David Malcolm <dmalcolm@redhat.com>
3833 * name-lookup.c (suggest_rid_p): New function.
3834 (lookup_name_fuzzy): Replace enum-rid-filtering logic with call to
3837 2018-02-07 Jason Merrill <jason@redhat.com>
3839 PR c++/84182 - ICE with captured lambda
3841 * pt.c (extract_locals_r, extract_local_specs): New.
3842 (tsubst_pack_expansion): Use them.
3844 2018-02-07 Martin Liska <mliska@suse.cz>
3847 * class.c (add_method): Append argument value.
3848 * cp-tree.h (maybe_version_functions): Add new argument.
3849 * decl.c (decls_match): Call it if a declaration does not
3850 have DECL_FUNCTION_VERSIONED.
3851 (maybe_version_functions): record argument is added.
3853 2018-02-05 Marek Polacek <polacek@redhat.com>
3855 * class.c: Remove unused global variables.
3856 (build_primary_vtable): Don't gather statistics.
3857 (print_class_statistics): Remove.
3858 * cp-tree.h (print_class_statistics): Remove.
3859 * tree.c (cxx_print_statistics): Don't call print_class_statistics.
3861 2018-02-02 Paolo Carlini <paolo.carlini@oracle.com>
3863 * class.c (is_really_empty_class): Use DECL_UNNAMED_BIT_FIELD.
3864 * constexpr.c (cx_check_missing_mem_inits): Likewise.
3865 * decl.c (next_initializable_field, find_decomp_class_base,
3866 cp_finish_decomp): Likewise.
3867 * typeck2.c (process_init_constructor_record): Likewise.
3869 2018-02-02 Jason Merrill <jason@redhat.com>
3871 PR c++/84181 - ICE with lambda parm in template argument.
3872 * tree.c (strip_typedefs_expr): Use cp_tree_operand_length.
3874 2018-02-01 Jason Merrill <jason@redhat.com>
3876 PR c++/84160 - ICE with nested variadic capture.
3877 * lambda.c (is_capture_proxy_with_ref): New.
3878 (insert_capture_proxy): Don't set DECL_CAPTURED_VARIABLE from a
3880 * expr.c (mark_use): Use is_capture_proxy_with_ref.
3881 * constexpr.c (potential_constant_expression_1): Likewise.
3882 * semantics.c (process_outer_var_ref): Likewise.
3884 2018-02-01 Marek Polacek <polacek@redhat.com>
3887 * typeck.c (build_address): Relax the assert when
3888 processing_template_decl.
3890 2018-02-01 Jason Merrill <jason@redhat.com>
3892 PR c++/84126 - ICE with variadic generic lambda
3895 * pt.c (tsubst_pack_expansion): Handle function parameter_packs in
3896 PACK_EXPANSION_EXTRA_ARGS.
3898 2018-02-01 Paolo Carlini <paolo.carlini@oracle.com>
3901 * call.c (convert_like_real): If w're initializing from {} explicitly
3902 call abstract_virtuals_error_sfinae.
3904 2018-01-31 Jason Merrill <jason@redhat.com>
3905 Jakub Jelinek <jakub@redhat.com>
3908 * constexpr.c (cxx_eval_outermost_constant_expr): Build NOP_EXPR
3909 around non-constant ADDR_EXPRs rather than clearing TREE_CONSTANT
3912 2018-01-31 Jakub Jelinek <jakub@redhat.com>
3915 * constexpr.c (diag_array_subscript): Emit different diagnostics
3916 if TYPE_DOMAIN (arraytype) is NULL.
3917 (cxx_eval_array_reference, cxx_eval_store_expression): For arrays
3918 with NULL TYPE_DOMAIN use size_zero_node as nelts.
3920 2018-01-31 Paolo Carlini <paolo.carlini@oracle.com>
3923 * semantics.c (finish_qualified_id_expr): When handling an
3924 UNBOUND_CLASS_TEMPLATE only adjust qualifying_class and expr.
3926 2018-01-31 Marek Polacek <polacek@redhat.com>
3929 * cp-gimplify.c (cp_fold): Check if X is an error node before
3930 calling useless_type_conversion_p.
3932 2018-01-30 Jason Merrill <jason@redhat.com>
3934 PR c++/84091 - ICE with local class in lambda in template.
3935 * decl2.c (determine_visibility): Look for outer containing template
3938 PR c++/84098 - ICE with lambda in template NSDMI.
3939 * pt.c (instantiate_class_template_1): Ignore more lambdas.
3941 2018-01-29 Jason Merrill <jason@redhat.com>
3943 PR c++/68810 - wrong location for reinterpret_cast error.
3944 * cvt.c (cp_convert_to_pointer): Always build a CONVERT_EXPR when
3947 2018-01-29 Marek Polacek <polacek@redhat.com>
3950 * constexpr.c (cxx_fold_indirect_ref): Compute ((foo *)&fooarray)[1]
3951 => fooarray[1] in offset_int.
3953 2018-01-29 Jason Merrill <jason@redhat.com>
3955 PR c++/83942 - wrong unused warning with static_cast.
3956 * cvt.c (ocp_convert): Call mark_rvalue_use.
3958 2018-01-26 Jason Merrill <jason@redhat.com>
3960 PR c++/83956 - wrong dtor error with anonymous union
3961 * method.c (walk_field_subobs): Variant members only affect
3963 (maybe_explain_implicit_delete): Pass &deleted_p for diagnostic.
3965 PR c++/84036 - ICE with variadic capture.
3967 * pt.c (tsubst_pack_expansion): When optimizing a simple
3968 substitution, pull a single pack expansion out of its pack.
3970 PR c++/82514 - ICE with local class in generic lambda.
3971 * pt.c (regenerated_lambda_fn_p): Remove.
3972 (enclosing_instantiation_of): Don't use it.
3973 (tsubst_function_decl): Call enclosing_instantiation_of.
3975 * pt.c (lookup_template_class_1): Add sanity check.
3976 * name-lookup.c (do_pushtag): Don't add closures to local_classes.
3978 2018-01-25 Jakub Jelinek <jakub@redhat.com>
3981 * decl.c (find_decomp_class_base): Ignore unnamed bitfields. Ignore
3982 recursive calls that return ret.
3983 (cp_finish_decomp): Ignore unnamed bitfields.
3985 2018-01-23 Jason Merrill <jason@redhat.com>
3987 PR c++/82249 - wrong mismatched pack length error.
3988 * pt.c (extract_fnparm_pack, tsubst_pack_expansion): Handle
3989 unsubstituted function parameter pack.
3991 2018-01-23 Paolo Carlini <paolo.carlini@oracle.com>
3994 * decl.c (check_for_uninitialized_const_var): Not static; add
3995 bool and tsubst_flags_t parameters; adjust to be used both in
3996 constexpr context and not.
3997 * constexpr.c (potential_constant_expression_1): Use the above.
3998 * cp-tree.h (check_for_uninitialized_const_var): Declare.
4000 2018-01-23 Jason Merrill <jason@redhat.com>
4002 PR c++/83947 - ICE with auto declarations.
4003 * pt.c (do_auto_deduction): Don't deduce from an auto decl.
4004 * decl.c (undeduced_auto_decl): Limit to vars and fns.
4006 2018-01-23 David Malcolm <dmalcolm@redhat.com>
4009 * pt.c (tsubst_copy_and_build) <CONSTRUCTOR>: Remove early bailout
4010 for pointer to member function types.
4012 2018-01-23 Jakub Jelinek <jakub@redhat.com>
4015 * tree.c (cp_free_lang_data): Change DECL_VALUE_EXPR of
4016 DECL_OMP_PRIVATIZED_MEMBER vars to error_mark_node.
4018 2018-01-23 Nathan Sidwell <nathan@acm.org>
4021 * pt.c (tsubst_baselink): Remove optype assert.
4022 * ptree.c (cxx_print_xnode): <case BASELINK> Print BASELINK_OPTYPE.
4024 2018-01-23 Jakub Jelinek <jakub@redhat.com>
4027 * decl.c (cp_finish_decomp): Diagnose if reference structure binding
4028 refers to incomplete type.
4030 2018-01-23 Nathan Sidwell <nathan@acm.org>
4032 Deprecate ARM-era for scope handling
4033 * decl.c (poplevel): Flag_new_for_scope is a boolean-like.
4034 (cxx_init_decl_processing): Deprecate flag_new_for_scope being
4036 * name-lookup.c (check_for_out_of_scope_variable): Deprecate and
4038 * semantics.c (begin_for_scope): Flag_new_for_scope is
4040 (finish_for_stmt, begin_range_for_stmt): Likewise.
4042 2018-01-22 Jason Merrill <jason@redhat.com>
4045 * decl2.c (determine_visibility): Fix template_decl handling
4046 instead of blocking it.
4048 PR c++/83720 - ICE with lambda and LTO.
4049 * decl2.c (determine_visibility): Clear template_decl for
4050 function-scope decls. Propagate anonymous linkage from containing
4053 2018-01-22 Marek Polacek <polacek@redhat.com>
4056 * typeck2.c (split_nonconstant_init_1): Return false if we didn't
4059 2018-01-22 Ville Voutilainen <ville.voutilainen@gmail.com>
4062 * decl.c (grokdeclarator): Don't diagnose extra parens
4065 2018-01-19 Jakub Jelinek <jakub@redhat.com>
4068 * call.c (joust): Use TREE_TYPE (source) if source is
4069 a POINTER_TYPE_P rather than if ! DECL_CONSTRUCTOR_P (w->fn).
4072 * typeck.c (convert_for_assignment): Suppress warn_ignored_qualifiers
4073 for direct enum init.
4074 * decl.c (reshape_init): Likewise.
4076 2018-01-19 Marek Polacek <polacek@redhat.com>
4078 * constexpr.c (fold_simple): Simplify.
4080 2018-01-18 Jason Merrill <jason@redhat.com>
4083 * search.c (any_dependent_bases_p): Handle null TREE_BINFO.
4084 * pt.c (instantiation_dependent_scope_ref_p): True if
4085 any_dependent_bases_p.
4087 2018-01-18 Paolo Carlini <paolo.carlini@oracle.com>
4089 * cp-tree.h: Fix comment typo (DECL_NON_TRIVIALLY_INITIALIZED_P
4090 vs DECL_NONTRIVIALLY_INITIALIZED_P).
4092 2018-01-18 Jason Merrill <jason@redhat.com>
4094 PR c++/82461 - constexpr list-initialized member
4095 * constexpr.c (potential_constant_expression_1): Check
4096 TARGET_EXPR_DIRECT_INIT_P.
4098 2018-01-18 Paolo Carlini <paolo.carlini@oracle.com>
4101 * decl.c (xref_basetypes): Early return upon error about derived
4104 2018-01-18 Nathan Sidwell <nathan@acm.org>
4107 * cp-tree.h (mark_use): Declare.
4108 * expr.c (mark_use): Make extern.
4109 * call.c (direct_reference_binding): Set inner conv's
4110 rvaluedness_matches_p, if it is an identity.
4111 (convert_like_real): Mark lvalue or rvalue use for identity as
4112 rvaledness_matches_p demands.
4114 2018-01-18 Jakub Jelinek <jakub@redhat.com>
4117 * parser.c (attr_chainon): New function.
4118 (cp_parser_label_for_labeled_statement, cp_parser_decl_specifier_seq,
4119 cp_parser_namespace_definition, cp_parser_init_declarator,
4120 cp_parser_type_specifier_seq, cp_parser_parameter_declaration,
4121 cp_parser_gnu_attributes_opt): Use it.
4122 (cp_parser_member_declaration, cp_parser_objc_class_ivars,
4123 cp_parser_objc_struct_declaration): Likewise. Don't reset
4124 prefix_attributes if attributes is error_mark_node.
4126 2018-01-17 Paolo Carlini <paolo.carlini@oracle.com>
4129 * decl.c (grokdeclarator): Do not append the error_mark_node
4130 due to an erroneous optional attribute-specifier-seq.
4132 2018-01-17 Jakub Jelinek <jakub@redhat.com>
4135 * cp-gimplify.c (cp_maybe_instrument_return): Handle
4138 2018-01-17 Paolo Carlini <paolo.carlini@oracle.com>
4141 * constexpr.c (ensure_literal_type_for_constexpr_object): Return
4142 error_mark_node when we give an error.
4143 * decl.c (cp_finish_decl): Use the latter.
4145 2018-01-17 Nathan Sidwell <nathan@acm.org>
4148 * init.c (build_raw_new_expr): Scan list for lookups to keep.
4150 2018-01-17 David Malcolm <dmalcolm@redhat.com>
4153 * expr.c (fold_for_warn): Move from c-common.c, reducing to just
4154 the C++ part. If processing a template, call
4155 fold_non_dependent_expr rather than fully folding.
4157 2018-01-17 Jason Merrill <jason@redhat.com>
4159 PR c++/81067 - redundant NULL warning.
4160 * call.c (convert_like_real): Restore null_node handling.
4162 2018-01-17 Jason Merrill <jason@redhat.com>
4164 PR c++/81843 - ICE with variadic member template.
4166 * pt.c (unify_pack_expansion): Don't try to deduce enclosing
4169 2018-01-17 David Malcolm <dmalcolm@redhat.com>
4172 * pt.c (type_dependent_expression_p): Strip any location wrapper
4173 before testing tree codes.
4174 (selftest::test_type_dependent_expression_p): New function.
4175 (selftest::cp_pt_c_tests): Call it.
4177 2018-01-17 Nathan Sidwell <nathan@acm.org>
4180 * pt.c (tsubst_expr) <case RANGE_FOR_STMT>: Rebuild a range_for if
4181 this not a final instantiation.
4183 2018-01-16 Jason Merrill <jason@redhat.com>
4185 PR c++/83714 - ICE checking return in template.
4186 * typeck.c (check_return_expr): Call build_non_dependent_expr.
4188 2018-01-16 Jakub Jelinek <jakub@redhat.com>
4191 * pt.c (tsubst_copy_and_build) <case CALL_EXPR>: If function
4192 is AGGR_INIT_EXPR rather than CALL_EXPR, set AGGR_INIT_FROM_THUNK_P
4193 instead of CALL_FROM_THUNK_P.
4196 * name-lookup.c (member_vec_dedup): Return early if len is 0.
4197 (resort_type_member_vec, set_class_bindings,
4198 insert_late_enum_def_bindings): Use vec qsort method instead of
4199 calling qsort directly.
4201 2018-01-15 Martin Sebor <msebor@redhat.com>
4204 * class.c (find_flexarrays): Make a record of multiple flexible array
4207 2018-01-12 Jason Merrill <jason@redhat.com>
4209 PR c++/83186 - ICE with static_cast of list-initialized temporary.
4210 * typeck.c (build_static_cast): Use build_non_dependent_expr.
4212 2018-01-12 Nathan Sidwell <nathan@acm.org>
4214 * cp-tree.h (mark_rvalue_use): Add parm name.
4215 * expr.c (mark_lvalue_use, mark_lvalue_use_nonread): Move next to
4217 * call.c (convert_like_real): Fix formatting.
4219 2018-01-11 Jason Merrill <jason@redhat.com>
4221 PR c++/82728 - wrong -Wunused-but-set-variable
4224 * call.c (perform_implicit_conversion_flags): Call mark_rvalue_use.
4225 * decl.c (case_conversion): Likewise.
4226 * semantics.c (finish_static_assert): Call
4227 perform_implicit_conversion_flags.
4229 2018-01-11 Nathan Sidwell <nathan@acm.org>
4231 * method.c (enum mangling_flags): Delete long-dead enum.
4233 2018-01-10 Paolo Carlini <paolo.carlini@oracle.com>
4235 * parser.c (cp_parser_std_attribute_spec): When
4236 token_pair::require_open / require_close return false simply
4237 return error_mark_node, avoid duplicate cp_parser_error about
4238 expected '(' / ')', respectively.
4240 2018-01-10 David Malcolm <dmalcolm@redhat.com>
4243 * call.c (null_ptr_cst_p): Strip location wrappers when
4244 converting from '0' to a pointer type in C++11 onwards.
4245 (conversion_null_warnings): Replace comparison with null_node with
4246 call to null_node_p.
4247 (build_over_call): Likewise.
4248 * cp-gimplify.c (cp_fold): Remove the early bailout when
4249 processing_template_decl.
4250 * cp-lang.c (selftest::run_cp_tests): Call
4251 selftest::cp_pt_c_tests and selftest::cp_tree_c_tests.
4252 * cp-tree.h (cp_expr::maybe_add_location_wrapper): New method.
4253 (selftest::run_cp_tests): Move decl to bottom of file.
4254 (null_node_p): New inline function.
4255 (selftest::cp_pt_c_tests): New decl.
4256 (selftest::cp_tree_c_tests): New decl.
4257 * cvt.c (build_expr_type_conversion): Replace comparison with
4258 null_node with call to null_node_p.
4259 * error.c (args_to_string): Likewise.
4260 * except.c (build_throw): Likewise.
4261 * mangle.c (write_expression): Skip location wrapper nodes.
4262 * parser.c (literal_integer_zerop): New function.
4263 (cp_parser_postfix_expression): Call maybe_add_location_wrapper on
4264 the result for RID_TYPEID. Pass true for new "wrap_locations_p"
4265 param of cp_parser_parenthesized_expression_list. When calling
4266 warn_for_memset, replace integer_zerop calls with
4267 literal_integer_zerop, eliminating the double logical negation
4268 cast to bool. Eliminate the special-casing for CONST_DECL in
4269 favor of the fold_for_warn within warn_for_memset.
4270 (cp_parser_parenthesized_expression_list): Add "wrap_locations_p"
4271 param, defaulting to false. Convert "expr" to a cp_expr, and call
4272 maybe_add_location_wrapper on it when wrap_locations_p is true.
4273 (cp_parser_unary_expression): Call maybe_add_location_wrapper on
4274 the result for RID_ALIGNOF and RID_SIZEOF.
4275 (cp_parser_builtin_offsetof): Likewise.
4276 * pt.c: Include "selftest.h".
4277 (tsubst_copy): Handle location wrappers.
4278 (tsubst_copy_and_build): Likewise.
4279 (build_non_dependent_expr): Likewise.
4280 (selftest::test_build_non_dependent_expr): New function.
4281 (selftest::cp_pt_c_tests): New function.
4282 * tree.c: Include "selftest.h".
4283 (lvalue_kind): Handle VIEW_CONVERT_EXPR location wrapper nodes.
4284 (selftest::test_lvalue_kind): New function.
4285 (selftest::cp_tree_c_tests): New function.
4286 * typeck.c (string_conv_p): Strip any location wrapper from "exp".
4287 (cp_build_binary_op): Replace comparison with null_node with call
4289 (build_address): Use location of operand when building address
4292 2018-01-10 Marek Polacek <polacek@redhat.com>
4295 * call.c (build_conditional_expr_1): Check complain before warning.
4296 * pt.c (tsubst_copy_and_build) <case COND_EXPR>: Suppress
4297 -Wduplicated-branches.
4299 2018-01-10 Jakub Jelinek <jakub@redhat.com>
4302 * call.c (maybe_warn_class_memaccess): Add forward declaration.
4303 Change last argument from tree * to const vec<tree, va_gc> *, adjust
4304 args uses and check number of operands too. Don't strip away any
4305 nops. Use maybe_constant_value when looking for INTEGER_CST args.
4306 Deal with src argument not having pointer type. Check
4307 tree_fits_uhwi_p before calling tree_to_uhwi. Remove useless
4309 (build_over_call): Call maybe_warn_class_memaccess here on the
4311 (build_cxx_call): Rather than here on converted arguments.
4313 2018-01-10 Paolo Carlini <paolo.carlini@oracle.com>
4316 * init.c (build_vec_init): Avoid building an INIT_EXPR with
4317 error_mark_node as second argument.
4319 2018-01-09 Jakub Jelinek <jakub@redhat.com>
4322 * constexpr.c (cxx_eval_statement_list): Ignore DEBUG_BEGIN_STMTs
4323 in STATEMENT_LIST. Remove unneeded assert.
4325 2018-01-03 Richard Sandiford <richard.sandiford@linaro.org>
4326 Alan Hayward <alan.hayward@arm.com>
4327 David Sherwood <david.sherwood@arm.com>
4329 * constexpr.c (cxx_eval_array_reference): Handle polynomial
4331 (cxx_fold_indirect_ref): Handle polynomial TYPE_VECTOR_SUBPARTS.
4332 * call.c (build_conditional_expr_1): Likewise.
4333 * decl.c (cp_finish_decomp): Likewise.
4334 * mangle.c (write_type): Likewise.
4335 * typeck.c (structural_comptypes): Likewise.
4336 (cp_build_binary_op): Likewise.
4337 * typeck2.c (process_init_constructor_array): Likewise.
4339 2018-01-03 Jakub Jelinek <jakub@redhat.com>
4342 * typeck.c (build_static_cast_1): For static casts to reference types,
4343 call build_base_path with flag_delete_null_pointer_checks as nonnull
4344 instead of always false. When -fsanitize=null, call
4345 ubsan_maybe_instrument_reference on the NULL reference INTEGER_CST.
4346 * cp-gimplify.c (cp_genericize_r): Don't walk subtrees of UBSAN_NULL
4347 call if the first argument is INTEGER_CST with REFERENCE_TYPE.
4349 2018-01-03 Nathan Sidwell <nathan@acm.org>
4352 * method.c (make_alias_for): Copy DECL_CONTEXT.
4354 2018-01-03 Marek Polacek <polacek@redhat.com>
4357 * decl.c (grokdeclarator): Don't warn about MVP in typename context.
4359 2018-01-03 Jakub Jelinek <jakub@redhat.com>
4361 PR preprocessor/83602
4362 * name-lookup.c (lookup_name_fuzzy): Don't use macro_use_before_def
4366 * cp-gimplify.c (cp_fold) <case NOP_EXPR>: If the operand folds to
4367 error_mark_node, return error_mark_node.
4369 Update copyright years.
4371 2018-01-02 Jakub Jelinek <jakub@redhat.com>
4374 * tree.c (replace_placeholders_r): Pass NULL as last argument to
4375 cp_walk_tree instead of d->pset. If non-TREE_CONSTANT and
4376 non-PLACEHOLDER_EXPR tree has been seen already, set *walk_subtrees
4377 to false and return.
4378 (replace_placeholders): Pass NULL instead of &pset as last argument
4381 2018-01-02 Nathan Sidwell <nathan@acm.org>
4383 * constexpr.c (cxx_bind_parameters_in_call): Remove unneeded local
4386 Copyright (C) 2018 Free Software Foundation, Inc.
4388 Copying and distribution of this file, with or without modification,
4389 are permitted in any medium without royalty provided the copyright
4390 notice and this notice are preserved.