[C++ PATCH] overloaded operator fns [6/N]
[official-gcc.git] / gcc / cp / ChangeLog
blobb97bb933357edb4a4abd1b227678dec53deb61dd
1 2017-11-01  Nathan Sidwell  <nathan@acm.org>
3         * cp-tree.h (assign_op_identifier, call_op_identifier): Use
4         compressed code.
5         (struct lang_decl_fn): Use compressed operator code.
6         (DECL_OVERLOADED_OPERATOR_CODE): Replace with ...
7         (DECL_OVERLOADED_OPERATOR_CODE_RAW): ... this.
8         (DECL_OVERLOADED_OPERATOR_CODE_IS): Use it.
9         * decl.c (duplicate_decls): Use DECL_OVERLOADED_OPERATOR_CODE_RAW.
10         (build_library_fn): Likewise.
11         (grok_op_properties): Likewise.
12         * mangle.c (write_unqualified_name): Likewise.
13         * method.c (implicitly_declare_fn): Likewise.
14         * typeck.c (check_return_expr): Use DECL_OVERLOADED_OPERATOR_IS.
16         * cp-tree.h (IDENTIFIER_CP_INDEX): Define.
17         (enum ovl_op_flags): Add OVL_OP_FLAG_AMBIARY.
18         (enum ovl_op_code): New.
19         (struct ovl_op_info): Add ovl_op_code field.
20         (ovl_op_info): Size by OVL_OP_MAX.
21         (ovl_op_mapping, ovl_op_alternate): Declare.
22         (OVL_OP_INFO): Adjust for mapping array.
23         (IDENTIFIER_OVL_OP_INFO): New.
24         * decl.c (ambi_op_p, unary_op_p): Delete.
25         (grok_op_properties): Use IDENTIFIER_OVL_OP_INFO and
26         ovl_op_alternate.
27         * lex.c (ovl_op_info): Adjust and static initialize.
28         (ovl_op_mappings, ovl_op_alternate): Define.
29         (init_operators): Iterate over ovl_op_info array and init mappings
30         & alternate arrays.
31         * mangle.c (write_unqualified_id): Use IDENTIFIER_OVL_OP_INFO.
32         * operators.def (DEF_OPERATOR): Remove KIND parm.
33         (DEF_SIMPLE_OPERATOR): Delete.
34         (OPERATOR_TRANSITION): Expand if defined.
36 2017-10-31  David Malcolm  <dmalcolm@redhat.com>
38         * pt.c (listify): Use %< and %> for description of #include.
40 2017-10-31  David Malcolm  <dmalcolm@redhat.com>
42         * class.c (explain_non_literal_class): Use UNKNOWN_LOCATION rather
43         than 0.
44         * name-lookup.c (suggest_alternatives_for): Update for renaming of
45         inform_at_rich_loc.
46         (maybe_suggest_missing_header): Likewise.
47         (suggest_alternative_in_explicit_scope): Likewise.
48         * parser.c (cp_parser_diagnose_invalid_type_name): Likewise for
49         renaming of error_at_rich_loc.
50         (cp_parser_string_literal): Likewise.
51         (cp_parser_nested_name_specifier_opt): Likewise.
52         (cp_parser_cast_expression): Likewise for renaming of
53         warning_at_rich_loc.
54         (cp_parser_decl_specifier_seq): Likewise for renaming of
55         error_at_rich_loc and warning_at_rich_loc.
56         (cp_parser_elaborated_type_specifier): Likewise for renaming of
57         pedwarn_at_rich_loc.
58         (cp_parser_cv_qualifier_seq_opt): Likewise for renaming of
59         error_at_rich_loc.
60         (cp_parser_virt_specifier_seq_opt): Likewise.
61         (cp_parser_class_specifier_1): Likewise.
62         (cp_parser_class_head): Likewise.
63         (cp_parser_member_declaration): Likewise for renaming of
64         pedwarn_at_rich_loc, warning_at_rich_loc, and error_at_rich_loc.
65         (cp_parser_enclosed_template_argument_list): Likewise for renaming
66         of error_at_rich_loc.
67         (set_and_check_decl_spec_loc): Likewise.
68         * pt.c (listify): Likewise.
69         * rtti.c (typeid_ok_p): Likewise.
70         * semantics.c (process_outer_var_ref): Use UNKNOWN_LOCATION rather
71         than 0.
72         * typeck.c (access_failure_info::maybe_suggest_accessor): Update
73         for renaming of inform_at_rich_loc.
74         (finish_class_member_access_expr): Likewise for renaming of
75         error_at_rich_loc.
77 2017-10-31  Nathan Sidwell  <nathan@acm.org>
79         * cp-tree.h (struct operator_name_info_t): Rename to ...
80         (struct ovl_op_info_t): ... here.  Add tree_code field.
81         (operator_name_info, assignment_operator_name_info): Delete.
82         (ovl_op_info): Declare.
83         (OVL_OP_INFO): Adjust.
84         * decl.c (grok_op_properties): Use ovl_op_flags.
85         * lex.c (operator_name_info, assignment_operator_name_info):
86         Delete.
87         (ovl_op_info): Define.
88         (set_operator_ident): Adjust.
89         (init_operators): Set tree_code.
90         * mangle.c (write_unqualified_id): Adjust operator array scan.
92         * lex.c (init_operators): Allow NULL operator name.  Don't add
93         special cases.
94         * operators.def: Use NULL for mangling only operators.  Move to
95         after regular operators but move assignment operators last.
97         * cp-tree.h (enum ovl_op_flags): New.
98         (struct operator_name_info_t): Rename arity to flags.
99         * lex.c (set_operator_ident): New.
100         (init_operators): Use it.  Adjust for flags.
101         * mangle.c (write_unqualified_id): Adjust for flags.
102         * operators.def: Replace arity with flags.
104         * cp-tree.h (ovl_op_identifier): New.
105         (assign_op_identifier, call_op_identifier): Adjust.
106         (cp_operator_id, cp_assignment_operator_ide): Delete.
107         (SET_OVERLOADED_OPERATOR_CODE): Delete.
108         (OVL_OP_INFO): New.
109         * call.c (op_error): Use OVL_OP_INFO.
110         (build_conditional_expr_1): Use ovl_op_identifier.
111         (build_new_op_1): Use OVL_OP_INFO & ovl_op_identifier.
112         (build_op_delete_call): Likewise.
113         * class.c (type_requires_array_cookie): Use ovl_op_identifier.
114         * decl.c (duplicate_decls): Directly copy operator code.
115         (builtin_function_1): Do not set operator code.
116         (build_library_fn): Directly set operator code.
117         (push_cp_library_fn): Use ovl_op_identifier.
118         (grok_op_properties): Directly set operator code.
119         * decl2.c (maybe_warn_sized_delete): Use ovl_op_identifier.
120         * error.c (dump_expr): Use OVL_OP_INFO.
121         (op_to_string): Add assop arg. Use OVL_OP_INFO.
122         (assop_to_string): Delete.
123         (args_to_string): Adjust.
124         * init.c (build_new_1): Use ovl_op_identifier.
125         * mangle.c (write_unqualified_name): Use OVL_OP_INFO.
126         (write_expression): Likewise.
127         * method.c (synthesized_method_walk): Use ovl_op_identifier.
128         (implicitly_declare_fn): Use assign_op_identifier. Directly set
129         operator code.
130         * name-lookup.c (get_class_binding): Use assign_op_identifier.
131         * parser.c (cp_parser_operator): Use ovl_op_identifier.
132         (cp_parser_omp_clause_reduction): Likewise.
133         * semantics.c (omp_reduction_id): Likewise.
134         * typeck.c (cxx_sizeof_or_alignof_type): Use OVL_OP_INFO.
136         * cp-tree.h (assign_op_identifier, call_op_identifier): Define.
137         (LAMBDA_FUNCTION_P): Use DECL_OVERLOADED_OPERATOR_IS.
138         (DECL_OVERLOADED_OPERATOR_P): Just retuurn true/false.
139         (DECL_OVERLOADED_OPERATOR_CODE, DECL_OVERLOADED_OPERATOR_IS): Define.
140         * call.c (add_function_candidate): Use
141         DECL_OVERLOADED_OPERATOR_IS.
142         (build_op_call_1): Use call_op_identifier &
143         DECL_OVERLOADED_OPERATOR_IS.
144         (build_over_call): Likewise.
145         (has_trivial_copy_assign_p): Use assign_op_identifier.
146         (build_special_member_call): Likewise.
147         * class.c (dfs_declare_virt_assop_and_dtor): Likewise.
148         (vbase_has_user_provided_move_assign,
149         classtype_has_move_assign_or_move_ctor_p): Likewise.
150         * decl.c (duplicate_decls): Use DECL_OVERLOADED_OPERATOR_CODE.
151         (grok_special_member_properties): Use assign_op_identifier.
152         (start_preparsed_function): Use DECL_OVERLOADED_OPERATOR_IS.
153         * decl2.c (mark_used): Use DECL_CONV_FN_P.
154         * dump.c (dump_access): Delete prototype.
155         (dump_op): Delete.
156         (cp_dump_tree): Don't call it.
157         * lambda.c (lambda_function): Use call_op_identifier.
158         (maybe_add_lambda_conv_op): Not an overloaded operator.  Remove
159         unneeded braces.
160         * mangle.c (write_unqualified_name): Use DECL_OVERLOADED_OPERTOR_CODE.
161         * method.c (do_build_copy_assign): Use assign_op_identifier.
162         (synthesize_method): Use DECL_OVERLOADED_OPERATOR_IS.
163         (get_copy_assign): Use assign_op_identifier.
164         (synthesized_method_walk): Likewise.
165         (defaultable_fn_check): Use DECL_OVERLOADED_OPERATOR_IS.
166         * parser.c (cp_parser_lambda_declarator_opt): Use
167         call_op_identifier.
168         * semanitics.c (classtype_has_nothrow_assign_or_copy_p): Use
169         assign_op_identifier.
170         * tree.c (special_function_p):  Use DECL_OVERLOADED_OPERATOR_IS.
171         * typeck.c (check_return_expr): Use DECL_OVERLOADED_OPERATOR_CODE.
172         (check_return_expr): Use assign_op_identifier.
174 2017-10-30  Paolo Carlini  <paolo.carlini@oracle.com>
176         PR c++/82085
177         * pt.c (tsubst_copy_and_build, [INDIRECT_REF]): For a REFERENCE_REF_P,
178         unconditionally call convert_from_reference.
180 2017-10-30  Nathan Sidwell  <nathan@acm.org>
182         * call.c (build_op_call_1): Test for FUNCTION_DECL in same manner
183         as a few lines earlier.
184         * cp-tree.h (PACK_EXPANSION_PATTERN): Fix white space.
185         * decl.c (grokfndecl): Fix indentation.
186         (compute_array_index_type): Use processing_template_decl_sentinel.
187         (grok_op_properties): Move warnings to end.  Reorder other checks
188         to group similar entities.  Tweak diagnostics.
189         * lex.c (unqualified_name_lookup_error): No need to check name is
190         not ERROR_MARK operator.
191         * parser.c (cp_parser_operator): Select operator code before
192         looking it up.
193         * typeck.c (check_return_expr): Fix indentation and line wrapping.
195 2017-10-27  Paolo Carlini  <paolo.carlini@oracle.com>
197         * pt.c (invalid_nontype_parm_type_p): Return a bool instead of an int.
199 2017-10-26  Nathan Sidwell  <nathan@acm.org>
201         * decl.c (sort_labels): Restore function.
202         (pop_labels): Sort labels
203         (identify_goto): Add translation markup.
205 2017-10-25  Nathan Sidwell  <nathan@acm.org>
207         Kill IDENTIFIER_LABEL_VALUE.
208         * cp-tree.h (lang_identifier): Delete label_value slot.
209         (IDENTIFIER_LABEL_VALUE, SET_IDENTIFIER_LABEL_VALUE): Delete.
210         (struct named_label_hasher): Rename to ...
211         (struct named_label_hash): ... here.  Reimplement.
212         (struct language_function): Adjust x_named_labels.
213         * name-lookup.h (struct cp_label_binding): Delete.
214         (struct cp_binding_level): Delete shadowed_labels slot.
215         * decl.c (struct named_label_entry): Add name and outer slots.
216         (pop_label): Rename to ...
217         (check_label_used): ... here.  Don't pop.
218         (note_label, sort_labels): Delete.
219         (pop_labels, pop_local_label): Reimplement.
220         (poplevel): Pop local labels as any other decl. Remove
221         shadowed_labels handling.
222         (named_label_hash::hash, named_label_hash::equal): New.
223         (make_label_decl): Absorb into ...
224         (lookup_label_1): ... here.  Add making_local_p arg, reimplement.
225         (lookup_label, declare_local_label): Adjust.
226         (check_goto, define_label): Adjust.
227         * lex.c (make_conv_op_name): Don't clear IDENTIFIER_LABEL_VALUE.
228         * ptree.c (cxx_print_identifier): Don't print identifier binding.
230         * decl.c (identifier_goto): Reduce duplication.
231         (check_previous_goto_1): Likewise.
232         (check_goto): Move var decls to initialization.
233         (check_omp_return, define_label_1, define_label): Likewise.
235 2017-10-25  Jakub Jelinek  <jakub@redhat.com>
237         PR libstdc++/81706
238         * decl.c (duplicate_decls): Copy "omp declare simd" attributes from
239         newdecl to corresponding __builtin_ if any.
241 2017-10-24  Paolo Carlini  <paolo.carlini@oracle.com>
243         PR c++/82466
244         * decl.c (duplicate_decls): Warn for built-in functions declared as
245         non-function, use OPT_Wbuiltin_declaration_mismatch.
247         * decl.c (duplicate_decls): Avoid redundant '+' in warning_at.
249 2017-10-24  Paolo Carlini  <paolo.carlini@oracle.com>
251         PR c++/80991
252         * pt.c (value_dependent_expression_p, [TRAIT_EXPR]): Handle
253         a TREE_LIST as TRAIT_EXPR_TYPE2.
255 2017-10-24  Mukesh Kapoor  <mukesh.kapoor@oracle.com>
256             Paolo Carlini  <paolo.carlini@oracle.com>
258         PR c++/82307
259         * cvt.c (type_promotes_to): Implement C++17, 7.6/4, about unscoped
260         enumeration type whose underlying type is fixed.
262 2017-10-23  Paolo Carlini  <paolo.carlini@oracle.com>
264         PR c++/80449
265         * semantics.c (finish_compound_literal): Check do_auto_deduction
266         return value for error_mark_node.
268 2017-10-23  Jason Merrill  <jason@redhat.com>
270         PR c++/77369 - wrong noexcept handling in C++14 and below
271         * tree.c (strip_typedefs): Canonicalize TYPE_RAISES_EXCEPTIONS.
273 2017-10-20  Nathan Sidwell  <nathan@acm.org>
275         * class.c (layout_class_type): Cleanup as-base creation, determine
276         mode here.
277         (finish_struct_1): ... not here.
279 2017-10-19  Jakub Jelinek  <jakub@redhat.com>
281         PR c++/82600
282         * typeck.c (check_return_expr): Don't call
283         maybe_warn_about_returning_address_of_local in templates.
285 2017-10-17  Nathan Sidwell  <nathan@acm.org>
287         PR c++/82560
288         * call.c (build_over_call): Don't pass tf_no_cleanup to nested
289         calls.
291         PR middle-end/82546
292         * cp-objcp-common.c (cp_tree_size): Reformat.  Adjust returns size
293         of TYPE nodes.
295 2017-10-13  Jason Merrill  <jason@redhat.com>
297         PR c++/82357 - bit-field in template
298         * tree.c (cp_stabilize_reference): Just return a NON_DEPENDENT_EXPR.
300 2017-10-13  David Malcolm  <dmalcolm@redhat.com>
302         * cp-tree.h (maybe_show_extern_c_location): New decl.
303         * decl.c (grokfndecl): When complaining about literal operators
304         with C linkage, issue a note giving the location of the
305         extern "C".
306         * parser.c (cp_parser_new): Initialize new field
307         "innermost_linkage_specification_location".
308         (cp_parser_linkage_specification): Store the location
309         of the linkage specification within the cp_parser.
310         (cp_parser_explicit_specialization): When complaining about
311         template specializations with C linkage, issue a note giving the
312         location of the extern "C".
313         (cp_parser_explicit_template_declaration): Likewise for templates.
314         (maybe_show_extern_c_location): New function.
315         * parser.h (struct cp_parser): New field
316         "innermost_linkage_specification_location".
318 2017-10-12  Nathan Sidwell  <nathan@acm.org>
320         * cp-tree.h (cp_expr): Add const operator * and operator->
321         accessors.
322         (cp_tree_node_structure_enum): Delete TS_CP_BINDING,
323         TS_CP_WRAPPER, LAST_TS_CP_ENUM.
325 2017-10-12  David Malcolm  <dmalcolm@redhat.com>
327         * parser.c (get_required_cpp_ttype): New function.
328         (cp_parser_error_1): Call it, using the result to call
329         maybe_suggest_missing_token_insertion.
331 2017-10-12  David Malcolm  <dmalcolm@redhat.com>
333         * parser.c (get_matching_symbol): Move to before...
334         (cp_parser_error): Split out into...
335         (cp_parser_error_1): ...this new function, merging in content
336         from...
337         (cp_parser_required_error): ...here.  Eliminate partial duplicate
338         of body of cp_parser_error in favor of a call to the new
339         cp_parser_error_1 helper function.
341 2017-10-11  Nathan Sidwell  <nathan@acm.org>
343         * decl2.c (struct mangled_decl_hash): Use DECL_ASSEMBLER_NAME_RAW.
344         (record_mangling): Likewise.
346 2017-10-10  Nathan Sidwell  <nathan@acm.org>
348         * name-lookup.c (extern_c_fns): Rename to ...
349         (extern_c_decls): ... here.
350         (check_extern_c_conflict, extern_c_linkage_bindings): Update.
351         (do_pushdecl): Check extern-c fns and vars.
353         * cp-tree.h (default_hash_traits <lang_identifier *>): Delete
354         specialization.
356         * decl2.c (struct mangled_decl_hash): New hash traits.
357         (mangled_decls): Make hash_table<mangled_decl_hash>.
358         (generate_mangling_alias, record_mangling): Adjust.
360 2017-10-10  Jason Merrill  <jason@redhat.com>
362         More delayed lambda capture fixes.
363         * call.c (add_function_candidate): Use build_address.
364         (build_op_call_1): Call mark_lvalue_use early.
365         (build_over_call): Handle error from build_this.
366         * constexpr.c (cxx_bind_parameters_in_call): Use build_address.
367         (cxx_eval_increment_expression): Don't use rvalue().
368         * cvt.c (convert_to_void): Use mark_discarded_use.
369         * expr.c (mark_use): Handle PARM_DECL, NON_DEPENDENT_EXPR.  Fix
370         reference handling.  Don't copy the expression.
371         (mark_discarded_use): New.
372         * lambda.c (insert_capture_proxy): Add some sanity checking.
373         (maybe_add_lambda_conv_op): Set cp_unevaluated_operand.
374         * pt.c (register_local_specialization): Add sanity check.
375         * semantics.c (process_outer_var_ref): Fix check for existing proxy.
376         * typeck.c (cp_build_addr_expr_1): Handle error from
377         mark_lvalue_use.
378         (cp_build_modify_expr): Call mark_lvalue_use_nonread, handle error
379         from rvalue.
381         Handle generic lambda capture in dependent expressions.
382         * lambda.c (need_generic_capture, dependent_capture_r)
383         (do_dependent_capture): New.
384         * pt.c (processing_nonlambda_template): Use need_generic_capture.
385         * semantics.c (maybe_cleanup_point_expr)
386         (maybe_cleanup_point_expr_void, finish_goto_stmt)
387         (maybe_convert_cond): Call do_dependent_capture.
388         * typeck.c (build_static_cast): Remove dependent capture handling.
390         * typeck.c (condition_conversion): Assert !processing_template_decl.
391         * semantics.c (finish_omp_clauses): Don't
392         fold_build_cleanup_point_expr if processing_template_decl.
393         (outer_var_p): A temporary can't be from an outer scope.
394         * pt.c (type_dependent_expression_p): Fix dependency checking of
395         functions without DECL_TEMPLATE_INFO.
396         (instantiate_decl): Use lss_copy.
397         * constexpr.c (is_valid_constexpr_fn): Fix lambdas before C++17.
399         * typeck.c (check_return_expr): Check non-dependent conversion in
400         templates.
401         * constraint.cc (check_function_concept): Don't complain about an
402         empty concept if seen_error.
404 2017-10-10  Richard Sandiford  <richard.sandiford@linaro.org>
406         * cvt.c (ignore_overflows): Use wi::to_wide when
407         operating on trees as wide_ints.
408         * decl.c (check_array_designated_initializer): Likewise.
409         * mangle.c (write_integer_cst): Likewise.
410         * semantics.c (cp_finish_omp_clause_depend_sink): Likewise.
412 2017-10-10  Nathan Sidwell  <nathan@acm.org>
414         * name-lookup.c (set_global_binding): Don't deal with STAT_HACK.
416 2017-10-06  Paolo Carlini  <paolo.carlini@oracle.com>
418         PR c++/47791
419         * decl.c (finish_function): Take a bool intead of an int; adjust.
420         * cp-tree.h (finish_function): Adjust declaration.
421         * decl2.c (generate_tls_wrapper, finish_objects,
422         finish_static_storage_duration_function): Adjust calls.
423         * lambda.c (maybe_add_lambda_conv_op, finish_lambda_function):
424         Likewise.
425         * method.c (synthesize_method): Likewise.
426         * optimize.c (maybe_thunk_body, maybe_clone_body): Likewise.
427         * pt.c (instantiate_decl): Likewise.
428         * parser.c (cp_parser_function_definition_after_declarator,
429         cp_parser_late_parsing_for_member, cp_parser_omp_declare_reduction):
430         Likewise.
431         (cp_parser_ctor_initializer_opt,
432         cp_parser_ctor_initializer_opt_and_function_body,
433         cp_parser_function_try_block,
434         cp_parser_function_definition_after_declarator,
435         cp_parser_function_transaction): Return void; adjust declarations.
437 2017-10-06  Nathan Sidwell  <nathan@acm.org>
439         PR c++/82424
440         * name-lookup.c (check_local_shadow): Don't try and convert
441         dependent types.
443 2017-10-06  Jakub Jelinek  <jakub@redhat.com>
445         PR c++/82299
446         * decl.c (reshape_init): Suppress warn_useless_cast for direct enum
447         init.
448         * typeck.c (convert_for_assignment): Likewise.
450         P0704R1 - fixing const-qualified pointers to members
451         * typeck2.c (build_m_component_ref): For -std=c++2a allow
452         pointer to const & qualified method on rvalue.
454 2017-10-06  Nathan Sidwell  <nathan@acm.org>
456         Use hash_table for extern "C" names
457         * name-lookup.c (extern_c_fns): Use hash_table.
458         (check_extern_c_conflict): Adjust.
459         (c_linkage_bindings): Adjust.
461         Use hash_table for namespace bindings
462         * cp-tree.h (struct named_decl_hash): New.
463         (lang_decl_ns): Change type of bindings field.
464         * lex.c (maybe_add_lang_decl_raw): Adjust.
465         * name-lookup.c (find_namespace_slot): Adjust.
466         (do_pushdecl): Push NULL-named namespace.
467         (do_push_nested_namespace): Adjust.
468         (push_namespace): Push anonymous namespace as NULL name.
470 2017-10-05  Jason Merrill  <jason@redhat.com>
472         Pass variadic class objects exactly like named by-value args.
473         * call.c (convert_arg_to_ellipsis): Use the result of force_rvalue.
475 2017-10-05  Nathan Sidwell  <nathan@acm.org>
477         Warn on MVP declarations
478         * cp-tree.h (struct cp_declarator): Add parenthesized field.
479         * decl.c (grokdeclarator): Warn about unnecessary parens.
480         * parser.c (make_declarator): Init parenthesized field.
481         (cp_parser_direct_declarator): Set parenthesized field.
483         Kill IDENTIFIER_GLOBAL_VALUE, SET_IDENTIFIER_GLOBAL_VALUE
484         * cp-tree.h (IDENTIFIER_GLOBAL_VALUE,
485         SET_IDENTIFIER_GLOBAL_VALUE): Delete.
486         * name-lookup.h (set_global_binding): Remove NAME parm.
487         (get_global_binding): New inline fn.
488         * name-lookup.c (set_global_binding): Remove NAME parm. Adjust.
489         (identifier_global_value): Move to ...
490         * cp-objcp-common.c (identifier_global_value): ... here.
491         * class.c (build_ctor_vtbl_group, build_vtbl_initializer): Adjust.
492         * decl.c (record_builtin_type, expand_static_init,
493         grokdeclarator): Adjust.
494         * decl2.c (get_guard, get_local_tls_init_fn, get_tls_init_fn,
495         get_tls_wrapper_fn, maybe_warn_sized_delete): Adjust.
496         * except.c (declare_library_fn, build_throw): Adjust.
497         * init.c (throw_bad_array_length): Adjust.
498         * rtti.c (throw_bad_cast, throw_bad_typeid, get_tinfo_decl): Adjust.
500         * decl2.c (record_mangling): Fix spello and formatting from
501         previous patch.
503 2017-10-04  Nathan Sidwell  <nathan@acm.org>
505         Give builtin types the correct name.
506         * name-lookup.c (set_global_binding): Assert name is DECL_NAME.
507         * decl.c (record_builtin_type): Reimplement, use new TYPE_DECL for
508         rname.
510 2017-10-04  Paolo Carlini  <paolo.carlini@oracle.com>
511             Andrew Pinski  <apinski@cavium.com>
513         PR c++/71946
514         * parser.c (cp_parser_lambda_body): Set parser->in_function_body.
516 2017-10-04  Nathan Sidwell  <nathan@acm.org>
518         Move mangling aliases out of global namespace.
519         * cp-tree.h (record_mangling): New.
520         (maybe_remove_implicit_alias): Delete.
521         * decl2.c (mangled_decls): New hash map.
522         (generate_mangling_alias): Reimplement using mangled_decls.
523         (record_mangling): New.
524         * mangle.c (decl_implicit_alias_p,
525         maybe_remove_implicit_alias): Delete.
526         (mangle_decl): Use record_mangling.
527         * name-lookup.c (supplement_binding_1): Remove
528         maybe_remove_implicit_alias check.
530 2017-10-04  Jakub Jelinek  <jakub@redhat.com>
532         PR c++/82373
533         * error.c (dump_function_decl): If show_return, call dump_type_suffix
534         on the same return type dump_type_prefix has been called on.
536 2017-10-04  Jason Merrill  <jason@redhat.com>
538         PR c++/81525 - broken handling of auto in generic lambda.
539         * pt.c (tsubst_decl) [VAR_DECL]: Use strip_innermost_template_args.
541 2017-10-04  Nathan Sidwell  <nathan@acm.org>
543         * call.c (convert_arg_to_ellipsis): Correct comment about passing
544         by reference.
546 2017-10-02  Richard Sandiford  <richard.sandiford@linaro.org>
548         * constexpr.c (cxx_eval_store_expression): Use wi::to_widest
549         when comparing the array bounds with an ARRAY_REF index.
551 2017-09-30  Paolo Carlini  <paolo.carlini@oracle.com>
553         PR c++/68754
554         * method.c (defaulted_late_check): Early return if the defaulted
555         declaration does not match the expected signature.
557 2017-09-29  Jakub Jelinek  <jakub@redhat.com>
559         P0683R1 - default member initializers for bit-fields
560         * cp-tree.h (grokbitfield): Add INIT parameter.
561         * parser.c (cp_parser_constant_expression): Add STRICT_P argument,
562         if true, parse a conditional-expression rather than
563         assignment-expression.
564         (cp_parser_member_declaration): For C++11 and later pass true
565         as STRICT_P to cp_parser_constant_expression.  Parse C++2A bitfield
566         NSDMIs.  Adjust grokbitfield caller.  Handle DECL_INITIAL also for
567         DECL_C_BIT_FIELDs.
568         (cp_parser_objc_class_ivars): Adjust grokbitfield caller.
569         * class.c (check_field_decl): Recurse even for DECL_C_BIT_FIELDs.
570         (check_field_decls): Call check_field_decl even for DECL_C_BIT_FIELDs.
571         * decl2.c (grokbitfield): Add INIT parameter, pass it to
572         cp_finish_decl.
573         * pt.c (tsubst_decl): Handle DECL_INITIAL for all FIELD_DECLs, not
574         just non-bitfields.
576         * class.c (check_bitfield_decl): Retrieve and clear width from
577         DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL.
578         (check_field_decls): Test DECL_BIT_FIELD_REPRESENTATIVE rather than
579         DECL_INITIAL.
580         (remove_zero_width_bit_fields): Adjust comment.
581         * decl2.c (grokbitfield): Stash width into
582         DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL.
583         * pt.c (tsubst_decl): For DECL_C_BIT_FIELD, tsubst_expr
584         DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL for width.
586         * parser.c (cp_parser_member_declaration): Parse attributes before
587         colon of a bitfield in addition to after colon.
589         * Make-lang.in (check-c++-all): Test also c++2a.
591 2017-09-28  Jason Merrill  <jason@redhat.com>
593         PR c++/56973, DR 696 - capture constant variables only as needed.
594         * expr.c (mark_use): Split out from mark_rvalue_use and
595         mark_lvalue_use.  Handle lambda capture of constant variables.
596         (mark_lvalue_use_nonread): New.
597         * semantics.c (process_outer_var_ref): Don't capture a constant
598         variable until forced.
599         * pt.c (processing_nonlambda_template): New.
600         * call.c (build_this): Check it.
601         * decl2.c (grok_array_decl): Call mark_rvalue_use and
602         mark_lvalue_use_nonread.
603         * init.c (constant_value_1): Don't call mark_rvalue_use.
604         * typeck.c (build_static_cast): Handle lambda capture.
606         Use local_specializations to find capture proxies.
607         * cp-tree.h (DECL_CAPTURED_VARIABLE): New.
608         * lambda.c (build_capture_proxy): Set it.
609         (add_capture): Pass initializer to build_capture_proxy.
610         (start_lambda_function): Likewise.
611         (insert_capture_proxy): Use register_local_specialization.
612         (is_lambda_ignored_entity): Always ignore proxies.
613         * name-lookup.c (qualify_lookup): Don't check
614         is_lambda_ignored_entity if LOOKUP_HIDDEN is set.
615         * semantics.c (process_outer_var_ref): Use
616         retrieve_local_specialization.
617         * parser.c (cp_parser_lambda_body): Push local_specializations.
618         * pt.c (tsubst_expr): Pass LOOKUP_HIDDEN when looking for a proxy.
619         (tsubst_lambda_expr): Push local_specializations sooner.
620         (tsubst_copy_and_build): Don't register_local_specialization.
622         * call.c (build_special_member_call): Use the return value of
623         mark_lvalue_use.
624         * decl.c (compute_array_index_type): Likewise.
625         * parser.c (cp_parser_oacc_wait_list): Likewise.
626         * lambda.c (is_normal_capture_proxy): Handle *this capture.
627         (add_capture): Clarify internal_error message.
629 2017-09-22  Eric Botcazou  <ebotcazou@adacore.com>
631         PR bootstrap/81926
632         * cp-objcp-common.c (cp_get_debug_type): Do only one lookup.
634 2017-09-22  Jakub Jelinek  <jakub@redhat.com>
636         PR sanitizer/81929
637         * tree.c (struct replace_placeholders_t): Add pset field.
638         (replace_placeholders_r): Call cp_walk_tree with d->pset as
639         last argument instead of NULL.  Formatting fix.
640         (replace_placeholders): Add pset variable, add its address
641         into data.  Pass &pset instead of NULL to cp_walk_tree.
643 2017-09-22  David Malcolm  <dmalcolm@redhat.com>
645         * call.c (get_fndecl_argument_location): New function.
646         (convert_like_real): Use it  when complaining about argument type
647         mismatches.
648         * cp-tree.h (struct cp_parameter_declarator): Add "loc" field.
649         * parser.c (make_parameter_declarator): Add "loc" param and use
650         it to initialize the new field.
651         (cp_parser_translation_unit): Add UNKNOWN_LOCATION for "loc" of
652         the "no_parameters" parameter.
653         (cp_parser_parameter_declaration_list): Set the location of the
654         result of grokdeclarator to be the parameter's loc, assuming no
655         errors.
656         (cp_parser_parameter_declaration): Generate a location for the
657         parameter and pass to make_parameter_declarator.
659 2017-09-20  Nathan Sidwell  <nathan@acm.org>
661         * name-lookup.c (member_name_cmp): Use DECL_UID for final
662         ordering.
664 2017-09-20  Jakub Jelinek  <jakub@redhat.com>
666         P0409R2 - allow lambda capture [=, this]
667         * parser.c (cp_parser_lambda_introducer): For cxx2a don't pedwarn on
668         redundant [=, this].
670 2017-09-18  Jason Merrill  <jason@redhat.com>
672         PR c++/82069 - ICE with lambda in template
673         * semantics.c (process_outer_var_ref): Check uses_template_parms
674         instead of any_dependent_template_arguments_p.
676 2017-09-15  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
677             Paolo Carlini  <paolo.carlini@oracle.com>
679         PR c++/64644
680         * decl2.c (finish_anon_union): Complain about "anonymous union with
681         no members" with a pedwarn.
683 2017-09-15  Bernd Edlinger  <bernd.edlinger@hotmail.de>
685         * typeck.c (build_reinterpret_cast_1,
686         build_const_cast_1): Implement -Wcast-align=strict.
688 2017-09-15  Jakub Jelinek  <jakub@redhat.com>
690         * decl.c (redeclaration_error_message): Use cxx17 instead of cxx1z,
691         adjust diagnostics refering to C++1z or -std=gnu++1z or -std=c++1z
692         to C++17 or -std=gnu++17 or -std=c++17.  Adjust comments.
693         (cxx_init_decl_processing, next_initializable_field,
694         is_direct_enum_init, check_initializer, cp_finish_decl,
695         mark_inline_variable, grokdeclarator, grokparms, xref_basetypes,
696         finish_function): Likewise.
697         * cp-tree.h (DECL_INLINE_VAR_P): Likewise.
698         * pt.c (mark_template_parm, convert_nontype_argument,
699         instantiate_class_template_1, type_unification_real, unify,
700         get_partial_spec_bindings, dependent_type_p_r): Likewise.
701         * typeck.c (cp_build_unary_op): Likewise.
702         * constexpr.c (var_in_maybe_constexpr_fn): Likewise.
703         * call.c (build_user_type_conversion_1, build_over_call,
704         build_special_member_call): Likewise.
705         * lambda.c (begin_lambda_type): Likewise.
706         * typeck2.c (process_init_constructor_record): Likewise.
707         * class.c (build_base_field, finalize_literal_type_property,
708         explain_non_literal_class): Likewise.
709         * parser.c (cp_parser_diagnose_invalid_type_name,
710         cp_parser_primary_expression, cp_parser_lambda_introducer,
711         cp_parser_lambda_declarator_opt, cp_parser_selection_statement,
712         cp_convert_range_for, cp_parser_perform_range_for_lookup,
713         cp_parser_decomposition_declaration, cp_parser_linkage_specification,
714         cp_parser_static_assert, cp_parser_simple_type_specifier,
715         cp_parser_namespace_definition, cp_parser_using_declaration,
716         cp_parser_init_declarator, cp_parser_type_parameter_key,
717         cp_parser_exception_specification_opt, cp_parser_std_attribute_spec,
718         cp_parser_constructor_declarator_p): Likewise.
719         * mangle.c (struct globals): Rename need_cxx1z_warning to
720         need_cxx17_warning.
721         (write_exception_spec, start_mangling, mangle_decl): Likewise.
722         * Make-lang.in (check-c++1z): Rename to check-c++17, depend on
723         it.
724         (check-c++17): New goal.  Use 17 instead of 1z.
725         (check-c++-all): Use 17 instead of 1z.
727 2017-09-14  Jakub Jelinek  <jakub@redhat.com>
729         PR c++/81314
730         * cp-gimplify.c (omp_var_to_track): Look through references.
731         (omp_cxx_notice_variable): Likewise.
733 2017-09-13  Nathan Sidwell  <nathan@acm.org>
735         Conv-op identifers not in identifier hash table
736         * lex.c (conv_type_hasher): Make member fns inline.
737         (make_conv_op_name): Directly clone conv_op_identifier.
739         Rename CLASSTYPE_METHOD_VEC to CLASSTYPE_MEMBER_VEC.
740         * cp-tree.h (struct lang_type): Rename methods to members.
741         (CLASSTYPE_METHOD_VEC): Rename to ...
742         (CLASSTYPE_MEMBER_VEC): ... this.
743         * name-lookup.h (get_method_slot): Rename to ...
744         (get_member_slot): ... this.
745         (resort_type_method_vec): Rename to ...
746         (resort_type_member_vec): ... this.
747         * class.c (add_method, warn_hidden): Adjust.
748         * search.c (dfs_locate_field_accessor_pre): Adjust.
749         * name-lookup.c (method_vec_binary_search): Rename to ...
750         (member_vec_binary_search): ... this and adjust.
751         (method_vec_linear_search): Rename to ...
752         (member_vec_linear_search): ... this and adjust.
753         (fields_linear_search, get_class_binding_direct): Adjust.
754         (get_method_slot): Rename to ...
755         (get_member_slot): ... this and adjust.
756         (method_name_slot): Rename to ...
757         (member_name_slot): ... this and adjust.
758         (resort_type_method_vec): Rename to ...
759         (resort_type_member_vec): ... this and adjust.
760         (method_vec_append_class_fields): Rename to ...
761         (member_vec_append_class_fields): ... this and adjust.
762         (method_vec_append_enum_values): Rename to ...
763         (member_vec_append_enum_values): ... this and adjust.
764         (method_vec_dedup): Rename to ...
765         (member_vec_dedup): ... this and adjust.
766         (set_class_bindings, insert_late_enum_def_bindings): Adjust.
767         
768 2017-09-12  Paolo Carlini  <paolo.carlini@oracle.com>
770         PR c++/70621
771         * decl.c (start_decl): Early return error_mark_node if duplicate_decls
772         returns it; avoid misleading error message.
774 2017-09-12  Nathan Sidwell  <nathan@acm.org>
776         Kill CLASSTYPE_SORTED_FIELDS.
777         * cp-tree.h (struct lang_type): Lose sorted_fields member.
778         (CLASSTYPE_SORTED_FIELDS): Delete.
779         * name-lookup.h (set_class_bindings): Add EXTRA arg.
780         * name-lookup.c (fields_linear_search): New, broken out of ...
781         (lookup_field_1): ... here.  Delete remainder of function.
782         (get_class_binding_direct): Reimplement without sorted_fields.
783         (get_class_binding): Rename TYPE arg to KLASS, for consistency.
784         (get_method_slot): Call set_class_binding when creating method_vec
785         on complete type.
786         (method_name_cmp): Order identically named slots.
787         (sorted_fields_type_new): Delete.
788         (field_vc_append_class_fields): Rename to ...
789         (method_vec_append_class_fields): ... here.  Adjust.
790         (field_vec_append_enum_values): Renme to ...
791         (method_vec_append_enum_values): ... here. Adjust.
792         (method_vec_dedup): New.
793         (set_class_bindings): Reimplement.
794         (insert_late_enum_def_bindings): Reimplement.
796         * name-lookup.c (get_class_binding): Rename TYPE arg to KLASS for
797         consistency.
798         (restort_data): Move later.
799         (method_name_cmp, resort_method_name_cmp): Simplify.
800         (resort_type_method_vec): Reformat.
802 2017-09-09  Jason Merrill  <jason@redhat.com>
804         * constexpr.c (reduced_constant_expression_p): If
805         CONSTRUCTOR_NO_IMPLICIT_ZERO, check that all fields are initialized.
807 2017-09-09  Eric Botcazou  <ebotcazou@adacore.com>
809         PR bootstrap/81926
810         * cp-objcp-common.c (struct debug_type_hasher): New class.
811         (debug_type_hash): New variable.
812         (cp_get_debug_type): Associate the OFFSET_TYPEs with the types.
814 2017-09-08  Jason Merrill  <jason@redhat.com>
816         PR c++/70029 - ICE with ref-qualifier and -flto
817         * tree.c (cxx_copy_lang_qualifiers): New.
818         * cp-tree.h: Declare it.
819         * cp-objcp-common.h: Define LANG_HOOKS_COPY_LANG_QUALIFIERS.
821 2017-09-06  Jason Merrill  <jason@redhat.com>
823         PR c++/82053 - ICE with default argument in lambda in template
824         * pt.c (tsubst_arg_types): Substitute default arguments for lambdas
825         in templates.
826         (retrieve_specialization): Use lambda_fn_in_template_p.
827         * cp-tree.h: Declare it.
829         PR c++/82070 - error with nested lambda capture
830         * pt.c (tsubst_expr) [DECL_EXPR]: Register capture proxies with
831         register_local_specialization.
833 2017-09-06  Nathan Sidwell  <nathan@acm.org>
835         * name-lookup.h (lookup_field_1): Delete.
836         (get_class_binding_direct, get_class_binding): Add type_or_fns arg.
837         * name-lookup.c (lookup_field_1): make static
838         (method_vec_binary_search, method_vec_linear_search): New.  Broken
839         out of ...
840         (get_class_binding_direct): ... here.  Add TYPE_OR_FNS argument.
841         Do complete search of this level.
842         (get_class_binding): Adjust.
843         * decl.c (reshape_init_class): Call get_class_binding.
844         * search.c (lookup_field_r): Move field searching into
845         get_class_binding_direct.
847         * class.c (warn_hidden): Don't barf on non-functions.
848         * decl2.c (check_classfn): Likewise.  Check template match earlier.
850         * name-lookup.c (count_fields): Rename to ...
851         (count_class_fields): ... here.  Take a class, don't count
852         NULL-named fields.
853         (add_fields_to_record_type): Rename to ...
854         (field_vec_append_class_fields): ... here.  Take a class, don't
855         add NULL-named fields.
856         (add_enum_fields_to_record_type): Rename to ...
857         (field_vec_append_enum_values): ... here.
858         (set_class_bindings): Adjust, assert we added expected number.
859         (insert_late_enum_def_bindings): Reimplement.  Create vector if
860         there are now sufficient entries.
862         * name-lookup.h (lookup_fnfields_slot_nolazy,
863         lookup_fnfields_slot): Rename to ...
864         (get_class_binding_direct, get_class_binding): ... here.
865         * name-lookup.c (lookup_fnfields_slot_nolazy,
866         lookup_fnfields_slot): Rename to ...
867         (get_class_binding_direct, get_class_binding): ... here.
868         * cp-tree.h (CLASSTYPE_CONSTRUCTORS, CLASSTYPE_DESTRUCTOR): Adjust.
869         * call.c (build_user_type_conversion_1): Adjust.
870         (has_trivial_copy_assign_p): Adjust.
871         (has_trivial_copy_p): Adjust.
872         * class.c (get_basefndecls) Adjust.
873         (vbase_has_user_provided_move_assign) Adjust.
874         (classtype_has_move_assign_or_move_ctor_p): Adjust.
875         (type_build_ctor_call, type_build_dtor_call): Adjust.
876         * decl.c (register_dtor_fn): Adjust.
877         * decl2.c (check_classfn): Adjust.
878         * pt.c (retrieve_specialization): Adjust.
879         (check_explicit_specialization): Adjust.
880         (do_class_deduction): Adjust.
881         * search.c (lookup_field_r): Adjust.
882         (look_for_overrides_here, lookup_conversions_r): Adjust.
883         * semantics.c (classtype_has_nothrow_assign_or_copy_p): Adjust.
884         * tree.c (type_has_nontrivial_copy_init): Adjust.
885         * method.c (lazily_declare_fn): Adjust comment.
887 2017-09-05  Nathan Sidwell  <nathan@acm.org>
889         * name-lookup.c (do_class_using_decl): Elide read-once temps.
890         Move declarations to initializations.
892         * class.c (add_method): Move slot search and insertion to ...
893         * name-lookup.c (get_method_slot): ... this new function.
894         (lookup_fnfields_slot_nolazy): Cope with NULL slot.
895         * name-lookup.h (get_method_slot): Declare.
896         * decl.c (cxx_init_decl_processinng): Give conv_op_marker a more
897         realistic type.
898         (grok_special_member_properties): Set
899         TYPE_HAS_CONVERSION. Expicitly look at DECL_NAME for specialness.
900         Improve TYPE_HAS_CONSTEXPR_CTOR setting.        
902         * cp-tree.h (lang_decl_base): Rename template_conv_p to
903         unknown_bound_p.
904         (DECL_CONV_FN_P): Don't check NULL DECL_NAME.
905         (DECL_CONV_FN_TYPE): FN must be conv op.
906         (DECL_TEMPLATE_CONV_FN_P): Delete.
907         (VAR_HAD_UNKNOWN_BOUND, SET_VAR_HAD_UNKNOWN_BOUND): Adjust.
908         * pt.c (push_template_decl_real): Delete DECL_TEMPLATE_CONV_FN_P
909         setting.
911         * class.c (unreverse_member_declarations): Remove extraneous if.
912         * pt.c (push_template_decl_real): Use string concatenation, not
913         \<newline>.  Add %<..%>.
915 2017-09-05  Paolo Carlini  <paolo.carlini@oracle.com>
917         PR c++/81942
918         * cp-tree.h (LABEL_DECL_CDTOR): Add and document.
919         * decl.c (start_preparsed_function): Set LABEL_DECL_CDTOR when
920         creating cdtor_label.
921         * constexpr.c (returns): Add the case of a constructor/destructor
922         returning via a LABEL_DECL_CDTOR label.
923         (cxx_eval_constant_expression, case [GOTO_EXPR]): Likewise.
925 2017-09-01  Nathan Sidwell  <nathan@acm.org>
927         * cp-tree.h (resort_type_method_vec): Move declaration to ...
928         * name-lookup.h (resort_type_method_vec): ... here.
929         (set_class_bindings): Lose 2nd arg.
930         * class.c (finish_struct_1, finish_struct): Adjust
931         set_class_bindings call.  Don't call finish_struct_methods.
932         (resort_data, method_name_cmp, resort_method_name_cmp,
933         resort_type_method_vec, finish_struct_methods): Move to ...
934         * name-lookup.c (resort_data, method_name_cmp,
935         resort_method_name_cmp, resort_type_method_vec): ... here.
936         (set_class_bindings): Lose fields arg.  Swallow finish_struct_methods.
938         * class.c (finish_struct): Call set_class_bindings for the
939         template case too.
941         * class.c (finish_struct_methods): Dont clear DECL_IN_AGGR_P here.
942         Don't call maybe_warn_about_overly_private_class here.
943         (warn_hidden): Cleanup declarations and comments.
944         (type_has_user_provided_constructor): No need to check
945         CLASSTYPE_METHOD_VEC.
946         (type_has_user_provided_or_explicit_constructor): Likewise.
947         (classtype_has_move_assign_or_move_ctor_p): Likewise.
948         (check_bases_and_members): Don't call finish_struct_methods here.
949         (finish_struct_1): Call finish_struct_methods and
950         set_class_bindings immediately after layout.  Clear DECL_IN_AGGR_P
951         here.
952         (finish_struct): For templates process USING_DECLS and clear
953         DECL_IN_AGGR_P before calling finish_struct_methods. Call
954         maybe_warn_about_overly_private_class here.
956         Revert 2017-08-28  Nathan Sidwell  <nathan@acm.org>
957         Restore sorted_fields vector.
958         * cp-tree.h (lang_type): Restore sorted_fields vector.
959         (CLASSTYPE_SORTED_FIELDS): Restore.
960         (CLASSTYPE_BINDINGS): Delete.
961         * name-lookup.c (lookup_field_1): Restore binary search.
962         (sorted_fields_type_new, count_fields,
963         add_fields_to_record_type, add_enum_fields_to_record_type): Restore
964         (set_class_bindings): Revert.
965         (insert_late_enum_def_binding): Restore field_vec insertion.
967 2017-09-01  Jakub Jelinek  <jakub@redhat.com>
969         PR c/81887
970         * parser.c (cp_parser_omp_ordered): Handle -fopenmp-simd.
972 2017-09-01  Marek Polacek  <polacek@redhat.com>
974         PR c++/82040
975         * typeck.c (cp_build_unary_op): Avoid re-entering reporting routines.
977 2017-08-30  Jason Merrill  <jason@redhat.com>
979         PR c++/82029 - __PRETTY_FUNCTION__ in lambda in template
980         * pt.c (enclosing_instantiation_of, lambda_fn_in_template_p)
981         (regenerated_lambda_fn_p): New.
982         (tsubst_decl) [VAR_DECL]: Use enclosing_instantiation_of.
983         (tsubst_copy) [VAR_DECL]: Likewise.
985         PR c++/82030 - ICE inheriting from multiple lambdas
986         PR c++/80767
987         * call.c (compare_ics): Handle null candidate.
989 2017-08-30  Ville Voutilainen  <ville.voutilainen@gmail.com>
991         Make taking the address of an overloaded function a non-deduced context
993         * pt.c (unify_overload_resolution_failure): Remove.
994         (unify_one_argument): Adjust.
996 2017-08-30  Richard Sandiford  <richard.sandiford@linaro.org>
997             Alan Hayward  <alan.hayward@arm.com>
998             David Sherwood  <david.sherwood@arm.com>
1000         * typeck.c (cp_build_binary_op): Use SCALAR_TYPE_MODE.
1002 2017-08-30  Richard Sandiford  <richard.sandiford@linaro.org>
1003             Alan Hayward  <alan.hayward@arm.com>
1004             David Sherwood  <david.sherwood@arm.com>
1006         * cvt.c (cp_convert_to_pointer): Use SCALAR_INT_TYPE_MODE.
1008 2017-08-30  Richard Sandiford  <richard.sandiford@linaro.org>
1009             Alan Hayward  <alan.hayward@arm.com>
1010             David Sherwood  <david.sherwood@arm.com>
1012         * mangle.c (write_real_cst): Use SCALAR_FLOAT_TYPE_MODE
1013         instead of TYPE_MODE.
1015 2017-08-29  Jason Merrill  <jason@redhat.com>
1017         PR c++/81236 - ICE with template-id in generic lambda
1018         * semantics.c (finish_id_expression): Remove special dependent case.
1019         Avoid some later pieces when dependent.
1020         (finish_qualified_id_expr): Do normal BASELINK handling in a
1021         template.  Always build a SCOPE_REF for a destructor BIT_NOT_EXPR.
1022         (parsing_default_capturing_generic_lambda_in_template): Remove.
1023         * parser.c (cp_parser_postfix_dot_deref_expression): Always give an
1024         error for types that will never be complete.
1025         * mangle.c (write_expression): Add sanity check.
1026         * tree.c (build_qualified_name): Add sanity check.
1027         (cp_walk_subtrees): Walk into the class context of a BASELINK.
1028         * lambda.c (add_capture): Improve diagnostic for generic lambda
1029         capture failure.
1030         * call.c (build_new_method_call_1): Print the right constructor
1031         name.
1033         Reimplement handling of lambdas in templates.
1034         * cp-tree.h (LAMBDA_FUNCTION_P): Check DECL_DECLARES_FUNCTION_P.
1035         * decl.c (start_preparsed_function): Call start_lambda_scope.
1036         (finish_function): Call finish_lambda_scope.
1037         * init.c (get_nsdmi): Call start/finish_lambda_scope.
1038         * lambda.c (start_lambda_scope): Only ignore VAR_DECL in a function.
1039         * parser.c (cp_parser_function_definition_after_declarator): Don't
1040         call start/finish_lambda_scope.
1041         * pt.c (retrieve_specialization): Ignore lambda functions in
1042         templates.
1043         (find_parameter_packs_r): Ignore capture proxies.  Look into
1044         lambdas.
1045         (check_for_bare_parameter_packs): Allow bare packs in lambdas.
1046         (tsubst_default_argument): Call start/finish_lambda_scope.
1047         (tsubst_function_decl): Handle lambda functions differently.
1048         (tsubst_template_decl): Likewise.
1049         (tsubst_expr) [DECL_EXPR]: Skip closure declarations and capture
1050         proxies.
1051         (tsubst_lambda_expr): Create a new closure rather than instantiate
1052         the one from the template.
1053         (tsubst_copy_and_build): Don't register a specialization of a pack.
1054         (regenerate_decl_from_template): Call start/finish_lambda_scope.
1055         (instantiate_decl): Remove special lambda function handling.
1056         * semantics.c (process_outer_var_ref): Remove special generic lambda
1057         handling.  Don't implicitly capture in a lambda in a template.  Look
1058         for an existing proxy.
1059         * class.c (current_nonlambda_class_type): Use decl_type_context.
1061         * cp-tree.h (LAMBDA_EXPR_CLOSURE): Use TREE_TYPE.
1062         (LAMBDA_EXPR_RETURN_TYPE): Remove.
1063         (struct tree_lambda_expr): Remove closure and return_type fields.
1064         * lambda.c (build_lambda_expr): Don't set LAMBDA_EXPR_RETURN_TYPE.
1065         * pt.c (tsubst_copy_and_build): Likewise.
1066         * parser.c (cp_parser_lambda_declarator_opt): Track return type.
1067         (cp_parser_lambda_body): Adjust unspecified return type check.
1068         * ptree.c (cxx_print_lambda_node): Don't print closure or
1069         return type.
1071         PR c++/80935 - wrong C++17 error with lambda
1072         * decl.c (check_for_uninitialized_const_var): Check
1073         is_instantiation_of_constexpr.
1074         * constexpr.c (ensure_literal_type_for_constexpr_object): Check
1075         is_instantiation_of_constexpr.
1076         (potential_constant_expression_1): Check var_in_maybe_constexpr_fn.
1078         * lambda.c (build_lambda_object): Check for error_mark_node.
1079         * pt.c (make_pack_expansion): Set PACK_EXPANSION_LOCAL_P on the type
1080         pack as well.
1081         (tsubst_decl) [FUNCTION_DECL]: Set DECL_CONTEXT on the parameters.
1082         (tsubst) [TEMPLATE_PARM_INDEX]: Check for error_mark_node.
1084         PR c++/80767 - unnecessary instantiation of generic lambda
1085         * call.c (convert_like_real): Call build_user_type_conversion_1 if
1086         cand is null.
1087         (add_conv_candidate): Build a ck_user conversion with no candidate.
1089         Fix lambdas in template default argument of inherited ctor.
1090         * method.c (synthesized_method_base_walk): Replace an inherited
1091         template with its specialization.
1092         (synthesized_method_walk): Make inheriting_ctor a pointer.
1093         (maybe_explain_implicit_delete, explain_implicit_non_constexpr)
1094         (deduce_inheriting_ctor, implicitly_declare_fn): Adjust.
1096         * pt.c (build_deduction_guide): Set DECL_ABSTRACT_ORIGIN on the
1097         template, not the function.
1098         (template_guide_p): Adjust.
1100         Support copying local_specializations.
1101         * cp-tree.h (enum lss_policy): New.
1102         (local_specialization_stack): Add policy parameter to default ctor.
1103         * pt.c (local_specialization_stack): Copy local_specializations if
1104         lss_copy.
1106         * constexpr.c (potential_constant_expression_1): Add "now" parm.
1107         (is_constant_expression, require_constant_expression): New.
1108         (is_static_init_expression, is_nondependent_constant_expression)
1109         (is_nondependent_static_init_expression): Drop "potential".
1110         * except.c (build_must_not_throw_expr): Do type conversion on
1111         value-dependent argument.
1112         * pt.c, semantics.c, typeck2.c: Use variants without "potential".
1114         Instantiate default arguments/member initializers once.
1115         * init.c (get_nsdmi): Remember NSDMI instantiations.
1116         * parser.c (inject_this_parameter): Be more picky about
1117         current_class_ptr.
1118         * pt.c (tsubst_copy): Simplify 'this' handling.
1119         (tsubst_default_argument): Remember default argument
1120         instantiations.  Take parameter number.
1121         (tsubst_default_arguments): Pass it.
1122         * call.c (convert_default_arg): Likewise.
1124         Fix default argument conversion failure and SFINAE.
1125         * call.c (build_over_call): Check convert_default_arg result for
1126         error_mark_node.
1127         * parser.c (cp_parser_late_parsing_default_args): Remember
1128         error_mark_node.
1130 2017-08-28  Nathan Sidwell  <nathan@acm.org>
1132         * cp-tree.h (lang_type): Replace sorted_fields vector with
1133         bindings map.
1134         (CLASSTYPE_SORTED_FIELDS): Delete.
1135         (CLASSTYPE_BINDINGS): New.
1136         * decl.c (finish_enum_value_list): Swap args of
1137         insert_late_enum_def_bindings.
1138         * name-lookup.c (lookup_field_1): Replace binary search of sorted
1139         fields with map->get.
1140         (sorted_fields_type_new, count_fields,
1141         add_fields_to_record_type, add_enum_fields_to_record_type): Delete.
1142         (add_class_member, add_class_members): New.
1143         (set_class_bindings): Create map and insert.
1144         (insert_late_enum_def_binding): Swap parms.  Use add_clasS_member.
1145         * ptree.c (cxx_print_type): Delete sorted fields printing.
1147         * cp-tree.h (insert_late_enum_def_into_classtype_sorted_fields):
1148         Delete.
1149         * name-lookup.h (set_class_bindings,
1150         insert_late_enum_def_bindings): Declare.
1151         * decl.c (finish_enum_value_list): Adjust for
1152         insert_late_enum_def_bindings name change.
1153         * class.c (finish_struct_1): Call set_class_bindings.
1154         (count_fields, add_fields_to_record_type,
1155         add_enum_fields_to_record_type, sorted_fields_type_new,
1156         insert_into_classtype_sorted_fields,
1157         insert_late_enum_def_into_classtype_sorted_fields): Move to ...
1158         * name-lookup.h (count_fields, add_fields_to_record_type,
1159         add_enum_fields_to_record_type, sorted_fields_type_new,
1160         set_class_bindings, insert_late_enum_def_bindings): ... here.
1162 2017-08-25  Nathan Sidwell  <nathan@acm.org>
1164         * class.c (method_name_cmp, resort_method_name_cmp): Methods
1165         can never be NULL.
1167         Conversion operators have a special name
1168         * cp-tree.h (CPTI_CONV_OP_MARKER, CPTI_CONV_OP_IDENTIFIER): New.
1169         (conv_op_marker, conv_op_identifier): New.
1170         (CLASSTYPE_FIRST_CONVERSION_SLOT): Delete.
1171         * decl.c (initialize_predefined_identifiers): Add
1172         conv_op_identifier.
1173         (cxx_init_decl_processing): Create conv_op_marker.
1174         * decl2.c (check_classfn): Lookup conv-ops by name.
1175         * class.c (add_method): Use conv_op_identifier & conv_op_marker.
1176         (resort_type_method_vec): Don't skip conv-ops.
1177         (finish_struct_methods, warn_hidden): Likewise.
1178         * name-lookup.h (lookup_all_conversions): Delete.
1179         * name-lookup.c (lookup_conversion_operator): Replace with ...
1180         (extract_conversion_operator): ... this.
1181         (lookup_fnfields_slot_nolazy): Find conv-ops by name.
1182         (lookup_all_conversions): Delete.
1183         * pt.c (check_explicit_specialization): Find conv-ops by name.
1184         * search.c (lookup_conversions_r): Likewise.
1186 2017-08-24  Nathan Sidwell  <nathan@acm.org>
1188         Conversion operators kept on single overload set
1189         * class.c (add_method): Keep all conv-ops on one slot.
1190         * name-lookup.c (lookup_conversion_operator): Pull the desired
1191         conv op out of overload set.
1192         * search.c (lookup_conversions_r): Lose template/non-template
1193         distinction.
1194         (lookup_conversions): Likewise.
1196 2017-08-23  Nathan Sidwell  <nathan@acm.org>
1198         * cp-tree.h (lookup_field_1, lookup_fnfields_slot,
1199         lookup_fnfields_slot_nolazy, lookup_all_conversions): Move
1200         declatations to ...
1201         * name-lookup.h (lookup_field_1, lookup_fnfields_slot,
1202         lookup_fnfields_slot_nolazy, lookup_all_conversions): ... here.
1203         * search.c (lookup_conversion_operator,
1204         lookup_fnfields_slot_nolazy, lookup_field_1, lookup_fnfields_slot,
1205         lookup_all_conversions): Move to ...
1206         * name-lookup.c (lookup_conversion_operator,
1207         lookup_fnfields_slot_nolazy, lookup_field_1, lookup_fnfields_slot,
1208         lookup_all_conversions): ... here.
1210         * semantics.c (finish_member_declaration): Move USING_DECL check
1211         earlier.  Always set C++ linkage.  Commonize TYPE_FIELD and
1212         template decl list insertion.
1214         * cp-tree.h (maybe_version_functions): Declare.
1215         * decl.c (decls_match): Break function versioning check to
1216         separate function.  Call it.
1217         (maybe_version_functions): Broken out of decls_match.
1218         * class.c (add_method): Use maybe_version_functions.
1220         * cp-tree.h (print_search_statistics,
1221         reinit_search_statistics): Don't declare.
1222         * search.c (n_fields_searched, n_calls_lookup_field,
1223         n_calls_lookup_field_1, n_calls_lookup_fnfields,
1224         n_calls_lookup_fnfields_1, n_calls_get_base_type,
1225         n_outer_fields_searched, n_contexts_saved): Delete.
1226         (lookup_field_1, lookup_member,
1227         lookup_fnfields_slot_nolazy): Remove stat gathering.
1228         (print_search_statistics, reinit_search_statistics): Delete.
1229         * tree.c (cxx_print_statistics): Don't print search stats.
1231 2017-08-21  Nathan Sidwell  <nathan@acm.org>
1233         * search.c (lookup_field_r): Remove obsolete code for type-named
1234         field in PoD.
1236         * search.c (lookup_field_1): Assert TYPE is a class and VFIELD
1237         isn't special.
1238         (lookup_field_fuzzy_info::fuzzy_lookup_fnfields): Delete.
1239         (lookup_field_fuzzy_r): Adjust.
1241 2017-08-21  David Malcolm  <dmalcolm@redhat.com>
1243         * call.c (build_over_call): Pass NULL for new parameter to
1244         check_function_arguments.
1245         * typeck.c (cp_build_function_call_vec): Likewise.
1247 2017-08-21  Nathan Sidwell  <nathan@acm.org>
1249         PR c++/81899
1250         * pt.c (instantiate_class_template_1):
1251         BOUND_TEMPLATE_TEMPLATE_PARM is never friend-injected.
1253 2017-08-18  David Malcolm  <dmalcolm@redhat.com>
1255         PR c++/81514
1256         * name-lookup.c (maybe_suggest_missing_header): Convert return
1257         type from void to bool; return true iff a suggestion was offered.
1258         (suggest_alternative_in_explicit_scope): Move call to
1259         maybe_suggest_missing_header to before use of best_match, and
1260         return true if the former offers a suggestion.
1262 2017-08-18  H.J. Lu  <hongjiu.lu@intel.com>
1264         PR c/53037
1265         * decl.c (duplicate_decls): Also merge DECL_WARN_IF_NOT_ALIGN.
1266         * decl2.c (grokbitfield): Don't allow bit-field with
1267         warn_if_not_aligned type.
1269 2017-08-17  Nathan Sidwell  <nathan@acm.org>
1271         * cp-tree.def (TEMPLATE_TEMPLATE_PARM): Remove stale comment.
1272         * cp-tree.h (ENUM_TEMPLATE_INFO): Delete.
1273         (TYPE_TEMPLATE_INFO): Simplify.
1274         (SET_TYPE_TEMPLATE_INFO): Simplify.
1276         * lex.c (maybe_add_lang_type_raw): BOUND_TEMPLATE_TEMPLATE_PARMs
1277         don't need lang_type.
1278         (cxx_make_type): Use maybe_add_lang_type_raw return value.
1279         * mangle.c (CLASSTYPE_TEMPLATE_ID_P): Don't rely on
1280         TYPE_LANG_SPECIFIC.
1282         * cp-tree.h (struct lang_type): Remove template_info field.
1283         (CLASSTYPE_TEMPLATE_INFO): Use TYPE_LANG_SLOT_1.
1284         (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO): Likewise.
1286 2017-08-14  Martin Sebor  <msebor@redhat.com>
1288         PR c/81117
1289         * error.c (cp_printer): Handle 'G'.
1291 2017-08-11  Martin Liska  <mliska@suse.cz>
1293         * decl2.c (get_tls_init_fn): Replace ASM_OUTPUT_DEF with
1294         TARGET_SUPPORTS_ALIASES.
1295         (handle_tls_init): Likewise.
1296         (note_mangling_alias): Likewise.  Remove ATTRIBUTE_UNUSED for
1297         both arguments.
1298         * optimize.c (can_alias_cdtor): Likewise.
1300 2017-08-11  Jason Merrill  <jason@redhat.com>
1302         PR c++/81671 - nullptr_t template parameter
1303         * pt.c (convert_nontype_argument): Fix nullptr_t check.
1305 2017-08-10  Jason Merrill  <jason@redhat.com>
1307         PR c++/81359 - Unparsed NSDMI error from SFINAE context.
1308         * method.c (synthesized_method_walk): Don't diagnose lack of
1309         operator delete.
1311         PR c++/80452 - Core 1579, implicit move semantics on return/throw
1312         * cp-tree.h (LOOKUP_PREFER_RVALUE): Now means that we've already
1313         tentatively changed the lvalue to an rvalue.
1314         * call.c (reference_binding): Remove LOOKUP_PREFER_RVALUE handling.
1315         (build_over_call): If LOOKUP_PREFER_RVALUE, check that the first
1316         parameter is an rvalue reference.
1317         * except.c (build_throw): Do maybe-rvalue overload resolution twice.
1318         * typeck.c (check_return_expr): Likewise.
1320 2017-08-10  David Malcolm  <dmalcolm@redhat.com>
1322         * parser.c (cp_parser_error): Update for new param to
1323         c_parse_error.
1324         (class token_pair): New class.
1325         (struct matching_paren_traits): New struct.
1326         (matching_parens): New typedef.
1327         (struct matching_brace_traits): New struct.
1328         (matching_braces): New typedef.
1329         (cp_parser_statement_expr): Convert explicit parsing of
1330         CPP_OPEN_PAREN and CPP_CLOSE_PAREN to use of
1331         class matching_parens, so that the pertinent open parenthesis is
1332         highlighted when there are problems locating the close
1333         parenthesis.
1334         (cp_parser_primary_expression): Likewise.
1335         (cp_parser_compound_literal_p): Remove consumption of opening
1336         paren.
1337         (cp_parser_postfix_expression): Convert explicit parsing of
1338         CPP_OPEN_PAREN and CPP_CLOSE_PAREN to use matching parens, as
1339         above.  Use it to consume the opening paren previously consumed by
1340         cp_parser_compound_literal_p.
1341         (cp_parser_parenthesized_expression_list): Likewise.
1342         (cp_parser_unary_expression): Likewise.
1343         (cp_parser_new_expression): Likewise.
1344         (cp_parser_cast_expression): Likewise.
1345         (cp_parser_builtin_offsetof): Likewise.
1346         (cp_parser_trait_expr): Likewise.
1347         (cp_parser_lambda_declarator_opt): Likewise.
1348         (cp_parser_lambda_body): Likewise, for matching_braces.
1349         (cp_parser_compound_statement): Likewise.
1350         (cp_parser_selection_statement): Likewise, for matching_parens.
1351         (cp_parser_iteration_statement): Likewise.
1352         (cp_parser_already_scoped_statement): Likewise, for
1353         matching_braces.
1354         (cp_parser_linkage_specification): Likewise.
1355         (cp_parser_static_assert): Likewise, for matching_parens.
1356         (cp_parser_decltype): Likewise.
1357         (cp_parser_operator): Likewise.
1358         (cp_parser_enum_specifier): Likewise.
1359         (cp_parser_namespace_definition): Likewise.
1360         (cp_parser_direct_declarator): Likewise.
1361         (cp_parser_braced_list): Likewise.
1362         (cp_parser_class_specifier_1): Likewise, for matching_braces.
1363         (cp_parser_constant_initializer): Likewise.
1364         (cp_parser_noexcept_specification_opt): Likewise, for
1365         matching_parens.
1366         (cp_parser_exception_specification_opt): Likewise.
1367         (cp_parser_handler): Likewise.
1368         (cp_parser_asm_specification_opt): Likewise.
1369         (cp_parser_asm_operand_list): Likewise.
1370         (cp_parser_gnu_attributes_opt): Likewise.
1371         (cp_parser_std_attribute_spec): Likewise.
1372         (cp_parser_requirement_parameter_list): Likewise.
1373         (cp_parser_requirement_body): Likewise, for matching_braces.
1374         (cp_parser_compound_requirement): Likewise.
1375         (cp_parser_template_introduction): Likewise.
1376         (cp_parser_sizeof_pack): Likewise, for matching_parens.
1377         (cp_parser_sizeof_operand): Likewise; use it to consume the
1378         opening paren previously consumed by cp_parser_compound_literal_p.
1379         (get_matching_symbol): New function.
1380         (cp_parser_required_error): Add param "matching_location".  Remove
1381         calls to cp_parser_error, instead setting a non-NULL gmsgid, and
1382         handling it if set by calling c_parse_error, potentially with a
1383         secondary location if matching_location was set.
1384         (cp_parser_require): Add param "matching_location", with a default
1385         value of UNKNOWN_LOCATION.
1386         (cp_parser_require_keyword): Update for new param of
1387         cp_parser_required_error.
1388         (cp_parser_objc_encode_expression): Update to class matching_parens
1389         as above.
1390         (cp_parser_objc_defs_expression): Likewise.
1391         (cp_parser_objc_protocol_expression): Likewise.
1392         (cp_parser_objc_selector_expression): Likewise.
1393         (cp_parser_objc_typename): Likewise.
1394         (cp_parser_objc_superclass_or_category): Likewise.
1395         (cp_parser_objc_try_catch_finally_statement): Likewise.
1396         (cp_parser_objc_synchronized_statement): Likewise.
1397         (cp_parser_objc_at_property_declaration): Likewise.
1398         (cp_parser_oacc_single_int_clause): Likewise.
1399         (cp_parser_oacc_shape_clause): Likewise.
1400         (cp_parser_omp_clause_collapse): Likewise.
1401         (cp_parser_omp_clause_default): Likewise.
1402         (cp_parser_omp_clause_final): Likewise.
1403         (cp_parser_omp_clause_if): Likewise.
1404         (cp_parser_omp_clause_num_threads): Likewise.
1405         (cp_parser_omp_clause_num_tasks): Likewise.
1406         (cp_parser_omp_clause_grainsize): Likewise.
1407         (cp_parser_omp_clause_priority): Likewise.
1408         (cp_parser_omp_clause_hint): Likewise.
1409         (cp_parser_omp_clause_defaultmap): Likewise.
1410         (cp_parser_omp_clause_ordered): Likewise.
1411         (cp_parser_omp_clause_schedule): Likewise.
1412         (cp_parser_omp_clause_num_teams): Likewise.
1413         (cp_parser_omp_clause_thread_limit): Likewise.
1414         (cp_parser_omp_clause_aligned): Likewise.
1415         (cp_parser_omp_clause_linear): Likewise.
1416         (cp_parser_omp_clause_safelen): Likewise.
1417         (cp_parser_omp_clause_simdlen): Likewise.
1418         (cp_parser_omp_clause_depend): Likewise.
1419         (cp_parser_omp_clause_device): Likewise.
1420         (cp_parser_omp_clause_dist_schedule): Likewise.
1421         (cp_parser_oacc_clause_async): Likewise.
1422         (cp_parser_omp_critical): Likewise.
1423         (cp_parser_omp_for_loop): Likewise.
1424         (cp_parser_omp_sections_scope): Likewise.
1425         (cp_parser_omp_declare_reduction_exprs): Likewise.
1426         Update for new param to cp_parser_required_error.
1427         (cp_parser_oacc_routine): Likewise.
1428         (cp_parser_transaction_expression): Likewise.
1429         (cp_parser_cilk_simd_vectorlength): Likewise.
1431 2017-08-09  Jason Merrill  <jason@redhat.com>
1433         PR c++/81525 - wrong constant value with generic lambda
1434         * pt.c (tsubst_decl) [VAR_DECL]: Avoid clobbering auto.
1435         (tsubst_copy) [VAR_DECL]: Handle auto.
1437         PR c++/81359 - Unparsed NSDMI error from SFINAE context.
1438         * init.c (get_nsdmi): Add complain parm.
1439         * typeck2.c (digest_nsdmi_init): Add complain parm.
1440         (process_init_constructor_record): Pass complain to get_nsdmi.
1441         * pt.c (maybe_instantiate_noexcept): Add complain parm, return bool.
1442         * method.c (get_defaulted_eh_spec): Add complain parm.  Pass it into
1443         synthesized_method_walk.
1444         (synthesized_method_walk): Adjust.
1445         (walk_field_subobs): Pass complain to get_nsdmi.
1446         (defaulted_late_check): Skip other checks if deleted.
1447         * decl2.c (mark_used): Pass complain to maybe_instantiate_noexcept.
1448         * call.c (build_aggr_conv): Pass complain to get_nsdmi.
1449         * parser.c (defarg_location): New.
1450         * error.c (location_of): Use it.
1452 2017-08-09  Marek Polacek  <polacek@redhat.com>
1454         * parser.c (cp_parser_perform_range_for_lookup): Use false instead of 0.
1455         * typeck.c (build_binary_op): Change the type of a parameter to bool.
1456         (cp_truthvalue_conversion): Use true instead of 1.
1458 2017-08-08  Marek Polacek  <polacek@redhat.com>
1460         PR c++/81607
1461         * cp-gimplify.c (cp_fold): If folding exposed a branch of
1462         a COND_EXPR, convert it to the original type of the COND_EXPR, if
1463         they differ.               
1465 2017-08-08  Martin Liska  <mliska@suse.cz>
1467         * call.c: Include header files.
1468         * cp-gimplify.c: Likewise.
1469         * cp-ubsan.c: Likewise.
1470         * cvt.c: Likewise.
1471         * init.c: Likewise.
1472         * search.c: Likewise.
1473         * semantics.c: Likewise.
1474         * typeck.c: Likewise.
1476 2017-08-07  Martin Liska  <mliska@suse.cz>
1478         * parser.c (cp_parser_gnu_attribute_list): Canonicalize name of an
1479         attribute.
1480         (cp_parser_std_attribute): Likewise.
1481         * tree.c: Add new include.
1483 2017-08-04  Paolo Carlini  <paolo.carlini@oracle.com>
1485         PR c++/79790
1486         * pt.c (do_class_deduction): Handle the case of no viable implicit
1487         deduction guides; simplify the code generating implicit deduction
1488         guides.
1490 2017-08-03  Paolo Carlini  <paolo.carlini@oracle.com>
1492         PR c++/71440
1493         * typeck.c (build_x_unary_op): Avoid pretty-printing constructor /
1494         destructor as expressions.
1496 2017-08-02  Jakub Jelinek  <jakub@redhat.com>
1498         PR c++/81640
1499         * call.c (build_user_type_conversion_1): Only call
1500         lookup_fnfields_slot if totype is CLASS_TYPE_P.
1502 2017-07-31  Jason Merrill  <jason@redhat.com>
1504         * decl.c (declare_global_var): Set DECL_CONTEXT.
1506 2017-07-31  Jan Hubicka <hubicka@ucw.cz>
1507             Martin Liska  <mliska@suse.cz>
1509         * pt.c (tsubst_copy): Copy PREDICT_EXPR.
1510         * semantics.c (finish_goto_stmt): Build gimple predict
1511         stament.
1512         * constexpr.c (potential_constant_expression_1): Handle
1513         PREDICT_EXPR.
1515 2017-07-31  Martin Liska  <mliska@suse.cz>
1517         PR sanitize/81530
1518         * cp-gimplify.c (cp_genericize): Guard condition with flag_sanitize_p
1519         also with current_function_decl non-null equality.
1520         * cp-ubsan.c (cp_ubsan_instrument_vptr_p): Likewise.
1521         * decl.c (compute_array_index_type): Likewise.
1522         * init.c (finish_length_check): Likewise.
1523         * typeck.c (cp_build_binary_op): Likewise.
1525 2017-07-29  Jakub Jelinek  <jakub@redhat.com>
1527         * cp-objcp-common.c (cp_decl_dwarf_attribute): Handle
1528         DW_AT_export_symbols.
1529         * name-lookup.c (emit_debug_info_using_namespace): Add IMPLICIT
1530         argument, pass it through to the debug hook.
1531         (finish_namespace_using_directive): Adjust
1532         emit_debug_info_using_namespace caller.
1533         (push_namespace): Likewise.  Call it after setting
1534         DECL_NAMESPACE_INLINE_P.
1535         (cp_emit_debug_info_for_using): Pass false as new argument to
1536         the imported_module_or_decl debug hook.
1538 2017-07-28  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
1540         * lex.c (copy_decl): Adjust.
1541         (copy_type): Likewise.
1543 2017-07-26  Paolo Carlini  <paolo.carlini@oracle.com>
1545         PR c++/71570
1546         * lambda.c (add_capture): Early return if we cannot capture by
1547         reference.
1549 2017-07-26  Jason Merrill  <jason@redhat.com>
1551         P0702R1 - List deduction of vector.
1552         * pt.c (do_class_deduction): Special-case deduction from a single
1553         element of related type.
1555 2017-07-26  Leonid Koppel  <lkoppel@uwaterloo.ca>
1557         PR c++/67054 - Inherited ctor with non-default-constructible members
1558         * method.c (walk_field_subobs) Consider member initializers (NSDMIs)
1559         when deducing an inheriting constructor.
1561 2017-07-21  Nathan Sidwell  <nathan@acm.org>
1563         * search.c (lookup_conversion_operator): Return overloads.
1564         (lookup_fnfields_idx_nolazy): Absorb into ...
1565         (lookup_fnfields_slot_nolaxy): ... here.
1566         (lookup_fnfields_1): Absorb into ...
1567         (lookup_fnfields_slot): ... here.
1569         Remove special CDtor METHOD_VEC slots.
1570         * cp-tree.h (CLASSTYPE_CONSTRUCTOR_SLOT,
1571         CLASSTYPE_DESTRUCTOR_SLOT): Delete.
1572         (CLASSTYPE_CONSTRUCTORS): Use lookup_fnfields_slot_nolazy.
1573         (CLASSTYPE_DESTRUCTOR): Likewise.
1574         * class (add_method): Don't use special cdtor slots.
1575         * search.c (lookup_fnfields_idx_nolazy): Likewise.
1576         (look_for_overrides_here): Use lookup_fnfields_slot.
1577         * semantics (classtype_has_nothrow_assign_or_copy_p): Likewise.
1579         * call.c (add_candidates): Move decls to initialization.  Don't
1580         use !!.
1582 2017-07-20  Nathan Sidwell  <nathan@acm.org>
1584         Remove TYPE_METHODS.
1585         * class.c (maybe_warn_about_overly_private_class,
1586         finish_struct_methods, one_inheriting_sig, count_fields,
1587         add_fields_to_record_type, check_field_decls, check_methods,
1588         clone_function_decl, set_method_tm_attributes,
1589         finalize_literal_type_property, check_bases_and_members,
1590         create_vtable_ptr, determine_key_method,
1591         unreverse_member_declarations, finish_struct,
1592         add_vcall_offset_vtbl_entries_1): Member fns are on TYPE_FIELDS.
1593         * decl.c (fixup_anonymous_aggr): Likewise.
1594         * decl2.c (reset_type_linkage_2): Likewise.
1595         * method.c (after_nsdmi_defaulted_late_checks,
1596         lazily_declare_fn): Likewise.
1597         * optimize.c (maybe_thunk_body, maybe_clone_body): Likewise.
1598         * pt.c (instantiate_class_template_1, tsubst_expr,
1599         do_type_instantiation, instantiate_pending_templates): Likewise.
1600         * search.c (lookup_field_1): Likewise.
1601         * semantics.c (finish_member_declaration,
1602         finish_omp_declare_simd_methods): Likewise.
1604 2017-07-19  Nathan Sidwell  <nathan@acm.org>
1606         * class.c (add_implicitly_declared_members): Use
1607         classtype_has_move_assign_or_move_ctor_p.
1608         (classtype_has_move_assign_or_move_ctor,
1609         classtype_has_user_move_assign_or_move_ctor_p): Merge into ...
1610         (classtype_has_move_assign_or_move_ctor_p): ... this new function.
1611         * cp-tree.h (classtype_has_user_move_assign_or_move_ctor_p):
1612         Replace with ...
1613         (classtype_has_move_assign_or_move_ctor_p): ... this.
1614         * method.c (maybe_explain_implicit_delete, lazily_declare_fn): Adjust.
1615         * tree.c (type_has_nontrivial_copy_init): Adjust.
1617         * cp-tree.h (PACK_EXPANSION_PARAMETER_PACKS,
1618         PACK_EXPANSION_EXTRA_ARGS): Use TYPE_{MIN,MAX}_VALUE_RAW.
1620 2017-07-18  Nathan Sidwell  <nathan@acm.org>
1622         * cp-array-notation.c (build_array_notation_ref): Use
1623         TYPE_{MIN,MAX}_VALUE.
1625         * class.c (classtype_has_move_assign_or_move_ctor): Declare.
1626         (add_implicitly_declared_members): Use it.
1627         (type_has_move_constructor, type_has_move_assign): Merge into ...
1628         (classtype_has_move_assign_or_move_ctor): ... this new function.
1629         * cp-tree.h (type_has_move_constructor, type_has_move_assign): Delete.
1631 2017-07-17  Volker Reichelt  <v.reichelt@netcologne.de>
1633         * parser.c (cp_parser_decl_specifier_seq): Add fix-it hints for
1634         friend outside class and obsolete auto as storage-class-specifier.
1636 2017-07-17  Nathan Sidwell  <nathan@acm.org>
1638         * class.c (maybe_warn_about_overly_private_class): Ignore public
1639         copy ctors.
1641         * class.c (type_has_user_declared_move_constructor,
1642         type_has_user_declared_move_assign): Combine into ...
1643         (classtype_has_user_move_assign_or_move_ctor_p): ... this new function.
1644         * cp-tree.h (type_has_user_declared_move_constructor,
1645         type_has_user_declared_move_assign): Combine into ...
1646         (classtype_has_user_move_assign_or_move_ctor_p): ... this. Declare.
1647         * method.c (maybe_explain_implicit_delete): Use it.
1648         (lazily_declare_fn): Use it.
1649         * tree.c (type_has_nontrivial_copy_init): Use it.
1651         * semantics.c (classtype_has_nothrow_assign_or_copy_p): Clarify
1652         semantics, simplify implementation.
1654 2017-07-16  Volker Reichelt  <v.reichelt@netcologne.de>
1656         * parser.c (cp_parser_cast_expression): Use %q#T instead of %qT
1657         in old-style cast diagnostic.
1658         * typeck.c (maybe_warn_about_useless_cast): Use %q#T instead of %qT
1659         in useless cast diagnostic.
1660         * error.c (type_to_string): Remove enum special handling.
1662 2017-07-14  David Malcolm  <dmalcolm@redhat.com>
1664         * name-lookup.c (get_std_name_hint): Add '<' and '>' around
1665         the header names.
1666         (maybe_suggest_missing_header): Update for addition of '<' and '>'
1667         to above.  Provide a fix-it hint.
1668         * pt.c: Include "gcc-rich-location.h"
1669         (listify): Attempt to add fix-it hint for missing
1670         #include <initializer_list>.
1671         * rtti.c: Include "gcc-rich-location.h".
1672         (typeid_ok_p): Attempt to add fix-it hint for missing
1673         #include <typeinfo>.
1675 2017-07-12  Jason Merrill  <jason@redhat.com>
1677         P0512R0 - Deduction from an initializer list.
1678         * pt.c (do_class_deduction): Do list deduction in two phases.
1680 2017-07-12  Nathan Sidwell  <nathan@acm.org>
1682         * cp-tree.h (DECL_CONSTRUCTOR_P, DECL_MAYBE_IN_CHARGE_CONSTRUCTOR,
1683         DECL_DESTRUCTOR_P, DECL_MAYBE_IN_CHARGE_DESTRCTOR): Look at
1684         identifier flags.
1685         * decl.c (grokfndecl): Set DECL_CXX_CONSTRUCTOR and
1686         DECL_CXX_DESTRUCTOR explicitly.
1687         * decl2.c (grokclassfn): Likewise.
1688         * friend.c (do_friend): Likewise.
1689         * method.c (make_thunk, make_alias_for,
1690         implicitly_declare_fn): Likewise.
1692 2017-07-11  Jason Merrill  <jason@redhat.com>
1694         Core DR 393
1695         * decl.c (grokparms): Downgrade error about array of unknown bound
1696         to pedwarn and disable it for C++17.
1698 2017-07-11  Nathan Sidwell  <nathan@acm.org>
1700         * decl2.c (reset_type_linkage_2): Dont't change ctor name.
1702 2017-07-10  Martin Sebor  <msebor@redhat.com>
1704         * cp-tree.h (cp_operator_id, cp_assignment_operator_id): Document.
1706 2017-07-06  Jason Merrill  <jason@redhat.com>
1708         PR c++/81204 - parse error with dependent template-name
1709         * parser.c (cp_parser_lookup_name): Revert previous change.
1711 2017-07-06  David Malcolm  <dmalcolm@redhat.com>
1713         * cp-lang.c (LANG_HOOKS_RUN_LANG_SELFTESTS): Define as
1714         selftest::run_cp_tests.
1715         (selftest::run_cp_tests): New function.
1716         * cp-tree.h (selftest::run_cp_tests): New decl.
1718 2017-07-04  Jakub Jelinek  <jakub@redhat.com>
1720         * parser.c (cp_parser_decomposition_declaration): Replace
1721         decomposition declaration with structured binding in diagnostics.
1722         * decl.c (cp_finish_decomp): Likewise.
1723         (grokdeclarator): Likewise.
1725         PR c++/81258
1726         * parser.c (cp_parser_decomposition_declaration): Diagnose invalid
1727         forms of structured binding initializers.
1729 2017-07-03  Paolo Carlini  <paolo.carlini@oracle.com>
1731         PR c++/65775
1732         * decl.c (grokdeclarator): Move checks on function return type after
1733         the splice_late_return_type call; if declspecs->locations[ds_type_spec]
1734         is UNKNOWN_LOCATION fall back to input_location.
1736 2017-07-03  David Malcolm  <dmalcolm@redhat.com>
1738         * parser.c (enum required_token): Fix spelling of
1739         RT_INTERATION to RT_ITERATION.
1740         (cp_parser_iteration_statement): Likewise.
1741         (cp_parser_required_error): Likewise.
1743 2017-06-30  Jason Merrill  <jason@redhat.com>
1745         PR c++/81257 - ICE with invalid ::template.
1746         PR c++/54769 - wrong lookup of dependent template-name.
1747         * parser.c (cp_parser_template_name): Revert part of last change.
1749 2017-06-30  Nathan Sidwell  <nathan@acm.org>
1751         * config-lang.in (gtfiles): Add cp/lex.c.
1752         * cp-tree.h (mangle_convop_name_for_type): Rename ...
1753         (make_conv_op_name): ... here.  Move to lex.
1754         * lambda.c (maybe_add_lambda_conv_op): Update.
1755         * parser.c (cp_parser_conversion_function_id): Update.
1756         * pt.c (tsubst_decl, tsubst_baselink, tsubst_copy,
1757         tsubst_copy_and_build): Update.
1758         * semantics.c (apply_deduced_return_type): Update.
1759         * mangle.c (conv_type_hasher, conv_type_names,
1760         mangle_conv_op_name_for_type): Move to ...
1761         * lex.c (conv_type_hasher, conv_type_names, make_convop_name):
1762         ... here.  Rename.
1764 2017-06-30  David Malcolm  <dmalcolm@redhat.com>
1766         PR c++/80014
1767         * parser.c (cp_parser_postfix_expression): Construct a location
1768         for typeid expressions.
1770 2017-06-30  Nathan Sidwell  <nathan@acm.org>
1772         * cp-tree.h (lookup_fnfields_1, class_method_index_for_fn): Don't
1773         declare.
1774         (lookup_all_conversions): Declare.
1775         * class.c (get_basefndecls): Use lookup_fnfields_slot.
1776         * decl.c (register_dtor_fn): Use lookup_fnfields_slot.
1777         * decl2.c (check_class_fn): Use lookup_fnfields_slot.  Rework
1778         diagnostics.
1779         * pt.c (retrieve_specialization): Use lookup_fnfields_slot.
1780         (check_explicit_specialization): Use lookup_fnfields_slot_nolazy,
1781         lookup_all_conversions.
1782         * search.c (lookup_fnfields_1): Make static.
1783         (lookup_all_conversions): New.
1784         (class_method_index_for_fn): Delete.
1785         * semantics.c (classtype_has_nothrow_assign_or_copy_p): Use
1786         lookup_fnfields_slot.
1788         * call.c (build_new_method_call_1): Use constructo_name to get
1789         ctor name.  Move argument processing earlier to merge cdtor
1790         handling blocks.
1791         * decl.c (grokfndecl): Cdtors have special names.
1792         * method.c (implicitly_declare_fn): Likewise. Simplify flag setting.
1793         * pt.c (check_explicit_specialization): Cdtor name is already
1794         special.
1795         * search.c (class_method_index_for_fn): Likewise.
1797         PR c++/81229
1798         * name-lookup.c (do_pushdecl): Reset IDENTIFIER_TYPE when finding
1799         a matching TYPE_DECL.
1801 2017-06-29  Paolo Carlini  <paolo.carlini@oracle.com>
1803         * class.c (add_method): Change pair of errors to error + inform.
1804         (handle_using_decl): Likewise.
1806 2017-06-29  Jason Merrill  <jason@redhat.com>
1808         * constexpr.c, error.c, tree.c: Remove WITH_CLEANUP_EXPR handling.
1810         PR c++/81180 - ICE with C++17 deduction of member class template.
1811         * pt.c (build_deduction_guide): Correct member template handling.
1813         PR c++/81188 - matching decltype of member function call.
1814         * tree.c (cp_tree_equal): Remove COMPONENT_REF special case.
1816 2017-06-29  Nathan Sidwell  <nathan@acm.org>
1818         PR c++/81247
1819         * parser.c (cp_parser_namespace_definition): Immediately close the
1820         namespace if there's no open-brace.
1821         * name-lookup.c (do_pushdecl): Reset OLD when pushing into new
1822         namespace.
1824 2017-06-29  Jason Merrill  <jason@redhat.com>
1826         PR c++/81164 - ICE with invalid inherited constructor.
1827         * search.c (binfo_direct_p): New.
1828         * name-lookup.c (do_class_using_decl): Use it.
1830 2017-06-29  Nathan Sidwell  <nathan@acm.org>
1832         * cp-tree.h (THIS_NAME, IN_CHARGE_NAME, VTBL_PTR_TYPE,
1833         VTABLE_DELTA_NAME, VTABLE_PFN_NAME): Delete.
1834         * decl.c (initialize_predefined_identifiers): Name cdtor special
1835         names consistently.  Use literals for above deleted defines.
1836         (cxx_init_decl_processing): Use literal for vtbl_ptr_type name,
1838         * lex.c (maybe_add_lang_type_raw): Exit early, rather than use a
1839         flag.
1841         * call.c (check_dtor_name): Use constructor_name for enums too.
1842         (build_new_method_call_1): Use constructor_name for cdtors and
1843         show ~ for dtor.
1844         * class.c (build_self_reference): Use TYPE_NAME to get name of
1845         self reference.
1846         * name-lookup (constructor_name): Use DECL_NAME directly.
1847         (constructor_name_p): Reimplement.
1848         (push_class_level_binding_1): Use TYPE_NAME directly.
1850         * class.c (finish_struct): Use OVL_P.
1851         (get_vfield_name): Measure constructor_name length.
1852         * cp-tree.h (SET_CLASS_TYPE_P): Add RECORD_OR_UNION_CHECK.
1853         (NON_UNION_CLASS_TYPE_P): Check RECORD_TYPE up front.
1854         * cxx-pretty-print.c (is_destructor_name): Delete.
1855         (pp_cxx_unqualified_id): Remove bogus destructor name checking.
1856         * decl.c (grokfndecl): Move cheap checks first when looking for
1857         implicit extern cness.
1859         * parser.c (cp_parser_direct_declarator): Reorder if to avoid
1860         indentation. Remove unnecessary assignment of constructor name.
1862         Whitespace cleanups.
1863         * call.c (name_as_c_string): Move CONST_CAST to return.
1864         (build_new_method_call_1): Remove unneeded bracing.
1865         * class.c (include_empty_classes): Unbreak line.
1866         * constraint.cc (tsubst_check_constraint): Add space.
1867         * cp-tree.h (lang_decl_ns): Add comment.
1868         (PTRMEM_CST_MEMBER): Break line.
1869         * decl.c (grokfndecl): Add blank lines. Unbreak some others.
1870         (grokdeclarator): Remove lines, move declaration to first use.
1871         * decl2.c (decl_needed_p): Fix indentation.
1872         (c_parse_final_cleanups): Remove blank line.
1873         * method.c (implicitly_declare_fn): Move declaration to first use.
1874         * search.c (current_scope): Add blank lines.
1876 2017-06-28  Jason Merrill  <jason@redhat.com>
1878         PR c++/72764 - ICE with invalid template typename.
1879         * decl.c (build_typename_type): No longer static.
1880         * tree.c (strip_typedefs): Use it instead of make_typename_type.
1882         PR c++/69300 - ICE with self-referential noexcept
1883         * pt.c (maybe_instantiate_noexcept): Check for recursion.
1885         PR c++/61022 - error with variadic template template parm
1886         * pt.c (convert_template_argument): Keep the TYPE_PACK_EXPANSION.
1888         PR c++/72801 - ICE with variadic partial specialization
1889         * pt.c (unify_pack_expansion): Use PACK_EXPANSION_EXTRA_ARGS.
1891         PR c++/55639 - partial specialization with ::template
1892         * parser.c (cp_parser_class_head): Handle ::template.
1894         PR c++/45976 - error with ::template in declarator.
1895         * pt.c (resolve_typename_type): Fix TEMPLATE_ID_EXPR handling.
1897         PR c++/54769 - wrong lookup of dependent template-name.
1898         * parser.c (cp_parser_template_name): Handle dependent object type.
1899         (cp_parser_nested_name_specifier_opt): Make template_keyword_p a
1900         parameter.
1901         (cp_parser_id_expression): Pass it.
1902         (cp_parser_diagnose_invalid_type_name): Handle TEMPLATE_ID_EXPR.
1904         * parser.c (cp_parser_template_id): Use the range location on the
1905         TEMPLATE_ID_EXPR.
1907         PR c++/81204 - parse error with dependent template-name
1908         * parser.c (cp_parser_lookup_name): Disqualify function templates
1909         after lookup.
1911 2017-06-27  Nathan Sidwell  <nathan@acm.org>
1913         * pt.c (tsubst_decl <FUNCTION_DECL>): Move var decls to
1914         initialization point.  Don't unnecessarily check for ctor name.
1916         * cp-tree.h (CLASSTYPE_DESTRUCTORS): Rename to ...
1917         (CLASSTYPE_DESTRUCTOR): ... this.
1918         * class.c (accessible_nvdtor_p,
1919         maybe_warn_about_overly_private_class,
1920         add_implicitly_declared_members,
1921         clone_constructors_and_destructors, type_has_virtual_destructor):
1922         Adjust for CLASSTYPE_DESTRUCTOR.
1923         (deduce_noexcept_on_destructors): Absorb into ...
1924         (check_bases_and_members): ... here.
1925         * except.c (dtor_nothrow): Adjust for CLASSTYPE_DESTRUCTOR.
1926         * init.c (build_delete): Likewise.
1927         * parser.c (cp_parser_lookup_name): Likewise.
1928         * pt.c (check_explicit_specialization): Likewise.
1929         * rtti.c (emit_support_tinfos): Likewise.
1930         * search.c (lookup_fnfields_idx_nolazy): Likewise.
1932         Kill IDENTIFIER_TEMPLATE.
1933         * cp-tree.h (lang_identifier): Remove class_template_info field.
1934         (IDENTIFIER_TEMPLATE): Delete.
1935         * name-lookup.c (constructor_name_full): Subsume into ...
1936         (constructor_name): ... here.  Don't check IDENTIFIER_TEMPLATE.
1937         (constructor_name_p): Likewise.
1938         * mangle.c (write_source_name): Likewise.
1939         * ptree.c (cxx_print_identifier): Likewise.
1941 2017-06-27  Marek Polacek  <polacek@redhat.com>
1943         PR bootstrap/81216
1944         * parser.c (cp_parser_already_scoped_statement): Initialize
1945         LOC_AFTER_LABELS.
1947 2017-06-26  Jason Merrill  <jason@redhat.com>
1949         PR c++/81215 - deduction failure with variadic TTP.
1950         * pt.c (unify_bound_ttp_args): Restore old logic for C++14 and down.
1952 2017-06-26  Martin Sebor  <msebor@redhat.com>
1954         PR c++/81169
1955         * call.c (maybe_warn_class_memaccess): Preserve explicit conversions
1956         to detect casting away cv-qualifiers.
1958 2017-06-26  Nathan Sidwell  <nathan@acm.org>
1960         * cp-tree.h (lang_decl_fn): Remove assignment_operator_p field.
1961         (DECL_COMPLETE_CONSTRUCTOR_P): Directly compare
1962         identifier.
1963         (DECL_BASE_CONSTRUCTOR_P, DECL_COMPLETE_DESTRUCTOR_P,
1964         DECL_BASE_DESTRUCTOR_P, DECL_DELETING_DESTRUCTOR_P): Likewise.
1965         (DECL_ASSIGNMENT_OPERATOR_P): Use IDENTIFIER_ASSIGN_OP_P.
1966         * decl.c (grok_op_properties): Adjust identifier checking.
1967         * init.c (expand_default_init): Adjust identifier descision.
1968         * method.c (implicitly_declare_fn): Don't use
1969         DECL_ASSIGNMENT_OPERATOR_P.
1970         * search.c (lookup_fnfields_1): Use IDENTIFIER_CTOR_P,
1971         IDENTIFIER_DTOR_P.
1972         * call.c (in_charge_arg_for_name): Reimplement.
1973         (build_special_member_call): Use IDENTIFIER_CDTOR_P,
1974         IDENTIFIER_DTOR_P.
1976 2017-06-26  Marek Polacek  <polacek@redhat.com>
1978         PR c/80116
1979         * parser.c (cp_parser_statement): Add a default argument.  Save the
1980         location of the expression-statement after labels have been parsed.
1981         (cp_parser_implicitly_scoped_statement): Set the location of the
1982         body of the conditional after parsing all the labels.  Call
1983         warn_for_multistatement_macros.
1984         (cp_parser_already_scoped_statement): Likewise.
1986 2017-06-24  Paolo Carlini  <paolo.carlini@oracle.com>
1988         PR c++/62315
1989         * parser.c (cp_parser_diagnose_invalid_type_name): Don't print
1990         'typename' in error messages about missing 'typename'.
1992 2017-06-23  Jason Merrill  <jason@redhat.com>
1994         PR c++/79056 - C++17 ICE with invalid template syntax.
1995         * parser.c (cp_parser_simple_type_specifier): Don't assume that type
1996         is a TYPE_DECL.
1997         (cp_parser_check_for_invalid_template_id): Handle TYPE_DECL.
1998         * pt.c (template_placeholder_p): New.
1999         * cp-tree.h: Declare it.
2001 2017-06-23  Marc Glisse  <marc.glisse@inria.fr>
2003         * decl.c (duplicate_decls): Use builtin_structptr_types.
2005 2017-06-22  Nathan Sidwell  <nathan@acm.org>
2007         Reorder IDENTIFIER flags
2008         gcc/cp/
2009         * cp-tree.h (enum cp_identifier_kind): New.
2010         (IDENTIFIER_KIND_BIT_0, IDENTIFIER_KIND_BIT_1,
2011         IDENTIFIER_KIND_BIT_2): New.
2012         (IDENTIFIER_MARKED): Move to TREE_LANG_FLAG_4.
2013         (IDENTIFIER_VIRTUAL_P, IDENTIFIER_REPO_CHOSEN): Add IDENTIFIER_CHECK.
2014         (C_IS_RESERVED_WORD): Replace with ...
2015         (IDENTIFIER_KEYWORD_P): ... this.
2016         (IDENTIFIER_CTOR_OR_DTOR_P): Replace with ...
2017         (IDENTIFIER_CDTOR_P): ... this.
2018         (IDENTIFIER_CTOR_P, IDENTIFIER_DTOR_P): New.
2019         (IDENTIFIER_OPNAME_P): Replace with ...
2020         (IDENTIFIER_ANY_OP_P): ... this.
2021         (IDENTIFIER_ASSIGN_OP_P): New.
2022         (IDENTIFIER_TYPENAME_P): Replace with ...
2023         (IDENTIFIER_CONV_OP_P): ... this.
2024         (NEW_DELETE_OPNAME_P): Replace with ...
2025         (IDENTIFIER_NEWDEL_OP_P): ... this.
2026         (DECL_CONV_FN_P, DECL_OVERLOADED_OPERATOR_P): Adjust.
2027         (get_identifier_kind_name, set_identifier_kind): Declare.
2028         * lex.c (get_identifier_kind_name, set_identifier_kind): New.
2029         (init_operators): Adjust to avoid keywords, use
2030         set_identifier_kind. Copy TYPE_EXPR slot.
2031         (init_reswords): Call set_identifier_kind.
2032         (unqualified_name_lookup_error): Adjust.
2033         * operators.def (TYPE_EXPR): Remove.
2034         * decl.c (struct predefined_identifier): Move into ...
2035         (initialize_predefined_identifiers): ... here.  Call
2036         set_identifier_kind.
2037         (grokfndecl, check_var_type, grokdeclarator): Adjust.
2038         (grok_op_properties): Use IDENTIFIER_ANY_ASSIGN_OP to halve search
2039         space.  Adjust.
2040         * call.c (name_as_c_string): Adjust.
2041         (build_new_method_call_1): Likewise.
2042         * cp-cilkplus.c (is_conversion_operator_function_decl_p): Likewise.
2043         * cxx-pretty-print.c (pp_cxx_unqualified_id): Adjust.
2044         * dump.c (cp_dump_tree): Adjust.
2045         * error.c (dump_decl_name): Adjust.
2046         * mangle.c (write_unqualified_id, write_member_name,
2047         write_expression): Adjust.
2048         (mangle_conv_op_name_for_type): Use set_identifier_kind.
2049         * name-lookup.c (do_class_using_decl): Adjust.
2050         (lookup_name_fuzzy, lookup_name_real_1): Likewise.
2051         * parser.c (cp_lexer_get_preprocessor_token,
2052         cp_parser_direct_declarator): Likewise.
2053         * pt.c (push_template_decl_real, tsubst_decl, tsubst_baselink,
2054         tsubst_copy, tsubst_copy_and_build): Adjust.
2055         * ptree.c (cxx_print_identifier): Print identifier kind.
2056         * search.c (lookup_field_r, lookup_member,
2057         lookup_fnfields_idx_nolazy): Adjust.
2058         * semantics.c (finish_id_expression): Adjust..
2059         * typeck.c (cp_build_addr_expr_1): Adjust.
2061 2017-06-21  Jakub Jelinek  <jakub@redhat.com>
2063         PR c++/81154
2064         * semantics.c (handle_omp_array_sections_1, finish_omp_clauses):
2065         Complain about t not being a variable if t is OVERLOAD even
2066         when processing_template_decl.
2068 2017-06-21  David Malcolm  <dmalcolm@redhat.com>
2070         * parser.c (get_cast_suggestion): New function.
2071         (maybe_add_cast_fixit): New function.
2072         (cp_parser_cast_expression): Capture the location of the closing
2073         parenthesis.  Call maybe_add_cast_fixit when emitting warnings
2074         about old-style casts.
2076 2017-06-20  Jason Merrill  <jason@redhat.com>
2078         PR c++/80972 - C++17 ICE with attribute packed.
2079         * call.c (build_over_call): Allow a TARGET_EXPR from reference
2080         binding.
2082 2017-06-20  Nathan Sidwell  <nathan@acm.org>
2084         * cp-tree.h (CPTI_NELTS_IDENTIFIER): Delete.
2085         (nelts_identifier): Delete.
2086         * decl.c (initialize_predefined_identifiers): Remove nelts.
2088         PR c++/67074 - namespace aliases
2089         * decl.c (duplicate_decls): Don't error here on mismatched
2090         namespace alias.
2091         * name-lookup.c (name_lookup::add_value): Matching namespaces are
2092         not ambiguous.
2093         (diagnose_name_conflict): Namespaces are never redeclarations.
2094         (update_binding): An alias can match a real namespace.
2096 2017-06-19  Jason Merrill  <jason@redhat.com>
2098         PR c++/80562 - ICE with constexpr if.
2099         * semantics.c (finish_if_stmt_cond): Call
2100         instantiate_non_dependent_expr.
2102         PR c++/80829 - ICE with constexpr copy of base subobject.
2103         * constexpr.c (clear_no_implicit_zero): New.
2104         (cxx_eval_call_expression): Call it.
2106 2017-06-19  Nathan Sidwell  <nathan@acm.org>
2108         PR c++/81124
2109         PR c++/79766
2110         * name-lookup.c (set_decl_namespace): Don't follow using
2111         directives and ignore using decls.  Only check overly-explicit
2112         scope after discovering decl.
2114 2017-06-19  Jason Merrill  <jason@redhat.com>
2116         PR c++/81073 - constexpr and static var in statement-expression.
2117         * typeck2.c (store_init_value): Always call
2118         require_potential_constant_expression.
2119         * pt.c (convert_nontype_argument): Likewise.
2120         * constexpr.c (potential_constant_expression_1): Adjust message.
2121         Use decl_maybe_constant_var_p instead of decl_constant_var_p.
2122         * decl2.c (decl_maybe_constant_var_p): Consider initializer.
2124 2017-06-19  Nathan Sidwell  <nathan@acm.org>
2126         * pt.c (coerce_template_parms): Fix indentation.
2127         (tsubst_decl): Remove repeated SET_DECL_RTL.  Move VAR_P handling
2128         in to single block.
2130         PR c++/81119
2131         * name-lookup.c (update_binding): Only warn about constructors
2132         hidden by functions.
2134 2017-06-17  Jason Merrill  <jason@redhat.com>
2136         PR c++/60063 - -Wunused-local-typedefs and templates.
2137         * decl2.c (is_late_template_attribute): Return false for "used".
2139         PR c++/70844 - -Wuseless-cast and inheriting constructor.
2140         * method.c (forward_parm): Suppress warn_useless_cast.
2142 2017-06-16  Jason Merrill  <jason@redhat.com>
2144         PR c++/81045 - Wrong type-dependence with auto return type.
2145         * pt.c (type_dependent_expression_p): An undeduced auto outside the
2146         template isn't dependent.
2147         * call.c (build_over_call): Instantiate undeduced auto even in a
2148         template.
2150         PR c++/80465 - ICE with generic lambda with noexcept-specifier.
2151         * lambda.c (maybe_add_lambda_conv_op): Keep processing_template_decl
2152         set longer for a generic lambda.
2154         PR c++/80614 - Wrong mangling for C++17 noexcept type
2155         * mangle.c (write_type): Put the eh spec back on the function type.
2157         PR c++/81102 - Wrong error with partial specialization.
2158         * pt.c (unify) [TEMPLATE_PARM_INDEX]: Strip reference when comparing
2159         types.  Do type deduction later.
2161         PR c++/81074 - ICE with partial specialization of member template.
2162         PR c++/71747
2163         * pt.c (get_partial_spec_bindings): Only coerce innermost args.
2165         PR c++/80831 - ICE with -fsyntax-only.
2166         * decl2.c (c_parse_final_cleanups): Use cgraph_node::get_create.
2168         PR c++/80639 - ICE with invalid PMF initialization.
2169         PR c++/80043 - ICE with -fpermissive
2170         * typeck.c (convert_for_assignment): Recurse when instantiate_type
2171         returns without an error.
2173 2017-06-16  Nathan Sidwell  <nathan@acm.org>
2175         * pt.c (tsubst_baselink): Fix & clarify formatting.
2177         * cp-tree.h (build_this_parm, cp_build_parm_decl,
2178         build_artificial_parm): Add FN parm.
2179         * decl.c (start_cleanup_fn): Adjust.
2180         (build_this_parm): Add FN parm, pass it through.
2181         (grokfndecl): Adjust parm building.
2182         * decl2.c (cp_build_parm_decl): Add FN parm, set context.
2183         (build_artificial_parm): Add FN parm, pass through.
2184         (maybe_retrofit_in_chrg): Adjust parm building.
2185         (start_static_storage_duration_function): Likwise.
2186         * lambda.c (maybe_aadd_lambda_conv_op): Likewise.
2187         * method.c (implicitly_declare_fn): Likewise.
2188         * parser.c (inject_this_parameter): Likewise.
2190         Symbol tables are insert only.
2191         * cp-tree.h (default_hash_traits <lang_identifier *>): Don't
2192         derive from pointer_hash.  Make undeletable.
2194         * class.c (resort_type_method_vec): Avoid potential unsigned
2195         overflow.
2197         Don't defer noexcept_deferred_spec.
2198         * cp-tree.h (unevaluated_noexcept_spec): Don't declare.
2199         * decl.c (cxx_init_decl_processing): Initialize
2200         noexcept_deferred_spec.
2201         * except.c (unevaluated_noexcept_spec): Delete.
2202         * class.c (deduce_noexcept_on_destructor): Use
2203         noexcept_deferred_spec directly.
2204         * method.c (implicitly_declare_fn): Likewise.
2206         Make keyed_classes a vector.
2207         * cp-tree.h (CPTI_KEYED_CLASSES, keyed_classes): Delete.
2208         (keyed_classes): Declare as vector.
2209         * decl.c (keyed_classes): Define.
2210         (cxx_init_decl_processing): Allocate it.
2211         (record_key_method_defined): Use vec_safe_push.
2212         * class.c (finish_struct_1): Likewise.
2213         * pt.c (instantiate_class_template_1): Likewise.
2214         * decl2.c (c_parse_final_cleanups): Reverse iterate keyed_classes.
2216         Make rtti lazier
2217         * rtti.c (enum tinfo_kind): Add TK_DERIVED_TYPES,
2218         TK_VMI_CLASS_TYPES, TK_MAX.  Delete TK_FIXED.
2219         (tinfo_names): New.
2220         (typeid_ok_p): Add quotes to error messages.  Use get_tinfo_desc.
2221         (get_tinfo_decl): Use get_tinfo_desc.
2222         (get_pseudo_ti_init): Likewise. Adjust VMI construction.
2223         (create_pseudo_type_info): Delete.
2224         (get_pseudo_ti_index): Just determine the index.
2225         (get_tinfo_desc): New.  Create all types lazily.
2226         (create_tinfo_types): Just allocate the descriptor array.
2227         (emit_support_tinfos): Use non-inserting type lookup.  Set builtin
2228         location.
2230 2017-06-15  Martin Sebor  <msebor@redhat.com>
2232         PR c++/80560
2233         * call.c (first_non_public_field, maybe_warn_class_memaccess): New
2234         functions.
2235         (has_trivial_copy_assign_p, has_trivial_copy_p): Ditto.
2236         (build_cxx_call): Call maybe_warn_class_memaccess.
2238 2017-06-14  Jakub Jelinek  <jakub@redhat.com>
2240         * cp-gimplify.c (cp_genericize_r): Turn most of the function
2241         into a switch (TREE_CODE (stmt)) statement from long else if
2242         sequence.
2244 2017-06-13  Jakub Jelinek  <jakub@redhat.com>
2246         PR c++/80973
2247         * cp-gimplify.c (cp_genericize_r): Don't instrument MEM_REF second
2248         argument even if it has REFERENCE_TYPE.
2250         PR c++/80984
2251         * cp-gimplify.c (cp_genericize): Only look for VAR_DECLs in
2252         BLOCK_VARS (outer) chain.
2253         (cxx_omp_const_qual_no_mutable): Likewise.
2255 2017-06-13  Martin Liska  <mliska@suse.cz>
2257         PR sanitize/78204
2258         * class.c (build_base_path): Use sanitize_flags_p.
2259         * cp-gimplify.c (cp_genericize_r): Likewise.
2260         (cp_genericize_tree): Likewise.
2261         (cp_genericize): Likewise.
2262         * cp-ubsan.c (cp_ubsan_instrument_vptr_p): Likewise.
2263         * decl.c (compute_array_index_type): Likewise.
2264         (start_preparsed_function): Likewise.
2265         * decl2.c (one_static_initialization_or_destruction): Likewise.
2266         * init.c (finish_length_check): Likewise.
2267         * lambda.c (maybe_add_lambda_conv_op): Likewise.
2268         * typeck.c (cp_build_binary_op): Likewise.
2269         (build_static_cast_1): Likewise.
2271 2017-06-11  Jason Merrill  <jason@redhat.com>
2273         * error.c (dump_expr): Use is_this_parameter.
2275         * cp-tree.h, decl2.c, mangle.c, parser.c, pt.c, semantics.c: Use
2276         id_equal.
2278 2017-06-09  Jason Merrill  <jason@redhat.com>
2280         Missing bits from N4268, constant evaluation for all non-type args.
2281         * call.c (build_converted_constant_expr): Rename from
2282         build_integral_nontype_arg_conv, handle all types.
2283         * pt.c (convert_nontype_argument): In C++17 call it for all types.
2284         Move NOP stripping inside pointer case, don't strip ADDR_EXPR.
2285         * cvt.c (strip_fnptr_conv): Also strip conversions to the same type.
2287         Overhaul pointer-to-member conversion and template argument handling.
2288         * call.c (standard_conversion): Avoid creating ck_pmem when the
2289         class type is the same.
2290         * cvt.c (can_convert_qual): Split from
2291         perform_qualification_conversions.
2292         * constexpr.c (cxx_eval_constant_expression): Check it.
2293         * typeck.c (convert_ptrmem): Only cplus_expand_constant if
2294         adjustment is necessary.
2295         * pt.c (check_valid_ptrmem_cst_expr): Compare class types.
2296         (convert_nontype_argument): Avoid redundant error.
2298         * call.c (convert_like_real): Remove "inner" parameter.
2299         Don't replace a constant with its value.
2300         * cp-gimplify.c (cp_fully_fold): Use cp_fold_rvalue.
2302         * pt.c (convert_nontype_argument): Check NULLPTR_TYPE_P rather than
2303         nullptr_node.
2305         * parser.c (cp_parser_constant_expression): Check
2306         potential_rvalue_constant_expression after decay_conversion.
2307         * pt.c (convert_nontype_argument): Don't require linkage in C++17.
2309         PR c++/80384 - ICE with dependent noexcept-specifier
2310         * pt.c (dependent_type_p_r) [FUNCTION_TYPE]: Check for dependent
2311         noexcept-specifier.
2313         * constexpr.c (potential_constant_expression_1): Allow 'this' capture.
2315 2017-06-09  Jan Hubicka  <hubicka@ucw.cz>
2317         * class.c (build_vtbl_initializer): Mark dvirt_fn as cold.
2318         * decl.c (cxx_init_decl_processing, push_throw_library_fn): Likewise.
2319         (excpet.c): Mark terminate as cold.
2321 2017-06-08  Jakub Jelinek  <jakub@redhat.com>
2323         PR c/81006
2324         * semantics.c (handle_omp_array_sections_1): Convert TYPE_MAX_VALUE
2325         to sizetype before size_binop.
2327         PR c++/81011
2328         * cp-gimplify.c (cxx_omp_finish_clause): When changing clause
2329         to OMP_CLAUSE_SHARED, also clear OMP_CLAUSE_SHARED_FIRSTPRIVATE
2330         and OMP_CLAUSE_SHARED_READONLY flags.
2332 2017-06-08  Jan Hubicka  <hubicka@ucw.cz>
2334         * cp-tree.h (lang_check_failed): Annotate by ATTRIBUTE_COLD.
2336 2017-06-07  Nathan Sidwell  <nathan@acm.org>
2338         * class.c (layout_class_type): Restructure overlong-bitfield tpe
2339         search.
2341 2017-06-07  Jonathan Wakely  <jwakely@redhat.com>
2343         PR c++/80990
2344         * pt.c (do_class_deduction): Build qualified type.
2346 2017-06-06  Nathan Sidwell  <nathan@acm.org>
2348         * name-lookup.c (suggest_alternatives_for): Use qualified lookup
2349         sans using directives.  Don't walk into inline namespaces.
2351         PR c++/80979
2352         * name-lookup.c (adl_class_only): Don't add visible friends.
2354 2017-06-05  Volker Reichelt  <v.reichelt@netcologne.de>
2356         * parser.c (cp_parser_base_specifier): Fix typos in error messages.
2358 2017-06-02  Nathan Sidwell  <nathan@acm.org>
2360         Remove lang_type_ptrmem.
2361         * cp-tree.h (lang_type_header): Remove is_lang_type_class. Move
2362         into ...
2363         (lang_type_class): ... this.  Reorder bitfields.  Rename to ...
2364         (lang_type): ... this.  Delete old definition.
2365         (lang_type_ptrmem): Delete.
2366         (LANG_TYPE_CLASS_CHECK): Simply get TYPE_LANG_SPECIFIC.  Adjust uses.
2367         (LANG_TYPE_PTRMEM_CHECK): Delete.
2368         (TYPE_GET_PTRMEMFUNC_TYPE, TYPE_SET_PTRMEMFUNC_TYPE): Delete.
2369         (TYPE_PTRMEMFUNC_TYPE): New.  Use TYPE_LANG_SLOT_1.
2370         * decl.c (build_ptrmemfunc_type): Adjust.
2371         * lex.c (copy_lang_type): Remove lang_type_ptrmem handling.
2372         (maybe_add_lang_type_raw): Don't set u.c.h.is_lang_type_class.
2373         
2374         * class.c (check_bases_and_members): Adjust vec_new_uses_cookie
2375         setting.
2376         
2377         Remove cp_binding_level::namespaces
2378         * name-lookup.h (cp_binding_level): Lose namespaces field.
2379         * name-lookup.c (add_decl_to_level): Chain namespaces on the names
2380         list.
2381         (suggest_alternatives_for): Adjust for namespace list.  Do
2382         breadth-first search.
2383         * decl2.c (collect_source_refs): Namespaces are on the regulr
2384         list.
2385         (collect_ada_namespace): Likewise.
2387 2017-06-02  Bernd Edlinger  <bernd.edlinger@hotmail.de>
2389         * typeck.c (cp_build_binary_op): Implement the -Wsizeof_pointer_div
2390         warning.
2392 2017-06-01  Ville Voutilainen  <ville.voutilainen@gmail.com>
2394         PR c++/80812
2395         * method.c (constructible_expr): Strip array types before calling
2396         build_value_init.
2398 2017-06-01  Paolo Carlini  <paolo.carlini@oracle.com>
2400         PR c++/80896
2401         * cvt.c (convert_to_void): Possibly call maybe_warn_nodiscard
2402         for case INDIRECT_REF too in the main switch.
2404 2017-05-31  Jason Merrill  <jason@redhat.com>
2406         PR c++/80840 - ICE with constexpr and reference
2407         * pt.c (convert_nontype_argument): Don't test whether a decl is
2408         value-dependent when binding to a reference.
2410 2017-05-31  Nathan Sidwell  <nathan@acm.org>
2412         * cp-tree.h (lang_decl_slector): New enum.
2413         (lang_decl_base): Make selector an enum.  Drop decomposition_p
2414         field.
2415         (lang_decl): Use enum for discrimination.
2416         (LANG_DECL_FN_CHECK, LANG_DECL_NS_CHECK, LANG_DECL_PARM_CHECK,
2417         LANG_DECL_DEOMP_CHECK): Use enum.
2418         (DECL_DECOMPOSITION_P): Use selector value.
2419         (SET_DECL_DECOMPOSITION_P): Delete.
2420         (retrofit_lang_decl): Lose SEL parm.
2421         (fit_decomposition_lang_decl): Declare.
2422         * decl.c (cp_finish_decomp, grokdeclarator): Use
2423         fit_decomposition_lang_decl.
2424         * lex.c (maybe_add_lang_decl_raw): New. Broken out of
2425         retrofit_lang_decl.
2426         (set_decl_linkage): New.  Broken out of retrofit_lang_decl.  Use enum.
2427         (fit_decomposition_lang_decl): Likewise.
2428         (retrofit_lang_decl): Use worker functions.
2429         (cxx_dup_lang_specific_decl): Use selector enum.
2430         (maybe_add_lang_type_raw): New.  Broken out of ...
2431         (cxx_make_type_name): ... here.  Call it.
2433 2017-05-30  Jason Merrill  <jason@redhat.com>
2435         PR c++/80856 - ICE with local extern in template
2436         * semantics.c (finish_call_expr): Replace a local extern overload
2437         set in a template with the IDENTIFIER_NODE.
2439 2017-05-30  David Malcolm  <dmalcolm@redhat.com>
2441         * call.c (perform_implicit_conversion_flags): Convert
2442         "from %qT to %qT" to "from %qH to %qI" in diagnostic.
2443         (print_conversion_rejection): Replace pairs of %qT with
2444         %qH and %qI in various places.
2445         (build_user_type_conversion_1): Likewise.
2446         (build_integral_nontype_arg_conv): Likewise.
2447         (build_conditional_expr_1): Likewise.
2448         (convert_like_real): Likewise.
2449         (convert_arg_to_ellipsis): Likewise.
2450         (joust): Likewise.
2451         (initialize_reference): Likewise.
2452         * cvt.c (cp_convert_to_pointer): Likewise.
2453         (cp_convert_to_pointer): Likewise.
2454         (convert_to_reference): Likewise.
2455         (ocp_convert): Likewise.
2456         * error.c (cp_printer): Gain bool and const char ** parameters.
2457         (struct deferred_printed_type): New struct.
2458         (class cxx_format_postprocessor): New class.
2459         (cxx_initialize_diagnostics): Wire up a cxx_format_postprocessor
2460         to pp->m_format_postprocessor.
2461         (comparable_template_types_p): New function.
2462         (newline_and_indent): New function.
2463         (arg_to_string): New function.
2464         (print_nonequal_arg): New function.
2465         (print_template_differences): New function.
2466         (type_to_string_with_compare): New function.
2467         (print_template_tree_comparison): New function.
2468         (append_formatted_chunk): New function.
2469         (add_quotes): New function.
2470         (cxx_format_postprocessor::handle): New function.
2471         (defer_phase_2_of_type_diff): New function.
2472         (cp_printer): Add "quoted" and "buffer_ptr" params.  Implement
2473         %H and %I.
2474         * typeck.c (cp_build_binary_op): Replace pairs of %qT with
2475         %qH and %qI in various places.
2476         (convert_member_func_to_ptr): Likewise.
2477         (build_reinterpret_cast_1): Likewise.
2478         (convert_for_assignment): Likewise.
2479         * typeck2.c (check_narrowing): Likewise.
2481 2017-05-30  Nathan Sidwell  <nathan@acm.org>
2483         Kill IDENTIFIER_NAMESPACE_BINDINGS
2484         * cp-tree.h (lang_identifier): Delete namespace_bindings.
2485         (IDENTIFIER_NAMESPACE_BINDINGS): Delete.
2486         (lang_decl_ns): Add bindings.
2487         (DECL_NAMESPACE_BINDINGS): New.
2488         * lex.c (retrofit_lang_decl): Create namespace hash table.
2489         * name-lookup.c (find_namespace_slot): Change to use hash-map.
2490         * ptree.c (cxx_print_binding): Delete.
2491         (cxx_print_identifier): Remove NAMESPACE_BINDING printing.
2493         * cp-tree.def (OVERLOAD): Fix comment.
2494         * cp-tree.h: Fix comments and whitespace.
2495         * error.c (dump_decl): Use pp_cxx_colon_colon, ovl_scope.
2496         * name-lookup.c (add_decl_to_level): Assert not class.
2497         (check_local_shadow): Use OVL_P.
2498         (pushdecl_with_scope_1): Rename to ...
2499         (do_pushdecl_with_Scope): ... here.
2500         (do_nonmember_using_decl): Use qualified_namespace_lookup return
2501         value.
2502         (push_class_level_binding_1): Use OVL_P.
2503         (pushdecl_namespace_level): Use do_pushdecl_with_scope.
2504         (pushtag_1): Rename to ...
2505         (do_pushtag): ... here.  Adjust do_pushdecl_with_scope call.
2506         (pushtag): Adjust.
2507         (store_class_bindings): Do not time here.
2508         * name-lookup.h (pushdecl_outermost_localscope): Reorder.
2509         * pt.c (listify): Declare argvec at point of initialization.
2511         PR c++/80913
2512         * name-lookup.c (add_decl_to_level): Assert not making a circular
2513         chain.
2514         (update_binding): Don't prematurely slide artificial decl.
2516 2017-05-29  Alexandre Oliva <aoliva@redhat.com>
2518         * cp-tree.h (lang_identifier): Drop oracle_looked_up, unused.
2520 2017-05-29  Nathan Sidwell  <nathan@acm.org>
2522         PR c++/80891 (#1,#5)
2523         * cp-tree.h (lookup_maybe_add): Add DEDUPING argument.
2524         * name-lookup.c (name_lookup): Add deduping field.
2525         (name_lookup::preserve_state, name_lookup::restore_state): Deal
2526         with deduping.
2527         (name_lookup::add_overload): New.
2528         (name_lookup::add_value, name_lookup::add_fns): Call add_overload.
2529         (name_lookup::search_adl): Set deduping.  Don't unmark here.
2530         * pt.c (most_specialized_instantiation): Revert previous change,
2531         Assert not given duplicates.
2532         * tree.c (lookup_mark): Just mark the underlying decls.
2533         (lookup_maybe_add): Dedup using marked decls.
2535         PR c++/80891 (#4)
2536         * ptree.c (cxx_print_xnode): Show internal OVERLOAD structure.
2537         * tree.c (ovl_insert, ovl_iterator_remove_node): Fix copying assert.
2539         Stat hack representation
2540         * name-lookup.c (STAT_HACK_P, STAT_TYPE, STAT_DECL,
2541         MAYBE_STAT_DECL, MAYBE_STAT_TYPE): New.
2542         (stat_hack): New.
2543         (find_namespace_binding): Replace with ...
2544         (find_namespace_slot): ... this.
2545         (find_namespace_value): New.
2546         (name_lookup::search_namespace_only,
2547         name_lookup::adl_namespace_only): Adjust.
2548         (update_binding): Add SLOT parameter, adjust.
2549         (check_local_shadow): Use find_namespace_value.
2550         (set_local_extern_decl_linkage): Likewise.
2551         (do_pushdecl): Adjust for namespace slot.
2552         (push_local_binding): Assert not a namespace binding.
2553         (check_for_out_of_scope_variable): Use find_namespace_value.
2554         (set_identifier_type_value_with_scope): Likewise.
2555         (get_namespace_binding): Likewise.
2556         (set_namespace_binding): Delete.
2557         (set_global_binding): Directly update the binding.
2558         (finish_namespace_using_decl): Likewise.
2559         (lookup_type_scope_1): Use find_namespace_slot and update.
2560         (do_push_nested_namespace): Use find_namespace_value.
2562         PR c++/80891 (#1)
2563         * pt.c (most_specialized_instantiation): Cope with duplicate
2564         instantiations.
2566         PR c++/80891 (#3)
2567         * cp-tree.h (build_min_nt_call_vec): Declare.
2568         * decl.c (build_offset_ref_call_from_tree): Call it.
2569         * parser.c (cp_parser_postfix_expression): Likewise.
2570         * pt.c (tsubst_copy_and_build): Likewise.
2571         * semantics.c (finish_call_expr): Likewise.
2572         * tree.c (build_min_nt_loc): Keep unresolved lookups.
2573         (build_min): Likewise.
2574         (build_min_non_dep): Likewise.
2575         (build_min_non_dep_call_vec): Likewise.
2576         (build_min_nt_call_vec): New.
2578         PR c++/80891 (#2)
2579         * tree.c (ovl_copy): Adjust assert, copy OVL_LOOKUP.
2580         (ovl_used): New.
2581         (lookup_keep): Call it.
2583 2017-05-26  Nathan Sidwell  <nathan@acm.org>
2585         Implement DR2061
2586         * name-lookup.c (push_inline_namespaces): New.
2587         (push_namespace): Look inside inline namespaces.
2589         Inline and using namespace representation change.
2590         * cp-tree.h (struct lang_decl_ns): Delete ns_using.  Add usings,
2591         inlinees as vector.
2592         (DECL_NAMESPACE_USING): Adjust.
2593         (DECL_NAMESPACE_INLINEES): New.
2594         * name-lookup.h (struct cp_binding_level): Change usings
2595         representation.
2596         * name-lookup.c (name_lookup::do_queue_usings,
2597         name_lookup::queue_usings): Adjust.
2598         (name_lookup::search_namespace, name_lookup::search_usings,
2599         name_lookup::queue_namespace): Adjust.
2600         (name_lookup::adl_namespace_only): Adjust.
2601         (add_using_namespace, push_namespace): Push onto vector.
2602         (pop_namespace): Add timing logic.
2604         * call.c (build_operator_new_call): Do namelookup and ADL here.
2605         (build_new_op_1): Likewise.
2606         * name-lookup.h (lookup_function_nonclass): Delete declaration.
2607         (do_using_directive): Likewise.
2608         * name-lookup.c (set_namespace_binding, push_local_binding): Don't
2609         declare early.
2610         (struct scope_binding): Delete.
2611         (EMPTY_SCOPE_BINDING): Delete.
2612         (set_decl_namespace): Use OVL_P.
2613         (finish_local_using_decl): Lose unnecesary checks.
2614         (lookup_function_nonclass): Delete.
2615         (cp_emit_debug_info_for_using): Use MAYBE_BASELINK_P.
2617         * cp-tree.h (OVL_CHAIN): Check looking at OVERLOAD.
2618         (ovl_iterator): Add allow_inner field.  Adjust ctor.  Make
2619         unduplicatable.
2620         (ovl_iterator::maybe_push, ovl_iterator::pop): New.
2621         (lkp_iterator): Add outer field.  Adjust ctor.
2622         (lkp_iterator::operator++): New.
2623         (lookup_mark, lookup_maybe_add): Declare.
2624         * name-lookup.c (name_lookup): Delete fn_set member.
2625         (name_lookup::preserve_state, name_lookup::restore_state): Unmark
2626         and mark lookup.
2627         (name_lookup::add_value): Use lookup_add directly.
2628         (name_lookup::add_fns: Use lookup_maybe_add.
2629         (name_lookup::search_adl): Mark and unmark fns.
2630         (pushdecl): Adjust.
2631         * pt.c (check_explicit_specialization): Use lookup_add directly.
2632         * ptree.c (cxx_print_xnode): Show complete overload structure.
2633         * tree.c (lookup_mark, lookup_maybe_add): New.
2635         * name-lookup.c (name_lookup::search_adl): ADL OMP UDR type args.
2637 2017-05-26  Jakub Jelinek  <jakub@redhat.com>
2639         * cp-tree.h (struct lang_decl_decomp): New type.
2640         (struct lang_decl): Add u.decomp.
2641         (LANG_DECL_DECOMP_CHECK): Define.
2642         (DECL_DECOMPOSITION_P): Note it is set also on the vars
2643         for user identifiers.
2644         (DECL_DECOMP_BASE): Define.
2645         (retrofit_lang_decl): Add extra int = 0 argument.
2646         * lex.c (retrofit_lang_decl): Add SEL argument, if non-zero
2647         use it to influence the selector choices and for selector
2648         0 to non-zero transition copy old content.
2649         (cxx_dup_lang_specific_decl): Handle DECL_DECOMPOSITION_P.
2650         * decl.c (poplevel): For DECL_DECOMPOSITION_P, check
2651         !DECL_DECOMP_BASE instead of !DECL_VALUE_EXPR.  Adjust warning
2652         wording if decl is a structured binding.
2653         (cp_finish_decomp): Pass 4 as the new argument to retrofit_lang_decl.
2654         Set DECL_DECOMP_BASE.  Ignore DECL_READ_P sets from initialization
2655         of individual variables for tuple structured bindings.
2656         (grokdeclarator): Pass 4 as the new argument to retrofit_lang_decl.
2657         Clear DECL_DECOMP_BASE.
2658         * decl2.c (mark_used): Mark DECL_DECOMP_BASE TREE_USED as well.
2659         * pt.c (tsubst_decomp_names): Assert DECL_DECOMP_BASE matches what
2660         is expected.
2661         * expr.c (mark_exp_read): Recurse on DECL_DECOMP_BASE instead of
2662         DECL_VALUE_EXPR.
2664 2017-05-25  Jason Merrill  <jason@redhat.com>
2666         PR c++/80605 - __is_standard_layout and zero-length array
2667         * class.c (check_bases): Use DECL_FIELD_IS_BASE.
2669 2017-05-25  Nathan Sidwell  <nathan@acm.org>
2671         Kill OVL_CURRENT, OVL_NEXT.
2672         * cp-tree.h (OVL_CURRENT, OVL_NEXT): Delete.
2673         * name-lookup.c (set_decl_namespace): Use ovl_iterator.
2674         (consider_binding_level): Use OVL_FIRST.
2675         (cp_emit_debug_info_for_using): Use lkp_iterator.
2676         * pt.c (check_explicit_specialization): Use ovl_iterator.       
2678         Kill DECL_NAMESPACE_USERS, DECL_NAMESPACE_ASSOCIATIONS.
2679         * cp-tree.h (lang_decl_ns): Remove ns_users field.
2680         (DECL_NAMESPACE_USERS, DECL_NAMESPACE_ASSOCIATIONS): Delete.
2681         (TREE_INDIRECT_USING): Delete.
2682         * name-lookup.h (is_associated_namespace): Delete.
2683         * name-lookup.c (name_lookup::search_usings,
2684         name_lookup::do_queue_usings): Usings are always direct.
2685         (is_associated_namespace): Delete.
2686         (handle_namespace_attrs): Use DECL_NAMESPACE_INLINE_P.
2687         (namespace_ancestor_1, namespace_ancestor): Delete.
2688         (push_using_directive_1, push_using_directive): Delete.
2689         (add_using_namespace_1): Delete.
2690         (add_using_namespace): Reimplement.
2691         (emit_debug_info_using_namespace): New.
2692         (finish_namespace_using_directive, finish_local_using_directive,
2693         push_namespace): Adjust.
2694         * tree.c (cp_free_lang_data): Remove DECL_NAMESPACE_USERS handling.
2696 2017-05-25  Volker Reichelt  <v.reichelt@netcologne.de>
2698         * semantics.c (finish_handler_parms): Warn about non-reference type
2699         catch handlers.
2701 2017-05-25  Nathan Sidwell  <nathan@acm.org>
2703         Reimplement unqualified namespace lookup.
2704         * name-lookup.c (name_lookup::using_pair,
2705         name_lookup::using_queue): New typedefs.
2706         (name_lookup::queue_namespace, name_lookup::do_queue_usings,
2707         name_lookup::queue_usings): New.
2708         (name_lookup::search_unqualified): New.
2709         (merge_functions, same_entity_p, ambiguous_decl,
2710         unqualified_namespace_lookup_1, unqualified_namespace_lookup,
2711         lookup_using_namespace): Delete.
2712         (lookup_name_real_1): Adjust.
2714         Reimplement qualified namespace lookup.
2715         * name-lookup.c (name_lookup::flags): New member.  Adjust ctor.
2716         (name_lookup::ambiguous, name_lookup::add_value,
2717         name_lookup::add_type, name_lookup::process_binding): New.
2718         (name_lookup::search_namespace_only,
2719         name_lookup::search_namespace, name_lookup::search_usings): New.
2720         (name_lookup::search_qualified): New.
2721         (do_nonmember_using_decl, suggest_alternatives_for,
2722         lookup_qualified_name): Adjust.
2723         (tree_vec_contains): Delete.
2724         (qualified_lookup_using_namespace): Rename to ...
2725         (qualified_namespace_lookup): ... here.  Reimplement.
2727         Reimplement ADL.
2728         * cp-tree.h (LOOKUP_SEEN_P, LOOKUP_FOUND_P): New.
2729         * name-lookup.h (lookup_arg_dependent): Return plain tree.
2730         * name-lookup.c (arg_lookup, arg_assoc, arg_assoc_args,
2731         arg_assoc_args_vec, arg_assoc_type, add_function,
2732         arg_assoc_namespace, arg_assoc_class_only, arg_assoc_bases,
2733         arg_assoc_class, arg_assoc_template_arg, arg_assoc,
2734         lookup_arg_dependent_1): Delete.
2735         (name_lookup): New lookup object.
2736         (name_lookup::preserve_state, name_lookup::restore_state,
2737         name_lookup::mark_seen, name_lookup::find_and_mark,
2738         name_lookup::add_fns, name_lookup::adl_namespace_only,
2739         name_lookup::adl_namespace, name_lookup::adl_class_only,
2740         name_lookup::adl_bases, name_lookup::adl_class,
2741         name_lookup::adl_expr, name_lookup::adl_type,
2742         name_lookup::adl_template_arg, name_lookup::search_adl): New.
2743         (lookup_arg_dependent): Return a plain tree.  Adjust.
2744         (is_associated_namespace): Move later.
2745         
2746 2017-05-24  Nathan Sidwell  <nathan@acm.org>
2748         * friend.c (do_friend): Remove check for existing decl.
2749         * name-lookup.h (lookup_name_innermost_nonclass_level): Delete.
2750         * name-lookup.c (push_local_binding): Directly look for binding.
2751         (lookup_name_innermost_nonclass_level_1): Delete.
2752         (lookup_name_innermost_nonclass_level): Delete.
2754         * Make-lang.in (CXX_AND_OBJCXX_OBJS): Alphabetize.
2756         * cp-tree.h (cp_free_lang_data): Add extern.
2757         (ovl_skip_hidden, is_overloaded_fn, really_overloaded_fn): Add
2758         ATTRIBUTE_PURE.
2759         (type_unknown_p): Return bool, make inline, lose TREE_LIST check.
2760         * typeck.c (type_unknown_p): Delete.
2761         * tree.c (is_overloaded_fn): Use MAYBE_BASELINE_FUNCTIONS, adjust
2762         overload management.
2763         (dependent_name): Likewise.
2764         (decl_anon_ns_mem_p): Simplify.
2766 2017-05-24  Jonathan Wakely  <jwakely@redhat.com>
2768         PR c++/80544
2769         * tree.c (reshape_init): Use unqualified type for direct enum init.
2770         * typeck.c (maybe_warn_about_cast_ignoring_quals): New.
2771         (build_static_cast_1, build_reinterpret_cast_1): Strip cv-quals from
2772         non-class destination types.
2773         (build_const_cast_1): Strip cv-quals from destination types.
2774         (build_static_cast, build_reinterpret_cast, build_const_cast)
2775         (cp_build_c_cast): Add calls to maybe_warn_about_cast_ignoring_quals.
2777 2017-05-24  Martin Sebor  <msebor@redhat.com>
2779         PR c/80731
2780         * call.c (fully_fold_internal): Adjust.
2782 2017-05-24  Nathan Sidwell  <nathan@acm.org>
2784         * cp-tree.h (ovl_skip_hidden): Declare.
2785         * tree.c (ovl_skip_hidden): New.
2786         * name-lookup.c (arg_assoc_namespace): Call ovl_skip_hidden.
2787         (lookup_arg_dependent_1): Likewise.
2788         (ambiguous_decl): Use DECL_HIDDEN_P, ovl_skip_hidden.
2789         (hidden_name_p, remove_hidden_names): Delete.
2790         (lookup_name_real_1): Do not strip hidden names.
2791         * name-lookup.h (hidden_name_p, remove_hidden_names): Delete.
2793         * cp-tree.h (OVL_HIDDEN_P): New.
2794         (ovl_iterator::hidden_p, ovl_iterator::reveal_node): New.
2795         (ovl_iterator::reveal_node): Declare.
2796         * tree.c (ovl_copy): Copy OVL_HIDDEN_P.
2797         (ovl_insert): Order on hiddenness.
2798         (ovl_iterator::reveal_node): New.
2799         * name-lookup.c (anticipated_builtin_p): New.
2800         (supplement_binding_1): Use it.
2801         (set_local_extern_decl_linkage): Use hidden_p.
2802         (do_pushdecl): Deal with unhiding a hidden decl, use
2803         anticipated_builtin_p.
2804         (do_nonmember_using_decl): Use anticipated_decl_p.
2805         (lookup_name_real_1): Use DECL_HIDDEN_P.
2807 2017-05-23  Jason Merrill  <jason@redhat.com>
2809         -Wunused and C++17 structured bindings
2810         * decl.c (poplevel): Don't warn about unused structured bindings,
2811         only real variables.
2812         * error.c (dump_simple_decl): Handle structured bindings.
2813         * expr.c (mark_exp_read): Look through DECL_VALUE_EXPR.
2815 2017-05-23  Nathan Sidwell  <nathan@acm.org>
2817         * cp-tree.h (PUSH_GLOBAL, PUSH_LOCAL, PUSH_USING): Delete.
2818         * name-lookup.c (create_local_binding): New.
2819         (update_binding): New.
2820         (pushdecl_maybe_friend_1): Rename to ...
2821         (do_pushdecl): ... this.  Reimplement.
2822         (pushdecl): Adjust.
2823         (push_overloaded_decl_1, push_overloaded_decl): Delete.
2825 2017-05-23  Jason Merrill  <jason@redhat.com>
2827         PR c++/80396 - built-in for make_integer_sequence.
2828         * pt.c (builtin_pack_fn_p, builtin_pack_call_p)
2829         (expand_integer_pack, expand_builtin_pack_call): New.
2830         (find_parameter_packs_r): Check builtin_pack_call_p.
2831         (check_for_bare_parameter_packs): Handle it.
2832         (tsubst_pack_expansion): Call expand_builtin_pack_call.
2833         (declare_integer_pack): New.
2834         (init_template_processing): Call it.
2835         * decl2.c (mark_used): Check builtin_pack_fn_p.
2837 2017-05-23  Nathan Sidwell  <nathan@acm.org>
2839         * name-lookup.c (find_namespace_binding): New.
2840         (pushdecl_maybe_friend_1): Use CP_DECL_CONTEXT.
2841         (set_identifier_type_value_with_scope): Use find_namespace_binding.
2842         (find_binding, cp_binding_level_find_binding_for_name,
2843         binding_for_name, namespace_binding_1): Delete.
2844         (push_overloaded_decl_1): Use CP_DECL_CONTEXT.
2845         (get_namespace_binding, set_namespace_binding,
2846         finish_namespace_using_decl, unqualified_namespace_lookup_1,
2847         qualified_lookup_using_namespace, lookup_type_scope_1,
2848         lookup_name_innermost_nonclass_level_1): Use find_namespace_binding.
2850         PR c++/80866
2851         * parser.c (cp_parser_template_id): Keep the lookup when stashing
2852         the template_id.
2854         * cp-tree.h (DECL_HIDDEN_P): New.
2855         * name-lookup.c (set_decl_context,
2856         set_local_extern_decl_linkage): New, broken out of ...
2857         (pushdecl_maybe_friend_1): ... here.  Call them.
2859 2017-05-23  Thomas Schwinge  <thomas@codesourcery.com>
2861         * parser.c (OACC_KERNELS_CLAUSE_MASK): Add
2862         "PRAGMA_OACC_CLAUSE_NUM_GANGS", "PRAGMA_OACC_CLAUSE_NUM_WORKERS",
2863         "VECTOR_LENGTH".
2865 2017-05-23  Nathan Sidwell  <nathan@acm.org>
2867         * cp-tree.h (OVL_P): New.
2868         * name-lookup.h (push_local_binding): Delete.
2869         (do_toplevel_using_decl, do_local_using_decl): Rename to ...
2870         (finish_namespace_using_decl, finish_local_using_decl): ... here
2871         * name-lookup.c (add_decl_to_level): Swap args.
2872         (pop_bindings_and_leave_scope): Look inside TREE_LIST.
2873         (diagnose_name_conflict): Check contexts are same for redecl.
2874         (update_local_overload): New.
2875         (compparms_for_decl_and_using): Rename to ...
2876         (matching_fn_p): ... here.
2877         (pushdecl_maybe_friend_1): Adjust add_decl_to_level,
2878         push_local_bindings call.
2879         (push_local_binding): Make static, replace FLAGS arg with
2880         IS_USING.
2881         (validate_nonmember_using_decl): Use OVL_FIRST.
2882         (do_nonmember_using_decl): Use in/out parameters.  Use
2883         lkp_iterator and simplify.
2884         (do_toplevel_using_decl, do_local_using_decl): Rename to ...
2885         (finish_namespace_using_decl, finish_local_using_decl): ... here.
2886         Adjust.
2887         (lookup_type_current_level): Delete.
2888         * parser.c (cp_parser_using_declaration): Adjust.
2889         * pt.c (tsubst_expr): Adjust.
2891 2017-05-22  Nathan Sidwell  <nathan@acm.org>
2893         * name-lookup.h (parse_using_directive): Replace with ...
2894         (finish_namespace_using_directive): ... this and ...
2895         (finish_local_using_directive): ... this.
2896         * name-lookup.c (add_using_namespace_1): Move later.
2897         (add_using_namespace): Move later, add namespace_p arg, remove
2898         indirect arg.
2899         (push_using_directive_1): Directly recurse.
2900         (do_using_directive, parse_using_directive): Delete, split into ...
2901         (finish_namespace_using_directive): ... this and ...
2902         (finish_local_using_directive): ... this.
2903         (push_namespace): Use add_using_namespace.
2904         * parser.c (cp_parser_using_directive): Call
2905         finish_namespace_using_directive or finish_local_using_directive.
2906         * pt.c (tsubst_expr): Call finish_local_using_directive.
2908         * cp-objcp-common.c (cp_register_dumps): Register raw dumper.
2909         * cp-tree.h (raw_dump_id): Declare.
2910         * decl2.c (raw_dump_id): Define.
2911         (dump_tu): Use raw_dump_id.
2913         * config-lang.in (gtfiles): Sort list, break lines.
2915         * cp-tree.h (CPTI_TERMINATE, CPTI_CALL_UNEXPECTED): Rename to ...
2916         (CPTI_TERMINATE_FN, CPTI_CALL_UNEXPECTED_FN): ... here.
2917         ( CPTI_GET_EXCEPTION_PTR_FN, CPTI_BEGIN_CATCH_FN, CPTI_END_CATCH_FN,
2918         CPTI_ALLOCATE_EXCEPTION_FN, CPTI_FREE_EXCEPTION_FN, CPTI_THROW_FN,
2919         CPTI_RETHROW_FN): New.
2920         (noexcept_deferred_spec): New.
2921         (terminate_node, call_unexpected_node): Rename to ...
2922         (terminate_fn, call_unexpected_fn): ... here.
2923         (get_exception_ptr_fn, begin_catch_fn, end_catch_fn,
2924         allocate_exception_fn, free_exception_fn, throw_fn, rethrow_fn): New.
2925         * except.c (fn1..fn5, throw_fn, rethrow_rn, spec): Delete.
2926         (init_exception_processing): Adjust.
2927         (declare_library_fn): Create and push the fns here.
2928         (do_get_exception_ptr, do_begin_catch, do_end_catch,
2929         do_allocate_exception_ptr, do_free_exception_ptr): Adjust
2930         declare_library_fn use.
2931         (unevaluated_noexcept_spec): Adjust.
2932         * cp-gimplify.c (genericize_eh_spec_block,
2933         gimplify_most_not_throw_expr): Adjust.
2935         * name-lookup.c (pushdecl_top_level,
2936         pushdecl_top_level_and_finish): Move after namespace pushing and
2937         popping functions.
2938         (push_to_top_level): Rename to ...
2939         (do_push_to_top_level): ... here.  Remove timing code.
2940         (pop_from_top_level_1): Rename to ...
2941         (do_pop_from_top_level): ... here.
2942         (do_push_nested_namespace, do_pop_nested_namespace)
2943         (push_to_top_level): New wrapper for do_push_to_top_level.
2944         (pop_from_top_level): Adjust.
2945         (push_nested_namepace, pop_nested_namespace): Wrappers for workers.
2947 2017-05-19  Bernd Edlinger  <bernd.edlinger@hotmail.de>
2949         * config-lang.in (gtfiles): Add c-family/c-format.c,
2950         except.c, init.c, lambda.c and friend.c.
2951         * class.c (dvirt_fn): Move out of function scope,
2952         add GTY attribute.
2953         * except.c (fn1-5, throw_fn, rethrow_fn, spec): Likewise.
2954         * init.c (fn): Likewise.
2955         * lambda.c (ptr_id, max_id): Likewise.
2956         * friend.c (global_friend): Add GTY attribute.
2958 2017-05-19  Nathan Sidwell  <nathan@acm.org>
2960         * call.c (add_list_candidates): Use OVL_FIRST.
2961         (build_new_method_call_1): Likewise.
2962         * cp-tree.h (OVL_SINGLE_P): New.
2963         (TYPE_HIDDEN_P): New.
2964         * decl.c (xref_tag_1): Use TYPE_HIDDEN_P.
2965         * dump.c (cp_tump_tree): Adjust overload dumping.
2966         * error.c (dump_decl): Use OVL_SINGLE_P, simplify context
2967         printing.
2968         * method.c (lazily_declare_fn): Assert we added it.
2969         * parser.c (cp_parser_nested_name_specifier): Use OVL_SINGLE_P,
2970         OVL_FIRST.
2971         (cp_parser_template_name): Use lkp_iterator.
2972         * pt.c (begin_template_parm_list): Fixup comment.
2973         (instantiate_class_template_1): Use TYPE_HIDDEN_P.
2974         * tree.c (ovl_iterator::remove_node): Cope with inherited ctors.
2975         (ovl_scope): Use lkp_iterator.
2977 2017-05-19  Thomas Schwinge  <thomas@codesourcery.com>
2979         * parser.c (cp_parser_omp_clause_default): Handle
2980         "OMP_CLAUSE_DEFAULT_PRESENT".
2982         * parser.c (cp_parser_omp_clause_default): Avoid printing more
2983         than one syntax error message.
2985 2017-05-19  Nathan Sidwell  <nathan@acm.org>
2987         * class.c (class_dump_id): Define.
2988         (dump_class_hierarchy, dump_vtable, dump_vtt): Use it.
2989         * cp-objcp-common.c (cp_register_dumps): New.
2990         * cp-objcp-common.h (cp_register_dumps): Declare.
2991         (LANG_HOOKS_REGISTER_DUMPS): Override.
2992         * cp-tree.h (class_dump_id): Declare.
2994 2017-05-18  Nathan Sidwell  <nathan@acm.org>
2996         * cp-tree.h (OVL_ARG_DEPENDENT): Delete.
2997         (OVL_USED_P): New.
2998         (lookup_keep): Declare.
2999         * name-lookup.c (add_function): Don't set OVL_ARG_DEPENDENT.
3000         * pt.c (tsubst_copy): Assert lookup is persistent.
3001         * semantics.c (finish_call_expr): Use lkp_iterator, call
3002         lookup_keep.
3003         * tree.c (ovl_copy): New.
3004         (ovl_insert, ovl_iterator::remove_node): Copy immutable nodes.
3005         (lookup_keep): New.
3007         * cp-tree.h (OVL_USED): Replace with ...
3008         (OVL_USING_P): ... this.
3009         (ovl_iterator::using_p): Adjust.
3010         * name-lookup.c (push_overloaded_decl_1,
3011         do_nonmember_using_decl): Adjust.
3012         * search.c (lookup_field_r): Adjust.
3013         * tree.c (ovl_insert, ovl_scope): Adjust.
3015         * cp-tree.h (lookup_add): Swap args.
3016         (ovl_cons, build_overload): Delete.
3017         * name-lookup.c (add_function, push_overloaded_decl_1,
3018         do_nonmember_using_decl, merge_functions, remove_hidden_names):
3019         Use lookup_add, ovl_insert.
3020         * pt.c (check_explicit_specialization): Use lookup_add.
3021         (do_class_deduction): Likewise. Refactor if.
3022         * tree.c (lookup_add): Swap args.
3023         (ovl_cons, build_overload): Delete.
3025         * name-lookup.c (find_local_binding): New, broken out of ...
3026         (lookup_name_innermost_nonclass_level_1): ... here.  Call it.
3027         (set_namespace_binding): Swap scope & name args.
3028         (namespace_binding_1): Likewise.
3029         (pushdecl_maybe_friend_1): Adjust set_namespace_binding call.
3030         (push_overloaded_decl_1): Likewise.
3031         (set_global_binding): Likewise.
3032         (get_namespace_binding): Adjust namespace_binding_1 call.
3034 2017-05-17  Nathan Sidwell  <nathan@acm.org>
3036         * cp-tree.h (default_hash_traits <lang_identifier *>): New
3037         specialization.
3038         * name-lookup.c (lookup_extern_c_fun_in_all_ns): Delete.
3039         (extern_c_fns): New hash table.
3040         (check_extern_c_conflict): New, broken out of ...
3041         (pushdecl_maybe_friend_1): ... here.  Call it.
3042         (c_linkage_bindings): Just look in hash table.
3044 2017-05-17  Ville Voutilainen  <ville.voutilainen@gmail.com>
3046         PR c++/80654
3047         PR c++/80682
3048         Implement new C++ intrinsics __is_assignable and __is_constructible.
3049         * cp-tree.h (CPTK_IS_ASSIGNABLE, CPTK_IS_CONSTRUCTIBLE): New.
3050         (is_xible): New.
3051         * cxx-pretty-print.c (pp_cxx_trait_expression): Handle
3052         CPTK_IS_ASSIGNABLE and CPTK_IS_CONSTRUCTIBLE.
3053         * method.c (constructible_expr): Set cp_unevaluated.
3054         (is_xible_helper): New.
3055         (is_trivially_xible): Adjust.
3056         (is_xible): New.
3057         * parser.c (cp_parser_primary_expression): Handle
3058         RID_IS_ASSIGNABLE and RID_IS_CONSTRUCTIBLE.
3059         (cp_parser_trait_expr): Likewise.
3060         * semantics.c (trait_expr_value): Handle
3061         CPTK_IS_ASSIGNABLE and CPTK_IS_CONSTRUCTIBLE.
3063 2017-05-17  Nathan Sidwell  <nathan@acm.org>
3065         * cp-tree.h (ovl_iterator::using_p): New predicate.
3066         (ovl_iterator::remove_node): New worker.
3067         (ovl_insert): Declare.
3068         * tree.c (ovl_insert): New.
3069         (ovl_iterator::remove_node): New.
3070         * class.c (add_method): Use ovl_iterator, ovl_insert.
3071         (clone_function_decl): Fix description.
3072         (clone_constructors_and_destructors): Use ovl_iterator.
3074         * class.c (handle_using_decl): Use OVL_FIRST, ovl_iterator.
3075         (maybe_warn_about_overly_private_class): Use ovl_iterator.
3076         (method_name_cmp, resort_method_name_cmp): Use OVL_NAME.
3077         (resort_type_method_vec, finish_struct_methods): Use OVL_FIRST.
3078         (get_base_fndecls): Use ovl_iterator.
3079         (warn_hidden): Use OVL_NAME, ovl_iterator.
3080         (add_implicitly_declared_members): Use ovl_iterator.
3081         * constraint.cc (normalize_template_id_expression): Use OVL_FIRST,
3082         flatten nested if.
3083         (finish_shorthand_constraint): Simplify, use ovl_make.
3084         * pt.c (make_constrained_auto): Simplify.  Use ovl_make.
3085         * search.c (shared_member_p): Use ovl_iterator.
3086         (lookup_field_fuzzy_info::fuzzy_lookup_fn): Use OVL_NAME.
3087         (lookup_conversion_operator): Use OVL_FIRST.
3088         (lookup_fnfiels_idx_nolazy): Use OVL_FIRST, OVL_NAME.
3089         (look_for_overrides_here): Use ovl_iterator.
3090         (lookup_conversions_r): Use OVL_FIRST, OVL_NAME, ovl_iterator.
3091         * typeck.c (build_x_unary_op): Use ovl_make.
3093 2017-05-17  Martin Liska  <mliska@suse.cz>
3095         * class.c (dump_class_hierarchy): Introduce dump_flags_t type and
3096         use it instead of int type.
3097         (dump_vtable): Likewise.
3098         (dump_vtt): Likewise.
3099         * decl2.c (dump_tu): Likewise.
3101 2017-05-16  David Malcolm  <dmalcolm@redhat.com>
3103         * call.c (enforce_access): Add access_failure_info * param and use
3104         it to record access failures.
3105         * cp-tree.h (class access_failure_info): New class.
3106         (enforce_access): Add access_failure_info * param, defaulting to
3107         NULL.
3108         (lookup_member): Likewise.
3109         (locate_field_accessor): New function decl.
3110         (perform_or_defer_access_check): Add access_failure_info * param,
3111         defaulting to NULL.
3112         * search.c (lookup_member): Add access_failure_info * param and
3113         pass it on to call to perform_or_defer_access_check.
3114         (matches_code_and_type_p): New function.
3115         (field_access_p): New function.
3116         (direct_accessor_p): New function.
3117         (reference_accessor_p): New function.
3118         (field_accessor_p): New function.
3119         (struct locate_field_data): New struct.
3120         (dfs_locate_field_accessor_pre): New function.
3121         (locate_field_accessor): New function.
3122         * semantics.c (perform_or_defer_access_check): Add
3123         access_failure_info * param, and pass it on to call to
3124         enforce_access.
3125         * typeck.c (access_failure_info::record_access_failure): New method.
3126         (access_failure_info::maybe_suggest_accessor): New method.
3127         (finish_class_member_access_expr): Pass an access_failure_info
3128         instance to the lookup_member call, and call its
3129         maybe_suggest_accessor method afterwards.
3131 2017-05-16  Marek Polacek  <polacek@redhat.com>
3133         PR sanitizer/80536
3134         PR sanitizer/80386
3135         * cp-gimplify.c (cp_fold): Handle SAVE_EXPR.
3137 2017-05-16  Nathan Sidwell  <nathan@acm.org>
3139         * name-lookup.c (check_local_shadow): New, broke out of ...
3140         (pushdecl_maybe_friend_1): ... here.  Call it.
3142         * cp-tree.h (OVL_NESTED_P, OVL_LOOKUP_P): New.
3143         (ovl_first): Move inline definition to end of file.
3144         (ovl_make, lookup_add): Declare.
3145         (get_fns, get_first_fn): Make pure.
3146         * tree.c (ovl_cache): New.
3147         (ovl_make, lookup_add): New.
3148         * pt.c (do_class_deduction): Don't add candidates that will be
3149         elided.
3151         * call.c (build_user_type_conversion_1): Use OVL_FIRST.
3152         (print_error_for_call_failure): Use OVL_NAME.
3153         (build_op_call_1): Use ovl_iterator.
3154         (add_candidates): Use OVL_FIRST & lkp_iterator.
3155         (build_op_delete_call): Use MAYBE_BASELINK_FUNCTIONS &
3156         lkp_iterator.
3157         * class.c (deduce_noexcept_on_destructors): Use ovl_iterator.
3158         (type_has_user_nondefault_constructor,
3159         in_class_defaulted_default_constructor,
3160         type_has_user_provided_constructor,
3161         type_has_user_provided_or_explicit_constructor,
3162         type_has_non_user_provided_default_constructor,
3163         vbase_has_user_provided_move_assign,
3164         type_has_move_constructor, type_has_move_assign,
3165         type_has_user_declared_move_constructor,
3166         type_has_user_declared_move_assign,
3167         type_build_ctor_call, type_build_dtor_call,
3168         type_requires_array_cookie, explain_non_literal_class): Likewise.
3169         (finish_struct): Use lkp_iterator.
3170         (resolve_address_of_overloaded_function): Use OVL_NAME, lkp_iterator.
3171         (note_name_declared_in_class): Use OVL_NAME.
3172         * cxx-pretty-print.c (pp_cxx_unqualified_id): Use OVL_FIRST.
3173         (pp_cxx_qualified_id, cxx_pretty_printer::id_expression,
3174         cxx_pretty_printer::expression): Likewise.
3175         * decl2.c (check_classfn): Use ovl_iterator.
3176         * pt.c (retrieve_specialization): Use ovl_iterator.
3177         * tree.c (cp_tree_equal): Use lkp_iterator.
3178         (type_has_nontrivial_copy_init): Use ovl_iterator.
3180         * typeck2.c (cxx_incomplete_type_diagnostic): Revert change and
3181         check is_overloaded_fn.
3183 2017-05-16  Martin Liska  <mliska@suse.cz>
3185         * parser.c (cp_lexer_print_token): Add default value for flags
3186         argument of print_gimple_stmt, print_gimple_expr,
3187         print_generic_stmt and print_generic_expr.
3189 2017-05-16  Nathan Sidwell  <nathan@acm.org>
3191         * cp-tree.h (class ovl_iterator, class lkp_iterator): New OVERLOAD
3192         iterators.
3193         (MAYBE_BASELINK_FUNCTIONS): New.
3194         * constraint.cc (resolve_constraint_check): Use lkp_iterator.
3195         * decl2.c (maybe_warn_sized_delete): Use ovl_iterator.
3196         * lambda.c (maybe_generic_this_capture): Use lkp_iterator.
3197         * method.c (inherited_ctor_binfo): Use ovl_iterator.
3198         (binfo_inherited_from): Likewise.
3199         * parser.c (lookup_literal_operator): Use lkp_iterator.
3200         * pt.c (iterative_hash_template_arg): Use lkp_iterator.
3201         (print_candidates_1): Likewise.
3202         (determine_specialization): Likewise.
3203         (resolve_overloaded_unification): Likewise.
3204         (resolve_nondeduced_context): Likewise.
3205         (type_dependent_expression_p): Likewise.
3206         (dependent_template_p): Likewise.
3207         * ptree.c (cxx_print_xnode): Likewise.
3208         * semantics.c (omp_reduction_lookup): Use lkp_iterator.
3209         (classtype_has_nothrow_assign_or_copy_p): Use ovl_iterator.
3210         * typeck.c (check_template_keyword): Use lkp_iterator.
3212         * cp-tree.h (OVL_FIRST, OVL_NAME): New.
3213         (ovl_first): New.
3214         * constexpr.c (function_concept_check): Use OVL_FIRST.
3215         * cvt.c (build_expr_type_conversion): Likewise.
3216         * decl.c (poplevel, grokdeclarator): Use OVL_NAME.
3217         * decl2.c (mark_used): Use OVL_FIRST.
3218         * error.c (dump_decl): Use OVL_FIRST, OVL_NAME.
3219         (dump_expr, location_of): Use OVL_FIRST.
3220         * friend.c (do_friend): Use OVL_NAME.
3221         * init.c (build_offset_ref): Use OVL_FIRST.
3222         * mangle.c (write_member_name): Likewise.
3223         (write_expression): Use OVL_NAME.
3224         * method.c (strip_inheriting_ctors): Use OVL_FIRST.
3225         * name-lookup.c (pushdecl_class_level): Use OVL_NAME.
3226         * pt.c (check_explicit_specialization): Use OVL_FIRST.
3227         (check_template_shadow): Likewise.
3228         (tsubst_template_args): Use OVL_NAME.
3229         (tsubst_baselink): Use OVL_FIRST.
3230         * semantics.c (perform_koenig_lookup): Use OVL_NAME.
3231         * tree.c (get_first_fn): Use OVL_FIRST.
3232         * typeck.c (finish_class_member_access_expr): Use OVL_NAME.
3233         (cp_build_addr_expr_1): Use OVL_FIRST.
3235         * pt.c (tsubst_copy_and_build): Remove unnecessary COMPONENT_REF
3236         peeking.
3237         * semantics.c (finish_id_expression): Directly init local var.
3238         (finish_omp_reduction_clause): Use really_overloaded_fn.
3239         * tree.c (get_fns): Document.  Assert we got an overload.
3240         (get_first_fn) Document.
3241         * typeck.c (cp_build_addr_expr_1): Pass arg directly to
3242         really_overloaded_fn.
3243         * typeck2.c (cxx_incomplete_type_diagnostic): Use get_first_fn directly.
3245         * cp-tree.h (SCOPE_DEPTH): New.
3246         * name-lookup.h (is_nested_namespace): Declare.
3247         * name-lookup.c (is_nested_namespace): New.
3248         (is_ancestor): Use it.
3249         (set_decl_namespace): Likewise.
3250         (push_namespace): Set SCOPE_DEPTH.
3251         * pt.c (check_specialization_namespace): Use is_nested_namespace.
3252         (check_unqualigied_spec_or_inst): Likewise.
3254 2017-05-15  Nathan Sidwell  <nathan@acm.org>
3256         PR c++/79369
3257         * cp-tree.h (DECL_NAMESPACE_INLINE_P): New.
3258         * name-lookup.h (push_namespace): Return int, add make_inline arg.
3259         * name-lookup.c (push_namespace): Deal with inline directly.
3260         Return pushed count.
3261         * parser.c (cp_parser_namespace_definition): Adjust for
3262         push_namespace change.
3264 2017-05-11  Nathan Sidwell  <nathan@acm.org>
3266         * cp-lang.c (get_global_decls, cxx_pushdecl, LANG_HOOK_GETDECLS,
3267         LANG_HOOKS_PUSHDECL): Move to ...
3268         * cp-objcp-common.c (cp_get_global_decls, cp_pushdec,
3269         LANG_HOOK_DECLS, LANG_HOOKS_PUSHDECL): ... here.
3270         * cp-objcp-common.h (cp_get_global_decls, cp_pushdecl): Declare.
3272         * name-lookup.h (pushdecl): Add default friend parm.
3273         (pushdecl_maybe_friend): Delete.
3274         (pushdecl_top_level): Add default friend parm.
3275         (pushdecl_top_level_maybe_friend): Delete.
3276         * name-lookup.c (pushdecl_maybe_friend): Delete.
3277         (pushdecl): Add is_friend parm.
3278         (pushdecl_top_level): Add is friend_parm.
3279         (pushdecl_top_level_maybe_friend, pushdecl_top_level_1): Delete.
3280         (pushdecl_top_level_and_finish): Do pushing and finishing directly.
3281         * friend.c (do_friend): Adjust.
3282         * pt.c (tsubst_friend_class): Adjust.
3284         Revert pushdecl_top_level_and_finish name change.
3285         * name-lookup.h (pushdecl_top_level_and_finish): Resurrect old name.
3286         * name-lookup.c (pushdecl_top_level_and_finish): Likewise.
3287         * decl.c (cp_make_fname_decl): Adjust.
3288         * decl2.c (get_guard, handle_tls_init):  Adjust.
3289         * rtti.c (get_tinfo_decl, tinfo_base_init):  Adjust.
3291         * name-lookup.c (pushdecl_outermost_localscope): Always
3292         conditionally stop timer.
3294         * decl.c (xref_tag_1): Don't frob ts_lambda scope here.
3295         * name-lookup.c (pushtag_1): Deal with ts_lambda scope.
3297         * cp-tree.h (pushdecl, pushdecl_maybe_friend, pushtag,
3298         pushtag_top_level_maybe_friend,
3299         pushdecl_top_level_and_finish): Move declarations to ...
3300         * name-lookup.h: ... here.  Group pushdecl variants.
3301         (pushdecl_top_level_and_finish): Rename to ...
3302         (pushdecl_top_level_with_init): ... here.
3303         * decl.c (cp_make_fname_decl): Use pushdecl_top_level_with_init.
3304         * decl2.c (get_guard, handle_tls_init): Likewise.
3305         * rtti.c (get_tinfo_decl, tinfo_base_init): Likewise.
3306         * lambda.c (maybe_add_lambda_conv_op): Use namespace_bindings_p.
3307         * method.c (implicitly_declare_fn): Likewise.
3308         * searchc (node_debug_info_needed): Likewise.
3309         * name-lookup.c (pushdecl_top_level_and_finish): Rename to ...
3310         (pushdecl_top_level_with_init): ... here.
3311         (pop_everything): Use namespace_bindings_p.
3313         * name-lookup.h (pop_binding): Rename to pop_local_binding.
3314         (getdecls): Rename to get_local_decls.
3315         * name-lookup.c (pop_binding): Rename to ...
3316         (pop_local_binding): ... here.
3317         (pop_bindings_and_leave_scope): Adjust.
3318         (getdecls): Rename to ...
3319         (get_local_decls): ... here.  Assert local scope.
3320         * decl.c (poplevel): Assert not namespace.  Adjust and simplify
3321         logic.
3322         (store_parm_decls): Adjust get_local_decls call.
3323         (parser.c (synthesize_implicit_template_parm): Likewise.
3325 2017-05-11  Ville Voutilainen  <ville.voutilainen@gmail.com>
3327         PR c++/80682
3328         * method.c (is_trivially_xible): Reject void types.
3330 2017-05-10  Nathan Sidwell  <nathan@acm.org>
3332         * class.c (handle_using_decl): Always use OVL_CURRENT.
3333         (resolve_address_of_overloaded_function): Move iterator decl into
3334         for scope.  Don't strip anticipated decls here.
3336         * pt.c (print_candidates_1): Separate TREE_LIST and OVERLOAD
3337         printing.
3338         (print_candidates): Adjust.
3340         * cp-tree.h (build_new_function_call): Lose koenig_p arg.  Fix
3341         line breaking.
3342         * call.c (build_new_function_call): Lose koenig_p arg.  Remove
3343         koenig_p handling here.
3344         * pt.c (push_template_decl_real): Unconditionally retrofit_lang_decl.
3345         (tsubst_omp_clauses): Likewise.
3346         (do_class_deduction): Adjust buld_new_function_call calls.
3347         * semantics.c (finish_call_expr): Likewise.
3349 2017-05-10  Jason Merrill  <jason@redhat.com>
3351         * pt.c (unify_parameter_deduction_failure, unify_cv_qual_mismatch)
3352         (unify_type_mismatch, unify_parameter_pack_mismatch)
3353         (unify_ptrmem_cst_mismatch, unify_expression_unequal)
3354         (unify_parameter_pack_inconsistent, unify_inconsistency)
3355         (unify_vla_arg, unify_method_type_error, unify_arity)
3356         (unify_arg_conversion, unify_no_common_base)
3357         (unify_inconsistent_template_template_parameters)
3358         (unify_template_deduction_failure)
3359         (unify_template_argument_mismatch)
3360         (unify_overload_resolution_failure): Call unify_invalid.
3362         CWG 1847 - Clarifying compatibility during partial ordering
3363         * pt.c (more_specialized_fn): No order between two non-deducible
3364         parameters.
3366         * pt.c (dependent_type_p): Make sure we aren't called with
3367         global_type_node.
3369         PR c++/79549 - C++17 ICE with non-type auto template parameter pack
3370         * pt.c (convert_template_argument): Just return an argument pack.
3371         (coerce_template_parameter_pack, template_parm_to_arg)
3372         (extract_fnparm_pack, make_argument_pack, tsubst_template_args)
3373         (tsubst_decl, tsubst, type_unification_real, unify_pack_expansion):
3374         Don't set the type of a NONTYPE_ARGUMENT_PACK.
3375         * parser.c (make_char_string_pack, make_string_pack): Likewise.
3377 2017-05-10  Nathan Sidwell  <nathan@acm.org>
3379         * cp-tree.h (add_method, clone_function_decl): Change last arg to
3380         bool.
3381         * class.c (add_method): Change third arg to bool.  Adjust.
3382         (one_inheriting_sig, one_inherited_ctor): Adjust.
3383         (clone_function_decl): Change 2nd arg to bool.  Adjust.
3384         (clone_constructors_and_destructors): Adjust.
3385         * lambda.c (maybe_add_lambda_conv_op): Adjust.
3386         * method.c (lazily_declare_fn): Adjust.
3387         * pt.c (tsubst_decl, instantiate_template_1): Adjust.
3388         * semantics.c (finish_member_declaration): Adjust.
3390 2017-05-10  Paolo Carlini  <paolo.carlini@oracle.com>
3392         PR c++/80145
3393         * decl.c (finish_function): To improve error recovery, change the
3394         logic for calling apply_deduced_return_type.
3396 2017-05-09  Jason Merrill  <jason@redhat.com>
3398         PR c++/80605 - __is_standard_layout and empty base
3399         * class.c (check_bases): Ignore empty bases.
3401         PR c++/70979 - literal class and closure types
3402         * class.c (finalize_literal_type_property): Handle closures
3403         specifically.
3404         (explain_non_literal_class): Likewise.
3406         PR c++/66297, DR 1684 - literal class and constexpr member fns
3407         * constexpr.c (is_valid_constexpr_fn): Only complain about
3408         non-literal enclosing class in C++11.
3409         * class.c (finalize_literal_type_property): Likewise.
3411 2017-05-09  Paolo Carlini  <paolo.carlini@oracle.com>
3413         PR c++/80186
3414         * pt.c (tsubst_decl): Early return error_mark_node if
3415         grok_ctor_properties returns false.
3417 2017-05-09  Jason Merrill  <jason@redhat.com>
3419         PR c++/70167 - array prvalue treated as lvalue
3420         * cp-tree.h (CONSTRUCTOR_C99_COMPOUND_LITERAL): New.
3421         (enum fcl_t): New.
3422         * semantics.c (finish_compound_literal): Add fcl_context parameter.
3423         Only make a static variable for C99 syntax.
3424         * parser.c (cp_parser_postfix_expression): Pass it.
3425         * pt.c (tsubst_copy_and_build): Likewise.
3426         * call.c (extend_ref_init_temps): Set
3427         DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P.
3429 2017-05-09  Nathan Sidwell  <nathan@acm.org>
3431         * cp-lang.c (get_global_decls, cxx_pushdecl): New.
3432         (LANG_HOOKS_GETDECLS, LANG_HOOKS_PUSHDECL): Override.
3433         * name-lookup.h (pushdecl_top_level): Declare.
3435 2017-05-08  Jason Merrill  <jason@redhat.com>
3437         PR c++/80178 - parameter passing for uncopyable classes
3438         * tree.c (type_has_nontrivial_copy_init): True for classes with only
3439         deleted copy/move ctors.
3440         (remember_deleted_copy, maybe_warn_parm_abi): New.
3441         * decl.c (require_complete_types_for_parms, check_function_type):
3442         Call maybe_warn_parm_abi.
3443         * call.c (convert_for_arg_passing, build_cxx_call): Likewise.
3445 2017-05-08  Nathan Sidwell  <nathan@acm.org>
3447         * decl.c (builtin_function_1): Set DECL_ANTICIPATED before pushing.
3448         (start_preparsed_function): Do decl pushing before setting
3449         current_funciton_decl and announcing it.
3451         * name-lookup.h (pushdecl_with_scope): Replace with ...
3452         (pushdecl_outermost_localscope): ... this.
3453         * name-lookup.c (pushdecl_with_scope): Replace with ...
3454         (pushdecl_outermost_localscope): ... this.
3455         (pushdecl_namespace_level): Adjust.
3456         * decl.c (cp_make_fname_decl): Use pushdecl_outermost_localscope.
3457         * lambda.c (insert_capture_proxy): Likewise.
3459         * class.c (build_vtbl_initializer): Don't shadow outer variable
3460         with static var.
3462         Revert _binding -> _value change.
3463         * name-lookup.h (get_namespace_value, set_global_value): Rename to ...
3464         (get_namespace_binding, set_global_binding): ... these.
3465         * name-lookup.c (get_namespace_value, set_global_value): Rename to ...
3466         (get_namespace_binding, set_global_binding): ... these.
3467         (arg_assoc_namespace, pushdecl_maybe_friend_1,
3468         check_for_out_of_scope_variable, push_overloaded_decl_1,
3469         lookup_name_innermost_nonclass_level, push_namespace): Adjust.
3470         * cp-tree.h (IDENTIFIER_GLOBAL_VALUE,
3471         SET_IDENTIFIER_GLOBAL_VALUE): Adjust.
3472         * decl.c (poplevel): Adjust.
3473         * pt.c (make_constrained_auto): Likewise.
3475 2017-05-07  Volker Reichelt  <v.reichelt@netcologne.de>
3477         PR translation/80280
3478         * call.c (print_z_candidate): Fix quoting.
3480 2017-05-05  David Malcolm  <dmalcolm@redhat.com>
3482         * error.c (pedwarn_cxx98): Replace report_diagnostic
3483         with diagnostic_report_diagnostic.
3485 2017-05-05  Nathan Sidwell  <nathan@acm.org>
3487         * cp-tree.h (IDENTIFIER_GLOBAL_VALUE): Use get_namespace_value.
3488         (SET_IDENTIFIER_GLOBAL_VALUE): Use set_global_value.
3489         (IDENTIFIER_NAMESPACE_VALUE): Delete.
3490         * name-lookup.h (namespace_binding, set_namespace_binding): Replace
3491         with ...
3492         (get_namespace_value, set_global_value): ... these.
3493         (get_global_value_if_present, is_typename_at_global_scope): Delete.
3494         * decl.c (poplevel): Use get_namespace_value.
3495         (grokdeclarator): Use IDENTIFIER_GLOBAL_VALUE.
3496         * class.c (build_vtbl_initializer): Stash library decl in
3497         static var. Use IDENTIFIER_GLOBAL_VALUE.
3498         * except.c (do_get_exception_ptr, do_begin_catch, do_end_catch,
3499         do_allocate_exception, do_free_exception, build_throw): Likewise.
3500         * init.c (throw_bad_array_new_length): Likewise.
3501         * rtti.c (throw_bad_cast, throw_bad_typeid): Likewise.
3502         * name-lookup.c (arg_assoc_namespace, pushdecl_maybe_friend_1,
3503         check_for_our_of_scope_variable, push_overloaded_decl_1): Use
3504         get_namespace_value.
3505         (set_namespace_binding_1): Rename to
3506         (set_namespace_binding): ... here.
3507         (set_global_value): New.
3508         (lookup_name_innermost_nonclass_level_1, push_namespace): Use
3509         get_namespace_value.
3510         * pt.c (listify): Use get_namespace_value.
3512         * call.c (make_temporary_var_for_ref_to_temp): Push decl into
3513         current scope.
3514         * lex.c (unqualified_name_lookup_error): Likewise.
3516         * class.c (alter_class): Use retrofit_lang_decl directly.
3517         * decl.c (push_local_name, dupliate_decls): Likewise.
3518         * semantics.c (omp_privatize_field): Likewise.
3520         Kill walk_namespaces.
3521         * cp-tree.h (walk_namespaces_fn, walk_namespaces): Delete.
3522         * decl.c (walk_namespaces_r, walk_namespaces): Delete.
3524         Kill per-namespace static_decls.
3525         * cp-tree.h (static_decls): Declare.
3526         (wrapup_globals_for_namespace,
3527         diagnose_inline_vars_for_namespace): Replace with ...
3528         (wrapup_namespace_globals): ... this.
3529         * decl.c (static_decls): Define.
3530         (wrapup_globals_for_namespace,
3531         diagnose_inline_vars_for_namespace): Replace with ...
3532         (wrapup_namespace_globals): ... this.
3533         (cxx_init_decl_processing): Initialize static_decls.
3534         * decl2.c (c_parse_final_cleanups): Adjust.
3535         * name-lookup.h (cp_binding_level): Remove static_decls member.
3536         * name-lookup.c (add_decl_to_level): Adjust.
3537         (begin_scope): Adjust.
3539 2017-05-05  Paolo Carlini  <paolo.carlini@oracle.com>
3541         PR c++/71577
3542         * decl.c (reshape_init): Unconditionally return error_mark_node
3543         upon error about too many initializers.
3545 2017-05-04  Nathan Sidwell  <nathan@acm.org>
3547         * constraint.cc (diagnose_check_constraint): Fix %E thinko.
3549 2017-05-04  Martin Sebor  <msebor@redhat.com>
3551         PR translation/80280
3552         * call.c (print_z_candidate): Add missing quoting to %D and other
3553         like directives.
3554         (build_op_call_1): Same.
3555         * constraint.cc (diagnose_check_constraint): Same.
3556         * mangle.c (mangle_decl): Same.
3557         * name-lookup.c (cp_binding_level_debug): Same.
3558         (set_decl_namespace): Same.
3559         * parser.c (cp_parser_tx_qualifier_opt): Same.
3560         * pt.c (print_candidates_1): Same.
3561         (check_template_variable): Same.
3562         (tsubst_default_argument): Same.
3563         (most_specialized_partial_spec): Same.
3564         * semantics.c (omp_reduction_lookup): Same.
3565         * tree.c (check_abi_tag_redeclaration): Same.
3566         * typeck.c (comptypes): Same.
3567         * typeck2.c (abstract_virtuals_error_sfinae): Same.
3569 2017-05-04  Nathan Sidwell  <nathan@acm.org>
3571         More global trees.
3572         * cp-tree.h (enum cp_tree_index): Add CPTI_GLOBAL,
3573         CPTI_GLOBAL_TYPE, CPTI_GLOBAL_IDENTIFIER, CPTI_ANON_IDENTIFIER,
3574         CPTI_INIT_LIST_IDENTIFIER.
3575         (global_namespace, global_type_node, global_identifier,
3576         anon_identifier, init_list_identifier): New.
3577         * decl.c (global_type_node, global_scope_name): Delete.
3578         (initialize_predefined_identifiers): Add new identifiers.
3579         (cxx_init_decl_processing): Adjust.
3580         * name-lookup.h (global_namespace, global_type_node): Delete.
3581         * name-lookup.c (global_namespace, anonymous_namespace_name,
3582         get_anonymous_namespace_name): Delete.
3583         (namespace_scope_ht_size, begin_scope, pushtag_1,
3584         push_namespace): Adjust,
3585         * call.c (type_has_extended_temps): Use init_list_identifier.
3586         * pt.c (listify): Likewise.
3588         * name-lookup.c: Reorder functions to make merging from modules
3589         branch simpler.
3591 2017-05-03  Jason Merrill  <jason@redhat.com>
3593         * constexpr.c (cxx_eval_outermost_constant_expr): Use TV_CONSTEXPR.
3595 2017-05-03  Nathan Sidwell  <nathan@acm.org>
3597         * cp-tree.h (enum cp_tree_index, cp_global_trees): Move earlier,
3598         along with #defines, to before name-lookup include.
3600 2017-05-02  Paolo Carlini  <paolo.carlini@oracle.com>
3602         * pt.c (is_auto_or_concept): Remove.
3603         (type_uses_auto_or_concept): Remove, unused.
3604         (find_parameter_packs_r, extract_autos_r, is_auto_r): Adjust.
3605         * parser.c (tree_type_is_auto_or_concept): Remove, unused.
3606         * cp-tree.h (is_auto_or_concept): Remove.
3608 2017-05-01  Xi Ruoyao  <ryxi@stu.xidian.edu.cn>
3610         PR c++/80038
3611         * cp-cilkplus.c (cilk_install_body_with_frame_cleanup): Don't
3612         add pedigree operation and detach call here.
3613         * cp-gimplify.c (cp_gimplify_expr): Remove the calls to
3614         cilk_cp_gimplify_call_params_in_spawned_fn.
3615         (cilk_cp_gimplify_call_params_in_spawned_fn): Remove function.
3616         * semantics.c (simplify_aggr_init_expr): Copy EXPR_CILK_SPAWN.
3618 2017-04-29  Volker Reichelt  <v.reichelt@netcologne.de>
3620         * parser.c (cp_parser_member_declaration): Add fix-it hints for
3621         stray comma and missing semicolon at end of member declaration.
3623 2017-04-27  Volker Reichelt  <v.reichelt@netcologne.de>
3625         * parser.c (cp_parser_cast_expression): Add target type of cast to
3626         diagnostic.
3627         * error.c (type_to_string): Add '{enum}' suffix to enumeration types.
3629 2017-04-26  Paolo Carlini  <paolo.carlini@oracle.com>
3631         * decl.c (grok_ctor_properties, ambi_op_p, unary_op_p): Change
3632         return type to bool.
3633         * cp-tree.h (grok_ctor_properties): Update.
3635 2017-04-26  Volker Reichelt  <v.reichelt@netcologne.de>
3637         * parser.c (cp_parser_nested_name_specifier_opt): Add fix-it
3638         information to diagnostic of invalid colon in nested-name-specifier.
3640 2017-04-25  Volker Reichelt  <v.reichelt@netcologne.de>
3642         * parser.c (cp_parser_elaborated_type_specifier): Add fix-it to
3643         diagnostic of invalid class/struct keyword after enum.
3645 2017-04-25  David Malcolm  <dmalcolm@redhat.com>
3647         * parser.c (cp_parser_member_declaration): Add fix-it hint
3648         for removing stray semicolons.
3650 2017-04-25  David Malcolm  <dmalcolm@redhat.com>
3652         * name-lookup.c (get_std_name_hint): New function.
3653         (maybe_suggest_missing_header): New function.
3654         (suggest_alternative_in_explicit_scope): Call
3655         maybe_suggest_missing_header.
3657 2017-04-25  David Malcolm  <dmalcolm@redhat.com>
3659         PR c++/80177
3660         * name-lookup.c (suggest_alternative_in_explicit_scope): Convert
3661         candidate type of bm from tree to const char *.
3662         (consider_binding_level): Likewise.
3663         (lookup_name_fuzzy): Likewise, using this to merge the best
3664         result from the preprocessor into bm, rather than immediately
3665         returning, so that better matches from reserved words can "win".
3666         Guard the rejection of keywords that don't start decl-specifiers
3667         so it only happens for FUZZY_LOOKUP_TYPENAME.
3669 2017-04-24  Volker Reichelt  <v.reichelt@netcologne.de>
3671         * decl.c (grokdeclarator): Use %qT instead of %<%T%> in diagnostics.
3672         (start_enum): Likewise.
3673         (build_enumerator): Likewise. Use %qE instead of plain %E.
3674         * parser.c (cp_parser_mem_initializer_list): Use %qD instead of
3675         %<%D%> in diagnostics.
3676         (cp_parser_elaborated_type_specifier): Likewise.
3677         * pt.c (make_pack_expansion): Use %qT and %qE instead of
3678         %<%T%> and %<%E%> in diagnostics.
3679         (tsubst_pack_expansion): Likewise.
3681 2017-04-24  David Malcolm  <dmalcolm@redhat.com>
3683         PR c++/80016
3684         * parser.c (cp_parser_unary_expression):  Generate a location
3685         range for alignof and sizeof expressions.
3687 2017-04-24  Volker Reichelt  <v.reichelt@netcologne.de>
3689         * parser.c (cp_parser_cv_qualifier_seq_opt): Add fix-it info to
3690         error message.
3691         (cp_parser_virt_specifier_seq_opt): Likewise.
3692         (set_and_check_decl_spec_loc): Likewise twice.
3694 2017-04-21  Jason Merrill  <jason@redhat.com>
3696         PR c++/80179 - ICE with initialized flexible array member.
3697         * constexpr.c (verify_ctor_sanity): Handle flexible array members.
3699 2017-04-21  Richard Biener  <rguenther@suse.de>
3701         * cp-tree.h (copy_decl): Annotate with CXX_MEM_STAT_INFO.
3702         (copy_type): Likewise.
3703         * lex.c (copy_decl): Pass down mem-stat info.
3704         (copy_type): Likewise.
3706 2017-04-20  Jonathan Wakely  <jwakely@redhat.com>
3708         PR c++/80473
3709         * init.c (build_new_1): Suppress notes about over-aligned new when
3710         the warning is suppressed.
3712 2017-04-20  Volker Reichelt  <v.reichelt@netcologne.de>
3714         * parser.c (cp_parser_member_declaration): Add warning with fixit
3715         information for extra semicolon after in-class function definition.
3717 2017-04-20  Jakub Jelinek  <jakub@redhat.com>
3719         PR middle-end/80423
3720         * tree.c (build_cplus_array_type): Call build_array_type
3721         with the intended TYPE_TYPELESS_STORAGE flag value, instead
3722         of calling build_array_type and modifying later TYPE_TYPELESS_STORAGE
3723         on the shared type.
3725 2017-04-18  Marek Polacek  <polacek@redhat.com>
3727         PR c++/80244 - ICE with attribute in template alias.
3728         * tree.c (strip_typedefs): Handle UNDERLYING_TYPE.
3730         PR c++/80241 - ICE with alignas pack expansion.
3731         * error.c (dump_expr): Handle TREE_LIST.
3732         * parser.c (cp_parser_std_attribute_list): Return error_mark if
3733         make_pack_expansion returns an error.
3735 2017-04-17  Bernd Edlinger  <bernd.edlinger@hotmail.de>
3737         PR c++/80287
3738         * class.c (fixup_may_alias): Fix all type variants.
3740 2017-04-17  Jason Merrill  <jason@redhat.com>
3742         PR c++/80415 - wrong error with default arg and array reference.
3743         * tree.c (lvalue_kind): Return clk_class for an array prvalue.
3745         * pt.c (tsubst_init): Set TARGET_EXPR_DIRECT_INIT_P.
3747 2017-04-15  Alexandre Oliva <aoliva@redhat.com>
3749         * decl.c (name_unnamed_type): Split out of...
3750         (grokdeclarator): ... this.
3751         * decl.h (name_unnamed_type): Declare.
3753 2017-04-12  Richard Biener  <rguenther@suse.de>
3754         Bernd Edlinger  <bernd.edlinger@hotmail.de>
3756         PR middle-end/79671
3757         * tree.c (build_cplus_array_type): Set TYPE_TYPELESS_STORAGE
3758         for arrays of character or std::byte type.
3760 2017-04-11  Jason Merrill  <jason@redhat.com>
3762         PR c++/80294 - ICE with constexpr and inheritance.
3763         * constexpr.c (reduced_constant_expression_p):
3764         A null constructor element is non-constant.
3765         (cxx_eval_indirect_ref): Don't VERIFY_CONSTANT before
3766         returning an empty base.
3768 2017-04-11  Jakub Jelinek  <jakub@redhat.com>
3770         PR c++/80370
3771         * decl.c (cp_finish_decomp): If processing_template_decl on
3772         non-dependent decl, only set TREE_TYPE on the v[i] decls, but don't
3773         change their DECL_VALUE_EXPR nor cp_finish_decl them.  Instead make
3774         sure DECL_VALUE_EXPR is the canonical NULL type ARRAY_REF for tsubst
3775         processing.
3776         * pt.c (value_dependent_expression_p) <case VAR_DECL>: For variables
3777         with DECL_VALUE_EXPR, return true if DECL_VALUE_EXPR is type
3778         dependent.
3780 2017-04-11  Jakub Jelinek  <jakub@redhat.com>
3782         PR c++/80363
3783         * error.c (dump_expr): Handle VEC_COND_EXPR like COND_EXPR.
3785 2017-04-10  Jakub Jelinek  <jakub@redhat.com>
3787         PR c++/80176
3788         * tree.c (lvalue_kind): For COMPONENT_REF with BASELINK second
3789         operand, if it is a static member function, recurse on the
3790         BASELINK.
3792 2017-04-10  Marek Polacek  <polacek@redhat.com>
3794         PR sanitizer/80348
3795         * typeck.c (cp_build_binary_op): Use NULL_TREE instead of NULL.  Set
3796         ORIG_TYPE earlier and not only when shortening.
3798 2017-04-07  Jason Merrill  <jason@redhat.com>
3800         PR c++/80356 - ICE with reference to function template argument.
3801         PR c++/79294
3802         * pt.c (convert_nontype_argument_function): Adjust type even with a
3803         value-dependent argument.
3805         PR c++/80267 - ICE with nested capture of reference
3806         PR c++/60992
3807         * pt.c (tsubst_copy): Handle lookup finding a capture proxy.
3809 2017-04-07  Marek Polacek  <polacek@redhat.com>
3811         PR sanitizer/80348
3812         * typeck.c (cp_build_binary_op): Convert COP[01] to ORIG_TYPE.
3814         PR c++/80095
3815         * call.c (build_over_call): Don't check cxx_dialect.
3816         * cp-gimplify.c (cp_gimplify_init_expr): Don't check cxx_dialect nor
3817         whether SUB is a CONSTRUCTOR.
3818         * init.c (build_new_1): Don't check cxx_dialect.
3819         * tree.c (replace_placeholders): Add a function comment.  Return if
3820         not in C++14, or if the object isn't a (member of a) class.
3821         * typeck2.c (store_init_value): Don't check cxx_dialect nor whether
3822         TYPE is CLASS_TYPE_P.
3824 2017-04-05  Jakub Jelinek  <jakub@redhat.com>
3826         PR c++/80309
3827         * pt.c (canonical_type_parameter): Use vec_safe_grow_cleared instead
3828         of a loop doing vec_safe_push of NULL.  Formatting fixes.
3829         (rewrite_template_parm): Copy TEMPLATE_PARM_PARAMETER_PACK from oldidx
3830         to newidx before calling canonical_type_parameter on newtype.
3832 2017-04-04  Volker Reichelt  <v.reichelt@netcologne.de>
3834         PR c++/80296
3835         * cxx-pretty-print.c (cxx_pretty_printer::expression): Add
3836         UNARY_PLUS_EXPR case.
3838 2017-04-03  Jason Merrill  <jason@redhat.com>
3840         * semantics.c (finish_template_type): Check CLASSTYPE_TEMPLATE_INFO.
3842 2017-04-03  Jonathan Wakely  <jwakely@redhat.com>
3844         * class.c (update_vtable_entry_for_fn): Fix typo in comment.
3845         * decl2.c (one_static_initialization_or_destruction): Likewise.
3846         * name-lookup.c (store_bindings): Likewise.
3847         * parser.c (make_call_declarator): Likewise.
3848         * pt.c (check_explicit_specialization): Likewise.
3850 2017-04-03  Jason Merrill  <jason@redhat.com>
3852         PR sanitizer/79993 - ICE with VLA initialization from string
3853         PR c++/69487 - wrong VLA initialization from string
3854         * init.c (finish_length_check): Split out from build_vec_init.
3855         (build_vec_init): Handle STRING_CST.
3856         * typeck2.c (split_nonconstant_init): Handle STRING_CST.
3857         (digest_init_r): Don't give a STRING_CST VLA type.
3859 2017-03-31  Jakub Jelinek  <jakub@redhat.com>
3861         PR c++/79572
3862         * cp-gimplify.c (cp_genericize_r): Sanitize INTEGER_CSTs with
3863         REFERENCE_TYPE.  Adjust ubsan_maybe_instrument_reference caller
3864         for NOP_EXPR to REFERENCE_TYPE.
3866         PR libstdc++/80251
3867         * cp-tree.h (enum cp_trait_kind): Add CPTK_IS_AGGREGATE.
3868         * cxx-pretty-print.c (pp_cxx_trait_expression): Handle
3869         CPTK_IS_AGGREGATE.
3870         * semantics.c (trait_expr_value): Handle CPTK_IS_AGGREGATE.
3871         Remove extraneous parens.
3872         (finish_trait_expr): Handle CPTK_IS_AGGREGATE.
3873         * parser.c (cp_parser_primary_expression): Handle RID_IS_AGGREGATE.
3874         (cp_parser_trait_expr): Likewise.
3876 2017-03-27  Jakub Jelinek  <jakub@redhat.com>
3878         PR middle-end/80162
3879         * cp-tree.h (cxx_mark_addressable): Add array_ref_p argument.
3880         * typeck.c (cxx_mark_addressable): Likewise.  Look through
3881         VIEW_CONVERT_EXPR unless array_ref_p and VCE is from VECTOR_TYPE
3882         to ARRAY_TYPE.
3883         (cp_build_array_ref): Pass true as array_ref_p to cxx_mark_addressable.
3885 2017-03-24  Jason Merrill  <jason@redhat.com>
3887         PR c++/77339 - ICE with invalid use of alias template.
3888         * pt.c (lookup_template_class_1): Don't try to enter the scope of an
3889         alias template.
3891 2017-03-24  Marek Polacek  <polacek@redhat.com>
3893         PR c++/80119
3894         * cp-gimplify.c (cp_fold): Strip CLEANUP_POINT_EXPR if the expression
3895         doesn't have side effects.
3897 2017-03-23  Jason Merrill  <jason@redhat.com>
3899         PR c++/80150 - ICE with overloaded variadic deduction.
3900         * pt.c (try_one_overload): Remove asserts.
3902         PR c++/77563 - missing ambiguous conversion error.
3903         * call.c (convert_like_real): Use LOOKUP_IMPLICIT.
3905 2017-03-23  Marek Polacek  <polacek@redhat.com>
3907         * cp-tree.h: Remove a C_RID_YYCODE reference.
3909 2017-03-22  Jakub Jelinek  <jakub@redhat.com>
3911         PR c++/80141
3912         * semantics.c (finish_omp_clause) <case OMP_CLAUSE_SIMDLEN,
3913         case OMP_CLAUSE_ALIGNED>: Call maybe_constant_value only when not
3914         processing_template_decl.
3916 2017-03-21  Paolo Carlini  <paolo.carlini@oracle.com>
3918         PR c++/77752
3919         * name-lookup.c (pushtag_1): Add check for bogus, non template,
3920         std::initializer_list.
3922 2017-03-21  Jakub Jelinek  <jakub@redhat.com>
3924         PR c++/35878
3925         * init.c (std_placement_new_fn_p, build_new_1): Formatting fixes.
3927 2017-03-21  Ville Voutilainen  <ville.voutilainen@gmail.com>
3929         PR c++/35878
3930         * init.c (std_placement_new_fn_p): New.
3931         (build_new_1): Call it.
3933 2017-03-20  Jason Merrill  <jason@redhat.com>
3935         PR c++/80096 - ICE with C++17 non-type auto.
3936         * pt.c (tsubst): Delay tsubst of type of template non-type
3937         parameter.
3939         PR c++/79519 - ICE with deleted template friend.
3940         * decl.c (grokdeclarator): Complain about misplaced function
3941         definition using =, as well.
3943         PR c++/79640 - infinite recursion with generic lambda.
3944         * pt.c (tsubst_copy) [VAR_DECL]: Register the dummy instantiation
3945         before substituting its initializer.
3947 2017-03-20  Marek Polacek  <polacek@redhat.com>
3948             Paolo Carlini  <paolo.carlini@oracle.com>
3950         PR c++/80059 - ICE with noexcept and __transaction_atomic
3951         * except.c (build_must_not_throw_expr): Call
3952         instantiate_non_dependent_expr.
3954 2017-03-19  Jason Merrill  <jason@redhat.com>
3956         PR c++/80084 - wrong C++17 decomposition by reference of parameter.
3957         * decl.c (cp_finish_decomp): Don't pull out the DECL_INITIAL of a
3958         reference decomposition.
3960         PR c++/80077 - error with constexpr and -fno-elide-constructors.
3961         * constexpr.c (cxx_eval_call_expression): Set ctx->call while
3962         expanding trivial constructor.
3964 2017-03-17  Jason Merrill  <jason@redhat.com>
3966         PR c++/78345 - ICE initializing array from lambda.
3967         * init.c (build_aggr_init): Check array initializer.
3968         (build_vec_init): Check the type of a CONSTRUCTOR.
3970         PR c++/80073 - C++17 ICE with virtual base.
3971         * decl.c (xref_basetypes): Also check for indirect vbases.
3973 2017-03-16  Jason Merrill  <jason@redhat.com>
3975         * decl.c (start_enum): std::byte aliases anything.
3977         PR c++/79797
3978         * constexpr.c (lookup_placeholder): Tweak.
3980 2017-03-15  Jason Merrill  <jason@redhat.com>
3982         PR c++/80043 - ICE with -fpermissive
3983         * typeck.c (convert_for_assignment): Handle instantiate_type
3984         not giving an error.
3986 2017-03-14  Nathan Sidwell  <nathan@acm.org>
3988         PR c++/79393 DR 1658 workaround
3989         * method.c (synthesized_method_base_walk): Inihibit abstract class
3990         virtual base access check here.
3991         (synthesized_method_walk): Not here.
3993 2017-03-13  Nathan Sidwell  <nathan@acm.org>
3995         PR c++/79393 DR 1658 workaround
3996         * method.c (synthesized_method_walk): Check vbases of abstract
3997         classes for dtor walk.
3999 2017-03-10  David Malcolm  <dmalcolm@redhat.com>
4001         PR translation/79848
4002         * decl.c (grokfndecl): Simplify uses of "%<%s%>" to "%qs".
4004 2017-03-10  Jason Merrill  <jason@redhat.com>
4006         PR c++/79960 - alias templates and partial ordering
4007         * pt.c (comp_template_args): Add partial_order parm.
4008         (template_args_equal): Likewise.
4009         (comp_template_args_porder): New.
4010         (get_partial_spec_bindings): Use it.
4012 2017-03-10  Marek Polacek  <polacek@redhat.com>
4014         PR c++/79967
4015         * decl.c (grokdeclarator): Check ATTRLIST before dereferencing it.
4017 2017-03-10  Jakub Jelinek  <jakub@redhat.com>
4019         PR c++/79899
4020         * optimize.c (maybe_thunk_body): Don't ICE if fns[0] is NULL.
4021         Use XALLOCAVEC macro.
4023         PR c++/79896
4024         * decl.c (finish_enum_value_list): If value is error_mark_node,
4025         don't copy it and change its type.
4026         * init.c (constant_value_1): Return error_mark_node if DECL_INITIAL
4027         of CONST_DECL is error_mark_node.
4029 2017-03-09  Marek Polacek  <polacek@redhat.com>
4031         PR c++/79900 - ICE in strip_typedefs
4032         * tree.c (strip_typedefs): Skip the attribute handling if T is
4033         a variant type which hasn't been updated yet.
4035         PR c++/79687 - wrong code with pointer-to-member
4036         * init.c (constant_value_1): Break if the variable has a dynamic
4037         initializer.
4039 2017-03-08  Jason Merrill  <jason@redhat.com>
4041         PR c++/79797 - ICE with self-reference in array DMI.
4042         * constexpr.c (lookup_placeholder): Split out...
4043         (cxx_eval_constant_expression): ...from here.
4045 2017-03-07  Jakub Jelinek  <jakub@redhat.com>
4047         PR c/79834
4048         * parser.c (cp_parser_omp_cancellation_point,
4049         cp_parser_omp_target_enter_data, cp_parser_omp_target_exit_data,
4050         cp_parser_omp_target_update): Change "may only be used in compound
4051         statements" diagnostics, such that the same translatable string is
4052         used for all pragmas.
4053         (cp_parser_pragma): Likewise.  Use error_at instead of
4054         cp_parser_error for that diagnostics.
4056 2017-03-06  Marek Polacek  <polacek@redhat.com>
4058         PR c++/79796 - ICE with NSDMI and this pointer
4059         * call.c (build_over_call): Handle NSDMI with a 'this' by calling
4060         replace_placeholders.
4062 2017-03-06  Jakub Jelinek  <jakub@redhat.com>
4064         PR c++/79822
4065         * constexpr.c (cxx_eval_statement_list): Treat empty ({ }) like
4066         ({ (void) 0; }).
4068 2017-03-06  Jason Merrill  <jason@redhat.com>
4070         Revert "Allow deduction guides to look into primary template."
4071         * cp-tree.h, parser.c, pt.c, search.c: Revert.
4073 2017-03-05  Paolo Carlini  <paolo.carlini@oracle.com>
4075         PR c++/70266
4076         * except.c (build_must_not_throw_expr): Perform the implicit
4077         conversions on the condition.
4079 2017-03-03  Jason Merrill  <jason@redhat.com>
4081         * mangle.c (mangle_decl): Check -Wnoexcept-type instead of
4082         -Wc++1z-compat.
4084         Core issues 2273 and 2277
4085         * call.c (joust): Adjust using-declaration tiebreaker to handle
4086         the intermediate base case.
4087         * method.c (strip_inheriting_ctors): Just return the argument if
4088         !flag_new_inheriting_ctors.
4090 2017-03-03  Richard Biener  <rguenther@suse.de>
4092         PR c++/79825
4093         * cp-gimplify.c (simple_empty_class_p): Handle EMPTY_CLASS_EXPR.
4095 2017-03-03  Marek Polacek  <polacek@redhat.com>
4097         PR c++/79791
4098         * typeck.c (string_conv_p): In C++11, always call pedwarn with
4099         OPT_Wwrite_strings.
4101 2017-03-02  Jason Merrill  <jason@redhat.com>
4103         Update overload resolution with deduction guides.
4104         * pt.c (do_class_deduction): Always build the copy guide.
4105         (copy_guide_p, template_guide_p): New.
4106         (build_deduction_guide): Remember the original constructor.
4107         * call.c (joust): Prefer the copy guide and non-template guides.
4109         Allow deduction guides to look into primary template.
4110         * cp-tree.h (struct saved_scope): Add deduction_guide_type.
4111         (struct cp_decl_specifier_seq): Add constructor_p.
4112         * parser.c (cp_parser_decl_specifier_seq): Set constructor_p.
4113         (cp_parser_init_declarator): Check it.  Set ctor_dtor_or_conv_p.
4114         Clear deduction_guide_type.  Don't handle deduction guide names.
4115         (cp_parser_declarator): Don't clear ctor_dtor_or_conv_p.
4116         (cp_parser_direct_declarator): Likewise.  Handle deduction guides.
4117         (cp_parser_member_declaration, cp_parser_cache_defarg)
4118         (cp_parser_objc_class_ivars): Set ctor_dtor_or_conv_p.
4119         * pt.c (tsubst_copy, tsubst_copy_and_build): Revert last change.
4120         (build_deduction_guide): Set deduction_guide_type.
4121         (dependent_scope_p): Check deduction_guide_type.
4122         * search.c (lookup_member): Likewise.
4124 2017-03-02  Jakub Jelinek  <jakub@redhat.com>
4126         PR c++/79782
4127         * init.c (mark_exp_read_r): New function.
4128         (emit_mem_initializers): Use cp_walk_tree with mark_exp_read_r on
4129         whole arguments instead of plain mark_exp_read on TREE_LIST values.
4131 2017-03-01  Jason Merrill  <jason@redhat.com>
4133         Class template argument deduction in new-expression
4134         * init.c (build_new): Handle deduction from no initializer.
4135         * parser.c (cp_parser_new_expression): Don't require a single
4136         expression for class template deduction.
4137         * typeck2.c (cxx_incomplete_type_diagnostic): Fix diagnostic for
4138         class template placeholder.
4139         * pt.c (tsubst_copy) [TEMPLATE_DECL]: Handle dependent context.
4140         (tsubst_copy_and_build) [TEMPLATE_ID_EXPR]: Handle SCOPE_REF.
4141         (redeclare_class_template): Set TEMPLATE_TYPE_PARM_FOR_CLASS.
4143 2017-03-01  Jakub Jelinek  <jakub@redhat.com>
4145         PR c++/79746
4146         * init.c (emit_mem_initializers): When not constructing vbases of
4147         abstract classes, mark arguments as read for
4148         -Wunused-but-set-parameter.
4150 2017-02-28  Jason Merrill  <jason@redhat.com>
4152         Class template argument deduction refinements
4153         * call.c (joust): Move deduction guide tiebreaker down.
4154         * decl.c (start_decl_1, cp_finish_decl, grokdeclarator): Allow class
4155         deduction with no initializer.
4156         * pt.c (build_deduction_guide): Handle implicit default/copy ctor.
4157         (do_class_deduction): Use that rather than special case.
4158         (do_auto_deduction): Handle null initializer.
4160 2017-02-28  Jakub Jelinek  <jakub@redhat.com>
4162         * decl.c (find_decomp_class_base): Use cond ? G_("...") : G_("...")
4163         instead of just cond ? "..." : "...".
4164         (grokdeclarator): Likewise.
4165         (build_enumerator): Likewise.
4166         * init.c (build_new_1): Likewise.
4167         * call.c (build_new_method_call_1): Likewise.
4168         * parser.c: Include intl.h.
4169         (cp_parser_oacc_enter_exit_data): Use %s and ternary operator only for
4170         "enter"/"exit" keyword.
4171         (cp_finalize_oacc_routine): Don't use %s to supply portions of the
4172         message.
4174 2017-02-27  Jason Merrill  <jason@redhat.com>
4176         PR c++/71568 - SFINAE forming pointer to member function
4177         * init.c (build_offset_ref): Check the return value of
4178         perform_or_defer_access_check.
4180 2017-02-27  Marek Polacek  <polacek@redhat.com>
4182         * decl.c (expand_static_init): Add missing } in a comment.
4184 2017-02-27  Volker Reichelt  <v.reichelt@netcologne.de>
4186         * init.c: Include intl.h.
4187         (build_new_1): Move message strings into pedwarn to make them
4188         -Wformat-security friendly. Mark string for translation.
4189         * pt.c (tsubst_copy_and_build): Mark string for translation.
4190         Make the pointer const.
4191         * semantics.c (finish_id_expression): Mark strings for translation.
4193 2017-02-25  Jakub Jelinek  <jakub@redhat.com>
4195         * call.c (build_op_delete_call): Make msg1 and msg2 const.
4197 2017-02-24  Jakub Jelinek  <jakub@redhat.com>
4199         PR c++/79588
4200         * call.c (build_over_call): Call check_function_arguments even for
4201         -Wrestrict, adjust check_function_arguments caller.
4202         * parser.c (cp_parser_postfix_expression): Don't handle -Wrestrict
4203         here.
4204         * typeck.c (cp_build_function_call_vec): Adjust
4205         check_function_arguments caller.
4207 2017-02-24  Marek Polacek  <polacek@redhat.com>
4209         PR translation/79705
4210         * decl.c (check_redeclaration_exception_specification): Mark a string
4211         for translation.  Make the pointer const.
4213 2017-02-23  Paolo Carlini  <paolo.carlini@oracle.com>
4215         PR c++/79361
4216         * pt.c (register_specialization): Check duplicate_decls return value
4217         for error_mark_node and pass it back.
4219 2017-02-22  Jason Merrill  <jason@redhat.com>
4221         PR c++/79679 - missing destructor for argument
4222         * call.c (build_over_call): Don't pass tf_no_cleanup to argument
4223         conversions.
4225         * pt.c (do_class_deduction): Handle 0 argument case.
4227 2017-02-22  Jakub Jelinek  <jakub@redhat.com>
4229         PR c++/79664
4230         * parser.c (cp_parser_omp_teams, cp_parser_omp_target): Use
4231         SET_EXPR_LOCATION on OMP_TARGET/OMP_TEAMS tree.
4232         * constexpr.c (potential_constant_expression_1): Handle
4233         OMP_*, OACC_* and CILK_* trees.  Use error_at with
4234         EXPR_LOC_OR_LOC (t, input_location) computed early
4235         instead of error, or error_at with location_of (t).
4237 2017-02-22  Marek Polacek  <polacek@redhat.com>
4239         PR c++/79653
4240         * parser.c (cp_parser_std_attribute_spec): Don't build the attribute
4241         if the alignas expression is erroneous.
4242         * pt.c (tsubst_attribute): If tsubst_pack_expansion fails, return
4243         error_mark_node.
4245         PR c++/79657
4246         * semantics.c (finish_underlying_type): Bail out for incomplete enums.
4248 2017-02-21  Jason Merrill  <jason@redhat.com>
4250         PR c++/50308 - wrong deprecated warning with ADL
4251         PR c++/17729 - duplicate deprecated warning
4252         * semantics.c (finish_id_expression): Only call mark_used on a
4253         function if we aren't building a call.
4255         PR c++/41727 - ICE with partial spec of partial instantiation
4256         * pt.c (process_partial_specialization): For now, don't check more
4257         specialized if there is more than one level of args.
4259 2017-02-21  Marek Polacek  <polacek@redhat.com>
4261         PR c++/79535
4262         * cp-tree.h (maybe_reject_flexarray_init): Declare.
4263         * init.c (maybe_reject_flexarray_init): No longer static.
4264         Add check for current_function_decl.
4265         * parser.c (cp_parser_late_parse_one_default_arg): Reject
4266         a default mem-initializer for a flexible array.
4268 2017-02-21  Jakub Jelinek  <jakub@redhat.com>
4269             Paolo Carlini  <paolo.carlini@oracle.com>
4271         PR c++/79654
4272         * decl.c (cp_finish_decomp): Don't set decl's type to error_mark_node
4273         on error.
4274         * pt.c (tsubst_decomp_names): Return error_mark_node if the first
4275         decl after the decomposition artificial decl has error_mark_node.
4276         * decl2.c (prune_vars_needing_no_initialization): Use error_operand_p
4277         instead of just == error_mark_node comparison.
4279 2017-02-21  Jakub Jelinek  <jakub@redhat.com>
4281         PR sanitizer/79589
4282         * decl.c: Include gimplify.h.
4283         (cp_finish_decomp): Make sure there is no sharing of trees
4284         in between DECL_VALUE_EXPR of decomposition decls.
4286         PR c++/79655
4287         * constexpr.c (cxx_eval_array_reference): Diagnose negative subscript.
4289         PR c++/79639
4290         * constexpr.c (cxx_eval_store_expression): If *valp is a PTRMEM_CST,
4291         call cplus_expand_constant on it first.
4293 2017-02-19  Jason Merrill  <jason@redhat.com>
4295         PR c++/78139 - destructor needed by new-expression
4296         * call.c (build_special_member_call): Use tf_no_cleanup.
4298         PR c++/78282 - auto template and pack expansion
4299         * pt.c (find_parameter_packs_r): Don't walk into the type of
4300         templates other than template template-parameters.
4302         PR c++/79606 - ICE with this->base_member in NSDMI
4303         * class.c (build_base_path): Check processing_template_decl.
4305         PR c++/79607 - ICE with T{} initializer
4306         * decl.c (type_dependent_init_p): Check the type of a CONSTRUCTOR.
4308         PR c++/79566 - elaborated-type-specifier in range for
4309         * parser.c (cp_parser_simple_declaration): Fix check for type
4310         definition.
4312         PR c++/79400 - confusing suggestion of 'noexcept'
4313         * parser.c (cp_parser_exception_specification_opt): Remove
4314         suggestion for deprecated dynamic exception-specification.
4316         PR c++/79470 - partial ordering with reference parameters
4317         * pt.c (unify) [INDIRECT_REF]: Handle pack expansions.
4319         PR c++/79500 - ICE with non-template deduction guide
4320         * pt.c (do_class_deduction): Use STRIP_TEMPLATE rather than
4321         DECL_TEMPLATE_RESULT.
4323         PR c++/79580 - ICE with compound literal
4324         * parser.c (cp_parser_class_head): If we're in the middle of an
4325         expression, use ts_within_enclosing_non_class.
4327         PR c++/79503 - inherited ctor taking base class
4328         * call.c (add_function_candidate): Also check that
4329         DECL_INHERITED_CTOR_BASE is reference-related to the parameter type.
4331 2017-02-19  Paolo Carlini  <paolo.carlini@oracle.com>
4333         PR c++/79380
4334         * typeck.c (cxx_alignas_expr): Reject a non-integral alignas
4335         argument.
4337 2017-02-19  Eric Fiselier  <eric@efcs.ca>
4338             Jonathan Wakely  <jwakely@redhat.com>
4340         PR c++/69523
4341         * parser.c (cp_parser_unqualified_id): Use OPT_Wliteral_suffix to
4342         control warning about literal suffix identifiers without a leading
4343         underscore.
4345 2017-02-17  Jason Merrill  <jason@redhat.com>
4347         PR c++/79508 - lookup error with member template
4348         * parser.c (cp_parser_template_name): Clear
4349         parser->context->object_type if we aren't doing lookup.
4351         PR c++/78690 - ICE with using and global type with same name
4352         * pt.c (type_dependent_object_expression_p): True for
4353         IDENTIFIER_NODE.
4355         PR c++/79549 - C++17 ICE with non-type auto template parameter pack
4356         * pt.c (convert_template_argument): Just return an auto arg pack.
4357         (tsubst_template_args): Don't tsubst an auto pack type.
4359         PR c++/79556 - C++17 ICE with non-type auto
4360         * pt.c (do_auto_deduction): Don't try to deduce from null type.
4362         PR c++/79533 - C++17 ICE with temporary cast to reference
4363         * call.c (build_over_call): Conversion to a reference prevents copy
4364         elision.
4366 2017-02-16  Jakub Jelinek  <jakub@redhat.com>
4367             Jason Merrill  <jason@redhat.com>
4369         PR c++/79502 - lost nodiscard attribute
4370         * pt.c (apply_late_template_attributes): Do apply non-dependent
4371         attributes to types.
4373 2017-02-16  Jason Merrill  <jason@redhat.com>
4375         PR c++/78572 - ICE with self-modifying array initializer
4376         * constexpr.c (cxx_eval_store_expression): The object we're
4377         initializing is outside the constant-expression.
4378         (cxx_eval_call_expression): Set ctx->call.
4380         PR c++/79050 - ICE with undeduced auto and LTO
4381         * decl.c (poplevel): Remove undeduced auto decls.
4383 2017-02-16  Jakub Jelinek  <jakub@redhat.com>
4385         PR c++/79512
4386         * parser.c (cp_parser_omp_target): For -fopenmp-simd
4387         ignore #pragma omp target even when not followed by identifier.
4389 2017-02-15  Jason Merrill  <jason@redhat.com>
4390             Jakub Jelinek  <jakub@redhat.com>
4392         PR c++/79464 - ICE in IPA with omitted constructor parms
4393         * class.c (build_clone): Also omit parms from TYPE_ARG_TYPES.
4394         (adjust_clone_args): Adjust.
4395         (add_method): Remember omitted parms.
4396         * call.c (add_function_candidate): Likewise.
4397         * mangle.c (write_method_parms): Likewise.
4398         * method.c (ctor_omit_inherited_parms): Return false if there are no
4399         parms to omit.
4401 2017-02-15  Martin Sebor  <msebor@redhat.com>
4403         PR c++/79363
4404         * init.c (maybe_reject_flexarray_init): New function.
4405         (perform_member_init): Call it.
4407 2017-02-15  Jakub Jelinek  <jakub@redhat.com>
4409         PR c++/79301
4410         * parser.c (cp_parser_std_attribute): Don't pedwarn about
4411         [[deprecated]] with -std=c++11 and [[fallthrough]] with
4412         -std=c++11 and -std=c++14.
4414         PR c++/79288
4415         * decl.c (grokdeclarator): For static data members, handle thread_p
4416         only after handling inline.
4418 2017-02-14  Marek Polacek  <polacek@redhat.com>
4420         PR c++/79420
4421         PR c++/79463
4422         * parser.c (cp_parser_postfix_dot_deref_expression): Avoid
4423         clobbering if the postfix expression isn't an EXPR_P.
4425 2017-02-13  Jason Merrill  <jason@redhat.com>
4427         PR c++/79461 - ICE with lambda in constexpr constructor
4428         * constexpr.c (build_data_member_initialization): Ignore
4429         initialization of a local variable.
4431 2017-02-13  Jakub Jelinek  <jakub@redhat.com>
4433         * init.c (warn_placement_new_too_small): Add missing space in
4434         diagnostics.
4435         * parser.c (cp_parser_oacc_declare): Likewise.
4436         * mangle.c (maybe_check_abi_tags): Likewise.
4438         PR c++/79232
4439         * typeck.c (cp_build_modify_expr): Handle properly COMPOUND_EXPRs
4440         on lhs that have {PRE{DEC,INC}REMENT,MODIFY,MIN,MAX,COND}_EXPR
4441         in the rightmost operand.
4443 2017-02-13  Nathan Sidwell  <nathan@acm.org>
4445         PR c++/79296 - ICE mangling localized template instantiation
4446         * decl2.c (determine_visibility): Use template fn context for
4447         local class instantiations.
4449 2017-02-11  Jason Merrill  <jason@redhat.com>
4451         PR c++/77659 - ICE with new and C++14 aggregate NSDMI
4452         * init.c (build_new): Make backups of any CONSTRUCTORs in init.
4453         (build_new_1): Use replace_placeholders.
4454         * tree.c (replace_placeholders_t): Also track whether we've seen a
4455         placeholder.
4456         (replace_placeholders, replace_placeholders_r): Adjust.
4457         * cp-tree.h: Adjust.
4459         PR c++/77790 - ICE with auto function in C++11 mode
4460         * decl.c (undeduced_auto_decl): Remove C++14 limitation.
4461         (require_deduced_type): Add complain parm, return bool.
4462         * cp-tree.h: Adjust.
4463         * decl2.c (mark_used): Use require_deduced_type.
4465 2017-02-10  Jason Merrill  <jason@redhat.com>
4467         PR c++/78908 - template ops and bitfields
4468         * tree.c (build_min_non_dep): Use unlowered_expr_type.
4470         PR c++/78897 - constexpr union
4471         * constexpr.c (cxx_eval_store_expression): A store to a union member
4472         erases a previous store to another member.
4474         PR c++/71285 - member of fold-expression
4475         * semantics.c (finish_unary_fold_expr)
4476         (finish_binary_fold_expr): Use null type for fold-expressions.
4478         PR c++/79401 - protected inherited constructor
4479         * call.c (enforce_access): For inheriting constructor, find a base
4480         binfo in the path we already have.
4482 2017-02-10  Marek Polacek  <polacek@redhat.com>
4484         PR c++/79435
4485         * pt.c (type_dependent_expression_p): Check if the expression type
4486         is null.
4488         PR c++/79184
4489         * cvt.c (ocp_convert): Add a sentinel against -Wint-in-bool-context
4490         if warnings shouldn't be given.
4492 2017-02-10  Paolo Carlini  <paolo.carlini@oracle.com>
4494         PR c++/71737
4495         * pt.c (tsubst_decl): Don't try to preserve a typedef that names
4496         an error_mark_node as type.
4498 2017-02-09  Jakub Jelinek  <jakub@redhat.com>
4499             Jason Merrill  <jason@redhat.com>
4501         PR c++/79143
4502         * pt.c (instantiate_class_template_1): Copy CLASSTYPE_NON_AGGREGATE
4503         from pattern to type.
4505 2017-02-09  Jason Merrill  <jason@redhat.com>
4507         PR c++/79316 - default argument in deduction guide
4508         PR c++/79350 - explicit deduction guide
4509         * parser.c (cp_parser_constructor_declarator_p)
4510         (cp_parser_direct_declarator): Parse deduction guides more like
4511         constructors.
4512         * cp-tree.h (enum special_function_kind): Add sfk_deduction_guide.
4513         * tree.c (special_function_p): Return it.
4514         * decl.c (check_special_function_return_type): Handle it.
4515         (grokdeclarator, grokfndecl): Adjust.
4516         (cp_finish_decl): Pass flags to do_auto_deduction.
4517         * error.c (dump_decl_name): Use TFF_UNQUALIFIED_NAME.
4518         * pt.c (dguide_name_p): Take a const_tree.
4519         (do_class_deduction): Handle explicit.
4520         (do_auto_deduction): Pass flags through.
4521         (build_deduction_guide): Copy explicit flag.
4523 2017-02-09  Jakub Jelinek  <jakub@redhat.com>
4525         PR c++/79429
4526         * parser.c (cp_parser_omp_ordered): Don't check for non-pragma_stmt
4527         non-pragma_compound context here.
4528         (cp_parser_omp_target): Likewise.
4529         (cp_parser_pragma): Don't call push_omp_privatization_clauses and
4530         parsing for ordered and target omp pragmas in non-pragma_stmt
4531         non-pragma_compound contexts.
4533         PR c/79431
4534         * parser.c (cp_parser_oacc_declare): Formatting fix.
4535         (cp_parser_omp_declare_target): Don't invoke symtab_node::get on
4536         automatic variables.
4538 2016-02-09  Nathan Sidwell  <nathan@codesourcery.com>
4539             Chung-Lin Tang  <cltang@codesourcery.com>
4541         * parser.c (cp_parser_oacc_clause_tile): Disallow collapse.  Fix
4542         parsing.  Parse constant expression. Remove semantic checking.
4543         (cp_parser_omp_clause_collapse): Disallow tile.
4544         (cp_parser_omp_for_loop): Deal with tile clause.  Don't emit a parse
4545         error about missing for after already emitting one.  Use more
4546         conventional for idiom for unbounded loop.
4547         * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_TILE.
4548         * semantics.c (finish_omp_clauses): Correct TILE semantic check.
4549         (finish_omp_for): Deal with tile clause.
4551 2017-02-07  Nathan Sidwell  <nathan@acm.org>
4553         * method.c (synthesized_method_base_walk): New.  Broken out of ...
4554         (synthesized_method_walk): ... here.  Call it.  Cleanup
4555         initializations.
4557 2017-02-07  Patrick Palka  <ppalka@gcc.gnu.org>
4559         PR c++/79360
4560         * typeck2.c (process_init_constructor_union): Consider only
4561         FIELD_DECLs when looking for an NSDMI.
4563 2017-02-06  Jason Merrill  <jason@redhat.com>
4565         PR c++/71193 - incomplete types in templates
4566         * parser.c (cp_parser_postfix_dot_deref_expression): In a template
4567         handle incomplete type by pedwarning and then treating as dependent.
4569 2017-02-06  Jakub Jelinek  <jakub@redhat.com>
4571         PR c++/79379
4572         * constexpr.c (cxx_eval_constant_expression): Handle ANNOTATE_EXPR.
4573         (potential_constant_expression_1): Likewise.
4575         PR c++/79377
4576         * tree.c (build_min_non_dep_op_overload): For POST{INC,DEC}REMENT_EXPR
4577         allow one fewer than expected arguments if flag_permissive.
4579         PR c++/79372
4580         * decl.c (cp_finish_decomp): On error set decl type to error_mark_node.
4581         * pt.c (tsubst_expr): Don't call tsubst_decomp_names on decompositions
4582         with error_mark_node type.
4584 2017-02-03  Jason Merrill  <jason@redhat.com>
4586         PR c++/78689 - ICE on constructor with label
4587         * optimize.c (maybe_clone_body): Replace omitted parameters with
4588         null lvalues.
4589         * class.c (build_clone): Fix logic for omitting inherited parms.
4591         PR c++/12245 - excessive memory use
4592         * constexpr.c (maybe_constant_value): Fold maybe_constant_value_1
4593         back in.  Don't cache constants.
4594         (maybe_constant_init): Don't cache constants.
4596         PR c++/79294 - ICE with invalid template argument
4597         * pt.c (convert_nontype_argument_function): Check value-dependence.
4598         (convert_nontype_argument): Don't check it here for function ptrs.
4600 2017-02-02  Richard Biener  <rguenther@suse.de>
4602         PR cp/14179
4603         * cp-gimplify.c (cp_fold): When folding a CONSTRUCTOR copy
4604         it lazily on the first changed element only and copy it
4605         fully upfront, only storing changed elements.
4607 2017-02-02  Paolo Carlini  <paolo.carlini@oracle.com>
4609         PR c++/69637
4610         * decl2.c (grokbitfield): In case of error don't set-up DECL_INITIAL
4611         to the width.
4613 2017-01-31  Jakub Jelinek  <jakub@redhat.com>
4615         PR c++/79304
4616         * error.c (dump_expr) <case COMPONENT_REF>: Don't print .
4617         after ARROW_EXPR.
4619 2017-01-31  David Malcolm  <dmalcolm@redhat.com>
4621         PR c++/79298
4622         * name-lookup.c (suggest_alternative_in_explicit_scope): Resolve
4623         any namespace aliases.
4625 2017-01-31  Nathan Sidwell  <nathan@acm.org>
4627         PR c++/79290
4628         * typeck.c (build_ptrmemfunc_access_expr): Set TREE_NO_WARNING.
4630         PR c++/67273
4631         PR c++/79253
4632         * pt.c: (instantiate_decl): Push to top level when current
4633         function scope doesn't match.  Only push lmabda scope stack when
4634         pushing to top.
4636         * cp-tree.h (instantiate_decl): Make defer_ok bool.
4637         * pt.c: Fix instantiate_decl calls to pass true/false not 0/1
4638         (instantiate_decl): Simplify and reorder state saving and restoration.
4640         PR c++/79264
4641         * lambda.c (maybe_generic_this_capture): Deal with template-id-exprs.
4642         * semantics.c (finish_member_declaration): Assert class is being
4643         defined.
4645 2017-01-30  Alexandre Oliva <aoliva@redhat.com>
4647         Introduce C++ support in libcc1.
4648         * cp-tree.h (struct lang_identifier): Add oracle_looked_up.
4649         (ansi_opname): Rename to...
4650         (cp_operator_id): ... this.  Adjust all callers.
4651         (ansi_assopname): Rename to...
4652         (cp_assignment_operator_id): ... this.  Adjust all callers.
4653         (cp_literal_operator_id): Declare.
4654         (set_global_friend): Declare.
4655         (is_global_friend): Declare.
4656         (enum cp_oracle_request): New type.
4657         (cp_binding_oracle_function): New type.
4658         (cp_binding_oracle): Declare.
4659         (cp_finish_injected_record_type): Declare.
4660         * friend.c (global_friend): New var.
4661         (set_global_friend): New fn.
4662         (is_global_friend): New fn.
4663         (is_friend): Call is_global_friend.
4664         * name-lookup.c (cp_binding_oracle): New var.
4665         (query_oracle): New fn.
4666         (qualified_lookup_using_namespace): Call query_oracle.
4667         (lookup_name_real_1): Likewise.
4668         * parser.c (cp_literal_operator_id): Drop static.
4669         * search.c (friend_accessible_p): Call is_global_friend.
4670         * semantics.c (is_this_parameter): Accept a variable if the
4671         binding oracle is enabled.
4673 2017-01-27  Jason Merrill  <jason@redhat.com>
4675         PR c++/78771 - ICE with inherited constructor.
4676         * call.c (build_over_call): Call deduce_inheriting_ctor here.
4677         * pt.c (tsubst_decl): Not here.
4678         * class.c (add_method): Or here.
4679         * method.c (deduce_inheriting_ctor): Handle clones.
4680         (implicitly_declare_fn): Don't deduce inheriting ctors yet.
4682 2017-01-27  Adam Butcher  <adam@jessamine.co.uk>
4684         PR c++/64382
4685         * cp/parser.c (parsing_default_capturing_generic_lambda_in_template):
4686         New function.
4687         * cp/cp-tree.h: Declare it.
4688         * cp/semantics.c (finish_id_expression): Resolve names within a default
4689         capturing generic lambda defined within a template prior to
4690         instantiation to allow for captures to be added to the closure type.
4692 2017-01-26  Jakub Jelinek  <jakub@redhat.com>
4694         PR c++/68727
4695         * cp-tree.def (OFFSETOF_EXPR): Bump number of operands to 2.
4696         * cp-tree.h (finish_offsetof): Add OBJECT_PTR argument.
4697         * parser.c (cp_parser_builtin_offsetof): Pass result of
4698         build_static_cast of null_pointer_node to finish_offsetof.
4699         * semantics.c (finish_offsetof): Add OBJECT_PTR argument, use
4700         it for -Winvalid-offsetof pedwarn instead of trying to guess
4701         original offsetof type from EXPR.  Save OBJECT_PTR as a new
4702         second operand to OFFSETOF_EXPR.
4703         * pt.c (tsubst_copy_and_build) <case OFFSETOF_EXPR>: Adjust
4704         finish_offsetof caller, pass the second operand of OFFSETOF_EXPR
4705         as OBJECT_PTR.
4707 2017-01-26  Jason Merrill  <jason@redhat.com>
4709         * name-lookup.c (parse_using_directive): Deprecate strong using.
4711         PR c++/79176 - lambda ICE with -flto -Os
4712         * decl2.c (vague_linkage_p): Handle decloned 'tors.
4713         * tree.c (decl_linkage): Likewise.
4715 2017-01-25  Martin Sebor  <msebor@redhat.com>
4717         * decl.c (grokdeclarator): Fix a typo in a comment.
4719 2017-01-25  Jakub Jelinek  <jakub@redhat.com>
4721         PR c++/78896
4722         * decl.c (cp_finish_decomp): Disallow memberwise decomposition of
4723         lambda expressions.
4725         PR c++/77914
4726         * parser.c (cp_parser_lambda_declarator_opt): Pedwarn with
4727         OPT_Wpedantic on lambda templates for -std=c++14 and higher.
4729 2017-01-25  Maxim Ostapenko  <m.ostapenko@samsung.com>
4731         PR lto/79061
4732         * decl.c (cxx_init_decl_processing): Pass main_input_filename
4733         to build_translation_unit_decl.
4735 2017-01-24  Jakub Jelinek  <jakub@redhat.com>
4737         PR c++/79205
4738         * cp-gimplify.c (cp_genericize_r): Add result of
4739         convert_from_reference on invisiref parm to p_set.
4741 2017-01-24  Nathan Sidwell  <nathan@acm.org>
4743         PR c++/78469 - defaulted ctor and inaccessible dtor
4744         * cp-tree.h (tsubst_flags): Add tf_no_cleanup.
4745         * init.c (build_new_1): Pass tf_no_cleanup to build_value_init.
4746         * tree.c (build_target_expr): Check tf_no_cleanup.
4748         PR c++/79118 - anon-members and constexpr
4749         * constexpr.c (cx_check_missing_mem_inits): Caller passes type not
4750         ctor decl.  Recursively check anonymous members.
4751         (register_constexpr_fundef): Adjust cx_check_missing_mem_inits
4752         call.
4753         (explain_invalid_constexpr_fn): Likewise.
4755 2017-01-23  Nathan Sidwell  <nathan@acm.org>
4757         PR c++/71710 - template using directive of field
4758         * pt.c (tsubst_copy_and_build [COMPONENT_REF]): Move FIELD_DECL
4759         check earlier.
4761         PR c++/71406 - ICE with scope-ref'd template id exprs
4762         PR c++/77508
4763         * typeck.c (finish_class_member_access_expr): Break up SCOPE_REF
4764         before breaking up TEMPLATE_ID_EXPR.
4766 2017-01-20  Nathan Sidwell  <nathan@acm.org>
4768         PR c++/78495 - wrong code inherited ctor and invisi-ref parm
4769         * cp-gimplify.c (cp_generize_r): Don't skip thunks.
4771 2017-01-20  David Malcolm  <dmalcolm@redhat.com>
4773         PR c++/77829
4774         PR c++/78656
4775         * cp-tree.h (suggest_alternatives_for): Add bool param.
4776         (suggest_alternative_in_explicit_scope): New decl.
4777         * error.c (qualified_name_lookup_error): When SCOPE is a namespace
4778         that isn't the global one, call new function
4779         suggest_alternative_in_explicit_scope, only calling
4780         suggest_alternatives_for if it fails, and disabling near match
4781         searches fort that case.  When SCOPE is the global namespace,
4782         pass true for new param to suggest_alternatives_for to allow for
4783         fuzzy name lookups.
4784         * lex.c (unqualified_name_lookup_error): Pass true for new param
4785         to suggest_alternatives_for.
4786         * name-lookup.c (consider_binding_level): Add forward decl.
4787         (suggest_alternatives_for): Add "suggest_misspellings" param,
4788         using it to conditionalize the fuzzy name-lookup code.
4789         (suggest_alternative_in_explicit_scope): New function.
4790         * parser.c (cp_parser_primary_expression): When calling
4791         finish_id_expression, pass location of id_expression rather
4792         than that of id_expr_token.
4793         (cp_parser_id_expression): Convert local "unqualified_id" from
4794         tree to cp_expr to avoid implicitly dropping location information.
4796 2017-01-20  Marek Polacek  <polacek@redhat.com>
4798         PR c/64279
4799         * call.c (build_conditional_expr_1): Warn about duplicated branches.
4800         * semantics.c (finish_expr_stmt): Build statement using the proper
4801         location.
4803 2017-01-19  Jason Merrill  <jason@redhat.com>
4805         US 20 - forwarding references and class template argument deduction
4806         * cp-tree.h (TEMPLATE_TYPE_PARM_FOR_CLASS): New.
4807         * pt.c (push_template_decl_real): Set it.
4808         (maybe_adjust_types_for_deduction): Check it.
4809         (rewrite_template_parm): Copy it.
4811         US 19 - deduction guides and constructors
4812         * call.c (joust): Prefer deduction guides to constructors.
4813         * pt.c (build_deduction_guide): Set DECL_ARTIFICIAL.
4814         (deduction_guide_p): Check DECL_P.
4816         * decl.c (check_initializer): Always use build_aggr_init for array
4817         decomposition.
4819         PR c++/79130 - decomposition and direct-initialization
4820         * init.c (build_aggr_init): Communicate direct-initialization to
4821         build_vec_init.
4822         (build_vec_init): Check for array copy sooner.
4823         * parser.c (cp_parser_decomposition_declaration): Remove call to
4824         build_x_compound_expr_from_list.
4826 2017-01-18  Jason Merrill  <jason@redhat.com>
4828         PR c++/68666 - member variable template-id
4829         * typeck.c (finish_class_member_access_expr): Handle variable
4830         template-id.
4831         * pt.c (lookup_and_finish_template_variable): No longer static.
4832         * cp-tree.h: Declare it.
4834 2017-01-18  Nathan Sidwell  <nathan@acm.org>
4836         PR c++/78488
4837         * call.c (build_over_call): When checking ellipsis conversions for
4838         an inherited ctor, make sure there is at least one conversion.
4840 2017-01-18  Jason Merrill  <jason@redhat.com>
4842         PR c++/78894 - ICE with class deduction and default arg
4843         * pt.c (build_deduction_guide): Set DECL_PRIMARY_TEMPLATE.
4845 2017-01-18  Markus Trippelsdorf  <markus@trippelsdorf.de>
4847         PR c++/77489
4848         * mangle.c (write_discriminator): Reorganize abi warning check.
4850 2017-01-18  Nathan Sidwell  <nathan@acm.org>
4852         * cp-tree.h: Clarify exception spec node comment.
4853         * except.c (nothrow_spec_p): Simplify by checking node-equality.
4855         PR c++/79091
4856         * mangle.c (write_exception_spec): Check nothrow explicitly.
4857         (write_encoding): Don't increment processing_template_decl around
4858         encoding.
4860 2017-01-18  Markus Trippelsdorf  <markus@trippelsdorf.de>
4862         PR c++/70182
4863         * mangle.c (write_template_args): Add "on" for operator names.
4865 2017-01-18  Markus Trippelsdorf  <markus@trippelsdorf.de>
4867         PR c++/77489
4868         * mangle.c (write_discriminator): Handle discriminator >= 10.
4870 2017-01-17  Nathan Sidwell  <nathan@acm.org>
4872         PR c++/61636
4873         * cp-tree.h (maybe_generic_this_capture): Declare.
4874         * lambda.c (resolvable_dummy_lambda): New, broken out of ...
4875         (maybe_resolve_dummy): ... here.  Call it.
4876         (maybe_generic_this_capture): New.
4877         * parser.c (cp_parser_postfix_expression): Speculatively capture
4878         this in generic lambda in unresolved member function call.
4879         * pt.c (tsubst_copy_and_build): Force hard error from failed
4880         member function lookup in generic lambda.
4882 2017-01-17  Aldy Hernandez  <aldyh@redhat.com>
4884         PR c++/70565
4885         * cp-array-notation.c (expand_array_notation_exprs): Handle
4886         OMP_PARALLEL.
4888 2017-01-11  Jason Merrill  <jason@redhat.com>
4890         PR c++/78337 - ICE on invalid with generic lambda
4891         * semantics.c (process_outer_var_ref): Check if containing_function
4892         is null.  Move inform call under complain test.
4894 2017-01-11  Nathan Sidwell  <nathan@acm.org>
4896         PR c++/77812
4897         * name-lookup.c (set_namespace_binding_1): An overload of 1 decl
4898         is a new overload.
4900 2017-01-11  Nathan Sidwell  <nathan@acm.org>
4902         * name-lookup.c (push_overloaded_decl_1): Refactor OVERLOAD creation.
4904 2017-01-11  Jakub Jelinek  <jakub@redhat.com>
4906         PR c++/78341
4907         * parser.c (cp_parser_std_attribute_spec): Remove over-eager
4908         assertion.  Formatting fix.
4910         PR c++/72813
4911         * decl2.c (c_parse_final_cleanups): Set flag_syntax_only to 1 after
4912         writing PCH file.
4914 2017-01-10  David Malcolm  <dmalcolm@redhat.com>
4916         PR c++/77949
4917         * parser.c (cp_parser_class_specifier_1): Only suggest inserting
4918         a missing semicolon if we have a valid insertion location for
4919         the fix-it hint.
4921 2017-01-10  Jason Merrill  <jason@redhat.com>
4923         FI 20, decomposition declaration with parenthesized initializer.
4924         * parser.c (cp_parser_decomposition_declaration): Use
4925         cp_parser_initializer.
4927 2017-01-09  Jason Merrill  <jason@redhat.com>
4929         Implement P0195R2, C++17 variadic using.
4930         * parser.c (cp_parser_using_declaration): Handle ellipsis and comma.
4931         * pt.c (tsubst_decl): Handle pack expansion in USING_DECL_SCOPE.
4932         * error.c (dump_decl): Likewise.
4934 2017-01-09  Jakub Jelinek  <jakub@redhat.com>
4936         PR translation/79019
4937         PR translation/79020
4938         * semantics.c (finish_omp_clauses): Add missing whitespace to
4939         translatable strings.
4940         * cp-cilkplus.c (cpp_validate_cilk_plus_loop_aux): Fix comment typo.
4942 2017-01-07  Jason Merrill  <jason@redhat.com>
4944         PR c++/78948 - instantiation from discarded statement
4945         * parser.h (struct cp_parser): Remove in_discarded_stmt field.
4946         * cp-tree.h (in_discarded_stmt): Declare it.
4947         (struct saved_scope): Add discarded_stmt bitfield.
4948         (in_discarded_stmt): New macro.
4949         * decl2.c (mark_used): Check it.
4950         * parser.c (cp_parser_selection_statement): Adjust.
4951         (cp_parser_jump_statement): Adjust.
4953 2017-01-05  Jakub Jelinek  <jakub@redhat.com>
4955         PR c++/78931
4956         * decl.c (cp_finish_decomp): Remove probe variable, if tt is
4957         REFERENCE_REF_P, set tt to its operand.
4959         PR c++/78890
4960         * class.c (check_field_decls): Diagnose REFERENCE_TYPE fields in
4961         unions even for C++11 and later.
4963 2017-01-05  Nathan Sidwell  <nathan@acm.org>
4965         PR c++/78765
4966         * pt.c (convert_nontype_argument): Don't try and see if integral
4967         or enum expressions are constants prematurely.
4969 2017-01-04  Marek Polacek  <polacek@redhat.com>
4971         PR c++/64767
4972         * typeck.c (cp_build_binary_op): Warn when a pointer is compared with
4973         a zero character literal.
4975 2017-01-04  Jakub Jelinek  <jakub@redhat.com>
4977         PR c++/78949
4978         * typeck.c (cp_build_unary_op): Call mark_rvalue_use on arg if it has
4979         vector type.
4981         PR c++/78693
4982         * parser.c (cp_parser_simple_declaration): Only complain about
4983         inconsistent auto deduction if auto_result doesn't use auto.
4985         * parser.c (cp_parser_simple_declaration): Diagnose function
4986         declaration among more than one init-declarators with auto
4987         specifier.
4989         PR c++/71182
4990         * parser.c (cp_lexer_previous_token): Use vec_safe_address in the
4991         assertion, as lexer->buffer may be NULL.
4993 2017-01-04  Marek Polacek  <polacek@redhat.com>
4995         PR c++/77545
4996         PR c++/77284
4997         * constexpr.c (potential_constant_expression_1): Handle CLEANUP_STMT.
4999 2017-01-04  Nathan Sidwell  <nathan@acm.org>
5001         PR c++/66735
5002         * cp-tree.h (DECLTYPE_FOR_REF_CAPTURE): New.
5003         (lambda_capture_field_type): Update prototype.
5004         * lambda.c (lambda_capture_field_type): Add is_reference parm.
5005         Add referenceness here.
5006         (add_capture): Adjust lambda_capture_field_type call, refactor
5007         error checking.
5008         * pt.c (tsubst): Adjust lambda_capture_field_type call.
5010 2017-01-01  Jakub Jelinek  <jakub@redhat.com>
5012         Update copyright years.
5014 Copyright (C) 2017 Free Software Foundation, Inc.
5016 Copying and distribution of this file, with or without modification,
5017 are permitted in any medium without royalty provided the copyright
5018 notice and this notice are preserved.