1 2017-11-07 Boris Kolpackov <boris@codesynthesis.com>
3 * Make-lang.in (CP_PLUGIN_HEADERS): Add operators.def since included
6 2017-11-07 Jakub Jelinek <jakub@redhat.com>
9 * cp-gimplify.c (cxx_omp_clause_apply_fn): For methods pass i - 1 to
10 convert_default_arg instead of i.
12 2017-11-06 Jason Merrill <jason@redhat.com>
14 P0704R1 - fixing const-qualified pointers to members
15 * typeck2.c (build_m_component_ref): Also accept in lower stds with
18 2017-11-06 Paolo Carlini <paolo.carlini@oracle.com>
21 * decl2.c (finish_static_data_member_decl): If there's an initializer,
22 complete the type and re-apply the quals.
24 2017-11-06 Martin Liska <mliska@suse.cz>
27 * constexpr.c (cxx_eval_builtin_function_call): Handle
28 __builtin_unreachable call.
29 (get_function_named_in_call): Declare function earlier.
30 (constexpr_fn_retval): Skip __builtin_unreachable.
31 * cp-gimplify.c (cp_ubsan_maybe_instrument_return): Rename to
33 (cp_maybe_instrument_return): ... this.
34 (cp_genericize): Call the function unconditionally.
36 2017-11-03 Nathan Sidwell <nathan@acm.org>
39 * decl.c (grokdeclarator): Protect MAYBE_CLASS things from paren
42 2017-11-02 Paolo Carlini <paolo.carlini@oracle.com>
45 * pt.c (make_pack_expansion): Add tsubst_flags_t parameter.
46 (expand_integer_pack, convert_template_argument, coerce_template_parms,
47 gen_elem_of_pack_expansion_instantiation, tsubst_pack_expansion,
49 * tree.c (cp_build_qualified_type_real): Likewise.
50 * cp-tree.h (make_pack_expansion): Adjust declaration.
52 2017-11-02 Nathan Sidwell <nathan@acm.org>
54 * cp-tree.h (IDENTIFIER_NEWDEL_OP_P): Restore, adjust.
55 (IDENTIFIER_NEW_OP_P): New.
56 * decl.c (grokdeclarator): Restore IDENTIFIER_NEWDEL_OP_P use.
57 * pt.c (push_template_decl_real): Likewise.
58 * typeck.c (check_return_expr): Use IDENTIFIER_NEW_OP_P.
61 * decl.c (grokdeclarator): Don't warn when parens protect a return
62 type from a qualified name.
64 2017-11-01 Nathan Sidwell <nathan@acm.org>
66 * cp-tree.h (enum cp_identifier_kind): Delete cik_newdel_op.
67 Renumber and reserve udlit value.
68 (IDENTIFIER_NEWDEL_OP_P): Delete.
69 (IDENTIFIER_OVL_OP_P): New.
70 (IDENTIFIER_ASSIGN_OP_P): Adjust.
71 (IDENTIFIER_CONV_OP_P): Adjust.
72 (IDENTIFIER_OVL_OP_INFO): Adjust.
73 (IDENTIFIER_OVL_OP_FLAGS): New.
74 * decl.c (grokdeclarator): Use IDENTIFIER_OVL_OP_FLAGS.
75 * lex.c (get_identifier_kind_name): Adjust.
76 (init_operators): Don't special case new/delete ops.
77 * mangle.c (write_unqualified_id): Use IDENTIFIER_OVL_OP_P.
78 * pt.c (push_template_decl_real): Use IDENTIFIER_OVL_OP_FLAGS.
79 * typeck.c (check_return_expr): Likewise.
81 * cp-tree.h (assign_op_identifier, call_op_identifier): Use
83 (struct lang_decl_fn): Use compressed operator code.
84 (DECL_OVERLOADED_OPERATOR_CODE): Replace with ...
85 (DECL_OVERLOADED_OPERATOR_CODE_RAW): ... this.
86 (DECL_OVERLOADED_OPERATOR_CODE_IS): Use it.
87 * decl.c (duplicate_decls): Use DECL_OVERLOADED_OPERATOR_CODE_RAW.
88 (build_library_fn): Likewise.
89 (grok_op_properties): Likewise.
90 * mangle.c (write_unqualified_name): Likewise.
91 * method.c (implicitly_declare_fn): Likewise.
92 * typeck.c (check_return_expr): Use DECL_OVERLOADED_OPERATOR_IS.
94 * cp-tree.h (IDENTIFIER_CP_INDEX): Define.
95 (enum ovl_op_flags): Add OVL_OP_FLAG_AMBIARY.
96 (enum ovl_op_code): New.
97 (struct ovl_op_info): Add ovl_op_code field.
98 (ovl_op_info): Size by OVL_OP_MAX.
99 (ovl_op_mapping, ovl_op_alternate): Declare.
100 (OVL_OP_INFO): Adjust for mapping array.
101 (IDENTIFIER_OVL_OP_INFO): New.
102 * decl.c (ambi_op_p, unary_op_p): Delete.
103 (grok_op_properties): Use IDENTIFIER_OVL_OP_INFO and
105 * lex.c (ovl_op_info): Adjust and static initialize.
106 (ovl_op_mappings, ovl_op_alternate): Define.
107 (init_operators): Iterate over ovl_op_info array and init mappings
109 * mangle.c (write_unqualified_id): Use IDENTIFIER_OVL_OP_INFO.
110 * operators.def (DEF_OPERATOR): Remove KIND parm.
111 (DEF_SIMPLE_OPERATOR): Delete.
112 (OPERATOR_TRANSITION): Expand if defined.
114 2017-10-31 David Malcolm <dmalcolm@redhat.com>
116 * pt.c (listify): Use %< and %> for description of #include.
118 2017-10-31 David Malcolm <dmalcolm@redhat.com>
120 * class.c (explain_non_literal_class): Use UNKNOWN_LOCATION rather
122 * name-lookup.c (suggest_alternatives_for): Update for renaming of
124 (maybe_suggest_missing_header): Likewise.
125 (suggest_alternative_in_explicit_scope): Likewise.
126 * parser.c (cp_parser_diagnose_invalid_type_name): Likewise for
127 renaming of error_at_rich_loc.
128 (cp_parser_string_literal): Likewise.
129 (cp_parser_nested_name_specifier_opt): Likewise.
130 (cp_parser_cast_expression): Likewise for renaming of
132 (cp_parser_decl_specifier_seq): Likewise for renaming of
133 error_at_rich_loc and warning_at_rich_loc.
134 (cp_parser_elaborated_type_specifier): Likewise for renaming of
136 (cp_parser_cv_qualifier_seq_opt): Likewise for renaming of
138 (cp_parser_virt_specifier_seq_opt): Likewise.
139 (cp_parser_class_specifier_1): Likewise.
140 (cp_parser_class_head): Likewise.
141 (cp_parser_member_declaration): Likewise for renaming of
142 pedwarn_at_rich_loc, warning_at_rich_loc, and error_at_rich_loc.
143 (cp_parser_enclosed_template_argument_list): Likewise for renaming
144 of error_at_rich_loc.
145 (set_and_check_decl_spec_loc): Likewise.
146 * pt.c (listify): Likewise.
147 * rtti.c (typeid_ok_p): Likewise.
148 * semantics.c (process_outer_var_ref): Use UNKNOWN_LOCATION rather
150 * typeck.c (access_failure_info::maybe_suggest_accessor): Update
151 for renaming of inform_at_rich_loc.
152 (finish_class_member_access_expr): Likewise for renaming of
155 2017-10-31 Nathan Sidwell <nathan@acm.org>
157 * cp-tree.h (struct operator_name_info_t): Rename to ...
158 (struct ovl_op_info_t): ... here. Add tree_code field.
159 (operator_name_info, assignment_operator_name_info): Delete.
160 (ovl_op_info): Declare.
161 (OVL_OP_INFO): Adjust.
162 * decl.c (grok_op_properties): Use ovl_op_flags.
163 * lex.c (operator_name_info, assignment_operator_name_info):
165 (ovl_op_info): Define.
166 (set_operator_ident): Adjust.
167 (init_operators): Set tree_code.
168 * mangle.c (write_unqualified_id): Adjust operator array scan.
170 * lex.c (init_operators): Allow NULL operator name. Don't add
172 * operators.def: Use NULL for mangling only operators. Move to
173 after regular operators but move assignment operators last.
175 * cp-tree.h (enum ovl_op_flags): New.
176 (struct operator_name_info_t): Rename arity to flags.
177 * lex.c (set_operator_ident): New.
178 (init_operators): Use it. Adjust for flags.
179 * mangle.c (write_unqualified_id): Adjust for flags.
180 * operators.def: Replace arity with flags.
182 * cp-tree.h (ovl_op_identifier): New.
183 (assign_op_identifier, call_op_identifier): Adjust.
184 (cp_operator_id, cp_assignment_operator_ide): Delete.
185 (SET_OVERLOADED_OPERATOR_CODE): Delete.
187 * call.c (op_error): Use OVL_OP_INFO.
188 (build_conditional_expr_1): Use ovl_op_identifier.
189 (build_new_op_1): Use OVL_OP_INFO & ovl_op_identifier.
190 (build_op_delete_call): Likewise.
191 * class.c (type_requires_array_cookie): Use ovl_op_identifier.
192 * decl.c (duplicate_decls): Directly copy operator code.
193 (builtin_function_1): Do not set operator code.
194 (build_library_fn): Directly set operator code.
195 (push_cp_library_fn): Use ovl_op_identifier.
196 (grok_op_properties): Directly set operator code.
197 * decl2.c (maybe_warn_sized_delete): Use ovl_op_identifier.
198 * error.c (dump_expr): Use OVL_OP_INFO.
199 (op_to_string): Add assop arg. Use OVL_OP_INFO.
200 (assop_to_string): Delete.
201 (args_to_string): Adjust.
202 * init.c (build_new_1): Use ovl_op_identifier.
203 * mangle.c (write_unqualified_name): Use OVL_OP_INFO.
204 (write_expression): Likewise.
205 * method.c (synthesized_method_walk): Use ovl_op_identifier.
206 (implicitly_declare_fn): Use assign_op_identifier. Directly set
208 * name-lookup.c (get_class_binding): Use assign_op_identifier.
209 * parser.c (cp_parser_operator): Use ovl_op_identifier.
210 (cp_parser_omp_clause_reduction): Likewise.
211 * semantics.c (omp_reduction_id): Likewise.
212 * typeck.c (cxx_sizeof_or_alignof_type): Use OVL_OP_INFO.
214 * cp-tree.h (assign_op_identifier, call_op_identifier): Define.
215 (LAMBDA_FUNCTION_P): Use DECL_OVERLOADED_OPERATOR_IS.
216 (DECL_OVERLOADED_OPERATOR_P): Just retuurn true/false.
217 (DECL_OVERLOADED_OPERATOR_CODE, DECL_OVERLOADED_OPERATOR_IS): Define.
218 * call.c (add_function_candidate): Use
219 DECL_OVERLOADED_OPERATOR_IS.
220 (build_op_call_1): Use call_op_identifier &
221 DECL_OVERLOADED_OPERATOR_IS.
222 (build_over_call): Likewise.
223 (has_trivial_copy_assign_p): Use assign_op_identifier.
224 (build_special_member_call): Likewise.
225 * class.c (dfs_declare_virt_assop_and_dtor): Likewise.
226 (vbase_has_user_provided_move_assign,
227 classtype_has_move_assign_or_move_ctor_p): Likewise.
228 * decl.c (duplicate_decls): Use DECL_OVERLOADED_OPERATOR_CODE.
229 (grok_special_member_properties): Use assign_op_identifier.
230 (start_preparsed_function): Use DECL_OVERLOADED_OPERATOR_IS.
231 * decl2.c (mark_used): Use DECL_CONV_FN_P.
232 * dump.c (dump_access): Delete prototype.
234 (cp_dump_tree): Don't call it.
235 * lambda.c (lambda_function): Use call_op_identifier.
236 (maybe_add_lambda_conv_op): Not an overloaded operator. Remove
238 * mangle.c (write_unqualified_name): Use DECL_OVERLOADED_OPERTOR_CODE.
239 * method.c (do_build_copy_assign): Use assign_op_identifier.
240 (synthesize_method): Use DECL_OVERLOADED_OPERATOR_IS.
241 (get_copy_assign): Use assign_op_identifier.
242 (synthesized_method_walk): Likewise.
243 (defaultable_fn_check): Use DECL_OVERLOADED_OPERATOR_IS.
244 * parser.c (cp_parser_lambda_declarator_opt): Use
246 * semanitics.c (classtype_has_nothrow_assign_or_copy_p): Use
247 assign_op_identifier.
248 * tree.c (special_function_p): Use DECL_OVERLOADED_OPERATOR_IS.
249 * typeck.c (check_return_expr): Use DECL_OVERLOADED_OPERATOR_CODE.
250 (check_return_expr): Use assign_op_identifier.
252 2017-10-30 Paolo Carlini <paolo.carlini@oracle.com>
255 * pt.c (tsubst_copy_and_build, [INDIRECT_REF]): For a REFERENCE_REF_P,
256 unconditionally call convert_from_reference.
258 2017-10-30 Nathan Sidwell <nathan@acm.org>
260 * call.c (build_op_call_1): Test for FUNCTION_DECL in same manner
261 as a few lines earlier.
262 * cp-tree.h (PACK_EXPANSION_PATTERN): Fix white space.
263 * decl.c (grokfndecl): Fix indentation.
264 (compute_array_index_type): Use processing_template_decl_sentinel.
265 (grok_op_properties): Move warnings to end. Reorder other checks
266 to group similar entities. Tweak diagnostics.
267 * lex.c (unqualified_name_lookup_error): No need to check name is
268 not ERROR_MARK operator.
269 * parser.c (cp_parser_operator): Select operator code before
271 * typeck.c (check_return_expr): Fix indentation and line wrapping.
273 2017-10-27 Paolo Carlini <paolo.carlini@oracle.com>
275 * pt.c (invalid_nontype_parm_type_p): Return a bool instead of an int.
277 2017-10-26 Nathan Sidwell <nathan@acm.org>
279 * decl.c (sort_labels): Restore function.
280 (pop_labels): Sort labels
281 (identify_goto): Add translation markup.
283 2017-10-25 Nathan Sidwell <nathan@acm.org>
285 Kill IDENTIFIER_LABEL_VALUE.
286 * cp-tree.h (lang_identifier): Delete label_value slot.
287 (IDENTIFIER_LABEL_VALUE, SET_IDENTIFIER_LABEL_VALUE): Delete.
288 (struct named_label_hasher): Rename to ...
289 (struct named_label_hash): ... here. Reimplement.
290 (struct language_function): Adjust x_named_labels.
291 * name-lookup.h (struct cp_label_binding): Delete.
292 (struct cp_binding_level): Delete shadowed_labels slot.
293 * decl.c (struct named_label_entry): Add name and outer slots.
294 (pop_label): Rename to ...
295 (check_label_used): ... here. Don't pop.
296 (note_label, sort_labels): Delete.
297 (pop_labels, pop_local_label): Reimplement.
298 (poplevel): Pop local labels as any other decl. Remove
299 shadowed_labels handling.
300 (named_label_hash::hash, named_label_hash::equal): New.
301 (make_label_decl): Absorb into ...
302 (lookup_label_1): ... here. Add making_local_p arg, reimplement.
303 (lookup_label, declare_local_label): Adjust.
304 (check_goto, define_label): Adjust.
305 * lex.c (make_conv_op_name): Don't clear IDENTIFIER_LABEL_VALUE.
306 * ptree.c (cxx_print_identifier): Don't print identifier binding.
308 * decl.c (identifier_goto): Reduce duplication.
309 (check_previous_goto_1): Likewise.
310 (check_goto): Move var decls to initialization.
311 (check_omp_return, define_label_1, define_label): Likewise.
313 2017-10-25 Jakub Jelinek <jakub@redhat.com>
316 * decl.c (duplicate_decls): Copy "omp declare simd" attributes from
317 newdecl to corresponding __builtin_ if any.
319 2017-10-24 Paolo Carlini <paolo.carlini@oracle.com>
322 * decl.c (duplicate_decls): Warn for built-in functions declared as
323 non-function, use OPT_Wbuiltin_declaration_mismatch.
325 * decl.c (duplicate_decls): Avoid redundant '+' in warning_at.
327 2017-10-24 Paolo Carlini <paolo.carlini@oracle.com>
330 * pt.c (value_dependent_expression_p, [TRAIT_EXPR]): Handle
331 a TREE_LIST as TRAIT_EXPR_TYPE2.
333 2017-10-24 Mukesh Kapoor <mukesh.kapoor@oracle.com>
334 Paolo Carlini <paolo.carlini@oracle.com>
337 * cvt.c (type_promotes_to): Implement C++17, 7.6/4, about unscoped
338 enumeration type whose underlying type is fixed.
340 2017-10-23 Paolo Carlini <paolo.carlini@oracle.com>
343 * semantics.c (finish_compound_literal): Check do_auto_deduction
344 return value for error_mark_node.
346 2017-10-23 Jason Merrill <jason@redhat.com>
348 PR c++/77369 - wrong noexcept handling in C++14 and below
349 * tree.c (strip_typedefs): Canonicalize TYPE_RAISES_EXCEPTIONS.
351 2017-10-20 Nathan Sidwell <nathan@acm.org>
353 * class.c (layout_class_type): Cleanup as-base creation, determine
355 (finish_struct_1): ... not here.
357 2017-10-19 Jakub Jelinek <jakub@redhat.com>
360 * typeck.c (check_return_expr): Don't call
361 maybe_warn_about_returning_address_of_local in templates.
363 2017-10-17 Nathan Sidwell <nathan@acm.org>
366 * call.c (build_over_call): Don't pass tf_no_cleanup to nested
370 * cp-objcp-common.c (cp_tree_size): Reformat. Adjust returns size
373 2017-10-13 Jason Merrill <jason@redhat.com>
375 PR c++/82357 - bit-field in template
376 * tree.c (cp_stabilize_reference): Just return a NON_DEPENDENT_EXPR.
378 2017-10-13 David Malcolm <dmalcolm@redhat.com>
380 * cp-tree.h (maybe_show_extern_c_location): New decl.
381 * decl.c (grokfndecl): When complaining about literal operators
382 with C linkage, issue a note giving the location of the
384 * parser.c (cp_parser_new): Initialize new field
385 "innermost_linkage_specification_location".
386 (cp_parser_linkage_specification): Store the location
387 of the linkage specification within the cp_parser.
388 (cp_parser_explicit_specialization): When complaining about
389 template specializations with C linkage, issue a note giving the
390 location of the extern "C".
391 (cp_parser_explicit_template_declaration): Likewise for templates.
392 (maybe_show_extern_c_location): New function.
393 * parser.h (struct cp_parser): New field
394 "innermost_linkage_specification_location".
396 2017-10-12 Nathan Sidwell <nathan@acm.org>
398 * cp-tree.h (cp_expr): Add const operator * and operator->
400 (cp_tree_node_structure_enum): Delete TS_CP_BINDING,
401 TS_CP_WRAPPER, LAST_TS_CP_ENUM.
403 2017-10-12 David Malcolm <dmalcolm@redhat.com>
405 * parser.c (get_required_cpp_ttype): New function.
406 (cp_parser_error_1): Call it, using the result to call
407 maybe_suggest_missing_token_insertion.
409 2017-10-12 David Malcolm <dmalcolm@redhat.com>
411 * parser.c (get_matching_symbol): Move to before...
412 (cp_parser_error): Split out into...
413 (cp_parser_error_1): ...this new function, merging in content
415 (cp_parser_required_error): ...here. Eliminate partial duplicate
416 of body of cp_parser_error in favor of a call to the new
417 cp_parser_error_1 helper function.
419 2017-10-11 Nathan Sidwell <nathan@acm.org>
421 * decl2.c (struct mangled_decl_hash): Use DECL_ASSEMBLER_NAME_RAW.
422 (record_mangling): Likewise.
424 2017-10-10 Nathan Sidwell <nathan@acm.org>
426 * name-lookup.c (extern_c_fns): Rename to ...
427 (extern_c_decls): ... here.
428 (check_extern_c_conflict, extern_c_linkage_bindings): Update.
429 (do_pushdecl): Check extern-c fns and vars.
431 * cp-tree.h (default_hash_traits <lang_identifier *>): Delete
434 * decl2.c (struct mangled_decl_hash): New hash traits.
435 (mangled_decls): Make hash_table<mangled_decl_hash>.
436 (generate_mangling_alias, record_mangling): Adjust.
438 2017-10-10 Jason Merrill <jason@redhat.com>
440 More delayed lambda capture fixes.
441 * call.c (add_function_candidate): Use build_address.
442 (build_op_call_1): Call mark_lvalue_use early.
443 (build_over_call): Handle error from build_this.
444 * constexpr.c (cxx_bind_parameters_in_call): Use build_address.
445 (cxx_eval_increment_expression): Don't use rvalue().
446 * cvt.c (convert_to_void): Use mark_discarded_use.
447 * expr.c (mark_use): Handle PARM_DECL, NON_DEPENDENT_EXPR. Fix
448 reference handling. Don't copy the expression.
449 (mark_discarded_use): New.
450 * lambda.c (insert_capture_proxy): Add some sanity checking.
451 (maybe_add_lambda_conv_op): Set cp_unevaluated_operand.
452 * pt.c (register_local_specialization): Add sanity check.
453 * semantics.c (process_outer_var_ref): Fix check for existing proxy.
454 * typeck.c (cp_build_addr_expr_1): Handle error from
456 (cp_build_modify_expr): Call mark_lvalue_use_nonread, handle error
459 Handle generic lambda capture in dependent expressions.
460 * lambda.c (need_generic_capture, dependent_capture_r)
461 (do_dependent_capture): New.
462 * pt.c (processing_nonlambda_template): Use need_generic_capture.
463 * semantics.c (maybe_cleanup_point_expr)
464 (maybe_cleanup_point_expr_void, finish_goto_stmt)
465 (maybe_convert_cond): Call do_dependent_capture.
466 * typeck.c (build_static_cast): Remove dependent capture handling.
468 * typeck.c (condition_conversion): Assert !processing_template_decl.
469 * semantics.c (finish_omp_clauses): Don't
470 fold_build_cleanup_point_expr if processing_template_decl.
471 (outer_var_p): A temporary can't be from an outer scope.
472 * pt.c (type_dependent_expression_p): Fix dependency checking of
473 functions without DECL_TEMPLATE_INFO.
474 (instantiate_decl): Use lss_copy.
475 * constexpr.c (is_valid_constexpr_fn): Fix lambdas before C++17.
477 * typeck.c (check_return_expr): Check non-dependent conversion in
479 * constraint.cc (check_function_concept): Don't complain about an
480 empty concept if seen_error.
482 2017-10-10 Richard Sandiford <richard.sandiford@linaro.org>
484 * cvt.c (ignore_overflows): Use wi::to_wide when
485 operating on trees as wide_ints.
486 * decl.c (check_array_designated_initializer): Likewise.
487 * mangle.c (write_integer_cst): Likewise.
488 * semantics.c (cp_finish_omp_clause_depend_sink): Likewise.
490 2017-10-10 Nathan Sidwell <nathan@acm.org>
492 * name-lookup.c (set_global_binding): Don't deal with STAT_HACK.
494 2017-10-06 Paolo Carlini <paolo.carlini@oracle.com>
497 * decl.c (finish_function): Take a bool intead of an int; adjust.
498 * cp-tree.h (finish_function): Adjust declaration.
499 * decl2.c (generate_tls_wrapper, finish_objects,
500 finish_static_storage_duration_function): Adjust calls.
501 * lambda.c (maybe_add_lambda_conv_op, finish_lambda_function):
503 * method.c (synthesize_method): Likewise.
504 * optimize.c (maybe_thunk_body, maybe_clone_body): Likewise.
505 * pt.c (instantiate_decl): Likewise.
506 * parser.c (cp_parser_function_definition_after_declarator,
507 cp_parser_late_parsing_for_member, cp_parser_omp_declare_reduction):
509 (cp_parser_ctor_initializer_opt,
510 cp_parser_ctor_initializer_opt_and_function_body,
511 cp_parser_function_try_block,
512 cp_parser_function_definition_after_declarator,
513 cp_parser_function_transaction): Return void; adjust declarations.
515 2017-10-06 Nathan Sidwell <nathan@acm.org>
518 * name-lookup.c (check_local_shadow): Don't try and convert
521 2017-10-06 Jakub Jelinek <jakub@redhat.com>
524 * decl.c (reshape_init): Suppress warn_useless_cast for direct enum
526 * typeck.c (convert_for_assignment): Likewise.
528 P0704R1 - fixing const-qualified pointers to members
529 * typeck2.c (build_m_component_ref): For -std=c++2a allow
530 pointer to const & qualified method on rvalue.
532 2017-10-06 Nathan Sidwell <nathan@acm.org>
534 Use hash_table for extern "C" names
535 * name-lookup.c (extern_c_fns): Use hash_table.
536 (check_extern_c_conflict): Adjust.
537 (c_linkage_bindings): Adjust.
539 Use hash_table for namespace bindings
540 * cp-tree.h (struct named_decl_hash): New.
541 (lang_decl_ns): Change type of bindings field.
542 * lex.c (maybe_add_lang_decl_raw): Adjust.
543 * name-lookup.c (find_namespace_slot): Adjust.
544 (do_pushdecl): Push NULL-named namespace.
545 (do_push_nested_namespace): Adjust.
546 (push_namespace): Push anonymous namespace as NULL name.
548 2017-10-05 Jason Merrill <jason@redhat.com>
550 Pass variadic class objects exactly like named by-value args.
551 * call.c (convert_arg_to_ellipsis): Use the result of force_rvalue.
553 2017-10-05 Nathan Sidwell <nathan@acm.org>
555 Warn on MVP declarations
556 * cp-tree.h (struct cp_declarator): Add parenthesized field.
557 * decl.c (grokdeclarator): Warn about unnecessary parens.
558 * parser.c (make_declarator): Init parenthesized field.
559 (cp_parser_direct_declarator): Set parenthesized field.
561 Kill IDENTIFIER_GLOBAL_VALUE, SET_IDENTIFIER_GLOBAL_VALUE
562 * cp-tree.h (IDENTIFIER_GLOBAL_VALUE,
563 SET_IDENTIFIER_GLOBAL_VALUE): Delete.
564 * name-lookup.h (set_global_binding): Remove NAME parm.
565 (get_global_binding): New inline fn.
566 * name-lookup.c (set_global_binding): Remove NAME parm. Adjust.
567 (identifier_global_value): Move to ...
568 * cp-objcp-common.c (identifier_global_value): ... here.
569 * class.c (build_ctor_vtbl_group, build_vtbl_initializer): Adjust.
570 * decl.c (record_builtin_type, expand_static_init,
571 grokdeclarator): Adjust.
572 * decl2.c (get_guard, get_local_tls_init_fn, get_tls_init_fn,
573 get_tls_wrapper_fn, maybe_warn_sized_delete): Adjust.
574 * except.c (declare_library_fn, build_throw): Adjust.
575 * init.c (throw_bad_array_length): Adjust.
576 * rtti.c (throw_bad_cast, throw_bad_typeid, get_tinfo_decl): Adjust.
578 * decl2.c (record_mangling): Fix spello and formatting from
581 2017-10-04 Nathan Sidwell <nathan@acm.org>
583 Give builtin types the correct name.
584 * name-lookup.c (set_global_binding): Assert name is DECL_NAME.
585 * decl.c (record_builtin_type): Reimplement, use new TYPE_DECL for
588 2017-10-04 Paolo Carlini <paolo.carlini@oracle.com>
589 Andrew Pinski <apinski@cavium.com>
592 * parser.c (cp_parser_lambda_body): Set parser->in_function_body.
594 2017-10-04 Nathan Sidwell <nathan@acm.org>
596 Move mangling aliases out of global namespace.
597 * cp-tree.h (record_mangling): New.
598 (maybe_remove_implicit_alias): Delete.
599 * decl2.c (mangled_decls): New hash map.
600 (generate_mangling_alias): Reimplement using mangled_decls.
601 (record_mangling): New.
602 * mangle.c (decl_implicit_alias_p,
603 maybe_remove_implicit_alias): Delete.
604 (mangle_decl): Use record_mangling.
605 * name-lookup.c (supplement_binding_1): Remove
606 maybe_remove_implicit_alias check.
608 2017-10-04 Jakub Jelinek <jakub@redhat.com>
611 * error.c (dump_function_decl): If show_return, call dump_type_suffix
612 on the same return type dump_type_prefix has been called on.
614 2017-10-04 Jason Merrill <jason@redhat.com>
616 PR c++/81525 - broken handling of auto in generic lambda.
617 * pt.c (tsubst_decl) [VAR_DECL]: Use strip_innermost_template_args.
619 2017-10-04 Nathan Sidwell <nathan@acm.org>
621 * call.c (convert_arg_to_ellipsis): Correct comment about passing
624 2017-10-02 Richard Sandiford <richard.sandiford@linaro.org>
626 * constexpr.c (cxx_eval_store_expression): Use wi::to_widest
627 when comparing the array bounds with an ARRAY_REF index.
629 2017-09-30 Paolo Carlini <paolo.carlini@oracle.com>
632 * method.c (defaulted_late_check): Early return if the defaulted
633 declaration does not match the expected signature.
635 2017-09-29 Jakub Jelinek <jakub@redhat.com>
637 P0683R1 - default member initializers for bit-fields
638 * cp-tree.h (grokbitfield): Add INIT parameter.
639 * parser.c (cp_parser_constant_expression): Add STRICT_P argument,
640 if true, parse a conditional-expression rather than
641 assignment-expression.
642 (cp_parser_member_declaration): For C++11 and later pass true
643 as STRICT_P to cp_parser_constant_expression. Parse C++2A bitfield
644 NSDMIs. Adjust grokbitfield caller. Handle DECL_INITIAL also for
646 (cp_parser_objc_class_ivars): Adjust grokbitfield caller.
647 * class.c (check_field_decl): Recurse even for DECL_C_BIT_FIELDs.
648 (check_field_decls): Call check_field_decl even for DECL_C_BIT_FIELDs.
649 * decl2.c (grokbitfield): Add INIT parameter, pass it to
651 * pt.c (tsubst_decl): Handle DECL_INITIAL for all FIELD_DECLs, not
654 * class.c (check_bitfield_decl): Retrieve and clear width from
655 DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL.
656 (check_field_decls): Test DECL_BIT_FIELD_REPRESENTATIVE rather than
658 (remove_zero_width_bit_fields): Adjust comment.
659 * decl2.c (grokbitfield): Stash width into
660 DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL.
661 * pt.c (tsubst_decl): For DECL_C_BIT_FIELD, tsubst_expr
662 DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL for width.
664 * parser.c (cp_parser_member_declaration): Parse attributes before
665 colon of a bitfield in addition to after colon.
667 * Make-lang.in (check-c++-all): Test also c++2a.
669 2017-09-28 Jason Merrill <jason@redhat.com>
671 PR c++/56973, DR 696 - capture constant variables only as needed.
672 * expr.c (mark_use): Split out from mark_rvalue_use and
673 mark_lvalue_use. Handle lambda capture of constant variables.
674 (mark_lvalue_use_nonread): New.
675 * semantics.c (process_outer_var_ref): Don't capture a constant
676 variable until forced.
677 * pt.c (processing_nonlambda_template): New.
678 * call.c (build_this): Check it.
679 * decl2.c (grok_array_decl): Call mark_rvalue_use and
680 mark_lvalue_use_nonread.
681 * init.c (constant_value_1): Don't call mark_rvalue_use.
682 * typeck.c (build_static_cast): Handle lambda capture.
684 Use local_specializations to find capture proxies.
685 * cp-tree.h (DECL_CAPTURED_VARIABLE): New.
686 * lambda.c (build_capture_proxy): Set it.
687 (add_capture): Pass initializer to build_capture_proxy.
688 (start_lambda_function): Likewise.
689 (insert_capture_proxy): Use register_local_specialization.
690 (is_lambda_ignored_entity): Always ignore proxies.
691 * name-lookup.c (qualify_lookup): Don't check
692 is_lambda_ignored_entity if LOOKUP_HIDDEN is set.
693 * semantics.c (process_outer_var_ref): Use
694 retrieve_local_specialization.
695 * parser.c (cp_parser_lambda_body): Push local_specializations.
696 * pt.c (tsubst_expr): Pass LOOKUP_HIDDEN when looking for a proxy.
697 (tsubst_lambda_expr): Push local_specializations sooner.
698 (tsubst_copy_and_build): Don't register_local_specialization.
700 * call.c (build_special_member_call): Use the return value of
702 * decl.c (compute_array_index_type): Likewise.
703 * parser.c (cp_parser_oacc_wait_list): Likewise.
704 * lambda.c (is_normal_capture_proxy): Handle *this capture.
705 (add_capture): Clarify internal_error message.
707 2017-09-22 Eric Botcazou <ebotcazou@adacore.com>
710 * cp-objcp-common.c (cp_get_debug_type): Do only one lookup.
712 2017-09-22 Jakub Jelinek <jakub@redhat.com>
715 * tree.c (struct replace_placeholders_t): Add pset field.
716 (replace_placeholders_r): Call cp_walk_tree with d->pset as
717 last argument instead of NULL. Formatting fix.
718 (replace_placeholders): Add pset variable, add its address
719 into data. Pass &pset instead of NULL to cp_walk_tree.
721 2017-09-22 David Malcolm <dmalcolm@redhat.com>
723 * call.c (get_fndecl_argument_location): New function.
724 (convert_like_real): Use it when complaining about argument type
726 * cp-tree.h (struct cp_parameter_declarator): Add "loc" field.
727 * parser.c (make_parameter_declarator): Add "loc" param and use
728 it to initialize the new field.
729 (cp_parser_translation_unit): Add UNKNOWN_LOCATION for "loc" of
730 the "no_parameters" parameter.
731 (cp_parser_parameter_declaration_list): Set the location of the
732 result of grokdeclarator to be the parameter's loc, assuming no
734 (cp_parser_parameter_declaration): Generate a location for the
735 parameter and pass to make_parameter_declarator.
737 2017-09-20 Nathan Sidwell <nathan@acm.org>
739 * name-lookup.c (member_name_cmp): Use DECL_UID for final
742 2017-09-20 Jakub Jelinek <jakub@redhat.com>
744 P0409R2 - allow lambda capture [=, this]
745 * parser.c (cp_parser_lambda_introducer): For cxx2a don't pedwarn on
748 2017-09-18 Jason Merrill <jason@redhat.com>
750 PR c++/82069 - ICE with lambda in template
751 * semantics.c (process_outer_var_ref): Check uses_template_parms
752 instead of any_dependent_template_arguments_p.
754 2017-09-15 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
755 Paolo Carlini <paolo.carlini@oracle.com>
758 * decl2.c (finish_anon_union): Complain about "anonymous union with
759 no members" with a pedwarn.
761 2017-09-15 Bernd Edlinger <bernd.edlinger@hotmail.de>
763 * typeck.c (build_reinterpret_cast_1,
764 build_const_cast_1): Implement -Wcast-align=strict.
766 2017-09-15 Jakub Jelinek <jakub@redhat.com>
768 * decl.c (redeclaration_error_message): Use cxx17 instead of cxx1z,
769 adjust diagnostics refering to C++1z or -std=gnu++1z or -std=c++1z
770 to C++17 or -std=gnu++17 or -std=c++17. Adjust comments.
771 (cxx_init_decl_processing, next_initializable_field,
772 is_direct_enum_init, check_initializer, cp_finish_decl,
773 mark_inline_variable, grokdeclarator, grokparms, xref_basetypes,
774 finish_function): Likewise.
775 * cp-tree.h (DECL_INLINE_VAR_P): Likewise.
776 * pt.c (mark_template_parm, convert_nontype_argument,
777 instantiate_class_template_1, type_unification_real, unify,
778 get_partial_spec_bindings, dependent_type_p_r): Likewise.
779 * typeck.c (cp_build_unary_op): Likewise.
780 * constexpr.c (var_in_maybe_constexpr_fn): Likewise.
781 * call.c (build_user_type_conversion_1, build_over_call,
782 build_special_member_call): Likewise.
783 * lambda.c (begin_lambda_type): Likewise.
784 * typeck2.c (process_init_constructor_record): Likewise.
785 * class.c (build_base_field, finalize_literal_type_property,
786 explain_non_literal_class): Likewise.
787 * parser.c (cp_parser_diagnose_invalid_type_name,
788 cp_parser_primary_expression, cp_parser_lambda_introducer,
789 cp_parser_lambda_declarator_opt, cp_parser_selection_statement,
790 cp_convert_range_for, cp_parser_perform_range_for_lookup,
791 cp_parser_decomposition_declaration, cp_parser_linkage_specification,
792 cp_parser_static_assert, cp_parser_simple_type_specifier,
793 cp_parser_namespace_definition, cp_parser_using_declaration,
794 cp_parser_init_declarator, cp_parser_type_parameter_key,
795 cp_parser_exception_specification_opt, cp_parser_std_attribute_spec,
796 cp_parser_constructor_declarator_p): Likewise.
797 * mangle.c (struct globals): Rename need_cxx1z_warning to
799 (write_exception_spec, start_mangling, mangle_decl): Likewise.
800 * Make-lang.in (check-c++1z): Rename to check-c++17, depend on
802 (check-c++17): New goal. Use 17 instead of 1z.
803 (check-c++-all): Use 17 instead of 1z.
805 2017-09-14 Jakub Jelinek <jakub@redhat.com>
808 * cp-gimplify.c (omp_var_to_track): Look through references.
809 (omp_cxx_notice_variable): Likewise.
811 2017-09-13 Nathan Sidwell <nathan@acm.org>
813 Conv-op identifers not in identifier hash table
814 * lex.c (conv_type_hasher): Make member fns inline.
815 (make_conv_op_name): Directly clone conv_op_identifier.
817 Rename CLASSTYPE_METHOD_VEC to CLASSTYPE_MEMBER_VEC.
818 * cp-tree.h (struct lang_type): Rename methods to members.
819 (CLASSTYPE_METHOD_VEC): Rename to ...
820 (CLASSTYPE_MEMBER_VEC): ... this.
821 * name-lookup.h (get_method_slot): Rename to ...
822 (get_member_slot): ... this.
823 (resort_type_method_vec): Rename to ...
824 (resort_type_member_vec): ... this.
825 * class.c (add_method, warn_hidden): Adjust.
826 * search.c (dfs_locate_field_accessor_pre): Adjust.
827 * name-lookup.c (method_vec_binary_search): Rename to ...
828 (member_vec_binary_search): ... this and adjust.
829 (method_vec_linear_search): Rename to ...
830 (member_vec_linear_search): ... this and adjust.
831 (fields_linear_search, get_class_binding_direct): Adjust.
832 (get_method_slot): Rename to ...
833 (get_member_slot): ... this and adjust.
834 (method_name_slot): Rename to ...
835 (member_name_slot): ... this and adjust.
836 (resort_type_method_vec): Rename to ...
837 (resort_type_member_vec): ... this and adjust.
838 (method_vec_append_class_fields): Rename to ...
839 (member_vec_append_class_fields): ... this and adjust.
840 (method_vec_append_enum_values): Rename to ...
841 (member_vec_append_enum_values): ... this and adjust.
842 (method_vec_dedup): Rename to ...
843 (member_vec_dedup): ... this and adjust.
844 (set_class_bindings, insert_late_enum_def_bindings): Adjust.
846 2017-09-12 Paolo Carlini <paolo.carlini@oracle.com>
849 * decl.c (start_decl): Early return error_mark_node if duplicate_decls
850 returns it; avoid misleading error message.
852 2017-09-12 Nathan Sidwell <nathan@acm.org>
854 Kill CLASSTYPE_SORTED_FIELDS.
855 * cp-tree.h (struct lang_type): Lose sorted_fields member.
856 (CLASSTYPE_SORTED_FIELDS): Delete.
857 * name-lookup.h (set_class_bindings): Add EXTRA arg.
858 * name-lookup.c (fields_linear_search): New, broken out of ...
859 (lookup_field_1): ... here. Delete remainder of function.
860 (get_class_binding_direct): Reimplement without sorted_fields.
861 (get_class_binding): Rename TYPE arg to KLASS, for consistency.
862 (get_method_slot): Call set_class_binding when creating method_vec
864 (method_name_cmp): Order identically named slots.
865 (sorted_fields_type_new): Delete.
866 (field_vc_append_class_fields): Rename to ...
867 (method_vec_append_class_fields): ... here. Adjust.
868 (field_vec_append_enum_values): Renme to ...
869 (method_vec_append_enum_values): ... here. Adjust.
870 (method_vec_dedup): New.
871 (set_class_bindings): Reimplement.
872 (insert_late_enum_def_bindings): Reimplement.
874 * name-lookup.c (get_class_binding): Rename TYPE arg to KLASS for
876 (restort_data): Move later.
877 (method_name_cmp, resort_method_name_cmp): Simplify.
878 (resort_type_method_vec): Reformat.
880 2017-09-09 Jason Merrill <jason@redhat.com>
882 * constexpr.c (reduced_constant_expression_p): If
883 CONSTRUCTOR_NO_IMPLICIT_ZERO, check that all fields are initialized.
885 2017-09-09 Eric Botcazou <ebotcazou@adacore.com>
888 * cp-objcp-common.c (struct debug_type_hasher): New class.
889 (debug_type_hash): New variable.
890 (cp_get_debug_type): Associate the OFFSET_TYPEs with the types.
892 2017-09-08 Jason Merrill <jason@redhat.com>
894 PR c++/70029 - ICE with ref-qualifier and -flto
895 * tree.c (cxx_copy_lang_qualifiers): New.
896 * cp-tree.h: Declare it.
897 * cp-objcp-common.h: Define LANG_HOOKS_COPY_LANG_QUALIFIERS.
899 2017-09-06 Jason Merrill <jason@redhat.com>
901 PR c++/82053 - ICE with default argument in lambda in template
902 * pt.c (tsubst_arg_types): Substitute default arguments for lambdas
904 (retrieve_specialization): Use lambda_fn_in_template_p.
905 * cp-tree.h: Declare it.
907 PR c++/82070 - error with nested lambda capture
908 * pt.c (tsubst_expr) [DECL_EXPR]: Register capture proxies with
909 register_local_specialization.
911 2017-09-06 Nathan Sidwell <nathan@acm.org>
913 * name-lookup.h (lookup_field_1): Delete.
914 (get_class_binding_direct, get_class_binding): Add type_or_fns arg.
915 * name-lookup.c (lookup_field_1): make static
916 (method_vec_binary_search, method_vec_linear_search): New. Broken
918 (get_class_binding_direct): ... here. Add TYPE_OR_FNS argument.
919 Do complete search of this level.
920 (get_class_binding): Adjust.
921 * decl.c (reshape_init_class): Call get_class_binding.
922 * search.c (lookup_field_r): Move field searching into
923 get_class_binding_direct.
925 * class.c (warn_hidden): Don't barf on non-functions.
926 * decl2.c (check_classfn): Likewise. Check template match earlier.
928 * name-lookup.c (count_fields): Rename to ...
929 (count_class_fields): ... here. Take a class, don't count
931 (add_fields_to_record_type): Rename to ...
932 (field_vec_append_class_fields): ... here. Take a class, don't
933 add NULL-named fields.
934 (add_enum_fields_to_record_type): Rename to ...
935 (field_vec_append_enum_values): ... here.
936 (set_class_bindings): Adjust, assert we added expected number.
937 (insert_late_enum_def_bindings): Reimplement. Create vector if
938 there are now sufficient entries.
940 * name-lookup.h (lookup_fnfields_slot_nolazy,
941 lookup_fnfields_slot): Rename to ...
942 (get_class_binding_direct, get_class_binding): ... here.
943 * name-lookup.c (lookup_fnfields_slot_nolazy,
944 lookup_fnfields_slot): Rename to ...
945 (get_class_binding_direct, get_class_binding): ... here.
946 * cp-tree.h (CLASSTYPE_CONSTRUCTORS, CLASSTYPE_DESTRUCTOR): Adjust.
947 * call.c (build_user_type_conversion_1): Adjust.
948 (has_trivial_copy_assign_p): Adjust.
949 (has_trivial_copy_p): Adjust.
950 * class.c (get_basefndecls) Adjust.
951 (vbase_has_user_provided_move_assign) Adjust.
952 (classtype_has_move_assign_or_move_ctor_p): Adjust.
953 (type_build_ctor_call, type_build_dtor_call): Adjust.
954 * decl.c (register_dtor_fn): Adjust.
955 * decl2.c (check_classfn): Adjust.
956 * pt.c (retrieve_specialization): Adjust.
957 (check_explicit_specialization): Adjust.
958 (do_class_deduction): Adjust.
959 * search.c (lookup_field_r): Adjust.
960 (look_for_overrides_here, lookup_conversions_r): Adjust.
961 * semantics.c (classtype_has_nothrow_assign_or_copy_p): Adjust.
962 * tree.c (type_has_nontrivial_copy_init): Adjust.
963 * method.c (lazily_declare_fn): Adjust comment.
965 2017-09-05 Nathan Sidwell <nathan@acm.org>
967 * name-lookup.c (do_class_using_decl): Elide read-once temps.
968 Move declarations to initializations.
970 * class.c (add_method): Move slot search and insertion to ...
971 * name-lookup.c (get_method_slot): ... this new function.
972 (lookup_fnfields_slot_nolazy): Cope with NULL slot.
973 * name-lookup.h (get_method_slot): Declare.
974 * decl.c (cxx_init_decl_processinng): Give conv_op_marker a more
976 (grok_special_member_properties): Set
977 TYPE_HAS_CONVERSION. Expicitly look at DECL_NAME for specialness.
978 Improve TYPE_HAS_CONSTEXPR_CTOR setting.
980 * cp-tree.h (lang_decl_base): Rename template_conv_p to
982 (DECL_CONV_FN_P): Don't check NULL DECL_NAME.
983 (DECL_CONV_FN_TYPE): FN must be conv op.
984 (DECL_TEMPLATE_CONV_FN_P): Delete.
985 (VAR_HAD_UNKNOWN_BOUND, SET_VAR_HAD_UNKNOWN_BOUND): Adjust.
986 * pt.c (push_template_decl_real): Delete DECL_TEMPLATE_CONV_FN_P
989 * class.c (unreverse_member_declarations): Remove extraneous if.
990 * pt.c (push_template_decl_real): Use string concatenation, not
991 \<newline>. Add %<..%>.
993 2017-09-05 Paolo Carlini <paolo.carlini@oracle.com>
996 * cp-tree.h (LABEL_DECL_CDTOR): Add and document.
997 * decl.c (start_preparsed_function): Set LABEL_DECL_CDTOR when
998 creating cdtor_label.
999 * constexpr.c (returns): Add the case of a constructor/destructor
1000 returning via a LABEL_DECL_CDTOR label.
1001 (cxx_eval_constant_expression, case [GOTO_EXPR]): Likewise.
1003 2017-09-01 Nathan Sidwell <nathan@acm.org>
1005 * cp-tree.h (resort_type_method_vec): Move declaration to ...
1006 * name-lookup.h (resort_type_method_vec): ... here.
1007 (set_class_bindings): Lose 2nd arg.
1008 * class.c (finish_struct_1, finish_struct): Adjust
1009 set_class_bindings call. Don't call finish_struct_methods.
1010 (resort_data, method_name_cmp, resort_method_name_cmp,
1011 resort_type_method_vec, finish_struct_methods): Move to ...
1012 * name-lookup.c (resort_data, method_name_cmp,
1013 resort_method_name_cmp, resort_type_method_vec): ... here.
1014 (set_class_bindings): Lose fields arg. Swallow finish_struct_methods.
1016 * class.c (finish_struct): Call set_class_bindings for the
1019 * class.c (finish_struct_methods): Dont clear DECL_IN_AGGR_P here.
1020 Don't call maybe_warn_about_overly_private_class here.
1021 (warn_hidden): Cleanup declarations and comments.
1022 (type_has_user_provided_constructor): No need to check
1023 CLASSTYPE_METHOD_VEC.
1024 (type_has_user_provided_or_explicit_constructor): Likewise.
1025 (classtype_has_move_assign_or_move_ctor_p): Likewise.
1026 (check_bases_and_members): Don't call finish_struct_methods here.
1027 (finish_struct_1): Call finish_struct_methods and
1028 set_class_bindings immediately after layout. Clear DECL_IN_AGGR_P
1030 (finish_struct): For templates process USING_DECLS and clear
1031 DECL_IN_AGGR_P before calling finish_struct_methods. Call
1032 maybe_warn_about_overly_private_class here.
1034 Revert 2017-08-28 Nathan Sidwell <nathan@acm.org>
1035 Restore sorted_fields vector.
1036 * cp-tree.h (lang_type): Restore sorted_fields vector.
1037 (CLASSTYPE_SORTED_FIELDS): Restore.
1038 (CLASSTYPE_BINDINGS): Delete.
1039 * name-lookup.c (lookup_field_1): Restore binary search.
1040 (sorted_fields_type_new, count_fields,
1041 add_fields_to_record_type, add_enum_fields_to_record_type): Restore
1042 (set_class_bindings): Revert.
1043 (insert_late_enum_def_binding): Restore field_vec insertion.
1045 2017-09-01 Jakub Jelinek <jakub@redhat.com>
1048 * parser.c (cp_parser_omp_ordered): Handle -fopenmp-simd.
1050 2017-09-01 Marek Polacek <polacek@redhat.com>
1053 * typeck.c (cp_build_unary_op): Avoid re-entering reporting routines.
1055 2017-08-30 Jason Merrill <jason@redhat.com>
1057 PR c++/82029 - __PRETTY_FUNCTION__ in lambda in template
1058 * pt.c (enclosing_instantiation_of, lambda_fn_in_template_p)
1059 (regenerated_lambda_fn_p): New.
1060 (tsubst_decl) [VAR_DECL]: Use enclosing_instantiation_of.
1061 (tsubst_copy) [VAR_DECL]: Likewise.
1063 PR c++/82030 - ICE inheriting from multiple lambdas
1065 * call.c (compare_ics): Handle null candidate.
1067 2017-08-30 Ville Voutilainen <ville.voutilainen@gmail.com>
1069 Make taking the address of an overloaded function a non-deduced context
1071 * pt.c (unify_overload_resolution_failure): Remove.
1072 (unify_one_argument): Adjust.
1074 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
1075 Alan Hayward <alan.hayward@arm.com>
1076 David Sherwood <david.sherwood@arm.com>
1078 * typeck.c (cp_build_binary_op): Use SCALAR_TYPE_MODE.
1080 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
1081 Alan Hayward <alan.hayward@arm.com>
1082 David Sherwood <david.sherwood@arm.com>
1084 * cvt.c (cp_convert_to_pointer): Use SCALAR_INT_TYPE_MODE.
1086 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
1087 Alan Hayward <alan.hayward@arm.com>
1088 David Sherwood <david.sherwood@arm.com>
1090 * mangle.c (write_real_cst): Use SCALAR_FLOAT_TYPE_MODE
1091 instead of TYPE_MODE.
1093 2017-08-29 Jason Merrill <jason@redhat.com>
1095 PR c++/81236 - ICE with template-id in generic lambda
1096 * semantics.c (finish_id_expression): Remove special dependent case.
1097 Avoid some later pieces when dependent.
1098 (finish_qualified_id_expr): Do normal BASELINK handling in a
1099 template. Always build a SCOPE_REF for a destructor BIT_NOT_EXPR.
1100 (parsing_default_capturing_generic_lambda_in_template): Remove.
1101 * parser.c (cp_parser_postfix_dot_deref_expression): Always give an
1102 error for types that will never be complete.
1103 * mangle.c (write_expression): Add sanity check.
1104 * tree.c (build_qualified_name): Add sanity check.
1105 (cp_walk_subtrees): Walk into the class context of a BASELINK.
1106 * lambda.c (add_capture): Improve diagnostic for generic lambda
1108 * call.c (build_new_method_call_1): Print the right constructor
1111 Reimplement handling of lambdas in templates.
1112 * cp-tree.h (LAMBDA_FUNCTION_P): Check DECL_DECLARES_FUNCTION_P.
1113 * decl.c (start_preparsed_function): Call start_lambda_scope.
1114 (finish_function): Call finish_lambda_scope.
1115 * init.c (get_nsdmi): Call start/finish_lambda_scope.
1116 * lambda.c (start_lambda_scope): Only ignore VAR_DECL in a function.
1117 * parser.c (cp_parser_function_definition_after_declarator): Don't
1118 call start/finish_lambda_scope.
1119 * pt.c (retrieve_specialization): Ignore lambda functions in
1121 (find_parameter_packs_r): Ignore capture proxies. Look into
1123 (check_for_bare_parameter_packs): Allow bare packs in lambdas.
1124 (tsubst_default_argument): Call start/finish_lambda_scope.
1125 (tsubst_function_decl): Handle lambda functions differently.
1126 (tsubst_template_decl): Likewise.
1127 (tsubst_expr) [DECL_EXPR]: Skip closure declarations and capture
1129 (tsubst_lambda_expr): Create a new closure rather than instantiate
1130 the one from the template.
1131 (tsubst_copy_and_build): Don't register a specialization of a pack.
1132 (regenerate_decl_from_template): Call start/finish_lambda_scope.
1133 (instantiate_decl): Remove special lambda function handling.
1134 * semantics.c (process_outer_var_ref): Remove special generic lambda
1135 handling. Don't implicitly capture in a lambda in a template. Look
1136 for an existing proxy.
1137 * class.c (current_nonlambda_class_type): Use decl_type_context.
1139 * cp-tree.h (LAMBDA_EXPR_CLOSURE): Use TREE_TYPE.
1140 (LAMBDA_EXPR_RETURN_TYPE): Remove.
1141 (struct tree_lambda_expr): Remove closure and return_type fields.
1142 * lambda.c (build_lambda_expr): Don't set LAMBDA_EXPR_RETURN_TYPE.
1143 * pt.c (tsubst_copy_and_build): Likewise.
1144 * parser.c (cp_parser_lambda_declarator_opt): Track return type.
1145 (cp_parser_lambda_body): Adjust unspecified return type check.
1146 * ptree.c (cxx_print_lambda_node): Don't print closure or
1149 PR c++/80935 - wrong C++17 error with lambda
1150 * decl.c (check_for_uninitialized_const_var): Check
1151 is_instantiation_of_constexpr.
1152 * constexpr.c (ensure_literal_type_for_constexpr_object): Check
1153 is_instantiation_of_constexpr.
1154 (potential_constant_expression_1): Check var_in_maybe_constexpr_fn.
1156 * lambda.c (build_lambda_object): Check for error_mark_node.
1157 * pt.c (make_pack_expansion): Set PACK_EXPANSION_LOCAL_P on the type
1159 (tsubst_decl) [FUNCTION_DECL]: Set DECL_CONTEXT on the parameters.
1160 (tsubst) [TEMPLATE_PARM_INDEX]: Check for error_mark_node.
1162 PR c++/80767 - unnecessary instantiation of generic lambda
1163 * call.c (convert_like_real): Call build_user_type_conversion_1 if
1165 (add_conv_candidate): Build a ck_user conversion with no candidate.
1167 Fix lambdas in template default argument of inherited ctor.
1168 * method.c (synthesized_method_base_walk): Replace an inherited
1169 template with its specialization.
1170 (synthesized_method_walk): Make inheriting_ctor a pointer.
1171 (maybe_explain_implicit_delete, explain_implicit_non_constexpr)
1172 (deduce_inheriting_ctor, implicitly_declare_fn): Adjust.
1174 * pt.c (build_deduction_guide): Set DECL_ABSTRACT_ORIGIN on the
1175 template, not the function.
1176 (template_guide_p): Adjust.
1178 Support copying local_specializations.
1179 * cp-tree.h (enum lss_policy): New.
1180 (local_specialization_stack): Add policy parameter to default ctor.
1181 * pt.c (local_specialization_stack): Copy local_specializations if
1184 * constexpr.c (potential_constant_expression_1): Add "now" parm.
1185 (is_constant_expression, require_constant_expression): New.
1186 (is_static_init_expression, is_nondependent_constant_expression)
1187 (is_nondependent_static_init_expression): Drop "potential".
1188 * except.c (build_must_not_throw_expr): Do type conversion on
1189 value-dependent argument.
1190 * pt.c, semantics.c, typeck2.c: Use variants without "potential".
1192 Instantiate default arguments/member initializers once.
1193 * init.c (get_nsdmi): Remember NSDMI instantiations.
1194 * parser.c (inject_this_parameter): Be more picky about
1196 * pt.c (tsubst_copy): Simplify 'this' handling.
1197 (tsubst_default_argument): Remember default argument
1198 instantiations. Take parameter number.
1199 (tsubst_default_arguments): Pass it.
1200 * call.c (convert_default_arg): Likewise.
1202 Fix default argument conversion failure and SFINAE.
1203 * call.c (build_over_call): Check convert_default_arg result for
1205 * parser.c (cp_parser_late_parsing_default_args): Remember
1208 2017-08-28 Nathan Sidwell <nathan@acm.org>
1210 * cp-tree.h (lang_type): Replace sorted_fields vector with
1212 (CLASSTYPE_SORTED_FIELDS): Delete.
1213 (CLASSTYPE_BINDINGS): New.
1214 * decl.c (finish_enum_value_list): Swap args of
1215 insert_late_enum_def_bindings.
1216 * name-lookup.c (lookup_field_1): Replace binary search of sorted
1217 fields with map->get.
1218 (sorted_fields_type_new, count_fields,
1219 add_fields_to_record_type, add_enum_fields_to_record_type): Delete.
1220 (add_class_member, add_class_members): New.
1221 (set_class_bindings): Create map and insert.
1222 (insert_late_enum_def_binding): Swap parms. Use add_clasS_member.
1223 * ptree.c (cxx_print_type): Delete sorted fields printing.
1225 * cp-tree.h (insert_late_enum_def_into_classtype_sorted_fields):
1227 * name-lookup.h (set_class_bindings,
1228 insert_late_enum_def_bindings): Declare.
1229 * decl.c (finish_enum_value_list): Adjust for
1230 insert_late_enum_def_bindings name change.
1231 * class.c (finish_struct_1): Call set_class_bindings.
1232 (count_fields, add_fields_to_record_type,
1233 add_enum_fields_to_record_type, sorted_fields_type_new,
1234 insert_into_classtype_sorted_fields,
1235 insert_late_enum_def_into_classtype_sorted_fields): Move to ...
1236 * name-lookup.h (count_fields, add_fields_to_record_type,
1237 add_enum_fields_to_record_type, sorted_fields_type_new,
1238 set_class_bindings, insert_late_enum_def_bindings): ... here.
1240 2017-08-25 Nathan Sidwell <nathan@acm.org>
1242 * class.c (method_name_cmp, resort_method_name_cmp): Methods
1245 Conversion operators have a special name
1246 * cp-tree.h (CPTI_CONV_OP_MARKER, CPTI_CONV_OP_IDENTIFIER): New.
1247 (conv_op_marker, conv_op_identifier): New.
1248 (CLASSTYPE_FIRST_CONVERSION_SLOT): Delete.
1249 * decl.c (initialize_predefined_identifiers): Add
1251 (cxx_init_decl_processing): Create conv_op_marker.
1252 * decl2.c (check_classfn): Lookup conv-ops by name.
1253 * class.c (add_method): Use conv_op_identifier & conv_op_marker.
1254 (resort_type_method_vec): Don't skip conv-ops.
1255 (finish_struct_methods, warn_hidden): Likewise.
1256 * name-lookup.h (lookup_all_conversions): Delete.
1257 * name-lookup.c (lookup_conversion_operator): Replace with ...
1258 (extract_conversion_operator): ... this.
1259 (lookup_fnfields_slot_nolazy): Find conv-ops by name.
1260 (lookup_all_conversions): Delete.
1261 * pt.c (check_explicit_specialization): Find conv-ops by name.
1262 * search.c (lookup_conversions_r): Likewise.
1264 2017-08-24 Nathan Sidwell <nathan@acm.org>
1266 Conversion operators kept on single overload set
1267 * class.c (add_method): Keep all conv-ops on one slot.
1268 * name-lookup.c (lookup_conversion_operator): Pull the desired
1269 conv op out of overload set.
1270 * search.c (lookup_conversions_r): Lose template/non-template
1272 (lookup_conversions): Likewise.
1274 2017-08-23 Nathan Sidwell <nathan@acm.org>
1276 * cp-tree.h (lookup_field_1, lookup_fnfields_slot,
1277 lookup_fnfields_slot_nolazy, lookup_all_conversions): Move
1279 * name-lookup.h (lookup_field_1, lookup_fnfields_slot,
1280 lookup_fnfields_slot_nolazy, lookup_all_conversions): ... here.
1281 * search.c (lookup_conversion_operator,
1282 lookup_fnfields_slot_nolazy, lookup_field_1, lookup_fnfields_slot,
1283 lookup_all_conversions): Move to ...
1284 * name-lookup.c (lookup_conversion_operator,
1285 lookup_fnfields_slot_nolazy, lookup_field_1, lookup_fnfields_slot,
1286 lookup_all_conversions): ... here.
1288 * semantics.c (finish_member_declaration): Move USING_DECL check
1289 earlier. Always set C++ linkage. Commonize TYPE_FIELD and
1290 template decl list insertion.
1292 * cp-tree.h (maybe_version_functions): Declare.
1293 * decl.c (decls_match): Break function versioning check to
1294 separate function. Call it.
1295 (maybe_version_functions): Broken out of decls_match.
1296 * class.c (add_method): Use maybe_version_functions.
1298 * cp-tree.h (print_search_statistics,
1299 reinit_search_statistics): Don't declare.
1300 * search.c (n_fields_searched, n_calls_lookup_field,
1301 n_calls_lookup_field_1, n_calls_lookup_fnfields,
1302 n_calls_lookup_fnfields_1, n_calls_get_base_type,
1303 n_outer_fields_searched, n_contexts_saved): Delete.
1304 (lookup_field_1, lookup_member,
1305 lookup_fnfields_slot_nolazy): Remove stat gathering.
1306 (print_search_statistics, reinit_search_statistics): Delete.
1307 * tree.c (cxx_print_statistics): Don't print search stats.
1309 2017-08-21 Nathan Sidwell <nathan@acm.org>
1311 * search.c (lookup_field_r): Remove obsolete code for type-named
1314 * search.c (lookup_field_1): Assert TYPE is a class and VFIELD
1316 (lookup_field_fuzzy_info::fuzzy_lookup_fnfields): Delete.
1317 (lookup_field_fuzzy_r): Adjust.
1319 2017-08-21 David Malcolm <dmalcolm@redhat.com>
1321 * call.c (build_over_call): Pass NULL for new parameter to
1322 check_function_arguments.
1323 * typeck.c (cp_build_function_call_vec): Likewise.
1325 2017-08-21 Nathan Sidwell <nathan@acm.org>
1328 * pt.c (instantiate_class_template_1):
1329 BOUND_TEMPLATE_TEMPLATE_PARM is never friend-injected.
1331 2017-08-18 David Malcolm <dmalcolm@redhat.com>
1334 * name-lookup.c (maybe_suggest_missing_header): Convert return
1335 type from void to bool; return true iff a suggestion was offered.
1336 (suggest_alternative_in_explicit_scope): Move call to
1337 maybe_suggest_missing_header to before use of best_match, and
1338 return true if the former offers a suggestion.
1340 2017-08-18 H.J. Lu <hongjiu.lu@intel.com>
1343 * decl.c (duplicate_decls): Also merge DECL_WARN_IF_NOT_ALIGN.
1344 * decl2.c (grokbitfield): Don't allow bit-field with
1345 warn_if_not_aligned type.
1347 2017-08-17 Nathan Sidwell <nathan@acm.org>
1349 * cp-tree.def (TEMPLATE_TEMPLATE_PARM): Remove stale comment.
1350 * cp-tree.h (ENUM_TEMPLATE_INFO): Delete.
1351 (TYPE_TEMPLATE_INFO): Simplify.
1352 (SET_TYPE_TEMPLATE_INFO): Simplify.
1354 * lex.c (maybe_add_lang_type_raw): BOUND_TEMPLATE_TEMPLATE_PARMs
1355 don't need lang_type.
1356 (cxx_make_type): Use maybe_add_lang_type_raw return value.
1357 * mangle.c (CLASSTYPE_TEMPLATE_ID_P): Don't rely on
1360 * cp-tree.h (struct lang_type): Remove template_info field.
1361 (CLASSTYPE_TEMPLATE_INFO): Use TYPE_LANG_SLOT_1.
1362 (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO): Likewise.
1364 2017-08-14 Martin Sebor <msebor@redhat.com>
1367 * error.c (cp_printer): Handle 'G'.
1369 2017-08-11 Martin Liska <mliska@suse.cz>
1371 * decl2.c (get_tls_init_fn): Replace ASM_OUTPUT_DEF with
1372 TARGET_SUPPORTS_ALIASES.
1373 (handle_tls_init): Likewise.
1374 (note_mangling_alias): Likewise. Remove ATTRIBUTE_UNUSED for
1376 * optimize.c (can_alias_cdtor): Likewise.
1378 2017-08-11 Jason Merrill <jason@redhat.com>
1380 PR c++/81671 - nullptr_t template parameter
1381 * pt.c (convert_nontype_argument): Fix nullptr_t check.
1383 2017-08-10 Jason Merrill <jason@redhat.com>
1385 PR c++/81359 - Unparsed NSDMI error from SFINAE context.
1386 * method.c (synthesized_method_walk): Don't diagnose lack of
1389 PR c++/80452 - Core 1579, implicit move semantics on return/throw
1390 * cp-tree.h (LOOKUP_PREFER_RVALUE): Now means that we've already
1391 tentatively changed the lvalue to an rvalue.
1392 * call.c (reference_binding): Remove LOOKUP_PREFER_RVALUE handling.
1393 (build_over_call): If LOOKUP_PREFER_RVALUE, check that the first
1394 parameter is an rvalue reference.
1395 * except.c (build_throw): Do maybe-rvalue overload resolution twice.
1396 * typeck.c (check_return_expr): Likewise.
1398 2017-08-10 David Malcolm <dmalcolm@redhat.com>
1400 * parser.c (cp_parser_error): Update for new param to
1402 (class token_pair): New class.
1403 (struct matching_paren_traits): New struct.
1404 (matching_parens): New typedef.
1405 (struct matching_brace_traits): New struct.
1406 (matching_braces): New typedef.
1407 (cp_parser_statement_expr): Convert explicit parsing of
1408 CPP_OPEN_PAREN and CPP_CLOSE_PAREN to use of
1409 class matching_parens, so that the pertinent open parenthesis is
1410 highlighted when there are problems locating the close
1412 (cp_parser_primary_expression): Likewise.
1413 (cp_parser_compound_literal_p): Remove consumption of opening
1415 (cp_parser_postfix_expression): Convert explicit parsing of
1416 CPP_OPEN_PAREN and CPP_CLOSE_PAREN to use matching parens, as
1417 above. Use it to consume the opening paren previously consumed by
1418 cp_parser_compound_literal_p.
1419 (cp_parser_parenthesized_expression_list): Likewise.
1420 (cp_parser_unary_expression): Likewise.
1421 (cp_parser_new_expression): Likewise.
1422 (cp_parser_cast_expression): Likewise.
1423 (cp_parser_builtin_offsetof): Likewise.
1424 (cp_parser_trait_expr): Likewise.
1425 (cp_parser_lambda_declarator_opt): Likewise.
1426 (cp_parser_lambda_body): Likewise, for matching_braces.
1427 (cp_parser_compound_statement): Likewise.
1428 (cp_parser_selection_statement): Likewise, for matching_parens.
1429 (cp_parser_iteration_statement): Likewise.
1430 (cp_parser_already_scoped_statement): Likewise, for
1432 (cp_parser_linkage_specification): Likewise.
1433 (cp_parser_static_assert): Likewise, for matching_parens.
1434 (cp_parser_decltype): Likewise.
1435 (cp_parser_operator): Likewise.
1436 (cp_parser_enum_specifier): Likewise.
1437 (cp_parser_namespace_definition): Likewise.
1438 (cp_parser_direct_declarator): Likewise.
1439 (cp_parser_braced_list): Likewise.
1440 (cp_parser_class_specifier_1): Likewise, for matching_braces.
1441 (cp_parser_constant_initializer): Likewise.
1442 (cp_parser_noexcept_specification_opt): Likewise, for
1444 (cp_parser_exception_specification_opt): Likewise.
1445 (cp_parser_handler): Likewise.
1446 (cp_parser_asm_specification_opt): Likewise.
1447 (cp_parser_asm_operand_list): Likewise.
1448 (cp_parser_gnu_attributes_opt): Likewise.
1449 (cp_parser_std_attribute_spec): Likewise.
1450 (cp_parser_requirement_parameter_list): Likewise.
1451 (cp_parser_requirement_body): Likewise, for matching_braces.
1452 (cp_parser_compound_requirement): Likewise.
1453 (cp_parser_template_introduction): Likewise.
1454 (cp_parser_sizeof_pack): Likewise, for matching_parens.
1455 (cp_parser_sizeof_operand): Likewise; use it to consume the
1456 opening paren previously consumed by cp_parser_compound_literal_p.
1457 (get_matching_symbol): New function.
1458 (cp_parser_required_error): Add param "matching_location". Remove
1459 calls to cp_parser_error, instead setting a non-NULL gmsgid, and
1460 handling it if set by calling c_parse_error, potentially with a
1461 secondary location if matching_location was set.
1462 (cp_parser_require): Add param "matching_location", with a default
1463 value of UNKNOWN_LOCATION.
1464 (cp_parser_require_keyword): Update for new param of
1465 cp_parser_required_error.
1466 (cp_parser_objc_encode_expression): Update to class matching_parens
1468 (cp_parser_objc_defs_expression): Likewise.
1469 (cp_parser_objc_protocol_expression): Likewise.
1470 (cp_parser_objc_selector_expression): Likewise.
1471 (cp_parser_objc_typename): Likewise.
1472 (cp_parser_objc_superclass_or_category): Likewise.
1473 (cp_parser_objc_try_catch_finally_statement): Likewise.
1474 (cp_parser_objc_synchronized_statement): Likewise.
1475 (cp_parser_objc_at_property_declaration): Likewise.
1476 (cp_parser_oacc_single_int_clause): Likewise.
1477 (cp_parser_oacc_shape_clause): Likewise.
1478 (cp_parser_omp_clause_collapse): Likewise.
1479 (cp_parser_omp_clause_default): Likewise.
1480 (cp_parser_omp_clause_final): Likewise.
1481 (cp_parser_omp_clause_if): Likewise.
1482 (cp_parser_omp_clause_num_threads): Likewise.
1483 (cp_parser_omp_clause_num_tasks): Likewise.
1484 (cp_parser_omp_clause_grainsize): Likewise.
1485 (cp_parser_omp_clause_priority): Likewise.
1486 (cp_parser_omp_clause_hint): Likewise.
1487 (cp_parser_omp_clause_defaultmap): Likewise.
1488 (cp_parser_omp_clause_ordered): Likewise.
1489 (cp_parser_omp_clause_schedule): Likewise.
1490 (cp_parser_omp_clause_num_teams): Likewise.
1491 (cp_parser_omp_clause_thread_limit): Likewise.
1492 (cp_parser_omp_clause_aligned): Likewise.
1493 (cp_parser_omp_clause_linear): Likewise.
1494 (cp_parser_omp_clause_safelen): Likewise.
1495 (cp_parser_omp_clause_simdlen): Likewise.
1496 (cp_parser_omp_clause_depend): Likewise.
1497 (cp_parser_omp_clause_device): Likewise.
1498 (cp_parser_omp_clause_dist_schedule): Likewise.
1499 (cp_parser_oacc_clause_async): Likewise.
1500 (cp_parser_omp_critical): Likewise.
1501 (cp_parser_omp_for_loop): Likewise.
1502 (cp_parser_omp_sections_scope): Likewise.
1503 (cp_parser_omp_declare_reduction_exprs): Likewise.
1504 Update for new param to cp_parser_required_error.
1505 (cp_parser_oacc_routine): Likewise.
1506 (cp_parser_transaction_expression): Likewise.
1507 (cp_parser_cilk_simd_vectorlength): Likewise.
1509 2017-08-09 Jason Merrill <jason@redhat.com>
1511 PR c++/81525 - wrong constant value with generic lambda
1512 * pt.c (tsubst_decl) [VAR_DECL]: Avoid clobbering auto.
1513 (tsubst_copy) [VAR_DECL]: Handle auto.
1515 PR c++/81359 - Unparsed NSDMI error from SFINAE context.
1516 * init.c (get_nsdmi): Add complain parm.
1517 * typeck2.c (digest_nsdmi_init): Add complain parm.
1518 (process_init_constructor_record): Pass complain to get_nsdmi.
1519 * pt.c (maybe_instantiate_noexcept): Add complain parm, return bool.
1520 * method.c (get_defaulted_eh_spec): Add complain parm. Pass it into
1521 synthesized_method_walk.
1522 (synthesized_method_walk): Adjust.
1523 (walk_field_subobs): Pass complain to get_nsdmi.
1524 (defaulted_late_check): Skip other checks if deleted.
1525 * decl2.c (mark_used): Pass complain to maybe_instantiate_noexcept.
1526 * call.c (build_aggr_conv): Pass complain to get_nsdmi.
1527 * parser.c (defarg_location): New.
1528 * error.c (location_of): Use it.
1530 2017-08-09 Marek Polacek <polacek@redhat.com>
1532 * parser.c (cp_parser_perform_range_for_lookup): Use false instead of 0.
1533 * typeck.c (build_binary_op): Change the type of a parameter to bool.
1534 (cp_truthvalue_conversion): Use true instead of 1.
1536 2017-08-08 Marek Polacek <polacek@redhat.com>
1539 * cp-gimplify.c (cp_fold): If folding exposed a branch of
1540 a COND_EXPR, convert it to the original type of the COND_EXPR, if
1543 2017-08-08 Martin Liska <mliska@suse.cz>
1545 * call.c: Include header files.
1546 * cp-gimplify.c: Likewise.
1547 * cp-ubsan.c: Likewise.
1550 * search.c: Likewise.
1551 * semantics.c: Likewise.
1552 * typeck.c: Likewise.
1554 2017-08-07 Martin Liska <mliska@suse.cz>
1556 * parser.c (cp_parser_gnu_attribute_list): Canonicalize name of an
1558 (cp_parser_std_attribute): Likewise.
1559 * tree.c: Add new include.
1561 2017-08-04 Paolo Carlini <paolo.carlini@oracle.com>
1564 * pt.c (do_class_deduction): Handle the case of no viable implicit
1565 deduction guides; simplify the code generating implicit deduction
1568 2017-08-03 Paolo Carlini <paolo.carlini@oracle.com>
1571 * typeck.c (build_x_unary_op): Avoid pretty-printing constructor /
1572 destructor as expressions.
1574 2017-08-02 Jakub Jelinek <jakub@redhat.com>
1577 * call.c (build_user_type_conversion_1): Only call
1578 lookup_fnfields_slot if totype is CLASS_TYPE_P.
1580 2017-07-31 Jason Merrill <jason@redhat.com>
1582 * decl.c (declare_global_var): Set DECL_CONTEXT.
1584 2017-07-31 Jan Hubicka <hubicka@ucw.cz>
1585 Martin Liska <mliska@suse.cz>
1587 * pt.c (tsubst_copy): Copy PREDICT_EXPR.
1588 * semantics.c (finish_goto_stmt): Build gimple predict
1590 * constexpr.c (potential_constant_expression_1): Handle
1593 2017-07-31 Martin Liska <mliska@suse.cz>
1596 * cp-gimplify.c (cp_genericize): Guard condition with flag_sanitize_p
1597 also with current_function_decl non-null equality.
1598 * cp-ubsan.c (cp_ubsan_instrument_vptr_p): Likewise.
1599 * decl.c (compute_array_index_type): Likewise.
1600 * init.c (finish_length_check): Likewise.
1601 * typeck.c (cp_build_binary_op): Likewise.
1603 2017-07-29 Jakub Jelinek <jakub@redhat.com>
1605 * cp-objcp-common.c (cp_decl_dwarf_attribute): Handle
1606 DW_AT_export_symbols.
1607 * name-lookup.c (emit_debug_info_using_namespace): Add IMPLICIT
1608 argument, pass it through to the debug hook.
1609 (finish_namespace_using_directive): Adjust
1610 emit_debug_info_using_namespace caller.
1611 (push_namespace): Likewise. Call it after setting
1612 DECL_NAMESPACE_INLINE_P.
1613 (cp_emit_debug_info_for_using): Pass false as new argument to
1614 the imported_module_or_decl debug hook.
1616 2017-07-28 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
1618 * lex.c (copy_decl): Adjust.
1619 (copy_type): Likewise.
1621 2017-07-26 Paolo Carlini <paolo.carlini@oracle.com>
1624 * lambda.c (add_capture): Early return if we cannot capture by
1627 2017-07-26 Jason Merrill <jason@redhat.com>
1629 P0702R1 - List deduction of vector.
1630 * pt.c (do_class_deduction): Special-case deduction from a single
1631 element of related type.
1633 2017-07-26 Leonid Koppel <lkoppel@uwaterloo.ca>
1635 PR c++/67054 - Inherited ctor with non-default-constructible members
1636 * method.c (walk_field_subobs) Consider member initializers (NSDMIs)
1637 when deducing an inheriting constructor.
1639 2017-07-21 Nathan Sidwell <nathan@acm.org>
1641 * search.c (lookup_conversion_operator): Return overloads.
1642 (lookup_fnfields_idx_nolazy): Absorb into ...
1643 (lookup_fnfields_slot_nolaxy): ... here.
1644 (lookup_fnfields_1): Absorb into ...
1645 (lookup_fnfields_slot): ... here.
1647 Remove special CDtor METHOD_VEC slots.
1648 * cp-tree.h (CLASSTYPE_CONSTRUCTOR_SLOT,
1649 CLASSTYPE_DESTRUCTOR_SLOT): Delete.
1650 (CLASSTYPE_CONSTRUCTORS): Use lookup_fnfields_slot_nolazy.
1651 (CLASSTYPE_DESTRUCTOR): Likewise.
1652 * class (add_method): Don't use special cdtor slots.
1653 * search.c (lookup_fnfields_idx_nolazy): Likewise.
1654 (look_for_overrides_here): Use lookup_fnfields_slot.
1655 * semantics (classtype_has_nothrow_assign_or_copy_p): Likewise.
1657 * call.c (add_candidates): Move decls to initialization. Don't
1660 2017-07-20 Nathan Sidwell <nathan@acm.org>
1662 Remove TYPE_METHODS.
1663 * class.c (maybe_warn_about_overly_private_class,
1664 finish_struct_methods, one_inheriting_sig, count_fields,
1665 add_fields_to_record_type, check_field_decls, check_methods,
1666 clone_function_decl, set_method_tm_attributes,
1667 finalize_literal_type_property, check_bases_and_members,
1668 create_vtable_ptr, determine_key_method,
1669 unreverse_member_declarations, finish_struct,
1670 add_vcall_offset_vtbl_entries_1): Member fns are on TYPE_FIELDS.
1671 * decl.c (fixup_anonymous_aggr): Likewise.
1672 * decl2.c (reset_type_linkage_2): Likewise.
1673 * method.c (after_nsdmi_defaulted_late_checks,
1674 lazily_declare_fn): Likewise.
1675 * optimize.c (maybe_thunk_body, maybe_clone_body): Likewise.
1676 * pt.c (instantiate_class_template_1, tsubst_expr,
1677 do_type_instantiation, instantiate_pending_templates): Likewise.
1678 * search.c (lookup_field_1): Likewise.
1679 * semantics.c (finish_member_declaration,
1680 finish_omp_declare_simd_methods): Likewise.
1682 2017-07-19 Nathan Sidwell <nathan@acm.org>
1684 * class.c (add_implicitly_declared_members): Use
1685 classtype_has_move_assign_or_move_ctor_p.
1686 (classtype_has_move_assign_or_move_ctor,
1687 classtype_has_user_move_assign_or_move_ctor_p): Merge into ...
1688 (classtype_has_move_assign_or_move_ctor_p): ... this new function.
1689 * cp-tree.h (classtype_has_user_move_assign_or_move_ctor_p):
1691 (classtype_has_move_assign_or_move_ctor_p): ... this.
1692 * method.c (maybe_explain_implicit_delete, lazily_declare_fn): Adjust.
1693 * tree.c (type_has_nontrivial_copy_init): Adjust.
1695 * cp-tree.h (PACK_EXPANSION_PARAMETER_PACKS,
1696 PACK_EXPANSION_EXTRA_ARGS): Use TYPE_{MIN,MAX}_VALUE_RAW.
1698 2017-07-18 Nathan Sidwell <nathan@acm.org>
1700 * cp-array-notation.c (build_array_notation_ref): Use
1701 TYPE_{MIN,MAX}_VALUE.
1703 * class.c (classtype_has_move_assign_or_move_ctor): Declare.
1704 (add_implicitly_declared_members): Use it.
1705 (type_has_move_constructor, type_has_move_assign): Merge into ...
1706 (classtype_has_move_assign_or_move_ctor): ... this new function.
1707 * cp-tree.h (type_has_move_constructor, type_has_move_assign): Delete.
1709 2017-07-17 Volker Reichelt <v.reichelt@netcologne.de>
1711 * parser.c (cp_parser_decl_specifier_seq): Add fix-it hints for
1712 friend outside class and obsolete auto as storage-class-specifier.
1714 2017-07-17 Nathan Sidwell <nathan@acm.org>
1716 * class.c (maybe_warn_about_overly_private_class): Ignore public
1719 * class.c (type_has_user_declared_move_constructor,
1720 type_has_user_declared_move_assign): Combine into ...
1721 (classtype_has_user_move_assign_or_move_ctor_p): ... this new function.
1722 * cp-tree.h (type_has_user_declared_move_constructor,
1723 type_has_user_declared_move_assign): Combine into ...
1724 (classtype_has_user_move_assign_or_move_ctor_p): ... this. Declare.
1725 * method.c (maybe_explain_implicit_delete): Use it.
1726 (lazily_declare_fn): Use it.
1727 * tree.c (type_has_nontrivial_copy_init): Use it.
1729 * semantics.c (classtype_has_nothrow_assign_or_copy_p): Clarify
1730 semantics, simplify implementation.
1732 2017-07-16 Volker Reichelt <v.reichelt@netcologne.de>
1734 * parser.c (cp_parser_cast_expression): Use %q#T instead of %qT
1735 in old-style cast diagnostic.
1736 * typeck.c (maybe_warn_about_useless_cast): Use %q#T instead of %qT
1737 in useless cast diagnostic.
1738 * error.c (type_to_string): Remove enum special handling.
1740 2017-07-14 David Malcolm <dmalcolm@redhat.com>
1742 * name-lookup.c (get_std_name_hint): Add '<' and '>' around
1744 (maybe_suggest_missing_header): Update for addition of '<' and '>'
1745 to above. Provide a fix-it hint.
1746 * pt.c: Include "gcc-rich-location.h"
1747 (listify): Attempt to add fix-it hint for missing
1748 #include <initializer_list>.
1749 * rtti.c: Include "gcc-rich-location.h".
1750 (typeid_ok_p): Attempt to add fix-it hint for missing
1751 #include <typeinfo>.
1753 2017-07-12 Jason Merrill <jason@redhat.com>
1755 P0512R0 - Deduction from an initializer list.
1756 * pt.c (do_class_deduction): Do list deduction in two phases.
1758 2017-07-12 Nathan Sidwell <nathan@acm.org>
1760 * cp-tree.h (DECL_CONSTRUCTOR_P, DECL_MAYBE_IN_CHARGE_CONSTRUCTOR,
1761 DECL_DESTRUCTOR_P, DECL_MAYBE_IN_CHARGE_DESTRCTOR): Look at
1763 * decl.c (grokfndecl): Set DECL_CXX_CONSTRUCTOR and
1764 DECL_CXX_DESTRUCTOR explicitly.
1765 * decl2.c (grokclassfn): Likewise.
1766 * friend.c (do_friend): Likewise.
1767 * method.c (make_thunk, make_alias_for,
1768 implicitly_declare_fn): Likewise.
1770 2017-07-11 Jason Merrill <jason@redhat.com>
1773 * decl.c (grokparms): Downgrade error about array of unknown bound
1774 to pedwarn and disable it for C++17.
1776 2017-07-11 Nathan Sidwell <nathan@acm.org>
1778 * decl2.c (reset_type_linkage_2): Dont't change ctor name.
1780 2017-07-10 Martin Sebor <msebor@redhat.com>
1782 * cp-tree.h (cp_operator_id, cp_assignment_operator_id): Document.
1784 2017-07-06 Jason Merrill <jason@redhat.com>
1786 PR c++/81204 - parse error with dependent template-name
1787 * parser.c (cp_parser_lookup_name): Revert previous change.
1789 2017-07-06 David Malcolm <dmalcolm@redhat.com>
1791 * cp-lang.c (LANG_HOOKS_RUN_LANG_SELFTESTS): Define as
1792 selftest::run_cp_tests.
1793 (selftest::run_cp_tests): New function.
1794 * cp-tree.h (selftest::run_cp_tests): New decl.
1796 2017-07-04 Jakub Jelinek <jakub@redhat.com>
1798 * parser.c (cp_parser_decomposition_declaration): Replace
1799 decomposition declaration with structured binding in diagnostics.
1800 * decl.c (cp_finish_decomp): Likewise.
1801 (grokdeclarator): Likewise.
1804 * parser.c (cp_parser_decomposition_declaration): Diagnose invalid
1805 forms of structured binding initializers.
1807 2017-07-03 Paolo Carlini <paolo.carlini@oracle.com>
1810 * decl.c (grokdeclarator): Move checks on function return type after
1811 the splice_late_return_type call; if declspecs->locations[ds_type_spec]
1812 is UNKNOWN_LOCATION fall back to input_location.
1814 2017-07-03 David Malcolm <dmalcolm@redhat.com>
1816 * parser.c (enum required_token): Fix spelling of
1817 RT_INTERATION to RT_ITERATION.
1818 (cp_parser_iteration_statement): Likewise.
1819 (cp_parser_required_error): Likewise.
1821 2017-06-30 Jason Merrill <jason@redhat.com>
1823 PR c++/81257 - ICE with invalid ::template.
1824 PR c++/54769 - wrong lookup of dependent template-name.
1825 * parser.c (cp_parser_template_name): Revert part of last change.
1827 2017-06-30 Nathan Sidwell <nathan@acm.org>
1829 * config-lang.in (gtfiles): Add cp/lex.c.
1830 * cp-tree.h (mangle_convop_name_for_type): Rename ...
1831 (make_conv_op_name): ... here. Move to lex.
1832 * lambda.c (maybe_add_lambda_conv_op): Update.
1833 * parser.c (cp_parser_conversion_function_id): Update.
1834 * pt.c (tsubst_decl, tsubst_baselink, tsubst_copy,
1835 tsubst_copy_and_build): Update.
1836 * semantics.c (apply_deduced_return_type): Update.
1837 * mangle.c (conv_type_hasher, conv_type_names,
1838 mangle_conv_op_name_for_type): Move to ...
1839 * lex.c (conv_type_hasher, conv_type_names, make_convop_name):
1842 2017-06-30 David Malcolm <dmalcolm@redhat.com>
1845 * parser.c (cp_parser_postfix_expression): Construct a location
1846 for typeid expressions.
1848 2017-06-30 Nathan Sidwell <nathan@acm.org>
1850 * cp-tree.h (lookup_fnfields_1, class_method_index_for_fn): Don't
1852 (lookup_all_conversions): Declare.
1853 * class.c (get_basefndecls): Use lookup_fnfields_slot.
1854 * decl.c (register_dtor_fn): Use lookup_fnfields_slot.
1855 * decl2.c (check_class_fn): Use lookup_fnfields_slot. Rework
1857 * pt.c (retrieve_specialization): Use lookup_fnfields_slot.
1858 (check_explicit_specialization): Use lookup_fnfields_slot_nolazy,
1859 lookup_all_conversions.
1860 * search.c (lookup_fnfields_1): Make static.
1861 (lookup_all_conversions): New.
1862 (class_method_index_for_fn): Delete.
1863 * semantics.c (classtype_has_nothrow_assign_or_copy_p): Use
1864 lookup_fnfields_slot.
1866 * call.c (build_new_method_call_1): Use constructo_name to get
1867 ctor name. Move argument processing earlier to merge cdtor
1869 * decl.c (grokfndecl): Cdtors have special names.
1870 * method.c (implicitly_declare_fn): Likewise. Simplify flag setting.
1871 * pt.c (check_explicit_specialization): Cdtor name is already
1873 * search.c (class_method_index_for_fn): Likewise.
1876 * name-lookup.c (do_pushdecl): Reset IDENTIFIER_TYPE when finding
1877 a matching TYPE_DECL.
1879 2017-06-29 Paolo Carlini <paolo.carlini@oracle.com>
1881 * class.c (add_method): Change pair of errors to error + inform.
1882 (handle_using_decl): Likewise.
1884 2017-06-29 Jason Merrill <jason@redhat.com>
1886 * constexpr.c, error.c, tree.c: Remove WITH_CLEANUP_EXPR handling.
1888 PR c++/81180 - ICE with C++17 deduction of member class template.
1889 * pt.c (build_deduction_guide): Correct member template handling.
1891 PR c++/81188 - matching decltype of member function call.
1892 * tree.c (cp_tree_equal): Remove COMPONENT_REF special case.
1894 2017-06-29 Nathan Sidwell <nathan@acm.org>
1897 * parser.c (cp_parser_namespace_definition): Immediately close the
1898 namespace if there's no open-brace.
1899 * name-lookup.c (do_pushdecl): Reset OLD when pushing into new
1902 2017-06-29 Jason Merrill <jason@redhat.com>
1904 PR c++/81164 - ICE with invalid inherited constructor.
1905 * search.c (binfo_direct_p): New.
1906 * name-lookup.c (do_class_using_decl): Use it.
1908 2017-06-29 Nathan Sidwell <nathan@acm.org>
1910 * cp-tree.h (THIS_NAME, IN_CHARGE_NAME, VTBL_PTR_TYPE,
1911 VTABLE_DELTA_NAME, VTABLE_PFN_NAME): Delete.
1912 * decl.c (initialize_predefined_identifiers): Name cdtor special
1913 names consistently. Use literals for above deleted defines.
1914 (cxx_init_decl_processing): Use literal for vtbl_ptr_type name,
1916 * lex.c (maybe_add_lang_type_raw): Exit early, rather than use a
1919 * call.c (check_dtor_name): Use constructor_name for enums too.
1920 (build_new_method_call_1): Use constructor_name for cdtors and
1922 * class.c (build_self_reference): Use TYPE_NAME to get name of
1924 * name-lookup (constructor_name): Use DECL_NAME directly.
1925 (constructor_name_p): Reimplement.
1926 (push_class_level_binding_1): Use TYPE_NAME directly.
1928 * class.c (finish_struct): Use OVL_P.
1929 (get_vfield_name): Measure constructor_name length.
1930 * cp-tree.h (SET_CLASS_TYPE_P): Add RECORD_OR_UNION_CHECK.
1931 (NON_UNION_CLASS_TYPE_P): Check RECORD_TYPE up front.
1932 * cxx-pretty-print.c (is_destructor_name): Delete.
1933 (pp_cxx_unqualified_id): Remove bogus destructor name checking.
1934 * decl.c (grokfndecl): Move cheap checks first when looking for
1935 implicit extern cness.
1937 * parser.c (cp_parser_direct_declarator): Reorder if to avoid
1938 indentation. Remove unnecessary assignment of constructor name.
1940 Whitespace cleanups.
1941 * call.c (name_as_c_string): Move CONST_CAST to return.
1942 (build_new_method_call_1): Remove unneeded bracing.
1943 * class.c (include_empty_classes): Unbreak line.
1944 * constraint.cc (tsubst_check_constraint): Add space.
1945 * cp-tree.h (lang_decl_ns): Add comment.
1946 (PTRMEM_CST_MEMBER): Break line.
1947 * decl.c (grokfndecl): Add blank lines. Unbreak some others.
1948 (grokdeclarator): Remove lines, move declaration to first use.
1949 * decl2.c (decl_needed_p): Fix indentation.
1950 (c_parse_final_cleanups): Remove blank line.
1951 * method.c (implicitly_declare_fn): Move declaration to first use.
1952 * search.c (current_scope): Add blank lines.
1954 2017-06-28 Jason Merrill <jason@redhat.com>
1956 PR c++/72764 - ICE with invalid template typename.
1957 * decl.c (build_typename_type): No longer static.
1958 * tree.c (strip_typedefs): Use it instead of make_typename_type.
1960 PR c++/69300 - ICE with self-referential noexcept
1961 * pt.c (maybe_instantiate_noexcept): Check for recursion.
1963 PR c++/61022 - error with variadic template template parm
1964 * pt.c (convert_template_argument): Keep the TYPE_PACK_EXPANSION.
1966 PR c++/72801 - ICE with variadic partial specialization
1967 * pt.c (unify_pack_expansion): Use PACK_EXPANSION_EXTRA_ARGS.
1969 PR c++/55639 - partial specialization with ::template
1970 * parser.c (cp_parser_class_head): Handle ::template.
1972 PR c++/45976 - error with ::template in declarator.
1973 * pt.c (resolve_typename_type): Fix TEMPLATE_ID_EXPR handling.
1975 PR c++/54769 - wrong lookup of dependent template-name.
1976 * parser.c (cp_parser_template_name): Handle dependent object type.
1977 (cp_parser_nested_name_specifier_opt): Make template_keyword_p a
1979 (cp_parser_id_expression): Pass it.
1980 (cp_parser_diagnose_invalid_type_name): Handle TEMPLATE_ID_EXPR.
1982 * parser.c (cp_parser_template_id): Use the range location on the
1985 PR c++/81204 - parse error with dependent template-name
1986 * parser.c (cp_parser_lookup_name): Disqualify function templates
1989 2017-06-27 Nathan Sidwell <nathan@acm.org>
1991 * pt.c (tsubst_decl <FUNCTION_DECL>): Move var decls to
1992 initialization point. Don't unnecessarily check for ctor name.
1994 * cp-tree.h (CLASSTYPE_DESTRUCTORS): Rename to ...
1995 (CLASSTYPE_DESTRUCTOR): ... this.
1996 * class.c (accessible_nvdtor_p,
1997 maybe_warn_about_overly_private_class,
1998 add_implicitly_declared_members,
1999 clone_constructors_and_destructors, type_has_virtual_destructor):
2000 Adjust for CLASSTYPE_DESTRUCTOR.
2001 (deduce_noexcept_on_destructors): Absorb into ...
2002 (check_bases_and_members): ... here.
2003 * except.c (dtor_nothrow): Adjust for CLASSTYPE_DESTRUCTOR.
2004 * init.c (build_delete): Likewise.
2005 * parser.c (cp_parser_lookup_name): Likewise.
2006 * pt.c (check_explicit_specialization): Likewise.
2007 * rtti.c (emit_support_tinfos): Likewise.
2008 * search.c (lookup_fnfields_idx_nolazy): Likewise.
2010 Kill IDENTIFIER_TEMPLATE.
2011 * cp-tree.h (lang_identifier): Remove class_template_info field.
2012 (IDENTIFIER_TEMPLATE): Delete.
2013 * name-lookup.c (constructor_name_full): Subsume into ...
2014 (constructor_name): ... here. Don't check IDENTIFIER_TEMPLATE.
2015 (constructor_name_p): Likewise.
2016 * mangle.c (write_source_name): Likewise.
2017 * ptree.c (cxx_print_identifier): Likewise.
2019 2017-06-27 Marek Polacek <polacek@redhat.com>
2022 * parser.c (cp_parser_already_scoped_statement): Initialize
2025 2017-06-26 Jason Merrill <jason@redhat.com>
2027 PR c++/81215 - deduction failure with variadic TTP.
2028 * pt.c (unify_bound_ttp_args): Restore old logic for C++14 and down.
2030 2017-06-26 Martin Sebor <msebor@redhat.com>
2033 * call.c (maybe_warn_class_memaccess): Preserve explicit conversions
2034 to detect casting away cv-qualifiers.
2036 2017-06-26 Nathan Sidwell <nathan@acm.org>
2038 * cp-tree.h (lang_decl_fn): Remove assignment_operator_p field.
2039 (DECL_COMPLETE_CONSTRUCTOR_P): Directly compare
2041 (DECL_BASE_CONSTRUCTOR_P, DECL_COMPLETE_DESTRUCTOR_P,
2042 DECL_BASE_DESTRUCTOR_P, DECL_DELETING_DESTRUCTOR_P): Likewise.
2043 (DECL_ASSIGNMENT_OPERATOR_P): Use IDENTIFIER_ASSIGN_OP_P.
2044 * decl.c (grok_op_properties): Adjust identifier checking.
2045 * init.c (expand_default_init): Adjust identifier descision.
2046 * method.c (implicitly_declare_fn): Don't use
2047 DECL_ASSIGNMENT_OPERATOR_P.
2048 * search.c (lookup_fnfields_1): Use IDENTIFIER_CTOR_P,
2050 * call.c (in_charge_arg_for_name): Reimplement.
2051 (build_special_member_call): Use IDENTIFIER_CDTOR_P,
2054 2017-06-26 Marek Polacek <polacek@redhat.com>
2057 * parser.c (cp_parser_statement): Add a default argument. Save the
2058 location of the expression-statement after labels have been parsed.
2059 (cp_parser_implicitly_scoped_statement): Set the location of the
2060 body of the conditional after parsing all the labels. Call
2061 warn_for_multistatement_macros.
2062 (cp_parser_already_scoped_statement): Likewise.
2064 2017-06-24 Paolo Carlini <paolo.carlini@oracle.com>
2067 * parser.c (cp_parser_diagnose_invalid_type_name): Don't print
2068 'typename' in error messages about missing 'typename'.
2070 2017-06-23 Jason Merrill <jason@redhat.com>
2072 PR c++/79056 - C++17 ICE with invalid template syntax.
2073 * parser.c (cp_parser_simple_type_specifier): Don't assume that type
2075 (cp_parser_check_for_invalid_template_id): Handle TYPE_DECL.
2076 * pt.c (template_placeholder_p): New.
2077 * cp-tree.h: Declare it.
2079 2017-06-23 Marc Glisse <marc.glisse@inria.fr>
2081 * decl.c (duplicate_decls): Use builtin_structptr_types.
2083 2017-06-22 Nathan Sidwell <nathan@acm.org>
2085 Reorder IDENTIFIER flags
2087 * cp-tree.h (enum cp_identifier_kind): New.
2088 (IDENTIFIER_KIND_BIT_0, IDENTIFIER_KIND_BIT_1,
2089 IDENTIFIER_KIND_BIT_2): New.
2090 (IDENTIFIER_MARKED): Move to TREE_LANG_FLAG_4.
2091 (IDENTIFIER_VIRTUAL_P, IDENTIFIER_REPO_CHOSEN): Add IDENTIFIER_CHECK.
2092 (C_IS_RESERVED_WORD): Replace with ...
2093 (IDENTIFIER_KEYWORD_P): ... this.
2094 (IDENTIFIER_CTOR_OR_DTOR_P): Replace with ...
2095 (IDENTIFIER_CDTOR_P): ... this.
2096 (IDENTIFIER_CTOR_P, IDENTIFIER_DTOR_P): New.
2097 (IDENTIFIER_OPNAME_P): Replace with ...
2098 (IDENTIFIER_ANY_OP_P): ... this.
2099 (IDENTIFIER_ASSIGN_OP_P): New.
2100 (IDENTIFIER_TYPENAME_P): Replace with ...
2101 (IDENTIFIER_CONV_OP_P): ... this.
2102 (NEW_DELETE_OPNAME_P): Replace with ...
2103 (IDENTIFIER_NEWDEL_OP_P): ... this.
2104 (DECL_CONV_FN_P, DECL_OVERLOADED_OPERATOR_P): Adjust.
2105 (get_identifier_kind_name, set_identifier_kind): Declare.
2106 * lex.c (get_identifier_kind_name, set_identifier_kind): New.
2107 (init_operators): Adjust to avoid keywords, use
2108 set_identifier_kind. Copy TYPE_EXPR slot.
2109 (init_reswords): Call set_identifier_kind.
2110 (unqualified_name_lookup_error): Adjust.
2111 * operators.def (TYPE_EXPR): Remove.
2112 * decl.c (struct predefined_identifier): Move into ...
2113 (initialize_predefined_identifiers): ... here. Call
2114 set_identifier_kind.
2115 (grokfndecl, check_var_type, grokdeclarator): Adjust.
2116 (grok_op_properties): Use IDENTIFIER_ANY_ASSIGN_OP to halve search
2118 * call.c (name_as_c_string): Adjust.
2119 (build_new_method_call_1): Likewise.
2120 * cp-cilkplus.c (is_conversion_operator_function_decl_p): Likewise.
2121 * cxx-pretty-print.c (pp_cxx_unqualified_id): Adjust.
2122 * dump.c (cp_dump_tree): Adjust.
2123 * error.c (dump_decl_name): Adjust.
2124 * mangle.c (write_unqualified_id, write_member_name,
2125 write_expression): Adjust.
2126 (mangle_conv_op_name_for_type): Use set_identifier_kind.
2127 * name-lookup.c (do_class_using_decl): Adjust.
2128 (lookup_name_fuzzy, lookup_name_real_1): Likewise.
2129 * parser.c (cp_lexer_get_preprocessor_token,
2130 cp_parser_direct_declarator): Likewise.
2131 * pt.c (push_template_decl_real, tsubst_decl, tsubst_baselink,
2132 tsubst_copy, tsubst_copy_and_build): Adjust.
2133 * ptree.c (cxx_print_identifier): Print identifier kind.
2134 * search.c (lookup_field_r, lookup_member,
2135 lookup_fnfields_idx_nolazy): Adjust.
2136 * semantics.c (finish_id_expression): Adjust..
2137 * typeck.c (cp_build_addr_expr_1): Adjust.
2139 2017-06-21 Jakub Jelinek <jakub@redhat.com>
2142 * semantics.c (handle_omp_array_sections_1, finish_omp_clauses):
2143 Complain about t not being a variable if t is OVERLOAD even
2144 when processing_template_decl.
2146 2017-06-21 David Malcolm <dmalcolm@redhat.com>
2148 * parser.c (get_cast_suggestion): New function.
2149 (maybe_add_cast_fixit): New function.
2150 (cp_parser_cast_expression): Capture the location of the closing
2151 parenthesis. Call maybe_add_cast_fixit when emitting warnings
2152 about old-style casts.
2154 2017-06-20 Jason Merrill <jason@redhat.com>
2156 PR c++/80972 - C++17 ICE with attribute packed.
2157 * call.c (build_over_call): Allow a TARGET_EXPR from reference
2160 2017-06-20 Nathan Sidwell <nathan@acm.org>
2162 * cp-tree.h (CPTI_NELTS_IDENTIFIER): Delete.
2163 (nelts_identifier): Delete.
2164 * decl.c (initialize_predefined_identifiers): Remove nelts.
2166 PR c++/67074 - namespace aliases
2167 * decl.c (duplicate_decls): Don't error here on mismatched
2169 * name-lookup.c (name_lookup::add_value): Matching namespaces are
2171 (diagnose_name_conflict): Namespaces are never redeclarations.
2172 (update_binding): An alias can match a real namespace.
2174 2017-06-19 Jason Merrill <jason@redhat.com>
2176 PR c++/80562 - ICE with constexpr if.
2177 * semantics.c (finish_if_stmt_cond): Call
2178 instantiate_non_dependent_expr.
2180 PR c++/80829 - ICE with constexpr copy of base subobject.
2181 * constexpr.c (clear_no_implicit_zero): New.
2182 (cxx_eval_call_expression): Call it.
2184 2017-06-19 Nathan Sidwell <nathan@acm.org>
2188 * name-lookup.c (set_decl_namespace): Don't follow using
2189 directives and ignore using decls. Only check overly-explicit
2190 scope after discovering decl.
2192 2017-06-19 Jason Merrill <jason@redhat.com>
2194 PR c++/81073 - constexpr and static var in statement-expression.
2195 * typeck2.c (store_init_value): Always call
2196 require_potential_constant_expression.
2197 * pt.c (convert_nontype_argument): Likewise.
2198 * constexpr.c (potential_constant_expression_1): Adjust message.
2199 Use decl_maybe_constant_var_p instead of decl_constant_var_p.
2200 * decl2.c (decl_maybe_constant_var_p): Consider initializer.
2202 2017-06-19 Nathan Sidwell <nathan@acm.org>
2204 * pt.c (coerce_template_parms): Fix indentation.
2205 (tsubst_decl): Remove repeated SET_DECL_RTL. Move VAR_P handling
2209 * name-lookup.c (update_binding): Only warn about constructors
2210 hidden by functions.
2212 2017-06-17 Jason Merrill <jason@redhat.com>
2214 PR c++/60063 - -Wunused-local-typedefs and templates.
2215 * decl2.c (is_late_template_attribute): Return false for "used".
2217 PR c++/70844 - -Wuseless-cast and inheriting constructor.
2218 * method.c (forward_parm): Suppress warn_useless_cast.
2220 2017-06-16 Jason Merrill <jason@redhat.com>
2222 PR c++/81045 - Wrong type-dependence with auto return type.
2223 * pt.c (type_dependent_expression_p): An undeduced auto outside the
2224 template isn't dependent.
2225 * call.c (build_over_call): Instantiate undeduced auto even in a
2228 PR c++/80465 - ICE with generic lambda with noexcept-specifier.
2229 * lambda.c (maybe_add_lambda_conv_op): Keep processing_template_decl
2230 set longer for a generic lambda.
2232 PR c++/80614 - Wrong mangling for C++17 noexcept type
2233 * mangle.c (write_type): Put the eh spec back on the function type.
2235 PR c++/81102 - Wrong error with partial specialization.
2236 * pt.c (unify) [TEMPLATE_PARM_INDEX]: Strip reference when comparing
2237 types. Do type deduction later.
2239 PR c++/81074 - ICE with partial specialization of member template.
2241 * pt.c (get_partial_spec_bindings): Only coerce innermost args.
2243 PR c++/80831 - ICE with -fsyntax-only.
2244 * decl2.c (c_parse_final_cleanups): Use cgraph_node::get_create.
2246 PR c++/80639 - ICE with invalid PMF initialization.
2247 PR c++/80043 - ICE with -fpermissive
2248 * typeck.c (convert_for_assignment): Recurse when instantiate_type
2249 returns without an error.
2251 2017-06-16 Nathan Sidwell <nathan@acm.org>
2253 * pt.c (tsubst_baselink): Fix & clarify formatting.
2255 * cp-tree.h (build_this_parm, cp_build_parm_decl,
2256 build_artificial_parm): Add FN parm.
2257 * decl.c (start_cleanup_fn): Adjust.
2258 (build_this_parm): Add FN parm, pass it through.
2259 (grokfndecl): Adjust parm building.
2260 * decl2.c (cp_build_parm_decl): Add FN parm, set context.
2261 (build_artificial_parm): Add FN parm, pass through.
2262 (maybe_retrofit_in_chrg): Adjust parm building.
2263 (start_static_storage_duration_function): Likwise.
2264 * lambda.c (maybe_aadd_lambda_conv_op): Likewise.
2265 * method.c (implicitly_declare_fn): Likewise.
2266 * parser.c (inject_this_parameter): Likewise.
2268 Symbol tables are insert only.
2269 * cp-tree.h (default_hash_traits <lang_identifier *>): Don't
2270 derive from pointer_hash. Make undeletable.
2272 * class.c (resort_type_method_vec): Avoid potential unsigned
2275 Don't defer noexcept_deferred_spec.
2276 * cp-tree.h (unevaluated_noexcept_spec): Don't declare.
2277 * decl.c (cxx_init_decl_processing): Initialize
2278 noexcept_deferred_spec.
2279 * except.c (unevaluated_noexcept_spec): Delete.
2280 * class.c (deduce_noexcept_on_destructor): Use
2281 noexcept_deferred_spec directly.
2282 * method.c (implicitly_declare_fn): Likewise.
2284 Make keyed_classes a vector.
2285 * cp-tree.h (CPTI_KEYED_CLASSES, keyed_classes): Delete.
2286 (keyed_classes): Declare as vector.
2287 * decl.c (keyed_classes): Define.
2288 (cxx_init_decl_processing): Allocate it.
2289 (record_key_method_defined): Use vec_safe_push.
2290 * class.c (finish_struct_1): Likewise.
2291 * pt.c (instantiate_class_template_1): Likewise.
2292 * decl2.c (c_parse_final_cleanups): Reverse iterate keyed_classes.
2295 * rtti.c (enum tinfo_kind): Add TK_DERIVED_TYPES,
2296 TK_VMI_CLASS_TYPES, TK_MAX. Delete TK_FIXED.
2298 (typeid_ok_p): Add quotes to error messages. Use get_tinfo_desc.
2299 (get_tinfo_decl): Use get_tinfo_desc.
2300 (get_pseudo_ti_init): Likewise. Adjust VMI construction.
2301 (create_pseudo_type_info): Delete.
2302 (get_pseudo_ti_index): Just determine the index.
2303 (get_tinfo_desc): New. Create all types lazily.
2304 (create_tinfo_types): Just allocate the descriptor array.
2305 (emit_support_tinfos): Use non-inserting type lookup. Set builtin
2308 2017-06-15 Martin Sebor <msebor@redhat.com>
2311 * call.c (first_non_public_field, maybe_warn_class_memaccess): New
2313 (has_trivial_copy_assign_p, has_trivial_copy_p): Ditto.
2314 (build_cxx_call): Call maybe_warn_class_memaccess.
2316 2017-06-14 Jakub Jelinek <jakub@redhat.com>
2318 * cp-gimplify.c (cp_genericize_r): Turn most of the function
2319 into a switch (TREE_CODE (stmt)) statement from long else if
2322 2017-06-13 Jakub Jelinek <jakub@redhat.com>
2325 * cp-gimplify.c (cp_genericize_r): Don't instrument MEM_REF second
2326 argument even if it has REFERENCE_TYPE.
2329 * cp-gimplify.c (cp_genericize): Only look for VAR_DECLs in
2330 BLOCK_VARS (outer) chain.
2331 (cxx_omp_const_qual_no_mutable): Likewise.
2333 2017-06-13 Martin Liska <mliska@suse.cz>
2336 * class.c (build_base_path): Use sanitize_flags_p.
2337 * cp-gimplify.c (cp_genericize_r): Likewise.
2338 (cp_genericize_tree): Likewise.
2339 (cp_genericize): Likewise.
2340 * cp-ubsan.c (cp_ubsan_instrument_vptr_p): Likewise.
2341 * decl.c (compute_array_index_type): Likewise.
2342 (start_preparsed_function): Likewise.
2343 * decl2.c (one_static_initialization_or_destruction): Likewise.
2344 * init.c (finish_length_check): Likewise.
2345 * lambda.c (maybe_add_lambda_conv_op): Likewise.
2346 * typeck.c (cp_build_binary_op): Likewise.
2347 (build_static_cast_1): Likewise.
2349 2017-06-11 Jason Merrill <jason@redhat.com>
2351 * error.c (dump_expr): Use is_this_parameter.
2353 * cp-tree.h, decl2.c, mangle.c, parser.c, pt.c, semantics.c: Use
2356 2017-06-09 Jason Merrill <jason@redhat.com>
2358 Missing bits from N4268, constant evaluation for all non-type args.
2359 * call.c (build_converted_constant_expr): Rename from
2360 build_integral_nontype_arg_conv, handle all types.
2361 * pt.c (convert_nontype_argument): In C++17 call it for all types.
2362 Move NOP stripping inside pointer case, don't strip ADDR_EXPR.
2363 * cvt.c (strip_fnptr_conv): Also strip conversions to the same type.
2365 Overhaul pointer-to-member conversion and template argument handling.
2366 * call.c (standard_conversion): Avoid creating ck_pmem when the
2367 class type is the same.
2368 * cvt.c (can_convert_qual): Split from
2369 perform_qualification_conversions.
2370 * constexpr.c (cxx_eval_constant_expression): Check it.
2371 * typeck.c (convert_ptrmem): Only cplus_expand_constant if
2372 adjustment is necessary.
2373 * pt.c (check_valid_ptrmem_cst_expr): Compare class types.
2374 (convert_nontype_argument): Avoid redundant error.
2376 * call.c (convert_like_real): Remove "inner" parameter.
2377 Don't replace a constant with its value.
2378 * cp-gimplify.c (cp_fully_fold): Use cp_fold_rvalue.
2380 * pt.c (convert_nontype_argument): Check NULLPTR_TYPE_P rather than
2383 * parser.c (cp_parser_constant_expression): Check
2384 potential_rvalue_constant_expression after decay_conversion.
2385 * pt.c (convert_nontype_argument): Don't require linkage in C++17.
2387 PR c++/80384 - ICE with dependent noexcept-specifier
2388 * pt.c (dependent_type_p_r) [FUNCTION_TYPE]: Check for dependent
2391 * constexpr.c (potential_constant_expression_1): Allow 'this' capture.
2393 2017-06-09 Jan Hubicka <hubicka@ucw.cz>
2395 * class.c (build_vtbl_initializer): Mark dvirt_fn as cold.
2396 * decl.c (cxx_init_decl_processing, push_throw_library_fn): Likewise.
2397 (excpet.c): Mark terminate as cold.
2399 2017-06-08 Jakub Jelinek <jakub@redhat.com>
2402 * semantics.c (handle_omp_array_sections_1): Convert TYPE_MAX_VALUE
2403 to sizetype before size_binop.
2406 * cp-gimplify.c (cxx_omp_finish_clause): When changing clause
2407 to OMP_CLAUSE_SHARED, also clear OMP_CLAUSE_SHARED_FIRSTPRIVATE
2408 and OMP_CLAUSE_SHARED_READONLY flags.
2410 2017-06-08 Jan Hubicka <hubicka@ucw.cz>
2412 * cp-tree.h (lang_check_failed): Annotate by ATTRIBUTE_COLD.
2414 2017-06-07 Nathan Sidwell <nathan@acm.org>
2416 * class.c (layout_class_type): Restructure overlong-bitfield tpe
2419 2017-06-07 Jonathan Wakely <jwakely@redhat.com>
2422 * pt.c (do_class_deduction): Build qualified type.
2424 2017-06-06 Nathan Sidwell <nathan@acm.org>
2426 * name-lookup.c (suggest_alternatives_for): Use qualified lookup
2427 sans using directives. Don't walk into inline namespaces.
2430 * name-lookup.c (adl_class_only): Don't add visible friends.
2432 2017-06-05 Volker Reichelt <v.reichelt@netcologne.de>
2434 * parser.c (cp_parser_base_specifier): Fix typos in error messages.
2436 2017-06-02 Nathan Sidwell <nathan@acm.org>
2438 Remove lang_type_ptrmem.
2439 * cp-tree.h (lang_type_header): Remove is_lang_type_class. Move
2441 (lang_type_class): ... this. Reorder bitfields. Rename to ...
2442 (lang_type): ... this. Delete old definition.
2443 (lang_type_ptrmem): Delete.
2444 (LANG_TYPE_CLASS_CHECK): Simply get TYPE_LANG_SPECIFIC. Adjust uses.
2445 (LANG_TYPE_PTRMEM_CHECK): Delete.
2446 (TYPE_GET_PTRMEMFUNC_TYPE, TYPE_SET_PTRMEMFUNC_TYPE): Delete.
2447 (TYPE_PTRMEMFUNC_TYPE): New. Use TYPE_LANG_SLOT_1.
2448 * decl.c (build_ptrmemfunc_type): Adjust.
2449 * lex.c (copy_lang_type): Remove lang_type_ptrmem handling.
2450 (maybe_add_lang_type_raw): Don't set u.c.h.is_lang_type_class.
2452 * class.c (check_bases_and_members): Adjust vec_new_uses_cookie
2455 Remove cp_binding_level::namespaces
2456 * name-lookup.h (cp_binding_level): Lose namespaces field.
2457 * name-lookup.c (add_decl_to_level): Chain namespaces on the names
2459 (suggest_alternatives_for): Adjust for namespace list. Do
2460 breadth-first search.
2461 * decl2.c (collect_source_refs): Namespaces are on the regulr
2463 (collect_ada_namespace): Likewise.
2465 2017-06-02 Bernd Edlinger <bernd.edlinger@hotmail.de>
2467 * typeck.c (cp_build_binary_op): Implement the -Wsizeof_pointer_div
2470 2017-06-01 Ville Voutilainen <ville.voutilainen@gmail.com>
2473 * method.c (constructible_expr): Strip array types before calling
2476 2017-06-01 Paolo Carlini <paolo.carlini@oracle.com>
2479 * cvt.c (convert_to_void): Possibly call maybe_warn_nodiscard
2480 for case INDIRECT_REF too in the main switch.
2482 2017-05-31 Jason Merrill <jason@redhat.com>
2484 PR c++/80840 - ICE with constexpr and reference
2485 * pt.c (convert_nontype_argument): Don't test whether a decl is
2486 value-dependent when binding to a reference.
2488 2017-05-31 Nathan Sidwell <nathan@acm.org>
2490 * cp-tree.h (lang_decl_slector): New enum.
2491 (lang_decl_base): Make selector an enum. Drop decomposition_p
2493 (lang_decl): Use enum for discrimination.
2494 (LANG_DECL_FN_CHECK, LANG_DECL_NS_CHECK, LANG_DECL_PARM_CHECK,
2495 LANG_DECL_DEOMP_CHECK): Use enum.
2496 (DECL_DECOMPOSITION_P): Use selector value.
2497 (SET_DECL_DECOMPOSITION_P): Delete.
2498 (retrofit_lang_decl): Lose SEL parm.
2499 (fit_decomposition_lang_decl): Declare.
2500 * decl.c (cp_finish_decomp, grokdeclarator): Use
2501 fit_decomposition_lang_decl.
2502 * lex.c (maybe_add_lang_decl_raw): New. Broken out of
2504 (set_decl_linkage): New. Broken out of retrofit_lang_decl. Use enum.
2505 (fit_decomposition_lang_decl): Likewise.
2506 (retrofit_lang_decl): Use worker functions.
2507 (cxx_dup_lang_specific_decl): Use selector enum.
2508 (maybe_add_lang_type_raw): New. Broken out of ...
2509 (cxx_make_type_name): ... here. Call it.
2511 2017-05-30 Jason Merrill <jason@redhat.com>
2513 PR c++/80856 - ICE with local extern in template
2514 * semantics.c (finish_call_expr): Replace a local extern overload
2515 set in a template with the IDENTIFIER_NODE.
2517 2017-05-30 David Malcolm <dmalcolm@redhat.com>
2519 * call.c (perform_implicit_conversion_flags): Convert
2520 "from %qT to %qT" to "from %qH to %qI" in diagnostic.
2521 (print_conversion_rejection): Replace pairs of %qT with
2522 %qH and %qI in various places.
2523 (build_user_type_conversion_1): Likewise.
2524 (build_integral_nontype_arg_conv): Likewise.
2525 (build_conditional_expr_1): Likewise.
2526 (convert_like_real): Likewise.
2527 (convert_arg_to_ellipsis): Likewise.
2529 (initialize_reference): Likewise.
2530 * cvt.c (cp_convert_to_pointer): Likewise.
2531 (cp_convert_to_pointer): Likewise.
2532 (convert_to_reference): Likewise.
2533 (ocp_convert): Likewise.
2534 * error.c (cp_printer): Gain bool and const char ** parameters.
2535 (struct deferred_printed_type): New struct.
2536 (class cxx_format_postprocessor): New class.
2537 (cxx_initialize_diagnostics): Wire up a cxx_format_postprocessor
2538 to pp->m_format_postprocessor.
2539 (comparable_template_types_p): New function.
2540 (newline_and_indent): New function.
2541 (arg_to_string): New function.
2542 (print_nonequal_arg): New function.
2543 (print_template_differences): New function.
2544 (type_to_string_with_compare): New function.
2545 (print_template_tree_comparison): New function.
2546 (append_formatted_chunk): New function.
2547 (add_quotes): New function.
2548 (cxx_format_postprocessor::handle): New function.
2549 (defer_phase_2_of_type_diff): New function.
2550 (cp_printer): Add "quoted" and "buffer_ptr" params. Implement
2552 * typeck.c (cp_build_binary_op): Replace pairs of %qT with
2553 %qH and %qI in various places.
2554 (convert_member_func_to_ptr): Likewise.
2555 (build_reinterpret_cast_1): Likewise.
2556 (convert_for_assignment): Likewise.
2557 * typeck2.c (check_narrowing): Likewise.
2559 2017-05-30 Nathan Sidwell <nathan@acm.org>
2561 Kill IDENTIFIER_NAMESPACE_BINDINGS
2562 * cp-tree.h (lang_identifier): Delete namespace_bindings.
2563 (IDENTIFIER_NAMESPACE_BINDINGS): Delete.
2564 (lang_decl_ns): Add bindings.
2565 (DECL_NAMESPACE_BINDINGS): New.
2566 * lex.c (retrofit_lang_decl): Create namespace hash table.
2567 * name-lookup.c (find_namespace_slot): Change to use hash-map.
2568 * ptree.c (cxx_print_binding): Delete.
2569 (cxx_print_identifier): Remove NAMESPACE_BINDING printing.
2571 * cp-tree.def (OVERLOAD): Fix comment.
2572 * cp-tree.h: Fix comments and whitespace.
2573 * error.c (dump_decl): Use pp_cxx_colon_colon, ovl_scope.
2574 * name-lookup.c (add_decl_to_level): Assert not class.
2575 (check_local_shadow): Use OVL_P.
2576 (pushdecl_with_scope_1): Rename to ...
2577 (do_pushdecl_with_Scope): ... here.
2578 (do_nonmember_using_decl): Use qualified_namespace_lookup return
2580 (push_class_level_binding_1): Use OVL_P.
2581 (pushdecl_namespace_level): Use do_pushdecl_with_scope.
2582 (pushtag_1): Rename to ...
2583 (do_pushtag): ... here. Adjust do_pushdecl_with_scope call.
2585 (store_class_bindings): Do not time here.
2586 * name-lookup.h (pushdecl_outermost_localscope): Reorder.
2587 * pt.c (listify): Declare argvec at point of initialization.
2590 * name-lookup.c (add_decl_to_level): Assert not making a circular
2592 (update_binding): Don't prematurely slide artificial decl.
2594 2017-05-29 Alexandre Oliva <aoliva@redhat.com>
2596 * cp-tree.h (lang_identifier): Drop oracle_looked_up, unused.
2598 2017-05-29 Nathan Sidwell <nathan@acm.org>
2600 PR c++/80891 (#1,#5)
2601 * cp-tree.h (lookup_maybe_add): Add DEDUPING argument.
2602 * name-lookup.c (name_lookup): Add deduping field.
2603 (name_lookup::preserve_state, name_lookup::restore_state): Deal
2605 (name_lookup::add_overload): New.
2606 (name_lookup::add_value, name_lookup::add_fns): Call add_overload.
2607 (name_lookup::search_adl): Set deduping. Don't unmark here.
2608 * pt.c (most_specialized_instantiation): Revert previous change,
2609 Assert not given duplicates.
2610 * tree.c (lookup_mark): Just mark the underlying decls.
2611 (lookup_maybe_add): Dedup using marked decls.
2614 * ptree.c (cxx_print_xnode): Show internal OVERLOAD structure.
2615 * tree.c (ovl_insert, ovl_iterator_remove_node): Fix copying assert.
2617 Stat hack representation
2618 * name-lookup.c (STAT_HACK_P, STAT_TYPE, STAT_DECL,
2619 MAYBE_STAT_DECL, MAYBE_STAT_TYPE): New.
2621 (find_namespace_binding): Replace with ...
2622 (find_namespace_slot): ... this.
2623 (find_namespace_value): New.
2624 (name_lookup::search_namespace_only,
2625 name_lookup::adl_namespace_only): Adjust.
2626 (update_binding): Add SLOT parameter, adjust.
2627 (check_local_shadow): Use find_namespace_value.
2628 (set_local_extern_decl_linkage): Likewise.
2629 (do_pushdecl): Adjust for namespace slot.
2630 (push_local_binding): Assert not a namespace binding.
2631 (check_for_out_of_scope_variable): Use find_namespace_value.
2632 (set_identifier_type_value_with_scope): Likewise.
2633 (get_namespace_binding): Likewise.
2634 (set_namespace_binding): Delete.
2635 (set_global_binding): Directly update the binding.
2636 (finish_namespace_using_decl): Likewise.
2637 (lookup_type_scope_1): Use find_namespace_slot and update.
2638 (do_push_nested_namespace): Use find_namespace_value.
2641 * pt.c (most_specialized_instantiation): Cope with duplicate
2645 * cp-tree.h (build_min_nt_call_vec): Declare.
2646 * decl.c (build_offset_ref_call_from_tree): Call it.
2647 * parser.c (cp_parser_postfix_expression): Likewise.
2648 * pt.c (tsubst_copy_and_build): Likewise.
2649 * semantics.c (finish_call_expr): Likewise.
2650 * tree.c (build_min_nt_loc): Keep unresolved lookups.
2651 (build_min): Likewise.
2652 (build_min_non_dep): Likewise.
2653 (build_min_non_dep_call_vec): Likewise.
2654 (build_min_nt_call_vec): New.
2657 * tree.c (ovl_copy): Adjust assert, copy OVL_LOOKUP.
2659 (lookup_keep): Call it.
2661 2017-05-26 Nathan Sidwell <nathan@acm.org>
2664 * name-lookup.c (push_inline_namespaces): New.
2665 (push_namespace): Look inside inline namespaces.
2667 Inline and using namespace representation change.
2668 * cp-tree.h (struct lang_decl_ns): Delete ns_using. Add usings,
2670 (DECL_NAMESPACE_USING): Adjust.
2671 (DECL_NAMESPACE_INLINEES): New.
2672 * name-lookup.h (struct cp_binding_level): Change usings
2674 * name-lookup.c (name_lookup::do_queue_usings,
2675 name_lookup::queue_usings): Adjust.
2676 (name_lookup::search_namespace, name_lookup::search_usings,
2677 name_lookup::queue_namespace): Adjust.
2678 (name_lookup::adl_namespace_only): Adjust.
2679 (add_using_namespace, push_namespace): Push onto vector.
2680 (pop_namespace): Add timing logic.
2682 * call.c (build_operator_new_call): Do namelookup and ADL here.
2683 (build_new_op_1): Likewise.
2684 * name-lookup.h (lookup_function_nonclass): Delete declaration.
2685 (do_using_directive): Likewise.
2686 * name-lookup.c (set_namespace_binding, push_local_binding): Don't
2688 (struct scope_binding): Delete.
2689 (EMPTY_SCOPE_BINDING): Delete.
2690 (set_decl_namespace): Use OVL_P.
2691 (finish_local_using_decl): Lose unnecesary checks.
2692 (lookup_function_nonclass): Delete.
2693 (cp_emit_debug_info_for_using): Use MAYBE_BASELINK_P.
2695 * cp-tree.h (OVL_CHAIN): Check looking at OVERLOAD.
2696 (ovl_iterator): Add allow_inner field. Adjust ctor. Make
2698 (ovl_iterator::maybe_push, ovl_iterator::pop): New.
2699 (lkp_iterator): Add outer field. Adjust ctor.
2700 (lkp_iterator::operator++): New.
2701 (lookup_mark, lookup_maybe_add): Declare.
2702 * name-lookup.c (name_lookup): Delete fn_set member.
2703 (name_lookup::preserve_state, name_lookup::restore_state): Unmark
2705 (name_lookup::add_value): Use lookup_add directly.
2706 (name_lookup::add_fns: Use lookup_maybe_add.
2707 (name_lookup::search_adl): Mark and unmark fns.
2709 * pt.c (check_explicit_specialization): Use lookup_add directly.
2710 * ptree.c (cxx_print_xnode): Show complete overload structure.
2711 * tree.c (lookup_mark, lookup_maybe_add): New.
2713 * name-lookup.c (name_lookup::search_adl): ADL OMP UDR type args.
2715 2017-05-26 Jakub Jelinek <jakub@redhat.com>
2717 * cp-tree.h (struct lang_decl_decomp): New type.
2718 (struct lang_decl): Add u.decomp.
2719 (LANG_DECL_DECOMP_CHECK): Define.
2720 (DECL_DECOMPOSITION_P): Note it is set also on the vars
2721 for user identifiers.
2722 (DECL_DECOMP_BASE): Define.
2723 (retrofit_lang_decl): Add extra int = 0 argument.
2724 * lex.c (retrofit_lang_decl): Add SEL argument, if non-zero
2725 use it to influence the selector choices and for selector
2726 0 to non-zero transition copy old content.
2727 (cxx_dup_lang_specific_decl): Handle DECL_DECOMPOSITION_P.
2728 * decl.c (poplevel): For DECL_DECOMPOSITION_P, check
2729 !DECL_DECOMP_BASE instead of !DECL_VALUE_EXPR. Adjust warning
2730 wording if decl is a structured binding.
2731 (cp_finish_decomp): Pass 4 as the new argument to retrofit_lang_decl.
2732 Set DECL_DECOMP_BASE. Ignore DECL_READ_P sets from initialization
2733 of individual variables for tuple structured bindings.
2734 (grokdeclarator): Pass 4 as the new argument to retrofit_lang_decl.
2735 Clear DECL_DECOMP_BASE.
2736 * decl2.c (mark_used): Mark DECL_DECOMP_BASE TREE_USED as well.
2737 * pt.c (tsubst_decomp_names): Assert DECL_DECOMP_BASE matches what
2739 * expr.c (mark_exp_read): Recurse on DECL_DECOMP_BASE instead of
2742 2017-05-25 Jason Merrill <jason@redhat.com>
2744 PR c++/80605 - __is_standard_layout and zero-length array
2745 * class.c (check_bases): Use DECL_FIELD_IS_BASE.
2747 2017-05-25 Nathan Sidwell <nathan@acm.org>
2749 Kill OVL_CURRENT, OVL_NEXT.
2750 * cp-tree.h (OVL_CURRENT, OVL_NEXT): Delete.
2751 * name-lookup.c (set_decl_namespace): Use ovl_iterator.
2752 (consider_binding_level): Use OVL_FIRST.
2753 (cp_emit_debug_info_for_using): Use lkp_iterator.
2754 * pt.c (check_explicit_specialization): Use ovl_iterator.
2756 Kill DECL_NAMESPACE_USERS, DECL_NAMESPACE_ASSOCIATIONS.
2757 * cp-tree.h (lang_decl_ns): Remove ns_users field.
2758 (DECL_NAMESPACE_USERS, DECL_NAMESPACE_ASSOCIATIONS): Delete.
2759 (TREE_INDIRECT_USING): Delete.
2760 * name-lookup.h (is_associated_namespace): Delete.
2761 * name-lookup.c (name_lookup::search_usings,
2762 name_lookup::do_queue_usings): Usings are always direct.
2763 (is_associated_namespace): Delete.
2764 (handle_namespace_attrs): Use DECL_NAMESPACE_INLINE_P.
2765 (namespace_ancestor_1, namespace_ancestor): Delete.
2766 (push_using_directive_1, push_using_directive): Delete.
2767 (add_using_namespace_1): Delete.
2768 (add_using_namespace): Reimplement.
2769 (emit_debug_info_using_namespace): New.
2770 (finish_namespace_using_directive, finish_local_using_directive,
2771 push_namespace): Adjust.
2772 * tree.c (cp_free_lang_data): Remove DECL_NAMESPACE_USERS handling.
2774 2017-05-25 Volker Reichelt <v.reichelt@netcologne.de>
2776 * semantics.c (finish_handler_parms): Warn about non-reference type
2779 2017-05-25 Nathan Sidwell <nathan@acm.org>
2781 Reimplement unqualified namespace lookup.
2782 * name-lookup.c (name_lookup::using_pair,
2783 name_lookup::using_queue): New typedefs.
2784 (name_lookup::queue_namespace, name_lookup::do_queue_usings,
2785 name_lookup::queue_usings): New.
2786 (name_lookup::search_unqualified): New.
2787 (merge_functions, same_entity_p, ambiguous_decl,
2788 unqualified_namespace_lookup_1, unqualified_namespace_lookup,
2789 lookup_using_namespace): Delete.
2790 (lookup_name_real_1): Adjust.
2792 Reimplement qualified namespace lookup.
2793 * name-lookup.c (name_lookup::flags): New member. Adjust ctor.
2794 (name_lookup::ambiguous, name_lookup::add_value,
2795 name_lookup::add_type, name_lookup::process_binding): New.
2796 (name_lookup::search_namespace_only,
2797 name_lookup::search_namespace, name_lookup::search_usings): New.
2798 (name_lookup::search_qualified): New.
2799 (do_nonmember_using_decl, suggest_alternatives_for,
2800 lookup_qualified_name): Adjust.
2801 (tree_vec_contains): Delete.
2802 (qualified_lookup_using_namespace): Rename to ...
2803 (qualified_namespace_lookup): ... here. Reimplement.
2806 * cp-tree.h (LOOKUP_SEEN_P, LOOKUP_FOUND_P): New.
2807 * name-lookup.h (lookup_arg_dependent): Return plain tree.
2808 * name-lookup.c (arg_lookup, arg_assoc, arg_assoc_args,
2809 arg_assoc_args_vec, arg_assoc_type, add_function,
2810 arg_assoc_namespace, arg_assoc_class_only, arg_assoc_bases,
2811 arg_assoc_class, arg_assoc_template_arg, arg_assoc,
2812 lookup_arg_dependent_1): Delete.
2813 (name_lookup): New lookup object.
2814 (name_lookup::preserve_state, name_lookup::restore_state,
2815 name_lookup::mark_seen, name_lookup::find_and_mark,
2816 name_lookup::add_fns, name_lookup::adl_namespace_only,
2817 name_lookup::adl_namespace, name_lookup::adl_class_only,
2818 name_lookup::adl_bases, name_lookup::adl_class,
2819 name_lookup::adl_expr, name_lookup::adl_type,
2820 name_lookup::adl_template_arg, name_lookup::search_adl): New.
2821 (lookup_arg_dependent): Return a plain tree. Adjust.
2822 (is_associated_namespace): Move later.
2824 2017-05-24 Nathan Sidwell <nathan@acm.org>
2826 * friend.c (do_friend): Remove check for existing decl.
2827 * name-lookup.h (lookup_name_innermost_nonclass_level): Delete.
2828 * name-lookup.c (push_local_binding): Directly look for binding.
2829 (lookup_name_innermost_nonclass_level_1): Delete.
2830 (lookup_name_innermost_nonclass_level): Delete.
2832 * Make-lang.in (CXX_AND_OBJCXX_OBJS): Alphabetize.
2834 * cp-tree.h (cp_free_lang_data): Add extern.
2835 (ovl_skip_hidden, is_overloaded_fn, really_overloaded_fn): Add
2837 (type_unknown_p): Return bool, make inline, lose TREE_LIST check.
2838 * typeck.c (type_unknown_p): Delete.
2839 * tree.c (is_overloaded_fn): Use MAYBE_BASELINE_FUNCTIONS, adjust
2840 overload management.
2841 (dependent_name): Likewise.
2842 (decl_anon_ns_mem_p): Simplify.
2844 2017-05-24 Jonathan Wakely <jwakely@redhat.com>
2847 * tree.c (reshape_init): Use unqualified type for direct enum init.
2848 * typeck.c (maybe_warn_about_cast_ignoring_quals): New.
2849 (build_static_cast_1, build_reinterpret_cast_1): Strip cv-quals from
2850 non-class destination types.
2851 (build_const_cast_1): Strip cv-quals from destination types.
2852 (build_static_cast, build_reinterpret_cast, build_const_cast)
2853 (cp_build_c_cast): Add calls to maybe_warn_about_cast_ignoring_quals.
2855 2017-05-24 Martin Sebor <msebor@redhat.com>
2858 * call.c (fully_fold_internal): Adjust.
2860 2017-05-24 Nathan Sidwell <nathan@acm.org>
2862 * cp-tree.h (ovl_skip_hidden): Declare.
2863 * tree.c (ovl_skip_hidden): New.
2864 * name-lookup.c (arg_assoc_namespace): Call ovl_skip_hidden.
2865 (lookup_arg_dependent_1): Likewise.
2866 (ambiguous_decl): Use DECL_HIDDEN_P, ovl_skip_hidden.
2867 (hidden_name_p, remove_hidden_names): Delete.
2868 (lookup_name_real_1): Do not strip hidden names.
2869 * name-lookup.h (hidden_name_p, remove_hidden_names): Delete.
2871 * cp-tree.h (OVL_HIDDEN_P): New.
2872 (ovl_iterator::hidden_p, ovl_iterator::reveal_node): New.
2873 (ovl_iterator::reveal_node): Declare.
2874 * tree.c (ovl_copy): Copy OVL_HIDDEN_P.
2875 (ovl_insert): Order on hiddenness.
2876 (ovl_iterator::reveal_node): New.
2877 * name-lookup.c (anticipated_builtin_p): New.
2878 (supplement_binding_1): Use it.
2879 (set_local_extern_decl_linkage): Use hidden_p.
2880 (do_pushdecl): Deal with unhiding a hidden decl, use
2881 anticipated_builtin_p.
2882 (do_nonmember_using_decl): Use anticipated_decl_p.
2883 (lookup_name_real_1): Use DECL_HIDDEN_P.
2885 2017-05-23 Jason Merrill <jason@redhat.com>
2887 -Wunused and C++17 structured bindings
2888 * decl.c (poplevel): Don't warn about unused structured bindings,
2889 only real variables.
2890 * error.c (dump_simple_decl): Handle structured bindings.
2891 * expr.c (mark_exp_read): Look through DECL_VALUE_EXPR.
2893 2017-05-23 Nathan Sidwell <nathan@acm.org>
2895 * cp-tree.h (PUSH_GLOBAL, PUSH_LOCAL, PUSH_USING): Delete.
2896 * name-lookup.c (create_local_binding): New.
2897 (update_binding): New.
2898 (pushdecl_maybe_friend_1): Rename to ...
2899 (do_pushdecl): ... this. Reimplement.
2901 (push_overloaded_decl_1, push_overloaded_decl): Delete.
2903 2017-05-23 Jason Merrill <jason@redhat.com>
2905 PR c++/80396 - built-in for make_integer_sequence.
2906 * pt.c (builtin_pack_fn_p, builtin_pack_call_p)
2907 (expand_integer_pack, expand_builtin_pack_call): New.
2908 (find_parameter_packs_r): Check builtin_pack_call_p.
2909 (check_for_bare_parameter_packs): Handle it.
2910 (tsubst_pack_expansion): Call expand_builtin_pack_call.
2911 (declare_integer_pack): New.
2912 (init_template_processing): Call it.
2913 * decl2.c (mark_used): Check builtin_pack_fn_p.
2915 2017-05-23 Nathan Sidwell <nathan@acm.org>
2917 * name-lookup.c (find_namespace_binding): New.
2918 (pushdecl_maybe_friend_1): Use CP_DECL_CONTEXT.
2919 (set_identifier_type_value_with_scope): Use find_namespace_binding.
2920 (find_binding, cp_binding_level_find_binding_for_name,
2921 binding_for_name, namespace_binding_1): Delete.
2922 (push_overloaded_decl_1): Use CP_DECL_CONTEXT.
2923 (get_namespace_binding, set_namespace_binding,
2924 finish_namespace_using_decl, unqualified_namespace_lookup_1,
2925 qualified_lookup_using_namespace, lookup_type_scope_1,
2926 lookup_name_innermost_nonclass_level_1): Use find_namespace_binding.
2929 * parser.c (cp_parser_template_id): Keep the lookup when stashing
2932 * cp-tree.h (DECL_HIDDEN_P): New.
2933 * name-lookup.c (set_decl_context,
2934 set_local_extern_decl_linkage): New, broken out of ...
2935 (pushdecl_maybe_friend_1): ... here. Call them.
2937 2017-05-23 Thomas Schwinge <thomas@codesourcery.com>
2939 * parser.c (OACC_KERNELS_CLAUSE_MASK): Add
2940 "PRAGMA_OACC_CLAUSE_NUM_GANGS", "PRAGMA_OACC_CLAUSE_NUM_WORKERS",
2943 2017-05-23 Nathan Sidwell <nathan@acm.org>
2945 * cp-tree.h (OVL_P): New.
2946 * name-lookup.h (push_local_binding): Delete.
2947 (do_toplevel_using_decl, do_local_using_decl): Rename to ...
2948 (finish_namespace_using_decl, finish_local_using_decl): ... here
2949 * name-lookup.c (add_decl_to_level): Swap args.
2950 (pop_bindings_and_leave_scope): Look inside TREE_LIST.
2951 (diagnose_name_conflict): Check contexts are same for redecl.
2952 (update_local_overload): New.
2953 (compparms_for_decl_and_using): Rename to ...
2954 (matching_fn_p): ... here.
2955 (pushdecl_maybe_friend_1): Adjust add_decl_to_level,
2956 push_local_bindings call.
2957 (push_local_binding): Make static, replace FLAGS arg with
2959 (validate_nonmember_using_decl): Use OVL_FIRST.
2960 (do_nonmember_using_decl): Use in/out parameters. Use
2961 lkp_iterator and simplify.
2962 (do_toplevel_using_decl, do_local_using_decl): Rename to ...
2963 (finish_namespace_using_decl, finish_local_using_decl): ... here.
2965 (lookup_type_current_level): Delete.
2966 * parser.c (cp_parser_using_declaration): Adjust.
2967 * pt.c (tsubst_expr): Adjust.
2969 2017-05-22 Nathan Sidwell <nathan@acm.org>
2971 * name-lookup.h (parse_using_directive): Replace with ...
2972 (finish_namespace_using_directive): ... this and ...
2973 (finish_local_using_directive): ... this.
2974 * name-lookup.c (add_using_namespace_1): Move later.
2975 (add_using_namespace): Move later, add namespace_p arg, remove
2977 (push_using_directive_1): Directly recurse.
2978 (do_using_directive, parse_using_directive): Delete, split into ...
2979 (finish_namespace_using_directive): ... this and ...
2980 (finish_local_using_directive): ... this.
2981 (push_namespace): Use add_using_namespace.
2982 * parser.c (cp_parser_using_directive): Call
2983 finish_namespace_using_directive or finish_local_using_directive.
2984 * pt.c (tsubst_expr): Call finish_local_using_directive.
2986 * cp-objcp-common.c (cp_register_dumps): Register raw dumper.
2987 * cp-tree.h (raw_dump_id): Declare.
2988 * decl2.c (raw_dump_id): Define.
2989 (dump_tu): Use raw_dump_id.
2991 * config-lang.in (gtfiles): Sort list, break lines.
2993 * cp-tree.h (CPTI_TERMINATE, CPTI_CALL_UNEXPECTED): Rename to ...
2994 (CPTI_TERMINATE_FN, CPTI_CALL_UNEXPECTED_FN): ... here.
2995 ( CPTI_GET_EXCEPTION_PTR_FN, CPTI_BEGIN_CATCH_FN, CPTI_END_CATCH_FN,
2996 CPTI_ALLOCATE_EXCEPTION_FN, CPTI_FREE_EXCEPTION_FN, CPTI_THROW_FN,
2997 CPTI_RETHROW_FN): New.
2998 (noexcept_deferred_spec): New.
2999 (terminate_node, call_unexpected_node): Rename to ...
3000 (terminate_fn, call_unexpected_fn): ... here.
3001 (get_exception_ptr_fn, begin_catch_fn, end_catch_fn,
3002 allocate_exception_fn, free_exception_fn, throw_fn, rethrow_fn): New.
3003 * except.c (fn1..fn5, throw_fn, rethrow_rn, spec): Delete.
3004 (init_exception_processing): Adjust.
3005 (declare_library_fn): Create and push the fns here.
3006 (do_get_exception_ptr, do_begin_catch, do_end_catch,
3007 do_allocate_exception_ptr, do_free_exception_ptr): Adjust
3008 declare_library_fn use.
3009 (unevaluated_noexcept_spec): Adjust.
3010 * cp-gimplify.c (genericize_eh_spec_block,
3011 gimplify_most_not_throw_expr): Adjust.
3013 * name-lookup.c (pushdecl_top_level,
3014 pushdecl_top_level_and_finish): Move after namespace pushing and
3016 (push_to_top_level): Rename to ...
3017 (do_push_to_top_level): ... here. Remove timing code.
3018 (pop_from_top_level_1): Rename to ...
3019 (do_pop_from_top_level): ... here.
3020 (do_push_nested_namespace, do_pop_nested_namespace)
3021 (push_to_top_level): New wrapper for do_push_to_top_level.
3022 (pop_from_top_level): Adjust.
3023 (push_nested_namepace, pop_nested_namespace): Wrappers for workers.
3025 2017-05-19 Bernd Edlinger <bernd.edlinger@hotmail.de>
3027 * config-lang.in (gtfiles): Add c-family/c-format.c,
3028 except.c, init.c, lambda.c and friend.c.
3029 * class.c (dvirt_fn): Move out of function scope,
3031 * except.c (fn1-5, throw_fn, rethrow_fn, spec): Likewise.
3032 * init.c (fn): Likewise.
3033 * lambda.c (ptr_id, max_id): Likewise.
3034 * friend.c (global_friend): Add GTY attribute.
3036 2017-05-19 Nathan Sidwell <nathan@acm.org>
3038 * call.c (add_list_candidates): Use OVL_FIRST.
3039 (build_new_method_call_1): Likewise.
3040 * cp-tree.h (OVL_SINGLE_P): New.
3041 (TYPE_HIDDEN_P): New.
3042 * decl.c (xref_tag_1): Use TYPE_HIDDEN_P.
3043 * dump.c (cp_tump_tree): Adjust overload dumping.
3044 * error.c (dump_decl): Use OVL_SINGLE_P, simplify context
3046 * method.c (lazily_declare_fn): Assert we added it.
3047 * parser.c (cp_parser_nested_name_specifier): Use OVL_SINGLE_P,
3049 (cp_parser_template_name): Use lkp_iterator.
3050 * pt.c (begin_template_parm_list): Fixup comment.
3051 (instantiate_class_template_1): Use TYPE_HIDDEN_P.
3052 * tree.c (ovl_iterator::remove_node): Cope with inherited ctors.
3053 (ovl_scope): Use lkp_iterator.
3055 2017-05-19 Thomas Schwinge <thomas@codesourcery.com>
3057 * parser.c (cp_parser_omp_clause_default): Handle
3058 "OMP_CLAUSE_DEFAULT_PRESENT".
3060 * parser.c (cp_parser_omp_clause_default): Avoid printing more
3061 than one syntax error message.
3063 2017-05-19 Nathan Sidwell <nathan@acm.org>
3065 * class.c (class_dump_id): Define.
3066 (dump_class_hierarchy, dump_vtable, dump_vtt): Use it.
3067 * cp-objcp-common.c (cp_register_dumps): New.
3068 * cp-objcp-common.h (cp_register_dumps): Declare.
3069 (LANG_HOOKS_REGISTER_DUMPS): Override.
3070 * cp-tree.h (class_dump_id): Declare.
3072 2017-05-18 Nathan Sidwell <nathan@acm.org>
3074 * cp-tree.h (OVL_ARG_DEPENDENT): Delete.
3076 (lookup_keep): Declare.
3077 * name-lookup.c (add_function): Don't set OVL_ARG_DEPENDENT.
3078 * pt.c (tsubst_copy): Assert lookup is persistent.
3079 * semantics.c (finish_call_expr): Use lkp_iterator, call
3081 * tree.c (ovl_copy): New.
3082 (ovl_insert, ovl_iterator::remove_node): Copy immutable nodes.
3085 * cp-tree.h (OVL_USED): Replace with ...
3086 (OVL_USING_P): ... this.
3087 (ovl_iterator::using_p): Adjust.
3088 * name-lookup.c (push_overloaded_decl_1,
3089 do_nonmember_using_decl): Adjust.
3090 * search.c (lookup_field_r): Adjust.
3091 * tree.c (ovl_insert, ovl_scope): Adjust.
3093 * cp-tree.h (lookup_add): Swap args.
3094 (ovl_cons, build_overload): Delete.
3095 * name-lookup.c (add_function, push_overloaded_decl_1,
3096 do_nonmember_using_decl, merge_functions, remove_hidden_names):
3097 Use lookup_add, ovl_insert.
3098 * pt.c (check_explicit_specialization): Use lookup_add.
3099 (do_class_deduction): Likewise. Refactor if.
3100 * tree.c (lookup_add): Swap args.
3101 (ovl_cons, build_overload): Delete.
3103 * name-lookup.c (find_local_binding): New, broken out of ...
3104 (lookup_name_innermost_nonclass_level_1): ... here. Call it.
3105 (set_namespace_binding): Swap scope & name args.
3106 (namespace_binding_1): Likewise.
3107 (pushdecl_maybe_friend_1): Adjust set_namespace_binding call.
3108 (push_overloaded_decl_1): Likewise.
3109 (set_global_binding): Likewise.
3110 (get_namespace_binding): Adjust namespace_binding_1 call.
3112 2017-05-17 Nathan Sidwell <nathan@acm.org>
3114 * cp-tree.h (default_hash_traits <lang_identifier *>): New
3116 * name-lookup.c (lookup_extern_c_fun_in_all_ns): Delete.
3117 (extern_c_fns): New hash table.
3118 (check_extern_c_conflict): New, broken out of ...
3119 (pushdecl_maybe_friend_1): ... here. Call it.
3120 (c_linkage_bindings): Just look in hash table.
3122 2017-05-17 Ville Voutilainen <ville.voutilainen@gmail.com>
3126 Implement new C++ intrinsics __is_assignable and __is_constructible.
3127 * cp-tree.h (CPTK_IS_ASSIGNABLE, CPTK_IS_CONSTRUCTIBLE): New.
3129 * cxx-pretty-print.c (pp_cxx_trait_expression): Handle
3130 CPTK_IS_ASSIGNABLE and CPTK_IS_CONSTRUCTIBLE.
3131 * method.c (constructible_expr): Set cp_unevaluated.
3132 (is_xible_helper): New.
3133 (is_trivially_xible): Adjust.
3135 * parser.c (cp_parser_primary_expression): Handle
3136 RID_IS_ASSIGNABLE and RID_IS_CONSTRUCTIBLE.
3137 (cp_parser_trait_expr): Likewise.
3138 * semantics.c (trait_expr_value): Handle
3139 CPTK_IS_ASSIGNABLE and CPTK_IS_CONSTRUCTIBLE.
3141 2017-05-17 Nathan Sidwell <nathan@acm.org>
3143 * cp-tree.h (ovl_iterator::using_p): New predicate.
3144 (ovl_iterator::remove_node): New worker.
3145 (ovl_insert): Declare.
3146 * tree.c (ovl_insert): New.
3147 (ovl_iterator::remove_node): New.
3148 * class.c (add_method): Use ovl_iterator, ovl_insert.
3149 (clone_function_decl): Fix description.
3150 (clone_constructors_and_destructors): Use ovl_iterator.
3152 * class.c (handle_using_decl): Use OVL_FIRST, ovl_iterator.
3153 (maybe_warn_about_overly_private_class): Use ovl_iterator.
3154 (method_name_cmp, resort_method_name_cmp): Use OVL_NAME.
3155 (resort_type_method_vec, finish_struct_methods): Use OVL_FIRST.
3156 (get_base_fndecls): Use ovl_iterator.
3157 (warn_hidden): Use OVL_NAME, ovl_iterator.
3158 (add_implicitly_declared_members): Use ovl_iterator.
3159 * constraint.cc (normalize_template_id_expression): Use OVL_FIRST,
3161 (finish_shorthand_constraint): Simplify, use ovl_make.
3162 * pt.c (make_constrained_auto): Simplify. Use ovl_make.
3163 * search.c (shared_member_p): Use ovl_iterator.
3164 (lookup_field_fuzzy_info::fuzzy_lookup_fn): Use OVL_NAME.
3165 (lookup_conversion_operator): Use OVL_FIRST.
3166 (lookup_fnfiels_idx_nolazy): Use OVL_FIRST, OVL_NAME.
3167 (look_for_overrides_here): Use ovl_iterator.
3168 (lookup_conversions_r): Use OVL_FIRST, OVL_NAME, ovl_iterator.
3169 * typeck.c (build_x_unary_op): Use ovl_make.
3171 2017-05-17 Martin Liska <mliska@suse.cz>
3173 * class.c (dump_class_hierarchy): Introduce dump_flags_t type and
3174 use it instead of int type.
3175 (dump_vtable): Likewise.
3176 (dump_vtt): Likewise.
3177 * decl2.c (dump_tu): Likewise.
3179 2017-05-16 David Malcolm <dmalcolm@redhat.com>
3181 * call.c (enforce_access): Add access_failure_info * param and use
3182 it to record access failures.
3183 * cp-tree.h (class access_failure_info): New class.
3184 (enforce_access): Add access_failure_info * param, defaulting to
3186 (lookup_member): Likewise.
3187 (locate_field_accessor): New function decl.
3188 (perform_or_defer_access_check): Add access_failure_info * param,
3190 * search.c (lookup_member): Add access_failure_info * param and
3191 pass it on to call to perform_or_defer_access_check.
3192 (matches_code_and_type_p): New function.
3193 (field_access_p): New function.
3194 (direct_accessor_p): New function.
3195 (reference_accessor_p): New function.
3196 (field_accessor_p): New function.
3197 (struct locate_field_data): New struct.
3198 (dfs_locate_field_accessor_pre): New function.
3199 (locate_field_accessor): New function.
3200 * semantics.c (perform_or_defer_access_check): Add
3201 access_failure_info * param, and pass it on to call to
3203 * typeck.c (access_failure_info::record_access_failure): New method.
3204 (access_failure_info::maybe_suggest_accessor): New method.
3205 (finish_class_member_access_expr): Pass an access_failure_info
3206 instance to the lookup_member call, and call its
3207 maybe_suggest_accessor method afterwards.
3209 2017-05-16 Marek Polacek <polacek@redhat.com>
3213 * cp-gimplify.c (cp_fold): Handle SAVE_EXPR.
3215 2017-05-16 Nathan Sidwell <nathan@acm.org>
3217 * name-lookup.c (check_local_shadow): New, broke out of ...
3218 (pushdecl_maybe_friend_1): ... here. Call it.
3220 * cp-tree.h (OVL_NESTED_P, OVL_LOOKUP_P): New.
3221 (ovl_first): Move inline definition to end of file.
3222 (ovl_make, lookup_add): Declare.
3223 (get_fns, get_first_fn): Make pure.
3224 * tree.c (ovl_cache): New.
3225 (ovl_make, lookup_add): New.
3226 * pt.c (do_class_deduction): Don't add candidates that will be
3229 * call.c (build_user_type_conversion_1): Use OVL_FIRST.
3230 (print_error_for_call_failure): Use OVL_NAME.
3231 (build_op_call_1): Use ovl_iterator.
3232 (add_candidates): Use OVL_FIRST & lkp_iterator.
3233 (build_op_delete_call): Use MAYBE_BASELINK_FUNCTIONS &
3235 * class.c (deduce_noexcept_on_destructors): Use ovl_iterator.
3236 (type_has_user_nondefault_constructor,
3237 in_class_defaulted_default_constructor,
3238 type_has_user_provided_constructor,
3239 type_has_user_provided_or_explicit_constructor,
3240 type_has_non_user_provided_default_constructor,
3241 vbase_has_user_provided_move_assign,
3242 type_has_move_constructor, type_has_move_assign,
3243 type_has_user_declared_move_constructor,
3244 type_has_user_declared_move_assign,
3245 type_build_ctor_call, type_build_dtor_call,
3246 type_requires_array_cookie, explain_non_literal_class): Likewise.
3247 (finish_struct): Use lkp_iterator.
3248 (resolve_address_of_overloaded_function): Use OVL_NAME, lkp_iterator.
3249 (note_name_declared_in_class): Use OVL_NAME.
3250 * cxx-pretty-print.c (pp_cxx_unqualified_id): Use OVL_FIRST.
3251 (pp_cxx_qualified_id, cxx_pretty_printer::id_expression,
3252 cxx_pretty_printer::expression): Likewise.
3253 * decl2.c (check_classfn): Use ovl_iterator.
3254 * pt.c (retrieve_specialization): Use ovl_iterator.
3255 * tree.c (cp_tree_equal): Use lkp_iterator.
3256 (type_has_nontrivial_copy_init): Use ovl_iterator.
3258 * typeck2.c (cxx_incomplete_type_diagnostic): Revert change and
3259 check is_overloaded_fn.
3261 2017-05-16 Martin Liska <mliska@suse.cz>
3263 * parser.c (cp_lexer_print_token): Add default value for flags
3264 argument of print_gimple_stmt, print_gimple_expr,
3265 print_generic_stmt and print_generic_expr.
3267 2017-05-16 Nathan Sidwell <nathan@acm.org>
3269 * cp-tree.h (class ovl_iterator, class lkp_iterator): New OVERLOAD
3271 (MAYBE_BASELINK_FUNCTIONS): New.
3272 * constraint.cc (resolve_constraint_check): Use lkp_iterator.
3273 * decl2.c (maybe_warn_sized_delete): Use ovl_iterator.
3274 * lambda.c (maybe_generic_this_capture): Use lkp_iterator.
3275 * method.c (inherited_ctor_binfo): Use ovl_iterator.
3276 (binfo_inherited_from): Likewise.
3277 * parser.c (lookup_literal_operator): Use lkp_iterator.
3278 * pt.c (iterative_hash_template_arg): Use lkp_iterator.
3279 (print_candidates_1): Likewise.
3280 (determine_specialization): Likewise.
3281 (resolve_overloaded_unification): Likewise.
3282 (resolve_nondeduced_context): Likewise.
3283 (type_dependent_expression_p): Likewise.
3284 (dependent_template_p): Likewise.
3285 * ptree.c (cxx_print_xnode): Likewise.
3286 * semantics.c (omp_reduction_lookup): Use lkp_iterator.
3287 (classtype_has_nothrow_assign_or_copy_p): Use ovl_iterator.
3288 * typeck.c (check_template_keyword): Use lkp_iterator.
3290 * cp-tree.h (OVL_FIRST, OVL_NAME): New.
3292 * constexpr.c (function_concept_check): Use OVL_FIRST.
3293 * cvt.c (build_expr_type_conversion): Likewise.
3294 * decl.c (poplevel, grokdeclarator): Use OVL_NAME.
3295 * decl2.c (mark_used): Use OVL_FIRST.
3296 * error.c (dump_decl): Use OVL_FIRST, OVL_NAME.
3297 (dump_expr, location_of): Use OVL_FIRST.
3298 * friend.c (do_friend): Use OVL_NAME.
3299 * init.c (build_offset_ref): Use OVL_FIRST.
3300 * mangle.c (write_member_name): Likewise.
3301 (write_expression): Use OVL_NAME.
3302 * method.c (strip_inheriting_ctors): Use OVL_FIRST.
3303 * name-lookup.c (pushdecl_class_level): Use OVL_NAME.
3304 * pt.c (check_explicit_specialization): Use OVL_FIRST.
3305 (check_template_shadow): Likewise.
3306 (tsubst_template_args): Use OVL_NAME.
3307 (tsubst_baselink): Use OVL_FIRST.
3308 * semantics.c (perform_koenig_lookup): Use OVL_NAME.
3309 * tree.c (get_first_fn): Use OVL_FIRST.
3310 * typeck.c (finish_class_member_access_expr): Use OVL_NAME.
3311 (cp_build_addr_expr_1): Use OVL_FIRST.
3313 * pt.c (tsubst_copy_and_build): Remove unnecessary COMPONENT_REF
3315 * semantics.c (finish_id_expression): Directly init local var.
3316 (finish_omp_reduction_clause): Use really_overloaded_fn.
3317 * tree.c (get_fns): Document. Assert we got an overload.
3318 (get_first_fn) Document.
3319 * typeck.c (cp_build_addr_expr_1): Pass arg directly to
3320 really_overloaded_fn.
3321 * typeck2.c (cxx_incomplete_type_diagnostic): Use get_first_fn directly.
3323 * cp-tree.h (SCOPE_DEPTH): New.
3324 * name-lookup.h (is_nested_namespace): Declare.
3325 * name-lookup.c (is_nested_namespace): New.
3326 (is_ancestor): Use it.
3327 (set_decl_namespace): Likewise.
3328 (push_namespace): Set SCOPE_DEPTH.
3329 * pt.c (check_specialization_namespace): Use is_nested_namespace.
3330 (check_unqualigied_spec_or_inst): Likewise.
3332 2017-05-15 Nathan Sidwell <nathan@acm.org>
3335 * cp-tree.h (DECL_NAMESPACE_INLINE_P): New.
3336 * name-lookup.h (push_namespace): Return int, add make_inline arg.
3337 * name-lookup.c (push_namespace): Deal with inline directly.
3338 Return pushed count.
3339 * parser.c (cp_parser_namespace_definition): Adjust for
3340 push_namespace change.
3342 2017-05-11 Nathan Sidwell <nathan@acm.org>
3344 * cp-lang.c (get_global_decls, cxx_pushdecl, LANG_HOOK_GETDECLS,
3345 LANG_HOOKS_PUSHDECL): Move to ...
3346 * cp-objcp-common.c (cp_get_global_decls, cp_pushdec,
3347 LANG_HOOK_DECLS, LANG_HOOKS_PUSHDECL): ... here.
3348 * cp-objcp-common.h (cp_get_global_decls, cp_pushdecl): Declare.
3350 * name-lookup.h (pushdecl): Add default friend parm.
3351 (pushdecl_maybe_friend): Delete.
3352 (pushdecl_top_level): Add default friend parm.
3353 (pushdecl_top_level_maybe_friend): Delete.
3354 * name-lookup.c (pushdecl_maybe_friend): Delete.
3355 (pushdecl): Add is_friend parm.
3356 (pushdecl_top_level): Add is friend_parm.
3357 (pushdecl_top_level_maybe_friend, pushdecl_top_level_1): Delete.
3358 (pushdecl_top_level_and_finish): Do pushing and finishing directly.
3359 * friend.c (do_friend): Adjust.
3360 * pt.c (tsubst_friend_class): Adjust.
3362 Revert pushdecl_top_level_and_finish name change.
3363 * name-lookup.h (pushdecl_top_level_and_finish): Resurrect old name.
3364 * name-lookup.c (pushdecl_top_level_and_finish): Likewise.
3365 * decl.c (cp_make_fname_decl): Adjust.
3366 * decl2.c (get_guard, handle_tls_init): Adjust.
3367 * rtti.c (get_tinfo_decl, tinfo_base_init): Adjust.
3369 * name-lookup.c (pushdecl_outermost_localscope): Always
3370 conditionally stop timer.
3372 * decl.c (xref_tag_1): Don't frob ts_lambda scope here.
3373 * name-lookup.c (pushtag_1): Deal with ts_lambda scope.
3375 * cp-tree.h (pushdecl, pushdecl_maybe_friend, pushtag,
3376 pushtag_top_level_maybe_friend,
3377 pushdecl_top_level_and_finish): Move declarations to ...
3378 * name-lookup.h: ... here. Group pushdecl variants.
3379 (pushdecl_top_level_and_finish): Rename to ...
3380 (pushdecl_top_level_with_init): ... here.
3381 * decl.c (cp_make_fname_decl): Use pushdecl_top_level_with_init.
3382 * decl2.c (get_guard, handle_tls_init): Likewise.
3383 * rtti.c (get_tinfo_decl, tinfo_base_init): Likewise.
3384 * lambda.c (maybe_add_lambda_conv_op): Use namespace_bindings_p.
3385 * method.c (implicitly_declare_fn): Likewise.
3386 * searchc (node_debug_info_needed): Likewise.
3387 * name-lookup.c (pushdecl_top_level_and_finish): Rename to ...
3388 (pushdecl_top_level_with_init): ... here.
3389 (pop_everything): Use namespace_bindings_p.
3391 * name-lookup.h (pop_binding): Rename to pop_local_binding.
3392 (getdecls): Rename to get_local_decls.
3393 * name-lookup.c (pop_binding): Rename to ...
3394 (pop_local_binding): ... here.
3395 (pop_bindings_and_leave_scope): Adjust.
3396 (getdecls): Rename to ...
3397 (get_local_decls): ... here. Assert local scope.
3398 * decl.c (poplevel): Assert not namespace. Adjust and simplify
3400 (store_parm_decls): Adjust get_local_decls call.
3401 (parser.c (synthesize_implicit_template_parm): Likewise.
3403 2017-05-11 Ville Voutilainen <ville.voutilainen@gmail.com>
3406 * method.c (is_trivially_xible): Reject void types.
3408 2017-05-10 Nathan Sidwell <nathan@acm.org>
3410 * class.c (handle_using_decl): Always use OVL_CURRENT.
3411 (resolve_address_of_overloaded_function): Move iterator decl into
3412 for scope. Don't strip anticipated decls here.
3414 * pt.c (print_candidates_1): Separate TREE_LIST and OVERLOAD
3416 (print_candidates): Adjust.
3418 * cp-tree.h (build_new_function_call): Lose koenig_p arg. Fix
3420 * call.c (build_new_function_call): Lose koenig_p arg. Remove
3421 koenig_p handling here.
3422 * pt.c (push_template_decl_real): Unconditionally retrofit_lang_decl.
3423 (tsubst_omp_clauses): Likewise.
3424 (do_class_deduction): Adjust buld_new_function_call calls.
3425 * semantics.c (finish_call_expr): Likewise.
3427 2017-05-10 Jason Merrill <jason@redhat.com>
3429 * pt.c (unify_parameter_deduction_failure, unify_cv_qual_mismatch)
3430 (unify_type_mismatch, unify_parameter_pack_mismatch)
3431 (unify_ptrmem_cst_mismatch, unify_expression_unequal)
3432 (unify_parameter_pack_inconsistent, unify_inconsistency)
3433 (unify_vla_arg, unify_method_type_error, unify_arity)
3434 (unify_arg_conversion, unify_no_common_base)
3435 (unify_inconsistent_template_template_parameters)
3436 (unify_template_deduction_failure)
3437 (unify_template_argument_mismatch)
3438 (unify_overload_resolution_failure): Call unify_invalid.
3440 CWG 1847 - Clarifying compatibility during partial ordering
3441 * pt.c (more_specialized_fn): No order between two non-deducible
3444 * pt.c (dependent_type_p): Make sure we aren't called with
3447 PR c++/79549 - C++17 ICE with non-type auto template parameter pack
3448 * pt.c (convert_template_argument): Just return an argument pack.
3449 (coerce_template_parameter_pack, template_parm_to_arg)
3450 (extract_fnparm_pack, make_argument_pack, tsubst_template_args)
3451 (tsubst_decl, tsubst, type_unification_real, unify_pack_expansion):
3452 Don't set the type of a NONTYPE_ARGUMENT_PACK.
3453 * parser.c (make_char_string_pack, make_string_pack): Likewise.
3455 2017-05-10 Nathan Sidwell <nathan@acm.org>
3457 * cp-tree.h (add_method, clone_function_decl): Change last arg to
3459 * class.c (add_method): Change third arg to bool. Adjust.
3460 (one_inheriting_sig, one_inherited_ctor): Adjust.
3461 (clone_function_decl): Change 2nd arg to bool. Adjust.
3462 (clone_constructors_and_destructors): Adjust.
3463 * lambda.c (maybe_add_lambda_conv_op): Adjust.
3464 * method.c (lazily_declare_fn): Adjust.
3465 * pt.c (tsubst_decl, instantiate_template_1): Adjust.
3466 * semantics.c (finish_member_declaration): Adjust.
3468 2017-05-10 Paolo Carlini <paolo.carlini@oracle.com>
3471 * decl.c (finish_function): To improve error recovery, change the
3472 logic for calling apply_deduced_return_type.
3474 2017-05-09 Jason Merrill <jason@redhat.com>
3476 PR c++/80605 - __is_standard_layout and empty base
3477 * class.c (check_bases): Ignore empty bases.
3479 PR c++/70979 - literal class and closure types
3480 * class.c (finalize_literal_type_property): Handle closures
3482 (explain_non_literal_class): Likewise.
3484 PR c++/66297, DR 1684 - literal class and constexpr member fns
3485 * constexpr.c (is_valid_constexpr_fn): Only complain about
3486 non-literal enclosing class in C++11.
3487 * class.c (finalize_literal_type_property): Likewise.
3489 2017-05-09 Paolo Carlini <paolo.carlini@oracle.com>
3492 * pt.c (tsubst_decl): Early return error_mark_node if
3493 grok_ctor_properties returns false.
3495 2017-05-09 Jason Merrill <jason@redhat.com>
3497 PR c++/70167 - array prvalue treated as lvalue
3498 * cp-tree.h (CONSTRUCTOR_C99_COMPOUND_LITERAL): New.
3500 * semantics.c (finish_compound_literal): Add fcl_context parameter.
3501 Only make a static variable for C99 syntax.
3502 * parser.c (cp_parser_postfix_expression): Pass it.
3503 * pt.c (tsubst_copy_and_build): Likewise.
3504 * call.c (extend_ref_init_temps): Set
3505 DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P.
3507 2017-05-09 Nathan Sidwell <nathan@acm.org>
3509 * cp-lang.c (get_global_decls, cxx_pushdecl): New.
3510 (LANG_HOOKS_GETDECLS, LANG_HOOKS_PUSHDECL): Override.
3511 * name-lookup.h (pushdecl_top_level): Declare.
3513 2017-05-08 Jason Merrill <jason@redhat.com>
3515 PR c++/80178 - parameter passing for uncopyable classes
3516 * tree.c (type_has_nontrivial_copy_init): True for classes with only
3517 deleted copy/move ctors.
3518 (remember_deleted_copy, maybe_warn_parm_abi): New.
3519 * decl.c (require_complete_types_for_parms, check_function_type):
3520 Call maybe_warn_parm_abi.
3521 * call.c (convert_for_arg_passing, build_cxx_call): Likewise.
3523 2017-05-08 Nathan Sidwell <nathan@acm.org>
3525 * decl.c (builtin_function_1): Set DECL_ANTICIPATED before pushing.
3526 (start_preparsed_function): Do decl pushing before setting
3527 current_funciton_decl and announcing it.
3529 * name-lookup.h (pushdecl_with_scope): Replace with ...
3530 (pushdecl_outermost_localscope): ... this.
3531 * name-lookup.c (pushdecl_with_scope): Replace with ...
3532 (pushdecl_outermost_localscope): ... this.
3533 (pushdecl_namespace_level): Adjust.
3534 * decl.c (cp_make_fname_decl): Use pushdecl_outermost_localscope.
3535 * lambda.c (insert_capture_proxy): Likewise.
3537 * class.c (build_vtbl_initializer): Don't shadow outer variable
3540 Revert _binding -> _value change.
3541 * name-lookup.h (get_namespace_value, set_global_value): Rename to ...
3542 (get_namespace_binding, set_global_binding): ... these.
3543 * name-lookup.c (get_namespace_value, set_global_value): Rename to ...
3544 (get_namespace_binding, set_global_binding): ... these.
3545 (arg_assoc_namespace, pushdecl_maybe_friend_1,
3546 check_for_out_of_scope_variable, push_overloaded_decl_1,
3547 lookup_name_innermost_nonclass_level, push_namespace): Adjust.
3548 * cp-tree.h (IDENTIFIER_GLOBAL_VALUE,
3549 SET_IDENTIFIER_GLOBAL_VALUE): Adjust.
3550 * decl.c (poplevel): Adjust.
3551 * pt.c (make_constrained_auto): Likewise.
3553 2017-05-07 Volker Reichelt <v.reichelt@netcologne.de>
3555 PR translation/80280
3556 * call.c (print_z_candidate): Fix quoting.
3558 2017-05-05 David Malcolm <dmalcolm@redhat.com>
3560 * error.c (pedwarn_cxx98): Replace report_diagnostic
3561 with diagnostic_report_diagnostic.
3563 2017-05-05 Nathan Sidwell <nathan@acm.org>
3565 * cp-tree.h (IDENTIFIER_GLOBAL_VALUE): Use get_namespace_value.
3566 (SET_IDENTIFIER_GLOBAL_VALUE): Use set_global_value.
3567 (IDENTIFIER_NAMESPACE_VALUE): Delete.
3568 * name-lookup.h (namespace_binding, set_namespace_binding): Replace
3570 (get_namespace_value, set_global_value): ... these.
3571 (get_global_value_if_present, is_typename_at_global_scope): Delete.
3572 * decl.c (poplevel): Use get_namespace_value.
3573 (grokdeclarator): Use IDENTIFIER_GLOBAL_VALUE.
3574 * class.c (build_vtbl_initializer): Stash library decl in
3575 static var. Use IDENTIFIER_GLOBAL_VALUE.
3576 * except.c (do_get_exception_ptr, do_begin_catch, do_end_catch,
3577 do_allocate_exception, do_free_exception, build_throw): Likewise.
3578 * init.c (throw_bad_array_new_length): Likewise.
3579 * rtti.c (throw_bad_cast, throw_bad_typeid): Likewise.
3580 * name-lookup.c (arg_assoc_namespace, pushdecl_maybe_friend_1,
3581 check_for_our_of_scope_variable, push_overloaded_decl_1): Use
3582 get_namespace_value.
3583 (set_namespace_binding_1): Rename to
3584 (set_namespace_binding): ... here.
3585 (set_global_value): New.
3586 (lookup_name_innermost_nonclass_level_1, push_namespace): Use
3587 get_namespace_value.
3588 * pt.c (listify): Use get_namespace_value.
3590 * call.c (make_temporary_var_for_ref_to_temp): Push decl into
3592 * lex.c (unqualified_name_lookup_error): Likewise.
3594 * class.c (alter_class): Use retrofit_lang_decl directly.
3595 * decl.c (push_local_name, dupliate_decls): Likewise.
3596 * semantics.c (omp_privatize_field): Likewise.
3598 Kill walk_namespaces.
3599 * cp-tree.h (walk_namespaces_fn, walk_namespaces): Delete.
3600 * decl.c (walk_namespaces_r, walk_namespaces): Delete.
3602 Kill per-namespace static_decls.
3603 * cp-tree.h (static_decls): Declare.
3604 (wrapup_globals_for_namespace,
3605 diagnose_inline_vars_for_namespace): Replace with ...
3606 (wrapup_namespace_globals): ... this.
3607 * decl.c (static_decls): Define.
3608 (wrapup_globals_for_namespace,
3609 diagnose_inline_vars_for_namespace): Replace with ...
3610 (wrapup_namespace_globals): ... this.
3611 (cxx_init_decl_processing): Initialize static_decls.
3612 * decl2.c (c_parse_final_cleanups): Adjust.
3613 * name-lookup.h (cp_binding_level): Remove static_decls member.
3614 * name-lookup.c (add_decl_to_level): Adjust.
3615 (begin_scope): Adjust.
3617 2017-05-05 Paolo Carlini <paolo.carlini@oracle.com>
3620 * decl.c (reshape_init): Unconditionally return error_mark_node
3621 upon error about too many initializers.
3623 2017-05-04 Nathan Sidwell <nathan@acm.org>
3625 * constraint.cc (diagnose_check_constraint): Fix %E thinko.
3627 2017-05-04 Martin Sebor <msebor@redhat.com>
3629 PR translation/80280
3630 * call.c (print_z_candidate): Add missing quoting to %D and other
3632 (build_op_call_1): Same.
3633 * constraint.cc (diagnose_check_constraint): Same.
3634 * mangle.c (mangle_decl): Same.
3635 * name-lookup.c (cp_binding_level_debug): Same.
3636 (set_decl_namespace): Same.
3637 * parser.c (cp_parser_tx_qualifier_opt): Same.
3638 * pt.c (print_candidates_1): Same.
3639 (check_template_variable): Same.
3640 (tsubst_default_argument): Same.
3641 (most_specialized_partial_spec): Same.
3642 * semantics.c (omp_reduction_lookup): Same.
3643 * tree.c (check_abi_tag_redeclaration): Same.
3644 * typeck.c (comptypes): Same.
3645 * typeck2.c (abstract_virtuals_error_sfinae): Same.
3647 2017-05-04 Nathan Sidwell <nathan@acm.org>
3650 * cp-tree.h (enum cp_tree_index): Add CPTI_GLOBAL,
3651 CPTI_GLOBAL_TYPE, CPTI_GLOBAL_IDENTIFIER, CPTI_ANON_IDENTIFIER,
3652 CPTI_INIT_LIST_IDENTIFIER.
3653 (global_namespace, global_type_node, global_identifier,
3654 anon_identifier, init_list_identifier): New.
3655 * decl.c (global_type_node, global_scope_name): Delete.
3656 (initialize_predefined_identifiers): Add new identifiers.
3657 (cxx_init_decl_processing): Adjust.
3658 * name-lookup.h (global_namespace, global_type_node): Delete.
3659 * name-lookup.c (global_namespace, anonymous_namespace_name,
3660 get_anonymous_namespace_name): Delete.
3661 (namespace_scope_ht_size, begin_scope, pushtag_1,
3662 push_namespace): Adjust,
3663 * call.c (type_has_extended_temps): Use init_list_identifier.
3664 * pt.c (listify): Likewise.
3666 * name-lookup.c: Reorder functions to make merging from modules
3669 2017-05-03 Jason Merrill <jason@redhat.com>
3671 * constexpr.c (cxx_eval_outermost_constant_expr): Use TV_CONSTEXPR.
3673 2017-05-03 Nathan Sidwell <nathan@acm.org>
3675 * cp-tree.h (enum cp_tree_index, cp_global_trees): Move earlier,
3676 along with #defines, to before name-lookup include.
3678 2017-05-02 Paolo Carlini <paolo.carlini@oracle.com>
3680 * pt.c (is_auto_or_concept): Remove.
3681 (type_uses_auto_or_concept): Remove, unused.
3682 (find_parameter_packs_r, extract_autos_r, is_auto_r): Adjust.
3683 * parser.c (tree_type_is_auto_or_concept): Remove, unused.
3684 * cp-tree.h (is_auto_or_concept): Remove.
3686 2017-05-01 Xi Ruoyao <ryxi@stu.xidian.edu.cn>
3689 * cp-cilkplus.c (cilk_install_body_with_frame_cleanup): Don't
3690 add pedigree operation and detach call here.
3691 * cp-gimplify.c (cp_gimplify_expr): Remove the calls to
3692 cilk_cp_gimplify_call_params_in_spawned_fn.
3693 (cilk_cp_gimplify_call_params_in_spawned_fn): Remove function.
3694 * semantics.c (simplify_aggr_init_expr): Copy EXPR_CILK_SPAWN.
3696 2017-04-29 Volker Reichelt <v.reichelt@netcologne.de>
3698 * parser.c (cp_parser_member_declaration): Add fix-it hints for
3699 stray comma and missing semicolon at end of member declaration.
3701 2017-04-27 Volker Reichelt <v.reichelt@netcologne.de>
3703 * parser.c (cp_parser_cast_expression): Add target type of cast to
3705 * error.c (type_to_string): Add '{enum}' suffix to enumeration types.
3707 2017-04-26 Paolo Carlini <paolo.carlini@oracle.com>
3709 * decl.c (grok_ctor_properties, ambi_op_p, unary_op_p): Change
3710 return type to bool.
3711 * cp-tree.h (grok_ctor_properties): Update.
3713 2017-04-26 Volker Reichelt <v.reichelt@netcologne.de>
3715 * parser.c (cp_parser_nested_name_specifier_opt): Add fix-it
3716 information to diagnostic of invalid colon in nested-name-specifier.
3718 2017-04-25 Volker Reichelt <v.reichelt@netcologne.de>
3720 * parser.c (cp_parser_elaborated_type_specifier): Add fix-it to
3721 diagnostic of invalid class/struct keyword after enum.
3723 2017-04-25 David Malcolm <dmalcolm@redhat.com>
3725 * parser.c (cp_parser_member_declaration): Add fix-it hint
3726 for removing stray semicolons.
3728 2017-04-25 David Malcolm <dmalcolm@redhat.com>
3730 * name-lookup.c (get_std_name_hint): New function.
3731 (maybe_suggest_missing_header): New function.
3732 (suggest_alternative_in_explicit_scope): Call
3733 maybe_suggest_missing_header.
3735 2017-04-25 David Malcolm <dmalcolm@redhat.com>
3738 * name-lookup.c (suggest_alternative_in_explicit_scope): Convert
3739 candidate type of bm from tree to const char *.
3740 (consider_binding_level): Likewise.
3741 (lookup_name_fuzzy): Likewise, using this to merge the best
3742 result from the preprocessor into bm, rather than immediately
3743 returning, so that better matches from reserved words can "win".
3744 Guard the rejection of keywords that don't start decl-specifiers
3745 so it only happens for FUZZY_LOOKUP_TYPENAME.
3747 2017-04-24 Volker Reichelt <v.reichelt@netcologne.de>
3749 * decl.c (grokdeclarator): Use %qT instead of %<%T%> in diagnostics.
3750 (start_enum): Likewise.
3751 (build_enumerator): Likewise. Use %qE instead of plain %E.
3752 * parser.c (cp_parser_mem_initializer_list): Use %qD instead of
3753 %<%D%> in diagnostics.
3754 (cp_parser_elaborated_type_specifier): Likewise.
3755 * pt.c (make_pack_expansion): Use %qT and %qE instead of
3756 %<%T%> and %<%E%> in diagnostics.
3757 (tsubst_pack_expansion): Likewise.
3759 2017-04-24 David Malcolm <dmalcolm@redhat.com>
3762 * parser.c (cp_parser_unary_expression): Generate a location
3763 range for alignof and sizeof expressions.
3765 2017-04-24 Volker Reichelt <v.reichelt@netcologne.de>
3767 * parser.c (cp_parser_cv_qualifier_seq_opt): Add fix-it info to
3769 (cp_parser_virt_specifier_seq_opt): Likewise.
3770 (set_and_check_decl_spec_loc): Likewise twice.
3772 2017-04-21 Jason Merrill <jason@redhat.com>
3774 PR c++/80179 - ICE with initialized flexible array member.
3775 * constexpr.c (verify_ctor_sanity): Handle flexible array members.
3777 2017-04-21 Richard Biener <rguenther@suse.de>
3779 * cp-tree.h (copy_decl): Annotate with CXX_MEM_STAT_INFO.
3780 (copy_type): Likewise.
3781 * lex.c (copy_decl): Pass down mem-stat info.
3782 (copy_type): Likewise.
3784 2017-04-20 Jonathan Wakely <jwakely@redhat.com>
3787 * init.c (build_new_1): Suppress notes about over-aligned new when
3788 the warning is suppressed.
3790 2017-04-20 Volker Reichelt <v.reichelt@netcologne.de>
3792 * parser.c (cp_parser_member_declaration): Add warning with fixit
3793 information for extra semicolon after in-class function definition.
3795 2017-04-20 Jakub Jelinek <jakub@redhat.com>
3798 * tree.c (build_cplus_array_type): Call build_array_type
3799 with the intended TYPE_TYPELESS_STORAGE flag value, instead
3800 of calling build_array_type and modifying later TYPE_TYPELESS_STORAGE
3803 2017-04-18 Marek Polacek <polacek@redhat.com>
3805 PR c++/80244 - ICE with attribute in template alias.
3806 * tree.c (strip_typedefs): Handle UNDERLYING_TYPE.
3808 PR c++/80241 - ICE with alignas pack expansion.
3809 * error.c (dump_expr): Handle TREE_LIST.
3810 * parser.c (cp_parser_std_attribute_list): Return error_mark if
3811 make_pack_expansion returns an error.
3813 2017-04-17 Bernd Edlinger <bernd.edlinger@hotmail.de>
3816 * class.c (fixup_may_alias): Fix all type variants.
3818 2017-04-17 Jason Merrill <jason@redhat.com>
3820 PR c++/80415 - wrong error with default arg and array reference.
3821 * tree.c (lvalue_kind): Return clk_class for an array prvalue.
3823 * pt.c (tsubst_init): Set TARGET_EXPR_DIRECT_INIT_P.
3825 2017-04-15 Alexandre Oliva <aoliva@redhat.com>
3827 * decl.c (name_unnamed_type): Split out of...
3828 (grokdeclarator): ... this.
3829 * decl.h (name_unnamed_type): Declare.
3831 2017-04-12 Richard Biener <rguenther@suse.de>
3832 Bernd Edlinger <bernd.edlinger@hotmail.de>
3835 * tree.c (build_cplus_array_type): Set TYPE_TYPELESS_STORAGE
3836 for arrays of character or std::byte type.
3838 2017-04-11 Jason Merrill <jason@redhat.com>
3840 PR c++/80294 - ICE with constexpr and inheritance.
3841 * constexpr.c (reduced_constant_expression_p):
3842 A null constructor element is non-constant.
3843 (cxx_eval_indirect_ref): Don't VERIFY_CONSTANT before
3844 returning an empty base.
3846 2017-04-11 Jakub Jelinek <jakub@redhat.com>
3849 * decl.c (cp_finish_decomp): If processing_template_decl on
3850 non-dependent decl, only set TREE_TYPE on the v[i] decls, but don't
3851 change their DECL_VALUE_EXPR nor cp_finish_decl them. Instead make
3852 sure DECL_VALUE_EXPR is the canonical NULL type ARRAY_REF for tsubst
3854 * pt.c (value_dependent_expression_p) <case VAR_DECL>: For variables
3855 with DECL_VALUE_EXPR, return true if DECL_VALUE_EXPR is type
3858 2017-04-11 Jakub Jelinek <jakub@redhat.com>
3861 * error.c (dump_expr): Handle VEC_COND_EXPR like COND_EXPR.
3863 2017-04-10 Jakub Jelinek <jakub@redhat.com>
3866 * tree.c (lvalue_kind): For COMPONENT_REF with BASELINK second
3867 operand, if it is a static member function, recurse on the
3870 2017-04-10 Marek Polacek <polacek@redhat.com>
3873 * typeck.c (cp_build_binary_op): Use NULL_TREE instead of NULL. Set
3874 ORIG_TYPE earlier and not only when shortening.
3876 2017-04-07 Jason Merrill <jason@redhat.com>
3878 PR c++/80356 - ICE with reference to function template argument.
3880 * pt.c (convert_nontype_argument_function): Adjust type even with a
3881 value-dependent argument.
3883 PR c++/80267 - ICE with nested capture of reference
3885 * pt.c (tsubst_copy): Handle lookup finding a capture proxy.
3887 2017-04-07 Marek Polacek <polacek@redhat.com>
3890 * typeck.c (cp_build_binary_op): Convert COP[01] to ORIG_TYPE.
3893 * call.c (build_over_call): Don't check cxx_dialect.
3894 * cp-gimplify.c (cp_gimplify_init_expr): Don't check cxx_dialect nor
3895 whether SUB is a CONSTRUCTOR.
3896 * init.c (build_new_1): Don't check cxx_dialect.
3897 * tree.c (replace_placeholders): Add a function comment. Return if
3898 not in C++14, or if the object isn't a (member of a) class.
3899 * typeck2.c (store_init_value): Don't check cxx_dialect nor whether
3900 TYPE is CLASS_TYPE_P.
3902 2017-04-05 Jakub Jelinek <jakub@redhat.com>
3905 * pt.c (canonical_type_parameter): Use vec_safe_grow_cleared instead
3906 of a loop doing vec_safe_push of NULL. Formatting fixes.
3907 (rewrite_template_parm): Copy TEMPLATE_PARM_PARAMETER_PACK from oldidx
3908 to newidx before calling canonical_type_parameter on newtype.
3910 2017-04-04 Volker Reichelt <v.reichelt@netcologne.de>
3913 * cxx-pretty-print.c (cxx_pretty_printer::expression): Add
3914 UNARY_PLUS_EXPR case.
3916 2017-04-03 Jason Merrill <jason@redhat.com>
3918 * semantics.c (finish_template_type): Check CLASSTYPE_TEMPLATE_INFO.
3920 2017-04-03 Jonathan Wakely <jwakely@redhat.com>
3922 * class.c (update_vtable_entry_for_fn): Fix typo in comment.
3923 * decl2.c (one_static_initialization_or_destruction): Likewise.
3924 * name-lookup.c (store_bindings): Likewise.
3925 * parser.c (make_call_declarator): Likewise.
3926 * pt.c (check_explicit_specialization): Likewise.
3928 2017-04-03 Jason Merrill <jason@redhat.com>
3930 PR sanitizer/79993 - ICE with VLA initialization from string
3931 PR c++/69487 - wrong VLA initialization from string
3932 * init.c (finish_length_check): Split out from build_vec_init.
3933 (build_vec_init): Handle STRING_CST.
3934 * typeck2.c (split_nonconstant_init): Handle STRING_CST.
3935 (digest_init_r): Don't give a STRING_CST VLA type.
3937 2017-03-31 Jakub Jelinek <jakub@redhat.com>
3940 * cp-gimplify.c (cp_genericize_r): Sanitize INTEGER_CSTs with
3941 REFERENCE_TYPE. Adjust ubsan_maybe_instrument_reference caller
3942 for NOP_EXPR to REFERENCE_TYPE.
3945 * cp-tree.h (enum cp_trait_kind): Add CPTK_IS_AGGREGATE.
3946 * cxx-pretty-print.c (pp_cxx_trait_expression): Handle
3948 * semantics.c (trait_expr_value): Handle CPTK_IS_AGGREGATE.
3949 Remove extraneous parens.
3950 (finish_trait_expr): Handle CPTK_IS_AGGREGATE.
3951 * parser.c (cp_parser_primary_expression): Handle RID_IS_AGGREGATE.
3952 (cp_parser_trait_expr): Likewise.
3954 2017-03-27 Jakub Jelinek <jakub@redhat.com>
3957 * cp-tree.h (cxx_mark_addressable): Add array_ref_p argument.
3958 * typeck.c (cxx_mark_addressable): Likewise. Look through
3959 VIEW_CONVERT_EXPR unless array_ref_p and VCE is from VECTOR_TYPE
3961 (cp_build_array_ref): Pass true as array_ref_p to cxx_mark_addressable.
3963 2017-03-24 Jason Merrill <jason@redhat.com>
3965 PR c++/77339 - ICE with invalid use of alias template.
3966 * pt.c (lookup_template_class_1): Don't try to enter the scope of an
3969 2017-03-24 Marek Polacek <polacek@redhat.com>
3972 * cp-gimplify.c (cp_fold): Strip CLEANUP_POINT_EXPR if the expression
3973 doesn't have side effects.
3975 2017-03-23 Jason Merrill <jason@redhat.com>
3977 PR c++/80150 - ICE with overloaded variadic deduction.
3978 * pt.c (try_one_overload): Remove asserts.
3980 PR c++/77563 - missing ambiguous conversion error.
3981 * call.c (convert_like_real): Use LOOKUP_IMPLICIT.
3983 2017-03-23 Marek Polacek <polacek@redhat.com>
3985 * cp-tree.h: Remove a C_RID_YYCODE reference.
3987 2017-03-22 Jakub Jelinek <jakub@redhat.com>
3990 * semantics.c (finish_omp_clause) <case OMP_CLAUSE_SIMDLEN,
3991 case OMP_CLAUSE_ALIGNED>: Call maybe_constant_value only when not
3992 processing_template_decl.
3994 2017-03-21 Paolo Carlini <paolo.carlini@oracle.com>
3997 * name-lookup.c (pushtag_1): Add check for bogus, non template,
3998 std::initializer_list.
4000 2017-03-21 Jakub Jelinek <jakub@redhat.com>
4003 * init.c (std_placement_new_fn_p, build_new_1): Formatting fixes.
4005 2017-03-21 Ville Voutilainen <ville.voutilainen@gmail.com>
4008 * init.c (std_placement_new_fn_p): New.
4009 (build_new_1): Call it.
4011 2017-03-20 Jason Merrill <jason@redhat.com>
4013 PR c++/80096 - ICE with C++17 non-type auto.
4014 * pt.c (tsubst): Delay tsubst of type of template non-type
4017 PR c++/79519 - ICE with deleted template friend.
4018 * decl.c (grokdeclarator): Complain about misplaced function
4019 definition using =, as well.
4021 PR c++/79640 - infinite recursion with generic lambda.
4022 * pt.c (tsubst_copy) [VAR_DECL]: Register the dummy instantiation
4023 before substituting its initializer.
4025 2017-03-20 Marek Polacek <polacek@redhat.com>
4026 Paolo Carlini <paolo.carlini@oracle.com>
4028 PR c++/80059 - ICE with noexcept and __transaction_atomic
4029 * except.c (build_must_not_throw_expr): Call
4030 instantiate_non_dependent_expr.
4032 2017-03-19 Jason Merrill <jason@redhat.com>
4034 PR c++/80084 - wrong C++17 decomposition by reference of parameter.
4035 * decl.c (cp_finish_decomp): Don't pull out the DECL_INITIAL of a
4036 reference decomposition.
4038 PR c++/80077 - error with constexpr and -fno-elide-constructors.
4039 * constexpr.c (cxx_eval_call_expression): Set ctx->call while
4040 expanding trivial constructor.
4042 2017-03-17 Jason Merrill <jason@redhat.com>
4044 PR c++/78345 - ICE initializing array from lambda.
4045 * init.c (build_aggr_init): Check array initializer.
4046 (build_vec_init): Check the type of a CONSTRUCTOR.
4048 PR c++/80073 - C++17 ICE with virtual base.
4049 * decl.c (xref_basetypes): Also check for indirect vbases.
4051 2017-03-16 Jason Merrill <jason@redhat.com>
4053 * decl.c (start_enum): std::byte aliases anything.
4056 * constexpr.c (lookup_placeholder): Tweak.
4058 2017-03-15 Jason Merrill <jason@redhat.com>
4060 PR c++/80043 - ICE with -fpermissive
4061 * typeck.c (convert_for_assignment): Handle instantiate_type
4062 not giving an error.
4064 2017-03-14 Nathan Sidwell <nathan@acm.org>
4066 PR c++/79393 DR 1658 workaround
4067 * method.c (synthesized_method_base_walk): Inihibit abstract class
4068 virtual base access check here.
4069 (synthesized_method_walk): Not here.
4071 2017-03-13 Nathan Sidwell <nathan@acm.org>
4073 PR c++/79393 DR 1658 workaround
4074 * method.c (synthesized_method_walk): Check vbases of abstract
4075 classes for dtor walk.
4077 2017-03-10 David Malcolm <dmalcolm@redhat.com>
4079 PR translation/79848
4080 * decl.c (grokfndecl): Simplify uses of "%<%s%>" to "%qs".
4082 2017-03-10 Jason Merrill <jason@redhat.com>
4084 PR c++/79960 - alias templates and partial ordering
4085 * pt.c (comp_template_args): Add partial_order parm.
4086 (template_args_equal): Likewise.
4087 (comp_template_args_porder): New.
4088 (get_partial_spec_bindings): Use it.
4090 2017-03-10 Marek Polacek <polacek@redhat.com>
4093 * decl.c (grokdeclarator): Check ATTRLIST before dereferencing it.
4095 2017-03-10 Jakub Jelinek <jakub@redhat.com>
4098 * optimize.c (maybe_thunk_body): Don't ICE if fns[0] is NULL.
4099 Use XALLOCAVEC macro.
4102 * decl.c (finish_enum_value_list): If value is error_mark_node,
4103 don't copy it and change its type.
4104 * init.c (constant_value_1): Return error_mark_node if DECL_INITIAL
4105 of CONST_DECL is error_mark_node.
4107 2017-03-09 Marek Polacek <polacek@redhat.com>
4109 PR c++/79900 - ICE in strip_typedefs
4110 * tree.c (strip_typedefs): Skip the attribute handling if T is
4111 a variant type which hasn't been updated yet.
4113 PR c++/79687 - wrong code with pointer-to-member
4114 * init.c (constant_value_1): Break if the variable has a dynamic
4117 2017-03-08 Jason Merrill <jason@redhat.com>
4119 PR c++/79797 - ICE with self-reference in array DMI.
4120 * constexpr.c (lookup_placeholder): Split out...
4121 (cxx_eval_constant_expression): ...from here.
4123 2017-03-07 Jakub Jelinek <jakub@redhat.com>
4126 * parser.c (cp_parser_omp_cancellation_point,
4127 cp_parser_omp_target_enter_data, cp_parser_omp_target_exit_data,
4128 cp_parser_omp_target_update): Change "may only be used in compound
4129 statements" diagnostics, such that the same translatable string is
4130 used for all pragmas.
4131 (cp_parser_pragma): Likewise. Use error_at instead of
4132 cp_parser_error for that diagnostics.
4134 2017-03-06 Marek Polacek <polacek@redhat.com>
4136 PR c++/79796 - ICE with NSDMI and this pointer
4137 * call.c (build_over_call): Handle NSDMI with a 'this' by calling
4138 replace_placeholders.
4140 2017-03-06 Jakub Jelinek <jakub@redhat.com>
4143 * constexpr.c (cxx_eval_statement_list): Treat empty ({ }) like
4146 2017-03-06 Jason Merrill <jason@redhat.com>
4148 Revert "Allow deduction guides to look into primary template."
4149 * cp-tree.h, parser.c, pt.c, search.c: Revert.
4151 2017-03-05 Paolo Carlini <paolo.carlini@oracle.com>
4154 * except.c (build_must_not_throw_expr): Perform the implicit
4155 conversions on the condition.
4157 2017-03-03 Jason Merrill <jason@redhat.com>
4159 * mangle.c (mangle_decl): Check -Wnoexcept-type instead of
4162 Core issues 2273 and 2277
4163 * call.c (joust): Adjust using-declaration tiebreaker to handle
4164 the intermediate base case.
4165 * method.c (strip_inheriting_ctors): Just return the argument if
4166 !flag_new_inheriting_ctors.
4168 2017-03-03 Richard Biener <rguenther@suse.de>
4171 * cp-gimplify.c (simple_empty_class_p): Handle EMPTY_CLASS_EXPR.
4173 2017-03-03 Marek Polacek <polacek@redhat.com>
4176 * typeck.c (string_conv_p): In C++11, always call pedwarn with
4179 2017-03-02 Jason Merrill <jason@redhat.com>
4181 Update overload resolution with deduction guides.
4182 * pt.c (do_class_deduction): Always build the copy guide.
4183 (copy_guide_p, template_guide_p): New.
4184 (build_deduction_guide): Remember the original constructor.
4185 * call.c (joust): Prefer the copy guide and non-template guides.
4187 Allow deduction guides to look into primary template.
4188 * cp-tree.h (struct saved_scope): Add deduction_guide_type.
4189 (struct cp_decl_specifier_seq): Add constructor_p.
4190 * parser.c (cp_parser_decl_specifier_seq): Set constructor_p.
4191 (cp_parser_init_declarator): Check it. Set ctor_dtor_or_conv_p.
4192 Clear deduction_guide_type. Don't handle deduction guide names.
4193 (cp_parser_declarator): Don't clear ctor_dtor_or_conv_p.
4194 (cp_parser_direct_declarator): Likewise. Handle deduction guides.
4195 (cp_parser_member_declaration, cp_parser_cache_defarg)
4196 (cp_parser_objc_class_ivars): Set ctor_dtor_or_conv_p.
4197 * pt.c (tsubst_copy, tsubst_copy_and_build): Revert last change.
4198 (build_deduction_guide): Set deduction_guide_type.
4199 (dependent_scope_p): Check deduction_guide_type.
4200 * search.c (lookup_member): Likewise.
4202 2017-03-02 Jakub Jelinek <jakub@redhat.com>
4205 * init.c (mark_exp_read_r): New function.
4206 (emit_mem_initializers): Use cp_walk_tree with mark_exp_read_r on
4207 whole arguments instead of plain mark_exp_read on TREE_LIST values.
4209 2017-03-01 Jason Merrill <jason@redhat.com>
4211 Class template argument deduction in new-expression
4212 * init.c (build_new): Handle deduction from no initializer.
4213 * parser.c (cp_parser_new_expression): Don't require a single
4214 expression for class template deduction.
4215 * typeck2.c (cxx_incomplete_type_diagnostic): Fix diagnostic for
4216 class template placeholder.
4217 * pt.c (tsubst_copy) [TEMPLATE_DECL]: Handle dependent context.
4218 (tsubst_copy_and_build) [TEMPLATE_ID_EXPR]: Handle SCOPE_REF.
4219 (redeclare_class_template): Set TEMPLATE_TYPE_PARM_FOR_CLASS.
4221 2017-03-01 Jakub Jelinek <jakub@redhat.com>
4224 * init.c (emit_mem_initializers): When not constructing vbases of
4225 abstract classes, mark arguments as read for
4226 -Wunused-but-set-parameter.
4228 2017-02-28 Jason Merrill <jason@redhat.com>
4230 Class template argument deduction refinements
4231 * call.c (joust): Move deduction guide tiebreaker down.
4232 * decl.c (start_decl_1, cp_finish_decl, grokdeclarator): Allow class
4233 deduction with no initializer.
4234 * pt.c (build_deduction_guide): Handle implicit default/copy ctor.
4235 (do_class_deduction): Use that rather than special case.
4236 (do_auto_deduction): Handle null initializer.
4238 2017-02-28 Jakub Jelinek <jakub@redhat.com>
4240 * decl.c (find_decomp_class_base): Use cond ? G_("...") : G_("...")
4241 instead of just cond ? "..." : "...".
4242 (grokdeclarator): Likewise.
4243 (build_enumerator): Likewise.
4244 * init.c (build_new_1): Likewise.
4245 * call.c (build_new_method_call_1): Likewise.
4246 * parser.c: Include intl.h.
4247 (cp_parser_oacc_enter_exit_data): Use %s and ternary operator only for
4248 "enter"/"exit" keyword.
4249 (cp_finalize_oacc_routine): Don't use %s to supply portions of the
4252 2017-02-27 Jason Merrill <jason@redhat.com>
4254 PR c++/71568 - SFINAE forming pointer to member function
4255 * init.c (build_offset_ref): Check the return value of
4256 perform_or_defer_access_check.
4258 2017-02-27 Marek Polacek <polacek@redhat.com>
4260 * decl.c (expand_static_init): Add missing } in a comment.
4262 2017-02-27 Volker Reichelt <v.reichelt@netcologne.de>
4264 * init.c: Include intl.h.
4265 (build_new_1): Move message strings into pedwarn to make them
4266 -Wformat-security friendly. Mark string for translation.
4267 * pt.c (tsubst_copy_and_build): Mark string for translation.
4268 Make the pointer const.
4269 * semantics.c (finish_id_expression): Mark strings for translation.
4271 2017-02-25 Jakub Jelinek <jakub@redhat.com>
4273 * call.c (build_op_delete_call): Make msg1 and msg2 const.
4275 2017-02-24 Jakub Jelinek <jakub@redhat.com>
4278 * call.c (build_over_call): Call check_function_arguments even for
4279 -Wrestrict, adjust check_function_arguments caller.
4280 * parser.c (cp_parser_postfix_expression): Don't handle -Wrestrict
4282 * typeck.c (cp_build_function_call_vec): Adjust
4283 check_function_arguments caller.
4285 2017-02-24 Marek Polacek <polacek@redhat.com>
4287 PR translation/79705
4288 * decl.c (check_redeclaration_exception_specification): Mark a string
4289 for translation. Make the pointer const.
4291 2017-02-23 Paolo Carlini <paolo.carlini@oracle.com>
4294 * pt.c (register_specialization): Check duplicate_decls return value
4295 for error_mark_node and pass it back.
4297 2017-02-22 Jason Merrill <jason@redhat.com>
4299 PR c++/79679 - missing destructor for argument
4300 * call.c (build_over_call): Don't pass tf_no_cleanup to argument
4303 * pt.c (do_class_deduction): Handle 0 argument case.
4305 2017-02-22 Jakub Jelinek <jakub@redhat.com>
4308 * parser.c (cp_parser_omp_teams, cp_parser_omp_target): Use
4309 SET_EXPR_LOCATION on OMP_TARGET/OMP_TEAMS tree.
4310 * constexpr.c (potential_constant_expression_1): Handle
4311 OMP_*, OACC_* and CILK_* trees. Use error_at with
4312 EXPR_LOC_OR_LOC (t, input_location) computed early
4313 instead of error, or error_at with location_of (t).
4315 2017-02-22 Marek Polacek <polacek@redhat.com>
4318 * parser.c (cp_parser_std_attribute_spec): Don't build the attribute
4319 if the alignas expression is erroneous.
4320 * pt.c (tsubst_attribute): If tsubst_pack_expansion fails, return
4324 * semantics.c (finish_underlying_type): Bail out for incomplete enums.
4326 2017-02-21 Jason Merrill <jason@redhat.com>
4328 PR c++/50308 - wrong deprecated warning with ADL
4329 PR c++/17729 - duplicate deprecated warning
4330 * semantics.c (finish_id_expression): Only call mark_used on a
4331 function if we aren't building a call.
4333 PR c++/41727 - ICE with partial spec of partial instantiation
4334 * pt.c (process_partial_specialization): For now, don't check more
4335 specialized if there is more than one level of args.
4337 2017-02-21 Marek Polacek <polacek@redhat.com>
4340 * cp-tree.h (maybe_reject_flexarray_init): Declare.
4341 * init.c (maybe_reject_flexarray_init): No longer static.
4342 Add check for current_function_decl.
4343 * parser.c (cp_parser_late_parse_one_default_arg): Reject
4344 a default mem-initializer for a flexible array.
4346 2017-02-21 Jakub Jelinek <jakub@redhat.com>
4347 Paolo Carlini <paolo.carlini@oracle.com>
4350 * decl.c (cp_finish_decomp): Don't set decl's type to error_mark_node
4352 * pt.c (tsubst_decomp_names): Return error_mark_node if the first
4353 decl after the decomposition artificial decl has error_mark_node.
4354 * decl2.c (prune_vars_needing_no_initialization): Use error_operand_p
4355 instead of just == error_mark_node comparison.
4357 2017-02-21 Jakub Jelinek <jakub@redhat.com>
4360 * decl.c: Include gimplify.h.
4361 (cp_finish_decomp): Make sure there is no sharing of trees
4362 in between DECL_VALUE_EXPR of decomposition decls.
4365 * constexpr.c (cxx_eval_array_reference): Diagnose negative subscript.
4368 * constexpr.c (cxx_eval_store_expression): If *valp is a PTRMEM_CST,
4369 call cplus_expand_constant on it first.
4371 2017-02-19 Jason Merrill <jason@redhat.com>
4373 PR c++/78139 - destructor needed by new-expression
4374 * call.c (build_special_member_call): Use tf_no_cleanup.
4376 PR c++/78282 - auto template and pack expansion
4377 * pt.c (find_parameter_packs_r): Don't walk into the type of
4378 templates other than template template-parameters.
4380 PR c++/79606 - ICE with this->base_member in NSDMI
4381 * class.c (build_base_path): Check processing_template_decl.
4383 PR c++/79607 - ICE with T{} initializer
4384 * decl.c (type_dependent_init_p): Check the type of a CONSTRUCTOR.
4386 PR c++/79566 - elaborated-type-specifier in range for
4387 * parser.c (cp_parser_simple_declaration): Fix check for type
4390 PR c++/79400 - confusing suggestion of 'noexcept'
4391 * parser.c (cp_parser_exception_specification_opt): Remove
4392 suggestion for deprecated dynamic exception-specification.
4394 PR c++/79470 - partial ordering with reference parameters
4395 * pt.c (unify) [INDIRECT_REF]: Handle pack expansions.
4397 PR c++/79500 - ICE with non-template deduction guide
4398 * pt.c (do_class_deduction): Use STRIP_TEMPLATE rather than
4399 DECL_TEMPLATE_RESULT.
4401 PR c++/79580 - ICE with compound literal
4402 * parser.c (cp_parser_class_head): If we're in the middle of an
4403 expression, use ts_within_enclosing_non_class.
4405 PR c++/79503 - inherited ctor taking base class
4406 * call.c (add_function_candidate): Also check that
4407 DECL_INHERITED_CTOR_BASE is reference-related to the parameter type.
4409 2017-02-19 Paolo Carlini <paolo.carlini@oracle.com>
4412 * typeck.c (cxx_alignas_expr): Reject a non-integral alignas
4415 2017-02-19 Eric Fiselier <eric@efcs.ca>
4416 Jonathan Wakely <jwakely@redhat.com>
4419 * parser.c (cp_parser_unqualified_id): Use OPT_Wliteral_suffix to
4420 control warning about literal suffix identifiers without a leading
4423 2017-02-17 Jason Merrill <jason@redhat.com>
4425 PR c++/79508 - lookup error with member template
4426 * parser.c (cp_parser_template_name): Clear
4427 parser->context->object_type if we aren't doing lookup.
4429 PR c++/78690 - ICE with using and global type with same name
4430 * pt.c (type_dependent_object_expression_p): True for
4433 PR c++/79549 - C++17 ICE with non-type auto template parameter pack
4434 * pt.c (convert_template_argument): Just return an auto arg pack.
4435 (tsubst_template_args): Don't tsubst an auto pack type.
4437 PR c++/79556 - C++17 ICE with non-type auto
4438 * pt.c (do_auto_deduction): Don't try to deduce from null type.
4440 PR c++/79533 - C++17 ICE with temporary cast to reference
4441 * call.c (build_over_call): Conversion to a reference prevents copy
4444 2017-02-16 Jakub Jelinek <jakub@redhat.com>
4445 Jason Merrill <jason@redhat.com>
4447 PR c++/79502 - lost nodiscard attribute
4448 * pt.c (apply_late_template_attributes): Do apply non-dependent
4449 attributes to types.
4451 2017-02-16 Jason Merrill <jason@redhat.com>
4453 PR c++/78572 - ICE with self-modifying array initializer
4454 * constexpr.c (cxx_eval_store_expression): The object we're
4455 initializing is outside the constant-expression.
4456 (cxx_eval_call_expression): Set ctx->call.
4458 PR c++/79050 - ICE with undeduced auto and LTO
4459 * decl.c (poplevel): Remove undeduced auto decls.
4461 2017-02-16 Jakub Jelinek <jakub@redhat.com>
4464 * parser.c (cp_parser_omp_target): For -fopenmp-simd
4465 ignore #pragma omp target even when not followed by identifier.
4467 2017-02-15 Jason Merrill <jason@redhat.com>
4468 Jakub Jelinek <jakub@redhat.com>
4470 PR c++/79464 - ICE in IPA with omitted constructor parms
4471 * class.c (build_clone): Also omit parms from TYPE_ARG_TYPES.
4472 (adjust_clone_args): Adjust.
4473 (add_method): Remember omitted parms.
4474 * call.c (add_function_candidate): Likewise.
4475 * mangle.c (write_method_parms): Likewise.
4476 * method.c (ctor_omit_inherited_parms): Return false if there are no
4479 2017-02-15 Martin Sebor <msebor@redhat.com>
4482 * init.c (maybe_reject_flexarray_init): New function.
4483 (perform_member_init): Call it.
4485 2017-02-15 Jakub Jelinek <jakub@redhat.com>
4488 * parser.c (cp_parser_std_attribute): Don't pedwarn about
4489 [[deprecated]] with -std=c++11 and [[fallthrough]] with
4490 -std=c++11 and -std=c++14.
4493 * decl.c (grokdeclarator): For static data members, handle thread_p
4494 only after handling inline.
4496 2017-02-14 Marek Polacek <polacek@redhat.com>
4500 * parser.c (cp_parser_postfix_dot_deref_expression): Avoid
4501 clobbering if the postfix expression isn't an EXPR_P.
4503 2017-02-13 Jason Merrill <jason@redhat.com>
4505 PR c++/79461 - ICE with lambda in constexpr constructor
4506 * constexpr.c (build_data_member_initialization): Ignore
4507 initialization of a local variable.
4509 2017-02-13 Jakub Jelinek <jakub@redhat.com>
4511 * init.c (warn_placement_new_too_small): Add missing space in
4513 * parser.c (cp_parser_oacc_declare): Likewise.
4514 * mangle.c (maybe_check_abi_tags): Likewise.
4517 * typeck.c (cp_build_modify_expr): Handle properly COMPOUND_EXPRs
4518 on lhs that have {PRE{DEC,INC}REMENT,MODIFY,MIN,MAX,COND}_EXPR
4519 in the rightmost operand.
4521 2017-02-13 Nathan Sidwell <nathan@acm.org>
4523 PR c++/79296 - ICE mangling localized template instantiation
4524 * decl2.c (determine_visibility): Use template fn context for
4525 local class instantiations.
4527 2017-02-11 Jason Merrill <jason@redhat.com>
4529 PR c++/77659 - ICE with new and C++14 aggregate NSDMI
4530 * init.c (build_new): Make backups of any CONSTRUCTORs in init.
4531 (build_new_1): Use replace_placeholders.
4532 * tree.c (replace_placeholders_t): Also track whether we've seen a
4534 (replace_placeholders, replace_placeholders_r): Adjust.
4535 * cp-tree.h: Adjust.
4537 PR c++/77790 - ICE with auto function in C++11 mode
4538 * decl.c (undeduced_auto_decl): Remove C++14 limitation.
4539 (require_deduced_type): Add complain parm, return bool.
4540 * cp-tree.h: Adjust.
4541 * decl2.c (mark_used): Use require_deduced_type.
4543 2017-02-10 Jason Merrill <jason@redhat.com>
4545 PR c++/78908 - template ops and bitfields
4546 * tree.c (build_min_non_dep): Use unlowered_expr_type.
4548 PR c++/78897 - constexpr union
4549 * constexpr.c (cxx_eval_store_expression): A store to a union member
4550 erases a previous store to another member.
4552 PR c++/71285 - member of fold-expression
4553 * semantics.c (finish_unary_fold_expr)
4554 (finish_binary_fold_expr): Use null type for fold-expressions.
4556 PR c++/79401 - protected inherited constructor
4557 * call.c (enforce_access): For inheriting constructor, find a base
4558 binfo in the path we already have.
4560 2017-02-10 Marek Polacek <polacek@redhat.com>
4563 * pt.c (type_dependent_expression_p): Check if the expression type
4567 * cvt.c (ocp_convert): Add a sentinel against -Wint-in-bool-context
4568 if warnings shouldn't be given.
4570 2017-02-10 Paolo Carlini <paolo.carlini@oracle.com>
4573 * pt.c (tsubst_decl): Don't try to preserve a typedef that names
4574 an error_mark_node as type.
4576 2017-02-09 Jakub Jelinek <jakub@redhat.com>
4577 Jason Merrill <jason@redhat.com>
4580 * pt.c (instantiate_class_template_1): Copy CLASSTYPE_NON_AGGREGATE
4581 from pattern to type.
4583 2017-02-09 Jason Merrill <jason@redhat.com>
4585 PR c++/79316 - default argument in deduction guide
4586 PR c++/79350 - explicit deduction guide
4587 * parser.c (cp_parser_constructor_declarator_p)
4588 (cp_parser_direct_declarator): Parse deduction guides more like
4590 * cp-tree.h (enum special_function_kind): Add sfk_deduction_guide.
4591 * tree.c (special_function_p): Return it.
4592 * decl.c (check_special_function_return_type): Handle it.
4593 (grokdeclarator, grokfndecl): Adjust.
4594 (cp_finish_decl): Pass flags to do_auto_deduction.
4595 * error.c (dump_decl_name): Use TFF_UNQUALIFIED_NAME.
4596 * pt.c (dguide_name_p): Take a const_tree.
4597 (do_class_deduction): Handle explicit.
4598 (do_auto_deduction): Pass flags through.
4599 (build_deduction_guide): Copy explicit flag.
4601 2017-02-09 Jakub Jelinek <jakub@redhat.com>
4604 * parser.c (cp_parser_omp_ordered): Don't check for non-pragma_stmt
4605 non-pragma_compound context here.
4606 (cp_parser_omp_target): Likewise.
4607 (cp_parser_pragma): Don't call push_omp_privatization_clauses and
4608 parsing for ordered and target omp pragmas in non-pragma_stmt
4609 non-pragma_compound contexts.
4612 * parser.c (cp_parser_oacc_declare): Formatting fix.
4613 (cp_parser_omp_declare_target): Don't invoke symtab_node::get on
4614 automatic variables.
4616 2016-02-09 Nathan Sidwell <nathan@codesourcery.com>
4617 Chung-Lin Tang <cltang@codesourcery.com>
4619 * parser.c (cp_parser_oacc_clause_tile): Disallow collapse. Fix
4620 parsing. Parse constant expression. Remove semantic checking.
4621 (cp_parser_omp_clause_collapse): Disallow tile.
4622 (cp_parser_omp_for_loop): Deal with tile clause. Don't emit a parse
4623 error about missing for after already emitting one. Use more
4624 conventional for idiom for unbounded loop.
4625 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_TILE.
4626 * semantics.c (finish_omp_clauses): Correct TILE semantic check.
4627 (finish_omp_for): Deal with tile clause.
4629 2017-02-07 Nathan Sidwell <nathan@acm.org>
4631 * method.c (synthesized_method_base_walk): New. Broken out of ...
4632 (synthesized_method_walk): ... here. Call it. Cleanup
4635 2017-02-07 Patrick Palka <ppalka@gcc.gnu.org>
4638 * typeck2.c (process_init_constructor_union): Consider only
4639 FIELD_DECLs when looking for an NSDMI.
4641 2017-02-06 Jason Merrill <jason@redhat.com>
4643 PR c++/71193 - incomplete types in templates
4644 * parser.c (cp_parser_postfix_dot_deref_expression): In a template
4645 handle incomplete type by pedwarning and then treating as dependent.
4647 2017-02-06 Jakub Jelinek <jakub@redhat.com>
4650 * constexpr.c (cxx_eval_constant_expression): Handle ANNOTATE_EXPR.
4651 (potential_constant_expression_1): Likewise.
4654 * tree.c (build_min_non_dep_op_overload): For POST{INC,DEC}REMENT_EXPR
4655 allow one fewer than expected arguments if flag_permissive.
4658 * decl.c (cp_finish_decomp): On error set decl type to error_mark_node.
4659 * pt.c (tsubst_expr): Don't call tsubst_decomp_names on decompositions
4660 with error_mark_node type.
4662 2017-02-03 Jason Merrill <jason@redhat.com>
4664 PR c++/78689 - ICE on constructor with label
4665 * optimize.c (maybe_clone_body): Replace omitted parameters with
4667 * class.c (build_clone): Fix logic for omitting inherited parms.
4669 PR c++/12245 - excessive memory use
4670 * constexpr.c (maybe_constant_value): Fold maybe_constant_value_1
4671 back in. Don't cache constants.
4672 (maybe_constant_init): Don't cache constants.
4674 PR c++/79294 - ICE with invalid template argument
4675 * pt.c (convert_nontype_argument_function): Check value-dependence.
4676 (convert_nontype_argument): Don't check it here for function ptrs.
4678 2017-02-02 Richard Biener <rguenther@suse.de>
4681 * cp-gimplify.c (cp_fold): When folding a CONSTRUCTOR copy
4682 it lazily on the first changed element only and copy it
4683 fully upfront, only storing changed elements.
4685 2017-02-02 Paolo Carlini <paolo.carlini@oracle.com>
4688 * decl2.c (grokbitfield): In case of error don't set-up DECL_INITIAL
4691 2017-01-31 Jakub Jelinek <jakub@redhat.com>
4694 * error.c (dump_expr) <case COMPONENT_REF>: Don't print .
4697 2017-01-31 David Malcolm <dmalcolm@redhat.com>
4700 * name-lookup.c (suggest_alternative_in_explicit_scope): Resolve
4701 any namespace aliases.
4703 2017-01-31 Nathan Sidwell <nathan@acm.org>
4706 * typeck.c (build_ptrmemfunc_access_expr): Set TREE_NO_WARNING.
4710 * pt.c: (instantiate_decl): Push to top level when current
4711 function scope doesn't match. Only push lmabda scope stack when
4714 * cp-tree.h (instantiate_decl): Make defer_ok bool.
4715 * pt.c: Fix instantiate_decl calls to pass true/false not 0/1
4716 (instantiate_decl): Simplify and reorder state saving and restoration.
4719 * lambda.c (maybe_generic_this_capture): Deal with template-id-exprs.
4720 * semantics.c (finish_member_declaration): Assert class is being
4723 2017-01-30 Alexandre Oliva <aoliva@redhat.com>
4725 Introduce C++ support in libcc1.
4726 * cp-tree.h (struct lang_identifier): Add oracle_looked_up.
4727 (ansi_opname): Rename to...
4728 (cp_operator_id): ... this. Adjust all callers.
4729 (ansi_assopname): Rename to...
4730 (cp_assignment_operator_id): ... this. Adjust all callers.
4731 (cp_literal_operator_id): Declare.
4732 (set_global_friend): Declare.
4733 (is_global_friend): Declare.
4734 (enum cp_oracle_request): New type.
4735 (cp_binding_oracle_function): New type.
4736 (cp_binding_oracle): Declare.
4737 (cp_finish_injected_record_type): Declare.
4738 * friend.c (global_friend): New var.
4739 (set_global_friend): New fn.
4740 (is_global_friend): New fn.
4741 (is_friend): Call is_global_friend.
4742 * name-lookup.c (cp_binding_oracle): New var.
4743 (query_oracle): New fn.
4744 (qualified_lookup_using_namespace): Call query_oracle.
4745 (lookup_name_real_1): Likewise.
4746 * parser.c (cp_literal_operator_id): Drop static.
4747 * search.c (friend_accessible_p): Call is_global_friend.
4748 * semantics.c (is_this_parameter): Accept a variable if the
4749 binding oracle is enabled.
4751 2017-01-27 Jason Merrill <jason@redhat.com>
4753 PR c++/78771 - ICE with inherited constructor.
4754 * call.c (build_over_call): Call deduce_inheriting_ctor here.
4755 * pt.c (tsubst_decl): Not here.
4756 * class.c (add_method): Or here.
4757 * method.c (deduce_inheriting_ctor): Handle clones.
4758 (implicitly_declare_fn): Don't deduce inheriting ctors yet.
4760 2017-01-27 Adam Butcher <adam@jessamine.co.uk>
4763 * cp/parser.c (parsing_default_capturing_generic_lambda_in_template):
4765 * cp/cp-tree.h: Declare it.
4766 * cp/semantics.c (finish_id_expression): Resolve names within a default
4767 capturing generic lambda defined within a template prior to
4768 instantiation to allow for captures to be added to the closure type.
4770 2017-01-26 Jakub Jelinek <jakub@redhat.com>
4773 * cp-tree.def (OFFSETOF_EXPR): Bump number of operands to 2.
4774 * cp-tree.h (finish_offsetof): Add OBJECT_PTR argument.
4775 * parser.c (cp_parser_builtin_offsetof): Pass result of
4776 build_static_cast of null_pointer_node to finish_offsetof.
4777 * semantics.c (finish_offsetof): Add OBJECT_PTR argument, use
4778 it for -Winvalid-offsetof pedwarn instead of trying to guess
4779 original offsetof type from EXPR. Save OBJECT_PTR as a new
4780 second operand to OFFSETOF_EXPR.
4781 * pt.c (tsubst_copy_and_build) <case OFFSETOF_EXPR>: Adjust
4782 finish_offsetof caller, pass the second operand of OFFSETOF_EXPR
4785 2017-01-26 Jason Merrill <jason@redhat.com>
4787 * name-lookup.c (parse_using_directive): Deprecate strong using.
4789 PR c++/79176 - lambda ICE with -flto -Os
4790 * decl2.c (vague_linkage_p): Handle decloned 'tors.
4791 * tree.c (decl_linkage): Likewise.
4793 2017-01-25 Martin Sebor <msebor@redhat.com>
4795 * decl.c (grokdeclarator): Fix a typo in a comment.
4797 2017-01-25 Jakub Jelinek <jakub@redhat.com>
4800 * decl.c (cp_finish_decomp): Disallow memberwise decomposition of
4804 * parser.c (cp_parser_lambda_declarator_opt): Pedwarn with
4805 OPT_Wpedantic on lambda templates for -std=c++14 and higher.
4807 2017-01-25 Maxim Ostapenko <m.ostapenko@samsung.com>
4810 * decl.c (cxx_init_decl_processing): Pass main_input_filename
4811 to build_translation_unit_decl.
4813 2017-01-24 Jakub Jelinek <jakub@redhat.com>
4816 * cp-gimplify.c (cp_genericize_r): Add result of
4817 convert_from_reference on invisiref parm to p_set.
4819 2017-01-24 Nathan Sidwell <nathan@acm.org>
4821 PR c++/78469 - defaulted ctor and inaccessible dtor
4822 * cp-tree.h (tsubst_flags): Add tf_no_cleanup.
4823 * init.c (build_new_1): Pass tf_no_cleanup to build_value_init.
4824 * tree.c (build_target_expr): Check tf_no_cleanup.
4826 PR c++/79118 - anon-members and constexpr
4827 * constexpr.c (cx_check_missing_mem_inits): Caller passes type not
4828 ctor decl. Recursively check anonymous members.
4829 (register_constexpr_fundef): Adjust cx_check_missing_mem_inits
4831 (explain_invalid_constexpr_fn): Likewise.
4833 2017-01-23 Nathan Sidwell <nathan@acm.org>
4835 PR c++/71710 - template using directive of field
4836 * pt.c (tsubst_copy_and_build [COMPONENT_REF]): Move FIELD_DECL
4839 PR c++/71406 - ICE with scope-ref'd template id exprs
4841 * typeck.c (finish_class_member_access_expr): Break up SCOPE_REF
4842 before breaking up TEMPLATE_ID_EXPR.
4844 2017-01-20 Nathan Sidwell <nathan@acm.org>
4846 PR c++/78495 - wrong code inherited ctor and invisi-ref parm
4847 * cp-gimplify.c (cp_generize_r): Don't skip thunks.
4849 2017-01-20 David Malcolm <dmalcolm@redhat.com>
4853 * cp-tree.h (suggest_alternatives_for): Add bool param.
4854 (suggest_alternative_in_explicit_scope): New decl.
4855 * error.c (qualified_name_lookup_error): When SCOPE is a namespace
4856 that isn't the global one, call new function
4857 suggest_alternative_in_explicit_scope, only calling
4858 suggest_alternatives_for if it fails, and disabling near match
4859 searches fort that case. When SCOPE is the global namespace,
4860 pass true for new param to suggest_alternatives_for to allow for
4862 * lex.c (unqualified_name_lookup_error): Pass true for new param
4863 to suggest_alternatives_for.
4864 * name-lookup.c (consider_binding_level): Add forward decl.
4865 (suggest_alternatives_for): Add "suggest_misspellings" param,
4866 using it to conditionalize the fuzzy name-lookup code.
4867 (suggest_alternative_in_explicit_scope): New function.
4868 * parser.c (cp_parser_primary_expression): When calling
4869 finish_id_expression, pass location of id_expression rather
4870 than that of id_expr_token.
4871 (cp_parser_id_expression): Convert local "unqualified_id" from
4872 tree to cp_expr to avoid implicitly dropping location information.
4874 2017-01-20 Marek Polacek <polacek@redhat.com>
4877 * call.c (build_conditional_expr_1): Warn about duplicated branches.
4878 * semantics.c (finish_expr_stmt): Build statement using the proper
4881 2017-01-19 Jason Merrill <jason@redhat.com>
4883 US 20 - forwarding references and class template argument deduction
4884 * cp-tree.h (TEMPLATE_TYPE_PARM_FOR_CLASS): New.
4885 * pt.c (push_template_decl_real): Set it.
4886 (maybe_adjust_types_for_deduction): Check it.
4887 (rewrite_template_parm): Copy it.
4889 US 19 - deduction guides and constructors
4890 * call.c (joust): Prefer deduction guides to constructors.
4891 * pt.c (build_deduction_guide): Set DECL_ARTIFICIAL.
4892 (deduction_guide_p): Check DECL_P.
4894 * decl.c (check_initializer): Always use build_aggr_init for array
4897 PR c++/79130 - decomposition and direct-initialization
4898 * init.c (build_aggr_init): Communicate direct-initialization to
4900 (build_vec_init): Check for array copy sooner.
4901 * parser.c (cp_parser_decomposition_declaration): Remove call to
4902 build_x_compound_expr_from_list.
4904 2017-01-18 Jason Merrill <jason@redhat.com>
4906 PR c++/68666 - member variable template-id
4907 * typeck.c (finish_class_member_access_expr): Handle variable
4909 * pt.c (lookup_and_finish_template_variable): No longer static.
4910 * cp-tree.h: Declare it.
4912 2017-01-18 Nathan Sidwell <nathan@acm.org>
4915 * call.c (build_over_call): When checking ellipsis conversions for
4916 an inherited ctor, make sure there is at least one conversion.
4918 2017-01-18 Jason Merrill <jason@redhat.com>
4920 PR c++/78894 - ICE with class deduction and default arg
4921 * pt.c (build_deduction_guide): Set DECL_PRIMARY_TEMPLATE.
4923 2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de>
4926 * mangle.c (write_discriminator): Reorganize abi warning check.
4928 2017-01-18 Nathan Sidwell <nathan@acm.org>
4930 * cp-tree.h: Clarify exception spec node comment.
4931 * except.c (nothrow_spec_p): Simplify by checking node-equality.
4934 * mangle.c (write_exception_spec): Check nothrow explicitly.
4935 (write_encoding): Don't increment processing_template_decl around
4938 2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de>
4941 * mangle.c (write_template_args): Add "on" for operator names.
4943 2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de>
4946 * mangle.c (write_discriminator): Handle discriminator >= 10.
4948 2017-01-17 Nathan Sidwell <nathan@acm.org>
4951 * cp-tree.h (maybe_generic_this_capture): Declare.
4952 * lambda.c (resolvable_dummy_lambda): New, broken out of ...
4953 (maybe_resolve_dummy): ... here. Call it.
4954 (maybe_generic_this_capture): New.
4955 * parser.c (cp_parser_postfix_expression): Speculatively capture
4956 this in generic lambda in unresolved member function call.
4957 * pt.c (tsubst_copy_and_build): Force hard error from failed
4958 member function lookup in generic lambda.
4960 2017-01-17 Aldy Hernandez <aldyh@redhat.com>
4963 * cp-array-notation.c (expand_array_notation_exprs): Handle
4966 2017-01-11 Jason Merrill <jason@redhat.com>
4968 PR c++/78337 - ICE on invalid with generic lambda
4969 * semantics.c (process_outer_var_ref): Check if containing_function
4970 is null. Move inform call under complain test.
4972 2017-01-11 Nathan Sidwell <nathan@acm.org>
4975 * name-lookup.c (set_namespace_binding_1): An overload of 1 decl
4978 2017-01-11 Nathan Sidwell <nathan@acm.org>
4980 * name-lookup.c (push_overloaded_decl_1): Refactor OVERLOAD creation.
4982 2017-01-11 Jakub Jelinek <jakub@redhat.com>
4985 * parser.c (cp_parser_std_attribute_spec): Remove over-eager
4986 assertion. Formatting fix.
4989 * decl2.c (c_parse_final_cleanups): Set flag_syntax_only to 1 after
4992 2017-01-10 David Malcolm <dmalcolm@redhat.com>
4995 * parser.c (cp_parser_class_specifier_1): Only suggest inserting
4996 a missing semicolon if we have a valid insertion location for
4999 2017-01-10 Jason Merrill <jason@redhat.com>
5001 FI 20, decomposition declaration with parenthesized initializer.
5002 * parser.c (cp_parser_decomposition_declaration): Use
5003 cp_parser_initializer.
5005 2017-01-09 Jason Merrill <jason@redhat.com>
5007 Implement P0195R2, C++17 variadic using.
5008 * parser.c (cp_parser_using_declaration): Handle ellipsis and comma.
5009 * pt.c (tsubst_decl): Handle pack expansion in USING_DECL_SCOPE.
5010 * error.c (dump_decl): Likewise.
5012 2017-01-09 Jakub Jelinek <jakub@redhat.com>
5014 PR translation/79019
5015 PR translation/79020
5016 * semantics.c (finish_omp_clauses): Add missing whitespace to
5017 translatable strings.
5018 * cp-cilkplus.c (cpp_validate_cilk_plus_loop_aux): Fix comment typo.
5020 2017-01-07 Jason Merrill <jason@redhat.com>
5022 PR c++/78948 - instantiation from discarded statement
5023 * parser.h (struct cp_parser): Remove in_discarded_stmt field.
5024 * cp-tree.h (in_discarded_stmt): Declare it.
5025 (struct saved_scope): Add discarded_stmt bitfield.
5026 (in_discarded_stmt): New macro.
5027 * decl2.c (mark_used): Check it.
5028 * parser.c (cp_parser_selection_statement): Adjust.
5029 (cp_parser_jump_statement): Adjust.
5031 2017-01-05 Jakub Jelinek <jakub@redhat.com>
5034 * decl.c (cp_finish_decomp): Remove probe variable, if tt is
5035 REFERENCE_REF_P, set tt to its operand.
5038 * class.c (check_field_decls): Diagnose REFERENCE_TYPE fields in
5039 unions even for C++11 and later.
5041 2017-01-05 Nathan Sidwell <nathan@acm.org>
5044 * pt.c (convert_nontype_argument): Don't try and see if integral
5045 or enum expressions are constants prematurely.
5047 2017-01-04 Marek Polacek <polacek@redhat.com>
5050 * typeck.c (cp_build_binary_op): Warn when a pointer is compared with
5051 a zero character literal.
5053 2017-01-04 Jakub Jelinek <jakub@redhat.com>
5056 * typeck.c (cp_build_unary_op): Call mark_rvalue_use on arg if it has
5060 * parser.c (cp_parser_simple_declaration): Only complain about
5061 inconsistent auto deduction if auto_result doesn't use auto.
5063 * parser.c (cp_parser_simple_declaration): Diagnose function
5064 declaration among more than one init-declarators with auto
5068 * parser.c (cp_lexer_previous_token): Use vec_safe_address in the
5069 assertion, as lexer->buffer may be NULL.
5071 2017-01-04 Marek Polacek <polacek@redhat.com>
5075 * constexpr.c (potential_constant_expression_1): Handle CLEANUP_STMT.
5077 2017-01-04 Nathan Sidwell <nathan@acm.org>
5080 * cp-tree.h (DECLTYPE_FOR_REF_CAPTURE): New.
5081 (lambda_capture_field_type): Update prototype.
5082 * lambda.c (lambda_capture_field_type): Add is_reference parm.
5083 Add referenceness here.
5084 (add_capture): Adjust lambda_capture_field_type call, refactor
5086 * pt.c (tsubst): Adjust lambda_capture_field_type call.
5088 2017-01-01 Jakub Jelinek <jakub@redhat.com>
5090 Update copyright years.
5092 Copyright (C) 2017 Free Software Foundation, Inc.
5094 Copying and distribution of this file, with or without modification,
5095 are permitted in any medium without royalty provided the copyright
5096 notice and this notice are preserved.