Run selftests for C++ as well as C
[official-gcc.git] / gcc / cp / ChangeLog
blobc04dbe840057394c2789be0159dab0a7d277e724
1 2018-10-17  David Malcolm  <dmalcolm@redhat.com>
3         * Make-lang.in (selftest-c++): New.
4         (CPP_SELFTEST_FLAGS, CPP_SELFTEST_DEPS, s-selftest-c++)
5         (selftest-c++-gdb, selftest-c++-valgrind): Move here from
6         gcc/Makefile.in.
8 2018-10-17  Paolo Carlini  <paolo.carlini@oracle.com>
10         PR c++/84705
11         * tree.c (build_cplus_new): Avoid duplicate diagnostic about
12         incomplete type, early return error_mark_node if the second
13         argument is error_mark_node.
15 2018-10-12  Nathan Sidwell  <nathan@acm.org>
17         * parser.h (struct cp_parser): Drop implicit_extern_c.
18         * parser.c (cp_debug_parser): Drop implicit_extern_c.
19         (cp_parser_new): Likewise.
20         (cp_parser_translation_unit): Handle implicit extern c here.  Call
21         cp_parser_toplevel_declaration.
22         (cp_parser_toplevel_declaration): New, broken out of ...
23         (cp_parser_declaration_seq_opt): ... here.  Call it.  Drop
24         implicit extern C handling.
26 2018-10-11  Will Wray  <wjwray@gmail.com>
28         PR c++/87364
29         * cxx-pretty-print.c (pp_cxx_enumeration_constant): New function.
30         (cxx_pretty_printer::constant): Use it.
32 2018-10-11  David Malcolm  <dmalcolm@redhat.com>
34         PR c++/84993
35         * call.c (enforce_access): Move diagnostics to...
36         (complain_about_access): ...this new function.
37         * cp-tree.h (class access_failure_info): Rename split out field
38         "m_field_decl" into "m_decl" and "m_diag_decl".
39         (access_failure_info::record_access_failure): Add tree param.
40         (access_failure_info::was_inaccessible_p): New accessor.
41         (access_failure_info::get_decl): New accessor.
42         (access_failure_info::get_diag_decl): New accessor.
43         (access_failure_info::get_any_accessor): New member function.
44         (access_failure_info::add_fixit_hint): New static member function.
45         (complain_about_access): New decl.
46         * typeck.c (access_failure_info::record_access_failure): Update
47         for change to fields.
48         (access_failure_info::maybe_suggest_accessor): Split out into...
49         (access_failure_info::get_any_accessor): ...this new function...
50         (access_failure_info::add_fixit_hint): ...and this new function.
51         (finish_class_member_access_expr): Split out "has no member named"
52         error-handling into...
53         (complain_about_unrecognized_member): ...this new function, and
54         check that the guessed name is accessible along the access path.
55         Only provide a spell-correction fix-it hint if it is; otherwise,
56         attempt to issue an accessor fix-it hint.
58 2018-10-11  Nathan Sidwell  <nathan@acm.org>
60         * parser.c (cp_parser_translation_unit): Return void.  Don't fail
61         at first extra }, simplify logic.
62         (c_parse_file): Call finish_translation_unit here.
64 2018-10-11  Jakub Jelinek  <jakub@redhat.com>
66         PR c++/87582
67         * typeck.c (maybe_warn_about_returning_address_of_local): If
68         whats_returned is a structured binding identifier and the structured
69         binding is a reference, recurse on its initializer.
71         PR c++/87547
72         * rtti.c (get_tinfo_decl_dynamic): Use unlowered_expr_type instead
73         of TREE_TYPE.
75 2018-10-10  Marek Polacek  <polacek@redhat.com>
77         PR c++/87567 - constexpr rejects call to non-constexpr function.
78         * constexpr.c (potential_constant_expression_1) <case FOR_STMT>: Return
79         true if the condition is always false.
80         <case WHILE_STMT>: Likewise.
82 2018-10-09  Paolo Carlini  <paolo.carlini@oracle.com>
84         PR c++/84423
85         * pt.c (convert_template_argument): Immediately return error_mark_node
86         if the second argument is erroneous.
87         * parser.c (cp_parser_type_id): Add location_t * parameter.
88         (cp_parser_type_id_1): Likewise.
89         (cp_parser_alias_declaration): Adjust cp_parser_type_id call,
90         obtain the location of the type and save it.
91         (cp_parser_template_type_arg): Adjust.
92         (cp_parser_trailing_type_id): Likewise.
93         * decl.c (grokdeclarator): Improve error message for 'auto' in
94         alias declaration.
96 2018-10-08  Paolo Carlini  <paolo.carlini@oracle.com>
98         PR c++/71128
99         * pt.c (do_decl_instantiation): Per 12.6.8/5, a concept cannot be
100         explicitly instantiated.
102 2018-10-05  David Malcolm  <dmalcolm@redhat.com>
104         PR c++/56856
105         * call.c (build_over_call): Build a vec of locations of the
106         arguments before the call to maybe_constant_value, and pass to
107         check_function_arguments.
108         * cp-lang.c (LANG_HOOKS_GET_SUBSTRING_LOCATION): Define as
109         c_get_substring_location.
110         * parser.c (cp_parser_string_literal): Capture string
111         concatenation locations.
113 2018-10-04  Nathan Sidwell  <nathan@acm.org>
115         * lang-specs.h: Use string contatenation, not line splicing.
117 2018-10-03  Jason Merrill  <jason@redhat.com>
119         Implement P0840, language support for empty objects.
120         * tree.c (handle_no_unique_addr_attribute): New.
121         (cxx_attribute_table): Add [[no_unique_address]].
122         * class.c (field_poverlapping_p): New.
123         (layout_class_type): Check it.  Adjust DECL_SIZE of potentially
124         overlapping fields.
125         (layout_empty_base_or_field): Rename from layout_empty_base, handle
126         FIELD_DECL as well.
127         (build_base_field, record_subobject_offsets): Adjust.
129 2018-10-03  Martin Liska  <mliska@suse.cz>
131         PR gcov-profile/86109
132         * parser.c (cp_parser_lambda_declarator_opt):
133         Set DECL_LAMBDA_FUNCTION for lambdas.
135 2018-10-02  Richard Biener  <rguenther@suse.de>
137         * name-lookup.c (check_local_shadow): Do not test DECL_FROM_INLINE.
139 2018-09-28  Eric Botcazou  <ebotcazou@adacore.com>
140             Pierre-Marie de Rodat  <derodat@adacore.com>
142         * method.c (use_thunk): Adjust call to cgraph_node::create_thunk.
144 2018-09-28  Richard Biener  <rguenther@suse.de>
146         * error.c (cp_print_error_function): Simplify by eliding
147         the BLOCK_ABSTRACT_ORIGIN chasing.
149 2018-09-27  Paolo Carlini  <paolo.carlini@oracle.com>
151         PR c++/84940
152         * semantics.c (finish_unary_op_expr): Check return value of
153         build_x_unary_op for error_mark_node.
155 2018-09-25  Jakub Jelinek  <jakub@redhat.com>
157         PR c++/87398
158         * constexpr.c (cxx_eval_constant_expression) <case OBJ_TYPE_REF>: Only
159         look through COMPONENT_REFs with DECL_FIELD_IS_BASE FIELD_DECLs.
161 2018-09-25  Martin Liska  <mliska@suse.cz>
163         * name-lookup.c (namespace_scope_ht_size): Remove
164         unused function.
165         * parser.c (cp_lexer_next_token_is_not_keyword): Likewise.
167 2018-09-24  Paolo Carlini  <paolo.carlini@oracle.com>
169         PR c++/85070
170         * method.c (lazily_declare_fn): During error-recovery add_method
171         may return false.
173 2018-09-21  Marek Polacek  <polacek@redhat.com>
175         PR c++/87372 - __func__ constexpr evaluation.
176         * constexpr.c (maybe_constant_init_1): Pass false for strict down to
177         cxx_eval_outermost_constant_expr.
179 2018-09-20  Marek Polacek  <polacek@redhat.com>
181         PR c++/87109 - wrong ctor with maybe-rvalue semantics.
182         * call.c (build_user_type_conversion_1): Refine the maybe-rvalue
183         check to only return if we're converting the return value to a base
184         class.
186 2018-09-20  Allan Sandfeld Jensen  <allan.jensen@qt.io>
188         * g++spec.c (lang_specific_driver): Handle -r like -nostdlib.
190 2018-09-20  Jason Merrill  <jason@redhat.com>
192         PR c++/87075 - ICE with constexpr array initialization.
193         * constexpr.c (cxx_eval_vec_init_1): Handle trivial initialization.
195 2018-09-19  Marek Polacek  <polacek@redhat.com>
197         Add -Wclass-conversion.
198         * decl.c (grok_op_properties): Change a warning from -Wconversion to
199         -Wclass-conversion.  Make it print the types.
201 2018-09-19  Paolo Carlini  <paolo.carlini@oracle.com>
203         PR c++/87324
204         * parser.c (cp_parser_initializer_list): Assign error_mark_node
205         to the index upon error.
207 2018-09-19  Marek Polacek  <polacek@redhat.com>
209         PR c++/87357 - missing -Wconversion warning
210         * decl.c (grok_op_properties): Remove diagnostic parts mentioning
211         a conversion to a reference to void.  Use
212         same_type_ignoring_top_level_qualifiers_p rather than comparing types
213         directly.
215 2018-09-18  Marek Polacek  <polacek@redhat.com>
217         P1064R0 - Allowing Virtual Function Calls in Constant Expressions
218         * call.c (build_over_call): No longer check if we're outside a template
219         function.
220         * class.c (build_vtbl_initializer): Build vtable's constructor with
221         indexes.
222         * constexpr.c (cxx_eval_constant_expression): Don't ignore _vptr's
223         initializer.  Handle OBJ_TYPE_REF.
224         (potential_constant_expression_1): Handle OBJ_TYPE_REF.
225         * decl.c (maybe_commonize_var): Bail out for any DECL_ARTIFICIAL.
226         (initialize_artificial_var): Mark the variable as constexpr.
227         (grokdeclarator): Change error to pedwarn.  Only warn when
228         pedantic and not C++2a.
230 2018-09-18  Paolo Carlini  <paolo.carlini@oracle.com>
232         PR c++/85065
233         * cp-tree.h (NON_ERROR): New.
234         * pt.c (auto_hash::hash): Use it.
235         (do_auto_deduction): Likewise.
237 2018-09-18  Nathan Sidwell  <nathan@acm.org>
239         PR c++/86881
240         * name-lookup.c (check_local_shadow): Ignore auto types.
242 2018-09-17  David Malcolm  <dmalcolm@redhat.com>
244         * error.c (range_label_for_type_mismatch::get_text): Update for
245         new param.
247 2018-09-13  Bernd Edlinger  <bernd.edlinger@hotmail.de>
249         * typeck2.c (digest_init_r): Fix overlength strings.
251 2018-09-13  Ville Voutilainen  <ville.voutilainen@gmail.com>
253         PR c++/87093
254         * method.c (constructible_expr): We're in an unevaluated context
255         in all cases, not just for class targets.
257 2018-09-12  David Malcolm  <dmalcolm@redhat.com>
259         PR c++/85110
260         * call.c (struct conversion_info): Add "loc" field.
261         (arg_conversion_rejection): Add "loc" param, using it to
262         initialize the new field.
263         (bad_arg_conversion_rejection): Likewise.
264         (explicit_conversion_rejection): Initialize the new field to
265         UNKNOWN_LOCATION.
266         (template_conversion_rejection): Likewise.
267         (add_function_candidate): Pass on the argument location to the new
268         param of arg_conversion_rejection.
269         (add_conv_candidate): Likewise.
270         (build_builtin_candidate): Likewise.
271         (build_user_type_conversion_1): Likewise.
272         (single_z_candidate): New function.
273         (maybe_get_bad_conversion_for_unmatched_call): New function.
274         (complain_about_bad_argument): New function, based on part of
275         convert_for_assignment.
276         (build_new_method_call_1): Split out handling of the "no viable
277         candidates" case into...
278         (complain_about_no_candidates_for_method_call): ...this new
279         function, and use the new functions above to special-case the
280         handling of a single non-viable candidate due to a bad argument.
281         * cp-tree.h (complain_about_bad_argument): New decl.
282         * typeck.c (convert_for_assignment): Split out one error-handling
283         case into complain_about_bad_argument.
285 2018-09-09  Cesar Philippidis  <cesar@codesourcery.com>
286             Julian Brown  <julian@codesourcery.com>
288         PR middle-end/86336
289         * semantics.c (finish_omp_clauses): Treat C++ references the same in
290         OpenACC as OpenMP.
292 2018-08-28  Martin Liska  <mliska@suse.cz>
294         * constexpr.c (cxx_eval_call_expression): Add quotes
295         to -fconstexpr-depth=.
297 2018-09-10  Marek Polacek  <polacek@redhat.com>
299         * class.c (build_vtbl_ref): Remove.
300         (build_vtbl_ref_1): Rename to build_vtbl_ref.
301         (build_vfn_ref): Call build_vtbl_ref instead of build_vtbl_ref_1.
303 2018-09-08  Marek Polacek  <polacek@redhat.com>
305         PR c++/87150 - wrong ctor with maybe-rvalue semantics.
306         * call.c (struct conversion): Update commentary.
307         (standard_conversion): Set rvaluedness_matches_p if LOOKUP_PREFER_RVALUE
308         for ck_base.
310 2018-09-08  Jason Merrill  <jason@redhat.com>
312         PR c++/86678 - constexpr function with non-constant after return.
313         * constexpr.c (potential_constant_expression_1): Add jump_target.
314         (breaks): Check for BREAK_STMT.
315         (continues): Check for CONTINUE_STMT.
317 2018-09-08  Marek Polacek  <polacek@redhat.com>
319         * cxx-pretty-print.c (cxx_pretty_printer::statement) <case
320         RANGE_FOR_SMT>: Handle RANGE_FOR_INIT_STMT.
322 2018-09-07  Marek Polacek  <polacek@redhat.com>
324         PR c++/87152 - range-based for loops with initializer broken in templates.
325         * constexpr.c (potential_constant_expression_1) <case RANGE_FOR_STMT>:
326         Recur into RANGE_FOR_INIT_STMT.
327         * cp-tree.def: Add RANGE_FOR_INIT_STMT to RANGE_FOR_STMT.
328         * cp-tree.h (RANGE_FOR_INIT_STMT): Define.
329         * dump.c (cp_dump_tree) <case RANGE_FOR_STMT>: Also dump
330         RANGE_FOR_INIT_STMT.
331         * pt.c (tsubst_expr) <case RANGE_FOR_STMT>: Recur into
332         RANGE_FOR_INIT_STMT.
333         * semantics.c (begin_range_for_stmt): Adjust call to build_stmt.
334         Do put the init statement in RANGE_FOR_INIT_STMT.
335         (finish_range_for_decl): Pop it for templates.
337 2018-09-06  Bernd Edlinger  <bernd.edlinger@hotmail.de>
339         * decl.c (check_initializer): Call cp_complete_array_type.
341 2018-09-05  Marek Polacek  <polacek@redhat.com>
343         PR c++/87109, wrong overload with ref-qualifiers.
344         * call.c (build_user_type_conversion_1): Use NULL instead of 0.  Bail
345         out if performing the maybe-rvalue overload resolution and a conversion
346         function is getting called.
348         PR c++/86982, -Wreturn-local-addr and std::move and std::forward.
349         * typeck.c (maybe_warn_about_returning_address_of_local): Handle calls
350         to std::move or std::forward.
351         (is_std_forward_p): New function.
353 2018-09-05  Pádraig Brady  <p@draigbrady.com>
355         PR c++/87185
356         * lambda.c (prune_lambda_captures): Protect against const_vars.get
357         returning NULL.
359 2018-09-04  Marek Polacek  <polacek@redhat.com>
361         * cp-tree.h (treat_lvalue_as_rvalue_p): Declare.
362         * except.c (build_throw): Use it.  Use CP_TYPE_VOLATILE_P.
363         * typeck.c (treat_lvalue_as_rvalue_p): No longer static.  Add PARM_OK
364         parameter.
365         (maybe_warn_pessimizing_move): Adjust treat_lvalue_as_rvalue_p call.
366         (check_return_expr): Likewise.
368 2018-09-03  Paolo Carlini  <paolo.carlini@oracle.com>
370         PR c++/84980
371         * constraint.cc (finish_shorthand_constraint): Early return if the
372         constraint is erroneous.
374 2018-09-02  Bernd Edlinger  <bernd.edlinger@hotmail.de>
376         * decl.c (eval_check_narrowing): Remove.
377         (check_initializer): Move call to braced_list_to_string from here ...
378         * typeck2.c (store_init_value): ... to here.
379         (digest_init_r): Remove handing of signed/unsigned char strings.
381 2018-08-31  Nathan Sidwell  <nathan@acm.org>
383         PR c++/87155
384         PR c++/84707
385         * name-lookup.c (name_lookup::search_namespace): Don't look at
386         inlines when searching for NULL names.
388         * decl.c (decls_match): Remove SYSTEM_IMPLICIT_EXTERN_C matching
389         of return types and parms.
390         * parser.c (cp_parser_parameter_declaration_clause): Likewise,
391         '()' always means '(void)'.
393 2018-08-29  Jakub Jelinek  <jakub@redhat.com>
395         PR c++/87095
396         * decl.c (begin_destructor_body): If current_class_type has
397         virtual bases and the primary base is nearly empty virtual base,
398         voidify clearing of vptr and make it conditional on in-charge
399         argument.
401 2018-08-29  Paolo Carlini  <paolo.carlini@oracle.com>
403         PR c++/85265
404         * parser.c (cp_parser_introduction_list): If cp_parser_identifier
405         returns error_mark_node early exit the loop.
406         (cp_parser_template_introduction): Improve error-recovery, remove
407         error call about empty introduction-list.
409 2018-08-29  David Malcolm  <dmalcolm@redhat.com>
411         PR c++/85110
412         * call.c (print_conversion_rejection): Add "fn" param and use it
413         for "no known conversion" messages to underline the pertinent
414         param.
415         (print_z_candidate): Supply "fn" to the new param above.
417 2018-08-29  Jakub Jelinek  <jakub@redhat.com>
419         PR c++/87122
420         * pt.c (tsubst_expr) <case RANGE_FOR_STMT>: If
421         processing_template_decl and decl is structured binding decl, call
422         cp_finish_decomp.
424 2018-08-28  Paolo Carlini  <paolo.carlini@oracle.com>
426         PR c++/86546
427         * decl.c (finish_case_label): If the type is erroneous early
428         return error_mark_node.
430 2018-08-27  David Malcolm  <dmalcolm@redhat.com>
432         PR c++/63392
433         * parser.c (cp_parser_diagnose_invalid_type_name): Add fix-it
434         hint.
436 2018-08-27  Jakub Jelinek  <jakub@redhat.com>
438         PR c++/86993
439         * cp-tree.h (cxx_readonly_error): Add location_t argument.
440         * typeck2.c (cxx_readonly_error): Add LOC argument, pass it to
441         ERROR_FOR_ASSIGNMENT macro and readonly_error.  Add LOC argument
442         to ERROR_FOR_ASSIGNMENT macro, use error_at instead of error and
443         pass LOC to it.  Formatting fixes.
444         * typeck.c (cp_build_unary_op): Pass location to cxx_readonly_error.
445         (cp_build_modify_expr): Pass loc to cxx_readonly_error.
446         * semantics.c (finish_asm_stmt): Pass input_location to
447         cxx_readonly_error.
449 2018-08-27  David Malcolm  <dmalcolm@redhat.com>
451         PR c++/87091
452         * decl.c (grokdeclarator): Update for conversion of show_caret_p
453         to a tri-state.
454         * error.c (cp_printer): Likewise.
455         * name-lookup.c (maybe_suggest_missing_std_header): Update call to
456         maybe_add_include_fixit to suggest overriding the location, as it
457         is for a note.
458         * parser.c (cp_parser_string_literal): Update for conversion of
459         show_caret_p to a tri-state.
460         (cp_parser_elaborated_type_specifier): Likewise.
461         (set_and_check_decl_spec_loc): Likewise.
462         * pt.c (listify): Update call to maybe_add_include_fixit to not
463         override the location, as it is for an error.
464         * rtti.c (typeid_ok_p): Likewise.
466 2018-08-27  Martin Liska  <mliska@suse.cz>
468         * call.c (build_call_a): Use new function
469         fndecl_built_in_p and remove check for FUNCTION_DECL if
470         possible.
471         (build_cxx_call): Likewise.
472         * constexpr.c (constexpr_fn_retval): Likewise.
473         (cxx_eval_builtin_function_call): Likewise.
474         (cxx_eval_call_expression): Likewise.
475         (potential_constant_expression_1): Likewise.
476         * cp-gimplify.c (cp_gimplify_expr): Likewise.
477         (cp_fold): Likewise.
478         * decl.c (decls_match): Likewise.
479         (validate_constexpr_redeclaration): Likewise.
480         (duplicate_decls): Likewise.
481         (make_rtl_for_nonlocal_decl): Likewise.
482         * name-lookup.c (consider_binding_level): Likewise.
483         (cp_emit_debug_info_for_using): Likewise.
484         * semantics.c (finish_call_expr): Likewise.
485         * tree.c (builtin_valid_in_constant_expr_p): Likewise.
487 2018-08-26  Marek Polacek  <polacek@redhat.com>
489         PR c++/87080
490         * typeck.c (maybe_warn_pessimizing_move): Do nothing in a template.
492         PR c++/87029, Implement -Wredundant-move.
493         * typeck.c (treat_lvalue_as_rvalue_p): New function.
494         (maybe_warn_pessimizing_move): Call convert_from_reference.
495         Warn about redundant moves.
497 2018-08-24  Marek Polacek  <polacek@redhat.com>
499         PR c++/67012
500         PR c++/86942
501         * decl.c (grokdeclarator): Disallow functions with trailing return
502         type with decltype(auto) as its type.  Also check the function if
503         it's inner declarator doesn't exist
505 2018-08-21  Marek Polacek  <polacek@redhat.com>
507         PR c++/86499
508         * parser.c (cp_parser_lambda_introducer): Give error if a non-local
509         lambda has a capture-default.
511 2018-08-21  Paolo Carlini  <paolo.carlini@oracle.com>
513         * decl.c (check_static_variable_definition): Change to return void.
515 2018-08-21  Marek Polacek  <polacek@redhat.com>
517         PR c++/86981, Implement -Wpessimizing-move.
518         * typeck.c (decl_in_std_namespace_p): New.
519         (is_std_move_p): New.
520         (maybe_warn_pessimizing_move): New.
521         (can_do_nrvo_p): New, factored out of ...
522         (check_return_expr): ... here.  Warn about potentially harmful
523         std::move in a return statement.
525         PR c++/65043
526         * call.c (standard_conversion): Set check_narrowing.
527         * typeck2.c (check_narrowing): Use CP_INTEGRAL_TYPE_P rather
528         than comparing with INTEGER_TYPE.
530         * cp-tree.h: Fix typo.
532 2018-08-20  David Malcolm  <dmalcolm@redhat.com>
534         PR other/84889
535         * call.c (build_user_type_conversion_1): Add auto_diagnostic_group
536         instance(s).
537         (print_error_for_call_failure): Likewise.
538         (build_op_call_1): Likewise.
539         (build_conditional_expr_1): Likewise.
540         (build_new_op_1): Likewise.
541         (build_op_delete_call): Likewise.
542         (convert_like_real): Likewise.
543         (build_over_call): Likewise.
544         (build_new_method_call_1): Likewise.
545         (joust): Likewise.
546         * class.c (check_tag): Likewise.
547         (finish_struct_anon_r): Likewise.
548         (one_inherited_ctor): Likewise.
549         (finalize_literal_type_property): Likewise.
550         (explain_non_literal_class): Likewise.
551         (find_flexarrays): Likewise.
552         (resolve_address_of_overloaded_function): Likewise.
553         * constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
554         (is_valid_constexpr_fn): Likewise.
555         (cx_check_missing_mem_inits): Likewise.
556         * cp-gimplify.c (cp_genericize_r): Likewise.
557         * cvt.c (maybe_warn_nodiscard): Likewise.
558         * decl.c (warn_extern_redeclared_static): Likewise.
559         (check_redeclaration_exception_specification): Likewise.
560         (check_no_redeclaration_friend_default_args): Likewise.
561         (duplicate_decls): Likewise.
562         (redeclaration_error_message): Likewise.
563         (warn_misplaced_attr_for_class_type): Likewise.
564         * decl2.c (finish_static_data_member_decl): Likewise.
565         (no_linkage_error): Likewise.
566         (cp_warn_deprecated_use): Likewise.
567         * error.c (qualified_name_lookup_error): Likewise.
568         * friend.c (make_friend_class): Likewise.
569         (do_friend): Likewise.
570         * init.c (perform_member_init): Likewise.
571         (build_new_1): Likewise.
572         (build_vec_delete_1): Likewise.
573         (build_delete): Likewise.
574         * lex.c (unqualified_name_lookup_error): Likewise.
575         * name-lookup.c (check_extern_c_conflict): Likewise.
576         (inform_shadowed): New function.
577         (check_local_shadow): Add auto_diagnostic_group instances,
578         replacing goto "inform_shadowed" label with call to subroutine.
579         (set_local_extern_decl_linkage): Add auto_diagnostic_group
580         instance(s).
581         * parser.c (cp_parser_diagnose_invalid_type_name): Likewise.
582         (cp_parser_namespace_name): Likewise.
583         * pt.c (check_specialization_namespace): Likewise.
584         (check_template_variable): Likewise.
585         (warn_spec_missing_attributes): Likewise.
586         (check_explicit_specialization): Likewise.
587         (process_partial_specialization): Likewise.
588         (lookup_template_class_1): Likewise.
589         (finish_template_variable): Likewise.
590         (do_auto_deduction): Likewise.
591         * search.c (check_final_overrider): Likewise.
592         (look_for_overrides_r): Likewise.
593         * tree.c (maybe_warn_parm_abi): Likewise.
594         * typeck.c (cxx_sizeof_expr): Likewise.
595         (cp_build_function_call_vec): Likewise.
596         (cp_build_binary_op): Likewise.
597         (convert_for_assignment): Likewise.
598         (maybe_warn_about_returning_address_of_local): Likewise.
599         * typeck2.c (abstract_virtuals_error_sfinae): Likewise.
600         (check_narrowing): Likewise.
602 2018-08-17  David Malcolm  <dmalcolm@redhat.com>
604         * typeck.c (string_conv_p): Extract location from EXP and use it
605         in preference to input_location when issuing warnings.
607 2018-08-15  David Malcolm  <dmalcolm@redhat.com>
609         * call.c: Include "gcc-rich-location.h".
610         (convert_like_real): Add range label for "invalid conversion"
611         diagnostic.
612         (perform_implicit_conversion_flags): Add type label to the
613         "could not convert" error.
614         * error.c: Include "gcc-rich-location.h".
615         (range_label_for_type_mismatch::get_text): New function.
616         * typeck.c (convert_for_assignment): Add type label to
617         the "cannot convert" error if a location is available.
619 2018-08-15  Paolo Carlini  <paolo.carlini@oracle.com>
621         * decl.c (check_previous_goto_1): When decl_jump_unsafe returns 2
622         emit an error instead of a permerror.
624 2018-08-13  Marek Polacek  <polacek@redhat.com>
626         PR c++/57891
627         * call.c (struct conversion): Add check_narrowing_const_only.
628         (build_converted_constant_expr): Set check_narrowing and
629         check_narrowing_const_only.  Give error if expr is error node.
630         (convert_like_real): Pass it to check_narrowing.
631         * cp-tree.h (check_narrowing): Add a default parameter.
632         * decl.c (compute_array_index_type): Use input_location instead of
633         location_of.
634         * pt.c (convert_nontype_argument): Return NULL_TREE if tf_error.
635         * typeck2.c (check_narrowing): Don't warn for instantiation-dependent
636         expressions.  Call maybe_constant_value instead of
637         fold_non_dependent_expr.  Don't mention { } in diagnostic.  Only check
638         narrowing for constants if CONST_ONLY.
640 2018-08-13  Martin Sebor  <msebor@redhat.com>
642         PR tree-optimization/71625
643         * decl.c (check_initializer):  Call braced_list_to_string.
644         (eval_check_narrowing): New function.
645         * gcc/cp/typeck2.c (digest_init_r): Accept strings literals
646         as initilizers for all narrow character types.
648 2018-08-13  Marek Polacek  <polacek@redhat.com>
650         P0806R2 - Deprecate implicit capture of this via [=]
651         * lambda.c (add_default_capture): Formatting fixes.  Warn about
652         deprecated implicit capture of this via [=].
654         PR c++/86915
655         * decl.c (create_array_type_for_decl): Handle null name.
657 2018-08-10  Jason Merrill  <jason@redhat.com>
659         PR c++/86728 - C variadic generic lambda.
660         * parser.c (cp_parser_parameter_declaration): Don't turn 'auto' into
661         a pack if it's followed by a declarator-id.
663 2018-08-08  Jakub Jelinek  <jakub@redhat.com>
665         P0595R1 - is_constant_evaluated
666         * cp-tree.h (enum cp_built_in_function): New.
667         (maybe_constant_init): Add pretend_const_required argument.
668         * typeck2.c (store_init_value): Pass true as new argument to
669         maybe_constant_init.
670         * constexpr.c (constexpr_fn_retval): Check also DECL_BUILT_IN_CLASS
671         for BUILT_IN_UNREACHABLE.
672         (struct constexpr_ctx): Add pretend_const_required field.
673         (cxx_eval_builtin_function_call): Use DECL_IS_BUILTIN_CONSTANT_P
674         macro.  Handle CP_BUILT_IN_IS_CONSTANT_EVALUATED.  Check also
675         DECL_BUILT_IN_CLASS for BUILT_IN_UNREACHABLE.
676         (cxx_eval_outermost_constant_expr): Add pretend_const_required
677         argument, initialize pretend_const_required field in ctx.  If the
678         result is TREE_CONSTANT and non_constant_p, retry with
679         pretend_const_required false if it was true.
680         (is_sub_constant_expr): Initialize pretend_const_required_field in
681         ctx.
682         (cxx_constant_value): Pass true as pretend_const_required to
683         cxx_eval_outermost_constant_expr.
684         (maybe_constant_value): Pass false as pretend_const_required to
685         cxx_eval_outermost_constant_expr.
686         (fold_non_dependent_expr): Likewise.
687         (maybe_constant_init_1): Add pretend_const_required argument, pass it
688         down to cxx_eval_outermost_constant_expr.  Pass !allow_non_constant
689         instead of false as strict to cxx_eval_outermost_constant_expr.
690         (maybe_constant_init): Add pretend_const_required argument, pass it
691         down to maybe_constant_init_1.
692         (cxx_constant_init): Pass true as pretend_const_required to
693         maybe_constant_init_1.
694         * cp-gimplify.c (cp_gimplify_expr): Handle CALL_EXPRs to
695         CP_BUILT_IN_IS_CONSTANT_EVALUATED.
696         (cp_fold): Don't fold CP_BUILT_IN_IS_CONSTANT_EVALUATED calls.
697         * decl.c: Include langhooks.h.
698         (cxx_init_decl_processing): Register __builtin_is_constant_evaluated
699         built-in.
700         * tree.c (builtin_valid_in_constant_expr_p): Return true for
701         CP_BUILT_IN_IS_CONSTANT_EVALUATED.
702         * pt.c (declare_integer_pack): Initialize DECL_FUNCTION_CODE.
704         PR c++/86836
705         * pt.c (tsubst_expr): For structured bindings, call tsubst_decomp_names
706         before tsubst_init, not after it.
708         PR c++/86738
709         * constexpr.c (cxx_eval_binary_expression): For arithmetics involving
710         NULL pointer set *non_constant_p to true.
711         (cxx_eval_component_reference): For dereferencing of a NULL pointer,
712         set *non_constant_p to true and return t.
714 2018-08-07  Paolo Carlini  <paolo.carlini@oracle.com>
716         PR c++/59480, DR 136
717         * decl.c (check_no_redeclaration_friend_default_args): New.
718         (duplicate_decls): Use the latter; also check that a friend
719         declaration specifying default arguments is a definition.
721 2018-08-07  Ville Voutilainen  <ville.voutilainen@gmail.com>
723         PR c++/79133
724         * name-lookup.c (check_local_shadow): Reject captures and parameters
725         with the same name.
727 2018-08-06  Marek Polacek  <polacek@redhat.com>
729         PR c++/86767
730         * constexpr.c (cxx_eval_statement_list): Handle continue.
732 2018-08-03  David Malcolm  <dmalcolm@redhat.com>
733             Jonathan Wakely  <jwakely@redhat.com>
735         * decl.c: Include "gcc-rich-location.h".
736         (add_return_star_this_fixit): New function.
737         (finish_function): When warning about missing return statements in
738         functions returning non-void, add a "return *this;" fix-it hint for
739         assignment operators.
741 2018-08-03  Jason Merrill  <jason@redhat.com>
743         PR c++/86706
744         * class.c (build_base_path): Use currently_open_class.
746 2018-08-02  David Malcolm  <dmalcolm@redhat.com>
748         * error.c (cxx_print_error_function): Duplicate "file" before
749         passing it to pp_set_prefix.
750         (cp_print_error_function): Use pp_take_prefix when saving the
751         existing prefix.
753 2018-08-02  Richard Biener  <rguenther@suse.de>
755         PR c++/86763
756         * class.c (layout_class_type): Copy TYPE_TYPELESS_STORAGE
757         to the CLASSTYPE_AS_BASE.
759 2018-08-01  Martin Sebor  <msebor@redhat.com>
761         PR tree-optimization/86650
762         * error.c (cp_printer): Move usage of EXPR_LOCATION (t) and
763         TREE_BLOCK (t) from within percent_K_format to this callsite.
765 2018-08-01  Paolo Carlini  <paolo.carlini@oracle.com>
767         PR c++/86661
768         * class.c (note_name_declared_in_class): Use location_of in permerror
769         instead of DECL_SOURCE_LOCATION (for OVERLOADs).
771 2018-07-31  Tom de Vries  <tdevries@suse.de>
773         PR debug/86687
774         * optimize.c (update_cloned_parm): Copy DECL_BY_REFERENCE.
776 2018-07-31  Jakub Jelinek  <jakub@redhat.com>
778         P1008R1 - prohibit aggregates with user-declared constructors
779         * class.c (check_bases_and_members): For C++2a set
780         CLASSTYPE_NON_AGGREGATE based on TYPE_HAS_USER_CONSTRUCTOR rather than
781         type_has_user_provided_or_explicit_constructor.
783 2018-07-31  Martin Liska  <mliska@suse.cz>
785         PR c++/86653
786         * parser.c (cp_parser_condition): Initialize non_constant_p
787         to false.
789 2018-07-28  David Malcolm  <dmalcolm@redhat.com>
791         * error.c (cp_printer): In the leading comment, move "%H" and "%I"
792         into alphabetical order, and add missing "%G" and "%K".  Within
793         the switch statement, move cases 'G', 'H', 'I' and 'K' so that the
794         cases are in alphabetical order.
796 2018-07-25  Jakub Jelinek  <jakub@redhat.com>
798         * cp-tree.h (enum cp_tree_index): Add
799         CPTI_{ABI_TAG,ALIGNED,BEGIN,END,GET,TUPLE_{ELEMENT,SIZE}}_IDENTIFIER
800         and CPTI_{GNU,TYPE,VALUE,FUN,CLOSURE}_IDENTIFIER.
801         (abi_tag_identifier, aligned_identifier, begin_identifier,
802         end_identifier, get__identifier, gnu_identifier,
803         tuple_element_identifier, tuple_size_identifier, type_identifier,
804         value_identifier, fun_identifier, closure_identifier): Define.
805         * decl.c (initialize_predefined_identifiers): Initialize the above
806         identifiers.
807         (get_tuple_size): Use tuple_size_identifier instead of
808         get_identifier ("tuple_size") and value_identifier instead of
809         get_identifier ("value").
810         (get_tuple_element_type): Use tuple_element_identifier instead of
811         get_identifier ("tuple_element") and type_identifier instead of
812         get_identifier ("type").
813         (get_tuple_decomp_init): Use get__identifier instead of
814         get_identifier ("get").
815         * lambda.c (maybe_add_lambda_conv_op): Use fun_identifier instead of
816         get_identifier ("_FUN").
817         * parser.c (cp_parser_lambda_declarator_opt): Use closure_identifier
818         instead of get_identifier ("__closure").
819         (cp_parser_std_attribute): Use gnu_identifier instead of
820         get_identifier ("gnu").
821         (cp_parser_std_attribute_spec): Likewise.  Use aligned_identifier
822         instead of get_identifier ("aligned").
823         * class.c (check_abi_tags, inherit_targ_abi_tags): Use
824         abi_tag_identifier instead of get_identifier ("abi_tag").
826         PR c++/85515
827         * cp-tree.h (enum cp_tree_index): Add
828         CPTI_FOR_{RANGE,BEGIN,END}{,_}_IDENTIFIER.
829         (for_range__identifier, for_begin__identifier, for_end__identifier,
830         for_range_identifier, for_begin_identifier, for_end_identifier):
831         Define.
832         * decl.c (initialize_predefined_identifiers): Initialize
833         for_{range,begin,end}{,_}_identifier.
834         * parser.c (build_range_temp): Use for_range__identifier instead of
835         get_identifier ("__for_range").
836         (cp_convert_range_for): Use for_begin__identifier and
837         for_end__identifier instead of get_identifier ("__for_begin") and
838         get_identifier ("__for_end").
839         * semantics.c (finish_for_stmt): Rename "__for_{range,begin,end} "
840         local symbols to "__for_{range,begin,end}".
842 2018-07-23  Jakub Jelinek  <jakub@redhat.com>
844         PR c++/86569
845         * cp-gimplify.c (cp_fold): Don't fold comparisons into other kind
846         of expressions other than INTEGER_CST regardless of TREE_NO_WARNING
847         or warn_nonnull_compare.
849 2018-07-19  Paolo Carlini  <paolo.carlini@oracle.com>
851         Revert fix for c++/59480 (and testsuite followup)
853         2019-07-18  Paolo Carlini  <paolo.carlini@oracle.com>
855         PR c++/59480, DR 136
856         * decl.c (check_no_redeclaration_friend_default_args): New.
857         (duplicate_decls): Use the latter; also check that a friend
858         declaration specifying default arguments is a definition.
860 2018-07-18  Jakub Jelinek  <jakub@redhat.com>
862         PR c++/86550
863         * parser.c (cp_parser_decl_specifier_seq): Diagnose invalid type
864         specifier if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR.
866 2018-07-18  Marek Polacek  <polacek@redhat.com>
868         PR c++/86190 - bogus -Wsign-conversion warning
869         * typeck.c (cp_build_binary_op): Fix formatting.  Add a warning
870         sentinel.
872 2018-07-18  Paolo Carlini  <paolo.carlini@oracle.com>
874         PR c++/59480, DR 136
875         * decl.c (check_no_redeclaration_friend_default_args): New.
876         (duplicate_decls): Use the latter; also check that a friend
877         declaration specifying default arguments is a definition.
879 2018-07-18  Paolo Carlini  <paolo.carlini@oracle.com>
881         * class.c (note_name_declared_in_class): Prefer permerror + inform
882         to a pair of permerrors; use DECL_SOURCE_LOCATION.
884 2018-07-18  Richard Biener  <rguenther@suse.de>
886         PR debug/86523
887         * decl2.c (c_parse_final_cleanups): Call write_out_vars before
888         start_static_storage_duration_function sets current_function_decl.
890 2018-07-17  Jason Merrill  <jason@redhat.com>
892         PR c++/86480 - nested variadic lambda and constexpr if.
893         * pt.c (find_parameter_packs_r) [IF_STMT]: Don't walk into
894         IF_STMT_EXTRA_ARGS.
895         * tree.c (cp_walk_subtrees) [DECLTYPE_TYPE]: Set
896         cp_unevaluated_operand.
897         [ALIGNOF_EXPR] [SIZEOF_EXPR] [NOEXCEPT_EXPR]: Likewise.
899 2018-07-16  Paolo Carlini  <paolo.carlini@oracle.com>
901         * class.c (resolve_address_of_overloaded_function): Don't emit an
902         inform if the matching permerror returns false.
903         * pt.c (check_specialization_namespace): Likewise.
905 2018-07-16  Jakub Jelinek  <jakub@redhat.com>
907         PR c++/3698
908         PR c++/86208
909         * cp-gimplify.c (cp_genericize_r): When using extern_decl_map, or
910         in TREE_USED flag from stmt to h->to.
912 2018-07-13  Nathan Sidwell  <nathan@acm.org>
914         PR c++/86374
915         * pt.c (lookup_template_class_1): Use tsubst_aggr_type for
916         contexts that are classes.
917         * parser.c (cp_parser_template_id): Combine entering_scope decl &
918         initializer.
920 2018-07-12  Jakub Jelinek  <jakub@redhat.com>
922         * decl2.c (cplus_decl_attributes): Don't diagnose vars without mappable
923         type here, instead add "omp declare target implicit" attribute.  Add
924         that attribute instead of "omp declare target" also when
925         processing_template_decl.
926         * decl.c (cp_finish_decl): Diagnose vars without mappable type here,
927         and before calling cp_omp_mappable_type call complete_type.
929 2018-07-10  Jakub Jelinek  <jakub@redhat.com>
931         PR sanitizer/86406
932         * cp-gimplify.c (cp_maybe_instrument_return): Skip trailing
933         DEBUG_BEGIN_STMTs.
935         PR c++/86443
936         * semantics.c (handle_omp_for_class_iterator): Remove lastp argument,
937         instead of setting *lastp turn orig_declv elt into a TREE_LIST.
938         (finish_omp_for): Adjust handle_omp_for_class_iterator caller.
939         * pt.c (tsubst_omp_for_iterator): Allow OMP_FOR_ORIG_DECLS to contain
940         TREE_LIST for both the original class iterator and the "last" helper
941         var.
943 2018-07-09  Paolo Carlini  <paolo.carlini@oracle.com>
945         * decl.c (grokdeclarator): Use rich_location::add_range in three
946         more places; include gcc-rich-location.h.
948 2018-07-07  Aldy Hernandez  <aldyh@redhat.com>
950         * decl.c (build_enumerator): Change overflow type to overflow_type.
951         * init.c (build_new_1): Same.
953 2018-07-05  Nathan Sidwell  <nathan@acm.org>
955         * cp/decl.c (decls_match): Check SYSTEM_IMPLICIT_EXTERN_C not
956         NO_IMPLICIT_EXTERN_C.
957         * cp/parser.c (cp_parser_parameter_declaration_clause): Likewise.
959 2018-07-04  Ville Voutilainen  <ville.voutilainen@gmail.com>
961         PR c++/86398
962         * method.c (is_trivially_xible): Return false
963         if is_xible_helper returns a NULL_TREE.
965 2018-07-03  Paolo Carlini  <paolo.carlini@oracle.com>
967         * decl.c (min_location): New.
968         (smallest_type_quals_location): Use the latter.
969         (check_concept_fn): Use DECL_SOURCE_LOCATION.
970         (grokdeclarator): Use accurate locations in a number of error
971         messages involving ds_thread, ds_storage_class, ds_virtual,
972         ds_constexpr, ds_typedef and ds_friend; exploit min_location.
974 2018-07-03  Marek Polacek  <polacek@redhat.com>
976         PR c++/86201
977         * typeck.c (cp_build_binary_op): Check c_inhibit_evaluation_warnings.
979 2018-07-03  Jason Merrill  <jason@redhat.com>
981         PR c++/86378 - functional cast in noexcept-specifier.
982         * tree.c (strip_typedefs_expr) [TREE_LIST]: Fix iteration.
984 2018-07-02  Paolo Carlini  <paolo.carlini@oracle.com>
986         * parser.c (set_and_check_decl_spec_loc): Use rich_location::add_range
987         in error message about __thread and thread_local at the same time.
989 2018-06-29  Marek Polacek  <polacek@redhat.com>
991         PR c++/86184
992         * tree.c (cp_save_expr): Don't call save_expr for TARGET_EXPRs.
994 2018-06-28  David Malcolm  <dmalcolm@redhat.com>
996         * parser.c (cp_parser_error_1): After issuing a conflict marker
997         error, consume tokens until the end of the source line.
999 2018-06-28  Jason Merrill  <jason@redhat.com>
1001         PR c++/86342 - -Wdeprecated-copy and system headers.
1002         * decl2.c (cp_warn_deprecated_use): Don't warn about declarations
1003         in system headers.
1005 2018-06-27  David Malcolm  <dmalcolm@redhat.com>
1007         PR c++/86329
1008         * name-lookup.c (consider_binding_level): Filter out names that
1009         match anon_aggrname_p.
1011 2018-06-27  Jason Merrill  <jason@redhat.com>
1013         * name-lookup.c (do_pushtag): If we skip a class level, also skip
1014         its template level.
1016 2018-06-26  Jason Merrill  <jason@redhat.com>
1018         PR c++/86320 - memory-hog with std::array of pair
1019         * typeck2.c (process_init_constructor_array): Only compute a
1020         constant initializer once.
1022         PR c++/80290 - memory-hog with std::pair.
1023         * pt.c (fn_type_unification): Add convs parameter.
1024         (check_non_deducible_conversion): Remember conversion.
1025         (check_non_deducible_conversions): New.  Do checks here.
1026         (type_unification_real): Not here.  Remove flags parm.
1027         * call.c (add_function_candidate): Make convs a parameter.
1028         Don't recalculate the conversion if it's already set.
1029         (add_template_candidate_real): Allocate convs here.
1030         (good_conversion, conv_flags): New.
1032 2018-06-26  Jakub Jelinek  <jakub@redhat.com>
1034         PR c++/86291
1035         * parser.c (cp_parser_omp_for_loop_init): Change for_block argument
1036         type from vec<tree, va_gc> * to vec<tree, va_gc> *&.
1038 2018-06-23  Paolo Carlini  <paolo.carlini@oracle.com>
1040         * decl.c (bad_specifiers): Add const location_t* parameter and
1041         use locations in error messages about 'inline' and 'virtual'.
1042         (mark_inline_variable): Add location_t parameter and use it in
1043         error_at and pedwarn messages.
1044         (grokdeclarator): Use declspecs->locations[ds_constexpr],
1045         declspecs->locations[ds_concept], declspecs->locations[ds_virtual],
1046         declspecs->locations[ds_inline] in many error messages; adjust
1047         bad_specifiers and mark_inline_variable calls.
1048         (grokvardecl): Use declspecs->locations[ds_concept] in error message.
1050 2018-06-22  Jason Merrill  <jason@redhat.com>
1052         PR c++/86219 - ICE with erroneous initializer in template.
1053         * constexpr.c (fold_non_dependent_expr): Add complain parm.
1054         * call.c, expr.c, init.c, pt.c, semantics.c, typeck.c, typeck2.c:
1055         Pass it.
1056         * call.c (build_cxx_call): Don't mess with builtins in a template.
1057         * typeck2.c (store_init_value): If fold_non_dependent_expr didn't
1058         produce a constant value, go back to the uninstantiated form.
1060         Avoid taking the address of something just because it's in parens.
1061         * constexpr.c (same_type_ignoring_tlq_and_bounds_p): New.
1062         (cxx_fold_indirect_ref): Use it.
1063         (cxx_eval_constant_expression) [VIEW_CONVERT_EXPR]: Use it.
1064         * cp-tree.h (REF_PARENTHESIZED_P): Allow VIEW_CONVERT_EXPR.
1065         * semantics.c (force_paren_expr): Use VIEW_CONVERT_EXPR instead of
1066         static_cast to reference type.
1067         (maybe_undo_parenthesized_ref): Handle VIEW_CONVERT_EXPR.
1069 2018-06-21  Jason Merrill  <jason@redhat.com>
1071         * pt.c (tsubst) [TEMPLATE_TYPE_PARM]: Use TEMPLATE_PARM_DESCENDANTS.
1073         * name-lookup.c (do_push_to_top_level): Don't allocate
1074         current_lang_base.
1075         (do_pop_from_top_level): Release current_lang_base.
1077         Let -fmem-report see callers of cxx_make_type.
1078         * lex.c (cxx_make_type): Add MEM_STAT_DECL.
1079         (make_class_type): Likewise.
1080         (cxx_make_type_hook): New.
1081         * cp-objcp-common.h (LANG_HOOKS_MAKE_TYPE): Use cxx_make_type_hook.
1083 2018-06-20  Nathan Sidwell  <nathan@acm.org>
1085         PR c++/85634
1086         * friend.c (add_friend): Keep lookup sets of tempate sets.
1088 2018-06-20  Paolo Carlini  <paolo.carlini@oracle.com>
1090         * decl.c (grokfndecl): Add const cp_decl_specifier_seq* parameter;
1091         tidy handling of a null location_t argument; use proper location
1092         information in a few additional error messages.
1093         (grokdeclarator): Update calls.
1095 2018-06-20  Chung-Lin Tang <cltang@codesourcery.com>
1096             Thomas Schwinge <thomas@codesourcery.com>
1097             Cesar Philippidis  <cesar@codesourcery.com>
1099         * parser.c (cp_parser_omp_clause_name): Add support for finalize
1100         and if_present. Make present_or_{copy,copyin,copyout,create} aliases
1101         to their non-present_or_* counterparts. Make 'self' an alias to
1102         PRAGMA_OACC_CLAUSE_HOST.
1103         (cp_parser_oacc_data_clause): Update GOMP mappings for
1104         PRAGMA_OACC_CLAUSE_{COPY,COPYIN,COPYOUT,CREATE,DELETE}. Remove
1105         PRAGMA_OACC_CLAUSE_{SELF,PRESENT_OR_*}.
1106         (cp_parser_oacc_all_clauses): Handle finalize and if_present clauses.
1107         Remove support for present_or_* clauses.
1108         (OACC_KERNELS_CLAUSE_MASK): Remove PRESENT_OR_* clauses.
1109         (OACC_PARALLEL_CLAUSE_MASK): Likewise.
1110         (OACC_DECLARE_CLAUSE_MASK): Likewise.
1111         (OACC_DATA_CLAUSE_MASK): Likewise.
1112         (OACC_ENTER_DATA_CLAUSE_MASK): Remove PRESENT_OR_* clauses.
1113         (OACC_EXIT_DATA_CLAUSE_MASK): Add FINALIZE clause.
1114         (OACC_UPDATE_CLAUSE_MASK): Remove SELF, add IF_PRESENT.
1115         (cp_parser_oacc_declare): Remove PRESENT_OR_* clauses.
1116         * pt.c (tsubst_omp_clauses): Handle IF_PRESENT and FINALIZE.
1117         * semantics.c (finish_omp_clauses): Handle IF_PRESENT and FINALIZE.
1119 2018-06-20  Marek Polacek  <polacek@redhat.com>
1121         PR c++/86240
1122         * constexpr.c (cxx_eval_constant_expression): Handle ABSU_EXPR.
1123         (fold_simple_1): Likewise.
1124         * error.c (dump_expr): Likewise.
1126 2018-06-20  Nathan Sidwell  <nathan@acm.org>
1128         PR c++/85634
1129         * cp-tree.h (lookup_keep): Drop KEEP parm.
1130         (lookup_list_keep): Delete.
1131         (maybe_get_fns): Declare.
1132         * parser.c (cp_parser_primary_expression): Call lookup_keep here.
1133         (cp_parser_template_id): Not here ...
1134         * decl.c (cp_finish_decl): ... nor here ...
1135         * init.c (build_raw_new_expr): ... nor here ...
1136         * pt.c (process_template_parm): ... nor here ...
1137         * semantics.c (perform_koenig_lookup): Call lookup_keep.
1138         (finish_call_expr): Not here.
1139         * tree.c (ovl_cache): Delete.
1140         (ovl_make, ovl_copy): No cache.
1141         (lookup_keep): Always keep.
1142         (lookup_list_keep): Delete.
1143         (maybe_get_fns): New, broken out of ...
1144         (get_fns): ... here.  Call it.
1145         (built_min_nt_loc, build_min, build_min_non_dep): Drop lookup_keep.
1146         (build_min_nt_call_vec): Likewise.
1148 2018-06-19  Jason Merrill  <jason@redhat.com>
1150         * cp-tree.h (CONSTRUCTOR_NO_IMPLICIT_ZERO): Remove.
1151         * constexpr.c: Use CONSTRUCTOR_NO_CLEARING instead.
1153         PR c++/86182 - ICE with anonymous union passed to template.
1154         * pt.c (tsubst_expr) [DECL_EXPR]: Handle an anonymous union type
1155         used to declare a named variable.
1157 2018-06-18  Jason Merrill  <jason@redhat.com>
1159         * tree.c (cp_expr_location): New.
1160         * cp-tree.h (cp_expr_loc_or_loc): New.
1161         * call.c, cvt.c, constexpr.c, constraint.cc, cp-gimplify.c, decl.c,
1162         error.c, init.c, lex.c, parser.c, pt.c, semantics.c, typeck.c,
1163         typeck2.c: Use it instead of EXPR_LOC_OR_LOC.
1165         * parser.c (cp_parser_lambda_expression): Use a range for
1166         LAMBDA_EXPR_LOCATION.
1168         PR c++/86200 - ICE with unexpanded pack in lambda parameter.
1169         * pt.c (find_parameter_packs_r) [LAMBDA_EXPR]: Also look into the
1170         function type.
1172         PR c++/81060 - ICE with unexpanded parameter pack.
1173         * pt.c (check_for_bare_parameter_packs): Add loc parameter.
1174         * decl.c (grokdeclarator): Call it for qualifying_scope.
1176         PR c++/86171 - ICE with recursive alias instantiation.
1177         * pt.c (tsubst_decl): Handle recursive alias instantiation.
1179 2018-06-18  Paolo Carlini  <paolo.carlini@oracle.com>
1181         * decl.c (duplicate_decls): Consistently use DECL_SOURCE_LOCATION
1182         in errors about redefined default arguments; tidy.
1184 2018-06-16  Kugan Vivekanandarajah  <kuganv@linaro.org>
1186         * constexpr.c (potential_constant_expression_1): Handle ABSU_EXPR.
1187         * cp-gimplify.c (cp_fold): Likewise.
1189 2018-06-15  Jason Merrill  <jason@redhat.com>
1191         PR c++/86147 - wrong capture for template argument.
1192         * expr.c (mark_use): Look through NOP_EXPR.
1194         * name-lookup.c (do_pushtag): Don't look through complete types, but
1195         don't add to them either.  Get context from current_binding_level.
1196         * pt.c (tsubst_default_argument): Use push_to/pop_from_top_level.
1198         * decl.c (start_enum): Do compare dependent underlying type.
1200         PR c++/82882 - ICE with lambda in template default argument.
1201         * lambda.c (record_null_lambda_scope): New.
1202         * pt.c (tsubst_lambda_expr): Use it.
1203         * name-lookup.c (do_pushtag): Don't give a lambda DECL_CONTEXT of a
1204         function that isn't open.
1206         * tree.c (maybe_warn_parm_abi): Inform the location of the class.
1208 2018-06-14  Marek Polacek  <polacek@redhat.com>
1210         PR c++/86063
1211         * decl2.c (cp_check_const_attributes): Skip trees that are not
1212         TREE_LISTs.
1214 2018-06-14  Jakub Jelinek  <jakub@redhat.com>
1216         P0624R2 - Default constructible and assignable stateless lambdas
1217         * method.c (synthesized_method_walk): For C++2a don't mark
1218         sfk_constructor or sfk_copy_assignment as deleted if lambda has
1219         no lambda-captures.
1221 2018-06-14  Paolo Carlini  <paolo.carlini@oracle.com>
1223         * decl.c (duplicate_decls): Use DECL_SOURCE_LOCATION in
1224         OPT_Wshadow warning_at.
1225         (grokfndecl): Consistently use the location_t argument in
1226         literal operator diagnostic messages.
1227         (grokdeclarator): Use declspecs->locations[ds_storage_class]
1228         in error_at call.
1229         * decl2.c (finish_static_data_member_decl): Use DECL_SOURCE_LOCATION
1230         in permerror call.
1232 2018-06-13  Jason Merrill  <jason@redhat.com>
1234         PR c++/86099 - ICE with trivial copy and non-trivial default ctor.
1235         * constexpr.c (instantiate_cx_fn_r): Don't synthesize trivial
1236         constructors.
1238         PR c++/86094 - wrong code with defaulted move ctor.
1239         * class.c (classtype_has_non_deleted_move_ctor): New.
1240         * tree.c (maybe_warn_parm_abi, type_has_nontrivial_copy_init):
1241         Handle v12 breakage.
1243 2018-06-12  Jason Merrill  <jason@redhat.com>
1245         PR c++/86098 - ICE with template placeholder for TTP.
1246         * typeck.c (structural_comptypes) [TEMPLATE_TYPE_PARM]: Check
1247         CLASS_PLACEHOLDER_TEMPLATE.
1249 2018-06-12  Paolo Carlini  <paolo.carlini@oracle.com>
1251         * decl2.c (coerce_new_type, coerce_delete_type): Add location_t
1252         parameter and adjust error_at calls.
1253         * decl.c (grok_op_properties): Adjust calls.
1254         * cp-tree.h (oerce_new_type, coerce_delete_type): Adjust decls.
1256 2018-06-12  Marek Polacek  <polacek@redhat.com>
1258         Core issue 1331 - const mismatch with defaulted copy constructor
1259         * class.c (check_bases_and_members): When checking a defaulted
1260         function, mark it as deleted rather than giving an error.
1262 2018-06-11  Jason Merrill  <jason@redhat.com>
1264         PR c++/85792 -Wctor-dtor-privacy and inherited constructor.
1265         * class.c (maybe_warn_about_overly_private_class): Handle inherited
1266         constructors.
1268         PR c++/85963 - -Wunused-but-set with ?: in template.
1269         * pt.c (tsubst_copy_and_build) [COND_EXPR]: Call mark_rvalue_use.
1271 2018-06-11  Paolo Carlini  <paolo.carlini@oracle.com>
1273         * decl.c (grok_op_properties): Consistently use the location
1274         of the decl; remove special casing of POSTINCREMENT_EXPR and
1275         POSTDECREMENT_EXPR wrt default arguments.
1277 2018-06-05  Jason Merrill  <jason@redhat.com>
1279         * constexpr.c (cxx_eval_binary_expression): Special case comparison
1280         of pointers to members of the same union.
1282 2018-06-11  Jason Merrill  <jason@redhat.com>
1284         PR c++/86094 - wrong code with defaulted move ctor.
1285         * tree.c (type_has_nontrivial_copy_init): Fix move ctor handling.
1287 2018-06-10  Paolo Carlini  <paolo.carlini@oracle.com>
1289         * decl.c (grokfndecl): Use the location_t argument in two more places.
1291 2018-06-06  Marek Polacek  <polacek@redhat.com>
1293         PR c++/85977
1294         * pt.c (unify): If ELTTYPE has no deducible template parms, skip
1295         deduction from the list elements.
1296         (type_unification_real): Check convertibility of list elements.
1298 2018-06-06  Jason Merrill  <jason@redhat.com>
1300         PR c++/86060 - ICE on range for with -std=c++98.
1301         * parser.c (cp_parser_init_statement): Don't clobber *decl after
1302         pedwarn.
1304         PR c++/85710 - ICE with -Wmemset-elt-size.
1305         * semantics.c (finish_call_expr): Call warn_for_memset here.
1306         * parser.c (cp_parser_postfix_expression): Not here.
1307         (literal_integer_zerop): No longer static.
1308         * pt.c (build_non_dependent_expr): Don't wrap CONST_DECL.
1310 2018-06-05  Marek Polacek  <polacek@redhat.com>
1312         PR c++/85976
1313         * tree.c (cp_tree_equal): Handle USING_DECL.
1315 2018-06-05  Jason Merrill  <jason@redhat.com>
1317         PR c++/85731 - wrong error with qualified-id in template.
1318         * semantics.c (finish_qualified_id_expr): build_qualified_name
1319         for unbound names in the current class.
1321 2018-06-04  Jason Merrill  <jason@redhat.com>
1323         PR c++/61806 - missed SFINAE with partial specialization.
1324         * cp-tree.h (deferring_access_check_sentinel): Add deferring_kind
1325         parameter to constructor.
1326         * pt.c (instantiate_class_template_1): Enable access checking
1327         before call to most_specialized_partial_spec.
1329         PR c++/85765 - SFINAE and non-type default template arg.
1330         * pt.c (type_unification_real): Do full semantic processing if
1331         substituting a partial args list replaces all template parms.
1333 2018-06-03  Jason Merrill  <jason@redhat.com>
1335         PR c++/85739 - ICE with pointer to member template parm.
1336         * cvt.c (perform_qualification_conversions): Use cp_fold_convert.
1338 2018-06-02  Jason Merrill  <jason@redhat.com>
1340         PR c++/85761 - ICE with ill-formed use of const outer variable.
1341         * expr.c (mark_use): Handle location wrappers.
1343 2018-06-01  Jason Merrill  <jason@redhat.com>
1345         PR c++/85764 - bogus 'this' not captured error.
1346         * lambda.c (resolvable_dummy_lambda): Use nonlambda_method_basetype.
1347         (nonlambda_method_basetype): Handle NSDMI.
1349         CWG 1581: When are constexpr member functions defined?
1350         * constexpr.c (instantiate_cx_fn_r, instantiate_constexpr_fns): New.
1351         (cxx_eval_outermost_constant_expr): Call instantiate_constexpr_fns.
1353         PR c++/58281 - explicit instantiation of constexpr
1354         * pt.c (mark_decl_instantiated): Clear DECL_EXTERNAL.
1356         * pt.c (instantiate_decl): Any defaulted function is defined.
1358 2018-05-30  Jonathan Wakely  <jwakely@redhat.com>
1360         PR c++/77777
1361         * call.c (resolve_args): Use location of expression, not current input
1362         location.
1364 2018-05-30  Ville Voutilainen  <ville.voutilainen@gmail.com>
1366         Do not warn about zero-as-null when NULL is used.
1367         * call.c (conversion_null_warnings): Check for pointer
1368         types converted from zero constants.
1369         (convert_like_real): Add a warning sentinel at the end.
1370         * tree.c (maybe_warn_zero_as_null_pointer_constant): Also
1371         check null_node_p.
1373 2018-05-30  Jason Merrill  <jason@redhat.com>
1375         PR c++/85807 - ICE with call in template NSDMI.
1376         * init.c (get_nsdmi): Use push_to/pop_from_top_level.
1377         * tree.c (bot_manip): Don't set_flags_from_callee in a template.
1379         PR c++/85873 - constant initializer_list array not in .rodata.
1380         * tree.c (build_target_expr): Set TREE_READONLY.
1381         * call.c (set_up_extended_ref_temp): Set TREE_READONLY.
1383         * parser.c (cp_parser_check_condition_declarator): Handle
1384         cp_error_declarator.
1386 2018-05-30  Jonathan Wakely  <jwakely@redhat.com>
1388         * typeck.c (cxx_sizeof_or_alignof_type): Return size_one_node instead
1389         of using it in dead store.
1391 2018-05-29  Jason Merrill  <jason@redhat.com>
1393         PR c++/67445 - returning temporary initializer_list.
1394         PR c++/67711 - assigning from temporary initializer_list.
1395         PR c++/48562 - new initializer_list.
1396         * typeck.c (maybe_warn_about_returning_address_of_local): Also warn
1397         about returning local initializer_list.
1398         * cp-tree.h (AUTO_TEMP_NAME, TEMP_NAME_P): Remove.
1399         * call.c (build_over_call): Warn about assignment from temporary
1400         init_list.
1401         * init.c (build_new_1): Warn about 'new std::initializer_list'.
1402         (find_list_begin, maybe_warn_list_ctor): New.
1403         (perform_member_init): Use maybe_warn_list_ctor.
1405 2018-05-29  Marek Polacek  <polacek@redhat.com>
1407         PR c++/85883
1408         * init.c (build_new): Handle deducing a class with new
1409         with more than one argument.
1411 2018-05-29  Jakub Jelinek  <jakub@redhat.com>
1413         PR c++/85952
1414         * init.c (build_aggr_init): For structured binding initialized from
1415         array call mark_rvalue_use on the initializer.
1417 2018-05-28  Bernd Edlinger  <bernd.edlinger@hotmail.de>
1419         * decl2.c (start_static_storage_duration_function): Use
1420         splay_tree_delete_pointers.
1422 2018-05-25  Jason Merrill  <jason@redhat.com>
1424         PR c++/85815 - reference to member of enclosing template.
1425         * search.c (lookup_base): Use currently_open_class.
1426         (lookup_member): Use it regardless of -fconcepts.
1427         * parser.c (cp_parser_postfix_dot_deref_expression): Check it.
1429         CWG 616, 1213 - value category of subobject references.
1430         * tree.c (lvalue_kind): Fix handling of ARRAY_REF of pointer.
1432 2018-05-24  Jason Merrill  <jason@redhat.com>
1434         PR c++/85842 - -Wreturn-type, constexpr if and generic lambda.
1435         * pt.c (tsubst_lambda_expr): Copy current_function_returns_* to
1436         generic lambda.
1438 2018-05-24  Ville Voutilainen  <ville.voutilainen@gmail.com>
1440         Pedwarn on a non-standard position of a C++ attribute.
1441         * parser.c (cp_parser_namespace_definition): Pedwarn about attributes
1442         after the namespace name.
1444 2018-05-24  Paolo Carlini  <paolo.carlini@oracle.com>
1446         * cp-tree.h (INDIRECT_TYPE_P): New.
1447         * call.c (build_trivial_dtor_call, maybe_warn_class_memaccess,
1448         joust): Use it instead of POINTER_TYPE_P.
1449         * class.c (update_vtable_entry_for_fn, find_flexarrays,
1450         * fixed_type_or_null, resolves_to_fixed_type_p): Likewise.
1451         * constexpr.c (cxx_eval_binary_expression, cxx_fold_indirect_ref,
1452         * cxx_eval_increment_expression, potential_constant_expression_1):
1453         Likewise.
1454         * cp-gimplify.c (cp_gimplify_expr, cp_genericize_r): Likewise.
1455         * cp-objcp-common.c (cxx_get_alias_set): Likewise.
1456         * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call,
1457         cp_ubsan_maybe_instrument_downcast): Likewise.
1458         * cvt.c (cp_convert_to_pointer, ocp_convert,
1459         cp_get_fndecl_from_callee, maybe_warn_nodiscard, convert): Likewise.
1460         * cxx-pretty-print.c (cxx_pretty_printer::abstract_declarator,
1461         pp_cxx_offsetof_expression_1): Likewise.
1462         * decl.c (grokparms, static_fn_type): Likewise.
1463         * decl2.c (grokbitfield): Likewise.
1464         * error.c (dump_expr): Likewise.
1465         * except.c (initialize_handler_parm, check_noexcept_r): Likewise.
1466         * init.c (warn_placement_new_too_small): Likewise.
1467         * lambda.c (build_capture_proxy, add_capture): Likewise.
1468         * parser.c (cp_parser_omp_for_loop): Likewise.
1469         * pt.c (convert_nontype_argument, fn_type_unification,
1470         uses_deducible_template_parms, check_cv_quals_for_unify,
1471         dependent_type_p_r): Likewise.
1472         * search.c (check_final_overrider): Likewise.
1473         * semantics.c (handle_omp_array_sections, finish_omp_clauses,
1474         finish_omp_for): Likewise.
1475         * tree.c (cp_build_qualified_type_real): Likewise.
1476         * typeck.c (build_class_member_access_expr,
1477         finish_class_member_access_expr, build_x_indirect_ref,
1478         cp_build_indirect_ref_1, cp_build_binary_op, build_const_cast_1):
1479         Likewise.
1481 2018-05-24  Jason Merrill  <jason@redhat.com>
1483         PR c++/85864 - literal template and default template arg.
1484         * pt.c (instantiation_dependent_r): Handle NONTYPE_ARGUMENT_PACK.
1486 2018-05-24  Marek Polacek  <polacek@redhat.com>
1488         PR c++/85847
1489         * init.c (build_new_1): Use fold_non_dependent_expr.  Use a dedicated
1490         variable for its result.  Fix a condition.
1491         (build_new): Use fold_non_dependent_expr.  Tweak a condition.
1493 2018-05-23  Jason Merrill  <jason@redhat.com>
1495         Fix cast to rvalue reference from prvalue.
1496         * cvt.c (diagnose_ref_binding): Handle rvalue reference.
1497         * rtti.c (build_dynamic_cast_1): Don't try to build a reference to
1498         non-class type.  Handle xvalue argument.
1499         * typeck.c (build_reinterpret_cast_1): Allow cast from prvalue to
1500         rvalue reference.
1501         * semantics.c (finish_compound_literal): Do direct-initialization,
1502         not cast, to initialize a reference.
1504         CWG 616, 1213 - value category of subobject references.
1505         * tree.c (lvalue_kind): A reference to a subobject of a prvalue is
1506         an xvalue.
1507         * typeck2.c (build_m_component_ref): Likewise.
1508         * typeck.c (cp_build_addr_expr_1, lvalue_or_else): Remove diagnostic
1509         distinction between temporary and xvalue.
1511 2018-05-23  Marek Polacek  <polacek@redhat.com>
1513         Implement P0614R1, Range-based for statements with initializer.
1514         * parser.c (cp_parser_range_based_for_with_init_p): New.
1515         (cp_parser_init_statement): Use it.  Parse the optional init-statement
1516         for a range-based for loop.
1517         (cp_parser_skip_to_closing_parenthesis_1): Handle balancing ?:.
1519 2018-05-22  Jason Merrill  <jason@redhat.com>
1521         PR c++/81420 - not extending temporary lifetime.
1522         * call.c (extend_ref_init_temps_1): Handle ARRAY_REF.
1523         * class.c (build_base_path): Avoid redundant move of an rvalue.
1525         PR c++/85866 - error with .* in default template arg.
1526         * pt.c (tsubst_copy_and_build): Handle partial instantiation.
1528 2018-05-21  Paolo Carlini  <paolo.carlini@oracle.com>
1530         * parser.c (cp_parser_parameter_declaration_list): Remove
1531         bool* parameter.
1532         (cp_parser_parameter_declaration_clause): Adjust.
1533         (cp_parser_cache_defarg): Likewise.
1535 2018-05-21  Paolo Carlini  <paolo.carlini@oracle.com>
1537         PR c++/84588
1538         * parser.c (cp_parser_maybe_commit_to_declaration,
1539         cp_parser_check_condition_declarator): New.
1540         (cp_parser_simple_declaration): Use the first above.
1541         (cp_parser_condition): Use both the above; enforce
1542         [stmt.stmt]/2 about the declarator not specifying
1543         a function or an array; improve error-recovery.
1545 2018-05-20  Jason Merrill  <jason@redhat.com>
1547         PR libstdc++/85843 - warning in logic_error copy constructor.
1548         * class.c (type_has_user_nondefault_constructor): Check for a
1549         user-provided ctor, not user-declared.
1551 2018-05-19  Jason Merrill  <jason@redhat.com>
1553         * pt.c (tsubst_pack_expansion): Sorry rather than abort
1554         on __integer_pack as subexpression of pattern.
1556 2018-05-18  Jason Merrill  <jason@redhat.com>
1558         PR c++/58407 - deprecated implicit copy ops.
1559         * call.c (build_over_call): Warn about deprecated trivial fns.
1560         * class.c (classtype_has_user_copy_or_dtor): New.
1561         (type_build_ctor_call): Check TREE_DEPRECATED.
1562         (type_build_dtor_call): Likewise.
1563         * decl2.c (cp_warn_deprecated_use): Move from tree.c.
1564         Add checks.  Return bool.  Handle -Wdeprecated-copy.
1565         (mark_used): Use it.
1566         * decl.c (grokdeclarator): Remove redundant checks.
1567         * typeck2.c (build_functional_cast): Likewise.
1568         * method.c (lazily_declare_fn): Mark deprecated copy ops.
1569         * init.c (build_aggr_init): Only set TREE_USED if there are
1570         side-effects.
1572 2018-05-18  Cesar Philippidis  <cesar@codesourcery.com>
1574         PR c++/85782
1575         * cp-gimplify.c (cp_genericize_r): Call genericize_omp_for_stmt for
1576         OACC_LOOPs.
1578 2018-05-18  Richard Sandiford  <richard.sandiford@linaro.org>
1580         * constexpr.c (cxx_eval_constant_expression): Remove FMA_EXPR handling.
1581         (potential_constant_expression_1): Likewise.
1583 2018-05-16  Marek Polacek  <polacek@redhat.com>
1585         PR c++/85363
1586         * call.c (set_flags_from_callee): Handle AGGR_INIT_EXPRs too.
1587         * tree.c (bot_manip): Call set_flags_from_callee for
1588         AGGR_INIT_EXPRs too.
1590 2018-05-15  Jason Merrill  <jason@redhat.com>
1592         * cp-tree.h (cp_expr): Remove copy constructor.
1593         * mangle.c (struct releasing_vec): Declare copy constructor.
1595         * constexpr.c (cxx_eval_vec_init_1): Pass tf_none if ctx->quiet.
1597         PR c++/64372 - CWG 1560, gratuitous lvalue-rvalue conversion in ?:
1598         * call.c (build_conditional_expr_1): Don't force_rvalue when one arm
1599         is a throw-expression.
1601 2018-05-15  Paolo Carlini  <paolo.carlini@oracle.com>
1603         * cp-tree.h (DECL_MAYBE_IN_CHARGE_CDTOR_P): New.
1604         (FOR_EACH_CLONE): Update.
1605         * decl.c (grokdeclarator): Use it.
1606         * decl2.c (vague_linkage_p): Likewise.
1607         * mangle.c (mangle_decl): Likewise.
1608         * method.c (lazily_declare_fn): Likewise.
1609         * optimize.c (can_alias_cdtor, maybe_clone_body): Likewise.
1610         * repo.c (repo_emit_p): Likewise.
1611         * tree.c (decl_linkage): Likewise.
1613 2018-05-14  Jason Merrill  <jason@redhat.com>
1615         Handle TYPE_HAS_LATE_RETURN_TYPE like ref-qualifier and eh spec.
1616         * tree.c (build_cp_fntype_variant): New.
1617         (build_ref_qualified_type, build_exception_variant)
1618         (strip_typedefs, cxx_copy_lang_qualifiers): Use it.
1619         (cxx_type_hash_eq, cp_check_qualified_type): Check
1620         TYPE_HAS_LATE_RETURN_TYPE.
1621         (cp_build_type_attribute_variant): Check cxx_type_hash_eq.
1622         (cp_build_qualified_type_real): No need to preserve C++ qualifiers.
1623         * class.c (build_clone): Use cxx_copy_lang_qualifiers.
1624         (adjust_clone_args): Likewise.
1625         * decl.c (grokfndecl): Add late_return_type_p parameter.  Use
1626         build_cp_fntype_variant.
1627         (grokdeclarator): Pass late_return_type_p to grokfndecl.
1628         (check_function_type): Use cxx_copy_lang_qualifiers.
1629         (static_fn_type): Use cxx_copy_lang_qualifiers.
1630         * decl2.c (build_memfn_type, maybe_retrofit_in_chrg)
1631         (cp_reconstruct_complex_type, coerce_new_type, coerce_delete_type)
1632         (change_return_type): Use cxx_copy_lang_qualifiers.
1633         * mangle.c (write_type): Use cxx_copy_lang_qualifiers.
1634         * parser.c (cp_parser_lambda_declarator_opt): Represent an explicit
1635         return type on the declarator like a normal trailing return type.
1636         * pt.c (tsubst_function_type): Use build_cp_fntype_variant.
1637         (copy_default_args_to_explicit_spec): Use cxx_copy_lang_qualifiers.
1638         * typeck.c (merge_types): Use build_cp_fntype_variant.
1640 2018-05-14  Paolo Carlini  <paolo.carlini@oracle.com>
1642         * cp-tree.h (TYPE_REF_P): New.
1643         (TYPE_OBJ_P, TYPE_REF_OBJ_P, TYPE_REFFN_P): Update.
1644         * call.c (build_list_conv, build_aggr_conv, standard_conversion,
1645         direct_reference_binding, reference_binding, implicit_conversion,
1646         add_builtin_candidate, build_user_type_conversion_1, build_op_call_1,
1647         build_new_op_1, build_x_va_arg, conv_binds_ref_to_prvalue,
1648         build_over_call, perform_implicit_conversion_flags,
1649         extend_ref_init_temps, type_has_extended_temps): Use it.
1650         * class.c (one_inheriting_sig, check_field_decls,
1651         check_bases_and_members, find_flexarrays, finish_struct,
1652         fixed_type_or_null): Likewise.
1653         * constexpr.c (literal_type_p, cxx_bind_parameters_in_call,
1654         non_const_var_error, cxx_eval_constant_expression,
1655         potential_constant_expression_1): Likewise.
1656         * cp-gimplify.c (omp_var_to_track, omp_cxx_notice_variable,
1657         cp_genericize_r, cxx_omp_privatize_by_reference,
1658         cxx_omp_const_qual_no_mutable, cxx_omp_finish_clause,
1659         cp_fold_maybe_rvalue): Likewise.
1660         * cp-ubsan.c (cp_ubsan_maybe_instrument_downcast): Likewise.
1661         * cvt.c (build_up_reference, convert_to_reference,
1662         convert_from_reference, convert_to_void, noexcept_conv_p,
1663         fnptr_conv_p): Likewise.
1664         * decl.c (poplevel, check_for_uninitialized_const_var,
1665         check_initializer, initialize_local_var, cp_finish_decl,
1666         get_tuple_decomp_init, cp_finish_decomp, grokdeclarator, copy_fn_p,
1667         move_signature_fn_p, grok_op_properties, finish_function): Likewise.
1668         * decl2.c (grok_array_decl, cp_reconstruct_complex_type,
1669         decl_maybe_constant_var_p): Likewise.
1670         * error.c (dump_type_prefix, dump_expr): Likewise.
1671         * except.c (initialize_handler_parm, complete_ptr_ref_or_void_ptr_p,
1672         is_admissible_throw_operand_or_catch_parameter): Likewise.
1673         * expr.c (mark_use): Likewise.
1674         * init.c (build_zero_init_1, build_value_init_noctor,
1675         perform_member_init, diagnose_uninitialized_cst_or_ref_member_1,
1676         build_new, build_delete): Likewise.
1677         * lambda.c (build_lambda_object): Likewise.
1678         * mangle.c (write_expression, write_template_arg): Likewise.
1679         * method.c (forward_parm, do_build_copy_constructor,
1680         do_build_copy_assign, build_stub_object, constructible_expr,
1681         walk_field_subobs): Likewise.
1682         * parser.c (cp_parser_omp_for_loop_init,
1683         cp_parser_omp_declare_reduction_exprs,
1684         cp_parser_omp_declare_reduction): Likewise.
1685         * pt.c (convert_nontype_argument_function, convert_nontype_argument,
1686         convert_template_argument, tsubst_pack_expansion,
1687         tsubst_function_decl, tsubst_decl, tsubst, tsubst_copy_and_build,
1688         maybe_adjust_types_for_deduction, check_cv_quals_for_unify, unify,
1689         more_specialized_fn, invalid_nontype_parm_type_p, dependent_type_p_r,
1690         value_dependent_expression_p, build_deduction_guide): Likewise.
1691         * semantics.c (finish_handler_parms, finish_non_static_data_member,
1692         finish_compound_literal, omp_privatize_field,
1693         handle_omp_array_sections_1, handle_omp_array_sections,
1694         cp_check_omp_declare_reduction, finish_omp_reduction_clause,
1695         finish_omp_declare_simd_methods, cp_finish_omp_clause_depend_sink,
1696         finish_omp_clauses, finish_decltype_type, capture_decltype,
1697         finish_builtin_launder): Likewise.
1698         * tree.c (lvalue_kind, cp_build_reference_type, move,
1699         cp_build_qualified_type_real, stabilize_expr, stabilize_init): Likewise.
1700         * typeck.c (cxx_safe_arg_type_equiv_p, build_class_member_access_expr,
1701         cp_build_indirect_ref_1, convert_arguments, warn_for_null_address,
1702         cp_build_addr_expr_1, maybe_warn_about_useless_cast,
1703         build_static_cast_1, build_static_cast, build_reinterpret_cast_1,
1704         build_const_cast_1, cp_build_c_cast, cp_build_modify_expr,
1705         convert_for_initialization,
1706         maybe_warn_about_returning_address_of_local, check_return_expr,
1707         cp_type_quals, casts_away_constness, non_reference): Likewise.
1708         * typeck2.c (cxx_readonly_error, store_init_value,
1709         process_init_constructor_record, build_x_arrow, build_functional_cast,
1710         add_exception_specifier): Likewise.
1712 2018-05-14  Jason Merrill  <jason@redhat.com>
1714         * pt.c (tsubst) [ARRAY_TYPE]: Check valid_array_size_p.
1715         (tsubst_copy_and_build) [NEW_EXPR]: Clear in_decl.
1717 2018-05-11  Jakub Jelinek  <jakub@redhat.com>
1719         PR c/85696
1720         * cp-tree.h (cxx_omp_predetermined_sharing_1): New prototype.
1721         * cp-gimplify.c (cxx_omp_predetermined_sharing): New wrapper around
1722         cxx_omp_predetermined_sharing_1.  Rename old function to ...
1723         (cxx_omp_predetermined_sharing_1): ... this.
1724         * semantics.c (finish_omp_clauses): Use cxx_omp_predetermined_sharing_1
1725         instead of cxx_omp_predetermined_sharing.
1727 2018-05-10  Jason Merrill  <jason@redhat.com>
1729         * decl.c (cp_finish_decl): Don't instantiate auto variable.
1730         (check_static_variable_definition): Allow auto.
1731         * constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
1733         * cp-tree.h (DECL_CONSTRUCTOR_P): Use DECL_CXX_CONSTRUCTOR_P.
1734         (DECL_DESTRUCTOR_P): Use DECL_CXX_DESTRUCTOR_P.
1736         Core issue 2310 - conversion to base of incomplete type.
1737         * class.c (build_base_path): Check COMPLETE_TYPE_P for source type.
1739         CWG 2267 - list-initialization of reference temporary
1740         * call.c (reference_binding): List-initializing a reference
1741         temporary is copy-list-initialization.
1743         * parser.c (cp_parser_class_head): Use num_template_headers_for_class.
1745         * pt.c (instantiate_decl): Make sure we aren't trying to do a nested
1746         instantiation in template context.
1748         * class.c (vbase_has_user_provided_move_assign): Use
1749         user_provided_p.
1751         * lambda.c (lambda_expr_this_capture): Improve logic.
1753         * decl.c (make_typename_type): s/parameters/arguments/.
1754         * parser.c (cp_parser_nested_name_specifier_opt): Likewise.
1755         * pt.c (make_pack_expansion): Correct error message.
1757 2018-05-10  Jakub Jelinek  <jakub@redhat.com>
1759         PR c++/85662
1760         * cp-gimplify.c (cp_fold): Use fold_offsetof rather than
1761         fold_offsetof_1, pass TREE_TYPE (x) as TYPE to it and drop the
1762         fold_convert.
1764 2018-05-10  Eric Botcazou  <ebotcazou@adacore.com>
1766         PR c++/85400
1767         * decl2.c (adjust_var_decl_tls_model): New static function.
1768         (comdat_linkage): Call it on a variable.
1769         (maybe_make_one_only): Likewise.
1771 2018-05-09  Paolo Carlini  <paolo.carlini@oracle.com>
1773         PR c++/85713
1774         Revert:
1775         2018-05-08  Paolo Carlini  <paolo.carlini@oracle.com>
1777         PR c++/84588
1778         * parser.c (cp_parser_parameter_declaration_list): When the
1779         entire parameter-declaration-list is erroneous maybe call
1780         abort_fully_implicit_template.
1782 2018-05-08  Jason Merrill  <jason@redhat.com>
1784         PR c++/85706 - class deduction under decltype
1785         * pt.c (for_each_template_parm_r): Handle DECLTYPE_TYPE.  Clear
1786         *walk_subtrees whether or not we walked into the operand.
1787         (type_uses_auto): Only look at deduced contexts.
1789 2018-05-08  Paolo Carlini  <paolo.carlini@oracle.com>
1791         PR c++/84588
1792         * parser.c (cp_parser_parameter_declaration_list): When the
1793         entire parameter-declaration-list is erroneous maybe call
1794         abort_fully_implicit_template.
1796 2018-05-08  Marek Polacek  <polacek@redhat.com>
1798         PR c++/85695
1799         * semantics.c (finish_if_stmt_cond): See through typedefs.
1801 2018-05-07  Jason Merrill  <jason@redhat.com>
1803         PR c++/85646 - lambda visibility.
1804         * decl2.c (determine_visibility): Don't mess with template arguments
1805         from the containing scope.
1806         (vague_linkage_p): Check DECL_ABSTRACT_P before looking at a 'tor
1807         thunk.
1809 2018-05-07  Nathan Sidwell  <nathan@acm.org>
1811         Remove fno-for-scope
1812         * cp-tree.h (DECL_ERROR_REPORTED, DECL_DEAD_FOR_LOCAL)
1813         (DECL_HAS_SHADOWED_FOR_VAR_P, DECL_SHADOWED_FOR_VAR)
1814         (SET_DECL_SHADOWED_FOR_VAR): Delete.
1815         (decl_shadowed_for_var_lookup, decl_shadowed_for_var_insert)
1816         (check_for_out_of_scope_variable, init_shadowed_var_for_decl):
1817         Don't declare.
1818         * name-lookup.h (struct cp_binding_level): Remove
1819         dead_vars_from_for field.
1820         * cp-lang.c (cp_init_ts): Delete.
1821         (LANG_HOOKS_INIT_TS): Override to cp_common_init_ts.
1822         * cp-objcp-common.c (shadowed_var_for_decl): Delete.
1823         (decl_shadowed_for_var_lookup, decl_shadowed_for_var_insert)
1824         (init_shadowed_var_for_decl): Delete.
1825         * decl.c (poplevel): Remove shadowed for var handling.
1826         (cxx_init_decl_processing): Remove -ffor-scope deprecation.
1827         * name-lookup.c (find_local_binding): Remove shadowed for var
1828         handling.
1829         (check_local_shadow): Likewise.
1830         (check_for_out_of_scope_variable): Delete.
1831         * parser.c (cp_parser_primary_expression): Remove shadowed for var
1832         handling.
1833         * pt.c (tsubst_decl): Remove DECL_DEAD_FOR_LOCAL setting.
1834         * semantics.c (begin_for_scope): Always have a scope.
1835         (begin_for_stmt, finish_for_stmt): Remove ARM-for scope handling.
1836         (begin_range_for_stmt, finish_id_expression): Likewise.
1838 2018-05-07  Jason Merrill  <jason@redhat.com>
1840         PR c++/85618 - ICE with initialized VLA.
1841         * tree.c (vla_type_p): New.
1842         * typeck2.c (store_init_value, split_nonconstant_init_1): Check it
1843         rather than array_of_runtime_bound_p.
1845 2018-05-05  Paolo Carlini  <paolo.carlini@oracle.com>
1847         * cvt.c (ocp_convert): Early handle the special case of a
1848         null_ptr_cst_p expr converted to a NULLPTR_TYPE_P type.
1850 2018-05-03  Jason Merrill  <jason@redhat.com>
1852         PR c++/85600 - virtual delete failure.
1853         * init.c (build_delete): Always save_expr when deleting.
1855 2018-05-03  Nathan Sidwell  <nathan@acm.org>
1857         * decl.c (cxx_init_decl_processing): Remove flag_friend_injection.
1858         * name-lookup.c (do_pushdecl): Likewise.
1860 2018-05-02  Paolo Carlini  <paolo.carlini@oracle.com>
1861             Jason Merrill  <jason@redhat.com>
1863         PR c++/68374
1864         * name-lookup.c (check_local_shadow): Don't handle static old
1865         declarations in the block handling locals shadowing locals.
1867 2018-05-01  Jason Merrill  <jason@redhat.com>
1869         PR c++/85587 - error with scoped enum in template.
1870         * semantics.c (finish_qualified_id_expr): Don't return an
1871         unqualified IDENTIFIER_NODE.
1873 2018-04-30  Jason Merrill  <jason@redhat.com>
1875         PR c++/85580 - extern "C" and local variables
1876         * name-lookup.c (check_extern_c_conflict): Ignore local decls.
1878         PR c++/84701 - unsigned typeof.
1879         * decl.c (grokdeclarator): Overhaul diagnostics for invalid use
1880         of long/short/signed/unsigned.
1882         PR c++/85305 - pack in lambda init-capture.
1883         * parser.c (cp_parser_initializer): Add subexpression_p parm; don't
1884         check_for_bare_parameter_packs in a subexpression.
1885         (cp_parser_lambda_introducer): Use it.
1887         PR c++/61982 - dead stores to destroyed objects.
1888         * call.c (build_trivial_dtor_call): New, assigns a clobber.
1889         (build_over_call, build_special_member_call): Use it.
1890         * cp-tree.h: Declare it.
1891         * init.c (build_delete): Remove trivial path.
1893         * init.c (build_dtor_call): Use build_special_member_call.
1894         (build_delete): Remove redundant uses of save_addr.
1896         * decl.c (build_clobber_this): Use build_clobber.
1898 2018-04-27  Jakub Jelinek  <jakub@redhat.com>
1900         PR c++/85553
1901         * init.c (build_zero_init_1): For zero initialization of
1902         NULLPTR_TYPE_P type use build_int_cst directly.
1904 2018-04-27  David Malcolm  <dmalcolm@redhat.com>
1906         PR c++/85515
1907         * name-lookup.c (consider_binding_level): Skip compiler-generated
1908         variables.
1909         * search.c (lookup_field_fuzzy_info::fuzzy_lookup_field): Flatten
1910         nested if statements into a series of rejection tests.  Reject
1911         lambda-ignored entities as suggestions.
1913 2018-04-27  Jason Merrill  <jason@redhat.com>
1915         * cvt.c (cp_fold_convert): Use convert_ptrmem.
1916         * typeck.c (convert_ptrmem): Add a NOP even if no adjustment.
1918 2018-04-27  Paolo Carlini  <paolo.carlini@oracle.com>
1920         PR c++/84691
1921         * decl.c (grokdeclarator): Clear friendp upon definition in local
1922         class definition error.
1924 2018-04-27  Jason Merrill  <jason@redhat.com>
1926         PR c++/85545 - ICE with noexcept PMF conversion.
1927         * cvt.c (cp_fold_convert): Pass PMF CONSTRUCTORs to
1928         build_ptrmemfunc.
1929         * typeck.c (build_ptrmemfunc): Don't build a NOP_EXPR for zero
1930         adjustment.
1931         (build_ptrmemfunc_access_expr): Special-case CONSTRUCTORs.
1933 2018-04-27  Nathan Sidwell  <nathan@acm.org>
1935         * typeck.c (convert_ptrmem): Move local var decls to initialization.
1937         * cp-tree.h (TEMPLATE_INFO): Fix comments.
1938         (TI_PENDING_TEMPLATE_FLAG): Check TEMPLATE_INFO.
1939         (NON_DEFAULT_TEMPLATE_ARG_COUNT): Wrap line.
1940         (dump, print_other_binding_stacks): Remove declarations.
1941         * name-lookup.c (print_other_binding_stack): Make static.
1942         * pt.c (build_template_decl): Make static.
1944 2018-04-26  Jason Merrill  <jason@redhat.com>
1946         PR c++/85545 - ICE with noexcept PMF conversion.
1947         * cvt.c (cp_fold_convert): Handle PMF CONSTRUCTORs directly.
1949 2018-04-25  Nathan Sidwell  <nathan@acm.org>
1951         PR c++/85437
1952         PR c++/49171
1953         * cp-tree.h (REINTERPRET_CAST_P): New.
1954         * constexpr.c (cxx_eval_constant_expression) <case NOP_EXPR>:
1955         Reject REINTERPET_CAST_P conversions.  Use cplus_expand_constant
1956         for non-trivial PTRMEM_CST cases.
1957         * typeck.c (build_nop_reinterpret): New.
1958         (build_reinterpret_cast_1): Use it.  Set REINTERPRET_CAST_P on
1959         NOP_EXPRs returned by cp_convert.
1961 2018-04-23  Jason Merrill  <jason@redhat.com>
1963         PR c++/69560 - wrong alignof(double) on x86.
1964         CWG 1879 - Inadequate definition of alignment requirement.
1965         * cp-tree.h (ALIGNOF_EXPR_STD_P): New.
1966         * typeck.c (cxx_sizeof_or_alignof_type): Add std_alignof parm.
1967         (cxx_sizeof_expr, cxx_sizeof_nowarn, cxx_alignas_expr)
1968         (cxx_alignof_expr): Pass it.
1969         * parser.c (cp_parser_unary_expression): Pass it.
1970         * pt.c (tsubst_copy): Copy it.
1971         (tsubst_copy_and_build): Pass it.
1972         * decl.c (fold_sizeof_expr): Pass it.
1974 2018-04-23  Jakub Jelinek  <jakub@redhat.com>
1975             Jason Merrill  <jason@redhat.com>
1977         PR c++/85470 - wrong error with static data member.
1978         * decl.c (check_initializer): Check DECL_INITIALIZED_IN_CLASS_P.
1979         * typeck2.c (store_init_value): Likewise.
1981 2018-04-20  Jakub Jelinek  <jakub@redhat.com>
1983         PR c++/85462
1984         * cp-tree.h (tinst_level): Remove in_system_header_p member,
1985         change refcount member from unsigned char to unsigned short,
1986         add refcount_infinity static data member, adjust comments.
1987         * pt.c (tinst_level::refcount_infinity): Define.
1988         (inc_refcount_use): Remove assert, don't increment if refcount
1989         is already refcount_infinity, adjust comment.
1990         (dec_refcount_use): Remove assert, don't decrement if refcount
1991         is refcount_infinity, adjust comment.
1992         (push_tinst_level_loc): Formatting fix.
1994 2018-04-19  Paolo Carlini  <paolo.carlini@oracle.com>
1996         PR c++/84611
1997         * pt.c (lookup_template_class_1): Check pushtag return value for
1998         error_mark_node.
2000 2018-04-19  Alexandre Oliva  <aoliva@redhat.com>
2002         PR c++/80290
2003         * cp-tree.h (tinst_level::free): Fix whitespace.
2005 2018-04-18  Paolo Carlini  <paolo.carlini@oracle.com>
2007         PR c++/84630
2008         * pt.c (tsubst_lambda_expr): Check begin_lambda_type return value
2009         for error_mark_node.
2011 2018-04-18  Jakub Jelinek  <jakub@redhat.com>
2013         PR c++/84463
2014         * typeck.c (cp_build_addr_expr_1): Move handling of offsetof-like
2015         tricks from here to ...
2016         * cp-gimplify.c (cp_fold) <case ADDR_EXPR>: ... here.  Only use it
2017         if INDIRECT_REF's operand is INTEGER_CST cast to pointer type.
2019 2018-04-18  Alexandre Oliva <aoliva@redhat.com>
2021         PR c++/80290
2022         * cp-tree.h (struct tinst_level): Split decl into tldcl and
2023         targs.  Add private split_list_p, tree_list_p, and not_list_p
2024         inline const predicates; to_list private member function
2025         declaration; free public member function declaration; list_p,
2026         get_node and maybe_get_node accessors, and refcount data
2027         member.  Narrow errors to unsigned short.
2028         * error.c (print_instantiation_full_context): Use new
2029         accessors.
2030         (print_instantiation_partial_context_line): Likewise.  Drop
2031         const from tinst_level-typed parameter.
2032         * mangle.c (mangle_decl_string): Likewise.
2033         * pt.c (freelist): New template class.
2034         (tree_list_freelist_head): New var.
2035         (tree_list_freelist): New fn, along with specializations.
2036         (tinst_level_freelist_head): New var.
2037         (pending_template_freelist_head): Likewise.
2038         (tinst_level_freelist, pending_template_freelist): New fns.
2039         (tinst_level::to_list, tinst_level::free): Define.
2040         (inc_refcount_use, dec_refcount_use): New fns for tinst_level.
2041         (set_refcount_ptr): New template fn.
2042         (add_pending_template): Adjust for refcounting, freelists and
2043         new accessors.
2044         (neglectable_inst_p): Take a NULL d as a non-DECL.
2045         (limit_bad_template_recursion): Use new accessors.
2046         (push_tinst_level): New overload to create the list.
2047         (push_tinst_level_loc): Make it static, split decl into two
2048         args, adjust tests and initialization to cope with split
2049         lists, use freelist, adjust for refcounting.
2050         (push_tinst_level_loc): New wrapper with the old interface.
2051         (pop_tinst_level): Adjust for refcounting.
2052         (record_last_problematic_instantiation): Likewise.
2053         (reopen_tinst_level): Likewise.  Use new accessors.
2054         (instantiate_alias_template): Adjust for split list.
2055         (fn_type_unification): Likewise.
2056         (get_partial_spec_bindings): Likewise.
2057         (instantiate_pending_templates): Use new accessors.  Adjust
2058         for refcount.  Release pending_template to freelist.
2059         (instantiating_current_function_p): Use new accessors.
2061 2018-04-16  Alexandre Oliva <aoliva@redhat.com>
2063         PR c++/85039
2064         * parser.c (cp_parser_builtin_offset): Reject type definitions.
2065         * mangle.c (nested_anon_class_index): Avoid crash returning -1
2066         if we've seen errors.
2068 2018-04-12  David Malcolm  <dmalcolm@redhat.com>
2070         PR c++/85385
2071         * name-lookup.c (macro_use_before_def::maybe_make): New function,
2072         checking that the use is indeed before the definition.
2073         (macro_use_before_def::macro_use_before_def): Make private.
2074         (macro_use_before_def::~macro_use_before_def): Make private.  Move
2075         check for UNKNOWN_LOCATION to macro_use_before_def::maybe_make.
2076         (lookup_name_fuzzy): Call macro_use_before_def::maybe_make rather
2077         than using new directly.
2079 2018-04-12  Jason Merrill  <jason@redhat.com>
2081         PR c++/85356 - ICE with pointer to member function.
2082         * pt.c (maybe_instantiate_noexcept): Do instantiate in templates if
2083         flag_noexcept_type.  Build the new spec within the function context.
2084         * except.c (build_noexcept_spec): Do get constant value in templates
2085         if flag_noexcept_type.
2086         * decl.c (check_redeclaration_exception_specification): Don't
2087         instantiate noexcept on a dependent declaration.
2089 2018-04-12  Marek Polacek  <polacek@redhat.com>
2091         PR c++/85258
2092         * constexpr.c (reduced_constant_expression_p): Return false for null
2093         trees.
2095 2018-04-11  Marek Polacek  <polacek@redhat.com>
2097         PR c++/85032
2098         * constexpr.c (potential_constant_expression_1): Consider conversions
2099         from classes to literal types potentially constant.
2101 2018-04-10  Paolo Carlini  <paolo.carlini@oracle.com>
2103         PR c++/70808
2104         * init.c (build_zero_init_1): Handle NULLPTR_TYPE_P being true of
2105         the type like TYPE_PTR_OR_PTRMEM_P.
2107 2018-04-10  Jason Merrill  <jason@redhat.com>
2109         PR debug/65821 - wrong location for main().
2110         * call.c (clear_location_r, convert_default_arg): Revert.
2111         * tree.c (break_out_target_exprs): Add clear_location parm.
2112         (struct bot_data): New.
2113         (bot_manip): Clear location if requested.
2114         * init.c (get_nsdmi): Pass clear_location.
2116 2018-04-10  David Malcolm  <dmalcolm@redhat.com>
2118         PR c++/85110
2119         * call.c (get_fndecl_argument_location): Make non-static.
2120         * cp-tree.h (get_fndecl_argument_location): New decl.
2121         * typeck.c (convert_for_assignment): When complaining due to
2122         conversions for an argument, show the location of the parameter
2123         within the decl.
2125 2018-04-10  Jakub Jelinek  <jakub@redhat.com>
2127         PR c++/85312 - P0962 cleanup
2128         * parser.c (cp_parser_perform_range_for_lookup): Remove unreachable
2129         diagnostics.
2131 2018-04-10  Jason Merrill  <jason@redhat.com>
2133         PR debug/65821 - wrong location for main().
2134         * call.c (clear_location_r): New.
2135         (convert_default_arg): Use it.
2136         * tree.c (bot_manip): Remove builtin_LINE/FILE handling.
2138         PR c++/85285 - ICE with flexible array after substitution.
2139         * pt.c (instantiate_class_template_1): Check for flexible array in
2140         union.
2142 2018-04-09  Paolo Carlini  <paolo.carlini@oracle.com>
2144         PR c++/85227
2145         * decl.c (cp_finish_decomp): In a template, if the type is incomplete
2146         issue a pedwarn and defer trying to do bindings.
2148 2018-04-09  Jason Merrill  <jason@redhat.com>
2150         PR c++/85279 - dump_expr doesn't understand decltype.
2151         * error.c (dump_expr): Handle DECLTYPE_TYPE.
2153         PR c++/85262 - ICE with redundant qualification on constructor.
2154         * call.c (build_new_method_call_1): Move make_args_non_dependent
2155         after A::A() handling.
2157         PR c++/85277 - ICE with invalid offsetof.
2158         * semantics.c (finish_offsetof): Avoid passing non-DECL to %qD.
2159         Adjust -Winvalid-offsetof diagnostic to say conditionally supported.
2161         PR c++/85264 - ICE with excess template-parameter-list.
2162         * parser.c (cp_parser_check_template_parameters): Add template_id_p
2163         parameter.  Don't allow an extra template header if true.
2164         (cp_parser_class_head): Pass template_id_p.
2165         (cp_parser_elaborated_type_specifier): Likewise.
2166         (cp_parser_alias_declaration): Likewise.
2167         (cp_parser_check_declarator_template_parameters): Likewise.
2169 2018-04-09  Jakub Jelinek  <jakub@redhat.com>
2171         PR c++/85194
2172         * parser.c (cp_parser_simple_declaration): For structured bindings,
2173         if *maybe_range_for_decl is NULL after parsing it, set it to
2174         error_mark_node.
2176 2018-04-09  Jason Merrill  <jason@redhat.com>
2178         PR c++/85256 - ICE capturing pointer to VLA.
2179         * lambda.c (add_capture): Distinguish between variable-size and
2180         variably-modified types.
2182 2018-04-06  Jason Merrill  <jason@redhat.com>
2184         PR c++/85214 - ICE with alias, generic lambda, constexpr if.
2185         * pt.c (extract_locals_r): Remember local typedefs.
2187 2018-04-06  David Malcolm  <dmalcolm@redhat.com>
2189         PR c++/84269
2190         * name-lookup.c (struct std_name_hint): Move out of
2191         get_std_name_hint; add field "min_dialect".
2192         (get_std_name_hint): Add min_dialect values to all initializers.
2193         Add <any>, <atomic>, <bitset>, <condition_variable>, <functional>,
2194         <future>, <istream>, <iterator>, <ostream>, <mutex>, <optional>,
2195         <shared_mutex>, <string_view>, <thread>, and <variant>.
2196         Add fstream, ifstream, and ofstream to <fstream>.
2197         Add istringstream, ostringstream, and stringstream to <sstream>.
2198         Add basic_string to <string>.
2199         Add tuple_element and tuple_size to <tuple>.
2200         Add declval to <utility>.
2201         Fix ordering of <queue> and <tuple>.
2202         Return a std_name_hint, rather than a const char *.
2203         (get_cxx_dialect_name): New function.
2204         (maybe_suggest_missing_std_header): Detect names that aren't yet
2205         available in the current dialect, and instead of suggesting a
2206         missing #include, warn about the dialect.
2208 2018-04-06  Jakub Jelinek  <jakub@redhat.com>
2210         PR c++/85210
2211         * pt.c (tsubst_decomp_names): Return error_mark_node and assert
2212         errorcount is set if tsubst doesn't return a VAR_DECL.
2214 2018-04-06  David Malcolm  <dmalcolm@redhat.com>
2216         PR c++/85021
2217         * name-lookup.c (using_directives_contain_std_p): New function.
2218         (has_using_namespace_std_directive_p): New function.
2219         (suggest_alternatives_for): Simplify if/else logic using early
2220         returns.  If no candidates were found, and there's a
2221         "using namespace std;" directive, call
2222         maybe_suggest_missing_std_header.
2223         (maybe_suggest_missing_header): Split later part of the function
2224         into..
2225         (maybe_suggest_missing_std_header): New.
2227 2018-04-06  Jason Merrill  <jason@redhat.com>
2229         PR c++/85242 - ICE with class definition in template parm.
2230         * cp-tree.h (PROCESSING_REAL_TEMPLATE_DECL_P): False if
2231         processing_template_parmlist.
2233         PR c++/85240 - LTO ICE with using of undeduced auto fn.
2234         * cp-gimplify.c (cp_genericize_r): Discard using of undeduced auto.
2236 2018-04-05  Jakub Jelinek  <jakub@redhat.com>
2238         PR c++/85209
2239         * pt.c (tsubst_decomp_names): Don't fail or ICE if DECL_CHAIN (decl3)
2240         is not prev, if prev == decl.
2242         PR c++/85208
2243         * decl.c (start_decl): For DECL_DECOMPOSITION_P decls, don't call
2244         maybe_apply_pragma_weak here...
2245         (cp_maybe_mangle_decomp): ... but call it here instead.
2247 2018-04-05  Jason Merrill  <jason@redhat.com>
2249         PR c++/85136 - ICE with designated init in template.
2250         * decl.c (maybe_deduce_size_from_array_init): Handle dependent
2251         designated initializer.
2252         (check_array_designated_initializer): Update ce->index with the
2253         constant value.
2255         PR c++/83808 - ICE with VLA initialization.
2256         * typeck2.c (process_init_constructor_array): Don't require a VLA
2257         initializer to have VLA type.
2259 2018-04-05  Paolo Carlini  <paolo.carlini@oracle.com>
2261         PR c++/80956
2262         * call.c (convert_like_real): Fail gracefully for a broken
2263         std::initializer_list, missing a definition.
2265         * name-lookup.c (do_pushtag): Tweak message, use %< and %>.
2267 2018-04-05  Paolo Carlini  <paolo.carlini@oracle.com>
2269         PR c++/84792
2270         * decl.c (grokdeclarator): Fix diagnostic about typedef name used
2271         as nested-name-specifier, keep type and TREE_TYPE (decl) in sync.
2273 2018-04-05  Jason Merrill  <jason@redhat.com>
2275         PR c++/82152 - ICE with class deduction and inherited ctor.
2276         * pt.c (do_class_deduction): Ignore inherited ctors.
2278         PR c++/84665 - ICE with array of empty class.
2279         * decl2.c (cp_check_const_attributes): Use fold_non_dependent_expr.
2281         PR c++/85228 - ICE with lambda in enumerator in template.
2282         * pt.c (bt_instantiate_type_proc): Don't assume
2283         CLASSTYPE_TEMPLATE_INFO is non-null.
2285 2018-04-05  Ville Voutilainen  <ville.voutilainen@gmail.com>
2287         Implement P0969
2288         * decl.c (find_decomp_class_base): Check accessibility instead
2289         of declared access, adjust diagnostic.
2291 2018-04-05  Ville Voutilainen  <ville.voutilainen@gmail.com>
2293         Implement P0961
2294         * decl.c (get_tuple_decomp_init): Check the templatedness
2295         of a member get.
2297 2018-04-05  Jason Merrill  <jason@redhat.com>
2299         PR c++/85200 - ICE with constexpr if in generic lambda.
2300         * pt.c (extract_locals_r): Don't record the local specs of variables
2301         declared within the pattern.
2303 2018-04-05  Alexandre Oliva <aoliva@redhat.com>
2305         PR c++/84979
2306         * pt.c (check_auto_in_tmpl_args): New.
2307         (tsubst_qualified_id): Use it to reject template args
2308         referencing auto for non-type templates.
2309         * parser.c (cp_parser_template_id): Likewise.
2310         * cp-tree.h (check_auto_in_tmpl_args): Declare.
2311         * typeck2.c (build_functional_cast): Report correct location
2312         for invalid use of auto.
2314 2018-04-04  Jason Merrill  <jason@redhat.com>
2316         PR c++/85215 - ICE with copy-init from conversion.
2317         * call.c (merge_conversion_sequences): Fix type of direct binding
2318         sequence.
2320         PR c++/84938 - ICE with division by ~-1.
2321         * call.c (set_up_extended_ref_temp): Call cp_fully_fold.
2323         PR c++/84936 - ICE with unexpanded pack in mem-initializer.
2324         * parser.c (cp_parser_mem_initializer_list): Call
2325         check_for_bare_parameter_packs.
2327 2018-04-04  Jakub Jelinek  <jakub@redhat.com>
2329         PR inline-asm/85172
2330         * constexpr.c (cxx_eval_builtin_function_call): For calls to
2331         builtin_valid_in_constant_expr_p functions, don't call
2332         cxx_eval_constant_expression if argument is not
2333         potential_constant_expression.
2335         PR c++/85146
2336         * cp-tree.h (calculate_bases, calculate_direct_bases): Add complain
2337         argument.
2338         * semantics.c (calculate_bases): Add complain argument.  Use
2339         complete_type_or_maybe_complain instead of just complete_type and
2340         return an empty vector if it fails.  Move make_tree_vector () call
2341         after early return.  Formatting fixes.
2342         (calculate_direct_bases): Likewise.  Call release_tree_vector at the
2343         end.
2344         (dfs_calculate_bases_post, calculate_bases_helper): Formatting fixes.
2345         * pt.c (tsubst_pack_expansion): Adjust calculate_bases and
2346         calculate_direct_bases callers, formatting fixes.
2348 2018-04-04  Jason Merrill  <jason@redhat.com>
2350         PR c++/85006 - -fconcepts ICE with A<auto...> return type
2351         * pt.c (tsubst_pack_expansion): Allow unsubstituted auto pack.
2353         PR c++/85200 - ICE with constexpr if in generic lambda.
2354         * tree.c (cp_walk_subtrees): Walk into DECL_EXPR in templates.
2356         PR c++/84221 - bogus -Wunused with attribute and template.
2357         * decl2.c (is_late_template_attribute): Handle unused and used
2358         normally on non-TYPE_DECL.
2360         PR c++/85135 - ICE with omitted template arguments.
2361         * decl.c (grokdeclarator): Catch deduced class type in trailing
2362         return type.
2364         PR c++/85133 - ICE with missing concept initializer.
2365         * decl.c (cp_finish_decl): If a concept initializer is missing, use
2366         true.
2368         PR c++/85118 - wrong error with generic lambda and std::bind.
2369         * call.c (add_template_conv_candidate): Disable if there are any
2370         call operators.
2372         PR c++/85141 - ICE with compound assignment and static member fn.
2373         * typeck.c (cp_build_modify_expr): Call decay_conversion for RHS of
2374         compound assignment.
2376         PR c++/85148 - ICE with 'this' in array NSDMI.
2377         * tree.c (replace_placeholders_r): Use handled_component_p.
2379 2018-04-04  Ville Voutilainen  <ville.voutilainen@gmail.com>
2381         PR c++/65923
2382         * decl.c (grokfndecl): Handle standard UDL diagnostics here..
2383         * parser.c (cp_parser_unqualified_id): ..not here.
2385 2018-04-04  Alexandre Oliva <aoliva@redhat.com>
2387         PR c++/84943
2388         * typeck.c (cp_build_addr_expr_1): Mark FUNCTION_DECL as
2389         used.
2390         * decl2.c (mark_used): Return without effects if tf_conv.
2392 2018-04-03  Jason Merrill  <jason@redhat.com>
2394         PR c++/85092 - C++17 ICE with unused list constructor.
2395         * call.c (conv_binds_ref_to_prvalue): Also count ck_identity
2396         from a TARGET_EXPR.
2398         PR c++/85113 - ICE with constexpr and __builtin_constant_p.
2399         * constexpr.c (cxx_eval_builtin_function_call): Only defer
2400         __builtin_constant_p if ctx->quiet.
2402 2018-04-03  Paolo Carlini  <paolo.carlini@oracle.com>
2404         PR c++/84768
2405         * pt.c (rewrite_template_parm): If the first argument is
2406         error_mark_node return it immediately.
2407         (build_deduction_guide): Check the return value of the
2408         latter for error_mark_node.
2409         (do_class_deduction): Check the return value of the latter.
2411 2018-04-03  Jason Merrill  <jason@redhat.com>
2413         * semantics.c (finish_if_stmt_cond): Use
2414         instantiation_dependent_expression_p.
2416         PR c++/85149 - generic lambda and constexpr if.
2417         * pt.c (build_extra_args, add_extra_args): Split from
2418         tsubst_pack_expansion.
2419         (tsubst_expr) [IF_STMT]: Use them.
2420         * cp-tree.h (IF_STMT_EXTRA_ARGS): New.
2422         * typeck.c (merge_types): Limit matching attribute shortcut to
2423         the default case.
2425 2018-04-03  Jakub Jelinek  <jakub@redhat.com>
2427         PR c++/85147
2428         * pt.c (fixed_parameter_pack_p_1): Punt if parm is error_mark_node.
2430         PR c++/85140
2431         * name-lookup.c (handle_namespace_attrs): Return early if attributes
2432         is error_mark_node.
2434         PR c++/85134
2435         * decl.c (cp_finish_decl): If ensure_literal_type_for_constexpr_object
2436         fails, after clearing DECL_DECLARED_CONSTEXPR_P don't return early,
2437         instead for static data members clear init and set DECL_EXTERNAL.
2439 2018-04-02  Jason Merrill  <jason@redhat.com>
2441         PR c++/64095 - auto... parameter pack.
2442         * parser.c (cp_parser_parameter_declaration): Handle turning autos
2443         into packs here.
2444         (cp_parser_parameter_declaration_list): Not here.
2446 2018-03-31  Alexandre Oliva <aoliva@redhat.com>
2448         PR c++/85027
2449         * class.c (instantiate_type): Peel off SAVE_EXPR before
2450         BASELINK.
2452 2018-03-30  Jason Merrill  <jason@redhat.com>
2454         * typeck2.c (process_init_constructor_record): Use
2455         init_list_type_node for the CONSTRUCTOR around an anonymous union
2456         designated initializer.
2458 2018-03-30  Jakub Jelinek  <jakub@redhat.com>
2460         PR c++/84791
2461         * semantics.c (finish_omp_reduction_clause): If
2462         OMP_CLAUSE_REDUCTION_PLACEHOLDER is error_mark_node, return true
2463         even if processing_template_decl.
2465 2018-03-29  David Malcolm  <dmalcolm@redhat.com>
2467         PR c++/84269
2468         * name-lookup.c (get_std_name_hint): Add names from <memory>,
2469         <tuple>, and <utility>.
2471 2018-03-29  Jason Merrill  <jason@redhat.com>
2473         PR c++/85093 - too many template args with pack expansion.
2474         * pt.c (coerce_template_parms): Keep pack expansion args that will
2475         need to be empty.
2477 2018-03-29  Jason Merrill  <jason@redhat.com>
2479         * pt.c (build_non_dependent_expr): Propagate expr location.
2481 2018-03-27  Jason Merrill  <jason@redhat.com>
2483         PR c++/85060 - wrong-code with call to base member in template.
2484         * search.c (any_dependent_bases_p): Check uses_template_parms
2485         rather than processing_template_decl.
2487 2018-03-29  David Malcolm  <dmalcolm@redhat.com>
2489         PR c++/85110
2490         * typeck.c (convert_for_assignment): When complaining due to
2491         conversions for an argument, attempt to use the location of the
2492         argument.
2494 2018-03-28  Paolo Carlini  <paolo.carlini@oracle.com>
2496         PR c++/85028
2497         * pt.c (tsubst_default_argument): Early return if the type of the
2498         parameter is erroneous.
2500 2018-03-28  Alexandre Oliva <aoliva@redhat.com>
2502         PR c++/84973
2503         * decl2.c (note_vague_linkage_fn): Don't defer uninstantiated
2504         templates.
2506         PR c++/84968
2507         * tree.c (strip_typedefs_expr): Reject STATEMENT_LISTs.
2509 2018-03-27  Paolo Carlini  <paolo.carlini@oracle.com>
2511         PR c++/85067
2512         * method.c (defaulted_late_check): Partially revert r253321 changes,
2513         do not early return upon error.
2515 2018-03-27  Jakub Jelinek  <jakub@redhat.com>
2517         PR c++/85077
2518         * cp-gimplify.c (cp_fold) <case CONSTRUCTOR>: For ctors with vector
2519         type call fold to generate VECTOR_CSTs when possible.
2521         PR c++/85076
2522         * tree.c (cp_build_reference_type): If to_type is error_mark_node,
2523         return it right away.
2525 2018-03-27  Volker Reichelt  <v.reichelt@netcologne.de>
2527         * search.c (check_final_overrider): Use inform instead of error
2528         for the diagnostics of the overridden functions.  Tweak wording.
2530 2018-03-27  Jakub Jelinek  <jakub@redhat.com>
2532         PR c++/85068
2533         * class.c (update_vtable_entry_for_fn): Don't ICE if base_binfo
2534         is NULL.  Assert if thunk_binfo is NULL then errorcount is non-zero.
2536 2018-03-27  Paolo Carlini  <paolo.carlini@oracle.com>
2537             Jason Merrill  <jason@redhat.com>
2539         PR c++/84632
2540         * init.c (build_aggr_init): When initializing from array,
2541         reject anything but CONSTRUCTORs and TARGET_EXPRs.
2542         (build_vec_init): Handle separately ARRAY_TYPEs.
2544 2018-03-26  Jason Merrill  <jason@redhat.com>
2546         PR c++/85062 - ICE with alignas in wrong place.
2547         * decl.c (grokdeclarator): Ignore attributes on type-specifiers
2548         here.
2550         PR c++/85049 - ICE with __integer_pack.
2551         * pt.c (unify_pack_expansion): Don't try to deduce generated packs.
2552         * cp-tree.h (TEMPLATE_PARM_P): New.
2554 2018-03-23  Jason Merrill  <jason@redhat.com>
2556         PR c++/78489 - wrong SFINAE behavior.
2558         PR c++/84489
2559         * pt.c (type_unification_real): Don't defer substitution failure.
2561 2018-03-23  Jakub Jelinek  <jakub@redhat.com>
2563         PR c++/85015
2564         * decl.c (compute_array_index_type): Set osize to mark_rvalue_use
2565         result.
2567         PR c++/84942
2568         * pt.c (tsubst_copy_and_build) <case FIX_TRUNC_EXPR>: Replace
2569         cp_build_unary_op call with gcc_unreachable ().
2571 2018-03-23  Marek Polacek  <polacek@redhat.com>
2573         PR c++/85045
2574         * cxx-pretty-print.c (cxx_pretty_printer::multiplicative_expression):
2575         Handle EXACT_DIV_EXPR and RDIV_EXPR.  Tweak condition.
2576         (cxx_pretty_printer::expression): Handle EXACT_DIV_EXPR and RDIV_EXPR.
2578 2018-03-23  Ville Voutilainen  <ville.voutilainen@gmail.com>
2580         Implement P0962
2581         * parser.c (cp_parser_perform_range_for_lookup): Change
2582         the condition for deciding whether to use members.
2584 2018-03-23  Marek Polacek  <polacek@redhat.com>
2586         PR c++/85033
2587         * semantics.c (finish_offsetof): Don't allow CONST_DECLs.
2589 2018-03-23  Alexandre Oliva <aoliva@redhat.com>
2591         PR c++/71251
2592         * parser.c (cp_parser_alias_declaration): Call
2593         parser_check_template_parameters.
2595         PR c++/84789
2596         * pt.c (resolve_typename_type): Drop assert that stopped
2597         simplification to template-independent types.  Add assert to
2598         verify the initial scope is template dependent.
2599         * parser.c (cp_parser_parse_and_diagnose_invalid_type_name):
2600         Reparse the id expression as a type-name, not a declarator.
2602         PR c++/84729
2603         * init.c (build_vec_init): Error at parenthesized array init.
2605         PR c++/84610
2606         PR c++/84642
2607         PR c++/84942
2608         * cp-tree.h (temp_override): New template class, generalizing
2609         a cleanup that was only used...
2610         * parser.c (cp_parser_parameter_declaration_clause):
2611         ... here for auto_is_implicit_function_template_parm_p.
2612         (cp_parser_gnu_attributes_opt): Use it here as well.
2613         (cp_parser_std_attribute): Likewise.
2615 2018-03-22  Marek Polacek  <polacek@redhat.com>
2617         PR c++/84854
2618         * semantics.c (finish_if_stmt_cond): Check if the type of the condition
2619         is boolean.
2621 2018-03-21  Jason Merrill  <jason@redhat.com>
2623         PR c++/81311 - wrong C++17 overload resolution.
2624         * call.c (build_user_type_conversion_1): Remove C++17 code.
2625         (conv_binds_ref_to_prvalue): New.
2626         (build_over_call): Handle C++17 copy elision.
2627         (build_special_member_call): Only do C++17 copy elision here if the
2628         argument is already the right type.
2630 2018-03-21  Alexandre Oliva <aoliva@redhat.com>
2632         PR c++/71965
2633         * init.c (build_vec_init): Silence error, former sorry,
2634         without tf_error.
2636         PR c++/84610
2637         PR c++/84642
2638         * parser.c (abort_fully_implicit_template_p): New.
2639         (cp_parser_skip_to_end_of_statement): Use it.
2640         (cp_parser_skip_to_end_of_block_or_statement): Likewise.
2641         (finish_fully_implicit_template_p): Clear
2642         implicit_template_parms and implicit_template_scope.
2644 2018-03-21  Paolo Carlini  <paolo.carlini@oracle.com>
2646         PR c++/84972
2647         * decl.c (maybe_deduce_size_from_array_init): Set TREE_TYPE to
2648         error_mark_node when check_array_designated_initializer fails.
2650 2018-03-21  Jakub Jelinek  <jakub@redhat.com>
2652         PR c++/84961
2653         * cp-tree.h (genericize_compound_lvalue): Declare.
2654         * typeck.c (genericize_compound_lvalue): New function.
2655         (unary_complex_lvalue, cp_build_modify_expr): Use it.
2656         * semantics.c (finish_asm_stmt): Replace MODIFY_EXPR, PREINCREMENT_EXPR
2657         and PREDECREMENT_EXPR in output and "m" constrained input operands with
2658         COMPOUND_EXPR.  Call cxx_mark_addressable on the rightmost
2659         COMPOUND_EXPR operand.
2661 2018-03-21  Nathan Sidwell  <nathan@acm.org>
2663         PR c++/85008
2664         * tree.c (decl_linkage): Use DECL_CLONED_FUNCTION_P.
2665         * decl2.c (vague_linkage_p): Likewise.
2667 2018-03-21  David Malcolm  <dmalcolm@redhat.com>
2669         PR c++/84994
2670         * constexpr.c (constexpr_fn_retval): Make non-"static".
2671         * cp-tree.h (constexpr_fn_retval): New decl.
2672         * search.c (direct_accessor_p): Update leading comment.
2673         (reference_accessor_p): Likewise.
2674         (field_accessor_p): Replace check that function body is a
2675         RETURN_EXPR with a call to constexpr_fn_retval.  Fix
2676         indentation of "field_type" decl.
2678 2018-03-21  Nathan Sidwell  <nathan@acm.org>
2680         PR c++/84804
2681         * name-lookup.c (do_pushtag): Permit lambdas to be pushed into
2682         complete classes.
2684 2018-03-21  Martin Sebor  <msebor@redhat.com>
2686         PR c++/84850
2687         * call.c (first_non_public_field): New template and function.
2688         (first_non_trivial_field): New function.
2689         (maybe_warn_class_memaccess): Call them.
2691 2018-03-21  David Malcolm  <dmalcolm@redhat.com>
2693         PR c++/84892
2694         * search.c (field_accessor_p): Use class_of_this_parm rather than
2695         type_of_this_parm, to check that "this" is a "const T *", rather
2696         than a "T *const".
2698 2018-03-21  Nathan Sidwell  <nathan@acm.org>
2700         * class.c (finish_struct_anon_r): Refactor, deprecate anything
2701         other than public non-static data members.
2702         * parser.c (cp_parser_init_declarator): Deprecate attributes after
2703         parenthesized initializer.
2705         PR c++/84836
2706         * name-lookup.c (update_binding): Correct logic for local binding
2707         update.
2709 2018-03-21  Marek Polacek  <polacek@redhat.com>
2711         PR c++/71638, ICE with NSDMI and reference.
2712         * constexpr.c (cxx_eval_bare_aggregate): Update constructor's flags
2713         even when we replace an element.
2715 2018-03-20  Marek Polacek  <polacek@redhat.com>
2717         PR c++/84978, ICE with NRVO.
2718         * constexpr.c (cxx_eval_constant_expression): Handle the case when
2719         a RESULT_DECL isn't in the hash map.
2721 2018-03-20  Jason Merrill  <jason@redhat.com>
2723         PR c++/84978, ICE with NRVO.
2724         * cvt.c (cp_get_fndecl_from_callee): Add fold parameter.
2725         (cp_get_callee_fndecl_nofold): New.
2726         * cp-gimplify.c (cp_genericize_r): Use it instead.
2727         * call.c (check_self_delegation): Likewise.
2729 2018-03-20  Nathan Sidwell  <nathan@acm.org>
2731         PR c++/84962
2732         * name-lookup.c (pushdecl_class_level): Push anon-struct's
2733         member_vec, if there is one.
2735         PR c++/84970
2736         * cp-tree.h (lookup_list_keep): Declare.
2737         * tree.c (lookup_list_keep): New, broken out of ...
2738         (build_min): ... here.  Call it.
2739         * decl.c (cp_finish_decl): Call lookup_list_keep.
2741 2018-03-19  Jason Merrill  <jason@redhat.com>
2743         PR c++/84937 - ICE with class deduction and auto.
2744         * pt.c (rewrite_template_parm): Fix auto handling.
2746 2018-03-19  Marek Polacek  <polacek@redhat.com>
2748         PR c++/84925
2749         * pt.c (enclosing_instantiation_of): Check if fn is null.
2751         PR c++/84927
2752         * constexpr.c (cxx_eval_bare_aggregate): Update constructor's flags
2753         as we evaluate the elements.
2754         (cxx_eval_constant_expression): Verify constructor's flags
2755         unconditionally.
2757 2018-03-19  Jason Merrill  <jason@redhat.com>
2759         PR c++/71834 - template-id with too few arguments.
2760         * pt.c (coerce_template_parms): Check fixed_parameter_pack_p.
2762 2018-03-19  Nathan Sidwell  <nathan@acm.org>
2764         PR c++/84835
2765         * lambda.c (maybe_add_lambda_conv_op): Force C++ linkage.
2766         * pt.c (build_template_decl): Propagate language linkage.
2768         PR c++/84812
2769         * name-lookup.c (set_local_extern_decl_linkage): Defend against
2770         ambiguous lookups.
2772 2018-03-16  Jakub Jelinek  <jakub@redhat.com>
2774         PR c/84910
2775         * parser.c (cp_parser_lambda_introducer): Remove trailing space from
2776         diagnostics.
2777         * method.c (synthesize_method): Likewise.
2778         * pt.c (convert_nontype_argument): Likewise.
2780 2018-03-16  Jason Merrill  <jason@redhat.com>
2782         PR c++/84720 - ICE with rvalue ref non-type argument.
2783         * pt.c (invalid_nontype_parm_type_p): Prohibit rvalue reference.
2784         (convert_nontype_argument): Revert earlier change.
2786         PR c++/80227 - SFINAE and negative array size.
2787         * decl.c (compute_array_index_type): Use
2788         build_converted_constant_expr and valid_constant_size_p.
2790         PR c++/84906 - silent wrong code with ambiguous conversion.
2791         * call.c (build_user_type_conversion_1): Set need_temporary_p on
2792         ambiguous conversion.
2793         (convert_like_real): Check it.
2795         PR c++/83937 - wrong C++17 handling of init-list ctor argument.
2796         * call.c (build_special_member_call): Don't convert an init-list
2797         argument directly to the class type.
2799 2018-03-16  Jakub Jelinek  <jakub@redhat.com>
2801         PR c++/79937
2802         PR c++/82410
2803         * cp-tree.h (CONSTRUCTOR_PLACEHOLDER_BOUNDARY): Define.
2804         (find_placeholder): Declare.
2805         * tree.c (struct replace_placeholders_t): Add exp member.
2806         (replace_placeholders_r): Don't walk into ctors with
2807         CONSTRUCTOR_PLACEHOLDER_BOUNDARY flag set, unless they are equal to
2808         d->exp.  Replace PLACEHOLDER_EXPR with unshare_expr (x) rather than x.
2809         (replace_placeholders): Initialize data.exp.
2810         (find_placeholders_r, find_placeholders): New functions.
2811         * typeck2.c (process_init_constructor_record,
2812         process_init_constructor_union): Set CONSTRUCTOR_PLACEHOLDER_BOUNDARY
2813         if adding NSDMI on which find_placeholder returns true.
2814         * call.c (build_over_call): Don't call replace_placeholders here.
2815         * cp-gimplify.c (cp_genericize_r): Set TARGET_EXPR_NO_ELIDE on
2816         TARGET_EXPRs with CONSTRUCTOR_PLACEHOLDER_BOUNDARY set on
2817         TARGET_EXPR_INITIAL.
2818         (cp_fold): Copy over CONSTRUCTOR_PLACEHOLDER_BOUNDARY bit to new
2819         ctor.
2821 2018-03-16  Jason Merrill  <jason@redhat.com>
2823         PR c++/83911 - ICE with multiversioned constructor.
2824         * cp-gimplify.c (cp_genericize_r): Replace versioned function with
2825         dispatchere here.
2826         * call.c (build_over_call): Not here.
2828 2018-03-16  Jakub Jelinek  <jakub@redhat.com>
2830         PR c++/84874
2831         * decl.c (reshape_init_class): Don't assert d->cur->index == field
2832         if d->cur->index is a FIELD_DECL, instead set field to d->cur->index.
2834 2018-03-15  Jakub Jelinek  <jakub@redhat.com>
2836         PR c++/84222
2837         * cp-tree.h (cp_warn_deprecated_use): Declare.
2838         * tree.c (cp_warn_deprecated_use): New function.
2839         * typeck2.c (build_functional_cast): Use it.
2840         * decl.c (grokparms): Likewise.
2841         (grokdeclarator): Likewise.  Temporarily push nested class scope
2842         around grokparms call for out of class member definitions.
2844 2018-03-14  Jason Merrill  <jason@redhat.com>
2846         PR c++/84820 - no error for invalid qualified-id.
2847         * parser.c (cp_parser_make_indirect_declarator): Don't wrap
2848         cp_error_declarator.
2850         PR c++/84801 - ICE with unexpanded pack in lambda.
2851         * pt.c (check_for_bare_parameter_packs): Don't return early for a
2852         lambda in non-template context.
2854         PR c++/81236 - auto variable and auto function
2855         * pt.c (tsubst_baselink): Update the type of the BASELINK after
2856         mark_used.
2858 2018-03-14  Jason Merrill  <jason@redhat.com>
2860         PR c++/83916 - ICE with template template parameters.
2861         * pt.c (convert_template_argument): Don't substitute into type of
2862         non-type parameter if we don't have enough arg levels.
2863         (unify): Likewise.
2865 2018-03-14  Marek Polacek  <polacek@redhat.com>
2867         PR c++/84596
2868         * semantics.c (finish_static_assert): Check
2869         instantiation_dependent_expression_p instead of
2870         {type,value}_dependent_expression_p.
2872 2018-03-13  Paolo Carlini  <paolo.carlini@oracle.com>
2873             Jason Merrill  <jason@redhat.com>
2875         PR c++/82336 - link error with list-init default argument.
2876         * decl.c (check_default_argument): Unshare an initializer list.
2878 2018-03-13  Jakub Jelinek  <jakub@redhat.com>
2880         PR c++/84843
2881         * decl.c (duplicate_decls): For redefinition of built-in, use error
2882         and return error_mark_node.  For redeclaration, return error_mark_node
2883         rather than olddecl if !flag_permissive.
2885 2018-03-13  Jason Merrill  <jason@redhat.com>
2887         PR c++/82565 - ICE with concepts and generic lambda.
2888         * pt.c (instantiate_decl): Clear fn_context for lambdas.
2890 2018-03-13  Jason Merrill  <jason@redhat.com>
2892         PR c++/84720 - ICE with rvalue ref non-type argument.
2893         * pt.c (convert_nontype_argument): Handle rvalue references.
2895         PR c++/84839 - ICE with decltype of parameter pack.
2896         * pt.c (tsubst_pack_expansion): Set cp_unevaluated_operand while
2897         instantiating dummy parms.
2899         * parser.c (cp_parser_simple_type_specifier): Pedwarn about auto
2900         parameter even without -Wpedantic.
2902         PR c++/84798 - ICE with auto in abstract function declarator.
2903         * parser.c (cp_parser_parameter_declaration_clause): Check
2904         parser->default_arg_ok_p.
2906 2018-03-13  Jakub Jelinek  <jakub@redhat.com>
2908         PR c++/84808
2909         * constexpr.c (find_array_ctor_elt): Don't use elt reference after
2910         first potential CONSTRUCTOR_ELTS reallocation.  Convert dindex to
2911         sizetype.  Formatting fixes.
2913 2018-03-12  Jason Merrill  <jason@redhat.com>
2915         PR c++/84355 - ICE with deduction for member class template.
2916         * pt.c (tsubst) [TEMPLATE_TYPE_PARM]: Always substitute into
2917         CLASS_PLACEHOLDER_TEMPLATE.
2919         PR c++/84802 - ICE capturing uninstantiated class.
2920         * lambda.c (build_capture_proxy): Call complete_type.
2922 2018-03-09  Jason Merrill  <jason@redhat.com>
2924         PR c++/84770 - ICE with typedef and parameter pack.
2925         * pt.c (verify_unstripped_args_1): Split out from
2926         verify_unstripped_args.
2928         PR c++/84785 - ICE with alias template and default targs.
2929         * pt.c (type_unification_real): Set processing_template_decl if
2930         saw_undeduced == 1.
2932         PR c++/84752 - ICE with capture of constexpr array.
2933         * call.c (standard_conversion): Set rvaluedness_matches_p on the
2934         identity conversion under ck_lvalue.
2936 2018-03-09  Jason Merrill  <jason@redhat.com>
2937             Paolo Carlini  <paolo.carlini@oracle.com>
2939         PR c++/71169
2940         PR c++/71832
2941         * pt.c (any_erroneous_template_args_p): New.
2942         * cp-tree.h (any_erroneous_template_args_p): Declare it.
2943         * parser.c (cp_parser_class_specifier_1): Use it.
2945 2018-03-09  Jason Merrill  <jason@redhat.com>
2947         PR c++/84726 - unnecessary capture of constant vars.
2948         * cp-tree.h (LAMBDA_CAPTURE_EXPLICIT_P)
2949         (LAMBDA_EXPR_CAPTURE_OPTIMIZED): New.
2950         * expr.c (mark_use): Set LAMBDA_EXPR_CAPTURE_OPTIMIZED.
2951         * lambda.c (is_constant_capture_proxy)
2952         (current_lambda_expr, var_to_maybe_prune, mark_const_cap_r)
2953         (prune_lambda_captures): New.
2954         (finish_lambda_function): Call prune_lambda_captures.
2956 2018-03-09  Jason Merrill  <jason@redhat.com>
2957             Jakub Jelinek  <jakub@redhat.com>
2959         PR c++/84076
2960         * call.c (convert_arg_to_ellipsis): Instead of cp_build_addr_expr
2961         build ADDR_EXPR with REFERENCE_TYPE.
2962         (build_over_call): For purposes of check_function_arguments, if
2963         argarray[j] is ADDR_EXPR with REFERENCE_TYPE created above, use
2964         its operand rather than the argument itself.
2966 2018-03-09  Jakub Jelinek  <jakub@redhat.com>
2968         PR c++/84724
2969         * decl.c (duplicate_decls): Don't override __* prefixed builtins
2970         except for __[^b]*_chk, instead issue permerror and for -fpermissive
2971         also a note and return olddecl.
2973 2018-03-09  Nathan Sidwell  <nathan@acm.org>
2975         PR c++/84733
2976         * name-lookup.c (do_pushdecl_with_scope): Only clear
2977         current_function_decl when pushing a non-class (i.e. namespace)
2978         scope.
2980 2018-03-08  Jason Merrill  <jason@redhat.com>
2981             Jakub Jelinek  <jakub@redhat.com>
2983         PR c++/80598
2984         * call.c (build_over_call): In templates set TREE_USED (first_fn) when
2985         not calling mark_used for the benefit of -Wunused-function warning.
2987 2018-03-06  Jason Merrill  <jason@redhat.com>
2989         * lambda.c (is_capture_proxy_with_ref): Remove.
2990         * constexpr.c, expr.c, cp-tree.h, semantics.c: Adjust.
2992 2018-03-06  Marek Polacek  <polacek@redhat.com>
2994         PR c++/84684
2995         * constexpr.c (cxx_bind_parameters_in_call): Unshare evaluated
2996         arguments.
2998 2018-03-06  Alexandre Oliva <aoliva@redhat.com>
3000         PR c++/84231
3001         * tree.c (lvalue_kind): Use presence/absence of REFERENCE_TYPE
3002         only while processing template decls.
3003         * typeck.c (build_x_conditional_expr): Move wrapping of
3004         reference type around type...
3005         * call.c (build_conditional_expr_1): ... here.  Rename
3006         is_lvalue to is_glvalue.
3007         * parser.c (cp_parser_fold_expression): Catch REFERENCE_REF_P
3008         INDIRECT_REF of COND_EXPR too.
3010         PR c++/84593
3011         * init.c (build_zero_init_1): Zero-initialize references.
3013         PR c++/84492
3014         * semantics.c (finish_stmt_expr_expr): Reject unresolved
3015         overloads used as stmt expr values.
3017 2018-03-05  Jason Merrill  <jason@redhat.com>
3019         PR c++/84708 - ICE with lambda in local class NSDMI.
3020         * lambda.c (lambda_expr_this_capture): Handle local class NSDMI
3021         context.
3023 2018-03-05  Jakub Jelinek  <jakub@redhat.com>
3025         PR c++/84684
3026         * constexpr.c (constexpr_call_hasher::equal): Return false if
3027         lhs->hash != rhs->hash.  Change return 1 to return true and
3028         return 0 to return false.
3030 2018-03-05  Nathan Sidwell  <nathan@acm.org>
3032         PR c++/84702
3033         * pt.c (process_template_arg): Mark lookup_keep on a default arg.
3035 2018-03-05  Marek Polacek  <polacek@redhat.com>
3037         PR c++/84707
3038         * decl.c (duplicate_decls): Check DECL_NAME before accessing
3039         UDLIT_OPER_P.
3041 2018-03-05  Nathan Sidwell  <nathan@acm.org>
3043         PR c++/84694
3044         * friend.c (do_friend): Restore check for identifier_p inside
3045         TEMPLATE_ID_EXPR.
3047 2018-03-05  Paolo Carlini  <paolo.carlini@oracle.com>
3049         PR c++/84618
3050         * parser.c (cp_parser_lambda_introducer): Reject any capture not
3051         involving a VAR_DECL or a PARM_DECL.
3053 2018-03-05  Pádraig Brady  <P@draigBrady.com>
3054             Jason  Merrill  <jason@redhat.com>
3055             Nathan Sidwell  <nathan@acm.org>
3057         PR c++/84497
3058         * decl2.c (get_tls_init_fn): Check TYPE_HAS_TRIVIAL_DFLT too.
3060 2018-03-03  Jason Merrill  <jason@redhat.com>
3062         PR c++/84686 - missing volatile loads.
3063         * cvt.c (convert_to_void): Call maybe_undo_parenthesized_ref.
3065 2018-03-03  Paolo Carlini  <paolo.carlini@oracle.com>
3067         PR c++/71464
3068         * optimize.c (maybe_thunk_body): Bail out immediately if either
3069         fns[0] or fns[1] is null.
3071 2018-03-02  Marek Polacek  <polacek@redhat.com>
3073         PR c++/84578
3074         * constexpr.c (get_array_or_vector_nelts): New.
3075         (cxx_eval_array_reference): Use it.
3076         (cxx_eval_vec_init_1): Likewise.
3077         (cxx_eval_store_expression): Likewise.
3079 2018-03-02  Jason Merrill  <jason@redhat.com>
3081         * semantics.c (force_paren_expr): Remove redundant test.
3083 2018-03-02  Marek Polacek  <polacek@redhat.com>
3085         PR c++/84663
3086         * decl.c (cp_complete_array_type): Check error_mark_node.
3088         PR c++/84664
3089         * typeck.c (cp_perform_integral_promotions): Check the result of
3090         mark_rvalue_use.
3092 2018-03-02  Jakub Jelinek  <jakub@redhat.com>
3094         PR c++/84662
3095         * pt.c (tsubst_copy_and_build) <case TEMPLATE_ID_EXPR>: Use
3096         RETURN instead of return.
3097         <case POINTER_PLUS_EXPR>: Likewise.
3098         <case CONVERT_EXPR>: If op0 is error_mark_node, just return
3099         it instead of wrapping it into CONVERT_EXPR.
3101 2018-03-02  Jason Merrill  <jason@redhat.com>
3103         Fix MIPS16 ICE.
3104         * pt.c (type_dependent_expression_p): Check DECL_LANG_SPECIFIC.
3106 2018-03-02  Marek Polacek  <polacek@redhat.com>
3108         PR c++/84590
3109         * cp-gimplify.c (cp_fully_fold): Unwrap TARGET_EXPR or a CONSTRUCTOR
3110         wrapped in VIEW_CONVERT_EXPR.
3112 2018-03-01  Martin Sebor  <msebor@redhat.com>
3114         PR c++/84294
3115         * decl.c (check_redeclaration_no_default_args): Merge attributes
3116         specified on redeclarations of the same function template.
3117         Remove dead code.
3119 2018-03-01  Marek Polacek  <polacek@redhat.com>
3120             Jason Merrill  <jason@redhat.com>
3122         PR c++/84582
3123         * semantics.c (force_paren_expr): Create a PAREN_EXPR when in
3124         a template.
3125         (maybe_undo_parenthesized_ref): Unwrap PAREN_EXPR.
3126         * typeck2.c (store_init_value): Call fold_non_dependent_expr instead
3127         of instantiate_non_dependent_expr.
3128         * tree.c (lvalue_kind): Handle PAREN_EXPR like NON_DEPENDENT_EXPR.
3130 2018-03-01  Nathan Sidwell  <nathan@acm.org>
3132         PR c++/84434
3133         * name-lookup.c (member_vec_dedup): Remove manually peeled
3134         iteration.  Ignore dependent ctor inheritance.
3136 2018-03-01  Jason Merrill  <jason@redhat.com>
3138         PR c++/71569 - decltype of template.
3139         * parser.c (cp_parser_decltype_expr): Handle missing template args.
3141 2018-03-01  Marek Polacek  <polacek@redhat.com>
3143         PR c++/84596
3144         * constexpr.c (require_rvalue_constant_expression): New function.
3145         * cp-tree.h: Declare it.
3146         * semantics.c (finish_static_assert): Use it instead of
3147         require_potential_rvalue_constant_expression.
3149 2018-03-01  Jason Merrill  <jason@redhat.com>
3150             Alexandre Oliva <aoliva@redhat.com>
3152         PR c++/71569 - ICE with redundant args on member variable template.
3153         * decl.c (start_decl): Handle partial specialization of member
3154         variable template.
3155         * pt.c (determine_specialization): Allow partial specialization
3156         of member variable template without specializing enclosing class.
3157         (process_partial_specialization): Improve error message.
3159 2018-02-28  Jason Merrill  <jason@redhat.com>
3161         PR c++/71784 - ICE with ref-qualifier and explicit specialization.
3162         * pt.c (determine_specialization): Check ref-qualifier.
3164 2018-02-28  Jakub Jelinek  <jakub@redhat.com>
3166         PR c++/84609
3167         * parser.c (cp_parser_attributes_opt): Formatting fix.
3168         (cp_parser_skip_balanced_tokens, cp_parser_skip_gnu_attributes_opt,
3169         cp_parser_skip_std_attribute_spec_seq, cp_parser_skip_attributes_opt):
3170         New functions.
3171         (cp_parser_member_declaration): Use cp_parser_skip_attributes_opt
3172         instead of tentative parse to peek over optional attribute tokens
3173         to check for CPP_COLON after them.
3175         PR c++/83871
3176         PR c++/83503
3177         * pt.c (INCLUDE_STRING): Remove define.
3178         (warn_spec_missing_attributes): Use pretty_printer instead of
3179         std::string.  Fix up inform call so that the list of attributes
3180         is in %s argument.
3182 2018-02-28  Martin Sebor  <msebor@redhat.com>
3184         PR testsuite/84617
3185         * decl.c (duplicate_decls): Fully merge attributes const, pure,
3186         and malloc.
3188 2018-02-28  Nathan Sidwell  <nathan@acm.org>
3190         PR c++/84602
3191         * name-lookup.h (search_anon_aggr): Add defaulted WANT_TYPE arg.
3192         * name-lookup.c (fields_linear_search): Look in an anon-aggr
3193         regardless of want_type.
3194         (search_anon_aggr): Just use get_class_binding_direct.
3196 2018-02-28  Jakub Jelinek  <jakub@redhat.com>
3198         * decl.c (cp_finish_decomp): Don't adjust eltscnt when calling
3199         inform_n.
3201 2018-02-27  Martin Sebor  <msebor@redhat.com>
3203         * pt.c: Avoid including <string> directly.
3205 2018-02-27  Martin Sebor  <msebor@redhat.com>
3207         PR c++/83871
3208         PR c++/83503
3209         * cp-tree.h (warn_spec_missing_attributes): New function.
3210         ((check_explicit_specialization): Add an argument.  Call the above
3211         function.
3212         * decl.c (duplicate_decls): Avoid applying primary function template's
3213         attributes to its explicit specializations.
3214         cp/pt.c (warn_spec_missing_attributes): Define.
3216 2018-02-27  HÃ¥kon Sandsmark  <hsandsmark@gmail.com>
3218         PR c++/71546 - lambda init-capture with qualified-id.
3219         * parser.c (cp_parser_lambda_introducer): Clear scope after
3220         each lambda capture.
3222 2018-02-27  Nathan Sidwell  <nathan@acm.org>
3224         PR c++/84426
3225         * name-lookup.h (get_member_slot): Rename ...
3226         (find_member_slot): ... here.
3227         (add_member_slot): New.
3228         * name-lookup.c (member_vec_linear_search): No need to check for
3229         NULL slot.
3230         (get_member_slot): Rename ...
3231         (find_member_slot): ... here.  Don't add slot for incomplete class.
3232         (add_member_slot): New.
3233         * class.c (add_method): Adjust get_member_slot rename.  Bail out
3234         if push_class_level_binding fails.  Create slot and grok
3235         properties once we're committed to insertion.
3237 2018-02-27  Jason Merrill  <jason@redhat.com>
3239         PR c++/84489 - dependent default template argument
3240         * pt.c (type_unification_real): Handle early substitution failure.
3242 2018-02-26  Jason Merrill  <jason@redhat.com>
3244         PR c++/84560 - ICE capturing multi-dimensional VLA.
3245         * tree.c (array_of_runtime_bound_p): False if the element is
3246         variably-modified.
3248         PR c++/84441 - ICE with base initialized from ?:
3249         * call.c (unsafe_copy_elision_p): Handle COND_EXPR.
3251         PR c++/84520 - ICE with generic lambda in NSDMI.
3252         * lambda.c (lambda_expr_this_capture): Don't look for fake NSDMI
3253         'this' in a generic lambda instantiation.
3255         PR c++/84559 - ICE with constexpr VLA.
3256         * constexpr.c (ensure_literal_type_for_constexpr_object): Check
3257         for constexpr variable with VLA type.
3259 2018-02-26  Jakub Jelinek  <jakub@redhat.com>
3261         PR c++/84558
3262         * constexpr.c (cxx_eval_vec_init_1): For reuse, treat NULL eltinit like
3263         a valid constant initializer.  Formatting fixes.
3265 2018-02-26  Paolo Carlini  <paolo.carlini@oracle.com>
3267         PR c++/84540
3268         * pt.c (tsubst_attributes): Handle correctly tsubst_attribute
3269         returning NULL_TREE.
3270         (apply_late_template_attributes): Likewise.
3272 2018-02-26  Jakub Jelinek  <jakub@redhat.com>
3274         PR c++/84557
3275         * parser.c (cp_parser_omp_var_list_no_open): Only call
3276         cp_parser_lookup_name_simple on names satisfying identifier_p.
3277         (cp_parser_oacc_routine): Likewise.
3279 2018-02-26  Jason Merrill  <jason@redhat.com>
3281         PR c++/84551 - ICE with concepts and -g.
3282         * parser.c (add_debug_begin_stmt): Do nothing in a concept.
3284 2018-02-26  Marek Polacek  <polacek@redhat.com>
3286         PR c++/84325
3287         * tree.c (replace_placeholders_r): Only check TREE_CONSTANT on
3288         non-types.
3290 2018-02-26  Jason Merrill  <jason@redhat.com>
3292         PR c++/84447 - ICE with deleted inherited ctor with default arg.
3293         * call.c (build_over_call): Handle deleted functions in one place.
3295 2018-02-26  Paolo Carlini  <paolo.carlini@oracle.com>
3297         PR c++/84533
3298         * decl.c (redeclaration_error_message): Don't try to use
3299         DECL_DECLARED_CONSTEXPR_P on CONST_DECLs.
3301 2018-02-26  Paolo Carlini  <paolo.carlini@oracle.com>
3303         * lambda.c (build_capture_proxy): Define static.
3304         * cp-tree.h (build_capture_proxy): Remove.
3306 2018-02-26  Marek Polacek  <polacek@redhat.com>
3308         PR c++/84537
3309         * name-lookup.c (suggest_alternative_in_explicit_scope): Return false
3310         if name is error node.
3312 2018-02-25  Jason Merrill  <jason@redhat.com>
3314         PR c++/84015 - ICE with class deduction and auto template parm.
3315         * pt.c (rewrite_template_parm): Use tf_partial in first tsubst.
3317 2018-02-24  Marek Polacek  <polacek@redhat.com>
3319         PR c++/83692
3320         * constexpr.c (maybe_constant_init_1): New function.
3321         (maybe_constant_init): Make it a wrapper around maybe_constant_init_1.
3322         (cxx_constant_init): New function.
3323         * cp-tree.h (cxx_constant_init): Declare.
3324         * typeck2.c (store_init_value): Call cxx_constant_init instead of
3325         cxx_constant_value.  Move the maybe_constant_init call under an 'else'.
3327 2018-02-22  Jason Merrill  <jason@redhat.com>
3329         PR c++/70468 - ICE with constructor delegation via typedef.
3330         * pt.c (tsubst_initializer_list): Check for other mem-initializers
3331         with constructor delegation.
3333 2018-02-22  Jason Merrill  <jason@redhat.com>
3335         PR c++/84424 - ICE with constexpr and __builtin_shuffle.
3336         * constexpr.c (reduced_constant_expression_p): Handle CONSTRUCTOR of
3337         VECTOR_TYPE.
3339 2018-02-22  Marek Polacek  <polacek@redhat.com>
3341         PR c++/84493
3342         * parser.c (cp_parser_braced_list): Use require_open instead of
3343         consume_open.
3345 2018-02-21  Jason Merrill  <jason@redhat.com>
3347         PR c++/84454 - ICE with pack expansion in signature.
3348         * error.c (find_typenames_r): Also stop on EXPR_PACK_EXPANSION.
3350 2018-02-20  Siddhesh Poyarekar  <siddhesh@sourceware.org>
3352         * cp-objcp-common.c (cxx_block_may_fallthru): Add case for
3353         IF_STMT.
3355 2018-02-20  Paolo Carlini  <paolo.carlini@oracle.com>
3357         PR c++/84446
3358         * parser.c (cp_parser_init_declarator): Don't call start_lambda_scope
3359         on error_mark_node.
3361 2018-02-20  Jakub Jelinek  <jakub@redhat.com>
3363         PR c++/84445
3364         * class.c (fixed_type_or_null) <case CALL_EXPR>: Only test
3365         TREE_HAS_CONSTRUCTOR if instance is not an internal function call.
3367         PR c++/84449
3368         * tree.c (bot_manip): If build_cplus_new or break_out_target_exprs
3369         returns error_mark_node, return it immediately.
3370         (break_out_target_exprs): If cp_walk_tree with bot_manip returns
3371         error_mark_node, return error_mark_node.
3373         PR c++/84455
3374         * pt.c (tsubst_lambda_expr): If not nested, increment temporarily
3375         function_depth to avoid GC during finish_lambda_function.
3377 2018-02-19  Jason Merrill  <jason@redhat.com>
3379         PR c++/84429 - ICE capturing VLA.
3380         * lambda.c (build_capture_proxy): Handle reference refs.
3382 2018-02-19  Jakub Jelinek  <jakub@redhat.com>
3384         PR c++/84448
3385         * parser.c (cp_parser_binary_expression): For no_toplevel_fold_p, if
3386         either operand is error_mark_node, set current.lhs to that instead of
3387         creating a binary op with error_mark_node operands.
3389         PR c++/84430
3390         * constexpr.c (potential_constant_expression_1): Handle OMP_SIMD.
3392 2018-02-19  Paolo Carlini  <paolo.carlini@oracle.com>
3394         PR c++/84348
3395         * decl.c (grokdeclarator): Early return error_mark_node upon
3396         ill-formed friend declaration.
3398 2018-02-16  Marek Polacek  <polacek@redhat.com>
3399             Jakub Jelinek  <jakub@redhat.com>
3401         PR c++/84192
3402         * constexpr.c (cxx_eval_constant_expression) <case RETURN_EXPR>: Don't
3403         set *jump_target to anything if jump_target is NULL.
3405 2018-02-16  Jason Merrill  <jason@redhat.com>
3407         PR c++/84151 - unnecessary volatile load with static member.
3408         * call.c (build_new_method_call_1): Avoid loading from a volatile
3409         lvalue used as the object argument for a static member function.
3411         PR c++/81853 - using-directive and constexpr.
3412         * constexpr.c (cxx_eval_constant_expression): Handle USING_STMT.
3414         PR c++/84420 - ICE with structured binding in lambda.
3415         * lambda.c (is_capture_proxy): Check DECL_DECOMPOSITION_P.
3417         PR c++/83835 - C++17 error with constructor ctors.
3418         * call.c (build_special_member_call): Set TARGET_EXPR_DIRECT_INIT_P.
3420         PR c++/82664 - ICE with reference to function template parm.
3421         * pt.c (convert_nontype_argument_function): Avoid obfuscationg
3422         NOP_EXPRs.
3424         PR c++/82764 - C++17 ICE with empty base
3425         * class.c (build_base_field_1): Set DECL_SIZE to zero for empty base.
3427 2018-02-16  Jason Merrill  <jason@redhat.com>
3429         PR c++/84421 - type-dependent if constexpr
3430         * semantics.c (finish_if_stmt_cond): Check type_dependent_expression_p.
3432 2018-02-16  Nathan Sidwell  <nathan@acm.org>
3434         Deprecate -ffriend-injection.
3435         * decl.c (cxx_init_decl_processing): Emit warning on option.
3436         * name-lookup.c (do_pushdecl): Emit warning if we push a visible
3437         friend.
3439 2018-02-16  Paolo Carlini  <paolo.carlini@oracle.com>
3441         PR c++/82468
3442         * decl.c (check_special_function_return_type): Reject template
3443         template parameter in deduction guide.
3445 2018-02-16  Nathan Sidwell  <nathan@acm.org>
3447         PR c++/84375
3448         * name-lookup.c (do_pushdecl): Bail out on bad local friend injection.
3450 2018-02-15  Jason Merrill  <jason@redhat.com>
3452         PR c++/83227 - C++17 ICE with init-list derived-to-base conversion.
3453         * call.c (convert_like_real): Don't use the copy-list-initialization
3454         shortcut for ck_base.
3456         PR c++/84045 - ICE with typedef and noexcept.
3457         * except.c (build_noexcept_spec): Use strip_typedefs_expr.
3459         PR c++/84376 - ICE with omitted template arguments.
3460         * pt.c (dguide_name_p): Check for IDENTIFIER_NODE.
3462         PR c++/84368 - wrong error with local variable in variadic lambda.
3463         * pt.c (tsubst_pack_expansion): Fix handling of non-packs in
3464         local_specializations.
3466 2018-02-15  Paolo Carlini  <paolo.carlini@oracle.com>
3468         PR c++/84330
3469         * constraint.cc (tsubst_constraint_info): Handle an error_mark_node
3470         as first argument.
3472 2018-02-14  Paolo Carlini  <paolo.carlini@oracle.com>
3474         PR c++/84350
3475         * pt.c (do_auto_deduction): Don't check the TREE_TYPE of a null
3476         init, early return.
3478 2018-02-14  Nathan Sidwell  <nathan@acm.org>
3480         * decl2.c (mark_vtable_entries): Set input_location to decl's.
3481         (c_parse_final_cleanups): Restore input_location after emitting
3482         vtables.
3484 2018-02-14  Paolo Carlini  <paolo.carlini@oracle.com>
3486         * cp-tree.h (do_auto_deduction (tree, tree, tree)): Remove.
3487         (do_auto_deduction (tree, tree, tree, tsubst_flags_t,
3488         auto_deduction_context, tree, int): Add defaults.
3489         * pt.c (do_auto_deduction (tree, tree, tree)): Remove definition.
3490         (tsubst_omp_for_iterator): Adjust do_auto_deduction call, forward
3491         tsubst_flags_t argument.
3492         * init.c (build_new): Likewise.
3494 2018-02-13  Jakub Jelinek  <jakub@redhat.com>
3496         PR c++/84364
3497         * typeck.c (check_return_expr): Don't emit -Weffc++ warning
3498         about return other than *this in assignment operators if
3499         retval is type dependent expression.
3501 2018-02-13  Paolo Carlini  <paolo.carlini@oracle.com>
3503         PR c++/84333
3504         * call.c (build_conditional_expr_1): Use cp_save_expr instead of
3505         save_expr for the G++ extension.
3507 2018-02-13  Jason Merrill  <jason@redhat.com>
3509         PR c++/84080 - ICE with return type deduction and specialization.
3510         * pt.c (determine_specialization): Check uses_template_parms.
3512         Fix more variadic capture issues.
3513         * pt.c (find_parameter_packs_r): Also look at explicit captures.
3514         (check_for_bare_parameter_packs): Check current_class_type for
3515         lambda context.
3516         (extract_locals_r): Handle seeing a full instantiation of a pack.
3517         (tsubst_pack_expansion): Likewise.  Force lambda capture.
3518         * parser.c (cp_parser_lambda_introducer): Don't
3519         check_for_bare_parameter_packs.
3521         PR c++/84338 - wrong variadic sizeof.
3522         * pt.c (argument_pack_select_arg): Like the macro, but look through
3523         a pack expansion.
3524         (tsubst, tsubst_copy, dependent_template_arg_p): Use it.
3525         (extract_fnparm_pack): Do make_pack_expansion.
3526         (extract_locals_r): Do strip a pack expansion.
3527         * cp-tree.h (ARGUMENT_PACK_SELECT_ARG): Remove.
3529 2018-02-12  Jakub Jelinek  <jakub@redhat.com>
3531         PR c++/84341
3532         * parser.c (cp_parser_binary_expression): Use build_min instead of
3533         build2_loc to build the no_toplevel_fold_p toplevel binary expression.
3535 2018-02-12  Nathan Sidwell  <nathan@acm.org>
3537         PR c++/84263
3538         * parser.c (cp_parser_decltype): Push and pop
3539         deferring_access_checks.  Reorganize to avoid goto.
3541 2018-02-12  Richard Biener  <rguenther@suse.de>
3543         PR c++/84281
3544         * constexpr.c (cxx_eval_vec_init_1): Use a RANGE_EXPR to compact
3545         uniform constructors and delay allocating them fully.
3547 2018-02-09  Jason Merrill  <jason@redhat.com>
3549         PR c++/84036 - ICE with variadic capture.
3550         Handle variadic capture proxies more like non-variadic.
3551         * lambda.c (build_capture_proxy): Remove workaround.
3552         * pt.c (find_parameter_packs_r): The proxy is a pack.
3553         (instantiate_class_template_1): Remove dead lambda code.
3554         (extract_fnparm_pack): Don't make_pack_expansion.
3555         (extract_locals_r): Don't strip a pack expansion.
3556         (tsubst_pack_expansion): Handle proxy packs.  Use
3557         PACK_EXPANSION_EXTRA_ARGS less.
3558         (tsubst_decl) [FIELD_DECL]: Don't register_specialization.
3559         (tsubst_copy) [FIELD_DECL]: Don't retrieve*_specialization.
3560         [VAR_DECL]: Handle ARGUMENT_PACK_SELECT.
3561         (tsubst_expr) [DECL_EXPR]: Handle proxy packs.
3562         (tsubst_copy_and_build) [VAR_DECL]: Handle proxy packs normally.
3564 2018-02-10  Jakub Jelinek  <jakub@redhat.com>
3566         PR sanitizer/83987
3567         * tree.c (cp_free_lang_data): Revert 2018-01-23 change.
3569 2018-02-09  Jason Merrill  <jason@redhat.com>
3571         PR c++/81917 - ICE with void_t and partial specialization.
3572         * pt.c (instantiate_class_template_1): Set TYPE_BEING_DEFINED before
3573         calling most_specialized_partial_spec.
3575 2018-02-09  Nathan Sidwell  <nathan@acm.org>
3577         PR c/84293
3578         * typeck.c (cp_build_indirect_ref_1, build_reinterpret_cast_1):
3579         Pass expr location to strict_aliasing_warning.
3581 2018-02-09  Jason Merrill  <jason@redhat.com>
3583         PR c++/84296 - ICE with qualified-id in template.
3584         PR c++/83714
3585         * pt.c (unknown_base_ref_p): New.
3586         (instantiation_dependent_scope_ref_p): Use it instead of
3587         any_dependent_bases_p.
3589 2018-02-09  Marek Polacek  <polacek@redhat.com>
3590             Jakub Jelinek  <jakub@redhat.com>
3592         PR c++/83659
3593         * constexpr.c (cxx_fold_indirect_ref): Sync some changes from
3594         fold_indirect_ref_1, including poly_*int64.  Verify first that
3595         tree_fits_poly_int64_p (op01).  Formatting fixes.
3597 2018-02-08  Paolo Carlini  <paolo.carlini@oracle.com>
3599         * constexpr.c (cxx_eval_component_reference): Use INDIRECT_REF_P.
3600         * lambda.c (build_capture_proxy): Likewise.
3601         * search.c (field_access_p): Likewise.
3602         * semantics.c (omp_clause_decl, omp_privatize_field,
3603         finish_omp_clauses): Likewise.
3605 2018-02-08  Paolo Carlini  <paolo.carlini@oracle.com>
3607         PR c++/83806
3608         * typeck.c (decay_conversion): Use mark_rvalue_use for the special
3609         case of nullptr too.
3611 2018-02-08  Nathan Sidwell  <nathan@acm.org>
3613         * class.c (finish_struct): Fix std:initializer_list diagnostic
3614         formatting.
3616 2018-02-08  Paolo Carlini  <paolo.carlini@oracle.com>
3618         PR c++/83204
3619         * pt.c (tsubst_copy_and_build): Use force_paren_expr for INDIRECT_REF.
3621 2018-02-07  Jakub Jelinek  <jakub@redhat.com>
3623         PR c++/84082
3624         * parser.c (cp_parser_dot_deref_incomplete): New function.
3625         (cp_parser_postfix_dot_deref_expression): Use it.
3627 2018-02-07  David Malcolm  <dmalcolm@redhat.com>
3629         PR c++/81610
3630         PR c++/80567
3631         * name-lookup.c (suggest_rid_p): New function.
3632         (lookup_name_fuzzy): Replace enum-rid-filtering logic with call to
3633         suggest_rid_p.
3635 2018-02-07  Jason Merrill  <jason@redhat.com>
3637         PR c++/84182 - ICE with captured lambda
3638         PR c++/84181
3639         * pt.c (extract_locals_r, extract_local_specs): New.
3640         (tsubst_pack_expansion): Use them.
3642 2018-02-07  Martin Liska  <mliska@suse.cz>
3644         PR c++/84059.
3645         * class.c (add_method): Append argument value.
3646         * cp-tree.h (maybe_version_functions): Add new argument.
3647         * decl.c (decls_match): Call it if a declaration does not
3648         have DECL_FUNCTION_VERSIONED.
3649         (maybe_version_functions): record argument is added.
3651 2018-02-05  Marek Polacek  <polacek@redhat.com>
3653         * class.c: Remove unused global variables.
3654         (build_primary_vtable): Don't gather statistics.
3655         (print_class_statistics): Remove.
3656         * cp-tree.h (print_class_statistics): Remove.
3657         * tree.c (cxx_print_statistics): Don't call print_class_statistics.
3659 2018-02-02  Paolo Carlini  <paolo.carlini@oracle.com>
3661         * class.c (is_really_empty_class): Use DECL_UNNAMED_BIT_FIELD.
3662         * constexpr.c (cx_check_missing_mem_inits): Likewise.
3663         * decl.c (next_initializable_field, find_decomp_class_base,
3664         cp_finish_decomp): Likewise.
3665         * typeck2.c (process_init_constructor_record): Likewise.
3667 2018-02-02  Jason Merrill  <jason@redhat.com>
3669         PR c++/84181 - ICE with lambda parm in template argument.
3670         * tree.c (strip_typedefs_expr): Use cp_tree_operand_length.
3672 2018-02-01  Jason Merrill  <jason@redhat.com>
3674         PR c++/84160 - ICE with nested variadic capture.
3675         * lambda.c (is_capture_proxy_with_ref): New.
3676         (insert_capture_proxy): Don't set DECL_CAPTURED_VARIABLE from a
3677         COMPONENT_REF.
3678         * expr.c (mark_use): Use is_capture_proxy_with_ref.
3679         * constexpr.c (potential_constant_expression_1): Likewise.
3680         * semantics.c (process_outer_var_ref): Likewise.
3682 2018-02-01  Marek Polacek  <polacek@redhat.com>
3684         PR c++/84125
3685         * typeck.c (build_address): Relax the assert when
3686         processing_template_decl.
3688 2018-02-01  Jason Merrill  <jason@redhat.com>
3690         PR c++/84126 - ICE with variadic generic lambda
3691         PR c++/84036
3692         PR c++/82249
3693         * pt.c (tsubst_pack_expansion): Handle function parameter_packs in
3694         PACK_EXPANSION_EXTRA_ARGS.
3696 2018-02-01  Paolo Carlini  <paolo.carlini@oracle.com>
3698         PR c++/83796
3699         * call.c (convert_like_real): If w're initializing from {} explicitly
3700         call abstract_virtuals_error_sfinae.
3702 2018-01-31  Jason Merrill  <jason@redhat.com>
3703             Jakub Jelinek  <jakub@redhat.com>
3705         PR c++/83993
3706         * constexpr.c (cxx_eval_outermost_constant_expr): Build NOP_EXPR
3707         around non-constant ADDR_EXPRs rather than clearing TREE_CONSTANT
3708         on ADDR_EXPR.
3710 2018-01-31  Jakub Jelinek  <jakub@redhat.com>
3712         PR c++/83993
3713         * constexpr.c (diag_array_subscript): Emit different diagnostics
3714         if TYPE_DOMAIN (arraytype) is NULL.
3715         (cxx_eval_array_reference, cxx_eval_store_expression): For arrays
3716         with NULL TYPE_DOMAIN use size_zero_node as nelts.
3718 2018-01-31  Paolo Carlini  <paolo.carlini@oracle.com>
3720         PR c++/84092
3721         * semantics.c (finish_qualified_id_expr): When handling an
3722         UNBOUND_CLASS_TEMPLATE only adjust qualifying_class and expr.
3724 2018-01-31  Marek Polacek  <polacek@redhat.com>
3726         PR c++/84138
3727         * cp-gimplify.c (cp_fold): Check if X is an error node before
3728         calling useless_type_conversion_p.
3730 2018-01-30  Jason Merrill  <jason@redhat.com>
3732         PR c++/84091 - ICE with local class in lambda in template.
3733         * decl2.c (determine_visibility): Look for outer containing template
3734         instantiation.
3736         PR c++/84098 - ICE with lambda in template NSDMI.
3737         * pt.c (instantiate_class_template_1): Ignore more lambdas.
3739 2018-01-29  Jason Merrill  <jason@redhat.com>
3741         PR c++/68810 - wrong location for reinterpret_cast error.
3742         * cvt.c (cp_convert_to_pointer): Always build a CONVERT_EXPR when
3743         !dofold.
3745 2018-01-29  Marek Polacek  <polacek@redhat.com>
3747         PR c++/83996
3748         * constexpr.c (cxx_fold_indirect_ref): Compute ((foo *)&fooarray)[1]
3749         => fooarray[1] in offset_int.
3751 2018-01-29  Jason Merrill  <jason@redhat.com>
3753         PR c++/83942 - wrong unused warning with static_cast.
3754         * cvt.c (ocp_convert): Call mark_rvalue_use.
3756 2018-01-26  Jason Merrill  <jason@redhat.com>
3758         PR c++/83956 - wrong dtor error with anonymous union
3759         * method.c (walk_field_subobs): Variant members only affect
3760         deletedness.
3761         (maybe_explain_implicit_delete): Pass &deleted_p for diagnostic.
3763         PR c++/84036 - ICE with variadic capture.
3764         PR c++/82249
3765         * pt.c (tsubst_pack_expansion): When optimizing a simple
3766         substitution, pull a single pack expansion out of its pack.
3768         PR c++/82514 - ICE with local class in generic lambda.
3769         * pt.c (regenerated_lambda_fn_p): Remove.
3770         (enclosing_instantiation_of): Don't use it.
3771         (tsubst_function_decl): Call enclosing_instantiation_of.
3773         * pt.c (lookup_template_class_1): Add sanity check.
3774         * name-lookup.c (do_pushtag): Don't add closures to local_classes.
3776 2018-01-25  Jakub Jelinek  <jakub@redhat.com>
3778         PR c++/84031
3779         * decl.c (find_decomp_class_base): Ignore unnamed bitfields.  Ignore
3780         recursive calls that return ret.
3781         (cp_finish_decomp): Ignore unnamed bitfields.
3783 2018-01-23  Jason Merrill  <jason@redhat.com>
3785         PR c++/82249 - wrong mismatched pack length error.
3786         * pt.c (extract_fnparm_pack, tsubst_pack_expansion): Handle
3787         unsubstituted function parameter pack.
3789 2018-01-23  Paolo Carlini  <paolo.carlini@oracle.com>
3791         PR c++/83921
3792         * decl.c (check_for_uninitialized_const_var): Not static; add
3793         bool and tsubst_flags_t parameters; adjust to be used both in
3794         constexpr context and not.
3795         * constexpr.c (potential_constant_expression_1): Use the above.
3796         * cp-tree.h (check_for_uninitialized_const_var): Declare.
3798 2018-01-23  Jason Merrill  <jason@redhat.com>
3800         PR c++/83947 - ICE with auto declarations.
3801         * pt.c (do_auto_deduction): Don't deduce from an auto decl.
3802         * decl.c (undeduced_auto_decl): Limit to vars and fns.
3804 2018-01-23  David Malcolm  <dmalcolm@redhat.com>
3806         PR c++/83974
3807         * pt.c (tsubst_copy_and_build) <CONSTRUCTOR>: Remove early bailout
3808         for pointer to member function types.
3810 2018-01-23  Jakub Jelinek  <jakub@redhat.com>
3812         PR sanitizer/83987
3813         * tree.c (cp_free_lang_data): Change DECL_VALUE_EXPR of
3814         DECL_OMP_PRIVATIZED_MEMBER vars to error_mark_node.
3816 2018-01-23  Nathan Sidwell  <nathan@acm.org>
3818         PR c++/83988
3819         * pt.c (tsubst_baselink): Remove optype assert.
3820         * ptree.c (cxx_print_xnode): <case BASELINK> Print BASELINK_OPTYPE.
3822 2018-01-23  Jakub Jelinek  <jakub@redhat.com>
3824         PR c++/83958
3825         * decl.c (cp_finish_decomp): Diagnose if reference structure binding
3826         refers to incomplete type.
3828 2018-01-23  Nathan Sidwell  <nathan@acm.org>
3830         Deprecate ARM-era for scope handling
3831         * decl.c (poplevel): Flag_new_for_scope is a boolean-like.
3832         (cxx_init_decl_processing): Deprecate flag_new_for_scope being
3833         cleared.
3834         * name-lookup.c (check_for_out_of_scope_variable): Deprecate and
3835         cleanup handling.
3836         * semantics.c (begin_for_scope): Flag_new_for_scope is
3837         boolean-like.
3838         (finish_for_stmt, begin_range_for_stmt): Likewise.
3840 2018-01-22  Jason Merrill  <jason@redhat.com>
3842         PR c++/83720
3843         * decl2.c (determine_visibility): Fix template_decl handling
3844         instead of blocking it.
3846         PR c++/83720 - ICE with lambda and LTO.
3847         * decl2.c (determine_visibility): Clear template_decl for
3848         function-scope decls.  Propagate anonymous linkage from containing
3849         function.
3851 2018-01-22  Marek Polacek  <polacek@redhat.com>
3853         PR c++/81933
3854         * typeck2.c (split_nonconstant_init_1): Return false if we didn't
3855         split out anything.
3857 2018-01-22  Ville Voutilainen  <ville.voutilainen@gmail.com>
3859         PR c++/83895
3860         * decl.c (grokdeclarator): Don't diagnose extra parens
3861         on typedefs.
3863 2018-01-19  Jakub Jelinek  <jakub@redhat.com>
3865         PR c++/81167
3866         * call.c (joust): Use TREE_TYPE (source) if source is
3867         a POINTER_TYPE_P rather than if ! DECL_CONSTRUCTOR_P (w->fn).
3869         PR c++/83919
3870         * typeck.c (convert_for_assignment): Suppress warn_ignored_qualifiers
3871         for direct enum init.
3872         * decl.c (reshape_init): Likewise.
3874 2018-01-19  Marek Polacek  <polacek@redhat.com>
3876         * constexpr.c (fold_simple): Simplify.
3878 2018-01-18  Jason Merrill  <jason@redhat.com>
3880         PR c++/83714
3881         * search.c (any_dependent_bases_p): Handle null TREE_BINFO.
3882         * pt.c (instantiation_dependent_scope_ref_p): True if
3883         any_dependent_bases_p.
3885 2018-01-18  Paolo Carlini  <paolo.carlini@oracle.com>
3887         * cp-tree.h: Fix comment typo (DECL_NON_TRIVIALLY_INITIALIZED_P
3888         vs DECL_NONTRIVIALLY_INITIALIZED_P).
3890 2018-01-18  Jason Merrill  <jason@redhat.com>
3892         PR c++/82461 - constexpr list-initialized member
3893         * constexpr.c (potential_constant_expression_1): Check
3894         TARGET_EXPR_DIRECT_INIT_P.
3896 2018-01-18  Paolo Carlini  <paolo.carlini@oracle.com>
3898         PR c++/81013
3899         * decl.c (xref_basetypes): Early return upon error about derived
3900         union.
3902 2018-01-18  Nathan Sidwell  <nathan@acm.org>
3904         PR c++/83160
3905         * cp-tree.h (mark_use): Declare.
3906         * expr.c (mark_use): Make extern.
3907         * call.c (direct_reference_binding): Set inner conv's
3908         rvaluedness_matches_p, if it is an identity.
3909         (convert_like_real): Mark lvalue or rvalue use for identity as
3910         rvaledness_matches_p demands.
3912 2018-01-18  Jakub Jelinek  <jakub@redhat.com>
3914         PR c++/83824
3915         * parser.c (attr_chainon): New function.
3916         (cp_parser_label_for_labeled_statement, cp_parser_decl_specifier_seq,
3917         cp_parser_namespace_definition, cp_parser_init_declarator,
3918         cp_parser_type_specifier_seq, cp_parser_parameter_declaration,
3919         cp_parser_gnu_attributes_opt): Use it.
3920         (cp_parser_member_declaration, cp_parser_objc_class_ivars,
3921         cp_parser_objc_struct_declaration): Likewise.  Don't reset
3922         prefix_attributes if attributes is error_mark_node.
3924 2018-01-17  Paolo Carlini  <paolo.carlini@oracle.com>
3926         PR c++/78344
3927         * decl.c (grokdeclarator): Do not append the error_mark_node
3928         due to an erroneous optional attribute-specifier-seq.
3930 2018-01-17  Jakub Jelinek  <jakub@redhat.com>
3932         PR c++/83897
3933         * cp-gimplify.c (cp_maybe_instrument_return): Handle
3934         CLEANUP_POINT_EXPR.
3936 2018-01-17  Paolo Carlini  <paolo.carlini@oracle.com>
3938         PR c++/81054
3939         * constexpr.c (ensure_literal_type_for_constexpr_object): Return
3940         error_mark_node when we give an error.
3941         * decl.c (cp_finish_decl): Use the latter.
3943 2018-01-17  Nathan Sidwell  <nathan@acm.org>
3945         PR c++/83287
3946         * init.c (build_raw_new_expr): Scan list for lookups to keep.
3948 2018-01-17  David Malcolm  <dmalcolm@redhat.com>
3950         PR c++/83814
3951         * expr.c (fold_for_warn): Move from c-common.c, reducing to just
3952         the C++ part.  If processing a template, call
3953         fold_non_dependent_expr rather than fully folding.
3955 2018-01-17  Jason Merrill  <jason@redhat.com>
3957         PR c++/81067 - redundant NULL warning.
3958         * call.c (convert_like_real): Restore null_node handling.
3960 2018-01-17  Jason Merrill  <jason@redhat.com>
3962         PR c++/81843 - ICE with variadic member template.
3963         PR c++/72801
3964         * pt.c (unify_pack_expansion): Don't try to deduce enclosing
3965         template args.
3967 2018-01-17  David Malcolm  <dmalcolm@redhat.com>
3969         PR c++/83799
3970         * pt.c (type_dependent_expression_p): Strip any location wrapper
3971         before testing tree codes.
3972         (selftest::test_type_dependent_expression_p): New function.
3973         (selftest::cp_pt_c_tests): Call it.
3975 2018-01-17  Nathan Sidwell  <nathan@acm.org>
3977         PR c++/83739
3978         * pt.c (tsubst_expr) <case RANGE_FOR_STMT>: Rebuild a range_for if
3979         this not a final instantiation.
3981 2018-01-16  Jason Merrill  <jason@redhat.com>
3983         PR c++/83714 - ICE checking return in template.
3984         * typeck.c (check_return_expr): Call build_non_dependent_expr.
3986 2018-01-16  Jakub Jelinek  <jakub@redhat.com>
3988         PR c++/83817
3989         * pt.c (tsubst_copy_and_build) <case CALL_EXPR>: If function
3990         is AGGR_INIT_EXPR rather than CALL_EXPR, set AGGR_INIT_FROM_THUNK_P
3991         instead of CALL_FROM_THUNK_P.
3993         PR c++/83825
3994         * name-lookup.c (member_vec_dedup): Return early if len is 0.
3995         (resort_type_member_vec, set_class_bindings,
3996         insert_late_enum_def_bindings): Use vec qsort method instead of
3997         calling qsort directly.
3999 2018-01-15  Martin Sebor  <msebor@redhat.com>
4001         PR c++/83588
4002         * class.c (find_flexarrays): Make a record of multiple flexible array
4003         members.
4005 2018-01-12  Jason Merrill  <jason@redhat.com>
4007         PR c++/83186 - ICE with static_cast of list-initialized temporary.
4008         * typeck.c (build_static_cast): Use build_non_dependent_expr.
4010 2018-01-12  Nathan Sidwell  <nathan@acm.org>
4012         * cp-tree.h (mark_rvalue_use): Add parm name.
4013         * expr.c (mark_lvalue_use, mark_lvalue_use_nonread): Move next to
4014         mark_rvalue_use.
4015         * call.c (convert_like_real): Fix formatting.
4017 2018-01-11  Jason Merrill  <jason@redhat.com>
4019         PR c++/82728 - wrong -Wunused-but-set-variable
4020         PR c++/82799
4021         PR c++/83690
4022         * call.c (perform_implicit_conversion_flags): Call mark_rvalue_use.
4023         * decl.c (case_conversion): Likewise.
4024         * semantics.c (finish_static_assert): Call
4025         perform_implicit_conversion_flags.
4027 2018-01-11  Nathan Sidwell  <nathan@acm.org>
4029         * method.c (enum mangling_flags): Delete long-dead enum.
4031 2018-01-10  Paolo Carlini  <paolo.carlini@oracle.com>
4033         * parser.c (cp_parser_std_attribute_spec): When
4034         token_pair::require_open / require_close return false simply
4035         return error_mark_node, avoid duplicate cp_parser_error about
4036         expected '(' / ')', respectively.
4038 2018-01-10  David Malcolm  <dmalcolm@redhat.com>
4040         PR c++/43486
4041         * call.c (null_ptr_cst_p): Strip location wrappers when
4042         converting from '0' to a pointer type in C++11 onwards.
4043         (conversion_null_warnings): Replace comparison with null_node with
4044         call to null_node_p.
4045         (build_over_call): Likewise.
4046         * cp-gimplify.c (cp_fold): Remove the early bailout when
4047         processing_template_decl.
4048         * cp-lang.c (selftest::run_cp_tests): Call
4049         selftest::cp_pt_c_tests and selftest::cp_tree_c_tests.
4050         * cp-tree.h (cp_expr::maybe_add_location_wrapper): New method.
4051         (selftest::run_cp_tests): Move decl to bottom of file.
4052         (null_node_p): New inline function.
4053         (selftest::cp_pt_c_tests): New decl.
4054         (selftest::cp_tree_c_tests): New decl.
4055         * cvt.c (build_expr_type_conversion): Replace comparison with
4056         null_node with call to null_node_p.
4057         * error.c (args_to_string): Likewise.
4058         * except.c (build_throw): Likewise.
4059         * mangle.c (write_expression): Skip location wrapper nodes.
4060         * parser.c (literal_integer_zerop): New function.
4061         (cp_parser_postfix_expression): Call maybe_add_location_wrapper on
4062         the result for RID_TYPEID. Pass true for new "wrap_locations_p"
4063         param of cp_parser_parenthesized_expression_list.  When calling
4064         warn_for_memset, replace integer_zerop calls with
4065         literal_integer_zerop, eliminating the double logical negation
4066         cast to bool.  Eliminate the special-casing for CONST_DECL in
4067         favor of the fold_for_warn within warn_for_memset.
4068         (cp_parser_parenthesized_expression_list): Add "wrap_locations_p"
4069         param, defaulting to false.  Convert "expr" to a cp_expr, and call
4070         maybe_add_location_wrapper on it when wrap_locations_p is true.
4071         (cp_parser_unary_expression): Call maybe_add_location_wrapper on
4072         the result for RID_ALIGNOF and RID_SIZEOF.
4073         (cp_parser_builtin_offsetof): Likewise.
4074         * pt.c: Include "selftest.h".
4075         (tsubst_copy): Handle location wrappers.
4076         (tsubst_copy_and_build): Likewise.
4077         (build_non_dependent_expr): Likewise.
4078         (selftest::test_build_non_dependent_expr): New function.
4079         (selftest::cp_pt_c_tests): New function.
4080         * tree.c: Include "selftest.h".
4081         (lvalue_kind): Handle VIEW_CONVERT_EXPR location wrapper nodes.
4082         (selftest::test_lvalue_kind): New function.
4083         (selftest::cp_tree_c_tests): New function.
4084         * typeck.c (string_conv_p): Strip any location wrapper from "exp".
4085         (cp_build_binary_op): Replace comparison with null_node with call
4086         to null_node_p.
4087         (build_address): Use location of operand when building address
4088         expression.
4090 2018-01-10  Marek Polacek  <polacek@redhat.com>
4092         PR c++/82541
4093         * call.c (build_conditional_expr_1): Check complain before warning.
4094         * pt.c (tsubst_copy_and_build) <case COND_EXPR>: Suppress
4095         -Wduplicated-branches.
4097 2018-01-10  Jakub Jelinek  <jakub@redhat.com>
4099         PR c++/81327
4100         * call.c (maybe_warn_class_memaccess): Add forward declaration.
4101         Change last argument from tree * to const vec<tree, va_gc> *, adjust
4102         args uses and check number of operands too.  Don't strip away any
4103         nops.  Use maybe_constant_value when looking for INTEGER_CST args.
4104         Deal with src argument not having pointer type.  Check
4105         tree_fits_uhwi_p before calling tree_to_uhwi.  Remove useless
4106         test.
4107         (build_over_call): Call maybe_warn_class_memaccess here on the
4108         original arguments.
4109         (build_cxx_call): Rather than here on converted arguments.
4111 2018-01-10  Paolo Carlini  <paolo.carlini@oracle.com>
4113         PR c++/81055
4114         * init.c (build_vec_init): Avoid building an INIT_EXPR with
4115         error_mark_node as second argument.
4117 2018-01-09  Jakub Jelinek  <jakub@redhat.com>
4119         PR c++/83734
4120         * constexpr.c (cxx_eval_statement_list): Ignore DEBUG_BEGIN_STMTs
4121         in STATEMENT_LIST.  Remove unneeded assert.
4123 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4124             Alan Hayward  <alan.hayward@arm.com>
4125             David Sherwood  <david.sherwood@arm.com>
4127         * constexpr.c (cxx_eval_array_reference): Handle polynomial
4128         VECTOR_CST_NELTS.
4129         (cxx_fold_indirect_ref): Handle polynomial TYPE_VECTOR_SUBPARTS.
4130         * call.c (build_conditional_expr_1): Likewise.
4131         * decl.c (cp_finish_decomp): Likewise.
4132         * mangle.c (write_type): Likewise.
4133         * typeck.c (structural_comptypes): Likewise.
4134         (cp_build_binary_op): Likewise.
4135         * typeck2.c (process_init_constructor_array): Likewise.
4137 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
4139         PR c++/83555
4140         * typeck.c (build_static_cast_1): For static casts to reference types,
4141         call build_base_path with flag_delete_null_pointer_checks as nonnull
4142         instead of always false.  When -fsanitize=null, call
4143         ubsan_maybe_instrument_reference on the NULL reference INTEGER_CST.
4144         * cp-gimplify.c (cp_genericize_r): Don't walk subtrees of UBSAN_NULL
4145         call if the first argument is INTEGER_CST with REFERENCE_TYPE.
4147 2018-01-03  Nathan Sidwell  <nathan@acm.org>
4149         PR c++/83667
4150         * method.c (make_alias_for): Copy DECL_CONTEXT.
4152 2018-01-03  Marek Polacek  <polacek@redhat.com>
4154         PR c++/83592
4155         * decl.c (grokdeclarator): Don't warn about MVP in typename context.
4157 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
4159         PR preprocessor/83602
4160         * name-lookup.c (lookup_name_fuzzy): Don't use macro_use_before_def
4161         for builtin macros.
4163         PR c++/83634
4164         * cp-gimplify.c (cp_fold) <case NOP_EXPR>: If the operand folds to
4165         error_mark_node, return error_mark_node.
4167         Update copyright years.
4169 2018-01-02  Jakub Jelinek  <jakub@redhat.com>
4171         PR c++/83556
4172         * tree.c (replace_placeholders_r): Pass NULL as last argument to
4173         cp_walk_tree instead of d->pset.  If non-TREE_CONSTANT and
4174         non-PLACEHOLDER_EXPR tree has been seen already, set *walk_subtrees
4175         to false and return.
4176         (replace_placeholders): Pass NULL instead of &pset as last argument
4177         to cp_walk_tree.
4179 2018-01-02  Nathan Sidwell  <nathan@acm.org>
4181         * constexpr.c (cxx_bind_parameters_in_call): Remove unneeded local
4182         lval var.
4184 Copyright (C) 2018 Free Software Foundation, Inc.
4186 Copying and distribution of this file, with or without modification,
4187 are permitted in any medium without royalty provided the copyright
4188 notice and this notice are preserved.