1 2017-11-21 Jakub Jelinek <jakub@redhat.com>
3 P0428R2 - familiar template syntax for generic lambdas
4 * parser.c (cp_parser_lambda_declarator_opt): Don't pedwarn
5 for cxx2a and above, reword pedwarn for C++14/C++17.
7 2017-11-20 David Malcolm <dmalcolm@redhat.com>
10 * name-lookup.c: Include "c-family/known-headers.h"
11 (lookup_name_fuzzy): Call get_cp_stdlib_header_for_name and
12 potentially return a new suggest_missing_header hint.
14 2017-11-20 David Malcolm <dmalcolm@redhat.com>
17 * name-lookup.c (class macro_use_before_def): New class.
18 (lookup_name_fuzzy): Detect macro that were used before being
19 defined, and report them as such.
21 2017-11-20 Jason Merrill <jason@redhat.com>
23 * decl2.c (constrain_class_visibility): Don't warn about artificial
26 2017-11-20 Jakub Jelinek <jakub@redhat.com>
28 P0329R4: Designated Initialization
29 * parser.c (cp_parser_initializer_clause): List in comment grammar
30 designated-initializer-list.
31 (cp_parser_initializer_list): Allow .identifier = without pedwarn for
32 C++2A, parse .identifier { ... }. Improve location_t argument to
33 pedwarn. Add pedwarn for [cst] = designators. Diagnose ... in
34 designated initializer list. Diagnose mixing designated and
35 non-designated initializer clauses for C++2A. Diagnose duplicated
36 identifiers in designators.
37 * name-lookup.h (search_anon_aggr): New declaration.
38 * name-lookup.c (fields_linear_search): Use search_anon_aggr.
39 (search_anon_aggr): New function.
40 * typeck2.c (process_init_constructor_record): Allow designator
41 to skip over some non-static data members. Handle anonymous
42 aggregates. Add diagnostics for designator order not matching
43 member declaration order.
45 2017-11-20 David Malcolm <dmalcolm@redhat.com>
47 * name-lookup.c: Define INCLUDE_UNIQUE_PTR before including system.h.
48 Include "c-family/name-hint.h"
49 (suggest_alternatives_for): Convert "fuzzy_name" from const char *
50 to name_hint, and rename to "hint". Pass location to
52 (lookup_name_fuzzy): Convert return type from const char *
53 to name_hint. Add location_t param.
54 * parser.c: Define INCLUDE_UNIQUE_PTR before including system.h.
55 Include "c-family/name-hint.h"
56 (cp_parser_diagnose_invalid_type_name): Convert
57 "suggestion" from const char * to name_hint, and rename to "hint".
58 Pass location to lookup_name_fuzzy.
60 2017-11-20 Nathan Sidwell <nathan@acm.org>
64 * call.c (build_call_a): Don't set CALL_FROM_THUNK_P for inherited
66 * cp-gimplify.c (cp_genericize_r): Restore THUNK dereference
67 inhibibition check removed in previous c++/78495 change.
69 2017-11-20 Jakub Jelinek <jakub@redhat.com>
72 * constexpr.c (cxx_eval_vector_conditional_expression): New function.
73 (cxx_eval_constant_expression) <case VEC_COND_EXPR>: Use it instead
74 of cxx_eval_conditional_expression.
76 2017-11-19 Jakub Jelinek <jakub@redhat.com>
80 * cp-gimplify.c (c_fully_fold): Add LVAL argument, call
81 cp_fold_maybe_rvalue instead of cp_fold_rvalue and pass it !LVAL.
83 2017-11-16 Jason Merrill <jason@redhat.com>
85 PR c++/79092 - non-type args of different types are different
86 * tree.c (cp_tree_equal): Check the type of constants.
87 * pt.c (unify) [TEMPLATE_PARM_INDEX]: Handle UNIFY_ALLOW_INTEGER
88 when comparing to previously deduced argument.
89 (maybe_convert_nontype_argument): New.
90 (convert_nontype_argument): Call it.
91 (tsubst_copy_and_build): Handle partial instantiation of
93 (unify): Ignore type when deducing from array bound.
94 (dependent_type_p_r): Handle DEFERRED_NOEXCEPT.
95 (value_dependent_expression_p): Any type-dependent expression is
96 value-dependent. Handle IMPLICIT_CONV_EXPR.
97 * cp-tree.h (IMPLICIT_CONV_EXPR_NONTYPE_ARG): New.
98 * mangle.c (write_template_arg): Strip IMPLICIT_CONV_EXPR.
100 2017-11-16 Nathan Sidwell <nathan@acm.org>
104 * cp-objcp-common.h (LANG_HOOKS_OVERWRITE_DECL_ASSEMBLER_NAME):
106 * cp-tree.h (overwrite_mangling): Declare.
107 * decl2.c (struct mangled_decl_hash): Entries are deletable.
108 (overwrite_mangling): New.
111 * decl.c (xref_tag_1): Push lambda into current scope.
112 * name-lookup.c (do_pushtag): Don't deal with ts_lambda here.
114 2017-11-15 Nathan Sidwell <nathan@acm.org>
117 * lambda.c (lambda_capture_field_type): Function references are
118 always catured by reference.
120 2017-11-15 Martin Liska <mliska@suse.cz>
122 * decl.c (begin_destructor_body): Use cp_build_fold_indirect_ref
123 instead of cp_build_indirect_ref.
125 2017-11-15 Martin Liska <mliska@suse.cz>
127 * decl.c (begin_destructor_body): In case of VPTR sanitization
128 (with disabled recovery), zero vptr in order to catch virtual calls
129 after lifetime of an object.
131 2017-11-14 Jason Merrill <jason@redhat.com>
133 Use GTY((cache)) on some hash tables.
134 * decl.c (decomp_type_table): Use tree_cache_map.
135 * init.c (nsdmi_inst): Likewise.
136 * pt.c (defarg_ints): Likewise.
137 * cp-objcp-common.c (cp_get_debug_type): Likewise.
139 2017-11-13 Jason Merrill <jason@redhat.com>
141 Capture adjustments for P0588R1.
142 * semantics.c (process_outer_var_ref): Capture variables when
143 they are named; complain about non-capture uses when odr-used.
144 * expr.c (mark_use): Rvalue use looks through capture proxy.
145 * constexpr.c (potential_constant_expression_1): Improve error about
146 use of captured variable.
147 * lambda.c (need_generic_capture, dependent_capture_r)
148 (do_dependent_capture, processing_nonlambda_template): Remove.
149 * call.c (build_this): Remove uses of the above.
150 * decl.c (cp_finish_decl): Likewise.
151 * semantics.c (maybe_cleanup_point_expr)
152 (maybe_cleanup_point_expr_void, finish_goto_stmt)
153 (maybe_convert_cond): Likewise.
154 * typeck.c (check_return_expr): Likewise.
157 * typeck.c (cp_build_fold_indirect_ref): New.
158 (cp_build_indirect_ref_1): Split out from cp_build_indirect_ref.
159 Add 'fold' parameter.
160 * cp-tree.h: Declare cp_build_fold_indirect_ref.
161 * call.c, class.c, cp-ubsan.c, decl.c, except.c, init.c, lambda.c,
162 parser.c, rtti.c, tree.c, typeck.c, typeck2.c: Use it.
163 * parser.c (do_range_for_auto_deduction): Use RO_UNARY_STAR.
164 (cp_convert_range_for): Likewise.
165 * typeck2.c (build_x_arrow): Use RO_ARROW.
167 * cp-ubsan.c (cp_ubsan_check_member_access_r): Fix handling of
168 INDIRECT_REF of ADDR_EXPR.
170 PR c++/82360 - ICE with static_cast in template.
171 * call.c (perform_direct_initialization_if_possible): Check
172 processing_template_decl.
173 * typeck.c (build_static_cast_1): Likewise.
175 2017-11-13 Ville Voutilainen <ville.voutilainen@gmail.com>
177 Remove the null check from placement new in all modes
178 * init.c (build_new_1): Don't do a null check for
179 a namespace-scope non-replaceable placement new
180 in any mode unless -fcheck-new is provided.
182 2017-11-07 Boris Kolpackov <boris@codesynthesis.com>
184 * Make-lang.in (CP_PLUGIN_HEADERS): Add operators.def since included
187 2017-11-07 Jakub Jelinek <jakub@redhat.com>
190 * cp-gimplify.c (cxx_omp_clause_apply_fn): For methods pass i - 1 to
191 convert_default_arg instead of i.
193 2017-11-06 Jason Merrill <jason@redhat.com>
195 P0704R1 - fixing const-qualified pointers to members
196 * typeck2.c (build_m_component_ref): Also accept in lower stds with
199 2017-11-06 Paolo Carlini <paolo.carlini@oracle.com>
202 * decl2.c (finish_static_data_member_decl): If there's an initializer,
203 complete the type and re-apply the quals.
205 2017-11-06 Martin Liska <mliska@suse.cz>
208 * constexpr.c (cxx_eval_builtin_function_call): Handle
209 __builtin_unreachable call.
210 (get_function_named_in_call): Declare function earlier.
211 (constexpr_fn_retval): Skip __builtin_unreachable.
212 * cp-gimplify.c (cp_ubsan_maybe_instrument_return): Rename to
214 (cp_maybe_instrument_return): ... this.
215 (cp_genericize): Call the function unconditionally.
217 2017-11-03 Nathan Sidwell <nathan@acm.org>
220 * decl.c (grokdeclarator): Protect MAYBE_CLASS things from paren
223 2017-11-02 Paolo Carlini <paolo.carlini@oracle.com>
226 * pt.c (make_pack_expansion): Add tsubst_flags_t parameter.
227 (expand_integer_pack, convert_template_argument, coerce_template_parms,
228 gen_elem_of_pack_expansion_instantiation, tsubst_pack_expansion,
229 unify): Adjust calls.
230 * tree.c (cp_build_qualified_type_real): Likewise.
231 * cp-tree.h (make_pack_expansion): Adjust declaration.
233 2017-11-02 Nathan Sidwell <nathan@acm.org>
235 * cp-tree.h (IDENTIFIER_NEWDEL_OP_P): Restore, adjust.
236 (IDENTIFIER_NEW_OP_P): New.
237 * decl.c (grokdeclarator): Restore IDENTIFIER_NEWDEL_OP_P use.
238 * pt.c (push_template_decl_real): Likewise.
239 * typeck.c (check_return_expr): Use IDENTIFIER_NEW_OP_P.
242 * decl.c (grokdeclarator): Don't warn when parens protect a return
243 type from a qualified name.
245 2017-11-01 Nathan Sidwell <nathan@acm.org>
247 * cp-tree.h (enum cp_identifier_kind): Delete cik_newdel_op.
248 Renumber and reserve udlit value.
249 (IDENTIFIER_NEWDEL_OP_P): Delete.
250 (IDENTIFIER_OVL_OP_P): New.
251 (IDENTIFIER_ASSIGN_OP_P): Adjust.
252 (IDENTIFIER_CONV_OP_P): Adjust.
253 (IDENTIFIER_OVL_OP_INFO): Adjust.
254 (IDENTIFIER_OVL_OP_FLAGS): New.
255 * decl.c (grokdeclarator): Use IDENTIFIER_OVL_OP_FLAGS.
256 * lex.c (get_identifier_kind_name): Adjust.
257 (init_operators): Don't special case new/delete ops.
258 * mangle.c (write_unqualified_id): Use IDENTIFIER_OVL_OP_P.
259 * pt.c (push_template_decl_real): Use IDENTIFIER_OVL_OP_FLAGS.
260 * typeck.c (check_return_expr): Likewise.
262 * cp-tree.h (assign_op_identifier, call_op_identifier): Use
264 (struct lang_decl_fn): Use compressed operator code.
265 (DECL_OVERLOADED_OPERATOR_CODE): Replace with ...
266 (DECL_OVERLOADED_OPERATOR_CODE_RAW): ... this.
267 (DECL_OVERLOADED_OPERATOR_CODE_IS): Use it.
268 * decl.c (duplicate_decls): Use DECL_OVERLOADED_OPERATOR_CODE_RAW.
269 (build_library_fn): Likewise.
270 (grok_op_properties): Likewise.
271 * mangle.c (write_unqualified_name): Likewise.
272 * method.c (implicitly_declare_fn): Likewise.
273 * typeck.c (check_return_expr): Use DECL_OVERLOADED_OPERATOR_IS.
275 * cp-tree.h (IDENTIFIER_CP_INDEX): Define.
276 (enum ovl_op_flags): Add OVL_OP_FLAG_AMBIARY.
277 (enum ovl_op_code): New.
278 (struct ovl_op_info): Add ovl_op_code field.
279 (ovl_op_info): Size by OVL_OP_MAX.
280 (ovl_op_mapping, ovl_op_alternate): Declare.
281 (OVL_OP_INFO): Adjust for mapping array.
282 (IDENTIFIER_OVL_OP_INFO): New.
283 * decl.c (ambi_op_p, unary_op_p): Delete.
284 (grok_op_properties): Use IDENTIFIER_OVL_OP_INFO and
286 * lex.c (ovl_op_info): Adjust and static initialize.
287 (ovl_op_mappings, ovl_op_alternate): Define.
288 (init_operators): Iterate over ovl_op_info array and init mappings
290 * mangle.c (write_unqualified_id): Use IDENTIFIER_OVL_OP_INFO.
291 * operators.def (DEF_OPERATOR): Remove KIND parm.
292 (DEF_SIMPLE_OPERATOR): Delete.
293 (OPERATOR_TRANSITION): Expand if defined.
295 2017-10-31 David Malcolm <dmalcolm@redhat.com>
297 * pt.c (listify): Use %< and %> for description of #include.
299 2017-10-31 David Malcolm <dmalcolm@redhat.com>
301 * class.c (explain_non_literal_class): Use UNKNOWN_LOCATION rather
303 * name-lookup.c (suggest_alternatives_for): Update for renaming of
305 (maybe_suggest_missing_header): Likewise.
306 (suggest_alternative_in_explicit_scope): Likewise.
307 * parser.c (cp_parser_diagnose_invalid_type_name): Likewise for
308 renaming of error_at_rich_loc.
309 (cp_parser_string_literal): Likewise.
310 (cp_parser_nested_name_specifier_opt): Likewise.
311 (cp_parser_cast_expression): Likewise for renaming of
313 (cp_parser_decl_specifier_seq): Likewise for renaming of
314 error_at_rich_loc and warning_at_rich_loc.
315 (cp_parser_elaborated_type_specifier): Likewise for renaming of
317 (cp_parser_cv_qualifier_seq_opt): Likewise for renaming of
319 (cp_parser_virt_specifier_seq_opt): Likewise.
320 (cp_parser_class_specifier_1): Likewise.
321 (cp_parser_class_head): Likewise.
322 (cp_parser_member_declaration): Likewise for renaming of
323 pedwarn_at_rich_loc, warning_at_rich_loc, and error_at_rich_loc.
324 (cp_parser_enclosed_template_argument_list): Likewise for renaming
325 of error_at_rich_loc.
326 (set_and_check_decl_spec_loc): Likewise.
327 * pt.c (listify): Likewise.
328 * rtti.c (typeid_ok_p): Likewise.
329 * semantics.c (process_outer_var_ref): Use UNKNOWN_LOCATION rather
331 * typeck.c (access_failure_info::maybe_suggest_accessor): Update
332 for renaming of inform_at_rich_loc.
333 (finish_class_member_access_expr): Likewise for renaming of
336 2017-10-31 Nathan Sidwell <nathan@acm.org>
338 * cp-tree.h (struct operator_name_info_t): Rename to ...
339 (struct ovl_op_info_t): ... here. Add tree_code field.
340 (operator_name_info, assignment_operator_name_info): Delete.
341 (ovl_op_info): Declare.
342 (OVL_OP_INFO): Adjust.
343 * decl.c (grok_op_properties): Use ovl_op_flags.
344 * lex.c (operator_name_info, assignment_operator_name_info):
346 (ovl_op_info): Define.
347 (set_operator_ident): Adjust.
348 (init_operators): Set tree_code.
349 * mangle.c (write_unqualified_id): Adjust operator array scan.
351 * lex.c (init_operators): Allow NULL operator name. Don't add
353 * operators.def: Use NULL for mangling only operators. Move to
354 after regular operators but move assignment operators last.
356 * cp-tree.h (enum ovl_op_flags): New.
357 (struct operator_name_info_t): Rename arity to flags.
358 * lex.c (set_operator_ident): New.
359 (init_operators): Use it. Adjust for flags.
360 * mangle.c (write_unqualified_id): Adjust for flags.
361 * operators.def: Replace arity with flags.
363 * cp-tree.h (ovl_op_identifier): New.
364 (assign_op_identifier, call_op_identifier): Adjust.
365 (cp_operator_id, cp_assignment_operator_ide): Delete.
366 (SET_OVERLOADED_OPERATOR_CODE): Delete.
368 * call.c (op_error): Use OVL_OP_INFO.
369 (build_conditional_expr_1): Use ovl_op_identifier.
370 (build_new_op_1): Use OVL_OP_INFO & ovl_op_identifier.
371 (build_op_delete_call): Likewise.
372 * class.c (type_requires_array_cookie): Use ovl_op_identifier.
373 * decl.c (duplicate_decls): Directly copy operator code.
374 (builtin_function_1): Do not set operator code.
375 (build_library_fn): Directly set operator code.
376 (push_cp_library_fn): Use ovl_op_identifier.
377 (grok_op_properties): Directly set operator code.
378 * decl2.c (maybe_warn_sized_delete): Use ovl_op_identifier.
379 * error.c (dump_expr): Use OVL_OP_INFO.
380 (op_to_string): Add assop arg. Use OVL_OP_INFO.
381 (assop_to_string): Delete.
382 (args_to_string): Adjust.
383 * init.c (build_new_1): Use ovl_op_identifier.
384 * mangle.c (write_unqualified_name): Use OVL_OP_INFO.
385 (write_expression): Likewise.
386 * method.c (synthesized_method_walk): Use ovl_op_identifier.
387 (implicitly_declare_fn): Use assign_op_identifier. Directly set
389 * name-lookup.c (get_class_binding): Use assign_op_identifier.
390 * parser.c (cp_parser_operator): Use ovl_op_identifier.
391 (cp_parser_omp_clause_reduction): Likewise.
392 * semantics.c (omp_reduction_id): Likewise.
393 * typeck.c (cxx_sizeof_or_alignof_type): Use OVL_OP_INFO.
395 * cp-tree.h (assign_op_identifier, call_op_identifier): Define.
396 (LAMBDA_FUNCTION_P): Use DECL_OVERLOADED_OPERATOR_IS.
397 (DECL_OVERLOADED_OPERATOR_P): Just retuurn true/false.
398 (DECL_OVERLOADED_OPERATOR_CODE, DECL_OVERLOADED_OPERATOR_IS): Define.
399 * call.c (add_function_candidate): Use
400 DECL_OVERLOADED_OPERATOR_IS.
401 (build_op_call_1): Use call_op_identifier &
402 DECL_OVERLOADED_OPERATOR_IS.
403 (build_over_call): Likewise.
404 (has_trivial_copy_assign_p): Use assign_op_identifier.
405 (build_special_member_call): Likewise.
406 * class.c (dfs_declare_virt_assop_and_dtor): Likewise.
407 (vbase_has_user_provided_move_assign,
408 classtype_has_move_assign_or_move_ctor_p): Likewise.
409 * decl.c (duplicate_decls): Use DECL_OVERLOADED_OPERATOR_CODE.
410 (grok_special_member_properties): Use assign_op_identifier.
411 (start_preparsed_function): Use DECL_OVERLOADED_OPERATOR_IS.
412 * decl2.c (mark_used): Use DECL_CONV_FN_P.
413 * dump.c (dump_access): Delete prototype.
415 (cp_dump_tree): Don't call it.
416 * lambda.c (lambda_function): Use call_op_identifier.
417 (maybe_add_lambda_conv_op): Not an overloaded operator. Remove
419 * mangle.c (write_unqualified_name): Use DECL_OVERLOADED_OPERTOR_CODE.
420 * method.c (do_build_copy_assign): Use assign_op_identifier.
421 (synthesize_method): Use DECL_OVERLOADED_OPERATOR_IS.
422 (get_copy_assign): Use assign_op_identifier.
423 (synthesized_method_walk): Likewise.
424 (defaultable_fn_check): Use DECL_OVERLOADED_OPERATOR_IS.
425 * parser.c (cp_parser_lambda_declarator_opt): Use
427 * semanitics.c (classtype_has_nothrow_assign_or_copy_p): Use
428 assign_op_identifier.
429 * tree.c (special_function_p): Use DECL_OVERLOADED_OPERATOR_IS.
430 * typeck.c (check_return_expr): Use DECL_OVERLOADED_OPERATOR_CODE.
431 (check_return_expr): Use assign_op_identifier.
433 2017-10-30 Paolo Carlini <paolo.carlini@oracle.com>
436 * pt.c (tsubst_copy_and_build, [INDIRECT_REF]): For a REFERENCE_REF_P,
437 unconditionally call convert_from_reference.
439 2017-10-30 Nathan Sidwell <nathan@acm.org>
441 * call.c (build_op_call_1): Test for FUNCTION_DECL in same manner
442 as a few lines earlier.
443 * cp-tree.h (PACK_EXPANSION_PATTERN): Fix white space.
444 * decl.c (grokfndecl): Fix indentation.
445 (compute_array_index_type): Use processing_template_decl_sentinel.
446 (grok_op_properties): Move warnings to end. Reorder other checks
447 to group similar entities. Tweak diagnostics.
448 * lex.c (unqualified_name_lookup_error): No need to check name is
449 not ERROR_MARK operator.
450 * parser.c (cp_parser_operator): Select operator code before
452 * typeck.c (check_return_expr): Fix indentation and line wrapping.
454 2017-10-27 Paolo Carlini <paolo.carlini@oracle.com>
456 * pt.c (invalid_nontype_parm_type_p): Return a bool instead of an int.
458 2017-10-26 Nathan Sidwell <nathan@acm.org>
460 * decl.c (sort_labels): Restore function.
461 (pop_labels): Sort labels
462 (identify_goto): Add translation markup.
464 2017-10-25 Nathan Sidwell <nathan@acm.org>
466 Kill IDENTIFIER_LABEL_VALUE.
467 * cp-tree.h (lang_identifier): Delete label_value slot.
468 (IDENTIFIER_LABEL_VALUE, SET_IDENTIFIER_LABEL_VALUE): Delete.
469 (struct named_label_hasher): Rename to ...
470 (struct named_label_hash): ... here. Reimplement.
471 (struct language_function): Adjust x_named_labels.
472 * name-lookup.h (struct cp_label_binding): Delete.
473 (struct cp_binding_level): Delete shadowed_labels slot.
474 * decl.c (struct named_label_entry): Add name and outer slots.
475 (pop_label): Rename to ...
476 (check_label_used): ... here. Don't pop.
477 (note_label, sort_labels): Delete.
478 (pop_labels, pop_local_label): Reimplement.
479 (poplevel): Pop local labels as any other decl. Remove
480 shadowed_labels handling.
481 (named_label_hash::hash, named_label_hash::equal): New.
482 (make_label_decl): Absorb into ...
483 (lookup_label_1): ... here. Add making_local_p arg, reimplement.
484 (lookup_label, declare_local_label): Adjust.
485 (check_goto, define_label): Adjust.
486 * lex.c (make_conv_op_name): Don't clear IDENTIFIER_LABEL_VALUE.
487 * ptree.c (cxx_print_identifier): Don't print identifier binding.
489 * decl.c (identifier_goto): Reduce duplication.
490 (check_previous_goto_1): Likewise.
491 (check_goto): Move var decls to initialization.
492 (check_omp_return, define_label_1, define_label): Likewise.
494 2017-10-25 Jakub Jelinek <jakub@redhat.com>
497 * decl.c (duplicate_decls): Copy "omp declare simd" attributes from
498 newdecl to corresponding __builtin_ if any.
500 2017-10-24 Paolo Carlini <paolo.carlini@oracle.com>
503 * decl.c (duplicate_decls): Warn for built-in functions declared as
504 non-function, use OPT_Wbuiltin_declaration_mismatch.
506 * decl.c (duplicate_decls): Avoid redundant '+' in warning_at.
508 2017-10-24 Paolo Carlini <paolo.carlini@oracle.com>
511 * pt.c (value_dependent_expression_p, [TRAIT_EXPR]): Handle
512 a TREE_LIST as TRAIT_EXPR_TYPE2.
514 2017-10-24 Mukesh Kapoor <mukesh.kapoor@oracle.com>
515 Paolo Carlini <paolo.carlini@oracle.com>
518 * cvt.c (type_promotes_to): Implement C++17, 7.6/4, about unscoped
519 enumeration type whose underlying type is fixed.
521 2017-10-23 Paolo Carlini <paolo.carlini@oracle.com>
524 * semantics.c (finish_compound_literal): Check do_auto_deduction
525 return value for error_mark_node.
527 2017-10-23 Jason Merrill <jason@redhat.com>
529 PR c++/77369 - wrong noexcept handling in C++14 and below
530 * tree.c (strip_typedefs): Canonicalize TYPE_RAISES_EXCEPTIONS.
532 2017-10-20 Nathan Sidwell <nathan@acm.org>
534 * class.c (layout_class_type): Cleanup as-base creation, determine
536 (finish_struct_1): ... not here.
538 2017-10-19 Jakub Jelinek <jakub@redhat.com>
541 * typeck.c (check_return_expr): Don't call
542 maybe_warn_about_returning_address_of_local in templates.
544 2017-10-17 Nathan Sidwell <nathan@acm.org>
547 * call.c (build_over_call): Don't pass tf_no_cleanup to nested
551 * cp-objcp-common.c (cp_tree_size): Reformat. Adjust returns size
554 2017-10-13 Jason Merrill <jason@redhat.com>
556 PR c++/82357 - bit-field in template
557 * tree.c (cp_stabilize_reference): Just return a NON_DEPENDENT_EXPR.
559 2017-10-13 David Malcolm <dmalcolm@redhat.com>
561 * cp-tree.h (maybe_show_extern_c_location): New decl.
562 * decl.c (grokfndecl): When complaining about literal operators
563 with C linkage, issue a note giving the location of the
565 * parser.c (cp_parser_new): Initialize new field
566 "innermost_linkage_specification_location".
567 (cp_parser_linkage_specification): Store the location
568 of the linkage specification within the cp_parser.
569 (cp_parser_explicit_specialization): When complaining about
570 template specializations with C linkage, issue a note giving the
571 location of the extern "C".
572 (cp_parser_explicit_template_declaration): Likewise for templates.
573 (maybe_show_extern_c_location): New function.
574 * parser.h (struct cp_parser): New field
575 "innermost_linkage_specification_location".
577 2017-10-12 Nathan Sidwell <nathan@acm.org>
579 * cp-tree.h (cp_expr): Add const operator * and operator->
581 (cp_tree_node_structure_enum): Delete TS_CP_BINDING,
582 TS_CP_WRAPPER, LAST_TS_CP_ENUM.
584 2017-10-12 David Malcolm <dmalcolm@redhat.com>
586 * parser.c (get_required_cpp_ttype): New function.
587 (cp_parser_error_1): Call it, using the result to call
588 maybe_suggest_missing_token_insertion.
590 2017-10-12 David Malcolm <dmalcolm@redhat.com>
592 * parser.c (get_matching_symbol): Move to before...
593 (cp_parser_error): Split out into...
594 (cp_parser_error_1): ...this new function, merging in content
596 (cp_parser_required_error): ...here. Eliminate partial duplicate
597 of body of cp_parser_error in favor of a call to the new
598 cp_parser_error_1 helper function.
600 2017-10-11 Nathan Sidwell <nathan@acm.org>
602 * decl2.c (struct mangled_decl_hash): Use DECL_ASSEMBLER_NAME_RAW.
603 (record_mangling): Likewise.
605 2017-10-10 Nathan Sidwell <nathan@acm.org>
607 * name-lookup.c (extern_c_fns): Rename to ...
608 (extern_c_decls): ... here.
609 (check_extern_c_conflict, extern_c_linkage_bindings): Update.
610 (do_pushdecl): Check extern-c fns and vars.
612 * cp-tree.h (default_hash_traits <lang_identifier *>): Delete
615 * decl2.c (struct mangled_decl_hash): New hash traits.
616 (mangled_decls): Make hash_table<mangled_decl_hash>.
617 (generate_mangling_alias, record_mangling): Adjust.
619 2017-10-10 Jason Merrill <jason@redhat.com>
621 More delayed lambda capture fixes.
622 * call.c (add_function_candidate): Use build_address.
623 (build_op_call_1): Call mark_lvalue_use early.
624 (build_over_call): Handle error from build_this.
625 * constexpr.c (cxx_bind_parameters_in_call): Use build_address.
626 (cxx_eval_increment_expression): Don't use rvalue().
627 * cvt.c (convert_to_void): Use mark_discarded_use.
628 * expr.c (mark_use): Handle PARM_DECL, NON_DEPENDENT_EXPR. Fix
629 reference handling. Don't copy the expression.
630 (mark_discarded_use): New.
631 * lambda.c (insert_capture_proxy): Add some sanity checking.
632 (maybe_add_lambda_conv_op): Set cp_unevaluated_operand.
633 * pt.c (register_local_specialization): Add sanity check.
634 * semantics.c (process_outer_var_ref): Fix check for existing proxy.
635 * typeck.c (cp_build_addr_expr_1): Handle error from
637 (cp_build_modify_expr): Call mark_lvalue_use_nonread, handle error
640 Handle generic lambda capture in dependent expressions.
641 * lambda.c (need_generic_capture, dependent_capture_r)
642 (do_dependent_capture): New.
643 * pt.c (processing_nonlambda_template): Use need_generic_capture.
644 * semantics.c (maybe_cleanup_point_expr)
645 (maybe_cleanup_point_expr_void, finish_goto_stmt)
646 (maybe_convert_cond): Call do_dependent_capture.
647 * typeck.c (build_static_cast): Remove dependent capture handling.
649 * typeck.c (condition_conversion): Assert !processing_template_decl.
650 * semantics.c (finish_omp_clauses): Don't
651 fold_build_cleanup_point_expr if processing_template_decl.
652 (outer_var_p): A temporary can't be from an outer scope.
653 * pt.c (type_dependent_expression_p): Fix dependency checking of
654 functions without DECL_TEMPLATE_INFO.
655 (instantiate_decl): Use lss_copy.
656 * constexpr.c (is_valid_constexpr_fn): Fix lambdas before C++17.
658 * typeck.c (check_return_expr): Check non-dependent conversion in
660 * constraint.cc (check_function_concept): Don't complain about an
661 empty concept if seen_error.
663 2017-10-10 Richard Sandiford <richard.sandiford@linaro.org>
665 * cvt.c (ignore_overflows): Use wi::to_wide when
666 operating on trees as wide_ints.
667 * decl.c (check_array_designated_initializer): Likewise.
668 * mangle.c (write_integer_cst): Likewise.
669 * semantics.c (cp_finish_omp_clause_depend_sink): Likewise.
671 2017-10-10 Nathan Sidwell <nathan@acm.org>
673 * name-lookup.c (set_global_binding): Don't deal with STAT_HACK.
675 2017-10-06 Paolo Carlini <paolo.carlini@oracle.com>
678 * decl.c (finish_function): Take a bool intead of an int; adjust.
679 * cp-tree.h (finish_function): Adjust declaration.
680 * decl2.c (generate_tls_wrapper, finish_objects,
681 finish_static_storage_duration_function): Adjust calls.
682 * lambda.c (maybe_add_lambda_conv_op, finish_lambda_function):
684 * method.c (synthesize_method): Likewise.
685 * optimize.c (maybe_thunk_body, maybe_clone_body): Likewise.
686 * pt.c (instantiate_decl): Likewise.
687 * parser.c (cp_parser_function_definition_after_declarator,
688 cp_parser_late_parsing_for_member, cp_parser_omp_declare_reduction):
690 (cp_parser_ctor_initializer_opt,
691 cp_parser_ctor_initializer_opt_and_function_body,
692 cp_parser_function_try_block,
693 cp_parser_function_definition_after_declarator,
694 cp_parser_function_transaction): Return void; adjust declarations.
696 2017-10-06 Nathan Sidwell <nathan@acm.org>
699 * name-lookup.c (check_local_shadow): Don't try and convert
702 2017-10-06 Jakub Jelinek <jakub@redhat.com>
705 * decl.c (reshape_init): Suppress warn_useless_cast for direct enum
707 * typeck.c (convert_for_assignment): Likewise.
709 P0704R1 - fixing const-qualified pointers to members
710 * typeck2.c (build_m_component_ref): For -std=c++2a allow
711 pointer to const & qualified method on rvalue.
713 2017-10-06 Nathan Sidwell <nathan@acm.org>
715 Use hash_table for extern "C" names
716 * name-lookup.c (extern_c_fns): Use hash_table.
717 (check_extern_c_conflict): Adjust.
718 (c_linkage_bindings): Adjust.
720 Use hash_table for namespace bindings
721 * cp-tree.h (struct named_decl_hash): New.
722 (lang_decl_ns): Change type of bindings field.
723 * lex.c (maybe_add_lang_decl_raw): Adjust.
724 * name-lookup.c (find_namespace_slot): Adjust.
725 (do_pushdecl): Push NULL-named namespace.
726 (do_push_nested_namespace): Adjust.
727 (push_namespace): Push anonymous namespace as NULL name.
729 2017-10-05 Jason Merrill <jason@redhat.com>
731 Pass variadic class objects exactly like named by-value args.
732 * call.c (convert_arg_to_ellipsis): Use the result of force_rvalue.
734 2017-10-05 Nathan Sidwell <nathan@acm.org>
736 Warn on MVP declarations
737 * cp-tree.h (struct cp_declarator): Add parenthesized field.
738 * decl.c (grokdeclarator): Warn about unnecessary parens.
739 * parser.c (make_declarator): Init parenthesized field.
740 (cp_parser_direct_declarator): Set parenthesized field.
742 Kill IDENTIFIER_GLOBAL_VALUE, SET_IDENTIFIER_GLOBAL_VALUE
743 * cp-tree.h (IDENTIFIER_GLOBAL_VALUE,
744 SET_IDENTIFIER_GLOBAL_VALUE): Delete.
745 * name-lookup.h (set_global_binding): Remove NAME parm.
746 (get_global_binding): New inline fn.
747 * name-lookup.c (set_global_binding): Remove NAME parm. Adjust.
748 (identifier_global_value): Move to ...
749 * cp-objcp-common.c (identifier_global_value): ... here.
750 * class.c (build_ctor_vtbl_group, build_vtbl_initializer): Adjust.
751 * decl.c (record_builtin_type, expand_static_init,
752 grokdeclarator): Adjust.
753 * decl2.c (get_guard, get_local_tls_init_fn, get_tls_init_fn,
754 get_tls_wrapper_fn, maybe_warn_sized_delete): Adjust.
755 * except.c (declare_library_fn, build_throw): Adjust.
756 * init.c (throw_bad_array_length): Adjust.
757 * rtti.c (throw_bad_cast, throw_bad_typeid, get_tinfo_decl): Adjust.
759 * decl2.c (record_mangling): Fix spello and formatting from
762 2017-10-04 Nathan Sidwell <nathan@acm.org>
764 Give builtin types the correct name.
765 * name-lookup.c (set_global_binding): Assert name is DECL_NAME.
766 * decl.c (record_builtin_type): Reimplement, use new TYPE_DECL for
769 2017-10-04 Paolo Carlini <paolo.carlini@oracle.com>
770 Andrew Pinski <apinski@cavium.com>
773 * parser.c (cp_parser_lambda_body): Set parser->in_function_body.
775 2017-10-04 Nathan Sidwell <nathan@acm.org>
777 Move mangling aliases out of global namespace.
778 * cp-tree.h (record_mangling): New.
779 (maybe_remove_implicit_alias): Delete.
780 * decl2.c (mangled_decls): New hash map.
781 (generate_mangling_alias): Reimplement using mangled_decls.
782 (record_mangling): New.
783 * mangle.c (decl_implicit_alias_p,
784 maybe_remove_implicit_alias): Delete.
785 (mangle_decl): Use record_mangling.
786 * name-lookup.c (supplement_binding_1): Remove
787 maybe_remove_implicit_alias check.
789 2017-10-04 Jakub Jelinek <jakub@redhat.com>
792 * error.c (dump_function_decl): If show_return, call dump_type_suffix
793 on the same return type dump_type_prefix has been called on.
795 2017-10-04 Jason Merrill <jason@redhat.com>
797 PR c++/81525 - broken handling of auto in generic lambda.
798 * pt.c (tsubst_decl) [VAR_DECL]: Use strip_innermost_template_args.
800 2017-10-04 Nathan Sidwell <nathan@acm.org>
802 * call.c (convert_arg_to_ellipsis): Correct comment about passing
805 2017-10-02 Richard Sandiford <richard.sandiford@linaro.org>
807 * constexpr.c (cxx_eval_store_expression): Use wi::to_widest
808 when comparing the array bounds with an ARRAY_REF index.
810 2017-09-30 Paolo Carlini <paolo.carlini@oracle.com>
813 * method.c (defaulted_late_check): Early return if the defaulted
814 declaration does not match the expected signature.
816 2017-09-29 Jakub Jelinek <jakub@redhat.com>
818 P0683R1 - default member initializers for bit-fields
819 * cp-tree.h (grokbitfield): Add INIT parameter.
820 * parser.c (cp_parser_constant_expression): Add STRICT_P argument,
821 if true, parse a conditional-expression rather than
822 assignment-expression.
823 (cp_parser_member_declaration): For C++11 and later pass true
824 as STRICT_P to cp_parser_constant_expression. Parse C++2A bitfield
825 NSDMIs. Adjust grokbitfield caller. Handle DECL_INITIAL also for
827 (cp_parser_objc_class_ivars): Adjust grokbitfield caller.
828 * class.c (check_field_decl): Recurse even for DECL_C_BIT_FIELDs.
829 (check_field_decls): Call check_field_decl even for DECL_C_BIT_FIELDs.
830 * decl2.c (grokbitfield): Add INIT parameter, pass it to
832 * pt.c (tsubst_decl): Handle DECL_INITIAL for all FIELD_DECLs, not
835 * class.c (check_bitfield_decl): Retrieve and clear width from
836 DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL.
837 (check_field_decls): Test DECL_BIT_FIELD_REPRESENTATIVE rather than
839 (remove_zero_width_bit_fields): Adjust comment.
840 * decl2.c (grokbitfield): Stash width into
841 DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL.
842 * pt.c (tsubst_decl): For DECL_C_BIT_FIELD, tsubst_expr
843 DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL for width.
845 * parser.c (cp_parser_member_declaration): Parse attributes before
846 colon of a bitfield in addition to after colon.
848 * Make-lang.in (check-c++-all): Test also c++2a.
850 2017-09-28 Jason Merrill <jason@redhat.com>
852 PR c++/56973, DR 696 - capture constant variables only as needed.
853 * expr.c (mark_use): Split out from mark_rvalue_use and
854 mark_lvalue_use. Handle lambda capture of constant variables.
855 (mark_lvalue_use_nonread): New.
856 * semantics.c (process_outer_var_ref): Don't capture a constant
857 variable until forced.
858 * pt.c (processing_nonlambda_template): New.
859 * call.c (build_this): Check it.
860 * decl2.c (grok_array_decl): Call mark_rvalue_use and
861 mark_lvalue_use_nonread.
862 * init.c (constant_value_1): Don't call mark_rvalue_use.
863 * typeck.c (build_static_cast): Handle lambda capture.
865 Use local_specializations to find capture proxies.
866 * cp-tree.h (DECL_CAPTURED_VARIABLE): New.
867 * lambda.c (build_capture_proxy): Set it.
868 (add_capture): Pass initializer to build_capture_proxy.
869 (start_lambda_function): Likewise.
870 (insert_capture_proxy): Use register_local_specialization.
871 (is_lambda_ignored_entity): Always ignore proxies.
872 * name-lookup.c (qualify_lookup): Don't check
873 is_lambda_ignored_entity if LOOKUP_HIDDEN is set.
874 * semantics.c (process_outer_var_ref): Use
875 retrieve_local_specialization.
876 * parser.c (cp_parser_lambda_body): Push local_specializations.
877 * pt.c (tsubst_expr): Pass LOOKUP_HIDDEN when looking for a proxy.
878 (tsubst_lambda_expr): Push local_specializations sooner.
879 (tsubst_copy_and_build): Don't register_local_specialization.
881 * call.c (build_special_member_call): Use the return value of
883 * decl.c (compute_array_index_type): Likewise.
884 * parser.c (cp_parser_oacc_wait_list): Likewise.
885 * lambda.c (is_normal_capture_proxy): Handle *this capture.
886 (add_capture): Clarify internal_error message.
888 2017-09-22 Eric Botcazou <ebotcazou@adacore.com>
891 * cp-objcp-common.c (cp_get_debug_type): Do only one lookup.
893 2017-09-22 Jakub Jelinek <jakub@redhat.com>
896 * tree.c (struct replace_placeholders_t): Add pset field.
897 (replace_placeholders_r): Call cp_walk_tree with d->pset as
898 last argument instead of NULL. Formatting fix.
899 (replace_placeholders): Add pset variable, add its address
900 into data. Pass &pset instead of NULL to cp_walk_tree.
902 2017-09-22 David Malcolm <dmalcolm@redhat.com>
904 * call.c (get_fndecl_argument_location): New function.
905 (convert_like_real): Use it when complaining about argument type
907 * cp-tree.h (struct cp_parameter_declarator): Add "loc" field.
908 * parser.c (make_parameter_declarator): Add "loc" param and use
909 it to initialize the new field.
910 (cp_parser_translation_unit): Add UNKNOWN_LOCATION for "loc" of
911 the "no_parameters" parameter.
912 (cp_parser_parameter_declaration_list): Set the location of the
913 result of grokdeclarator to be the parameter's loc, assuming no
915 (cp_parser_parameter_declaration): Generate a location for the
916 parameter and pass to make_parameter_declarator.
918 2017-09-20 Nathan Sidwell <nathan@acm.org>
920 * name-lookup.c (member_name_cmp): Use DECL_UID for final
923 2017-09-20 Jakub Jelinek <jakub@redhat.com>
925 P0409R2 - allow lambda capture [=, this]
926 * parser.c (cp_parser_lambda_introducer): For cxx2a don't pedwarn on
929 2017-09-18 Jason Merrill <jason@redhat.com>
931 PR c++/82069 - ICE with lambda in template
932 * semantics.c (process_outer_var_ref): Check uses_template_parms
933 instead of any_dependent_template_arguments_p.
935 2017-09-15 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
936 Paolo Carlini <paolo.carlini@oracle.com>
939 * decl2.c (finish_anon_union): Complain about "anonymous union with
940 no members" with a pedwarn.
942 2017-09-15 Bernd Edlinger <bernd.edlinger@hotmail.de>
944 * typeck.c (build_reinterpret_cast_1,
945 build_const_cast_1): Implement -Wcast-align=strict.
947 2017-09-15 Jakub Jelinek <jakub@redhat.com>
949 * decl.c (redeclaration_error_message): Use cxx17 instead of cxx1z,
950 adjust diagnostics refering to C++1z or -std=gnu++1z or -std=c++1z
951 to C++17 or -std=gnu++17 or -std=c++17. Adjust comments.
952 (cxx_init_decl_processing, next_initializable_field,
953 is_direct_enum_init, check_initializer, cp_finish_decl,
954 mark_inline_variable, grokdeclarator, grokparms, xref_basetypes,
955 finish_function): Likewise.
956 * cp-tree.h (DECL_INLINE_VAR_P): Likewise.
957 * pt.c (mark_template_parm, convert_nontype_argument,
958 instantiate_class_template_1, type_unification_real, unify,
959 get_partial_spec_bindings, dependent_type_p_r): Likewise.
960 * typeck.c (cp_build_unary_op): Likewise.
961 * constexpr.c (var_in_maybe_constexpr_fn): Likewise.
962 * call.c (build_user_type_conversion_1, build_over_call,
963 build_special_member_call): Likewise.
964 * lambda.c (begin_lambda_type): Likewise.
965 * typeck2.c (process_init_constructor_record): Likewise.
966 * class.c (build_base_field, finalize_literal_type_property,
967 explain_non_literal_class): Likewise.
968 * parser.c (cp_parser_diagnose_invalid_type_name,
969 cp_parser_primary_expression, cp_parser_lambda_introducer,
970 cp_parser_lambda_declarator_opt, cp_parser_selection_statement,
971 cp_convert_range_for, cp_parser_perform_range_for_lookup,
972 cp_parser_decomposition_declaration, cp_parser_linkage_specification,
973 cp_parser_static_assert, cp_parser_simple_type_specifier,
974 cp_parser_namespace_definition, cp_parser_using_declaration,
975 cp_parser_init_declarator, cp_parser_type_parameter_key,
976 cp_parser_exception_specification_opt, cp_parser_std_attribute_spec,
977 cp_parser_constructor_declarator_p): Likewise.
978 * mangle.c (struct globals): Rename need_cxx1z_warning to
980 (write_exception_spec, start_mangling, mangle_decl): Likewise.
981 * Make-lang.in (check-c++1z): Rename to check-c++17, depend on
983 (check-c++17): New goal. Use 17 instead of 1z.
984 (check-c++-all): Use 17 instead of 1z.
986 2017-09-14 Jakub Jelinek <jakub@redhat.com>
989 * cp-gimplify.c (omp_var_to_track): Look through references.
990 (omp_cxx_notice_variable): Likewise.
992 2017-09-13 Nathan Sidwell <nathan@acm.org>
994 Conv-op identifers not in identifier hash table
995 * lex.c (conv_type_hasher): Make member fns inline.
996 (make_conv_op_name): Directly clone conv_op_identifier.
998 Rename CLASSTYPE_METHOD_VEC to CLASSTYPE_MEMBER_VEC.
999 * cp-tree.h (struct lang_type): Rename methods to members.
1000 (CLASSTYPE_METHOD_VEC): Rename to ...
1001 (CLASSTYPE_MEMBER_VEC): ... this.
1002 * name-lookup.h (get_method_slot): Rename to ...
1003 (get_member_slot): ... this.
1004 (resort_type_method_vec): Rename to ...
1005 (resort_type_member_vec): ... this.
1006 * class.c (add_method, warn_hidden): Adjust.
1007 * search.c (dfs_locate_field_accessor_pre): Adjust.
1008 * name-lookup.c (method_vec_binary_search): Rename to ...
1009 (member_vec_binary_search): ... this and adjust.
1010 (method_vec_linear_search): Rename to ...
1011 (member_vec_linear_search): ... this and adjust.
1012 (fields_linear_search, get_class_binding_direct): Adjust.
1013 (get_method_slot): Rename to ...
1014 (get_member_slot): ... this and adjust.
1015 (method_name_slot): Rename to ...
1016 (member_name_slot): ... this and adjust.
1017 (resort_type_method_vec): Rename to ...
1018 (resort_type_member_vec): ... this and adjust.
1019 (method_vec_append_class_fields): Rename to ...
1020 (member_vec_append_class_fields): ... this and adjust.
1021 (method_vec_append_enum_values): Rename to ...
1022 (member_vec_append_enum_values): ... this and adjust.
1023 (method_vec_dedup): Rename to ...
1024 (member_vec_dedup): ... this and adjust.
1025 (set_class_bindings, insert_late_enum_def_bindings): Adjust.
1027 2017-09-12 Paolo Carlini <paolo.carlini@oracle.com>
1030 * decl.c (start_decl): Early return error_mark_node if duplicate_decls
1031 returns it; avoid misleading error message.
1033 2017-09-12 Nathan Sidwell <nathan@acm.org>
1035 Kill CLASSTYPE_SORTED_FIELDS.
1036 * cp-tree.h (struct lang_type): Lose sorted_fields member.
1037 (CLASSTYPE_SORTED_FIELDS): Delete.
1038 * name-lookup.h (set_class_bindings): Add EXTRA arg.
1039 * name-lookup.c (fields_linear_search): New, broken out of ...
1040 (lookup_field_1): ... here. Delete remainder of function.
1041 (get_class_binding_direct): Reimplement without sorted_fields.
1042 (get_class_binding): Rename TYPE arg to KLASS, for consistency.
1043 (get_method_slot): Call set_class_binding when creating method_vec
1045 (method_name_cmp): Order identically named slots.
1046 (sorted_fields_type_new): Delete.
1047 (field_vc_append_class_fields): Rename to ...
1048 (method_vec_append_class_fields): ... here. Adjust.
1049 (field_vec_append_enum_values): Renme to ...
1050 (method_vec_append_enum_values): ... here. Adjust.
1051 (method_vec_dedup): New.
1052 (set_class_bindings): Reimplement.
1053 (insert_late_enum_def_bindings): Reimplement.
1055 * name-lookup.c (get_class_binding): Rename TYPE arg to KLASS for
1057 (restort_data): Move later.
1058 (method_name_cmp, resort_method_name_cmp): Simplify.
1059 (resort_type_method_vec): Reformat.
1061 2017-09-09 Jason Merrill <jason@redhat.com>
1063 * constexpr.c (reduced_constant_expression_p): If
1064 CONSTRUCTOR_NO_IMPLICIT_ZERO, check that all fields are initialized.
1066 2017-09-09 Eric Botcazou <ebotcazou@adacore.com>
1069 * cp-objcp-common.c (struct debug_type_hasher): New class.
1070 (debug_type_hash): New variable.
1071 (cp_get_debug_type): Associate the OFFSET_TYPEs with the types.
1073 2017-09-08 Jason Merrill <jason@redhat.com>
1075 PR c++/70029 - ICE with ref-qualifier and -flto
1076 * tree.c (cxx_copy_lang_qualifiers): New.
1077 * cp-tree.h: Declare it.
1078 * cp-objcp-common.h: Define LANG_HOOKS_COPY_LANG_QUALIFIERS.
1080 2017-09-06 Jason Merrill <jason@redhat.com>
1082 PR c++/82053 - ICE with default argument in lambda in template
1083 * pt.c (tsubst_arg_types): Substitute default arguments for lambdas
1085 (retrieve_specialization): Use lambda_fn_in_template_p.
1086 * cp-tree.h: Declare it.
1088 PR c++/82070 - error with nested lambda capture
1089 * pt.c (tsubst_expr) [DECL_EXPR]: Register capture proxies with
1090 register_local_specialization.
1092 2017-09-06 Nathan Sidwell <nathan@acm.org>
1094 * name-lookup.h (lookup_field_1): Delete.
1095 (get_class_binding_direct, get_class_binding): Add type_or_fns arg.
1096 * name-lookup.c (lookup_field_1): make static
1097 (method_vec_binary_search, method_vec_linear_search): New. Broken
1099 (get_class_binding_direct): ... here. Add TYPE_OR_FNS argument.
1100 Do complete search of this level.
1101 (get_class_binding): Adjust.
1102 * decl.c (reshape_init_class): Call get_class_binding.
1103 * search.c (lookup_field_r): Move field searching into
1104 get_class_binding_direct.
1106 * class.c (warn_hidden): Don't barf on non-functions.
1107 * decl2.c (check_classfn): Likewise. Check template match earlier.
1109 * name-lookup.c (count_fields): Rename to ...
1110 (count_class_fields): ... here. Take a class, don't count
1112 (add_fields_to_record_type): Rename to ...
1113 (field_vec_append_class_fields): ... here. Take a class, don't
1114 add NULL-named fields.
1115 (add_enum_fields_to_record_type): Rename to ...
1116 (field_vec_append_enum_values): ... here.
1117 (set_class_bindings): Adjust, assert we added expected number.
1118 (insert_late_enum_def_bindings): Reimplement. Create vector if
1119 there are now sufficient entries.
1121 * name-lookup.h (lookup_fnfields_slot_nolazy,
1122 lookup_fnfields_slot): Rename to ...
1123 (get_class_binding_direct, get_class_binding): ... here.
1124 * name-lookup.c (lookup_fnfields_slot_nolazy,
1125 lookup_fnfields_slot): Rename to ...
1126 (get_class_binding_direct, get_class_binding): ... here.
1127 * cp-tree.h (CLASSTYPE_CONSTRUCTORS, CLASSTYPE_DESTRUCTOR): Adjust.
1128 * call.c (build_user_type_conversion_1): Adjust.
1129 (has_trivial_copy_assign_p): Adjust.
1130 (has_trivial_copy_p): Adjust.
1131 * class.c (get_basefndecls) Adjust.
1132 (vbase_has_user_provided_move_assign) Adjust.
1133 (classtype_has_move_assign_or_move_ctor_p): Adjust.
1134 (type_build_ctor_call, type_build_dtor_call): Adjust.
1135 * decl.c (register_dtor_fn): Adjust.
1136 * decl2.c (check_classfn): Adjust.
1137 * pt.c (retrieve_specialization): Adjust.
1138 (check_explicit_specialization): Adjust.
1139 (do_class_deduction): Adjust.
1140 * search.c (lookup_field_r): Adjust.
1141 (look_for_overrides_here, lookup_conversions_r): Adjust.
1142 * semantics.c (classtype_has_nothrow_assign_or_copy_p): Adjust.
1143 * tree.c (type_has_nontrivial_copy_init): Adjust.
1144 * method.c (lazily_declare_fn): Adjust comment.
1146 2017-09-05 Nathan Sidwell <nathan@acm.org>
1148 * name-lookup.c (do_class_using_decl): Elide read-once temps.
1149 Move declarations to initializations.
1151 * class.c (add_method): Move slot search and insertion to ...
1152 * name-lookup.c (get_method_slot): ... this new function.
1153 (lookup_fnfields_slot_nolazy): Cope with NULL slot.
1154 * name-lookup.h (get_method_slot): Declare.
1155 * decl.c (cxx_init_decl_processinng): Give conv_op_marker a more
1157 (grok_special_member_properties): Set
1158 TYPE_HAS_CONVERSION. Expicitly look at DECL_NAME for specialness.
1159 Improve TYPE_HAS_CONSTEXPR_CTOR setting.
1161 * cp-tree.h (lang_decl_base): Rename template_conv_p to
1163 (DECL_CONV_FN_P): Don't check NULL DECL_NAME.
1164 (DECL_CONV_FN_TYPE): FN must be conv op.
1165 (DECL_TEMPLATE_CONV_FN_P): Delete.
1166 (VAR_HAD_UNKNOWN_BOUND, SET_VAR_HAD_UNKNOWN_BOUND): Adjust.
1167 * pt.c (push_template_decl_real): Delete DECL_TEMPLATE_CONV_FN_P
1170 * class.c (unreverse_member_declarations): Remove extraneous if.
1171 * pt.c (push_template_decl_real): Use string concatenation, not
1172 \<newline>. Add %<..%>.
1174 2017-09-05 Paolo Carlini <paolo.carlini@oracle.com>
1177 * cp-tree.h (LABEL_DECL_CDTOR): Add and document.
1178 * decl.c (start_preparsed_function): Set LABEL_DECL_CDTOR when
1179 creating cdtor_label.
1180 * constexpr.c (returns): Add the case of a constructor/destructor
1181 returning via a LABEL_DECL_CDTOR label.
1182 (cxx_eval_constant_expression, case [GOTO_EXPR]): Likewise.
1184 2017-09-01 Nathan Sidwell <nathan@acm.org>
1186 * cp-tree.h (resort_type_method_vec): Move declaration to ...
1187 * name-lookup.h (resort_type_method_vec): ... here.
1188 (set_class_bindings): Lose 2nd arg.
1189 * class.c (finish_struct_1, finish_struct): Adjust
1190 set_class_bindings call. Don't call finish_struct_methods.
1191 (resort_data, method_name_cmp, resort_method_name_cmp,
1192 resort_type_method_vec, finish_struct_methods): Move to ...
1193 * name-lookup.c (resort_data, method_name_cmp,
1194 resort_method_name_cmp, resort_type_method_vec): ... here.
1195 (set_class_bindings): Lose fields arg. Swallow finish_struct_methods.
1197 * class.c (finish_struct): Call set_class_bindings for the
1200 * class.c (finish_struct_methods): Dont clear DECL_IN_AGGR_P here.
1201 Don't call maybe_warn_about_overly_private_class here.
1202 (warn_hidden): Cleanup declarations and comments.
1203 (type_has_user_provided_constructor): No need to check
1204 CLASSTYPE_METHOD_VEC.
1205 (type_has_user_provided_or_explicit_constructor): Likewise.
1206 (classtype_has_move_assign_or_move_ctor_p): Likewise.
1207 (check_bases_and_members): Don't call finish_struct_methods here.
1208 (finish_struct_1): Call finish_struct_methods and
1209 set_class_bindings immediately after layout. Clear DECL_IN_AGGR_P
1211 (finish_struct): For templates process USING_DECLS and clear
1212 DECL_IN_AGGR_P before calling finish_struct_methods. Call
1213 maybe_warn_about_overly_private_class here.
1215 Revert 2017-08-28 Nathan Sidwell <nathan@acm.org>
1216 Restore sorted_fields vector.
1217 * cp-tree.h (lang_type): Restore sorted_fields vector.
1218 (CLASSTYPE_SORTED_FIELDS): Restore.
1219 (CLASSTYPE_BINDINGS): Delete.
1220 * name-lookup.c (lookup_field_1): Restore binary search.
1221 (sorted_fields_type_new, count_fields,
1222 add_fields_to_record_type, add_enum_fields_to_record_type): Restore
1223 (set_class_bindings): Revert.
1224 (insert_late_enum_def_binding): Restore field_vec insertion.
1226 2017-09-01 Jakub Jelinek <jakub@redhat.com>
1229 * parser.c (cp_parser_omp_ordered): Handle -fopenmp-simd.
1231 2017-09-01 Marek Polacek <polacek@redhat.com>
1234 * typeck.c (cp_build_unary_op): Avoid re-entering reporting routines.
1236 2017-08-30 Jason Merrill <jason@redhat.com>
1238 PR c++/82029 - __PRETTY_FUNCTION__ in lambda in template
1239 * pt.c (enclosing_instantiation_of, lambda_fn_in_template_p)
1240 (regenerated_lambda_fn_p): New.
1241 (tsubst_decl) [VAR_DECL]: Use enclosing_instantiation_of.
1242 (tsubst_copy) [VAR_DECL]: Likewise.
1244 PR c++/82030 - ICE inheriting from multiple lambdas
1246 * call.c (compare_ics): Handle null candidate.
1248 2017-08-30 Ville Voutilainen <ville.voutilainen@gmail.com>
1250 Make taking the address of an overloaded function a non-deduced context
1252 * pt.c (unify_overload_resolution_failure): Remove.
1253 (unify_one_argument): Adjust.
1255 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
1256 Alan Hayward <alan.hayward@arm.com>
1257 David Sherwood <david.sherwood@arm.com>
1259 * typeck.c (cp_build_binary_op): Use SCALAR_TYPE_MODE.
1261 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
1262 Alan Hayward <alan.hayward@arm.com>
1263 David Sherwood <david.sherwood@arm.com>
1265 * cvt.c (cp_convert_to_pointer): Use SCALAR_INT_TYPE_MODE.
1267 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
1268 Alan Hayward <alan.hayward@arm.com>
1269 David Sherwood <david.sherwood@arm.com>
1271 * mangle.c (write_real_cst): Use SCALAR_FLOAT_TYPE_MODE
1272 instead of TYPE_MODE.
1274 2017-08-29 Jason Merrill <jason@redhat.com>
1276 PR c++/81236 - ICE with template-id in generic lambda
1277 * semantics.c (finish_id_expression): Remove special dependent case.
1278 Avoid some later pieces when dependent.
1279 (finish_qualified_id_expr): Do normal BASELINK handling in a
1280 template. Always build a SCOPE_REF for a destructor BIT_NOT_EXPR.
1281 (parsing_default_capturing_generic_lambda_in_template): Remove.
1282 * parser.c (cp_parser_postfix_dot_deref_expression): Always give an
1283 error for types that will never be complete.
1284 * mangle.c (write_expression): Add sanity check.
1285 * tree.c (build_qualified_name): Add sanity check.
1286 (cp_walk_subtrees): Walk into the class context of a BASELINK.
1287 * lambda.c (add_capture): Improve diagnostic for generic lambda
1289 * call.c (build_new_method_call_1): Print the right constructor
1292 Reimplement handling of lambdas in templates.
1293 * cp-tree.h (LAMBDA_FUNCTION_P): Check DECL_DECLARES_FUNCTION_P.
1294 * decl.c (start_preparsed_function): Call start_lambda_scope.
1295 (finish_function): Call finish_lambda_scope.
1296 * init.c (get_nsdmi): Call start/finish_lambda_scope.
1297 * lambda.c (start_lambda_scope): Only ignore VAR_DECL in a function.
1298 * parser.c (cp_parser_function_definition_after_declarator): Don't
1299 call start/finish_lambda_scope.
1300 * pt.c (retrieve_specialization): Ignore lambda functions in
1302 (find_parameter_packs_r): Ignore capture proxies. Look into
1304 (check_for_bare_parameter_packs): Allow bare packs in lambdas.
1305 (tsubst_default_argument): Call start/finish_lambda_scope.
1306 (tsubst_function_decl): Handle lambda functions differently.
1307 (tsubst_template_decl): Likewise.
1308 (tsubst_expr) [DECL_EXPR]: Skip closure declarations and capture
1310 (tsubst_lambda_expr): Create a new closure rather than instantiate
1311 the one from the template.
1312 (tsubst_copy_and_build): Don't register a specialization of a pack.
1313 (regenerate_decl_from_template): Call start/finish_lambda_scope.
1314 (instantiate_decl): Remove special lambda function handling.
1315 * semantics.c (process_outer_var_ref): Remove special generic lambda
1316 handling. Don't implicitly capture in a lambda in a template. Look
1317 for an existing proxy.
1318 * class.c (current_nonlambda_class_type): Use decl_type_context.
1320 * cp-tree.h (LAMBDA_EXPR_CLOSURE): Use TREE_TYPE.
1321 (LAMBDA_EXPR_RETURN_TYPE): Remove.
1322 (struct tree_lambda_expr): Remove closure and return_type fields.
1323 * lambda.c (build_lambda_expr): Don't set LAMBDA_EXPR_RETURN_TYPE.
1324 * pt.c (tsubst_copy_and_build): Likewise.
1325 * parser.c (cp_parser_lambda_declarator_opt): Track return type.
1326 (cp_parser_lambda_body): Adjust unspecified return type check.
1327 * ptree.c (cxx_print_lambda_node): Don't print closure or
1330 PR c++/80935 - wrong C++17 error with lambda
1331 * decl.c (check_for_uninitialized_const_var): Check
1332 is_instantiation_of_constexpr.
1333 * constexpr.c (ensure_literal_type_for_constexpr_object): Check
1334 is_instantiation_of_constexpr.
1335 (potential_constant_expression_1): Check var_in_maybe_constexpr_fn.
1337 * lambda.c (build_lambda_object): Check for error_mark_node.
1338 * pt.c (make_pack_expansion): Set PACK_EXPANSION_LOCAL_P on the type
1340 (tsubst_decl) [FUNCTION_DECL]: Set DECL_CONTEXT on the parameters.
1341 (tsubst) [TEMPLATE_PARM_INDEX]: Check for error_mark_node.
1343 PR c++/80767 - unnecessary instantiation of generic lambda
1344 * call.c (convert_like_real): Call build_user_type_conversion_1 if
1346 (add_conv_candidate): Build a ck_user conversion with no candidate.
1348 Fix lambdas in template default argument of inherited ctor.
1349 * method.c (synthesized_method_base_walk): Replace an inherited
1350 template with its specialization.
1351 (synthesized_method_walk): Make inheriting_ctor a pointer.
1352 (maybe_explain_implicit_delete, explain_implicit_non_constexpr)
1353 (deduce_inheriting_ctor, implicitly_declare_fn): Adjust.
1355 * pt.c (build_deduction_guide): Set DECL_ABSTRACT_ORIGIN on the
1356 template, not the function.
1357 (template_guide_p): Adjust.
1359 Support copying local_specializations.
1360 * cp-tree.h (enum lss_policy): New.
1361 (local_specialization_stack): Add policy parameter to default ctor.
1362 * pt.c (local_specialization_stack): Copy local_specializations if
1365 * constexpr.c (potential_constant_expression_1): Add "now" parm.
1366 (is_constant_expression, require_constant_expression): New.
1367 (is_static_init_expression, is_nondependent_constant_expression)
1368 (is_nondependent_static_init_expression): Drop "potential".
1369 * except.c (build_must_not_throw_expr): Do type conversion on
1370 value-dependent argument.
1371 * pt.c, semantics.c, typeck2.c: Use variants without "potential".
1373 Instantiate default arguments/member initializers once.
1374 * init.c (get_nsdmi): Remember NSDMI instantiations.
1375 * parser.c (inject_this_parameter): Be more picky about
1377 * pt.c (tsubst_copy): Simplify 'this' handling.
1378 (tsubst_default_argument): Remember default argument
1379 instantiations. Take parameter number.
1380 (tsubst_default_arguments): Pass it.
1381 * call.c (convert_default_arg): Likewise.
1383 Fix default argument conversion failure and SFINAE.
1384 * call.c (build_over_call): Check convert_default_arg result for
1386 * parser.c (cp_parser_late_parsing_default_args): Remember
1389 2017-08-28 Nathan Sidwell <nathan@acm.org>
1391 * cp-tree.h (lang_type): Replace sorted_fields vector with
1393 (CLASSTYPE_SORTED_FIELDS): Delete.
1394 (CLASSTYPE_BINDINGS): New.
1395 * decl.c (finish_enum_value_list): Swap args of
1396 insert_late_enum_def_bindings.
1397 * name-lookup.c (lookup_field_1): Replace binary search of sorted
1398 fields with map->get.
1399 (sorted_fields_type_new, count_fields,
1400 add_fields_to_record_type, add_enum_fields_to_record_type): Delete.
1401 (add_class_member, add_class_members): New.
1402 (set_class_bindings): Create map and insert.
1403 (insert_late_enum_def_binding): Swap parms. Use add_clasS_member.
1404 * ptree.c (cxx_print_type): Delete sorted fields printing.
1406 * cp-tree.h (insert_late_enum_def_into_classtype_sorted_fields):
1408 * name-lookup.h (set_class_bindings,
1409 insert_late_enum_def_bindings): Declare.
1410 * decl.c (finish_enum_value_list): Adjust for
1411 insert_late_enum_def_bindings name change.
1412 * class.c (finish_struct_1): Call set_class_bindings.
1413 (count_fields, add_fields_to_record_type,
1414 add_enum_fields_to_record_type, sorted_fields_type_new,
1415 insert_into_classtype_sorted_fields,
1416 insert_late_enum_def_into_classtype_sorted_fields): Move to ...
1417 * name-lookup.h (count_fields, add_fields_to_record_type,
1418 add_enum_fields_to_record_type, sorted_fields_type_new,
1419 set_class_bindings, insert_late_enum_def_bindings): ... here.
1421 2017-08-25 Nathan Sidwell <nathan@acm.org>
1423 * class.c (method_name_cmp, resort_method_name_cmp): Methods
1426 Conversion operators have a special name
1427 * cp-tree.h (CPTI_CONV_OP_MARKER, CPTI_CONV_OP_IDENTIFIER): New.
1428 (conv_op_marker, conv_op_identifier): New.
1429 (CLASSTYPE_FIRST_CONVERSION_SLOT): Delete.
1430 * decl.c (initialize_predefined_identifiers): Add
1432 (cxx_init_decl_processing): Create conv_op_marker.
1433 * decl2.c (check_classfn): Lookup conv-ops by name.
1434 * class.c (add_method): Use conv_op_identifier & conv_op_marker.
1435 (resort_type_method_vec): Don't skip conv-ops.
1436 (finish_struct_methods, warn_hidden): Likewise.
1437 * name-lookup.h (lookup_all_conversions): Delete.
1438 * name-lookup.c (lookup_conversion_operator): Replace with ...
1439 (extract_conversion_operator): ... this.
1440 (lookup_fnfields_slot_nolazy): Find conv-ops by name.
1441 (lookup_all_conversions): Delete.
1442 * pt.c (check_explicit_specialization): Find conv-ops by name.
1443 * search.c (lookup_conversions_r): Likewise.
1445 2017-08-24 Nathan Sidwell <nathan@acm.org>
1447 Conversion operators kept on single overload set
1448 * class.c (add_method): Keep all conv-ops on one slot.
1449 * name-lookup.c (lookup_conversion_operator): Pull the desired
1450 conv op out of overload set.
1451 * search.c (lookup_conversions_r): Lose template/non-template
1453 (lookup_conversions): Likewise.
1455 2017-08-23 Nathan Sidwell <nathan@acm.org>
1457 * cp-tree.h (lookup_field_1, lookup_fnfields_slot,
1458 lookup_fnfields_slot_nolazy, lookup_all_conversions): Move
1460 * name-lookup.h (lookup_field_1, lookup_fnfields_slot,
1461 lookup_fnfields_slot_nolazy, lookup_all_conversions): ... here.
1462 * search.c (lookup_conversion_operator,
1463 lookup_fnfields_slot_nolazy, lookup_field_1, lookup_fnfields_slot,
1464 lookup_all_conversions): Move to ...
1465 * name-lookup.c (lookup_conversion_operator,
1466 lookup_fnfields_slot_nolazy, lookup_field_1, lookup_fnfields_slot,
1467 lookup_all_conversions): ... here.
1469 * semantics.c (finish_member_declaration): Move USING_DECL check
1470 earlier. Always set C++ linkage. Commonize TYPE_FIELD and
1471 template decl list insertion.
1473 * cp-tree.h (maybe_version_functions): Declare.
1474 * decl.c (decls_match): Break function versioning check to
1475 separate function. Call it.
1476 (maybe_version_functions): Broken out of decls_match.
1477 * class.c (add_method): Use maybe_version_functions.
1479 * cp-tree.h (print_search_statistics,
1480 reinit_search_statistics): Don't declare.
1481 * search.c (n_fields_searched, n_calls_lookup_field,
1482 n_calls_lookup_field_1, n_calls_lookup_fnfields,
1483 n_calls_lookup_fnfields_1, n_calls_get_base_type,
1484 n_outer_fields_searched, n_contexts_saved): Delete.
1485 (lookup_field_1, lookup_member,
1486 lookup_fnfields_slot_nolazy): Remove stat gathering.
1487 (print_search_statistics, reinit_search_statistics): Delete.
1488 * tree.c (cxx_print_statistics): Don't print search stats.
1490 2017-08-21 Nathan Sidwell <nathan@acm.org>
1492 * search.c (lookup_field_r): Remove obsolete code for type-named
1495 * search.c (lookup_field_1): Assert TYPE is a class and VFIELD
1497 (lookup_field_fuzzy_info::fuzzy_lookup_fnfields): Delete.
1498 (lookup_field_fuzzy_r): Adjust.
1500 2017-08-21 David Malcolm <dmalcolm@redhat.com>
1502 * call.c (build_over_call): Pass NULL for new parameter to
1503 check_function_arguments.
1504 * typeck.c (cp_build_function_call_vec): Likewise.
1506 2017-08-21 Nathan Sidwell <nathan@acm.org>
1509 * pt.c (instantiate_class_template_1):
1510 BOUND_TEMPLATE_TEMPLATE_PARM is never friend-injected.
1512 2017-08-18 David Malcolm <dmalcolm@redhat.com>
1515 * name-lookup.c (maybe_suggest_missing_header): Convert return
1516 type from void to bool; return true iff a suggestion was offered.
1517 (suggest_alternative_in_explicit_scope): Move call to
1518 maybe_suggest_missing_header to before use of best_match, and
1519 return true if the former offers a suggestion.
1521 2017-08-18 H.J. Lu <hongjiu.lu@intel.com>
1524 * decl.c (duplicate_decls): Also merge DECL_WARN_IF_NOT_ALIGN.
1525 * decl2.c (grokbitfield): Don't allow bit-field with
1526 warn_if_not_aligned type.
1528 2017-08-17 Nathan Sidwell <nathan@acm.org>
1530 * cp-tree.def (TEMPLATE_TEMPLATE_PARM): Remove stale comment.
1531 * cp-tree.h (ENUM_TEMPLATE_INFO): Delete.
1532 (TYPE_TEMPLATE_INFO): Simplify.
1533 (SET_TYPE_TEMPLATE_INFO): Simplify.
1535 * lex.c (maybe_add_lang_type_raw): BOUND_TEMPLATE_TEMPLATE_PARMs
1536 don't need lang_type.
1537 (cxx_make_type): Use maybe_add_lang_type_raw return value.
1538 * mangle.c (CLASSTYPE_TEMPLATE_ID_P): Don't rely on
1541 * cp-tree.h (struct lang_type): Remove template_info field.
1542 (CLASSTYPE_TEMPLATE_INFO): Use TYPE_LANG_SLOT_1.
1543 (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO): Likewise.
1545 2017-08-14 Martin Sebor <msebor@redhat.com>
1548 * error.c (cp_printer): Handle 'G'.
1550 2017-08-11 Martin Liska <mliska@suse.cz>
1552 * decl2.c (get_tls_init_fn): Replace ASM_OUTPUT_DEF with
1553 TARGET_SUPPORTS_ALIASES.
1554 (handle_tls_init): Likewise.
1555 (note_mangling_alias): Likewise. Remove ATTRIBUTE_UNUSED for
1557 * optimize.c (can_alias_cdtor): Likewise.
1559 2017-08-11 Jason Merrill <jason@redhat.com>
1561 PR c++/81671 - nullptr_t template parameter
1562 * pt.c (convert_nontype_argument): Fix nullptr_t check.
1564 2017-08-10 Jason Merrill <jason@redhat.com>
1566 PR c++/81359 - Unparsed NSDMI error from SFINAE context.
1567 * method.c (synthesized_method_walk): Don't diagnose lack of
1570 PR c++/80452 - Core 1579, implicit move semantics on return/throw
1571 * cp-tree.h (LOOKUP_PREFER_RVALUE): Now means that we've already
1572 tentatively changed the lvalue to an rvalue.
1573 * call.c (reference_binding): Remove LOOKUP_PREFER_RVALUE handling.
1574 (build_over_call): If LOOKUP_PREFER_RVALUE, check that the first
1575 parameter is an rvalue reference.
1576 * except.c (build_throw): Do maybe-rvalue overload resolution twice.
1577 * typeck.c (check_return_expr): Likewise.
1579 2017-08-10 David Malcolm <dmalcolm@redhat.com>
1581 * parser.c (cp_parser_error): Update for new param to
1583 (class token_pair): New class.
1584 (struct matching_paren_traits): New struct.
1585 (matching_parens): New typedef.
1586 (struct matching_brace_traits): New struct.
1587 (matching_braces): New typedef.
1588 (cp_parser_statement_expr): Convert explicit parsing of
1589 CPP_OPEN_PAREN and CPP_CLOSE_PAREN to use of
1590 class matching_parens, so that the pertinent open parenthesis is
1591 highlighted when there are problems locating the close
1593 (cp_parser_primary_expression): Likewise.
1594 (cp_parser_compound_literal_p): Remove consumption of opening
1596 (cp_parser_postfix_expression): Convert explicit parsing of
1597 CPP_OPEN_PAREN and CPP_CLOSE_PAREN to use matching parens, as
1598 above. Use it to consume the opening paren previously consumed by
1599 cp_parser_compound_literal_p.
1600 (cp_parser_parenthesized_expression_list): Likewise.
1601 (cp_parser_unary_expression): Likewise.
1602 (cp_parser_new_expression): Likewise.
1603 (cp_parser_cast_expression): Likewise.
1604 (cp_parser_builtin_offsetof): Likewise.
1605 (cp_parser_trait_expr): Likewise.
1606 (cp_parser_lambda_declarator_opt): Likewise.
1607 (cp_parser_lambda_body): Likewise, for matching_braces.
1608 (cp_parser_compound_statement): Likewise.
1609 (cp_parser_selection_statement): Likewise, for matching_parens.
1610 (cp_parser_iteration_statement): Likewise.
1611 (cp_parser_already_scoped_statement): Likewise, for
1613 (cp_parser_linkage_specification): Likewise.
1614 (cp_parser_static_assert): Likewise, for matching_parens.
1615 (cp_parser_decltype): Likewise.
1616 (cp_parser_operator): Likewise.
1617 (cp_parser_enum_specifier): Likewise.
1618 (cp_parser_namespace_definition): Likewise.
1619 (cp_parser_direct_declarator): Likewise.
1620 (cp_parser_braced_list): Likewise.
1621 (cp_parser_class_specifier_1): Likewise, for matching_braces.
1622 (cp_parser_constant_initializer): Likewise.
1623 (cp_parser_noexcept_specification_opt): Likewise, for
1625 (cp_parser_exception_specification_opt): Likewise.
1626 (cp_parser_handler): Likewise.
1627 (cp_parser_asm_specification_opt): Likewise.
1628 (cp_parser_asm_operand_list): Likewise.
1629 (cp_parser_gnu_attributes_opt): Likewise.
1630 (cp_parser_std_attribute_spec): Likewise.
1631 (cp_parser_requirement_parameter_list): Likewise.
1632 (cp_parser_requirement_body): Likewise, for matching_braces.
1633 (cp_parser_compound_requirement): Likewise.
1634 (cp_parser_template_introduction): Likewise.
1635 (cp_parser_sizeof_pack): Likewise, for matching_parens.
1636 (cp_parser_sizeof_operand): Likewise; use it to consume the
1637 opening paren previously consumed by cp_parser_compound_literal_p.
1638 (get_matching_symbol): New function.
1639 (cp_parser_required_error): Add param "matching_location". Remove
1640 calls to cp_parser_error, instead setting a non-NULL gmsgid, and
1641 handling it if set by calling c_parse_error, potentially with a
1642 secondary location if matching_location was set.
1643 (cp_parser_require): Add param "matching_location", with a default
1644 value of UNKNOWN_LOCATION.
1645 (cp_parser_require_keyword): Update for new param of
1646 cp_parser_required_error.
1647 (cp_parser_objc_encode_expression): Update to class matching_parens
1649 (cp_parser_objc_defs_expression): Likewise.
1650 (cp_parser_objc_protocol_expression): Likewise.
1651 (cp_parser_objc_selector_expression): Likewise.
1652 (cp_parser_objc_typename): Likewise.
1653 (cp_parser_objc_superclass_or_category): Likewise.
1654 (cp_parser_objc_try_catch_finally_statement): Likewise.
1655 (cp_parser_objc_synchronized_statement): Likewise.
1656 (cp_parser_objc_at_property_declaration): Likewise.
1657 (cp_parser_oacc_single_int_clause): Likewise.
1658 (cp_parser_oacc_shape_clause): Likewise.
1659 (cp_parser_omp_clause_collapse): Likewise.
1660 (cp_parser_omp_clause_default): Likewise.
1661 (cp_parser_omp_clause_final): Likewise.
1662 (cp_parser_omp_clause_if): Likewise.
1663 (cp_parser_omp_clause_num_threads): Likewise.
1664 (cp_parser_omp_clause_num_tasks): Likewise.
1665 (cp_parser_omp_clause_grainsize): Likewise.
1666 (cp_parser_omp_clause_priority): Likewise.
1667 (cp_parser_omp_clause_hint): Likewise.
1668 (cp_parser_omp_clause_defaultmap): Likewise.
1669 (cp_parser_omp_clause_ordered): Likewise.
1670 (cp_parser_omp_clause_schedule): Likewise.
1671 (cp_parser_omp_clause_num_teams): Likewise.
1672 (cp_parser_omp_clause_thread_limit): Likewise.
1673 (cp_parser_omp_clause_aligned): Likewise.
1674 (cp_parser_omp_clause_linear): Likewise.
1675 (cp_parser_omp_clause_safelen): Likewise.
1676 (cp_parser_omp_clause_simdlen): Likewise.
1677 (cp_parser_omp_clause_depend): Likewise.
1678 (cp_parser_omp_clause_device): Likewise.
1679 (cp_parser_omp_clause_dist_schedule): Likewise.
1680 (cp_parser_oacc_clause_async): Likewise.
1681 (cp_parser_omp_critical): Likewise.
1682 (cp_parser_omp_for_loop): Likewise.
1683 (cp_parser_omp_sections_scope): Likewise.
1684 (cp_parser_omp_declare_reduction_exprs): Likewise.
1685 Update for new param to cp_parser_required_error.
1686 (cp_parser_oacc_routine): Likewise.
1687 (cp_parser_transaction_expression): Likewise.
1688 (cp_parser_cilk_simd_vectorlength): Likewise.
1690 2017-08-09 Jason Merrill <jason@redhat.com>
1692 PR c++/81525 - wrong constant value with generic lambda
1693 * pt.c (tsubst_decl) [VAR_DECL]: Avoid clobbering auto.
1694 (tsubst_copy) [VAR_DECL]: Handle auto.
1696 PR c++/81359 - Unparsed NSDMI error from SFINAE context.
1697 * init.c (get_nsdmi): Add complain parm.
1698 * typeck2.c (digest_nsdmi_init): Add complain parm.
1699 (process_init_constructor_record): Pass complain to get_nsdmi.
1700 * pt.c (maybe_instantiate_noexcept): Add complain parm, return bool.
1701 * method.c (get_defaulted_eh_spec): Add complain parm. Pass it into
1702 synthesized_method_walk.
1703 (synthesized_method_walk): Adjust.
1704 (walk_field_subobs): Pass complain to get_nsdmi.
1705 (defaulted_late_check): Skip other checks if deleted.
1706 * decl2.c (mark_used): Pass complain to maybe_instantiate_noexcept.
1707 * call.c (build_aggr_conv): Pass complain to get_nsdmi.
1708 * parser.c (defarg_location): New.
1709 * error.c (location_of): Use it.
1711 2017-08-09 Marek Polacek <polacek@redhat.com>
1713 * parser.c (cp_parser_perform_range_for_lookup): Use false instead of 0.
1714 * typeck.c (build_binary_op): Change the type of a parameter to bool.
1715 (cp_truthvalue_conversion): Use true instead of 1.
1717 2017-08-08 Marek Polacek <polacek@redhat.com>
1720 * cp-gimplify.c (cp_fold): If folding exposed a branch of
1721 a COND_EXPR, convert it to the original type of the COND_EXPR, if
1724 2017-08-08 Martin Liska <mliska@suse.cz>
1726 * call.c: Include header files.
1727 * cp-gimplify.c: Likewise.
1728 * cp-ubsan.c: Likewise.
1731 * search.c: Likewise.
1732 * semantics.c: Likewise.
1733 * typeck.c: Likewise.
1735 2017-08-07 Martin Liska <mliska@suse.cz>
1737 * parser.c (cp_parser_gnu_attribute_list): Canonicalize name of an
1739 (cp_parser_std_attribute): Likewise.
1740 * tree.c: Add new include.
1742 2017-08-04 Paolo Carlini <paolo.carlini@oracle.com>
1745 * pt.c (do_class_deduction): Handle the case of no viable implicit
1746 deduction guides; simplify the code generating implicit deduction
1749 2017-08-03 Paolo Carlini <paolo.carlini@oracle.com>
1752 * typeck.c (build_x_unary_op): Avoid pretty-printing constructor /
1753 destructor as expressions.
1755 2017-08-02 Jakub Jelinek <jakub@redhat.com>
1758 * call.c (build_user_type_conversion_1): Only call
1759 lookup_fnfields_slot if totype is CLASS_TYPE_P.
1761 2017-07-31 Jason Merrill <jason@redhat.com>
1763 * decl.c (declare_global_var): Set DECL_CONTEXT.
1765 2017-07-31 Jan Hubicka <hubicka@ucw.cz>
1766 Martin Liska <mliska@suse.cz>
1768 * pt.c (tsubst_copy): Copy PREDICT_EXPR.
1769 * semantics.c (finish_goto_stmt): Build gimple predict
1771 * constexpr.c (potential_constant_expression_1): Handle
1774 2017-07-31 Martin Liska <mliska@suse.cz>
1777 * cp-gimplify.c (cp_genericize): Guard condition with flag_sanitize_p
1778 also with current_function_decl non-null equality.
1779 * cp-ubsan.c (cp_ubsan_instrument_vptr_p): Likewise.
1780 * decl.c (compute_array_index_type): Likewise.
1781 * init.c (finish_length_check): Likewise.
1782 * typeck.c (cp_build_binary_op): Likewise.
1784 2017-07-29 Jakub Jelinek <jakub@redhat.com>
1786 * cp-objcp-common.c (cp_decl_dwarf_attribute): Handle
1787 DW_AT_export_symbols.
1788 * name-lookup.c (emit_debug_info_using_namespace): Add IMPLICIT
1789 argument, pass it through to the debug hook.
1790 (finish_namespace_using_directive): Adjust
1791 emit_debug_info_using_namespace caller.
1792 (push_namespace): Likewise. Call it after setting
1793 DECL_NAMESPACE_INLINE_P.
1794 (cp_emit_debug_info_for_using): Pass false as new argument to
1795 the imported_module_or_decl debug hook.
1797 2017-07-28 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
1799 * lex.c (copy_decl): Adjust.
1800 (copy_type): Likewise.
1802 2017-07-26 Paolo Carlini <paolo.carlini@oracle.com>
1805 * lambda.c (add_capture): Early return if we cannot capture by
1808 2017-07-26 Jason Merrill <jason@redhat.com>
1810 P0702R1 - List deduction of vector.
1811 * pt.c (do_class_deduction): Special-case deduction from a single
1812 element of related type.
1814 2017-07-26 Leonid Koppel <lkoppel@uwaterloo.ca>
1816 PR c++/67054 - Inherited ctor with non-default-constructible members
1817 * method.c (walk_field_subobs) Consider member initializers (NSDMIs)
1818 when deducing an inheriting constructor.
1820 2017-07-21 Nathan Sidwell <nathan@acm.org>
1822 * search.c (lookup_conversion_operator): Return overloads.
1823 (lookup_fnfields_idx_nolazy): Absorb into ...
1824 (lookup_fnfields_slot_nolaxy): ... here.
1825 (lookup_fnfields_1): Absorb into ...
1826 (lookup_fnfields_slot): ... here.
1828 Remove special CDtor METHOD_VEC slots.
1829 * cp-tree.h (CLASSTYPE_CONSTRUCTOR_SLOT,
1830 CLASSTYPE_DESTRUCTOR_SLOT): Delete.
1831 (CLASSTYPE_CONSTRUCTORS): Use lookup_fnfields_slot_nolazy.
1832 (CLASSTYPE_DESTRUCTOR): Likewise.
1833 * class (add_method): Don't use special cdtor slots.
1834 * search.c (lookup_fnfields_idx_nolazy): Likewise.
1835 (look_for_overrides_here): Use lookup_fnfields_slot.
1836 * semantics (classtype_has_nothrow_assign_or_copy_p): Likewise.
1838 * call.c (add_candidates): Move decls to initialization. Don't
1841 2017-07-20 Nathan Sidwell <nathan@acm.org>
1843 Remove TYPE_METHODS.
1844 * class.c (maybe_warn_about_overly_private_class,
1845 finish_struct_methods, one_inheriting_sig, count_fields,
1846 add_fields_to_record_type, check_field_decls, check_methods,
1847 clone_function_decl, set_method_tm_attributes,
1848 finalize_literal_type_property, check_bases_and_members,
1849 create_vtable_ptr, determine_key_method,
1850 unreverse_member_declarations, finish_struct,
1851 add_vcall_offset_vtbl_entries_1): Member fns are on TYPE_FIELDS.
1852 * decl.c (fixup_anonymous_aggr): Likewise.
1853 * decl2.c (reset_type_linkage_2): Likewise.
1854 * method.c (after_nsdmi_defaulted_late_checks,
1855 lazily_declare_fn): Likewise.
1856 * optimize.c (maybe_thunk_body, maybe_clone_body): Likewise.
1857 * pt.c (instantiate_class_template_1, tsubst_expr,
1858 do_type_instantiation, instantiate_pending_templates): Likewise.
1859 * search.c (lookup_field_1): Likewise.
1860 * semantics.c (finish_member_declaration,
1861 finish_omp_declare_simd_methods): Likewise.
1863 2017-07-19 Nathan Sidwell <nathan@acm.org>
1865 * class.c (add_implicitly_declared_members): Use
1866 classtype_has_move_assign_or_move_ctor_p.
1867 (classtype_has_move_assign_or_move_ctor,
1868 classtype_has_user_move_assign_or_move_ctor_p): Merge into ...
1869 (classtype_has_move_assign_or_move_ctor_p): ... this new function.
1870 * cp-tree.h (classtype_has_user_move_assign_or_move_ctor_p):
1872 (classtype_has_move_assign_or_move_ctor_p): ... this.
1873 * method.c (maybe_explain_implicit_delete, lazily_declare_fn): Adjust.
1874 * tree.c (type_has_nontrivial_copy_init): Adjust.
1876 * cp-tree.h (PACK_EXPANSION_PARAMETER_PACKS,
1877 PACK_EXPANSION_EXTRA_ARGS): Use TYPE_{MIN,MAX}_VALUE_RAW.
1879 2017-07-18 Nathan Sidwell <nathan@acm.org>
1881 * cp-array-notation.c (build_array_notation_ref): Use
1882 TYPE_{MIN,MAX}_VALUE.
1884 * class.c (classtype_has_move_assign_or_move_ctor): Declare.
1885 (add_implicitly_declared_members): Use it.
1886 (type_has_move_constructor, type_has_move_assign): Merge into ...
1887 (classtype_has_move_assign_or_move_ctor): ... this new function.
1888 * cp-tree.h (type_has_move_constructor, type_has_move_assign): Delete.
1890 2017-07-17 Volker Reichelt <v.reichelt@netcologne.de>
1892 * parser.c (cp_parser_decl_specifier_seq): Add fix-it hints for
1893 friend outside class and obsolete auto as storage-class-specifier.
1895 2017-07-17 Nathan Sidwell <nathan@acm.org>
1897 * class.c (maybe_warn_about_overly_private_class): Ignore public
1900 * class.c (type_has_user_declared_move_constructor,
1901 type_has_user_declared_move_assign): Combine into ...
1902 (classtype_has_user_move_assign_or_move_ctor_p): ... this new function.
1903 * cp-tree.h (type_has_user_declared_move_constructor,
1904 type_has_user_declared_move_assign): Combine into ...
1905 (classtype_has_user_move_assign_or_move_ctor_p): ... this. Declare.
1906 * method.c (maybe_explain_implicit_delete): Use it.
1907 (lazily_declare_fn): Use it.
1908 * tree.c (type_has_nontrivial_copy_init): Use it.
1910 * semantics.c (classtype_has_nothrow_assign_or_copy_p): Clarify
1911 semantics, simplify implementation.
1913 2017-07-16 Volker Reichelt <v.reichelt@netcologne.de>
1915 * parser.c (cp_parser_cast_expression): Use %q#T instead of %qT
1916 in old-style cast diagnostic.
1917 * typeck.c (maybe_warn_about_useless_cast): Use %q#T instead of %qT
1918 in useless cast diagnostic.
1919 * error.c (type_to_string): Remove enum special handling.
1921 2017-07-14 David Malcolm <dmalcolm@redhat.com>
1923 * name-lookup.c (get_std_name_hint): Add '<' and '>' around
1925 (maybe_suggest_missing_header): Update for addition of '<' and '>'
1926 to above. Provide a fix-it hint.
1927 * pt.c: Include "gcc-rich-location.h"
1928 (listify): Attempt to add fix-it hint for missing
1929 #include <initializer_list>.
1930 * rtti.c: Include "gcc-rich-location.h".
1931 (typeid_ok_p): Attempt to add fix-it hint for missing
1932 #include <typeinfo>.
1934 2017-07-12 Jason Merrill <jason@redhat.com>
1936 P0512R0 - Deduction from an initializer list.
1937 * pt.c (do_class_deduction): Do list deduction in two phases.
1939 2017-07-12 Nathan Sidwell <nathan@acm.org>
1941 * cp-tree.h (DECL_CONSTRUCTOR_P, DECL_MAYBE_IN_CHARGE_CONSTRUCTOR,
1942 DECL_DESTRUCTOR_P, DECL_MAYBE_IN_CHARGE_DESTRCTOR): Look at
1944 * decl.c (grokfndecl): Set DECL_CXX_CONSTRUCTOR and
1945 DECL_CXX_DESTRUCTOR explicitly.
1946 * decl2.c (grokclassfn): Likewise.
1947 * friend.c (do_friend): Likewise.
1948 * method.c (make_thunk, make_alias_for,
1949 implicitly_declare_fn): Likewise.
1951 2017-07-11 Jason Merrill <jason@redhat.com>
1954 * decl.c (grokparms): Downgrade error about array of unknown bound
1955 to pedwarn and disable it for C++17.
1957 2017-07-11 Nathan Sidwell <nathan@acm.org>
1959 * decl2.c (reset_type_linkage_2): Dont't change ctor name.
1961 2017-07-10 Martin Sebor <msebor@redhat.com>
1963 * cp-tree.h (cp_operator_id, cp_assignment_operator_id): Document.
1965 2017-07-06 Jason Merrill <jason@redhat.com>
1967 PR c++/81204 - parse error with dependent template-name
1968 * parser.c (cp_parser_lookup_name): Revert previous change.
1970 2017-07-06 David Malcolm <dmalcolm@redhat.com>
1972 * cp-lang.c (LANG_HOOKS_RUN_LANG_SELFTESTS): Define as
1973 selftest::run_cp_tests.
1974 (selftest::run_cp_tests): New function.
1975 * cp-tree.h (selftest::run_cp_tests): New decl.
1977 2017-07-04 Jakub Jelinek <jakub@redhat.com>
1979 * parser.c (cp_parser_decomposition_declaration): Replace
1980 decomposition declaration with structured binding in diagnostics.
1981 * decl.c (cp_finish_decomp): Likewise.
1982 (grokdeclarator): Likewise.
1985 * parser.c (cp_parser_decomposition_declaration): Diagnose invalid
1986 forms of structured binding initializers.
1988 2017-07-03 Paolo Carlini <paolo.carlini@oracle.com>
1991 * decl.c (grokdeclarator): Move checks on function return type after
1992 the splice_late_return_type call; if declspecs->locations[ds_type_spec]
1993 is UNKNOWN_LOCATION fall back to input_location.
1995 2017-07-03 David Malcolm <dmalcolm@redhat.com>
1997 * parser.c (enum required_token): Fix spelling of
1998 RT_INTERATION to RT_ITERATION.
1999 (cp_parser_iteration_statement): Likewise.
2000 (cp_parser_required_error): Likewise.
2002 2017-06-30 Jason Merrill <jason@redhat.com>
2004 PR c++/81257 - ICE with invalid ::template.
2005 PR c++/54769 - wrong lookup of dependent template-name.
2006 * parser.c (cp_parser_template_name): Revert part of last change.
2008 2017-06-30 Nathan Sidwell <nathan@acm.org>
2010 * config-lang.in (gtfiles): Add cp/lex.c.
2011 * cp-tree.h (mangle_convop_name_for_type): Rename ...
2012 (make_conv_op_name): ... here. Move to lex.
2013 * lambda.c (maybe_add_lambda_conv_op): Update.
2014 * parser.c (cp_parser_conversion_function_id): Update.
2015 * pt.c (tsubst_decl, tsubst_baselink, tsubst_copy,
2016 tsubst_copy_and_build): Update.
2017 * semantics.c (apply_deduced_return_type): Update.
2018 * mangle.c (conv_type_hasher, conv_type_names,
2019 mangle_conv_op_name_for_type): Move to ...
2020 * lex.c (conv_type_hasher, conv_type_names, make_convop_name):
2023 2017-06-30 David Malcolm <dmalcolm@redhat.com>
2026 * parser.c (cp_parser_postfix_expression): Construct a location
2027 for typeid expressions.
2029 2017-06-30 Nathan Sidwell <nathan@acm.org>
2031 * cp-tree.h (lookup_fnfields_1, class_method_index_for_fn): Don't
2033 (lookup_all_conversions): Declare.
2034 * class.c (get_basefndecls): Use lookup_fnfields_slot.
2035 * decl.c (register_dtor_fn): Use lookup_fnfields_slot.
2036 * decl2.c (check_class_fn): Use lookup_fnfields_slot. Rework
2038 * pt.c (retrieve_specialization): Use lookup_fnfields_slot.
2039 (check_explicit_specialization): Use lookup_fnfields_slot_nolazy,
2040 lookup_all_conversions.
2041 * search.c (lookup_fnfields_1): Make static.
2042 (lookup_all_conversions): New.
2043 (class_method_index_for_fn): Delete.
2044 * semantics.c (classtype_has_nothrow_assign_or_copy_p): Use
2045 lookup_fnfields_slot.
2047 * call.c (build_new_method_call_1): Use constructo_name to get
2048 ctor name. Move argument processing earlier to merge cdtor
2050 * decl.c (grokfndecl): Cdtors have special names.
2051 * method.c (implicitly_declare_fn): Likewise. Simplify flag setting.
2052 * pt.c (check_explicit_specialization): Cdtor name is already
2054 * search.c (class_method_index_for_fn): Likewise.
2057 * name-lookup.c (do_pushdecl): Reset IDENTIFIER_TYPE when finding
2058 a matching TYPE_DECL.
2060 2017-06-29 Paolo Carlini <paolo.carlini@oracle.com>
2062 * class.c (add_method): Change pair of errors to error + inform.
2063 (handle_using_decl): Likewise.
2065 2017-06-29 Jason Merrill <jason@redhat.com>
2067 * constexpr.c, error.c, tree.c: Remove WITH_CLEANUP_EXPR handling.
2069 PR c++/81180 - ICE with C++17 deduction of member class template.
2070 * pt.c (build_deduction_guide): Correct member template handling.
2072 PR c++/81188 - matching decltype of member function call.
2073 * tree.c (cp_tree_equal): Remove COMPONENT_REF special case.
2075 2017-06-29 Nathan Sidwell <nathan@acm.org>
2078 * parser.c (cp_parser_namespace_definition): Immediately close the
2079 namespace if there's no open-brace.
2080 * name-lookup.c (do_pushdecl): Reset OLD when pushing into new
2083 2017-06-29 Jason Merrill <jason@redhat.com>
2085 PR c++/81164 - ICE with invalid inherited constructor.
2086 * search.c (binfo_direct_p): New.
2087 * name-lookup.c (do_class_using_decl): Use it.
2089 2017-06-29 Nathan Sidwell <nathan@acm.org>
2091 * cp-tree.h (THIS_NAME, IN_CHARGE_NAME, VTBL_PTR_TYPE,
2092 VTABLE_DELTA_NAME, VTABLE_PFN_NAME): Delete.
2093 * decl.c (initialize_predefined_identifiers): Name cdtor special
2094 names consistently. Use literals for above deleted defines.
2095 (cxx_init_decl_processing): Use literal for vtbl_ptr_type name,
2097 * lex.c (maybe_add_lang_type_raw): Exit early, rather than use a
2100 * call.c (check_dtor_name): Use constructor_name for enums too.
2101 (build_new_method_call_1): Use constructor_name for cdtors and
2103 * class.c (build_self_reference): Use TYPE_NAME to get name of
2105 * name-lookup (constructor_name): Use DECL_NAME directly.
2106 (constructor_name_p): Reimplement.
2107 (push_class_level_binding_1): Use TYPE_NAME directly.
2109 * class.c (finish_struct): Use OVL_P.
2110 (get_vfield_name): Measure constructor_name length.
2111 * cp-tree.h (SET_CLASS_TYPE_P): Add RECORD_OR_UNION_CHECK.
2112 (NON_UNION_CLASS_TYPE_P): Check RECORD_TYPE up front.
2113 * cxx-pretty-print.c (is_destructor_name): Delete.
2114 (pp_cxx_unqualified_id): Remove bogus destructor name checking.
2115 * decl.c (grokfndecl): Move cheap checks first when looking for
2116 implicit extern cness.
2118 * parser.c (cp_parser_direct_declarator): Reorder if to avoid
2119 indentation. Remove unnecessary assignment of constructor name.
2121 Whitespace cleanups.
2122 * call.c (name_as_c_string): Move CONST_CAST to return.
2123 (build_new_method_call_1): Remove unneeded bracing.
2124 * class.c (include_empty_classes): Unbreak line.
2125 * constraint.cc (tsubst_check_constraint): Add space.
2126 * cp-tree.h (lang_decl_ns): Add comment.
2127 (PTRMEM_CST_MEMBER): Break line.
2128 * decl.c (grokfndecl): Add blank lines. Unbreak some others.
2129 (grokdeclarator): Remove lines, move declaration to first use.
2130 * decl2.c (decl_needed_p): Fix indentation.
2131 (c_parse_final_cleanups): Remove blank line.
2132 * method.c (implicitly_declare_fn): Move declaration to first use.
2133 * search.c (current_scope): Add blank lines.
2135 2017-06-28 Jason Merrill <jason@redhat.com>
2137 PR c++/72764 - ICE with invalid template typename.
2138 * decl.c (build_typename_type): No longer static.
2139 * tree.c (strip_typedefs): Use it instead of make_typename_type.
2141 PR c++/69300 - ICE with self-referential noexcept
2142 * pt.c (maybe_instantiate_noexcept): Check for recursion.
2144 PR c++/61022 - error with variadic template template parm
2145 * pt.c (convert_template_argument): Keep the TYPE_PACK_EXPANSION.
2147 PR c++/72801 - ICE with variadic partial specialization
2148 * pt.c (unify_pack_expansion): Use PACK_EXPANSION_EXTRA_ARGS.
2150 PR c++/55639 - partial specialization with ::template
2151 * parser.c (cp_parser_class_head): Handle ::template.
2153 PR c++/45976 - error with ::template in declarator.
2154 * pt.c (resolve_typename_type): Fix TEMPLATE_ID_EXPR handling.
2156 PR c++/54769 - wrong lookup of dependent template-name.
2157 * parser.c (cp_parser_template_name): Handle dependent object type.
2158 (cp_parser_nested_name_specifier_opt): Make template_keyword_p a
2160 (cp_parser_id_expression): Pass it.
2161 (cp_parser_diagnose_invalid_type_name): Handle TEMPLATE_ID_EXPR.
2163 * parser.c (cp_parser_template_id): Use the range location on the
2166 PR c++/81204 - parse error with dependent template-name
2167 * parser.c (cp_parser_lookup_name): Disqualify function templates
2170 2017-06-27 Nathan Sidwell <nathan@acm.org>
2172 * pt.c (tsubst_decl <FUNCTION_DECL>): Move var decls to
2173 initialization point. Don't unnecessarily check for ctor name.
2175 * cp-tree.h (CLASSTYPE_DESTRUCTORS): Rename to ...
2176 (CLASSTYPE_DESTRUCTOR): ... this.
2177 * class.c (accessible_nvdtor_p,
2178 maybe_warn_about_overly_private_class,
2179 add_implicitly_declared_members,
2180 clone_constructors_and_destructors, type_has_virtual_destructor):
2181 Adjust for CLASSTYPE_DESTRUCTOR.
2182 (deduce_noexcept_on_destructors): Absorb into ...
2183 (check_bases_and_members): ... here.
2184 * except.c (dtor_nothrow): Adjust for CLASSTYPE_DESTRUCTOR.
2185 * init.c (build_delete): Likewise.
2186 * parser.c (cp_parser_lookup_name): Likewise.
2187 * pt.c (check_explicit_specialization): Likewise.
2188 * rtti.c (emit_support_tinfos): Likewise.
2189 * search.c (lookup_fnfields_idx_nolazy): Likewise.
2191 Kill IDENTIFIER_TEMPLATE.
2192 * cp-tree.h (lang_identifier): Remove class_template_info field.
2193 (IDENTIFIER_TEMPLATE): Delete.
2194 * name-lookup.c (constructor_name_full): Subsume into ...
2195 (constructor_name): ... here. Don't check IDENTIFIER_TEMPLATE.
2196 (constructor_name_p): Likewise.
2197 * mangle.c (write_source_name): Likewise.
2198 * ptree.c (cxx_print_identifier): Likewise.
2200 2017-06-27 Marek Polacek <polacek@redhat.com>
2203 * parser.c (cp_parser_already_scoped_statement): Initialize
2206 2017-06-26 Jason Merrill <jason@redhat.com>
2208 PR c++/81215 - deduction failure with variadic TTP.
2209 * pt.c (unify_bound_ttp_args): Restore old logic for C++14 and down.
2211 2017-06-26 Martin Sebor <msebor@redhat.com>
2214 * call.c (maybe_warn_class_memaccess): Preserve explicit conversions
2215 to detect casting away cv-qualifiers.
2217 2017-06-26 Nathan Sidwell <nathan@acm.org>
2219 * cp-tree.h (lang_decl_fn): Remove assignment_operator_p field.
2220 (DECL_COMPLETE_CONSTRUCTOR_P): Directly compare
2222 (DECL_BASE_CONSTRUCTOR_P, DECL_COMPLETE_DESTRUCTOR_P,
2223 DECL_BASE_DESTRUCTOR_P, DECL_DELETING_DESTRUCTOR_P): Likewise.
2224 (DECL_ASSIGNMENT_OPERATOR_P): Use IDENTIFIER_ASSIGN_OP_P.
2225 * decl.c (grok_op_properties): Adjust identifier checking.
2226 * init.c (expand_default_init): Adjust identifier descision.
2227 * method.c (implicitly_declare_fn): Don't use
2228 DECL_ASSIGNMENT_OPERATOR_P.
2229 * search.c (lookup_fnfields_1): Use IDENTIFIER_CTOR_P,
2231 * call.c (in_charge_arg_for_name): Reimplement.
2232 (build_special_member_call): Use IDENTIFIER_CDTOR_P,
2235 2017-06-26 Marek Polacek <polacek@redhat.com>
2238 * parser.c (cp_parser_statement): Add a default argument. Save the
2239 location of the expression-statement after labels have been parsed.
2240 (cp_parser_implicitly_scoped_statement): Set the location of the
2241 body of the conditional after parsing all the labels. Call
2242 warn_for_multistatement_macros.
2243 (cp_parser_already_scoped_statement): Likewise.
2245 2017-06-24 Paolo Carlini <paolo.carlini@oracle.com>
2248 * parser.c (cp_parser_diagnose_invalid_type_name): Don't print
2249 'typename' in error messages about missing 'typename'.
2251 2017-06-23 Jason Merrill <jason@redhat.com>
2253 PR c++/79056 - C++17 ICE with invalid template syntax.
2254 * parser.c (cp_parser_simple_type_specifier): Don't assume that type
2256 (cp_parser_check_for_invalid_template_id): Handle TYPE_DECL.
2257 * pt.c (template_placeholder_p): New.
2258 * cp-tree.h: Declare it.
2260 2017-06-23 Marc Glisse <marc.glisse@inria.fr>
2262 * decl.c (duplicate_decls): Use builtin_structptr_types.
2264 2017-06-22 Nathan Sidwell <nathan@acm.org>
2266 Reorder IDENTIFIER flags
2268 * cp-tree.h (enum cp_identifier_kind): New.
2269 (IDENTIFIER_KIND_BIT_0, IDENTIFIER_KIND_BIT_1,
2270 IDENTIFIER_KIND_BIT_2): New.
2271 (IDENTIFIER_MARKED): Move to TREE_LANG_FLAG_4.
2272 (IDENTIFIER_VIRTUAL_P, IDENTIFIER_REPO_CHOSEN): Add IDENTIFIER_CHECK.
2273 (C_IS_RESERVED_WORD): Replace with ...
2274 (IDENTIFIER_KEYWORD_P): ... this.
2275 (IDENTIFIER_CTOR_OR_DTOR_P): Replace with ...
2276 (IDENTIFIER_CDTOR_P): ... this.
2277 (IDENTIFIER_CTOR_P, IDENTIFIER_DTOR_P): New.
2278 (IDENTIFIER_OPNAME_P): Replace with ...
2279 (IDENTIFIER_ANY_OP_P): ... this.
2280 (IDENTIFIER_ASSIGN_OP_P): New.
2281 (IDENTIFIER_TYPENAME_P): Replace with ...
2282 (IDENTIFIER_CONV_OP_P): ... this.
2283 (NEW_DELETE_OPNAME_P): Replace with ...
2284 (IDENTIFIER_NEWDEL_OP_P): ... this.
2285 (DECL_CONV_FN_P, DECL_OVERLOADED_OPERATOR_P): Adjust.
2286 (get_identifier_kind_name, set_identifier_kind): Declare.
2287 * lex.c (get_identifier_kind_name, set_identifier_kind): New.
2288 (init_operators): Adjust to avoid keywords, use
2289 set_identifier_kind. Copy TYPE_EXPR slot.
2290 (init_reswords): Call set_identifier_kind.
2291 (unqualified_name_lookup_error): Adjust.
2292 * operators.def (TYPE_EXPR): Remove.
2293 * decl.c (struct predefined_identifier): Move into ...
2294 (initialize_predefined_identifiers): ... here. Call
2295 set_identifier_kind.
2296 (grokfndecl, check_var_type, grokdeclarator): Adjust.
2297 (grok_op_properties): Use IDENTIFIER_ANY_ASSIGN_OP to halve search
2299 * call.c (name_as_c_string): Adjust.
2300 (build_new_method_call_1): Likewise.
2301 * cp-cilkplus.c (is_conversion_operator_function_decl_p): Likewise.
2302 * cxx-pretty-print.c (pp_cxx_unqualified_id): Adjust.
2303 * dump.c (cp_dump_tree): Adjust.
2304 * error.c (dump_decl_name): Adjust.
2305 * mangle.c (write_unqualified_id, write_member_name,
2306 write_expression): Adjust.
2307 (mangle_conv_op_name_for_type): Use set_identifier_kind.
2308 * name-lookup.c (do_class_using_decl): Adjust.
2309 (lookup_name_fuzzy, lookup_name_real_1): Likewise.
2310 * parser.c (cp_lexer_get_preprocessor_token,
2311 cp_parser_direct_declarator): Likewise.
2312 * pt.c (push_template_decl_real, tsubst_decl, tsubst_baselink,
2313 tsubst_copy, tsubst_copy_and_build): Adjust.
2314 * ptree.c (cxx_print_identifier): Print identifier kind.
2315 * search.c (lookup_field_r, lookup_member,
2316 lookup_fnfields_idx_nolazy): Adjust.
2317 * semantics.c (finish_id_expression): Adjust..
2318 * typeck.c (cp_build_addr_expr_1): Adjust.
2320 2017-06-21 Jakub Jelinek <jakub@redhat.com>
2323 * semantics.c (handle_omp_array_sections_1, finish_omp_clauses):
2324 Complain about t not being a variable if t is OVERLOAD even
2325 when processing_template_decl.
2327 2017-06-21 David Malcolm <dmalcolm@redhat.com>
2329 * parser.c (get_cast_suggestion): New function.
2330 (maybe_add_cast_fixit): New function.
2331 (cp_parser_cast_expression): Capture the location of the closing
2332 parenthesis. Call maybe_add_cast_fixit when emitting warnings
2333 about old-style casts.
2335 2017-06-20 Jason Merrill <jason@redhat.com>
2337 PR c++/80972 - C++17 ICE with attribute packed.
2338 * call.c (build_over_call): Allow a TARGET_EXPR from reference
2341 2017-06-20 Nathan Sidwell <nathan@acm.org>
2343 * cp-tree.h (CPTI_NELTS_IDENTIFIER): Delete.
2344 (nelts_identifier): Delete.
2345 * decl.c (initialize_predefined_identifiers): Remove nelts.
2347 PR c++/67074 - namespace aliases
2348 * decl.c (duplicate_decls): Don't error here on mismatched
2350 * name-lookup.c (name_lookup::add_value): Matching namespaces are
2352 (diagnose_name_conflict): Namespaces are never redeclarations.
2353 (update_binding): An alias can match a real namespace.
2355 2017-06-19 Jason Merrill <jason@redhat.com>
2357 PR c++/80562 - ICE with constexpr if.
2358 * semantics.c (finish_if_stmt_cond): Call
2359 instantiate_non_dependent_expr.
2361 PR c++/80829 - ICE with constexpr copy of base subobject.
2362 * constexpr.c (clear_no_implicit_zero): New.
2363 (cxx_eval_call_expression): Call it.
2365 2017-06-19 Nathan Sidwell <nathan@acm.org>
2369 * name-lookup.c (set_decl_namespace): Don't follow using
2370 directives and ignore using decls. Only check overly-explicit
2371 scope after discovering decl.
2373 2017-06-19 Jason Merrill <jason@redhat.com>
2375 PR c++/81073 - constexpr and static var in statement-expression.
2376 * typeck2.c (store_init_value): Always call
2377 require_potential_constant_expression.
2378 * pt.c (convert_nontype_argument): Likewise.
2379 * constexpr.c (potential_constant_expression_1): Adjust message.
2380 Use decl_maybe_constant_var_p instead of decl_constant_var_p.
2381 * decl2.c (decl_maybe_constant_var_p): Consider initializer.
2383 2017-06-19 Nathan Sidwell <nathan@acm.org>
2385 * pt.c (coerce_template_parms): Fix indentation.
2386 (tsubst_decl): Remove repeated SET_DECL_RTL. Move VAR_P handling
2390 * name-lookup.c (update_binding): Only warn about constructors
2391 hidden by functions.
2393 2017-06-17 Jason Merrill <jason@redhat.com>
2395 PR c++/60063 - -Wunused-local-typedefs and templates.
2396 * decl2.c (is_late_template_attribute): Return false for "used".
2398 PR c++/70844 - -Wuseless-cast and inheriting constructor.
2399 * method.c (forward_parm): Suppress warn_useless_cast.
2401 2017-06-16 Jason Merrill <jason@redhat.com>
2403 PR c++/81045 - Wrong type-dependence with auto return type.
2404 * pt.c (type_dependent_expression_p): An undeduced auto outside the
2405 template isn't dependent.
2406 * call.c (build_over_call): Instantiate undeduced auto even in a
2409 PR c++/80465 - ICE with generic lambda with noexcept-specifier.
2410 * lambda.c (maybe_add_lambda_conv_op): Keep processing_template_decl
2411 set longer for a generic lambda.
2413 PR c++/80614 - Wrong mangling for C++17 noexcept type
2414 * mangle.c (write_type): Put the eh spec back on the function type.
2416 PR c++/81102 - Wrong error with partial specialization.
2417 * pt.c (unify) [TEMPLATE_PARM_INDEX]: Strip reference when comparing
2418 types. Do type deduction later.
2420 PR c++/81074 - ICE with partial specialization of member template.
2422 * pt.c (get_partial_spec_bindings): Only coerce innermost args.
2424 PR c++/80831 - ICE with -fsyntax-only.
2425 * decl2.c (c_parse_final_cleanups): Use cgraph_node::get_create.
2427 PR c++/80639 - ICE with invalid PMF initialization.
2428 PR c++/80043 - ICE with -fpermissive
2429 * typeck.c (convert_for_assignment): Recurse when instantiate_type
2430 returns without an error.
2432 2017-06-16 Nathan Sidwell <nathan@acm.org>
2434 * pt.c (tsubst_baselink): Fix & clarify formatting.
2436 * cp-tree.h (build_this_parm, cp_build_parm_decl,
2437 build_artificial_parm): Add FN parm.
2438 * decl.c (start_cleanup_fn): Adjust.
2439 (build_this_parm): Add FN parm, pass it through.
2440 (grokfndecl): Adjust parm building.
2441 * decl2.c (cp_build_parm_decl): Add FN parm, set context.
2442 (build_artificial_parm): Add FN parm, pass through.
2443 (maybe_retrofit_in_chrg): Adjust parm building.
2444 (start_static_storage_duration_function): Likwise.
2445 * lambda.c (maybe_aadd_lambda_conv_op): Likewise.
2446 * method.c (implicitly_declare_fn): Likewise.
2447 * parser.c (inject_this_parameter): Likewise.
2449 Symbol tables are insert only.
2450 * cp-tree.h (default_hash_traits <lang_identifier *>): Don't
2451 derive from pointer_hash. Make undeletable.
2453 * class.c (resort_type_method_vec): Avoid potential unsigned
2456 Don't defer noexcept_deferred_spec.
2457 * cp-tree.h (unevaluated_noexcept_spec): Don't declare.
2458 * decl.c (cxx_init_decl_processing): Initialize
2459 noexcept_deferred_spec.
2460 * except.c (unevaluated_noexcept_spec): Delete.
2461 * class.c (deduce_noexcept_on_destructor): Use
2462 noexcept_deferred_spec directly.
2463 * method.c (implicitly_declare_fn): Likewise.
2465 Make keyed_classes a vector.
2466 * cp-tree.h (CPTI_KEYED_CLASSES, keyed_classes): Delete.
2467 (keyed_classes): Declare as vector.
2468 * decl.c (keyed_classes): Define.
2469 (cxx_init_decl_processing): Allocate it.
2470 (record_key_method_defined): Use vec_safe_push.
2471 * class.c (finish_struct_1): Likewise.
2472 * pt.c (instantiate_class_template_1): Likewise.
2473 * decl2.c (c_parse_final_cleanups): Reverse iterate keyed_classes.
2476 * rtti.c (enum tinfo_kind): Add TK_DERIVED_TYPES,
2477 TK_VMI_CLASS_TYPES, TK_MAX. Delete TK_FIXED.
2479 (typeid_ok_p): Add quotes to error messages. Use get_tinfo_desc.
2480 (get_tinfo_decl): Use get_tinfo_desc.
2481 (get_pseudo_ti_init): Likewise. Adjust VMI construction.
2482 (create_pseudo_type_info): Delete.
2483 (get_pseudo_ti_index): Just determine the index.
2484 (get_tinfo_desc): New. Create all types lazily.
2485 (create_tinfo_types): Just allocate the descriptor array.
2486 (emit_support_tinfos): Use non-inserting type lookup. Set builtin
2489 2017-06-15 Martin Sebor <msebor@redhat.com>
2492 * call.c (first_non_public_field, maybe_warn_class_memaccess): New
2494 (has_trivial_copy_assign_p, has_trivial_copy_p): Ditto.
2495 (build_cxx_call): Call maybe_warn_class_memaccess.
2497 2017-06-14 Jakub Jelinek <jakub@redhat.com>
2499 * cp-gimplify.c (cp_genericize_r): Turn most of the function
2500 into a switch (TREE_CODE (stmt)) statement from long else if
2503 2017-06-13 Jakub Jelinek <jakub@redhat.com>
2506 * cp-gimplify.c (cp_genericize_r): Don't instrument MEM_REF second
2507 argument even if it has REFERENCE_TYPE.
2510 * cp-gimplify.c (cp_genericize): Only look for VAR_DECLs in
2511 BLOCK_VARS (outer) chain.
2512 (cxx_omp_const_qual_no_mutable): Likewise.
2514 2017-06-13 Martin Liska <mliska@suse.cz>
2517 * class.c (build_base_path): Use sanitize_flags_p.
2518 * cp-gimplify.c (cp_genericize_r): Likewise.
2519 (cp_genericize_tree): Likewise.
2520 (cp_genericize): Likewise.
2521 * cp-ubsan.c (cp_ubsan_instrument_vptr_p): Likewise.
2522 * decl.c (compute_array_index_type): Likewise.
2523 (start_preparsed_function): Likewise.
2524 * decl2.c (one_static_initialization_or_destruction): Likewise.
2525 * init.c (finish_length_check): Likewise.
2526 * lambda.c (maybe_add_lambda_conv_op): Likewise.
2527 * typeck.c (cp_build_binary_op): Likewise.
2528 (build_static_cast_1): Likewise.
2530 2017-06-11 Jason Merrill <jason@redhat.com>
2532 * error.c (dump_expr): Use is_this_parameter.
2534 * cp-tree.h, decl2.c, mangle.c, parser.c, pt.c, semantics.c: Use
2537 2017-06-09 Jason Merrill <jason@redhat.com>
2539 Missing bits from N4268, constant evaluation for all non-type args.
2540 * call.c (build_converted_constant_expr): Rename from
2541 build_integral_nontype_arg_conv, handle all types.
2542 * pt.c (convert_nontype_argument): In C++17 call it for all types.
2543 Move NOP stripping inside pointer case, don't strip ADDR_EXPR.
2544 * cvt.c (strip_fnptr_conv): Also strip conversions to the same type.
2546 Overhaul pointer-to-member conversion and template argument handling.
2547 * call.c (standard_conversion): Avoid creating ck_pmem when the
2548 class type is the same.
2549 * cvt.c (can_convert_qual): Split from
2550 perform_qualification_conversions.
2551 * constexpr.c (cxx_eval_constant_expression): Check it.
2552 * typeck.c (convert_ptrmem): Only cplus_expand_constant if
2553 adjustment is necessary.
2554 * pt.c (check_valid_ptrmem_cst_expr): Compare class types.
2555 (convert_nontype_argument): Avoid redundant error.
2557 * call.c (convert_like_real): Remove "inner" parameter.
2558 Don't replace a constant with its value.
2559 * cp-gimplify.c (cp_fully_fold): Use cp_fold_rvalue.
2561 * pt.c (convert_nontype_argument): Check NULLPTR_TYPE_P rather than
2564 * parser.c (cp_parser_constant_expression): Check
2565 potential_rvalue_constant_expression after decay_conversion.
2566 * pt.c (convert_nontype_argument): Don't require linkage in C++17.
2568 PR c++/80384 - ICE with dependent noexcept-specifier
2569 * pt.c (dependent_type_p_r) [FUNCTION_TYPE]: Check for dependent
2572 * constexpr.c (potential_constant_expression_1): Allow 'this' capture.
2574 2017-06-09 Jan Hubicka <hubicka@ucw.cz>
2576 * class.c (build_vtbl_initializer): Mark dvirt_fn as cold.
2577 * decl.c (cxx_init_decl_processing, push_throw_library_fn): Likewise.
2578 (excpet.c): Mark terminate as cold.
2580 2017-06-08 Jakub Jelinek <jakub@redhat.com>
2583 * semantics.c (handle_omp_array_sections_1): Convert TYPE_MAX_VALUE
2584 to sizetype before size_binop.
2587 * cp-gimplify.c (cxx_omp_finish_clause): When changing clause
2588 to OMP_CLAUSE_SHARED, also clear OMP_CLAUSE_SHARED_FIRSTPRIVATE
2589 and OMP_CLAUSE_SHARED_READONLY flags.
2591 2017-06-08 Jan Hubicka <hubicka@ucw.cz>
2593 * cp-tree.h (lang_check_failed): Annotate by ATTRIBUTE_COLD.
2595 2017-06-07 Nathan Sidwell <nathan@acm.org>
2597 * class.c (layout_class_type): Restructure overlong-bitfield tpe
2600 2017-06-07 Jonathan Wakely <jwakely@redhat.com>
2603 * pt.c (do_class_deduction): Build qualified type.
2605 2017-06-06 Nathan Sidwell <nathan@acm.org>
2607 * name-lookup.c (suggest_alternatives_for): Use qualified lookup
2608 sans using directives. Don't walk into inline namespaces.
2611 * name-lookup.c (adl_class_only): Don't add visible friends.
2613 2017-06-05 Volker Reichelt <v.reichelt@netcologne.de>
2615 * parser.c (cp_parser_base_specifier): Fix typos in error messages.
2617 2017-06-02 Nathan Sidwell <nathan@acm.org>
2619 Remove lang_type_ptrmem.
2620 * cp-tree.h (lang_type_header): Remove is_lang_type_class. Move
2622 (lang_type_class): ... this. Reorder bitfields. Rename to ...
2623 (lang_type): ... this. Delete old definition.
2624 (lang_type_ptrmem): Delete.
2625 (LANG_TYPE_CLASS_CHECK): Simply get TYPE_LANG_SPECIFIC. Adjust uses.
2626 (LANG_TYPE_PTRMEM_CHECK): Delete.
2627 (TYPE_GET_PTRMEMFUNC_TYPE, TYPE_SET_PTRMEMFUNC_TYPE): Delete.
2628 (TYPE_PTRMEMFUNC_TYPE): New. Use TYPE_LANG_SLOT_1.
2629 * decl.c (build_ptrmemfunc_type): Adjust.
2630 * lex.c (copy_lang_type): Remove lang_type_ptrmem handling.
2631 (maybe_add_lang_type_raw): Don't set u.c.h.is_lang_type_class.
2633 * class.c (check_bases_and_members): Adjust vec_new_uses_cookie
2636 Remove cp_binding_level::namespaces
2637 * name-lookup.h (cp_binding_level): Lose namespaces field.
2638 * name-lookup.c (add_decl_to_level): Chain namespaces on the names
2640 (suggest_alternatives_for): Adjust for namespace list. Do
2641 breadth-first search.
2642 * decl2.c (collect_source_refs): Namespaces are on the regulr
2644 (collect_ada_namespace): Likewise.
2646 2017-06-02 Bernd Edlinger <bernd.edlinger@hotmail.de>
2648 * typeck.c (cp_build_binary_op): Implement the -Wsizeof_pointer_div
2651 2017-06-01 Ville Voutilainen <ville.voutilainen@gmail.com>
2654 * method.c (constructible_expr): Strip array types before calling
2657 2017-06-01 Paolo Carlini <paolo.carlini@oracle.com>
2660 * cvt.c (convert_to_void): Possibly call maybe_warn_nodiscard
2661 for case INDIRECT_REF too in the main switch.
2663 2017-05-31 Jason Merrill <jason@redhat.com>
2665 PR c++/80840 - ICE with constexpr and reference
2666 * pt.c (convert_nontype_argument): Don't test whether a decl is
2667 value-dependent when binding to a reference.
2669 2017-05-31 Nathan Sidwell <nathan@acm.org>
2671 * cp-tree.h (lang_decl_slector): New enum.
2672 (lang_decl_base): Make selector an enum. Drop decomposition_p
2674 (lang_decl): Use enum for discrimination.
2675 (LANG_DECL_FN_CHECK, LANG_DECL_NS_CHECK, LANG_DECL_PARM_CHECK,
2676 LANG_DECL_DEOMP_CHECK): Use enum.
2677 (DECL_DECOMPOSITION_P): Use selector value.
2678 (SET_DECL_DECOMPOSITION_P): Delete.
2679 (retrofit_lang_decl): Lose SEL parm.
2680 (fit_decomposition_lang_decl): Declare.
2681 * decl.c (cp_finish_decomp, grokdeclarator): Use
2682 fit_decomposition_lang_decl.
2683 * lex.c (maybe_add_lang_decl_raw): New. Broken out of
2685 (set_decl_linkage): New. Broken out of retrofit_lang_decl. Use enum.
2686 (fit_decomposition_lang_decl): Likewise.
2687 (retrofit_lang_decl): Use worker functions.
2688 (cxx_dup_lang_specific_decl): Use selector enum.
2689 (maybe_add_lang_type_raw): New. Broken out of ...
2690 (cxx_make_type_name): ... here. Call it.
2692 2017-05-30 Jason Merrill <jason@redhat.com>
2694 PR c++/80856 - ICE with local extern in template
2695 * semantics.c (finish_call_expr): Replace a local extern overload
2696 set in a template with the IDENTIFIER_NODE.
2698 2017-05-30 David Malcolm <dmalcolm@redhat.com>
2700 * call.c (perform_implicit_conversion_flags): Convert
2701 "from %qT to %qT" to "from %qH to %qI" in diagnostic.
2702 (print_conversion_rejection): Replace pairs of %qT with
2703 %qH and %qI in various places.
2704 (build_user_type_conversion_1): Likewise.
2705 (build_integral_nontype_arg_conv): Likewise.
2706 (build_conditional_expr_1): Likewise.
2707 (convert_like_real): Likewise.
2708 (convert_arg_to_ellipsis): Likewise.
2710 (initialize_reference): Likewise.
2711 * cvt.c (cp_convert_to_pointer): Likewise.
2712 (cp_convert_to_pointer): Likewise.
2713 (convert_to_reference): Likewise.
2714 (ocp_convert): Likewise.
2715 * error.c (cp_printer): Gain bool and const char ** parameters.
2716 (struct deferred_printed_type): New struct.
2717 (class cxx_format_postprocessor): New class.
2718 (cxx_initialize_diagnostics): Wire up a cxx_format_postprocessor
2719 to pp->m_format_postprocessor.
2720 (comparable_template_types_p): New function.
2721 (newline_and_indent): New function.
2722 (arg_to_string): New function.
2723 (print_nonequal_arg): New function.
2724 (print_template_differences): New function.
2725 (type_to_string_with_compare): New function.
2726 (print_template_tree_comparison): New function.
2727 (append_formatted_chunk): New function.
2728 (add_quotes): New function.
2729 (cxx_format_postprocessor::handle): New function.
2730 (defer_phase_2_of_type_diff): New function.
2731 (cp_printer): Add "quoted" and "buffer_ptr" params. Implement
2733 * typeck.c (cp_build_binary_op): Replace pairs of %qT with
2734 %qH and %qI in various places.
2735 (convert_member_func_to_ptr): Likewise.
2736 (build_reinterpret_cast_1): Likewise.
2737 (convert_for_assignment): Likewise.
2738 * typeck2.c (check_narrowing): Likewise.
2740 2017-05-30 Nathan Sidwell <nathan@acm.org>
2742 Kill IDENTIFIER_NAMESPACE_BINDINGS
2743 * cp-tree.h (lang_identifier): Delete namespace_bindings.
2744 (IDENTIFIER_NAMESPACE_BINDINGS): Delete.
2745 (lang_decl_ns): Add bindings.
2746 (DECL_NAMESPACE_BINDINGS): New.
2747 * lex.c (retrofit_lang_decl): Create namespace hash table.
2748 * name-lookup.c (find_namespace_slot): Change to use hash-map.
2749 * ptree.c (cxx_print_binding): Delete.
2750 (cxx_print_identifier): Remove NAMESPACE_BINDING printing.
2752 * cp-tree.def (OVERLOAD): Fix comment.
2753 * cp-tree.h: Fix comments and whitespace.
2754 * error.c (dump_decl): Use pp_cxx_colon_colon, ovl_scope.
2755 * name-lookup.c (add_decl_to_level): Assert not class.
2756 (check_local_shadow): Use OVL_P.
2757 (pushdecl_with_scope_1): Rename to ...
2758 (do_pushdecl_with_Scope): ... here.
2759 (do_nonmember_using_decl): Use qualified_namespace_lookup return
2761 (push_class_level_binding_1): Use OVL_P.
2762 (pushdecl_namespace_level): Use do_pushdecl_with_scope.
2763 (pushtag_1): Rename to ...
2764 (do_pushtag): ... here. Adjust do_pushdecl_with_scope call.
2766 (store_class_bindings): Do not time here.
2767 * name-lookup.h (pushdecl_outermost_localscope): Reorder.
2768 * pt.c (listify): Declare argvec at point of initialization.
2771 * name-lookup.c (add_decl_to_level): Assert not making a circular
2773 (update_binding): Don't prematurely slide artificial decl.
2775 2017-05-29 Alexandre Oliva <aoliva@redhat.com>
2777 * cp-tree.h (lang_identifier): Drop oracle_looked_up, unused.
2779 2017-05-29 Nathan Sidwell <nathan@acm.org>
2781 PR c++/80891 (#1,#5)
2782 * cp-tree.h (lookup_maybe_add): Add DEDUPING argument.
2783 * name-lookup.c (name_lookup): Add deduping field.
2784 (name_lookup::preserve_state, name_lookup::restore_state): Deal
2786 (name_lookup::add_overload): New.
2787 (name_lookup::add_value, name_lookup::add_fns): Call add_overload.
2788 (name_lookup::search_adl): Set deduping. Don't unmark here.
2789 * pt.c (most_specialized_instantiation): Revert previous change,
2790 Assert not given duplicates.
2791 * tree.c (lookup_mark): Just mark the underlying decls.
2792 (lookup_maybe_add): Dedup using marked decls.
2795 * ptree.c (cxx_print_xnode): Show internal OVERLOAD structure.
2796 * tree.c (ovl_insert, ovl_iterator_remove_node): Fix copying assert.
2798 Stat hack representation
2799 * name-lookup.c (STAT_HACK_P, STAT_TYPE, STAT_DECL,
2800 MAYBE_STAT_DECL, MAYBE_STAT_TYPE): New.
2802 (find_namespace_binding): Replace with ...
2803 (find_namespace_slot): ... this.
2804 (find_namespace_value): New.
2805 (name_lookup::search_namespace_only,
2806 name_lookup::adl_namespace_only): Adjust.
2807 (update_binding): Add SLOT parameter, adjust.
2808 (check_local_shadow): Use find_namespace_value.
2809 (set_local_extern_decl_linkage): Likewise.
2810 (do_pushdecl): Adjust for namespace slot.
2811 (push_local_binding): Assert not a namespace binding.
2812 (check_for_out_of_scope_variable): Use find_namespace_value.
2813 (set_identifier_type_value_with_scope): Likewise.
2814 (get_namespace_binding): Likewise.
2815 (set_namespace_binding): Delete.
2816 (set_global_binding): Directly update the binding.
2817 (finish_namespace_using_decl): Likewise.
2818 (lookup_type_scope_1): Use find_namespace_slot and update.
2819 (do_push_nested_namespace): Use find_namespace_value.
2822 * pt.c (most_specialized_instantiation): Cope with duplicate
2826 * cp-tree.h (build_min_nt_call_vec): Declare.
2827 * decl.c (build_offset_ref_call_from_tree): Call it.
2828 * parser.c (cp_parser_postfix_expression): Likewise.
2829 * pt.c (tsubst_copy_and_build): Likewise.
2830 * semantics.c (finish_call_expr): Likewise.
2831 * tree.c (build_min_nt_loc): Keep unresolved lookups.
2832 (build_min): Likewise.
2833 (build_min_non_dep): Likewise.
2834 (build_min_non_dep_call_vec): Likewise.
2835 (build_min_nt_call_vec): New.
2838 * tree.c (ovl_copy): Adjust assert, copy OVL_LOOKUP.
2840 (lookup_keep): Call it.
2842 2017-05-26 Nathan Sidwell <nathan@acm.org>
2845 * name-lookup.c (push_inline_namespaces): New.
2846 (push_namespace): Look inside inline namespaces.
2848 Inline and using namespace representation change.
2849 * cp-tree.h (struct lang_decl_ns): Delete ns_using. Add usings,
2851 (DECL_NAMESPACE_USING): Adjust.
2852 (DECL_NAMESPACE_INLINEES): New.
2853 * name-lookup.h (struct cp_binding_level): Change usings
2855 * name-lookup.c (name_lookup::do_queue_usings,
2856 name_lookup::queue_usings): Adjust.
2857 (name_lookup::search_namespace, name_lookup::search_usings,
2858 name_lookup::queue_namespace): Adjust.
2859 (name_lookup::adl_namespace_only): Adjust.
2860 (add_using_namespace, push_namespace): Push onto vector.
2861 (pop_namespace): Add timing logic.
2863 * call.c (build_operator_new_call): Do namelookup and ADL here.
2864 (build_new_op_1): Likewise.
2865 * name-lookup.h (lookup_function_nonclass): Delete declaration.
2866 (do_using_directive): Likewise.
2867 * name-lookup.c (set_namespace_binding, push_local_binding): Don't
2869 (struct scope_binding): Delete.
2870 (EMPTY_SCOPE_BINDING): Delete.
2871 (set_decl_namespace): Use OVL_P.
2872 (finish_local_using_decl): Lose unnecesary checks.
2873 (lookup_function_nonclass): Delete.
2874 (cp_emit_debug_info_for_using): Use MAYBE_BASELINK_P.
2876 * cp-tree.h (OVL_CHAIN): Check looking at OVERLOAD.
2877 (ovl_iterator): Add allow_inner field. Adjust ctor. Make
2879 (ovl_iterator::maybe_push, ovl_iterator::pop): New.
2880 (lkp_iterator): Add outer field. Adjust ctor.
2881 (lkp_iterator::operator++): New.
2882 (lookup_mark, lookup_maybe_add): Declare.
2883 * name-lookup.c (name_lookup): Delete fn_set member.
2884 (name_lookup::preserve_state, name_lookup::restore_state): Unmark
2886 (name_lookup::add_value): Use lookup_add directly.
2887 (name_lookup::add_fns: Use lookup_maybe_add.
2888 (name_lookup::search_adl): Mark and unmark fns.
2890 * pt.c (check_explicit_specialization): Use lookup_add directly.
2891 * ptree.c (cxx_print_xnode): Show complete overload structure.
2892 * tree.c (lookup_mark, lookup_maybe_add): New.
2894 * name-lookup.c (name_lookup::search_adl): ADL OMP UDR type args.
2896 2017-05-26 Jakub Jelinek <jakub@redhat.com>
2898 * cp-tree.h (struct lang_decl_decomp): New type.
2899 (struct lang_decl): Add u.decomp.
2900 (LANG_DECL_DECOMP_CHECK): Define.
2901 (DECL_DECOMPOSITION_P): Note it is set also on the vars
2902 for user identifiers.
2903 (DECL_DECOMP_BASE): Define.
2904 (retrofit_lang_decl): Add extra int = 0 argument.
2905 * lex.c (retrofit_lang_decl): Add SEL argument, if non-zero
2906 use it to influence the selector choices and for selector
2907 0 to non-zero transition copy old content.
2908 (cxx_dup_lang_specific_decl): Handle DECL_DECOMPOSITION_P.
2909 * decl.c (poplevel): For DECL_DECOMPOSITION_P, check
2910 !DECL_DECOMP_BASE instead of !DECL_VALUE_EXPR. Adjust warning
2911 wording if decl is a structured binding.
2912 (cp_finish_decomp): Pass 4 as the new argument to retrofit_lang_decl.
2913 Set DECL_DECOMP_BASE. Ignore DECL_READ_P sets from initialization
2914 of individual variables for tuple structured bindings.
2915 (grokdeclarator): Pass 4 as the new argument to retrofit_lang_decl.
2916 Clear DECL_DECOMP_BASE.
2917 * decl2.c (mark_used): Mark DECL_DECOMP_BASE TREE_USED as well.
2918 * pt.c (tsubst_decomp_names): Assert DECL_DECOMP_BASE matches what
2920 * expr.c (mark_exp_read): Recurse on DECL_DECOMP_BASE instead of
2923 2017-05-25 Jason Merrill <jason@redhat.com>
2925 PR c++/80605 - __is_standard_layout and zero-length array
2926 * class.c (check_bases): Use DECL_FIELD_IS_BASE.
2928 2017-05-25 Nathan Sidwell <nathan@acm.org>
2930 Kill OVL_CURRENT, OVL_NEXT.
2931 * cp-tree.h (OVL_CURRENT, OVL_NEXT): Delete.
2932 * name-lookup.c (set_decl_namespace): Use ovl_iterator.
2933 (consider_binding_level): Use OVL_FIRST.
2934 (cp_emit_debug_info_for_using): Use lkp_iterator.
2935 * pt.c (check_explicit_specialization): Use ovl_iterator.
2937 Kill DECL_NAMESPACE_USERS, DECL_NAMESPACE_ASSOCIATIONS.
2938 * cp-tree.h (lang_decl_ns): Remove ns_users field.
2939 (DECL_NAMESPACE_USERS, DECL_NAMESPACE_ASSOCIATIONS): Delete.
2940 (TREE_INDIRECT_USING): Delete.
2941 * name-lookup.h (is_associated_namespace): Delete.
2942 * name-lookup.c (name_lookup::search_usings,
2943 name_lookup::do_queue_usings): Usings are always direct.
2944 (is_associated_namespace): Delete.
2945 (handle_namespace_attrs): Use DECL_NAMESPACE_INLINE_P.
2946 (namespace_ancestor_1, namespace_ancestor): Delete.
2947 (push_using_directive_1, push_using_directive): Delete.
2948 (add_using_namespace_1): Delete.
2949 (add_using_namespace): Reimplement.
2950 (emit_debug_info_using_namespace): New.
2951 (finish_namespace_using_directive, finish_local_using_directive,
2952 push_namespace): Adjust.
2953 * tree.c (cp_free_lang_data): Remove DECL_NAMESPACE_USERS handling.
2955 2017-05-25 Volker Reichelt <v.reichelt@netcologne.de>
2957 * semantics.c (finish_handler_parms): Warn about non-reference type
2960 2017-05-25 Nathan Sidwell <nathan@acm.org>
2962 Reimplement unqualified namespace lookup.
2963 * name-lookup.c (name_lookup::using_pair,
2964 name_lookup::using_queue): New typedefs.
2965 (name_lookup::queue_namespace, name_lookup::do_queue_usings,
2966 name_lookup::queue_usings): New.
2967 (name_lookup::search_unqualified): New.
2968 (merge_functions, same_entity_p, ambiguous_decl,
2969 unqualified_namespace_lookup_1, unqualified_namespace_lookup,
2970 lookup_using_namespace): Delete.
2971 (lookup_name_real_1): Adjust.
2973 Reimplement qualified namespace lookup.
2974 * name-lookup.c (name_lookup::flags): New member. Adjust ctor.
2975 (name_lookup::ambiguous, name_lookup::add_value,
2976 name_lookup::add_type, name_lookup::process_binding): New.
2977 (name_lookup::search_namespace_only,
2978 name_lookup::search_namespace, name_lookup::search_usings): New.
2979 (name_lookup::search_qualified): New.
2980 (do_nonmember_using_decl, suggest_alternatives_for,
2981 lookup_qualified_name): Adjust.
2982 (tree_vec_contains): Delete.
2983 (qualified_lookup_using_namespace): Rename to ...
2984 (qualified_namespace_lookup): ... here. Reimplement.
2987 * cp-tree.h (LOOKUP_SEEN_P, LOOKUP_FOUND_P): New.
2988 * name-lookup.h (lookup_arg_dependent): Return plain tree.
2989 * name-lookup.c (arg_lookup, arg_assoc, arg_assoc_args,
2990 arg_assoc_args_vec, arg_assoc_type, add_function,
2991 arg_assoc_namespace, arg_assoc_class_only, arg_assoc_bases,
2992 arg_assoc_class, arg_assoc_template_arg, arg_assoc,
2993 lookup_arg_dependent_1): Delete.
2994 (name_lookup): New lookup object.
2995 (name_lookup::preserve_state, name_lookup::restore_state,
2996 name_lookup::mark_seen, name_lookup::find_and_mark,
2997 name_lookup::add_fns, name_lookup::adl_namespace_only,
2998 name_lookup::adl_namespace, name_lookup::adl_class_only,
2999 name_lookup::adl_bases, name_lookup::adl_class,
3000 name_lookup::adl_expr, name_lookup::adl_type,
3001 name_lookup::adl_template_arg, name_lookup::search_adl): New.
3002 (lookup_arg_dependent): Return a plain tree. Adjust.
3003 (is_associated_namespace): Move later.
3005 2017-05-24 Nathan Sidwell <nathan@acm.org>
3007 * friend.c (do_friend): Remove check for existing decl.
3008 * name-lookup.h (lookup_name_innermost_nonclass_level): Delete.
3009 * name-lookup.c (push_local_binding): Directly look for binding.
3010 (lookup_name_innermost_nonclass_level_1): Delete.
3011 (lookup_name_innermost_nonclass_level): Delete.
3013 * Make-lang.in (CXX_AND_OBJCXX_OBJS): Alphabetize.
3015 * cp-tree.h (cp_free_lang_data): Add extern.
3016 (ovl_skip_hidden, is_overloaded_fn, really_overloaded_fn): Add
3018 (type_unknown_p): Return bool, make inline, lose TREE_LIST check.
3019 * typeck.c (type_unknown_p): Delete.
3020 * tree.c (is_overloaded_fn): Use MAYBE_BASELINE_FUNCTIONS, adjust
3021 overload management.
3022 (dependent_name): Likewise.
3023 (decl_anon_ns_mem_p): Simplify.
3025 2017-05-24 Jonathan Wakely <jwakely@redhat.com>
3028 * tree.c (reshape_init): Use unqualified type for direct enum init.
3029 * typeck.c (maybe_warn_about_cast_ignoring_quals): New.
3030 (build_static_cast_1, build_reinterpret_cast_1): Strip cv-quals from
3031 non-class destination types.
3032 (build_const_cast_1): Strip cv-quals from destination types.
3033 (build_static_cast, build_reinterpret_cast, build_const_cast)
3034 (cp_build_c_cast): Add calls to maybe_warn_about_cast_ignoring_quals.
3036 2017-05-24 Martin Sebor <msebor@redhat.com>
3039 * call.c (fully_fold_internal): Adjust.
3041 2017-05-24 Nathan Sidwell <nathan@acm.org>
3043 * cp-tree.h (ovl_skip_hidden): Declare.
3044 * tree.c (ovl_skip_hidden): New.
3045 * name-lookup.c (arg_assoc_namespace): Call ovl_skip_hidden.
3046 (lookup_arg_dependent_1): Likewise.
3047 (ambiguous_decl): Use DECL_HIDDEN_P, ovl_skip_hidden.
3048 (hidden_name_p, remove_hidden_names): Delete.
3049 (lookup_name_real_1): Do not strip hidden names.
3050 * name-lookup.h (hidden_name_p, remove_hidden_names): Delete.
3052 * cp-tree.h (OVL_HIDDEN_P): New.
3053 (ovl_iterator::hidden_p, ovl_iterator::reveal_node): New.
3054 (ovl_iterator::reveal_node): Declare.
3055 * tree.c (ovl_copy): Copy OVL_HIDDEN_P.
3056 (ovl_insert): Order on hiddenness.
3057 (ovl_iterator::reveal_node): New.
3058 * name-lookup.c (anticipated_builtin_p): New.
3059 (supplement_binding_1): Use it.
3060 (set_local_extern_decl_linkage): Use hidden_p.
3061 (do_pushdecl): Deal with unhiding a hidden decl, use
3062 anticipated_builtin_p.
3063 (do_nonmember_using_decl): Use anticipated_decl_p.
3064 (lookup_name_real_1): Use DECL_HIDDEN_P.
3066 2017-05-23 Jason Merrill <jason@redhat.com>
3068 -Wunused and C++17 structured bindings
3069 * decl.c (poplevel): Don't warn about unused structured bindings,
3070 only real variables.
3071 * error.c (dump_simple_decl): Handle structured bindings.
3072 * expr.c (mark_exp_read): Look through DECL_VALUE_EXPR.
3074 2017-05-23 Nathan Sidwell <nathan@acm.org>
3076 * cp-tree.h (PUSH_GLOBAL, PUSH_LOCAL, PUSH_USING): Delete.
3077 * name-lookup.c (create_local_binding): New.
3078 (update_binding): New.
3079 (pushdecl_maybe_friend_1): Rename to ...
3080 (do_pushdecl): ... this. Reimplement.
3082 (push_overloaded_decl_1, push_overloaded_decl): Delete.
3084 2017-05-23 Jason Merrill <jason@redhat.com>
3086 PR c++/80396 - built-in for make_integer_sequence.
3087 * pt.c (builtin_pack_fn_p, builtin_pack_call_p)
3088 (expand_integer_pack, expand_builtin_pack_call): New.
3089 (find_parameter_packs_r): Check builtin_pack_call_p.
3090 (check_for_bare_parameter_packs): Handle it.
3091 (tsubst_pack_expansion): Call expand_builtin_pack_call.
3092 (declare_integer_pack): New.
3093 (init_template_processing): Call it.
3094 * decl2.c (mark_used): Check builtin_pack_fn_p.
3096 2017-05-23 Nathan Sidwell <nathan@acm.org>
3098 * name-lookup.c (find_namespace_binding): New.
3099 (pushdecl_maybe_friend_1): Use CP_DECL_CONTEXT.
3100 (set_identifier_type_value_with_scope): Use find_namespace_binding.
3101 (find_binding, cp_binding_level_find_binding_for_name,
3102 binding_for_name, namespace_binding_1): Delete.
3103 (push_overloaded_decl_1): Use CP_DECL_CONTEXT.
3104 (get_namespace_binding, set_namespace_binding,
3105 finish_namespace_using_decl, unqualified_namespace_lookup_1,
3106 qualified_lookup_using_namespace, lookup_type_scope_1,
3107 lookup_name_innermost_nonclass_level_1): Use find_namespace_binding.
3110 * parser.c (cp_parser_template_id): Keep the lookup when stashing
3113 * cp-tree.h (DECL_HIDDEN_P): New.
3114 * name-lookup.c (set_decl_context,
3115 set_local_extern_decl_linkage): New, broken out of ...
3116 (pushdecl_maybe_friend_1): ... here. Call them.
3118 2017-05-23 Thomas Schwinge <thomas@codesourcery.com>
3120 * parser.c (OACC_KERNELS_CLAUSE_MASK): Add
3121 "PRAGMA_OACC_CLAUSE_NUM_GANGS", "PRAGMA_OACC_CLAUSE_NUM_WORKERS",
3124 2017-05-23 Nathan Sidwell <nathan@acm.org>
3126 * cp-tree.h (OVL_P): New.
3127 * name-lookup.h (push_local_binding): Delete.
3128 (do_toplevel_using_decl, do_local_using_decl): Rename to ...
3129 (finish_namespace_using_decl, finish_local_using_decl): ... here
3130 * name-lookup.c (add_decl_to_level): Swap args.
3131 (pop_bindings_and_leave_scope): Look inside TREE_LIST.
3132 (diagnose_name_conflict): Check contexts are same for redecl.
3133 (update_local_overload): New.
3134 (compparms_for_decl_and_using): Rename to ...
3135 (matching_fn_p): ... here.
3136 (pushdecl_maybe_friend_1): Adjust add_decl_to_level,
3137 push_local_bindings call.
3138 (push_local_binding): Make static, replace FLAGS arg with
3140 (validate_nonmember_using_decl): Use OVL_FIRST.
3141 (do_nonmember_using_decl): Use in/out parameters. Use
3142 lkp_iterator and simplify.
3143 (do_toplevel_using_decl, do_local_using_decl): Rename to ...
3144 (finish_namespace_using_decl, finish_local_using_decl): ... here.
3146 (lookup_type_current_level): Delete.
3147 * parser.c (cp_parser_using_declaration): Adjust.
3148 * pt.c (tsubst_expr): Adjust.
3150 2017-05-22 Nathan Sidwell <nathan@acm.org>
3152 * name-lookup.h (parse_using_directive): Replace with ...
3153 (finish_namespace_using_directive): ... this and ...
3154 (finish_local_using_directive): ... this.
3155 * name-lookup.c (add_using_namespace_1): Move later.
3156 (add_using_namespace): Move later, add namespace_p arg, remove
3158 (push_using_directive_1): Directly recurse.
3159 (do_using_directive, parse_using_directive): Delete, split into ...
3160 (finish_namespace_using_directive): ... this and ...
3161 (finish_local_using_directive): ... this.
3162 (push_namespace): Use add_using_namespace.
3163 * parser.c (cp_parser_using_directive): Call
3164 finish_namespace_using_directive or finish_local_using_directive.
3165 * pt.c (tsubst_expr): Call finish_local_using_directive.
3167 * cp-objcp-common.c (cp_register_dumps): Register raw dumper.
3168 * cp-tree.h (raw_dump_id): Declare.
3169 * decl2.c (raw_dump_id): Define.
3170 (dump_tu): Use raw_dump_id.
3172 * config-lang.in (gtfiles): Sort list, break lines.
3174 * cp-tree.h (CPTI_TERMINATE, CPTI_CALL_UNEXPECTED): Rename to ...
3175 (CPTI_TERMINATE_FN, CPTI_CALL_UNEXPECTED_FN): ... here.
3176 ( CPTI_GET_EXCEPTION_PTR_FN, CPTI_BEGIN_CATCH_FN, CPTI_END_CATCH_FN,
3177 CPTI_ALLOCATE_EXCEPTION_FN, CPTI_FREE_EXCEPTION_FN, CPTI_THROW_FN,
3178 CPTI_RETHROW_FN): New.
3179 (noexcept_deferred_spec): New.
3180 (terminate_node, call_unexpected_node): Rename to ...
3181 (terminate_fn, call_unexpected_fn): ... here.
3182 (get_exception_ptr_fn, begin_catch_fn, end_catch_fn,
3183 allocate_exception_fn, free_exception_fn, throw_fn, rethrow_fn): New.
3184 * except.c (fn1..fn5, throw_fn, rethrow_rn, spec): Delete.
3185 (init_exception_processing): Adjust.
3186 (declare_library_fn): Create and push the fns here.
3187 (do_get_exception_ptr, do_begin_catch, do_end_catch,
3188 do_allocate_exception_ptr, do_free_exception_ptr): Adjust
3189 declare_library_fn use.
3190 (unevaluated_noexcept_spec): Adjust.
3191 * cp-gimplify.c (genericize_eh_spec_block,
3192 gimplify_most_not_throw_expr): Adjust.
3194 * name-lookup.c (pushdecl_top_level,
3195 pushdecl_top_level_and_finish): Move after namespace pushing and
3197 (push_to_top_level): Rename to ...
3198 (do_push_to_top_level): ... here. Remove timing code.
3199 (pop_from_top_level_1): Rename to ...
3200 (do_pop_from_top_level): ... here.
3201 (do_push_nested_namespace, do_pop_nested_namespace)
3202 (push_to_top_level): New wrapper for do_push_to_top_level.
3203 (pop_from_top_level): Adjust.
3204 (push_nested_namepace, pop_nested_namespace): Wrappers for workers.
3206 2017-05-19 Bernd Edlinger <bernd.edlinger@hotmail.de>
3208 * config-lang.in (gtfiles): Add c-family/c-format.c,
3209 except.c, init.c, lambda.c and friend.c.
3210 * class.c (dvirt_fn): Move out of function scope,
3212 * except.c (fn1-5, throw_fn, rethrow_fn, spec): Likewise.
3213 * init.c (fn): Likewise.
3214 * lambda.c (ptr_id, max_id): Likewise.
3215 * friend.c (global_friend): Add GTY attribute.
3217 2017-05-19 Nathan Sidwell <nathan@acm.org>
3219 * call.c (add_list_candidates): Use OVL_FIRST.
3220 (build_new_method_call_1): Likewise.
3221 * cp-tree.h (OVL_SINGLE_P): New.
3222 (TYPE_HIDDEN_P): New.
3223 * decl.c (xref_tag_1): Use TYPE_HIDDEN_P.
3224 * dump.c (cp_tump_tree): Adjust overload dumping.
3225 * error.c (dump_decl): Use OVL_SINGLE_P, simplify context
3227 * method.c (lazily_declare_fn): Assert we added it.
3228 * parser.c (cp_parser_nested_name_specifier): Use OVL_SINGLE_P,
3230 (cp_parser_template_name): Use lkp_iterator.
3231 * pt.c (begin_template_parm_list): Fixup comment.
3232 (instantiate_class_template_1): Use TYPE_HIDDEN_P.
3233 * tree.c (ovl_iterator::remove_node): Cope with inherited ctors.
3234 (ovl_scope): Use lkp_iterator.
3236 2017-05-19 Thomas Schwinge <thomas@codesourcery.com>
3238 * parser.c (cp_parser_omp_clause_default): Handle
3239 "OMP_CLAUSE_DEFAULT_PRESENT".
3241 * parser.c (cp_parser_omp_clause_default): Avoid printing more
3242 than one syntax error message.
3244 2017-05-19 Nathan Sidwell <nathan@acm.org>
3246 * class.c (class_dump_id): Define.
3247 (dump_class_hierarchy, dump_vtable, dump_vtt): Use it.
3248 * cp-objcp-common.c (cp_register_dumps): New.
3249 * cp-objcp-common.h (cp_register_dumps): Declare.
3250 (LANG_HOOKS_REGISTER_DUMPS): Override.
3251 * cp-tree.h (class_dump_id): Declare.
3253 2017-05-18 Nathan Sidwell <nathan@acm.org>
3255 * cp-tree.h (OVL_ARG_DEPENDENT): Delete.
3257 (lookup_keep): Declare.
3258 * name-lookup.c (add_function): Don't set OVL_ARG_DEPENDENT.
3259 * pt.c (tsubst_copy): Assert lookup is persistent.
3260 * semantics.c (finish_call_expr): Use lkp_iterator, call
3262 * tree.c (ovl_copy): New.
3263 (ovl_insert, ovl_iterator::remove_node): Copy immutable nodes.
3266 * cp-tree.h (OVL_USED): Replace with ...
3267 (OVL_USING_P): ... this.
3268 (ovl_iterator::using_p): Adjust.
3269 * name-lookup.c (push_overloaded_decl_1,
3270 do_nonmember_using_decl): Adjust.
3271 * search.c (lookup_field_r): Adjust.
3272 * tree.c (ovl_insert, ovl_scope): Adjust.
3274 * cp-tree.h (lookup_add): Swap args.
3275 (ovl_cons, build_overload): Delete.
3276 * name-lookup.c (add_function, push_overloaded_decl_1,
3277 do_nonmember_using_decl, merge_functions, remove_hidden_names):
3278 Use lookup_add, ovl_insert.
3279 * pt.c (check_explicit_specialization): Use lookup_add.
3280 (do_class_deduction): Likewise. Refactor if.
3281 * tree.c (lookup_add): Swap args.
3282 (ovl_cons, build_overload): Delete.
3284 * name-lookup.c (find_local_binding): New, broken out of ...
3285 (lookup_name_innermost_nonclass_level_1): ... here. Call it.
3286 (set_namespace_binding): Swap scope & name args.
3287 (namespace_binding_1): Likewise.
3288 (pushdecl_maybe_friend_1): Adjust set_namespace_binding call.
3289 (push_overloaded_decl_1): Likewise.
3290 (set_global_binding): Likewise.
3291 (get_namespace_binding): Adjust namespace_binding_1 call.
3293 2017-05-17 Nathan Sidwell <nathan@acm.org>
3295 * cp-tree.h (default_hash_traits <lang_identifier *>): New
3297 * name-lookup.c (lookup_extern_c_fun_in_all_ns): Delete.
3298 (extern_c_fns): New hash table.
3299 (check_extern_c_conflict): New, broken out of ...
3300 (pushdecl_maybe_friend_1): ... here. Call it.
3301 (c_linkage_bindings): Just look in hash table.
3303 2017-05-17 Ville Voutilainen <ville.voutilainen@gmail.com>
3307 Implement new C++ intrinsics __is_assignable and __is_constructible.
3308 * cp-tree.h (CPTK_IS_ASSIGNABLE, CPTK_IS_CONSTRUCTIBLE): New.
3310 * cxx-pretty-print.c (pp_cxx_trait_expression): Handle
3311 CPTK_IS_ASSIGNABLE and CPTK_IS_CONSTRUCTIBLE.
3312 * method.c (constructible_expr): Set cp_unevaluated.
3313 (is_xible_helper): New.
3314 (is_trivially_xible): Adjust.
3316 * parser.c (cp_parser_primary_expression): Handle
3317 RID_IS_ASSIGNABLE and RID_IS_CONSTRUCTIBLE.
3318 (cp_parser_trait_expr): Likewise.
3319 * semantics.c (trait_expr_value): Handle
3320 CPTK_IS_ASSIGNABLE and CPTK_IS_CONSTRUCTIBLE.
3322 2017-05-17 Nathan Sidwell <nathan@acm.org>
3324 * cp-tree.h (ovl_iterator::using_p): New predicate.
3325 (ovl_iterator::remove_node): New worker.
3326 (ovl_insert): Declare.
3327 * tree.c (ovl_insert): New.
3328 (ovl_iterator::remove_node): New.
3329 * class.c (add_method): Use ovl_iterator, ovl_insert.
3330 (clone_function_decl): Fix description.
3331 (clone_constructors_and_destructors): Use ovl_iterator.
3333 * class.c (handle_using_decl): Use OVL_FIRST, ovl_iterator.
3334 (maybe_warn_about_overly_private_class): Use ovl_iterator.
3335 (method_name_cmp, resort_method_name_cmp): Use OVL_NAME.
3336 (resort_type_method_vec, finish_struct_methods): Use OVL_FIRST.
3337 (get_base_fndecls): Use ovl_iterator.
3338 (warn_hidden): Use OVL_NAME, ovl_iterator.
3339 (add_implicitly_declared_members): Use ovl_iterator.
3340 * constraint.cc (normalize_template_id_expression): Use OVL_FIRST,
3342 (finish_shorthand_constraint): Simplify, use ovl_make.
3343 * pt.c (make_constrained_auto): Simplify. Use ovl_make.
3344 * search.c (shared_member_p): Use ovl_iterator.
3345 (lookup_field_fuzzy_info::fuzzy_lookup_fn): Use OVL_NAME.
3346 (lookup_conversion_operator): Use OVL_FIRST.
3347 (lookup_fnfiels_idx_nolazy): Use OVL_FIRST, OVL_NAME.
3348 (look_for_overrides_here): Use ovl_iterator.
3349 (lookup_conversions_r): Use OVL_FIRST, OVL_NAME, ovl_iterator.
3350 * typeck.c (build_x_unary_op): Use ovl_make.
3352 2017-05-17 Martin Liska <mliska@suse.cz>
3354 * class.c (dump_class_hierarchy): Introduce dump_flags_t type and
3355 use it instead of int type.
3356 (dump_vtable): Likewise.
3357 (dump_vtt): Likewise.
3358 * decl2.c (dump_tu): Likewise.
3360 2017-05-16 David Malcolm <dmalcolm@redhat.com>
3362 * call.c (enforce_access): Add access_failure_info * param and use
3363 it to record access failures.
3364 * cp-tree.h (class access_failure_info): New class.
3365 (enforce_access): Add access_failure_info * param, defaulting to
3367 (lookup_member): Likewise.
3368 (locate_field_accessor): New function decl.
3369 (perform_or_defer_access_check): Add access_failure_info * param,
3371 * search.c (lookup_member): Add access_failure_info * param and
3372 pass it on to call to perform_or_defer_access_check.
3373 (matches_code_and_type_p): New function.
3374 (field_access_p): New function.
3375 (direct_accessor_p): New function.
3376 (reference_accessor_p): New function.
3377 (field_accessor_p): New function.
3378 (struct locate_field_data): New struct.
3379 (dfs_locate_field_accessor_pre): New function.
3380 (locate_field_accessor): New function.
3381 * semantics.c (perform_or_defer_access_check): Add
3382 access_failure_info * param, and pass it on to call to
3384 * typeck.c (access_failure_info::record_access_failure): New method.
3385 (access_failure_info::maybe_suggest_accessor): New method.
3386 (finish_class_member_access_expr): Pass an access_failure_info
3387 instance to the lookup_member call, and call its
3388 maybe_suggest_accessor method afterwards.
3390 2017-05-16 Marek Polacek <polacek@redhat.com>
3394 * cp-gimplify.c (cp_fold): Handle SAVE_EXPR.
3396 2017-05-16 Nathan Sidwell <nathan@acm.org>
3398 * name-lookup.c (check_local_shadow): New, broke out of ...
3399 (pushdecl_maybe_friend_1): ... here. Call it.
3401 * cp-tree.h (OVL_NESTED_P, OVL_LOOKUP_P): New.
3402 (ovl_first): Move inline definition to end of file.
3403 (ovl_make, lookup_add): Declare.
3404 (get_fns, get_first_fn): Make pure.
3405 * tree.c (ovl_cache): New.
3406 (ovl_make, lookup_add): New.
3407 * pt.c (do_class_deduction): Don't add candidates that will be
3410 * call.c (build_user_type_conversion_1): Use OVL_FIRST.
3411 (print_error_for_call_failure): Use OVL_NAME.
3412 (build_op_call_1): Use ovl_iterator.
3413 (add_candidates): Use OVL_FIRST & lkp_iterator.
3414 (build_op_delete_call): Use MAYBE_BASELINK_FUNCTIONS &
3416 * class.c (deduce_noexcept_on_destructors): Use ovl_iterator.
3417 (type_has_user_nondefault_constructor,
3418 in_class_defaulted_default_constructor,
3419 type_has_user_provided_constructor,
3420 type_has_user_provided_or_explicit_constructor,
3421 type_has_non_user_provided_default_constructor,
3422 vbase_has_user_provided_move_assign,
3423 type_has_move_constructor, type_has_move_assign,
3424 type_has_user_declared_move_constructor,
3425 type_has_user_declared_move_assign,
3426 type_build_ctor_call, type_build_dtor_call,
3427 type_requires_array_cookie, explain_non_literal_class): Likewise.
3428 (finish_struct): Use lkp_iterator.
3429 (resolve_address_of_overloaded_function): Use OVL_NAME, lkp_iterator.
3430 (note_name_declared_in_class): Use OVL_NAME.
3431 * cxx-pretty-print.c (pp_cxx_unqualified_id): Use OVL_FIRST.
3432 (pp_cxx_qualified_id, cxx_pretty_printer::id_expression,
3433 cxx_pretty_printer::expression): Likewise.
3434 * decl2.c (check_classfn): Use ovl_iterator.
3435 * pt.c (retrieve_specialization): Use ovl_iterator.
3436 * tree.c (cp_tree_equal): Use lkp_iterator.
3437 (type_has_nontrivial_copy_init): Use ovl_iterator.
3439 * typeck2.c (cxx_incomplete_type_diagnostic): Revert change and
3440 check is_overloaded_fn.
3442 2017-05-16 Martin Liska <mliska@suse.cz>
3444 * parser.c (cp_lexer_print_token): Add default value for flags
3445 argument of print_gimple_stmt, print_gimple_expr,
3446 print_generic_stmt and print_generic_expr.
3448 2017-05-16 Nathan Sidwell <nathan@acm.org>
3450 * cp-tree.h (class ovl_iterator, class lkp_iterator): New OVERLOAD
3452 (MAYBE_BASELINK_FUNCTIONS): New.
3453 * constraint.cc (resolve_constraint_check): Use lkp_iterator.
3454 * decl2.c (maybe_warn_sized_delete): Use ovl_iterator.
3455 * lambda.c (maybe_generic_this_capture): Use lkp_iterator.
3456 * method.c (inherited_ctor_binfo): Use ovl_iterator.
3457 (binfo_inherited_from): Likewise.
3458 * parser.c (lookup_literal_operator): Use lkp_iterator.
3459 * pt.c (iterative_hash_template_arg): Use lkp_iterator.
3460 (print_candidates_1): Likewise.
3461 (determine_specialization): Likewise.
3462 (resolve_overloaded_unification): Likewise.
3463 (resolve_nondeduced_context): Likewise.
3464 (type_dependent_expression_p): Likewise.
3465 (dependent_template_p): Likewise.
3466 * ptree.c (cxx_print_xnode): Likewise.
3467 * semantics.c (omp_reduction_lookup): Use lkp_iterator.
3468 (classtype_has_nothrow_assign_or_copy_p): Use ovl_iterator.
3469 * typeck.c (check_template_keyword): Use lkp_iterator.
3471 * cp-tree.h (OVL_FIRST, OVL_NAME): New.
3473 * constexpr.c (function_concept_check): Use OVL_FIRST.
3474 * cvt.c (build_expr_type_conversion): Likewise.
3475 * decl.c (poplevel, grokdeclarator): Use OVL_NAME.
3476 * decl2.c (mark_used): Use OVL_FIRST.
3477 * error.c (dump_decl): Use OVL_FIRST, OVL_NAME.
3478 (dump_expr, location_of): Use OVL_FIRST.
3479 * friend.c (do_friend): Use OVL_NAME.
3480 * init.c (build_offset_ref): Use OVL_FIRST.
3481 * mangle.c (write_member_name): Likewise.
3482 (write_expression): Use OVL_NAME.
3483 * method.c (strip_inheriting_ctors): Use OVL_FIRST.
3484 * name-lookup.c (pushdecl_class_level): Use OVL_NAME.
3485 * pt.c (check_explicit_specialization): Use OVL_FIRST.
3486 (check_template_shadow): Likewise.
3487 (tsubst_template_args): Use OVL_NAME.
3488 (tsubst_baselink): Use OVL_FIRST.
3489 * semantics.c (perform_koenig_lookup): Use OVL_NAME.
3490 * tree.c (get_first_fn): Use OVL_FIRST.
3491 * typeck.c (finish_class_member_access_expr): Use OVL_NAME.
3492 (cp_build_addr_expr_1): Use OVL_FIRST.
3494 * pt.c (tsubst_copy_and_build): Remove unnecessary COMPONENT_REF
3496 * semantics.c (finish_id_expression): Directly init local var.
3497 (finish_omp_reduction_clause): Use really_overloaded_fn.
3498 * tree.c (get_fns): Document. Assert we got an overload.
3499 (get_first_fn) Document.
3500 * typeck.c (cp_build_addr_expr_1): Pass arg directly to
3501 really_overloaded_fn.
3502 * typeck2.c (cxx_incomplete_type_diagnostic): Use get_first_fn directly.
3504 * cp-tree.h (SCOPE_DEPTH): New.
3505 * name-lookup.h (is_nested_namespace): Declare.
3506 * name-lookup.c (is_nested_namespace): New.
3507 (is_ancestor): Use it.
3508 (set_decl_namespace): Likewise.
3509 (push_namespace): Set SCOPE_DEPTH.
3510 * pt.c (check_specialization_namespace): Use is_nested_namespace.
3511 (check_unqualigied_spec_or_inst): Likewise.
3513 2017-05-15 Nathan Sidwell <nathan@acm.org>
3516 * cp-tree.h (DECL_NAMESPACE_INLINE_P): New.
3517 * name-lookup.h (push_namespace): Return int, add make_inline arg.
3518 * name-lookup.c (push_namespace): Deal with inline directly.
3519 Return pushed count.
3520 * parser.c (cp_parser_namespace_definition): Adjust for
3521 push_namespace change.
3523 2017-05-11 Nathan Sidwell <nathan@acm.org>
3525 * cp-lang.c (get_global_decls, cxx_pushdecl, LANG_HOOK_GETDECLS,
3526 LANG_HOOKS_PUSHDECL): Move to ...
3527 * cp-objcp-common.c (cp_get_global_decls, cp_pushdec,
3528 LANG_HOOK_DECLS, LANG_HOOKS_PUSHDECL): ... here.
3529 * cp-objcp-common.h (cp_get_global_decls, cp_pushdecl): Declare.
3531 * name-lookup.h (pushdecl): Add default friend parm.
3532 (pushdecl_maybe_friend): Delete.
3533 (pushdecl_top_level): Add default friend parm.
3534 (pushdecl_top_level_maybe_friend): Delete.
3535 * name-lookup.c (pushdecl_maybe_friend): Delete.
3536 (pushdecl): Add is_friend parm.
3537 (pushdecl_top_level): Add is friend_parm.
3538 (pushdecl_top_level_maybe_friend, pushdecl_top_level_1): Delete.
3539 (pushdecl_top_level_and_finish): Do pushing and finishing directly.
3540 * friend.c (do_friend): Adjust.
3541 * pt.c (tsubst_friend_class): Adjust.
3543 Revert pushdecl_top_level_and_finish name change.
3544 * name-lookup.h (pushdecl_top_level_and_finish): Resurrect old name.
3545 * name-lookup.c (pushdecl_top_level_and_finish): Likewise.
3546 * decl.c (cp_make_fname_decl): Adjust.
3547 * decl2.c (get_guard, handle_tls_init): Adjust.
3548 * rtti.c (get_tinfo_decl, tinfo_base_init): Adjust.
3550 * name-lookup.c (pushdecl_outermost_localscope): Always
3551 conditionally stop timer.
3553 * decl.c (xref_tag_1): Don't frob ts_lambda scope here.
3554 * name-lookup.c (pushtag_1): Deal with ts_lambda scope.
3556 * cp-tree.h (pushdecl, pushdecl_maybe_friend, pushtag,
3557 pushtag_top_level_maybe_friend,
3558 pushdecl_top_level_and_finish): Move declarations to ...
3559 * name-lookup.h: ... here. Group pushdecl variants.
3560 (pushdecl_top_level_and_finish): Rename to ...
3561 (pushdecl_top_level_with_init): ... here.
3562 * decl.c (cp_make_fname_decl): Use pushdecl_top_level_with_init.
3563 * decl2.c (get_guard, handle_tls_init): Likewise.
3564 * rtti.c (get_tinfo_decl, tinfo_base_init): Likewise.
3565 * lambda.c (maybe_add_lambda_conv_op): Use namespace_bindings_p.
3566 * method.c (implicitly_declare_fn): Likewise.
3567 * searchc (node_debug_info_needed): Likewise.
3568 * name-lookup.c (pushdecl_top_level_and_finish): Rename to ...
3569 (pushdecl_top_level_with_init): ... here.
3570 (pop_everything): Use namespace_bindings_p.
3572 * name-lookup.h (pop_binding): Rename to pop_local_binding.
3573 (getdecls): Rename to get_local_decls.
3574 * name-lookup.c (pop_binding): Rename to ...
3575 (pop_local_binding): ... here.
3576 (pop_bindings_and_leave_scope): Adjust.
3577 (getdecls): Rename to ...
3578 (get_local_decls): ... here. Assert local scope.
3579 * decl.c (poplevel): Assert not namespace. Adjust and simplify
3581 (store_parm_decls): Adjust get_local_decls call.
3582 (parser.c (synthesize_implicit_template_parm): Likewise.
3584 2017-05-11 Ville Voutilainen <ville.voutilainen@gmail.com>
3587 * method.c (is_trivially_xible): Reject void types.
3589 2017-05-10 Nathan Sidwell <nathan@acm.org>
3591 * class.c (handle_using_decl): Always use OVL_CURRENT.
3592 (resolve_address_of_overloaded_function): Move iterator decl into
3593 for scope. Don't strip anticipated decls here.
3595 * pt.c (print_candidates_1): Separate TREE_LIST and OVERLOAD
3597 (print_candidates): Adjust.
3599 * cp-tree.h (build_new_function_call): Lose koenig_p arg. Fix
3601 * call.c (build_new_function_call): Lose koenig_p arg. Remove
3602 koenig_p handling here.
3603 * pt.c (push_template_decl_real): Unconditionally retrofit_lang_decl.
3604 (tsubst_omp_clauses): Likewise.
3605 (do_class_deduction): Adjust buld_new_function_call calls.
3606 * semantics.c (finish_call_expr): Likewise.
3608 2017-05-10 Jason Merrill <jason@redhat.com>
3610 * pt.c (unify_parameter_deduction_failure, unify_cv_qual_mismatch)
3611 (unify_type_mismatch, unify_parameter_pack_mismatch)
3612 (unify_ptrmem_cst_mismatch, unify_expression_unequal)
3613 (unify_parameter_pack_inconsistent, unify_inconsistency)
3614 (unify_vla_arg, unify_method_type_error, unify_arity)
3615 (unify_arg_conversion, unify_no_common_base)
3616 (unify_inconsistent_template_template_parameters)
3617 (unify_template_deduction_failure)
3618 (unify_template_argument_mismatch)
3619 (unify_overload_resolution_failure): Call unify_invalid.
3621 CWG 1847 - Clarifying compatibility during partial ordering
3622 * pt.c (more_specialized_fn): No order between two non-deducible
3625 * pt.c (dependent_type_p): Make sure we aren't called with
3628 PR c++/79549 - C++17 ICE with non-type auto template parameter pack
3629 * pt.c (convert_template_argument): Just return an argument pack.
3630 (coerce_template_parameter_pack, template_parm_to_arg)
3631 (extract_fnparm_pack, make_argument_pack, tsubst_template_args)
3632 (tsubst_decl, tsubst, type_unification_real, unify_pack_expansion):
3633 Don't set the type of a NONTYPE_ARGUMENT_PACK.
3634 * parser.c (make_char_string_pack, make_string_pack): Likewise.
3636 2017-05-10 Nathan Sidwell <nathan@acm.org>
3638 * cp-tree.h (add_method, clone_function_decl): Change last arg to
3640 * class.c (add_method): Change third arg to bool. Adjust.
3641 (one_inheriting_sig, one_inherited_ctor): Adjust.
3642 (clone_function_decl): Change 2nd arg to bool. Adjust.
3643 (clone_constructors_and_destructors): Adjust.
3644 * lambda.c (maybe_add_lambda_conv_op): Adjust.
3645 * method.c (lazily_declare_fn): Adjust.
3646 * pt.c (tsubst_decl, instantiate_template_1): Adjust.
3647 * semantics.c (finish_member_declaration): Adjust.
3649 2017-05-10 Paolo Carlini <paolo.carlini@oracle.com>
3652 * decl.c (finish_function): To improve error recovery, change the
3653 logic for calling apply_deduced_return_type.
3655 2017-05-09 Jason Merrill <jason@redhat.com>
3657 PR c++/80605 - __is_standard_layout and empty base
3658 * class.c (check_bases): Ignore empty bases.
3660 PR c++/70979 - literal class and closure types
3661 * class.c (finalize_literal_type_property): Handle closures
3663 (explain_non_literal_class): Likewise.
3665 PR c++/66297, DR 1684 - literal class and constexpr member fns
3666 * constexpr.c (is_valid_constexpr_fn): Only complain about
3667 non-literal enclosing class in C++11.
3668 * class.c (finalize_literal_type_property): Likewise.
3670 2017-05-09 Paolo Carlini <paolo.carlini@oracle.com>
3673 * pt.c (tsubst_decl): Early return error_mark_node if
3674 grok_ctor_properties returns false.
3676 2017-05-09 Jason Merrill <jason@redhat.com>
3678 PR c++/70167 - array prvalue treated as lvalue
3679 * cp-tree.h (CONSTRUCTOR_C99_COMPOUND_LITERAL): New.
3681 * semantics.c (finish_compound_literal): Add fcl_context parameter.
3682 Only make a static variable for C99 syntax.
3683 * parser.c (cp_parser_postfix_expression): Pass it.
3684 * pt.c (tsubst_copy_and_build): Likewise.
3685 * call.c (extend_ref_init_temps): Set
3686 DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P.
3688 2017-05-09 Nathan Sidwell <nathan@acm.org>
3690 * cp-lang.c (get_global_decls, cxx_pushdecl): New.
3691 (LANG_HOOKS_GETDECLS, LANG_HOOKS_PUSHDECL): Override.
3692 * name-lookup.h (pushdecl_top_level): Declare.
3694 2017-05-08 Jason Merrill <jason@redhat.com>
3696 PR c++/80178 - parameter passing for uncopyable classes
3697 * tree.c (type_has_nontrivial_copy_init): True for classes with only
3698 deleted copy/move ctors.
3699 (remember_deleted_copy, maybe_warn_parm_abi): New.
3700 * decl.c (require_complete_types_for_parms, check_function_type):
3701 Call maybe_warn_parm_abi.
3702 * call.c (convert_for_arg_passing, build_cxx_call): Likewise.
3704 2017-05-08 Nathan Sidwell <nathan@acm.org>
3706 * decl.c (builtin_function_1): Set DECL_ANTICIPATED before pushing.
3707 (start_preparsed_function): Do decl pushing before setting
3708 current_funciton_decl and announcing it.
3710 * name-lookup.h (pushdecl_with_scope): Replace with ...
3711 (pushdecl_outermost_localscope): ... this.
3712 * name-lookup.c (pushdecl_with_scope): Replace with ...
3713 (pushdecl_outermost_localscope): ... this.
3714 (pushdecl_namespace_level): Adjust.
3715 * decl.c (cp_make_fname_decl): Use pushdecl_outermost_localscope.
3716 * lambda.c (insert_capture_proxy): Likewise.
3718 * class.c (build_vtbl_initializer): Don't shadow outer variable
3721 Revert _binding -> _value change.
3722 * name-lookup.h (get_namespace_value, set_global_value): Rename to ...
3723 (get_namespace_binding, set_global_binding): ... these.
3724 * name-lookup.c (get_namespace_value, set_global_value): Rename to ...
3725 (get_namespace_binding, set_global_binding): ... these.
3726 (arg_assoc_namespace, pushdecl_maybe_friend_1,
3727 check_for_out_of_scope_variable, push_overloaded_decl_1,
3728 lookup_name_innermost_nonclass_level, push_namespace): Adjust.
3729 * cp-tree.h (IDENTIFIER_GLOBAL_VALUE,
3730 SET_IDENTIFIER_GLOBAL_VALUE): Adjust.
3731 * decl.c (poplevel): Adjust.
3732 * pt.c (make_constrained_auto): Likewise.
3734 2017-05-07 Volker Reichelt <v.reichelt@netcologne.de>
3736 PR translation/80280
3737 * call.c (print_z_candidate): Fix quoting.
3739 2017-05-05 David Malcolm <dmalcolm@redhat.com>
3741 * error.c (pedwarn_cxx98): Replace report_diagnostic
3742 with diagnostic_report_diagnostic.
3744 2017-05-05 Nathan Sidwell <nathan@acm.org>
3746 * cp-tree.h (IDENTIFIER_GLOBAL_VALUE): Use get_namespace_value.
3747 (SET_IDENTIFIER_GLOBAL_VALUE): Use set_global_value.
3748 (IDENTIFIER_NAMESPACE_VALUE): Delete.
3749 * name-lookup.h (namespace_binding, set_namespace_binding): Replace
3751 (get_namespace_value, set_global_value): ... these.
3752 (get_global_value_if_present, is_typename_at_global_scope): Delete.
3753 * decl.c (poplevel): Use get_namespace_value.
3754 (grokdeclarator): Use IDENTIFIER_GLOBAL_VALUE.
3755 * class.c (build_vtbl_initializer): Stash library decl in
3756 static var. Use IDENTIFIER_GLOBAL_VALUE.
3757 * except.c (do_get_exception_ptr, do_begin_catch, do_end_catch,
3758 do_allocate_exception, do_free_exception, build_throw): Likewise.
3759 * init.c (throw_bad_array_new_length): Likewise.
3760 * rtti.c (throw_bad_cast, throw_bad_typeid): Likewise.
3761 * name-lookup.c (arg_assoc_namespace, pushdecl_maybe_friend_1,
3762 check_for_our_of_scope_variable, push_overloaded_decl_1): Use
3763 get_namespace_value.
3764 (set_namespace_binding_1): Rename to
3765 (set_namespace_binding): ... here.
3766 (set_global_value): New.
3767 (lookup_name_innermost_nonclass_level_1, push_namespace): Use
3768 get_namespace_value.
3769 * pt.c (listify): Use get_namespace_value.
3771 * call.c (make_temporary_var_for_ref_to_temp): Push decl into
3773 * lex.c (unqualified_name_lookup_error): Likewise.
3775 * class.c (alter_class): Use retrofit_lang_decl directly.
3776 * decl.c (push_local_name, dupliate_decls): Likewise.
3777 * semantics.c (omp_privatize_field): Likewise.
3779 Kill walk_namespaces.
3780 * cp-tree.h (walk_namespaces_fn, walk_namespaces): Delete.
3781 * decl.c (walk_namespaces_r, walk_namespaces): Delete.
3783 Kill per-namespace static_decls.
3784 * cp-tree.h (static_decls): Declare.
3785 (wrapup_globals_for_namespace,
3786 diagnose_inline_vars_for_namespace): Replace with ...
3787 (wrapup_namespace_globals): ... this.
3788 * decl.c (static_decls): Define.
3789 (wrapup_globals_for_namespace,
3790 diagnose_inline_vars_for_namespace): Replace with ...
3791 (wrapup_namespace_globals): ... this.
3792 (cxx_init_decl_processing): Initialize static_decls.
3793 * decl2.c (c_parse_final_cleanups): Adjust.
3794 * name-lookup.h (cp_binding_level): Remove static_decls member.
3795 * name-lookup.c (add_decl_to_level): Adjust.
3796 (begin_scope): Adjust.
3798 2017-05-05 Paolo Carlini <paolo.carlini@oracle.com>
3801 * decl.c (reshape_init): Unconditionally return error_mark_node
3802 upon error about too many initializers.
3804 2017-05-04 Nathan Sidwell <nathan@acm.org>
3806 * constraint.cc (diagnose_check_constraint): Fix %E thinko.
3808 2017-05-04 Martin Sebor <msebor@redhat.com>
3810 PR translation/80280
3811 * call.c (print_z_candidate): Add missing quoting to %D and other
3813 (build_op_call_1): Same.
3814 * constraint.cc (diagnose_check_constraint): Same.
3815 * mangle.c (mangle_decl): Same.
3816 * name-lookup.c (cp_binding_level_debug): Same.
3817 (set_decl_namespace): Same.
3818 * parser.c (cp_parser_tx_qualifier_opt): Same.
3819 * pt.c (print_candidates_1): Same.
3820 (check_template_variable): Same.
3821 (tsubst_default_argument): Same.
3822 (most_specialized_partial_spec): Same.
3823 * semantics.c (omp_reduction_lookup): Same.
3824 * tree.c (check_abi_tag_redeclaration): Same.
3825 * typeck.c (comptypes): Same.
3826 * typeck2.c (abstract_virtuals_error_sfinae): Same.
3828 2017-05-04 Nathan Sidwell <nathan@acm.org>
3831 * cp-tree.h (enum cp_tree_index): Add CPTI_GLOBAL,
3832 CPTI_GLOBAL_TYPE, CPTI_GLOBAL_IDENTIFIER, CPTI_ANON_IDENTIFIER,
3833 CPTI_INIT_LIST_IDENTIFIER.
3834 (global_namespace, global_type_node, global_identifier,
3835 anon_identifier, init_list_identifier): New.
3836 * decl.c (global_type_node, global_scope_name): Delete.
3837 (initialize_predefined_identifiers): Add new identifiers.
3838 (cxx_init_decl_processing): Adjust.
3839 * name-lookup.h (global_namespace, global_type_node): Delete.
3840 * name-lookup.c (global_namespace, anonymous_namespace_name,
3841 get_anonymous_namespace_name): Delete.
3842 (namespace_scope_ht_size, begin_scope, pushtag_1,
3843 push_namespace): Adjust,
3844 * call.c (type_has_extended_temps): Use init_list_identifier.
3845 * pt.c (listify): Likewise.
3847 * name-lookup.c: Reorder functions to make merging from modules
3850 2017-05-03 Jason Merrill <jason@redhat.com>
3852 * constexpr.c (cxx_eval_outermost_constant_expr): Use TV_CONSTEXPR.
3854 2017-05-03 Nathan Sidwell <nathan@acm.org>
3856 * cp-tree.h (enum cp_tree_index, cp_global_trees): Move earlier,
3857 along with #defines, to before name-lookup include.
3859 2017-05-02 Paolo Carlini <paolo.carlini@oracle.com>
3861 * pt.c (is_auto_or_concept): Remove.
3862 (type_uses_auto_or_concept): Remove, unused.
3863 (find_parameter_packs_r, extract_autos_r, is_auto_r): Adjust.
3864 * parser.c (tree_type_is_auto_or_concept): Remove, unused.
3865 * cp-tree.h (is_auto_or_concept): Remove.
3867 2017-05-01 Xi Ruoyao <ryxi@stu.xidian.edu.cn>
3870 * cp-cilkplus.c (cilk_install_body_with_frame_cleanup): Don't
3871 add pedigree operation and detach call here.
3872 * cp-gimplify.c (cp_gimplify_expr): Remove the calls to
3873 cilk_cp_gimplify_call_params_in_spawned_fn.
3874 (cilk_cp_gimplify_call_params_in_spawned_fn): Remove function.
3875 * semantics.c (simplify_aggr_init_expr): Copy EXPR_CILK_SPAWN.
3877 2017-04-29 Volker Reichelt <v.reichelt@netcologne.de>
3879 * parser.c (cp_parser_member_declaration): Add fix-it hints for
3880 stray comma and missing semicolon at end of member declaration.
3882 2017-04-27 Volker Reichelt <v.reichelt@netcologne.de>
3884 * parser.c (cp_parser_cast_expression): Add target type of cast to
3886 * error.c (type_to_string): Add '{enum}' suffix to enumeration types.
3888 2017-04-26 Paolo Carlini <paolo.carlini@oracle.com>
3890 * decl.c (grok_ctor_properties, ambi_op_p, unary_op_p): Change
3891 return type to bool.
3892 * cp-tree.h (grok_ctor_properties): Update.
3894 2017-04-26 Volker Reichelt <v.reichelt@netcologne.de>
3896 * parser.c (cp_parser_nested_name_specifier_opt): Add fix-it
3897 information to diagnostic of invalid colon in nested-name-specifier.
3899 2017-04-25 Volker Reichelt <v.reichelt@netcologne.de>
3901 * parser.c (cp_parser_elaborated_type_specifier): Add fix-it to
3902 diagnostic of invalid class/struct keyword after enum.
3904 2017-04-25 David Malcolm <dmalcolm@redhat.com>
3906 * parser.c (cp_parser_member_declaration): Add fix-it hint
3907 for removing stray semicolons.
3909 2017-04-25 David Malcolm <dmalcolm@redhat.com>
3911 * name-lookup.c (get_std_name_hint): New function.
3912 (maybe_suggest_missing_header): New function.
3913 (suggest_alternative_in_explicit_scope): Call
3914 maybe_suggest_missing_header.
3916 2017-04-25 David Malcolm <dmalcolm@redhat.com>
3919 * name-lookup.c (suggest_alternative_in_explicit_scope): Convert
3920 candidate type of bm from tree to const char *.
3921 (consider_binding_level): Likewise.
3922 (lookup_name_fuzzy): Likewise, using this to merge the best
3923 result from the preprocessor into bm, rather than immediately
3924 returning, so that better matches from reserved words can "win".
3925 Guard the rejection of keywords that don't start decl-specifiers
3926 so it only happens for FUZZY_LOOKUP_TYPENAME.
3928 2017-04-24 Volker Reichelt <v.reichelt@netcologne.de>
3930 * decl.c (grokdeclarator): Use %qT instead of %<%T%> in diagnostics.
3931 (start_enum): Likewise.
3932 (build_enumerator): Likewise. Use %qE instead of plain %E.
3933 * parser.c (cp_parser_mem_initializer_list): Use %qD instead of
3934 %<%D%> in diagnostics.
3935 (cp_parser_elaborated_type_specifier): Likewise.
3936 * pt.c (make_pack_expansion): Use %qT and %qE instead of
3937 %<%T%> and %<%E%> in diagnostics.
3938 (tsubst_pack_expansion): Likewise.
3940 2017-04-24 David Malcolm <dmalcolm@redhat.com>
3943 * parser.c (cp_parser_unary_expression): Generate a location
3944 range for alignof and sizeof expressions.
3946 2017-04-24 Volker Reichelt <v.reichelt@netcologne.de>
3948 * parser.c (cp_parser_cv_qualifier_seq_opt): Add fix-it info to
3950 (cp_parser_virt_specifier_seq_opt): Likewise.
3951 (set_and_check_decl_spec_loc): Likewise twice.
3953 2017-04-21 Jason Merrill <jason@redhat.com>
3955 PR c++/80179 - ICE with initialized flexible array member.
3956 * constexpr.c (verify_ctor_sanity): Handle flexible array members.
3958 2017-04-21 Richard Biener <rguenther@suse.de>
3960 * cp-tree.h (copy_decl): Annotate with CXX_MEM_STAT_INFO.
3961 (copy_type): Likewise.
3962 * lex.c (copy_decl): Pass down mem-stat info.
3963 (copy_type): Likewise.
3965 2017-04-20 Jonathan Wakely <jwakely@redhat.com>
3968 * init.c (build_new_1): Suppress notes about over-aligned new when
3969 the warning is suppressed.
3971 2017-04-20 Volker Reichelt <v.reichelt@netcologne.de>
3973 * parser.c (cp_parser_member_declaration): Add warning with fixit
3974 information for extra semicolon after in-class function definition.
3976 2017-04-20 Jakub Jelinek <jakub@redhat.com>
3979 * tree.c (build_cplus_array_type): Call build_array_type
3980 with the intended TYPE_TYPELESS_STORAGE flag value, instead
3981 of calling build_array_type and modifying later TYPE_TYPELESS_STORAGE
3984 2017-04-18 Marek Polacek <polacek@redhat.com>
3986 PR c++/80244 - ICE with attribute in template alias.
3987 * tree.c (strip_typedefs): Handle UNDERLYING_TYPE.
3989 PR c++/80241 - ICE with alignas pack expansion.
3990 * error.c (dump_expr): Handle TREE_LIST.
3991 * parser.c (cp_parser_std_attribute_list): Return error_mark if
3992 make_pack_expansion returns an error.
3994 2017-04-17 Bernd Edlinger <bernd.edlinger@hotmail.de>
3997 * class.c (fixup_may_alias): Fix all type variants.
3999 2017-04-17 Jason Merrill <jason@redhat.com>
4001 PR c++/80415 - wrong error with default arg and array reference.
4002 * tree.c (lvalue_kind): Return clk_class for an array prvalue.
4004 * pt.c (tsubst_init): Set TARGET_EXPR_DIRECT_INIT_P.
4006 2017-04-15 Alexandre Oliva <aoliva@redhat.com>
4008 * decl.c (name_unnamed_type): Split out of...
4009 (grokdeclarator): ... this.
4010 * decl.h (name_unnamed_type): Declare.
4012 2017-04-12 Richard Biener <rguenther@suse.de>
4013 Bernd Edlinger <bernd.edlinger@hotmail.de>
4016 * tree.c (build_cplus_array_type): Set TYPE_TYPELESS_STORAGE
4017 for arrays of character or std::byte type.
4019 2017-04-11 Jason Merrill <jason@redhat.com>
4021 PR c++/80294 - ICE with constexpr and inheritance.
4022 * constexpr.c (reduced_constant_expression_p):
4023 A null constructor element is non-constant.
4024 (cxx_eval_indirect_ref): Don't VERIFY_CONSTANT before
4025 returning an empty base.
4027 2017-04-11 Jakub Jelinek <jakub@redhat.com>
4030 * decl.c (cp_finish_decomp): If processing_template_decl on
4031 non-dependent decl, only set TREE_TYPE on the v[i] decls, but don't
4032 change their DECL_VALUE_EXPR nor cp_finish_decl them. Instead make
4033 sure DECL_VALUE_EXPR is the canonical NULL type ARRAY_REF for tsubst
4035 * pt.c (value_dependent_expression_p) <case VAR_DECL>: For variables
4036 with DECL_VALUE_EXPR, return true if DECL_VALUE_EXPR is type
4039 2017-04-11 Jakub Jelinek <jakub@redhat.com>
4042 * error.c (dump_expr): Handle VEC_COND_EXPR like COND_EXPR.
4044 2017-04-10 Jakub Jelinek <jakub@redhat.com>
4047 * tree.c (lvalue_kind): For COMPONENT_REF with BASELINK second
4048 operand, if it is a static member function, recurse on the
4051 2017-04-10 Marek Polacek <polacek@redhat.com>
4054 * typeck.c (cp_build_binary_op): Use NULL_TREE instead of NULL. Set
4055 ORIG_TYPE earlier and not only when shortening.
4057 2017-04-07 Jason Merrill <jason@redhat.com>
4059 PR c++/80356 - ICE with reference to function template argument.
4061 * pt.c (convert_nontype_argument_function): Adjust type even with a
4062 value-dependent argument.
4064 PR c++/80267 - ICE with nested capture of reference
4066 * pt.c (tsubst_copy): Handle lookup finding a capture proxy.
4068 2017-04-07 Marek Polacek <polacek@redhat.com>
4071 * typeck.c (cp_build_binary_op): Convert COP[01] to ORIG_TYPE.
4074 * call.c (build_over_call): Don't check cxx_dialect.
4075 * cp-gimplify.c (cp_gimplify_init_expr): Don't check cxx_dialect nor
4076 whether SUB is a CONSTRUCTOR.
4077 * init.c (build_new_1): Don't check cxx_dialect.
4078 * tree.c (replace_placeholders): Add a function comment. Return if
4079 not in C++14, or if the object isn't a (member of a) class.
4080 * typeck2.c (store_init_value): Don't check cxx_dialect nor whether
4081 TYPE is CLASS_TYPE_P.
4083 2017-04-05 Jakub Jelinek <jakub@redhat.com>
4086 * pt.c (canonical_type_parameter): Use vec_safe_grow_cleared instead
4087 of a loop doing vec_safe_push of NULL. Formatting fixes.
4088 (rewrite_template_parm): Copy TEMPLATE_PARM_PARAMETER_PACK from oldidx
4089 to newidx before calling canonical_type_parameter on newtype.
4091 2017-04-04 Volker Reichelt <v.reichelt@netcologne.de>
4094 * cxx-pretty-print.c (cxx_pretty_printer::expression): Add
4095 UNARY_PLUS_EXPR case.
4097 2017-04-03 Jason Merrill <jason@redhat.com>
4099 * semantics.c (finish_template_type): Check CLASSTYPE_TEMPLATE_INFO.
4101 2017-04-03 Jonathan Wakely <jwakely@redhat.com>
4103 * class.c (update_vtable_entry_for_fn): Fix typo in comment.
4104 * decl2.c (one_static_initialization_or_destruction): Likewise.
4105 * name-lookup.c (store_bindings): Likewise.
4106 * parser.c (make_call_declarator): Likewise.
4107 * pt.c (check_explicit_specialization): Likewise.
4109 2017-04-03 Jason Merrill <jason@redhat.com>
4111 PR sanitizer/79993 - ICE with VLA initialization from string
4112 PR c++/69487 - wrong VLA initialization from string
4113 * init.c (finish_length_check): Split out from build_vec_init.
4114 (build_vec_init): Handle STRING_CST.
4115 * typeck2.c (split_nonconstant_init): Handle STRING_CST.
4116 (digest_init_r): Don't give a STRING_CST VLA type.
4118 2017-03-31 Jakub Jelinek <jakub@redhat.com>
4121 * cp-gimplify.c (cp_genericize_r): Sanitize INTEGER_CSTs with
4122 REFERENCE_TYPE. Adjust ubsan_maybe_instrument_reference caller
4123 for NOP_EXPR to REFERENCE_TYPE.
4126 * cp-tree.h (enum cp_trait_kind): Add CPTK_IS_AGGREGATE.
4127 * cxx-pretty-print.c (pp_cxx_trait_expression): Handle
4129 * semantics.c (trait_expr_value): Handle CPTK_IS_AGGREGATE.
4130 Remove extraneous parens.
4131 (finish_trait_expr): Handle CPTK_IS_AGGREGATE.
4132 * parser.c (cp_parser_primary_expression): Handle RID_IS_AGGREGATE.
4133 (cp_parser_trait_expr): Likewise.
4135 2017-03-27 Jakub Jelinek <jakub@redhat.com>
4138 * cp-tree.h (cxx_mark_addressable): Add array_ref_p argument.
4139 * typeck.c (cxx_mark_addressable): Likewise. Look through
4140 VIEW_CONVERT_EXPR unless array_ref_p and VCE is from VECTOR_TYPE
4142 (cp_build_array_ref): Pass true as array_ref_p to cxx_mark_addressable.
4144 2017-03-24 Jason Merrill <jason@redhat.com>
4146 PR c++/77339 - ICE with invalid use of alias template.
4147 * pt.c (lookup_template_class_1): Don't try to enter the scope of an
4150 2017-03-24 Marek Polacek <polacek@redhat.com>
4153 * cp-gimplify.c (cp_fold): Strip CLEANUP_POINT_EXPR if the expression
4154 doesn't have side effects.
4156 2017-03-23 Jason Merrill <jason@redhat.com>
4158 PR c++/80150 - ICE with overloaded variadic deduction.
4159 * pt.c (try_one_overload): Remove asserts.
4161 PR c++/77563 - missing ambiguous conversion error.
4162 * call.c (convert_like_real): Use LOOKUP_IMPLICIT.
4164 2017-03-23 Marek Polacek <polacek@redhat.com>
4166 * cp-tree.h: Remove a C_RID_YYCODE reference.
4168 2017-03-22 Jakub Jelinek <jakub@redhat.com>
4171 * semantics.c (finish_omp_clause) <case OMP_CLAUSE_SIMDLEN,
4172 case OMP_CLAUSE_ALIGNED>: Call maybe_constant_value only when not
4173 processing_template_decl.
4175 2017-03-21 Paolo Carlini <paolo.carlini@oracle.com>
4178 * name-lookup.c (pushtag_1): Add check for bogus, non template,
4179 std::initializer_list.
4181 2017-03-21 Jakub Jelinek <jakub@redhat.com>
4184 * init.c (std_placement_new_fn_p, build_new_1): Formatting fixes.
4186 2017-03-21 Ville Voutilainen <ville.voutilainen@gmail.com>
4189 * init.c (std_placement_new_fn_p): New.
4190 (build_new_1): Call it.
4192 2017-03-20 Jason Merrill <jason@redhat.com>
4194 PR c++/80096 - ICE with C++17 non-type auto.
4195 * pt.c (tsubst): Delay tsubst of type of template non-type
4198 PR c++/79519 - ICE with deleted template friend.
4199 * decl.c (grokdeclarator): Complain about misplaced function
4200 definition using =, as well.
4202 PR c++/79640 - infinite recursion with generic lambda.
4203 * pt.c (tsubst_copy) [VAR_DECL]: Register the dummy instantiation
4204 before substituting its initializer.
4206 2017-03-20 Marek Polacek <polacek@redhat.com>
4207 Paolo Carlini <paolo.carlini@oracle.com>
4209 PR c++/80059 - ICE with noexcept and __transaction_atomic
4210 * except.c (build_must_not_throw_expr): Call
4211 instantiate_non_dependent_expr.
4213 2017-03-19 Jason Merrill <jason@redhat.com>
4215 PR c++/80084 - wrong C++17 decomposition by reference of parameter.
4216 * decl.c (cp_finish_decomp): Don't pull out the DECL_INITIAL of a
4217 reference decomposition.
4219 PR c++/80077 - error with constexpr and -fno-elide-constructors.
4220 * constexpr.c (cxx_eval_call_expression): Set ctx->call while
4221 expanding trivial constructor.
4223 2017-03-17 Jason Merrill <jason@redhat.com>
4225 PR c++/78345 - ICE initializing array from lambda.
4226 * init.c (build_aggr_init): Check array initializer.
4227 (build_vec_init): Check the type of a CONSTRUCTOR.
4229 PR c++/80073 - C++17 ICE with virtual base.
4230 * decl.c (xref_basetypes): Also check for indirect vbases.
4232 2017-03-16 Jason Merrill <jason@redhat.com>
4234 * decl.c (start_enum): std::byte aliases anything.
4237 * constexpr.c (lookup_placeholder): Tweak.
4239 2017-03-15 Jason Merrill <jason@redhat.com>
4241 PR c++/80043 - ICE with -fpermissive
4242 * typeck.c (convert_for_assignment): Handle instantiate_type
4243 not giving an error.
4245 2017-03-14 Nathan Sidwell <nathan@acm.org>
4247 PR c++/79393 DR 1658 workaround
4248 * method.c (synthesized_method_base_walk): Inihibit abstract class
4249 virtual base access check here.
4250 (synthesized_method_walk): Not here.
4252 2017-03-13 Nathan Sidwell <nathan@acm.org>
4254 PR c++/79393 DR 1658 workaround
4255 * method.c (synthesized_method_walk): Check vbases of abstract
4256 classes for dtor walk.
4258 2017-03-10 David Malcolm <dmalcolm@redhat.com>
4260 PR translation/79848
4261 * decl.c (grokfndecl): Simplify uses of "%<%s%>" to "%qs".
4263 2017-03-10 Jason Merrill <jason@redhat.com>
4265 PR c++/79960 - alias templates and partial ordering
4266 * pt.c (comp_template_args): Add partial_order parm.
4267 (template_args_equal): Likewise.
4268 (comp_template_args_porder): New.
4269 (get_partial_spec_bindings): Use it.
4271 2017-03-10 Marek Polacek <polacek@redhat.com>
4274 * decl.c (grokdeclarator): Check ATTRLIST before dereferencing it.
4276 2017-03-10 Jakub Jelinek <jakub@redhat.com>
4279 * optimize.c (maybe_thunk_body): Don't ICE if fns[0] is NULL.
4280 Use XALLOCAVEC macro.
4283 * decl.c (finish_enum_value_list): If value is error_mark_node,
4284 don't copy it and change its type.
4285 * init.c (constant_value_1): Return error_mark_node if DECL_INITIAL
4286 of CONST_DECL is error_mark_node.
4288 2017-03-09 Marek Polacek <polacek@redhat.com>
4290 PR c++/79900 - ICE in strip_typedefs
4291 * tree.c (strip_typedefs): Skip the attribute handling if T is
4292 a variant type which hasn't been updated yet.
4294 PR c++/79687 - wrong code with pointer-to-member
4295 * init.c (constant_value_1): Break if the variable has a dynamic
4298 2017-03-08 Jason Merrill <jason@redhat.com>
4300 PR c++/79797 - ICE with self-reference in array DMI.
4301 * constexpr.c (lookup_placeholder): Split out...
4302 (cxx_eval_constant_expression): ...from here.
4304 2017-03-07 Jakub Jelinek <jakub@redhat.com>
4307 * parser.c (cp_parser_omp_cancellation_point,
4308 cp_parser_omp_target_enter_data, cp_parser_omp_target_exit_data,
4309 cp_parser_omp_target_update): Change "may only be used in compound
4310 statements" diagnostics, such that the same translatable string is
4311 used for all pragmas.
4312 (cp_parser_pragma): Likewise. Use error_at instead of
4313 cp_parser_error for that diagnostics.
4315 2017-03-06 Marek Polacek <polacek@redhat.com>
4317 PR c++/79796 - ICE with NSDMI and this pointer
4318 * call.c (build_over_call): Handle NSDMI with a 'this' by calling
4319 replace_placeholders.
4321 2017-03-06 Jakub Jelinek <jakub@redhat.com>
4324 * constexpr.c (cxx_eval_statement_list): Treat empty ({ }) like
4327 2017-03-06 Jason Merrill <jason@redhat.com>
4329 Revert "Allow deduction guides to look into primary template."
4330 * cp-tree.h, parser.c, pt.c, search.c: Revert.
4332 2017-03-05 Paolo Carlini <paolo.carlini@oracle.com>
4335 * except.c (build_must_not_throw_expr): Perform the implicit
4336 conversions on the condition.
4338 2017-03-03 Jason Merrill <jason@redhat.com>
4340 * mangle.c (mangle_decl): Check -Wnoexcept-type instead of
4343 Core issues 2273 and 2277
4344 * call.c (joust): Adjust using-declaration tiebreaker to handle
4345 the intermediate base case.
4346 * method.c (strip_inheriting_ctors): Just return the argument if
4347 !flag_new_inheriting_ctors.
4349 2017-03-03 Richard Biener <rguenther@suse.de>
4352 * cp-gimplify.c (simple_empty_class_p): Handle EMPTY_CLASS_EXPR.
4354 2017-03-03 Marek Polacek <polacek@redhat.com>
4357 * typeck.c (string_conv_p): In C++11, always call pedwarn with
4360 2017-03-02 Jason Merrill <jason@redhat.com>
4362 Update overload resolution with deduction guides.
4363 * pt.c (do_class_deduction): Always build the copy guide.
4364 (copy_guide_p, template_guide_p): New.
4365 (build_deduction_guide): Remember the original constructor.
4366 * call.c (joust): Prefer the copy guide and non-template guides.
4368 Allow deduction guides to look into primary template.
4369 * cp-tree.h (struct saved_scope): Add deduction_guide_type.
4370 (struct cp_decl_specifier_seq): Add constructor_p.
4371 * parser.c (cp_parser_decl_specifier_seq): Set constructor_p.
4372 (cp_parser_init_declarator): Check it. Set ctor_dtor_or_conv_p.
4373 Clear deduction_guide_type. Don't handle deduction guide names.
4374 (cp_parser_declarator): Don't clear ctor_dtor_or_conv_p.
4375 (cp_parser_direct_declarator): Likewise. Handle deduction guides.
4376 (cp_parser_member_declaration, cp_parser_cache_defarg)
4377 (cp_parser_objc_class_ivars): Set ctor_dtor_or_conv_p.
4378 * pt.c (tsubst_copy, tsubst_copy_and_build): Revert last change.
4379 (build_deduction_guide): Set deduction_guide_type.
4380 (dependent_scope_p): Check deduction_guide_type.
4381 * search.c (lookup_member): Likewise.
4383 2017-03-02 Jakub Jelinek <jakub@redhat.com>
4386 * init.c (mark_exp_read_r): New function.
4387 (emit_mem_initializers): Use cp_walk_tree with mark_exp_read_r on
4388 whole arguments instead of plain mark_exp_read on TREE_LIST values.
4390 2017-03-01 Jason Merrill <jason@redhat.com>
4392 Class template argument deduction in new-expression
4393 * init.c (build_new): Handle deduction from no initializer.
4394 * parser.c (cp_parser_new_expression): Don't require a single
4395 expression for class template deduction.
4396 * typeck2.c (cxx_incomplete_type_diagnostic): Fix diagnostic for
4397 class template placeholder.
4398 * pt.c (tsubst_copy) [TEMPLATE_DECL]: Handle dependent context.
4399 (tsubst_copy_and_build) [TEMPLATE_ID_EXPR]: Handle SCOPE_REF.
4400 (redeclare_class_template): Set TEMPLATE_TYPE_PARM_FOR_CLASS.
4402 2017-03-01 Jakub Jelinek <jakub@redhat.com>
4405 * init.c (emit_mem_initializers): When not constructing vbases of
4406 abstract classes, mark arguments as read for
4407 -Wunused-but-set-parameter.
4409 2017-02-28 Jason Merrill <jason@redhat.com>
4411 Class template argument deduction refinements
4412 * call.c (joust): Move deduction guide tiebreaker down.
4413 * decl.c (start_decl_1, cp_finish_decl, grokdeclarator): Allow class
4414 deduction with no initializer.
4415 * pt.c (build_deduction_guide): Handle implicit default/copy ctor.
4416 (do_class_deduction): Use that rather than special case.
4417 (do_auto_deduction): Handle null initializer.
4419 2017-02-28 Jakub Jelinek <jakub@redhat.com>
4421 * decl.c (find_decomp_class_base): Use cond ? G_("...") : G_("...")
4422 instead of just cond ? "..." : "...".
4423 (grokdeclarator): Likewise.
4424 (build_enumerator): Likewise.
4425 * init.c (build_new_1): Likewise.
4426 * call.c (build_new_method_call_1): Likewise.
4427 * parser.c: Include intl.h.
4428 (cp_parser_oacc_enter_exit_data): Use %s and ternary operator only for
4429 "enter"/"exit" keyword.
4430 (cp_finalize_oacc_routine): Don't use %s to supply portions of the
4433 2017-02-27 Jason Merrill <jason@redhat.com>
4435 PR c++/71568 - SFINAE forming pointer to member function
4436 * init.c (build_offset_ref): Check the return value of
4437 perform_or_defer_access_check.
4439 2017-02-27 Marek Polacek <polacek@redhat.com>
4441 * decl.c (expand_static_init): Add missing } in a comment.
4443 2017-02-27 Volker Reichelt <v.reichelt@netcologne.de>
4445 * init.c: Include intl.h.
4446 (build_new_1): Move message strings into pedwarn to make them
4447 -Wformat-security friendly. Mark string for translation.
4448 * pt.c (tsubst_copy_and_build): Mark string for translation.
4449 Make the pointer const.
4450 * semantics.c (finish_id_expression): Mark strings for translation.
4452 2017-02-25 Jakub Jelinek <jakub@redhat.com>
4454 * call.c (build_op_delete_call): Make msg1 and msg2 const.
4456 2017-02-24 Jakub Jelinek <jakub@redhat.com>
4459 * call.c (build_over_call): Call check_function_arguments even for
4460 -Wrestrict, adjust check_function_arguments caller.
4461 * parser.c (cp_parser_postfix_expression): Don't handle -Wrestrict
4463 * typeck.c (cp_build_function_call_vec): Adjust
4464 check_function_arguments caller.
4466 2017-02-24 Marek Polacek <polacek@redhat.com>
4468 PR translation/79705
4469 * decl.c (check_redeclaration_exception_specification): Mark a string
4470 for translation. Make the pointer const.
4472 2017-02-23 Paolo Carlini <paolo.carlini@oracle.com>
4475 * pt.c (register_specialization): Check duplicate_decls return value
4476 for error_mark_node and pass it back.
4478 2017-02-22 Jason Merrill <jason@redhat.com>
4480 PR c++/79679 - missing destructor for argument
4481 * call.c (build_over_call): Don't pass tf_no_cleanup to argument
4484 * pt.c (do_class_deduction): Handle 0 argument case.
4486 2017-02-22 Jakub Jelinek <jakub@redhat.com>
4489 * parser.c (cp_parser_omp_teams, cp_parser_omp_target): Use
4490 SET_EXPR_LOCATION on OMP_TARGET/OMP_TEAMS tree.
4491 * constexpr.c (potential_constant_expression_1): Handle
4492 OMP_*, OACC_* and CILK_* trees. Use error_at with
4493 EXPR_LOC_OR_LOC (t, input_location) computed early
4494 instead of error, or error_at with location_of (t).
4496 2017-02-22 Marek Polacek <polacek@redhat.com>
4499 * parser.c (cp_parser_std_attribute_spec): Don't build the attribute
4500 if the alignas expression is erroneous.
4501 * pt.c (tsubst_attribute): If tsubst_pack_expansion fails, return
4505 * semantics.c (finish_underlying_type): Bail out for incomplete enums.
4507 2017-02-21 Jason Merrill <jason@redhat.com>
4509 PR c++/50308 - wrong deprecated warning with ADL
4510 PR c++/17729 - duplicate deprecated warning
4511 * semantics.c (finish_id_expression): Only call mark_used on a
4512 function if we aren't building a call.
4514 PR c++/41727 - ICE with partial spec of partial instantiation
4515 * pt.c (process_partial_specialization): For now, don't check more
4516 specialized if there is more than one level of args.
4518 2017-02-21 Marek Polacek <polacek@redhat.com>
4521 * cp-tree.h (maybe_reject_flexarray_init): Declare.
4522 * init.c (maybe_reject_flexarray_init): No longer static.
4523 Add check for current_function_decl.
4524 * parser.c (cp_parser_late_parse_one_default_arg): Reject
4525 a default mem-initializer for a flexible array.
4527 2017-02-21 Jakub Jelinek <jakub@redhat.com>
4528 Paolo Carlini <paolo.carlini@oracle.com>
4531 * decl.c (cp_finish_decomp): Don't set decl's type to error_mark_node
4533 * pt.c (tsubst_decomp_names): Return error_mark_node if the first
4534 decl after the decomposition artificial decl has error_mark_node.
4535 * decl2.c (prune_vars_needing_no_initialization): Use error_operand_p
4536 instead of just == error_mark_node comparison.
4538 2017-02-21 Jakub Jelinek <jakub@redhat.com>
4541 * decl.c: Include gimplify.h.
4542 (cp_finish_decomp): Make sure there is no sharing of trees
4543 in between DECL_VALUE_EXPR of decomposition decls.
4546 * constexpr.c (cxx_eval_array_reference): Diagnose negative subscript.
4549 * constexpr.c (cxx_eval_store_expression): If *valp is a PTRMEM_CST,
4550 call cplus_expand_constant on it first.
4552 2017-02-19 Jason Merrill <jason@redhat.com>
4554 PR c++/78139 - destructor needed by new-expression
4555 * call.c (build_special_member_call): Use tf_no_cleanup.
4557 PR c++/78282 - auto template and pack expansion
4558 * pt.c (find_parameter_packs_r): Don't walk into the type of
4559 templates other than template template-parameters.
4561 PR c++/79606 - ICE with this->base_member in NSDMI
4562 * class.c (build_base_path): Check processing_template_decl.
4564 PR c++/79607 - ICE with T{} initializer
4565 * decl.c (type_dependent_init_p): Check the type of a CONSTRUCTOR.
4567 PR c++/79566 - elaborated-type-specifier in range for
4568 * parser.c (cp_parser_simple_declaration): Fix check for type
4571 PR c++/79400 - confusing suggestion of 'noexcept'
4572 * parser.c (cp_parser_exception_specification_opt): Remove
4573 suggestion for deprecated dynamic exception-specification.
4575 PR c++/79470 - partial ordering with reference parameters
4576 * pt.c (unify) [INDIRECT_REF]: Handle pack expansions.
4578 PR c++/79500 - ICE with non-template deduction guide
4579 * pt.c (do_class_deduction): Use STRIP_TEMPLATE rather than
4580 DECL_TEMPLATE_RESULT.
4582 PR c++/79580 - ICE with compound literal
4583 * parser.c (cp_parser_class_head): If we're in the middle of an
4584 expression, use ts_within_enclosing_non_class.
4586 PR c++/79503 - inherited ctor taking base class
4587 * call.c (add_function_candidate): Also check that
4588 DECL_INHERITED_CTOR_BASE is reference-related to the parameter type.
4590 2017-02-19 Paolo Carlini <paolo.carlini@oracle.com>
4593 * typeck.c (cxx_alignas_expr): Reject a non-integral alignas
4596 2017-02-19 Eric Fiselier <eric@efcs.ca>
4597 Jonathan Wakely <jwakely@redhat.com>
4600 * parser.c (cp_parser_unqualified_id): Use OPT_Wliteral_suffix to
4601 control warning about literal suffix identifiers without a leading
4604 2017-02-17 Jason Merrill <jason@redhat.com>
4606 PR c++/79508 - lookup error with member template
4607 * parser.c (cp_parser_template_name): Clear
4608 parser->context->object_type if we aren't doing lookup.
4610 PR c++/78690 - ICE with using and global type with same name
4611 * pt.c (type_dependent_object_expression_p): True for
4614 PR c++/79549 - C++17 ICE with non-type auto template parameter pack
4615 * pt.c (convert_template_argument): Just return an auto arg pack.
4616 (tsubst_template_args): Don't tsubst an auto pack type.
4618 PR c++/79556 - C++17 ICE with non-type auto
4619 * pt.c (do_auto_deduction): Don't try to deduce from null type.
4621 PR c++/79533 - C++17 ICE with temporary cast to reference
4622 * call.c (build_over_call): Conversion to a reference prevents copy
4625 2017-02-16 Jakub Jelinek <jakub@redhat.com>
4626 Jason Merrill <jason@redhat.com>
4628 PR c++/79502 - lost nodiscard attribute
4629 * pt.c (apply_late_template_attributes): Do apply non-dependent
4630 attributes to types.
4632 2017-02-16 Jason Merrill <jason@redhat.com>
4634 PR c++/78572 - ICE with self-modifying array initializer
4635 * constexpr.c (cxx_eval_store_expression): The object we're
4636 initializing is outside the constant-expression.
4637 (cxx_eval_call_expression): Set ctx->call.
4639 PR c++/79050 - ICE with undeduced auto and LTO
4640 * decl.c (poplevel): Remove undeduced auto decls.
4642 2017-02-16 Jakub Jelinek <jakub@redhat.com>
4645 * parser.c (cp_parser_omp_target): For -fopenmp-simd
4646 ignore #pragma omp target even when not followed by identifier.
4648 2017-02-15 Jason Merrill <jason@redhat.com>
4649 Jakub Jelinek <jakub@redhat.com>
4651 PR c++/79464 - ICE in IPA with omitted constructor parms
4652 * class.c (build_clone): Also omit parms from TYPE_ARG_TYPES.
4653 (adjust_clone_args): Adjust.
4654 (add_method): Remember omitted parms.
4655 * call.c (add_function_candidate): Likewise.
4656 * mangle.c (write_method_parms): Likewise.
4657 * method.c (ctor_omit_inherited_parms): Return false if there are no
4660 2017-02-15 Martin Sebor <msebor@redhat.com>
4663 * init.c (maybe_reject_flexarray_init): New function.
4664 (perform_member_init): Call it.
4666 2017-02-15 Jakub Jelinek <jakub@redhat.com>
4669 * parser.c (cp_parser_std_attribute): Don't pedwarn about
4670 [[deprecated]] with -std=c++11 and [[fallthrough]] with
4671 -std=c++11 and -std=c++14.
4674 * decl.c (grokdeclarator): For static data members, handle thread_p
4675 only after handling inline.
4677 2017-02-14 Marek Polacek <polacek@redhat.com>
4681 * parser.c (cp_parser_postfix_dot_deref_expression): Avoid
4682 clobbering if the postfix expression isn't an EXPR_P.
4684 2017-02-13 Jason Merrill <jason@redhat.com>
4686 PR c++/79461 - ICE with lambda in constexpr constructor
4687 * constexpr.c (build_data_member_initialization): Ignore
4688 initialization of a local variable.
4690 2017-02-13 Jakub Jelinek <jakub@redhat.com>
4692 * init.c (warn_placement_new_too_small): Add missing space in
4694 * parser.c (cp_parser_oacc_declare): Likewise.
4695 * mangle.c (maybe_check_abi_tags): Likewise.
4698 * typeck.c (cp_build_modify_expr): Handle properly COMPOUND_EXPRs
4699 on lhs that have {PRE{DEC,INC}REMENT,MODIFY,MIN,MAX,COND}_EXPR
4700 in the rightmost operand.
4702 2017-02-13 Nathan Sidwell <nathan@acm.org>
4704 PR c++/79296 - ICE mangling localized template instantiation
4705 * decl2.c (determine_visibility): Use template fn context for
4706 local class instantiations.
4708 2017-02-11 Jason Merrill <jason@redhat.com>
4710 PR c++/77659 - ICE with new and C++14 aggregate NSDMI
4711 * init.c (build_new): Make backups of any CONSTRUCTORs in init.
4712 (build_new_1): Use replace_placeholders.
4713 * tree.c (replace_placeholders_t): Also track whether we've seen a
4715 (replace_placeholders, replace_placeholders_r): Adjust.
4716 * cp-tree.h: Adjust.
4718 PR c++/77790 - ICE with auto function in C++11 mode
4719 * decl.c (undeduced_auto_decl): Remove C++14 limitation.
4720 (require_deduced_type): Add complain parm, return bool.
4721 * cp-tree.h: Adjust.
4722 * decl2.c (mark_used): Use require_deduced_type.
4724 2017-02-10 Jason Merrill <jason@redhat.com>
4726 PR c++/78908 - template ops and bitfields
4727 * tree.c (build_min_non_dep): Use unlowered_expr_type.
4729 PR c++/78897 - constexpr union
4730 * constexpr.c (cxx_eval_store_expression): A store to a union member
4731 erases a previous store to another member.
4733 PR c++/71285 - member of fold-expression
4734 * semantics.c (finish_unary_fold_expr)
4735 (finish_binary_fold_expr): Use null type for fold-expressions.
4737 PR c++/79401 - protected inherited constructor
4738 * call.c (enforce_access): For inheriting constructor, find a base
4739 binfo in the path we already have.
4741 2017-02-10 Marek Polacek <polacek@redhat.com>
4744 * pt.c (type_dependent_expression_p): Check if the expression type
4748 * cvt.c (ocp_convert): Add a sentinel against -Wint-in-bool-context
4749 if warnings shouldn't be given.
4751 2017-02-10 Paolo Carlini <paolo.carlini@oracle.com>
4754 * pt.c (tsubst_decl): Don't try to preserve a typedef that names
4755 an error_mark_node as type.
4757 2017-02-09 Jakub Jelinek <jakub@redhat.com>
4758 Jason Merrill <jason@redhat.com>
4761 * pt.c (instantiate_class_template_1): Copy CLASSTYPE_NON_AGGREGATE
4762 from pattern to type.
4764 2017-02-09 Jason Merrill <jason@redhat.com>
4766 PR c++/79316 - default argument in deduction guide
4767 PR c++/79350 - explicit deduction guide
4768 * parser.c (cp_parser_constructor_declarator_p)
4769 (cp_parser_direct_declarator): Parse deduction guides more like
4771 * cp-tree.h (enum special_function_kind): Add sfk_deduction_guide.
4772 * tree.c (special_function_p): Return it.
4773 * decl.c (check_special_function_return_type): Handle it.
4774 (grokdeclarator, grokfndecl): Adjust.
4775 (cp_finish_decl): Pass flags to do_auto_deduction.
4776 * error.c (dump_decl_name): Use TFF_UNQUALIFIED_NAME.
4777 * pt.c (dguide_name_p): Take a const_tree.
4778 (do_class_deduction): Handle explicit.
4779 (do_auto_deduction): Pass flags through.
4780 (build_deduction_guide): Copy explicit flag.
4782 2017-02-09 Jakub Jelinek <jakub@redhat.com>
4785 * parser.c (cp_parser_omp_ordered): Don't check for non-pragma_stmt
4786 non-pragma_compound context here.
4787 (cp_parser_omp_target): Likewise.
4788 (cp_parser_pragma): Don't call push_omp_privatization_clauses and
4789 parsing for ordered and target omp pragmas in non-pragma_stmt
4790 non-pragma_compound contexts.
4793 * parser.c (cp_parser_oacc_declare): Formatting fix.
4794 (cp_parser_omp_declare_target): Don't invoke symtab_node::get on
4795 automatic variables.
4797 2016-02-09 Nathan Sidwell <nathan@codesourcery.com>
4798 Chung-Lin Tang <cltang@codesourcery.com>
4800 * parser.c (cp_parser_oacc_clause_tile): Disallow collapse. Fix
4801 parsing. Parse constant expression. Remove semantic checking.
4802 (cp_parser_omp_clause_collapse): Disallow tile.
4803 (cp_parser_omp_for_loop): Deal with tile clause. Don't emit a parse
4804 error about missing for after already emitting one. Use more
4805 conventional for idiom for unbounded loop.
4806 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_TILE.
4807 * semantics.c (finish_omp_clauses): Correct TILE semantic check.
4808 (finish_omp_for): Deal with tile clause.
4810 2017-02-07 Nathan Sidwell <nathan@acm.org>
4812 * method.c (synthesized_method_base_walk): New. Broken out of ...
4813 (synthesized_method_walk): ... here. Call it. Cleanup
4816 2017-02-07 Patrick Palka <ppalka@gcc.gnu.org>
4819 * typeck2.c (process_init_constructor_union): Consider only
4820 FIELD_DECLs when looking for an NSDMI.
4822 2017-02-06 Jason Merrill <jason@redhat.com>
4824 PR c++/71193 - incomplete types in templates
4825 * parser.c (cp_parser_postfix_dot_deref_expression): In a template
4826 handle incomplete type by pedwarning and then treating as dependent.
4828 2017-02-06 Jakub Jelinek <jakub@redhat.com>
4831 * constexpr.c (cxx_eval_constant_expression): Handle ANNOTATE_EXPR.
4832 (potential_constant_expression_1): Likewise.
4835 * tree.c (build_min_non_dep_op_overload): For POST{INC,DEC}REMENT_EXPR
4836 allow one fewer than expected arguments if flag_permissive.
4839 * decl.c (cp_finish_decomp): On error set decl type to error_mark_node.
4840 * pt.c (tsubst_expr): Don't call tsubst_decomp_names on decompositions
4841 with error_mark_node type.
4843 2017-02-03 Jason Merrill <jason@redhat.com>
4845 PR c++/78689 - ICE on constructor with label
4846 * optimize.c (maybe_clone_body): Replace omitted parameters with
4848 * class.c (build_clone): Fix logic for omitting inherited parms.
4850 PR c++/12245 - excessive memory use
4851 * constexpr.c (maybe_constant_value): Fold maybe_constant_value_1
4852 back in. Don't cache constants.
4853 (maybe_constant_init): Don't cache constants.
4855 PR c++/79294 - ICE with invalid template argument
4856 * pt.c (convert_nontype_argument_function): Check value-dependence.
4857 (convert_nontype_argument): Don't check it here for function ptrs.
4859 2017-02-02 Richard Biener <rguenther@suse.de>
4862 * cp-gimplify.c (cp_fold): When folding a CONSTRUCTOR copy
4863 it lazily on the first changed element only and copy it
4864 fully upfront, only storing changed elements.
4866 2017-02-02 Paolo Carlini <paolo.carlini@oracle.com>
4869 * decl2.c (grokbitfield): In case of error don't set-up DECL_INITIAL
4872 2017-01-31 Jakub Jelinek <jakub@redhat.com>
4875 * error.c (dump_expr) <case COMPONENT_REF>: Don't print .
4878 2017-01-31 David Malcolm <dmalcolm@redhat.com>
4881 * name-lookup.c (suggest_alternative_in_explicit_scope): Resolve
4882 any namespace aliases.
4884 2017-01-31 Nathan Sidwell <nathan@acm.org>
4887 * typeck.c (build_ptrmemfunc_access_expr): Set TREE_NO_WARNING.
4891 * pt.c: (instantiate_decl): Push to top level when current
4892 function scope doesn't match. Only push lmabda scope stack when
4895 * cp-tree.h (instantiate_decl): Make defer_ok bool.
4896 * pt.c: Fix instantiate_decl calls to pass true/false not 0/1
4897 (instantiate_decl): Simplify and reorder state saving and restoration.
4900 * lambda.c (maybe_generic_this_capture): Deal with template-id-exprs.
4901 * semantics.c (finish_member_declaration): Assert class is being
4904 2017-01-30 Alexandre Oliva <aoliva@redhat.com>
4906 Introduce C++ support in libcc1.
4907 * cp-tree.h (struct lang_identifier): Add oracle_looked_up.
4908 (ansi_opname): Rename to...
4909 (cp_operator_id): ... this. Adjust all callers.
4910 (ansi_assopname): Rename to...
4911 (cp_assignment_operator_id): ... this. Adjust all callers.
4912 (cp_literal_operator_id): Declare.
4913 (set_global_friend): Declare.
4914 (is_global_friend): Declare.
4915 (enum cp_oracle_request): New type.
4916 (cp_binding_oracle_function): New type.
4917 (cp_binding_oracle): Declare.
4918 (cp_finish_injected_record_type): Declare.
4919 * friend.c (global_friend): New var.
4920 (set_global_friend): New fn.
4921 (is_global_friend): New fn.
4922 (is_friend): Call is_global_friend.
4923 * name-lookup.c (cp_binding_oracle): New var.
4924 (query_oracle): New fn.
4925 (qualified_lookup_using_namespace): Call query_oracle.
4926 (lookup_name_real_1): Likewise.
4927 * parser.c (cp_literal_operator_id): Drop static.
4928 * search.c (friend_accessible_p): Call is_global_friend.
4929 * semantics.c (is_this_parameter): Accept a variable if the
4930 binding oracle is enabled.
4932 2017-01-27 Jason Merrill <jason@redhat.com>
4934 PR c++/78771 - ICE with inherited constructor.
4935 * call.c (build_over_call): Call deduce_inheriting_ctor here.
4936 * pt.c (tsubst_decl): Not here.
4937 * class.c (add_method): Or here.
4938 * method.c (deduce_inheriting_ctor): Handle clones.
4939 (implicitly_declare_fn): Don't deduce inheriting ctors yet.
4941 2017-01-27 Adam Butcher <adam@jessamine.co.uk>
4944 * cp/parser.c (parsing_default_capturing_generic_lambda_in_template):
4946 * cp/cp-tree.h: Declare it.
4947 * cp/semantics.c (finish_id_expression): Resolve names within a default
4948 capturing generic lambda defined within a template prior to
4949 instantiation to allow for captures to be added to the closure type.
4951 2017-01-26 Jakub Jelinek <jakub@redhat.com>
4954 * cp-tree.def (OFFSETOF_EXPR): Bump number of operands to 2.
4955 * cp-tree.h (finish_offsetof): Add OBJECT_PTR argument.
4956 * parser.c (cp_parser_builtin_offsetof): Pass result of
4957 build_static_cast of null_pointer_node to finish_offsetof.
4958 * semantics.c (finish_offsetof): Add OBJECT_PTR argument, use
4959 it for -Winvalid-offsetof pedwarn instead of trying to guess
4960 original offsetof type from EXPR. Save OBJECT_PTR as a new
4961 second operand to OFFSETOF_EXPR.
4962 * pt.c (tsubst_copy_and_build) <case OFFSETOF_EXPR>: Adjust
4963 finish_offsetof caller, pass the second operand of OFFSETOF_EXPR
4966 2017-01-26 Jason Merrill <jason@redhat.com>
4968 * name-lookup.c (parse_using_directive): Deprecate strong using.
4970 PR c++/79176 - lambda ICE with -flto -Os
4971 * decl2.c (vague_linkage_p): Handle decloned 'tors.
4972 * tree.c (decl_linkage): Likewise.
4974 2017-01-25 Martin Sebor <msebor@redhat.com>
4976 * decl.c (grokdeclarator): Fix a typo in a comment.
4978 2017-01-25 Jakub Jelinek <jakub@redhat.com>
4981 * decl.c (cp_finish_decomp): Disallow memberwise decomposition of
4985 * parser.c (cp_parser_lambda_declarator_opt): Pedwarn with
4986 OPT_Wpedantic on lambda templates for -std=c++14 and higher.
4988 2017-01-25 Maxim Ostapenko <m.ostapenko@samsung.com>
4991 * decl.c (cxx_init_decl_processing): Pass main_input_filename
4992 to build_translation_unit_decl.
4994 2017-01-24 Jakub Jelinek <jakub@redhat.com>
4997 * cp-gimplify.c (cp_genericize_r): Add result of
4998 convert_from_reference on invisiref parm to p_set.
5000 2017-01-24 Nathan Sidwell <nathan@acm.org>
5002 PR c++/78469 - defaulted ctor and inaccessible dtor
5003 * cp-tree.h (tsubst_flags): Add tf_no_cleanup.
5004 * init.c (build_new_1): Pass tf_no_cleanup to build_value_init.
5005 * tree.c (build_target_expr): Check tf_no_cleanup.
5007 PR c++/79118 - anon-members and constexpr
5008 * constexpr.c (cx_check_missing_mem_inits): Caller passes type not
5009 ctor decl. Recursively check anonymous members.
5010 (register_constexpr_fundef): Adjust cx_check_missing_mem_inits
5012 (explain_invalid_constexpr_fn): Likewise.
5014 2017-01-23 Nathan Sidwell <nathan@acm.org>
5016 PR c++/71710 - template using directive of field
5017 * pt.c (tsubst_copy_and_build [COMPONENT_REF]): Move FIELD_DECL
5020 PR c++/71406 - ICE with scope-ref'd template id exprs
5022 * typeck.c (finish_class_member_access_expr): Break up SCOPE_REF
5023 before breaking up TEMPLATE_ID_EXPR.
5025 2017-01-20 Nathan Sidwell <nathan@acm.org>
5027 PR c++/78495 - wrong code inherited ctor and invisi-ref parm
5028 * cp-gimplify.c (cp_generize_r): Don't skip thunks.
5030 2017-01-20 David Malcolm <dmalcolm@redhat.com>
5034 * cp-tree.h (suggest_alternatives_for): Add bool param.
5035 (suggest_alternative_in_explicit_scope): New decl.
5036 * error.c (qualified_name_lookup_error): When SCOPE is a namespace
5037 that isn't the global one, call new function
5038 suggest_alternative_in_explicit_scope, only calling
5039 suggest_alternatives_for if it fails, and disabling near match
5040 searches fort that case. When SCOPE is the global namespace,
5041 pass true for new param to suggest_alternatives_for to allow for
5043 * lex.c (unqualified_name_lookup_error): Pass true for new param
5044 to suggest_alternatives_for.
5045 * name-lookup.c (consider_binding_level): Add forward decl.
5046 (suggest_alternatives_for): Add "suggest_misspellings" param,
5047 using it to conditionalize the fuzzy name-lookup code.
5048 (suggest_alternative_in_explicit_scope): New function.
5049 * parser.c (cp_parser_primary_expression): When calling
5050 finish_id_expression, pass location of id_expression rather
5051 than that of id_expr_token.
5052 (cp_parser_id_expression): Convert local "unqualified_id" from
5053 tree to cp_expr to avoid implicitly dropping location information.
5055 2017-01-20 Marek Polacek <polacek@redhat.com>
5058 * call.c (build_conditional_expr_1): Warn about duplicated branches.
5059 * semantics.c (finish_expr_stmt): Build statement using the proper
5062 2017-01-19 Jason Merrill <jason@redhat.com>
5064 US 20 - forwarding references and class template argument deduction
5065 * cp-tree.h (TEMPLATE_TYPE_PARM_FOR_CLASS): New.
5066 * pt.c (push_template_decl_real): Set it.
5067 (maybe_adjust_types_for_deduction): Check it.
5068 (rewrite_template_parm): Copy it.
5070 US 19 - deduction guides and constructors
5071 * call.c (joust): Prefer deduction guides to constructors.
5072 * pt.c (build_deduction_guide): Set DECL_ARTIFICIAL.
5073 (deduction_guide_p): Check DECL_P.
5075 * decl.c (check_initializer): Always use build_aggr_init for array
5078 PR c++/79130 - decomposition and direct-initialization
5079 * init.c (build_aggr_init): Communicate direct-initialization to
5081 (build_vec_init): Check for array copy sooner.
5082 * parser.c (cp_parser_decomposition_declaration): Remove call to
5083 build_x_compound_expr_from_list.
5085 2017-01-18 Jason Merrill <jason@redhat.com>
5087 PR c++/68666 - member variable template-id
5088 * typeck.c (finish_class_member_access_expr): Handle variable
5090 * pt.c (lookup_and_finish_template_variable): No longer static.
5091 * cp-tree.h: Declare it.
5093 2017-01-18 Nathan Sidwell <nathan@acm.org>
5096 * call.c (build_over_call): When checking ellipsis conversions for
5097 an inherited ctor, make sure there is at least one conversion.
5099 2017-01-18 Jason Merrill <jason@redhat.com>
5101 PR c++/78894 - ICE with class deduction and default arg
5102 * pt.c (build_deduction_guide): Set DECL_PRIMARY_TEMPLATE.
5104 2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de>
5107 * mangle.c (write_discriminator): Reorganize abi warning check.
5109 2017-01-18 Nathan Sidwell <nathan@acm.org>
5111 * cp-tree.h: Clarify exception spec node comment.
5112 * except.c (nothrow_spec_p): Simplify by checking node-equality.
5115 * mangle.c (write_exception_spec): Check nothrow explicitly.
5116 (write_encoding): Don't increment processing_template_decl around
5119 2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de>
5122 * mangle.c (write_template_args): Add "on" for operator names.
5124 2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de>
5127 * mangle.c (write_discriminator): Handle discriminator >= 10.
5129 2017-01-17 Nathan Sidwell <nathan@acm.org>
5132 * cp-tree.h (maybe_generic_this_capture): Declare.
5133 * lambda.c (resolvable_dummy_lambda): New, broken out of ...
5134 (maybe_resolve_dummy): ... here. Call it.
5135 (maybe_generic_this_capture): New.
5136 * parser.c (cp_parser_postfix_expression): Speculatively capture
5137 this in generic lambda in unresolved member function call.
5138 * pt.c (tsubst_copy_and_build): Force hard error from failed
5139 member function lookup in generic lambda.
5141 2017-01-17 Aldy Hernandez <aldyh@redhat.com>
5144 * cp-array-notation.c (expand_array_notation_exprs): Handle
5147 2017-01-11 Jason Merrill <jason@redhat.com>
5149 PR c++/78337 - ICE on invalid with generic lambda
5150 * semantics.c (process_outer_var_ref): Check if containing_function
5151 is null. Move inform call under complain test.
5153 2017-01-11 Nathan Sidwell <nathan@acm.org>
5156 * name-lookup.c (set_namespace_binding_1): An overload of 1 decl
5159 2017-01-11 Nathan Sidwell <nathan@acm.org>
5161 * name-lookup.c (push_overloaded_decl_1): Refactor OVERLOAD creation.
5163 2017-01-11 Jakub Jelinek <jakub@redhat.com>
5166 * parser.c (cp_parser_std_attribute_spec): Remove over-eager
5167 assertion. Formatting fix.
5170 * decl2.c (c_parse_final_cleanups): Set flag_syntax_only to 1 after
5173 2017-01-10 David Malcolm <dmalcolm@redhat.com>
5176 * parser.c (cp_parser_class_specifier_1): Only suggest inserting
5177 a missing semicolon if we have a valid insertion location for
5180 2017-01-10 Jason Merrill <jason@redhat.com>
5182 FI 20, decomposition declaration with parenthesized initializer.
5183 * parser.c (cp_parser_decomposition_declaration): Use
5184 cp_parser_initializer.
5186 2017-01-09 Jason Merrill <jason@redhat.com>
5188 Implement P0195R2, C++17 variadic using.
5189 * parser.c (cp_parser_using_declaration): Handle ellipsis and comma.
5190 * pt.c (tsubst_decl): Handle pack expansion in USING_DECL_SCOPE.
5191 * error.c (dump_decl): Likewise.
5193 2017-01-09 Jakub Jelinek <jakub@redhat.com>
5195 PR translation/79019
5196 PR translation/79020
5197 * semantics.c (finish_omp_clauses): Add missing whitespace to
5198 translatable strings.
5199 * cp-cilkplus.c (cpp_validate_cilk_plus_loop_aux): Fix comment typo.
5201 2017-01-07 Jason Merrill <jason@redhat.com>
5203 PR c++/78948 - instantiation from discarded statement
5204 * parser.h (struct cp_parser): Remove in_discarded_stmt field.
5205 * cp-tree.h (in_discarded_stmt): Declare it.
5206 (struct saved_scope): Add discarded_stmt bitfield.
5207 (in_discarded_stmt): New macro.
5208 * decl2.c (mark_used): Check it.
5209 * parser.c (cp_parser_selection_statement): Adjust.
5210 (cp_parser_jump_statement): Adjust.
5212 2017-01-05 Jakub Jelinek <jakub@redhat.com>
5215 * decl.c (cp_finish_decomp): Remove probe variable, if tt is
5216 REFERENCE_REF_P, set tt to its operand.
5219 * class.c (check_field_decls): Diagnose REFERENCE_TYPE fields in
5220 unions even for C++11 and later.
5222 2017-01-05 Nathan Sidwell <nathan@acm.org>
5225 * pt.c (convert_nontype_argument): Don't try and see if integral
5226 or enum expressions are constants prematurely.
5228 2017-01-04 Marek Polacek <polacek@redhat.com>
5231 * typeck.c (cp_build_binary_op): Warn when a pointer is compared with
5232 a zero character literal.
5234 2017-01-04 Jakub Jelinek <jakub@redhat.com>
5237 * typeck.c (cp_build_unary_op): Call mark_rvalue_use on arg if it has
5241 * parser.c (cp_parser_simple_declaration): Only complain about
5242 inconsistent auto deduction if auto_result doesn't use auto.
5244 * parser.c (cp_parser_simple_declaration): Diagnose function
5245 declaration among more than one init-declarators with auto
5249 * parser.c (cp_lexer_previous_token): Use vec_safe_address in the
5250 assertion, as lexer->buffer may be NULL.
5252 2017-01-04 Marek Polacek <polacek@redhat.com>
5256 * constexpr.c (potential_constant_expression_1): Handle CLEANUP_STMT.
5258 2017-01-04 Nathan Sidwell <nathan@acm.org>
5261 * cp-tree.h (DECLTYPE_FOR_REF_CAPTURE): New.
5262 (lambda_capture_field_type): Update prototype.
5263 * lambda.c (lambda_capture_field_type): Add is_reference parm.
5264 Add referenceness here.
5265 (add_capture): Adjust lambda_capture_field_type call, refactor
5267 * pt.c (tsubst): Adjust lambda_capture_field_type call.
5269 2017-01-01 Jakub Jelinek <jakub@redhat.com>
5271 Update copyright years.
5273 Copyright (C) 2017 Free Software Foundation, Inc.
5275 Copying and distribution of this file, with or without modification,
5276 are permitted in any medium without royalty provided the copyright
5277 notice and this notice are preserved.