1 2017-10-19 Jakub Jelinek <jakub@redhat.com>
4 * typeck.c (check_return_expr): Don't call
5 maybe_warn_about_returning_address_of_local in templates.
7 2017-10-17 Nathan Sidwell <nathan@acm.org>
10 * call.c (build_over_call): Don't pass tf_no_cleanup to nested
14 * cp-objcp-common.c (cp_tree_size): Reformat. Adjust returns size
17 2017-10-13 Jason Merrill <jason@redhat.com>
19 PR c++/82357 - bit-field in template
20 * tree.c (cp_stabilize_reference): Just return a NON_DEPENDENT_EXPR.
22 2017-10-13 David Malcolm <dmalcolm@redhat.com>
24 * cp-tree.h (maybe_show_extern_c_location): New decl.
25 * decl.c (grokfndecl): When complaining about literal operators
26 with C linkage, issue a note giving the location of the
28 * parser.c (cp_parser_new): Initialize new field
29 "innermost_linkage_specification_location".
30 (cp_parser_linkage_specification): Store the location
31 of the linkage specification within the cp_parser.
32 (cp_parser_explicit_specialization): When complaining about
33 template specializations with C linkage, issue a note giving the
34 location of the extern "C".
35 (cp_parser_explicit_template_declaration): Likewise for templates.
36 (maybe_show_extern_c_location): New function.
37 * parser.h (struct cp_parser): New field
38 "innermost_linkage_specification_location".
40 2017-10-12 Nathan Sidwell <nathan@acm.org>
42 * cp-tree.h (cp_expr): Add const operator * and operator->
44 (cp_tree_node_structure_enum): Delete TS_CP_BINDING,
45 TS_CP_WRAPPER, LAST_TS_CP_ENUM.
47 2017-10-12 David Malcolm <dmalcolm@redhat.com>
49 * parser.c (get_required_cpp_ttype): New function.
50 (cp_parser_error_1): Call it, using the result to call
51 maybe_suggest_missing_token_insertion.
53 2017-10-12 David Malcolm <dmalcolm@redhat.com>
55 * parser.c (get_matching_symbol): Move to before...
56 (cp_parser_error): Split out into...
57 (cp_parser_error_1): ...this new function, merging in content
59 (cp_parser_required_error): ...here. Eliminate partial duplicate
60 of body of cp_parser_error in favor of a call to the new
61 cp_parser_error_1 helper function.
63 2017-10-11 Nathan Sidwell <nathan@acm.org>
65 * decl2.c (struct mangled_decl_hash): Use DECL_ASSEMBLER_NAME_RAW.
66 (record_mangling): Likewise.
68 2017-10-10 Nathan Sidwell <nathan@acm.org>
70 * name-lookup.c (extern_c_fns): Rename to ...
71 (extern_c_decls): ... here.
72 (check_extern_c_conflict, extern_c_linkage_bindings): Update.
73 (do_pushdecl): Check extern-c fns and vars.
75 * cp-tree.h (default_hash_traits <lang_identifier *>): Delete
78 * decl2.c (struct mangled_decl_hash): New hash traits.
79 (mangled_decls): Make hash_table<mangled_decl_hash>.
80 (generate_mangling_alias, record_mangling): Adjust.
82 2017-10-10 Jason Merrill <jason@redhat.com>
84 More delayed lambda capture fixes.
85 * call.c (add_function_candidate): Use build_address.
86 (build_op_call_1): Call mark_lvalue_use early.
87 (build_over_call): Handle error from build_this.
88 * constexpr.c (cxx_bind_parameters_in_call): Use build_address.
89 (cxx_eval_increment_expression): Don't use rvalue().
90 * cvt.c (convert_to_void): Use mark_discarded_use.
91 * expr.c (mark_use): Handle PARM_DECL, NON_DEPENDENT_EXPR. Fix
92 reference handling. Don't copy the expression.
93 (mark_discarded_use): New.
94 * lambda.c (insert_capture_proxy): Add some sanity checking.
95 (maybe_add_lambda_conv_op): Set cp_unevaluated_operand.
96 * pt.c (register_local_specialization): Add sanity check.
97 * semantics.c (process_outer_var_ref): Fix check for existing proxy.
98 * typeck.c (cp_build_addr_expr_1): Handle error from
100 (cp_build_modify_expr): Call mark_lvalue_use_nonread, handle error
103 Handle generic lambda capture in dependent expressions.
104 * lambda.c (need_generic_capture, dependent_capture_r)
105 (do_dependent_capture): New.
106 * pt.c (processing_nonlambda_template): Use need_generic_capture.
107 * semantics.c (maybe_cleanup_point_expr)
108 (maybe_cleanup_point_expr_void, finish_goto_stmt)
109 (maybe_convert_cond): Call do_dependent_capture.
110 * typeck.c (build_static_cast): Remove dependent capture handling.
112 * typeck.c (condition_conversion): Assert !processing_template_decl.
113 * semantics.c (finish_omp_clauses): Don't
114 fold_build_cleanup_point_expr if processing_template_decl.
115 (outer_var_p): A temporary can't be from an outer scope.
116 * pt.c (type_dependent_expression_p): Fix dependency checking of
117 functions without DECL_TEMPLATE_INFO.
118 (instantiate_decl): Use lss_copy.
119 * constexpr.c (is_valid_constexpr_fn): Fix lambdas before C++17.
121 * typeck.c (check_return_expr): Check non-dependent conversion in
123 * constraint.cc (check_function_concept): Don't complain about an
124 empty concept if seen_error.
126 2017-10-10 Richard Sandiford <richard.sandiford@linaro.org>
128 * cvt.c (ignore_overflows): Use wi::to_wide when
129 operating on trees as wide_ints.
130 * decl.c (check_array_designated_initializer): Likewise.
131 * mangle.c (write_integer_cst): Likewise.
132 * semantics.c (cp_finish_omp_clause_depend_sink): Likewise.
134 2017-10-10 Nathan Sidwell <nathan@acm.org>
136 * name-lookup.c (set_global_binding): Don't deal with STAT_HACK.
138 2017-10-06 Paolo Carlini <paolo.carlini@oracle.com>
141 * decl.c (finish_function): Take a bool intead of an int; adjust.
142 * cp-tree.h (finish_function): Adjust declaration.
143 * decl2.c (generate_tls_wrapper, finish_objects,
144 finish_static_storage_duration_function): Adjust calls.
145 * lambda.c (maybe_add_lambda_conv_op, finish_lambda_function):
147 * method.c (synthesize_method): Likewise.
148 * optimize.c (maybe_thunk_body, maybe_clone_body): Likewise.
149 * pt.c (instantiate_decl): Likewise.
150 * parser.c (cp_parser_function_definition_after_declarator,
151 cp_parser_late_parsing_for_member, cp_parser_omp_declare_reduction):
153 (cp_parser_ctor_initializer_opt,
154 cp_parser_ctor_initializer_opt_and_function_body,
155 cp_parser_function_try_block,
156 cp_parser_function_definition_after_declarator,
157 cp_parser_function_transaction): Return void; adjust declarations.
159 2017-10-06 Nathan Sidwell <nathan@acm.org>
162 * name-lookup.c (check_local_shadow): Don't try and convert
165 2017-10-06 Jakub Jelinek <jakub@redhat.com>
168 * decl.c (reshape_init): Suppress warn_useless_cast for direct enum
170 * typeck.c (convert_for_assignment): Likewise.
172 P0704R1 - fixing const-qualified pointers to members
173 * typeck2.c (build_m_component_ref): For -std=c++2a allow
174 pointer to const & qualified method on rvalue.
176 2017-10-06 Nathan Sidwell <nathan@acm.org>
178 Use hash_table for extern "C" names
179 * name-lookup.c (extern_c_fns): Use hash_table.
180 (check_extern_c_conflict): Adjust.
181 (c_linkage_bindings): Adjust.
183 Use hash_table for namespace bindings
184 * cp-tree.h (struct named_decl_hash): New.
185 (lang_decl_ns): Change type of bindings field.
186 * lex.c (maybe_add_lang_decl_raw): Adjust.
187 * name-lookup.c (find_namespace_slot): Adjust.
188 (do_pushdecl): Push NULL-named namespace.
189 (do_push_nested_namespace): Adjust.
190 (push_namespace): Push anonymous namespace as NULL name.
192 2017-10-05 Jason Merrill <jason@redhat.com>
194 Pass variadic class objects exactly like named by-value args.
195 * call.c (convert_arg_to_ellipsis): Use the result of force_rvalue.
197 2017-10-05 Nathan Sidwell <nathan@acm.org>
199 Warn on MVP declarations
200 * cp-tree.h (struct cp_declarator): Add parenthesized field.
201 * decl.c (grokdeclarator): Warn about unnecessary parens.
202 * parser.c (make_declarator): Init parenthesized field.
203 (cp_parser_direct_declarator): Set parenthesized field.
205 Kill IDENTIFIER_GLOBAL_VALUE, SET_IDENTIFIER_GLOBAL_VALUE
206 * cp-tree.h (IDENTIFIER_GLOBAL_VALUE,
207 SET_IDENTIFIER_GLOBAL_VALUE): Delete.
208 * name-lookup.h (set_global_binding): Remove NAME parm.
209 (get_global_binding): New inline fn.
210 * name-lookup.c (set_global_binding): Remove NAME parm. Adjust.
211 (identifier_global_value): Move to ...
212 * cp-objcp-common.c (identifier_global_value): ... here.
213 * class.c (build_ctor_vtbl_group, build_vtbl_initializer): Adjust.
214 * decl.c (record_builtin_type, expand_static_init,
215 grokdeclarator): Adjust.
216 * decl2.c (get_guard, get_local_tls_init_fn, get_tls_init_fn,
217 get_tls_wrapper_fn, maybe_warn_sized_delete): Adjust.
218 * except.c (declare_library_fn, build_throw): Adjust.
219 * init.c (throw_bad_array_length): Adjust.
220 * rtti.c (throw_bad_cast, throw_bad_typeid, get_tinfo_decl): Adjust.
222 * decl2.c (record_mangling): Fix spello and formatting from
225 2017-10-04 Nathan Sidwell <nathan@acm.org>
227 Give builtin types the correct name.
228 * name-lookup.c (set_global_binding): Assert name is DECL_NAME.
229 * decl.c (record_builtin_type): Reimplement, use new TYPE_DECL for
232 2017-10-04 Paolo Carlini <paolo.carlini@oracle.com>
233 Andrew Pinski <apinski@cavium.com>
236 * parser.c (cp_parser_lambda_body): Set parser->in_function_body.
238 2017-10-04 Nathan Sidwell <nathan@acm.org>
240 Move mangling aliases out of global namespace.
241 * cp-tree.h (record_mangling): New.
242 (maybe_remove_implicit_alias): Delete.
243 * decl2.c (mangled_decls): New hash map.
244 (generate_mangling_alias): Reimplement using mangled_decls.
245 (record_mangling): New.
246 * mangle.c (decl_implicit_alias_p,
247 maybe_remove_implicit_alias): Delete.
248 (mangle_decl): Use record_mangling.
249 * name-lookup.c (supplement_binding_1): Remove
250 maybe_remove_implicit_alias check.
252 2017-10-04 Jakub Jelinek <jakub@redhat.com>
255 * error.c (dump_function_decl): If show_return, call dump_type_suffix
256 on the same return type dump_type_prefix has been called on.
258 2017-10-04 Jason Merrill <jason@redhat.com>
260 PR c++/81525 - broken handling of auto in generic lambda.
261 * pt.c (tsubst_decl) [VAR_DECL]: Use strip_innermost_template_args.
263 2017-10-04 Nathan Sidwell <nathan@acm.org>
265 * call.c (convert_arg_to_ellipsis): Correct comment about passing
268 2017-10-02 Richard Sandiford <richard.sandiford@linaro.org>
270 * constexpr.c (cxx_eval_store_expression): Use wi::to_widest
271 when comparing the array bounds with an ARRAY_REF index.
273 2017-09-30 Paolo Carlini <paolo.carlini@oracle.com>
276 * method.c (defaulted_late_check): Early return if the defaulted
277 declaration does not match the expected signature.
279 2017-09-29 Jakub Jelinek <jakub@redhat.com>
281 P0683R1 - default member initializers for bit-fields
282 * cp-tree.h (grokbitfield): Add INIT parameter.
283 * parser.c (cp_parser_constant_expression): Add STRICT_P argument,
284 if true, parse a conditional-expression rather than
285 assignment-expression.
286 (cp_parser_member_declaration): For C++11 and later pass true
287 as STRICT_P to cp_parser_constant_expression. Parse C++2A bitfield
288 NSDMIs. Adjust grokbitfield caller. Handle DECL_INITIAL also for
290 (cp_parser_objc_class_ivars): Adjust grokbitfield caller.
291 * class.c (check_field_decl): Recurse even for DECL_C_BIT_FIELDs.
292 (check_field_decls): Call check_field_decl even for DECL_C_BIT_FIELDs.
293 * decl2.c (grokbitfield): Add INIT parameter, pass it to
295 * pt.c (tsubst_decl): Handle DECL_INITIAL for all FIELD_DECLs, not
298 * class.c (check_bitfield_decl): Retrieve and clear width from
299 DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL.
300 (check_field_decls): Test DECL_BIT_FIELD_REPRESENTATIVE rather than
302 (remove_zero_width_bit_fields): Adjust comment.
303 * decl2.c (grokbitfield): Stash width into
304 DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL.
305 * pt.c (tsubst_decl): For DECL_C_BIT_FIELD, tsubst_expr
306 DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL for width.
308 * parser.c (cp_parser_member_declaration): Parse attributes before
309 colon of a bitfield in addition to after colon.
311 * Make-lang.in (check-c++-all): Test also c++2a.
313 2017-09-28 Jason Merrill <jason@redhat.com>
315 PR c++/56973, DR 696 - capture constant variables only as needed.
316 * expr.c (mark_use): Split out from mark_rvalue_use and
317 mark_lvalue_use. Handle lambda capture of constant variables.
318 (mark_lvalue_use_nonread): New.
319 * semantics.c (process_outer_var_ref): Don't capture a constant
320 variable until forced.
321 * pt.c (processing_nonlambda_template): New.
322 * call.c (build_this): Check it.
323 * decl2.c (grok_array_decl): Call mark_rvalue_use and
324 mark_lvalue_use_nonread.
325 * init.c (constant_value_1): Don't call mark_rvalue_use.
326 * typeck.c (build_static_cast): Handle lambda capture.
328 Use local_specializations to find capture proxies.
329 * cp-tree.h (DECL_CAPTURED_VARIABLE): New.
330 * lambda.c (build_capture_proxy): Set it.
331 (add_capture): Pass initializer to build_capture_proxy.
332 (start_lambda_function): Likewise.
333 (insert_capture_proxy): Use register_local_specialization.
334 (is_lambda_ignored_entity): Always ignore proxies.
335 * name-lookup.c (qualify_lookup): Don't check
336 is_lambda_ignored_entity if LOOKUP_HIDDEN is set.
337 * semantics.c (process_outer_var_ref): Use
338 retrieve_local_specialization.
339 * parser.c (cp_parser_lambda_body): Push local_specializations.
340 * pt.c (tsubst_expr): Pass LOOKUP_HIDDEN when looking for a proxy.
341 (tsubst_lambda_expr): Push local_specializations sooner.
342 (tsubst_copy_and_build): Don't register_local_specialization.
344 * call.c (build_special_member_call): Use the return value of
346 * decl.c (compute_array_index_type): Likewise.
347 * parser.c (cp_parser_oacc_wait_list): Likewise.
348 * lambda.c (is_normal_capture_proxy): Handle *this capture.
349 (add_capture): Clarify internal_error message.
351 2017-09-22 Eric Botcazou <ebotcazou@adacore.com>
354 * cp-objcp-common.c (cp_get_debug_type): Do only one lookup.
356 2017-09-22 Jakub Jelinek <jakub@redhat.com>
359 * tree.c (struct replace_placeholders_t): Add pset field.
360 (replace_placeholders_r): Call cp_walk_tree with d->pset as
361 last argument instead of NULL. Formatting fix.
362 (replace_placeholders): Add pset variable, add its address
363 into data. Pass &pset instead of NULL to cp_walk_tree.
365 2017-09-22 David Malcolm <dmalcolm@redhat.com>
367 * call.c (get_fndecl_argument_location): New function.
368 (convert_like_real): Use it when complaining about argument type
370 * cp-tree.h (struct cp_parameter_declarator): Add "loc" field.
371 * parser.c (make_parameter_declarator): Add "loc" param and use
372 it to initialize the new field.
373 (cp_parser_translation_unit): Add UNKNOWN_LOCATION for "loc" of
374 the "no_parameters" parameter.
375 (cp_parser_parameter_declaration_list): Set the location of the
376 result of grokdeclarator to be the parameter's loc, assuming no
378 (cp_parser_parameter_declaration): Generate a location for the
379 parameter and pass to make_parameter_declarator.
381 2017-09-20 Nathan Sidwell <nathan@acm.org>
383 * name-lookup.c (member_name_cmp): Use DECL_UID for final
386 2017-09-20 Jakub Jelinek <jakub@redhat.com>
388 P0409R2 - allow lambda capture [=, this]
389 * parser.c (cp_parser_lambda_introducer): For cxx2a don't pedwarn on
392 2017-09-18 Jason Merrill <jason@redhat.com>
394 PR c++/82069 - ICE with lambda in template
395 * semantics.c (process_outer_var_ref): Check uses_template_parms
396 instead of any_dependent_template_arguments_p.
398 2017-09-15 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
399 Paolo Carlini <paolo.carlini@oracle.com>
402 * decl2.c (finish_anon_union): Complain about "anonymous union with
403 no members" with a pedwarn.
405 2017-09-15 Bernd Edlinger <bernd.edlinger@hotmail.de>
407 * typeck.c (build_reinterpret_cast_1,
408 build_const_cast_1): Implement -Wcast-align=strict.
410 2017-09-15 Jakub Jelinek <jakub@redhat.com>
412 * decl.c (redeclaration_error_message): Use cxx17 instead of cxx1z,
413 adjust diagnostics refering to C++1z or -std=gnu++1z or -std=c++1z
414 to C++17 or -std=gnu++17 or -std=c++17. Adjust comments.
415 (cxx_init_decl_processing, next_initializable_field,
416 is_direct_enum_init, check_initializer, cp_finish_decl,
417 mark_inline_variable, grokdeclarator, grokparms, xref_basetypes,
418 finish_function): Likewise.
419 * cp-tree.h (DECL_INLINE_VAR_P): Likewise.
420 * pt.c (mark_template_parm, convert_nontype_argument,
421 instantiate_class_template_1, type_unification_real, unify,
422 get_partial_spec_bindings, dependent_type_p_r): Likewise.
423 * typeck.c (cp_build_unary_op): Likewise.
424 * constexpr.c (var_in_maybe_constexpr_fn): Likewise.
425 * call.c (build_user_type_conversion_1, build_over_call,
426 build_special_member_call): Likewise.
427 * lambda.c (begin_lambda_type): Likewise.
428 * typeck2.c (process_init_constructor_record): Likewise.
429 * class.c (build_base_field, finalize_literal_type_property,
430 explain_non_literal_class): Likewise.
431 * parser.c (cp_parser_diagnose_invalid_type_name,
432 cp_parser_primary_expression, cp_parser_lambda_introducer,
433 cp_parser_lambda_declarator_opt, cp_parser_selection_statement,
434 cp_convert_range_for, cp_parser_perform_range_for_lookup,
435 cp_parser_decomposition_declaration, cp_parser_linkage_specification,
436 cp_parser_static_assert, cp_parser_simple_type_specifier,
437 cp_parser_namespace_definition, cp_parser_using_declaration,
438 cp_parser_init_declarator, cp_parser_type_parameter_key,
439 cp_parser_exception_specification_opt, cp_parser_std_attribute_spec,
440 cp_parser_constructor_declarator_p): Likewise.
441 * mangle.c (struct globals): Rename need_cxx1z_warning to
443 (write_exception_spec, start_mangling, mangle_decl): Likewise.
444 * Make-lang.in (check-c++1z): Rename to check-c++17, depend on
446 (check-c++17): New goal. Use 17 instead of 1z.
447 (check-c++-all): Use 17 instead of 1z.
449 2017-09-14 Jakub Jelinek <jakub@redhat.com>
452 * cp-gimplify.c (omp_var_to_track): Look through references.
453 (omp_cxx_notice_variable): Likewise.
455 2017-09-13 Nathan Sidwell <nathan@acm.org>
457 Conv-op identifers not in identifier hash table
458 * lex.c (conv_type_hasher): Make member fns inline.
459 (make_conv_op_name): Directly clone conv_op_identifier.
461 Rename CLASSTYPE_METHOD_VEC to CLASSTYPE_MEMBER_VEC.
462 * cp-tree.h (struct lang_type): Rename methods to members.
463 (CLASSTYPE_METHOD_VEC): Rename to ...
464 (CLASSTYPE_MEMBER_VEC): ... this.
465 * name-lookup.h (get_method_slot): Rename to ...
466 (get_member_slot): ... this.
467 (resort_type_method_vec): Rename to ...
468 (resort_type_member_vec): ... this.
469 * class.c (add_method, warn_hidden): Adjust.
470 * search.c (dfs_locate_field_accessor_pre): Adjust.
471 * name-lookup.c (method_vec_binary_search): Rename to ...
472 (member_vec_binary_search): ... this and adjust.
473 (method_vec_linear_search): Rename to ...
474 (member_vec_linear_search): ... this and adjust.
475 (fields_linear_search, get_class_binding_direct): Adjust.
476 (get_method_slot): Rename to ...
477 (get_member_slot): ... this and adjust.
478 (method_name_slot): Rename to ...
479 (member_name_slot): ... this and adjust.
480 (resort_type_method_vec): Rename to ...
481 (resort_type_member_vec): ... this and adjust.
482 (method_vec_append_class_fields): Rename to ...
483 (member_vec_append_class_fields): ... this and adjust.
484 (method_vec_append_enum_values): Rename to ...
485 (member_vec_append_enum_values): ... this and adjust.
486 (method_vec_dedup): Rename to ...
487 (member_vec_dedup): ... this and adjust.
488 (set_class_bindings, insert_late_enum_def_bindings): Adjust.
490 2017-09-12 Paolo Carlini <paolo.carlini@oracle.com>
493 * decl.c (start_decl): Early return error_mark_node if duplicate_decls
494 returns it; avoid misleading error message.
496 2017-09-12 Nathan Sidwell <nathan@acm.org>
498 Kill CLASSTYPE_SORTED_FIELDS.
499 * cp-tree.h (struct lang_type): Lose sorted_fields member.
500 (CLASSTYPE_SORTED_FIELDS): Delete.
501 * name-lookup.h (set_class_bindings): Add EXTRA arg.
502 * name-lookup.c (fields_linear_search): New, broken out of ...
503 (lookup_field_1): ... here. Delete remainder of function.
504 (get_class_binding_direct): Reimplement without sorted_fields.
505 (get_class_binding): Rename TYPE arg to KLASS, for consistency.
506 (get_method_slot): Call set_class_binding when creating method_vec
508 (method_name_cmp): Order identically named slots.
509 (sorted_fields_type_new): Delete.
510 (field_vc_append_class_fields): Rename to ...
511 (method_vec_append_class_fields): ... here. Adjust.
512 (field_vec_append_enum_values): Renme to ...
513 (method_vec_append_enum_values): ... here. Adjust.
514 (method_vec_dedup): New.
515 (set_class_bindings): Reimplement.
516 (insert_late_enum_def_bindings): Reimplement.
518 * name-lookup.c (get_class_binding): Rename TYPE arg to KLASS for
520 (restort_data): Move later.
521 (method_name_cmp, resort_method_name_cmp): Simplify.
522 (resort_type_method_vec): Reformat.
524 2017-09-09 Jason Merrill <jason@redhat.com>
526 * constexpr.c (reduced_constant_expression_p): If
527 CONSTRUCTOR_NO_IMPLICIT_ZERO, check that all fields are initialized.
529 2017-09-09 Eric Botcazou <ebotcazou@adacore.com>
532 * cp-objcp-common.c (struct debug_type_hasher): New class.
533 (debug_type_hash): New variable.
534 (cp_get_debug_type): Associate the OFFSET_TYPEs with the types.
536 2017-09-08 Jason Merrill <jason@redhat.com>
538 PR c++/70029 - ICE with ref-qualifier and -flto
539 * tree.c (cxx_copy_lang_qualifiers): New.
540 * cp-tree.h: Declare it.
541 * cp-objcp-common.h: Define LANG_HOOKS_COPY_LANG_QUALIFIERS.
543 2017-09-06 Jason Merrill <jason@redhat.com>
545 PR c++/82053 - ICE with default argument in lambda in template
546 * pt.c (tsubst_arg_types): Substitute default arguments for lambdas
548 (retrieve_specialization): Use lambda_fn_in_template_p.
549 * cp-tree.h: Declare it.
551 PR c++/82070 - error with nested lambda capture
552 * pt.c (tsubst_expr) [DECL_EXPR]: Register capture proxies with
553 register_local_specialization.
555 2017-09-06 Nathan Sidwell <nathan@acm.org>
557 * name-lookup.h (lookup_field_1): Delete.
558 (get_class_binding_direct, get_class_binding): Add type_or_fns arg.
559 * name-lookup.c (lookup_field_1): make static
560 (method_vec_binary_search, method_vec_linear_search): New. Broken
562 (get_class_binding_direct): ... here. Add TYPE_OR_FNS argument.
563 Do complete search of this level.
564 (get_class_binding): Adjust.
565 * decl.c (reshape_init_class): Call get_class_binding.
566 * search.c (lookup_field_r): Move field searching into
567 get_class_binding_direct.
569 * class.c (warn_hidden): Don't barf on non-functions.
570 * decl2.c (check_classfn): Likewise. Check template match earlier.
572 * name-lookup.c (count_fields): Rename to ...
573 (count_class_fields): ... here. Take a class, don't count
575 (add_fields_to_record_type): Rename to ...
576 (field_vec_append_class_fields): ... here. Take a class, don't
577 add NULL-named fields.
578 (add_enum_fields_to_record_type): Rename to ...
579 (field_vec_append_enum_values): ... here.
580 (set_class_bindings): Adjust, assert we added expected number.
581 (insert_late_enum_def_bindings): Reimplement. Create vector if
582 there are now sufficient entries.
584 * name-lookup.h (lookup_fnfields_slot_nolazy,
585 lookup_fnfields_slot): Rename to ...
586 (get_class_binding_direct, get_class_binding): ... here.
587 * name-lookup.c (lookup_fnfields_slot_nolazy,
588 lookup_fnfields_slot): Rename to ...
589 (get_class_binding_direct, get_class_binding): ... here.
590 * cp-tree.h (CLASSTYPE_CONSTRUCTORS, CLASSTYPE_DESTRUCTOR): Adjust.
591 * call.c (build_user_type_conversion_1): Adjust.
592 (has_trivial_copy_assign_p): Adjust.
593 (has_trivial_copy_p): Adjust.
594 * class.c (get_basefndecls) Adjust.
595 (vbase_has_user_provided_move_assign) Adjust.
596 (classtype_has_move_assign_or_move_ctor_p): Adjust.
597 (type_build_ctor_call, type_build_dtor_call): Adjust.
598 * decl.c (register_dtor_fn): Adjust.
599 * decl2.c (check_classfn): Adjust.
600 * pt.c (retrieve_specialization): Adjust.
601 (check_explicit_specialization): Adjust.
602 (do_class_deduction): Adjust.
603 * search.c (lookup_field_r): Adjust.
604 (look_for_overrides_here, lookup_conversions_r): Adjust.
605 * semantics.c (classtype_has_nothrow_assign_or_copy_p): Adjust.
606 * tree.c (type_has_nontrivial_copy_init): Adjust.
607 * method.c (lazily_declare_fn): Adjust comment.
609 2017-09-05 Nathan Sidwell <nathan@acm.org>
611 * name-lookup.c (do_class_using_decl): Elide read-once temps.
612 Move declarations to initializations.
614 * class.c (add_method): Move slot search and insertion to ...
615 * name-lookup.c (get_method_slot): ... this new function.
616 (lookup_fnfields_slot_nolazy): Cope with NULL slot.
617 * name-lookup.h (get_method_slot): Declare.
618 * decl.c (cxx_init_decl_processinng): Give conv_op_marker a more
620 (grok_special_member_properties): Set
621 TYPE_HAS_CONVERSION. Expicitly look at DECL_NAME for specialness.
622 Improve TYPE_HAS_CONSTEXPR_CTOR setting.
624 * cp-tree.h (lang_decl_base): Rename template_conv_p to
626 (DECL_CONV_FN_P): Don't check NULL DECL_NAME.
627 (DECL_CONV_FN_TYPE): FN must be conv op.
628 (DECL_TEMPLATE_CONV_FN_P): Delete.
629 (VAR_HAD_UNKNOWN_BOUND, SET_VAR_HAD_UNKNOWN_BOUND): Adjust.
630 * pt.c (push_template_decl_real): Delete DECL_TEMPLATE_CONV_FN_P
633 * class.c (unreverse_member_declarations): Remove extraneous if.
634 * pt.c (push_template_decl_real): Use string concatenation, not
635 \<newline>. Add %<..%>.
637 2017-09-05 Paolo Carlini <paolo.carlini@oracle.com>
640 * cp-tree.h (LABEL_DECL_CDTOR): Add and document.
641 * decl.c (start_preparsed_function): Set LABEL_DECL_CDTOR when
642 creating cdtor_label.
643 * constexpr.c (returns): Add the case of a constructor/destructor
644 returning via a LABEL_DECL_CDTOR label.
645 (cxx_eval_constant_expression, case [GOTO_EXPR]): Likewise.
647 2017-09-01 Nathan Sidwell <nathan@acm.org>
649 * cp-tree.h (resort_type_method_vec): Move declaration to ...
650 * name-lookup.h (resort_type_method_vec): ... here.
651 (set_class_bindings): Lose 2nd arg.
652 * class.c (finish_struct_1, finish_struct): Adjust
653 set_class_bindings call. Don't call finish_struct_methods.
654 (resort_data, method_name_cmp, resort_method_name_cmp,
655 resort_type_method_vec, finish_struct_methods): Move to ...
656 * name-lookup.c (resort_data, method_name_cmp,
657 resort_method_name_cmp, resort_type_method_vec): ... here.
658 (set_class_bindings): Lose fields arg. Swallow finish_struct_methods.
660 * class.c (finish_struct): Call set_class_bindings for the
663 * class.c (finish_struct_methods): Dont clear DECL_IN_AGGR_P here.
664 Don't call maybe_warn_about_overly_private_class here.
665 (warn_hidden): Cleanup declarations and comments.
666 (type_has_user_provided_constructor): No need to check
667 CLASSTYPE_METHOD_VEC.
668 (type_has_user_provided_or_explicit_constructor): Likewise.
669 (classtype_has_move_assign_or_move_ctor_p): Likewise.
670 (check_bases_and_members): Don't call finish_struct_methods here.
671 (finish_struct_1): Call finish_struct_methods and
672 set_class_bindings immediately after layout. Clear DECL_IN_AGGR_P
674 (finish_struct): For templates process USING_DECLS and clear
675 DECL_IN_AGGR_P before calling finish_struct_methods. Call
676 maybe_warn_about_overly_private_class here.
678 Revert 2017-08-28 Nathan Sidwell <nathan@acm.org>
679 Restore sorted_fields vector.
680 * cp-tree.h (lang_type): Restore sorted_fields vector.
681 (CLASSTYPE_SORTED_FIELDS): Restore.
682 (CLASSTYPE_BINDINGS): Delete.
683 * name-lookup.c (lookup_field_1): Restore binary search.
684 (sorted_fields_type_new, count_fields,
685 add_fields_to_record_type, add_enum_fields_to_record_type): Restore
686 (set_class_bindings): Revert.
687 (insert_late_enum_def_binding): Restore field_vec insertion.
689 2017-09-01 Jakub Jelinek <jakub@redhat.com>
692 * parser.c (cp_parser_omp_ordered): Handle -fopenmp-simd.
694 2017-09-01 Marek Polacek <polacek@redhat.com>
697 * typeck.c (cp_build_unary_op): Avoid re-entering reporting routines.
699 2017-08-30 Jason Merrill <jason@redhat.com>
701 PR c++/82029 - __PRETTY_FUNCTION__ in lambda in template
702 * pt.c (enclosing_instantiation_of, lambda_fn_in_template_p)
703 (regenerated_lambda_fn_p): New.
704 (tsubst_decl) [VAR_DECL]: Use enclosing_instantiation_of.
705 (tsubst_copy) [VAR_DECL]: Likewise.
707 PR c++/82030 - ICE inheriting from multiple lambdas
709 * call.c (compare_ics): Handle null candidate.
711 2017-08-30 Ville Voutilainen <ville.voutilainen@gmail.com>
713 Make taking the address of an overloaded function a non-deduced context
715 * pt.c (unify_overload_resolution_failure): Remove.
716 (unify_one_argument): Adjust.
718 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
719 Alan Hayward <alan.hayward@arm.com>
720 David Sherwood <david.sherwood@arm.com>
722 * typeck.c (cp_build_binary_op): Use SCALAR_TYPE_MODE.
724 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
725 Alan Hayward <alan.hayward@arm.com>
726 David Sherwood <david.sherwood@arm.com>
728 * cvt.c (cp_convert_to_pointer): Use SCALAR_INT_TYPE_MODE.
730 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
731 Alan Hayward <alan.hayward@arm.com>
732 David Sherwood <david.sherwood@arm.com>
734 * mangle.c (write_real_cst): Use SCALAR_FLOAT_TYPE_MODE
735 instead of TYPE_MODE.
737 2017-08-29 Jason Merrill <jason@redhat.com>
739 PR c++/81236 - ICE with template-id in generic lambda
740 * semantics.c (finish_id_expression): Remove special dependent case.
741 Avoid some later pieces when dependent.
742 (finish_qualified_id_expr): Do normal BASELINK handling in a
743 template. Always build a SCOPE_REF for a destructor BIT_NOT_EXPR.
744 (parsing_default_capturing_generic_lambda_in_template): Remove.
745 * parser.c (cp_parser_postfix_dot_deref_expression): Always give an
746 error for types that will never be complete.
747 * mangle.c (write_expression): Add sanity check.
748 * tree.c (build_qualified_name): Add sanity check.
749 (cp_walk_subtrees): Walk into the class context of a BASELINK.
750 * lambda.c (add_capture): Improve diagnostic for generic lambda
752 * call.c (build_new_method_call_1): Print the right constructor
755 Reimplement handling of lambdas in templates.
756 * cp-tree.h (LAMBDA_FUNCTION_P): Check DECL_DECLARES_FUNCTION_P.
757 * decl.c (start_preparsed_function): Call start_lambda_scope.
758 (finish_function): Call finish_lambda_scope.
759 * init.c (get_nsdmi): Call start/finish_lambda_scope.
760 * lambda.c (start_lambda_scope): Only ignore VAR_DECL in a function.
761 * parser.c (cp_parser_function_definition_after_declarator): Don't
762 call start/finish_lambda_scope.
763 * pt.c (retrieve_specialization): Ignore lambda functions in
765 (find_parameter_packs_r): Ignore capture proxies. Look into
767 (check_for_bare_parameter_packs): Allow bare packs in lambdas.
768 (tsubst_default_argument): Call start/finish_lambda_scope.
769 (tsubst_function_decl): Handle lambda functions differently.
770 (tsubst_template_decl): Likewise.
771 (tsubst_expr) [DECL_EXPR]: Skip closure declarations and capture
773 (tsubst_lambda_expr): Create a new closure rather than instantiate
774 the one from the template.
775 (tsubst_copy_and_build): Don't register a specialization of a pack.
776 (regenerate_decl_from_template): Call start/finish_lambda_scope.
777 (instantiate_decl): Remove special lambda function handling.
778 * semantics.c (process_outer_var_ref): Remove special generic lambda
779 handling. Don't implicitly capture in a lambda in a template. Look
780 for an existing proxy.
781 * class.c (current_nonlambda_class_type): Use decl_type_context.
783 * cp-tree.h (LAMBDA_EXPR_CLOSURE): Use TREE_TYPE.
784 (LAMBDA_EXPR_RETURN_TYPE): Remove.
785 (struct tree_lambda_expr): Remove closure and return_type fields.
786 * lambda.c (build_lambda_expr): Don't set LAMBDA_EXPR_RETURN_TYPE.
787 * pt.c (tsubst_copy_and_build): Likewise.
788 * parser.c (cp_parser_lambda_declarator_opt): Track return type.
789 (cp_parser_lambda_body): Adjust unspecified return type check.
790 * ptree.c (cxx_print_lambda_node): Don't print closure or
793 PR c++/80935 - wrong C++17 error with lambda
794 * decl.c (check_for_uninitialized_const_var): Check
795 is_instantiation_of_constexpr.
796 * constexpr.c (ensure_literal_type_for_constexpr_object): Check
797 is_instantiation_of_constexpr.
798 (potential_constant_expression_1): Check var_in_maybe_constexpr_fn.
800 * lambda.c (build_lambda_object): Check for error_mark_node.
801 * pt.c (make_pack_expansion): Set PACK_EXPANSION_LOCAL_P on the type
803 (tsubst_decl) [FUNCTION_DECL]: Set DECL_CONTEXT on the parameters.
804 (tsubst) [TEMPLATE_PARM_INDEX]: Check for error_mark_node.
806 PR c++/80767 - unnecessary instantiation of generic lambda
807 * call.c (convert_like_real): Call build_user_type_conversion_1 if
809 (add_conv_candidate): Build a ck_user conversion with no candidate.
811 Fix lambdas in template default argument of inherited ctor.
812 * method.c (synthesized_method_base_walk): Replace an inherited
813 template with its specialization.
814 (synthesized_method_walk): Make inheriting_ctor a pointer.
815 (maybe_explain_implicit_delete, explain_implicit_non_constexpr)
816 (deduce_inheriting_ctor, implicitly_declare_fn): Adjust.
818 * pt.c (build_deduction_guide): Set DECL_ABSTRACT_ORIGIN on the
819 template, not the function.
820 (template_guide_p): Adjust.
822 Support copying local_specializations.
823 * cp-tree.h (enum lss_policy): New.
824 (local_specialization_stack): Add policy parameter to default ctor.
825 * pt.c (local_specialization_stack): Copy local_specializations if
828 * constexpr.c (potential_constant_expression_1): Add "now" parm.
829 (is_constant_expression, require_constant_expression): New.
830 (is_static_init_expression, is_nondependent_constant_expression)
831 (is_nondependent_static_init_expression): Drop "potential".
832 * except.c (build_must_not_throw_expr): Do type conversion on
833 value-dependent argument.
834 * pt.c, semantics.c, typeck2.c: Use variants without "potential".
836 Instantiate default arguments/member initializers once.
837 * init.c (get_nsdmi): Remember NSDMI instantiations.
838 * parser.c (inject_this_parameter): Be more picky about
840 * pt.c (tsubst_copy): Simplify 'this' handling.
841 (tsubst_default_argument): Remember default argument
842 instantiations. Take parameter number.
843 (tsubst_default_arguments): Pass it.
844 * call.c (convert_default_arg): Likewise.
846 Fix default argument conversion failure and SFINAE.
847 * call.c (build_over_call): Check convert_default_arg result for
849 * parser.c (cp_parser_late_parsing_default_args): Remember
852 2017-08-28 Nathan Sidwell <nathan@acm.org>
854 * cp-tree.h (lang_type): Replace sorted_fields vector with
856 (CLASSTYPE_SORTED_FIELDS): Delete.
857 (CLASSTYPE_BINDINGS): New.
858 * decl.c (finish_enum_value_list): Swap args of
859 insert_late_enum_def_bindings.
860 * name-lookup.c (lookup_field_1): Replace binary search of sorted
861 fields with map->get.
862 (sorted_fields_type_new, count_fields,
863 add_fields_to_record_type, add_enum_fields_to_record_type): Delete.
864 (add_class_member, add_class_members): New.
865 (set_class_bindings): Create map and insert.
866 (insert_late_enum_def_binding): Swap parms. Use add_clasS_member.
867 * ptree.c (cxx_print_type): Delete sorted fields printing.
869 * cp-tree.h (insert_late_enum_def_into_classtype_sorted_fields):
871 * name-lookup.h (set_class_bindings,
872 insert_late_enum_def_bindings): Declare.
873 * decl.c (finish_enum_value_list): Adjust for
874 insert_late_enum_def_bindings name change.
875 * class.c (finish_struct_1): Call set_class_bindings.
876 (count_fields, add_fields_to_record_type,
877 add_enum_fields_to_record_type, sorted_fields_type_new,
878 insert_into_classtype_sorted_fields,
879 insert_late_enum_def_into_classtype_sorted_fields): Move to ...
880 * name-lookup.h (count_fields, add_fields_to_record_type,
881 add_enum_fields_to_record_type, sorted_fields_type_new,
882 set_class_bindings, insert_late_enum_def_bindings): ... here.
884 2017-08-25 Nathan Sidwell <nathan@acm.org>
886 * class.c (method_name_cmp, resort_method_name_cmp): Methods
889 Conversion operators have a special name
890 * cp-tree.h (CPTI_CONV_OP_MARKER, CPTI_CONV_OP_IDENTIFIER): New.
891 (conv_op_marker, conv_op_identifier): New.
892 (CLASSTYPE_FIRST_CONVERSION_SLOT): Delete.
893 * decl.c (initialize_predefined_identifiers): Add
895 (cxx_init_decl_processing): Create conv_op_marker.
896 * decl2.c (check_classfn): Lookup conv-ops by name.
897 * class.c (add_method): Use conv_op_identifier & conv_op_marker.
898 (resort_type_method_vec): Don't skip conv-ops.
899 (finish_struct_methods, warn_hidden): Likewise.
900 * name-lookup.h (lookup_all_conversions): Delete.
901 * name-lookup.c (lookup_conversion_operator): Replace with ...
902 (extract_conversion_operator): ... this.
903 (lookup_fnfields_slot_nolazy): Find conv-ops by name.
904 (lookup_all_conversions): Delete.
905 * pt.c (check_explicit_specialization): Find conv-ops by name.
906 * search.c (lookup_conversions_r): Likewise.
908 2017-08-24 Nathan Sidwell <nathan@acm.org>
910 Conversion operators kept on single overload set
911 * class.c (add_method): Keep all conv-ops on one slot.
912 * name-lookup.c (lookup_conversion_operator): Pull the desired
913 conv op out of overload set.
914 * search.c (lookup_conversions_r): Lose template/non-template
916 (lookup_conversions): Likewise.
918 2017-08-23 Nathan Sidwell <nathan@acm.org>
920 * cp-tree.h (lookup_field_1, lookup_fnfields_slot,
921 lookup_fnfields_slot_nolazy, lookup_all_conversions): Move
923 * name-lookup.h (lookup_field_1, lookup_fnfields_slot,
924 lookup_fnfields_slot_nolazy, lookup_all_conversions): ... here.
925 * search.c (lookup_conversion_operator,
926 lookup_fnfields_slot_nolazy, lookup_field_1, lookup_fnfields_slot,
927 lookup_all_conversions): Move to ...
928 * name-lookup.c (lookup_conversion_operator,
929 lookup_fnfields_slot_nolazy, lookup_field_1, lookup_fnfields_slot,
930 lookup_all_conversions): ... here.
932 * semantics.c (finish_member_declaration): Move USING_DECL check
933 earlier. Always set C++ linkage. Commonize TYPE_FIELD and
934 template decl list insertion.
936 * cp-tree.h (maybe_version_functions): Declare.
937 * decl.c (decls_match): Break function versioning check to
938 separate function. Call it.
939 (maybe_version_functions): Broken out of decls_match.
940 * class.c (add_method): Use maybe_version_functions.
942 * cp-tree.h (print_search_statistics,
943 reinit_search_statistics): Don't declare.
944 * search.c (n_fields_searched, n_calls_lookup_field,
945 n_calls_lookup_field_1, n_calls_lookup_fnfields,
946 n_calls_lookup_fnfields_1, n_calls_get_base_type,
947 n_outer_fields_searched, n_contexts_saved): Delete.
948 (lookup_field_1, lookup_member,
949 lookup_fnfields_slot_nolazy): Remove stat gathering.
950 (print_search_statistics, reinit_search_statistics): Delete.
951 * tree.c (cxx_print_statistics): Don't print search stats.
953 2017-08-21 Nathan Sidwell <nathan@acm.org>
955 * search.c (lookup_field_r): Remove obsolete code for type-named
958 * search.c (lookup_field_1): Assert TYPE is a class and VFIELD
960 (lookup_field_fuzzy_info::fuzzy_lookup_fnfields): Delete.
961 (lookup_field_fuzzy_r): Adjust.
963 2017-08-21 David Malcolm <dmalcolm@redhat.com>
965 * call.c (build_over_call): Pass NULL for new parameter to
966 check_function_arguments.
967 * typeck.c (cp_build_function_call_vec): Likewise.
969 2017-08-21 Nathan Sidwell <nathan@acm.org>
972 * pt.c (instantiate_class_template_1):
973 BOUND_TEMPLATE_TEMPLATE_PARM is never friend-injected.
975 2017-08-18 David Malcolm <dmalcolm@redhat.com>
978 * name-lookup.c (maybe_suggest_missing_header): Convert return
979 type from void to bool; return true iff a suggestion was offered.
980 (suggest_alternative_in_explicit_scope): Move call to
981 maybe_suggest_missing_header to before use of best_match, and
982 return true if the former offers a suggestion.
984 2017-08-18 H.J. Lu <hongjiu.lu@intel.com>
987 * decl.c (duplicate_decls): Also merge DECL_WARN_IF_NOT_ALIGN.
988 * decl2.c (grokbitfield): Don't allow bit-field with
989 warn_if_not_aligned type.
991 2017-08-17 Nathan Sidwell <nathan@acm.org>
993 * cp-tree.def (TEMPLATE_TEMPLATE_PARM): Remove stale comment.
994 * cp-tree.h (ENUM_TEMPLATE_INFO): Delete.
995 (TYPE_TEMPLATE_INFO): Simplify.
996 (SET_TYPE_TEMPLATE_INFO): Simplify.
998 * lex.c (maybe_add_lang_type_raw): BOUND_TEMPLATE_TEMPLATE_PARMs
999 don't need lang_type.
1000 (cxx_make_type): Use maybe_add_lang_type_raw return value.
1001 * mangle.c (CLASSTYPE_TEMPLATE_ID_P): Don't rely on
1004 * cp-tree.h (struct lang_type): Remove template_info field.
1005 (CLASSTYPE_TEMPLATE_INFO): Use TYPE_LANG_SLOT_1.
1006 (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO): Likewise.
1008 2017-08-14 Martin Sebor <msebor@redhat.com>
1011 * error.c (cp_printer): Handle 'G'.
1013 2017-08-11 Martin Liska <mliska@suse.cz>
1015 * decl2.c (get_tls_init_fn): Replace ASM_OUTPUT_DEF with
1016 TARGET_SUPPORTS_ALIASES.
1017 (handle_tls_init): Likewise.
1018 (note_mangling_alias): Likewise. Remove ATTRIBUTE_UNUSED for
1020 * optimize.c (can_alias_cdtor): Likewise.
1022 2017-08-11 Jason Merrill <jason@redhat.com>
1024 PR c++/81671 - nullptr_t template parameter
1025 * pt.c (convert_nontype_argument): Fix nullptr_t check.
1027 2017-08-10 Jason Merrill <jason@redhat.com>
1029 PR c++/81359 - Unparsed NSDMI error from SFINAE context.
1030 * method.c (synthesized_method_walk): Don't diagnose lack of
1033 PR c++/80452 - Core 1579, implicit move semantics on return/throw
1034 * cp-tree.h (LOOKUP_PREFER_RVALUE): Now means that we've already
1035 tentatively changed the lvalue to an rvalue.
1036 * call.c (reference_binding): Remove LOOKUP_PREFER_RVALUE handling.
1037 (build_over_call): If LOOKUP_PREFER_RVALUE, check that the first
1038 parameter is an rvalue reference.
1039 * except.c (build_throw): Do maybe-rvalue overload resolution twice.
1040 * typeck.c (check_return_expr): Likewise.
1042 2017-08-10 David Malcolm <dmalcolm@redhat.com>
1044 * parser.c (cp_parser_error): Update for new param to
1046 (class token_pair): New class.
1047 (struct matching_paren_traits): New struct.
1048 (matching_parens): New typedef.
1049 (struct matching_brace_traits): New struct.
1050 (matching_braces): New typedef.
1051 (cp_parser_statement_expr): Convert explicit parsing of
1052 CPP_OPEN_PAREN and CPP_CLOSE_PAREN to use of
1053 class matching_parens, so that the pertinent open parenthesis is
1054 highlighted when there are problems locating the close
1056 (cp_parser_primary_expression): Likewise.
1057 (cp_parser_compound_literal_p): Remove consumption of opening
1059 (cp_parser_postfix_expression): Convert explicit parsing of
1060 CPP_OPEN_PAREN and CPP_CLOSE_PAREN to use matching parens, as
1061 above. Use it to consume the opening paren previously consumed by
1062 cp_parser_compound_literal_p.
1063 (cp_parser_parenthesized_expression_list): Likewise.
1064 (cp_parser_unary_expression): Likewise.
1065 (cp_parser_new_expression): Likewise.
1066 (cp_parser_cast_expression): Likewise.
1067 (cp_parser_builtin_offsetof): Likewise.
1068 (cp_parser_trait_expr): Likewise.
1069 (cp_parser_lambda_declarator_opt): Likewise.
1070 (cp_parser_lambda_body): Likewise, for matching_braces.
1071 (cp_parser_compound_statement): Likewise.
1072 (cp_parser_selection_statement): Likewise, for matching_parens.
1073 (cp_parser_iteration_statement): Likewise.
1074 (cp_parser_already_scoped_statement): Likewise, for
1076 (cp_parser_linkage_specification): Likewise.
1077 (cp_parser_static_assert): Likewise, for matching_parens.
1078 (cp_parser_decltype): Likewise.
1079 (cp_parser_operator): Likewise.
1080 (cp_parser_enum_specifier): Likewise.
1081 (cp_parser_namespace_definition): Likewise.
1082 (cp_parser_direct_declarator): Likewise.
1083 (cp_parser_braced_list): Likewise.
1084 (cp_parser_class_specifier_1): Likewise, for matching_braces.
1085 (cp_parser_constant_initializer): Likewise.
1086 (cp_parser_noexcept_specification_opt): Likewise, for
1088 (cp_parser_exception_specification_opt): Likewise.
1089 (cp_parser_handler): Likewise.
1090 (cp_parser_asm_specification_opt): Likewise.
1091 (cp_parser_asm_operand_list): Likewise.
1092 (cp_parser_gnu_attributes_opt): Likewise.
1093 (cp_parser_std_attribute_spec): Likewise.
1094 (cp_parser_requirement_parameter_list): Likewise.
1095 (cp_parser_requirement_body): Likewise, for matching_braces.
1096 (cp_parser_compound_requirement): Likewise.
1097 (cp_parser_template_introduction): Likewise.
1098 (cp_parser_sizeof_pack): Likewise, for matching_parens.
1099 (cp_parser_sizeof_operand): Likewise; use it to consume the
1100 opening paren previously consumed by cp_parser_compound_literal_p.
1101 (get_matching_symbol): New function.
1102 (cp_parser_required_error): Add param "matching_location". Remove
1103 calls to cp_parser_error, instead setting a non-NULL gmsgid, and
1104 handling it if set by calling c_parse_error, potentially with a
1105 secondary location if matching_location was set.
1106 (cp_parser_require): Add param "matching_location", with a default
1107 value of UNKNOWN_LOCATION.
1108 (cp_parser_require_keyword): Update for new param of
1109 cp_parser_required_error.
1110 (cp_parser_objc_encode_expression): Update to class matching_parens
1112 (cp_parser_objc_defs_expression): Likewise.
1113 (cp_parser_objc_protocol_expression): Likewise.
1114 (cp_parser_objc_selector_expression): Likewise.
1115 (cp_parser_objc_typename): Likewise.
1116 (cp_parser_objc_superclass_or_category): Likewise.
1117 (cp_parser_objc_try_catch_finally_statement): Likewise.
1118 (cp_parser_objc_synchronized_statement): Likewise.
1119 (cp_parser_objc_at_property_declaration): Likewise.
1120 (cp_parser_oacc_single_int_clause): Likewise.
1121 (cp_parser_oacc_shape_clause): Likewise.
1122 (cp_parser_omp_clause_collapse): Likewise.
1123 (cp_parser_omp_clause_default): Likewise.
1124 (cp_parser_omp_clause_final): Likewise.
1125 (cp_parser_omp_clause_if): Likewise.
1126 (cp_parser_omp_clause_num_threads): Likewise.
1127 (cp_parser_omp_clause_num_tasks): Likewise.
1128 (cp_parser_omp_clause_grainsize): Likewise.
1129 (cp_parser_omp_clause_priority): Likewise.
1130 (cp_parser_omp_clause_hint): Likewise.
1131 (cp_parser_omp_clause_defaultmap): Likewise.
1132 (cp_parser_omp_clause_ordered): Likewise.
1133 (cp_parser_omp_clause_schedule): Likewise.
1134 (cp_parser_omp_clause_num_teams): Likewise.
1135 (cp_parser_omp_clause_thread_limit): Likewise.
1136 (cp_parser_omp_clause_aligned): Likewise.
1137 (cp_parser_omp_clause_linear): Likewise.
1138 (cp_parser_omp_clause_safelen): Likewise.
1139 (cp_parser_omp_clause_simdlen): Likewise.
1140 (cp_parser_omp_clause_depend): Likewise.
1141 (cp_parser_omp_clause_device): Likewise.
1142 (cp_parser_omp_clause_dist_schedule): Likewise.
1143 (cp_parser_oacc_clause_async): Likewise.
1144 (cp_parser_omp_critical): Likewise.
1145 (cp_parser_omp_for_loop): Likewise.
1146 (cp_parser_omp_sections_scope): Likewise.
1147 (cp_parser_omp_declare_reduction_exprs): Likewise.
1148 Update for new param to cp_parser_required_error.
1149 (cp_parser_oacc_routine): Likewise.
1150 (cp_parser_transaction_expression): Likewise.
1151 (cp_parser_cilk_simd_vectorlength): Likewise.
1153 2017-08-09 Jason Merrill <jason@redhat.com>
1155 PR c++/81525 - wrong constant value with generic lambda
1156 * pt.c (tsubst_decl) [VAR_DECL]: Avoid clobbering auto.
1157 (tsubst_copy) [VAR_DECL]: Handle auto.
1159 PR c++/81359 - Unparsed NSDMI error from SFINAE context.
1160 * init.c (get_nsdmi): Add complain parm.
1161 * typeck2.c (digest_nsdmi_init): Add complain parm.
1162 (process_init_constructor_record): Pass complain to get_nsdmi.
1163 * pt.c (maybe_instantiate_noexcept): Add complain parm, return bool.
1164 * method.c (get_defaulted_eh_spec): Add complain parm. Pass it into
1165 synthesized_method_walk.
1166 (synthesized_method_walk): Adjust.
1167 (walk_field_subobs): Pass complain to get_nsdmi.
1168 (defaulted_late_check): Skip other checks if deleted.
1169 * decl2.c (mark_used): Pass complain to maybe_instantiate_noexcept.
1170 * call.c (build_aggr_conv): Pass complain to get_nsdmi.
1171 * parser.c (defarg_location): New.
1172 * error.c (location_of): Use it.
1174 2017-08-09 Marek Polacek <polacek@redhat.com>
1176 * parser.c (cp_parser_perform_range_for_lookup): Use false instead of 0.
1177 * typeck.c (build_binary_op): Change the type of a parameter to bool.
1178 (cp_truthvalue_conversion): Use true instead of 1.
1180 2017-08-08 Marek Polacek <polacek@redhat.com>
1183 * cp-gimplify.c (cp_fold): If folding exposed a branch of
1184 a COND_EXPR, convert it to the original type of the COND_EXPR, if
1187 2017-08-08 Martin Liska <mliska@suse.cz>
1189 * call.c: Include header files.
1190 * cp-gimplify.c: Likewise.
1191 * cp-ubsan.c: Likewise.
1194 * search.c: Likewise.
1195 * semantics.c: Likewise.
1196 * typeck.c: Likewise.
1198 2017-08-07 Martin Liska <mliska@suse.cz>
1200 * parser.c (cp_parser_gnu_attribute_list): Canonicalize name of an
1202 (cp_parser_std_attribute): Likewise.
1203 * tree.c: Add new include.
1205 2017-08-04 Paolo Carlini <paolo.carlini@oracle.com>
1208 * pt.c (do_class_deduction): Handle the case of no viable implicit
1209 deduction guides; simplify the code generating implicit deduction
1212 2017-08-03 Paolo Carlini <paolo.carlini@oracle.com>
1215 * typeck.c (build_x_unary_op): Avoid pretty-printing constructor /
1216 destructor as expressions.
1218 2017-08-02 Jakub Jelinek <jakub@redhat.com>
1221 * call.c (build_user_type_conversion_1): Only call
1222 lookup_fnfields_slot if totype is CLASS_TYPE_P.
1224 2017-07-31 Jason Merrill <jason@redhat.com>
1226 * decl.c (declare_global_var): Set DECL_CONTEXT.
1228 2017-07-31 Jan Hubicka <hubicka@ucw.cz>
1229 Martin Liska <mliska@suse.cz>
1231 * pt.c (tsubst_copy): Copy PREDICT_EXPR.
1232 * semantics.c (finish_goto_stmt): Build gimple predict
1234 * constexpr.c (potential_constant_expression_1): Handle
1237 2017-07-31 Martin Liska <mliska@suse.cz>
1240 * cp-gimplify.c (cp_genericize): Guard condition with flag_sanitize_p
1241 also with current_function_decl non-null equality.
1242 * cp-ubsan.c (cp_ubsan_instrument_vptr_p): Likewise.
1243 * decl.c (compute_array_index_type): Likewise.
1244 * init.c (finish_length_check): Likewise.
1245 * typeck.c (cp_build_binary_op): Likewise.
1247 2017-07-29 Jakub Jelinek <jakub@redhat.com>
1249 * cp-objcp-common.c (cp_decl_dwarf_attribute): Handle
1250 DW_AT_export_symbols.
1251 * name-lookup.c (emit_debug_info_using_namespace): Add IMPLICIT
1252 argument, pass it through to the debug hook.
1253 (finish_namespace_using_directive): Adjust
1254 emit_debug_info_using_namespace caller.
1255 (push_namespace): Likewise. Call it after setting
1256 DECL_NAMESPACE_INLINE_P.
1257 (cp_emit_debug_info_for_using): Pass false as new argument to
1258 the imported_module_or_decl debug hook.
1260 2017-07-28 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
1262 * lex.c (copy_decl): Adjust.
1263 (copy_type): Likewise.
1265 2017-07-26 Paolo Carlini <paolo.carlini@oracle.com>
1268 * lambda.c (add_capture): Early return if we cannot capture by
1271 2017-07-26 Jason Merrill <jason@redhat.com>
1273 P0702R1 - List deduction of vector.
1274 * pt.c (do_class_deduction): Special-case deduction from a single
1275 element of related type.
1277 2017-07-26 Leonid Koppel <lkoppel@uwaterloo.ca>
1279 PR c++/67054 - Inherited ctor with non-default-constructible members
1280 * method.c (walk_field_subobs) Consider member initializers (NSDMIs)
1281 when deducing an inheriting constructor.
1283 2017-07-21 Nathan Sidwell <nathan@acm.org>
1285 * search.c (lookup_conversion_operator): Return overloads.
1286 (lookup_fnfields_idx_nolazy): Absorb into ...
1287 (lookup_fnfields_slot_nolaxy): ... here.
1288 (lookup_fnfields_1): Absorb into ...
1289 (lookup_fnfields_slot): ... here.
1291 Remove special CDtor METHOD_VEC slots.
1292 * cp-tree.h (CLASSTYPE_CONSTRUCTOR_SLOT,
1293 CLASSTYPE_DESTRUCTOR_SLOT): Delete.
1294 (CLASSTYPE_CONSTRUCTORS): Use lookup_fnfields_slot_nolazy.
1295 (CLASSTYPE_DESTRUCTOR): Likewise.
1296 * class (add_method): Don't use special cdtor slots.
1297 * search.c (lookup_fnfields_idx_nolazy): Likewise.
1298 (look_for_overrides_here): Use lookup_fnfields_slot.
1299 * semantics (classtype_has_nothrow_assign_or_copy_p): Likewise.
1301 * call.c (add_candidates): Move decls to initialization. Don't
1304 2017-07-20 Nathan Sidwell <nathan@acm.org>
1306 Remove TYPE_METHODS.
1307 * class.c (maybe_warn_about_overly_private_class,
1308 finish_struct_methods, one_inheriting_sig, count_fields,
1309 add_fields_to_record_type, check_field_decls, check_methods,
1310 clone_function_decl, set_method_tm_attributes,
1311 finalize_literal_type_property, check_bases_and_members,
1312 create_vtable_ptr, determine_key_method,
1313 unreverse_member_declarations, finish_struct,
1314 add_vcall_offset_vtbl_entries_1): Member fns are on TYPE_FIELDS.
1315 * decl.c (fixup_anonymous_aggr): Likewise.
1316 * decl2.c (reset_type_linkage_2): Likewise.
1317 * method.c (after_nsdmi_defaulted_late_checks,
1318 lazily_declare_fn): Likewise.
1319 * optimize.c (maybe_thunk_body, maybe_clone_body): Likewise.
1320 * pt.c (instantiate_class_template_1, tsubst_expr,
1321 do_type_instantiation, instantiate_pending_templates): Likewise.
1322 * search.c (lookup_field_1): Likewise.
1323 * semantics.c (finish_member_declaration,
1324 finish_omp_declare_simd_methods): Likewise.
1326 2017-07-19 Nathan Sidwell <nathan@acm.org>
1328 * class.c (add_implicitly_declared_members): Use
1329 classtype_has_move_assign_or_move_ctor_p.
1330 (classtype_has_move_assign_or_move_ctor,
1331 classtype_has_user_move_assign_or_move_ctor_p): Merge into ...
1332 (classtype_has_move_assign_or_move_ctor_p): ... this new function.
1333 * cp-tree.h (classtype_has_user_move_assign_or_move_ctor_p):
1335 (classtype_has_move_assign_or_move_ctor_p): ... this.
1336 * method.c (maybe_explain_implicit_delete, lazily_declare_fn): Adjust.
1337 * tree.c (type_has_nontrivial_copy_init): Adjust.
1339 * cp-tree.h (PACK_EXPANSION_PARAMETER_PACKS,
1340 PACK_EXPANSION_EXTRA_ARGS): Use TYPE_{MIN,MAX}_VALUE_RAW.
1342 2017-07-18 Nathan Sidwell <nathan@acm.org>
1344 * cp-array-notation.c (build_array_notation_ref): Use
1345 TYPE_{MIN,MAX}_VALUE.
1347 * class.c (classtype_has_move_assign_or_move_ctor): Declare.
1348 (add_implicitly_declared_members): Use it.
1349 (type_has_move_constructor, type_has_move_assign): Merge into ...
1350 (classtype_has_move_assign_or_move_ctor): ... this new function.
1351 * cp-tree.h (type_has_move_constructor, type_has_move_assign): Delete.
1353 2017-07-17 Volker Reichelt <v.reichelt@netcologne.de>
1355 * parser.c (cp_parser_decl_specifier_seq): Add fix-it hints for
1356 friend outside class and obsolete auto as storage-class-specifier.
1358 2017-07-17 Nathan Sidwell <nathan@acm.org>
1360 * class.c (maybe_warn_about_overly_private_class): Ignore public
1363 * class.c (type_has_user_declared_move_constructor,
1364 type_has_user_declared_move_assign): Combine into ...
1365 (classtype_has_user_move_assign_or_move_ctor_p): ... this new function.
1366 * cp-tree.h (type_has_user_declared_move_constructor,
1367 type_has_user_declared_move_assign): Combine into ...
1368 (classtype_has_user_move_assign_or_move_ctor_p): ... this. Declare.
1369 * method.c (maybe_explain_implicit_delete): Use it.
1370 (lazily_declare_fn): Use it.
1371 * tree.c (type_has_nontrivial_copy_init): Use it.
1373 * semantics.c (classtype_has_nothrow_assign_or_copy_p): Clarify
1374 semantics, simplify implementation.
1376 2017-07-16 Volker Reichelt <v.reichelt@netcologne.de>
1378 * parser.c (cp_parser_cast_expression): Use %q#T instead of %qT
1379 in old-style cast diagnostic.
1380 * typeck.c (maybe_warn_about_useless_cast): Use %q#T instead of %qT
1381 in useless cast diagnostic.
1382 * error.c (type_to_string): Remove enum special handling.
1384 2017-07-14 David Malcolm <dmalcolm@redhat.com>
1386 * name-lookup.c (get_std_name_hint): Add '<' and '>' around
1388 (maybe_suggest_missing_header): Update for addition of '<' and '>'
1389 to above. Provide a fix-it hint.
1390 * pt.c: Include "gcc-rich-location.h"
1391 (listify): Attempt to add fix-it hint for missing
1392 #include <initializer_list>.
1393 * rtti.c: Include "gcc-rich-location.h".
1394 (typeid_ok_p): Attempt to add fix-it hint for missing
1395 #include <typeinfo>.
1397 2017-07-12 Jason Merrill <jason@redhat.com>
1399 P0512R0 - Deduction from an initializer list.
1400 * pt.c (do_class_deduction): Do list deduction in two phases.
1402 2017-07-12 Nathan Sidwell <nathan@acm.org>
1404 * cp-tree.h (DECL_CONSTRUCTOR_P, DECL_MAYBE_IN_CHARGE_CONSTRUCTOR,
1405 DECL_DESTRUCTOR_P, DECL_MAYBE_IN_CHARGE_DESTRCTOR): Look at
1407 * decl.c (grokfndecl): Set DECL_CXX_CONSTRUCTOR and
1408 DECL_CXX_DESTRUCTOR explicitly.
1409 * decl2.c (grokclassfn): Likewise.
1410 * friend.c (do_friend): Likewise.
1411 * method.c (make_thunk, make_alias_for,
1412 implicitly_declare_fn): Likewise.
1414 2017-07-11 Jason Merrill <jason@redhat.com>
1417 * decl.c (grokparms): Downgrade error about array of unknown bound
1418 to pedwarn and disable it for C++17.
1420 2017-07-11 Nathan Sidwell <nathan@acm.org>
1422 * decl2.c (reset_type_linkage_2): Dont't change ctor name.
1424 2017-07-10 Martin Sebor <msebor@redhat.com>
1426 * cp-tree.h (cp_operator_id, cp_assignment_operator_id): Document.
1428 2017-07-06 Jason Merrill <jason@redhat.com>
1430 PR c++/81204 - parse error with dependent template-name
1431 * parser.c (cp_parser_lookup_name): Revert previous change.
1433 2017-07-06 David Malcolm <dmalcolm@redhat.com>
1435 * cp-lang.c (LANG_HOOKS_RUN_LANG_SELFTESTS): Define as
1436 selftest::run_cp_tests.
1437 (selftest::run_cp_tests): New function.
1438 * cp-tree.h (selftest::run_cp_tests): New decl.
1440 2017-07-04 Jakub Jelinek <jakub@redhat.com>
1442 * parser.c (cp_parser_decomposition_declaration): Replace
1443 decomposition declaration with structured binding in diagnostics.
1444 * decl.c (cp_finish_decomp): Likewise.
1445 (grokdeclarator): Likewise.
1448 * parser.c (cp_parser_decomposition_declaration): Diagnose invalid
1449 forms of structured binding initializers.
1451 2017-07-03 Paolo Carlini <paolo.carlini@oracle.com>
1454 * decl.c (grokdeclarator): Move checks on function return type after
1455 the splice_late_return_type call; if declspecs->locations[ds_type_spec]
1456 is UNKNOWN_LOCATION fall back to input_location.
1458 2017-07-03 David Malcolm <dmalcolm@redhat.com>
1460 * parser.c (enum required_token): Fix spelling of
1461 RT_INTERATION to RT_ITERATION.
1462 (cp_parser_iteration_statement): Likewise.
1463 (cp_parser_required_error): Likewise.
1465 2017-06-30 Jason Merrill <jason@redhat.com>
1467 PR c++/81257 - ICE with invalid ::template.
1468 PR c++/54769 - wrong lookup of dependent template-name.
1469 * parser.c (cp_parser_template_name): Revert part of last change.
1471 2017-06-30 Nathan Sidwell <nathan@acm.org>
1473 * config-lang.in (gtfiles): Add cp/lex.c.
1474 * cp-tree.h (mangle_convop_name_for_type): Rename ...
1475 (make_conv_op_name): ... here. Move to lex.
1476 * lambda.c (maybe_add_lambda_conv_op): Update.
1477 * parser.c (cp_parser_conversion_function_id): Update.
1478 * pt.c (tsubst_decl, tsubst_baselink, tsubst_copy,
1479 tsubst_copy_and_build): Update.
1480 * semantics.c (apply_deduced_return_type): Update.
1481 * mangle.c (conv_type_hasher, conv_type_names,
1482 mangle_conv_op_name_for_type): Move to ...
1483 * lex.c (conv_type_hasher, conv_type_names, make_convop_name):
1486 2017-06-30 David Malcolm <dmalcolm@redhat.com>
1489 * parser.c (cp_parser_postfix_expression): Construct a location
1490 for typeid expressions.
1492 2017-06-30 Nathan Sidwell <nathan@acm.org>
1494 * cp-tree.h (lookup_fnfields_1, class_method_index_for_fn): Don't
1496 (lookup_all_conversions): Declare.
1497 * class.c (get_basefndecls): Use lookup_fnfields_slot.
1498 * decl.c (register_dtor_fn): Use lookup_fnfields_slot.
1499 * decl2.c (check_class_fn): Use lookup_fnfields_slot. Rework
1501 * pt.c (retrieve_specialization): Use lookup_fnfields_slot.
1502 (check_explicit_specialization): Use lookup_fnfields_slot_nolazy,
1503 lookup_all_conversions.
1504 * search.c (lookup_fnfields_1): Make static.
1505 (lookup_all_conversions): New.
1506 (class_method_index_for_fn): Delete.
1507 * semantics.c (classtype_has_nothrow_assign_or_copy_p): Use
1508 lookup_fnfields_slot.
1510 * call.c (build_new_method_call_1): Use constructo_name to get
1511 ctor name. Move argument processing earlier to merge cdtor
1513 * decl.c (grokfndecl): Cdtors have special names.
1514 * method.c (implicitly_declare_fn): Likewise. Simplify flag setting.
1515 * pt.c (check_explicit_specialization): Cdtor name is already
1517 * search.c (class_method_index_for_fn): Likewise.
1520 * name-lookup.c (do_pushdecl): Reset IDENTIFIER_TYPE when finding
1521 a matching TYPE_DECL.
1523 2017-06-29 Paolo Carlini <paolo.carlini@oracle.com>
1525 * class.c (add_method): Change pair of errors to error + inform.
1526 (handle_using_decl): Likewise.
1528 2017-06-29 Jason Merrill <jason@redhat.com>
1530 * constexpr.c, error.c, tree.c: Remove WITH_CLEANUP_EXPR handling.
1532 PR c++/81180 - ICE with C++17 deduction of member class template.
1533 * pt.c (build_deduction_guide): Correct member template handling.
1535 PR c++/81188 - matching decltype of member function call.
1536 * tree.c (cp_tree_equal): Remove COMPONENT_REF special case.
1538 2017-06-29 Nathan Sidwell <nathan@acm.org>
1541 * parser.c (cp_parser_namespace_definition): Immediately close the
1542 namespace if there's no open-brace.
1543 * name-lookup.c (do_pushdecl): Reset OLD when pushing into new
1546 2017-06-29 Jason Merrill <jason@redhat.com>
1548 PR c++/81164 - ICE with invalid inherited constructor.
1549 * search.c (binfo_direct_p): New.
1550 * name-lookup.c (do_class_using_decl): Use it.
1552 2017-06-29 Nathan Sidwell <nathan@acm.org>
1554 * cp-tree.h (THIS_NAME, IN_CHARGE_NAME, VTBL_PTR_TYPE,
1555 VTABLE_DELTA_NAME, VTABLE_PFN_NAME): Delete.
1556 * decl.c (initialize_predefined_identifiers): Name cdtor special
1557 names consistently. Use literals for above deleted defines.
1558 (cxx_init_decl_processing): Use literal for vtbl_ptr_type name,
1560 * lex.c (maybe_add_lang_type_raw): Exit early, rather than use a
1563 * call.c (check_dtor_name): Use constructor_name for enums too.
1564 (build_new_method_call_1): Use constructor_name for cdtors and
1566 * class.c (build_self_reference): Use TYPE_NAME to get name of
1568 * name-lookup (constructor_name): Use DECL_NAME directly.
1569 (constructor_name_p): Reimplement.
1570 (push_class_level_binding_1): Use TYPE_NAME directly.
1572 * class.c (finish_struct): Use OVL_P.
1573 (get_vfield_name): Measure constructor_name length.
1574 * cp-tree.h (SET_CLASS_TYPE_P): Add RECORD_OR_UNION_CHECK.
1575 (NON_UNION_CLASS_TYPE_P): Check RECORD_TYPE up front.
1576 * cxx-pretty-print.c (is_destructor_name): Delete.
1577 (pp_cxx_unqualified_id): Remove bogus destructor name checking.
1578 * decl.c (grokfndecl): Move cheap checks first when looking for
1579 implicit extern cness.
1581 * parser.c (cp_parser_direct_declarator): Reorder if to avoid
1582 indentation. Remove unnecessary assignment of constructor name.
1584 Whitespace cleanups.
1585 * call.c (name_as_c_string): Move CONST_CAST to return.
1586 (build_new_method_call_1): Remove unneeded bracing.
1587 * class.c (include_empty_classes): Unbreak line.
1588 * constraint.cc (tsubst_check_constraint): Add space.
1589 * cp-tree.h (lang_decl_ns): Add comment.
1590 (PTRMEM_CST_MEMBER): Break line.
1591 * decl.c (grokfndecl): Add blank lines. Unbreak some others.
1592 (grokdeclarator): Remove lines, move declaration to first use.
1593 * decl2.c (decl_needed_p): Fix indentation.
1594 (c_parse_final_cleanups): Remove blank line.
1595 * method.c (implicitly_declare_fn): Move declaration to first use.
1596 * search.c (current_scope): Add blank lines.
1598 2017-06-28 Jason Merrill <jason@redhat.com>
1600 PR c++/72764 - ICE with invalid template typename.
1601 * decl.c (build_typename_type): No longer static.
1602 * tree.c (strip_typedefs): Use it instead of make_typename_type.
1604 PR c++/69300 - ICE with self-referential noexcept
1605 * pt.c (maybe_instantiate_noexcept): Check for recursion.
1607 PR c++/61022 - error with variadic template template parm
1608 * pt.c (convert_template_argument): Keep the TYPE_PACK_EXPANSION.
1610 PR c++/72801 - ICE with variadic partial specialization
1611 * pt.c (unify_pack_expansion): Use PACK_EXPANSION_EXTRA_ARGS.
1613 PR c++/55639 - partial specialization with ::template
1614 * parser.c (cp_parser_class_head): Handle ::template.
1616 PR c++/45976 - error with ::template in declarator.
1617 * pt.c (resolve_typename_type): Fix TEMPLATE_ID_EXPR handling.
1619 PR c++/54769 - wrong lookup of dependent template-name.
1620 * parser.c (cp_parser_template_name): Handle dependent object type.
1621 (cp_parser_nested_name_specifier_opt): Make template_keyword_p a
1623 (cp_parser_id_expression): Pass it.
1624 (cp_parser_diagnose_invalid_type_name): Handle TEMPLATE_ID_EXPR.
1626 * parser.c (cp_parser_template_id): Use the range location on the
1629 PR c++/81204 - parse error with dependent template-name
1630 * parser.c (cp_parser_lookup_name): Disqualify function templates
1633 2017-06-27 Nathan Sidwell <nathan@acm.org>
1635 * pt.c (tsubst_decl <FUNCTION_DECL>): Move var decls to
1636 initialization point. Don't unnecessarily check for ctor name.
1638 * cp-tree.h (CLASSTYPE_DESTRUCTORS): Rename to ...
1639 (CLASSTYPE_DESTRUCTOR): ... this.
1640 * class.c (accessible_nvdtor_p,
1641 maybe_warn_about_overly_private_class,
1642 add_implicitly_declared_members,
1643 clone_constructors_and_destructors, type_has_virtual_destructor):
1644 Adjust for CLASSTYPE_DESTRUCTOR.
1645 (deduce_noexcept_on_destructors): Absorb into ...
1646 (check_bases_and_members): ... here.
1647 * except.c (dtor_nothrow): Adjust for CLASSTYPE_DESTRUCTOR.
1648 * init.c (build_delete): Likewise.
1649 * parser.c (cp_parser_lookup_name): Likewise.
1650 * pt.c (check_explicit_specialization): Likewise.
1651 * rtti.c (emit_support_tinfos): Likewise.
1652 * search.c (lookup_fnfields_idx_nolazy): Likewise.
1654 Kill IDENTIFIER_TEMPLATE.
1655 * cp-tree.h (lang_identifier): Remove class_template_info field.
1656 (IDENTIFIER_TEMPLATE): Delete.
1657 * name-lookup.c (constructor_name_full): Subsume into ...
1658 (constructor_name): ... here. Don't check IDENTIFIER_TEMPLATE.
1659 (constructor_name_p): Likewise.
1660 * mangle.c (write_source_name): Likewise.
1661 * ptree.c (cxx_print_identifier): Likewise.
1663 2017-06-27 Marek Polacek <polacek@redhat.com>
1666 * parser.c (cp_parser_already_scoped_statement): Initialize
1669 2017-06-26 Jason Merrill <jason@redhat.com>
1671 PR c++/81215 - deduction failure with variadic TTP.
1672 * pt.c (unify_bound_ttp_args): Restore old logic for C++14 and down.
1674 2017-06-26 Martin Sebor <msebor@redhat.com>
1677 * call.c (maybe_warn_class_memaccess): Preserve explicit conversions
1678 to detect casting away cv-qualifiers.
1680 2017-06-26 Nathan Sidwell <nathan@acm.org>
1682 * cp-tree.h (lang_decl_fn): Remove assignment_operator_p field.
1683 (DECL_COMPLETE_CONSTRUCTOR_P): Directly compare
1685 (DECL_BASE_CONSTRUCTOR_P, DECL_COMPLETE_DESTRUCTOR_P,
1686 DECL_BASE_DESTRUCTOR_P, DECL_DELETING_DESTRUCTOR_P): Likewise.
1687 (DECL_ASSIGNMENT_OPERATOR_P): Use IDENTIFIER_ASSIGN_OP_P.
1688 * decl.c (grok_op_properties): Adjust identifier checking.
1689 * init.c (expand_default_init): Adjust identifier descision.
1690 * method.c (implicitly_declare_fn): Don't use
1691 DECL_ASSIGNMENT_OPERATOR_P.
1692 * search.c (lookup_fnfields_1): Use IDENTIFIER_CTOR_P,
1694 * call.c (in_charge_arg_for_name): Reimplement.
1695 (build_special_member_call): Use IDENTIFIER_CDTOR_P,
1698 2017-06-26 Marek Polacek <polacek@redhat.com>
1701 * parser.c (cp_parser_statement): Add a default argument. Save the
1702 location of the expression-statement after labels have been parsed.
1703 (cp_parser_implicitly_scoped_statement): Set the location of the
1704 body of the conditional after parsing all the labels. Call
1705 warn_for_multistatement_macros.
1706 (cp_parser_already_scoped_statement): Likewise.
1708 2017-06-24 Paolo Carlini <paolo.carlini@oracle.com>
1711 * parser.c (cp_parser_diagnose_invalid_type_name): Don't print
1712 'typename' in error messages about missing 'typename'.
1714 2017-06-23 Jason Merrill <jason@redhat.com>
1716 PR c++/79056 - C++17 ICE with invalid template syntax.
1717 * parser.c (cp_parser_simple_type_specifier): Don't assume that type
1719 (cp_parser_check_for_invalid_template_id): Handle TYPE_DECL.
1720 * pt.c (template_placeholder_p): New.
1721 * cp-tree.h: Declare it.
1723 2017-06-23 Marc Glisse <marc.glisse@inria.fr>
1725 * decl.c (duplicate_decls): Use builtin_structptr_types.
1727 2017-06-22 Nathan Sidwell <nathan@acm.org>
1729 Reorder IDENTIFIER flags
1731 * cp-tree.h (enum cp_identifier_kind): New.
1732 (IDENTIFIER_KIND_BIT_0, IDENTIFIER_KIND_BIT_1,
1733 IDENTIFIER_KIND_BIT_2): New.
1734 (IDENTIFIER_MARKED): Move to TREE_LANG_FLAG_4.
1735 (IDENTIFIER_VIRTUAL_P, IDENTIFIER_REPO_CHOSEN): Add IDENTIFIER_CHECK.
1736 (C_IS_RESERVED_WORD): Replace with ...
1737 (IDENTIFIER_KEYWORD_P): ... this.
1738 (IDENTIFIER_CTOR_OR_DTOR_P): Replace with ...
1739 (IDENTIFIER_CDTOR_P): ... this.
1740 (IDENTIFIER_CTOR_P, IDENTIFIER_DTOR_P): New.
1741 (IDENTIFIER_OPNAME_P): Replace with ...
1742 (IDENTIFIER_ANY_OP_P): ... this.
1743 (IDENTIFIER_ASSIGN_OP_P): New.
1744 (IDENTIFIER_TYPENAME_P): Replace with ...
1745 (IDENTIFIER_CONV_OP_P): ... this.
1746 (NEW_DELETE_OPNAME_P): Replace with ...
1747 (IDENTIFIER_NEWDEL_OP_P): ... this.
1748 (DECL_CONV_FN_P, DECL_OVERLOADED_OPERATOR_P): Adjust.
1749 (get_identifier_kind_name, set_identifier_kind): Declare.
1750 * lex.c (get_identifier_kind_name, set_identifier_kind): New.
1751 (init_operators): Adjust to avoid keywords, use
1752 set_identifier_kind. Copy TYPE_EXPR slot.
1753 (init_reswords): Call set_identifier_kind.
1754 (unqualified_name_lookup_error): Adjust.
1755 * operators.def (TYPE_EXPR): Remove.
1756 * decl.c (struct predefined_identifier): Move into ...
1757 (initialize_predefined_identifiers): ... here. Call
1758 set_identifier_kind.
1759 (grokfndecl, check_var_type, grokdeclarator): Adjust.
1760 (grok_op_properties): Use IDENTIFIER_ANY_ASSIGN_OP to halve search
1762 * call.c (name_as_c_string): Adjust.
1763 (build_new_method_call_1): Likewise.
1764 * cp-cilkplus.c (is_conversion_operator_function_decl_p): Likewise.
1765 * cxx-pretty-print.c (pp_cxx_unqualified_id): Adjust.
1766 * dump.c (cp_dump_tree): Adjust.
1767 * error.c (dump_decl_name): Adjust.
1768 * mangle.c (write_unqualified_id, write_member_name,
1769 write_expression): Adjust.
1770 (mangle_conv_op_name_for_type): Use set_identifier_kind.
1771 * name-lookup.c (do_class_using_decl): Adjust.
1772 (lookup_name_fuzzy, lookup_name_real_1): Likewise.
1773 * parser.c (cp_lexer_get_preprocessor_token,
1774 cp_parser_direct_declarator): Likewise.
1775 * pt.c (push_template_decl_real, tsubst_decl, tsubst_baselink,
1776 tsubst_copy, tsubst_copy_and_build): Adjust.
1777 * ptree.c (cxx_print_identifier): Print identifier kind.
1778 * search.c (lookup_field_r, lookup_member,
1779 lookup_fnfields_idx_nolazy): Adjust.
1780 * semantics.c (finish_id_expression): Adjust..
1781 * typeck.c (cp_build_addr_expr_1): Adjust.
1783 2017-06-21 Jakub Jelinek <jakub@redhat.com>
1786 * semantics.c (handle_omp_array_sections_1, finish_omp_clauses):
1787 Complain about t not being a variable if t is OVERLOAD even
1788 when processing_template_decl.
1790 2017-06-21 David Malcolm <dmalcolm@redhat.com>
1792 * parser.c (get_cast_suggestion): New function.
1793 (maybe_add_cast_fixit): New function.
1794 (cp_parser_cast_expression): Capture the location of the closing
1795 parenthesis. Call maybe_add_cast_fixit when emitting warnings
1796 about old-style casts.
1798 2017-06-20 Jason Merrill <jason@redhat.com>
1800 PR c++/80972 - C++17 ICE with attribute packed.
1801 * call.c (build_over_call): Allow a TARGET_EXPR from reference
1804 2017-06-20 Nathan Sidwell <nathan@acm.org>
1806 * cp-tree.h (CPTI_NELTS_IDENTIFIER): Delete.
1807 (nelts_identifier): Delete.
1808 * decl.c (initialize_predefined_identifiers): Remove nelts.
1810 PR c++/67074 - namespace aliases
1811 * decl.c (duplicate_decls): Don't error here on mismatched
1813 * name-lookup.c (name_lookup::add_value): Matching namespaces are
1815 (diagnose_name_conflict): Namespaces are never redeclarations.
1816 (update_binding): An alias can match a real namespace.
1818 2017-06-19 Jason Merrill <jason@redhat.com>
1820 PR c++/80562 - ICE with constexpr if.
1821 * semantics.c (finish_if_stmt_cond): Call
1822 instantiate_non_dependent_expr.
1824 PR c++/80829 - ICE with constexpr copy of base subobject.
1825 * constexpr.c (clear_no_implicit_zero): New.
1826 (cxx_eval_call_expression): Call it.
1828 2017-06-19 Nathan Sidwell <nathan@acm.org>
1832 * name-lookup.c (set_decl_namespace): Don't follow using
1833 directives and ignore using decls. Only check overly-explicit
1834 scope after discovering decl.
1836 2017-06-19 Jason Merrill <jason@redhat.com>
1838 PR c++/81073 - constexpr and static var in statement-expression.
1839 * typeck2.c (store_init_value): Always call
1840 require_potential_constant_expression.
1841 * pt.c (convert_nontype_argument): Likewise.
1842 * constexpr.c (potential_constant_expression_1): Adjust message.
1843 Use decl_maybe_constant_var_p instead of decl_constant_var_p.
1844 * decl2.c (decl_maybe_constant_var_p): Consider initializer.
1846 2017-06-19 Nathan Sidwell <nathan@acm.org>
1848 * pt.c (coerce_template_parms): Fix indentation.
1849 (tsubst_decl): Remove repeated SET_DECL_RTL. Move VAR_P handling
1853 * name-lookup.c (update_binding): Only warn about constructors
1854 hidden by functions.
1856 2017-06-17 Jason Merrill <jason@redhat.com>
1858 PR c++/60063 - -Wunused-local-typedefs and templates.
1859 * decl2.c (is_late_template_attribute): Return false for "used".
1861 PR c++/70844 - -Wuseless-cast and inheriting constructor.
1862 * method.c (forward_parm): Suppress warn_useless_cast.
1864 2017-06-16 Jason Merrill <jason@redhat.com>
1866 PR c++/81045 - Wrong type-dependence with auto return type.
1867 * pt.c (type_dependent_expression_p): An undeduced auto outside the
1868 template isn't dependent.
1869 * call.c (build_over_call): Instantiate undeduced auto even in a
1872 PR c++/80465 - ICE with generic lambda with noexcept-specifier.
1873 * lambda.c (maybe_add_lambda_conv_op): Keep processing_template_decl
1874 set longer for a generic lambda.
1876 PR c++/80614 - Wrong mangling for C++17 noexcept type
1877 * mangle.c (write_type): Put the eh spec back on the function type.
1879 PR c++/81102 - Wrong error with partial specialization.
1880 * pt.c (unify) [TEMPLATE_PARM_INDEX]: Strip reference when comparing
1881 types. Do type deduction later.
1883 PR c++/81074 - ICE with partial specialization of member template.
1885 * pt.c (get_partial_spec_bindings): Only coerce innermost args.
1887 PR c++/80831 - ICE with -fsyntax-only.
1888 * decl2.c (c_parse_final_cleanups): Use cgraph_node::get_create.
1890 PR c++/80639 - ICE with invalid PMF initialization.
1891 PR c++/80043 - ICE with -fpermissive
1892 * typeck.c (convert_for_assignment): Recurse when instantiate_type
1893 returns without an error.
1895 2017-06-16 Nathan Sidwell <nathan@acm.org>
1897 * pt.c (tsubst_baselink): Fix & clarify formatting.
1899 * cp-tree.h (build_this_parm, cp_build_parm_decl,
1900 build_artificial_parm): Add FN parm.
1901 * decl.c (start_cleanup_fn): Adjust.
1902 (build_this_parm): Add FN parm, pass it through.
1903 (grokfndecl): Adjust parm building.
1904 * decl2.c (cp_build_parm_decl): Add FN parm, set context.
1905 (build_artificial_parm): Add FN parm, pass through.
1906 (maybe_retrofit_in_chrg): Adjust parm building.
1907 (start_static_storage_duration_function): Likwise.
1908 * lambda.c (maybe_aadd_lambda_conv_op): Likewise.
1909 * method.c (implicitly_declare_fn): Likewise.
1910 * parser.c (inject_this_parameter): Likewise.
1912 Symbol tables are insert only.
1913 * cp-tree.h (default_hash_traits <lang_identifier *>): Don't
1914 derive from pointer_hash. Make undeletable.
1916 * class.c (resort_type_method_vec): Avoid potential unsigned
1919 Don't defer noexcept_deferred_spec.
1920 * cp-tree.h (unevaluated_noexcept_spec): Don't declare.
1921 * decl.c (cxx_init_decl_processing): Initialize
1922 noexcept_deferred_spec.
1923 * except.c (unevaluated_noexcept_spec): Delete.
1924 * class.c (deduce_noexcept_on_destructor): Use
1925 noexcept_deferred_spec directly.
1926 * method.c (implicitly_declare_fn): Likewise.
1928 Make keyed_classes a vector.
1929 * cp-tree.h (CPTI_KEYED_CLASSES, keyed_classes): Delete.
1930 (keyed_classes): Declare as vector.
1931 * decl.c (keyed_classes): Define.
1932 (cxx_init_decl_processing): Allocate it.
1933 (record_key_method_defined): Use vec_safe_push.
1934 * class.c (finish_struct_1): Likewise.
1935 * pt.c (instantiate_class_template_1): Likewise.
1936 * decl2.c (c_parse_final_cleanups): Reverse iterate keyed_classes.
1939 * rtti.c (enum tinfo_kind): Add TK_DERIVED_TYPES,
1940 TK_VMI_CLASS_TYPES, TK_MAX. Delete TK_FIXED.
1942 (typeid_ok_p): Add quotes to error messages. Use get_tinfo_desc.
1943 (get_tinfo_decl): Use get_tinfo_desc.
1944 (get_pseudo_ti_init): Likewise. Adjust VMI construction.
1945 (create_pseudo_type_info): Delete.
1946 (get_pseudo_ti_index): Just determine the index.
1947 (get_tinfo_desc): New. Create all types lazily.
1948 (create_tinfo_types): Just allocate the descriptor array.
1949 (emit_support_tinfos): Use non-inserting type lookup. Set builtin
1952 2017-06-15 Martin Sebor <msebor@redhat.com>
1955 * call.c (first_non_public_field, maybe_warn_class_memaccess): New
1957 (has_trivial_copy_assign_p, has_trivial_copy_p): Ditto.
1958 (build_cxx_call): Call maybe_warn_class_memaccess.
1960 2017-06-14 Jakub Jelinek <jakub@redhat.com>
1962 * cp-gimplify.c (cp_genericize_r): Turn most of the function
1963 into a switch (TREE_CODE (stmt)) statement from long else if
1966 2017-06-13 Jakub Jelinek <jakub@redhat.com>
1969 * cp-gimplify.c (cp_genericize_r): Don't instrument MEM_REF second
1970 argument even if it has REFERENCE_TYPE.
1973 * cp-gimplify.c (cp_genericize): Only look for VAR_DECLs in
1974 BLOCK_VARS (outer) chain.
1975 (cxx_omp_const_qual_no_mutable): Likewise.
1977 2017-06-13 Martin Liska <mliska@suse.cz>
1980 * class.c (build_base_path): Use sanitize_flags_p.
1981 * cp-gimplify.c (cp_genericize_r): Likewise.
1982 (cp_genericize_tree): Likewise.
1983 (cp_genericize): Likewise.
1984 * cp-ubsan.c (cp_ubsan_instrument_vptr_p): Likewise.
1985 * decl.c (compute_array_index_type): Likewise.
1986 (start_preparsed_function): Likewise.
1987 * decl2.c (one_static_initialization_or_destruction): Likewise.
1988 * init.c (finish_length_check): Likewise.
1989 * lambda.c (maybe_add_lambda_conv_op): Likewise.
1990 * typeck.c (cp_build_binary_op): Likewise.
1991 (build_static_cast_1): Likewise.
1993 2017-06-11 Jason Merrill <jason@redhat.com>
1995 * error.c (dump_expr): Use is_this_parameter.
1997 * cp-tree.h, decl2.c, mangle.c, parser.c, pt.c, semantics.c: Use
2000 2017-06-09 Jason Merrill <jason@redhat.com>
2002 Missing bits from N4268, constant evaluation for all non-type args.
2003 * call.c (build_converted_constant_expr): Rename from
2004 build_integral_nontype_arg_conv, handle all types.
2005 * pt.c (convert_nontype_argument): In C++17 call it for all types.
2006 Move NOP stripping inside pointer case, don't strip ADDR_EXPR.
2007 * cvt.c (strip_fnptr_conv): Also strip conversions to the same type.
2009 Overhaul pointer-to-member conversion and template argument handling.
2010 * call.c (standard_conversion): Avoid creating ck_pmem when the
2011 class type is the same.
2012 * cvt.c (can_convert_qual): Split from
2013 perform_qualification_conversions.
2014 * constexpr.c (cxx_eval_constant_expression): Check it.
2015 * typeck.c (convert_ptrmem): Only cplus_expand_constant if
2016 adjustment is necessary.
2017 * pt.c (check_valid_ptrmem_cst_expr): Compare class types.
2018 (convert_nontype_argument): Avoid redundant error.
2020 * call.c (convert_like_real): Remove "inner" parameter.
2021 Don't replace a constant with its value.
2022 * cp-gimplify.c (cp_fully_fold): Use cp_fold_rvalue.
2024 * pt.c (convert_nontype_argument): Check NULLPTR_TYPE_P rather than
2027 * parser.c (cp_parser_constant_expression): Check
2028 potential_rvalue_constant_expression after decay_conversion.
2029 * pt.c (convert_nontype_argument): Don't require linkage in C++17.
2031 PR c++/80384 - ICE with dependent noexcept-specifier
2032 * pt.c (dependent_type_p_r) [FUNCTION_TYPE]: Check for dependent
2035 * constexpr.c (potential_constant_expression_1): Allow 'this' capture.
2037 2017-06-09 Jan Hubicka <hubicka@ucw.cz>
2039 * class.c (build_vtbl_initializer): Mark dvirt_fn as cold.
2040 * decl.c (cxx_init_decl_processing, push_throw_library_fn): Likewise.
2041 (excpet.c): Mark terminate as cold.
2043 2017-06-08 Jakub Jelinek <jakub@redhat.com>
2046 * semantics.c (handle_omp_array_sections_1): Convert TYPE_MAX_VALUE
2047 to sizetype before size_binop.
2050 * cp-gimplify.c (cxx_omp_finish_clause): When changing clause
2051 to OMP_CLAUSE_SHARED, also clear OMP_CLAUSE_SHARED_FIRSTPRIVATE
2052 and OMP_CLAUSE_SHARED_READONLY flags.
2054 2017-06-08 Jan Hubicka <hubicka@ucw.cz>
2056 * cp-tree.h (lang_check_failed): Annotate by ATTRIBUTE_COLD.
2058 2017-06-07 Nathan Sidwell <nathan@acm.org>
2060 * class.c (layout_class_type): Restructure overlong-bitfield tpe
2063 2017-06-07 Jonathan Wakely <jwakely@redhat.com>
2066 * pt.c (do_class_deduction): Build qualified type.
2068 2017-06-06 Nathan Sidwell <nathan@acm.org>
2070 * name-lookup.c (suggest_alternatives_for): Use qualified lookup
2071 sans using directives. Don't walk into inline namespaces.
2074 * name-lookup.c (adl_class_only): Don't add visible friends.
2076 2017-06-05 Volker Reichelt <v.reichelt@netcologne.de>
2078 * parser.c (cp_parser_base_specifier): Fix typos in error messages.
2080 2017-06-02 Nathan Sidwell <nathan@acm.org>
2082 Remove lang_type_ptrmem.
2083 * cp-tree.h (lang_type_header): Remove is_lang_type_class. Move
2085 (lang_type_class): ... this. Reorder bitfields. Rename to ...
2086 (lang_type): ... this. Delete old definition.
2087 (lang_type_ptrmem): Delete.
2088 (LANG_TYPE_CLASS_CHECK): Simply get TYPE_LANG_SPECIFIC. Adjust uses.
2089 (LANG_TYPE_PTRMEM_CHECK): Delete.
2090 (TYPE_GET_PTRMEMFUNC_TYPE, TYPE_SET_PTRMEMFUNC_TYPE): Delete.
2091 (TYPE_PTRMEMFUNC_TYPE): New. Use TYPE_LANG_SLOT_1.
2092 * decl.c (build_ptrmemfunc_type): Adjust.
2093 * lex.c (copy_lang_type): Remove lang_type_ptrmem handling.
2094 (maybe_add_lang_type_raw): Don't set u.c.h.is_lang_type_class.
2096 * class.c (check_bases_and_members): Adjust vec_new_uses_cookie
2099 Remove cp_binding_level::namespaces
2100 * name-lookup.h (cp_binding_level): Lose namespaces field.
2101 * name-lookup.c (add_decl_to_level): Chain namespaces on the names
2103 (suggest_alternatives_for): Adjust for namespace list. Do
2104 breadth-first search.
2105 * decl2.c (collect_source_refs): Namespaces are on the regulr
2107 (collect_ada_namespace): Likewise.
2109 2017-06-02 Bernd Edlinger <bernd.edlinger@hotmail.de>
2111 * typeck.c (cp_build_binary_op): Implement the -Wsizeof_pointer_div
2114 2017-06-01 Ville Voutilainen <ville.voutilainen@gmail.com>
2117 * method.c (constructible_expr): Strip array types before calling
2120 2017-06-01 Paolo Carlini <paolo.carlini@oracle.com>
2123 * cvt.c (convert_to_void): Possibly call maybe_warn_nodiscard
2124 for case INDIRECT_REF too in the main switch.
2126 2017-05-31 Jason Merrill <jason@redhat.com>
2128 PR c++/80840 - ICE with constexpr and reference
2129 * pt.c (convert_nontype_argument): Don't test whether a decl is
2130 value-dependent when binding to a reference.
2132 2017-05-31 Nathan Sidwell <nathan@acm.org>
2134 * cp-tree.h (lang_decl_slector): New enum.
2135 (lang_decl_base): Make selector an enum. Drop decomposition_p
2137 (lang_decl): Use enum for discrimination.
2138 (LANG_DECL_FN_CHECK, LANG_DECL_NS_CHECK, LANG_DECL_PARM_CHECK,
2139 LANG_DECL_DEOMP_CHECK): Use enum.
2140 (DECL_DECOMPOSITION_P): Use selector value.
2141 (SET_DECL_DECOMPOSITION_P): Delete.
2142 (retrofit_lang_decl): Lose SEL parm.
2143 (fit_decomposition_lang_decl): Declare.
2144 * decl.c (cp_finish_decomp, grokdeclarator): Use
2145 fit_decomposition_lang_decl.
2146 * lex.c (maybe_add_lang_decl_raw): New. Broken out of
2148 (set_decl_linkage): New. Broken out of retrofit_lang_decl. Use enum.
2149 (fit_decomposition_lang_decl): Likewise.
2150 (retrofit_lang_decl): Use worker functions.
2151 (cxx_dup_lang_specific_decl): Use selector enum.
2152 (maybe_add_lang_type_raw): New. Broken out of ...
2153 (cxx_make_type_name): ... here. Call it.
2155 2017-05-30 Jason Merrill <jason@redhat.com>
2157 PR c++/80856 - ICE with local extern in template
2158 * semantics.c (finish_call_expr): Replace a local extern overload
2159 set in a template with the IDENTIFIER_NODE.
2161 2017-05-30 David Malcolm <dmalcolm@redhat.com>
2163 * call.c (perform_implicit_conversion_flags): Convert
2164 "from %qT to %qT" to "from %qH to %qI" in diagnostic.
2165 (print_conversion_rejection): Replace pairs of %qT with
2166 %qH and %qI in various places.
2167 (build_user_type_conversion_1): Likewise.
2168 (build_integral_nontype_arg_conv): Likewise.
2169 (build_conditional_expr_1): Likewise.
2170 (convert_like_real): Likewise.
2171 (convert_arg_to_ellipsis): Likewise.
2173 (initialize_reference): Likewise.
2174 * cvt.c (cp_convert_to_pointer): Likewise.
2175 (cp_convert_to_pointer): Likewise.
2176 (convert_to_reference): Likewise.
2177 (ocp_convert): Likewise.
2178 * error.c (cp_printer): Gain bool and const char ** parameters.
2179 (struct deferred_printed_type): New struct.
2180 (class cxx_format_postprocessor): New class.
2181 (cxx_initialize_diagnostics): Wire up a cxx_format_postprocessor
2182 to pp->m_format_postprocessor.
2183 (comparable_template_types_p): New function.
2184 (newline_and_indent): New function.
2185 (arg_to_string): New function.
2186 (print_nonequal_arg): New function.
2187 (print_template_differences): New function.
2188 (type_to_string_with_compare): New function.
2189 (print_template_tree_comparison): New function.
2190 (append_formatted_chunk): New function.
2191 (add_quotes): New function.
2192 (cxx_format_postprocessor::handle): New function.
2193 (defer_phase_2_of_type_diff): New function.
2194 (cp_printer): Add "quoted" and "buffer_ptr" params. Implement
2196 * typeck.c (cp_build_binary_op): Replace pairs of %qT with
2197 %qH and %qI in various places.
2198 (convert_member_func_to_ptr): Likewise.
2199 (build_reinterpret_cast_1): Likewise.
2200 (convert_for_assignment): Likewise.
2201 * typeck2.c (check_narrowing): Likewise.
2203 2017-05-30 Nathan Sidwell <nathan@acm.org>
2205 Kill IDENTIFIER_NAMESPACE_BINDINGS
2206 * cp-tree.h (lang_identifier): Delete namespace_bindings.
2207 (IDENTIFIER_NAMESPACE_BINDINGS): Delete.
2208 (lang_decl_ns): Add bindings.
2209 (DECL_NAMESPACE_BINDINGS): New.
2210 * lex.c (retrofit_lang_decl): Create namespace hash table.
2211 * name-lookup.c (find_namespace_slot): Change to use hash-map.
2212 * ptree.c (cxx_print_binding): Delete.
2213 (cxx_print_identifier): Remove NAMESPACE_BINDING printing.
2215 * cp-tree.def (OVERLOAD): Fix comment.
2216 * cp-tree.h: Fix comments and whitespace.
2217 * error.c (dump_decl): Use pp_cxx_colon_colon, ovl_scope.
2218 * name-lookup.c (add_decl_to_level): Assert not class.
2219 (check_local_shadow): Use OVL_P.
2220 (pushdecl_with_scope_1): Rename to ...
2221 (do_pushdecl_with_Scope): ... here.
2222 (do_nonmember_using_decl): Use qualified_namespace_lookup return
2224 (push_class_level_binding_1): Use OVL_P.
2225 (pushdecl_namespace_level): Use do_pushdecl_with_scope.
2226 (pushtag_1): Rename to ...
2227 (do_pushtag): ... here. Adjust do_pushdecl_with_scope call.
2229 (store_class_bindings): Do not time here.
2230 * name-lookup.h (pushdecl_outermost_localscope): Reorder.
2231 * pt.c (listify): Declare argvec at point of initialization.
2234 * name-lookup.c (add_decl_to_level): Assert not making a circular
2236 (update_binding): Don't prematurely slide artificial decl.
2238 2017-05-29 Alexandre Oliva <aoliva@redhat.com>
2240 * cp-tree.h (lang_identifier): Drop oracle_looked_up, unused.
2242 2017-05-29 Nathan Sidwell <nathan@acm.org>
2244 PR c++/80891 (#1,#5)
2245 * cp-tree.h (lookup_maybe_add): Add DEDUPING argument.
2246 * name-lookup.c (name_lookup): Add deduping field.
2247 (name_lookup::preserve_state, name_lookup::restore_state): Deal
2249 (name_lookup::add_overload): New.
2250 (name_lookup::add_value, name_lookup::add_fns): Call add_overload.
2251 (name_lookup::search_adl): Set deduping. Don't unmark here.
2252 * pt.c (most_specialized_instantiation): Revert previous change,
2253 Assert not given duplicates.
2254 * tree.c (lookup_mark): Just mark the underlying decls.
2255 (lookup_maybe_add): Dedup using marked decls.
2258 * ptree.c (cxx_print_xnode): Show internal OVERLOAD structure.
2259 * tree.c (ovl_insert, ovl_iterator_remove_node): Fix copying assert.
2261 Stat hack representation
2262 * name-lookup.c (STAT_HACK_P, STAT_TYPE, STAT_DECL,
2263 MAYBE_STAT_DECL, MAYBE_STAT_TYPE): New.
2265 (find_namespace_binding): Replace with ...
2266 (find_namespace_slot): ... this.
2267 (find_namespace_value): New.
2268 (name_lookup::search_namespace_only,
2269 name_lookup::adl_namespace_only): Adjust.
2270 (update_binding): Add SLOT parameter, adjust.
2271 (check_local_shadow): Use find_namespace_value.
2272 (set_local_extern_decl_linkage): Likewise.
2273 (do_pushdecl): Adjust for namespace slot.
2274 (push_local_binding): Assert not a namespace binding.
2275 (check_for_out_of_scope_variable): Use find_namespace_value.
2276 (set_identifier_type_value_with_scope): Likewise.
2277 (get_namespace_binding): Likewise.
2278 (set_namespace_binding): Delete.
2279 (set_global_binding): Directly update the binding.
2280 (finish_namespace_using_decl): Likewise.
2281 (lookup_type_scope_1): Use find_namespace_slot and update.
2282 (do_push_nested_namespace): Use find_namespace_value.
2285 * pt.c (most_specialized_instantiation): Cope with duplicate
2289 * cp-tree.h (build_min_nt_call_vec): Declare.
2290 * decl.c (build_offset_ref_call_from_tree): Call it.
2291 * parser.c (cp_parser_postfix_expression): Likewise.
2292 * pt.c (tsubst_copy_and_build): Likewise.
2293 * semantics.c (finish_call_expr): Likewise.
2294 * tree.c (build_min_nt_loc): Keep unresolved lookups.
2295 (build_min): Likewise.
2296 (build_min_non_dep): Likewise.
2297 (build_min_non_dep_call_vec): Likewise.
2298 (build_min_nt_call_vec): New.
2301 * tree.c (ovl_copy): Adjust assert, copy OVL_LOOKUP.
2303 (lookup_keep): Call it.
2305 2017-05-26 Nathan Sidwell <nathan@acm.org>
2308 * name-lookup.c (push_inline_namespaces): New.
2309 (push_namespace): Look inside inline namespaces.
2311 Inline and using namespace representation change.
2312 * cp-tree.h (struct lang_decl_ns): Delete ns_using. Add usings,
2314 (DECL_NAMESPACE_USING): Adjust.
2315 (DECL_NAMESPACE_INLINEES): New.
2316 * name-lookup.h (struct cp_binding_level): Change usings
2318 * name-lookup.c (name_lookup::do_queue_usings,
2319 name_lookup::queue_usings): Adjust.
2320 (name_lookup::search_namespace, name_lookup::search_usings,
2321 name_lookup::queue_namespace): Adjust.
2322 (name_lookup::adl_namespace_only): Adjust.
2323 (add_using_namespace, push_namespace): Push onto vector.
2324 (pop_namespace): Add timing logic.
2326 * call.c (build_operator_new_call): Do namelookup and ADL here.
2327 (build_new_op_1): Likewise.
2328 * name-lookup.h (lookup_function_nonclass): Delete declaration.
2329 (do_using_directive): Likewise.
2330 * name-lookup.c (set_namespace_binding, push_local_binding): Don't
2332 (struct scope_binding): Delete.
2333 (EMPTY_SCOPE_BINDING): Delete.
2334 (set_decl_namespace): Use OVL_P.
2335 (finish_local_using_decl): Lose unnecesary checks.
2336 (lookup_function_nonclass): Delete.
2337 (cp_emit_debug_info_for_using): Use MAYBE_BASELINK_P.
2339 * cp-tree.h (OVL_CHAIN): Check looking at OVERLOAD.
2340 (ovl_iterator): Add allow_inner field. Adjust ctor. Make
2342 (ovl_iterator::maybe_push, ovl_iterator::pop): New.
2343 (lkp_iterator): Add outer field. Adjust ctor.
2344 (lkp_iterator::operator++): New.
2345 (lookup_mark, lookup_maybe_add): Declare.
2346 * name-lookup.c (name_lookup): Delete fn_set member.
2347 (name_lookup::preserve_state, name_lookup::restore_state): Unmark
2349 (name_lookup::add_value): Use lookup_add directly.
2350 (name_lookup::add_fns: Use lookup_maybe_add.
2351 (name_lookup::search_adl): Mark and unmark fns.
2353 * pt.c (check_explicit_specialization): Use lookup_add directly.
2354 * ptree.c (cxx_print_xnode): Show complete overload structure.
2355 * tree.c (lookup_mark, lookup_maybe_add): New.
2357 * name-lookup.c (name_lookup::search_adl): ADL OMP UDR type args.
2359 2017-05-26 Jakub Jelinek <jakub@redhat.com>
2361 * cp-tree.h (struct lang_decl_decomp): New type.
2362 (struct lang_decl): Add u.decomp.
2363 (LANG_DECL_DECOMP_CHECK): Define.
2364 (DECL_DECOMPOSITION_P): Note it is set also on the vars
2365 for user identifiers.
2366 (DECL_DECOMP_BASE): Define.
2367 (retrofit_lang_decl): Add extra int = 0 argument.
2368 * lex.c (retrofit_lang_decl): Add SEL argument, if non-zero
2369 use it to influence the selector choices and for selector
2370 0 to non-zero transition copy old content.
2371 (cxx_dup_lang_specific_decl): Handle DECL_DECOMPOSITION_P.
2372 * decl.c (poplevel): For DECL_DECOMPOSITION_P, check
2373 !DECL_DECOMP_BASE instead of !DECL_VALUE_EXPR. Adjust warning
2374 wording if decl is a structured binding.
2375 (cp_finish_decomp): Pass 4 as the new argument to retrofit_lang_decl.
2376 Set DECL_DECOMP_BASE. Ignore DECL_READ_P sets from initialization
2377 of individual variables for tuple structured bindings.
2378 (grokdeclarator): Pass 4 as the new argument to retrofit_lang_decl.
2379 Clear DECL_DECOMP_BASE.
2380 * decl2.c (mark_used): Mark DECL_DECOMP_BASE TREE_USED as well.
2381 * pt.c (tsubst_decomp_names): Assert DECL_DECOMP_BASE matches what
2383 * expr.c (mark_exp_read): Recurse on DECL_DECOMP_BASE instead of
2386 2017-05-25 Jason Merrill <jason@redhat.com>
2388 PR c++/80605 - __is_standard_layout and zero-length array
2389 * class.c (check_bases): Use DECL_FIELD_IS_BASE.
2391 2017-05-25 Nathan Sidwell <nathan@acm.org>
2393 Kill OVL_CURRENT, OVL_NEXT.
2394 * cp-tree.h (OVL_CURRENT, OVL_NEXT): Delete.
2395 * name-lookup.c (set_decl_namespace): Use ovl_iterator.
2396 (consider_binding_level): Use OVL_FIRST.
2397 (cp_emit_debug_info_for_using): Use lkp_iterator.
2398 * pt.c (check_explicit_specialization): Use ovl_iterator.
2400 Kill DECL_NAMESPACE_USERS, DECL_NAMESPACE_ASSOCIATIONS.
2401 * cp-tree.h (lang_decl_ns): Remove ns_users field.
2402 (DECL_NAMESPACE_USERS, DECL_NAMESPACE_ASSOCIATIONS): Delete.
2403 (TREE_INDIRECT_USING): Delete.
2404 * name-lookup.h (is_associated_namespace): Delete.
2405 * name-lookup.c (name_lookup::search_usings,
2406 name_lookup::do_queue_usings): Usings are always direct.
2407 (is_associated_namespace): Delete.
2408 (handle_namespace_attrs): Use DECL_NAMESPACE_INLINE_P.
2409 (namespace_ancestor_1, namespace_ancestor): Delete.
2410 (push_using_directive_1, push_using_directive): Delete.
2411 (add_using_namespace_1): Delete.
2412 (add_using_namespace): Reimplement.
2413 (emit_debug_info_using_namespace): New.
2414 (finish_namespace_using_directive, finish_local_using_directive,
2415 push_namespace): Adjust.
2416 * tree.c (cp_free_lang_data): Remove DECL_NAMESPACE_USERS handling.
2418 2017-05-25 Volker Reichelt <v.reichelt@netcologne.de>
2420 * semantics.c (finish_handler_parms): Warn about non-reference type
2423 2017-05-25 Nathan Sidwell <nathan@acm.org>
2425 Reimplement unqualified namespace lookup.
2426 * name-lookup.c (name_lookup::using_pair,
2427 name_lookup::using_queue): New typedefs.
2428 (name_lookup::queue_namespace, name_lookup::do_queue_usings,
2429 name_lookup::queue_usings): New.
2430 (name_lookup::search_unqualified): New.
2431 (merge_functions, same_entity_p, ambiguous_decl,
2432 unqualified_namespace_lookup_1, unqualified_namespace_lookup,
2433 lookup_using_namespace): Delete.
2434 (lookup_name_real_1): Adjust.
2436 Reimplement qualified namespace lookup.
2437 * name-lookup.c (name_lookup::flags): New member. Adjust ctor.
2438 (name_lookup::ambiguous, name_lookup::add_value,
2439 name_lookup::add_type, name_lookup::process_binding): New.
2440 (name_lookup::search_namespace_only,
2441 name_lookup::search_namespace, name_lookup::search_usings): New.
2442 (name_lookup::search_qualified): New.
2443 (do_nonmember_using_decl, suggest_alternatives_for,
2444 lookup_qualified_name): Adjust.
2445 (tree_vec_contains): Delete.
2446 (qualified_lookup_using_namespace): Rename to ...
2447 (qualified_namespace_lookup): ... here. Reimplement.
2450 * cp-tree.h (LOOKUP_SEEN_P, LOOKUP_FOUND_P): New.
2451 * name-lookup.h (lookup_arg_dependent): Return plain tree.
2452 * name-lookup.c (arg_lookup, arg_assoc, arg_assoc_args,
2453 arg_assoc_args_vec, arg_assoc_type, add_function,
2454 arg_assoc_namespace, arg_assoc_class_only, arg_assoc_bases,
2455 arg_assoc_class, arg_assoc_template_arg, arg_assoc,
2456 lookup_arg_dependent_1): Delete.
2457 (name_lookup): New lookup object.
2458 (name_lookup::preserve_state, name_lookup::restore_state,
2459 name_lookup::mark_seen, name_lookup::find_and_mark,
2460 name_lookup::add_fns, name_lookup::adl_namespace_only,
2461 name_lookup::adl_namespace, name_lookup::adl_class_only,
2462 name_lookup::adl_bases, name_lookup::adl_class,
2463 name_lookup::adl_expr, name_lookup::adl_type,
2464 name_lookup::adl_template_arg, name_lookup::search_adl): New.
2465 (lookup_arg_dependent): Return a plain tree. Adjust.
2466 (is_associated_namespace): Move later.
2468 2017-05-24 Nathan Sidwell <nathan@acm.org>
2470 * friend.c (do_friend): Remove check for existing decl.
2471 * name-lookup.h (lookup_name_innermost_nonclass_level): Delete.
2472 * name-lookup.c (push_local_binding): Directly look for binding.
2473 (lookup_name_innermost_nonclass_level_1): Delete.
2474 (lookup_name_innermost_nonclass_level): Delete.
2476 * Make-lang.in (CXX_AND_OBJCXX_OBJS): Alphabetize.
2478 * cp-tree.h (cp_free_lang_data): Add extern.
2479 (ovl_skip_hidden, is_overloaded_fn, really_overloaded_fn): Add
2481 (type_unknown_p): Return bool, make inline, lose TREE_LIST check.
2482 * typeck.c (type_unknown_p): Delete.
2483 * tree.c (is_overloaded_fn): Use MAYBE_BASELINE_FUNCTIONS, adjust
2484 overload management.
2485 (dependent_name): Likewise.
2486 (decl_anon_ns_mem_p): Simplify.
2488 2017-05-24 Jonathan Wakely <jwakely@redhat.com>
2491 * tree.c (reshape_init): Use unqualified type for direct enum init.
2492 * typeck.c (maybe_warn_about_cast_ignoring_quals): New.
2493 (build_static_cast_1, build_reinterpret_cast_1): Strip cv-quals from
2494 non-class destination types.
2495 (build_const_cast_1): Strip cv-quals from destination types.
2496 (build_static_cast, build_reinterpret_cast, build_const_cast)
2497 (cp_build_c_cast): Add calls to maybe_warn_about_cast_ignoring_quals.
2499 2017-05-24 Martin Sebor <msebor@redhat.com>
2502 * call.c (fully_fold_internal): Adjust.
2504 2017-05-24 Nathan Sidwell <nathan@acm.org>
2506 * cp-tree.h (ovl_skip_hidden): Declare.
2507 * tree.c (ovl_skip_hidden): New.
2508 * name-lookup.c (arg_assoc_namespace): Call ovl_skip_hidden.
2509 (lookup_arg_dependent_1): Likewise.
2510 (ambiguous_decl): Use DECL_HIDDEN_P, ovl_skip_hidden.
2511 (hidden_name_p, remove_hidden_names): Delete.
2512 (lookup_name_real_1): Do not strip hidden names.
2513 * name-lookup.h (hidden_name_p, remove_hidden_names): Delete.
2515 * cp-tree.h (OVL_HIDDEN_P): New.
2516 (ovl_iterator::hidden_p, ovl_iterator::reveal_node): New.
2517 (ovl_iterator::reveal_node): Declare.
2518 * tree.c (ovl_copy): Copy OVL_HIDDEN_P.
2519 (ovl_insert): Order on hiddenness.
2520 (ovl_iterator::reveal_node): New.
2521 * name-lookup.c (anticipated_builtin_p): New.
2522 (supplement_binding_1): Use it.
2523 (set_local_extern_decl_linkage): Use hidden_p.
2524 (do_pushdecl): Deal with unhiding a hidden decl, use
2525 anticipated_builtin_p.
2526 (do_nonmember_using_decl): Use anticipated_decl_p.
2527 (lookup_name_real_1): Use DECL_HIDDEN_P.
2529 2017-05-23 Jason Merrill <jason@redhat.com>
2531 -Wunused and C++17 structured bindings
2532 * decl.c (poplevel): Don't warn about unused structured bindings,
2533 only real variables.
2534 * error.c (dump_simple_decl): Handle structured bindings.
2535 * expr.c (mark_exp_read): Look through DECL_VALUE_EXPR.
2537 2017-05-23 Nathan Sidwell <nathan@acm.org>
2539 * cp-tree.h (PUSH_GLOBAL, PUSH_LOCAL, PUSH_USING): Delete.
2540 * name-lookup.c (create_local_binding): New.
2541 (update_binding): New.
2542 (pushdecl_maybe_friend_1): Rename to ...
2543 (do_pushdecl): ... this. Reimplement.
2545 (push_overloaded_decl_1, push_overloaded_decl): Delete.
2547 2017-05-23 Jason Merrill <jason@redhat.com>
2549 PR c++/80396 - built-in for make_integer_sequence.
2550 * pt.c (builtin_pack_fn_p, builtin_pack_call_p)
2551 (expand_integer_pack, expand_builtin_pack_call): New.
2552 (find_parameter_packs_r): Check builtin_pack_call_p.
2553 (check_for_bare_parameter_packs): Handle it.
2554 (tsubst_pack_expansion): Call expand_builtin_pack_call.
2555 (declare_integer_pack): New.
2556 (init_template_processing): Call it.
2557 * decl2.c (mark_used): Check builtin_pack_fn_p.
2559 2017-05-23 Nathan Sidwell <nathan@acm.org>
2561 * name-lookup.c (find_namespace_binding): New.
2562 (pushdecl_maybe_friend_1): Use CP_DECL_CONTEXT.
2563 (set_identifier_type_value_with_scope): Use find_namespace_binding.
2564 (find_binding, cp_binding_level_find_binding_for_name,
2565 binding_for_name, namespace_binding_1): Delete.
2566 (push_overloaded_decl_1): Use CP_DECL_CONTEXT.
2567 (get_namespace_binding, set_namespace_binding,
2568 finish_namespace_using_decl, unqualified_namespace_lookup_1,
2569 qualified_lookup_using_namespace, lookup_type_scope_1,
2570 lookup_name_innermost_nonclass_level_1): Use find_namespace_binding.
2573 * parser.c (cp_parser_template_id): Keep the lookup when stashing
2576 * cp-tree.h (DECL_HIDDEN_P): New.
2577 * name-lookup.c (set_decl_context,
2578 set_local_extern_decl_linkage): New, broken out of ...
2579 (pushdecl_maybe_friend_1): ... here. Call them.
2581 2017-05-23 Thomas Schwinge <thomas@codesourcery.com>
2583 * parser.c (OACC_KERNELS_CLAUSE_MASK): Add
2584 "PRAGMA_OACC_CLAUSE_NUM_GANGS", "PRAGMA_OACC_CLAUSE_NUM_WORKERS",
2587 2017-05-23 Nathan Sidwell <nathan@acm.org>
2589 * cp-tree.h (OVL_P): New.
2590 * name-lookup.h (push_local_binding): Delete.
2591 (do_toplevel_using_decl, do_local_using_decl): Rename to ...
2592 (finish_namespace_using_decl, finish_local_using_decl): ... here
2593 * name-lookup.c (add_decl_to_level): Swap args.
2594 (pop_bindings_and_leave_scope): Look inside TREE_LIST.
2595 (diagnose_name_conflict): Check contexts are same for redecl.
2596 (update_local_overload): New.
2597 (compparms_for_decl_and_using): Rename to ...
2598 (matching_fn_p): ... here.
2599 (pushdecl_maybe_friend_1): Adjust add_decl_to_level,
2600 push_local_bindings call.
2601 (push_local_binding): Make static, replace FLAGS arg with
2603 (validate_nonmember_using_decl): Use OVL_FIRST.
2604 (do_nonmember_using_decl): Use in/out parameters. Use
2605 lkp_iterator and simplify.
2606 (do_toplevel_using_decl, do_local_using_decl): Rename to ...
2607 (finish_namespace_using_decl, finish_local_using_decl): ... here.
2609 (lookup_type_current_level): Delete.
2610 * parser.c (cp_parser_using_declaration): Adjust.
2611 * pt.c (tsubst_expr): Adjust.
2613 2017-05-22 Nathan Sidwell <nathan@acm.org>
2615 * name-lookup.h (parse_using_directive): Replace with ...
2616 (finish_namespace_using_directive): ... this and ...
2617 (finish_local_using_directive): ... this.
2618 * name-lookup.c (add_using_namespace_1): Move later.
2619 (add_using_namespace): Move later, add namespace_p arg, remove
2621 (push_using_directive_1): Directly recurse.
2622 (do_using_directive, parse_using_directive): Delete, split into ...
2623 (finish_namespace_using_directive): ... this and ...
2624 (finish_local_using_directive): ... this.
2625 (push_namespace): Use add_using_namespace.
2626 * parser.c (cp_parser_using_directive): Call
2627 finish_namespace_using_directive or finish_local_using_directive.
2628 * pt.c (tsubst_expr): Call finish_local_using_directive.
2630 * cp-objcp-common.c (cp_register_dumps): Register raw dumper.
2631 * cp-tree.h (raw_dump_id): Declare.
2632 * decl2.c (raw_dump_id): Define.
2633 (dump_tu): Use raw_dump_id.
2635 * config-lang.in (gtfiles): Sort list, break lines.
2637 * cp-tree.h (CPTI_TERMINATE, CPTI_CALL_UNEXPECTED): Rename to ...
2638 (CPTI_TERMINATE_FN, CPTI_CALL_UNEXPECTED_FN): ... here.
2639 ( CPTI_GET_EXCEPTION_PTR_FN, CPTI_BEGIN_CATCH_FN, CPTI_END_CATCH_FN,
2640 CPTI_ALLOCATE_EXCEPTION_FN, CPTI_FREE_EXCEPTION_FN, CPTI_THROW_FN,
2641 CPTI_RETHROW_FN): New.
2642 (noexcept_deferred_spec): New.
2643 (terminate_node, call_unexpected_node): Rename to ...
2644 (terminate_fn, call_unexpected_fn): ... here.
2645 (get_exception_ptr_fn, begin_catch_fn, end_catch_fn,
2646 allocate_exception_fn, free_exception_fn, throw_fn, rethrow_fn): New.
2647 * except.c (fn1..fn5, throw_fn, rethrow_rn, spec): Delete.
2648 (init_exception_processing): Adjust.
2649 (declare_library_fn): Create and push the fns here.
2650 (do_get_exception_ptr, do_begin_catch, do_end_catch,
2651 do_allocate_exception_ptr, do_free_exception_ptr): Adjust
2652 declare_library_fn use.
2653 (unevaluated_noexcept_spec): Adjust.
2654 * cp-gimplify.c (genericize_eh_spec_block,
2655 gimplify_most_not_throw_expr): Adjust.
2657 * name-lookup.c (pushdecl_top_level,
2658 pushdecl_top_level_and_finish): Move after namespace pushing and
2660 (push_to_top_level): Rename to ...
2661 (do_push_to_top_level): ... here. Remove timing code.
2662 (pop_from_top_level_1): Rename to ...
2663 (do_pop_from_top_level): ... here.
2664 (do_push_nested_namespace, do_pop_nested_namespace)
2665 (push_to_top_level): New wrapper for do_push_to_top_level.
2666 (pop_from_top_level): Adjust.
2667 (push_nested_namepace, pop_nested_namespace): Wrappers for workers.
2669 2017-05-19 Bernd Edlinger <bernd.edlinger@hotmail.de>
2671 * config-lang.in (gtfiles): Add c-family/c-format.c,
2672 except.c, init.c, lambda.c and friend.c.
2673 * class.c (dvirt_fn): Move out of function scope,
2675 * except.c (fn1-5, throw_fn, rethrow_fn, spec): Likewise.
2676 * init.c (fn): Likewise.
2677 * lambda.c (ptr_id, max_id): Likewise.
2678 * friend.c (global_friend): Add GTY attribute.
2680 2017-05-19 Nathan Sidwell <nathan@acm.org>
2682 * call.c (add_list_candidates): Use OVL_FIRST.
2683 (build_new_method_call_1): Likewise.
2684 * cp-tree.h (OVL_SINGLE_P): New.
2685 (TYPE_HIDDEN_P): New.
2686 * decl.c (xref_tag_1): Use TYPE_HIDDEN_P.
2687 * dump.c (cp_tump_tree): Adjust overload dumping.
2688 * error.c (dump_decl): Use OVL_SINGLE_P, simplify context
2690 * method.c (lazily_declare_fn): Assert we added it.
2691 * parser.c (cp_parser_nested_name_specifier): Use OVL_SINGLE_P,
2693 (cp_parser_template_name): Use lkp_iterator.
2694 * pt.c (begin_template_parm_list): Fixup comment.
2695 (instantiate_class_template_1): Use TYPE_HIDDEN_P.
2696 * tree.c (ovl_iterator::remove_node): Cope with inherited ctors.
2697 (ovl_scope): Use lkp_iterator.
2699 2017-05-19 Thomas Schwinge <thomas@codesourcery.com>
2701 * parser.c (cp_parser_omp_clause_default): Handle
2702 "OMP_CLAUSE_DEFAULT_PRESENT".
2704 * parser.c (cp_parser_omp_clause_default): Avoid printing more
2705 than one syntax error message.
2707 2017-05-19 Nathan Sidwell <nathan@acm.org>
2709 * class.c (class_dump_id): Define.
2710 (dump_class_hierarchy, dump_vtable, dump_vtt): Use it.
2711 * cp-objcp-common.c (cp_register_dumps): New.
2712 * cp-objcp-common.h (cp_register_dumps): Declare.
2713 (LANG_HOOKS_REGISTER_DUMPS): Override.
2714 * cp-tree.h (class_dump_id): Declare.
2716 2017-05-18 Nathan Sidwell <nathan@acm.org>
2718 * cp-tree.h (OVL_ARG_DEPENDENT): Delete.
2720 (lookup_keep): Declare.
2721 * name-lookup.c (add_function): Don't set OVL_ARG_DEPENDENT.
2722 * pt.c (tsubst_copy): Assert lookup is persistent.
2723 * semantics.c (finish_call_expr): Use lkp_iterator, call
2725 * tree.c (ovl_copy): New.
2726 (ovl_insert, ovl_iterator::remove_node): Copy immutable nodes.
2729 * cp-tree.h (OVL_USED): Replace with ...
2730 (OVL_USING_P): ... this.
2731 (ovl_iterator::using_p): Adjust.
2732 * name-lookup.c (push_overloaded_decl_1,
2733 do_nonmember_using_decl): Adjust.
2734 * search.c (lookup_field_r): Adjust.
2735 * tree.c (ovl_insert, ovl_scope): Adjust.
2737 * cp-tree.h (lookup_add): Swap args.
2738 (ovl_cons, build_overload): Delete.
2739 * name-lookup.c (add_function, push_overloaded_decl_1,
2740 do_nonmember_using_decl, merge_functions, remove_hidden_names):
2741 Use lookup_add, ovl_insert.
2742 * pt.c (check_explicit_specialization): Use lookup_add.
2743 (do_class_deduction): Likewise. Refactor if.
2744 * tree.c (lookup_add): Swap args.
2745 (ovl_cons, build_overload): Delete.
2747 * name-lookup.c (find_local_binding): New, broken out of ...
2748 (lookup_name_innermost_nonclass_level_1): ... here. Call it.
2749 (set_namespace_binding): Swap scope & name args.
2750 (namespace_binding_1): Likewise.
2751 (pushdecl_maybe_friend_1): Adjust set_namespace_binding call.
2752 (push_overloaded_decl_1): Likewise.
2753 (set_global_binding): Likewise.
2754 (get_namespace_binding): Adjust namespace_binding_1 call.
2756 2017-05-17 Nathan Sidwell <nathan@acm.org>
2758 * cp-tree.h (default_hash_traits <lang_identifier *>): New
2760 * name-lookup.c (lookup_extern_c_fun_in_all_ns): Delete.
2761 (extern_c_fns): New hash table.
2762 (check_extern_c_conflict): New, broken out of ...
2763 (pushdecl_maybe_friend_1): ... here. Call it.
2764 (c_linkage_bindings): Just look in hash table.
2766 2017-05-17 Ville Voutilainen <ville.voutilainen@gmail.com>
2770 Implement new C++ intrinsics __is_assignable and __is_constructible.
2771 * cp-tree.h (CPTK_IS_ASSIGNABLE, CPTK_IS_CONSTRUCTIBLE): New.
2773 * cxx-pretty-print.c (pp_cxx_trait_expression): Handle
2774 CPTK_IS_ASSIGNABLE and CPTK_IS_CONSTRUCTIBLE.
2775 * method.c (constructible_expr): Set cp_unevaluated.
2776 (is_xible_helper): New.
2777 (is_trivially_xible): Adjust.
2779 * parser.c (cp_parser_primary_expression): Handle
2780 RID_IS_ASSIGNABLE and RID_IS_CONSTRUCTIBLE.
2781 (cp_parser_trait_expr): Likewise.
2782 * semantics.c (trait_expr_value): Handle
2783 CPTK_IS_ASSIGNABLE and CPTK_IS_CONSTRUCTIBLE.
2785 2017-05-17 Nathan Sidwell <nathan@acm.org>
2787 * cp-tree.h (ovl_iterator::using_p): New predicate.
2788 (ovl_iterator::remove_node): New worker.
2789 (ovl_insert): Declare.
2790 * tree.c (ovl_insert): New.
2791 (ovl_iterator::remove_node): New.
2792 * class.c (add_method): Use ovl_iterator, ovl_insert.
2793 (clone_function_decl): Fix description.
2794 (clone_constructors_and_destructors): Use ovl_iterator.
2796 * class.c (handle_using_decl): Use OVL_FIRST, ovl_iterator.
2797 (maybe_warn_about_overly_private_class): Use ovl_iterator.
2798 (method_name_cmp, resort_method_name_cmp): Use OVL_NAME.
2799 (resort_type_method_vec, finish_struct_methods): Use OVL_FIRST.
2800 (get_base_fndecls): Use ovl_iterator.
2801 (warn_hidden): Use OVL_NAME, ovl_iterator.
2802 (add_implicitly_declared_members): Use ovl_iterator.
2803 * constraint.cc (normalize_template_id_expression): Use OVL_FIRST,
2805 (finish_shorthand_constraint): Simplify, use ovl_make.
2806 * pt.c (make_constrained_auto): Simplify. Use ovl_make.
2807 * search.c (shared_member_p): Use ovl_iterator.
2808 (lookup_field_fuzzy_info::fuzzy_lookup_fn): Use OVL_NAME.
2809 (lookup_conversion_operator): Use OVL_FIRST.
2810 (lookup_fnfiels_idx_nolazy): Use OVL_FIRST, OVL_NAME.
2811 (look_for_overrides_here): Use ovl_iterator.
2812 (lookup_conversions_r): Use OVL_FIRST, OVL_NAME, ovl_iterator.
2813 * typeck.c (build_x_unary_op): Use ovl_make.
2815 2017-05-17 Martin Liska <mliska@suse.cz>
2817 * class.c (dump_class_hierarchy): Introduce dump_flags_t type and
2818 use it instead of int type.
2819 (dump_vtable): Likewise.
2820 (dump_vtt): Likewise.
2821 * decl2.c (dump_tu): Likewise.
2823 2017-05-16 David Malcolm <dmalcolm@redhat.com>
2825 * call.c (enforce_access): Add access_failure_info * param and use
2826 it to record access failures.
2827 * cp-tree.h (class access_failure_info): New class.
2828 (enforce_access): Add access_failure_info * param, defaulting to
2830 (lookup_member): Likewise.
2831 (locate_field_accessor): New function decl.
2832 (perform_or_defer_access_check): Add access_failure_info * param,
2834 * search.c (lookup_member): Add access_failure_info * param and
2835 pass it on to call to perform_or_defer_access_check.
2836 (matches_code_and_type_p): New function.
2837 (field_access_p): New function.
2838 (direct_accessor_p): New function.
2839 (reference_accessor_p): New function.
2840 (field_accessor_p): New function.
2841 (struct locate_field_data): New struct.
2842 (dfs_locate_field_accessor_pre): New function.
2843 (locate_field_accessor): New function.
2844 * semantics.c (perform_or_defer_access_check): Add
2845 access_failure_info * param, and pass it on to call to
2847 * typeck.c (access_failure_info::record_access_failure): New method.
2848 (access_failure_info::maybe_suggest_accessor): New method.
2849 (finish_class_member_access_expr): Pass an access_failure_info
2850 instance to the lookup_member call, and call its
2851 maybe_suggest_accessor method afterwards.
2853 2017-05-16 Marek Polacek <polacek@redhat.com>
2857 * cp-gimplify.c (cp_fold): Handle SAVE_EXPR.
2859 2017-05-16 Nathan Sidwell <nathan@acm.org>
2861 * name-lookup.c (check_local_shadow): New, broke out of ...
2862 (pushdecl_maybe_friend_1): ... here. Call it.
2864 * cp-tree.h (OVL_NESTED_P, OVL_LOOKUP_P): New.
2865 (ovl_first): Move inline definition to end of file.
2866 (ovl_make, lookup_add): Declare.
2867 (get_fns, get_first_fn): Make pure.
2868 * tree.c (ovl_cache): New.
2869 (ovl_make, lookup_add): New.
2870 * pt.c (do_class_deduction): Don't add candidates that will be
2873 * call.c (build_user_type_conversion_1): Use OVL_FIRST.
2874 (print_error_for_call_failure): Use OVL_NAME.
2875 (build_op_call_1): Use ovl_iterator.
2876 (add_candidates): Use OVL_FIRST & lkp_iterator.
2877 (build_op_delete_call): Use MAYBE_BASELINK_FUNCTIONS &
2879 * class.c (deduce_noexcept_on_destructors): Use ovl_iterator.
2880 (type_has_user_nondefault_constructor,
2881 in_class_defaulted_default_constructor,
2882 type_has_user_provided_constructor,
2883 type_has_user_provided_or_explicit_constructor,
2884 type_has_non_user_provided_default_constructor,
2885 vbase_has_user_provided_move_assign,
2886 type_has_move_constructor, type_has_move_assign,
2887 type_has_user_declared_move_constructor,
2888 type_has_user_declared_move_assign,
2889 type_build_ctor_call, type_build_dtor_call,
2890 type_requires_array_cookie, explain_non_literal_class): Likewise.
2891 (finish_struct): Use lkp_iterator.
2892 (resolve_address_of_overloaded_function): Use OVL_NAME, lkp_iterator.
2893 (note_name_declared_in_class): Use OVL_NAME.
2894 * cxx-pretty-print.c (pp_cxx_unqualified_id): Use OVL_FIRST.
2895 (pp_cxx_qualified_id, cxx_pretty_printer::id_expression,
2896 cxx_pretty_printer::expression): Likewise.
2897 * decl2.c (check_classfn): Use ovl_iterator.
2898 * pt.c (retrieve_specialization): Use ovl_iterator.
2899 * tree.c (cp_tree_equal): Use lkp_iterator.
2900 (type_has_nontrivial_copy_init): Use ovl_iterator.
2902 * typeck2.c (cxx_incomplete_type_diagnostic): Revert change and
2903 check is_overloaded_fn.
2905 2017-05-16 Martin Liska <mliska@suse.cz>
2907 * parser.c (cp_lexer_print_token): Add default value for flags
2908 argument of print_gimple_stmt, print_gimple_expr,
2909 print_generic_stmt and print_generic_expr.
2911 2017-05-16 Nathan Sidwell <nathan@acm.org>
2913 * cp-tree.h (class ovl_iterator, class lkp_iterator): New OVERLOAD
2915 (MAYBE_BASELINK_FUNCTIONS): New.
2916 * constraint.cc (resolve_constraint_check): Use lkp_iterator.
2917 * decl2.c (maybe_warn_sized_delete): Use ovl_iterator.
2918 * lambda.c (maybe_generic_this_capture): Use lkp_iterator.
2919 * method.c (inherited_ctor_binfo): Use ovl_iterator.
2920 (binfo_inherited_from): Likewise.
2921 * parser.c (lookup_literal_operator): Use lkp_iterator.
2922 * pt.c (iterative_hash_template_arg): Use lkp_iterator.
2923 (print_candidates_1): Likewise.
2924 (determine_specialization): Likewise.
2925 (resolve_overloaded_unification): Likewise.
2926 (resolve_nondeduced_context): Likewise.
2927 (type_dependent_expression_p): Likewise.
2928 (dependent_template_p): Likewise.
2929 * ptree.c (cxx_print_xnode): Likewise.
2930 * semantics.c (omp_reduction_lookup): Use lkp_iterator.
2931 (classtype_has_nothrow_assign_or_copy_p): Use ovl_iterator.
2932 * typeck.c (check_template_keyword): Use lkp_iterator.
2934 * cp-tree.h (OVL_FIRST, OVL_NAME): New.
2936 * constexpr.c (function_concept_check): Use OVL_FIRST.
2937 * cvt.c (build_expr_type_conversion): Likewise.
2938 * decl.c (poplevel, grokdeclarator): Use OVL_NAME.
2939 * decl2.c (mark_used): Use OVL_FIRST.
2940 * error.c (dump_decl): Use OVL_FIRST, OVL_NAME.
2941 (dump_expr, location_of): Use OVL_FIRST.
2942 * friend.c (do_friend): Use OVL_NAME.
2943 * init.c (build_offset_ref): Use OVL_FIRST.
2944 * mangle.c (write_member_name): Likewise.
2945 (write_expression): Use OVL_NAME.
2946 * method.c (strip_inheriting_ctors): Use OVL_FIRST.
2947 * name-lookup.c (pushdecl_class_level): Use OVL_NAME.
2948 * pt.c (check_explicit_specialization): Use OVL_FIRST.
2949 (check_template_shadow): Likewise.
2950 (tsubst_template_args): Use OVL_NAME.
2951 (tsubst_baselink): Use OVL_FIRST.
2952 * semantics.c (perform_koenig_lookup): Use OVL_NAME.
2953 * tree.c (get_first_fn): Use OVL_FIRST.
2954 * typeck.c (finish_class_member_access_expr): Use OVL_NAME.
2955 (cp_build_addr_expr_1): Use OVL_FIRST.
2957 * pt.c (tsubst_copy_and_build): Remove unnecessary COMPONENT_REF
2959 * semantics.c (finish_id_expression): Directly init local var.
2960 (finish_omp_reduction_clause): Use really_overloaded_fn.
2961 * tree.c (get_fns): Document. Assert we got an overload.
2962 (get_first_fn) Document.
2963 * typeck.c (cp_build_addr_expr_1): Pass arg directly to
2964 really_overloaded_fn.
2965 * typeck2.c (cxx_incomplete_type_diagnostic): Use get_first_fn directly.
2967 * cp-tree.h (SCOPE_DEPTH): New.
2968 * name-lookup.h (is_nested_namespace): Declare.
2969 * name-lookup.c (is_nested_namespace): New.
2970 (is_ancestor): Use it.
2971 (set_decl_namespace): Likewise.
2972 (push_namespace): Set SCOPE_DEPTH.
2973 * pt.c (check_specialization_namespace): Use is_nested_namespace.
2974 (check_unqualigied_spec_or_inst): Likewise.
2976 2017-05-15 Nathan Sidwell <nathan@acm.org>
2979 * cp-tree.h (DECL_NAMESPACE_INLINE_P): New.
2980 * name-lookup.h (push_namespace): Return int, add make_inline arg.
2981 * name-lookup.c (push_namespace): Deal with inline directly.
2982 Return pushed count.
2983 * parser.c (cp_parser_namespace_definition): Adjust for
2984 push_namespace change.
2986 2017-05-11 Nathan Sidwell <nathan@acm.org>
2988 * cp-lang.c (get_global_decls, cxx_pushdecl, LANG_HOOK_GETDECLS,
2989 LANG_HOOKS_PUSHDECL): Move to ...
2990 * cp-objcp-common.c (cp_get_global_decls, cp_pushdec,
2991 LANG_HOOK_DECLS, LANG_HOOKS_PUSHDECL): ... here.
2992 * cp-objcp-common.h (cp_get_global_decls, cp_pushdecl): Declare.
2994 * name-lookup.h (pushdecl): Add default friend parm.
2995 (pushdecl_maybe_friend): Delete.
2996 (pushdecl_top_level): Add default friend parm.
2997 (pushdecl_top_level_maybe_friend): Delete.
2998 * name-lookup.c (pushdecl_maybe_friend): Delete.
2999 (pushdecl): Add is_friend parm.
3000 (pushdecl_top_level): Add is friend_parm.
3001 (pushdecl_top_level_maybe_friend, pushdecl_top_level_1): Delete.
3002 (pushdecl_top_level_and_finish): Do pushing and finishing directly.
3003 * friend.c (do_friend): Adjust.
3004 * pt.c (tsubst_friend_class): Adjust.
3006 Revert pushdecl_top_level_and_finish name change.
3007 * name-lookup.h (pushdecl_top_level_and_finish): Resurrect old name.
3008 * name-lookup.c (pushdecl_top_level_and_finish): Likewise.
3009 * decl.c (cp_make_fname_decl): Adjust.
3010 * decl2.c (get_guard, handle_tls_init): Adjust.
3011 * rtti.c (get_tinfo_decl, tinfo_base_init): Adjust.
3013 * name-lookup.c (pushdecl_outermost_localscope): Always
3014 conditionally stop timer.
3016 * decl.c (xref_tag_1): Don't frob ts_lambda scope here.
3017 * name-lookup.c (pushtag_1): Deal with ts_lambda scope.
3019 * cp-tree.h (pushdecl, pushdecl_maybe_friend, pushtag,
3020 pushtag_top_level_maybe_friend,
3021 pushdecl_top_level_and_finish): Move declarations to ...
3022 * name-lookup.h: ... here. Group pushdecl variants.
3023 (pushdecl_top_level_and_finish): Rename to ...
3024 (pushdecl_top_level_with_init): ... here.
3025 * decl.c (cp_make_fname_decl): Use pushdecl_top_level_with_init.
3026 * decl2.c (get_guard, handle_tls_init): Likewise.
3027 * rtti.c (get_tinfo_decl, tinfo_base_init): Likewise.
3028 * lambda.c (maybe_add_lambda_conv_op): Use namespace_bindings_p.
3029 * method.c (implicitly_declare_fn): Likewise.
3030 * searchc (node_debug_info_needed): Likewise.
3031 * name-lookup.c (pushdecl_top_level_and_finish): Rename to ...
3032 (pushdecl_top_level_with_init): ... here.
3033 (pop_everything): Use namespace_bindings_p.
3035 * name-lookup.h (pop_binding): Rename to pop_local_binding.
3036 (getdecls): Rename to get_local_decls.
3037 * name-lookup.c (pop_binding): Rename to ...
3038 (pop_local_binding): ... here.
3039 (pop_bindings_and_leave_scope): Adjust.
3040 (getdecls): Rename to ...
3041 (get_local_decls): ... here. Assert local scope.
3042 * decl.c (poplevel): Assert not namespace. Adjust and simplify
3044 (store_parm_decls): Adjust get_local_decls call.
3045 (parser.c (synthesize_implicit_template_parm): Likewise.
3047 2017-05-11 Ville Voutilainen <ville.voutilainen@gmail.com>
3050 * method.c (is_trivially_xible): Reject void types.
3052 2017-05-10 Nathan Sidwell <nathan@acm.org>
3054 * class.c (handle_using_decl): Always use OVL_CURRENT.
3055 (resolve_address_of_overloaded_function): Move iterator decl into
3056 for scope. Don't strip anticipated decls here.
3058 * pt.c (print_candidates_1): Separate TREE_LIST and OVERLOAD
3060 (print_candidates): Adjust.
3062 * cp-tree.h (build_new_function_call): Lose koenig_p arg. Fix
3064 * call.c (build_new_function_call): Lose koenig_p arg. Remove
3065 koenig_p handling here.
3066 * pt.c (push_template_decl_real): Unconditionally retrofit_lang_decl.
3067 (tsubst_omp_clauses): Likewise.
3068 (do_class_deduction): Adjust buld_new_function_call calls.
3069 * semantics.c (finish_call_expr): Likewise.
3071 2017-05-10 Jason Merrill <jason@redhat.com>
3073 * pt.c (unify_parameter_deduction_failure, unify_cv_qual_mismatch)
3074 (unify_type_mismatch, unify_parameter_pack_mismatch)
3075 (unify_ptrmem_cst_mismatch, unify_expression_unequal)
3076 (unify_parameter_pack_inconsistent, unify_inconsistency)
3077 (unify_vla_arg, unify_method_type_error, unify_arity)
3078 (unify_arg_conversion, unify_no_common_base)
3079 (unify_inconsistent_template_template_parameters)
3080 (unify_template_deduction_failure)
3081 (unify_template_argument_mismatch)
3082 (unify_overload_resolution_failure): Call unify_invalid.
3084 CWG 1847 - Clarifying compatibility during partial ordering
3085 * pt.c (more_specialized_fn): No order between two non-deducible
3088 * pt.c (dependent_type_p): Make sure we aren't called with
3091 PR c++/79549 - C++17 ICE with non-type auto template parameter pack
3092 * pt.c (convert_template_argument): Just return an argument pack.
3093 (coerce_template_parameter_pack, template_parm_to_arg)
3094 (extract_fnparm_pack, make_argument_pack, tsubst_template_args)
3095 (tsubst_decl, tsubst, type_unification_real, unify_pack_expansion):
3096 Don't set the type of a NONTYPE_ARGUMENT_PACK.
3097 * parser.c (make_char_string_pack, make_string_pack): Likewise.
3099 2017-05-10 Nathan Sidwell <nathan@acm.org>
3101 * cp-tree.h (add_method, clone_function_decl): Change last arg to
3103 * class.c (add_method): Change third arg to bool. Adjust.
3104 (one_inheriting_sig, one_inherited_ctor): Adjust.
3105 (clone_function_decl): Change 2nd arg to bool. Adjust.
3106 (clone_constructors_and_destructors): Adjust.
3107 * lambda.c (maybe_add_lambda_conv_op): Adjust.
3108 * method.c (lazily_declare_fn): Adjust.
3109 * pt.c (tsubst_decl, instantiate_template_1): Adjust.
3110 * semantics.c (finish_member_declaration): Adjust.
3112 2017-05-10 Paolo Carlini <paolo.carlini@oracle.com>
3115 * decl.c (finish_function): To improve error recovery, change the
3116 logic for calling apply_deduced_return_type.
3118 2017-05-09 Jason Merrill <jason@redhat.com>
3120 PR c++/80605 - __is_standard_layout and empty base
3121 * class.c (check_bases): Ignore empty bases.
3123 PR c++/70979 - literal class and closure types
3124 * class.c (finalize_literal_type_property): Handle closures
3126 (explain_non_literal_class): Likewise.
3128 PR c++/66297, DR 1684 - literal class and constexpr member fns
3129 * constexpr.c (is_valid_constexpr_fn): Only complain about
3130 non-literal enclosing class in C++11.
3131 * class.c (finalize_literal_type_property): Likewise.
3133 2017-05-09 Paolo Carlini <paolo.carlini@oracle.com>
3136 * pt.c (tsubst_decl): Early return error_mark_node if
3137 grok_ctor_properties returns false.
3139 2017-05-09 Jason Merrill <jason@redhat.com>
3141 PR c++/70167 - array prvalue treated as lvalue
3142 * cp-tree.h (CONSTRUCTOR_C99_COMPOUND_LITERAL): New.
3144 * semantics.c (finish_compound_literal): Add fcl_context parameter.
3145 Only make a static variable for C99 syntax.
3146 * parser.c (cp_parser_postfix_expression): Pass it.
3147 * pt.c (tsubst_copy_and_build): Likewise.
3148 * call.c (extend_ref_init_temps): Set
3149 DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P.
3151 2017-05-09 Nathan Sidwell <nathan@acm.org>
3153 * cp-lang.c (get_global_decls, cxx_pushdecl): New.
3154 (LANG_HOOKS_GETDECLS, LANG_HOOKS_PUSHDECL): Override.
3155 * name-lookup.h (pushdecl_top_level): Declare.
3157 2017-05-08 Jason Merrill <jason@redhat.com>
3159 PR c++/80178 - parameter passing for uncopyable classes
3160 * tree.c (type_has_nontrivial_copy_init): True for classes with only
3161 deleted copy/move ctors.
3162 (remember_deleted_copy, maybe_warn_parm_abi): New.
3163 * decl.c (require_complete_types_for_parms, check_function_type):
3164 Call maybe_warn_parm_abi.
3165 * call.c (convert_for_arg_passing, build_cxx_call): Likewise.
3167 2017-05-08 Nathan Sidwell <nathan@acm.org>
3169 * decl.c (builtin_function_1): Set DECL_ANTICIPATED before pushing.
3170 (start_preparsed_function): Do decl pushing before setting
3171 current_funciton_decl and announcing it.
3173 * name-lookup.h (pushdecl_with_scope): Replace with ...
3174 (pushdecl_outermost_localscope): ... this.
3175 * name-lookup.c (pushdecl_with_scope): Replace with ...
3176 (pushdecl_outermost_localscope): ... this.
3177 (pushdecl_namespace_level): Adjust.
3178 * decl.c (cp_make_fname_decl): Use pushdecl_outermost_localscope.
3179 * lambda.c (insert_capture_proxy): Likewise.
3181 * class.c (build_vtbl_initializer): Don't shadow outer variable
3184 Revert _binding -> _value change.
3185 * name-lookup.h (get_namespace_value, set_global_value): Rename to ...
3186 (get_namespace_binding, set_global_binding): ... these.
3187 * name-lookup.c (get_namespace_value, set_global_value): Rename to ...
3188 (get_namespace_binding, set_global_binding): ... these.
3189 (arg_assoc_namespace, pushdecl_maybe_friend_1,
3190 check_for_out_of_scope_variable, push_overloaded_decl_1,
3191 lookup_name_innermost_nonclass_level, push_namespace): Adjust.
3192 * cp-tree.h (IDENTIFIER_GLOBAL_VALUE,
3193 SET_IDENTIFIER_GLOBAL_VALUE): Adjust.
3194 * decl.c (poplevel): Adjust.
3195 * pt.c (make_constrained_auto): Likewise.
3197 2017-05-07 Volker Reichelt <v.reichelt@netcologne.de>
3199 PR translation/80280
3200 * call.c (print_z_candidate): Fix quoting.
3202 2017-05-05 David Malcolm <dmalcolm@redhat.com>
3204 * error.c (pedwarn_cxx98): Replace report_diagnostic
3205 with diagnostic_report_diagnostic.
3207 2017-05-05 Nathan Sidwell <nathan@acm.org>
3209 * cp-tree.h (IDENTIFIER_GLOBAL_VALUE): Use get_namespace_value.
3210 (SET_IDENTIFIER_GLOBAL_VALUE): Use set_global_value.
3211 (IDENTIFIER_NAMESPACE_VALUE): Delete.
3212 * name-lookup.h (namespace_binding, set_namespace_binding): Replace
3214 (get_namespace_value, set_global_value): ... these.
3215 (get_global_value_if_present, is_typename_at_global_scope): Delete.
3216 * decl.c (poplevel): Use get_namespace_value.
3217 (grokdeclarator): Use IDENTIFIER_GLOBAL_VALUE.
3218 * class.c (build_vtbl_initializer): Stash library decl in
3219 static var. Use IDENTIFIER_GLOBAL_VALUE.
3220 * except.c (do_get_exception_ptr, do_begin_catch, do_end_catch,
3221 do_allocate_exception, do_free_exception, build_throw): Likewise.
3222 * init.c (throw_bad_array_new_length): Likewise.
3223 * rtti.c (throw_bad_cast, throw_bad_typeid): Likewise.
3224 * name-lookup.c (arg_assoc_namespace, pushdecl_maybe_friend_1,
3225 check_for_our_of_scope_variable, push_overloaded_decl_1): Use
3226 get_namespace_value.
3227 (set_namespace_binding_1): Rename to
3228 (set_namespace_binding): ... here.
3229 (set_global_value): New.
3230 (lookup_name_innermost_nonclass_level_1, push_namespace): Use
3231 get_namespace_value.
3232 * pt.c (listify): Use get_namespace_value.
3234 * call.c (make_temporary_var_for_ref_to_temp): Push decl into
3236 * lex.c (unqualified_name_lookup_error): Likewise.
3238 * class.c (alter_class): Use retrofit_lang_decl directly.
3239 * decl.c (push_local_name, dupliate_decls): Likewise.
3240 * semantics.c (omp_privatize_field): Likewise.
3242 Kill walk_namespaces.
3243 * cp-tree.h (walk_namespaces_fn, walk_namespaces): Delete.
3244 * decl.c (walk_namespaces_r, walk_namespaces): Delete.
3246 Kill per-namespace static_decls.
3247 * cp-tree.h (static_decls): Declare.
3248 (wrapup_globals_for_namespace,
3249 diagnose_inline_vars_for_namespace): Replace with ...
3250 (wrapup_namespace_globals): ... this.
3251 * decl.c (static_decls): Define.
3252 (wrapup_globals_for_namespace,
3253 diagnose_inline_vars_for_namespace): Replace with ...
3254 (wrapup_namespace_globals): ... this.
3255 (cxx_init_decl_processing): Initialize static_decls.
3256 * decl2.c (c_parse_final_cleanups): Adjust.
3257 * name-lookup.h (cp_binding_level): Remove static_decls member.
3258 * name-lookup.c (add_decl_to_level): Adjust.
3259 (begin_scope): Adjust.
3261 2017-05-05 Paolo Carlini <paolo.carlini@oracle.com>
3264 * decl.c (reshape_init): Unconditionally return error_mark_node
3265 upon error about too many initializers.
3267 2017-05-04 Nathan Sidwell <nathan@acm.org>
3269 * constraint.cc (diagnose_check_constraint): Fix %E thinko.
3271 2017-05-04 Martin Sebor <msebor@redhat.com>
3273 PR translation/80280
3274 * call.c (print_z_candidate): Add missing quoting to %D and other
3276 (build_op_call_1): Same.
3277 * constraint.cc (diagnose_check_constraint): Same.
3278 * mangle.c (mangle_decl): Same.
3279 * name-lookup.c (cp_binding_level_debug): Same.
3280 (set_decl_namespace): Same.
3281 * parser.c (cp_parser_tx_qualifier_opt): Same.
3282 * pt.c (print_candidates_1): Same.
3283 (check_template_variable): Same.
3284 (tsubst_default_argument): Same.
3285 (most_specialized_partial_spec): Same.
3286 * semantics.c (omp_reduction_lookup): Same.
3287 * tree.c (check_abi_tag_redeclaration): Same.
3288 * typeck.c (comptypes): Same.
3289 * typeck2.c (abstract_virtuals_error_sfinae): Same.
3291 2017-05-04 Nathan Sidwell <nathan@acm.org>
3294 * cp-tree.h (enum cp_tree_index): Add CPTI_GLOBAL,
3295 CPTI_GLOBAL_TYPE, CPTI_GLOBAL_IDENTIFIER, CPTI_ANON_IDENTIFIER,
3296 CPTI_INIT_LIST_IDENTIFIER.
3297 (global_namespace, global_type_node, global_identifier,
3298 anon_identifier, init_list_identifier): New.
3299 * decl.c (global_type_node, global_scope_name): Delete.
3300 (initialize_predefined_identifiers): Add new identifiers.
3301 (cxx_init_decl_processing): Adjust.
3302 * name-lookup.h (global_namespace, global_type_node): Delete.
3303 * name-lookup.c (global_namespace, anonymous_namespace_name,
3304 get_anonymous_namespace_name): Delete.
3305 (namespace_scope_ht_size, begin_scope, pushtag_1,
3306 push_namespace): Adjust,
3307 * call.c (type_has_extended_temps): Use init_list_identifier.
3308 * pt.c (listify): Likewise.
3310 * name-lookup.c: Reorder functions to make merging from modules
3313 2017-05-03 Jason Merrill <jason@redhat.com>
3315 * constexpr.c (cxx_eval_outermost_constant_expr): Use TV_CONSTEXPR.
3317 2017-05-03 Nathan Sidwell <nathan@acm.org>
3319 * cp-tree.h (enum cp_tree_index, cp_global_trees): Move earlier,
3320 along with #defines, to before name-lookup include.
3322 2017-05-02 Paolo Carlini <paolo.carlini@oracle.com>
3324 * pt.c (is_auto_or_concept): Remove.
3325 (type_uses_auto_or_concept): Remove, unused.
3326 (find_parameter_packs_r, extract_autos_r, is_auto_r): Adjust.
3327 * parser.c (tree_type_is_auto_or_concept): Remove, unused.
3328 * cp-tree.h (is_auto_or_concept): Remove.
3330 2017-05-01 Xi Ruoyao <ryxi@stu.xidian.edu.cn>
3333 * cp-cilkplus.c (cilk_install_body_with_frame_cleanup): Don't
3334 add pedigree operation and detach call here.
3335 * cp-gimplify.c (cp_gimplify_expr): Remove the calls to
3336 cilk_cp_gimplify_call_params_in_spawned_fn.
3337 (cilk_cp_gimplify_call_params_in_spawned_fn): Remove function.
3338 * semantics.c (simplify_aggr_init_expr): Copy EXPR_CILK_SPAWN.
3340 2017-04-29 Volker Reichelt <v.reichelt@netcologne.de>
3342 * parser.c (cp_parser_member_declaration): Add fix-it hints for
3343 stray comma and missing semicolon at end of member declaration.
3345 2017-04-27 Volker Reichelt <v.reichelt@netcologne.de>
3347 * parser.c (cp_parser_cast_expression): Add target type of cast to
3349 * error.c (type_to_string): Add '{enum}' suffix to enumeration types.
3351 2017-04-26 Paolo Carlini <paolo.carlini@oracle.com>
3353 * decl.c (grok_ctor_properties, ambi_op_p, unary_op_p): Change
3354 return type to bool.
3355 * cp-tree.h (grok_ctor_properties): Update.
3357 2017-04-26 Volker Reichelt <v.reichelt@netcologne.de>
3359 * parser.c (cp_parser_nested_name_specifier_opt): Add fix-it
3360 information to diagnostic of invalid colon in nested-name-specifier.
3362 2017-04-25 Volker Reichelt <v.reichelt@netcologne.de>
3364 * parser.c (cp_parser_elaborated_type_specifier): Add fix-it to
3365 diagnostic of invalid class/struct keyword after enum.
3367 2017-04-25 David Malcolm <dmalcolm@redhat.com>
3369 * parser.c (cp_parser_member_declaration): Add fix-it hint
3370 for removing stray semicolons.
3372 2017-04-25 David Malcolm <dmalcolm@redhat.com>
3374 * name-lookup.c (get_std_name_hint): New function.
3375 (maybe_suggest_missing_header): New function.
3376 (suggest_alternative_in_explicit_scope): Call
3377 maybe_suggest_missing_header.
3379 2017-04-25 David Malcolm <dmalcolm@redhat.com>
3382 * name-lookup.c (suggest_alternative_in_explicit_scope): Convert
3383 candidate type of bm from tree to const char *.
3384 (consider_binding_level): Likewise.
3385 (lookup_name_fuzzy): Likewise, using this to merge the best
3386 result from the preprocessor into bm, rather than immediately
3387 returning, so that better matches from reserved words can "win".
3388 Guard the rejection of keywords that don't start decl-specifiers
3389 so it only happens for FUZZY_LOOKUP_TYPENAME.
3391 2017-04-24 Volker Reichelt <v.reichelt@netcologne.de>
3393 * decl.c (grokdeclarator): Use %qT instead of %<%T%> in diagnostics.
3394 (start_enum): Likewise.
3395 (build_enumerator): Likewise. Use %qE instead of plain %E.
3396 * parser.c (cp_parser_mem_initializer_list): Use %qD instead of
3397 %<%D%> in diagnostics.
3398 (cp_parser_elaborated_type_specifier): Likewise.
3399 * pt.c (make_pack_expansion): Use %qT and %qE instead of
3400 %<%T%> and %<%E%> in diagnostics.
3401 (tsubst_pack_expansion): Likewise.
3403 2017-04-24 David Malcolm <dmalcolm@redhat.com>
3406 * parser.c (cp_parser_unary_expression): Generate a location
3407 range for alignof and sizeof expressions.
3409 2017-04-24 Volker Reichelt <v.reichelt@netcologne.de>
3411 * parser.c (cp_parser_cv_qualifier_seq_opt): Add fix-it info to
3413 (cp_parser_virt_specifier_seq_opt): Likewise.
3414 (set_and_check_decl_spec_loc): Likewise twice.
3416 2017-04-21 Jason Merrill <jason@redhat.com>
3418 PR c++/80179 - ICE with initialized flexible array member.
3419 * constexpr.c (verify_ctor_sanity): Handle flexible array members.
3421 2017-04-21 Richard Biener <rguenther@suse.de>
3423 * cp-tree.h (copy_decl): Annotate with CXX_MEM_STAT_INFO.
3424 (copy_type): Likewise.
3425 * lex.c (copy_decl): Pass down mem-stat info.
3426 (copy_type): Likewise.
3428 2017-04-20 Jonathan Wakely <jwakely@redhat.com>
3431 * init.c (build_new_1): Suppress notes about over-aligned new when
3432 the warning is suppressed.
3434 2017-04-20 Volker Reichelt <v.reichelt@netcologne.de>
3436 * parser.c (cp_parser_member_declaration): Add warning with fixit
3437 information for extra semicolon after in-class function definition.
3439 2017-04-20 Jakub Jelinek <jakub@redhat.com>
3442 * tree.c (build_cplus_array_type): Call build_array_type
3443 with the intended TYPE_TYPELESS_STORAGE flag value, instead
3444 of calling build_array_type and modifying later TYPE_TYPELESS_STORAGE
3447 2017-04-18 Marek Polacek <polacek@redhat.com>
3449 PR c++/80244 - ICE with attribute in template alias.
3450 * tree.c (strip_typedefs): Handle UNDERLYING_TYPE.
3452 PR c++/80241 - ICE with alignas pack expansion.
3453 * error.c (dump_expr): Handle TREE_LIST.
3454 * parser.c (cp_parser_std_attribute_list): Return error_mark if
3455 make_pack_expansion returns an error.
3457 2017-04-17 Bernd Edlinger <bernd.edlinger@hotmail.de>
3460 * class.c (fixup_may_alias): Fix all type variants.
3462 2017-04-17 Jason Merrill <jason@redhat.com>
3464 PR c++/80415 - wrong error with default arg and array reference.
3465 * tree.c (lvalue_kind): Return clk_class for an array prvalue.
3467 * pt.c (tsubst_init): Set TARGET_EXPR_DIRECT_INIT_P.
3469 2017-04-15 Alexandre Oliva <aoliva@redhat.com>
3471 * decl.c (name_unnamed_type): Split out of...
3472 (grokdeclarator): ... this.
3473 * decl.h (name_unnamed_type): Declare.
3475 2017-04-12 Richard Biener <rguenther@suse.de>
3476 Bernd Edlinger <bernd.edlinger@hotmail.de>
3479 * tree.c (build_cplus_array_type): Set TYPE_TYPELESS_STORAGE
3480 for arrays of character or std::byte type.
3482 2017-04-11 Jason Merrill <jason@redhat.com>
3484 PR c++/80294 - ICE with constexpr and inheritance.
3485 * constexpr.c (reduced_constant_expression_p):
3486 A null constructor element is non-constant.
3487 (cxx_eval_indirect_ref): Don't VERIFY_CONSTANT before
3488 returning an empty base.
3490 2017-04-11 Jakub Jelinek <jakub@redhat.com>
3493 * decl.c (cp_finish_decomp): If processing_template_decl on
3494 non-dependent decl, only set TREE_TYPE on the v[i] decls, but don't
3495 change their DECL_VALUE_EXPR nor cp_finish_decl them. Instead make
3496 sure DECL_VALUE_EXPR is the canonical NULL type ARRAY_REF for tsubst
3498 * pt.c (value_dependent_expression_p) <case VAR_DECL>: For variables
3499 with DECL_VALUE_EXPR, return true if DECL_VALUE_EXPR is type
3502 2017-04-11 Jakub Jelinek <jakub@redhat.com>
3505 * error.c (dump_expr): Handle VEC_COND_EXPR like COND_EXPR.
3507 2017-04-10 Jakub Jelinek <jakub@redhat.com>
3510 * tree.c (lvalue_kind): For COMPONENT_REF with BASELINK second
3511 operand, if it is a static member function, recurse on the
3514 2017-04-10 Marek Polacek <polacek@redhat.com>
3517 * typeck.c (cp_build_binary_op): Use NULL_TREE instead of NULL. Set
3518 ORIG_TYPE earlier and not only when shortening.
3520 2017-04-07 Jason Merrill <jason@redhat.com>
3522 PR c++/80356 - ICE with reference to function template argument.
3524 * pt.c (convert_nontype_argument_function): Adjust type even with a
3525 value-dependent argument.
3527 PR c++/80267 - ICE with nested capture of reference
3529 * pt.c (tsubst_copy): Handle lookup finding a capture proxy.
3531 2017-04-07 Marek Polacek <polacek@redhat.com>
3534 * typeck.c (cp_build_binary_op): Convert COP[01] to ORIG_TYPE.
3537 * call.c (build_over_call): Don't check cxx_dialect.
3538 * cp-gimplify.c (cp_gimplify_init_expr): Don't check cxx_dialect nor
3539 whether SUB is a CONSTRUCTOR.
3540 * init.c (build_new_1): Don't check cxx_dialect.
3541 * tree.c (replace_placeholders): Add a function comment. Return if
3542 not in C++14, or if the object isn't a (member of a) class.
3543 * typeck2.c (store_init_value): Don't check cxx_dialect nor whether
3544 TYPE is CLASS_TYPE_P.
3546 2017-04-05 Jakub Jelinek <jakub@redhat.com>
3549 * pt.c (canonical_type_parameter): Use vec_safe_grow_cleared instead
3550 of a loop doing vec_safe_push of NULL. Formatting fixes.
3551 (rewrite_template_parm): Copy TEMPLATE_PARM_PARAMETER_PACK from oldidx
3552 to newidx before calling canonical_type_parameter on newtype.
3554 2017-04-04 Volker Reichelt <v.reichelt@netcologne.de>
3557 * cxx-pretty-print.c (cxx_pretty_printer::expression): Add
3558 UNARY_PLUS_EXPR case.
3560 2017-04-03 Jason Merrill <jason@redhat.com>
3562 * semantics.c (finish_template_type): Check CLASSTYPE_TEMPLATE_INFO.
3564 2017-04-03 Jonathan Wakely <jwakely@redhat.com>
3566 * class.c (update_vtable_entry_for_fn): Fix typo in comment.
3567 * decl2.c (one_static_initialization_or_destruction): Likewise.
3568 * name-lookup.c (store_bindings): Likewise.
3569 * parser.c (make_call_declarator): Likewise.
3570 * pt.c (check_explicit_specialization): Likewise.
3572 2017-04-03 Jason Merrill <jason@redhat.com>
3574 PR sanitizer/79993 - ICE with VLA initialization from string
3575 PR c++/69487 - wrong VLA initialization from string
3576 * init.c (finish_length_check): Split out from build_vec_init.
3577 (build_vec_init): Handle STRING_CST.
3578 * typeck2.c (split_nonconstant_init): Handle STRING_CST.
3579 (digest_init_r): Don't give a STRING_CST VLA type.
3581 2017-03-31 Jakub Jelinek <jakub@redhat.com>
3584 * cp-gimplify.c (cp_genericize_r): Sanitize INTEGER_CSTs with
3585 REFERENCE_TYPE. Adjust ubsan_maybe_instrument_reference caller
3586 for NOP_EXPR to REFERENCE_TYPE.
3589 * cp-tree.h (enum cp_trait_kind): Add CPTK_IS_AGGREGATE.
3590 * cxx-pretty-print.c (pp_cxx_trait_expression): Handle
3592 * semantics.c (trait_expr_value): Handle CPTK_IS_AGGREGATE.
3593 Remove extraneous parens.
3594 (finish_trait_expr): Handle CPTK_IS_AGGREGATE.
3595 * parser.c (cp_parser_primary_expression): Handle RID_IS_AGGREGATE.
3596 (cp_parser_trait_expr): Likewise.
3598 2017-03-27 Jakub Jelinek <jakub@redhat.com>
3601 * cp-tree.h (cxx_mark_addressable): Add array_ref_p argument.
3602 * typeck.c (cxx_mark_addressable): Likewise. Look through
3603 VIEW_CONVERT_EXPR unless array_ref_p and VCE is from VECTOR_TYPE
3605 (cp_build_array_ref): Pass true as array_ref_p to cxx_mark_addressable.
3607 2017-03-24 Jason Merrill <jason@redhat.com>
3609 PR c++/77339 - ICE with invalid use of alias template.
3610 * pt.c (lookup_template_class_1): Don't try to enter the scope of an
3613 2017-03-24 Marek Polacek <polacek@redhat.com>
3616 * cp-gimplify.c (cp_fold): Strip CLEANUP_POINT_EXPR if the expression
3617 doesn't have side effects.
3619 2017-03-23 Jason Merrill <jason@redhat.com>
3621 PR c++/80150 - ICE with overloaded variadic deduction.
3622 * pt.c (try_one_overload): Remove asserts.
3624 PR c++/77563 - missing ambiguous conversion error.
3625 * call.c (convert_like_real): Use LOOKUP_IMPLICIT.
3627 2017-03-23 Marek Polacek <polacek@redhat.com>
3629 * cp-tree.h: Remove a C_RID_YYCODE reference.
3631 2017-03-22 Jakub Jelinek <jakub@redhat.com>
3634 * semantics.c (finish_omp_clause) <case OMP_CLAUSE_SIMDLEN,
3635 case OMP_CLAUSE_ALIGNED>: Call maybe_constant_value only when not
3636 processing_template_decl.
3638 2017-03-21 Paolo Carlini <paolo.carlini@oracle.com>
3641 * name-lookup.c (pushtag_1): Add check for bogus, non template,
3642 std::initializer_list.
3644 2017-03-21 Jakub Jelinek <jakub@redhat.com>
3647 * init.c (std_placement_new_fn_p, build_new_1): Formatting fixes.
3649 2017-03-21 Ville Voutilainen <ville.voutilainen@gmail.com>
3652 * init.c (std_placement_new_fn_p): New.
3653 (build_new_1): Call it.
3655 2017-03-20 Jason Merrill <jason@redhat.com>
3657 PR c++/80096 - ICE with C++17 non-type auto.
3658 * pt.c (tsubst): Delay tsubst of type of template non-type
3661 PR c++/79519 - ICE with deleted template friend.
3662 * decl.c (grokdeclarator): Complain about misplaced function
3663 definition using =, as well.
3665 PR c++/79640 - infinite recursion with generic lambda.
3666 * pt.c (tsubst_copy) [VAR_DECL]: Register the dummy instantiation
3667 before substituting its initializer.
3669 2017-03-20 Marek Polacek <polacek@redhat.com>
3670 Paolo Carlini <paolo.carlini@oracle.com>
3672 PR c++/80059 - ICE with noexcept and __transaction_atomic
3673 * except.c (build_must_not_throw_expr): Call
3674 instantiate_non_dependent_expr.
3676 2017-03-19 Jason Merrill <jason@redhat.com>
3678 PR c++/80084 - wrong C++17 decomposition by reference of parameter.
3679 * decl.c (cp_finish_decomp): Don't pull out the DECL_INITIAL of a
3680 reference decomposition.
3682 PR c++/80077 - error with constexpr and -fno-elide-constructors.
3683 * constexpr.c (cxx_eval_call_expression): Set ctx->call while
3684 expanding trivial constructor.
3686 2017-03-17 Jason Merrill <jason@redhat.com>
3688 PR c++/78345 - ICE initializing array from lambda.
3689 * init.c (build_aggr_init): Check array initializer.
3690 (build_vec_init): Check the type of a CONSTRUCTOR.
3692 PR c++/80073 - C++17 ICE with virtual base.
3693 * decl.c (xref_basetypes): Also check for indirect vbases.
3695 2017-03-16 Jason Merrill <jason@redhat.com>
3697 * decl.c (start_enum): std::byte aliases anything.
3700 * constexpr.c (lookup_placeholder): Tweak.
3702 2017-03-15 Jason Merrill <jason@redhat.com>
3704 PR c++/80043 - ICE with -fpermissive
3705 * typeck.c (convert_for_assignment): Handle instantiate_type
3706 not giving an error.
3708 2017-03-14 Nathan Sidwell <nathan@acm.org>
3710 PR c++/79393 DR 1658 workaround
3711 * method.c (synthesized_method_base_walk): Inihibit abstract class
3712 virtual base access check here.
3713 (synthesized_method_walk): Not here.
3715 2017-03-13 Nathan Sidwell <nathan@acm.org>
3717 PR c++/79393 DR 1658 workaround
3718 * method.c (synthesized_method_walk): Check vbases of abstract
3719 classes for dtor walk.
3721 2017-03-10 David Malcolm <dmalcolm@redhat.com>
3723 PR translation/79848
3724 * decl.c (grokfndecl): Simplify uses of "%<%s%>" to "%qs".
3726 2017-03-10 Jason Merrill <jason@redhat.com>
3728 PR c++/79960 - alias templates and partial ordering
3729 * pt.c (comp_template_args): Add partial_order parm.
3730 (template_args_equal): Likewise.
3731 (comp_template_args_porder): New.
3732 (get_partial_spec_bindings): Use it.
3734 2017-03-10 Marek Polacek <polacek@redhat.com>
3737 * decl.c (grokdeclarator): Check ATTRLIST before dereferencing it.
3739 2017-03-10 Jakub Jelinek <jakub@redhat.com>
3742 * optimize.c (maybe_thunk_body): Don't ICE if fns[0] is NULL.
3743 Use XALLOCAVEC macro.
3746 * decl.c (finish_enum_value_list): If value is error_mark_node,
3747 don't copy it and change its type.
3748 * init.c (constant_value_1): Return error_mark_node if DECL_INITIAL
3749 of CONST_DECL is error_mark_node.
3751 2017-03-09 Marek Polacek <polacek@redhat.com>
3753 PR c++/79900 - ICE in strip_typedefs
3754 * tree.c (strip_typedefs): Skip the attribute handling if T is
3755 a variant type which hasn't been updated yet.
3757 PR c++/79687 - wrong code with pointer-to-member
3758 * init.c (constant_value_1): Break if the variable has a dynamic
3761 2017-03-08 Jason Merrill <jason@redhat.com>
3763 PR c++/79797 - ICE with self-reference in array DMI.
3764 * constexpr.c (lookup_placeholder): Split out...
3765 (cxx_eval_constant_expression): ...from here.
3767 2017-03-07 Jakub Jelinek <jakub@redhat.com>
3770 * parser.c (cp_parser_omp_cancellation_point,
3771 cp_parser_omp_target_enter_data, cp_parser_omp_target_exit_data,
3772 cp_parser_omp_target_update): Change "may only be used in compound
3773 statements" diagnostics, such that the same translatable string is
3774 used for all pragmas.
3775 (cp_parser_pragma): Likewise. Use error_at instead of
3776 cp_parser_error for that diagnostics.
3778 2017-03-06 Marek Polacek <polacek@redhat.com>
3780 PR c++/79796 - ICE with NSDMI and this pointer
3781 * call.c (build_over_call): Handle NSDMI with a 'this' by calling
3782 replace_placeholders.
3784 2017-03-06 Jakub Jelinek <jakub@redhat.com>
3787 * constexpr.c (cxx_eval_statement_list): Treat empty ({ }) like
3790 2017-03-06 Jason Merrill <jason@redhat.com>
3792 Revert "Allow deduction guides to look into primary template."
3793 * cp-tree.h, parser.c, pt.c, search.c: Revert.
3795 2017-03-05 Paolo Carlini <paolo.carlini@oracle.com>
3798 * except.c (build_must_not_throw_expr): Perform the implicit
3799 conversions on the condition.
3801 2017-03-03 Jason Merrill <jason@redhat.com>
3803 * mangle.c (mangle_decl): Check -Wnoexcept-type instead of
3806 Core issues 2273 and 2277
3807 * call.c (joust): Adjust using-declaration tiebreaker to handle
3808 the intermediate base case.
3809 * method.c (strip_inheriting_ctors): Just return the argument if
3810 !flag_new_inheriting_ctors.
3812 2017-03-03 Richard Biener <rguenther@suse.de>
3815 * cp-gimplify.c (simple_empty_class_p): Handle EMPTY_CLASS_EXPR.
3817 2017-03-03 Marek Polacek <polacek@redhat.com>
3820 * typeck.c (string_conv_p): In C++11, always call pedwarn with
3823 2017-03-02 Jason Merrill <jason@redhat.com>
3825 Update overload resolution with deduction guides.
3826 * pt.c (do_class_deduction): Always build the copy guide.
3827 (copy_guide_p, template_guide_p): New.
3828 (build_deduction_guide): Remember the original constructor.
3829 * call.c (joust): Prefer the copy guide and non-template guides.
3831 Allow deduction guides to look into primary template.
3832 * cp-tree.h (struct saved_scope): Add deduction_guide_type.
3833 (struct cp_decl_specifier_seq): Add constructor_p.
3834 * parser.c (cp_parser_decl_specifier_seq): Set constructor_p.
3835 (cp_parser_init_declarator): Check it. Set ctor_dtor_or_conv_p.
3836 Clear deduction_guide_type. Don't handle deduction guide names.
3837 (cp_parser_declarator): Don't clear ctor_dtor_or_conv_p.
3838 (cp_parser_direct_declarator): Likewise. Handle deduction guides.
3839 (cp_parser_member_declaration, cp_parser_cache_defarg)
3840 (cp_parser_objc_class_ivars): Set ctor_dtor_or_conv_p.
3841 * pt.c (tsubst_copy, tsubst_copy_and_build): Revert last change.
3842 (build_deduction_guide): Set deduction_guide_type.
3843 (dependent_scope_p): Check deduction_guide_type.
3844 * search.c (lookup_member): Likewise.
3846 2017-03-02 Jakub Jelinek <jakub@redhat.com>
3849 * init.c (mark_exp_read_r): New function.
3850 (emit_mem_initializers): Use cp_walk_tree with mark_exp_read_r on
3851 whole arguments instead of plain mark_exp_read on TREE_LIST values.
3853 2017-03-01 Jason Merrill <jason@redhat.com>
3855 Class template argument deduction in new-expression
3856 * init.c (build_new): Handle deduction from no initializer.
3857 * parser.c (cp_parser_new_expression): Don't require a single
3858 expression for class template deduction.
3859 * typeck2.c (cxx_incomplete_type_diagnostic): Fix diagnostic for
3860 class template placeholder.
3861 * pt.c (tsubst_copy) [TEMPLATE_DECL]: Handle dependent context.
3862 (tsubst_copy_and_build) [TEMPLATE_ID_EXPR]: Handle SCOPE_REF.
3863 (redeclare_class_template): Set TEMPLATE_TYPE_PARM_FOR_CLASS.
3865 2017-03-01 Jakub Jelinek <jakub@redhat.com>
3868 * init.c (emit_mem_initializers): When not constructing vbases of
3869 abstract classes, mark arguments as read for
3870 -Wunused-but-set-parameter.
3872 2017-02-28 Jason Merrill <jason@redhat.com>
3874 Class template argument deduction refinements
3875 * call.c (joust): Move deduction guide tiebreaker down.
3876 * decl.c (start_decl_1, cp_finish_decl, grokdeclarator): Allow class
3877 deduction with no initializer.
3878 * pt.c (build_deduction_guide): Handle implicit default/copy ctor.
3879 (do_class_deduction): Use that rather than special case.
3880 (do_auto_deduction): Handle null initializer.
3882 2017-02-28 Jakub Jelinek <jakub@redhat.com>
3884 * decl.c (find_decomp_class_base): Use cond ? G_("...") : G_("...")
3885 instead of just cond ? "..." : "...".
3886 (grokdeclarator): Likewise.
3887 (build_enumerator): Likewise.
3888 * init.c (build_new_1): Likewise.
3889 * call.c (build_new_method_call_1): Likewise.
3890 * parser.c: Include intl.h.
3891 (cp_parser_oacc_enter_exit_data): Use %s and ternary operator only for
3892 "enter"/"exit" keyword.
3893 (cp_finalize_oacc_routine): Don't use %s to supply portions of the
3896 2017-02-27 Jason Merrill <jason@redhat.com>
3898 PR c++/71568 - SFINAE forming pointer to member function
3899 * init.c (build_offset_ref): Check the return value of
3900 perform_or_defer_access_check.
3902 2017-02-27 Marek Polacek <polacek@redhat.com>
3904 * decl.c (expand_static_init): Add missing } in a comment.
3906 2017-02-27 Volker Reichelt <v.reichelt@netcologne.de>
3908 * init.c: Include intl.h.
3909 (build_new_1): Move message strings into pedwarn to make them
3910 -Wformat-security friendly. Mark string for translation.
3911 * pt.c (tsubst_copy_and_build): Mark string for translation.
3912 Make the pointer const.
3913 * semantics.c (finish_id_expression): Mark strings for translation.
3915 2017-02-25 Jakub Jelinek <jakub@redhat.com>
3917 * call.c (build_op_delete_call): Make msg1 and msg2 const.
3919 2017-02-24 Jakub Jelinek <jakub@redhat.com>
3922 * call.c (build_over_call): Call check_function_arguments even for
3923 -Wrestrict, adjust check_function_arguments caller.
3924 * parser.c (cp_parser_postfix_expression): Don't handle -Wrestrict
3926 * typeck.c (cp_build_function_call_vec): Adjust
3927 check_function_arguments caller.
3929 2017-02-24 Marek Polacek <polacek@redhat.com>
3931 PR translation/79705
3932 * decl.c (check_redeclaration_exception_specification): Mark a string
3933 for translation. Make the pointer const.
3935 2017-02-23 Paolo Carlini <paolo.carlini@oracle.com>
3938 * pt.c (register_specialization): Check duplicate_decls return value
3939 for error_mark_node and pass it back.
3941 2017-02-22 Jason Merrill <jason@redhat.com>
3943 PR c++/79679 - missing destructor for argument
3944 * call.c (build_over_call): Don't pass tf_no_cleanup to argument
3947 * pt.c (do_class_deduction): Handle 0 argument case.
3949 2017-02-22 Jakub Jelinek <jakub@redhat.com>
3952 * parser.c (cp_parser_omp_teams, cp_parser_omp_target): Use
3953 SET_EXPR_LOCATION on OMP_TARGET/OMP_TEAMS tree.
3954 * constexpr.c (potential_constant_expression_1): Handle
3955 OMP_*, OACC_* and CILK_* trees. Use error_at with
3956 EXPR_LOC_OR_LOC (t, input_location) computed early
3957 instead of error, or error_at with location_of (t).
3959 2017-02-22 Marek Polacek <polacek@redhat.com>
3962 * parser.c (cp_parser_std_attribute_spec): Don't build the attribute
3963 if the alignas expression is erroneous.
3964 * pt.c (tsubst_attribute): If tsubst_pack_expansion fails, return
3968 * semantics.c (finish_underlying_type): Bail out for incomplete enums.
3970 2017-02-21 Jason Merrill <jason@redhat.com>
3972 PR c++/50308 - wrong deprecated warning with ADL
3973 PR c++/17729 - duplicate deprecated warning
3974 * semantics.c (finish_id_expression): Only call mark_used on a
3975 function if we aren't building a call.
3977 PR c++/41727 - ICE with partial spec of partial instantiation
3978 * pt.c (process_partial_specialization): For now, don't check more
3979 specialized if there is more than one level of args.
3981 2017-02-21 Marek Polacek <polacek@redhat.com>
3984 * cp-tree.h (maybe_reject_flexarray_init): Declare.
3985 * init.c (maybe_reject_flexarray_init): No longer static.
3986 Add check for current_function_decl.
3987 * parser.c (cp_parser_late_parse_one_default_arg): Reject
3988 a default mem-initializer for a flexible array.
3990 2017-02-21 Jakub Jelinek <jakub@redhat.com>
3991 Paolo Carlini <paolo.carlini@oracle.com>
3994 * decl.c (cp_finish_decomp): Don't set decl's type to error_mark_node
3996 * pt.c (tsubst_decomp_names): Return error_mark_node if the first
3997 decl after the decomposition artificial decl has error_mark_node.
3998 * decl2.c (prune_vars_needing_no_initialization): Use error_operand_p
3999 instead of just == error_mark_node comparison.
4001 2017-02-21 Jakub Jelinek <jakub@redhat.com>
4004 * decl.c: Include gimplify.h.
4005 (cp_finish_decomp): Make sure there is no sharing of trees
4006 in between DECL_VALUE_EXPR of decomposition decls.
4009 * constexpr.c (cxx_eval_array_reference): Diagnose negative subscript.
4012 * constexpr.c (cxx_eval_store_expression): If *valp is a PTRMEM_CST,
4013 call cplus_expand_constant on it first.
4015 2017-02-19 Jason Merrill <jason@redhat.com>
4017 PR c++/78139 - destructor needed by new-expression
4018 * call.c (build_special_member_call): Use tf_no_cleanup.
4020 PR c++/78282 - auto template and pack expansion
4021 * pt.c (find_parameter_packs_r): Don't walk into the type of
4022 templates other than template template-parameters.
4024 PR c++/79606 - ICE with this->base_member in NSDMI
4025 * class.c (build_base_path): Check processing_template_decl.
4027 PR c++/79607 - ICE with T{} initializer
4028 * decl.c (type_dependent_init_p): Check the type of a CONSTRUCTOR.
4030 PR c++/79566 - elaborated-type-specifier in range for
4031 * parser.c (cp_parser_simple_declaration): Fix check for type
4034 PR c++/79400 - confusing suggestion of 'noexcept'
4035 * parser.c (cp_parser_exception_specification_opt): Remove
4036 suggestion for deprecated dynamic exception-specification.
4038 PR c++/79470 - partial ordering with reference parameters
4039 * pt.c (unify) [INDIRECT_REF]: Handle pack expansions.
4041 PR c++/79500 - ICE with non-template deduction guide
4042 * pt.c (do_class_deduction): Use STRIP_TEMPLATE rather than
4043 DECL_TEMPLATE_RESULT.
4045 PR c++/79580 - ICE with compound literal
4046 * parser.c (cp_parser_class_head): If we're in the middle of an
4047 expression, use ts_within_enclosing_non_class.
4049 PR c++/79503 - inherited ctor taking base class
4050 * call.c (add_function_candidate): Also check that
4051 DECL_INHERITED_CTOR_BASE is reference-related to the parameter type.
4053 2017-02-19 Paolo Carlini <paolo.carlini@oracle.com>
4056 * typeck.c (cxx_alignas_expr): Reject a non-integral alignas
4059 2017-02-19 Eric Fiselier <eric@efcs.ca>
4060 Jonathan Wakely <jwakely@redhat.com>
4063 * parser.c (cp_parser_unqualified_id): Use OPT_Wliteral_suffix to
4064 control warning about literal suffix identifiers without a leading
4067 2017-02-17 Jason Merrill <jason@redhat.com>
4069 PR c++/79508 - lookup error with member template
4070 * parser.c (cp_parser_template_name): Clear
4071 parser->context->object_type if we aren't doing lookup.
4073 PR c++/78690 - ICE with using and global type with same name
4074 * pt.c (type_dependent_object_expression_p): True for
4077 PR c++/79549 - C++17 ICE with non-type auto template parameter pack
4078 * pt.c (convert_template_argument): Just return an auto arg pack.
4079 (tsubst_template_args): Don't tsubst an auto pack type.
4081 PR c++/79556 - C++17 ICE with non-type auto
4082 * pt.c (do_auto_deduction): Don't try to deduce from null type.
4084 PR c++/79533 - C++17 ICE with temporary cast to reference
4085 * call.c (build_over_call): Conversion to a reference prevents copy
4088 2017-02-16 Jakub Jelinek <jakub@redhat.com>
4089 Jason Merrill <jason@redhat.com>
4091 PR c++/79502 - lost nodiscard attribute
4092 * pt.c (apply_late_template_attributes): Do apply non-dependent
4093 attributes to types.
4095 2017-02-16 Jason Merrill <jason@redhat.com>
4097 PR c++/78572 - ICE with self-modifying array initializer
4098 * constexpr.c (cxx_eval_store_expression): The object we're
4099 initializing is outside the constant-expression.
4100 (cxx_eval_call_expression): Set ctx->call.
4102 PR c++/79050 - ICE with undeduced auto and LTO
4103 * decl.c (poplevel): Remove undeduced auto decls.
4105 2017-02-16 Jakub Jelinek <jakub@redhat.com>
4108 * parser.c (cp_parser_omp_target): For -fopenmp-simd
4109 ignore #pragma omp target even when not followed by identifier.
4111 2017-02-15 Jason Merrill <jason@redhat.com>
4112 Jakub Jelinek <jakub@redhat.com>
4114 PR c++/79464 - ICE in IPA with omitted constructor parms
4115 * class.c (build_clone): Also omit parms from TYPE_ARG_TYPES.
4116 (adjust_clone_args): Adjust.
4117 (add_method): Remember omitted parms.
4118 * call.c (add_function_candidate): Likewise.
4119 * mangle.c (write_method_parms): Likewise.
4120 * method.c (ctor_omit_inherited_parms): Return false if there are no
4123 2017-02-15 Martin Sebor <msebor@redhat.com>
4126 * init.c (maybe_reject_flexarray_init): New function.
4127 (perform_member_init): Call it.
4129 2017-02-15 Jakub Jelinek <jakub@redhat.com>
4132 * parser.c (cp_parser_std_attribute): Don't pedwarn about
4133 [[deprecated]] with -std=c++11 and [[fallthrough]] with
4134 -std=c++11 and -std=c++14.
4137 * decl.c (grokdeclarator): For static data members, handle thread_p
4138 only after handling inline.
4140 2017-02-14 Marek Polacek <polacek@redhat.com>
4144 * parser.c (cp_parser_postfix_dot_deref_expression): Avoid
4145 clobbering if the postfix expression isn't an EXPR_P.
4147 2017-02-13 Jason Merrill <jason@redhat.com>
4149 PR c++/79461 - ICE with lambda in constexpr constructor
4150 * constexpr.c (build_data_member_initialization): Ignore
4151 initialization of a local variable.
4153 2017-02-13 Jakub Jelinek <jakub@redhat.com>
4155 * init.c (warn_placement_new_too_small): Add missing space in
4157 * parser.c (cp_parser_oacc_declare): Likewise.
4158 * mangle.c (maybe_check_abi_tags): Likewise.
4161 * typeck.c (cp_build_modify_expr): Handle properly COMPOUND_EXPRs
4162 on lhs that have {PRE{DEC,INC}REMENT,MODIFY,MIN,MAX,COND}_EXPR
4163 in the rightmost operand.
4165 2017-02-13 Nathan Sidwell <nathan@acm.org>
4167 PR c++/79296 - ICE mangling localized template instantiation
4168 * decl2.c (determine_visibility): Use template fn context for
4169 local class instantiations.
4171 2017-02-11 Jason Merrill <jason@redhat.com>
4173 PR c++/77659 - ICE with new and C++14 aggregate NSDMI
4174 * init.c (build_new): Make backups of any CONSTRUCTORs in init.
4175 (build_new_1): Use replace_placeholders.
4176 * tree.c (replace_placeholders_t): Also track whether we've seen a
4178 (replace_placeholders, replace_placeholders_r): Adjust.
4179 * cp-tree.h: Adjust.
4181 PR c++/77790 - ICE with auto function in C++11 mode
4182 * decl.c (undeduced_auto_decl): Remove C++14 limitation.
4183 (require_deduced_type): Add complain parm, return bool.
4184 * cp-tree.h: Adjust.
4185 * decl2.c (mark_used): Use require_deduced_type.
4187 2017-02-10 Jason Merrill <jason@redhat.com>
4189 PR c++/78908 - template ops and bitfields
4190 * tree.c (build_min_non_dep): Use unlowered_expr_type.
4192 PR c++/78897 - constexpr union
4193 * constexpr.c (cxx_eval_store_expression): A store to a union member
4194 erases a previous store to another member.
4196 PR c++/71285 - member of fold-expression
4197 * semantics.c (finish_unary_fold_expr)
4198 (finish_binary_fold_expr): Use null type for fold-expressions.
4200 PR c++/79401 - protected inherited constructor
4201 * call.c (enforce_access): For inheriting constructor, find a base
4202 binfo in the path we already have.
4204 2017-02-10 Marek Polacek <polacek@redhat.com>
4207 * pt.c (type_dependent_expression_p): Check if the expression type
4211 * cvt.c (ocp_convert): Add a sentinel against -Wint-in-bool-context
4212 if warnings shouldn't be given.
4214 2017-02-10 Paolo Carlini <paolo.carlini@oracle.com>
4217 * pt.c (tsubst_decl): Don't try to preserve a typedef that names
4218 an error_mark_node as type.
4220 2017-02-09 Jakub Jelinek <jakub@redhat.com>
4221 Jason Merrill <jason@redhat.com>
4224 * pt.c (instantiate_class_template_1): Copy CLASSTYPE_NON_AGGREGATE
4225 from pattern to type.
4227 2017-02-09 Jason Merrill <jason@redhat.com>
4229 PR c++/79316 - default argument in deduction guide
4230 PR c++/79350 - explicit deduction guide
4231 * parser.c (cp_parser_constructor_declarator_p)
4232 (cp_parser_direct_declarator): Parse deduction guides more like
4234 * cp-tree.h (enum special_function_kind): Add sfk_deduction_guide.
4235 * tree.c (special_function_p): Return it.
4236 * decl.c (check_special_function_return_type): Handle it.
4237 (grokdeclarator, grokfndecl): Adjust.
4238 (cp_finish_decl): Pass flags to do_auto_deduction.
4239 * error.c (dump_decl_name): Use TFF_UNQUALIFIED_NAME.
4240 * pt.c (dguide_name_p): Take a const_tree.
4241 (do_class_deduction): Handle explicit.
4242 (do_auto_deduction): Pass flags through.
4243 (build_deduction_guide): Copy explicit flag.
4245 2017-02-09 Jakub Jelinek <jakub@redhat.com>
4248 * parser.c (cp_parser_omp_ordered): Don't check for non-pragma_stmt
4249 non-pragma_compound context here.
4250 (cp_parser_omp_target): Likewise.
4251 (cp_parser_pragma): Don't call push_omp_privatization_clauses and
4252 parsing for ordered and target omp pragmas in non-pragma_stmt
4253 non-pragma_compound contexts.
4256 * parser.c (cp_parser_oacc_declare): Formatting fix.
4257 (cp_parser_omp_declare_target): Don't invoke symtab_node::get on
4258 automatic variables.
4260 2016-02-09 Nathan Sidwell <nathan@codesourcery.com>
4261 Chung-Lin Tang <cltang@codesourcery.com>
4263 * parser.c (cp_parser_oacc_clause_tile): Disallow collapse. Fix
4264 parsing. Parse constant expression. Remove semantic checking.
4265 (cp_parser_omp_clause_collapse): Disallow tile.
4266 (cp_parser_omp_for_loop): Deal with tile clause. Don't emit a parse
4267 error about missing for after already emitting one. Use more
4268 conventional for idiom for unbounded loop.
4269 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_TILE.
4270 * semantics.c (finish_omp_clauses): Correct TILE semantic check.
4271 (finish_omp_for): Deal with tile clause.
4273 2017-02-07 Nathan Sidwell <nathan@acm.org>
4275 * method.c (synthesized_method_base_walk): New. Broken out of ...
4276 (synthesized_method_walk): ... here. Call it. Cleanup
4279 2017-02-07 Patrick Palka <ppalka@gcc.gnu.org>
4282 * typeck2.c (process_init_constructor_union): Consider only
4283 FIELD_DECLs when looking for an NSDMI.
4285 2017-02-06 Jason Merrill <jason@redhat.com>
4287 PR c++/71193 - incomplete types in templates
4288 * parser.c (cp_parser_postfix_dot_deref_expression): In a template
4289 handle incomplete type by pedwarning and then treating as dependent.
4291 2017-02-06 Jakub Jelinek <jakub@redhat.com>
4294 * constexpr.c (cxx_eval_constant_expression): Handle ANNOTATE_EXPR.
4295 (potential_constant_expression_1): Likewise.
4298 * tree.c (build_min_non_dep_op_overload): For POST{INC,DEC}REMENT_EXPR
4299 allow one fewer than expected arguments if flag_permissive.
4302 * decl.c (cp_finish_decomp): On error set decl type to error_mark_node.
4303 * pt.c (tsubst_expr): Don't call tsubst_decomp_names on decompositions
4304 with error_mark_node type.
4306 2017-02-03 Jason Merrill <jason@redhat.com>
4308 PR c++/78689 - ICE on constructor with label
4309 * optimize.c (maybe_clone_body): Replace omitted parameters with
4311 * class.c (build_clone): Fix logic for omitting inherited parms.
4313 PR c++/12245 - excessive memory use
4314 * constexpr.c (maybe_constant_value): Fold maybe_constant_value_1
4315 back in. Don't cache constants.
4316 (maybe_constant_init): Don't cache constants.
4318 PR c++/79294 - ICE with invalid template argument
4319 * pt.c (convert_nontype_argument_function): Check value-dependence.
4320 (convert_nontype_argument): Don't check it here for function ptrs.
4322 2017-02-02 Richard Biener <rguenther@suse.de>
4325 * cp-gimplify.c (cp_fold): When folding a CONSTRUCTOR copy
4326 it lazily on the first changed element only and copy it
4327 fully upfront, only storing changed elements.
4329 2017-02-02 Paolo Carlini <paolo.carlini@oracle.com>
4332 * decl2.c (grokbitfield): In case of error don't set-up DECL_INITIAL
4335 2017-01-31 Jakub Jelinek <jakub@redhat.com>
4338 * error.c (dump_expr) <case COMPONENT_REF>: Don't print .
4341 2017-01-31 David Malcolm <dmalcolm@redhat.com>
4344 * name-lookup.c (suggest_alternative_in_explicit_scope): Resolve
4345 any namespace aliases.
4347 2017-01-31 Nathan Sidwell <nathan@acm.org>
4350 * typeck.c (build_ptrmemfunc_access_expr): Set TREE_NO_WARNING.
4354 * pt.c: (instantiate_decl): Push to top level when current
4355 function scope doesn't match. Only push lmabda scope stack when
4358 * cp-tree.h (instantiate_decl): Make defer_ok bool.
4359 * pt.c: Fix instantiate_decl calls to pass true/false not 0/1
4360 (instantiate_decl): Simplify and reorder state saving and restoration.
4363 * lambda.c (maybe_generic_this_capture): Deal with template-id-exprs.
4364 * semantics.c (finish_member_declaration): Assert class is being
4367 2017-01-30 Alexandre Oliva <aoliva@redhat.com>
4369 Introduce C++ support in libcc1.
4370 * cp-tree.h (struct lang_identifier): Add oracle_looked_up.
4371 (ansi_opname): Rename to...
4372 (cp_operator_id): ... this. Adjust all callers.
4373 (ansi_assopname): Rename to...
4374 (cp_assignment_operator_id): ... this. Adjust all callers.
4375 (cp_literal_operator_id): Declare.
4376 (set_global_friend): Declare.
4377 (is_global_friend): Declare.
4378 (enum cp_oracle_request): New type.
4379 (cp_binding_oracle_function): New type.
4380 (cp_binding_oracle): Declare.
4381 (cp_finish_injected_record_type): Declare.
4382 * friend.c (global_friend): New var.
4383 (set_global_friend): New fn.
4384 (is_global_friend): New fn.
4385 (is_friend): Call is_global_friend.
4386 * name-lookup.c (cp_binding_oracle): New var.
4387 (query_oracle): New fn.
4388 (qualified_lookup_using_namespace): Call query_oracle.
4389 (lookup_name_real_1): Likewise.
4390 * parser.c (cp_literal_operator_id): Drop static.
4391 * search.c (friend_accessible_p): Call is_global_friend.
4392 * semantics.c (is_this_parameter): Accept a variable if the
4393 binding oracle is enabled.
4395 2017-01-27 Jason Merrill <jason@redhat.com>
4397 PR c++/78771 - ICE with inherited constructor.
4398 * call.c (build_over_call): Call deduce_inheriting_ctor here.
4399 * pt.c (tsubst_decl): Not here.
4400 * class.c (add_method): Or here.
4401 * method.c (deduce_inheriting_ctor): Handle clones.
4402 (implicitly_declare_fn): Don't deduce inheriting ctors yet.
4404 2017-01-27 Adam Butcher <adam@jessamine.co.uk>
4407 * cp/parser.c (parsing_default_capturing_generic_lambda_in_template):
4409 * cp/cp-tree.h: Declare it.
4410 * cp/semantics.c (finish_id_expression): Resolve names within a default
4411 capturing generic lambda defined within a template prior to
4412 instantiation to allow for captures to be added to the closure type.
4414 2017-01-26 Jakub Jelinek <jakub@redhat.com>
4417 * cp-tree.def (OFFSETOF_EXPR): Bump number of operands to 2.
4418 * cp-tree.h (finish_offsetof): Add OBJECT_PTR argument.
4419 * parser.c (cp_parser_builtin_offsetof): Pass result of
4420 build_static_cast of null_pointer_node to finish_offsetof.
4421 * semantics.c (finish_offsetof): Add OBJECT_PTR argument, use
4422 it for -Winvalid-offsetof pedwarn instead of trying to guess
4423 original offsetof type from EXPR. Save OBJECT_PTR as a new
4424 second operand to OFFSETOF_EXPR.
4425 * pt.c (tsubst_copy_and_build) <case OFFSETOF_EXPR>: Adjust
4426 finish_offsetof caller, pass the second operand of OFFSETOF_EXPR
4429 2017-01-26 Jason Merrill <jason@redhat.com>
4431 * name-lookup.c (parse_using_directive): Deprecate strong using.
4433 PR c++/79176 - lambda ICE with -flto -Os
4434 * decl2.c (vague_linkage_p): Handle decloned 'tors.
4435 * tree.c (decl_linkage): Likewise.
4437 2017-01-25 Martin Sebor <msebor@redhat.com>
4439 * decl.c (grokdeclarator): Fix a typo in a comment.
4441 2017-01-25 Jakub Jelinek <jakub@redhat.com>
4444 * decl.c (cp_finish_decomp): Disallow memberwise decomposition of
4448 * parser.c (cp_parser_lambda_declarator_opt): Pedwarn with
4449 OPT_Wpedantic on lambda templates for -std=c++14 and higher.
4451 2017-01-25 Maxim Ostapenko <m.ostapenko@samsung.com>
4454 * decl.c (cxx_init_decl_processing): Pass main_input_filename
4455 to build_translation_unit_decl.
4457 2017-01-24 Jakub Jelinek <jakub@redhat.com>
4460 * cp-gimplify.c (cp_genericize_r): Add result of
4461 convert_from_reference on invisiref parm to p_set.
4463 2017-01-24 Nathan Sidwell <nathan@acm.org>
4465 PR c++/78469 - defaulted ctor and inaccessible dtor
4466 * cp-tree.h (tsubst_flags): Add tf_no_cleanup.
4467 * init.c (build_new_1): Pass tf_no_cleanup to build_value_init.
4468 * tree.c (build_target_expr): Check tf_no_cleanup.
4470 PR c++/79118 - anon-members and constexpr
4471 * constexpr.c (cx_check_missing_mem_inits): Caller passes type not
4472 ctor decl. Recursively check anonymous members.
4473 (register_constexpr_fundef): Adjust cx_check_missing_mem_inits
4475 (explain_invalid_constexpr_fn): Likewise.
4477 2017-01-23 Nathan Sidwell <nathan@acm.org>
4479 PR c++/71710 - template using directive of field
4480 * pt.c (tsubst_copy_and_build [COMPONENT_REF]): Move FIELD_DECL
4483 PR c++/71406 - ICE with scope-ref'd template id exprs
4485 * typeck.c (finish_class_member_access_expr): Break up SCOPE_REF
4486 before breaking up TEMPLATE_ID_EXPR.
4488 2017-01-20 Nathan Sidwell <nathan@acm.org>
4490 PR c++/78495 - wrong code inherited ctor and invisi-ref parm
4491 * cp-gimplify.c (cp_generize_r): Don't skip thunks.
4493 2017-01-20 David Malcolm <dmalcolm@redhat.com>
4497 * cp-tree.h (suggest_alternatives_for): Add bool param.
4498 (suggest_alternative_in_explicit_scope): New decl.
4499 * error.c (qualified_name_lookup_error): When SCOPE is a namespace
4500 that isn't the global one, call new function
4501 suggest_alternative_in_explicit_scope, only calling
4502 suggest_alternatives_for if it fails, and disabling near match
4503 searches fort that case. When SCOPE is the global namespace,
4504 pass true for new param to suggest_alternatives_for to allow for
4506 * lex.c (unqualified_name_lookup_error): Pass true for new param
4507 to suggest_alternatives_for.
4508 * name-lookup.c (consider_binding_level): Add forward decl.
4509 (suggest_alternatives_for): Add "suggest_misspellings" param,
4510 using it to conditionalize the fuzzy name-lookup code.
4511 (suggest_alternative_in_explicit_scope): New function.
4512 * parser.c (cp_parser_primary_expression): When calling
4513 finish_id_expression, pass location of id_expression rather
4514 than that of id_expr_token.
4515 (cp_parser_id_expression): Convert local "unqualified_id" from
4516 tree to cp_expr to avoid implicitly dropping location information.
4518 2017-01-20 Marek Polacek <polacek@redhat.com>
4521 * call.c (build_conditional_expr_1): Warn about duplicated branches.
4522 * semantics.c (finish_expr_stmt): Build statement using the proper
4525 2017-01-19 Jason Merrill <jason@redhat.com>
4527 US 20 - forwarding references and class template argument deduction
4528 * cp-tree.h (TEMPLATE_TYPE_PARM_FOR_CLASS): New.
4529 * pt.c (push_template_decl_real): Set it.
4530 (maybe_adjust_types_for_deduction): Check it.
4531 (rewrite_template_parm): Copy it.
4533 US 19 - deduction guides and constructors
4534 * call.c (joust): Prefer deduction guides to constructors.
4535 * pt.c (build_deduction_guide): Set DECL_ARTIFICIAL.
4536 (deduction_guide_p): Check DECL_P.
4538 * decl.c (check_initializer): Always use build_aggr_init for array
4541 PR c++/79130 - decomposition and direct-initialization
4542 * init.c (build_aggr_init): Communicate direct-initialization to
4544 (build_vec_init): Check for array copy sooner.
4545 * parser.c (cp_parser_decomposition_declaration): Remove call to
4546 build_x_compound_expr_from_list.
4548 2017-01-18 Jason Merrill <jason@redhat.com>
4550 PR c++/68666 - member variable template-id
4551 * typeck.c (finish_class_member_access_expr): Handle variable
4553 * pt.c (lookup_and_finish_template_variable): No longer static.
4554 * cp-tree.h: Declare it.
4556 2017-01-18 Nathan Sidwell <nathan@acm.org>
4559 * call.c (build_over_call): When checking ellipsis conversions for
4560 an inherited ctor, make sure there is at least one conversion.
4562 2017-01-18 Jason Merrill <jason@redhat.com>
4564 PR c++/78894 - ICE with class deduction and default arg
4565 * pt.c (build_deduction_guide): Set DECL_PRIMARY_TEMPLATE.
4567 2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de>
4570 * mangle.c (write_discriminator): Reorganize abi warning check.
4572 2017-01-18 Nathan Sidwell <nathan@acm.org>
4574 * cp-tree.h: Clarify exception spec node comment.
4575 * except.c (nothrow_spec_p): Simplify by checking node-equality.
4578 * mangle.c (write_exception_spec): Check nothrow explicitly.
4579 (write_encoding): Don't increment processing_template_decl around
4582 2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de>
4585 * mangle.c (write_template_args): Add "on" for operator names.
4587 2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de>
4590 * mangle.c (write_discriminator): Handle discriminator >= 10.
4592 2017-01-17 Nathan Sidwell <nathan@acm.org>
4595 * cp-tree.h (maybe_generic_this_capture): Declare.
4596 * lambda.c (resolvable_dummy_lambda): New, broken out of ...
4597 (maybe_resolve_dummy): ... here. Call it.
4598 (maybe_generic_this_capture): New.
4599 * parser.c (cp_parser_postfix_expression): Speculatively capture
4600 this in generic lambda in unresolved member function call.
4601 * pt.c (tsubst_copy_and_build): Force hard error from failed
4602 member function lookup in generic lambda.
4604 2017-01-17 Aldy Hernandez <aldyh@redhat.com>
4607 * cp-array-notation.c (expand_array_notation_exprs): Handle
4610 2017-01-11 Jason Merrill <jason@redhat.com>
4612 PR c++/78337 - ICE on invalid with generic lambda
4613 * semantics.c (process_outer_var_ref): Check if containing_function
4614 is null. Move inform call under complain test.
4616 2017-01-11 Nathan Sidwell <nathan@acm.org>
4619 * name-lookup.c (set_namespace_binding_1): An overload of 1 decl
4622 2017-01-11 Nathan Sidwell <nathan@acm.org>
4624 * name-lookup.c (push_overloaded_decl_1): Refactor OVERLOAD creation.
4626 2017-01-11 Jakub Jelinek <jakub@redhat.com>
4629 * parser.c (cp_parser_std_attribute_spec): Remove over-eager
4630 assertion. Formatting fix.
4633 * decl2.c (c_parse_final_cleanups): Set flag_syntax_only to 1 after
4636 2017-01-10 David Malcolm <dmalcolm@redhat.com>
4639 * parser.c (cp_parser_class_specifier_1): Only suggest inserting
4640 a missing semicolon if we have a valid insertion location for
4643 2017-01-10 Jason Merrill <jason@redhat.com>
4645 FI 20, decomposition declaration with parenthesized initializer.
4646 * parser.c (cp_parser_decomposition_declaration): Use
4647 cp_parser_initializer.
4649 2017-01-09 Jason Merrill <jason@redhat.com>
4651 Implement P0195R2, C++17 variadic using.
4652 * parser.c (cp_parser_using_declaration): Handle ellipsis and comma.
4653 * pt.c (tsubst_decl): Handle pack expansion in USING_DECL_SCOPE.
4654 * error.c (dump_decl): Likewise.
4656 2017-01-09 Jakub Jelinek <jakub@redhat.com>
4658 PR translation/79019
4659 PR translation/79020
4660 * semantics.c (finish_omp_clauses): Add missing whitespace to
4661 translatable strings.
4662 * cp-cilkplus.c (cpp_validate_cilk_plus_loop_aux): Fix comment typo.
4664 2017-01-07 Jason Merrill <jason@redhat.com>
4666 PR c++/78948 - instantiation from discarded statement
4667 * parser.h (struct cp_parser): Remove in_discarded_stmt field.
4668 * cp-tree.h (in_discarded_stmt): Declare it.
4669 (struct saved_scope): Add discarded_stmt bitfield.
4670 (in_discarded_stmt): New macro.
4671 * decl2.c (mark_used): Check it.
4672 * parser.c (cp_parser_selection_statement): Adjust.
4673 (cp_parser_jump_statement): Adjust.
4675 2017-01-05 Jakub Jelinek <jakub@redhat.com>
4678 * decl.c (cp_finish_decomp): Remove probe variable, if tt is
4679 REFERENCE_REF_P, set tt to its operand.
4682 * class.c (check_field_decls): Diagnose REFERENCE_TYPE fields in
4683 unions even for C++11 and later.
4685 2017-01-05 Nathan Sidwell <nathan@acm.org>
4688 * pt.c (convert_nontype_argument): Don't try and see if integral
4689 or enum expressions are constants prematurely.
4691 2017-01-04 Marek Polacek <polacek@redhat.com>
4694 * typeck.c (cp_build_binary_op): Warn when a pointer is compared with
4695 a zero character literal.
4697 2017-01-04 Jakub Jelinek <jakub@redhat.com>
4700 * typeck.c (cp_build_unary_op): Call mark_rvalue_use on arg if it has
4704 * parser.c (cp_parser_simple_declaration): Only complain about
4705 inconsistent auto deduction if auto_result doesn't use auto.
4707 * parser.c (cp_parser_simple_declaration): Diagnose function
4708 declaration among more than one init-declarators with auto
4712 * parser.c (cp_lexer_previous_token): Use vec_safe_address in the
4713 assertion, as lexer->buffer may be NULL.
4715 2017-01-04 Marek Polacek <polacek@redhat.com>
4719 * constexpr.c (potential_constant_expression_1): Handle CLEANUP_STMT.
4721 2017-01-04 Nathan Sidwell <nathan@acm.org>
4724 * cp-tree.h (DECLTYPE_FOR_REF_CAPTURE): New.
4725 (lambda_capture_field_type): Update prototype.
4726 * lambda.c (lambda_capture_field_type): Add is_reference parm.
4727 Add referenceness here.
4728 (add_capture): Adjust lambda_capture_field_type call, refactor
4730 * pt.c (tsubst): Adjust lambda_capture_field_type call.
4732 2017-01-01 Jakub Jelinek <jakub@redhat.com>
4734 Update copyright years.
4736 Copyright (C) 2017 Free Software Foundation, Inc.
4738 Copying and distribution of this file, with or without modification,
4739 are permitted in any medium without royalty provided the copyright
4740 notice and this notice are preserved.