1 2017-11-16 Jason Merrill <jason@redhat.com>
3 PR c++/79092 - non-type args of different types are different
4 * tree.c (cp_tree_equal): Check the type of constants.
5 * pt.c (unify) [TEMPLATE_PARM_INDEX]: Handle UNIFY_ALLOW_INTEGER
6 when comparing to previously deduced argument.
7 (maybe_convert_nontype_argument): New.
8 (convert_nontype_argument): Call it.
9 (tsubst_copy_and_build): Handle partial instantiation of
11 (unify): Ignore type when deducing from array bound.
12 (dependent_type_p_r): Handle DEFERRED_NOEXCEPT.
13 (value_dependent_expression_p): Any type-dependent expression is
14 value-dependent. Handle IMPLICIT_CONV_EXPR.
15 * cp-tree.h (IMPLICIT_CONV_EXPR_NONTYPE_ARG): New.
16 * mangle.c (write_template_arg): Strip IMPLICIT_CONV_EXPR.
18 2017-11-16 Nathan Sidwell <nathan@acm.org>
22 * cp-objcp-common.h (LANG_HOOKS_OVERWRITE_DECL_ASSEMBLER_NAME):
24 * cp-tree.h (overwrite_mangling): Declare.
25 * decl2.c (struct mangled_decl_hash): Entries are deletable.
26 (overwrite_mangling): New.
29 * decl.c (xref_tag_1): Push lambda into current scope.
30 * name-lookup.c (do_pushtag): Don't deal with ts_lambda here.
32 2017-11-15 Nathan Sidwell <nathan@acm.org>
35 * lambda.c (lambda_capture_field_type): Function references are
36 always catured by reference.
38 2017-11-15 Martin Liska <mliska@suse.cz>
40 * decl.c (begin_destructor_body): Use cp_build_fold_indirect_ref
41 instead of cp_build_indirect_ref.
43 2017-11-15 Martin Liska <mliska@suse.cz>
45 * decl.c (begin_destructor_body): In case of VPTR sanitization
46 (with disabled recovery), zero vptr in order to catch virtual calls
47 after lifetime of an object.
49 2017-11-14 Jason Merrill <jason@redhat.com>
51 Use GTY((cache)) on some hash tables.
52 * decl.c (decomp_type_table): Use tree_cache_map.
53 * init.c (nsdmi_inst): Likewise.
54 * pt.c (defarg_ints): Likewise.
55 * cp-objcp-common.c (cp_get_debug_type): Likewise.
57 2017-11-13 Jason Merrill <jason@redhat.com>
59 Capture adjustments for P0588R1.
60 * semantics.c (process_outer_var_ref): Capture variables when
61 they are named; complain about non-capture uses when odr-used.
62 * expr.c (mark_use): Rvalue use looks through capture proxy.
63 * constexpr.c (potential_constant_expression_1): Improve error about
64 use of captured variable.
65 * lambda.c (need_generic_capture, dependent_capture_r)
66 (do_dependent_capture, processing_nonlambda_template): Remove.
67 * call.c (build_this): Remove uses of the above.
68 * decl.c (cp_finish_decl): Likewise.
69 * semantics.c (maybe_cleanup_point_expr)
70 (maybe_cleanup_point_expr_void, finish_goto_stmt)
71 (maybe_convert_cond): Likewise.
72 * typeck.c (check_return_expr): Likewise.
75 * typeck.c (cp_build_fold_indirect_ref): New.
76 (cp_build_indirect_ref_1): Split out from cp_build_indirect_ref.
78 * cp-tree.h: Declare cp_build_fold_indirect_ref.
79 * call.c, class.c, cp-ubsan.c, decl.c, except.c, init.c, lambda.c,
80 parser.c, rtti.c, tree.c, typeck.c, typeck2.c: Use it.
81 * parser.c (do_range_for_auto_deduction): Use RO_UNARY_STAR.
82 (cp_convert_range_for): Likewise.
83 * typeck2.c (build_x_arrow): Use RO_ARROW.
85 * cp-ubsan.c (cp_ubsan_check_member_access_r): Fix handling of
86 INDIRECT_REF of ADDR_EXPR.
88 PR c++/82360 - ICE with static_cast in template.
89 * call.c (perform_direct_initialization_if_possible): Check
90 processing_template_decl.
91 * typeck.c (build_static_cast_1): Likewise.
93 2017-11-13 Ville Voutilainen <ville.voutilainen@gmail.com>
95 Remove the null check from placement new in all modes
96 * init.c (build_new_1): Don't do a null check for
97 a namespace-scope non-replaceable placement new
98 in any mode unless -fcheck-new is provided.
100 2017-11-07 Boris Kolpackov <boris@codesynthesis.com>
102 * Make-lang.in (CP_PLUGIN_HEADERS): Add operators.def since included
105 2017-11-07 Jakub Jelinek <jakub@redhat.com>
108 * cp-gimplify.c (cxx_omp_clause_apply_fn): For methods pass i - 1 to
109 convert_default_arg instead of i.
111 2017-11-06 Jason Merrill <jason@redhat.com>
113 P0704R1 - fixing const-qualified pointers to members
114 * typeck2.c (build_m_component_ref): Also accept in lower stds with
117 2017-11-06 Paolo Carlini <paolo.carlini@oracle.com>
120 * decl2.c (finish_static_data_member_decl): If there's an initializer,
121 complete the type and re-apply the quals.
123 2017-11-06 Martin Liska <mliska@suse.cz>
126 * constexpr.c (cxx_eval_builtin_function_call): Handle
127 __builtin_unreachable call.
128 (get_function_named_in_call): Declare function earlier.
129 (constexpr_fn_retval): Skip __builtin_unreachable.
130 * cp-gimplify.c (cp_ubsan_maybe_instrument_return): Rename to
132 (cp_maybe_instrument_return): ... this.
133 (cp_genericize): Call the function unconditionally.
135 2017-11-03 Nathan Sidwell <nathan@acm.org>
138 * decl.c (grokdeclarator): Protect MAYBE_CLASS things from paren
141 2017-11-02 Paolo Carlini <paolo.carlini@oracle.com>
144 * pt.c (make_pack_expansion): Add tsubst_flags_t parameter.
145 (expand_integer_pack, convert_template_argument, coerce_template_parms,
146 gen_elem_of_pack_expansion_instantiation, tsubst_pack_expansion,
147 unify): Adjust calls.
148 * tree.c (cp_build_qualified_type_real): Likewise.
149 * cp-tree.h (make_pack_expansion): Adjust declaration.
151 2017-11-02 Nathan Sidwell <nathan@acm.org>
153 * cp-tree.h (IDENTIFIER_NEWDEL_OP_P): Restore, adjust.
154 (IDENTIFIER_NEW_OP_P): New.
155 * decl.c (grokdeclarator): Restore IDENTIFIER_NEWDEL_OP_P use.
156 * pt.c (push_template_decl_real): Likewise.
157 * typeck.c (check_return_expr): Use IDENTIFIER_NEW_OP_P.
160 * decl.c (grokdeclarator): Don't warn when parens protect a return
161 type from a qualified name.
163 2017-11-01 Nathan Sidwell <nathan@acm.org>
165 * cp-tree.h (enum cp_identifier_kind): Delete cik_newdel_op.
166 Renumber and reserve udlit value.
167 (IDENTIFIER_NEWDEL_OP_P): Delete.
168 (IDENTIFIER_OVL_OP_P): New.
169 (IDENTIFIER_ASSIGN_OP_P): Adjust.
170 (IDENTIFIER_CONV_OP_P): Adjust.
171 (IDENTIFIER_OVL_OP_INFO): Adjust.
172 (IDENTIFIER_OVL_OP_FLAGS): New.
173 * decl.c (grokdeclarator): Use IDENTIFIER_OVL_OP_FLAGS.
174 * lex.c (get_identifier_kind_name): Adjust.
175 (init_operators): Don't special case new/delete ops.
176 * mangle.c (write_unqualified_id): Use IDENTIFIER_OVL_OP_P.
177 * pt.c (push_template_decl_real): Use IDENTIFIER_OVL_OP_FLAGS.
178 * typeck.c (check_return_expr): Likewise.
180 * cp-tree.h (assign_op_identifier, call_op_identifier): Use
182 (struct lang_decl_fn): Use compressed operator code.
183 (DECL_OVERLOADED_OPERATOR_CODE): Replace with ...
184 (DECL_OVERLOADED_OPERATOR_CODE_RAW): ... this.
185 (DECL_OVERLOADED_OPERATOR_CODE_IS): Use it.
186 * decl.c (duplicate_decls): Use DECL_OVERLOADED_OPERATOR_CODE_RAW.
187 (build_library_fn): Likewise.
188 (grok_op_properties): Likewise.
189 * mangle.c (write_unqualified_name): Likewise.
190 * method.c (implicitly_declare_fn): Likewise.
191 * typeck.c (check_return_expr): Use DECL_OVERLOADED_OPERATOR_IS.
193 * cp-tree.h (IDENTIFIER_CP_INDEX): Define.
194 (enum ovl_op_flags): Add OVL_OP_FLAG_AMBIARY.
195 (enum ovl_op_code): New.
196 (struct ovl_op_info): Add ovl_op_code field.
197 (ovl_op_info): Size by OVL_OP_MAX.
198 (ovl_op_mapping, ovl_op_alternate): Declare.
199 (OVL_OP_INFO): Adjust for mapping array.
200 (IDENTIFIER_OVL_OP_INFO): New.
201 * decl.c (ambi_op_p, unary_op_p): Delete.
202 (grok_op_properties): Use IDENTIFIER_OVL_OP_INFO and
204 * lex.c (ovl_op_info): Adjust and static initialize.
205 (ovl_op_mappings, ovl_op_alternate): Define.
206 (init_operators): Iterate over ovl_op_info array and init mappings
208 * mangle.c (write_unqualified_id): Use IDENTIFIER_OVL_OP_INFO.
209 * operators.def (DEF_OPERATOR): Remove KIND parm.
210 (DEF_SIMPLE_OPERATOR): Delete.
211 (OPERATOR_TRANSITION): Expand if defined.
213 2017-10-31 David Malcolm <dmalcolm@redhat.com>
215 * pt.c (listify): Use %< and %> for description of #include.
217 2017-10-31 David Malcolm <dmalcolm@redhat.com>
219 * class.c (explain_non_literal_class): Use UNKNOWN_LOCATION rather
221 * name-lookup.c (suggest_alternatives_for): Update for renaming of
223 (maybe_suggest_missing_header): Likewise.
224 (suggest_alternative_in_explicit_scope): Likewise.
225 * parser.c (cp_parser_diagnose_invalid_type_name): Likewise for
226 renaming of error_at_rich_loc.
227 (cp_parser_string_literal): Likewise.
228 (cp_parser_nested_name_specifier_opt): Likewise.
229 (cp_parser_cast_expression): Likewise for renaming of
231 (cp_parser_decl_specifier_seq): Likewise for renaming of
232 error_at_rich_loc and warning_at_rich_loc.
233 (cp_parser_elaborated_type_specifier): Likewise for renaming of
235 (cp_parser_cv_qualifier_seq_opt): Likewise for renaming of
237 (cp_parser_virt_specifier_seq_opt): Likewise.
238 (cp_parser_class_specifier_1): Likewise.
239 (cp_parser_class_head): Likewise.
240 (cp_parser_member_declaration): Likewise for renaming of
241 pedwarn_at_rich_loc, warning_at_rich_loc, and error_at_rich_loc.
242 (cp_parser_enclosed_template_argument_list): Likewise for renaming
243 of error_at_rich_loc.
244 (set_and_check_decl_spec_loc): Likewise.
245 * pt.c (listify): Likewise.
246 * rtti.c (typeid_ok_p): Likewise.
247 * semantics.c (process_outer_var_ref): Use UNKNOWN_LOCATION rather
249 * typeck.c (access_failure_info::maybe_suggest_accessor): Update
250 for renaming of inform_at_rich_loc.
251 (finish_class_member_access_expr): Likewise for renaming of
254 2017-10-31 Nathan Sidwell <nathan@acm.org>
256 * cp-tree.h (struct operator_name_info_t): Rename to ...
257 (struct ovl_op_info_t): ... here. Add tree_code field.
258 (operator_name_info, assignment_operator_name_info): Delete.
259 (ovl_op_info): Declare.
260 (OVL_OP_INFO): Adjust.
261 * decl.c (grok_op_properties): Use ovl_op_flags.
262 * lex.c (operator_name_info, assignment_operator_name_info):
264 (ovl_op_info): Define.
265 (set_operator_ident): Adjust.
266 (init_operators): Set tree_code.
267 * mangle.c (write_unqualified_id): Adjust operator array scan.
269 * lex.c (init_operators): Allow NULL operator name. Don't add
271 * operators.def: Use NULL for mangling only operators. Move to
272 after regular operators but move assignment operators last.
274 * cp-tree.h (enum ovl_op_flags): New.
275 (struct operator_name_info_t): Rename arity to flags.
276 * lex.c (set_operator_ident): New.
277 (init_operators): Use it. Adjust for flags.
278 * mangle.c (write_unqualified_id): Adjust for flags.
279 * operators.def: Replace arity with flags.
281 * cp-tree.h (ovl_op_identifier): New.
282 (assign_op_identifier, call_op_identifier): Adjust.
283 (cp_operator_id, cp_assignment_operator_ide): Delete.
284 (SET_OVERLOADED_OPERATOR_CODE): Delete.
286 * call.c (op_error): Use OVL_OP_INFO.
287 (build_conditional_expr_1): Use ovl_op_identifier.
288 (build_new_op_1): Use OVL_OP_INFO & ovl_op_identifier.
289 (build_op_delete_call): Likewise.
290 * class.c (type_requires_array_cookie): Use ovl_op_identifier.
291 * decl.c (duplicate_decls): Directly copy operator code.
292 (builtin_function_1): Do not set operator code.
293 (build_library_fn): Directly set operator code.
294 (push_cp_library_fn): Use ovl_op_identifier.
295 (grok_op_properties): Directly set operator code.
296 * decl2.c (maybe_warn_sized_delete): Use ovl_op_identifier.
297 * error.c (dump_expr): Use OVL_OP_INFO.
298 (op_to_string): Add assop arg. Use OVL_OP_INFO.
299 (assop_to_string): Delete.
300 (args_to_string): Adjust.
301 * init.c (build_new_1): Use ovl_op_identifier.
302 * mangle.c (write_unqualified_name): Use OVL_OP_INFO.
303 (write_expression): Likewise.
304 * method.c (synthesized_method_walk): Use ovl_op_identifier.
305 (implicitly_declare_fn): Use assign_op_identifier. Directly set
307 * name-lookup.c (get_class_binding): Use assign_op_identifier.
308 * parser.c (cp_parser_operator): Use ovl_op_identifier.
309 (cp_parser_omp_clause_reduction): Likewise.
310 * semantics.c (omp_reduction_id): Likewise.
311 * typeck.c (cxx_sizeof_or_alignof_type): Use OVL_OP_INFO.
313 * cp-tree.h (assign_op_identifier, call_op_identifier): Define.
314 (LAMBDA_FUNCTION_P): Use DECL_OVERLOADED_OPERATOR_IS.
315 (DECL_OVERLOADED_OPERATOR_P): Just retuurn true/false.
316 (DECL_OVERLOADED_OPERATOR_CODE, DECL_OVERLOADED_OPERATOR_IS): Define.
317 * call.c (add_function_candidate): Use
318 DECL_OVERLOADED_OPERATOR_IS.
319 (build_op_call_1): Use call_op_identifier &
320 DECL_OVERLOADED_OPERATOR_IS.
321 (build_over_call): Likewise.
322 (has_trivial_copy_assign_p): Use assign_op_identifier.
323 (build_special_member_call): Likewise.
324 * class.c (dfs_declare_virt_assop_and_dtor): Likewise.
325 (vbase_has_user_provided_move_assign,
326 classtype_has_move_assign_or_move_ctor_p): Likewise.
327 * decl.c (duplicate_decls): Use DECL_OVERLOADED_OPERATOR_CODE.
328 (grok_special_member_properties): Use assign_op_identifier.
329 (start_preparsed_function): Use DECL_OVERLOADED_OPERATOR_IS.
330 * decl2.c (mark_used): Use DECL_CONV_FN_P.
331 * dump.c (dump_access): Delete prototype.
333 (cp_dump_tree): Don't call it.
334 * lambda.c (lambda_function): Use call_op_identifier.
335 (maybe_add_lambda_conv_op): Not an overloaded operator. Remove
337 * mangle.c (write_unqualified_name): Use DECL_OVERLOADED_OPERTOR_CODE.
338 * method.c (do_build_copy_assign): Use assign_op_identifier.
339 (synthesize_method): Use DECL_OVERLOADED_OPERATOR_IS.
340 (get_copy_assign): Use assign_op_identifier.
341 (synthesized_method_walk): Likewise.
342 (defaultable_fn_check): Use DECL_OVERLOADED_OPERATOR_IS.
343 * parser.c (cp_parser_lambda_declarator_opt): Use
345 * semanitics.c (classtype_has_nothrow_assign_or_copy_p): Use
346 assign_op_identifier.
347 * tree.c (special_function_p): Use DECL_OVERLOADED_OPERATOR_IS.
348 * typeck.c (check_return_expr): Use DECL_OVERLOADED_OPERATOR_CODE.
349 (check_return_expr): Use assign_op_identifier.
351 2017-10-30 Paolo Carlini <paolo.carlini@oracle.com>
354 * pt.c (tsubst_copy_and_build, [INDIRECT_REF]): For a REFERENCE_REF_P,
355 unconditionally call convert_from_reference.
357 2017-10-30 Nathan Sidwell <nathan@acm.org>
359 * call.c (build_op_call_1): Test for FUNCTION_DECL in same manner
360 as a few lines earlier.
361 * cp-tree.h (PACK_EXPANSION_PATTERN): Fix white space.
362 * decl.c (grokfndecl): Fix indentation.
363 (compute_array_index_type): Use processing_template_decl_sentinel.
364 (grok_op_properties): Move warnings to end. Reorder other checks
365 to group similar entities. Tweak diagnostics.
366 * lex.c (unqualified_name_lookup_error): No need to check name is
367 not ERROR_MARK operator.
368 * parser.c (cp_parser_operator): Select operator code before
370 * typeck.c (check_return_expr): Fix indentation and line wrapping.
372 2017-10-27 Paolo Carlini <paolo.carlini@oracle.com>
374 * pt.c (invalid_nontype_parm_type_p): Return a bool instead of an int.
376 2017-10-26 Nathan Sidwell <nathan@acm.org>
378 * decl.c (sort_labels): Restore function.
379 (pop_labels): Sort labels
380 (identify_goto): Add translation markup.
382 2017-10-25 Nathan Sidwell <nathan@acm.org>
384 Kill IDENTIFIER_LABEL_VALUE.
385 * cp-tree.h (lang_identifier): Delete label_value slot.
386 (IDENTIFIER_LABEL_VALUE, SET_IDENTIFIER_LABEL_VALUE): Delete.
387 (struct named_label_hasher): Rename to ...
388 (struct named_label_hash): ... here. Reimplement.
389 (struct language_function): Adjust x_named_labels.
390 * name-lookup.h (struct cp_label_binding): Delete.
391 (struct cp_binding_level): Delete shadowed_labels slot.
392 * decl.c (struct named_label_entry): Add name and outer slots.
393 (pop_label): Rename to ...
394 (check_label_used): ... here. Don't pop.
395 (note_label, sort_labels): Delete.
396 (pop_labels, pop_local_label): Reimplement.
397 (poplevel): Pop local labels as any other decl. Remove
398 shadowed_labels handling.
399 (named_label_hash::hash, named_label_hash::equal): New.
400 (make_label_decl): Absorb into ...
401 (lookup_label_1): ... here. Add making_local_p arg, reimplement.
402 (lookup_label, declare_local_label): Adjust.
403 (check_goto, define_label): Adjust.
404 * lex.c (make_conv_op_name): Don't clear IDENTIFIER_LABEL_VALUE.
405 * ptree.c (cxx_print_identifier): Don't print identifier binding.
407 * decl.c (identifier_goto): Reduce duplication.
408 (check_previous_goto_1): Likewise.
409 (check_goto): Move var decls to initialization.
410 (check_omp_return, define_label_1, define_label): Likewise.
412 2017-10-25 Jakub Jelinek <jakub@redhat.com>
415 * decl.c (duplicate_decls): Copy "omp declare simd" attributes from
416 newdecl to corresponding __builtin_ if any.
418 2017-10-24 Paolo Carlini <paolo.carlini@oracle.com>
421 * decl.c (duplicate_decls): Warn for built-in functions declared as
422 non-function, use OPT_Wbuiltin_declaration_mismatch.
424 * decl.c (duplicate_decls): Avoid redundant '+' in warning_at.
426 2017-10-24 Paolo Carlini <paolo.carlini@oracle.com>
429 * pt.c (value_dependent_expression_p, [TRAIT_EXPR]): Handle
430 a TREE_LIST as TRAIT_EXPR_TYPE2.
432 2017-10-24 Mukesh Kapoor <mukesh.kapoor@oracle.com>
433 Paolo Carlini <paolo.carlini@oracle.com>
436 * cvt.c (type_promotes_to): Implement C++17, 7.6/4, about unscoped
437 enumeration type whose underlying type is fixed.
439 2017-10-23 Paolo Carlini <paolo.carlini@oracle.com>
442 * semantics.c (finish_compound_literal): Check do_auto_deduction
443 return value for error_mark_node.
445 2017-10-23 Jason Merrill <jason@redhat.com>
447 PR c++/77369 - wrong noexcept handling in C++14 and below
448 * tree.c (strip_typedefs): Canonicalize TYPE_RAISES_EXCEPTIONS.
450 2017-10-20 Nathan Sidwell <nathan@acm.org>
452 * class.c (layout_class_type): Cleanup as-base creation, determine
454 (finish_struct_1): ... not here.
456 2017-10-19 Jakub Jelinek <jakub@redhat.com>
459 * typeck.c (check_return_expr): Don't call
460 maybe_warn_about_returning_address_of_local in templates.
462 2017-10-17 Nathan Sidwell <nathan@acm.org>
465 * call.c (build_over_call): Don't pass tf_no_cleanup to nested
469 * cp-objcp-common.c (cp_tree_size): Reformat. Adjust returns size
472 2017-10-13 Jason Merrill <jason@redhat.com>
474 PR c++/82357 - bit-field in template
475 * tree.c (cp_stabilize_reference): Just return a NON_DEPENDENT_EXPR.
477 2017-10-13 David Malcolm <dmalcolm@redhat.com>
479 * cp-tree.h (maybe_show_extern_c_location): New decl.
480 * decl.c (grokfndecl): When complaining about literal operators
481 with C linkage, issue a note giving the location of the
483 * parser.c (cp_parser_new): Initialize new field
484 "innermost_linkage_specification_location".
485 (cp_parser_linkage_specification): Store the location
486 of the linkage specification within the cp_parser.
487 (cp_parser_explicit_specialization): When complaining about
488 template specializations with C linkage, issue a note giving the
489 location of the extern "C".
490 (cp_parser_explicit_template_declaration): Likewise for templates.
491 (maybe_show_extern_c_location): New function.
492 * parser.h (struct cp_parser): New field
493 "innermost_linkage_specification_location".
495 2017-10-12 Nathan Sidwell <nathan@acm.org>
497 * cp-tree.h (cp_expr): Add const operator * and operator->
499 (cp_tree_node_structure_enum): Delete TS_CP_BINDING,
500 TS_CP_WRAPPER, LAST_TS_CP_ENUM.
502 2017-10-12 David Malcolm <dmalcolm@redhat.com>
504 * parser.c (get_required_cpp_ttype): New function.
505 (cp_parser_error_1): Call it, using the result to call
506 maybe_suggest_missing_token_insertion.
508 2017-10-12 David Malcolm <dmalcolm@redhat.com>
510 * parser.c (get_matching_symbol): Move to before...
511 (cp_parser_error): Split out into...
512 (cp_parser_error_1): ...this new function, merging in content
514 (cp_parser_required_error): ...here. Eliminate partial duplicate
515 of body of cp_parser_error in favor of a call to the new
516 cp_parser_error_1 helper function.
518 2017-10-11 Nathan Sidwell <nathan@acm.org>
520 * decl2.c (struct mangled_decl_hash): Use DECL_ASSEMBLER_NAME_RAW.
521 (record_mangling): Likewise.
523 2017-10-10 Nathan Sidwell <nathan@acm.org>
525 * name-lookup.c (extern_c_fns): Rename to ...
526 (extern_c_decls): ... here.
527 (check_extern_c_conflict, extern_c_linkage_bindings): Update.
528 (do_pushdecl): Check extern-c fns and vars.
530 * cp-tree.h (default_hash_traits <lang_identifier *>): Delete
533 * decl2.c (struct mangled_decl_hash): New hash traits.
534 (mangled_decls): Make hash_table<mangled_decl_hash>.
535 (generate_mangling_alias, record_mangling): Adjust.
537 2017-10-10 Jason Merrill <jason@redhat.com>
539 More delayed lambda capture fixes.
540 * call.c (add_function_candidate): Use build_address.
541 (build_op_call_1): Call mark_lvalue_use early.
542 (build_over_call): Handle error from build_this.
543 * constexpr.c (cxx_bind_parameters_in_call): Use build_address.
544 (cxx_eval_increment_expression): Don't use rvalue().
545 * cvt.c (convert_to_void): Use mark_discarded_use.
546 * expr.c (mark_use): Handle PARM_DECL, NON_DEPENDENT_EXPR. Fix
547 reference handling. Don't copy the expression.
548 (mark_discarded_use): New.
549 * lambda.c (insert_capture_proxy): Add some sanity checking.
550 (maybe_add_lambda_conv_op): Set cp_unevaluated_operand.
551 * pt.c (register_local_specialization): Add sanity check.
552 * semantics.c (process_outer_var_ref): Fix check for existing proxy.
553 * typeck.c (cp_build_addr_expr_1): Handle error from
555 (cp_build_modify_expr): Call mark_lvalue_use_nonread, handle error
558 Handle generic lambda capture in dependent expressions.
559 * lambda.c (need_generic_capture, dependent_capture_r)
560 (do_dependent_capture): New.
561 * pt.c (processing_nonlambda_template): Use need_generic_capture.
562 * semantics.c (maybe_cleanup_point_expr)
563 (maybe_cleanup_point_expr_void, finish_goto_stmt)
564 (maybe_convert_cond): Call do_dependent_capture.
565 * typeck.c (build_static_cast): Remove dependent capture handling.
567 * typeck.c (condition_conversion): Assert !processing_template_decl.
568 * semantics.c (finish_omp_clauses): Don't
569 fold_build_cleanup_point_expr if processing_template_decl.
570 (outer_var_p): A temporary can't be from an outer scope.
571 * pt.c (type_dependent_expression_p): Fix dependency checking of
572 functions without DECL_TEMPLATE_INFO.
573 (instantiate_decl): Use lss_copy.
574 * constexpr.c (is_valid_constexpr_fn): Fix lambdas before C++17.
576 * typeck.c (check_return_expr): Check non-dependent conversion in
578 * constraint.cc (check_function_concept): Don't complain about an
579 empty concept if seen_error.
581 2017-10-10 Richard Sandiford <richard.sandiford@linaro.org>
583 * cvt.c (ignore_overflows): Use wi::to_wide when
584 operating on trees as wide_ints.
585 * decl.c (check_array_designated_initializer): Likewise.
586 * mangle.c (write_integer_cst): Likewise.
587 * semantics.c (cp_finish_omp_clause_depend_sink): Likewise.
589 2017-10-10 Nathan Sidwell <nathan@acm.org>
591 * name-lookup.c (set_global_binding): Don't deal with STAT_HACK.
593 2017-10-06 Paolo Carlini <paolo.carlini@oracle.com>
596 * decl.c (finish_function): Take a bool intead of an int; adjust.
597 * cp-tree.h (finish_function): Adjust declaration.
598 * decl2.c (generate_tls_wrapper, finish_objects,
599 finish_static_storage_duration_function): Adjust calls.
600 * lambda.c (maybe_add_lambda_conv_op, finish_lambda_function):
602 * method.c (synthesize_method): Likewise.
603 * optimize.c (maybe_thunk_body, maybe_clone_body): Likewise.
604 * pt.c (instantiate_decl): Likewise.
605 * parser.c (cp_parser_function_definition_after_declarator,
606 cp_parser_late_parsing_for_member, cp_parser_omp_declare_reduction):
608 (cp_parser_ctor_initializer_opt,
609 cp_parser_ctor_initializer_opt_and_function_body,
610 cp_parser_function_try_block,
611 cp_parser_function_definition_after_declarator,
612 cp_parser_function_transaction): Return void; adjust declarations.
614 2017-10-06 Nathan Sidwell <nathan@acm.org>
617 * name-lookup.c (check_local_shadow): Don't try and convert
620 2017-10-06 Jakub Jelinek <jakub@redhat.com>
623 * decl.c (reshape_init): Suppress warn_useless_cast for direct enum
625 * typeck.c (convert_for_assignment): Likewise.
627 P0704R1 - fixing const-qualified pointers to members
628 * typeck2.c (build_m_component_ref): For -std=c++2a allow
629 pointer to const & qualified method on rvalue.
631 2017-10-06 Nathan Sidwell <nathan@acm.org>
633 Use hash_table for extern "C" names
634 * name-lookup.c (extern_c_fns): Use hash_table.
635 (check_extern_c_conflict): Adjust.
636 (c_linkage_bindings): Adjust.
638 Use hash_table for namespace bindings
639 * cp-tree.h (struct named_decl_hash): New.
640 (lang_decl_ns): Change type of bindings field.
641 * lex.c (maybe_add_lang_decl_raw): Adjust.
642 * name-lookup.c (find_namespace_slot): Adjust.
643 (do_pushdecl): Push NULL-named namespace.
644 (do_push_nested_namespace): Adjust.
645 (push_namespace): Push anonymous namespace as NULL name.
647 2017-10-05 Jason Merrill <jason@redhat.com>
649 Pass variadic class objects exactly like named by-value args.
650 * call.c (convert_arg_to_ellipsis): Use the result of force_rvalue.
652 2017-10-05 Nathan Sidwell <nathan@acm.org>
654 Warn on MVP declarations
655 * cp-tree.h (struct cp_declarator): Add parenthesized field.
656 * decl.c (grokdeclarator): Warn about unnecessary parens.
657 * parser.c (make_declarator): Init parenthesized field.
658 (cp_parser_direct_declarator): Set parenthesized field.
660 Kill IDENTIFIER_GLOBAL_VALUE, SET_IDENTIFIER_GLOBAL_VALUE
661 * cp-tree.h (IDENTIFIER_GLOBAL_VALUE,
662 SET_IDENTIFIER_GLOBAL_VALUE): Delete.
663 * name-lookup.h (set_global_binding): Remove NAME parm.
664 (get_global_binding): New inline fn.
665 * name-lookup.c (set_global_binding): Remove NAME parm. Adjust.
666 (identifier_global_value): Move to ...
667 * cp-objcp-common.c (identifier_global_value): ... here.
668 * class.c (build_ctor_vtbl_group, build_vtbl_initializer): Adjust.
669 * decl.c (record_builtin_type, expand_static_init,
670 grokdeclarator): Adjust.
671 * decl2.c (get_guard, get_local_tls_init_fn, get_tls_init_fn,
672 get_tls_wrapper_fn, maybe_warn_sized_delete): Adjust.
673 * except.c (declare_library_fn, build_throw): Adjust.
674 * init.c (throw_bad_array_length): Adjust.
675 * rtti.c (throw_bad_cast, throw_bad_typeid, get_tinfo_decl): Adjust.
677 * decl2.c (record_mangling): Fix spello and formatting from
680 2017-10-04 Nathan Sidwell <nathan@acm.org>
682 Give builtin types the correct name.
683 * name-lookup.c (set_global_binding): Assert name is DECL_NAME.
684 * decl.c (record_builtin_type): Reimplement, use new TYPE_DECL for
687 2017-10-04 Paolo Carlini <paolo.carlini@oracle.com>
688 Andrew Pinski <apinski@cavium.com>
691 * parser.c (cp_parser_lambda_body): Set parser->in_function_body.
693 2017-10-04 Nathan Sidwell <nathan@acm.org>
695 Move mangling aliases out of global namespace.
696 * cp-tree.h (record_mangling): New.
697 (maybe_remove_implicit_alias): Delete.
698 * decl2.c (mangled_decls): New hash map.
699 (generate_mangling_alias): Reimplement using mangled_decls.
700 (record_mangling): New.
701 * mangle.c (decl_implicit_alias_p,
702 maybe_remove_implicit_alias): Delete.
703 (mangle_decl): Use record_mangling.
704 * name-lookup.c (supplement_binding_1): Remove
705 maybe_remove_implicit_alias check.
707 2017-10-04 Jakub Jelinek <jakub@redhat.com>
710 * error.c (dump_function_decl): If show_return, call dump_type_suffix
711 on the same return type dump_type_prefix has been called on.
713 2017-10-04 Jason Merrill <jason@redhat.com>
715 PR c++/81525 - broken handling of auto in generic lambda.
716 * pt.c (tsubst_decl) [VAR_DECL]: Use strip_innermost_template_args.
718 2017-10-04 Nathan Sidwell <nathan@acm.org>
720 * call.c (convert_arg_to_ellipsis): Correct comment about passing
723 2017-10-02 Richard Sandiford <richard.sandiford@linaro.org>
725 * constexpr.c (cxx_eval_store_expression): Use wi::to_widest
726 when comparing the array bounds with an ARRAY_REF index.
728 2017-09-30 Paolo Carlini <paolo.carlini@oracle.com>
731 * method.c (defaulted_late_check): Early return if the defaulted
732 declaration does not match the expected signature.
734 2017-09-29 Jakub Jelinek <jakub@redhat.com>
736 P0683R1 - default member initializers for bit-fields
737 * cp-tree.h (grokbitfield): Add INIT parameter.
738 * parser.c (cp_parser_constant_expression): Add STRICT_P argument,
739 if true, parse a conditional-expression rather than
740 assignment-expression.
741 (cp_parser_member_declaration): For C++11 and later pass true
742 as STRICT_P to cp_parser_constant_expression. Parse C++2A bitfield
743 NSDMIs. Adjust grokbitfield caller. Handle DECL_INITIAL also for
745 (cp_parser_objc_class_ivars): Adjust grokbitfield caller.
746 * class.c (check_field_decl): Recurse even for DECL_C_BIT_FIELDs.
747 (check_field_decls): Call check_field_decl even for DECL_C_BIT_FIELDs.
748 * decl2.c (grokbitfield): Add INIT parameter, pass it to
750 * pt.c (tsubst_decl): Handle DECL_INITIAL for all FIELD_DECLs, not
753 * class.c (check_bitfield_decl): Retrieve and clear width from
754 DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL.
755 (check_field_decls): Test DECL_BIT_FIELD_REPRESENTATIVE rather than
757 (remove_zero_width_bit_fields): Adjust comment.
758 * decl2.c (grokbitfield): Stash width into
759 DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL.
760 * pt.c (tsubst_decl): For DECL_C_BIT_FIELD, tsubst_expr
761 DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL for width.
763 * parser.c (cp_parser_member_declaration): Parse attributes before
764 colon of a bitfield in addition to after colon.
766 * Make-lang.in (check-c++-all): Test also c++2a.
768 2017-09-28 Jason Merrill <jason@redhat.com>
770 PR c++/56973, DR 696 - capture constant variables only as needed.
771 * expr.c (mark_use): Split out from mark_rvalue_use and
772 mark_lvalue_use. Handle lambda capture of constant variables.
773 (mark_lvalue_use_nonread): New.
774 * semantics.c (process_outer_var_ref): Don't capture a constant
775 variable until forced.
776 * pt.c (processing_nonlambda_template): New.
777 * call.c (build_this): Check it.
778 * decl2.c (grok_array_decl): Call mark_rvalue_use and
779 mark_lvalue_use_nonread.
780 * init.c (constant_value_1): Don't call mark_rvalue_use.
781 * typeck.c (build_static_cast): Handle lambda capture.
783 Use local_specializations to find capture proxies.
784 * cp-tree.h (DECL_CAPTURED_VARIABLE): New.
785 * lambda.c (build_capture_proxy): Set it.
786 (add_capture): Pass initializer to build_capture_proxy.
787 (start_lambda_function): Likewise.
788 (insert_capture_proxy): Use register_local_specialization.
789 (is_lambda_ignored_entity): Always ignore proxies.
790 * name-lookup.c (qualify_lookup): Don't check
791 is_lambda_ignored_entity if LOOKUP_HIDDEN is set.
792 * semantics.c (process_outer_var_ref): Use
793 retrieve_local_specialization.
794 * parser.c (cp_parser_lambda_body): Push local_specializations.
795 * pt.c (tsubst_expr): Pass LOOKUP_HIDDEN when looking for a proxy.
796 (tsubst_lambda_expr): Push local_specializations sooner.
797 (tsubst_copy_and_build): Don't register_local_specialization.
799 * call.c (build_special_member_call): Use the return value of
801 * decl.c (compute_array_index_type): Likewise.
802 * parser.c (cp_parser_oacc_wait_list): Likewise.
803 * lambda.c (is_normal_capture_proxy): Handle *this capture.
804 (add_capture): Clarify internal_error message.
806 2017-09-22 Eric Botcazou <ebotcazou@adacore.com>
809 * cp-objcp-common.c (cp_get_debug_type): Do only one lookup.
811 2017-09-22 Jakub Jelinek <jakub@redhat.com>
814 * tree.c (struct replace_placeholders_t): Add pset field.
815 (replace_placeholders_r): Call cp_walk_tree with d->pset as
816 last argument instead of NULL. Formatting fix.
817 (replace_placeholders): Add pset variable, add its address
818 into data. Pass &pset instead of NULL to cp_walk_tree.
820 2017-09-22 David Malcolm <dmalcolm@redhat.com>
822 * call.c (get_fndecl_argument_location): New function.
823 (convert_like_real): Use it when complaining about argument type
825 * cp-tree.h (struct cp_parameter_declarator): Add "loc" field.
826 * parser.c (make_parameter_declarator): Add "loc" param and use
827 it to initialize the new field.
828 (cp_parser_translation_unit): Add UNKNOWN_LOCATION for "loc" of
829 the "no_parameters" parameter.
830 (cp_parser_parameter_declaration_list): Set the location of the
831 result of grokdeclarator to be the parameter's loc, assuming no
833 (cp_parser_parameter_declaration): Generate a location for the
834 parameter and pass to make_parameter_declarator.
836 2017-09-20 Nathan Sidwell <nathan@acm.org>
838 * name-lookup.c (member_name_cmp): Use DECL_UID for final
841 2017-09-20 Jakub Jelinek <jakub@redhat.com>
843 P0409R2 - allow lambda capture [=, this]
844 * parser.c (cp_parser_lambda_introducer): For cxx2a don't pedwarn on
847 2017-09-18 Jason Merrill <jason@redhat.com>
849 PR c++/82069 - ICE with lambda in template
850 * semantics.c (process_outer_var_ref): Check uses_template_parms
851 instead of any_dependent_template_arguments_p.
853 2017-09-15 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
854 Paolo Carlini <paolo.carlini@oracle.com>
857 * decl2.c (finish_anon_union): Complain about "anonymous union with
858 no members" with a pedwarn.
860 2017-09-15 Bernd Edlinger <bernd.edlinger@hotmail.de>
862 * typeck.c (build_reinterpret_cast_1,
863 build_const_cast_1): Implement -Wcast-align=strict.
865 2017-09-15 Jakub Jelinek <jakub@redhat.com>
867 * decl.c (redeclaration_error_message): Use cxx17 instead of cxx1z,
868 adjust diagnostics refering to C++1z or -std=gnu++1z or -std=c++1z
869 to C++17 or -std=gnu++17 or -std=c++17. Adjust comments.
870 (cxx_init_decl_processing, next_initializable_field,
871 is_direct_enum_init, check_initializer, cp_finish_decl,
872 mark_inline_variable, grokdeclarator, grokparms, xref_basetypes,
873 finish_function): Likewise.
874 * cp-tree.h (DECL_INLINE_VAR_P): Likewise.
875 * pt.c (mark_template_parm, convert_nontype_argument,
876 instantiate_class_template_1, type_unification_real, unify,
877 get_partial_spec_bindings, dependent_type_p_r): Likewise.
878 * typeck.c (cp_build_unary_op): Likewise.
879 * constexpr.c (var_in_maybe_constexpr_fn): Likewise.
880 * call.c (build_user_type_conversion_1, build_over_call,
881 build_special_member_call): Likewise.
882 * lambda.c (begin_lambda_type): Likewise.
883 * typeck2.c (process_init_constructor_record): Likewise.
884 * class.c (build_base_field, finalize_literal_type_property,
885 explain_non_literal_class): Likewise.
886 * parser.c (cp_parser_diagnose_invalid_type_name,
887 cp_parser_primary_expression, cp_parser_lambda_introducer,
888 cp_parser_lambda_declarator_opt, cp_parser_selection_statement,
889 cp_convert_range_for, cp_parser_perform_range_for_lookup,
890 cp_parser_decomposition_declaration, cp_parser_linkage_specification,
891 cp_parser_static_assert, cp_parser_simple_type_specifier,
892 cp_parser_namespace_definition, cp_parser_using_declaration,
893 cp_parser_init_declarator, cp_parser_type_parameter_key,
894 cp_parser_exception_specification_opt, cp_parser_std_attribute_spec,
895 cp_parser_constructor_declarator_p): Likewise.
896 * mangle.c (struct globals): Rename need_cxx1z_warning to
898 (write_exception_spec, start_mangling, mangle_decl): Likewise.
899 * Make-lang.in (check-c++1z): Rename to check-c++17, depend on
901 (check-c++17): New goal. Use 17 instead of 1z.
902 (check-c++-all): Use 17 instead of 1z.
904 2017-09-14 Jakub Jelinek <jakub@redhat.com>
907 * cp-gimplify.c (omp_var_to_track): Look through references.
908 (omp_cxx_notice_variable): Likewise.
910 2017-09-13 Nathan Sidwell <nathan@acm.org>
912 Conv-op identifers not in identifier hash table
913 * lex.c (conv_type_hasher): Make member fns inline.
914 (make_conv_op_name): Directly clone conv_op_identifier.
916 Rename CLASSTYPE_METHOD_VEC to CLASSTYPE_MEMBER_VEC.
917 * cp-tree.h (struct lang_type): Rename methods to members.
918 (CLASSTYPE_METHOD_VEC): Rename to ...
919 (CLASSTYPE_MEMBER_VEC): ... this.
920 * name-lookup.h (get_method_slot): Rename to ...
921 (get_member_slot): ... this.
922 (resort_type_method_vec): Rename to ...
923 (resort_type_member_vec): ... this.
924 * class.c (add_method, warn_hidden): Adjust.
925 * search.c (dfs_locate_field_accessor_pre): Adjust.
926 * name-lookup.c (method_vec_binary_search): Rename to ...
927 (member_vec_binary_search): ... this and adjust.
928 (method_vec_linear_search): Rename to ...
929 (member_vec_linear_search): ... this and adjust.
930 (fields_linear_search, get_class_binding_direct): Adjust.
931 (get_method_slot): Rename to ...
932 (get_member_slot): ... this and adjust.
933 (method_name_slot): Rename to ...
934 (member_name_slot): ... this and adjust.
935 (resort_type_method_vec): Rename to ...
936 (resort_type_member_vec): ... this and adjust.
937 (method_vec_append_class_fields): Rename to ...
938 (member_vec_append_class_fields): ... this and adjust.
939 (method_vec_append_enum_values): Rename to ...
940 (member_vec_append_enum_values): ... this and adjust.
941 (method_vec_dedup): Rename to ...
942 (member_vec_dedup): ... this and adjust.
943 (set_class_bindings, insert_late_enum_def_bindings): Adjust.
945 2017-09-12 Paolo Carlini <paolo.carlini@oracle.com>
948 * decl.c (start_decl): Early return error_mark_node if duplicate_decls
949 returns it; avoid misleading error message.
951 2017-09-12 Nathan Sidwell <nathan@acm.org>
953 Kill CLASSTYPE_SORTED_FIELDS.
954 * cp-tree.h (struct lang_type): Lose sorted_fields member.
955 (CLASSTYPE_SORTED_FIELDS): Delete.
956 * name-lookup.h (set_class_bindings): Add EXTRA arg.
957 * name-lookup.c (fields_linear_search): New, broken out of ...
958 (lookup_field_1): ... here. Delete remainder of function.
959 (get_class_binding_direct): Reimplement without sorted_fields.
960 (get_class_binding): Rename TYPE arg to KLASS, for consistency.
961 (get_method_slot): Call set_class_binding when creating method_vec
963 (method_name_cmp): Order identically named slots.
964 (sorted_fields_type_new): Delete.
965 (field_vc_append_class_fields): Rename to ...
966 (method_vec_append_class_fields): ... here. Adjust.
967 (field_vec_append_enum_values): Renme to ...
968 (method_vec_append_enum_values): ... here. Adjust.
969 (method_vec_dedup): New.
970 (set_class_bindings): Reimplement.
971 (insert_late_enum_def_bindings): Reimplement.
973 * name-lookup.c (get_class_binding): Rename TYPE arg to KLASS for
975 (restort_data): Move later.
976 (method_name_cmp, resort_method_name_cmp): Simplify.
977 (resort_type_method_vec): Reformat.
979 2017-09-09 Jason Merrill <jason@redhat.com>
981 * constexpr.c (reduced_constant_expression_p): If
982 CONSTRUCTOR_NO_IMPLICIT_ZERO, check that all fields are initialized.
984 2017-09-09 Eric Botcazou <ebotcazou@adacore.com>
987 * cp-objcp-common.c (struct debug_type_hasher): New class.
988 (debug_type_hash): New variable.
989 (cp_get_debug_type): Associate the OFFSET_TYPEs with the types.
991 2017-09-08 Jason Merrill <jason@redhat.com>
993 PR c++/70029 - ICE with ref-qualifier and -flto
994 * tree.c (cxx_copy_lang_qualifiers): New.
995 * cp-tree.h: Declare it.
996 * cp-objcp-common.h: Define LANG_HOOKS_COPY_LANG_QUALIFIERS.
998 2017-09-06 Jason Merrill <jason@redhat.com>
1000 PR c++/82053 - ICE with default argument in lambda in template
1001 * pt.c (tsubst_arg_types): Substitute default arguments for lambdas
1003 (retrieve_specialization): Use lambda_fn_in_template_p.
1004 * cp-tree.h: Declare it.
1006 PR c++/82070 - error with nested lambda capture
1007 * pt.c (tsubst_expr) [DECL_EXPR]: Register capture proxies with
1008 register_local_specialization.
1010 2017-09-06 Nathan Sidwell <nathan@acm.org>
1012 * name-lookup.h (lookup_field_1): Delete.
1013 (get_class_binding_direct, get_class_binding): Add type_or_fns arg.
1014 * name-lookup.c (lookup_field_1): make static
1015 (method_vec_binary_search, method_vec_linear_search): New. Broken
1017 (get_class_binding_direct): ... here. Add TYPE_OR_FNS argument.
1018 Do complete search of this level.
1019 (get_class_binding): Adjust.
1020 * decl.c (reshape_init_class): Call get_class_binding.
1021 * search.c (lookup_field_r): Move field searching into
1022 get_class_binding_direct.
1024 * class.c (warn_hidden): Don't barf on non-functions.
1025 * decl2.c (check_classfn): Likewise. Check template match earlier.
1027 * name-lookup.c (count_fields): Rename to ...
1028 (count_class_fields): ... here. Take a class, don't count
1030 (add_fields_to_record_type): Rename to ...
1031 (field_vec_append_class_fields): ... here. Take a class, don't
1032 add NULL-named fields.
1033 (add_enum_fields_to_record_type): Rename to ...
1034 (field_vec_append_enum_values): ... here.
1035 (set_class_bindings): Adjust, assert we added expected number.
1036 (insert_late_enum_def_bindings): Reimplement. Create vector if
1037 there are now sufficient entries.
1039 * name-lookup.h (lookup_fnfields_slot_nolazy,
1040 lookup_fnfields_slot): Rename to ...
1041 (get_class_binding_direct, get_class_binding): ... here.
1042 * name-lookup.c (lookup_fnfields_slot_nolazy,
1043 lookup_fnfields_slot): Rename to ...
1044 (get_class_binding_direct, get_class_binding): ... here.
1045 * cp-tree.h (CLASSTYPE_CONSTRUCTORS, CLASSTYPE_DESTRUCTOR): Adjust.
1046 * call.c (build_user_type_conversion_1): Adjust.
1047 (has_trivial_copy_assign_p): Adjust.
1048 (has_trivial_copy_p): Adjust.
1049 * class.c (get_basefndecls) Adjust.
1050 (vbase_has_user_provided_move_assign) Adjust.
1051 (classtype_has_move_assign_or_move_ctor_p): Adjust.
1052 (type_build_ctor_call, type_build_dtor_call): Adjust.
1053 * decl.c (register_dtor_fn): Adjust.
1054 * decl2.c (check_classfn): Adjust.
1055 * pt.c (retrieve_specialization): Adjust.
1056 (check_explicit_specialization): Adjust.
1057 (do_class_deduction): Adjust.
1058 * search.c (lookup_field_r): Adjust.
1059 (look_for_overrides_here, lookup_conversions_r): Adjust.
1060 * semantics.c (classtype_has_nothrow_assign_or_copy_p): Adjust.
1061 * tree.c (type_has_nontrivial_copy_init): Adjust.
1062 * method.c (lazily_declare_fn): Adjust comment.
1064 2017-09-05 Nathan Sidwell <nathan@acm.org>
1066 * name-lookup.c (do_class_using_decl): Elide read-once temps.
1067 Move declarations to initializations.
1069 * class.c (add_method): Move slot search and insertion to ...
1070 * name-lookup.c (get_method_slot): ... this new function.
1071 (lookup_fnfields_slot_nolazy): Cope with NULL slot.
1072 * name-lookup.h (get_method_slot): Declare.
1073 * decl.c (cxx_init_decl_processinng): Give conv_op_marker a more
1075 (grok_special_member_properties): Set
1076 TYPE_HAS_CONVERSION. Expicitly look at DECL_NAME for specialness.
1077 Improve TYPE_HAS_CONSTEXPR_CTOR setting.
1079 * cp-tree.h (lang_decl_base): Rename template_conv_p to
1081 (DECL_CONV_FN_P): Don't check NULL DECL_NAME.
1082 (DECL_CONV_FN_TYPE): FN must be conv op.
1083 (DECL_TEMPLATE_CONV_FN_P): Delete.
1084 (VAR_HAD_UNKNOWN_BOUND, SET_VAR_HAD_UNKNOWN_BOUND): Adjust.
1085 * pt.c (push_template_decl_real): Delete DECL_TEMPLATE_CONV_FN_P
1088 * class.c (unreverse_member_declarations): Remove extraneous if.
1089 * pt.c (push_template_decl_real): Use string concatenation, not
1090 \<newline>. Add %<..%>.
1092 2017-09-05 Paolo Carlini <paolo.carlini@oracle.com>
1095 * cp-tree.h (LABEL_DECL_CDTOR): Add and document.
1096 * decl.c (start_preparsed_function): Set LABEL_DECL_CDTOR when
1097 creating cdtor_label.
1098 * constexpr.c (returns): Add the case of a constructor/destructor
1099 returning via a LABEL_DECL_CDTOR label.
1100 (cxx_eval_constant_expression, case [GOTO_EXPR]): Likewise.
1102 2017-09-01 Nathan Sidwell <nathan@acm.org>
1104 * cp-tree.h (resort_type_method_vec): Move declaration to ...
1105 * name-lookup.h (resort_type_method_vec): ... here.
1106 (set_class_bindings): Lose 2nd arg.
1107 * class.c (finish_struct_1, finish_struct): Adjust
1108 set_class_bindings call. Don't call finish_struct_methods.
1109 (resort_data, method_name_cmp, resort_method_name_cmp,
1110 resort_type_method_vec, finish_struct_methods): Move to ...
1111 * name-lookup.c (resort_data, method_name_cmp,
1112 resort_method_name_cmp, resort_type_method_vec): ... here.
1113 (set_class_bindings): Lose fields arg. Swallow finish_struct_methods.
1115 * class.c (finish_struct): Call set_class_bindings for the
1118 * class.c (finish_struct_methods): Dont clear DECL_IN_AGGR_P here.
1119 Don't call maybe_warn_about_overly_private_class here.
1120 (warn_hidden): Cleanup declarations and comments.
1121 (type_has_user_provided_constructor): No need to check
1122 CLASSTYPE_METHOD_VEC.
1123 (type_has_user_provided_or_explicit_constructor): Likewise.
1124 (classtype_has_move_assign_or_move_ctor_p): Likewise.
1125 (check_bases_and_members): Don't call finish_struct_methods here.
1126 (finish_struct_1): Call finish_struct_methods and
1127 set_class_bindings immediately after layout. Clear DECL_IN_AGGR_P
1129 (finish_struct): For templates process USING_DECLS and clear
1130 DECL_IN_AGGR_P before calling finish_struct_methods. Call
1131 maybe_warn_about_overly_private_class here.
1133 Revert 2017-08-28 Nathan Sidwell <nathan@acm.org>
1134 Restore sorted_fields vector.
1135 * cp-tree.h (lang_type): Restore sorted_fields vector.
1136 (CLASSTYPE_SORTED_FIELDS): Restore.
1137 (CLASSTYPE_BINDINGS): Delete.
1138 * name-lookup.c (lookup_field_1): Restore binary search.
1139 (sorted_fields_type_new, count_fields,
1140 add_fields_to_record_type, add_enum_fields_to_record_type): Restore
1141 (set_class_bindings): Revert.
1142 (insert_late_enum_def_binding): Restore field_vec insertion.
1144 2017-09-01 Jakub Jelinek <jakub@redhat.com>
1147 * parser.c (cp_parser_omp_ordered): Handle -fopenmp-simd.
1149 2017-09-01 Marek Polacek <polacek@redhat.com>
1152 * typeck.c (cp_build_unary_op): Avoid re-entering reporting routines.
1154 2017-08-30 Jason Merrill <jason@redhat.com>
1156 PR c++/82029 - __PRETTY_FUNCTION__ in lambda in template
1157 * pt.c (enclosing_instantiation_of, lambda_fn_in_template_p)
1158 (regenerated_lambda_fn_p): New.
1159 (tsubst_decl) [VAR_DECL]: Use enclosing_instantiation_of.
1160 (tsubst_copy) [VAR_DECL]: Likewise.
1162 PR c++/82030 - ICE inheriting from multiple lambdas
1164 * call.c (compare_ics): Handle null candidate.
1166 2017-08-30 Ville Voutilainen <ville.voutilainen@gmail.com>
1168 Make taking the address of an overloaded function a non-deduced context
1170 * pt.c (unify_overload_resolution_failure): Remove.
1171 (unify_one_argument): Adjust.
1173 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
1174 Alan Hayward <alan.hayward@arm.com>
1175 David Sherwood <david.sherwood@arm.com>
1177 * typeck.c (cp_build_binary_op): Use SCALAR_TYPE_MODE.
1179 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
1180 Alan Hayward <alan.hayward@arm.com>
1181 David Sherwood <david.sherwood@arm.com>
1183 * cvt.c (cp_convert_to_pointer): Use SCALAR_INT_TYPE_MODE.
1185 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
1186 Alan Hayward <alan.hayward@arm.com>
1187 David Sherwood <david.sherwood@arm.com>
1189 * mangle.c (write_real_cst): Use SCALAR_FLOAT_TYPE_MODE
1190 instead of TYPE_MODE.
1192 2017-08-29 Jason Merrill <jason@redhat.com>
1194 PR c++/81236 - ICE with template-id in generic lambda
1195 * semantics.c (finish_id_expression): Remove special dependent case.
1196 Avoid some later pieces when dependent.
1197 (finish_qualified_id_expr): Do normal BASELINK handling in a
1198 template. Always build a SCOPE_REF for a destructor BIT_NOT_EXPR.
1199 (parsing_default_capturing_generic_lambda_in_template): Remove.
1200 * parser.c (cp_parser_postfix_dot_deref_expression): Always give an
1201 error for types that will never be complete.
1202 * mangle.c (write_expression): Add sanity check.
1203 * tree.c (build_qualified_name): Add sanity check.
1204 (cp_walk_subtrees): Walk into the class context of a BASELINK.
1205 * lambda.c (add_capture): Improve diagnostic for generic lambda
1207 * call.c (build_new_method_call_1): Print the right constructor
1210 Reimplement handling of lambdas in templates.
1211 * cp-tree.h (LAMBDA_FUNCTION_P): Check DECL_DECLARES_FUNCTION_P.
1212 * decl.c (start_preparsed_function): Call start_lambda_scope.
1213 (finish_function): Call finish_lambda_scope.
1214 * init.c (get_nsdmi): Call start/finish_lambda_scope.
1215 * lambda.c (start_lambda_scope): Only ignore VAR_DECL in a function.
1216 * parser.c (cp_parser_function_definition_after_declarator): Don't
1217 call start/finish_lambda_scope.
1218 * pt.c (retrieve_specialization): Ignore lambda functions in
1220 (find_parameter_packs_r): Ignore capture proxies. Look into
1222 (check_for_bare_parameter_packs): Allow bare packs in lambdas.
1223 (tsubst_default_argument): Call start/finish_lambda_scope.
1224 (tsubst_function_decl): Handle lambda functions differently.
1225 (tsubst_template_decl): Likewise.
1226 (tsubst_expr) [DECL_EXPR]: Skip closure declarations and capture
1228 (tsubst_lambda_expr): Create a new closure rather than instantiate
1229 the one from the template.
1230 (tsubst_copy_and_build): Don't register a specialization of a pack.
1231 (regenerate_decl_from_template): Call start/finish_lambda_scope.
1232 (instantiate_decl): Remove special lambda function handling.
1233 * semantics.c (process_outer_var_ref): Remove special generic lambda
1234 handling. Don't implicitly capture in a lambda in a template. Look
1235 for an existing proxy.
1236 * class.c (current_nonlambda_class_type): Use decl_type_context.
1238 * cp-tree.h (LAMBDA_EXPR_CLOSURE): Use TREE_TYPE.
1239 (LAMBDA_EXPR_RETURN_TYPE): Remove.
1240 (struct tree_lambda_expr): Remove closure and return_type fields.
1241 * lambda.c (build_lambda_expr): Don't set LAMBDA_EXPR_RETURN_TYPE.
1242 * pt.c (tsubst_copy_and_build): Likewise.
1243 * parser.c (cp_parser_lambda_declarator_opt): Track return type.
1244 (cp_parser_lambda_body): Adjust unspecified return type check.
1245 * ptree.c (cxx_print_lambda_node): Don't print closure or
1248 PR c++/80935 - wrong C++17 error with lambda
1249 * decl.c (check_for_uninitialized_const_var): Check
1250 is_instantiation_of_constexpr.
1251 * constexpr.c (ensure_literal_type_for_constexpr_object): Check
1252 is_instantiation_of_constexpr.
1253 (potential_constant_expression_1): Check var_in_maybe_constexpr_fn.
1255 * lambda.c (build_lambda_object): Check for error_mark_node.
1256 * pt.c (make_pack_expansion): Set PACK_EXPANSION_LOCAL_P on the type
1258 (tsubst_decl) [FUNCTION_DECL]: Set DECL_CONTEXT on the parameters.
1259 (tsubst) [TEMPLATE_PARM_INDEX]: Check for error_mark_node.
1261 PR c++/80767 - unnecessary instantiation of generic lambda
1262 * call.c (convert_like_real): Call build_user_type_conversion_1 if
1264 (add_conv_candidate): Build a ck_user conversion with no candidate.
1266 Fix lambdas in template default argument of inherited ctor.
1267 * method.c (synthesized_method_base_walk): Replace an inherited
1268 template with its specialization.
1269 (synthesized_method_walk): Make inheriting_ctor a pointer.
1270 (maybe_explain_implicit_delete, explain_implicit_non_constexpr)
1271 (deduce_inheriting_ctor, implicitly_declare_fn): Adjust.
1273 * pt.c (build_deduction_guide): Set DECL_ABSTRACT_ORIGIN on the
1274 template, not the function.
1275 (template_guide_p): Adjust.
1277 Support copying local_specializations.
1278 * cp-tree.h (enum lss_policy): New.
1279 (local_specialization_stack): Add policy parameter to default ctor.
1280 * pt.c (local_specialization_stack): Copy local_specializations if
1283 * constexpr.c (potential_constant_expression_1): Add "now" parm.
1284 (is_constant_expression, require_constant_expression): New.
1285 (is_static_init_expression, is_nondependent_constant_expression)
1286 (is_nondependent_static_init_expression): Drop "potential".
1287 * except.c (build_must_not_throw_expr): Do type conversion on
1288 value-dependent argument.
1289 * pt.c, semantics.c, typeck2.c: Use variants without "potential".
1291 Instantiate default arguments/member initializers once.
1292 * init.c (get_nsdmi): Remember NSDMI instantiations.
1293 * parser.c (inject_this_parameter): Be more picky about
1295 * pt.c (tsubst_copy): Simplify 'this' handling.
1296 (tsubst_default_argument): Remember default argument
1297 instantiations. Take parameter number.
1298 (tsubst_default_arguments): Pass it.
1299 * call.c (convert_default_arg): Likewise.
1301 Fix default argument conversion failure and SFINAE.
1302 * call.c (build_over_call): Check convert_default_arg result for
1304 * parser.c (cp_parser_late_parsing_default_args): Remember
1307 2017-08-28 Nathan Sidwell <nathan@acm.org>
1309 * cp-tree.h (lang_type): Replace sorted_fields vector with
1311 (CLASSTYPE_SORTED_FIELDS): Delete.
1312 (CLASSTYPE_BINDINGS): New.
1313 * decl.c (finish_enum_value_list): Swap args of
1314 insert_late_enum_def_bindings.
1315 * name-lookup.c (lookup_field_1): Replace binary search of sorted
1316 fields with map->get.
1317 (sorted_fields_type_new, count_fields,
1318 add_fields_to_record_type, add_enum_fields_to_record_type): Delete.
1319 (add_class_member, add_class_members): New.
1320 (set_class_bindings): Create map and insert.
1321 (insert_late_enum_def_binding): Swap parms. Use add_clasS_member.
1322 * ptree.c (cxx_print_type): Delete sorted fields printing.
1324 * cp-tree.h (insert_late_enum_def_into_classtype_sorted_fields):
1326 * name-lookup.h (set_class_bindings,
1327 insert_late_enum_def_bindings): Declare.
1328 * decl.c (finish_enum_value_list): Adjust for
1329 insert_late_enum_def_bindings name change.
1330 * class.c (finish_struct_1): Call set_class_bindings.
1331 (count_fields, add_fields_to_record_type,
1332 add_enum_fields_to_record_type, sorted_fields_type_new,
1333 insert_into_classtype_sorted_fields,
1334 insert_late_enum_def_into_classtype_sorted_fields): Move to ...
1335 * name-lookup.h (count_fields, add_fields_to_record_type,
1336 add_enum_fields_to_record_type, sorted_fields_type_new,
1337 set_class_bindings, insert_late_enum_def_bindings): ... here.
1339 2017-08-25 Nathan Sidwell <nathan@acm.org>
1341 * class.c (method_name_cmp, resort_method_name_cmp): Methods
1344 Conversion operators have a special name
1345 * cp-tree.h (CPTI_CONV_OP_MARKER, CPTI_CONV_OP_IDENTIFIER): New.
1346 (conv_op_marker, conv_op_identifier): New.
1347 (CLASSTYPE_FIRST_CONVERSION_SLOT): Delete.
1348 * decl.c (initialize_predefined_identifiers): Add
1350 (cxx_init_decl_processing): Create conv_op_marker.
1351 * decl2.c (check_classfn): Lookup conv-ops by name.
1352 * class.c (add_method): Use conv_op_identifier & conv_op_marker.
1353 (resort_type_method_vec): Don't skip conv-ops.
1354 (finish_struct_methods, warn_hidden): Likewise.
1355 * name-lookup.h (lookup_all_conversions): Delete.
1356 * name-lookup.c (lookup_conversion_operator): Replace with ...
1357 (extract_conversion_operator): ... this.
1358 (lookup_fnfields_slot_nolazy): Find conv-ops by name.
1359 (lookup_all_conversions): Delete.
1360 * pt.c (check_explicit_specialization): Find conv-ops by name.
1361 * search.c (lookup_conversions_r): Likewise.
1363 2017-08-24 Nathan Sidwell <nathan@acm.org>
1365 Conversion operators kept on single overload set
1366 * class.c (add_method): Keep all conv-ops on one slot.
1367 * name-lookup.c (lookup_conversion_operator): Pull the desired
1368 conv op out of overload set.
1369 * search.c (lookup_conversions_r): Lose template/non-template
1371 (lookup_conversions): Likewise.
1373 2017-08-23 Nathan Sidwell <nathan@acm.org>
1375 * cp-tree.h (lookup_field_1, lookup_fnfields_slot,
1376 lookup_fnfields_slot_nolazy, lookup_all_conversions): Move
1378 * name-lookup.h (lookup_field_1, lookup_fnfields_slot,
1379 lookup_fnfields_slot_nolazy, lookup_all_conversions): ... here.
1380 * search.c (lookup_conversion_operator,
1381 lookup_fnfields_slot_nolazy, lookup_field_1, lookup_fnfields_slot,
1382 lookup_all_conversions): Move to ...
1383 * name-lookup.c (lookup_conversion_operator,
1384 lookup_fnfields_slot_nolazy, lookup_field_1, lookup_fnfields_slot,
1385 lookup_all_conversions): ... here.
1387 * semantics.c (finish_member_declaration): Move USING_DECL check
1388 earlier. Always set C++ linkage. Commonize TYPE_FIELD and
1389 template decl list insertion.
1391 * cp-tree.h (maybe_version_functions): Declare.
1392 * decl.c (decls_match): Break function versioning check to
1393 separate function. Call it.
1394 (maybe_version_functions): Broken out of decls_match.
1395 * class.c (add_method): Use maybe_version_functions.
1397 * cp-tree.h (print_search_statistics,
1398 reinit_search_statistics): Don't declare.
1399 * search.c (n_fields_searched, n_calls_lookup_field,
1400 n_calls_lookup_field_1, n_calls_lookup_fnfields,
1401 n_calls_lookup_fnfields_1, n_calls_get_base_type,
1402 n_outer_fields_searched, n_contexts_saved): Delete.
1403 (lookup_field_1, lookup_member,
1404 lookup_fnfields_slot_nolazy): Remove stat gathering.
1405 (print_search_statistics, reinit_search_statistics): Delete.
1406 * tree.c (cxx_print_statistics): Don't print search stats.
1408 2017-08-21 Nathan Sidwell <nathan@acm.org>
1410 * search.c (lookup_field_r): Remove obsolete code for type-named
1413 * search.c (lookup_field_1): Assert TYPE is a class and VFIELD
1415 (lookup_field_fuzzy_info::fuzzy_lookup_fnfields): Delete.
1416 (lookup_field_fuzzy_r): Adjust.
1418 2017-08-21 David Malcolm <dmalcolm@redhat.com>
1420 * call.c (build_over_call): Pass NULL for new parameter to
1421 check_function_arguments.
1422 * typeck.c (cp_build_function_call_vec): Likewise.
1424 2017-08-21 Nathan Sidwell <nathan@acm.org>
1427 * pt.c (instantiate_class_template_1):
1428 BOUND_TEMPLATE_TEMPLATE_PARM is never friend-injected.
1430 2017-08-18 David Malcolm <dmalcolm@redhat.com>
1433 * name-lookup.c (maybe_suggest_missing_header): Convert return
1434 type from void to bool; return true iff a suggestion was offered.
1435 (suggest_alternative_in_explicit_scope): Move call to
1436 maybe_suggest_missing_header to before use of best_match, and
1437 return true if the former offers a suggestion.
1439 2017-08-18 H.J. Lu <hongjiu.lu@intel.com>
1442 * decl.c (duplicate_decls): Also merge DECL_WARN_IF_NOT_ALIGN.
1443 * decl2.c (grokbitfield): Don't allow bit-field with
1444 warn_if_not_aligned type.
1446 2017-08-17 Nathan Sidwell <nathan@acm.org>
1448 * cp-tree.def (TEMPLATE_TEMPLATE_PARM): Remove stale comment.
1449 * cp-tree.h (ENUM_TEMPLATE_INFO): Delete.
1450 (TYPE_TEMPLATE_INFO): Simplify.
1451 (SET_TYPE_TEMPLATE_INFO): Simplify.
1453 * lex.c (maybe_add_lang_type_raw): BOUND_TEMPLATE_TEMPLATE_PARMs
1454 don't need lang_type.
1455 (cxx_make_type): Use maybe_add_lang_type_raw return value.
1456 * mangle.c (CLASSTYPE_TEMPLATE_ID_P): Don't rely on
1459 * cp-tree.h (struct lang_type): Remove template_info field.
1460 (CLASSTYPE_TEMPLATE_INFO): Use TYPE_LANG_SLOT_1.
1461 (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO): Likewise.
1463 2017-08-14 Martin Sebor <msebor@redhat.com>
1466 * error.c (cp_printer): Handle 'G'.
1468 2017-08-11 Martin Liska <mliska@suse.cz>
1470 * decl2.c (get_tls_init_fn): Replace ASM_OUTPUT_DEF with
1471 TARGET_SUPPORTS_ALIASES.
1472 (handle_tls_init): Likewise.
1473 (note_mangling_alias): Likewise. Remove ATTRIBUTE_UNUSED for
1475 * optimize.c (can_alias_cdtor): Likewise.
1477 2017-08-11 Jason Merrill <jason@redhat.com>
1479 PR c++/81671 - nullptr_t template parameter
1480 * pt.c (convert_nontype_argument): Fix nullptr_t check.
1482 2017-08-10 Jason Merrill <jason@redhat.com>
1484 PR c++/81359 - Unparsed NSDMI error from SFINAE context.
1485 * method.c (synthesized_method_walk): Don't diagnose lack of
1488 PR c++/80452 - Core 1579, implicit move semantics on return/throw
1489 * cp-tree.h (LOOKUP_PREFER_RVALUE): Now means that we've already
1490 tentatively changed the lvalue to an rvalue.
1491 * call.c (reference_binding): Remove LOOKUP_PREFER_RVALUE handling.
1492 (build_over_call): If LOOKUP_PREFER_RVALUE, check that the first
1493 parameter is an rvalue reference.
1494 * except.c (build_throw): Do maybe-rvalue overload resolution twice.
1495 * typeck.c (check_return_expr): Likewise.
1497 2017-08-10 David Malcolm <dmalcolm@redhat.com>
1499 * parser.c (cp_parser_error): Update for new param to
1501 (class token_pair): New class.
1502 (struct matching_paren_traits): New struct.
1503 (matching_parens): New typedef.
1504 (struct matching_brace_traits): New struct.
1505 (matching_braces): New typedef.
1506 (cp_parser_statement_expr): Convert explicit parsing of
1507 CPP_OPEN_PAREN and CPP_CLOSE_PAREN to use of
1508 class matching_parens, so that the pertinent open parenthesis is
1509 highlighted when there are problems locating the close
1511 (cp_parser_primary_expression): Likewise.
1512 (cp_parser_compound_literal_p): Remove consumption of opening
1514 (cp_parser_postfix_expression): Convert explicit parsing of
1515 CPP_OPEN_PAREN and CPP_CLOSE_PAREN to use matching parens, as
1516 above. Use it to consume the opening paren previously consumed by
1517 cp_parser_compound_literal_p.
1518 (cp_parser_parenthesized_expression_list): Likewise.
1519 (cp_parser_unary_expression): Likewise.
1520 (cp_parser_new_expression): Likewise.
1521 (cp_parser_cast_expression): Likewise.
1522 (cp_parser_builtin_offsetof): Likewise.
1523 (cp_parser_trait_expr): Likewise.
1524 (cp_parser_lambda_declarator_opt): Likewise.
1525 (cp_parser_lambda_body): Likewise, for matching_braces.
1526 (cp_parser_compound_statement): Likewise.
1527 (cp_parser_selection_statement): Likewise, for matching_parens.
1528 (cp_parser_iteration_statement): Likewise.
1529 (cp_parser_already_scoped_statement): Likewise, for
1531 (cp_parser_linkage_specification): Likewise.
1532 (cp_parser_static_assert): Likewise, for matching_parens.
1533 (cp_parser_decltype): Likewise.
1534 (cp_parser_operator): Likewise.
1535 (cp_parser_enum_specifier): Likewise.
1536 (cp_parser_namespace_definition): Likewise.
1537 (cp_parser_direct_declarator): Likewise.
1538 (cp_parser_braced_list): Likewise.
1539 (cp_parser_class_specifier_1): Likewise, for matching_braces.
1540 (cp_parser_constant_initializer): Likewise.
1541 (cp_parser_noexcept_specification_opt): Likewise, for
1543 (cp_parser_exception_specification_opt): Likewise.
1544 (cp_parser_handler): Likewise.
1545 (cp_parser_asm_specification_opt): Likewise.
1546 (cp_parser_asm_operand_list): Likewise.
1547 (cp_parser_gnu_attributes_opt): Likewise.
1548 (cp_parser_std_attribute_spec): Likewise.
1549 (cp_parser_requirement_parameter_list): Likewise.
1550 (cp_parser_requirement_body): Likewise, for matching_braces.
1551 (cp_parser_compound_requirement): Likewise.
1552 (cp_parser_template_introduction): Likewise.
1553 (cp_parser_sizeof_pack): Likewise, for matching_parens.
1554 (cp_parser_sizeof_operand): Likewise; use it to consume the
1555 opening paren previously consumed by cp_parser_compound_literal_p.
1556 (get_matching_symbol): New function.
1557 (cp_parser_required_error): Add param "matching_location". Remove
1558 calls to cp_parser_error, instead setting a non-NULL gmsgid, and
1559 handling it if set by calling c_parse_error, potentially with a
1560 secondary location if matching_location was set.
1561 (cp_parser_require): Add param "matching_location", with a default
1562 value of UNKNOWN_LOCATION.
1563 (cp_parser_require_keyword): Update for new param of
1564 cp_parser_required_error.
1565 (cp_parser_objc_encode_expression): Update to class matching_parens
1567 (cp_parser_objc_defs_expression): Likewise.
1568 (cp_parser_objc_protocol_expression): Likewise.
1569 (cp_parser_objc_selector_expression): Likewise.
1570 (cp_parser_objc_typename): Likewise.
1571 (cp_parser_objc_superclass_or_category): Likewise.
1572 (cp_parser_objc_try_catch_finally_statement): Likewise.
1573 (cp_parser_objc_synchronized_statement): Likewise.
1574 (cp_parser_objc_at_property_declaration): Likewise.
1575 (cp_parser_oacc_single_int_clause): Likewise.
1576 (cp_parser_oacc_shape_clause): Likewise.
1577 (cp_parser_omp_clause_collapse): Likewise.
1578 (cp_parser_omp_clause_default): Likewise.
1579 (cp_parser_omp_clause_final): Likewise.
1580 (cp_parser_omp_clause_if): Likewise.
1581 (cp_parser_omp_clause_num_threads): Likewise.
1582 (cp_parser_omp_clause_num_tasks): Likewise.
1583 (cp_parser_omp_clause_grainsize): Likewise.
1584 (cp_parser_omp_clause_priority): Likewise.
1585 (cp_parser_omp_clause_hint): Likewise.
1586 (cp_parser_omp_clause_defaultmap): Likewise.
1587 (cp_parser_omp_clause_ordered): Likewise.
1588 (cp_parser_omp_clause_schedule): Likewise.
1589 (cp_parser_omp_clause_num_teams): Likewise.
1590 (cp_parser_omp_clause_thread_limit): Likewise.
1591 (cp_parser_omp_clause_aligned): Likewise.
1592 (cp_parser_omp_clause_linear): Likewise.
1593 (cp_parser_omp_clause_safelen): Likewise.
1594 (cp_parser_omp_clause_simdlen): Likewise.
1595 (cp_parser_omp_clause_depend): Likewise.
1596 (cp_parser_omp_clause_device): Likewise.
1597 (cp_parser_omp_clause_dist_schedule): Likewise.
1598 (cp_parser_oacc_clause_async): Likewise.
1599 (cp_parser_omp_critical): Likewise.
1600 (cp_parser_omp_for_loop): Likewise.
1601 (cp_parser_omp_sections_scope): Likewise.
1602 (cp_parser_omp_declare_reduction_exprs): Likewise.
1603 Update for new param to cp_parser_required_error.
1604 (cp_parser_oacc_routine): Likewise.
1605 (cp_parser_transaction_expression): Likewise.
1606 (cp_parser_cilk_simd_vectorlength): Likewise.
1608 2017-08-09 Jason Merrill <jason@redhat.com>
1610 PR c++/81525 - wrong constant value with generic lambda
1611 * pt.c (tsubst_decl) [VAR_DECL]: Avoid clobbering auto.
1612 (tsubst_copy) [VAR_DECL]: Handle auto.
1614 PR c++/81359 - Unparsed NSDMI error from SFINAE context.
1615 * init.c (get_nsdmi): Add complain parm.
1616 * typeck2.c (digest_nsdmi_init): Add complain parm.
1617 (process_init_constructor_record): Pass complain to get_nsdmi.
1618 * pt.c (maybe_instantiate_noexcept): Add complain parm, return bool.
1619 * method.c (get_defaulted_eh_spec): Add complain parm. Pass it into
1620 synthesized_method_walk.
1621 (synthesized_method_walk): Adjust.
1622 (walk_field_subobs): Pass complain to get_nsdmi.
1623 (defaulted_late_check): Skip other checks if deleted.
1624 * decl2.c (mark_used): Pass complain to maybe_instantiate_noexcept.
1625 * call.c (build_aggr_conv): Pass complain to get_nsdmi.
1626 * parser.c (defarg_location): New.
1627 * error.c (location_of): Use it.
1629 2017-08-09 Marek Polacek <polacek@redhat.com>
1631 * parser.c (cp_parser_perform_range_for_lookup): Use false instead of 0.
1632 * typeck.c (build_binary_op): Change the type of a parameter to bool.
1633 (cp_truthvalue_conversion): Use true instead of 1.
1635 2017-08-08 Marek Polacek <polacek@redhat.com>
1638 * cp-gimplify.c (cp_fold): If folding exposed a branch of
1639 a COND_EXPR, convert it to the original type of the COND_EXPR, if
1642 2017-08-08 Martin Liska <mliska@suse.cz>
1644 * call.c: Include header files.
1645 * cp-gimplify.c: Likewise.
1646 * cp-ubsan.c: Likewise.
1649 * search.c: Likewise.
1650 * semantics.c: Likewise.
1651 * typeck.c: Likewise.
1653 2017-08-07 Martin Liska <mliska@suse.cz>
1655 * parser.c (cp_parser_gnu_attribute_list): Canonicalize name of an
1657 (cp_parser_std_attribute): Likewise.
1658 * tree.c: Add new include.
1660 2017-08-04 Paolo Carlini <paolo.carlini@oracle.com>
1663 * pt.c (do_class_deduction): Handle the case of no viable implicit
1664 deduction guides; simplify the code generating implicit deduction
1667 2017-08-03 Paolo Carlini <paolo.carlini@oracle.com>
1670 * typeck.c (build_x_unary_op): Avoid pretty-printing constructor /
1671 destructor as expressions.
1673 2017-08-02 Jakub Jelinek <jakub@redhat.com>
1676 * call.c (build_user_type_conversion_1): Only call
1677 lookup_fnfields_slot if totype is CLASS_TYPE_P.
1679 2017-07-31 Jason Merrill <jason@redhat.com>
1681 * decl.c (declare_global_var): Set DECL_CONTEXT.
1683 2017-07-31 Jan Hubicka <hubicka@ucw.cz>
1684 Martin Liska <mliska@suse.cz>
1686 * pt.c (tsubst_copy): Copy PREDICT_EXPR.
1687 * semantics.c (finish_goto_stmt): Build gimple predict
1689 * constexpr.c (potential_constant_expression_1): Handle
1692 2017-07-31 Martin Liska <mliska@suse.cz>
1695 * cp-gimplify.c (cp_genericize): Guard condition with flag_sanitize_p
1696 also with current_function_decl non-null equality.
1697 * cp-ubsan.c (cp_ubsan_instrument_vptr_p): Likewise.
1698 * decl.c (compute_array_index_type): Likewise.
1699 * init.c (finish_length_check): Likewise.
1700 * typeck.c (cp_build_binary_op): Likewise.
1702 2017-07-29 Jakub Jelinek <jakub@redhat.com>
1704 * cp-objcp-common.c (cp_decl_dwarf_attribute): Handle
1705 DW_AT_export_symbols.
1706 * name-lookup.c (emit_debug_info_using_namespace): Add IMPLICIT
1707 argument, pass it through to the debug hook.
1708 (finish_namespace_using_directive): Adjust
1709 emit_debug_info_using_namespace caller.
1710 (push_namespace): Likewise. Call it after setting
1711 DECL_NAMESPACE_INLINE_P.
1712 (cp_emit_debug_info_for_using): Pass false as new argument to
1713 the imported_module_or_decl debug hook.
1715 2017-07-28 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
1717 * lex.c (copy_decl): Adjust.
1718 (copy_type): Likewise.
1720 2017-07-26 Paolo Carlini <paolo.carlini@oracle.com>
1723 * lambda.c (add_capture): Early return if we cannot capture by
1726 2017-07-26 Jason Merrill <jason@redhat.com>
1728 P0702R1 - List deduction of vector.
1729 * pt.c (do_class_deduction): Special-case deduction from a single
1730 element of related type.
1732 2017-07-26 Leonid Koppel <lkoppel@uwaterloo.ca>
1734 PR c++/67054 - Inherited ctor with non-default-constructible members
1735 * method.c (walk_field_subobs) Consider member initializers (NSDMIs)
1736 when deducing an inheriting constructor.
1738 2017-07-21 Nathan Sidwell <nathan@acm.org>
1740 * search.c (lookup_conversion_operator): Return overloads.
1741 (lookup_fnfields_idx_nolazy): Absorb into ...
1742 (lookup_fnfields_slot_nolaxy): ... here.
1743 (lookup_fnfields_1): Absorb into ...
1744 (lookup_fnfields_slot): ... here.
1746 Remove special CDtor METHOD_VEC slots.
1747 * cp-tree.h (CLASSTYPE_CONSTRUCTOR_SLOT,
1748 CLASSTYPE_DESTRUCTOR_SLOT): Delete.
1749 (CLASSTYPE_CONSTRUCTORS): Use lookup_fnfields_slot_nolazy.
1750 (CLASSTYPE_DESTRUCTOR): Likewise.
1751 * class (add_method): Don't use special cdtor slots.
1752 * search.c (lookup_fnfields_idx_nolazy): Likewise.
1753 (look_for_overrides_here): Use lookup_fnfields_slot.
1754 * semantics (classtype_has_nothrow_assign_or_copy_p): Likewise.
1756 * call.c (add_candidates): Move decls to initialization. Don't
1759 2017-07-20 Nathan Sidwell <nathan@acm.org>
1761 Remove TYPE_METHODS.
1762 * class.c (maybe_warn_about_overly_private_class,
1763 finish_struct_methods, one_inheriting_sig, count_fields,
1764 add_fields_to_record_type, check_field_decls, check_methods,
1765 clone_function_decl, set_method_tm_attributes,
1766 finalize_literal_type_property, check_bases_and_members,
1767 create_vtable_ptr, determine_key_method,
1768 unreverse_member_declarations, finish_struct,
1769 add_vcall_offset_vtbl_entries_1): Member fns are on TYPE_FIELDS.
1770 * decl.c (fixup_anonymous_aggr): Likewise.
1771 * decl2.c (reset_type_linkage_2): Likewise.
1772 * method.c (after_nsdmi_defaulted_late_checks,
1773 lazily_declare_fn): Likewise.
1774 * optimize.c (maybe_thunk_body, maybe_clone_body): Likewise.
1775 * pt.c (instantiate_class_template_1, tsubst_expr,
1776 do_type_instantiation, instantiate_pending_templates): Likewise.
1777 * search.c (lookup_field_1): Likewise.
1778 * semantics.c (finish_member_declaration,
1779 finish_omp_declare_simd_methods): Likewise.
1781 2017-07-19 Nathan Sidwell <nathan@acm.org>
1783 * class.c (add_implicitly_declared_members): Use
1784 classtype_has_move_assign_or_move_ctor_p.
1785 (classtype_has_move_assign_or_move_ctor,
1786 classtype_has_user_move_assign_or_move_ctor_p): Merge into ...
1787 (classtype_has_move_assign_or_move_ctor_p): ... this new function.
1788 * cp-tree.h (classtype_has_user_move_assign_or_move_ctor_p):
1790 (classtype_has_move_assign_or_move_ctor_p): ... this.
1791 * method.c (maybe_explain_implicit_delete, lazily_declare_fn): Adjust.
1792 * tree.c (type_has_nontrivial_copy_init): Adjust.
1794 * cp-tree.h (PACK_EXPANSION_PARAMETER_PACKS,
1795 PACK_EXPANSION_EXTRA_ARGS): Use TYPE_{MIN,MAX}_VALUE_RAW.
1797 2017-07-18 Nathan Sidwell <nathan@acm.org>
1799 * cp-array-notation.c (build_array_notation_ref): Use
1800 TYPE_{MIN,MAX}_VALUE.
1802 * class.c (classtype_has_move_assign_or_move_ctor): Declare.
1803 (add_implicitly_declared_members): Use it.
1804 (type_has_move_constructor, type_has_move_assign): Merge into ...
1805 (classtype_has_move_assign_or_move_ctor): ... this new function.
1806 * cp-tree.h (type_has_move_constructor, type_has_move_assign): Delete.
1808 2017-07-17 Volker Reichelt <v.reichelt@netcologne.de>
1810 * parser.c (cp_parser_decl_specifier_seq): Add fix-it hints for
1811 friend outside class and obsolete auto as storage-class-specifier.
1813 2017-07-17 Nathan Sidwell <nathan@acm.org>
1815 * class.c (maybe_warn_about_overly_private_class): Ignore public
1818 * class.c (type_has_user_declared_move_constructor,
1819 type_has_user_declared_move_assign): Combine into ...
1820 (classtype_has_user_move_assign_or_move_ctor_p): ... this new function.
1821 * cp-tree.h (type_has_user_declared_move_constructor,
1822 type_has_user_declared_move_assign): Combine into ...
1823 (classtype_has_user_move_assign_or_move_ctor_p): ... this. Declare.
1824 * method.c (maybe_explain_implicit_delete): Use it.
1825 (lazily_declare_fn): Use it.
1826 * tree.c (type_has_nontrivial_copy_init): Use it.
1828 * semantics.c (classtype_has_nothrow_assign_or_copy_p): Clarify
1829 semantics, simplify implementation.
1831 2017-07-16 Volker Reichelt <v.reichelt@netcologne.de>
1833 * parser.c (cp_parser_cast_expression): Use %q#T instead of %qT
1834 in old-style cast diagnostic.
1835 * typeck.c (maybe_warn_about_useless_cast): Use %q#T instead of %qT
1836 in useless cast diagnostic.
1837 * error.c (type_to_string): Remove enum special handling.
1839 2017-07-14 David Malcolm <dmalcolm@redhat.com>
1841 * name-lookup.c (get_std_name_hint): Add '<' and '>' around
1843 (maybe_suggest_missing_header): Update for addition of '<' and '>'
1844 to above. Provide a fix-it hint.
1845 * pt.c: Include "gcc-rich-location.h"
1846 (listify): Attempt to add fix-it hint for missing
1847 #include <initializer_list>.
1848 * rtti.c: Include "gcc-rich-location.h".
1849 (typeid_ok_p): Attempt to add fix-it hint for missing
1850 #include <typeinfo>.
1852 2017-07-12 Jason Merrill <jason@redhat.com>
1854 P0512R0 - Deduction from an initializer list.
1855 * pt.c (do_class_deduction): Do list deduction in two phases.
1857 2017-07-12 Nathan Sidwell <nathan@acm.org>
1859 * cp-tree.h (DECL_CONSTRUCTOR_P, DECL_MAYBE_IN_CHARGE_CONSTRUCTOR,
1860 DECL_DESTRUCTOR_P, DECL_MAYBE_IN_CHARGE_DESTRCTOR): Look at
1862 * decl.c (grokfndecl): Set DECL_CXX_CONSTRUCTOR and
1863 DECL_CXX_DESTRUCTOR explicitly.
1864 * decl2.c (grokclassfn): Likewise.
1865 * friend.c (do_friend): Likewise.
1866 * method.c (make_thunk, make_alias_for,
1867 implicitly_declare_fn): Likewise.
1869 2017-07-11 Jason Merrill <jason@redhat.com>
1872 * decl.c (grokparms): Downgrade error about array of unknown bound
1873 to pedwarn and disable it for C++17.
1875 2017-07-11 Nathan Sidwell <nathan@acm.org>
1877 * decl2.c (reset_type_linkage_2): Dont't change ctor name.
1879 2017-07-10 Martin Sebor <msebor@redhat.com>
1881 * cp-tree.h (cp_operator_id, cp_assignment_operator_id): Document.
1883 2017-07-06 Jason Merrill <jason@redhat.com>
1885 PR c++/81204 - parse error with dependent template-name
1886 * parser.c (cp_parser_lookup_name): Revert previous change.
1888 2017-07-06 David Malcolm <dmalcolm@redhat.com>
1890 * cp-lang.c (LANG_HOOKS_RUN_LANG_SELFTESTS): Define as
1891 selftest::run_cp_tests.
1892 (selftest::run_cp_tests): New function.
1893 * cp-tree.h (selftest::run_cp_tests): New decl.
1895 2017-07-04 Jakub Jelinek <jakub@redhat.com>
1897 * parser.c (cp_parser_decomposition_declaration): Replace
1898 decomposition declaration with structured binding in diagnostics.
1899 * decl.c (cp_finish_decomp): Likewise.
1900 (grokdeclarator): Likewise.
1903 * parser.c (cp_parser_decomposition_declaration): Diagnose invalid
1904 forms of structured binding initializers.
1906 2017-07-03 Paolo Carlini <paolo.carlini@oracle.com>
1909 * decl.c (grokdeclarator): Move checks on function return type after
1910 the splice_late_return_type call; if declspecs->locations[ds_type_spec]
1911 is UNKNOWN_LOCATION fall back to input_location.
1913 2017-07-03 David Malcolm <dmalcolm@redhat.com>
1915 * parser.c (enum required_token): Fix spelling of
1916 RT_INTERATION to RT_ITERATION.
1917 (cp_parser_iteration_statement): Likewise.
1918 (cp_parser_required_error): Likewise.
1920 2017-06-30 Jason Merrill <jason@redhat.com>
1922 PR c++/81257 - ICE with invalid ::template.
1923 PR c++/54769 - wrong lookup of dependent template-name.
1924 * parser.c (cp_parser_template_name): Revert part of last change.
1926 2017-06-30 Nathan Sidwell <nathan@acm.org>
1928 * config-lang.in (gtfiles): Add cp/lex.c.
1929 * cp-tree.h (mangle_convop_name_for_type): Rename ...
1930 (make_conv_op_name): ... here. Move to lex.
1931 * lambda.c (maybe_add_lambda_conv_op): Update.
1932 * parser.c (cp_parser_conversion_function_id): Update.
1933 * pt.c (tsubst_decl, tsubst_baselink, tsubst_copy,
1934 tsubst_copy_and_build): Update.
1935 * semantics.c (apply_deduced_return_type): Update.
1936 * mangle.c (conv_type_hasher, conv_type_names,
1937 mangle_conv_op_name_for_type): Move to ...
1938 * lex.c (conv_type_hasher, conv_type_names, make_convop_name):
1941 2017-06-30 David Malcolm <dmalcolm@redhat.com>
1944 * parser.c (cp_parser_postfix_expression): Construct a location
1945 for typeid expressions.
1947 2017-06-30 Nathan Sidwell <nathan@acm.org>
1949 * cp-tree.h (lookup_fnfields_1, class_method_index_for_fn): Don't
1951 (lookup_all_conversions): Declare.
1952 * class.c (get_basefndecls): Use lookup_fnfields_slot.
1953 * decl.c (register_dtor_fn): Use lookup_fnfields_slot.
1954 * decl2.c (check_class_fn): Use lookup_fnfields_slot. Rework
1956 * pt.c (retrieve_specialization): Use lookup_fnfields_slot.
1957 (check_explicit_specialization): Use lookup_fnfields_slot_nolazy,
1958 lookup_all_conversions.
1959 * search.c (lookup_fnfields_1): Make static.
1960 (lookup_all_conversions): New.
1961 (class_method_index_for_fn): Delete.
1962 * semantics.c (classtype_has_nothrow_assign_or_copy_p): Use
1963 lookup_fnfields_slot.
1965 * call.c (build_new_method_call_1): Use constructo_name to get
1966 ctor name. Move argument processing earlier to merge cdtor
1968 * decl.c (grokfndecl): Cdtors have special names.
1969 * method.c (implicitly_declare_fn): Likewise. Simplify flag setting.
1970 * pt.c (check_explicit_specialization): Cdtor name is already
1972 * search.c (class_method_index_for_fn): Likewise.
1975 * name-lookup.c (do_pushdecl): Reset IDENTIFIER_TYPE when finding
1976 a matching TYPE_DECL.
1978 2017-06-29 Paolo Carlini <paolo.carlini@oracle.com>
1980 * class.c (add_method): Change pair of errors to error + inform.
1981 (handle_using_decl): Likewise.
1983 2017-06-29 Jason Merrill <jason@redhat.com>
1985 * constexpr.c, error.c, tree.c: Remove WITH_CLEANUP_EXPR handling.
1987 PR c++/81180 - ICE with C++17 deduction of member class template.
1988 * pt.c (build_deduction_guide): Correct member template handling.
1990 PR c++/81188 - matching decltype of member function call.
1991 * tree.c (cp_tree_equal): Remove COMPONENT_REF special case.
1993 2017-06-29 Nathan Sidwell <nathan@acm.org>
1996 * parser.c (cp_parser_namespace_definition): Immediately close the
1997 namespace if there's no open-brace.
1998 * name-lookup.c (do_pushdecl): Reset OLD when pushing into new
2001 2017-06-29 Jason Merrill <jason@redhat.com>
2003 PR c++/81164 - ICE with invalid inherited constructor.
2004 * search.c (binfo_direct_p): New.
2005 * name-lookup.c (do_class_using_decl): Use it.
2007 2017-06-29 Nathan Sidwell <nathan@acm.org>
2009 * cp-tree.h (THIS_NAME, IN_CHARGE_NAME, VTBL_PTR_TYPE,
2010 VTABLE_DELTA_NAME, VTABLE_PFN_NAME): Delete.
2011 * decl.c (initialize_predefined_identifiers): Name cdtor special
2012 names consistently. Use literals for above deleted defines.
2013 (cxx_init_decl_processing): Use literal for vtbl_ptr_type name,
2015 * lex.c (maybe_add_lang_type_raw): Exit early, rather than use a
2018 * call.c (check_dtor_name): Use constructor_name for enums too.
2019 (build_new_method_call_1): Use constructor_name for cdtors and
2021 * class.c (build_self_reference): Use TYPE_NAME to get name of
2023 * name-lookup (constructor_name): Use DECL_NAME directly.
2024 (constructor_name_p): Reimplement.
2025 (push_class_level_binding_1): Use TYPE_NAME directly.
2027 * class.c (finish_struct): Use OVL_P.
2028 (get_vfield_name): Measure constructor_name length.
2029 * cp-tree.h (SET_CLASS_TYPE_P): Add RECORD_OR_UNION_CHECK.
2030 (NON_UNION_CLASS_TYPE_P): Check RECORD_TYPE up front.
2031 * cxx-pretty-print.c (is_destructor_name): Delete.
2032 (pp_cxx_unqualified_id): Remove bogus destructor name checking.
2033 * decl.c (grokfndecl): Move cheap checks first when looking for
2034 implicit extern cness.
2036 * parser.c (cp_parser_direct_declarator): Reorder if to avoid
2037 indentation. Remove unnecessary assignment of constructor name.
2039 Whitespace cleanups.
2040 * call.c (name_as_c_string): Move CONST_CAST to return.
2041 (build_new_method_call_1): Remove unneeded bracing.
2042 * class.c (include_empty_classes): Unbreak line.
2043 * constraint.cc (tsubst_check_constraint): Add space.
2044 * cp-tree.h (lang_decl_ns): Add comment.
2045 (PTRMEM_CST_MEMBER): Break line.
2046 * decl.c (grokfndecl): Add blank lines. Unbreak some others.
2047 (grokdeclarator): Remove lines, move declaration to first use.
2048 * decl2.c (decl_needed_p): Fix indentation.
2049 (c_parse_final_cleanups): Remove blank line.
2050 * method.c (implicitly_declare_fn): Move declaration to first use.
2051 * search.c (current_scope): Add blank lines.
2053 2017-06-28 Jason Merrill <jason@redhat.com>
2055 PR c++/72764 - ICE with invalid template typename.
2056 * decl.c (build_typename_type): No longer static.
2057 * tree.c (strip_typedefs): Use it instead of make_typename_type.
2059 PR c++/69300 - ICE with self-referential noexcept
2060 * pt.c (maybe_instantiate_noexcept): Check for recursion.
2062 PR c++/61022 - error with variadic template template parm
2063 * pt.c (convert_template_argument): Keep the TYPE_PACK_EXPANSION.
2065 PR c++/72801 - ICE with variadic partial specialization
2066 * pt.c (unify_pack_expansion): Use PACK_EXPANSION_EXTRA_ARGS.
2068 PR c++/55639 - partial specialization with ::template
2069 * parser.c (cp_parser_class_head): Handle ::template.
2071 PR c++/45976 - error with ::template in declarator.
2072 * pt.c (resolve_typename_type): Fix TEMPLATE_ID_EXPR handling.
2074 PR c++/54769 - wrong lookup of dependent template-name.
2075 * parser.c (cp_parser_template_name): Handle dependent object type.
2076 (cp_parser_nested_name_specifier_opt): Make template_keyword_p a
2078 (cp_parser_id_expression): Pass it.
2079 (cp_parser_diagnose_invalid_type_name): Handle TEMPLATE_ID_EXPR.
2081 * parser.c (cp_parser_template_id): Use the range location on the
2084 PR c++/81204 - parse error with dependent template-name
2085 * parser.c (cp_parser_lookup_name): Disqualify function templates
2088 2017-06-27 Nathan Sidwell <nathan@acm.org>
2090 * pt.c (tsubst_decl <FUNCTION_DECL>): Move var decls to
2091 initialization point. Don't unnecessarily check for ctor name.
2093 * cp-tree.h (CLASSTYPE_DESTRUCTORS): Rename to ...
2094 (CLASSTYPE_DESTRUCTOR): ... this.
2095 * class.c (accessible_nvdtor_p,
2096 maybe_warn_about_overly_private_class,
2097 add_implicitly_declared_members,
2098 clone_constructors_and_destructors, type_has_virtual_destructor):
2099 Adjust for CLASSTYPE_DESTRUCTOR.
2100 (deduce_noexcept_on_destructors): Absorb into ...
2101 (check_bases_and_members): ... here.
2102 * except.c (dtor_nothrow): Adjust for CLASSTYPE_DESTRUCTOR.
2103 * init.c (build_delete): Likewise.
2104 * parser.c (cp_parser_lookup_name): Likewise.
2105 * pt.c (check_explicit_specialization): Likewise.
2106 * rtti.c (emit_support_tinfos): Likewise.
2107 * search.c (lookup_fnfields_idx_nolazy): Likewise.
2109 Kill IDENTIFIER_TEMPLATE.
2110 * cp-tree.h (lang_identifier): Remove class_template_info field.
2111 (IDENTIFIER_TEMPLATE): Delete.
2112 * name-lookup.c (constructor_name_full): Subsume into ...
2113 (constructor_name): ... here. Don't check IDENTIFIER_TEMPLATE.
2114 (constructor_name_p): Likewise.
2115 * mangle.c (write_source_name): Likewise.
2116 * ptree.c (cxx_print_identifier): Likewise.
2118 2017-06-27 Marek Polacek <polacek@redhat.com>
2121 * parser.c (cp_parser_already_scoped_statement): Initialize
2124 2017-06-26 Jason Merrill <jason@redhat.com>
2126 PR c++/81215 - deduction failure with variadic TTP.
2127 * pt.c (unify_bound_ttp_args): Restore old logic for C++14 and down.
2129 2017-06-26 Martin Sebor <msebor@redhat.com>
2132 * call.c (maybe_warn_class_memaccess): Preserve explicit conversions
2133 to detect casting away cv-qualifiers.
2135 2017-06-26 Nathan Sidwell <nathan@acm.org>
2137 * cp-tree.h (lang_decl_fn): Remove assignment_operator_p field.
2138 (DECL_COMPLETE_CONSTRUCTOR_P): Directly compare
2140 (DECL_BASE_CONSTRUCTOR_P, DECL_COMPLETE_DESTRUCTOR_P,
2141 DECL_BASE_DESTRUCTOR_P, DECL_DELETING_DESTRUCTOR_P): Likewise.
2142 (DECL_ASSIGNMENT_OPERATOR_P): Use IDENTIFIER_ASSIGN_OP_P.
2143 * decl.c (grok_op_properties): Adjust identifier checking.
2144 * init.c (expand_default_init): Adjust identifier descision.
2145 * method.c (implicitly_declare_fn): Don't use
2146 DECL_ASSIGNMENT_OPERATOR_P.
2147 * search.c (lookup_fnfields_1): Use IDENTIFIER_CTOR_P,
2149 * call.c (in_charge_arg_for_name): Reimplement.
2150 (build_special_member_call): Use IDENTIFIER_CDTOR_P,
2153 2017-06-26 Marek Polacek <polacek@redhat.com>
2156 * parser.c (cp_parser_statement): Add a default argument. Save the
2157 location of the expression-statement after labels have been parsed.
2158 (cp_parser_implicitly_scoped_statement): Set the location of the
2159 body of the conditional after parsing all the labels. Call
2160 warn_for_multistatement_macros.
2161 (cp_parser_already_scoped_statement): Likewise.
2163 2017-06-24 Paolo Carlini <paolo.carlini@oracle.com>
2166 * parser.c (cp_parser_diagnose_invalid_type_name): Don't print
2167 'typename' in error messages about missing 'typename'.
2169 2017-06-23 Jason Merrill <jason@redhat.com>
2171 PR c++/79056 - C++17 ICE with invalid template syntax.
2172 * parser.c (cp_parser_simple_type_specifier): Don't assume that type
2174 (cp_parser_check_for_invalid_template_id): Handle TYPE_DECL.
2175 * pt.c (template_placeholder_p): New.
2176 * cp-tree.h: Declare it.
2178 2017-06-23 Marc Glisse <marc.glisse@inria.fr>
2180 * decl.c (duplicate_decls): Use builtin_structptr_types.
2182 2017-06-22 Nathan Sidwell <nathan@acm.org>
2184 Reorder IDENTIFIER flags
2186 * cp-tree.h (enum cp_identifier_kind): New.
2187 (IDENTIFIER_KIND_BIT_0, IDENTIFIER_KIND_BIT_1,
2188 IDENTIFIER_KIND_BIT_2): New.
2189 (IDENTIFIER_MARKED): Move to TREE_LANG_FLAG_4.
2190 (IDENTIFIER_VIRTUAL_P, IDENTIFIER_REPO_CHOSEN): Add IDENTIFIER_CHECK.
2191 (C_IS_RESERVED_WORD): Replace with ...
2192 (IDENTIFIER_KEYWORD_P): ... this.
2193 (IDENTIFIER_CTOR_OR_DTOR_P): Replace with ...
2194 (IDENTIFIER_CDTOR_P): ... this.
2195 (IDENTIFIER_CTOR_P, IDENTIFIER_DTOR_P): New.
2196 (IDENTIFIER_OPNAME_P): Replace with ...
2197 (IDENTIFIER_ANY_OP_P): ... this.
2198 (IDENTIFIER_ASSIGN_OP_P): New.
2199 (IDENTIFIER_TYPENAME_P): Replace with ...
2200 (IDENTIFIER_CONV_OP_P): ... this.
2201 (NEW_DELETE_OPNAME_P): Replace with ...
2202 (IDENTIFIER_NEWDEL_OP_P): ... this.
2203 (DECL_CONV_FN_P, DECL_OVERLOADED_OPERATOR_P): Adjust.
2204 (get_identifier_kind_name, set_identifier_kind): Declare.
2205 * lex.c (get_identifier_kind_name, set_identifier_kind): New.
2206 (init_operators): Adjust to avoid keywords, use
2207 set_identifier_kind. Copy TYPE_EXPR slot.
2208 (init_reswords): Call set_identifier_kind.
2209 (unqualified_name_lookup_error): Adjust.
2210 * operators.def (TYPE_EXPR): Remove.
2211 * decl.c (struct predefined_identifier): Move into ...
2212 (initialize_predefined_identifiers): ... here. Call
2213 set_identifier_kind.
2214 (grokfndecl, check_var_type, grokdeclarator): Adjust.
2215 (grok_op_properties): Use IDENTIFIER_ANY_ASSIGN_OP to halve search
2217 * call.c (name_as_c_string): Adjust.
2218 (build_new_method_call_1): Likewise.
2219 * cp-cilkplus.c (is_conversion_operator_function_decl_p): Likewise.
2220 * cxx-pretty-print.c (pp_cxx_unqualified_id): Adjust.
2221 * dump.c (cp_dump_tree): Adjust.
2222 * error.c (dump_decl_name): Adjust.
2223 * mangle.c (write_unqualified_id, write_member_name,
2224 write_expression): Adjust.
2225 (mangle_conv_op_name_for_type): Use set_identifier_kind.
2226 * name-lookup.c (do_class_using_decl): Adjust.
2227 (lookup_name_fuzzy, lookup_name_real_1): Likewise.
2228 * parser.c (cp_lexer_get_preprocessor_token,
2229 cp_parser_direct_declarator): Likewise.
2230 * pt.c (push_template_decl_real, tsubst_decl, tsubst_baselink,
2231 tsubst_copy, tsubst_copy_and_build): Adjust.
2232 * ptree.c (cxx_print_identifier): Print identifier kind.
2233 * search.c (lookup_field_r, lookup_member,
2234 lookup_fnfields_idx_nolazy): Adjust.
2235 * semantics.c (finish_id_expression): Adjust..
2236 * typeck.c (cp_build_addr_expr_1): Adjust.
2238 2017-06-21 Jakub Jelinek <jakub@redhat.com>
2241 * semantics.c (handle_omp_array_sections_1, finish_omp_clauses):
2242 Complain about t not being a variable if t is OVERLOAD even
2243 when processing_template_decl.
2245 2017-06-21 David Malcolm <dmalcolm@redhat.com>
2247 * parser.c (get_cast_suggestion): New function.
2248 (maybe_add_cast_fixit): New function.
2249 (cp_parser_cast_expression): Capture the location of the closing
2250 parenthesis. Call maybe_add_cast_fixit when emitting warnings
2251 about old-style casts.
2253 2017-06-20 Jason Merrill <jason@redhat.com>
2255 PR c++/80972 - C++17 ICE with attribute packed.
2256 * call.c (build_over_call): Allow a TARGET_EXPR from reference
2259 2017-06-20 Nathan Sidwell <nathan@acm.org>
2261 * cp-tree.h (CPTI_NELTS_IDENTIFIER): Delete.
2262 (nelts_identifier): Delete.
2263 * decl.c (initialize_predefined_identifiers): Remove nelts.
2265 PR c++/67074 - namespace aliases
2266 * decl.c (duplicate_decls): Don't error here on mismatched
2268 * name-lookup.c (name_lookup::add_value): Matching namespaces are
2270 (diagnose_name_conflict): Namespaces are never redeclarations.
2271 (update_binding): An alias can match a real namespace.
2273 2017-06-19 Jason Merrill <jason@redhat.com>
2275 PR c++/80562 - ICE with constexpr if.
2276 * semantics.c (finish_if_stmt_cond): Call
2277 instantiate_non_dependent_expr.
2279 PR c++/80829 - ICE with constexpr copy of base subobject.
2280 * constexpr.c (clear_no_implicit_zero): New.
2281 (cxx_eval_call_expression): Call it.
2283 2017-06-19 Nathan Sidwell <nathan@acm.org>
2287 * name-lookup.c (set_decl_namespace): Don't follow using
2288 directives and ignore using decls. Only check overly-explicit
2289 scope after discovering decl.
2291 2017-06-19 Jason Merrill <jason@redhat.com>
2293 PR c++/81073 - constexpr and static var in statement-expression.
2294 * typeck2.c (store_init_value): Always call
2295 require_potential_constant_expression.
2296 * pt.c (convert_nontype_argument): Likewise.
2297 * constexpr.c (potential_constant_expression_1): Adjust message.
2298 Use decl_maybe_constant_var_p instead of decl_constant_var_p.
2299 * decl2.c (decl_maybe_constant_var_p): Consider initializer.
2301 2017-06-19 Nathan Sidwell <nathan@acm.org>
2303 * pt.c (coerce_template_parms): Fix indentation.
2304 (tsubst_decl): Remove repeated SET_DECL_RTL. Move VAR_P handling
2308 * name-lookup.c (update_binding): Only warn about constructors
2309 hidden by functions.
2311 2017-06-17 Jason Merrill <jason@redhat.com>
2313 PR c++/60063 - -Wunused-local-typedefs and templates.
2314 * decl2.c (is_late_template_attribute): Return false for "used".
2316 PR c++/70844 - -Wuseless-cast and inheriting constructor.
2317 * method.c (forward_parm): Suppress warn_useless_cast.
2319 2017-06-16 Jason Merrill <jason@redhat.com>
2321 PR c++/81045 - Wrong type-dependence with auto return type.
2322 * pt.c (type_dependent_expression_p): An undeduced auto outside the
2323 template isn't dependent.
2324 * call.c (build_over_call): Instantiate undeduced auto even in a
2327 PR c++/80465 - ICE with generic lambda with noexcept-specifier.
2328 * lambda.c (maybe_add_lambda_conv_op): Keep processing_template_decl
2329 set longer for a generic lambda.
2331 PR c++/80614 - Wrong mangling for C++17 noexcept type
2332 * mangle.c (write_type): Put the eh spec back on the function type.
2334 PR c++/81102 - Wrong error with partial specialization.
2335 * pt.c (unify) [TEMPLATE_PARM_INDEX]: Strip reference when comparing
2336 types. Do type deduction later.
2338 PR c++/81074 - ICE with partial specialization of member template.
2340 * pt.c (get_partial_spec_bindings): Only coerce innermost args.
2342 PR c++/80831 - ICE with -fsyntax-only.
2343 * decl2.c (c_parse_final_cleanups): Use cgraph_node::get_create.
2345 PR c++/80639 - ICE with invalid PMF initialization.
2346 PR c++/80043 - ICE with -fpermissive
2347 * typeck.c (convert_for_assignment): Recurse when instantiate_type
2348 returns without an error.
2350 2017-06-16 Nathan Sidwell <nathan@acm.org>
2352 * pt.c (tsubst_baselink): Fix & clarify formatting.
2354 * cp-tree.h (build_this_parm, cp_build_parm_decl,
2355 build_artificial_parm): Add FN parm.
2356 * decl.c (start_cleanup_fn): Adjust.
2357 (build_this_parm): Add FN parm, pass it through.
2358 (grokfndecl): Adjust parm building.
2359 * decl2.c (cp_build_parm_decl): Add FN parm, set context.
2360 (build_artificial_parm): Add FN parm, pass through.
2361 (maybe_retrofit_in_chrg): Adjust parm building.
2362 (start_static_storage_duration_function): Likwise.
2363 * lambda.c (maybe_aadd_lambda_conv_op): Likewise.
2364 * method.c (implicitly_declare_fn): Likewise.
2365 * parser.c (inject_this_parameter): Likewise.
2367 Symbol tables are insert only.
2368 * cp-tree.h (default_hash_traits <lang_identifier *>): Don't
2369 derive from pointer_hash. Make undeletable.
2371 * class.c (resort_type_method_vec): Avoid potential unsigned
2374 Don't defer noexcept_deferred_spec.
2375 * cp-tree.h (unevaluated_noexcept_spec): Don't declare.
2376 * decl.c (cxx_init_decl_processing): Initialize
2377 noexcept_deferred_spec.
2378 * except.c (unevaluated_noexcept_spec): Delete.
2379 * class.c (deduce_noexcept_on_destructor): Use
2380 noexcept_deferred_spec directly.
2381 * method.c (implicitly_declare_fn): Likewise.
2383 Make keyed_classes a vector.
2384 * cp-tree.h (CPTI_KEYED_CLASSES, keyed_classes): Delete.
2385 (keyed_classes): Declare as vector.
2386 * decl.c (keyed_classes): Define.
2387 (cxx_init_decl_processing): Allocate it.
2388 (record_key_method_defined): Use vec_safe_push.
2389 * class.c (finish_struct_1): Likewise.
2390 * pt.c (instantiate_class_template_1): Likewise.
2391 * decl2.c (c_parse_final_cleanups): Reverse iterate keyed_classes.
2394 * rtti.c (enum tinfo_kind): Add TK_DERIVED_TYPES,
2395 TK_VMI_CLASS_TYPES, TK_MAX. Delete TK_FIXED.
2397 (typeid_ok_p): Add quotes to error messages. Use get_tinfo_desc.
2398 (get_tinfo_decl): Use get_tinfo_desc.
2399 (get_pseudo_ti_init): Likewise. Adjust VMI construction.
2400 (create_pseudo_type_info): Delete.
2401 (get_pseudo_ti_index): Just determine the index.
2402 (get_tinfo_desc): New. Create all types lazily.
2403 (create_tinfo_types): Just allocate the descriptor array.
2404 (emit_support_tinfos): Use non-inserting type lookup. Set builtin
2407 2017-06-15 Martin Sebor <msebor@redhat.com>
2410 * call.c (first_non_public_field, maybe_warn_class_memaccess): New
2412 (has_trivial_copy_assign_p, has_trivial_copy_p): Ditto.
2413 (build_cxx_call): Call maybe_warn_class_memaccess.
2415 2017-06-14 Jakub Jelinek <jakub@redhat.com>
2417 * cp-gimplify.c (cp_genericize_r): Turn most of the function
2418 into a switch (TREE_CODE (stmt)) statement from long else if
2421 2017-06-13 Jakub Jelinek <jakub@redhat.com>
2424 * cp-gimplify.c (cp_genericize_r): Don't instrument MEM_REF second
2425 argument even if it has REFERENCE_TYPE.
2428 * cp-gimplify.c (cp_genericize): Only look for VAR_DECLs in
2429 BLOCK_VARS (outer) chain.
2430 (cxx_omp_const_qual_no_mutable): Likewise.
2432 2017-06-13 Martin Liska <mliska@suse.cz>
2435 * class.c (build_base_path): Use sanitize_flags_p.
2436 * cp-gimplify.c (cp_genericize_r): Likewise.
2437 (cp_genericize_tree): Likewise.
2438 (cp_genericize): Likewise.
2439 * cp-ubsan.c (cp_ubsan_instrument_vptr_p): Likewise.
2440 * decl.c (compute_array_index_type): Likewise.
2441 (start_preparsed_function): Likewise.
2442 * decl2.c (one_static_initialization_or_destruction): Likewise.
2443 * init.c (finish_length_check): Likewise.
2444 * lambda.c (maybe_add_lambda_conv_op): Likewise.
2445 * typeck.c (cp_build_binary_op): Likewise.
2446 (build_static_cast_1): Likewise.
2448 2017-06-11 Jason Merrill <jason@redhat.com>
2450 * error.c (dump_expr): Use is_this_parameter.
2452 * cp-tree.h, decl2.c, mangle.c, parser.c, pt.c, semantics.c: Use
2455 2017-06-09 Jason Merrill <jason@redhat.com>
2457 Missing bits from N4268, constant evaluation for all non-type args.
2458 * call.c (build_converted_constant_expr): Rename from
2459 build_integral_nontype_arg_conv, handle all types.
2460 * pt.c (convert_nontype_argument): In C++17 call it for all types.
2461 Move NOP stripping inside pointer case, don't strip ADDR_EXPR.
2462 * cvt.c (strip_fnptr_conv): Also strip conversions to the same type.
2464 Overhaul pointer-to-member conversion and template argument handling.
2465 * call.c (standard_conversion): Avoid creating ck_pmem when the
2466 class type is the same.
2467 * cvt.c (can_convert_qual): Split from
2468 perform_qualification_conversions.
2469 * constexpr.c (cxx_eval_constant_expression): Check it.
2470 * typeck.c (convert_ptrmem): Only cplus_expand_constant if
2471 adjustment is necessary.
2472 * pt.c (check_valid_ptrmem_cst_expr): Compare class types.
2473 (convert_nontype_argument): Avoid redundant error.
2475 * call.c (convert_like_real): Remove "inner" parameter.
2476 Don't replace a constant with its value.
2477 * cp-gimplify.c (cp_fully_fold): Use cp_fold_rvalue.
2479 * pt.c (convert_nontype_argument): Check NULLPTR_TYPE_P rather than
2482 * parser.c (cp_parser_constant_expression): Check
2483 potential_rvalue_constant_expression after decay_conversion.
2484 * pt.c (convert_nontype_argument): Don't require linkage in C++17.
2486 PR c++/80384 - ICE with dependent noexcept-specifier
2487 * pt.c (dependent_type_p_r) [FUNCTION_TYPE]: Check for dependent
2490 * constexpr.c (potential_constant_expression_1): Allow 'this' capture.
2492 2017-06-09 Jan Hubicka <hubicka@ucw.cz>
2494 * class.c (build_vtbl_initializer): Mark dvirt_fn as cold.
2495 * decl.c (cxx_init_decl_processing, push_throw_library_fn): Likewise.
2496 (excpet.c): Mark terminate as cold.
2498 2017-06-08 Jakub Jelinek <jakub@redhat.com>
2501 * semantics.c (handle_omp_array_sections_1): Convert TYPE_MAX_VALUE
2502 to sizetype before size_binop.
2505 * cp-gimplify.c (cxx_omp_finish_clause): When changing clause
2506 to OMP_CLAUSE_SHARED, also clear OMP_CLAUSE_SHARED_FIRSTPRIVATE
2507 and OMP_CLAUSE_SHARED_READONLY flags.
2509 2017-06-08 Jan Hubicka <hubicka@ucw.cz>
2511 * cp-tree.h (lang_check_failed): Annotate by ATTRIBUTE_COLD.
2513 2017-06-07 Nathan Sidwell <nathan@acm.org>
2515 * class.c (layout_class_type): Restructure overlong-bitfield tpe
2518 2017-06-07 Jonathan Wakely <jwakely@redhat.com>
2521 * pt.c (do_class_deduction): Build qualified type.
2523 2017-06-06 Nathan Sidwell <nathan@acm.org>
2525 * name-lookup.c (suggest_alternatives_for): Use qualified lookup
2526 sans using directives. Don't walk into inline namespaces.
2529 * name-lookup.c (adl_class_only): Don't add visible friends.
2531 2017-06-05 Volker Reichelt <v.reichelt@netcologne.de>
2533 * parser.c (cp_parser_base_specifier): Fix typos in error messages.
2535 2017-06-02 Nathan Sidwell <nathan@acm.org>
2537 Remove lang_type_ptrmem.
2538 * cp-tree.h (lang_type_header): Remove is_lang_type_class. Move
2540 (lang_type_class): ... this. Reorder bitfields. Rename to ...
2541 (lang_type): ... this. Delete old definition.
2542 (lang_type_ptrmem): Delete.
2543 (LANG_TYPE_CLASS_CHECK): Simply get TYPE_LANG_SPECIFIC. Adjust uses.
2544 (LANG_TYPE_PTRMEM_CHECK): Delete.
2545 (TYPE_GET_PTRMEMFUNC_TYPE, TYPE_SET_PTRMEMFUNC_TYPE): Delete.
2546 (TYPE_PTRMEMFUNC_TYPE): New. Use TYPE_LANG_SLOT_1.
2547 * decl.c (build_ptrmemfunc_type): Adjust.
2548 * lex.c (copy_lang_type): Remove lang_type_ptrmem handling.
2549 (maybe_add_lang_type_raw): Don't set u.c.h.is_lang_type_class.
2551 * class.c (check_bases_and_members): Adjust vec_new_uses_cookie
2554 Remove cp_binding_level::namespaces
2555 * name-lookup.h (cp_binding_level): Lose namespaces field.
2556 * name-lookup.c (add_decl_to_level): Chain namespaces on the names
2558 (suggest_alternatives_for): Adjust for namespace list. Do
2559 breadth-first search.
2560 * decl2.c (collect_source_refs): Namespaces are on the regulr
2562 (collect_ada_namespace): Likewise.
2564 2017-06-02 Bernd Edlinger <bernd.edlinger@hotmail.de>
2566 * typeck.c (cp_build_binary_op): Implement the -Wsizeof_pointer_div
2569 2017-06-01 Ville Voutilainen <ville.voutilainen@gmail.com>
2572 * method.c (constructible_expr): Strip array types before calling
2575 2017-06-01 Paolo Carlini <paolo.carlini@oracle.com>
2578 * cvt.c (convert_to_void): Possibly call maybe_warn_nodiscard
2579 for case INDIRECT_REF too in the main switch.
2581 2017-05-31 Jason Merrill <jason@redhat.com>
2583 PR c++/80840 - ICE with constexpr and reference
2584 * pt.c (convert_nontype_argument): Don't test whether a decl is
2585 value-dependent when binding to a reference.
2587 2017-05-31 Nathan Sidwell <nathan@acm.org>
2589 * cp-tree.h (lang_decl_slector): New enum.
2590 (lang_decl_base): Make selector an enum. Drop decomposition_p
2592 (lang_decl): Use enum for discrimination.
2593 (LANG_DECL_FN_CHECK, LANG_DECL_NS_CHECK, LANG_DECL_PARM_CHECK,
2594 LANG_DECL_DEOMP_CHECK): Use enum.
2595 (DECL_DECOMPOSITION_P): Use selector value.
2596 (SET_DECL_DECOMPOSITION_P): Delete.
2597 (retrofit_lang_decl): Lose SEL parm.
2598 (fit_decomposition_lang_decl): Declare.
2599 * decl.c (cp_finish_decomp, grokdeclarator): Use
2600 fit_decomposition_lang_decl.
2601 * lex.c (maybe_add_lang_decl_raw): New. Broken out of
2603 (set_decl_linkage): New. Broken out of retrofit_lang_decl. Use enum.
2604 (fit_decomposition_lang_decl): Likewise.
2605 (retrofit_lang_decl): Use worker functions.
2606 (cxx_dup_lang_specific_decl): Use selector enum.
2607 (maybe_add_lang_type_raw): New. Broken out of ...
2608 (cxx_make_type_name): ... here. Call it.
2610 2017-05-30 Jason Merrill <jason@redhat.com>
2612 PR c++/80856 - ICE with local extern in template
2613 * semantics.c (finish_call_expr): Replace a local extern overload
2614 set in a template with the IDENTIFIER_NODE.
2616 2017-05-30 David Malcolm <dmalcolm@redhat.com>
2618 * call.c (perform_implicit_conversion_flags): Convert
2619 "from %qT to %qT" to "from %qH to %qI" in diagnostic.
2620 (print_conversion_rejection): Replace pairs of %qT with
2621 %qH and %qI in various places.
2622 (build_user_type_conversion_1): Likewise.
2623 (build_integral_nontype_arg_conv): Likewise.
2624 (build_conditional_expr_1): Likewise.
2625 (convert_like_real): Likewise.
2626 (convert_arg_to_ellipsis): Likewise.
2628 (initialize_reference): Likewise.
2629 * cvt.c (cp_convert_to_pointer): Likewise.
2630 (cp_convert_to_pointer): Likewise.
2631 (convert_to_reference): Likewise.
2632 (ocp_convert): Likewise.
2633 * error.c (cp_printer): Gain bool and const char ** parameters.
2634 (struct deferred_printed_type): New struct.
2635 (class cxx_format_postprocessor): New class.
2636 (cxx_initialize_diagnostics): Wire up a cxx_format_postprocessor
2637 to pp->m_format_postprocessor.
2638 (comparable_template_types_p): New function.
2639 (newline_and_indent): New function.
2640 (arg_to_string): New function.
2641 (print_nonequal_arg): New function.
2642 (print_template_differences): New function.
2643 (type_to_string_with_compare): New function.
2644 (print_template_tree_comparison): New function.
2645 (append_formatted_chunk): New function.
2646 (add_quotes): New function.
2647 (cxx_format_postprocessor::handle): New function.
2648 (defer_phase_2_of_type_diff): New function.
2649 (cp_printer): Add "quoted" and "buffer_ptr" params. Implement
2651 * typeck.c (cp_build_binary_op): Replace pairs of %qT with
2652 %qH and %qI in various places.
2653 (convert_member_func_to_ptr): Likewise.
2654 (build_reinterpret_cast_1): Likewise.
2655 (convert_for_assignment): Likewise.
2656 * typeck2.c (check_narrowing): Likewise.
2658 2017-05-30 Nathan Sidwell <nathan@acm.org>
2660 Kill IDENTIFIER_NAMESPACE_BINDINGS
2661 * cp-tree.h (lang_identifier): Delete namespace_bindings.
2662 (IDENTIFIER_NAMESPACE_BINDINGS): Delete.
2663 (lang_decl_ns): Add bindings.
2664 (DECL_NAMESPACE_BINDINGS): New.
2665 * lex.c (retrofit_lang_decl): Create namespace hash table.
2666 * name-lookup.c (find_namespace_slot): Change to use hash-map.
2667 * ptree.c (cxx_print_binding): Delete.
2668 (cxx_print_identifier): Remove NAMESPACE_BINDING printing.
2670 * cp-tree.def (OVERLOAD): Fix comment.
2671 * cp-tree.h: Fix comments and whitespace.
2672 * error.c (dump_decl): Use pp_cxx_colon_colon, ovl_scope.
2673 * name-lookup.c (add_decl_to_level): Assert not class.
2674 (check_local_shadow): Use OVL_P.
2675 (pushdecl_with_scope_1): Rename to ...
2676 (do_pushdecl_with_Scope): ... here.
2677 (do_nonmember_using_decl): Use qualified_namespace_lookup return
2679 (push_class_level_binding_1): Use OVL_P.
2680 (pushdecl_namespace_level): Use do_pushdecl_with_scope.
2681 (pushtag_1): Rename to ...
2682 (do_pushtag): ... here. Adjust do_pushdecl_with_scope call.
2684 (store_class_bindings): Do not time here.
2685 * name-lookup.h (pushdecl_outermost_localscope): Reorder.
2686 * pt.c (listify): Declare argvec at point of initialization.
2689 * name-lookup.c (add_decl_to_level): Assert not making a circular
2691 (update_binding): Don't prematurely slide artificial decl.
2693 2017-05-29 Alexandre Oliva <aoliva@redhat.com>
2695 * cp-tree.h (lang_identifier): Drop oracle_looked_up, unused.
2697 2017-05-29 Nathan Sidwell <nathan@acm.org>
2699 PR c++/80891 (#1,#5)
2700 * cp-tree.h (lookup_maybe_add): Add DEDUPING argument.
2701 * name-lookup.c (name_lookup): Add deduping field.
2702 (name_lookup::preserve_state, name_lookup::restore_state): Deal
2704 (name_lookup::add_overload): New.
2705 (name_lookup::add_value, name_lookup::add_fns): Call add_overload.
2706 (name_lookup::search_adl): Set deduping. Don't unmark here.
2707 * pt.c (most_specialized_instantiation): Revert previous change,
2708 Assert not given duplicates.
2709 * tree.c (lookup_mark): Just mark the underlying decls.
2710 (lookup_maybe_add): Dedup using marked decls.
2713 * ptree.c (cxx_print_xnode): Show internal OVERLOAD structure.
2714 * tree.c (ovl_insert, ovl_iterator_remove_node): Fix copying assert.
2716 Stat hack representation
2717 * name-lookup.c (STAT_HACK_P, STAT_TYPE, STAT_DECL,
2718 MAYBE_STAT_DECL, MAYBE_STAT_TYPE): New.
2720 (find_namespace_binding): Replace with ...
2721 (find_namespace_slot): ... this.
2722 (find_namespace_value): New.
2723 (name_lookup::search_namespace_only,
2724 name_lookup::adl_namespace_only): Adjust.
2725 (update_binding): Add SLOT parameter, adjust.
2726 (check_local_shadow): Use find_namespace_value.
2727 (set_local_extern_decl_linkage): Likewise.
2728 (do_pushdecl): Adjust for namespace slot.
2729 (push_local_binding): Assert not a namespace binding.
2730 (check_for_out_of_scope_variable): Use find_namespace_value.
2731 (set_identifier_type_value_with_scope): Likewise.
2732 (get_namespace_binding): Likewise.
2733 (set_namespace_binding): Delete.
2734 (set_global_binding): Directly update the binding.
2735 (finish_namespace_using_decl): Likewise.
2736 (lookup_type_scope_1): Use find_namespace_slot and update.
2737 (do_push_nested_namespace): Use find_namespace_value.
2740 * pt.c (most_specialized_instantiation): Cope with duplicate
2744 * cp-tree.h (build_min_nt_call_vec): Declare.
2745 * decl.c (build_offset_ref_call_from_tree): Call it.
2746 * parser.c (cp_parser_postfix_expression): Likewise.
2747 * pt.c (tsubst_copy_and_build): Likewise.
2748 * semantics.c (finish_call_expr): Likewise.
2749 * tree.c (build_min_nt_loc): Keep unresolved lookups.
2750 (build_min): Likewise.
2751 (build_min_non_dep): Likewise.
2752 (build_min_non_dep_call_vec): Likewise.
2753 (build_min_nt_call_vec): New.
2756 * tree.c (ovl_copy): Adjust assert, copy OVL_LOOKUP.
2758 (lookup_keep): Call it.
2760 2017-05-26 Nathan Sidwell <nathan@acm.org>
2763 * name-lookup.c (push_inline_namespaces): New.
2764 (push_namespace): Look inside inline namespaces.
2766 Inline and using namespace representation change.
2767 * cp-tree.h (struct lang_decl_ns): Delete ns_using. Add usings,
2769 (DECL_NAMESPACE_USING): Adjust.
2770 (DECL_NAMESPACE_INLINEES): New.
2771 * name-lookup.h (struct cp_binding_level): Change usings
2773 * name-lookup.c (name_lookup::do_queue_usings,
2774 name_lookup::queue_usings): Adjust.
2775 (name_lookup::search_namespace, name_lookup::search_usings,
2776 name_lookup::queue_namespace): Adjust.
2777 (name_lookup::adl_namespace_only): Adjust.
2778 (add_using_namespace, push_namespace): Push onto vector.
2779 (pop_namespace): Add timing logic.
2781 * call.c (build_operator_new_call): Do namelookup and ADL here.
2782 (build_new_op_1): Likewise.
2783 * name-lookup.h (lookup_function_nonclass): Delete declaration.
2784 (do_using_directive): Likewise.
2785 * name-lookup.c (set_namespace_binding, push_local_binding): Don't
2787 (struct scope_binding): Delete.
2788 (EMPTY_SCOPE_BINDING): Delete.
2789 (set_decl_namespace): Use OVL_P.
2790 (finish_local_using_decl): Lose unnecesary checks.
2791 (lookup_function_nonclass): Delete.
2792 (cp_emit_debug_info_for_using): Use MAYBE_BASELINK_P.
2794 * cp-tree.h (OVL_CHAIN): Check looking at OVERLOAD.
2795 (ovl_iterator): Add allow_inner field. Adjust ctor. Make
2797 (ovl_iterator::maybe_push, ovl_iterator::pop): New.
2798 (lkp_iterator): Add outer field. Adjust ctor.
2799 (lkp_iterator::operator++): New.
2800 (lookup_mark, lookup_maybe_add): Declare.
2801 * name-lookup.c (name_lookup): Delete fn_set member.
2802 (name_lookup::preserve_state, name_lookup::restore_state): Unmark
2804 (name_lookup::add_value): Use lookup_add directly.
2805 (name_lookup::add_fns: Use lookup_maybe_add.
2806 (name_lookup::search_adl): Mark and unmark fns.
2808 * pt.c (check_explicit_specialization): Use lookup_add directly.
2809 * ptree.c (cxx_print_xnode): Show complete overload structure.
2810 * tree.c (lookup_mark, lookup_maybe_add): New.
2812 * name-lookup.c (name_lookup::search_adl): ADL OMP UDR type args.
2814 2017-05-26 Jakub Jelinek <jakub@redhat.com>
2816 * cp-tree.h (struct lang_decl_decomp): New type.
2817 (struct lang_decl): Add u.decomp.
2818 (LANG_DECL_DECOMP_CHECK): Define.
2819 (DECL_DECOMPOSITION_P): Note it is set also on the vars
2820 for user identifiers.
2821 (DECL_DECOMP_BASE): Define.
2822 (retrofit_lang_decl): Add extra int = 0 argument.
2823 * lex.c (retrofit_lang_decl): Add SEL argument, if non-zero
2824 use it to influence the selector choices and for selector
2825 0 to non-zero transition copy old content.
2826 (cxx_dup_lang_specific_decl): Handle DECL_DECOMPOSITION_P.
2827 * decl.c (poplevel): For DECL_DECOMPOSITION_P, check
2828 !DECL_DECOMP_BASE instead of !DECL_VALUE_EXPR. Adjust warning
2829 wording if decl is a structured binding.
2830 (cp_finish_decomp): Pass 4 as the new argument to retrofit_lang_decl.
2831 Set DECL_DECOMP_BASE. Ignore DECL_READ_P sets from initialization
2832 of individual variables for tuple structured bindings.
2833 (grokdeclarator): Pass 4 as the new argument to retrofit_lang_decl.
2834 Clear DECL_DECOMP_BASE.
2835 * decl2.c (mark_used): Mark DECL_DECOMP_BASE TREE_USED as well.
2836 * pt.c (tsubst_decomp_names): Assert DECL_DECOMP_BASE matches what
2838 * expr.c (mark_exp_read): Recurse on DECL_DECOMP_BASE instead of
2841 2017-05-25 Jason Merrill <jason@redhat.com>
2843 PR c++/80605 - __is_standard_layout and zero-length array
2844 * class.c (check_bases): Use DECL_FIELD_IS_BASE.
2846 2017-05-25 Nathan Sidwell <nathan@acm.org>
2848 Kill OVL_CURRENT, OVL_NEXT.
2849 * cp-tree.h (OVL_CURRENT, OVL_NEXT): Delete.
2850 * name-lookup.c (set_decl_namespace): Use ovl_iterator.
2851 (consider_binding_level): Use OVL_FIRST.
2852 (cp_emit_debug_info_for_using): Use lkp_iterator.
2853 * pt.c (check_explicit_specialization): Use ovl_iterator.
2855 Kill DECL_NAMESPACE_USERS, DECL_NAMESPACE_ASSOCIATIONS.
2856 * cp-tree.h (lang_decl_ns): Remove ns_users field.
2857 (DECL_NAMESPACE_USERS, DECL_NAMESPACE_ASSOCIATIONS): Delete.
2858 (TREE_INDIRECT_USING): Delete.
2859 * name-lookup.h (is_associated_namespace): Delete.
2860 * name-lookup.c (name_lookup::search_usings,
2861 name_lookup::do_queue_usings): Usings are always direct.
2862 (is_associated_namespace): Delete.
2863 (handle_namespace_attrs): Use DECL_NAMESPACE_INLINE_P.
2864 (namespace_ancestor_1, namespace_ancestor): Delete.
2865 (push_using_directive_1, push_using_directive): Delete.
2866 (add_using_namespace_1): Delete.
2867 (add_using_namespace): Reimplement.
2868 (emit_debug_info_using_namespace): New.
2869 (finish_namespace_using_directive, finish_local_using_directive,
2870 push_namespace): Adjust.
2871 * tree.c (cp_free_lang_data): Remove DECL_NAMESPACE_USERS handling.
2873 2017-05-25 Volker Reichelt <v.reichelt@netcologne.de>
2875 * semantics.c (finish_handler_parms): Warn about non-reference type
2878 2017-05-25 Nathan Sidwell <nathan@acm.org>
2880 Reimplement unqualified namespace lookup.
2881 * name-lookup.c (name_lookup::using_pair,
2882 name_lookup::using_queue): New typedefs.
2883 (name_lookup::queue_namespace, name_lookup::do_queue_usings,
2884 name_lookup::queue_usings): New.
2885 (name_lookup::search_unqualified): New.
2886 (merge_functions, same_entity_p, ambiguous_decl,
2887 unqualified_namespace_lookup_1, unqualified_namespace_lookup,
2888 lookup_using_namespace): Delete.
2889 (lookup_name_real_1): Adjust.
2891 Reimplement qualified namespace lookup.
2892 * name-lookup.c (name_lookup::flags): New member. Adjust ctor.
2893 (name_lookup::ambiguous, name_lookup::add_value,
2894 name_lookup::add_type, name_lookup::process_binding): New.
2895 (name_lookup::search_namespace_only,
2896 name_lookup::search_namespace, name_lookup::search_usings): New.
2897 (name_lookup::search_qualified): New.
2898 (do_nonmember_using_decl, suggest_alternatives_for,
2899 lookup_qualified_name): Adjust.
2900 (tree_vec_contains): Delete.
2901 (qualified_lookup_using_namespace): Rename to ...
2902 (qualified_namespace_lookup): ... here. Reimplement.
2905 * cp-tree.h (LOOKUP_SEEN_P, LOOKUP_FOUND_P): New.
2906 * name-lookup.h (lookup_arg_dependent): Return plain tree.
2907 * name-lookup.c (arg_lookup, arg_assoc, arg_assoc_args,
2908 arg_assoc_args_vec, arg_assoc_type, add_function,
2909 arg_assoc_namespace, arg_assoc_class_only, arg_assoc_bases,
2910 arg_assoc_class, arg_assoc_template_arg, arg_assoc,
2911 lookup_arg_dependent_1): Delete.
2912 (name_lookup): New lookup object.
2913 (name_lookup::preserve_state, name_lookup::restore_state,
2914 name_lookup::mark_seen, name_lookup::find_and_mark,
2915 name_lookup::add_fns, name_lookup::adl_namespace_only,
2916 name_lookup::adl_namespace, name_lookup::adl_class_only,
2917 name_lookup::adl_bases, name_lookup::adl_class,
2918 name_lookup::adl_expr, name_lookup::adl_type,
2919 name_lookup::adl_template_arg, name_lookup::search_adl): New.
2920 (lookup_arg_dependent): Return a plain tree. Adjust.
2921 (is_associated_namespace): Move later.
2923 2017-05-24 Nathan Sidwell <nathan@acm.org>
2925 * friend.c (do_friend): Remove check for existing decl.
2926 * name-lookup.h (lookup_name_innermost_nonclass_level): Delete.
2927 * name-lookup.c (push_local_binding): Directly look for binding.
2928 (lookup_name_innermost_nonclass_level_1): Delete.
2929 (lookup_name_innermost_nonclass_level): Delete.
2931 * Make-lang.in (CXX_AND_OBJCXX_OBJS): Alphabetize.
2933 * cp-tree.h (cp_free_lang_data): Add extern.
2934 (ovl_skip_hidden, is_overloaded_fn, really_overloaded_fn): Add
2936 (type_unknown_p): Return bool, make inline, lose TREE_LIST check.
2937 * typeck.c (type_unknown_p): Delete.
2938 * tree.c (is_overloaded_fn): Use MAYBE_BASELINE_FUNCTIONS, adjust
2939 overload management.
2940 (dependent_name): Likewise.
2941 (decl_anon_ns_mem_p): Simplify.
2943 2017-05-24 Jonathan Wakely <jwakely@redhat.com>
2946 * tree.c (reshape_init): Use unqualified type for direct enum init.
2947 * typeck.c (maybe_warn_about_cast_ignoring_quals): New.
2948 (build_static_cast_1, build_reinterpret_cast_1): Strip cv-quals from
2949 non-class destination types.
2950 (build_const_cast_1): Strip cv-quals from destination types.
2951 (build_static_cast, build_reinterpret_cast, build_const_cast)
2952 (cp_build_c_cast): Add calls to maybe_warn_about_cast_ignoring_quals.
2954 2017-05-24 Martin Sebor <msebor@redhat.com>
2957 * call.c (fully_fold_internal): Adjust.
2959 2017-05-24 Nathan Sidwell <nathan@acm.org>
2961 * cp-tree.h (ovl_skip_hidden): Declare.
2962 * tree.c (ovl_skip_hidden): New.
2963 * name-lookup.c (arg_assoc_namespace): Call ovl_skip_hidden.
2964 (lookup_arg_dependent_1): Likewise.
2965 (ambiguous_decl): Use DECL_HIDDEN_P, ovl_skip_hidden.
2966 (hidden_name_p, remove_hidden_names): Delete.
2967 (lookup_name_real_1): Do not strip hidden names.
2968 * name-lookup.h (hidden_name_p, remove_hidden_names): Delete.
2970 * cp-tree.h (OVL_HIDDEN_P): New.
2971 (ovl_iterator::hidden_p, ovl_iterator::reveal_node): New.
2972 (ovl_iterator::reveal_node): Declare.
2973 * tree.c (ovl_copy): Copy OVL_HIDDEN_P.
2974 (ovl_insert): Order on hiddenness.
2975 (ovl_iterator::reveal_node): New.
2976 * name-lookup.c (anticipated_builtin_p): New.
2977 (supplement_binding_1): Use it.
2978 (set_local_extern_decl_linkage): Use hidden_p.
2979 (do_pushdecl): Deal with unhiding a hidden decl, use
2980 anticipated_builtin_p.
2981 (do_nonmember_using_decl): Use anticipated_decl_p.
2982 (lookup_name_real_1): Use DECL_HIDDEN_P.
2984 2017-05-23 Jason Merrill <jason@redhat.com>
2986 -Wunused and C++17 structured bindings
2987 * decl.c (poplevel): Don't warn about unused structured bindings,
2988 only real variables.
2989 * error.c (dump_simple_decl): Handle structured bindings.
2990 * expr.c (mark_exp_read): Look through DECL_VALUE_EXPR.
2992 2017-05-23 Nathan Sidwell <nathan@acm.org>
2994 * cp-tree.h (PUSH_GLOBAL, PUSH_LOCAL, PUSH_USING): Delete.
2995 * name-lookup.c (create_local_binding): New.
2996 (update_binding): New.
2997 (pushdecl_maybe_friend_1): Rename to ...
2998 (do_pushdecl): ... this. Reimplement.
3000 (push_overloaded_decl_1, push_overloaded_decl): Delete.
3002 2017-05-23 Jason Merrill <jason@redhat.com>
3004 PR c++/80396 - built-in for make_integer_sequence.
3005 * pt.c (builtin_pack_fn_p, builtin_pack_call_p)
3006 (expand_integer_pack, expand_builtin_pack_call): New.
3007 (find_parameter_packs_r): Check builtin_pack_call_p.
3008 (check_for_bare_parameter_packs): Handle it.
3009 (tsubst_pack_expansion): Call expand_builtin_pack_call.
3010 (declare_integer_pack): New.
3011 (init_template_processing): Call it.
3012 * decl2.c (mark_used): Check builtin_pack_fn_p.
3014 2017-05-23 Nathan Sidwell <nathan@acm.org>
3016 * name-lookup.c (find_namespace_binding): New.
3017 (pushdecl_maybe_friend_1): Use CP_DECL_CONTEXT.
3018 (set_identifier_type_value_with_scope): Use find_namespace_binding.
3019 (find_binding, cp_binding_level_find_binding_for_name,
3020 binding_for_name, namespace_binding_1): Delete.
3021 (push_overloaded_decl_1): Use CP_DECL_CONTEXT.
3022 (get_namespace_binding, set_namespace_binding,
3023 finish_namespace_using_decl, unqualified_namespace_lookup_1,
3024 qualified_lookup_using_namespace, lookup_type_scope_1,
3025 lookup_name_innermost_nonclass_level_1): Use find_namespace_binding.
3028 * parser.c (cp_parser_template_id): Keep the lookup when stashing
3031 * cp-tree.h (DECL_HIDDEN_P): New.
3032 * name-lookup.c (set_decl_context,
3033 set_local_extern_decl_linkage): New, broken out of ...
3034 (pushdecl_maybe_friend_1): ... here. Call them.
3036 2017-05-23 Thomas Schwinge <thomas@codesourcery.com>
3038 * parser.c (OACC_KERNELS_CLAUSE_MASK): Add
3039 "PRAGMA_OACC_CLAUSE_NUM_GANGS", "PRAGMA_OACC_CLAUSE_NUM_WORKERS",
3042 2017-05-23 Nathan Sidwell <nathan@acm.org>
3044 * cp-tree.h (OVL_P): New.
3045 * name-lookup.h (push_local_binding): Delete.
3046 (do_toplevel_using_decl, do_local_using_decl): Rename to ...
3047 (finish_namespace_using_decl, finish_local_using_decl): ... here
3048 * name-lookup.c (add_decl_to_level): Swap args.
3049 (pop_bindings_and_leave_scope): Look inside TREE_LIST.
3050 (diagnose_name_conflict): Check contexts are same for redecl.
3051 (update_local_overload): New.
3052 (compparms_for_decl_and_using): Rename to ...
3053 (matching_fn_p): ... here.
3054 (pushdecl_maybe_friend_1): Adjust add_decl_to_level,
3055 push_local_bindings call.
3056 (push_local_binding): Make static, replace FLAGS arg with
3058 (validate_nonmember_using_decl): Use OVL_FIRST.
3059 (do_nonmember_using_decl): Use in/out parameters. Use
3060 lkp_iterator and simplify.
3061 (do_toplevel_using_decl, do_local_using_decl): Rename to ...
3062 (finish_namespace_using_decl, finish_local_using_decl): ... here.
3064 (lookup_type_current_level): Delete.
3065 * parser.c (cp_parser_using_declaration): Adjust.
3066 * pt.c (tsubst_expr): Adjust.
3068 2017-05-22 Nathan Sidwell <nathan@acm.org>
3070 * name-lookup.h (parse_using_directive): Replace with ...
3071 (finish_namespace_using_directive): ... this and ...
3072 (finish_local_using_directive): ... this.
3073 * name-lookup.c (add_using_namespace_1): Move later.
3074 (add_using_namespace): Move later, add namespace_p arg, remove
3076 (push_using_directive_1): Directly recurse.
3077 (do_using_directive, parse_using_directive): Delete, split into ...
3078 (finish_namespace_using_directive): ... this and ...
3079 (finish_local_using_directive): ... this.
3080 (push_namespace): Use add_using_namespace.
3081 * parser.c (cp_parser_using_directive): Call
3082 finish_namespace_using_directive or finish_local_using_directive.
3083 * pt.c (tsubst_expr): Call finish_local_using_directive.
3085 * cp-objcp-common.c (cp_register_dumps): Register raw dumper.
3086 * cp-tree.h (raw_dump_id): Declare.
3087 * decl2.c (raw_dump_id): Define.
3088 (dump_tu): Use raw_dump_id.
3090 * config-lang.in (gtfiles): Sort list, break lines.
3092 * cp-tree.h (CPTI_TERMINATE, CPTI_CALL_UNEXPECTED): Rename to ...
3093 (CPTI_TERMINATE_FN, CPTI_CALL_UNEXPECTED_FN): ... here.
3094 ( CPTI_GET_EXCEPTION_PTR_FN, CPTI_BEGIN_CATCH_FN, CPTI_END_CATCH_FN,
3095 CPTI_ALLOCATE_EXCEPTION_FN, CPTI_FREE_EXCEPTION_FN, CPTI_THROW_FN,
3096 CPTI_RETHROW_FN): New.
3097 (noexcept_deferred_spec): New.
3098 (terminate_node, call_unexpected_node): Rename to ...
3099 (terminate_fn, call_unexpected_fn): ... here.
3100 (get_exception_ptr_fn, begin_catch_fn, end_catch_fn,
3101 allocate_exception_fn, free_exception_fn, throw_fn, rethrow_fn): New.
3102 * except.c (fn1..fn5, throw_fn, rethrow_rn, spec): Delete.
3103 (init_exception_processing): Adjust.
3104 (declare_library_fn): Create and push the fns here.
3105 (do_get_exception_ptr, do_begin_catch, do_end_catch,
3106 do_allocate_exception_ptr, do_free_exception_ptr): Adjust
3107 declare_library_fn use.
3108 (unevaluated_noexcept_spec): Adjust.
3109 * cp-gimplify.c (genericize_eh_spec_block,
3110 gimplify_most_not_throw_expr): Adjust.
3112 * name-lookup.c (pushdecl_top_level,
3113 pushdecl_top_level_and_finish): Move after namespace pushing and
3115 (push_to_top_level): Rename to ...
3116 (do_push_to_top_level): ... here. Remove timing code.
3117 (pop_from_top_level_1): Rename to ...
3118 (do_pop_from_top_level): ... here.
3119 (do_push_nested_namespace, do_pop_nested_namespace)
3120 (push_to_top_level): New wrapper for do_push_to_top_level.
3121 (pop_from_top_level): Adjust.
3122 (push_nested_namepace, pop_nested_namespace): Wrappers for workers.
3124 2017-05-19 Bernd Edlinger <bernd.edlinger@hotmail.de>
3126 * config-lang.in (gtfiles): Add c-family/c-format.c,
3127 except.c, init.c, lambda.c and friend.c.
3128 * class.c (dvirt_fn): Move out of function scope,
3130 * except.c (fn1-5, throw_fn, rethrow_fn, spec): Likewise.
3131 * init.c (fn): Likewise.
3132 * lambda.c (ptr_id, max_id): Likewise.
3133 * friend.c (global_friend): Add GTY attribute.
3135 2017-05-19 Nathan Sidwell <nathan@acm.org>
3137 * call.c (add_list_candidates): Use OVL_FIRST.
3138 (build_new_method_call_1): Likewise.
3139 * cp-tree.h (OVL_SINGLE_P): New.
3140 (TYPE_HIDDEN_P): New.
3141 * decl.c (xref_tag_1): Use TYPE_HIDDEN_P.
3142 * dump.c (cp_tump_tree): Adjust overload dumping.
3143 * error.c (dump_decl): Use OVL_SINGLE_P, simplify context
3145 * method.c (lazily_declare_fn): Assert we added it.
3146 * parser.c (cp_parser_nested_name_specifier): Use OVL_SINGLE_P,
3148 (cp_parser_template_name): Use lkp_iterator.
3149 * pt.c (begin_template_parm_list): Fixup comment.
3150 (instantiate_class_template_1): Use TYPE_HIDDEN_P.
3151 * tree.c (ovl_iterator::remove_node): Cope with inherited ctors.
3152 (ovl_scope): Use lkp_iterator.
3154 2017-05-19 Thomas Schwinge <thomas@codesourcery.com>
3156 * parser.c (cp_parser_omp_clause_default): Handle
3157 "OMP_CLAUSE_DEFAULT_PRESENT".
3159 * parser.c (cp_parser_omp_clause_default): Avoid printing more
3160 than one syntax error message.
3162 2017-05-19 Nathan Sidwell <nathan@acm.org>
3164 * class.c (class_dump_id): Define.
3165 (dump_class_hierarchy, dump_vtable, dump_vtt): Use it.
3166 * cp-objcp-common.c (cp_register_dumps): New.
3167 * cp-objcp-common.h (cp_register_dumps): Declare.
3168 (LANG_HOOKS_REGISTER_DUMPS): Override.
3169 * cp-tree.h (class_dump_id): Declare.
3171 2017-05-18 Nathan Sidwell <nathan@acm.org>
3173 * cp-tree.h (OVL_ARG_DEPENDENT): Delete.
3175 (lookup_keep): Declare.
3176 * name-lookup.c (add_function): Don't set OVL_ARG_DEPENDENT.
3177 * pt.c (tsubst_copy): Assert lookup is persistent.
3178 * semantics.c (finish_call_expr): Use lkp_iterator, call
3180 * tree.c (ovl_copy): New.
3181 (ovl_insert, ovl_iterator::remove_node): Copy immutable nodes.
3184 * cp-tree.h (OVL_USED): Replace with ...
3185 (OVL_USING_P): ... this.
3186 (ovl_iterator::using_p): Adjust.
3187 * name-lookup.c (push_overloaded_decl_1,
3188 do_nonmember_using_decl): Adjust.
3189 * search.c (lookup_field_r): Adjust.
3190 * tree.c (ovl_insert, ovl_scope): Adjust.
3192 * cp-tree.h (lookup_add): Swap args.
3193 (ovl_cons, build_overload): Delete.
3194 * name-lookup.c (add_function, push_overloaded_decl_1,
3195 do_nonmember_using_decl, merge_functions, remove_hidden_names):
3196 Use lookup_add, ovl_insert.
3197 * pt.c (check_explicit_specialization): Use lookup_add.
3198 (do_class_deduction): Likewise. Refactor if.
3199 * tree.c (lookup_add): Swap args.
3200 (ovl_cons, build_overload): Delete.
3202 * name-lookup.c (find_local_binding): New, broken out of ...
3203 (lookup_name_innermost_nonclass_level_1): ... here. Call it.
3204 (set_namespace_binding): Swap scope & name args.
3205 (namespace_binding_1): Likewise.
3206 (pushdecl_maybe_friend_1): Adjust set_namespace_binding call.
3207 (push_overloaded_decl_1): Likewise.
3208 (set_global_binding): Likewise.
3209 (get_namespace_binding): Adjust namespace_binding_1 call.
3211 2017-05-17 Nathan Sidwell <nathan@acm.org>
3213 * cp-tree.h (default_hash_traits <lang_identifier *>): New
3215 * name-lookup.c (lookup_extern_c_fun_in_all_ns): Delete.
3216 (extern_c_fns): New hash table.
3217 (check_extern_c_conflict): New, broken out of ...
3218 (pushdecl_maybe_friend_1): ... here. Call it.
3219 (c_linkage_bindings): Just look in hash table.
3221 2017-05-17 Ville Voutilainen <ville.voutilainen@gmail.com>
3225 Implement new C++ intrinsics __is_assignable and __is_constructible.
3226 * cp-tree.h (CPTK_IS_ASSIGNABLE, CPTK_IS_CONSTRUCTIBLE): New.
3228 * cxx-pretty-print.c (pp_cxx_trait_expression): Handle
3229 CPTK_IS_ASSIGNABLE and CPTK_IS_CONSTRUCTIBLE.
3230 * method.c (constructible_expr): Set cp_unevaluated.
3231 (is_xible_helper): New.
3232 (is_trivially_xible): Adjust.
3234 * parser.c (cp_parser_primary_expression): Handle
3235 RID_IS_ASSIGNABLE and RID_IS_CONSTRUCTIBLE.
3236 (cp_parser_trait_expr): Likewise.
3237 * semantics.c (trait_expr_value): Handle
3238 CPTK_IS_ASSIGNABLE and CPTK_IS_CONSTRUCTIBLE.
3240 2017-05-17 Nathan Sidwell <nathan@acm.org>
3242 * cp-tree.h (ovl_iterator::using_p): New predicate.
3243 (ovl_iterator::remove_node): New worker.
3244 (ovl_insert): Declare.
3245 * tree.c (ovl_insert): New.
3246 (ovl_iterator::remove_node): New.
3247 * class.c (add_method): Use ovl_iterator, ovl_insert.
3248 (clone_function_decl): Fix description.
3249 (clone_constructors_and_destructors): Use ovl_iterator.
3251 * class.c (handle_using_decl): Use OVL_FIRST, ovl_iterator.
3252 (maybe_warn_about_overly_private_class): Use ovl_iterator.
3253 (method_name_cmp, resort_method_name_cmp): Use OVL_NAME.
3254 (resort_type_method_vec, finish_struct_methods): Use OVL_FIRST.
3255 (get_base_fndecls): Use ovl_iterator.
3256 (warn_hidden): Use OVL_NAME, ovl_iterator.
3257 (add_implicitly_declared_members): Use ovl_iterator.
3258 * constraint.cc (normalize_template_id_expression): Use OVL_FIRST,
3260 (finish_shorthand_constraint): Simplify, use ovl_make.
3261 * pt.c (make_constrained_auto): Simplify. Use ovl_make.
3262 * search.c (shared_member_p): Use ovl_iterator.
3263 (lookup_field_fuzzy_info::fuzzy_lookup_fn): Use OVL_NAME.
3264 (lookup_conversion_operator): Use OVL_FIRST.
3265 (lookup_fnfiels_idx_nolazy): Use OVL_FIRST, OVL_NAME.
3266 (look_for_overrides_here): Use ovl_iterator.
3267 (lookup_conversions_r): Use OVL_FIRST, OVL_NAME, ovl_iterator.
3268 * typeck.c (build_x_unary_op): Use ovl_make.
3270 2017-05-17 Martin Liska <mliska@suse.cz>
3272 * class.c (dump_class_hierarchy): Introduce dump_flags_t type and
3273 use it instead of int type.
3274 (dump_vtable): Likewise.
3275 (dump_vtt): Likewise.
3276 * decl2.c (dump_tu): Likewise.
3278 2017-05-16 David Malcolm <dmalcolm@redhat.com>
3280 * call.c (enforce_access): Add access_failure_info * param and use
3281 it to record access failures.
3282 * cp-tree.h (class access_failure_info): New class.
3283 (enforce_access): Add access_failure_info * param, defaulting to
3285 (lookup_member): Likewise.
3286 (locate_field_accessor): New function decl.
3287 (perform_or_defer_access_check): Add access_failure_info * param,
3289 * search.c (lookup_member): Add access_failure_info * param and
3290 pass it on to call to perform_or_defer_access_check.
3291 (matches_code_and_type_p): New function.
3292 (field_access_p): New function.
3293 (direct_accessor_p): New function.
3294 (reference_accessor_p): New function.
3295 (field_accessor_p): New function.
3296 (struct locate_field_data): New struct.
3297 (dfs_locate_field_accessor_pre): New function.
3298 (locate_field_accessor): New function.
3299 * semantics.c (perform_or_defer_access_check): Add
3300 access_failure_info * param, and pass it on to call to
3302 * typeck.c (access_failure_info::record_access_failure): New method.
3303 (access_failure_info::maybe_suggest_accessor): New method.
3304 (finish_class_member_access_expr): Pass an access_failure_info
3305 instance to the lookup_member call, and call its
3306 maybe_suggest_accessor method afterwards.
3308 2017-05-16 Marek Polacek <polacek@redhat.com>
3312 * cp-gimplify.c (cp_fold): Handle SAVE_EXPR.
3314 2017-05-16 Nathan Sidwell <nathan@acm.org>
3316 * name-lookup.c (check_local_shadow): New, broke out of ...
3317 (pushdecl_maybe_friend_1): ... here. Call it.
3319 * cp-tree.h (OVL_NESTED_P, OVL_LOOKUP_P): New.
3320 (ovl_first): Move inline definition to end of file.
3321 (ovl_make, lookup_add): Declare.
3322 (get_fns, get_first_fn): Make pure.
3323 * tree.c (ovl_cache): New.
3324 (ovl_make, lookup_add): New.
3325 * pt.c (do_class_deduction): Don't add candidates that will be
3328 * call.c (build_user_type_conversion_1): Use OVL_FIRST.
3329 (print_error_for_call_failure): Use OVL_NAME.
3330 (build_op_call_1): Use ovl_iterator.
3331 (add_candidates): Use OVL_FIRST & lkp_iterator.
3332 (build_op_delete_call): Use MAYBE_BASELINK_FUNCTIONS &
3334 * class.c (deduce_noexcept_on_destructors): Use ovl_iterator.
3335 (type_has_user_nondefault_constructor,
3336 in_class_defaulted_default_constructor,
3337 type_has_user_provided_constructor,
3338 type_has_user_provided_or_explicit_constructor,
3339 type_has_non_user_provided_default_constructor,
3340 vbase_has_user_provided_move_assign,
3341 type_has_move_constructor, type_has_move_assign,
3342 type_has_user_declared_move_constructor,
3343 type_has_user_declared_move_assign,
3344 type_build_ctor_call, type_build_dtor_call,
3345 type_requires_array_cookie, explain_non_literal_class): Likewise.
3346 (finish_struct): Use lkp_iterator.
3347 (resolve_address_of_overloaded_function): Use OVL_NAME, lkp_iterator.
3348 (note_name_declared_in_class): Use OVL_NAME.
3349 * cxx-pretty-print.c (pp_cxx_unqualified_id): Use OVL_FIRST.
3350 (pp_cxx_qualified_id, cxx_pretty_printer::id_expression,
3351 cxx_pretty_printer::expression): Likewise.
3352 * decl2.c (check_classfn): Use ovl_iterator.
3353 * pt.c (retrieve_specialization): Use ovl_iterator.
3354 * tree.c (cp_tree_equal): Use lkp_iterator.
3355 (type_has_nontrivial_copy_init): Use ovl_iterator.
3357 * typeck2.c (cxx_incomplete_type_diagnostic): Revert change and
3358 check is_overloaded_fn.
3360 2017-05-16 Martin Liska <mliska@suse.cz>
3362 * parser.c (cp_lexer_print_token): Add default value for flags
3363 argument of print_gimple_stmt, print_gimple_expr,
3364 print_generic_stmt and print_generic_expr.
3366 2017-05-16 Nathan Sidwell <nathan@acm.org>
3368 * cp-tree.h (class ovl_iterator, class lkp_iterator): New OVERLOAD
3370 (MAYBE_BASELINK_FUNCTIONS): New.
3371 * constraint.cc (resolve_constraint_check): Use lkp_iterator.
3372 * decl2.c (maybe_warn_sized_delete): Use ovl_iterator.
3373 * lambda.c (maybe_generic_this_capture): Use lkp_iterator.
3374 * method.c (inherited_ctor_binfo): Use ovl_iterator.
3375 (binfo_inherited_from): Likewise.
3376 * parser.c (lookup_literal_operator): Use lkp_iterator.
3377 * pt.c (iterative_hash_template_arg): Use lkp_iterator.
3378 (print_candidates_1): Likewise.
3379 (determine_specialization): Likewise.
3380 (resolve_overloaded_unification): Likewise.
3381 (resolve_nondeduced_context): Likewise.
3382 (type_dependent_expression_p): Likewise.
3383 (dependent_template_p): Likewise.
3384 * ptree.c (cxx_print_xnode): Likewise.
3385 * semantics.c (omp_reduction_lookup): Use lkp_iterator.
3386 (classtype_has_nothrow_assign_or_copy_p): Use ovl_iterator.
3387 * typeck.c (check_template_keyword): Use lkp_iterator.
3389 * cp-tree.h (OVL_FIRST, OVL_NAME): New.
3391 * constexpr.c (function_concept_check): Use OVL_FIRST.
3392 * cvt.c (build_expr_type_conversion): Likewise.
3393 * decl.c (poplevel, grokdeclarator): Use OVL_NAME.
3394 * decl2.c (mark_used): Use OVL_FIRST.
3395 * error.c (dump_decl): Use OVL_FIRST, OVL_NAME.
3396 (dump_expr, location_of): Use OVL_FIRST.
3397 * friend.c (do_friend): Use OVL_NAME.
3398 * init.c (build_offset_ref): Use OVL_FIRST.
3399 * mangle.c (write_member_name): Likewise.
3400 (write_expression): Use OVL_NAME.
3401 * method.c (strip_inheriting_ctors): Use OVL_FIRST.
3402 * name-lookup.c (pushdecl_class_level): Use OVL_NAME.
3403 * pt.c (check_explicit_specialization): Use OVL_FIRST.
3404 (check_template_shadow): Likewise.
3405 (tsubst_template_args): Use OVL_NAME.
3406 (tsubst_baselink): Use OVL_FIRST.
3407 * semantics.c (perform_koenig_lookup): Use OVL_NAME.
3408 * tree.c (get_first_fn): Use OVL_FIRST.
3409 * typeck.c (finish_class_member_access_expr): Use OVL_NAME.
3410 (cp_build_addr_expr_1): Use OVL_FIRST.
3412 * pt.c (tsubst_copy_and_build): Remove unnecessary COMPONENT_REF
3414 * semantics.c (finish_id_expression): Directly init local var.
3415 (finish_omp_reduction_clause): Use really_overloaded_fn.
3416 * tree.c (get_fns): Document. Assert we got an overload.
3417 (get_first_fn) Document.
3418 * typeck.c (cp_build_addr_expr_1): Pass arg directly to
3419 really_overloaded_fn.
3420 * typeck2.c (cxx_incomplete_type_diagnostic): Use get_first_fn directly.
3422 * cp-tree.h (SCOPE_DEPTH): New.
3423 * name-lookup.h (is_nested_namespace): Declare.
3424 * name-lookup.c (is_nested_namespace): New.
3425 (is_ancestor): Use it.
3426 (set_decl_namespace): Likewise.
3427 (push_namespace): Set SCOPE_DEPTH.
3428 * pt.c (check_specialization_namespace): Use is_nested_namespace.
3429 (check_unqualigied_spec_or_inst): Likewise.
3431 2017-05-15 Nathan Sidwell <nathan@acm.org>
3434 * cp-tree.h (DECL_NAMESPACE_INLINE_P): New.
3435 * name-lookup.h (push_namespace): Return int, add make_inline arg.
3436 * name-lookup.c (push_namespace): Deal with inline directly.
3437 Return pushed count.
3438 * parser.c (cp_parser_namespace_definition): Adjust for
3439 push_namespace change.
3441 2017-05-11 Nathan Sidwell <nathan@acm.org>
3443 * cp-lang.c (get_global_decls, cxx_pushdecl, LANG_HOOK_GETDECLS,
3444 LANG_HOOKS_PUSHDECL): Move to ...
3445 * cp-objcp-common.c (cp_get_global_decls, cp_pushdec,
3446 LANG_HOOK_DECLS, LANG_HOOKS_PUSHDECL): ... here.
3447 * cp-objcp-common.h (cp_get_global_decls, cp_pushdecl): Declare.
3449 * name-lookup.h (pushdecl): Add default friend parm.
3450 (pushdecl_maybe_friend): Delete.
3451 (pushdecl_top_level): Add default friend parm.
3452 (pushdecl_top_level_maybe_friend): Delete.
3453 * name-lookup.c (pushdecl_maybe_friend): Delete.
3454 (pushdecl): Add is_friend parm.
3455 (pushdecl_top_level): Add is friend_parm.
3456 (pushdecl_top_level_maybe_friend, pushdecl_top_level_1): Delete.
3457 (pushdecl_top_level_and_finish): Do pushing and finishing directly.
3458 * friend.c (do_friend): Adjust.
3459 * pt.c (tsubst_friend_class): Adjust.
3461 Revert pushdecl_top_level_and_finish name change.
3462 * name-lookup.h (pushdecl_top_level_and_finish): Resurrect old name.
3463 * name-lookup.c (pushdecl_top_level_and_finish): Likewise.
3464 * decl.c (cp_make_fname_decl): Adjust.
3465 * decl2.c (get_guard, handle_tls_init): Adjust.
3466 * rtti.c (get_tinfo_decl, tinfo_base_init): Adjust.
3468 * name-lookup.c (pushdecl_outermost_localscope): Always
3469 conditionally stop timer.
3471 * decl.c (xref_tag_1): Don't frob ts_lambda scope here.
3472 * name-lookup.c (pushtag_1): Deal with ts_lambda scope.
3474 * cp-tree.h (pushdecl, pushdecl_maybe_friend, pushtag,
3475 pushtag_top_level_maybe_friend,
3476 pushdecl_top_level_and_finish): Move declarations to ...
3477 * name-lookup.h: ... here. Group pushdecl variants.
3478 (pushdecl_top_level_and_finish): Rename to ...
3479 (pushdecl_top_level_with_init): ... here.
3480 * decl.c (cp_make_fname_decl): Use pushdecl_top_level_with_init.
3481 * decl2.c (get_guard, handle_tls_init): Likewise.
3482 * rtti.c (get_tinfo_decl, tinfo_base_init): Likewise.
3483 * lambda.c (maybe_add_lambda_conv_op): Use namespace_bindings_p.
3484 * method.c (implicitly_declare_fn): Likewise.
3485 * searchc (node_debug_info_needed): Likewise.
3486 * name-lookup.c (pushdecl_top_level_and_finish): Rename to ...
3487 (pushdecl_top_level_with_init): ... here.
3488 (pop_everything): Use namespace_bindings_p.
3490 * name-lookup.h (pop_binding): Rename to pop_local_binding.
3491 (getdecls): Rename to get_local_decls.
3492 * name-lookup.c (pop_binding): Rename to ...
3493 (pop_local_binding): ... here.
3494 (pop_bindings_and_leave_scope): Adjust.
3495 (getdecls): Rename to ...
3496 (get_local_decls): ... here. Assert local scope.
3497 * decl.c (poplevel): Assert not namespace. Adjust and simplify
3499 (store_parm_decls): Adjust get_local_decls call.
3500 (parser.c (synthesize_implicit_template_parm): Likewise.
3502 2017-05-11 Ville Voutilainen <ville.voutilainen@gmail.com>
3505 * method.c (is_trivially_xible): Reject void types.
3507 2017-05-10 Nathan Sidwell <nathan@acm.org>
3509 * class.c (handle_using_decl): Always use OVL_CURRENT.
3510 (resolve_address_of_overloaded_function): Move iterator decl into
3511 for scope. Don't strip anticipated decls here.
3513 * pt.c (print_candidates_1): Separate TREE_LIST and OVERLOAD
3515 (print_candidates): Adjust.
3517 * cp-tree.h (build_new_function_call): Lose koenig_p arg. Fix
3519 * call.c (build_new_function_call): Lose koenig_p arg. Remove
3520 koenig_p handling here.
3521 * pt.c (push_template_decl_real): Unconditionally retrofit_lang_decl.
3522 (tsubst_omp_clauses): Likewise.
3523 (do_class_deduction): Adjust buld_new_function_call calls.
3524 * semantics.c (finish_call_expr): Likewise.
3526 2017-05-10 Jason Merrill <jason@redhat.com>
3528 * pt.c (unify_parameter_deduction_failure, unify_cv_qual_mismatch)
3529 (unify_type_mismatch, unify_parameter_pack_mismatch)
3530 (unify_ptrmem_cst_mismatch, unify_expression_unequal)
3531 (unify_parameter_pack_inconsistent, unify_inconsistency)
3532 (unify_vla_arg, unify_method_type_error, unify_arity)
3533 (unify_arg_conversion, unify_no_common_base)
3534 (unify_inconsistent_template_template_parameters)
3535 (unify_template_deduction_failure)
3536 (unify_template_argument_mismatch)
3537 (unify_overload_resolution_failure): Call unify_invalid.
3539 CWG 1847 - Clarifying compatibility during partial ordering
3540 * pt.c (more_specialized_fn): No order between two non-deducible
3543 * pt.c (dependent_type_p): Make sure we aren't called with
3546 PR c++/79549 - C++17 ICE with non-type auto template parameter pack
3547 * pt.c (convert_template_argument): Just return an argument pack.
3548 (coerce_template_parameter_pack, template_parm_to_arg)
3549 (extract_fnparm_pack, make_argument_pack, tsubst_template_args)
3550 (tsubst_decl, tsubst, type_unification_real, unify_pack_expansion):
3551 Don't set the type of a NONTYPE_ARGUMENT_PACK.
3552 * parser.c (make_char_string_pack, make_string_pack): Likewise.
3554 2017-05-10 Nathan Sidwell <nathan@acm.org>
3556 * cp-tree.h (add_method, clone_function_decl): Change last arg to
3558 * class.c (add_method): Change third arg to bool. Adjust.
3559 (one_inheriting_sig, one_inherited_ctor): Adjust.
3560 (clone_function_decl): Change 2nd arg to bool. Adjust.
3561 (clone_constructors_and_destructors): Adjust.
3562 * lambda.c (maybe_add_lambda_conv_op): Adjust.
3563 * method.c (lazily_declare_fn): Adjust.
3564 * pt.c (tsubst_decl, instantiate_template_1): Adjust.
3565 * semantics.c (finish_member_declaration): Adjust.
3567 2017-05-10 Paolo Carlini <paolo.carlini@oracle.com>
3570 * decl.c (finish_function): To improve error recovery, change the
3571 logic for calling apply_deduced_return_type.
3573 2017-05-09 Jason Merrill <jason@redhat.com>
3575 PR c++/80605 - __is_standard_layout and empty base
3576 * class.c (check_bases): Ignore empty bases.
3578 PR c++/70979 - literal class and closure types
3579 * class.c (finalize_literal_type_property): Handle closures
3581 (explain_non_literal_class): Likewise.
3583 PR c++/66297, DR 1684 - literal class and constexpr member fns
3584 * constexpr.c (is_valid_constexpr_fn): Only complain about
3585 non-literal enclosing class in C++11.
3586 * class.c (finalize_literal_type_property): Likewise.
3588 2017-05-09 Paolo Carlini <paolo.carlini@oracle.com>
3591 * pt.c (tsubst_decl): Early return error_mark_node if
3592 grok_ctor_properties returns false.
3594 2017-05-09 Jason Merrill <jason@redhat.com>
3596 PR c++/70167 - array prvalue treated as lvalue
3597 * cp-tree.h (CONSTRUCTOR_C99_COMPOUND_LITERAL): New.
3599 * semantics.c (finish_compound_literal): Add fcl_context parameter.
3600 Only make a static variable for C99 syntax.
3601 * parser.c (cp_parser_postfix_expression): Pass it.
3602 * pt.c (tsubst_copy_and_build): Likewise.
3603 * call.c (extend_ref_init_temps): Set
3604 DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P.
3606 2017-05-09 Nathan Sidwell <nathan@acm.org>
3608 * cp-lang.c (get_global_decls, cxx_pushdecl): New.
3609 (LANG_HOOKS_GETDECLS, LANG_HOOKS_PUSHDECL): Override.
3610 * name-lookup.h (pushdecl_top_level): Declare.
3612 2017-05-08 Jason Merrill <jason@redhat.com>
3614 PR c++/80178 - parameter passing for uncopyable classes
3615 * tree.c (type_has_nontrivial_copy_init): True for classes with only
3616 deleted copy/move ctors.
3617 (remember_deleted_copy, maybe_warn_parm_abi): New.
3618 * decl.c (require_complete_types_for_parms, check_function_type):
3619 Call maybe_warn_parm_abi.
3620 * call.c (convert_for_arg_passing, build_cxx_call): Likewise.
3622 2017-05-08 Nathan Sidwell <nathan@acm.org>
3624 * decl.c (builtin_function_1): Set DECL_ANTICIPATED before pushing.
3625 (start_preparsed_function): Do decl pushing before setting
3626 current_funciton_decl and announcing it.
3628 * name-lookup.h (pushdecl_with_scope): Replace with ...
3629 (pushdecl_outermost_localscope): ... this.
3630 * name-lookup.c (pushdecl_with_scope): Replace with ...
3631 (pushdecl_outermost_localscope): ... this.
3632 (pushdecl_namespace_level): Adjust.
3633 * decl.c (cp_make_fname_decl): Use pushdecl_outermost_localscope.
3634 * lambda.c (insert_capture_proxy): Likewise.
3636 * class.c (build_vtbl_initializer): Don't shadow outer variable
3639 Revert _binding -> _value change.
3640 * name-lookup.h (get_namespace_value, set_global_value): Rename to ...
3641 (get_namespace_binding, set_global_binding): ... these.
3642 * name-lookup.c (get_namespace_value, set_global_value): Rename to ...
3643 (get_namespace_binding, set_global_binding): ... these.
3644 (arg_assoc_namespace, pushdecl_maybe_friend_1,
3645 check_for_out_of_scope_variable, push_overloaded_decl_1,
3646 lookup_name_innermost_nonclass_level, push_namespace): Adjust.
3647 * cp-tree.h (IDENTIFIER_GLOBAL_VALUE,
3648 SET_IDENTIFIER_GLOBAL_VALUE): Adjust.
3649 * decl.c (poplevel): Adjust.
3650 * pt.c (make_constrained_auto): Likewise.
3652 2017-05-07 Volker Reichelt <v.reichelt@netcologne.de>
3654 PR translation/80280
3655 * call.c (print_z_candidate): Fix quoting.
3657 2017-05-05 David Malcolm <dmalcolm@redhat.com>
3659 * error.c (pedwarn_cxx98): Replace report_diagnostic
3660 with diagnostic_report_diagnostic.
3662 2017-05-05 Nathan Sidwell <nathan@acm.org>
3664 * cp-tree.h (IDENTIFIER_GLOBAL_VALUE): Use get_namespace_value.
3665 (SET_IDENTIFIER_GLOBAL_VALUE): Use set_global_value.
3666 (IDENTIFIER_NAMESPACE_VALUE): Delete.
3667 * name-lookup.h (namespace_binding, set_namespace_binding): Replace
3669 (get_namespace_value, set_global_value): ... these.
3670 (get_global_value_if_present, is_typename_at_global_scope): Delete.
3671 * decl.c (poplevel): Use get_namespace_value.
3672 (grokdeclarator): Use IDENTIFIER_GLOBAL_VALUE.
3673 * class.c (build_vtbl_initializer): Stash library decl in
3674 static var. Use IDENTIFIER_GLOBAL_VALUE.
3675 * except.c (do_get_exception_ptr, do_begin_catch, do_end_catch,
3676 do_allocate_exception, do_free_exception, build_throw): Likewise.
3677 * init.c (throw_bad_array_new_length): Likewise.
3678 * rtti.c (throw_bad_cast, throw_bad_typeid): Likewise.
3679 * name-lookup.c (arg_assoc_namespace, pushdecl_maybe_friend_1,
3680 check_for_our_of_scope_variable, push_overloaded_decl_1): Use
3681 get_namespace_value.
3682 (set_namespace_binding_1): Rename to
3683 (set_namespace_binding): ... here.
3684 (set_global_value): New.
3685 (lookup_name_innermost_nonclass_level_1, push_namespace): Use
3686 get_namespace_value.
3687 * pt.c (listify): Use get_namespace_value.
3689 * call.c (make_temporary_var_for_ref_to_temp): Push decl into
3691 * lex.c (unqualified_name_lookup_error): Likewise.
3693 * class.c (alter_class): Use retrofit_lang_decl directly.
3694 * decl.c (push_local_name, dupliate_decls): Likewise.
3695 * semantics.c (omp_privatize_field): Likewise.
3697 Kill walk_namespaces.
3698 * cp-tree.h (walk_namespaces_fn, walk_namespaces): Delete.
3699 * decl.c (walk_namespaces_r, walk_namespaces): Delete.
3701 Kill per-namespace static_decls.
3702 * cp-tree.h (static_decls): Declare.
3703 (wrapup_globals_for_namespace,
3704 diagnose_inline_vars_for_namespace): Replace with ...
3705 (wrapup_namespace_globals): ... this.
3706 * decl.c (static_decls): Define.
3707 (wrapup_globals_for_namespace,
3708 diagnose_inline_vars_for_namespace): Replace with ...
3709 (wrapup_namespace_globals): ... this.
3710 (cxx_init_decl_processing): Initialize static_decls.
3711 * decl2.c (c_parse_final_cleanups): Adjust.
3712 * name-lookup.h (cp_binding_level): Remove static_decls member.
3713 * name-lookup.c (add_decl_to_level): Adjust.
3714 (begin_scope): Adjust.
3716 2017-05-05 Paolo Carlini <paolo.carlini@oracle.com>
3719 * decl.c (reshape_init): Unconditionally return error_mark_node
3720 upon error about too many initializers.
3722 2017-05-04 Nathan Sidwell <nathan@acm.org>
3724 * constraint.cc (diagnose_check_constraint): Fix %E thinko.
3726 2017-05-04 Martin Sebor <msebor@redhat.com>
3728 PR translation/80280
3729 * call.c (print_z_candidate): Add missing quoting to %D and other
3731 (build_op_call_1): Same.
3732 * constraint.cc (diagnose_check_constraint): Same.
3733 * mangle.c (mangle_decl): Same.
3734 * name-lookup.c (cp_binding_level_debug): Same.
3735 (set_decl_namespace): Same.
3736 * parser.c (cp_parser_tx_qualifier_opt): Same.
3737 * pt.c (print_candidates_1): Same.
3738 (check_template_variable): Same.
3739 (tsubst_default_argument): Same.
3740 (most_specialized_partial_spec): Same.
3741 * semantics.c (omp_reduction_lookup): Same.
3742 * tree.c (check_abi_tag_redeclaration): Same.
3743 * typeck.c (comptypes): Same.
3744 * typeck2.c (abstract_virtuals_error_sfinae): Same.
3746 2017-05-04 Nathan Sidwell <nathan@acm.org>
3749 * cp-tree.h (enum cp_tree_index): Add CPTI_GLOBAL,
3750 CPTI_GLOBAL_TYPE, CPTI_GLOBAL_IDENTIFIER, CPTI_ANON_IDENTIFIER,
3751 CPTI_INIT_LIST_IDENTIFIER.
3752 (global_namespace, global_type_node, global_identifier,
3753 anon_identifier, init_list_identifier): New.
3754 * decl.c (global_type_node, global_scope_name): Delete.
3755 (initialize_predefined_identifiers): Add new identifiers.
3756 (cxx_init_decl_processing): Adjust.
3757 * name-lookup.h (global_namespace, global_type_node): Delete.
3758 * name-lookup.c (global_namespace, anonymous_namespace_name,
3759 get_anonymous_namespace_name): Delete.
3760 (namespace_scope_ht_size, begin_scope, pushtag_1,
3761 push_namespace): Adjust,
3762 * call.c (type_has_extended_temps): Use init_list_identifier.
3763 * pt.c (listify): Likewise.
3765 * name-lookup.c: Reorder functions to make merging from modules
3768 2017-05-03 Jason Merrill <jason@redhat.com>
3770 * constexpr.c (cxx_eval_outermost_constant_expr): Use TV_CONSTEXPR.
3772 2017-05-03 Nathan Sidwell <nathan@acm.org>
3774 * cp-tree.h (enum cp_tree_index, cp_global_trees): Move earlier,
3775 along with #defines, to before name-lookup include.
3777 2017-05-02 Paolo Carlini <paolo.carlini@oracle.com>
3779 * pt.c (is_auto_or_concept): Remove.
3780 (type_uses_auto_or_concept): Remove, unused.
3781 (find_parameter_packs_r, extract_autos_r, is_auto_r): Adjust.
3782 * parser.c (tree_type_is_auto_or_concept): Remove, unused.
3783 * cp-tree.h (is_auto_or_concept): Remove.
3785 2017-05-01 Xi Ruoyao <ryxi@stu.xidian.edu.cn>
3788 * cp-cilkplus.c (cilk_install_body_with_frame_cleanup): Don't
3789 add pedigree operation and detach call here.
3790 * cp-gimplify.c (cp_gimplify_expr): Remove the calls to
3791 cilk_cp_gimplify_call_params_in_spawned_fn.
3792 (cilk_cp_gimplify_call_params_in_spawned_fn): Remove function.
3793 * semantics.c (simplify_aggr_init_expr): Copy EXPR_CILK_SPAWN.
3795 2017-04-29 Volker Reichelt <v.reichelt@netcologne.de>
3797 * parser.c (cp_parser_member_declaration): Add fix-it hints for
3798 stray comma and missing semicolon at end of member declaration.
3800 2017-04-27 Volker Reichelt <v.reichelt@netcologne.de>
3802 * parser.c (cp_parser_cast_expression): Add target type of cast to
3804 * error.c (type_to_string): Add '{enum}' suffix to enumeration types.
3806 2017-04-26 Paolo Carlini <paolo.carlini@oracle.com>
3808 * decl.c (grok_ctor_properties, ambi_op_p, unary_op_p): Change
3809 return type to bool.
3810 * cp-tree.h (grok_ctor_properties): Update.
3812 2017-04-26 Volker Reichelt <v.reichelt@netcologne.de>
3814 * parser.c (cp_parser_nested_name_specifier_opt): Add fix-it
3815 information to diagnostic of invalid colon in nested-name-specifier.
3817 2017-04-25 Volker Reichelt <v.reichelt@netcologne.de>
3819 * parser.c (cp_parser_elaborated_type_specifier): Add fix-it to
3820 diagnostic of invalid class/struct keyword after enum.
3822 2017-04-25 David Malcolm <dmalcolm@redhat.com>
3824 * parser.c (cp_parser_member_declaration): Add fix-it hint
3825 for removing stray semicolons.
3827 2017-04-25 David Malcolm <dmalcolm@redhat.com>
3829 * name-lookup.c (get_std_name_hint): New function.
3830 (maybe_suggest_missing_header): New function.
3831 (suggest_alternative_in_explicit_scope): Call
3832 maybe_suggest_missing_header.
3834 2017-04-25 David Malcolm <dmalcolm@redhat.com>
3837 * name-lookup.c (suggest_alternative_in_explicit_scope): Convert
3838 candidate type of bm from tree to const char *.
3839 (consider_binding_level): Likewise.
3840 (lookup_name_fuzzy): Likewise, using this to merge the best
3841 result from the preprocessor into bm, rather than immediately
3842 returning, so that better matches from reserved words can "win".
3843 Guard the rejection of keywords that don't start decl-specifiers
3844 so it only happens for FUZZY_LOOKUP_TYPENAME.
3846 2017-04-24 Volker Reichelt <v.reichelt@netcologne.de>
3848 * decl.c (grokdeclarator): Use %qT instead of %<%T%> in diagnostics.
3849 (start_enum): Likewise.
3850 (build_enumerator): Likewise. Use %qE instead of plain %E.
3851 * parser.c (cp_parser_mem_initializer_list): Use %qD instead of
3852 %<%D%> in diagnostics.
3853 (cp_parser_elaborated_type_specifier): Likewise.
3854 * pt.c (make_pack_expansion): Use %qT and %qE instead of
3855 %<%T%> and %<%E%> in diagnostics.
3856 (tsubst_pack_expansion): Likewise.
3858 2017-04-24 David Malcolm <dmalcolm@redhat.com>
3861 * parser.c (cp_parser_unary_expression): Generate a location
3862 range for alignof and sizeof expressions.
3864 2017-04-24 Volker Reichelt <v.reichelt@netcologne.de>
3866 * parser.c (cp_parser_cv_qualifier_seq_opt): Add fix-it info to
3868 (cp_parser_virt_specifier_seq_opt): Likewise.
3869 (set_and_check_decl_spec_loc): Likewise twice.
3871 2017-04-21 Jason Merrill <jason@redhat.com>
3873 PR c++/80179 - ICE with initialized flexible array member.
3874 * constexpr.c (verify_ctor_sanity): Handle flexible array members.
3876 2017-04-21 Richard Biener <rguenther@suse.de>
3878 * cp-tree.h (copy_decl): Annotate with CXX_MEM_STAT_INFO.
3879 (copy_type): Likewise.
3880 * lex.c (copy_decl): Pass down mem-stat info.
3881 (copy_type): Likewise.
3883 2017-04-20 Jonathan Wakely <jwakely@redhat.com>
3886 * init.c (build_new_1): Suppress notes about over-aligned new when
3887 the warning is suppressed.
3889 2017-04-20 Volker Reichelt <v.reichelt@netcologne.de>
3891 * parser.c (cp_parser_member_declaration): Add warning with fixit
3892 information for extra semicolon after in-class function definition.
3894 2017-04-20 Jakub Jelinek <jakub@redhat.com>
3897 * tree.c (build_cplus_array_type): Call build_array_type
3898 with the intended TYPE_TYPELESS_STORAGE flag value, instead
3899 of calling build_array_type and modifying later TYPE_TYPELESS_STORAGE
3902 2017-04-18 Marek Polacek <polacek@redhat.com>
3904 PR c++/80244 - ICE with attribute in template alias.
3905 * tree.c (strip_typedefs): Handle UNDERLYING_TYPE.
3907 PR c++/80241 - ICE with alignas pack expansion.
3908 * error.c (dump_expr): Handle TREE_LIST.
3909 * parser.c (cp_parser_std_attribute_list): Return error_mark if
3910 make_pack_expansion returns an error.
3912 2017-04-17 Bernd Edlinger <bernd.edlinger@hotmail.de>
3915 * class.c (fixup_may_alias): Fix all type variants.
3917 2017-04-17 Jason Merrill <jason@redhat.com>
3919 PR c++/80415 - wrong error with default arg and array reference.
3920 * tree.c (lvalue_kind): Return clk_class for an array prvalue.
3922 * pt.c (tsubst_init): Set TARGET_EXPR_DIRECT_INIT_P.
3924 2017-04-15 Alexandre Oliva <aoliva@redhat.com>
3926 * decl.c (name_unnamed_type): Split out of...
3927 (grokdeclarator): ... this.
3928 * decl.h (name_unnamed_type): Declare.
3930 2017-04-12 Richard Biener <rguenther@suse.de>
3931 Bernd Edlinger <bernd.edlinger@hotmail.de>
3934 * tree.c (build_cplus_array_type): Set TYPE_TYPELESS_STORAGE
3935 for arrays of character or std::byte type.
3937 2017-04-11 Jason Merrill <jason@redhat.com>
3939 PR c++/80294 - ICE with constexpr and inheritance.
3940 * constexpr.c (reduced_constant_expression_p):
3941 A null constructor element is non-constant.
3942 (cxx_eval_indirect_ref): Don't VERIFY_CONSTANT before
3943 returning an empty base.
3945 2017-04-11 Jakub Jelinek <jakub@redhat.com>
3948 * decl.c (cp_finish_decomp): If processing_template_decl on
3949 non-dependent decl, only set TREE_TYPE on the v[i] decls, but don't
3950 change their DECL_VALUE_EXPR nor cp_finish_decl them. Instead make
3951 sure DECL_VALUE_EXPR is the canonical NULL type ARRAY_REF for tsubst
3953 * pt.c (value_dependent_expression_p) <case VAR_DECL>: For variables
3954 with DECL_VALUE_EXPR, return true if DECL_VALUE_EXPR is type
3957 2017-04-11 Jakub Jelinek <jakub@redhat.com>
3960 * error.c (dump_expr): Handle VEC_COND_EXPR like COND_EXPR.
3962 2017-04-10 Jakub Jelinek <jakub@redhat.com>
3965 * tree.c (lvalue_kind): For COMPONENT_REF with BASELINK second
3966 operand, if it is a static member function, recurse on the
3969 2017-04-10 Marek Polacek <polacek@redhat.com>
3972 * typeck.c (cp_build_binary_op): Use NULL_TREE instead of NULL. Set
3973 ORIG_TYPE earlier and not only when shortening.
3975 2017-04-07 Jason Merrill <jason@redhat.com>
3977 PR c++/80356 - ICE with reference to function template argument.
3979 * pt.c (convert_nontype_argument_function): Adjust type even with a
3980 value-dependent argument.
3982 PR c++/80267 - ICE with nested capture of reference
3984 * pt.c (tsubst_copy): Handle lookup finding a capture proxy.
3986 2017-04-07 Marek Polacek <polacek@redhat.com>
3989 * typeck.c (cp_build_binary_op): Convert COP[01] to ORIG_TYPE.
3992 * call.c (build_over_call): Don't check cxx_dialect.
3993 * cp-gimplify.c (cp_gimplify_init_expr): Don't check cxx_dialect nor
3994 whether SUB is a CONSTRUCTOR.
3995 * init.c (build_new_1): Don't check cxx_dialect.
3996 * tree.c (replace_placeholders): Add a function comment. Return if
3997 not in C++14, or if the object isn't a (member of a) class.
3998 * typeck2.c (store_init_value): Don't check cxx_dialect nor whether
3999 TYPE is CLASS_TYPE_P.
4001 2017-04-05 Jakub Jelinek <jakub@redhat.com>
4004 * pt.c (canonical_type_parameter): Use vec_safe_grow_cleared instead
4005 of a loop doing vec_safe_push of NULL. Formatting fixes.
4006 (rewrite_template_parm): Copy TEMPLATE_PARM_PARAMETER_PACK from oldidx
4007 to newidx before calling canonical_type_parameter on newtype.
4009 2017-04-04 Volker Reichelt <v.reichelt@netcologne.de>
4012 * cxx-pretty-print.c (cxx_pretty_printer::expression): Add
4013 UNARY_PLUS_EXPR case.
4015 2017-04-03 Jason Merrill <jason@redhat.com>
4017 * semantics.c (finish_template_type): Check CLASSTYPE_TEMPLATE_INFO.
4019 2017-04-03 Jonathan Wakely <jwakely@redhat.com>
4021 * class.c (update_vtable_entry_for_fn): Fix typo in comment.
4022 * decl2.c (one_static_initialization_or_destruction): Likewise.
4023 * name-lookup.c (store_bindings): Likewise.
4024 * parser.c (make_call_declarator): Likewise.
4025 * pt.c (check_explicit_specialization): Likewise.
4027 2017-04-03 Jason Merrill <jason@redhat.com>
4029 PR sanitizer/79993 - ICE with VLA initialization from string
4030 PR c++/69487 - wrong VLA initialization from string
4031 * init.c (finish_length_check): Split out from build_vec_init.
4032 (build_vec_init): Handle STRING_CST.
4033 * typeck2.c (split_nonconstant_init): Handle STRING_CST.
4034 (digest_init_r): Don't give a STRING_CST VLA type.
4036 2017-03-31 Jakub Jelinek <jakub@redhat.com>
4039 * cp-gimplify.c (cp_genericize_r): Sanitize INTEGER_CSTs with
4040 REFERENCE_TYPE. Adjust ubsan_maybe_instrument_reference caller
4041 for NOP_EXPR to REFERENCE_TYPE.
4044 * cp-tree.h (enum cp_trait_kind): Add CPTK_IS_AGGREGATE.
4045 * cxx-pretty-print.c (pp_cxx_trait_expression): Handle
4047 * semantics.c (trait_expr_value): Handle CPTK_IS_AGGREGATE.
4048 Remove extraneous parens.
4049 (finish_trait_expr): Handle CPTK_IS_AGGREGATE.
4050 * parser.c (cp_parser_primary_expression): Handle RID_IS_AGGREGATE.
4051 (cp_parser_trait_expr): Likewise.
4053 2017-03-27 Jakub Jelinek <jakub@redhat.com>
4056 * cp-tree.h (cxx_mark_addressable): Add array_ref_p argument.
4057 * typeck.c (cxx_mark_addressable): Likewise. Look through
4058 VIEW_CONVERT_EXPR unless array_ref_p and VCE is from VECTOR_TYPE
4060 (cp_build_array_ref): Pass true as array_ref_p to cxx_mark_addressable.
4062 2017-03-24 Jason Merrill <jason@redhat.com>
4064 PR c++/77339 - ICE with invalid use of alias template.
4065 * pt.c (lookup_template_class_1): Don't try to enter the scope of an
4068 2017-03-24 Marek Polacek <polacek@redhat.com>
4071 * cp-gimplify.c (cp_fold): Strip CLEANUP_POINT_EXPR if the expression
4072 doesn't have side effects.
4074 2017-03-23 Jason Merrill <jason@redhat.com>
4076 PR c++/80150 - ICE with overloaded variadic deduction.
4077 * pt.c (try_one_overload): Remove asserts.
4079 PR c++/77563 - missing ambiguous conversion error.
4080 * call.c (convert_like_real): Use LOOKUP_IMPLICIT.
4082 2017-03-23 Marek Polacek <polacek@redhat.com>
4084 * cp-tree.h: Remove a C_RID_YYCODE reference.
4086 2017-03-22 Jakub Jelinek <jakub@redhat.com>
4089 * semantics.c (finish_omp_clause) <case OMP_CLAUSE_SIMDLEN,
4090 case OMP_CLAUSE_ALIGNED>: Call maybe_constant_value only when not
4091 processing_template_decl.
4093 2017-03-21 Paolo Carlini <paolo.carlini@oracle.com>
4096 * name-lookup.c (pushtag_1): Add check for bogus, non template,
4097 std::initializer_list.
4099 2017-03-21 Jakub Jelinek <jakub@redhat.com>
4102 * init.c (std_placement_new_fn_p, build_new_1): Formatting fixes.
4104 2017-03-21 Ville Voutilainen <ville.voutilainen@gmail.com>
4107 * init.c (std_placement_new_fn_p): New.
4108 (build_new_1): Call it.
4110 2017-03-20 Jason Merrill <jason@redhat.com>
4112 PR c++/80096 - ICE with C++17 non-type auto.
4113 * pt.c (tsubst): Delay tsubst of type of template non-type
4116 PR c++/79519 - ICE with deleted template friend.
4117 * decl.c (grokdeclarator): Complain about misplaced function
4118 definition using =, as well.
4120 PR c++/79640 - infinite recursion with generic lambda.
4121 * pt.c (tsubst_copy) [VAR_DECL]: Register the dummy instantiation
4122 before substituting its initializer.
4124 2017-03-20 Marek Polacek <polacek@redhat.com>
4125 Paolo Carlini <paolo.carlini@oracle.com>
4127 PR c++/80059 - ICE with noexcept and __transaction_atomic
4128 * except.c (build_must_not_throw_expr): Call
4129 instantiate_non_dependent_expr.
4131 2017-03-19 Jason Merrill <jason@redhat.com>
4133 PR c++/80084 - wrong C++17 decomposition by reference of parameter.
4134 * decl.c (cp_finish_decomp): Don't pull out the DECL_INITIAL of a
4135 reference decomposition.
4137 PR c++/80077 - error with constexpr and -fno-elide-constructors.
4138 * constexpr.c (cxx_eval_call_expression): Set ctx->call while
4139 expanding trivial constructor.
4141 2017-03-17 Jason Merrill <jason@redhat.com>
4143 PR c++/78345 - ICE initializing array from lambda.
4144 * init.c (build_aggr_init): Check array initializer.
4145 (build_vec_init): Check the type of a CONSTRUCTOR.
4147 PR c++/80073 - C++17 ICE with virtual base.
4148 * decl.c (xref_basetypes): Also check for indirect vbases.
4150 2017-03-16 Jason Merrill <jason@redhat.com>
4152 * decl.c (start_enum): std::byte aliases anything.
4155 * constexpr.c (lookup_placeholder): Tweak.
4157 2017-03-15 Jason Merrill <jason@redhat.com>
4159 PR c++/80043 - ICE with -fpermissive
4160 * typeck.c (convert_for_assignment): Handle instantiate_type
4161 not giving an error.
4163 2017-03-14 Nathan Sidwell <nathan@acm.org>
4165 PR c++/79393 DR 1658 workaround
4166 * method.c (synthesized_method_base_walk): Inihibit abstract class
4167 virtual base access check here.
4168 (synthesized_method_walk): Not here.
4170 2017-03-13 Nathan Sidwell <nathan@acm.org>
4172 PR c++/79393 DR 1658 workaround
4173 * method.c (synthesized_method_walk): Check vbases of abstract
4174 classes for dtor walk.
4176 2017-03-10 David Malcolm <dmalcolm@redhat.com>
4178 PR translation/79848
4179 * decl.c (grokfndecl): Simplify uses of "%<%s%>" to "%qs".
4181 2017-03-10 Jason Merrill <jason@redhat.com>
4183 PR c++/79960 - alias templates and partial ordering
4184 * pt.c (comp_template_args): Add partial_order parm.
4185 (template_args_equal): Likewise.
4186 (comp_template_args_porder): New.
4187 (get_partial_spec_bindings): Use it.
4189 2017-03-10 Marek Polacek <polacek@redhat.com>
4192 * decl.c (grokdeclarator): Check ATTRLIST before dereferencing it.
4194 2017-03-10 Jakub Jelinek <jakub@redhat.com>
4197 * optimize.c (maybe_thunk_body): Don't ICE if fns[0] is NULL.
4198 Use XALLOCAVEC macro.
4201 * decl.c (finish_enum_value_list): If value is error_mark_node,
4202 don't copy it and change its type.
4203 * init.c (constant_value_1): Return error_mark_node if DECL_INITIAL
4204 of CONST_DECL is error_mark_node.
4206 2017-03-09 Marek Polacek <polacek@redhat.com>
4208 PR c++/79900 - ICE in strip_typedefs
4209 * tree.c (strip_typedefs): Skip the attribute handling if T is
4210 a variant type which hasn't been updated yet.
4212 PR c++/79687 - wrong code with pointer-to-member
4213 * init.c (constant_value_1): Break if the variable has a dynamic
4216 2017-03-08 Jason Merrill <jason@redhat.com>
4218 PR c++/79797 - ICE with self-reference in array DMI.
4219 * constexpr.c (lookup_placeholder): Split out...
4220 (cxx_eval_constant_expression): ...from here.
4222 2017-03-07 Jakub Jelinek <jakub@redhat.com>
4225 * parser.c (cp_parser_omp_cancellation_point,
4226 cp_parser_omp_target_enter_data, cp_parser_omp_target_exit_data,
4227 cp_parser_omp_target_update): Change "may only be used in compound
4228 statements" diagnostics, such that the same translatable string is
4229 used for all pragmas.
4230 (cp_parser_pragma): Likewise. Use error_at instead of
4231 cp_parser_error for that diagnostics.
4233 2017-03-06 Marek Polacek <polacek@redhat.com>
4235 PR c++/79796 - ICE with NSDMI and this pointer
4236 * call.c (build_over_call): Handle NSDMI with a 'this' by calling
4237 replace_placeholders.
4239 2017-03-06 Jakub Jelinek <jakub@redhat.com>
4242 * constexpr.c (cxx_eval_statement_list): Treat empty ({ }) like
4245 2017-03-06 Jason Merrill <jason@redhat.com>
4247 Revert "Allow deduction guides to look into primary template."
4248 * cp-tree.h, parser.c, pt.c, search.c: Revert.
4250 2017-03-05 Paolo Carlini <paolo.carlini@oracle.com>
4253 * except.c (build_must_not_throw_expr): Perform the implicit
4254 conversions on the condition.
4256 2017-03-03 Jason Merrill <jason@redhat.com>
4258 * mangle.c (mangle_decl): Check -Wnoexcept-type instead of
4261 Core issues 2273 and 2277
4262 * call.c (joust): Adjust using-declaration tiebreaker to handle
4263 the intermediate base case.
4264 * method.c (strip_inheriting_ctors): Just return the argument if
4265 !flag_new_inheriting_ctors.
4267 2017-03-03 Richard Biener <rguenther@suse.de>
4270 * cp-gimplify.c (simple_empty_class_p): Handle EMPTY_CLASS_EXPR.
4272 2017-03-03 Marek Polacek <polacek@redhat.com>
4275 * typeck.c (string_conv_p): In C++11, always call pedwarn with
4278 2017-03-02 Jason Merrill <jason@redhat.com>
4280 Update overload resolution with deduction guides.
4281 * pt.c (do_class_deduction): Always build the copy guide.
4282 (copy_guide_p, template_guide_p): New.
4283 (build_deduction_guide): Remember the original constructor.
4284 * call.c (joust): Prefer the copy guide and non-template guides.
4286 Allow deduction guides to look into primary template.
4287 * cp-tree.h (struct saved_scope): Add deduction_guide_type.
4288 (struct cp_decl_specifier_seq): Add constructor_p.
4289 * parser.c (cp_parser_decl_specifier_seq): Set constructor_p.
4290 (cp_parser_init_declarator): Check it. Set ctor_dtor_or_conv_p.
4291 Clear deduction_guide_type. Don't handle deduction guide names.
4292 (cp_parser_declarator): Don't clear ctor_dtor_or_conv_p.
4293 (cp_parser_direct_declarator): Likewise. Handle deduction guides.
4294 (cp_parser_member_declaration, cp_parser_cache_defarg)
4295 (cp_parser_objc_class_ivars): Set ctor_dtor_or_conv_p.
4296 * pt.c (tsubst_copy, tsubst_copy_and_build): Revert last change.
4297 (build_deduction_guide): Set deduction_guide_type.
4298 (dependent_scope_p): Check deduction_guide_type.
4299 * search.c (lookup_member): Likewise.
4301 2017-03-02 Jakub Jelinek <jakub@redhat.com>
4304 * init.c (mark_exp_read_r): New function.
4305 (emit_mem_initializers): Use cp_walk_tree with mark_exp_read_r on
4306 whole arguments instead of plain mark_exp_read on TREE_LIST values.
4308 2017-03-01 Jason Merrill <jason@redhat.com>
4310 Class template argument deduction in new-expression
4311 * init.c (build_new): Handle deduction from no initializer.
4312 * parser.c (cp_parser_new_expression): Don't require a single
4313 expression for class template deduction.
4314 * typeck2.c (cxx_incomplete_type_diagnostic): Fix diagnostic for
4315 class template placeholder.
4316 * pt.c (tsubst_copy) [TEMPLATE_DECL]: Handle dependent context.
4317 (tsubst_copy_and_build) [TEMPLATE_ID_EXPR]: Handle SCOPE_REF.
4318 (redeclare_class_template): Set TEMPLATE_TYPE_PARM_FOR_CLASS.
4320 2017-03-01 Jakub Jelinek <jakub@redhat.com>
4323 * init.c (emit_mem_initializers): When not constructing vbases of
4324 abstract classes, mark arguments as read for
4325 -Wunused-but-set-parameter.
4327 2017-02-28 Jason Merrill <jason@redhat.com>
4329 Class template argument deduction refinements
4330 * call.c (joust): Move deduction guide tiebreaker down.
4331 * decl.c (start_decl_1, cp_finish_decl, grokdeclarator): Allow class
4332 deduction with no initializer.
4333 * pt.c (build_deduction_guide): Handle implicit default/copy ctor.
4334 (do_class_deduction): Use that rather than special case.
4335 (do_auto_deduction): Handle null initializer.
4337 2017-02-28 Jakub Jelinek <jakub@redhat.com>
4339 * decl.c (find_decomp_class_base): Use cond ? G_("...") : G_("...")
4340 instead of just cond ? "..." : "...".
4341 (grokdeclarator): Likewise.
4342 (build_enumerator): Likewise.
4343 * init.c (build_new_1): Likewise.
4344 * call.c (build_new_method_call_1): Likewise.
4345 * parser.c: Include intl.h.
4346 (cp_parser_oacc_enter_exit_data): Use %s and ternary operator only for
4347 "enter"/"exit" keyword.
4348 (cp_finalize_oacc_routine): Don't use %s to supply portions of the
4351 2017-02-27 Jason Merrill <jason@redhat.com>
4353 PR c++/71568 - SFINAE forming pointer to member function
4354 * init.c (build_offset_ref): Check the return value of
4355 perform_or_defer_access_check.
4357 2017-02-27 Marek Polacek <polacek@redhat.com>
4359 * decl.c (expand_static_init): Add missing } in a comment.
4361 2017-02-27 Volker Reichelt <v.reichelt@netcologne.de>
4363 * init.c: Include intl.h.
4364 (build_new_1): Move message strings into pedwarn to make them
4365 -Wformat-security friendly. Mark string for translation.
4366 * pt.c (tsubst_copy_and_build): Mark string for translation.
4367 Make the pointer const.
4368 * semantics.c (finish_id_expression): Mark strings for translation.
4370 2017-02-25 Jakub Jelinek <jakub@redhat.com>
4372 * call.c (build_op_delete_call): Make msg1 and msg2 const.
4374 2017-02-24 Jakub Jelinek <jakub@redhat.com>
4377 * call.c (build_over_call): Call check_function_arguments even for
4378 -Wrestrict, adjust check_function_arguments caller.
4379 * parser.c (cp_parser_postfix_expression): Don't handle -Wrestrict
4381 * typeck.c (cp_build_function_call_vec): Adjust
4382 check_function_arguments caller.
4384 2017-02-24 Marek Polacek <polacek@redhat.com>
4386 PR translation/79705
4387 * decl.c (check_redeclaration_exception_specification): Mark a string
4388 for translation. Make the pointer const.
4390 2017-02-23 Paolo Carlini <paolo.carlini@oracle.com>
4393 * pt.c (register_specialization): Check duplicate_decls return value
4394 for error_mark_node and pass it back.
4396 2017-02-22 Jason Merrill <jason@redhat.com>
4398 PR c++/79679 - missing destructor for argument
4399 * call.c (build_over_call): Don't pass tf_no_cleanup to argument
4402 * pt.c (do_class_deduction): Handle 0 argument case.
4404 2017-02-22 Jakub Jelinek <jakub@redhat.com>
4407 * parser.c (cp_parser_omp_teams, cp_parser_omp_target): Use
4408 SET_EXPR_LOCATION on OMP_TARGET/OMP_TEAMS tree.
4409 * constexpr.c (potential_constant_expression_1): Handle
4410 OMP_*, OACC_* and CILK_* trees. Use error_at with
4411 EXPR_LOC_OR_LOC (t, input_location) computed early
4412 instead of error, or error_at with location_of (t).
4414 2017-02-22 Marek Polacek <polacek@redhat.com>
4417 * parser.c (cp_parser_std_attribute_spec): Don't build the attribute
4418 if the alignas expression is erroneous.
4419 * pt.c (tsubst_attribute): If tsubst_pack_expansion fails, return
4423 * semantics.c (finish_underlying_type): Bail out for incomplete enums.
4425 2017-02-21 Jason Merrill <jason@redhat.com>
4427 PR c++/50308 - wrong deprecated warning with ADL
4428 PR c++/17729 - duplicate deprecated warning
4429 * semantics.c (finish_id_expression): Only call mark_used on a
4430 function if we aren't building a call.
4432 PR c++/41727 - ICE with partial spec of partial instantiation
4433 * pt.c (process_partial_specialization): For now, don't check more
4434 specialized if there is more than one level of args.
4436 2017-02-21 Marek Polacek <polacek@redhat.com>
4439 * cp-tree.h (maybe_reject_flexarray_init): Declare.
4440 * init.c (maybe_reject_flexarray_init): No longer static.
4441 Add check for current_function_decl.
4442 * parser.c (cp_parser_late_parse_one_default_arg): Reject
4443 a default mem-initializer for a flexible array.
4445 2017-02-21 Jakub Jelinek <jakub@redhat.com>
4446 Paolo Carlini <paolo.carlini@oracle.com>
4449 * decl.c (cp_finish_decomp): Don't set decl's type to error_mark_node
4451 * pt.c (tsubst_decomp_names): Return error_mark_node if the first
4452 decl after the decomposition artificial decl has error_mark_node.
4453 * decl2.c (prune_vars_needing_no_initialization): Use error_operand_p
4454 instead of just == error_mark_node comparison.
4456 2017-02-21 Jakub Jelinek <jakub@redhat.com>
4459 * decl.c: Include gimplify.h.
4460 (cp_finish_decomp): Make sure there is no sharing of trees
4461 in between DECL_VALUE_EXPR of decomposition decls.
4464 * constexpr.c (cxx_eval_array_reference): Diagnose negative subscript.
4467 * constexpr.c (cxx_eval_store_expression): If *valp is a PTRMEM_CST,
4468 call cplus_expand_constant on it first.
4470 2017-02-19 Jason Merrill <jason@redhat.com>
4472 PR c++/78139 - destructor needed by new-expression
4473 * call.c (build_special_member_call): Use tf_no_cleanup.
4475 PR c++/78282 - auto template and pack expansion
4476 * pt.c (find_parameter_packs_r): Don't walk into the type of
4477 templates other than template template-parameters.
4479 PR c++/79606 - ICE with this->base_member in NSDMI
4480 * class.c (build_base_path): Check processing_template_decl.
4482 PR c++/79607 - ICE with T{} initializer
4483 * decl.c (type_dependent_init_p): Check the type of a CONSTRUCTOR.
4485 PR c++/79566 - elaborated-type-specifier in range for
4486 * parser.c (cp_parser_simple_declaration): Fix check for type
4489 PR c++/79400 - confusing suggestion of 'noexcept'
4490 * parser.c (cp_parser_exception_specification_opt): Remove
4491 suggestion for deprecated dynamic exception-specification.
4493 PR c++/79470 - partial ordering with reference parameters
4494 * pt.c (unify) [INDIRECT_REF]: Handle pack expansions.
4496 PR c++/79500 - ICE with non-template deduction guide
4497 * pt.c (do_class_deduction): Use STRIP_TEMPLATE rather than
4498 DECL_TEMPLATE_RESULT.
4500 PR c++/79580 - ICE with compound literal
4501 * parser.c (cp_parser_class_head): If we're in the middle of an
4502 expression, use ts_within_enclosing_non_class.
4504 PR c++/79503 - inherited ctor taking base class
4505 * call.c (add_function_candidate): Also check that
4506 DECL_INHERITED_CTOR_BASE is reference-related to the parameter type.
4508 2017-02-19 Paolo Carlini <paolo.carlini@oracle.com>
4511 * typeck.c (cxx_alignas_expr): Reject a non-integral alignas
4514 2017-02-19 Eric Fiselier <eric@efcs.ca>
4515 Jonathan Wakely <jwakely@redhat.com>
4518 * parser.c (cp_parser_unqualified_id): Use OPT_Wliteral_suffix to
4519 control warning about literal suffix identifiers without a leading
4522 2017-02-17 Jason Merrill <jason@redhat.com>
4524 PR c++/79508 - lookup error with member template
4525 * parser.c (cp_parser_template_name): Clear
4526 parser->context->object_type if we aren't doing lookup.
4528 PR c++/78690 - ICE with using and global type with same name
4529 * pt.c (type_dependent_object_expression_p): True for
4532 PR c++/79549 - C++17 ICE with non-type auto template parameter pack
4533 * pt.c (convert_template_argument): Just return an auto arg pack.
4534 (tsubst_template_args): Don't tsubst an auto pack type.
4536 PR c++/79556 - C++17 ICE with non-type auto
4537 * pt.c (do_auto_deduction): Don't try to deduce from null type.
4539 PR c++/79533 - C++17 ICE with temporary cast to reference
4540 * call.c (build_over_call): Conversion to a reference prevents copy
4543 2017-02-16 Jakub Jelinek <jakub@redhat.com>
4544 Jason Merrill <jason@redhat.com>
4546 PR c++/79502 - lost nodiscard attribute
4547 * pt.c (apply_late_template_attributes): Do apply non-dependent
4548 attributes to types.
4550 2017-02-16 Jason Merrill <jason@redhat.com>
4552 PR c++/78572 - ICE with self-modifying array initializer
4553 * constexpr.c (cxx_eval_store_expression): The object we're
4554 initializing is outside the constant-expression.
4555 (cxx_eval_call_expression): Set ctx->call.
4557 PR c++/79050 - ICE with undeduced auto and LTO
4558 * decl.c (poplevel): Remove undeduced auto decls.
4560 2017-02-16 Jakub Jelinek <jakub@redhat.com>
4563 * parser.c (cp_parser_omp_target): For -fopenmp-simd
4564 ignore #pragma omp target even when not followed by identifier.
4566 2017-02-15 Jason Merrill <jason@redhat.com>
4567 Jakub Jelinek <jakub@redhat.com>
4569 PR c++/79464 - ICE in IPA with omitted constructor parms
4570 * class.c (build_clone): Also omit parms from TYPE_ARG_TYPES.
4571 (adjust_clone_args): Adjust.
4572 (add_method): Remember omitted parms.
4573 * call.c (add_function_candidate): Likewise.
4574 * mangle.c (write_method_parms): Likewise.
4575 * method.c (ctor_omit_inherited_parms): Return false if there are no
4578 2017-02-15 Martin Sebor <msebor@redhat.com>
4581 * init.c (maybe_reject_flexarray_init): New function.
4582 (perform_member_init): Call it.
4584 2017-02-15 Jakub Jelinek <jakub@redhat.com>
4587 * parser.c (cp_parser_std_attribute): Don't pedwarn about
4588 [[deprecated]] with -std=c++11 and [[fallthrough]] with
4589 -std=c++11 and -std=c++14.
4592 * decl.c (grokdeclarator): For static data members, handle thread_p
4593 only after handling inline.
4595 2017-02-14 Marek Polacek <polacek@redhat.com>
4599 * parser.c (cp_parser_postfix_dot_deref_expression): Avoid
4600 clobbering if the postfix expression isn't an EXPR_P.
4602 2017-02-13 Jason Merrill <jason@redhat.com>
4604 PR c++/79461 - ICE with lambda in constexpr constructor
4605 * constexpr.c (build_data_member_initialization): Ignore
4606 initialization of a local variable.
4608 2017-02-13 Jakub Jelinek <jakub@redhat.com>
4610 * init.c (warn_placement_new_too_small): Add missing space in
4612 * parser.c (cp_parser_oacc_declare): Likewise.
4613 * mangle.c (maybe_check_abi_tags): Likewise.
4616 * typeck.c (cp_build_modify_expr): Handle properly COMPOUND_EXPRs
4617 on lhs that have {PRE{DEC,INC}REMENT,MODIFY,MIN,MAX,COND}_EXPR
4618 in the rightmost operand.
4620 2017-02-13 Nathan Sidwell <nathan@acm.org>
4622 PR c++/79296 - ICE mangling localized template instantiation
4623 * decl2.c (determine_visibility): Use template fn context for
4624 local class instantiations.
4626 2017-02-11 Jason Merrill <jason@redhat.com>
4628 PR c++/77659 - ICE with new and C++14 aggregate NSDMI
4629 * init.c (build_new): Make backups of any CONSTRUCTORs in init.
4630 (build_new_1): Use replace_placeholders.
4631 * tree.c (replace_placeholders_t): Also track whether we've seen a
4633 (replace_placeholders, replace_placeholders_r): Adjust.
4634 * cp-tree.h: Adjust.
4636 PR c++/77790 - ICE with auto function in C++11 mode
4637 * decl.c (undeduced_auto_decl): Remove C++14 limitation.
4638 (require_deduced_type): Add complain parm, return bool.
4639 * cp-tree.h: Adjust.
4640 * decl2.c (mark_used): Use require_deduced_type.
4642 2017-02-10 Jason Merrill <jason@redhat.com>
4644 PR c++/78908 - template ops and bitfields
4645 * tree.c (build_min_non_dep): Use unlowered_expr_type.
4647 PR c++/78897 - constexpr union
4648 * constexpr.c (cxx_eval_store_expression): A store to a union member
4649 erases a previous store to another member.
4651 PR c++/71285 - member of fold-expression
4652 * semantics.c (finish_unary_fold_expr)
4653 (finish_binary_fold_expr): Use null type for fold-expressions.
4655 PR c++/79401 - protected inherited constructor
4656 * call.c (enforce_access): For inheriting constructor, find a base
4657 binfo in the path we already have.
4659 2017-02-10 Marek Polacek <polacek@redhat.com>
4662 * pt.c (type_dependent_expression_p): Check if the expression type
4666 * cvt.c (ocp_convert): Add a sentinel against -Wint-in-bool-context
4667 if warnings shouldn't be given.
4669 2017-02-10 Paolo Carlini <paolo.carlini@oracle.com>
4672 * pt.c (tsubst_decl): Don't try to preserve a typedef that names
4673 an error_mark_node as type.
4675 2017-02-09 Jakub Jelinek <jakub@redhat.com>
4676 Jason Merrill <jason@redhat.com>
4679 * pt.c (instantiate_class_template_1): Copy CLASSTYPE_NON_AGGREGATE
4680 from pattern to type.
4682 2017-02-09 Jason Merrill <jason@redhat.com>
4684 PR c++/79316 - default argument in deduction guide
4685 PR c++/79350 - explicit deduction guide
4686 * parser.c (cp_parser_constructor_declarator_p)
4687 (cp_parser_direct_declarator): Parse deduction guides more like
4689 * cp-tree.h (enum special_function_kind): Add sfk_deduction_guide.
4690 * tree.c (special_function_p): Return it.
4691 * decl.c (check_special_function_return_type): Handle it.
4692 (grokdeclarator, grokfndecl): Adjust.
4693 (cp_finish_decl): Pass flags to do_auto_deduction.
4694 * error.c (dump_decl_name): Use TFF_UNQUALIFIED_NAME.
4695 * pt.c (dguide_name_p): Take a const_tree.
4696 (do_class_deduction): Handle explicit.
4697 (do_auto_deduction): Pass flags through.
4698 (build_deduction_guide): Copy explicit flag.
4700 2017-02-09 Jakub Jelinek <jakub@redhat.com>
4703 * parser.c (cp_parser_omp_ordered): Don't check for non-pragma_stmt
4704 non-pragma_compound context here.
4705 (cp_parser_omp_target): Likewise.
4706 (cp_parser_pragma): Don't call push_omp_privatization_clauses and
4707 parsing for ordered and target omp pragmas in non-pragma_stmt
4708 non-pragma_compound contexts.
4711 * parser.c (cp_parser_oacc_declare): Formatting fix.
4712 (cp_parser_omp_declare_target): Don't invoke symtab_node::get on
4713 automatic variables.
4715 2016-02-09 Nathan Sidwell <nathan@codesourcery.com>
4716 Chung-Lin Tang <cltang@codesourcery.com>
4718 * parser.c (cp_parser_oacc_clause_tile): Disallow collapse. Fix
4719 parsing. Parse constant expression. Remove semantic checking.
4720 (cp_parser_omp_clause_collapse): Disallow tile.
4721 (cp_parser_omp_for_loop): Deal with tile clause. Don't emit a parse
4722 error about missing for after already emitting one. Use more
4723 conventional for idiom for unbounded loop.
4724 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_TILE.
4725 * semantics.c (finish_omp_clauses): Correct TILE semantic check.
4726 (finish_omp_for): Deal with tile clause.
4728 2017-02-07 Nathan Sidwell <nathan@acm.org>
4730 * method.c (synthesized_method_base_walk): New. Broken out of ...
4731 (synthesized_method_walk): ... here. Call it. Cleanup
4734 2017-02-07 Patrick Palka <ppalka@gcc.gnu.org>
4737 * typeck2.c (process_init_constructor_union): Consider only
4738 FIELD_DECLs when looking for an NSDMI.
4740 2017-02-06 Jason Merrill <jason@redhat.com>
4742 PR c++/71193 - incomplete types in templates
4743 * parser.c (cp_parser_postfix_dot_deref_expression): In a template
4744 handle incomplete type by pedwarning and then treating as dependent.
4746 2017-02-06 Jakub Jelinek <jakub@redhat.com>
4749 * constexpr.c (cxx_eval_constant_expression): Handle ANNOTATE_EXPR.
4750 (potential_constant_expression_1): Likewise.
4753 * tree.c (build_min_non_dep_op_overload): For POST{INC,DEC}REMENT_EXPR
4754 allow one fewer than expected arguments if flag_permissive.
4757 * decl.c (cp_finish_decomp): On error set decl type to error_mark_node.
4758 * pt.c (tsubst_expr): Don't call tsubst_decomp_names on decompositions
4759 with error_mark_node type.
4761 2017-02-03 Jason Merrill <jason@redhat.com>
4763 PR c++/78689 - ICE on constructor with label
4764 * optimize.c (maybe_clone_body): Replace omitted parameters with
4766 * class.c (build_clone): Fix logic for omitting inherited parms.
4768 PR c++/12245 - excessive memory use
4769 * constexpr.c (maybe_constant_value): Fold maybe_constant_value_1
4770 back in. Don't cache constants.
4771 (maybe_constant_init): Don't cache constants.
4773 PR c++/79294 - ICE with invalid template argument
4774 * pt.c (convert_nontype_argument_function): Check value-dependence.
4775 (convert_nontype_argument): Don't check it here for function ptrs.
4777 2017-02-02 Richard Biener <rguenther@suse.de>
4780 * cp-gimplify.c (cp_fold): When folding a CONSTRUCTOR copy
4781 it lazily on the first changed element only and copy it
4782 fully upfront, only storing changed elements.
4784 2017-02-02 Paolo Carlini <paolo.carlini@oracle.com>
4787 * decl2.c (grokbitfield): In case of error don't set-up DECL_INITIAL
4790 2017-01-31 Jakub Jelinek <jakub@redhat.com>
4793 * error.c (dump_expr) <case COMPONENT_REF>: Don't print .
4796 2017-01-31 David Malcolm <dmalcolm@redhat.com>
4799 * name-lookup.c (suggest_alternative_in_explicit_scope): Resolve
4800 any namespace aliases.
4802 2017-01-31 Nathan Sidwell <nathan@acm.org>
4805 * typeck.c (build_ptrmemfunc_access_expr): Set TREE_NO_WARNING.
4809 * pt.c: (instantiate_decl): Push to top level when current
4810 function scope doesn't match. Only push lmabda scope stack when
4813 * cp-tree.h (instantiate_decl): Make defer_ok bool.
4814 * pt.c: Fix instantiate_decl calls to pass true/false not 0/1
4815 (instantiate_decl): Simplify and reorder state saving and restoration.
4818 * lambda.c (maybe_generic_this_capture): Deal with template-id-exprs.
4819 * semantics.c (finish_member_declaration): Assert class is being
4822 2017-01-30 Alexandre Oliva <aoliva@redhat.com>
4824 Introduce C++ support in libcc1.
4825 * cp-tree.h (struct lang_identifier): Add oracle_looked_up.
4826 (ansi_opname): Rename to...
4827 (cp_operator_id): ... this. Adjust all callers.
4828 (ansi_assopname): Rename to...
4829 (cp_assignment_operator_id): ... this. Adjust all callers.
4830 (cp_literal_operator_id): Declare.
4831 (set_global_friend): Declare.
4832 (is_global_friend): Declare.
4833 (enum cp_oracle_request): New type.
4834 (cp_binding_oracle_function): New type.
4835 (cp_binding_oracle): Declare.
4836 (cp_finish_injected_record_type): Declare.
4837 * friend.c (global_friend): New var.
4838 (set_global_friend): New fn.
4839 (is_global_friend): New fn.
4840 (is_friend): Call is_global_friend.
4841 * name-lookup.c (cp_binding_oracle): New var.
4842 (query_oracle): New fn.
4843 (qualified_lookup_using_namespace): Call query_oracle.
4844 (lookup_name_real_1): Likewise.
4845 * parser.c (cp_literal_operator_id): Drop static.
4846 * search.c (friend_accessible_p): Call is_global_friend.
4847 * semantics.c (is_this_parameter): Accept a variable if the
4848 binding oracle is enabled.
4850 2017-01-27 Jason Merrill <jason@redhat.com>
4852 PR c++/78771 - ICE with inherited constructor.
4853 * call.c (build_over_call): Call deduce_inheriting_ctor here.
4854 * pt.c (tsubst_decl): Not here.
4855 * class.c (add_method): Or here.
4856 * method.c (deduce_inheriting_ctor): Handle clones.
4857 (implicitly_declare_fn): Don't deduce inheriting ctors yet.
4859 2017-01-27 Adam Butcher <adam@jessamine.co.uk>
4862 * cp/parser.c (parsing_default_capturing_generic_lambda_in_template):
4864 * cp/cp-tree.h: Declare it.
4865 * cp/semantics.c (finish_id_expression): Resolve names within a default
4866 capturing generic lambda defined within a template prior to
4867 instantiation to allow for captures to be added to the closure type.
4869 2017-01-26 Jakub Jelinek <jakub@redhat.com>
4872 * cp-tree.def (OFFSETOF_EXPR): Bump number of operands to 2.
4873 * cp-tree.h (finish_offsetof): Add OBJECT_PTR argument.
4874 * parser.c (cp_parser_builtin_offsetof): Pass result of
4875 build_static_cast of null_pointer_node to finish_offsetof.
4876 * semantics.c (finish_offsetof): Add OBJECT_PTR argument, use
4877 it for -Winvalid-offsetof pedwarn instead of trying to guess
4878 original offsetof type from EXPR. Save OBJECT_PTR as a new
4879 second operand to OFFSETOF_EXPR.
4880 * pt.c (tsubst_copy_and_build) <case OFFSETOF_EXPR>: Adjust
4881 finish_offsetof caller, pass the second operand of OFFSETOF_EXPR
4884 2017-01-26 Jason Merrill <jason@redhat.com>
4886 * name-lookup.c (parse_using_directive): Deprecate strong using.
4888 PR c++/79176 - lambda ICE with -flto -Os
4889 * decl2.c (vague_linkage_p): Handle decloned 'tors.
4890 * tree.c (decl_linkage): Likewise.
4892 2017-01-25 Martin Sebor <msebor@redhat.com>
4894 * decl.c (grokdeclarator): Fix a typo in a comment.
4896 2017-01-25 Jakub Jelinek <jakub@redhat.com>
4899 * decl.c (cp_finish_decomp): Disallow memberwise decomposition of
4903 * parser.c (cp_parser_lambda_declarator_opt): Pedwarn with
4904 OPT_Wpedantic on lambda templates for -std=c++14 and higher.
4906 2017-01-25 Maxim Ostapenko <m.ostapenko@samsung.com>
4909 * decl.c (cxx_init_decl_processing): Pass main_input_filename
4910 to build_translation_unit_decl.
4912 2017-01-24 Jakub Jelinek <jakub@redhat.com>
4915 * cp-gimplify.c (cp_genericize_r): Add result of
4916 convert_from_reference on invisiref parm to p_set.
4918 2017-01-24 Nathan Sidwell <nathan@acm.org>
4920 PR c++/78469 - defaulted ctor and inaccessible dtor
4921 * cp-tree.h (tsubst_flags): Add tf_no_cleanup.
4922 * init.c (build_new_1): Pass tf_no_cleanup to build_value_init.
4923 * tree.c (build_target_expr): Check tf_no_cleanup.
4925 PR c++/79118 - anon-members and constexpr
4926 * constexpr.c (cx_check_missing_mem_inits): Caller passes type not
4927 ctor decl. Recursively check anonymous members.
4928 (register_constexpr_fundef): Adjust cx_check_missing_mem_inits
4930 (explain_invalid_constexpr_fn): Likewise.
4932 2017-01-23 Nathan Sidwell <nathan@acm.org>
4934 PR c++/71710 - template using directive of field
4935 * pt.c (tsubst_copy_and_build [COMPONENT_REF]): Move FIELD_DECL
4938 PR c++/71406 - ICE with scope-ref'd template id exprs
4940 * typeck.c (finish_class_member_access_expr): Break up SCOPE_REF
4941 before breaking up TEMPLATE_ID_EXPR.
4943 2017-01-20 Nathan Sidwell <nathan@acm.org>
4945 PR c++/78495 - wrong code inherited ctor and invisi-ref parm
4946 * cp-gimplify.c (cp_generize_r): Don't skip thunks.
4948 2017-01-20 David Malcolm <dmalcolm@redhat.com>
4952 * cp-tree.h (suggest_alternatives_for): Add bool param.
4953 (suggest_alternative_in_explicit_scope): New decl.
4954 * error.c (qualified_name_lookup_error): When SCOPE is a namespace
4955 that isn't the global one, call new function
4956 suggest_alternative_in_explicit_scope, only calling
4957 suggest_alternatives_for if it fails, and disabling near match
4958 searches fort that case. When SCOPE is the global namespace,
4959 pass true for new param to suggest_alternatives_for to allow for
4961 * lex.c (unqualified_name_lookup_error): Pass true for new param
4962 to suggest_alternatives_for.
4963 * name-lookup.c (consider_binding_level): Add forward decl.
4964 (suggest_alternatives_for): Add "suggest_misspellings" param,
4965 using it to conditionalize the fuzzy name-lookup code.
4966 (suggest_alternative_in_explicit_scope): New function.
4967 * parser.c (cp_parser_primary_expression): When calling
4968 finish_id_expression, pass location of id_expression rather
4969 than that of id_expr_token.
4970 (cp_parser_id_expression): Convert local "unqualified_id" from
4971 tree to cp_expr to avoid implicitly dropping location information.
4973 2017-01-20 Marek Polacek <polacek@redhat.com>
4976 * call.c (build_conditional_expr_1): Warn about duplicated branches.
4977 * semantics.c (finish_expr_stmt): Build statement using the proper
4980 2017-01-19 Jason Merrill <jason@redhat.com>
4982 US 20 - forwarding references and class template argument deduction
4983 * cp-tree.h (TEMPLATE_TYPE_PARM_FOR_CLASS): New.
4984 * pt.c (push_template_decl_real): Set it.
4985 (maybe_adjust_types_for_deduction): Check it.
4986 (rewrite_template_parm): Copy it.
4988 US 19 - deduction guides and constructors
4989 * call.c (joust): Prefer deduction guides to constructors.
4990 * pt.c (build_deduction_guide): Set DECL_ARTIFICIAL.
4991 (deduction_guide_p): Check DECL_P.
4993 * decl.c (check_initializer): Always use build_aggr_init for array
4996 PR c++/79130 - decomposition and direct-initialization
4997 * init.c (build_aggr_init): Communicate direct-initialization to
4999 (build_vec_init): Check for array copy sooner.
5000 * parser.c (cp_parser_decomposition_declaration): Remove call to
5001 build_x_compound_expr_from_list.
5003 2017-01-18 Jason Merrill <jason@redhat.com>
5005 PR c++/68666 - member variable template-id
5006 * typeck.c (finish_class_member_access_expr): Handle variable
5008 * pt.c (lookup_and_finish_template_variable): No longer static.
5009 * cp-tree.h: Declare it.
5011 2017-01-18 Nathan Sidwell <nathan@acm.org>
5014 * call.c (build_over_call): When checking ellipsis conversions for
5015 an inherited ctor, make sure there is at least one conversion.
5017 2017-01-18 Jason Merrill <jason@redhat.com>
5019 PR c++/78894 - ICE with class deduction and default arg
5020 * pt.c (build_deduction_guide): Set DECL_PRIMARY_TEMPLATE.
5022 2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de>
5025 * mangle.c (write_discriminator): Reorganize abi warning check.
5027 2017-01-18 Nathan Sidwell <nathan@acm.org>
5029 * cp-tree.h: Clarify exception spec node comment.
5030 * except.c (nothrow_spec_p): Simplify by checking node-equality.
5033 * mangle.c (write_exception_spec): Check nothrow explicitly.
5034 (write_encoding): Don't increment processing_template_decl around
5037 2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de>
5040 * mangle.c (write_template_args): Add "on" for operator names.
5042 2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de>
5045 * mangle.c (write_discriminator): Handle discriminator >= 10.
5047 2017-01-17 Nathan Sidwell <nathan@acm.org>
5050 * cp-tree.h (maybe_generic_this_capture): Declare.
5051 * lambda.c (resolvable_dummy_lambda): New, broken out of ...
5052 (maybe_resolve_dummy): ... here. Call it.
5053 (maybe_generic_this_capture): New.
5054 * parser.c (cp_parser_postfix_expression): Speculatively capture
5055 this in generic lambda in unresolved member function call.
5056 * pt.c (tsubst_copy_and_build): Force hard error from failed
5057 member function lookup in generic lambda.
5059 2017-01-17 Aldy Hernandez <aldyh@redhat.com>
5062 * cp-array-notation.c (expand_array_notation_exprs): Handle
5065 2017-01-11 Jason Merrill <jason@redhat.com>
5067 PR c++/78337 - ICE on invalid with generic lambda
5068 * semantics.c (process_outer_var_ref): Check if containing_function
5069 is null. Move inform call under complain test.
5071 2017-01-11 Nathan Sidwell <nathan@acm.org>
5074 * name-lookup.c (set_namespace_binding_1): An overload of 1 decl
5077 2017-01-11 Nathan Sidwell <nathan@acm.org>
5079 * name-lookup.c (push_overloaded_decl_1): Refactor OVERLOAD creation.
5081 2017-01-11 Jakub Jelinek <jakub@redhat.com>
5084 * parser.c (cp_parser_std_attribute_spec): Remove over-eager
5085 assertion. Formatting fix.
5088 * decl2.c (c_parse_final_cleanups): Set flag_syntax_only to 1 after
5091 2017-01-10 David Malcolm <dmalcolm@redhat.com>
5094 * parser.c (cp_parser_class_specifier_1): Only suggest inserting
5095 a missing semicolon if we have a valid insertion location for
5098 2017-01-10 Jason Merrill <jason@redhat.com>
5100 FI 20, decomposition declaration with parenthesized initializer.
5101 * parser.c (cp_parser_decomposition_declaration): Use
5102 cp_parser_initializer.
5104 2017-01-09 Jason Merrill <jason@redhat.com>
5106 Implement P0195R2, C++17 variadic using.
5107 * parser.c (cp_parser_using_declaration): Handle ellipsis and comma.
5108 * pt.c (tsubst_decl): Handle pack expansion in USING_DECL_SCOPE.
5109 * error.c (dump_decl): Likewise.
5111 2017-01-09 Jakub Jelinek <jakub@redhat.com>
5113 PR translation/79019
5114 PR translation/79020
5115 * semantics.c (finish_omp_clauses): Add missing whitespace to
5116 translatable strings.
5117 * cp-cilkplus.c (cpp_validate_cilk_plus_loop_aux): Fix comment typo.
5119 2017-01-07 Jason Merrill <jason@redhat.com>
5121 PR c++/78948 - instantiation from discarded statement
5122 * parser.h (struct cp_parser): Remove in_discarded_stmt field.
5123 * cp-tree.h (in_discarded_stmt): Declare it.
5124 (struct saved_scope): Add discarded_stmt bitfield.
5125 (in_discarded_stmt): New macro.
5126 * decl2.c (mark_used): Check it.
5127 * parser.c (cp_parser_selection_statement): Adjust.
5128 (cp_parser_jump_statement): Adjust.
5130 2017-01-05 Jakub Jelinek <jakub@redhat.com>
5133 * decl.c (cp_finish_decomp): Remove probe variable, if tt is
5134 REFERENCE_REF_P, set tt to its operand.
5137 * class.c (check_field_decls): Diagnose REFERENCE_TYPE fields in
5138 unions even for C++11 and later.
5140 2017-01-05 Nathan Sidwell <nathan@acm.org>
5143 * pt.c (convert_nontype_argument): Don't try and see if integral
5144 or enum expressions are constants prematurely.
5146 2017-01-04 Marek Polacek <polacek@redhat.com>
5149 * typeck.c (cp_build_binary_op): Warn when a pointer is compared with
5150 a zero character literal.
5152 2017-01-04 Jakub Jelinek <jakub@redhat.com>
5155 * typeck.c (cp_build_unary_op): Call mark_rvalue_use on arg if it has
5159 * parser.c (cp_parser_simple_declaration): Only complain about
5160 inconsistent auto deduction if auto_result doesn't use auto.
5162 * parser.c (cp_parser_simple_declaration): Diagnose function
5163 declaration among more than one init-declarators with auto
5167 * parser.c (cp_lexer_previous_token): Use vec_safe_address in the
5168 assertion, as lexer->buffer may be NULL.
5170 2017-01-04 Marek Polacek <polacek@redhat.com>
5174 * constexpr.c (potential_constant_expression_1): Handle CLEANUP_STMT.
5176 2017-01-04 Nathan Sidwell <nathan@acm.org>
5179 * cp-tree.h (DECLTYPE_FOR_REF_CAPTURE): New.
5180 (lambda_capture_field_type): Update prototype.
5181 * lambda.c (lambda_capture_field_type): Add is_reference parm.
5182 Add referenceness here.
5183 (add_capture): Adjust lambda_capture_field_type call, refactor
5185 * pt.c (tsubst): Adjust lambda_capture_field_type call.
5187 2017-01-01 Jakub Jelinek <jakub@redhat.com>
5189 Update copyright years.
5191 Copyright (C) 2017 Free Software Foundation, Inc.
5193 Copying and distribution of this file, with or without modification,
5194 are permitted in any medium without royalty provided the copyright
5195 notice and this notice are preserved.