blob: 20b0349b93579958533b58ee12b2eff02df7585b [file] [log] [blame]
2017-12-22 Mike Stump <>
Eric Botcazou <>
* constexpr.c (cxx_eval_constant_expression) <ANNOTATE_EXPR>: Remove
assertion on 2nd operand.
(potential_constant_expression_1): Likewise.
* cp-tree.def (RANGE_FOR_STMT): Take a 5th operand.
* cp-tree.h (RANGE_FOR_UNROLL): New macro.
(cp_convert_range_for): Adjust prototype.
(finish_while_stmt_cond): Likewise.
(finish_do_stmt): Likewise.
(finish_for_cond): Likewise.
* init.c (build_vec_init): Adjut call to finish_for_cond.
* parser.c (cp_parser_statement): Adjust call to
(cp_parser_for): Add unroll parameter and pass it in calls to
cp_parser_range_for and cp_parser_c_for.
(cp_parser_c_for): Add unroll parameter and pass it in call to
(cp_parser_range_for): Add unroll parameter, set in on RANGE_FOR_STMT
and pass it in call to cp_convert_range_for.
(cp_convert_range_for): Add unroll parameter and pass it in call to
(cp_parser_iteration_statement): Add unroll parameter and pass it in
calls to finish_while_stmt_cond, finish_do_stmt and cp_parser_for.
(cp_parser_pragma_ivdep): New static function.
(cp_parser_pragma_unroll): Likewise.
(cp_parser_pragma) <PRAGMA_IVDEP>: Add support for pragma Unroll.
<PRAGMA_UNROLL>: New case.
* pt.c (tsubst_expr) <FOR_STMT>: Adjust call to finish_for_cond.
<RANGE_FOR_STMT>: Pass unrolling factor to cp_convert_range_for.
<WHILE_STMT>: Adjust call to finish_while_stmt_cond.
<DO_STMT>: Adjust call to finish_do_stmt.
* semantics.c (finish_while_stmt_cond): Add unroll parameter and
build ANNOTATE_EXPR if present.
(finish_do_stmt): Likewise.
(finish_for_cond): Likewise.
(begin_range_for_stmt): Build RANGE_FOR_STMT with 5th operand.
2017-12-21 Nathan Sidwell <>
PR c++/83406
* parser.c (cp_parser_lambda_body): Remove obsolete
single-return-statement handling.
2017-12-21 Richard Sandiford <>
Alan Hayward <>
David Sherwood <>
* constexpr.c (check_automatic_or_tls): Track polynomial
offsets and sizes.
2017-12-19 Paolo Carlini <>
PR c++/82593
* decl.c (check_array_designated_initializer): Not static.
* cp-tree.h (check_array_designated_initializer): Declare.
* typeck2.c (process_init_constructor_array): Call the latter.
* parser.c (cp_parser_initializer_list): Check the return value
of require_potential_rvalue_constant_expression.
2017-12-19 Martin Sebor <>
PR c++/83394
PR c++/83322
* decl2.c (cplus_decl_attributes): Look up member functions
in the scope of their class.
2017-12-19 Jakub Jelinek <>
* name-lookup.c (get_std_name_hint): Replace Yoda conditions with
typical order conditions.
* class.c (check_bitfield_decl): Likewise.
* pt.c (convert_template_argument): Likewise.
* decl.c (duplicate_decls): Likewise.
* typeck.c (commonparms): Likewise.
2017-12-19 Paolo Carlini <>
* cp-tree.h: Fix typo in comment.
2017-12-18 Marek Polacek <>
PR c++/83116
* constexpr.c (cxx_eval_call_expression): Only look into
constexpr_call_table if ctx->strict.
2017-12-18 Jakub Jelinek <>
PR c++/83300
* decl2.c (save_template_attributes): Add flags argument, if
not ATTR_FLAG_TYPE_IN_PLACE, *decl_p is a type and we want to
modify TYPE_ATTRIBUTES, add them on type attribute variant.
2017-12-18 Nathan Sidwell <>
PR c++/59930
* name-lookup.c (name_lookup::search_unqualified): Don't search
parent namespace when looking for hidden things.
* pt.c (tsubst_friend_class): Always push to friend scope, drop
unneeded self-friend check. Inject new hidden friend into correct
2017-12-15 Jakub Jelinek <>
PR c++/83205
* decl.c (cp_finish_decomp): Handle the case when tsize is not
error_mark_node, but doesn't fit into uhwi. Split up count != eltscnt
and !tree_fits_uhwi_p (tsize) error_at calls into error_n and inform_n
to handle plural forms properly.
PR c++/81197
* cp-tree.h (cp_maybe_mangle_decomp): Declare.
* decl.c (cp_maybe_mangle_decomp): New function.
(cp_finish_decomp): Don't SET_DECL_ASSEMBLER_NAME here.
* parser.c (cp_convert_range_for,
cp_parser_decomposition_declaration): Call cp_maybe_mangle_decomp.
* pt.c (tsubst_expr): Likewise.
* mangle.c (find_decomp_unqualified_name): New function.
(write_unqualified_name): Handle DECL_DECOMPOSITION_P
where DECL_ASSEMBLER_NAME is already set.
PR c++/80135
PR c++/81922
* typeck2.c (digest_init_r): Change nested argument type from bool to
int. Use code instead of TREE_CODE (type) where possible. If
nested == 2, diagnose initialization of flexible array member with
STRING_CST. Pass nested to process_init_constructor. Formatting fix.
(digest_init, digest_init_flags): Adjust digest_init_r caller.
(massage_init_elt): Add nested argument. Pass 2 instead of 1 to
digest_init_r's nested argument if nested is non-zero.
(process_init_constructor_array): Add nested argument. If nested == 2,
diagnose initialization of flexible array member with non-empty
braced enclosed list. Pass nested to massage_init_elt.
(process_init_constructor_record, process_init_constructor_union): Add
nested argument, pass it to massage_init_elt.
(process_init_constructor): Add nested argument, pass it to
* init.c (find_field_init): Renamed to ...
(find_flexarray_init): ... this. Return NULL_TREE if init is
error_mark_node. Don't look through nested CONSTRUCTORs.
(warn_placement_new_too_small): Adjust caller.
PR c++/83217
* decl.c (cp_finish_decomp): If decl's type is REFERENCE_TYPE,
call complete_type (TREE_TYPE (type)).
* tree.c (cxx_attribute_table, std_attribute_table): Swap
affects_type_identity and handler fields, adjust comments.
2017-12-15 Nathan Sidwell <>
PR c++/59930
* decl.c (xref_tag_1): Correct comments about template friends and
default args.
* friend.c (make_friend_class): Move comments concerning
self-friendliness to code dealing with such.
* pt.c (check_default_tmpl_args): Deal with template friend
classes too.
(push_template_decl_real): Check default args for non-function
template friends.
2017-12-14 Bernd Edlinger <>
* decl2.c (start_static_storage_duration_function): Avoid warning.
* typeck.c (cxx_safe_arg_type_equiv_p,
cxx_safe_function_type_cast_p): New function.
(build_reinterpret_cast_1): Implement -Wcast-function-type.
2017-12-14 Jakub Jelinek <>
PR c++/79650
* pt.c (convert_nontype_argument): Diagnose
reduced_constant_expression_p expressions that aren't INTEGER_CST.
2017-12-13 Paolo Carlini <>
PR c++/81061
* typeck.c (cp_build_modify_expr): Upon cxx_readonly_error
immediately return error_mark_node.
2017-12-13 Nathan Sidwell <>
PR c++/15272
* pt.c (tsubst_baselink): Don't repeat the lookup for
non-dependent baselinks.
2017-12-12 Jason Merrill <>
* decl.c (value_dependent_init_p): Check the type of a CONSTRUCTOR.
(type_dependent_init_p): Remove.
PR c++/82115 - ICE with variable initialized with its own address.
* cp-tree.h (struct lang_decl_base): Add dependent_init_p.
* decl.c (cp_finish_decl): Set it.
(duplicate_decls): Copy it.
* pt.c (tsubst_decl): Clear it.
(value_dependent_expression_p): Revert earlier change. Check it.
2017-12-12 Alexandre Oliva <>
* constexpr.c (check_constexpr_ctor_body_1): Skip begin stmt
(constexpr_fn_retval): Likewise.
(potential_constant_expression_1): Likewise.
(cxx_eval_statement_list): Check that a begin stmt marker is
not used as the value of a statement list.
(cxx_eval_constant_expression): Return begin stmt markers
* cp-array-notation.c (stmt_location): New.
(cp_expand_cond_array_notations): Use it.
* cp-objcp-common.h (LANG_HOOKS_EMITS_BEGIN_STMT): Redefine as true.
* parser.c (add_debug_begin_stmt): New.
(cp_parser_statement): Call it.
* pt.c (tsubst_copy): Handle begin stmt markers.
2017-12-07 Martin Sebor <>
PR c/81544
* cp-tree.h (decls_match): Add default argument.
* decl.c (decls_match): Avoid calling into the target back end
and triggering an error.
* decl2.c (cplus_decl_attributes): Look up existing declaration and
pass it to decl_attributes.
* tree.c (cxx_attribute_table): Initialize new member of struct
2017-12-06 Jakub Jelinek <>
PR c++/80259
* decl2.c (grokfield): Diagnose = delete redefinition of a friend.
2017-12-06 Jason Merrill <>
* call.c (convert_for_arg_passing): Pass NULL_TREE to
(type_passed_as): Likewise.
PR c++/82115 - ICE with variable initialized with its own address.
* pt.c (value_dependent_expression_p): Add lval parameter. Don't
consider DECL_INITIAL if it's true.
2017-12-06 David Malcolm <>
PR c/83236
* name-lookup.c (consider_binding_level): Don't suggest names that
are reserved for use by the implementation.
2017-12-06 David Malcolm <>
* name-lookup.c: Include "c-family/c-spellcheck.h".
2017-12-05 Jason Merrill <>
PR c++/82331 - ICE with variadic partial specialization of auto
* pt.c (unify) [TEMPLATE_PARM_INDEX]: Set processing_template_decl
around call to tsubst.
2017-12-05 Nathan Sidwell <>
PR c++/83287
* tree.c (build_min): Check CAST_EXPR arg for OVERLOADs.
2017-12-05 Martin Liska <>
Jakub Jelinek <>
* typeck.c (pointer_diff): Add new argument and instrument
pointer subtraction.
(cp_build_binary_op): Create compound expression if doing an
2017-12-05 Jakub Jelinek <>
* cp-gimplify.c (cp_maybe_instrument_return): Don't add
__builtin_unreachable if -O0 or if -fsanitize=unreachable.
2017-12-04 Jason Merrill <>
PR c++/83273 - constexpr if allows non-constant condition
* semantics.c (finish_if_stmt_cond): Use require_constant_expression
rather than is_constant_expression.
* constexpr.c (potential_constant_expression_1) [LAMBDA_EXPR]: Allow
in C++17.
2017-12-01 Jason Merrill <>
Give #include hints for <complex>.
* name-lookup.c (get_std_name_hint): Add <complex>.
* parser.c (cp_parser_diagnose_invalid_type_name): Call
(cp_parser_namespace_name): Likewise.
PR c++/79228 - extensions hide C++14 complex literal operators
* parser.c (cp_parser_userdef_numeric_literal): Be helpful about
'i' in C++14 and up.
2017-12-01 Jakub Jelinek <>
* parser.c (cp_parser_new): Don't clear cilk_simd_fn_info.
(parsing_nsdmi): Adjust comment.
(cp_parser_omp_for_loop_init): Likewise.
* parser.h (struct cp_omp_declare_simd_data): Adjust comment.
(struct cp_parser): Remove cilk_simd_fn_info field.
* cp-tree.h (cilk_valid_spawn): Remove.
PR c/79153
* cp-gimplify.c (genericize_switch_stmt): Emit LABEL_EXPR for the
break label into SWITCH_BODY instead of after it and set
* parser.c (cp_parser_objc_expression): Add FALLTHRU comment to avoid
-Wimplicit-fallthrough warning.
2017-11-30 Jason Merrill <>
PR c++/82219 - bogus -Wignored-qualifiers with template
* pt.c (tsubst_copy_and_build) [STATIC_CAST_EXPR]: Suppress
2017-11-29 David Malcolm <>
* parser.c (cp_parser_unary_expression): Generate a location for
(cp_parser_trait_expr): Generate and return a location_t,
converting the return type from tree to cp_expr.
(cp_parser_static_assert): Pass location of the condition to
finish_static_assert, rather than that of the "static_assert"
token, where available.
2017-11-29 Paolo Carlini <>
PR c++/82293
* lambda.c (nonlambda_method_basetype): Don't use LAMBDA_TYPE_P
on a null type.
2017-11-29 Jason Merrill <>
PR c++/82760 - memory corruption with aligned new.
* call.c (build_operator_new_call): Update *args if we add the
2017-11-28 Jakub Jelinek <>
PR sanitizer/81275
* cp-tree.h (SWITCH_STMT_ALL_CASES_P): Define.
(note_break_stmt, note_iteration_stmt_body_start,
note_iteration_stmt_body_end): Declare.
* decl.c (struct cp_switch): Add has_default_p, break_stmt_seen_p
and in_loop_body_p fields.
(push_switch): Clear them.
(pop_switch): Set SWITCH_STMT_CANNOT_FALLTHRU_P if has_default_p
and !break_stmt_seen_p. Assert in_loop_body_p is false.
(note_break_stmt, note_iteration_stmt_body_start,
note_iteration_stmt_body_end): New functions.
(finish_case_label): Set has_default_p when both low and high
* parser.c (cp_parser_iteration_statement): Use
note_iteration_stmt_body_start and note_iteration_stmt_body_end
around parsing iteration body.
* pt.c (tsubst_expr): Likewise.
* cp-objcp-common.c (cxx_block_may_fallthru): Return false for
SWITCH_STMT which contains no BREAK_STMTs, contains a default:
CASE_LABEL_EXPR and where SWITCH_STMT_BODY isn't empty and
can't fallthru.
* semantics.c (finish_break_stmt): Call note_break_stmt.
* cp-gimplify.c (genericize_switch_stmt): Copy SWITCH_STMT_ALL_CASES_P
bit to SWITCH_ALL_CASES_P. Assert that if SWITCH_STMT_NO_BREAK_P then
the break label is not TREE_USED.
2017-11-28 Julia Koval <>
Sebastian Peryt <>
* (cp/cp-array-notation.o, cp/cp-cilkplus.o): Delete.
* call.c (convert_for_arg_passing, build_cxx_call): Remove cilkplus.
* constexpr.c (potential_constant_expression_1): Ditto.
* cp-array-notation.c: Delete.
* cp-cilkplus.c: Ditto.
* cp-cilkplus.h: Ditto.
* cp-gimplify.c (cp_gimplify_expr, cp_fold_r, cp_genericize): Remove
cilkplus condition.
* cp-objcp-common.c (ARRAY_NOTATION_REF): Delete.
* cp-tree.h (cilkplus_an_triplet_types_ok_p): Delete.
* decl.c (grokfndecl, finish_function): Remove cilkplus condition.
* error.c (dump_decl, dump_expr): Remove ARRAY_NOTATION_REF condition.
* lambda.c (cp-cilkplus.h): Remove.
* parser.c (cp_parser_cilk_simd, cp_parser_cilk_for,
cp_parser_cilk_simd_vectorlength): Delete.
(cp_debug_parser, cp_parser_ctor_initializer_opt_and_function_body,
cp_parser_statement, cp_parser_jump_statement,
cp_parser_late_return_type_opt, cp_parser_gnu_attribute_list,
cp_parser_omp_clause_name, cp_parser_omp_clause_aligned,
cp_parser_omp_clause_linear, cp_parser_omp_all_clauses,
cp_parser_omp_for_cond, cp_parser_omp_for_incr,
cp_parser_omp_declare_simd): Remove cilkplus support.
(CILK_SIMD_FN_CLAUSE_MASK, cp_parser_late_parsing_cilk_simd_fn_info,
cp_parser_cilk_grainsize): Remove.
(cp_parser_pragma, c_parse_file): Remove cilkplus support.
(cp_parser_cilk_simd_vectorlength, cp_parser_cilk_simd_linear,
cp_parser_cilk_simd_clause_name, cp_parser_cilk_simd_all_clauses,
cp_parser_cilk_simd, cp_parser_cilk_for): Remove.
* parser.h (IN_CILK_SIMD_FOR, IN_CILK_SPAWN): Remove.
* pt.c (tsubst_attribute, tsubst_expr, tsubst_copy_and_build): Remove
cilkplus support.
* semantics.c (finish_goto_stmt, begin_while_stmt, finish_do_body,
finish_init_stmt, finish_switch_cond, simplify_aggr_init_expr,
finish_omp_clauses, finish_omp_clauses, finish_omp_for): Remove
* tree.c (lvalue_kind): Remove ARRAY_NOTATION_REF conditon.
* typeck.c (cp_build_array_ref, cp_build_compound_expr,
check_return_expr): Remove cilkplus support.
2017-11-28 Jakub Jelinek <>
* cp-gimplify.c (genericize_switch_stmt): Build SWITCH_EXPR using
build2_loc instead of build3_loc.
2017-11-27 Martin Sebor <>
PR c++/83058
* init.c (warn_placement_new_too_small): Use offset_int instead of
2017-11-27 Jakub Jelinek <>
PR c++/81888
* parser.c (cp_parser_decomposition_declaration): Reject just
BRACE_ENCLOSED_INITIALIZER_P initializers with nelts != 1 rather
than all such CONSTRUCTORs, and only if is_direct_init is true.
2017-11-27 Jason Merrill <>
* pt.c (primary_template_specialization_p): Rename from
primary_template_instantiation_p. Don't check
* call.c, cp-tree.h, decl2.c: Adjust.
2017-11-27 Jakub Jelinek <>
PR c++/81675
* cp-gimplify.c (cp_fold) <case COND_EXPR>: Don't return immediately
for VOID_TYPE_P COND_EXPRs, instead fold the operands and if op0 is
INTEGER_CST, ensure that both op1 and op2 are non-NULL and fall
through into normal folding, otherwise just rebuild x if any op
2017-11-14 Boris Kolpackov <>
* (c++.install-plugin): Install backend import library.
2017-11-23 Jakub Jelinek <>
* parser.c (cp_parser_omp_declare): Change return type to bool from
void, return true for declare simd.
(cp_parser_pragma): Return cp_parser_omp_declare returned value
rather than always false.
2017-11-23 Mike Stump <>
Eric Botcazou <>
* pt.c (tsubst_expr) <ANNOTATE_EXPR>: Recurse on 3rd operand.
* semantics.c (finish_while_stmt_cond): Pass 3rd operand to
(finish_do_stmt): Likewise.
(finish_for_cond): Likewise.
2017-11-22 Jakub Jelinek <>
PR c++/82401
* name-lookup.c (member_name_cmp): Return 0 if a == b.
2017-11-22 David Malcolm <>
PR c++/62170
* error.c (type_to_string): Add leading comment. Add params
"postprocessed", "quote", and "show_color", using them to fix
quoting of the "aka" for types involving typedefs.
(arg_to_string): Update for new params to type_to_string.
(cxx_format_postprocessor::handle): Likewise.
(cp_printer): Convert penultimate param from bool to bool *.
Update call to type_to_string and calls to
2017-11-22 Marek Polacek <>
PR c++/60336
PR middle-end/67239
PR target/68355
* class.c (layout_class_type): Set DECL_PADDING_P on padding.
* decl.c (cxx_init_decl_processing): Set TRANSLATION_UNIT_WARN_EMPTY_P.
(grokdeclarator): Set DECL_PADDING_P on unnamed bit-fields.
2017-11-21 Martin Liska <>
* class.c (finalize_literal_type_property): Add quotes for
constexpr keyword.
(explain_non_literal_class): Likewise.
* constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
(is_valid_constexpr_fn): Likewise.
(check_constexpr_ctor_body): Likewise.
(register_constexpr_fundef): Likewise.
(explain_invalid_constexpr_fn): Likewise.
(cxx_eval_builtin_function_call): Likewise.
(cxx_eval_call_expression): Likewise.
(cxx_eval_loop_expr): Likewise.
(potential_constant_expression_1): Likewise.
* decl.c (check_previous_goto_1): Likewise.
(check_goto): Likewise.
(grokfndecl): Likewise.
(grokdeclarator): Likewise.
* error.c (maybe_print_constexpr_context): Likewise.
* method.c (process_subob_fn): Likewise.
(defaulted_late_check): Likewise.
* parser.c (cp_parser_compound_statement): Likewise.
2017-11-21 Marc Glisse <>
* constexpr.c (cxx_eval_constant_expression,
potential_constant_expression_1): Handle POINTER_DIFF_EXPR.
* cp-gimplify.c (cp_fold): Likewise.
* error.c (dump_expr): Likewise.
* typeck.c (pointer_diff): Use POINTER_DIFF_EXPR.
2017-11-21 Jakub Jelinek <>
P0428R2 - familiar template syntax for generic lambdas
* parser.c (cp_parser_lambda_declarator_opt): Don't pedwarn
for cxx2a and above, reword pedwarn for C++14/C++17.
2017-11-20 David Malcolm <>
PR c/81404
* name-lookup.c: Include "c-family/known-headers.h"
(lookup_name_fuzzy): Call get_cp_stdlib_header_for_name and
potentially return a new suggest_missing_header hint.
2017-11-20 David Malcolm <>
PR c++/72786
* name-lookup.c (class macro_use_before_def): New class.
(lookup_name_fuzzy): Detect macro that were used before being
defined, and report them as such.
2017-11-20 Jason Merrill <>
* decl2.c (constrain_class_visibility): Don't warn about artificial
2017-11-20 Jakub Jelinek <>
P0329R4: Designated Initialization
* parser.c (cp_parser_initializer_clause): List in comment grammar
(cp_parser_initializer_list): Allow .identifier = without pedwarn for
C++2A, parse .identifier { ... }. Improve location_t argument to
pedwarn. Add pedwarn for [cst] = designators. Diagnose ... in
designated initializer list. Diagnose mixing designated and
non-designated initializer clauses for C++2A. Diagnose duplicated
identifiers in designators.
* name-lookup.h (search_anon_aggr): New declaration.
* name-lookup.c (fields_linear_search): Use search_anon_aggr.
(search_anon_aggr): New function.
* typeck2.c (process_init_constructor_record): Allow designator
to skip over some non-static data members. Handle anonymous
aggregates. Add diagnostics for designator order not matching
member declaration order.
2017-11-20 David Malcolm <>
* name-lookup.c: Define INCLUDE_UNIQUE_PTR before including system.h.
Include "c-family/name-hint.h"
(suggest_alternatives_for): Convert "fuzzy_name" from const char *
to name_hint, and rename to "hint". Pass location to
(lookup_name_fuzzy): Convert return type from const char *
to name_hint. Add location_t param.
* parser.c: Define INCLUDE_UNIQUE_PTR before including system.h.
Include "c-family/name-hint.h"
(cp_parser_diagnose_invalid_type_name): Convert
"suggestion" from const char * to name_hint, and rename to "hint".
Pass location to lookup_name_fuzzy.
2017-11-20 Nathan Sidwell <>
PR c++/82878
PR c++/78495
* call.c (build_call_a): Don't set CALL_FROM_THUNK_P for inherited
* cp-gimplify.c (cp_genericize_r): Restore THUNK dereference
inhibibition check removed in previous c++/78495 change.
2017-11-20 Jakub Jelinek <>
PR c++/82781
* constexpr.c (cxx_eval_vector_conditional_expression): New function.
(cxx_eval_constant_expression) <case VEC_COND_EXPR>: Use it instead
of cxx_eval_conditional_expression.
2017-11-19 Jakub Jelinek <>
PR c/66618
PR c/69960
* cp-gimplify.c (c_fully_fold): Add LVAL argument, call
cp_fold_maybe_rvalue instead of cp_fold_rvalue and pass it !LVAL.
2017-11-16 Jason Merrill <>
PR c++/79092 - non-type args of different types are different
* tree.c (cp_tree_equal): Check the type of constants.
when comparing to previously deduced argument.
(maybe_convert_nontype_argument): New.
(convert_nontype_argument): Call it.
(tsubst_copy_and_build): Handle partial instantiation of
(unify): Ignore type when deducing from array bound.
(dependent_type_p_r): Handle DEFERRED_NOEXCEPT.
(value_dependent_expression_p): Any type-dependent expression is
value-dependent. Handle IMPLICIT_CONV_EXPR.
* mangle.c (write_template_arg): Strip IMPLICIT_CONV_EXPR.
2017-11-16 Nathan Sidwell <>
PR c++/82836
PR c++/82737
* cp-tree.h (overwrite_mangling): Declare.
* decl2.c (struct mangled_decl_hash): Entries are deletable.
(overwrite_mangling): New.
PR c++/81060
* decl.c (xref_tag_1): Push lambda into current scope.
* name-lookup.c (do_pushtag): Don't deal with ts_lambda here.
2017-11-15 Nathan Sidwell <>
PR c++/81574
* lambda.c (lambda_capture_field_type): Function references are
always catured by reference.
2017-11-15 Martin Liska <>
* decl.c (begin_destructor_body): Use cp_build_fold_indirect_ref
instead of cp_build_indirect_ref.
2017-11-15 Martin Liska <>
* decl.c (begin_destructor_body): In case of VPTR sanitization
(with disabled recovery), zero vptr in order to catch virtual calls
after lifetime of an object.
2017-11-14 Jason Merrill <>
Use GTY((cache)) on some hash tables.
* decl.c (decomp_type_table): Use tree_cache_map.
* init.c (nsdmi_inst): Likewise.
* pt.c (defarg_ints): Likewise.
* cp-objcp-common.c (cp_get_debug_type): Likewise.
2017-11-13 Jason Merrill <>
Capture adjustments for P0588R1.
* semantics.c (process_outer_var_ref): Capture variables when
they are named; complain about non-capture uses when odr-used.
* expr.c (mark_use): Rvalue use looks through capture proxy.
* constexpr.c (potential_constant_expression_1): Improve error about
use of captured variable.
* lambda.c (need_generic_capture, dependent_capture_r)
(do_dependent_capture, processing_nonlambda_template): Remove.
* call.c (build_this): Remove uses of the above.
* decl.c (cp_finish_decl): Likewise.
* semantics.c (maybe_cleanup_point_expr)
(maybe_cleanup_point_expr_void, finish_goto_stmt)
(maybe_convert_cond): Likewise.
* typeck.c (check_return_expr): Likewise.
Defer folding of *&.
* typeck.c (cp_build_fold_indirect_ref): New.
(cp_build_indirect_ref_1): Split out from cp_build_indirect_ref.
Add 'fold' parameter.
* cp-tree.h: Declare cp_build_fold_indirect_ref.
* call.c, class.c, cp-ubsan.c, decl.c, except.c, init.c, lambda.c,
parser.c, rtti.c, tree.c, typeck.c, typeck2.c: Use it.
* parser.c (do_range_for_auto_deduction): Use RO_UNARY_STAR.
(cp_convert_range_for): Likewise.
* typeck2.c (build_x_arrow): Use RO_ARROW.
* cp-ubsan.c (cp_ubsan_check_member_access_r): Fix handling of
PR c++/82360 - ICE with static_cast in template.
* call.c (perform_direct_initialization_if_possible): Check
* typeck.c (build_static_cast_1): Likewise.
2017-11-13 Ville Voutilainen <>
Remove the null check from placement new in all modes
* init.c (build_new_1): Don't do a null check for
a namespace-scope non-replaceable placement new
in any mode unless -fcheck-new is provided.
2017-11-07 Boris Kolpackov <>
* (CP_PLUGIN_HEADERS): Add operators.def since included
in cp-tree.h.
2017-11-07 Jakub Jelinek <>
PR c++/82835
* cp-gimplify.c (cxx_omp_clause_apply_fn): For methods pass i - 1 to
convert_default_arg instead of i.
2017-11-06 Jason Merrill <>
P0704R1 - fixing const-qualified pointers to members
* typeck2.c (build_m_component_ref): Also accept in lower stds with
a pedwarn.
2017-11-06 Paolo Carlini <>
PR c++/65579
* decl2.c (finish_static_data_member_decl): If there's an initializer,
complete the type and re-apply the quals.
2017-11-06 Martin Liska <>
PR middle-end/82404
* constexpr.c (cxx_eval_builtin_function_call): Handle
__builtin_unreachable call.
(get_function_named_in_call): Declare function earlier.
(constexpr_fn_retval): Skip __builtin_unreachable.
* cp-gimplify.c (cp_ubsan_maybe_instrument_return): Rename to
(cp_maybe_instrument_return): ... this.
(cp_genericize): Call the function unconditionally.
2017-11-03 Nathan Sidwell <>
PR c++/82710
* decl.c (grokdeclarator): Protect MAYBE_CLASS things from paren
warning too.
2017-11-02 Paolo Carlini <>
PR c++/81957
* pt.c (make_pack_expansion): Add tsubst_flags_t parameter.
(expand_integer_pack, convert_template_argument, coerce_template_parms,
gen_elem_of_pack_expansion_instantiation, tsubst_pack_expansion,
unify): Adjust calls.
* tree.c (cp_build_qualified_type_real): Likewise.
* cp-tree.h (make_pack_expansion): Adjust declaration.
2017-11-02 Nathan Sidwell <>
* cp-tree.h (IDENTIFIER_NEWDEL_OP_P): Restore, adjust.
* decl.c (grokdeclarator): Restore IDENTIFIER_NEWDEL_OP_P use.
* pt.c (push_template_decl_real): Likewise.
* typeck.c (check_return_expr): Use IDENTIFIER_NEW_OP_P.
PR c++/82710
* decl.c (grokdeclarator): Don't warn when parens protect a return
type from a qualified name.
2017-11-01 Nathan Sidwell <>
* cp-tree.h (enum cp_identifier_kind): Delete cik_newdel_op.
Renumber and reserve udlit value.
* decl.c (grokdeclarator): Use IDENTIFIER_OVL_OP_FLAGS.
* lex.c (get_identifier_kind_name): Adjust.
(init_operators): Don't special case new/delete ops.
* mangle.c (write_unqualified_id): Use IDENTIFIER_OVL_OP_P.
* pt.c (push_template_decl_real): Use IDENTIFIER_OVL_OP_FLAGS.
* typeck.c (check_return_expr): Likewise.
* cp-tree.h (assign_op_identifier, call_op_identifier): Use
compressed code.
(struct lang_decl_fn): Use compressed operator code.
* decl.c (duplicate_decls): Use DECL_OVERLOADED_OPERATOR_CODE_RAW.
(build_library_fn): Likewise.
(grok_op_properties): Likewise.
* mangle.c (write_unqualified_name): Likewise.
* method.c (implicitly_declare_fn): Likewise.
* typeck.c (check_return_expr): Use DECL_OVERLOADED_OPERATOR_IS.
* cp-tree.h (IDENTIFIER_CP_INDEX): Define.
(enum ovl_op_flags): Add OVL_OP_FLAG_AMBIARY.
(enum ovl_op_code): New.
(struct ovl_op_info): Add ovl_op_code field.
(ovl_op_info): Size by OVL_OP_MAX.
(ovl_op_mapping, ovl_op_alternate): Declare.
(OVL_OP_INFO): Adjust for mapping array.
* decl.c (ambi_op_p, unary_op_p): Delete.
(grok_op_properties): Use IDENTIFIER_OVL_OP_INFO and
* lex.c (ovl_op_info): Adjust and static initialize.
(ovl_op_mappings, ovl_op_alternate): Define.
(init_operators): Iterate over ovl_op_info array and init mappings
& alternate arrays.
* mangle.c (write_unqualified_id): Use IDENTIFIER_OVL_OP_INFO.
* operators.def (DEF_OPERATOR): Remove KIND parm.
(OPERATOR_TRANSITION): Expand if defined.
2017-10-31 David Malcolm <>
* pt.c (listify): Use %< and %> for description of #include.
2017-10-31 David Malcolm <>
* class.c (explain_non_literal_class): Use UNKNOWN_LOCATION rather
than 0.
* name-lookup.c (suggest_alternatives_for): Update for renaming of
(maybe_suggest_missing_header): Likewise.
(suggest_alternative_in_explicit_scope): Likewise.
* parser.c (cp_parser_diagnose_invalid_type_name): Likewise for
renaming of error_at_rich_loc.
(cp_parser_string_literal): Likewise.
(cp_parser_nested_name_specifier_opt): Likewise.
(cp_parser_cast_expression): Likewise for renaming of
(cp_parser_decl_specifier_seq): Likewise for renaming of
error_at_rich_loc and warning_at_rich_loc.
(cp_parser_elaborated_type_specifier): Likewise for renaming of
(cp_parser_cv_qualifier_seq_opt): Likewise for renaming of
(cp_parser_virt_specifier_seq_opt): Likewise.
(cp_parser_class_specifier_1): Likewise.
(cp_parser_class_head): Likewise.
(cp_parser_member_declaration): Likewise for renaming of
pedwarn_at_rich_loc, warning_at_rich_loc, and error_at_rich_loc.
(cp_parser_enclosed_template_argument_list): Likewise for renaming
of error_at_rich_loc.
(set_and_check_decl_spec_loc): Likewise.
* pt.c (listify): Likewise.
* rtti.c (typeid_ok_p): Likewise.
* semantics.c (process_outer_var_ref): Use UNKNOWN_LOCATION rather
than 0.
* typeck.c (access_failure_info::maybe_suggest_accessor): Update
for renaming of inform_at_rich_loc.
(finish_class_member_access_expr): Likewise for renaming of
2017-10-31 Nathan Sidwell <>
* cp-tree.h (struct operator_name_info_t): Rename to ...
(struct ovl_op_info_t): ... here. Add tree_code field.
(operator_name_info, assignment_operator_name_info): Delete.
(ovl_op_info): Declare.
(OVL_OP_INFO): Adjust.
* decl.c (grok_op_properties): Use ovl_op_flags.
* lex.c (operator_name_info, assignment_operator_name_info):
(ovl_op_info): Define.
(set_operator_ident): Adjust.
(init_operators): Set tree_code.
* mangle.c (write_unqualified_id): Adjust operator array scan.
* lex.c (init_operators): Allow NULL operator name. Don't add
special cases.
* operators.def: Use NULL for mangling only operators. Move to
after regular operators but move assignment operators last.
* cp-tree.h (enum ovl_op_flags): New.
(struct operator_name_info_t): Rename arity to flags.
* lex.c (set_operator_ident): New.
(init_operators): Use it. Adjust for flags.
* mangle.c (write_unqualified_id): Adjust for flags.
* operators.def: Replace arity with flags.
* cp-tree.h (ovl_op_identifier): New.
(assign_op_identifier, call_op_identifier): Adjust.
(cp_operator_id, cp_assignment_operator_ide): Delete.
* call.c (op_error): Use OVL_OP_INFO.
(build_conditional_expr_1): Use ovl_op_identifier.
(build_new_op_1): Use OVL_OP_INFO & ovl_op_identifier.
(build_op_delete_call): Likewise.
* class.c (type_requires_array_cookie): Use ovl_op_identifier.
* decl.c (duplicate_decls): Directly copy operator code.
(builtin_function_1): Do not set operator code.
(build_library_fn): Directly set operator code.
(push_cp_library_fn): Use ovl_op_identifier.
(grok_op_properties): Directly set operator code.
* decl2.c (maybe_warn_sized_delete): Use ovl_op_identifier.
* error.c (dump_expr): Use OVL_OP_INFO.
(op_to_string): Add assop arg. Use OVL_OP_INFO.
(assop_to_string): Delete.
(args_to_string): Adjust.
* init.c (build_new_1): Use ovl_op_identifier.
* mangle.c (write_unqualified_name): Use OVL_OP_INFO.
(write_expression): Likewise.
* method.c (synthesized_method_walk): Use ovl_op_identifier.
(implicitly_declare_fn): Use assign_op_identifier. Directly set
operator code.
* name-lookup.c (get_class_binding): Use assign_op_identifier.
* parser.c (cp_parser_operator): Use ovl_op_identifier.
(cp_parser_omp_clause_reduction): Likewise.
* semantics.c (omp_reduction_id): Likewise.
* typeck.c (cxx_sizeof_or_alignof_type): Use OVL_OP_INFO.
* cp-tree.h (assign_op_identifier, call_op_identifier): Define.
(DECL_OVERLOADED_OPERATOR_P): Just retuurn true/false.
* call.c (add_function_candidate): Use
(build_op_call_1): Use call_op_identifier &
(build_over_call): Likewise.
(has_trivial_copy_assign_p): Use assign_op_identifier.
(build_special_member_call): Likewise.
* class.c (dfs_declare_virt_assop_and_dtor): Likewise.
classtype_has_move_assign_or_move_ctor_p): Likewise.
* decl.c (duplicate_decls): Use DECL_OVERLOADED_OPERATOR_CODE.
(grok_special_member_properties): Use assign_op_identifier.
(start_preparsed_function): Use DECL_OVERLOADED_OPERATOR_IS.
* decl2.c (mark_used): Use DECL_CONV_FN_P.
* dump.c (dump_access): Delete prototype.
(dump_op): Delete.
(cp_dump_tree): Don't call it.
* lambda.c (lambda_function): Use call_op_identifier.
(maybe_add_lambda_conv_op): Not an overloaded operator. Remove
unneeded braces.
* mangle.c (write_unqualified_name): Use DECL_OVERLOADED_OPERTOR_CODE.
* method.c (do_build_copy_assign): Use assign_op_identifier.
(synthesize_method): Use DECL_OVERLOADED_OPERATOR_IS.
(get_copy_assign): Use assign_op_identifier.
(synthesized_method_walk): Likewise.
(defaultable_fn_check): Use DECL_OVERLOADED_OPERATOR_IS.
* parser.c (cp_parser_lambda_declarator_opt): Use
* semanitics.c (classtype_has_nothrow_assign_or_copy_p): Use
* tree.c (special_function_p): Use DECL_OVERLOADED_OPERATOR_IS.
* typeck.c (check_return_expr): Use DECL_OVERLOADED_OPERATOR_CODE.
(check_return_expr): Use assign_op_identifier.
2017-10-30 Paolo Carlini <>
PR c++/82085
* pt.c (tsubst_copy_and_build, [INDIRECT_REF]): For a REFERENCE_REF_P,
unconditionally call convert_from_reference.
2017-10-30 Nathan Sidwell <>
* call.c (build_op_call_1): Test for FUNCTION_DECL in same manner
as a few lines earlier.
* cp-tree.h (PACK_EXPANSION_PATTERN): Fix white space.
* decl.c (grokfndecl): Fix indentation.
(compute_array_index_type): Use processing_template_decl_sentinel.
(grok_op_properties): Move warnings to end. Reorder other checks
to group similar entities. Tweak diagnostics.
* lex.c (unqualified_name_lookup_error): No need to check name is
not ERROR_MARK operator.
* parser.c (cp_parser_operator): Select operator code before
looking it up.
* typeck.c (check_return_expr): Fix indentation and line wrapping.
2017-10-27 Paolo Carlini <>
* pt.c (invalid_nontype_parm_type_p): Return a bool instead of an int.
2017-10-26 Nathan Sidwell <>
* decl.c (sort_labels): Restore function.
(pop_labels): Sort labels
(identify_goto): Add translation markup.
2017-10-25 Nathan Sidwell <>
* cp-tree.h (lang_identifier): Delete label_value slot.
(struct named_label_hasher): Rename to ...
(struct named_label_hash): ... here. Reimplement.
(struct language_function): Adjust x_named_labels.
* name-lookup.h (struct cp_label_binding): Delete.
(struct cp_binding_level): Delete shadowed_labels slot.
* decl.c (struct named_label_entry): Add name and outer slots.
(pop_label): Rename to ...
(check_label_used): ... here. Don't pop.
(note_label, sort_labels): Delete.
(pop_labels, pop_local_label): Reimplement.
(poplevel): Pop local labels as any other decl. Remove
shadowed_labels handling.
(named_label_hash::hash, named_label_hash::equal): New.
(make_label_decl): Absorb into ...
(lookup_label_1): ... here. Add making_local_p arg, reimplement.
(lookup_label, declare_local_label): Adjust.
(check_goto, define_label): Adjust.
* lex.c (make_conv_op_name): Don't clear IDENTIFIER_LABEL_VALUE.
* ptree.c (cxx_print_identifier): Don't print identifier binding.
* decl.c (identifier_goto): Reduce duplication.
(check_previous_goto_1): Likewise.
(check_goto): Move var decls to initialization.
(check_omp_return, define_label_1, define_label): Likewise.
2017-10-25 Jakub Jelinek <>
PR libstdc++/81706
* decl.c (duplicate_decls): Copy "omp declare simd" attributes from
newdecl to corresponding __builtin_ if any.
2017-10-24 Paolo Carlini <>
PR c++/82466
* decl.c (duplicate_decls): Warn for built-in functions declared as
non-function, use OPT_Wbuiltin_declaration_mismatch.
* decl.c (duplicate_decls): Avoid redundant '+' in warning_at.
2017-10-24 Paolo Carlini <>
PR c++/80991
* pt.c (value_dependent_expression_p, [TRAIT_EXPR]): Handle
2017-10-24 Mukesh Kapoor <>
Paolo Carlini <>
PR c++/82307
* cvt.c (type_promotes_to): Implement C++17, 7.6/4, about unscoped
enumeration type whose underlying type is fixed.
2017-10-23 Paolo Carlini <>
PR c++/80449
* semantics.c (finish_compound_literal): Check do_auto_deduction
return value for error_mark_node.
2017-10-23 Jason Merrill <>
PR c++/77369 - wrong noexcept handling in C++14 and below
* tree.c (strip_typedefs): Canonicalize TYPE_RAISES_EXCEPTIONS.
2017-10-20 Nathan Sidwell <>
* class.c (layout_class_type): Cleanup as-base creation, determine
mode here.
(finish_struct_1): ... not here.
2017-10-19 Jakub Jelinek <>
PR c++/82600
* typeck.c (check_return_expr): Don't call
maybe_warn_about_returning_address_of_local in templates.
2017-10-17 Nathan Sidwell <>
PR c++/82560
* call.c (build_over_call): Don't pass tf_no_cleanup to nested
PR middle-end/82546
* cp-objcp-common.c (cp_tree_size): Reformat. Adjust returns size
of TYPE nodes.
2017-10-13 Jason Merrill <>
PR c++/82357 - bit-field in template
* tree.c (cp_stabilize_reference): Just return a NON_DEPENDENT_EXPR.
2017-10-13 David Malcolm <>
* cp-tree.h (maybe_show_extern_c_location): New decl.
* decl.c (grokfndecl): When complaining about literal operators
with C linkage, issue a note giving the location of the
extern "C".
* parser.c (cp_parser_new): Initialize new field
(cp_parser_linkage_specification): Store the location
of the linkage specification within the cp_parser.
(cp_parser_explicit_specialization): When complaining about
template specializations with C linkage, issue a note giving the
location of the extern "C".
(cp_parser_explicit_template_declaration): Likewise for templates.
(maybe_show_extern_c_location): New function.
* parser.h (struct cp_parser): New field
2017-10-12 Nathan Sidwell <>
* cp-tree.h (cp_expr): Add const operator * and operator->
(cp_tree_node_structure_enum): Delete TS_CP_BINDING,
2017-10-12 David Malcolm <>
* parser.c (get_required_cpp_ttype): New function.
(cp_parser_error_1): Call it, using the result to call
2017-10-12 David Malcolm <>
* parser.c (get_matching_symbol): Move to before...
(cp_parser_error): Split out into...
(cp_parser_error_1): ...this new function, merging in content
(cp_parser_required_error): Eliminate partial duplicate
of body of cp_parser_error in favor of a call to the new
cp_parser_error_1 helper function.
2017-10-11 Nathan Sidwell <>
* decl2.c (struct mangled_decl_hash): Use DECL_ASSEMBLER_NAME_RAW.
(record_mangling): Likewise.
2017-10-10 Nathan Sidwell <>
* name-lookup.c (extern_c_fns): Rename to ...
(extern_c_decls): ... here.
(check_extern_c_conflict, extern_c_linkage_bindings): Update.
(do_pushdecl): Check extern-c fns and vars.
* cp-tree.h (default_hash_traits <lang_identifier *>): Delete
* decl2.c (struct mangled_decl_hash): New hash traits.
(mangled_decls): Make hash_table<mangled_decl_hash>.
(generate_mangling_alias, record_mangling): Adjust.
2017-10-10 Jason Merrill <>
More delayed lambda capture fixes.
* call.c (add_function_candidate): Use build_address.
(build_op_call_1): Call mark_lvalue_use early.
(build_over_call): Handle error from build_this.
* constexpr.c (cxx_bind_parameters_in_call): Use build_address.
(cxx_eval_increment_expression): Don't use rvalue().
* cvt.c (convert_to_void): Use mark_discarded_use.
* expr.c (mark_use): Handle PARM_DECL, NON_DEPENDENT_EXPR. Fix
reference handling. Don't copy the expression.
(mark_discarded_use): New.
* lambda.c (insert_capture_proxy): Add some sanity checking.
(maybe_add_lambda_conv_op): Set cp_unevaluated_operand.
* pt.c (register_local_specialization): Add sanity check.
* semantics.c (process_outer_var_ref): Fix check for existing proxy.
* typeck.c (cp_build_addr_expr_1): Handle error from
(cp_build_modify_expr): Call mark_lvalue_use_nonread, handle error
from rvalue.
Handle generic lambda capture in dependent expressions.
* lambda.c (need_generic_capture, dependent_capture_r)
(do_dependent_capture): New.
* pt.c (processing_nonlambda_template): Use need_generic_capture.
* semantics.c (maybe_cleanup_point_expr)
(maybe_cleanup_point_expr_void, finish_goto_stmt)
(maybe_convert_cond): Call do_dependent_capture.
* typeck.c (build_static_cast): Remove dependent capture handling.
* typeck.c (condition_conversion): Assert !processing_template_decl.
* semantics.c (finish_omp_clauses): Don't
fold_build_cleanup_point_expr if processing_template_decl.
(outer_var_p): A temporary can't be from an outer scope.
* pt.c (type_dependent_expression_p): Fix dependency checking of
functions without DECL_TEMPLATE_INFO.
(instantiate_decl): Use lss_copy.
* constexpr.c (is_valid_constexpr_fn): Fix lambdas before C++17.
* typeck.c (check_return_expr): Check non-dependent conversion in
* (check_function_concept): Don't complain about an
empty concept if seen_error.
2017-10-10 Richard Sandiford <>
* cvt.c (ignore_overflows): Use wi::to_wide when
operating on trees as wide_ints.
* decl.c (check_array_designated_initializer): Likewise.
* mangle.c (write_integer_cst): Likewise.
* semantics.c (cp_finish_omp_clause_depend_sink): Likewise.
2017-10-10 Nathan Sidwell <>
* name-lookup.c (set_global_binding): Don't deal with STAT_HACK.
2017-10-06 Paolo Carlini <>
PR c++/47791
* decl.c (finish_function): Take a bool intead of an int; adjust.
* cp-tree.h (finish_function): Adjust declaration.
* decl2.c (generate_tls_wrapper, finish_objects,
finish_static_storage_duration_function): Adjust calls.
* lambda.c (maybe_add_lambda_conv_op, finish_lambda_function):
* method.c (synthesize_method): Likewise.
* optimize.c (maybe_thunk_body, maybe_clone_body): Likewise.
* pt.c (instantiate_decl): Likewise.
* parser.c (cp_parser_function_definition_after_declarator,
cp_parser_late_parsing_for_member, cp_parser_omp_declare_reduction):
cp_parser_function_transaction): Return void; adjust declarations.
2017-10-06 Nathan Sidwell <>
PR c++/82424
* name-lookup.c (check_local_shadow): Don't try and convert
dependent types.
2017-10-06 Jakub Jelinek <>
PR c++/82299
* decl.c (reshape_init): Suppress warn_useless_cast for direct enum
* typeck.c (convert_for_assignment): Likewise.
P0704R1 - fixing const-qualified pointers to members
* typeck2.c (build_m_component_ref): For -std=c++2a allow
pointer to const & qualified method on rvalue.
2017-10-06 Nathan Sidwell <>
Use hash_table for extern "C" names
* name-lookup.c (extern_c_fns): Use hash_table.
(check_extern_c_conflict): Adjust.
(c_linkage_bindings): Adjust.
Use hash_table for namespace bindings
* cp-tree.h (struct named_decl_hash): New.
(lang_decl_ns): Change type of bindings field.
* lex.c (maybe_add_lang_decl_raw): Adjust.
* name-lookup.c (find_namespace_slot): Adjust.
(do_pushdecl): Push NULL-named namespace.
(do_push_nested_namespace): Adjust.
(push_namespace): Push anonymous namespace as NULL name.
2017-10-05 Jason Merrill <>
Pass variadic class objects exactly like named by-value args.
* call.c (convert_arg_to_ellipsis): Use the result of force_rvalue.
2017-10-05 Nathan Sidwell <>
Warn on MVP declarations
* cp-tree.h (struct cp_declarator): Add parenthesized field.
* decl.c (grokdeclarator): Warn about unnecessary parens.
* parser.c (make_declarator): Init parenthesized field.
(cp_parser_direct_declarator): Set parenthesized field.
* name-lookup.h (set_global_binding): Remove NAME parm.
(get_global_binding): New inline fn.
* name-lookup.c (set_global_binding): Remove NAME parm. Adjust.
(identifier_global_value): Move to ...
* cp-objcp-common.c (identifier_global_value): ... here.
* class.c (build_ctor_vtbl_group, build_vtbl_initializer): Adjust.
* decl.c (record_builtin_type, expand_static_init,
grokdeclarator): Adjust.
* decl2.c (get_guard, get_local_tls_init_fn, get_tls_init_fn,
get_tls_wrapper_fn, maybe_warn_sized_delete): Adjust.
* except.c (declare_library_fn, build_throw): Adjust.
* init.c (throw_bad_array_length): Adjust.
* rtti.c (throw_bad_cast, throw_bad_typeid, get_tinfo_decl): Adjust.
* decl2.c (record_mangling): Fix spello and formatting from
previous patch.
2017-10-04 Nathan Sidwell <>
Give builtin types the correct name.
* name-lookup.c (set_global_binding): Assert name is DECL_NAME.
* decl.c (record_builtin_type): Reimplement, use new TYPE_DECL for
2017-10-04 Paolo Carlini <>
Andrew Pinski <>
PR c++/71946
* parser.c (cp_parser_lambda_body): Set parser->in_function_body.
2017-10-04 Nathan Sidwell <>
Move mangling aliases out of global namespace.
* cp-tree.h (record_mangling): New.
(maybe_remove_implicit_alias): Delete.
* decl2.c (mangled_decls): New hash map.
(generate_mangling_alias): Reimplement using mangled_decls.
(record_mangling): New.
* mangle.c (decl_implicit_alias_p,
maybe_remove_implicit_alias): Delete.
(mangle_decl): Use record_mangling.
* name-lookup.c (supplement_binding_1): Remove
maybe_remove_implicit_alias check.
2017-10-04 Jakub Jelinek <>
PR c++/82373
* error.c (dump_function_decl): If show_return, call dump_type_suffix
on the same return type dump_type_prefix has been called on.
2017-10-04 Jason Merrill <>
PR c++/81525 - broken handling of auto in generic lambda.
* pt.c (tsubst_decl) [VAR_DECL]: Use strip_innermost_template_args.
2017-10-04 Nathan Sidwell <>
* call.c (convert_arg_to_ellipsis): Correct comment about passing
by reference.
2017-10-02 Richard Sandiford <>
* constexpr.c (cxx_eval_store_expression): Use wi::to_widest
when comparing the array bounds with an ARRAY_REF index.
2017-09-30 Paolo Carlini <>
PR c++/68754
* method.c (defaulted_late_check): Early return if the defaulted
declaration does not match the expected signature.
2017-09-29 Jakub Jelinek <>
P0683R1 - default member initializers for bit-fields
* cp-tree.h (grokbitfield): Add INIT parameter.
* parser.c (cp_parser_constant_expression): Add STRICT_P argument,
if true, parse a conditional-expression rather than
(cp_parser_member_declaration): For C++11 and later pass true
as STRICT_P to cp_parser_constant_expression. Parse C++2A bitfield
NSDMIs. Adjust grokbitfield caller. Handle DECL_INITIAL also for
(cp_parser_objc_class_ivars): Adjust grokbitfield caller.
* class.c (check_field_decl): Recurse even for DECL_C_BIT_FIELDs.
(check_field_decls): Call check_field_decl even for DECL_C_BIT_FIELDs.
* decl2.c (grokbitfield): Add INIT parameter, pass it to
* pt.c (tsubst_decl): Handle DECL_INITIAL for all FIELD_DECLs, not
just non-bitfields.
* class.c (check_bitfield_decl): Retrieve and clear width from
(check_field_decls): Test DECL_BIT_FIELD_REPRESENTATIVE rather than
(remove_zero_width_bit_fields): Adjust comment.
* decl2.c (grokbitfield): Stash width into
* pt.c (tsubst_decl): For DECL_C_BIT_FIELD, tsubst_expr
* parser.c (cp_parser_member_declaration): Parse attributes before
colon of a bitfield in addition to after colon.
* (check-c++-all): Test also c++2a.
2017-09-28 Jason Merrill <>
PR c++/56973, DR 696 - capture constant variables only as needed.
* expr.c (mark_use): Split out from mark_rvalue_use and
mark_lvalue_use. Handle lambda capture of constant variables.
(mark_lvalue_use_nonread): New.
* semantics.c (process_outer_var_ref): Don't capture a constant
variable until forced.
* pt.c (processing_nonlambda_template): New.
* call.c (build_this): Check it.
* decl2.c (grok_array_decl): Call mark_rvalue_use and
* init.c (constant_value_1): Don't call mark_rvalue_use.
* typeck.c (build_static_cast): Handle lambda capture.
Use local_specializations to find capture proxies.
* cp-tree.h (DECL_CAPTURED_VARIABLE): New.
* lambda.c (build_capture_proxy): Set it.
(add_capture): Pass initializer to build_capture_proxy.
(start_lambda_function): Likewise.
(insert_capture_proxy): Use register_local_specialization.
(is_lambda_ignored_entity): Always ignore proxies.
* name-lookup.c (qualify_lookup): Don't check
is_lambda_ignored_entity if LOOKUP_HIDDEN is set.
* semantics.c (process_outer_var_ref): Use
* parser.c (cp_parser_lambda_body): Push local_specializations.
* pt.c (tsubst_expr): Pass LOOKUP_HIDDEN when looking for a proxy.
(tsubst_lambda_expr): Push local_specializations sooner.
(tsubst_copy_and_build): Don't register_local_specialization.
* call.c (build_special_member_call): Use the return value of
* decl.c (compute_array_index_type): Likewise.
* parser.c (cp_parser_oacc_wait_list): Likewise.
* lambda.c (is_normal_capture_proxy): Handle *this capture.
(add_capture): Clarify internal_error message.
2017-09-22 Eric Botcazou <>
PR bootstrap/81926
* cp-objcp-common.c (cp_get_debug_type): Do only one lookup.
2017-09-22 Jakub Jelinek <>
PR sanitizer/81929
* tree.c (struct replace_placeholders_t): Add pset field.
(replace_placeholders_r): Call cp_walk_tree with d->pset as
last argument instead of NULL. Formatting fix.
(replace_placeholders): Add pset variable, add its address
into data. Pass &pset instead of NULL to cp_walk_tree.
2017-09-22 David Malcolm <>
* call.c (get_fndecl_argument_location): New function.
(convert_like_real): Use it when complaining about argument type
* cp-tree.h (struct cp_parameter_declarator): Add "loc" field.
* parser.c (make_parameter_declarator): Add "loc" param and use
it to initialize the new field.
(cp_parser_translation_unit): Add UNKNOWN_LOCATION for "loc" of
the "no_parameters" parameter.
(cp_parser_parameter_declaration_list): Set the location of the
result of grokdeclarator to be the parameter's loc, assuming no
(cp_parser_parameter_declaration): Generate a location for the
parameter and pass to make_parameter_declarator.
2017-09-20 Nathan Sidwell <>
* name-lookup.c (member_name_cmp): Use DECL_UID for final
2017-09-20 Jakub Jelinek <>
P0409R2 - allow lambda capture [=, this]
* parser.c (cp_parser_lambda_introducer): For cxx2a don't pedwarn on
redundant [=, this].
2017-09-18 Jason Merrill <>
PR c++/82069 - ICE with lambda in template
* semantics.c (process_outer_var_ref): Check uses_template_parms
instead of any_dependent_template_arguments_p.
2017-09-15 Manuel Lopez-Ibanez <>
Paolo Carlini <>
PR c++/64644
* decl2.c (finish_anon_union): Complain about "anonymous union with
no members" with a pedwarn.
2017-09-15 Bernd Edlinger <>
* typeck.c (build_reinterpret_cast_1,
build_const_cast_1): Implement -Wcast-align=strict.
2017-09-15 Jakub Jelinek <>
* decl.c (redeclaration_error_message): Use cxx17 instead of cxx1z,
adjust diagnostics refering to C++1z or -std=gnu++1z or -std=c++1z
to C++17 or -std=gnu++17 or -std=c++17. Adjust comments.
(cxx_init_decl_processing, next_initializable_field,
is_direct_enum_init, check_initializer, cp_finish_decl,
mark_inline_variable, grokdeclarator, grokparms, xref_basetypes,
finish_function): Likewise.
* cp-tree.h (DECL_INLINE_VAR_P): Likewise.
* pt.c (mark_template_parm, convert_nontype_argument,
instantiate_class_template_1, type_unification_real, unify,
get_partial_spec_bindings, dependent_type_p_r): Likewise.
* typeck.c (cp_build_unary_op): Likewise.
* constexpr.c (var_in_maybe_constexpr_fn): Likewise.
* call.c (build_user_type_conversion_1, build_over_call,
build_special_member_call): Likewise.
* lambda.c (begin_lambda_type): Likewise.
* typeck2.c (process_init_constructor_record): Likewise.
* class.c (build_base_field, finalize_literal_type_property,
explain_non_literal_class): Likewise.
* parser.c (cp_parser_diagnose_invalid_type_name,
cp_parser_primary_expression, cp_parser_lambda_introducer,
cp_parser_lambda_declarator_opt, cp_parser_selection_statement,
cp_convert_range_for, cp_parser_perform_range_for_lookup,
cp_parser_decomposition_declaration, cp_parser_linkage_specification,
cp_parser_static_assert, cp_parser_simple_type_specifier,
cp_parser_namespace_definition, cp_parser_using_declaration,
cp_parser_init_declarator, cp_parser_type_parameter_key,
cp_parser_exception_specification_opt, cp_parser_std_attribute_spec,
cp_parser_constructor_declarator_p): Likewise.
* mangle.c (struct globals): Rename need_cxx1z_warning to
(write_exception_spec, start_mangling, mangle_decl): Likewise.
* (check-c++1z): Rename to check-c++17, depend on
(check-c++17): New goal. Use 17 instead of 1z.
(check-c++-all): Use 17 instead of 1z.
2017-09-14 Jakub Jelinek <>
PR c++/81314
* cp-gimplify.c (omp_var_to_track): Look through references.
(omp_cxx_notice_variable): Likewise.
2017-09-13 Nathan Sidwell <>
Conv-op identifers not in identifier hash table
* lex.c (conv_type_hasher): Make member fns inline.
(make_conv_op_name): Directly clone conv_op_identifier.
* cp-tree.h (struct lang_type): Rename methods to members.
* name-lookup.h (get_method_slot): Rename to ...
(get_member_slot): ... this.
(resort_type_method_vec): Rename to ...
(resort_type_member_vec): ... this.
* class.c (add_method, warn_hidden): Adjust.
* search.c (dfs_locate_field_accessor_pre): Adjust.
* name-lookup.c (method_vec_binary_search): Rename to ...
(member_vec_binary_search): ... this and adjust.
(method_vec_linear_search): Rename to ...
(member_vec_linear_search): ... this and adjust.
(fields_linear_search, get_class_binding_direct): Adjust.
(get_method_slot): Rename to ...
(get_member_slot): ... this and adjust.
(method_name_slot): Rename to ...
(member_name_slot): ... this and adjust.
(resort_type_method_vec): Rename to ...
(resort_type_member_vec): ... this and adjust.
(method_vec_append_class_fields): Rename to ...
(member_vec_append_class_fields): ... this and adjust.
(method_vec_append_enum_values): Rename to ...
(member_vec_append_enum_values): ... this and adjust.
(method_vec_dedup): Rename to ...
(member_vec_dedup): ... this and adjust.
(set_class_bindings, insert_late_enum_def_bindings): Adjust.
2017-09-12 Paolo Carlini <>
PR c++/70621
* decl.c (start_decl): Early return error_mark_node if duplicate_decls
returns it; avoid misleading error message.
2017-09-12 Nathan Sidwell <>
* cp-tree.h (struct lang_type): Lose sorted_fields member.
* name-lookup.h (set_class_bindings): Add EXTRA arg.
* name-lookup.c (fields_linear_search): New, broken out of ...
(lookup_field_1): ... here. Delete remainder of function.
(get_class_binding_direct): Reimplement without sorted_fields.
(get_class_binding): Rename TYPE arg to KLASS, for consistency.
(get_method_slot): Call set_class_binding when creating method_vec
on complete type.
(method_name_cmp): Order identically named slots.
(sorted_fields_type_new): Delete.
(field_vc_append_class_fields): Rename to ...
(method_vec_append_class_fields): ... here. Adjust.
(field_vec_append_enum_values): Renme to ...
(method_vec_append_enum_values): ... here. Adjust.
(method_vec_dedup): New.
(set_class_bindings): Reimplement.
(insert_late_enum_def_bindings): Reimplement.
* name-lookup.c (get_class_binding): Rename TYPE arg to KLASS for
(restort_data): Move later.
(method_name_cmp, resort_method_name_cmp): Simplify.
(resort_type_method_vec): Reformat.
2017-09-09 Jason Merrill <>
* constexpr.c (reduced_constant_expression_p): If
CONSTRUCTOR_NO_IMPLICIT_ZERO, check that all fields are initialized.
2017-09-09 Eric Botcazou <>
PR bootstrap/81926
* cp-objcp-common.c (struct debug_type_hasher): New class.
(debug_type_hash): New variable.
(cp_get_debug_type): Associate the OFFSET_TYPEs with the types.
2017-09-08 Jason Merrill <>
PR c++/70029 - ICE with ref-qualifier and -flto
* tree.c (cxx_copy_lang_qualifiers): New.
* cp-tree.h: Declare it.
* cp-objcp-common.h: Define LANG_HOOKS_COPY_LANG_QUALIFIERS.
2017-09-06 Jason Merrill <>
PR c++/82053 - ICE with default argument in lambda in template
* pt.c (tsubst_arg_types): Substitute default arguments for lambdas
in templates.
(retrieve_specialization): Use lambda_fn_in_template_p.
* cp-tree.h: Declare it.
PR c++/82070 - error with nested lambda capture
* pt.c (tsubst_expr) [DECL_EXPR]: Register capture proxies with
2017-09-06 Nathan Sidwell <>
* name-lookup.h (lookup_field_1): Delete.
(get_class_binding_direct, get_class_binding): Add type_or_fns arg.
* name-lookup.c (lookup_field_1): make static
(method_vec_binary_search, method_vec_linear_search): New. Broken
out of ...
(get_class_binding_direct): ... here. Add TYPE_OR_FNS argument.
Do complete search of this level.
(get_class_binding): Adjust.
* decl.c (reshape_init_class): Call get_class_binding.
* search.c (lookup_field_r): Move field searching into
* class.c (warn_hidden): Don't barf on non-functions.
* decl2.c (check_classfn): Likewise. Check template match earlier.
* name-lookup.c (count_fields): Rename to ...
(count_class_fields): ... here. Take a class, don't count
NULL-named fields.
(add_fields_to_record_type): Rename to ...
(field_vec_append_class_fields): ... here. Take a class, don't
add NULL-named fields.
(add_enum_fields_to_record_type): Rename to ...
(field_vec_append_enum_values): ... here.
(set_class_bindings): Adjust, assert we added expected number.
(insert_late_enum_def_bindings): Reimplement. Create vector if
there are now sufficient entries.
* name-lookup.h (lookup_fnfields_slot_nolazy,
lookup_fnfields_slot): Rename to ...
(get_class_binding_direct, get_class_binding): ... here.
* name-lookup.c (lookup_fnfields_slot_nolazy,
lookup_fnfields_slot): Rename to ...
(get_class_binding_direct, get_class_binding): ... here.
* call.c (build_user_type_conversion_1): Adjust.
(has_trivial_copy_assign_p): Adjust.
(has_trivial_copy_p): Adjust.
* class.c (get_basefndecls) Adjust.
(vbase_has_user_provided_move_assign) Adjust.
(classtype_has_move_assign_or_move_ctor_p): Adjust.
(type_build_ctor_call, type_build_dtor_call): Adjust.
* decl.c (register_dtor_fn): Adjust.
* decl2.c (check_classfn): Adjust.
* pt.c (retrieve_specialization): Adjust.
(check_explicit_specialization): Adjust.
(do_class_deduction): Adjust.
* search.c (lookup_field_r): Adjust.
(look_for_overrides_here, lookup_conversions_r): Adjust.
* semantics.c (classtype_has_nothrow_assign_or_copy_p): Adjust.
* tree.c (type_has_nontrivial_copy_init): Adjust.
* method.c (lazily_declare_fn): Adjust comment.
2017-09-05 Nathan Sidwell <>
* name-lookup.c (do_class_using_decl): Elide read-once temps.
Move declarations to initializations.
* class.c (add_method): Move slot search and insertion to ...
* name-lookup.c (get_method_slot): ... this new function.
(lookup_fnfields_slot_nolazy): Cope with NULL slot.
* name-lookup.h (get_method_slot): Declare.
* decl.c (cxx_init_decl_processinng): Give conv_op_marker a more
realistic type.
(grok_special_member_properties): Set
TYPE_HAS_CONVERSION. Expicitly look at DECL_NAME for specialness.
* cp-tree.h (lang_decl_base): Rename template_conv_p to
(DECL_CONV_FN_TYPE): FN must be conv op.
* pt.c (push_template_decl_real): Delete DECL_TEMPLATE_CONV_FN_P
* class.c (unreverse_member_declarations): Remove extraneous if.
* pt.c (push_template_decl_real): Use string concatenation, not
\<newline>. Add %<..%>.
2017-09-05 Paolo Carlini <>
PR c++/81942
* cp-tree.h (LABEL_DECL_CDTOR): Add and document.
* decl.c (start_preparsed_function): Set LABEL_DECL_CDTOR when
creating cdtor_label.
* constexpr.c (returns): Add the case of a constructor/destructor
returning via a LABEL_DECL_CDTOR label.
(cxx_eval_constant_expression, case [GOTO_EXPR]): Likewise.
2017-09-01 Nathan Sidwell <>
* cp-tree.h (resort_type_method_vec): Move declaration to ...
* name-lookup.h (resort_type_method_vec): ... here.
(set_class_bindings): Lose 2nd arg.
* class.c (finish_struct_1, finish_struct): Adjust
set_class_bindings call. Don't call finish_struct_methods.
(resort_data, method_name_cmp, resort_method_name_cmp,
resort_type_method_vec, finish_struct_methods): Move to ...
* name-lookup.c (resort_data, method_name_cmp,
resort_method_name_cmp, resort_type_method_vec): ... here.
(set_class_bindings): Lose fields arg. Swallow finish_struct_methods.
* class.c (finish_struct): Call set_class_bindings for the
template case too.
* class.c (finish_struct_methods): Dont clear DECL_IN_AGGR_P here.
Don't call maybe_warn_about_overly_private_class here.
(warn_hidden): Cleanup declarations and comments.
(type_has_user_provided_constructor): No need to check
(type_has_user_provided_or_explicit_constructor): Likewise.
(classtype_has_move_assign_or_move_ctor_p): Likewise.
(check_bases_and_members): Don't call finish_struct_methods here.
(finish_struct_1): Call finish_struct_methods and
set_class_bindings immediately after layout. Clear DECL_IN_AGGR_P
(finish_struct): For templates process USING_DECLS and clear
DECL_IN_AGGR_P before calling finish_struct_methods. Call
maybe_warn_about_overly_private_class here.
Revert 2017-08-28 Nathan Sidwell <>
Restore sorted_fields vector.
* cp-tree.h (lang_type): Restore sorted_fields vector.
* name-lookup.c (lookup_field_1): Restore binary search.
(sorted_fields_type_new, count_fields,
add_fields_to_record_type, add_enum_fields_to_record_type): Restore
(set_class_bindings): Revert.
(insert_late_enum_def_binding): Restore field_vec insertion.
2017-09-01 Jakub Jelinek <>
PR c/81887
* parser.c (cp_parser_omp_ordered): Handle -fopenmp-simd.
2017-09-01 Marek Polacek <>
PR c++/82040
* typeck.c (cp_build_unary_op): Avoid re-entering reporting routines.
2017-08-30 Jason Merrill <>
PR c++/82029 - __PRETTY_FUNCTION__ in lambda in template
* pt.c (enclosing_instantiation_of, lambda_fn_in_template_p)
(regenerated_lambda_fn_p): New.
(tsubst_decl) [VAR_DECL]: Use enclosing_instantiation_of.
(tsubst_copy) [VAR_DECL]: Likewise.
PR c++/82030 - ICE inheriting from multiple lambdas
PR c++/80767
* call.c (compare_ics): Handle null candidate.
2017-08-30 Ville Voutilainen <>
Make taking the address of an overloaded function a non-deduced context
* pt.c (unify_overload_resolution_failure): Remove.
(unify_one_argument): Adjust.
2017-08-30 Richard Sandiford <>
Alan Hayward <>
David Sherwood <>
* typeck.c (cp_build_binary_op): Use SCALAR_TYPE_MODE.
2017-08-30 Richard Sandiford <>
Alan Hayward <>
David Sherwood <>
* cvt.c (cp_convert_to_pointer): Use SCALAR_INT_TYPE_MODE.
2017-08-30 Richard Sandiford <>
Alan Hayward <>
David Sherwood <>
* mangle.c (write_real_cst): Use SCALAR_FLOAT_TYPE_MODE
instead of TYPE_MODE.
2017-08-29 Jason Merrill <>
PR c++/81236 - ICE with template-id in generic lambda
* semantics.c (finish_id_expression): Remove special dependent case.
Avoid some later pieces when dependent.
(finish_qualified_id_expr): Do normal BASELINK handling in a
template. Always build a SCOPE_REF for a destructor BIT_NOT_EXPR.
(parsing_default_capturing_generic_lambda_in_template): Remove.
* parser.c (cp_parser_postfix_dot_deref_expression): Always give an
error for types that will never be complete.
* mangle.c (write_expression): Add sanity check.
* tree.c (build_qualified_name): Add sanity check.
(cp_walk_subtrees): Walk into the class context of a BASELINK.
* lambda.c (add_capture): Improve diagnostic for generic lambda
capture failure.
* call.c (build_new_method_call_1): Print the right constructor
Reimplement handling of lambdas in templates.
* decl.c (start_preparsed_function): Call start_lambda_scope.
(finish_function): Call finish_lambda_scope.
* init.c (get_nsdmi): Call start/finish_lambda_scope.
* lambda.c (start_lambda_scope): Only ignore VAR_DECL in a function.
* parser.c (cp_parser_function_definition_after_declarator): Don't
call start/finish_lambda_scope.
* pt.c (retrieve_specialization): Ignore lambda functions in
(find_parameter_packs_r): Ignore capture proxies. Look into
(check_for_bare_parameter_packs): Allow bare packs in lambdas.
(tsubst_default_argument): Call start/finish_lambda_scope.
(tsubst_function_decl): Handle lambda functions differently.
(tsubst_template_decl): Likewise.
(tsubst_expr) [DECL_EXPR]: Skip closure declarations and capture
(tsubst_lambda_expr): Create a new closure rather than instantiate
the one from the template.
(tsubst_copy_and_build): Don't register a specialization of a pack.
(regenerate_decl_from_template): Call start/finish_lambda_scope.
(instantiate_decl): Remove special lambda function handling.
* semantics.c (process_outer_var_ref): Remove special generic lambda
handling. Don't implicitly capture in a lambda in a template. Look
for an existing proxy.
* class.c (current_nonlambda_class_type): Use decl_type_context.
(struct tree_lambda_expr): Remove closure and return_type fields.
* lambda.c (build_lambda_expr): Don't set LAMBDA_EXPR_RETURN_TYPE.
* pt.c (tsubst_copy_and_build): Likewise.
* parser.c (cp_parser_lambda_declarator_opt): Track return type.
(cp_parser_lambda_body): Adjust unspecified return type check.
* ptree.c (cxx_print_lambda_node): Don't print closure or
return type.
PR c++/80935 - wrong C++17 error with lambda
* decl.c (check_for_uninitialized_const_var): Check
* constexpr.c (ensure_literal_type_for_constexpr_object): Check
(potential_constant_expression_1): Check var_in_maybe_constexpr_fn.
* lambda.c (build_lambda_object): Check for error_mark_node.
* pt.c (make_pack_expansion): Set PACK_EXPANSION_LOCAL_P on the type
pack as well.
(tsubst_decl) [FUNCTION_DECL]: Set DECL_CONTEXT on the parameters.
(tsubst) [TEMPLATE_PARM_INDEX]: Check for error_mark_node.
PR c++/80767 - unnecessary instantiation of generic lambda
* call.c (convert_like_real): Call build_user_type_conversion_1 if
cand is null.
(add_conv_candidate): Build a ck_user conversion with no candidate.
Fix lambdas in template default argument of inherited ctor.
* method.c (synthesized_method_base_walk): Replace an inherited
template with its specialization.
(synthesized_method_walk): Make inheriting_ctor a pointer.
(maybe_explain_implicit_delete, explain_implicit_non_constexpr)
(deduce_inheriting_ctor, implicitly_declare_fn): Adjust.
* pt.c (build_deduction_guide): Set DECL_ABSTRACT_ORIGIN on the
template, not the function.
(template_guide_p): Adjust.
Support copying local_specializations.
* cp-tree.h (enum lss_policy): New.
(local_specialization_stack): Add policy parameter to default ctor.
* pt.c (local_specialization_stack): Copy local_specializations if
* constexpr.c (potential_constant_expression_1): Add "now" parm.
(is_constant_expression, require_constant_expression): New.
(is_static_init_expression, is_nondependent_constant_expression)
(is_nondependent_static_init_expression): Drop "potential".
* except.c (build_must_not_throw_expr): Do type conversion on
value-dependent argument.
* pt.c, semantics.c, typeck2.c: Use variants without "potential".
Instantiate default arguments/member initializers once.
* init.c (get_nsdmi): Remember NSDMI instantiations.
* parser.c (inject_this_parameter): Be more picky about
* pt.c (tsubst_copy): Simplify 'this' handling.
(tsubst_default_argument): Remember default argument
instantiations. Take parameter number.
(tsubst_default_arguments): Pass it.
* call.c (convert_default_arg): Likewise.
Fix default argument conversion failure and SFINAE.
* call.c (build_over_call): Check convert_default_arg result for
* parser.c (cp_parser_late_parsing_default_args): Remember
2017-08-28 Nathan Sidwell <>
* cp-tree.h (lang_type): Replace sorted_fields vector with
bindings map.
* decl.c (finish_enum_value_list): Swap args of
* name-lookup.c (lookup_field_1): Replace binary search of sorted
fields with map->get.
(sorted_fields_type_new, count_fields,
add_fields_to_record_type, add_enum_fields_to_record_type): Delete.
(add_class_member, add_class_members): New.
(set_class_bindings): Create map and insert.
(insert_late_enum_def_binding): Swap parms. Use add_clasS_member.
* ptree.c (cxx_print_type): Delete sorted fields printing.
* cp-tree.h (insert_late_enum_def_into_classtype_sorted_fields):
* name-lookup.h (set_class_bindings,
insert_late_enum_def_bindings): Declare.
* decl.c (finish_enum_value_list): Adjust for
insert_late_enum_def_bindings name change.
* class.c (finish_struct_1): Call set_class_bindings.
(count_fields, add_fields_to_record_type,
add_enum_fields_to_record_type, sorted_fields_type_new,
insert_late_enum_def_into_classtype_sorted_fields): Move to ...
* name-lookup.h (count_fields, add_fields_to_record_type,
add_enum_fields_to_record_type, sorted_fields_type_new,
set_class_bindings, insert_late_enum_def_bindings): ... here.
2017-08-25 Nathan Sidwell <>
* class.c (method_name_cmp, resort_method_name_cmp): Methods
can never be NULL.
Conversion operators have a special name
(conv_op_marker, conv_op_identifier): New.
* decl.c (initialize_predefined_identifiers): Add
(cxx_init_decl_processing): Create conv_op_marker.
* decl2.c (check_classfn): Lookup conv-ops by name.
* class.c (add_method): Use conv_op_identifier & conv_op_marker.
(resort_type_method_vec): Don't skip conv-ops.
(finish_struct_methods, warn_hidden): Likewise.
* name-lookup.h (lookup_all_conversions): Delete.
* name-lookup.c (lookup_conversion_operator): Replace with ...
(extract_conversion_operator): ... this.
(lookup_fnfields_slot_nolazy): Find conv-ops by name.
(lookup_all_conversions): Delete.
* pt.c (check_explicit_specialization): Find conv-ops by name.
* search.c (lookup_conversions_r): Likewise.
2017-08-24 Nathan Sidwell <>
Conversion operators kept on single overload set
* class.c (add_method): Keep all conv-ops on one slot.
* name-lookup.c (lookup_conversion_operator): Pull the desired
conv op out of overload set.
* search.c (lookup_conversions_r): Lose template/non-template
(lookup_conversions): Likewise.
2017-08-23 Nathan Sidwell <>
* cp-tree.h (lookup_field_1, lookup_fnfields_slot,
lookup_fnfields_slot_nolazy, lookup_all_conversions): Move
declatations to ...
* name-lookup.h (lookup_field_1, lookup_fnfields_slot,
lookup_fnfields_slot_nolazy, lookup_all_conversions): ... here.
* search.c (lookup_conversion_operator,
lookup_fnfields_slot_nolazy, lookup_field_1, lookup_fnfields_slot,
lookup_all_conversions): Move to ...
* name-lookup.c (lookup_conversion_operator,
lookup_fnfields_slot_nolazy, lookup_field_1, lookup_fnfields_slot,
lookup_all_conversions): ... here.
* semantics.c (finish_member_declaration): Move USING_DECL check
earlier. Always set C++ linkage. Commonize TYPE_FIELD and
template decl list insertion.
* cp-tree.h (maybe_version_functions): Declare.
* decl.c (decls_match): Break function versioning check to
separate function. Call it.
(maybe_version_functions): Broken out of decls_match.
* class.c (add_method): Use maybe_version_functions.
* cp-tree.h (print_search_statistics,
reinit_search_statistics): Don't declare.
* search.c (n_fields_searched, n_calls_lookup_field,
n_calls_lookup_field_1, n_calls_lookup_fnfields,
n_calls_lookup_fnfields_1, n_calls_get_base_type,
n_outer_fields_searched, n_contexts_saved): Delete.
(lookup_field_1, lookup_member,
lookup_fnfields_slot_nolazy): Remove stat gathering.
(print_search_statistics, reinit_search_statistics): Delete.
* tree.c (cxx_print_statistics): Don't print search stats.
2017-08-21 Nathan Sidwell <>
* search.c (lookup_field_r): Remove obsolete code for type-named
field in PoD.
* search.c (lookup_field_1): Assert TYPE is a class and VFIELD
isn't special.
(lookup_field_fuzzy_info::fuzzy_lookup_fnfields): Delete.
(lookup_field_fuzzy_r): Adjust.
2017-08-21 David Malcolm <>
* call.c (build_over_call): Pass NULL for new parameter to
* typeck.c (cp_build_function_call_vec): Likewise.
2017-08-21 Nathan Sidwell <>
PR c++/81899
* pt.c (instantiate_class_template_1):
BOUND_TEMPLATE_TEMPLATE_PARM is never friend-injected.
2017-08-18 David Malcolm <>
PR c++/81514
* name-lookup.c (maybe_suggest_missing_header): Convert return
type from void to bool; return true iff a suggestion was offered.
(suggest_alternative_in_explicit_scope): Move call to
maybe_suggest_missing_header to before use of best_match, and
return true if the former offers a suggestion.
2017-08-18 H.J. Lu <>
PR c/53037
* decl.c (duplicate_decls): Also merge DECL_WARN_IF_NOT_ALIGN.
* decl2.c (grokbitfield): Don't allow bit-field with
warn_if_not_aligned type.
2017-08-17 Nathan Sidwell <>
* cp-tree.def (TEMPLATE_TEMPLATE_PARM): Remove stale comment.
* cp-tree.h (ENUM_TEMPLATE_INFO): Delete.
* lex.c (maybe_add_lang_type_raw): BOUND_TEMPLATE_TEMPLATE_PARMs
don't need lang_type.
(cxx_make_type): Use maybe_add_lang_type_raw return value.
* mangle.c (CLASSTYPE_TEMPLATE_ID_P): Don't rely on
* cp-tree.h (struct lang_type): Remove template_info field.
2017-08-14 Martin Sebor <>
PR c/81117
* error.c (cp_printer): Handle 'G'.
2017-08-11 Martin Liska <>
* decl2.c (get_tls_init_fn): Replace ASM_OUTPUT_DEF with
(handle_tls_init): Likewise.
(note_mangling_alias): Likewise. Remove ATTRIBUTE_UNUSED for
both arguments.
* optimize.c (can_alias_cdtor): Likewise.
2017-08-11 Jason Merrill <>
PR c++/81671 - nullptr_t template parameter
* pt.c (convert_nontype_argument): Fix nullptr_t check.
2017-08-10 Jason Merrill <>
PR c++/81359 - Unparsed NSDMI error from SFINAE context.
* method.c (synthesized_method_walk): Don't diagnose lack of
operator delete.
PR c++/80452 - Core 1579, implicit move semantics on return/throw
* cp-tree.h (LOOKUP_PREFER_RVALUE): Now means that we've already
tentatively changed the lvalue to an rvalue.
* call.c (reference_binding): Remove LOOKUP_PREFER_RVALUE handling.
(build_over_call): If LOOKUP_PREFER_RVALUE, check that the first
parameter is an rvalue reference.
* except.c (build_throw): Do maybe-rvalue overload resolution twice.
* typeck.c (check_return_expr): Likewise.
2017-08-10 David Malcolm <>
* parser.c (cp_parser_error): Update for new param to
(class token_pair): New class.
(struct matching_paren_traits): New struct.
(matching_parens): New typedef.
(struct matching_brace_traits): New struct.
(matching_braces): New typedef.
(cp_parser_statement_expr): Convert explicit parsing of
class matching_parens, so that the pertinent open parenthesis is
highlighted when there are problems locating the close
(cp_parser_primary_expression): Likewise.
(cp_parser_compound_literal_p): Remove consumption of opening
(cp_parser_postfix_expression): Convert explicit parsing of
CPP_OPEN_PAREN and CPP_CLOSE_PAREN to use matching parens, as
above. Use it to consume the opening paren previously consumed by
(cp_parser_parenthesized_expression_list): Likewise.
(cp_parser_unary_expression): Likewise.
(cp_parser_new_expression): Likewise.
(cp_parser_cast_expression): Likewise.
(cp_parser_builtin_offsetof): Likewise.
(cp_parser_trait_expr): Likewise.
(cp_parser_lambda_declarator_opt): Likewise.
(cp_parser_lambda_body): Likewise, for matching_braces.
(cp_parser_compound_statement): Likewise.
(cp_parser_selection_statement): Likewise, for matching_parens.
(cp_parser_iteration_statement): Likewise.
(cp_parser_already_scoped_statement): Likewise, for
(cp_parser_linkage_specification): Likewise.
(cp_parser_static_assert): Likewise, for matching_parens.
(cp_parser_decltype): Likewise.
(cp_parser_operator): Likewise.
(cp_parser_enum_specifier): Likewise.
(cp_parser_namespace_definition): Likewise.
(cp_parser_direct_declarator): Likewise.
(cp_parser_braced_list): Likewise.
(cp_parser_class_specifier_1): Likewise, for matching_braces.
(cp_parser_constant_initializer): Likewise.
(cp_parser_noexcept_specification_opt): Likewise, for
(cp_parser_exception_specification_opt): Likewise.
(cp_parser_handler): Likewise.
(cp_parser_asm_specification_opt): Likewise.
(cp_parser_asm_operand_list): Likewise.
(cp_parser_gnu_attributes_opt): Likewise.
(cp_parser_std_attribute_spec): Likewise.
(cp_parser_requirement_parameter_list): Likewise.
(cp_parser_requirement_body): Likewise, for matching_braces.
(cp_parser_compound_requirement): Likewise.
(cp_parser_template_introduction): Likewise.
(cp_parser_sizeof_pack): Likewise, for matching_parens.
(cp_parser_sizeof_operand): Likewise; use it to consume the
opening paren previously consumed by cp_parser_compound_literal_p.
(get_matching_symbol): New function.
(cp_parser_required_error): Add param "matching_location". Remove
calls to cp_parser_error, instead setting a non-NULL gmsgid, and
handling it if set by calling c_parse_error, potentially with a
secondary location if matching_location was set.
(cp_parser_require): Add param "matching_location", with a default
(cp_parser_require_keyword): Update for new param of
(cp_parser_objc_encode_expression): Update to class matching_parens
as above.
(cp_parser_objc_defs_expression): Likewise.
(cp_parser_objc_protocol_expression): Likewise.
(cp_parser_objc_selector_expression): Likewise.
(cp_parser_objc_typename): Likewise.
(cp_parser_objc_superclass_or_category): Likewise.
(cp_parser_objc_try_catch_finally_statement): Likewise.
(cp_parser_objc_synchronized_statement): Likewise.
(cp_parser_objc_at_property_declaration): Likewise.
(cp_parser_oacc_single_int_clause): Likewise.
(cp_parser_oacc_shape_clause): Likewise.
(cp_parser_omp_clause_collapse): Likewise.
(cp_parser_omp_clause_default): Likewise.
(cp_parser_omp_clause_final): Likewise.
(cp_parser_omp_clause_if): Likewise.
(cp_parser_omp_clause_num_threads): Likewise.
(cp_parser_omp_clause_num_tasks): Likewise.
(cp_parser_omp_clause_grainsize): Likewise.
(cp_parser_omp_clause_priority): Likewise.
(cp_parser_omp_clause_hint): Likewise.
(cp_parser_omp_clause_defaultmap): Likewise.
(cp_parser_omp_clause_ordered): Likewise.
(cp_parser_omp_clause_schedule): Likewise.
(cp_parser_omp_clause_num_teams): Likewise.
(cp_parser_omp_clause_thread_limit): Likewise.
(cp_parser_omp_clause_aligned): Likewise.
(cp_parser_omp_clause_linear): Likewise.
(cp_parser_omp_clause_safelen): Likewise.
(cp_parser_omp_clause_simdlen): Likewise.
(cp_parser_omp_clause_depend): Likewise.
(cp_parser_omp_clause_device): Likewise.
(cp_parser_omp_clause_dist_schedule): Likewise.
(cp_parser_oacc_clause_async): Likewise.
(cp_parser_omp_critical): Likewise.
(cp_parser_omp_for_loop): Likewise.
(cp_parser_omp_sections_scope): Likewise.
(cp_parser_omp_declare_reduction_exprs): Likewise.
Update for new param to cp_parser_required_error.
(cp_parser_oacc_routine): Likewise.
(cp_parser_transaction_expression): Likewise.
(cp_parser_cilk_simd_vectorlength): Likewise.
2017-08-09 Jason Merrill <>
PR c++/81525 - wrong constant value with generic lambda
* pt.c (tsubst_decl) [VAR_DECL]: Avoid clobbering auto.
(tsubst_copy) [VAR_DECL]: Handle auto.
PR c++/81359 - Unparsed NSDMI error from SFINAE context.
* init.c (get_nsdmi): Add complain parm.
* typeck2.c (digest_nsdmi_init): Add complain parm.
(process_init_constructor_record): Pass complain to get_nsdmi.
* pt.c (maybe_instantiate_noexcept): Add complain parm, return bool.
* method.c (get_defaulted_eh_spec): Add complain parm. Pass it into
(synthesized_method_walk): Adjust.
(walk_field_subobs): Pass complain to get_nsdmi.
(defaulted_late_check): Skip other checks if deleted.
* decl2.c (mark_used): Pass complain to maybe_instantiate_noexcept.
* call.c (build_aggr_conv): Pass complain to get_nsdmi.
* parser.c (defarg_location): New.
* error.c (location_of): Use it.
2017-08-09 Marek Polacek <>
* parser.c (cp_parser_perform_range_for_lookup): Use false instead of 0.
* typeck.c (build_binary_op): Change the type of a parameter to bool.
(cp_truthvalue_conversion): Use true instead of 1.
2017-08-08 Marek Polacek <>
PR c++/81607
* cp-gimplify.c (cp_fold): If folding exposed a branch of
a COND_EXPR, convert it to the original type of the COND_EXPR, if
they differ.
2017-08-08 Martin Liska <>
* call.c: Include header files.
* cp-gimplify.c: Likewise.
* cp-ubsan.c: Likewise.
* cvt.c: Likewise.
* init.c: Likewise.
* search.c: Likewise.
* semantics.c: Likewise.
* typeck.c: Likewise.
2017-08-07 Martin Liska <>
* parser.c (cp_parser_gnu_attribute_list): Canonicalize name of an
(cp_parser_std_attribute): Likewise.
* tree.c: Add new include.
2017-08-04 Paolo Carlini <>
PR c++/79790
* pt.c (do_class_deduction): Handle the case of no viable implicit
deduction guides; simplify the code generating implicit deduction
2017-08-03 Paolo Carlini <>
PR c++/71440
* typeck.c (build_x_unary_op): Avoid pretty-printing constructor /
destructor as expressions.
2017-08-02 Jakub Jelinek <>
PR c++/81640
* call.c (build_user_type_conversion_1): Only call
lookup_fnfields_slot if totype is CLASS_TYPE_P.
2017-07-31 Jason Merrill <>
* decl.c (declare_global_var): Set DECL_CONTEXT.
2017-07-31 Jan Hubicka <>
Martin Liska <>
* pt.c (tsubst_copy): Copy PREDICT_EXPR.
* semantics.c (finish_goto_stmt): Build gimple predict
* constexpr.c (potential_constant_expression_1): Handle
2017-07-31 Martin Liska <>
PR sanitize/81530
* cp-gimplify.c (cp_genericize): Guard condition with flag_sanitize_p
also with current_function_decl non-null equality.
* cp-ubsan.c (cp_ubsan_instrument_vptr_p): Likewise.
* decl.c (compute_array_index_type): Likewise.
* init.c (finish_length_check): Likewise.
* typeck.c (cp_build_binary_op): Likewise.
2017-07-29 Jakub Jelinek <>
* cp-objcp-common.c (cp_decl_dwarf_attribute): Handle
* name-lookup.c (emit_debug_info_using_namespace): Add IMPLICIT
argument, pass it through to the debug hook.
(finish_namespace_using_directive): Adjust
emit_debug_info_using_namespace caller.
(push_namespace): Likewise. Call it after setting
(cp_emit_debug_info_for_using): Pass false as new argument to
the imported_module_or_decl debug hook.
2017-07-28 Trevor Saunders <>
* lex.c (copy_decl): Adjust.
(copy_type): Likewise.
2017-07-26 Paolo Carlini <>
PR c++/71570
* lambda.c (add_capture): Early return if we cannot capture by
2017-07-26 Jason Merrill <>
P0702R1 - List deduction of vector.
* pt.c (do_class_deduction): Special-case deduction from a single
element of related type.
2017-07-26 Leonid Koppel <>
PR c++/67054 - Inherited ctor with non-default-constructible members
* method.c (walk_field_subobs) Consider member initializers (NSDMIs)
when deducing an inheriting constructor.
2017-07-21 Nathan Sidwell <>
* search.c (lookup_conversion_operator): Return overloads.
(lookup_fnfields_idx_nolazy): Absorb into ...
(lookup_fnfields_slot_nolaxy): ... here.
(lookup_fnfields_1): Absorb into ...
(lookup_fnfields_slot): ... here.
Remove special CDtor METHOD_VEC slots.
(CLASSTYPE_CONSTRUCTORS): Use lookup_fnfields_slot_nolazy.
* class (add_method): Don't use special cdtor slots.
* search.c (lookup_fnfields_idx_nolazy): Likewise.
(look_for_overrides_here): Use lookup_fnfields_slot.
* semantics (classtype_has_nothrow_assign_or_copy_p): Likewise.
* call.c (add_candidates): Move decls to initialization. Don't
use !!.
2017-07-20 Nathan Sidwell <>
* class.c (maybe_warn_about_overly_private_class,
finish_struct_methods, one_inheriting_sig, count_fields,
add_fields_to_record_type, check_field_decls, check_methods,
clone_function_decl, set_method_tm_attributes,
finalize_literal_type_property, check_bases_and_members,
create_vtable_ptr, determine_key_method,
unreverse_member_declarations, finish_struct,
add_vcall_offset_vtbl_entries_1): Member fns are on TYPE_FIELDS.
* decl.c (fixup_anonymous_aggr): Likewise.
* decl2.c (reset_type_linkage_2): Likewise.
* method.c (after_nsdmi_defaulted_late_checks,
lazily_declare_fn): Likewise.
* optimize.c (maybe_thunk_body, maybe_clone_body): Likewise.
* pt.c (instantiate_class_template_1, tsubst_expr,
do_type_instantiation, instantiate_pending_templates): Likewise.
* search.c (lookup_field_1): Likewise.
* semantics.c (finish_member_declaration,
finish_omp_declare_simd_methods): Likewise.
2017-07-19 Nathan Sidwell <>
* class.c (add_implicitly_declared_members): Use
classtype_has_user_move_assign_or_move_ctor_p): Merge into ...
(classtype_has_move_assign_or_move_ctor_p): ... this new function.
* cp-tree.h (classtype_has_user_move_assign_or_move_ctor_p):
Replace with ...
(classtype_has_move_assign_or_move_ctor_p): ... this.
* method.c (maybe_explain_implicit_delete, lazily_declare_fn): Adjust.
* tree.c (type_has_nontrivial_copy_init): Adjust.
2017-07-18 Nathan Sidwell <>
* cp-array-notation.c (build_array_notation_ref): Use
* class.c (classtype_has_move_assign_or_move_ctor): Declare.
(add_implicitly_declared_members): Use it.
(type_has_move_constructor, type_has_move_assign): Merge into ...
(classtype_has_move_assign_or_move_ctor): ... this new function.
* cp-tree.h (type_has_move_constructor, type_has_move_assign): Delete.
2017-07-17 Volker Reichelt <>
* parser.c (cp_parser_decl_specifier_seq): Add fix-it hints for
friend outside class and obsolete auto as storage-class-specifier.
2017-07-17 Nathan Sidwell <>
* class.c (maybe_warn_about_overly_private_class): Ignore public
copy ctors.
* class.c (type_has_user_declared_move_constructor,
type_has_user_declared_move_assign): Combine into ...
(classtype_has_user_move_assign_or_move_ctor_p): ... this new function.
* cp-tree.h (type_has_user_declared_move_constructor,
type_has_user_declared_move_assign): Combine into ...
(classtype_has_user_move_assign_or_move_ctor_p): ... this. Declare.
* method.c (maybe_explain_implicit_delete): Use it.
(lazily_declare_fn): Use it.
* tree.c (type_has_nontrivial_copy_init): Use it.
* semantics.c (classtype_has_nothrow_assign_or_copy_p): Clarify
semantics, simplify implementation.
2017-07-16 Volker Reichelt <>
* parser.c (cp_parser_cast_expression): Use %q#T instead of %qT
in old-style cast diagnostic.
* typeck.c (maybe_warn_about_useless_cast): Use %q#T instead of %qT
in useless cast diagnostic.
* error.c (type_to_string): Remove enum special handling.
2017-07-14 David Malcolm <>
* name-lookup.c (get_std_name_hint): Add '<' and '>' around
the header names.
(maybe_suggest_missing_header): Update for addition of '<' and '>'
to above. Provide a fix-it hint.
* pt.c: Include "gcc-rich-location.h"
(listify): Attempt to add fix-it hint for missing
#include <initializer_list>.
* rtti.c: Include "gcc-rich-location.h".
(typeid_ok_p): Attempt to add fix-it hint for missing
#include <typeinfo>.
2017-07-12 Jason Merrill <>
P0512R0 - Deduction from an initializer list.
* pt.c (do_class_deduction): Do list deduction in two phases.
2017-07-12 Nathan Sidwell <>
identifier flags.
* decl.c (grokfndecl): Set DECL_CXX_CONSTRUCTOR and
* decl2.c (grokclassfn): Likewise.
* friend.c (do_friend): Likewise.
* method.c (make_thunk, make_alias_for,
implicitly_declare_fn): Likewise.
2017-07-11 Jason Merrill <>
Core DR 393
* decl.c (grokparms): Downgrade error about array of unknown bound
to pedwarn and disable it for C++17.
2017-07-11 Nathan Sidwell <>
* decl2.c (reset_type_linkage_2): Dont't change ctor name.
2017-07-10 Martin Sebor <>
* cp-tree.h (cp_operator_id, cp_assignment_operator_id): Document.
2017-07-06 Jason Merrill <>
PR c++/81204 - parse error with dependent template-name
* parser.c (cp_parser_lookup_name): Revert previous change.
2017-07-06 David Malcolm <>
* cp-lang.c (LANG_HOOKS_RUN_LANG_SELFTESTS): Define as
(selftest::run_cp_tests): New function.
* cp-tree.h (selftest::run_cp_tests): New decl.
2017-07-04 Jakub Jelinek <>
* parser.c (cp_parser_decomposition_declaration): Replace
decomposition declaration with structured binding in diagnostics.
* decl.c (cp_finish_decomp): Likewise.
(grokdeclarator): Likewise.
PR c++/81258
* parser.c (cp_parser_decomposition_declaration): Diagnose invalid
forms of structured binding initializers.
2017-07-03 Paolo Carlini <>
PR c++/65775
* decl.c (grokdeclarator): Move checks on function return type after
the splice_late_return_type call; if declspecs->locations[ds_type_spec]
is UNKNOWN_LOCATION fall back to input_location.
2017-07-03 David Malcolm <>
* parser.c (enum required_token): Fix spelling of
(cp_parser_iteration_statement): Likewise.
(cp_parser_required_error): Likewise.
2017-06-30 Jason Merrill <>
PR c++/81257 - ICE with invalid ::template.
PR c++/54769 - wrong lookup of dependent template-name.
* parser.c (cp_parser_template_name): Revert part of last change.
2017-06-30 Nathan Sidwell <>
* (gtfiles): Add cp/lex.c.
* cp-tree.h (mangle_convop_name_for_type): Rename ...
(make_conv_op_name): ... here. Move to lex.
* lambda.c (maybe_add_lambda_conv_op): Update.
* parser.c (cp_parser_conversion_function_id): Update.
* pt.c (tsubst_decl, tsubst_baselink, tsubst_copy,
tsubst_copy_and_build): Update.
* semantics.c (apply_deduced_return_type): Update.
* mangle.c (conv_type_hasher, conv_type_names,
mangle_conv_op_name_for_type): Move to ...
* lex.c (conv_type_hasher, conv_type_names, make_convop_name):
... here. Rename.
2017-06-30 David Malcolm <>
PR c++/80014
* parser.c (cp_parser_postfix_expression): Construct a location
for typeid expressions.
2017-06-30 Nathan Sidwell <>
* cp-tree.h (lookup_fnfields_1, class_method_index_for_fn): Don't
(lookup_all_conversions): Declare.
* class.c (get_basefndecls): Use lookup_fnfields_slot.
* decl.c (register_dtor_fn): Use lookup_fnfields_slot.
* decl2.c (check_class_fn): Use lookup_fnfields_slot. Rework
* pt.c (retrieve_specialization): Use lookup_fnfields_slot.
(check_explicit_specialization): Use lookup_fnfields_slot_nolazy,
* search.c (lookup_fnfields_1): Make static.
(lookup_all_conversions): New.
(class_method_index_for_fn): Delete.
* semantics.c (classtype_has_nothrow_assign_or_copy_p): Use
* call.c (build_new_method_call_1): Use constructo_name to get
ctor name. Move argument processing earlier to merge cdtor
handling blocks.
* decl.c (grokfndecl): Cdtors have special names.
* method.c (implicitly_declare_fn): Likewise. Simplify flag setting.
* pt.c (check_explicit_specialization): Cdtor name is already
* search.c (class_method_index_for_fn): Likewise.
PR c++/81229
* name-lookup.c (do_pushdecl): Reset IDENTIFIER_TYPE when finding
a matching TYPE_DECL.
2017-06-29 Paolo Carlini <>
* class.c (add_method): Change pair of errors to error + inform.
(handle_using_decl): Likewise.
2017-06-29 Jason Merrill <>
* constexpr.c, error.c, tree.c: Remove WITH_CLEANUP_EXPR handling.
PR c++/81180 - ICE with C++17 deduction of member class template.
* pt.c (build_deduction_guide): Correct member template handling.
PR c++/81188 - matching decltype of member function call.
* tree.c (cp_tree_equal): Remove COMPONENT_REF special case.
2017-06-29 Nathan Sidwell <>
PR c++/81247
* parser.c (cp_parser_namespace_definition): Immediately close the
namespace if there's no open-brace.
* name-lookup.c (do_pushdecl): Reset OLD when pushing into new
2017-06-29 Jason Merrill <>
PR c++/81164 - ICE with invalid inherited constructor.
* search.c (binfo_direct_p): New.
* name-lookup.c (do_class_using_decl): Use it.
2017-06-29 Nathan Sidwell <>
* decl.c (initialize_predefined_identifiers): Name cdtor special
names consistently. Use literals for above deleted defines.
(cxx_init_decl_processing): Use literal for vtbl_ptr_type name,
* lex.c (maybe_add_lang_type_raw): Exit early, rather than use a
* call.c (check_dtor_name): Use constructor_name for enums too.
(build_new_method_call_1): Use constructor_name for cdtors and
show ~ for dtor.
* class.c (build_self_reference): Use TYPE_NAME to get name of
self reference.
* name-lookup (constructor_name): Use DECL_NAME directly.
(constructor_name_p): Reimplement.
(push_class_level_binding_1): Use TYPE_NAME directly.
* class.c (finish_struct): Use OVL_P.
(get_vfield_name): Measure constructor_name length.
* cxx-pretty-print.c (is_destructor_name): Delete.
(pp_cxx_unqualified_id): Remove bogus destructor name checking.
* decl.c (grokfndecl): Move cheap checks first when looking for
implicit extern cness.
* parser.c (cp_parser_direct_declarator): Reorder if to avoid
indentation. Remove unnecessary assignment of constructor name.
Whitespace cleanups.
* call.c (name_as_c_string): Move CONST_CAST to return.
(build_new_method_call_1): Remove unneeded bracing.
* class.c (include_empty_classes): Unbreak line.
* (tsubst_check_constraint): Add space.
* cp-tree.h (lang_decl_ns): Add comment.
(PTRMEM_CST_MEMBER): Break line.
* decl.c (grokfndecl): Add blank lines. Unbreak some others.
(grokdeclarator): Remove lines, move declaration to first use.
* decl2.c (decl_needed_p): Fix indentation.
(c_parse_final_cleanups): Remove blank line.
* method.c (implicitly_declare_fn): Move declaration to first use.
* search.c (current_scope): Add blank lines.
2017-06-28 Jason Merrill <>
PR c++/72764 - ICE with invalid template typename.
* decl.c (build_typename_type): No longer static.
* tree.c (strip_typedefs): Use it instead of make_typename_type.
PR c++/69300 - ICE with self-referential noexcept
* pt.c (maybe_instantiate_noexcept): Check for recursion.
PR c++/61022 - error with variadic template template parm
* pt.c (convert_template_argument): Keep the TYPE_PACK_EXPANSION.
PR c++/72801 - ICE with variadic partial specialization
* pt.c (unify_pack_expansion): Use PACK_EXPANSION_EXTRA_ARGS.
PR c++/55639 - partial specialization with ::template
* parser.c (cp_parser_class_head): Handle ::template.
PR c++/45976 - error with ::template in declarator.
* pt.c (resolve_typename_type): Fix TEMPLATE_ID_EXPR handling.
PR c++/54769 - wrong lookup of dependent template-name.
* parser.c (cp_parser_template_name): Handle dependent object type.
(cp_parser_nested_name_specifier_opt): Make template_keyword_p a
(cp_parser_id_expression): Pass it.
(cp_parser_diagnose_invalid_type_name): Handle TEMPLATE_ID_EXPR.
* parser.c (cp_parser_template_id): Use the range location on the
PR c++/81204 - parse error with dependent template-name
* parser.c (cp_parser_lookup_name): Disqualify function templates
after lookup.
2017-06-27 Nathan Sidwell <>
* pt.c (tsubst_decl <FUNCTION_DECL>): Move var decls to
initialization point. Don't unnecessarily check for ctor name.
* cp-tree.h (CLASSTYPE_DESTRUCTORS): Rename to ...
* class.c (accessible_nvdtor_p,
clone_constructors_and_destructors, type_has_virtual_destructor):
(deduce_noexcept_on_destructors): Absorb into ...
(check_bases_and_members): ... here.
* except.c (dtor_nothrow): Adjust for CLASSTYPE_DESTRUCTOR.
* init.c (build_delete): Likewise.
* parser.c (cp_parser_lookup_name): Likewise.
* pt.c (check_explicit_specialization): Likewise.
* rtti.c (emit_support_tinfos): Likewise.
* search.c (lookup_fnfields_idx_nolazy): Likewise.
* cp-tree.h (lang_identifier): Remove class_template_info field.
* name-lookup.c (constructor_name_full): Subsume into ...
(constructor_name): ... here. Don't check IDENTIFIER_TEMPLATE.
(constructor_name_p): Likewise.
* mangle.c (write_source_name): Likewise.
* ptree.c (cxx_print_identifier): Likewise.
2017-06-27 Marek Polacek <>
PR bootstrap/81216
* parser.c (cp_parser_already_scoped_statement): Initialize
2017-06-26 Jason Merrill <>
PR c++/81215 - deduction failure with variadic TTP.
* pt.c (unify_bound_ttp_args): Restore old logic for C++14 and down.
2017-06-26 Martin Sebor <>
PR c++/81169
* call.c (maybe_warn_class_memaccess): Preserve explicit conversions
to detect casting away cv-qualifiers.
2017-06-26 Nathan Sidwell <>
* cp-tree.h (lang_decl_fn): Remove assignment_operator_p field.
* decl.c (grok_op_properties): Adjust identifier checking.
* init.c (expand_default_init): Adjust identifier descision.
* method.c (implicitly_declare_fn): Don't use
* search.c (lookup_fnfields_1): Use IDENTIFIER_CTOR_P,
* call.c (in_charge_arg_for_name): Reimplement.
(build_special_member_call): Use IDENTIFIER_CDTOR_P,
2017-06-26 Marek Polacek <>
PR c/80116
* parser.c (cp_parser_statement): Add a default argument. Save the
location of the expression-statement after labels have been parsed.
(cp_parser_implicitly_scoped_statement): Set the location of the
body of the conditional after parsing all the labels. Call
(cp_parser_already_scoped_statement): Likewise.
2017-06-24 Paolo Carlini <>
PR c++/62315
* parser.c (cp_parser_diagnose_invalid_type_name): Don't print
'typename' in error messages about missing 'typename'.
2017-06-23 Jason Merrill <>
PR c++/79056 - C++17 ICE with invalid template syntax.
* parser.c (cp_parser_simple_type_specifier): Don't assume that type
(cp_parser_check_for_invalid_template_id): Handle TYPE_DECL.
* pt.c (template_placeholder_p): New.
* cp-tree.h: Declare it.
2017-06-23 Marc Glisse <>
* decl.c (duplicate_decls): Use builtin_structptr_types.
2017-06-22 Nathan Sidwell <>
Reorder IDENTIFIER flags
* cp-tree.h (enum cp_identifier_kind): New.
(C_IS_RESERVED_WORD): Replace with ...
(IDENTIFIER_CTOR_OR_DTOR_P): Replace with ...
(IDENTIFIER_OPNAME_P): Replace with ...
(IDENTIFIER_ANY_OP_P): ... this.
(IDENTIFIER_TYPENAME_P): Replace with ...
(NEW_DELETE_OPNAME_P): Replace with ...
(get_identifier_kind_name, set_identifier_kind): Declare.
* lex.c (get_identifier_kind_name, set_identifier_kind): New.
(init_operators): Adjust to avoid keywords, use
set_identifier_kind. Copy TYPE_EXPR slot.
(init_reswords): Call set_identifier_kind.
(unqualified_name_lookup_error): Adjust.
* operators.def (TYPE_EXPR): Remove.
* decl.c (struct predefined_identifier): Move into ...
(initialize_predefined_identifiers): ... here. Call
(grokfndecl, check_var_type, grokdeclarator): Adjust.
(grok_op_properties): Use IDENTIFIER_ANY_ASSIGN_OP to halve search
space. Adjust.
* call.c (name_as_c_string): Adjust.
(build_new_method_call_1): Likewise.
* cp-cilkplus.c (is_conversion_operator_function_decl_p): Likewise.
* cxx-pretty-print.c (pp_cxx_unqualified_id): Adjust.
* dump.c (cp_dump_tree): Adjust.
* error.c (dump_decl_name): Adjust.
* mangle.c (write_unqualified_id, write_member_name,
write_expression): Adjust.
(mangle_conv_op_name_for_type): Use set_identifier_kind.
* name-lookup.c (do_class_using_decl): Adjust.
(lookup_name_fuzzy, lookup_name_real_1): Likewise.
* parser.c (cp_lexer_get_preprocessor_token,
cp_parser_direct_declarator): Likewise.
* pt.c (push_template_decl_real, tsubst_decl, tsubst_baselink,
tsubst_copy, tsubst_copy_and_build): Adjust.
* ptree.c (cxx_print_identifier): Print identifier kind.
* search.c (lookup_field_r, lookup_member,
lookup_fnfields_idx_nolazy): Adjust.
* semantics.c (finish_id_expression): Adjust..
* typeck.c (cp_build_addr_expr_1): Adjust.
2017-06-21 Jakub Jelinek <>
PR c++/81154
* semantics.c (handle_omp_array_sections_1, finish_omp_clauses):
Complain about t not being a variable if t is OVERLOAD even
when processing_template_decl.
2017-06-21 David Malcolm <>
* parser.c (get_cast_suggestion): New function.
(maybe_add_cast_fixit): New function.
(cp_parser_cast_expression): Capture the location of the closing
parenthesis. Call maybe_add_cast_fixit when emitting warnings
about old-style casts.
2017-06-20 Jason Merrill <>
PR c++/80972 - C++17 ICE with attribute packed.
* call.c (build_over_call): Allow a TARGET_EXPR from reference
2017-06-20 Nathan Sidwell <>
* cp-tree.h (CPTI_NELTS_IDENTIFIER): Delete.
(nelts_identifier): Delete.
* decl.c (initialize_predefined_identifiers): Remove nelts.
PR c++/67074 - namespace aliases
* decl.c (duplicate_decls): Don't error here on mismatched
namespace alias.
* name-lookup.c (name_lookup::add_value): Matching namespaces are
not ambiguous.
(diagnose_name_conflict): Namespaces are never redeclarations.
(update_binding): An alias can match a real namespace.
2017-06-19 Jason Merrill <>
PR c++/80562 - ICE with constexpr if.
* semantics.c (finish_if_stmt_cond): Call
PR c++/80829 - ICE with constexpr copy of base subobject.
* constexpr.c (clear_no_implicit_zero): New.
(cxx_eval_call_expression): Call it.
2017-06-19 Nathan Sidwell <>
PR c++/81124
PR c++/79766
* name-lookup.c (set_decl_namespace): Don't follow using
directives and ignore using decls. Only check overly-explicit
scope after discovering decl.
2017-06-19 Jason Merrill <>
PR c++/81073 - constexpr and static var in statement-expression.
* typeck2.c (store_init_value): Always call
* pt.c (convert_nontype_argument): Likewise.
* constexpr.c (potential_constant_expression_1): Adjust message.
Use decl_maybe_constant_var_p instead of decl_constant_var_p.
* decl2.c (decl_maybe_constant_var_p): Consider initializer.
2017-06-19 Nathan Sidwell <>
* pt.c (coerce_template_parms): Fix indentation.
(tsubst_decl): Remove repeated SET_DECL_RTL. Move VAR_P handling
in to single block.
PR c++/81119
* name-lookup.c (update_binding): Only warn about constructors
hidden by functions.
2017-06-17 Jason Merrill <>
PR c++/60063 - -Wunused-local-typedefs and templates.
* decl2.c (is_late_template_attribute): Return false for "used".
PR c++/70844 - -Wuseless-cast and inheriting constructor.
* method.c (forward_parm): Suppress warn_useless_cast.
2017-06-16 Jason Merrill <>
PR c++/81045 - Wrong type-dependence with auto return type.
* pt.c (type_dependent_expression_p): An undeduced auto outside the
template isn't dependent.
* call.c (build_over_call): Instantiate undeduced auto even in a
PR c++/80465 - ICE with generic lambda with noexcept-specifier.
* lambda.c (maybe_add_lambda_conv_op): Keep processing_template_decl
set longer for a generic lambda.
PR c++/80614 - Wrong mangling for C++17 noexcept type
* mangle.c (write_type): Put the eh spec back on the function type.
PR c++/81102 - Wrong error with partial specialization.
* pt.c (unify) [TEMPLATE_PARM_INDEX]: Strip reference when comparing
types. Do type deduction later.
PR c++/81074 - ICE with partial specialization of member template.
PR c++/71747
* pt.c (get_partial_spec_bindings): Only coerce innermost args.
PR c++/80831 - ICE with -fsyntax-only.
* decl2.c (c_parse_final_cleanups): Use cgraph_node::get_create.
PR c++/80639 - ICE with invalid PMF initialization.
PR c++/80043 - ICE with -fpermissive
* typeck.c (convert_for_assignment): Recurse when instantiate_type
returns without an error.
2017-06-16 Nathan Sidwell <>
* pt.c (tsubst_baselink): Fix & clarify formatting.
* cp-tree.h (build_this_parm, cp_build_parm_decl,
build_artificial_parm): Add FN parm.
* decl.c (start_cleanup_fn): Adjust.
(build_this_parm): Add FN parm, pass it through.
(grokfndecl): Adjust parm building.
* decl2.c (cp_build_parm_decl): Add FN parm, set context.
(build_artificial_parm): Add FN parm, pass through.
(maybe_retrofit_in_chrg): Adjust parm building.
(start_static_storage_duration_function): Likwise.
* lambda.c (maybe_aadd_lambda_conv_op): Likewise.
* method.c (implicitly_declare_fn): Likewise.
* parser.c (inject_this_parameter): Likewise.
Symbol tables are insert only.
* cp-tree.h (default_hash_traits <lang_identifier *>): Don't
derive from pointer_hash. Make undeletable.
* class.c (resort_type_method_vec): Avoid potential unsigned
Don't defer noexcept_deferred_spec.
* cp-tree.h (unevaluated_noexcept_spec): Don't declare.
* decl.c (cxx_init_decl_processing): Initialize
* except.c (unevaluated_noexcept_spec): Delete.
* class.c (deduce_noexcept_on_destructor): Use
noexcept_deferred_spec directly.
* method.c (implicitly_declare_fn): Likewise.
Make keyed_classes a vector.
* cp-tree.h (CPTI_KEYED_CLASSES, keyed_classes): Delete.
(keyed_classes): Declare as vector.
* decl.c (keyed_classes): Define.
(cxx_init_decl_processing): Allocate it.
(record_key_method_defined): Use vec_safe_push.
* class.c (finish_struct_1): Likewise.
* pt.c (instantiate_class_template_1): Likewise.
* decl2.c (c_parse_final_cleanups): Reverse iterate keyed_classes.
Make rtti lazier
* rtti.c (enum tinfo_kind): Add TK_DERIVED_TYPES,
(tinfo_names): New.
(typeid_ok_p): Add quotes to error messages. Use get_tinfo_desc.
(get_tinfo_decl): Use get_tinfo_desc.
(get_pseudo_ti_init): Likewise. Adjust VMI construction.
(create_pseudo_type_info): Delete.
(get_pseudo_ti_index): Just determine the index.
(get_tinfo_desc): New. Create all types lazily.
(create_tinfo_types): Just allocate the descriptor array.
(emit_support_tinfos): Use non-inserting type lookup. Set builtin
2017-06-15 Martin Sebor <>
PR c++/80560
* call.c (first_non_public_field, maybe_warn_class_memaccess): New
(has_trivial_copy_assign_p, has_trivial_copy_p): Ditto.
(build_cxx_call): Call maybe_warn_class_memaccess.
2017-06-14 Jakub Jelinek <>
* cp-gimplify.c (cp_genericize_r): Turn most of the function
into a switch (TREE_CODE (stmt)) statement from long else if
2017-06-13 Jakub Jelinek <>
PR c++/80973
* cp-gimplify.c (cp_genericize_r): Don't instrument MEM_REF second
argument even if it has REFERENCE_TYPE.
PR c++/80984
* cp-gimplify.c (cp_genericize): Only look for VAR_DECLs in
BLOCK_VARS (outer) chain.
(cxx_omp_const_qual_no_mutable): Likewise.
2017-06-13 Martin Liska <>
PR sanitize/78204
* class.c (build_base_path): Use sanitize_flags_p.
* cp-gimplify.c (cp_genericize_r): Likewise.
(cp_genericize_tree): Likewise.
(cp_genericize): Likewise.
* cp-ubsan.c (cp_ubsan_instrument_vptr_p): Likewise.
* decl.c (compute_array_index_type): Likewise.
(start_preparsed_function): Likewise.
* decl2.c (one_static_initialization_or_destruction): Likewise.
* init.c (finish_length_check): Likewise.
* lambda.c (maybe_add_lambda_conv_op): Likewise.
* typeck.c (cp_build_binary_op): Likewise.
(build_static_cast_1): Likewise.
2017-06-11 Jason Merrill <>
* error.c (dump_expr): Use is_this_parameter.
* cp-tree.h, decl2.c, mangle.c, parser.c, pt.c, semantics.c: Use
2017-06-09 Jason Merrill <>
Missing bits from N4268, constant evaluation for all non-type args.
* call.c (build_converted_constant_expr): Rename from
build_integral_nontype_arg_conv, handle all types.
* pt.c (convert_nontype_argument): In C++17 call it for all types.
Move NOP stripping inside pointer case, don't strip ADDR_EXPR.
* cvt.c (strip_fnptr_conv): Also strip conversions to the same type.
Overhaul pointer-to-member conversion and template argument handling.
* call.c (standard_conversion): Avoid creating ck_pmem when the
class type is the same.
* cvt.c (can_convert_qual): Split from
* constexpr.c (cxx_eval_constant_expression): Check it.
* typeck.c (convert_ptrmem): Only cplus_expand_constant if
adjustment is necessary.
* pt.c (check_valid_ptrmem_cst_expr): Compare class types.
(convert_nontype_argument): Avoid redundant error.
* call.c (convert_like_real): Remove "inner" parameter.
Don't replace a constant with its value.
* cp-gimplify.c (cp_fully_fold): Use cp_fold_rvalue.
* pt.c (convert_nontype_argument): Check NULLPTR_TYPE_P rather than
* parser.c (cp_parser_constant_expression): Check
potential_rvalue_constant_expression after decay_conversion.
* pt.c (convert_nontype_argument): Don't require linkage in C++17.
PR c++/80384 - ICE with dependent noexcept-specifier
* pt.c (dependent_type_p_r) [FUNCTION_TYPE]: Check for dependent
* constexpr.c (potential_constant_expression_1): Allow 'this' capture.
2017-06-09 Jan Hubicka <>
* class.c (build_vtbl_initializer): Mark dvirt_fn as cold.
* decl.c (cxx_init_decl_processing, push_throw_library_fn): Likewise.
(excpet.c): Mark terminate as cold.
2017-06-08 Jakub Jelinek <>
PR c/81006
* semantics.c (handle_omp_array_sections_1): Convert TYPE_MAX_VALUE
to sizetype before size_binop.
PR c++/81011
* cp-gimplify.c (cxx_omp_finish_clause): When changing clause
2017-06-08 Jan Hubicka <>
* cp-tree.h (lang_check_failed): Annotate by ATTRIBUTE_COLD.
2017-06-07 Nathan Sidwell <>
* class.c (layout_class_type): Restructure overlong-bitfield tpe
2017-06-07 Jonathan Wakely <>
PR c++/80990
* pt.c (do_class_deduction): Build qualified type.
2017-06-06 Nathan Sidwell <>
* name-lookup.c (suggest_alternatives_for): Use qualified lookup
sans using directives. Don't walk into inline namespaces.
PR c++/80979
* name-lookup.c (adl_class_only): Don't add visible friends.
2017-06-05 Volker Reichelt <>
* parser.c (cp_parser_base_specifier): Fix typos in error messages.
2017-06-02 Nathan Sidwell <>
Remove lang_type_ptrmem.
* cp-tree.h (lang_type_header): Remove is_lang_type_class. Move
into ...
(lang_type_class): ... this. Reorder bitfields. Rename to ...
(lang_type): ... this. Delete old definition.
(lang_type_ptrmem): Delete.
* decl.c (build_ptrmemfunc_type): Adjust.
* lex.c (copy_lang_type): Remove lang_type_ptrmem handling.
(maybe_add_lang_type_raw): Don't set u.c.h.is_lang_type_class.
* class.c (check_bases_and_members): Adjust vec_new_uses_cookie
Remove cp_binding_level::namespaces
* name-lookup.h (cp_binding_level): Lose namespaces field.
* name-lookup.c (add_decl_to_level): Chain namespaces on the names
(suggest_alternatives_for): Adjust for namespace list. Do
breadth-first search.
* decl2.c (collect_source_refs): Namespaces are on the regulr
(collect_ada_namespace): Likewise.
2017-06-02 Bernd Edlinger <>
* typeck.c (cp_build_binary_op): Implement the -Wsizeof_pointer_div
2017-06-01 Ville Voutilainen <>
PR c++/80812
* method.c (constructible_expr): Strip array types before calling
2017-06-01 Paolo Carlini <>
PR c++/80896
* cvt.c (convert_to_void): Possibly call maybe_warn_nodiscard
for case INDIRECT_REF too in the main switch.
2017-05-31 Jason Merrill <>
PR c++/80840 - ICE with constexpr and reference
* pt.c (convert_nontype_argument): Don't test whether a decl is
value-dependent when binding to a reference.
2017-05-31 Nathan Sidwell <>
* cp-tree.h (lang_decl_slector): New enum.
(lang_decl_base): Make selector an enum. Drop decomposition_p
(lang_decl): Use enum for discrimination.
(DECL_DECOMPOSITION_P): Use selector value.
(retrofit_lang_decl): Lose SEL parm.
(fit_decomposition_lang_decl): Declare.
* decl.c (cp_finish_decomp, grokdeclarator): Use
* lex.c (maybe_add_lang_decl_raw): New. Broken out of
(set_decl_linkage): New. Broken out of retrofit_lang_decl. Use enum.
(fit_decomposition_lang_decl): Likewise.
(retrofit_lang_decl): Use worker functions.
(cxx_dup_lang_specific_decl): Use selector enum.
(maybe_add_lang_type_raw): New. Broken out of ...
(cxx_make_type_name): ... here. Call it.
2017-05-30 Jason Merrill <>
PR c++/80856 - ICE with local extern in template
* semantics.c (finish_call_expr): Replace a local extern overload
set in a template with the IDENTIFIER_NODE.
2017-05-30 David Malcolm <>
* call.c (perform_implicit_conversion_flags): Convert
"from %qT to %qT" to "from %qH to %qI" in diagnostic.
(print_conversion_rejection): Replace pairs of %qT with
%qH and %qI in various places.
(build_user_type_conversion_1): Likewise.
(build_integral_nontype_arg_conv): Likewise.
(build_conditional_expr_1): Likewise.
(convert_like_real): Likewise.
(convert_arg_to_ellipsis): Likewise.
(joust): Likewise.
(initialize_reference): Likewise.
* cvt.c (cp_convert_to_pointer): Likewise.
(cp_convert_to_pointer): Likewise.
(convert_to_reference): Likewise.
(ocp_convert): Likewise.
* error.c (cp_printer): Gain bool and const char ** parameters.
(struct deferred_printed_type): New struct.
(class cxx_format_postprocessor): New class.
(cxx_initialize_diagnostics): Wire up a cxx_format_postprocessor
to pp->m_format_postprocessor.
(comparable_template_types_p): New function.
(newline_and_indent): New function.
(arg_to_string): New function.
(print_nonequal_arg): New function.
(print_template_differences): New function.
(type_to_string_with_compare): New function.
(print_template_tree_comparison): New function.
(append_formatted_chunk): New function.
(add_quotes): New function.
(cxx_format_postprocessor::handle): New function.
(defer_phase_2_of_type_diff): New function.
(cp_printer): Add "quoted" and "buffer_ptr" params. Implement
%H and %I.
* typeck.c (cp_build_binary_op): Replace pairs of %qT with
%qH and %qI in various places.
(convert_member_func_to_ptr): Likewise.
(build_reinterpret_cast_1): Likewise.
(convert_for_assignment): Likewise.
* typeck2.c (check_narrowing): Likewise.
2017-05-30 Nathan Sidwell <>
* cp-tree.h (lang_identifier): Delete namespace_bindings.
(lang_decl_ns): Add bindings.
* lex.c (retrofit_lang_decl): Create namespace hash table.
* name-lookup.c (find_namespace_slot): Change to use hash-map.
* ptree.c (cxx_print_binding): Delete.
(cxx_print_identifier): Remove NAMESPACE_BINDING printing.
* cp-tree.def (OVERLOAD): Fix comment.
* cp-tree.h: Fix comments and whitespace.
* error.c (dump_decl): Use pp_cxx_colon_colon, ovl_scope.
* name-lookup.c (add_decl_to_level): Assert not class.
(check_local_shadow): Use OVL_P.
(pushdecl_with_scope_1): Rename to ...
(do_pushdecl_with_Scope): ... here.
(do_nonmember_using_decl): Use qualified_namespace_lookup return
(push_class_level_binding_1): Use OVL_P.
(pushdecl_namespace_level): Use do_pushdecl_with_scope.
(pushtag_1): Rename to ...
(do_pushtag): ... here. Adjust do_pushdecl_with_scope call.
(pushtag): Adjust.
(store_class_bindings): Do not time here.
* name-lookup.h (pushdecl_outermost_localscope): Reorder.
* pt.c (listify): Declare argvec at point of initialization.
PR c++/80913
* name-lookup.c (add_decl_to_level): Assert not making a circular
(update_binding): Don't prematurely slide artificial decl.
2017-05-29 Alexandre Oliva <>
* cp-tree.h (lang_identifier): Drop oracle_looked_up, unused.
2017-05-29 Nathan Sidwell <>
PR c++/80891 (#1,#5)
* cp-tree.h (lookup_maybe_add): Add DEDUPING argument.
* name-lookup.c (name_lookup): Add deduping field.
(name_lookup::preserve_state, name_lookup::restore_state): Deal
with deduping.
(name_lookup::add_overload): New.
(name_lookup::add_value, name_lookup::add_fns): Call add_overload.
(name_lookup::search_adl): Set deduping. Don't unmark here.
* pt.c (most_specialized_instantiation): Revert previous change,
Assert not given duplicates.
* tree.c (lookup_mark): Just mark the underlying decls.
(lookup_maybe_add): Dedup using marked decls.
PR c++/80891 (#4)
* ptree.c (cxx_print_xnode): Show internal OVERLOAD structure.
* tree.c (ovl_insert, ovl_iterator_remove_node): Fix copying assert.
Stat hack representation
* name-lookup.c (STAT_HACK_P, STAT_TYPE, STAT_DECL,
(stat_hack): New.
(find_namespace_binding): Replace with ...
(find_namespace_slot): ... this.
(find_namespace_value): New.
name_lookup::adl_namespace_only): Adjust.
(update_binding): Add SLOT parameter, adjust.
(check_local_shadow): Use find_namespace_value.
(set_local_extern_decl_linkage): Likewise.
(do_pushdecl): Adjust for namespace slot.
(push_local_binding): Assert not a namespace binding.
(check_for_out_of_scope_variable): Use find_namespace_value.
(set_identifier_type_value_with_scope): Likewise.
(get_namespace_binding): Likewise.
(set_namespace_binding): Delete.
(set_global_binding): Directly update the binding.
(finish_namespace_using_decl): Likewise.
(lookup_type_scope_1): Use find_namespace_slot and update.
(do_push_nested_namespace): Use find_namespace_value.
PR c++/80891 (#1)
* pt.c (most_specialized_instantiation): Cope with duplicate
PR c++/80891 (#3)
* cp-tree.h (build_min_nt_call_vec): Declare.
* decl.c (build_offset_ref_call_from_tree): Call it.
* parser.c (cp_parser_postfix_expression): Likewise.
* pt.c (tsubst_copy_and_build): Likewise.
* semantics.c (finish_call_expr): Likewise.
* tree.c (build_min_nt_loc): Keep unresolved lookups.
(build_min): Likewise.
(build_min_non_dep): Likewise.
(build_min_non_dep_call_vec): Likewise.
(build_min_nt_call_vec): New.
PR c++/80891 (#2)
* tree.c (ovl_copy): Adjust assert, copy OVL_LOOKUP.
(ovl_used): New.
(lookup_keep): Call it.
2017-05-26 Nathan Sidwell <>
Implement DR2061
* name-lookup.c (push_inline_namespaces): New.
(push_namespace): Look inside inline namespaces.
Inline and using namespace representation change.
* cp-tree.h (struct lang_decl_ns): Delete ns_using. Add usings,
inlinees as vector.
* name-lookup.h (struct cp_binding_level): Change usings
* name-lookup.c (name_lookup::do_queue_usings,
name_lookup::queue_usings): Adjust.
(name_lookup::search_namespace, name_lookup::search_usings,
name_lookup::queue_namespace): Adjust.
(name_lookup::adl_namespace_only): Adjust.
(add_using_namespace, push_namespace): Push onto vector.
(pop_namespace): Add timing logic.
* call.c (build_operator_new_call): Do namelookup and ADL here.
(build_new_op_1): Likewise.
* name-lookup.h (lookup_function_nonclass): Delete declaration.
(do_using_directive): Likewise.
* name-lookup.c (set_namespace_binding, push_local_binding): Don't
declare early.
(struct scope_binding): Delete.
(set_decl_namespace): Use OVL_P.
(finish_local_using_decl): Lose unnecesary checks.
(lookup_function_nonclass): Delete.
(cp_emit_debug_info_for_using): Use MAYBE_BASELINK_P.
* cp-tree.h (OVL_CHAIN): Check looking at OVERLOAD.
(ovl_iterator): Add allow_inner field. Adjust ctor. Make
(ovl_iterator::maybe_push, ovl_iterator::pop): New.
(lkp_iterator): Add outer field. Adjust ctor.
(lkp_iterator::operator++): New.
(lookup_mark, lookup_maybe_add): Declare.
* name-lookup.c (name_lookup): Delete fn_set member.
(name_lookup::preserve_state, name_lookup::restore_state): Unmark
and mark lookup.
(name_lookup::add_value): Use lookup_add directly.
(name_lookup::add_fns: Use lookup_maybe_add.
(name_lookup::search_adl): Mark and unmark fns.
(pushdecl): Adjust.
* pt.c (check_explicit_specialization): Use lookup_add directly.
* ptree.c (cxx_print_xnode): Show complete overload structure.
* tree.c (lookup_mark, lookup_maybe_add): New.
* name-lookup.c (name_lookup::search_adl): ADL OMP UDR type args.
2017-05-26 Jakub Jelinek <>
* cp-tree.h (struct lang_decl_decomp): New type.
(struct lang_decl): Add u.decomp.
(DECL_DECOMPOSITION_P): Note it is set also on the vars
for user identifiers.
(retrofit_lang_decl): Add extra int = 0 argument.
* lex.c (retrofit_lang_decl): Add SEL argument, if non-zero
use it to influence the selector choices and for selector
0 to non-zero transition copy old content.
(cxx_dup_lang_specific_decl): Handle DECL_DECOMPOSITION_P.
* decl.c (poplevel): For DECL_DECOMPOSITION_P, check
!DECL_DECOMP_BASE instead of !DECL_VALUE_EXPR. Adjust warning
wording if decl is a structured binding.
(cp_finish_decomp): Pass 4 as the new argument to retrofit_lang_decl.
Set DECL_DECOMP_BASE. Ignore DECL_READ_P sets from initialization
of individual variables for tuple structured bindings.
(grokdeclarator): Pass 4 as the new argument to retrofit_lang_decl.
* decl2.c (mark_used): Mark DECL_DECOMP_BASE TREE_USED as well.
* pt.c (tsubst_decomp_names): Assert DECL_DECOMP_BASE matches what
is expected.
* expr.c (mark_exp_read): Recurse on DECL_DECOMP_BASE instead of
2017-05-25 Jason Merrill <>
PR c++/80605 - __is_standard_layout and zero-length array
* class.c (check_bases): Use DECL_FIELD_IS_BASE.
2017-05-25 Nathan Sidwell <>
* cp-tree.h (OVL_CURRENT, OVL_NEXT): Delete.
* name-lookup.c (set_decl_namespace): Use ovl_iterator.
(consider_binding_level): Use OVL_FIRST.
(cp_emit_debug_info_for_using): Use lkp_iterator.
* pt.c (check_explicit_specialization): Use ovl_iterator.
* cp-tree.h (lang_decl_ns): Remove ns_users field.
* name-lookup.h (is_associated_namespace): Delete.
* name-lookup.c (name_lookup::search_usings,
name_lookup::do_queue_usings): Usings are always direct.
(is_associated_namespace): Delete.
(handle_namespace_attrs): Use DECL_NAMESPACE_INLINE_P.
(namespace_ancestor_1, namespace_ancestor): Delete.
(push_using_directive_1, push_using_directive): Delete.
(add_using_namespace_1): Delete.
(add_using_namespace): Reimplement.
(emit_debug_info_using_namespace): New.
(finish_namespace_using_directive, finish_local_using_directive,
push_namespace): Adjust.
* tree.c (cp_free_lang_data): Remove DECL_NAMESPACE_USERS handling.
2017-05-25 Volker Reichelt <>
* semantics.c (finish_handler_parms): Warn about non-reference type
catch handlers.
2017-05-25 Nathan Sidwell <>
Reimplement unqualified namespace lookup.
* name-lookup.c (name_lookup::using_pair,
name_lookup::using_queue): New typedefs.
(name_lookup::queue_namespace, name_lookup::do_queue_usings,
name_lookup::queue_usings): New.
(name_lookup::search_unqualified): New.
(merge_functions, same_entity_p, ambiguous_decl,
unqualified_namespace_lookup_1, unqualified_namespace_lookup,
lookup_using_namespace): Delete.
(lookup_name_real_1): Adjust.
Reimplement qualified namespace lookup.
* name-lookup.c (name_lookup::flags): New member. Adjust ctor.
(name_lookup::ambiguous, name_lookup::add_value,
name_lookup::add_type, name_lookup::process_binding): New.
name_lookup::search_namespace, name_lookup::search_usings): New.
(name_lookup::search_qualified): New.
(do_nonmember_using_decl, suggest_alternatives_for,
lookup_qualified_name): Adjust.
(tree_vec_contains): Delete.
(qualified_lookup_using_namespace): Rename to ...
(qualified_namespace_lookup): ... here. Reimplement.
Reimplement ADL.
* cp-tree.h (LOOKUP_SEEN_P, LOOKUP_FOUND_P): New.
* name-lookup.h (lookup_arg_dependent): Return plain tree.
* name-lookup.c (arg_lookup, arg_assoc, arg_assoc_args,
arg_assoc_args_vec, arg_assoc_type, add_function,
arg_assoc_namespace, arg_assoc_class_only, arg_assoc_bases,
arg_assoc_class, arg_assoc_template_arg, arg_assoc,
lookup_arg_dependent_1): Delete.
(name_lookup): New lookup object.
(name_lookup::preserve_state, name_lookup::restore_state,
name_lookup::mark_seen, name_lookup::find_and_mark,
name_lookup::add_fns, name_lookup::adl_namespace_only,
name_lookup::adl_namespace, name_lookup::adl_class_only,
name_lookup::adl_bases, name_lookup::adl_class,
name_lookup::adl_expr, name_lookup::adl_type,
name_lookup::adl_template_arg, name_lookup::search_adl): New.
(lookup_arg_dependent): Return a plain tree. Adjust.
(is_associated_namespace): Move later.
2017-05-24 Nathan Sidwell <>
* friend.c (do_friend): Remove check for existing decl.
* name-lookup.h (lookup_name_innermost_nonclass_level): Delete.
* name-lookup.c (push_local_binding): Directly look for binding.
(lookup_name_innermost_nonclass_level_1): Delete.
(lookup_name_innermost_nonclass_level): Delete.
* (CXX_AND_OBJCXX_OBJS): Alphabetize.
* cp-tree.h (cp_free_lang_data): Add extern.
(ovl_skip_hidden, is_overloaded_fn, really_overloaded_fn): Add
(type_unknown_p): Return bool, make inline, lose TREE_LIST check.
* typeck.c (type_unknown_p): Delete.
* tree.c (is_overloaded_fn): Use MAYBE_BASELINE_FUNCTIONS, adjust
overload management.
(dependent_name): Likewise.
(decl_anon_ns_mem_p): Simplify.
2017-05-24 Jonathan Wakely <>
PR c++/80544
* tree.c (reshape_init): Use unqualified type for direct enum init.
* typeck.c (maybe_warn_about_cast_ignoring_quals): New.
(build_static_cast_1, build_reinterpret_cast_1): Strip cv-quals from
non-class destination types.
(build_const_cast_1): Strip cv-quals from destination types.
(build_static_cast, build_reinterpret_cast, build_const_cast)
(cp_build_c_cast): Add calls to maybe_warn_about_cast_ignoring_quals.
2017-05-24 Martin Sebor <>
PR c/80731
* call.c (fully_fold_internal): Adjust.
2017-05-24 Nathan Sidwell <>
* cp-tree.h (ovl_skip_hidden): Declare.
* tree.c (ovl_skip_hidden): New.
* name-lookup.c (arg_assoc_namespace): Call ovl_skip_hidden.
(lookup_arg_dependent_1): Likewise.
(ambiguous_decl): Use DECL_HIDDEN_P, ovl_skip_hidden.
(hidden_name_p, remove_hidden_names): Delete.
(lookup_name_real_1): Do not strip hidden names.
* name-lookup.h (hidden_name_p, remove_hidden_names): Delete.
* cp-tree.h (OVL_HIDDEN_P): New.
(ovl_iterator::hidden_p, ovl_iterator::reveal_node): New.
(ovl_iterator::reveal_node): Declare.
* tree.c (ovl_copy): Copy OVL_HIDDEN_P.
(ovl_insert): Order on hiddenness.
(ovl_iterator::reveal_node): New.
* name-lookup.c (anticipated_builtin_p): New.
(supplement_binding_1): Use it.
(set_local_extern_decl_linkage): Use hidden_p.
(do_pushdecl): Deal with unhiding a hidden decl, use
(do_nonmember_using_decl): Use anticipated_decl_p.
(lookup_name_real_1): Use DECL_HIDDEN_P.
2017-05-23 Jason Merrill <>
-Wunused and C++17 structured bindings
* decl.c (poplevel): Don't warn about unused structured bindings,
only real variables.
* error.c (dump_simple_decl): Handle structured bindings.
* expr.c (mark_exp_read): Look through DECL_VALUE_EXPR.
2017-05-23 Nathan Sidwell <>
* cp-tree.h (PUSH_GLOBAL, PUSH_LOCAL, PUSH_USING): Delete.
* name-lookup.c (create_local_binding): New.
(update_binding): New.
(pushdecl_maybe_friend_1): Rename to ...
(do_pushdecl): ... this. Reimplement.
(pushdecl): Adjust.
(push_overloaded_decl_1, push_overloaded_decl): Delete.
2017-05-23 Jason Merrill <>
PR c++/80396 - built-in for make_integer_sequence.
* pt.c (builtin_pack_fn_p, builtin_pack_call_p)
(expand_integer_pack, expand_builtin_pack_call): New.
(find_parameter_packs_r): Check builtin_pack_call_p.
(check_for_bare_parameter_packs): Handle it.
(tsubst_pack_expansion): Call expand_builtin_pack_call.
(declare_integer_pack): New.
(init_template_processing): Call it.
* decl2.c (mark_used): Check builtin_pack_fn_p.
2017-05-23 Nathan Sidwell <>
* name-lookup.c (find_namespace_binding): New.
(pushdecl_maybe_friend_1): Use CP_DECL_CONTEXT.
(set_identifier_type_value_with_scope): Use find_namespace_binding.
(find_binding, cp_binding_level_find_binding_for_name,
binding_for_name, namespace_binding_1): Delete.
(push_overloaded_decl_1): Use CP_DECL_CONTEXT.
(get_namespace_binding, set_namespace_binding,
finish_namespace_using_decl, unqualified_namespace_lookup_1,
qualified_lookup_using_namespace, lookup_type_scope_1,
lookup_name_innermost_nonclass_level_1): Use find_namespace_binding.
PR c++/80866
* parser.c (cp_parser_template_id): Keep the lookup when stashing
the template_id.
* cp-tree.h (DECL_HIDDEN_P): New.
* name-lookup.c (set_decl_context,
set_local_extern_decl_linkage): New, broken out of ...
(pushdecl_maybe_friend_1): ... here. Call them.
2017-05-23 Thomas Schwinge <>
2017-05-23 Nathan Sidwell <>
* cp-tree.h (OVL_P): New.
* name-lookup.h (push_local_binding): Delete.
(do_toplevel_using_decl, do_local_using_decl): Rename to ...
(finish_namespace_using_decl, finish_local_using_decl): ... here
* name-lookup.c (add_decl_to_level): Swap args.
(pop_bindings_and_leave_scope): Look inside TREE_LIST.
(diagnose_name_conflict): Check contexts are same for redecl.
(update_local_overload): New.
(compparms_for_decl_and_using): Rename to ...
(matching_fn_p): ... here.
(pushdecl_maybe_friend_1): Adjust add_decl_to_level,
push_local_bindings call.
(push_local_binding): Make static, replace FLAGS arg with
(validate_nonmember_using_decl): Use OVL_FIRST.
(do_nonmember_using_decl): Use in/out parameters. Use
lkp_iterator and simplify.
(do_toplevel_using_decl, do_local_using_decl): Rename to ...
(finish_namespace_using_decl, finish_local_using_decl): ... here.
(lookup_type_current_level): Delete.
* parser.c (cp_parser_using_declaration): Adjust.
* pt.c (tsubst_expr): Adjust.
2017-05-22 Nathan Sidwell <>
* name-lookup.h (parse_using_directive): Replace with ...
(finish_namespace_using_directive): ... this and ...
(finish_local_using_directive): ... this.
* name-lookup.c (add_using_namespace_1): Move later.
(add_using_namespace): Move later, add namespace_p arg, remove
indirect arg.
(push_using_directive_1): Directly recurse.
(do_using_directive, parse_using_directive): Delete, split into ...
(finish_namespace_using_directive): ... this and ...
(finish_local_using_directive): ... this.
(push_namespace): Use add_using_namespace.
* parser.c (cp_parser_using_directive): Call
finish_namespace_using_directive or finish_local_using_directive.
* pt.c (tsubst_expr): Call finish_local_using_directive.
* cp-objcp-common.c (cp_register_dumps): Register raw dumper.
* cp-tree.h (raw_dump_id): Declare.
* decl2.c (raw_dump_id): Define.
(dump_tu): Use raw_dump_id.
* (gtfiles): Sort list, break lines.
* cp-tree.h (CPTI_TERMINATE, CPTI_CALL_UNEXPECTED): Rename to ...
(noexcept_deferred_spec): New.
(terminate_node, call_unexpected_node): Rename to ...
(terminate_fn, call_unexpected_fn): ... here.
(get_exception_ptr_fn, begin_catch_fn, end_catch_fn,
allocate_exception_fn, free_exception_fn, throw_fn, rethrow_fn): New.
* except.c (fn1..fn5, throw_fn, rethrow_rn, spec): Delete.
(init_exception_processing): Adjust.
(declare_library_fn): Create and push the fns here.
(do_get_exception_ptr, do_begin_catch, do_end_catch,
do_allocate_exception_ptr, do_free_exception_ptr): Adjust
declare_library_fn use.
(unevaluated_noexcept_spec): Adjust.
* cp-gimplify.c (genericize_eh_spec_block,
gimplify_most_not_throw_expr): Adjust.
* name-lookup.c (pushdecl_top_level,
pushdecl_top_level_and_finish): Move after namespace pushing and
popping functions.
(push_to_top_level): Rename to ...
(do_push_to_top_level): ... here. Remove timing code.
(pop_from_top_level_1): Rename to ...
(do_pop_from_top_level): ... here.
(do_push_nested_namespace, do_pop_nested_namespace)
(push_to_top_level): New wrapper for do_push_to_top_level.
(pop_from_top_level): Adjust.
(push_nested_namepace, pop_nested_namespace): Wrappers for workers.
2017-05-19 Bernd Edlinger <>
* (gtfiles): Add c-family/c-format.c,
except.c, init.c, lambda.c and friend.c.
* class.c (dvirt_fn): Move out of function scope,
add GTY attribute.
* except.c (fn1-5, throw_fn, rethrow_fn, spec): Likewise.
* init.c (fn): Likewise.
* lambda.c (ptr_id, max_id): Likewise.
* friend.c (global_friend): Add GTY attribute.
2017-05-19 Nathan Sidwell <>
* call.c (add_list_candidates): Use OVL_FIRST.
(build_new_method_call_1): Likewise.
* cp-tree.h (OVL_SINGLE_P): New.
* decl.c (xref_tag_1): Use TYPE_HIDDEN_P.
* dump.c (cp_tump_tree): Adjust overload dumping.
* error.c (dump_decl): Use OVL_SINGLE_P, simplify context
* method.c (lazily_declare_fn): Assert we added it.
* parser.c (cp_parser_nested_name_specifier): Use OVL_SINGLE_P,
(cp_parser_template_name): Use lkp_iterator.
* pt.c (begin_template_parm_list): Fixup comment.
(instantiate_class_template_1): Use TYPE_HIDDEN_P.
* tree.c (ovl_iterator::remove_node): Cope with inherited ctors.
(ovl_scope): Use lkp_iterator.
2017-05-19 Thomas Schwinge <>
* parser.c (cp_parser_omp_clause_default): Handle
* parser.c (cp_parser_omp_clause_default): Avoid printing more
than one syntax error message.
2017-05-19 Nathan Sidwell <>
* class.c (class_dump_id): Define.
(dump_class_hierarchy, dump_vtable, dump_vtt): Use it.
* cp-objcp-common.c (cp_register_dumps): New.
* cp-objcp-common.h (cp_register_dumps): Declare.
* cp-tree.h (class_dump_id): Declare.
2017-05-18 Nathan Sidwell <>
* cp-tree.h (OVL_ARG_DEPENDENT): Delete.
(OVL_USED_P): New.
(lookup_keep): Declare.
* name-lookup.c (add_function): Don't set OVL_ARG_DEPENDENT.
* pt.c (tsubst_copy): Assert lookup is persistent.
* semantics.c (finish_call_expr): Use lkp_iterator, call
* tree.c (ovl_copy): New.
(ovl_insert, ovl_iterator::remove_node): Copy immutable nodes.
(lookup_keep): New.
* cp-tree.h (OVL_USED): Replace with ...
(OVL_USING_P): ... this.
(ovl_iterator::using_p): Adjust.
* name-lookup.c (push_overloaded_decl_1,
do_nonmember_using_decl): Adjust.
* search.c (lookup_field_r): Adjust.
* tree.c (ovl_insert, ovl_scope): Adjust.
* cp-tree.h (lookup_add): Swap args.
(ovl_cons, build_overload): Delete.
* name-lookup.c (add_function, push_overloaded_decl_1,
do_nonmember_using_decl, merge_functions, remove_hidden_names):
Use lookup_add, ovl_insert.
* pt.c (check_explicit_specialization): Use lookup_add.
(do_class_deduction): Likewise. Refactor if.
* tree.c (lookup_add): Swap args.
(ovl_cons, build_overload): Delete.
* name-lookup.c (find_local_binding): New, broken out of ...
(lookup_name_innermost_nonclass_level_1): ... here. Call it.
(set_namespace_binding): Swap scope & name args.
(namespace_binding_1): Likewise.
(pushdecl_maybe_friend_1): Adjust set_namespace_binding call.
(push_overloaded_decl_1): Likewise.
(set_global_binding): Likewise.
(get_namespace_binding): Adjust namespace_binding_1 call.
2017-05-17 Nathan Sidwell <>
* cp-tree.h (default_hash_traits <lang_identifier *>): New
* name-lookup.c (lookup_extern_c_fun_in_all_ns): Delete.
(extern_c_fns): New hash table.
(check_extern_c_conflict): New, broken out of ...
(pushdecl_maybe_friend_1): ... here. Call it.
(c_linkage_bindings): Just look in hash table.
2017-05-17 Ville Voutilainen <>
PR c++/80654
PR c++/80682
Implement new C++ intrinsics __is_assignable and __is_constructible.
(is_xible): New.
* cxx-pretty-print.c (pp_cxx_trait_expression): Handle
* method.c (constructible_expr): Set cp_unevaluated.
(is_xible_helper): New.
(is_trivially_xible): Adjust.
(is_xible): New.
* parser.c (cp_parser_primary_expression): Handle
(cp_parser_trait_expr): Likewise.
* semantics.c (trait_expr_value): Handle
2017-05-17 Nathan Sidwell <>
* cp-tree.h (ovl_iterator::using_p): New predicate.
(ovl_iterator::remove_node): New worker.
(ovl_insert): Declare.
* tree.c (ovl_insert): New.
(ovl_iterator::remove_node): New.
* class.c (add_method): Use ovl_iterator, ovl_insert.
(clone_function_decl): Fix description.
(clone_constructors_and_destructors): Use ovl_iterator.
* class.c (handle_using_decl): Use OVL_FIRST, ovl_iterator.
(maybe_warn_about_overly_private_class): Use ovl_iterator.
(method_name_cmp, resort_method_name_cmp): Use OVL_NAME.
(resort_type_method_vec, finish_struct_methods): Use OVL_FIRST.
(get_base_fndecls): Use ovl_iterator.
(warn_hidden): Use OVL_NAME, ovl_iterator.
(add_implicitly_declared_members): Use ovl_iterator.
* (normalize_template_id_expression): Use OVL_FIRST,
flatten nested if.
(finish_shorthand_constraint): Simplify, use ovl_make.
* pt.c (make_constrained_auto): Simplify. Use ovl_make.
* search.c (shared_member_p): Use ovl_iterator.
(lookup_field_fuzzy_info::fuzzy_lookup_fn): Use OVL_NAME.
(lookup_conversion_operator): Use OVL_FIRST.
(lookup_fnfiels_idx_nolazy): Use OVL_FIRST, OVL_NAME.
(look_for_overrides_here): Use ovl_iterator.
(lookup_conversions_r): Use OVL_FIRST, OVL_NAME, ovl_iterator.
* typeck.c (build_x_unary_op): Use ovl_make.
2017-05-17 Martin Liska <>
* class.c (dump_class_hierarchy): Introduce dump_flags_t type and
use it instead of int type.
(dump_vtable): Likewise.
(dump_vtt): Likewise.
* decl2.c (dump_tu): Likewise.
2017-05-16 David Malcolm <>
* call.c (enforce_access): Add access_failure_info * param and use
it to record access failures.
* cp-tree.h (class access_failure_info): New class.
(enforce_access): Add access_failure_info * param, defaulting to
(lookup_member): Likewise.
(locate_field_accessor): New function decl.
(perform_or_defer_access_check): Add access_failure_info * param,
defaulting to NULL.
* search.c (lookup_member): Add access_failure_info * param and
pass it on to call to perform_or_defer_access_check.
(matches_code_and_type_p): New function.
(field_access_p): New function.
(direct_accessor_p): New function.
(reference_accessor_p): New function.
(field_accessor_p): New function.
(struct locate_field_data): New struct.
(dfs_locate_field_accessor_pre): New function.
(locate_field_accessor): New function.
* semantics.c (perform_or_defer_access_check): Add
access_failure_info * param, and pass it on to call to
* typeck.c (access_failure_info::record_access_failure): New method.
(access_failure_info::maybe_suggest_accessor): New method.
(finish_class_member_access_expr): Pass an access_failure_info
instance to the lookup_member call, and call its
maybe_suggest_accessor method afterwards.
2017-05-16 Marek Polacek <>
PR sanitizer/80536
PR sanitizer/80386
* cp-gimplify.c (cp_fold): Handle SAVE_EXPR.
2017-05-16 Nathan Sidwell <>
* name-lookup.c (check_local_shadow): New, broke out of ...
(pushdecl_maybe_friend_1): ... here. Call it.
* cp-tree.h (OVL_NESTED_P, OVL_LOOKUP_P): New.
(ovl_first): Move inline definition to end of file.
(ovl_make, lookup_add): Declare.
(get_fns, get_first_fn): Make pure.
* tree.c (ovl_cache): New.
(ovl_make, lookup_add): New.
* pt.c (do_class_deduction): Don't add candidates that will be
* call.c (build_user_type_conversion_1): Use OVL_FIRST.
(print_error_for_call_failure): Use OVL_NAME.
(build_op_call_1): Use ovl_iterator.
(add_candidates): Use OVL_FIRST & lkp_iterator.
(build_op_delete_call): Use MAYBE_BASELINK_FUNCTIONS &
* class.c (deduce_noexcept_on_destructors): Use ovl_iterator.
type_has_move_constructor, type_has_move_assign,
type_build_ctor_call, type_build_dtor_call,
type_requires_array_cookie, explain_non_literal_class): Likewise.
(finish_struct): Use lkp_iterator.
(resolve_address_of_overloaded_function): Use OVL_NAME, lkp_iterator.
(note_name_declared_in_class): Use OVL_NAME.
* cxx-pretty-print.c (pp_cxx_unqualified_id): Use OVL_FIRST.
(pp_cxx_qualified_id, cxx_pretty_printer::id_expression,
cxx_pretty_printer::expression): Likewise.
* decl2.c (check_classfn): Use ovl_iterator.
* pt.c (retrieve_specialization): Use ovl_iterator.
* tree.c (cp_tree_equal): Use lkp_iterator.
(type_has_nontrivial_copy_init): Use ovl_iterator.
* typeck2.c (cxx_incomplete_type_diagnostic): Revert change and
check is_overloaded_fn.
2017-05-16 Martin Liska <>
* parser.c (cp_lexer_print_token): Add default value for flags
argument of print_gimple_stmt, print_gimple_expr,
print_generic_stmt and print_generic_expr.
2017-05-16 Nathan Sidwell <>
* cp-tree.h (class ovl_iterator, class lkp_iterator): New OVERLOAD
* (resolve_constraint_check): Use lkp_iterator.
* decl2.c (maybe_warn_sized_delete): Use ovl_iterator.
* lambda.c (maybe_generic_this_capture): Use lkp_iterator.
* method.c (inherited_ctor_binfo): Use ovl_iterator.
(binfo_inherited_from): Likewise.
* parser.c (lookup_literal_operator): Use lkp_iterator.
* pt.c (iterative_hash_template_arg): Use lkp_iterator.
(print_candidates_1): Likewise.
(determine_specialization): Likewise.
(resolve_overloaded_unification): Likewise.
(resolve_nondeduced_context): Likewise.
(type_dependent_expression_p): Likewise.
(dependent_template_p): Likewise.
* ptree.c (cxx_print_xnode): Likewise.
* semantics.c (omp_reduction_lookup): Use lkp_iterator.
(classtype_has_nothrow_assign_or_copy_p): Use ovl_iterator.
* typeck.c (check_template_keyword): Use lkp_iterator.
* cp-tree.h (OVL_FIRST, OVL_NAME): New.
(ovl_first): New.
* constexpr.c (function_concept_check): Use OVL_FIRST.
* cvt.c (build_expr_type_conversion): Likewise.
* decl.c (poplevel, grokdeclarator): Use OVL_NAME.
* decl2.c (mark_used): Use OVL_FIRST.
* error.c (dump_decl): Use OVL_FIRST, OVL_NAME.
(dump_expr, location_of): Use OVL_FIRST.
* friend.c (do_friend): Use OVL_NAME.
* init.c (build_offset_ref): Use OVL_FIRST.
* mangle.c (write_member_name): Likewise.
(write_expression): Use OVL_NAME.
* method.c (strip_inheriting_ctors): Use OVL_FIRST.
* name-lookup.c (pushdecl_class_level): Use OVL_NAME.
* pt.c (check_explicit_specialization): Use OVL_FIRST.
(check_template_shadow): Likewise.
(tsubst_template_args): Use OVL_NAME.
(tsubst_baselink): Use OVL_FIRST.
* semantics.c (perform_koenig_lookup): Use OVL_NAME.
* tree.c (get_first_fn): Use OVL_FIRST.
* typeck.c (finish_class_member_access_expr): Use OVL_NAME.
(cp_build_addr_expr_1): Use OVL_FIRST.
* pt.c (tsubst_copy_and_build): Remove unnecessary COMPONENT_REF
* semantics.c (finish_id_expression): Directly init local var.
(finish_omp_reduction_clause): Use really_overloaded_fn.
* tree.c (get_fns): Document. Assert we got an overload.
(get_first_fn) Document.
* typeck.c (cp_build_addr_expr_1): Pass arg directly to
* typeck2.c (cxx_incomplete_type_diagnostic): Use get_first_fn directly.
* cp-tree.h (SCOPE_DEPTH): New.
* name-lookup.h (is_nested_namespace): Declare.
* name-lookup.c (is_nested_namespace): New.
(is_ancestor): Use it.
(set_decl_namespace): Likewise.
(push_namespace): Set SCOPE_DEPTH.
* pt.c (check_specialization_namespace): Use is_nested_namespace.
(check_unqualigied_spec_or_inst): Likewise.
2017-05-15 Nathan Sidwell <>
PR c++/79369
* cp-tree.h (DECL_NAMESPACE_INLINE_P): New.
* name-lookup.h (push_namespace): Return int, add make_inline arg.
* name-lookup.c (push_namespace): Deal with inline directly.
Return pushed count.
* parser.c (cp_parser_namespace_definition): Adjust for
push_namespace change.
2017-05-11 Nathan Sidwell <>
* cp-lang.c (get_global_decls, cxx_pushdecl, LANG_HOOK_GETDECLS,
* cp-objcp-common.c (cp_get_global_decls, cp_pushdec,
* cp-objcp-common.h (cp_get_global_decls, cp_pushdecl): Declare.
* name-lookup.h (pushdecl): Add default friend parm.
(pushdecl_maybe_friend): Delete.
(pushdecl_top_level): Add default friend parm.
(pushdecl_top_level_maybe_friend): Delete.
* name-lookup.c (pushdecl_maybe_friend): Delete.
(pushdecl): Add is_friend parm.
(pushdecl_top_level): Add is friend_parm.
(pushdecl_top_level_maybe_friend, pushdecl_top_level_1): Delete.
(pushdecl_top_level_and_finish): Do pushing and finishing directly.
* friend.c (do_friend): Adjust.
* pt.c (tsubst_friend_class): Adjust.
Revert pushdecl_top_level_and_finish name change.
* name-lookup.h (pushdecl_top_level_and_finish): Resurrect old name.
* name-lookup.c (pushdecl_top_level_and_finish): Likewise.
* decl.c (cp_make_fname_decl): Adjust.
* decl2.c (get_guard, handle_tls_init): Adjust.
* rtti.c (get_tinfo_decl, tinfo_base_init): Adjust.
* name-lookup.c (pushdecl_outermost_localscope): Always
conditionally stop timer.
* decl.c (xref_tag_1): Don't frob ts_lambda scope here.
* name-lookup.c (pushtag_1): Deal with ts_lambda scope.
* cp-tree.h (pushdecl, pushdecl_maybe_friend, pushtag,
pushdecl_top_level_and_finish): Move declarations to ...
* name-lookup.h: ... here. Group pushdecl variants.
(pushdecl_top_level_and_finish): Rename to ...
(pushdecl_top_level_with_init): ... here.
* decl.c (cp_make_fname_decl): Use pushdecl_top_level_with_init.
* decl2.c (get_guard, handle_tls_init): Likewise.
* rtti.c (get_tinfo_decl, tinfo_base_init): Likewise.
* lambda.c (maybe_add_lambda_conv_op): Use namespace_bindings_p.
* method.c (implicitly_declare_fn): Likewise.
* searchc (node_debug_info_needed): Likewise.
* name-lookup.c (pushdecl_top_level_and_finish): Rename to ...
(pushdecl_top_level_with_init): ... here.
(pop_everything): Use namespace_bindings_p.
* name-lookup.h (pop_binding): Rename to pop_local_binding.
(getdecls): Rename to get_local_decls.
* name-lookup.c (pop_binding): Rename to ...
(pop_local_binding): ... here.
(pop_bindings_and_leave_scope): Adjust.
(getdecls): Rename to ...
(get_local_decls): ... here. Assert local scope.
* decl.c (poplevel): Assert not namespace. Adjust and simplify
(store_parm_decls): Adjust get_local_decls call.
(parser.c (synthesize_implicit_template_parm): Likewise.
2017-05-11 Ville Voutilainen <>
PR c++/80682
* method.c (is_trivially_xible): Reject void types.
2017-05-10 Nathan Sidwell <>
* class.c (handle_using_decl): Always use OVL_CURRENT.
(resolve_address_of_overloaded_function): Move iterator decl into
for scope. Don't strip anticipated decls here.
* pt.c (print_candidates_1): Separate TREE_LIST and OVERLOAD
(print_candidates): Adjust.
* cp-tree.h (build_new_function_call): Lose koenig_p arg. Fix
line breaking.
* call.c (build_new_function_call): Lose koenig_p arg. Remove
koenig_p handling here.
* pt.c (push_template_decl_real): Unconditionally retrofit_lang_decl.
(tsubst_omp_clauses): Likewise.
(do_class_deduction): Adjust buld_new_function_call calls.
* semantics.c (finish_call_expr): Likewise.
2017-05-10 Jason Merrill <>
* pt.c (unify_parameter_deduction_failure, unify_cv_qual_mismatch)
(unify_type_mismatch, unify_parameter_pack_mismatch)
(unify_ptrmem_cst_mismatch, unify_expression_unequal)
(unify_parameter_pack_inconsistent, unify_inconsistency)
(unify_vla_arg, unify_method_type_error, unify_arity)
(unify_arg_conversion, unify_no_common_base)
(unify_overload_resolution_failure): Call unify_invalid.
CWG 1847 - Clarifying compatibility during partial ordering
* pt.c (more_specialized_fn): No order between two non-deducible
* pt.c (dependent_type_p): Make sure we aren't called with
PR c++/79549 - C++17 ICE with non-type auto template parameter pack
* pt.c (convert_template_argument): Just return an argument pack.
(coerce_template_parameter_pack, template_parm_to_arg)
(extract_fnparm_pack, make_argument_pack, tsubst_template_args)
(tsubst_decl, tsubst, type_unification_real, unify_pack_expansion):
Don't set the type of a NONTYPE_ARGUMENT_PACK.
* parser.c (make_char_string_pack, make_string_pack): Likewise.
2017-05-10 Nathan Sidwell <>
* cp-tree.h (add_method, clone_function_decl): Change last arg to
* class.c (add_method): Change third arg to bool. Adjust.
(one_inheriting_sig, one_inherited_ctor): Adjust.
(clone_function_decl): Change 2nd arg to bool. Adjust.
(clone_constructors_and_destructors): Adjust.
* lambda.c (maybe_add_lambda_conv_op): Adjust.
* method.c (lazily_declare_fn): Adjust.
* pt.c (tsubst_decl, instantiate_template_1): Adjust.
* semantics.c (finish_member_declaration): Adjust.
2017-05-10 Paolo Carlini <>
PR c++/80145
* decl.c (finish_function): To improve error recovery, change the
logic for calling apply_deduced_return_type.
2017-05-09 Jason Merrill <>
PR c++/80605 - __is_standard_layout and empty base
* class.c (check_bases): Ignore empty bases.
PR c++/70979 - literal class and closure types
* class.c (finalize_literal_type_property): Handle closures
(explain_non_literal_class): Likewise.
PR c++/66297, DR 1684 - literal class and constexpr member fns
* constexpr.c (is_valid_constexpr_fn): Only complain about
non-literal enclosing class in C++11.
* class.c (finalize_literal_type_property): Likewise.
2017-05-09 Paolo Carlini <>
PR c++/80186
* pt.c (tsubst_decl): Early return error_mark_node if
grok_ctor_properties returns false.
2017-05-09 Jason Merrill <>
PR c++/70167 - array prvalue treated as lvalue
(enum fcl_t): New.
* semantics.c (finish_compound_literal): Add fcl_context parameter.
Only make a static variable for C99 syntax.
* parser.c (cp_parser_postfix_expression): Pass it.
* pt.c (tsubst_copy_and_build): Likewise.
* call.c (extend_ref_init_temps): Set
2017-05-09 Nathan Sidwell <>
* cp-lang.c (get_global_decls, cxx_pushdecl): New.
* name-lookup.h (pushdecl_top_level): Declare.
2017-05-08 Jason Merrill <>
PR c++/80178 - parameter passing for uncopyable classes
* tree.c (type_has_nontrivial_copy_init): True for classes with only
deleted copy/move ctors.
(remember_deleted_copy, maybe_warn_parm_abi): New.
* decl.c (require_complete_types_for_parms, check_function_type):
Call maybe_warn_parm_abi.