1 2017-12-19 Paolo Carlini <paolo.carlini@oracle.com>
3 * cp-tree.h: Fix typo in comment.
5 2017-12-18 Marek Polacek <polacek@redhat.com>
8 * constexpr.c (cxx_eval_call_expression): Only look into
9 constexpr_call_table if ctx->strict.
11 2017-12-18 Jakub Jelinek <jakub@redhat.com>
14 * decl2.c (save_template_attributes): Add flags argument, if
15 not ATTR_FLAG_TYPE_IN_PLACE, *decl_p is a type and we want to
16 modify TYPE_ATTRIBUTES, add them on type attribute variant.
18 2017-12-18 Nathan Sidwell <nathan@acm.org>
21 * name-lookup.c (name_lookup::search_unqualified): Don't search
22 parent namespace when looking for hidden things.
23 * pt.c (tsubst_friend_class): Always push to friend scope, drop
24 unneeded self-friend check. Inject new hidden friend into correct
27 2017-12-15 Jakub Jelinek <jakub@redhat.com>
30 * decl.c (cp_finish_decomp): Handle the case when tsize is not
31 error_mark_node, but doesn't fit into uhwi. Split up count != eltscnt
32 and !tree_fits_uhwi_p (tsize) error_at calls into error_n and inform_n
33 to handle plural forms properly.
36 * cp-tree.h (cp_maybe_mangle_decomp): Declare.
37 * decl.c (cp_maybe_mangle_decomp): New function.
38 (cp_finish_decomp): Don't SET_DECL_ASSEMBLER_NAME here.
39 * parser.c (cp_convert_range_for,
40 cp_parser_decomposition_declaration): Call cp_maybe_mangle_decomp.
41 * pt.c (tsubst_expr): Likewise.
42 * mangle.c (find_decomp_unqualified_name): New function.
43 (write_unqualified_name): Handle DECL_DECOMPOSITION_P
44 where DECL_ASSEMBLER_NAME is already set.
48 * typeck2.c (digest_init_r): Change nested argument type from bool to
49 int. Use code instead of TREE_CODE (type) where possible. If
50 nested == 2, diagnose initialization of flexible array member with
51 STRING_CST. Pass nested to process_init_constructor. Formatting fix.
52 (digest_init, digest_init_flags): Adjust digest_init_r caller.
53 (massage_init_elt): Add nested argument. Pass 2 instead of 1 to
54 digest_init_r's nested argument if nested is non-zero.
55 (process_init_constructor_array): Add nested argument. If nested == 2,
56 diagnose initialization of flexible array member with non-empty
57 braced enclosed list. Pass nested to massage_init_elt.
58 (process_init_constructor_record, process_init_constructor_union): Add
59 nested argument, pass it to massage_init_elt.
60 (process_init_constructor): Add nested argument, pass it to
61 process_init_constructor_{array,record,union}.
62 * init.c (find_field_init): Renamed to ...
63 (find_flexarray_init): ... this. Return NULL_TREE if init is
64 error_mark_node. Don't look through nested CONSTRUCTORs.
65 (warn_placement_new_too_small): Adjust caller.
68 * decl.c (cp_finish_decomp): If decl's type is REFERENCE_TYPE,
69 call complete_type (TREE_TYPE (type)).
71 * tree.c (cxx_attribute_table, std_attribute_table): Swap
72 affects_type_identity and handler fields, adjust comments.
74 2017-12-15 Nathan Sidwell <nathan@acm.org>
77 * decl.c (xref_tag_1): Correct comments about template friends and
79 * friend.c (make_friend_class): Move comments concerning
80 self-friendliness to code dealing with such.
81 * pt.c (check_default_tmpl_args): Deal with template friend
83 (push_template_decl_real): Check default args for non-function
86 2017-12-14 Bernd Edlinger <bernd.edlinger@hotmail.de>
88 * decl2.c (start_static_storage_duration_function): Avoid warning.
89 * typeck.c (cxx_safe_arg_type_equiv_p,
90 cxx_safe_function_type_cast_p): New function.
91 (build_reinterpret_cast_1): Implement -Wcast-function-type.
93 2017-12-14 Jakub Jelinek <jakub@redhat.com>
96 * pt.c (convert_nontype_argument): Diagnose
97 reduced_constant_expression_p expressions that aren't INTEGER_CST.
99 2017-12-13 Paolo Carlini <paolo.carlini@oracle.com>
102 * typeck.c (cp_build_modify_expr): Upon cxx_readonly_error
103 immediately return error_mark_node.
105 2017-12-13 Nathan Sidwell <nathan@acm.org>
108 * pt.c (tsubst_baselink): Don't repeat the lookup for
109 non-dependent baselinks.
111 2017-12-12 Jason Merrill <jason@redhat.com>
113 * decl.c (value_dependent_init_p): Check the type of a CONSTRUCTOR.
114 (type_dependent_init_p): Remove.
116 PR c++/82115 - ICE with variable initialized with its own address.
117 * cp-tree.h (struct lang_decl_base): Add dependent_init_p.
118 (DECL_DEPENDENT_INIT_P, SET_DECL_DEPENDENT_INIT_P): New.
119 * decl.c (cp_finish_decl): Set it.
120 (duplicate_decls): Copy it.
121 * pt.c (tsubst_decl): Clear it.
122 (value_dependent_expression_p): Revert earlier change. Check it.
124 2017-12-12 Alexandre Oliva <aoliva@redhat.com>
126 * constexpr.c (check_constexpr_ctor_body_1): Skip begin stmt
128 (constexpr_fn_retval): Likewise.
129 (potential_constant_expression_1): Likewise.
130 (cxx_eval_statement_list): Check that a begin stmt marker is
131 not used as the value of a statement list.
132 (cxx_eval_constant_expression): Return begin stmt markers
134 * cp-array-notation.c (stmt_location): New.
135 (cp_expand_cond_array_notations): Use it.
136 * cp-objcp-common.h (LANG_HOOKS_EMITS_BEGIN_STMT): Redefine as true.
137 * parser.c (add_debug_begin_stmt): New.
138 (cp_parser_statement): Call it.
139 * pt.c (tsubst_copy): Handle begin stmt markers.
141 2017-12-07 Martin Sebor <msebor@redhat.com>
144 * cp-tree.h (decls_match): Add default argument.
145 * decl.c (decls_match): Avoid calling into the target back end
146 and triggering an error.
147 * decl2.c (cplus_decl_attributes): Look up existing declaration and
148 pass it to decl_attributes.
149 * tree.c (cxx_attribute_table): Initialize new member of struct
152 2017-12-06 Jakub Jelinek <jakub@redhat.com>
155 * decl2.c (grokfield): Diagnose = delete redefinition of a friend.
157 2017-12-06 Jason Merrill <jason@redhat.com>
159 * call.c (convert_for_arg_passing): Pass NULL_TREE to
160 targetm.calls.promote_prototypes.
161 (type_passed_as): Likewise.
163 PR c++/82115 - ICE with variable initialized with its own address.
164 * pt.c (value_dependent_expression_p): Add lval parameter. Don't
165 consider DECL_INITIAL if it's true.
167 2017-12-06 David Malcolm <dmalcolm@redhat.com>
170 * name-lookup.c (consider_binding_level): Don't suggest names that
171 are reserved for use by the implementation.
173 2017-12-06 David Malcolm <dmalcolm@redhat.com>
175 * name-lookup.c: Include "c-family/c-spellcheck.h".
177 2017-12-05 Jason Merrill <jason@redhat.com>
179 PR c++/82331 - ICE with variadic partial specialization of auto
180 * pt.c (unify) [TEMPLATE_PARM_INDEX]: Set processing_template_decl
181 around call to tsubst.
183 2017-12-05 Nathan Sidwell <nathan@acm.org>
186 * tree.c (build_min): Check CAST_EXPR arg for OVERLOADs.
188 2017-12-05 Martin Liska <mliska@suse.cz>
189 Jakub Jelinek <jakub@redhat.com>
191 * typeck.c (pointer_diff): Add new argument and instrument
193 (cp_build_binary_op): Create compound expression if doing an
196 2017-12-05 Jakub Jelinek <jakub@redhat.com>
198 * cp-gimplify.c (cp_maybe_instrument_return): Don't add
199 __builtin_unreachable if -O0 or if -fsanitize=unreachable.
201 2017-12-04 Jason Merrill <jason@redhat.com>
203 PR c++/83273 - constexpr if allows non-constant condition
204 * semantics.c (finish_if_stmt_cond): Use require_constant_expression
205 rather than is_constant_expression.
206 * constexpr.c (potential_constant_expression_1) [LAMBDA_EXPR]: Allow
209 2017-12-01 Jason Merrill <jason@redhat.com>
211 Give #include hints for <complex>.
212 * name-lookup.c (get_std_name_hint): Add <complex>.
213 * parser.c (cp_parser_diagnose_invalid_type_name): Call
214 suggest_alternative_in_explicit_scope.
215 (cp_parser_namespace_name): Likewise.
217 PR c++/79228 - extensions hide C++14 complex literal operators
218 * parser.c (cp_parser_userdef_numeric_literal): Be helpful about
221 2017-12-01 Jakub Jelinek <jakub@redhat.com>
223 * parser.c (cp_parser_new): Don't clear cilk_simd_fn_info.
224 (parsing_nsdmi): Adjust comment.
225 (cp_parser_omp_for_loop_init): Likewise.
226 * parser.h (struct cp_omp_declare_simd_data): Adjust comment.
227 (struct cp_parser): Remove cilk_simd_fn_info field.
228 * cp-tree.h (cilk_valid_spawn): Remove.
231 * cp-gimplify.c (genericize_switch_stmt): Emit LABEL_EXPR for the
232 break label into SWITCH_BODY instead of after it and set
233 SWITCH_BREAK_LABEL_P on it.
234 * parser.c (cp_parser_objc_expression): Add FALLTHRU comment to avoid
235 -Wimplicit-fallthrough warning.
237 2017-11-30 Jason Merrill <jason@redhat.com>
239 PR c++/82219 - bogus -Wignored-qualifiers with template
240 * pt.c (tsubst_copy_and_build) [STATIC_CAST_EXPR]: Suppress
241 -Wignored-qualifiers.
243 2017-11-29 David Malcolm <dmalcolm@redhat.com>
245 * parser.c (cp_parser_unary_expression): Generate a location for
247 (cp_parser_trait_expr): Generate and return a location_t,
248 converting the return type from tree to cp_expr.
249 (cp_parser_static_assert): Pass location of the condition to
250 finish_static_assert, rather than that of the "static_assert"
251 token, where available.
253 2017-11-29 Paolo Carlini <paolo.carlini@oracle.com>
256 * lambda.c (nonlambda_method_basetype): Don't use LAMBDA_TYPE_P
259 2017-11-29 Jason Merrill <jason@redhat.com>
261 PR c++/82760 - memory corruption with aligned new.
262 * call.c (build_operator_new_call): Update *args if we add the
265 2017-11-28 Jakub Jelinek <jakub@redhat.com>
268 * cp-tree.h (SWITCH_STMT_ALL_CASES_P): Define.
269 (SWITCH_STMT_NO_BREAK_P): Define.
270 (note_break_stmt, note_iteration_stmt_body_start,
271 note_iteration_stmt_body_end): Declare.
272 * decl.c (struct cp_switch): Add has_default_p, break_stmt_seen_p
273 and in_loop_body_p fields.
274 (push_switch): Clear them.
275 (pop_switch): Set SWITCH_STMT_CANNOT_FALLTHRU_P if has_default_p
276 and !break_stmt_seen_p. Assert in_loop_body_p is false.
277 (note_break_stmt, note_iteration_stmt_body_start,
278 note_iteration_stmt_body_end): New functions.
279 (finish_case_label): Set has_default_p when both low and high
281 * parser.c (cp_parser_iteration_statement): Use
282 note_iteration_stmt_body_start and note_iteration_stmt_body_end
283 around parsing iteration body.
284 * pt.c (tsubst_expr): Likewise.
285 * cp-objcp-common.c (cxx_block_may_fallthru): Return false for
286 SWITCH_STMT which contains no BREAK_STMTs, contains a default:
287 CASE_LABEL_EXPR and where SWITCH_STMT_BODY isn't empty and
289 * semantics.c (finish_break_stmt): Call note_break_stmt.
290 * cp-gimplify.c (genericize_switch_stmt): Copy SWITCH_STMT_ALL_CASES_P
291 bit to SWITCH_ALL_CASES_P. Assert that if SWITCH_STMT_NO_BREAK_P then
292 the break label is not TREE_USED.
294 2017-11-28 Julia Koval <julia.koval@intel.com>
295 Sebastian Peryt <sebastian.peryt@intel.com>
297 * Make-lang.in (cp/cp-array-notation.o, cp/cp-cilkplus.o): Delete.
298 * call.c (convert_for_arg_passing, build_cxx_call): Remove cilkplus.
299 * constexpr.c (potential_constant_expression_1): Ditto.
300 * cp-array-notation.c: Delete.
301 * cp-cilkplus.c: Ditto.
302 * cp-cilkplus.h: Ditto.
303 * cp-gimplify.c (cp_gimplify_expr, cp_fold_r, cp_genericize): Remove
305 * cp-objcp-common.c (ARRAY_NOTATION_REF): Delete.
306 * cp-tree.h (cilkplus_an_triplet_types_ok_p): Delete.
307 * decl.c (grokfndecl, finish_function): Remove cilkplus condition.
308 * error.c (dump_decl, dump_expr): Remove ARRAY_NOTATION_REF condition.
309 * lambda.c (cp-cilkplus.h): Remove.
310 * parser.c (cp_parser_cilk_simd, cp_parser_cilk_for,
311 cp_parser_cilk_simd_vectorlength): Delete.
312 (cp_debug_parser, cp_parser_ctor_initializer_opt_and_function_body,
313 cp_parser_postfix_expression,
314 cp_parser_postfix_open_square_expression,
315 cp_parser_statement, cp_parser_jump_statement,
316 cp_parser_direct_declarator,
317 cp_parser_late_return_type_opt, cp_parser_gnu_attribute_list,
318 cp_parser_omp_clause_name, cp_parser_omp_clause_aligned,
319 cp_parser_omp_clause_linear, cp_parser_omp_all_clauses,
321 cp_parser_omp_for_cond, cp_parser_omp_for_incr,
322 cp_parser_omp_for_loop_init,
323 cp_parser_omp_for_loop,
324 cp_parser_omp_declare_simd): Remove cilkplus support.
325 (CILK_SIMD_FN_CLAUSE_MASK, cp_parser_late_parsing_cilk_simd_fn_info,
326 cp_parser_cilk_grainsize): Remove.
327 (cp_parser_pragma, c_parse_file): Remove cilkplus support.
328 (cp_parser_cilk_simd_vectorlength, cp_parser_cilk_simd_linear,
329 cp_parser_cilk_simd_clause_name, cp_parser_cilk_simd_all_clauses,
330 cp_parser_cilk_simd, cp_parser_cilk_for): Remove.
331 * parser.h (IN_CILK_SIMD_FOR, IN_CILK_SPAWN): Remove.
332 * pt.c (tsubst_attribute, tsubst_expr, tsubst_copy_and_build): Remove
334 * semantics.c (finish_goto_stmt, begin_while_stmt, finish_do_body,
335 finish_init_stmt, finish_switch_cond, simplify_aggr_init_expr,
336 finish_omp_clauses, finish_omp_clauses, finish_omp_for): Remove
339 * tree.c (lvalue_kind): Remove ARRAY_NOTATION_REF conditon.
340 * typeck.c (cp_build_array_ref, cp_build_compound_expr,
341 check_return_expr): Remove cilkplus support.
343 2017-11-28 Jakub Jelinek <jakub@redhat.com>
345 * cp-gimplify.c (genericize_switch_stmt): Build SWITCH_EXPR using
346 build2_loc instead of build3_loc.
348 2017-11-27 Martin Sebor <msebor@redhat.com>
351 * init.c (warn_placement_new_too_small): Use offset_int instead of
354 2017-11-27 Jakub Jelinek <jakub@redhat.com>
357 * parser.c (cp_parser_decomposition_declaration): Reject just
358 BRACE_ENCLOSED_INITIALIZER_P initializers with nelts != 1 rather
359 than all such CONSTRUCTORs, and only if is_direct_init is true.
361 2017-11-27 Jason Merrill <jason@redhat.com>
363 * pt.c (primary_template_specialization_p): Rename from
364 primary_template_instantiation_p. Don't check
365 DECL_TEMPLATE_INSTANTIATION.
366 * call.c, cp-tree.h, decl2.c: Adjust.
368 2017-11-27 Jakub Jelinek <jakub@redhat.com>
371 * cp-gimplify.c (cp_fold) <case COND_EXPR>: Don't return immediately
372 for VOID_TYPE_P COND_EXPRs, instead fold the operands and if op0 is
373 INTEGER_CST, ensure that both op1 and op2 are non-NULL and fall
374 through into normal folding, otherwise just rebuild x if any op
377 2017-11-14 Boris Kolpackov <boris@codesynthesis.com>
379 * Make-lang.in (c++.install-plugin): Install backend import library.
381 2017-11-23 Jakub Jelinek <jakub@redhat.com>
383 * parser.c (cp_parser_omp_declare): Change return type to bool from
384 void, return true for declare simd.
385 (cp_parser_pragma): Return cp_parser_omp_declare returned value
386 rather than always false.
388 2017-11-23 Mike Stump <mikestump@comcast.net>
389 Eric Botcazou <ebotcazou@adacore.com>
391 * pt.c (tsubst_expr) <ANNOTATE_EXPR>: Recurse on 3rd operand.
392 * semantics.c (finish_while_stmt_cond): Pass 3rd operand to
394 (finish_do_stmt): Likewise.
395 (finish_for_cond): Likewise.
397 2017-11-22 Jakub Jelinek <jakub@redhat.com>
400 * name-lookup.c (member_name_cmp): Return 0 if a == b.
402 2017-11-22 David Malcolm <dmalcolm@redhat.com>
405 * error.c (type_to_string): Add leading comment. Add params
406 "postprocessed", "quote", and "show_color", using them to fix
407 quoting of the "aka" for types involving typedefs.
408 (arg_to_string): Update for new params to type_to_string.
409 (cxx_format_postprocessor::handle): Likewise.
410 (cp_printer): Convert penultimate param from bool to bool *.
411 Update call to type_to_string and calls to
412 defer_phase_2_of_type_diff.
414 2017-11-22 Marek Polacek <polacek@redhat.com>
419 * class.c (layout_class_type): Set DECL_PADDING_P on padding.
420 * decl.c (cxx_init_decl_processing): Set TRANSLATION_UNIT_WARN_EMPTY_P.
421 (grokdeclarator): Set DECL_PADDING_P on unnamed bit-fields.
423 2017-11-21 Martin Liska <mliska@suse.cz>
425 * class.c (finalize_literal_type_property): Add quotes for
427 (explain_non_literal_class): Likewise.
428 * constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
429 (is_valid_constexpr_fn): Likewise.
430 (check_constexpr_ctor_body): Likewise.
431 (register_constexpr_fundef): Likewise.
432 (explain_invalid_constexpr_fn): Likewise.
433 (cxx_eval_builtin_function_call): Likewise.
434 (cxx_eval_call_expression): Likewise.
435 (cxx_eval_loop_expr): Likewise.
436 (potential_constant_expression_1): Likewise.
437 * decl.c (check_previous_goto_1): Likewise.
438 (check_goto): Likewise.
439 (grokfndecl): Likewise.
440 (grokdeclarator): Likewise.
441 * error.c (maybe_print_constexpr_context): Likewise.
442 * method.c (process_subob_fn): Likewise.
443 (defaulted_late_check): Likewise.
444 * parser.c (cp_parser_compound_statement): Likewise.
446 2017-11-21 Marc Glisse <marc.glisse@inria.fr>
448 * constexpr.c (cxx_eval_constant_expression,
449 potential_constant_expression_1): Handle POINTER_DIFF_EXPR.
450 * cp-gimplify.c (cp_fold): Likewise.
451 * error.c (dump_expr): Likewise.
452 * typeck.c (pointer_diff): Use POINTER_DIFF_EXPR.
454 2017-11-21 Jakub Jelinek <jakub@redhat.com>
456 P0428R2 - familiar template syntax for generic lambdas
457 * parser.c (cp_parser_lambda_declarator_opt): Don't pedwarn
458 for cxx2a and above, reword pedwarn for C++14/C++17.
460 2017-11-20 David Malcolm <dmalcolm@redhat.com>
463 * name-lookup.c: Include "c-family/known-headers.h"
464 (lookup_name_fuzzy): Call get_cp_stdlib_header_for_name and
465 potentially return a new suggest_missing_header hint.
467 2017-11-20 David Malcolm <dmalcolm@redhat.com>
470 * name-lookup.c (class macro_use_before_def): New class.
471 (lookup_name_fuzzy): Detect macro that were used before being
472 defined, and report them as such.
474 2017-11-20 Jason Merrill <jason@redhat.com>
476 * decl2.c (constrain_class_visibility): Don't warn about artificial
479 2017-11-20 Jakub Jelinek <jakub@redhat.com>
481 P0329R4: Designated Initialization
482 * parser.c (cp_parser_initializer_clause): List in comment grammar
483 designated-initializer-list.
484 (cp_parser_initializer_list): Allow .identifier = without pedwarn for
485 C++2A, parse .identifier { ... }. Improve location_t argument to
486 pedwarn. Add pedwarn for [cst] = designators. Diagnose ... in
487 designated initializer list. Diagnose mixing designated and
488 non-designated initializer clauses for C++2A. Diagnose duplicated
489 identifiers in designators.
490 * name-lookup.h (search_anon_aggr): New declaration.
491 * name-lookup.c (fields_linear_search): Use search_anon_aggr.
492 (search_anon_aggr): New function.
493 * typeck2.c (process_init_constructor_record): Allow designator
494 to skip over some non-static data members. Handle anonymous
495 aggregates. Add diagnostics for designator order not matching
496 member declaration order.
498 2017-11-20 David Malcolm <dmalcolm@redhat.com>
500 * name-lookup.c: Define INCLUDE_UNIQUE_PTR before including system.h.
501 Include "c-family/name-hint.h"
502 (suggest_alternatives_for): Convert "fuzzy_name" from const char *
503 to name_hint, and rename to "hint". Pass location to
505 (lookup_name_fuzzy): Convert return type from const char *
506 to name_hint. Add location_t param.
507 * parser.c: Define INCLUDE_UNIQUE_PTR before including system.h.
508 Include "c-family/name-hint.h"
509 (cp_parser_diagnose_invalid_type_name): Convert
510 "suggestion" from const char * to name_hint, and rename to "hint".
511 Pass location to lookup_name_fuzzy.
513 2017-11-20 Nathan Sidwell <nathan@acm.org>
517 * call.c (build_call_a): Don't set CALL_FROM_THUNK_P for inherited
519 * cp-gimplify.c (cp_genericize_r): Restore THUNK dereference
520 inhibibition check removed in previous c++/78495 change.
522 2017-11-20 Jakub Jelinek <jakub@redhat.com>
525 * constexpr.c (cxx_eval_vector_conditional_expression): New function.
526 (cxx_eval_constant_expression) <case VEC_COND_EXPR>: Use it instead
527 of cxx_eval_conditional_expression.
529 2017-11-19 Jakub Jelinek <jakub@redhat.com>
533 * cp-gimplify.c (c_fully_fold): Add LVAL argument, call
534 cp_fold_maybe_rvalue instead of cp_fold_rvalue and pass it !LVAL.
536 2017-11-16 Jason Merrill <jason@redhat.com>
538 PR c++/79092 - non-type args of different types are different
539 * tree.c (cp_tree_equal): Check the type of constants.
540 * pt.c (unify) [TEMPLATE_PARM_INDEX]: Handle UNIFY_ALLOW_INTEGER
541 when comparing to previously deduced argument.
542 (maybe_convert_nontype_argument): New.
543 (convert_nontype_argument): Call it.
544 (tsubst_copy_and_build): Handle partial instantiation of
546 (unify): Ignore type when deducing from array bound.
547 (dependent_type_p_r): Handle DEFERRED_NOEXCEPT.
548 (value_dependent_expression_p): Any type-dependent expression is
549 value-dependent. Handle IMPLICIT_CONV_EXPR.
550 * cp-tree.h (IMPLICIT_CONV_EXPR_NONTYPE_ARG): New.
551 * mangle.c (write_template_arg): Strip IMPLICIT_CONV_EXPR.
553 2017-11-16 Nathan Sidwell <nathan@acm.org>
557 * cp-objcp-common.h (LANG_HOOKS_OVERWRITE_DECL_ASSEMBLER_NAME):
559 * cp-tree.h (overwrite_mangling): Declare.
560 * decl2.c (struct mangled_decl_hash): Entries are deletable.
561 (overwrite_mangling): New.
564 * decl.c (xref_tag_1): Push lambda into current scope.
565 * name-lookup.c (do_pushtag): Don't deal with ts_lambda here.
567 2017-11-15 Nathan Sidwell <nathan@acm.org>
570 * lambda.c (lambda_capture_field_type): Function references are
571 always catured by reference.
573 2017-11-15 Martin Liska <mliska@suse.cz>
575 * decl.c (begin_destructor_body): Use cp_build_fold_indirect_ref
576 instead of cp_build_indirect_ref.
578 2017-11-15 Martin Liska <mliska@suse.cz>
580 * decl.c (begin_destructor_body): In case of VPTR sanitization
581 (with disabled recovery), zero vptr in order to catch virtual calls
582 after lifetime of an object.
584 2017-11-14 Jason Merrill <jason@redhat.com>
586 Use GTY((cache)) on some hash tables.
587 * decl.c (decomp_type_table): Use tree_cache_map.
588 * init.c (nsdmi_inst): Likewise.
589 * pt.c (defarg_ints): Likewise.
590 * cp-objcp-common.c (cp_get_debug_type): Likewise.
592 2017-11-13 Jason Merrill <jason@redhat.com>
594 Capture adjustments for P0588R1.
595 * semantics.c (process_outer_var_ref): Capture variables when
596 they are named; complain about non-capture uses when odr-used.
597 * expr.c (mark_use): Rvalue use looks through capture proxy.
598 * constexpr.c (potential_constant_expression_1): Improve error about
599 use of captured variable.
600 * lambda.c (need_generic_capture, dependent_capture_r)
601 (do_dependent_capture, processing_nonlambda_template): Remove.
602 * call.c (build_this): Remove uses of the above.
603 * decl.c (cp_finish_decl): Likewise.
604 * semantics.c (maybe_cleanup_point_expr)
605 (maybe_cleanup_point_expr_void, finish_goto_stmt)
606 (maybe_convert_cond): Likewise.
607 * typeck.c (check_return_expr): Likewise.
610 * typeck.c (cp_build_fold_indirect_ref): New.
611 (cp_build_indirect_ref_1): Split out from cp_build_indirect_ref.
612 Add 'fold' parameter.
613 * cp-tree.h: Declare cp_build_fold_indirect_ref.
614 * call.c, class.c, cp-ubsan.c, decl.c, except.c, init.c, lambda.c,
615 parser.c, rtti.c, tree.c, typeck.c, typeck2.c: Use it.
616 * parser.c (do_range_for_auto_deduction): Use RO_UNARY_STAR.
617 (cp_convert_range_for): Likewise.
618 * typeck2.c (build_x_arrow): Use RO_ARROW.
620 * cp-ubsan.c (cp_ubsan_check_member_access_r): Fix handling of
621 INDIRECT_REF of ADDR_EXPR.
623 PR c++/82360 - ICE with static_cast in template.
624 * call.c (perform_direct_initialization_if_possible): Check
625 processing_template_decl.
626 * typeck.c (build_static_cast_1): Likewise.
628 2017-11-13 Ville Voutilainen <ville.voutilainen@gmail.com>
630 Remove the null check from placement new in all modes
631 * init.c (build_new_1): Don't do a null check for
632 a namespace-scope non-replaceable placement new
633 in any mode unless -fcheck-new is provided.
635 2017-11-07 Boris Kolpackov <boris@codesynthesis.com>
637 * Make-lang.in (CP_PLUGIN_HEADERS): Add operators.def since included
640 2017-11-07 Jakub Jelinek <jakub@redhat.com>
643 * cp-gimplify.c (cxx_omp_clause_apply_fn): For methods pass i - 1 to
644 convert_default_arg instead of i.
646 2017-11-06 Jason Merrill <jason@redhat.com>
648 P0704R1 - fixing const-qualified pointers to members
649 * typeck2.c (build_m_component_ref): Also accept in lower stds with
652 2017-11-06 Paolo Carlini <paolo.carlini@oracle.com>
655 * decl2.c (finish_static_data_member_decl): If there's an initializer,
656 complete the type and re-apply the quals.
658 2017-11-06 Martin Liska <mliska@suse.cz>
661 * constexpr.c (cxx_eval_builtin_function_call): Handle
662 __builtin_unreachable call.
663 (get_function_named_in_call): Declare function earlier.
664 (constexpr_fn_retval): Skip __builtin_unreachable.
665 * cp-gimplify.c (cp_ubsan_maybe_instrument_return): Rename to
667 (cp_maybe_instrument_return): ... this.
668 (cp_genericize): Call the function unconditionally.
670 2017-11-03 Nathan Sidwell <nathan@acm.org>
673 * decl.c (grokdeclarator): Protect MAYBE_CLASS things from paren
676 2017-11-02 Paolo Carlini <paolo.carlini@oracle.com>
679 * pt.c (make_pack_expansion): Add tsubst_flags_t parameter.
680 (expand_integer_pack, convert_template_argument, coerce_template_parms,
681 gen_elem_of_pack_expansion_instantiation, tsubst_pack_expansion,
682 unify): Adjust calls.
683 * tree.c (cp_build_qualified_type_real): Likewise.
684 * cp-tree.h (make_pack_expansion): Adjust declaration.
686 2017-11-02 Nathan Sidwell <nathan@acm.org>
688 * cp-tree.h (IDENTIFIER_NEWDEL_OP_P): Restore, adjust.
689 (IDENTIFIER_NEW_OP_P): New.
690 * decl.c (grokdeclarator): Restore IDENTIFIER_NEWDEL_OP_P use.
691 * pt.c (push_template_decl_real): Likewise.
692 * typeck.c (check_return_expr): Use IDENTIFIER_NEW_OP_P.
695 * decl.c (grokdeclarator): Don't warn when parens protect a return
696 type from a qualified name.
698 2017-11-01 Nathan Sidwell <nathan@acm.org>
700 * cp-tree.h (enum cp_identifier_kind): Delete cik_newdel_op.
701 Renumber and reserve udlit value.
702 (IDENTIFIER_NEWDEL_OP_P): Delete.
703 (IDENTIFIER_OVL_OP_P): New.
704 (IDENTIFIER_ASSIGN_OP_P): Adjust.
705 (IDENTIFIER_CONV_OP_P): Adjust.
706 (IDENTIFIER_OVL_OP_INFO): Adjust.
707 (IDENTIFIER_OVL_OP_FLAGS): New.
708 * decl.c (grokdeclarator): Use IDENTIFIER_OVL_OP_FLAGS.
709 * lex.c (get_identifier_kind_name): Adjust.
710 (init_operators): Don't special case new/delete ops.
711 * mangle.c (write_unqualified_id): Use IDENTIFIER_OVL_OP_P.
712 * pt.c (push_template_decl_real): Use IDENTIFIER_OVL_OP_FLAGS.
713 * typeck.c (check_return_expr): Likewise.
715 * cp-tree.h (assign_op_identifier, call_op_identifier): Use
717 (struct lang_decl_fn): Use compressed operator code.
718 (DECL_OVERLOADED_OPERATOR_CODE): Replace with ...
719 (DECL_OVERLOADED_OPERATOR_CODE_RAW): ... this.
720 (DECL_OVERLOADED_OPERATOR_CODE_IS): Use it.
721 * decl.c (duplicate_decls): Use DECL_OVERLOADED_OPERATOR_CODE_RAW.
722 (build_library_fn): Likewise.
723 (grok_op_properties): Likewise.
724 * mangle.c (write_unqualified_name): Likewise.
725 * method.c (implicitly_declare_fn): Likewise.
726 * typeck.c (check_return_expr): Use DECL_OVERLOADED_OPERATOR_IS.
728 * cp-tree.h (IDENTIFIER_CP_INDEX): Define.
729 (enum ovl_op_flags): Add OVL_OP_FLAG_AMBIARY.
730 (enum ovl_op_code): New.
731 (struct ovl_op_info): Add ovl_op_code field.
732 (ovl_op_info): Size by OVL_OP_MAX.
733 (ovl_op_mapping, ovl_op_alternate): Declare.
734 (OVL_OP_INFO): Adjust for mapping array.
735 (IDENTIFIER_OVL_OP_INFO): New.
736 * decl.c (ambi_op_p, unary_op_p): Delete.
737 (grok_op_properties): Use IDENTIFIER_OVL_OP_INFO and
739 * lex.c (ovl_op_info): Adjust and static initialize.
740 (ovl_op_mappings, ovl_op_alternate): Define.
741 (init_operators): Iterate over ovl_op_info array and init mappings
743 * mangle.c (write_unqualified_id): Use IDENTIFIER_OVL_OP_INFO.
744 * operators.def (DEF_OPERATOR): Remove KIND parm.
745 (DEF_SIMPLE_OPERATOR): Delete.
746 (OPERATOR_TRANSITION): Expand if defined.
748 2017-10-31 David Malcolm <dmalcolm@redhat.com>
750 * pt.c (listify): Use %< and %> for description of #include.
752 2017-10-31 David Malcolm <dmalcolm@redhat.com>
754 * class.c (explain_non_literal_class): Use UNKNOWN_LOCATION rather
756 * name-lookup.c (suggest_alternatives_for): Update for renaming of
758 (maybe_suggest_missing_header): Likewise.
759 (suggest_alternative_in_explicit_scope): Likewise.
760 * parser.c (cp_parser_diagnose_invalid_type_name): Likewise for
761 renaming of error_at_rich_loc.
762 (cp_parser_string_literal): Likewise.
763 (cp_parser_nested_name_specifier_opt): Likewise.
764 (cp_parser_cast_expression): Likewise for renaming of
766 (cp_parser_decl_specifier_seq): Likewise for renaming of
767 error_at_rich_loc and warning_at_rich_loc.
768 (cp_parser_elaborated_type_specifier): Likewise for renaming of
770 (cp_parser_cv_qualifier_seq_opt): Likewise for renaming of
772 (cp_parser_virt_specifier_seq_opt): Likewise.
773 (cp_parser_class_specifier_1): Likewise.
774 (cp_parser_class_head): Likewise.
775 (cp_parser_member_declaration): Likewise for renaming of
776 pedwarn_at_rich_loc, warning_at_rich_loc, and error_at_rich_loc.
777 (cp_parser_enclosed_template_argument_list): Likewise for renaming
778 of error_at_rich_loc.
779 (set_and_check_decl_spec_loc): Likewise.
780 * pt.c (listify): Likewise.
781 * rtti.c (typeid_ok_p): Likewise.
782 * semantics.c (process_outer_var_ref): Use UNKNOWN_LOCATION rather
784 * typeck.c (access_failure_info::maybe_suggest_accessor): Update
785 for renaming of inform_at_rich_loc.
786 (finish_class_member_access_expr): Likewise for renaming of
789 2017-10-31 Nathan Sidwell <nathan@acm.org>
791 * cp-tree.h (struct operator_name_info_t): Rename to ...
792 (struct ovl_op_info_t): ... here. Add tree_code field.
793 (operator_name_info, assignment_operator_name_info): Delete.
794 (ovl_op_info): Declare.
795 (OVL_OP_INFO): Adjust.
796 * decl.c (grok_op_properties): Use ovl_op_flags.
797 * lex.c (operator_name_info, assignment_operator_name_info):
799 (ovl_op_info): Define.
800 (set_operator_ident): Adjust.
801 (init_operators): Set tree_code.
802 * mangle.c (write_unqualified_id): Adjust operator array scan.
804 * lex.c (init_operators): Allow NULL operator name. Don't add
806 * operators.def: Use NULL for mangling only operators. Move to
807 after regular operators but move assignment operators last.
809 * cp-tree.h (enum ovl_op_flags): New.
810 (struct operator_name_info_t): Rename arity to flags.
811 * lex.c (set_operator_ident): New.
812 (init_operators): Use it. Adjust for flags.
813 * mangle.c (write_unqualified_id): Adjust for flags.
814 * operators.def: Replace arity with flags.
816 * cp-tree.h (ovl_op_identifier): New.
817 (assign_op_identifier, call_op_identifier): Adjust.
818 (cp_operator_id, cp_assignment_operator_ide): Delete.
819 (SET_OVERLOADED_OPERATOR_CODE): Delete.
821 * call.c (op_error): Use OVL_OP_INFO.
822 (build_conditional_expr_1): Use ovl_op_identifier.
823 (build_new_op_1): Use OVL_OP_INFO & ovl_op_identifier.
824 (build_op_delete_call): Likewise.
825 * class.c (type_requires_array_cookie): Use ovl_op_identifier.
826 * decl.c (duplicate_decls): Directly copy operator code.
827 (builtin_function_1): Do not set operator code.
828 (build_library_fn): Directly set operator code.
829 (push_cp_library_fn): Use ovl_op_identifier.
830 (grok_op_properties): Directly set operator code.
831 * decl2.c (maybe_warn_sized_delete): Use ovl_op_identifier.
832 * error.c (dump_expr): Use OVL_OP_INFO.
833 (op_to_string): Add assop arg. Use OVL_OP_INFO.
834 (assop_to_string): Delete.
835 (args_to_string): Adjust.
836 * init.c (build_new_1): Use ovl_op_identifier.
837 * mangle.c (write_unqualified_name): Use OVL_OP_INFO.
838 (write_expression): Likewise.
839 * method.c (synthesized_method_walk): Use ovl_op_identifier.
840 (implicitly_declare_fn): Use assign_op_identifier. Directly set
842 * name-lookup.c (get_class_binding): Use assign_op_identifier.
843 * parser.c (cp_parser_operator): Use ovl_op_identifier.
844 (cp_parser_omp_clause_reduction): Likewise.
845 * semantics.c (omp_reduction_id): Likewise.
846 * typeck.c (cxx_sizeof_or_alignof_type): Use OVL_OP_INFO.
848 * cp-tree.h (assign_op_identifier, call_op_identifier): Define.
849 (LAMBDA_FUNCTION_P): Use DECL_OVERLOADED_OPERATOR_IS.
850 (DECL_OVERLOADED_OPERATOR_P): Just retuurn true/false.
851 (DECL_OVERLOADED_OPERATOR_CODE, DECL_OVERLOADED_OPERATOR_IS): Define.
852 * call.c (add_function_candidate): Use
853 DECL_OVERLOADED_OPERATOR_IS.
854 (build_op_call_1): Use call_op_identifier &
855 DECL_OVERLOADED_OPERATOR_IS.
856 (build_over_call): Likewise.
857 (has_trivial_copy_assign_p): Use assign_op_identifier.
858 (build_special_member_call): Likewise.
859 * class.c (dfs_declare_virt_assop_and_dtor): Likewise.
860 (vbase_has_user_provided_move_assign,
861 classtype_has_move_assign_or_move_ctor_p): Likewise.
862 * decl.c (duplicate_decls): Use DECL_OVERLOADED_OPERATOR_CODE.
863 (grok_special_member_properties): Use assign_op_identifier.
864 (start_preparsed_function): Use DECL_OVERLOADED_OPERATOR_IS.
865 * decl2.c (mark_used): Use DECL_CONV_FN_P.
866 * dump.c (dump_access): Delete prototype.
868 (cp_dump_tree): Don't call it.
869 * lambda.c (lambda_function): Use call_op_identifier.
870 (maybe_add_lambda_conv_op): Not an overloaded operator. Remove
872 * mangle.c (write_unqualified_name): Use DECL_OVERLOADED_OPERTOR_CODE.
873 * method.c (do_build_copy_assign): Use assign_op_identifier.
874 (synthesize_method): Use DECL_OVERLOADED_OPERATOR_IS.
875 (get_copy_assign): Use assign_op_identifier.
876 (synthesized_method_walk): Likewise.
877 (defaultable_fn_check): Use DECL_OVERLOADED_OPERATOR_IS.
878 * parser.c (cp_parser_lambda_declarator_opt): Use
880 * semanitics.c (classtype_has_nothrow_assign_or_copy_p): Use
881 assign_op_identifier.
882 * tree.c (special_function_p): Use DECL_OVERLOADED_OPERATOR_IS.
883 * typeck.c (check_return_expr): Use DECL_OVERLOADED_OPERATOR_CODE.
884 (check_return_expr): Use assign_op_identifier.
886 2017-10-30 Paolo Carlini <paolo.carlini@oracle.com>
889 * pt.c (tsubst_copy_and_build, [INDIRECT_REF]): For a REFERENCE_REF_P,
890 unconditionally call convert_from_reference.
892 2017-10-30 Nathan Sidwell <nathan@acm.org>
894 * call.c (build_op_call_1): Test for FUNCTION_DECL in same manner
895 as a few lines earlier.
896 * cp-tree.h (PACK_EXPANSION_PATTERN): Fix white space.
897 * decl.c (grokfndecl): Fix indentation.
898 (compute_array_index_type): Use processing_template_decl_sentinel.
899 (grok_op_properties): Move warnings to end. Reorder other checks
900 to group similar entities. Tweak diagnostics.
901 * lex.c (unqualified_name_lookup_error): No need to check name is
902 not ERROR_MARK operator.
903 * parser.c (cp_parser_operator): Select operator code before
905 * typeck.c (check_return_expr): Fix indentation and line wrapping.
907 2017-10-27 Paolo Carlini <paolo.carlini@oracle.com>
909 * pt.c (invalid_nontype_parm_type_p): Return a bool instead of an int.
911 2017-10-26 Nathan Sidwell <nathan@acm.org>
913 * decl.c (sort_labels): Restore function.
914 (pop_labels): Sort labels
915 (identify_goto): Add translation markup.
917 2017-10-25 Nathan Sidwell <nathan@acm.org>
919 Kill IDENTIFIER_LABEL_VALUE.
920 * cp-tree.h (lang_identifier): Delete label_value slot.
921 (IDENTIFIER_LABEL_VALUE, SET_IDENTIFIER_LABEL_VALUE): Delete.
922 (struct named_label_hasher): Rename to ...
923 (struct named_label_hash): ... here. Reimplement.
924 (struct language_function): Adjust x_named_labels.
925 * name-lookup.h (struct cp_label_binding): Delete.
926 (struct cp_binding_level): Delete shadowed_labels slot.
927 * decl.c (struct named_label_entry): Add name and outer slots.
928 (pop_label): Rename to ...
929 (check_label_used): ... here. Don't pop.
930 (note_label, sort_labels): Delete.
931 (pop_labels, pop_local_label): Reimplement.
932 (poplevel): Pop local labels as any other decl. Remove
933 shadowed_labels handling.
934 (named_label_hash::hash, named_label_hash::equal): New.
935 (make_label_decl): Absorb into ...
936 (lookup_label_1): ... here. Add making_local_p arg, reimplement.
937 (lookup_label, declare_local_label): Adjust.
938 (check_goto, define_label): Adjust.
939 * lex.c (make_conv_op_name): Don't clear IDENTIFIER_LABEL_VALUE.
940 * ptree.c (cxx_print_identifier): Don't print identifier binding.
942 * decl.c (identifier_goto): Reduce duplication.
943 (check_previous_goto_1): Likewise.
944 (check_goto): Move var decls to initialization.
945 (check_omp_return, define_label_1, define_label): Likewise.
947 2017-10-25 Jakub Jelinek <jakub@redhat.com>
950 * decl.c (duplicate_decls): Copy "omp declare simd" attributes from
951 newdecl to corresponding __builtin_ if any.
953 2017-10-24 Paolo Carlini <paolo.carlini@oracle.com>
956 * decl.c (duplicate_decls): Warn for built-in functions declared as
957 non-function, use OPT_Wbuiltin_declaration_mismatch.
959 * decl.c (duplicate_decls): Avoid redundant '+' in warning_at.
961 2017-10-24 Paolo Carlini <paolo.carlini@oracle.com>
964 * pt.c (value_dependent_expression_p, [TRAIT_EXPR]): Handle
965 a TREE_LIST as TRAIT_EXPR_TYPE2.
967 2017-10-24 Mukesh Kapoor <mukesh.kapoor@oracle.com>
968 Paolo Carlini <paolo.carlini@oracle.com>
971 * cvt.c (type_promotes_to): Implement C++17, 7.6/4, about unscoped
972 enumeration type whose underlying type is fixed.
974 2017-10-23 Paolo Carlini <paolo.carlini@oracle.com>
977 * semantics.c (finish_compound_literal): Check do_auto_deduction
978 return value for error_mark_node.
980 2017-10-23 Jason Merrill <jason@redhat.com>
982 PR c++/77369 - wrong noexcept handling in C++14 and below
983 * tree.c (strip_typedefs): Canonicalize TYPE_RAISES_EXCEPTIONS.
985 2017-10-20 Nathan Sidwell <nathan@acm.org>
987 * class.c (layout_class_type): Cleanup as-base creation, determine
989 (finish_struct_1): ... not here.
991 2017-10-19 Jakub Jelinek <jakub@redhat.com>
994 * typeck.c (check_return_expr): Don't call
995 maybe_warn_about_returning_address_of_local in templates.
997 2017-10-17 Nathan Sidwell <nathan@acm.org>
1000 * call.c (build_over_call): Don't pass tf_no_cleanup to nested
1004 * cp-objcp-common.c (cp_tree_size): Reformat. Adjust returns size
1007 2017-10-13 Jason Merrill <jason@redhat.com>
1009 PR c++/82357 - bit-field in template
1010 * tree.c (cp_stabilize_reference): Just return a NON_DEPENDENT_EXPR.
1012 2017-10-13 David Malcolm <dmalcolm@redhat.com>
1014 * cp-tree.h (maybe_show_extern_c_location): New decl.
1015 * decl.c (grokfndecl): When complaining about literal operators
1016 with C linkage, issue a note giving the location of the
1018 * parser.c (cp_parser_new): Initialize new field
1019 "innermost_linkage_specification_location".
1020 (cp_parser_linkage_specification): Store the location
1021 of the linkage specification within the cp_parser.
1022 (cp_parser_explicit_specialization): When complaining about
1023 template specializations with C linkage, issue a note giving the
1024 location of the extern "C".
1025 (cp_parser_explicit_template_declaration): Likewise for templates.
1026 (maybe_show_extern_c_location): New function.
1027 * parser.h (struct cp_parser): New field
1028 "innermost_linkage_specification_location".
1030 2017-10-12 Nathan Sidwell <nathan@acm.org>
1032 * cp-tree.h (cp_expr): Add const operator * and operator->
1034 (cp_tree_node_structure_enum): Delete TS_CP_BINDING,
1035 TS_CP_WRAPPER, LAST_TS_CP_ENUM.
1037 2017-10-12 David Malcolm <dmalcolm@redhat.com>
1039 * parser.c (get_required_cpp_ttype): New function.
1040 (cp_parser_error_1): Call it, using the result to call
1041 maybe_suggest_missing_token_insertion.
1043 2017-10-12 David Malcolm <dmalcolm@redhat.com>
1045 * parser.c (get_matching_symbol): Move to before...
1046 (cp_parser_error): Split out into...
1047 (cp_parser_error_1): ...this new function, merging in content
1049 (cp_parser_required_error): ...here. Eliminate partial duplicate
1050 of body of cp_parser_error in favor of a call to the new
1051 cp_parser_error_1 helper function.
1053 2017-10-11 Nathan Sidwell <nathan@acm.org>
1055 * decl2.c (struct mangled_decl_hash): Use DECL_ASSEMBLER_NAME_RAW.
1056 (record_mangling): Likewise.
1058 2017-10-10 Nathan Sidwell <nathan@acm.org>
1060 * name-lookup.c (extern_c_fns): Rename to ...
1061 (extern_c_decls): ... here.
1062 (check_extern_c_conflict, extern_c_linkage_bindings): Update.
1063 (do_pushdecl): Check extern-c fns and vars.
1065 * cp-tree.h (default_hash_traits <lang_identifier *>): Delete
1068 * decl2.c (struct mangled_decl_hash): New hash traits.
1069 (mangled_decls): Make hash_table<mangled_decl_hash>.
1070 (generate_mangling_alias, record_mangling): Adjust.
1072 2017-10-10 Jason Merrill <jason@redhat.com>
1074 More delayed lambda capture fixes.
1075 * call.c (add_function_candidate): Use build_address.
1076 (build_op_call_1): Call mark_lvalue_use early.
1077 (build_over_call): Handle error from build_this.
1078 * constexpr.c (cxx_bind_parameters_in_call): Use build_address.
1079 (cxx_eval_increment_expression): Don't use rvalue().
1080 * cvt.c (convert_to_void): Use mark_discarded_use.
1081 * expr.c (mark_use): Handle PARM_DECL, NON_DEPENDENT_EXPR. Fix
1082 reference handling. Don't copy the expression.
1083 (mark_discarded_use): New.
1084 * lambda.c (insert_capture_proxy): Add some sanity checking.
1085 (maybe_add_lambda_conv_op): Set cp_unevaluated_operand.
1086 * pt.c (register_local_specialization): Add sanity check.
1087 * semantics.c (process_outer_var_ref): Fix check for existing proxy.
1088 * typeck.c (cp_build_addr_expr_1): Handle error from
1090 (cp_build_modify_expr): Call mark_lvalue_use_nonread, handle error
1093 Handle generic lambda capture in dependent expressions.
1094 * lambda.c (need_generic_capture, dependent_capture_r)
1095 (do_dependent_capture): New.
1096 * pt.c (processing_nonlambda_template): Use need_generic_capture.
1097 * semantics.c (maybe_cleanup_point_expr)
1098 (maybe_cleanup_point_expr_void, finish_goto_stmt)
1099 (maybe_convert_cond): Call do_dependent_capture.
1100 * typeck.c (build_static_cast): Remove dependent capture handling.
1102 * typeck.c (condition_conversion): Assert !processing_template_decl.
1103 * semantics.c (finish_omp_clauses): Don't
1104 fold_build_cleanup_point_expr if processing_template_decl.
1105 (outer_var_p): A temporary can't be from an outer scope.
1106 * pt.c (type_dependent_expression_p): Fix dependency checking of
1107 functions without DECL_TEMPLATE_INFO.
1108 (instantiate_decl): Use lss_copy.
1109 * constexpr.c (is_valid_constexpr_fn): Fix lambdas before C++17.
1111 * typeck.c (check_return_expr): Check non-dependent conversion in
1113 * constraint.cc (check_function_concept): Don't complain about an
1114 empty concept if seen_error.
1116 2017-10-10 Richard Sandiford <richard.sandiford@linaro.org>
1118 * cvt.c (ignore_overflows): Use wi::to_wide when
1119 operating on trees as wide_ints.
1120 * decl.c (check_array_designated_initializer): Likewise.
1121 * mangle.c (write_integer_cst): Likewise.
1122 * semantics.c (cp_finish_omp_clause_depend_sink): Likewise.
1124 2017-10-10 Nathan Sidwell <nathan@acm.org>
1126 * name-lookup.c (set_global_binding): Don't deal with STAT_HACK.
1128 2017-10-06 Paolo Carlini <paolo.carlini@oracle.com>
1131 * decl.c (finish_function): Take a bool intead of an int; adjust.
1132 * cp-tree.h (finish_function): Adjust declaration.
1133 * decl2.c (generate_tls_wrapper, finish_objects,
1134 finish_static_storage_duration_function): Adjust calls.
1135 * lambda.c (maybe_add_lambda_conv_op, finish_lambda_function):
1137 * method.c (synthesize_method): Likewise.
1138 * optimize.c (maybe_thunk_body, maybe_clone_body): Likewise.
1139 * pt.c (instantiate_decl): Likewise.
1140 * parser.c (cp_parser_function_definition_after_declarator,
1141 cp_parser_late_parsing_for_member, cp_parser_omp_declare_reduction):
1143 (cp_parser_ctor_initializer_opt,
1144 cp_parser_ctor_initializer_opt_and_function_body,
1145 cp_parser_function_try_block,
1146 cp_parser_function_definition_after_declarator,
1147 cp_parser_function_transaction): Return void; adjust declarations.
1149 2017-10-06 Nathan Sidwell <nathan@acm.org>
1152 * name-lookup.c (check_local_shadow): Don't try and convert
1155 2017-10-06 Jakub Jelinek <jakub@redhat.com>
1158 * decl.c (reshape_init): Suppress warn_useless_cast for direct enum
1160 * typeck.c (convert_for_assignment): Likewise.
1162 P0704R1 - fixing const-qualified pointers to members
1163 * typeck2.c (build_m_component_ref): For -std=c++2a allow
1164 pointer to const & qualified method on rvalue.
1166 2017-10-06 Nathan Sidwell <nathan@acm.org>
1168 Use hash_table for extern "C" names
1169 * name-lookup.c (extern_c_fns): Use hash_table.
1170 (check_extern_c_conflict): Adjust.
1171 (c_linkage_bindings): Adjust.
1173 Use hash_table for namespace bindings
1174 * cp-tree.h (struct named_decl_hash): New.
1175 (lang_decl_ns): Change type of bindings field.
1176 * lex.c (maybe_add_lang_decl_raw): Adjust.
1177 * name-lookup.c (find_namespace_slot): Adjust.
1178 (do_pushdecl): Push NULL-named namespace.
1179 (do_push_nested_namespace): Adjust.
1180 (push_namespace): Push anonymous namespace as NULL name.
1182 2017-10-05 Jason Merrill <jason@redhat.com>
1184 Pass variadic class objects exactly like named by-value args.
1185 * call.c (convert_arg_to_ellipsis): Use the result of force_rvalue.
1187 2017-10-05 Nathan Sidwell <nathan@acm.org>
1189 Warn on MVP declarations
1190 * cp-tree.h (struct cp_declarator): Add parenthesized field.
1191 * decl.c (grokdeclarator): Warn about unnecessary parens.
1192 * parser.c (make_declarator): Init parenthesized field.
1193 (cp_parser_direct_declarator): Set parenthesized field.
1195 Kill IDENTIFIER_GLOBAL_VALUE, SET_IDENTIFIER_GLOBAL_VALUE
1196 * cp-tree.h (IDENTIFIER_GLOBAL_VALUE,
1197 SET_IDENTIFIER_GLOBAL_VALUE): Delete.
1198 * name-lookup.h (set_global_binding): Remove NAME parm.
1199 (get_global_binding): New inline fn.
1200 * name-lookup.c (set_global_binding): Remove NAME parm. Adjust.
1201 (identifier_global_value): Move to ...
1202 * cp-objcp-common.c (identifier_global_value): ... here.
1203 * class.c (build_ctor_vtbl_group, build_vtbl_initializer): Adjust.
1204 * decl.c (record_builtin_type, expand_static_init,
1205 grokdeclarator): Adjust.
1206 * decl2.c (get_guard, get_local_tls_init_fn, get_tls_init_fn,
1207 get_tls_wrapper_fn, maybe_warn_sized_delete): Adjust.
1208 * except.c (declare_library_fn, build_throw): Adjust.
1209 * init.c (throw_bad_array_length): Adjust.
1210 * rtti.c (throw_bad_cast, throw_bad_typeid, get_tinfo_decl): Adjust.
1212 * decl2.c (record_mangling): Fix spello and formatting from
1215 2017-10-04 Nathan Sidwell <nathan@acm.org>
1217 Give builtin types the correct name.
1218 * name-lookup.c (set_global_binding): Assert name is DECL_NAME.
1219 * decl.c (record_builtin_type): Reimplement, use new TYPE_DECL for
1222 2017-10-04 Paolo Carlini <paolo.carlini@oracle.com>
1223 Andrew Pinski <apinski@cavium.com>
1226 * parser.c (cp_parser_lambda_body): Set parser->in_function_body.
1228 2017-10-04 Nathan Sidwell <nathan@acm.org>
1230 Move mangling aliases out of global namespace.
1231 * cp-tree.h (record_mangling): New.
1232 (maybe_remove_implicit_alias): Delete.
1233 * decl2.c (mangled_decls): New hash map.
1234 (generate_mangling_alias): Reimplement using mangled_decls.
1235 (record_mangling): New.
1236 * mangle.c (decl_implicit_alias_p,
1237 maybe_remove_implicit_alias): Delete.
1238 (mangle_decl): Use record_mangling.
1239 * name-lookup.c (supplement_binding_1): Remove
1240 maybe_remove_implicit_alias check.
1242 2017-10-04 Jakub Jelinek <jakub@redhat.com>
1245 * error.c (dump_function_decl): If show_return, call dump_type_suffix
1246 on the same return type dump_type_prefix has been called on.
1248 2017-10-04 Jason Merrill <jason@redhat.com>
1250 PR c++/81525 - broken handling of auto in generic lambda.
1251 * pt.c (tsubst_decl) [VAR_DECL]: Use strip_innermost_template_args.
1253 2017-10-04 Nathan Sidwell <nathan@acm.org>
1255 * call.c (convert_arg_to_ellipsis): Correct comment about passing
1258 2017-10-02 Richard Sandiford <richard.sandiford@linaro.org>
1260 * constexpr.c (cxx_eval_store_expression): Use wi::to_widest
1261 when comparing the array bounds with an ARRAY_REF index.
1263 2017-09-30 Paolo Carlini <paolo.carlini@oracle.com>
1266 * method.c (defaulted_late_check): Early return if the defaulted
1267 declaration does not match the expected signature.
1269 2017-09-29 Jakub Jelinek <jakub@redhat.com>
1271 P0683R1 - default member initializers for bit-fields
1272 * cp-tree.h (grokbitfield): Add INIT parameter.
1273 * parser.c (cp_parser_constant_expression): Add STRICT_P argument,
1274 if true, parse a conditional-expression rather than
1275 assignment-expression.
1276 (cp_parser_member_declaration): For C++11 and later pass true
1277 as STRICT_P to cp_parser_constant_expression. Parse C++2A bitfield
1278 NSDMIs. Adjust grokbitfield caller. Handle DECL_INITIAL also for
1280 (cp_parser_objc_class_ivars): Adjust grokbitfield caller.
1281 * class.c (check_field_decl): Recurse even for DECL_C_BIT_FIELDs.
1282 (check_field_decls): Call check_field_decl even for DECL_C_BIT_FIELDs.
1283 * decl2.c (grokbitfield): Add INIT parameter, pass it to
1285 * pt.c (tsubst_decl): Handle DECL_INITIAL for all FIELD_DECLs, not
1288 * class.c (check_bitfield_decl): Retrieve and clear width from
1289 DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL.
1290 (check_field_decls): Test DECL_BIT_FIELD_REPRESENTATIVE rather than
1292 (remove_zero_width_bit_fields): Adjust comment.
1293 * decl2.c (grokbitfield): Stash width into
1294 DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL.
1295 * pt.c (tsubst_decl): For DECL_C_BIT_FIELD, tsubst_expr
1296 DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL for width.
1298 * parser.c (cp_parser_member_declaration): Parse attributes before
1299 colon of a bitfield in addition to after colon.
1301 * Make-lang.in (check-c++-all): Test also c++2a.
1303 2017-09-28 Jason Merrill <jason@redhat.com>
1305 PR c++/56973, DR 696 - capture constant variables only as needed.
1306 * expr.c (mark_use): Split out from mark_rvalue_use and
1307 mark_lvalue_use. Handle lambda capture of constant variables.
1308 (mark_lvalue_use_nonread): New.
1309 * semantics.c (process_outer_var_ref): Don't capture a constant
1310 variable until forced.
1311 * pt.c (processing_nonlambda_template): New.
1312 * call.c (build_this): Check it.
1313 * decl2.c (grok_array_decl): Call mark_rvalue_use and
1314 mark_lvalue_use_nonread.
1315 * init.c (constant_value_1): Don't call mark_rvalue_use.
1316 * typeck.c (build_static_cast): Handle lambda capture.
1318 Use local_specializations to find capture proxies.
1319 * cp-tree.h (DECL_CAPTURED_VARIABLE): New.
1320 * lambda.c (build_capture_proxy): Set it.
1321 (add_capture): Pass initializer to build_capture_proxy.
1322 (start_lambda_function): Likewise.
1323 (insert_capture_proxy): Use register_local_specialization.
1324 (is_lambda_ignored_entity): Always ignore proxies.
1325 * name-lookup.c (qualify_lookup): Don't check
1326 is_lambda_ignored_entity if LOOKUP_HIDDEN is set.
1327 * semantics.c (process_outer_var_ref): Use
1328 retrieve_local_specialization.
1329 * parser.c (cp_parser_lambda_body): Push local_specializations.
1330 * pt.c (tsubst_expr): Pass LOOKUP_HIDDEN when looking for a proxy.
1331 (tsubst_lambda_expr): Push local_specializations sooner.
1332 (tsubst_copy_and_build): Don't register_local_specialization.
1334 * call.c (build_special_member_call): Use the return value of
1336 * decl.c (compute_array_index_type): Likewise.
1337 * parser.c (cp_parser_oacc_wait_list): Likewise.
1338 * lambda.c (is_normal_capture_proxy): Handle *this capture.
1339 (add_capture): Clarify internal_error message.
1341 2017-09-22 Eric Botcazou <ebotcazou@adacore.com>
1344 * cp-objcp-common.c (cp_get_debug_type): Do only one lookup.
1346 2017-09-22 Jakub Jelinek <jakub@redhat.com>
1349 * tree.c (struct replace_placeholders_t): Add pset field.
1350 (replace_placeholders_r): Call cp_walk_tree with d->pset as
1351 last argument instead of NULL. Formatting fix.
1352 (replace_placeholders): Add pset variable, add its address
1353 into data. Pass &pset instead of NULL to cp_walk_tree.
1355 2017-09-22 David Malcolm <dmalcolm@redhat.com>
1357 * call.c (get_fndecl_argument_location): New function.
1358 (convert_like_real): Use it when complaining about argument type
1360 * cp-tree.h (struct cp_parameter_declarator): Add "loc" field.
1361 * parser.c (make_parameter_declarator): Add "loc" param and use
1362 it to initialize the new field.
1363 (cp_parser_translation_unit): Add UNKNOWN_LOCATION for "loc" of
1364 the "no_parameters" parameter.
1365 (cp_parser_parameter_declaration_list): Set the location of the
1366 result of grokdeclarator to be the parameter's loc, assuming no
1368 (cp_parser_parameter_declaration): Generate a location for the
1369 parameter and pass to make_parameter_declarator.
1371 2017-09-20 Nathan Sidwell <nathan@acm.org>
1373 * name-lookup.c (member_name_cmp): Use DECL_UID for final
1376 2017-09-20 Jakub Jelinek <jakub@redhat.com>
1378 P0409R2 - allow lambda capture [=, this]
1379 * parser.c (cp_parser_lambda_introducer): For cxx2a don't pedwarn on
1380 redundant [=, this].
1382 2017-09-18 Jason Merrill <jason@redhat.com>
1384 PR c++/82069 - ICE with lambda in template
1385 * semantics.c (process_outer_var_ref): Check uses_template_parms
1386 instead of any_dependent_template_arguments_p.
1388 2017-09-15 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
1389 Paolo Carlini <paolo.carlini@oracle.com>
1392 * decl2.c (finish_anon_union): Complain about "anonymous union with
1393 no members" with a pedwarn.
1395 2017-09-15 Bernd Edlinger <bernd.edlinger@hotmail.de>
1397 * typeck.c (build_reinterpret_cast_1,
1398 build_const_cast_1): Implement -Wcast-align=strict.
1400 2017-09-15 Jakub Jelinek <jakub@redhat.com>
1402 * decl.c (redeclaration_error_message): Use cxx17 instead of cxx1z,
1403 adjust diagnostics refering to C++1z or -std=gnu++1z or -std=c++1z
1404 to C++17 or -std=gnu++17 or -std=c++17. Adjust comments.
1405 (cxx_init_decl_processing, next_initializable_field,
1406 is_direct_enum_init, check_initializer, cp_finish_decl,
1407 mark_inline_variable, grokdeclarator, grokparms, xref_basetypes,
1408 finish_function): Likewise.
1409 * cp-tree.h (DECL_INLINE_VAR_P): Likewise.
1410 * pt.c (mark_template_parm, convert_nontype_argument,
1411 instantiate_class_template_1, type_unification_real, unify,
1412 get_partial_spec_bindings, dependent_type_p_r): Likewise.
1413 * typeck.c (cp_build_unary_op): Likewise.
1414 * constexpr.c (var_in_maybe_constexpr_fn): Likewise.
1415 * call.c (build_user_type_conversion_1, build_over_call,
1416 build_special_member_call): Likewise.
1417 * lambda.c (begin_lambda_type): Likewise.
1418 * typeck2.c (process_init_constructor_record): Likewise.
1419 * class.c (build_base_field, finalize_literal_type_property,
1420 explain_non_literal_class): Likewise.
1421 * parser.c (cp_parser_diagnose_invalid_type_name,
1422 cp_parser_primary_expression, cp_parser_lambda_introducer,
1423 cp_parser_lambda_declarator_opt, cp_parser_selection_statement,
1424 cp_convert_range_for, cp_parser_perform_range_for_lookup,
1425 cp_parser_decomposition_declaration, cp_parser_linkage_specification,
1426 cp_parser_static_assert, cp_parser_simple_type_specifier,
1427 cp_parser_namespace_definition, cp_parser_using_declaration,
1428 cp_parser_init_declarator, cp_parser_type_parameter_key,
1429 cp_parser_exception_specification_opt, cp_parser_std_attribute_spec,
1430 cp_parser_constructor_declarator_p): Likewise.
1431 * mangle.c (struct globals): Rename need_cxx1z_warning to
1433 (write_exception_spec, start_mangling, mangle_decl): Likewise.
1434 * Make-lang.in (check-c++1z): Rename to check-c++17, depend on
1436 (check-c++17): New goal. Use 17 instead of 1z.
1437 (check-c++-all): Use 17 instead of 1z.
1439 2017-09-14 Jakub Jelinek <jakub@redhat.com>
1442 * cp-gimplify.c (omp_var_to_track): Look through references.
1443 (omp_cxx_notice_variable): Likewise.
1445 2017-09-13 Nathan Sidwell <nathan@acm.org>
1447 Conv-op identifers not in identifier hash table
1448 * lex.c (conv_type_hasher): Make member fns inline.
1449 (make_conv_op_name): Directly clone conv_op_identifier.
1451 Rename CLASSTYPE_METHOD_VEC to CLASSTYPE_MEMBER_VEC.
1452 * cp-tree.h (struct lang_type): Rename methods to members.
1453 (CLASSTYPE_METHOD_VEC): Rename to ...
1454 (CLASSTYPE_MEMBER_VEC): ... this.
1455 * name-lookup.h (get_method_slot): Rename to ...
1456 (get_member_slot): ... this.
1457 (resort_type_method_vec): Rename to ...
1458 (resort_type_member_vec): ... this.
1459 * class.c (add_method, warn_hidden): Adjust.
1460 * search.c (dfs_locate_field_accessor_pre): Adjust.
1461 * name-lookup.c (method_vec_binary_search): Rename to ...
1462 (member_vec_binary_search): ... this and adjust.
1463 (method_vec_linear_search): Rename to ...
1464 (member_vec_linear_search): ... this and adjust.
1465 (fields_linear_search, get_class_binding_direct): Adjust.
1466 (get_method_slot): Rename to ...
1467 (get_member_slot): ... this and adjust.
1468 (method_name_slot): Rename to ...
1469 (member_name_slot): ... this and adjust.
1470 (resort_type_method_vec): Rename to ...
1471 (resort_type_member_vec): ... this and adjust.
1472 (method_vec_append_class_fields): Rename to ...
1473 (member_vec_append_class_fields): ... this and adjust.
1474 (method_vec_append_enum_values): Rename to ...
1475 (member_vec_append_enum_values): ... this and adjust.
1476 (method_vec_dedup): Rename to ...
1477 (member_vec_dedup): ... this and adjust.
1478 (set_class_bindings, insert_late_enum_def_bindings): Adjust.
1480 2017-09-12 Paolo Carlini <paolo.carlini@oracle.com>
1483 * decl.c (start_decl): Early return error_mark_node if duplicate_decls
1484 returns it; avoid misleading error message.
1486 2017-09-12 Nathan Sidwell <nathan@acm.org>
1488 Kill CLASSTYPE_SORTED_FIELDS.
1489 * cp-tree.h (struct lang_type): Lose sorted_fields member.
1490 (CLASSTYPE_SORTED_FIELDS): Delete.
1491 * name-lookup.h (set_class_bindings): Add EXTRA arg.
1492 * name-lookup.c (fields_linear_search): New, broken out of ...
1493 (lookup_field_1): ... here. Delete remainder of function.
1494 (get_class_binding_direct): Reimplement without sorted_fields.
1495 (get_class_binding): Rename TYPE arg to KLASS, for consistency.
1496 (get_method_slot): Call set_class_binding when creating method_vec
1498 (method_name_cmp): Order identically named slots.
1499 (sorted_fields_type_new): Delete.
1500 (field_vc_append_class_fields): Rename to ...
1501 (method_vec_append_class_fields): ... here. Adjust.
1502 (field_vec_append_enum_values): Renme to ...
1503 (method_vec_append_enum_values): ... here. Adjust.
1504 (method_vec_dedup): New.
1505 (set_class_bindings): Reimplement.
1506 (insert_late_enum_def_bindings): Reimplement.
1508 * name-lookup.c (get_class_binding): Rename TYPE arg to KLASS for
1510 (restort_data): Move later.
1511 (method_name_cmp, resort_method_name_cmp): Simplify.
1512 (resort_type_method_vec): Reformat.
1514 2017-09-09 Jason Merrill <jason@redhat.com>
1516 * constexpr.c (reduced_constant_expression_p): If
1517 CONSTRUCTOR_NO_IMPLICIT_ZERO, check that all fields are initialized.
1519 2017-09-09 Eric Botcazou <ebotcazou@adacore.com>
1522 * cp-objcp-common.c (struct debug_type_hasher): New class.
1523 (debug_type_hash): New variable.
1524 (cp_get_debug_type): Associate the OFFSET_TYPEs with the types.
1526 2017-09-08 Jason Merrill <jason@redhat.com>
1528 PR c++/70029 - ICE with ref-qualifier and -flto
1529 * tree.c (cxx_copy_lang_qualifiers): New.
1530 * cp-tree.h: Declare it.
1531 * cp-objcp-common.h: Define LANG_HOOKS_COPY_LANG_QUALIFIERS.
1533 2017-09-06 Jason Merrill <jason@redhat.com>
1535 PR c++/82053 - ICE with default argument in lambda in template
1536 * pt.c (tsubst_arg_types): Substitute default arguments for lambdas
1538 (retrieve_specialization): Use lambda_fn_in_template_p.
1539 * cp-tree.h: Declare it.
1541 PR c++/82070 - error with nested lambda capture
1542 * pt.c (tsubst_expr) [DECL_EXPR]: Register capture proxies with
1543 register_local_specialization.
1545 2017-09-06 Nathan Sidwell <nathan@acm.org>
1547 * name-lookup.h (lookup_field_1): Delete.
1548 (get_class_binding_direct, get_class_binding): Add type_or_fns arg.
1549 * name-lookup.c (lookup_field_1): make static
1550 (method_vec_binary_search, method_vec_linear_search): New. Broken
1552 (get_class_binding_direct): ... here. Add TYPE_OR_FNS argument.
1553 Do complete search of this level.
1554 (get_class_binding): Adjust.
1555 * decl.c (reshape_init_class): Call get_class_binding.
1556 * search.c (lookup_field_r): Move field searching into
1557 get_class_binding_direct.
1559 * class.c (warn_hidden): Don't barf on non-functions.
1560 * decl2.c (check_classfn): Likewise. Check template match earlier.
1562 * name-lookup.c (count_fields): Rename to ...
1563 (count_class_fields): ... here. Take a class, don't count
1565 (add_fields_to_record_type): Rename to ...
1566 (field_vec_append_class_fields): ... here. Take a class, don't
1567 add NULL-named fields.
1568 (add_enum_fields_to_record_type): Rename to ...
1569 (field_vec_append_enum_values): ... here.
1570 (set_class_bindings): Adjust, assert we added expected number.
1571 (insert_late_enum_def_bindings): Reimplement. Create vector if
1572 there are now sufficient entries.
1574 * name-lookup.h (lookup_fnfields_slot_nolazy,
1575 lookup_fnfields_slot): Rename to ...
1576 (get_class_binding_direct, get_class_binding): ... here.
1577 * name-lookup.c (lookup_fnfields_slot_nolazy,
1578 lookup_fnfields_slot): Rename to ...
1579 (get_class_binding_direct, get_class_binding): ... here.
1580 * cp-tree.h (CLASSTYPE_CONSTRUCTORS, CLASSTYPE_DESTRUCTOR): Adjust.
1581 * call.c (build_user_type_conversion_1): Adjust.
1582 (has_trivial_copy_assign_p): Adjust.
1583 (has_trivial_copy_p): Adjust.
1584 * class.c (get_basefndecls) Adjust.
1585 (vbase_has_user_provided_move_assign) Adjust.
1586 (classtype_has_move_assign_or_move_ctor_p): Adjust.
1587 (type_build_ctor_call, type_build_dtor_call): Adjust.
1588 * decl.c (register_dtor_fn): Adjust.
1589 * decl2.c (check_classfn): Adjust.
1590 * pt.c (retrieve_specialization): Adjust.
1591 (check_explicit_specialization): Adjust.
1592 (do_class_deduction): Adjust.
1593 * search.c (lookup_field_r): Adjust.
1594 (look_for_overrides_here, lookup_conversions_r): Adjust.
1595 * semantics.c (classtype_has_nothrow_assign_or_copy_p): Adjust.
1596 * tree.c (type_has_nontrivial_copy_init): Adjust.
1597 * method.c (lazily_declare_fn): Adjust comment.
1599 2017-09-05 Nathan Sidwell <nathan@acm.org>
1601 * name-lookup.c (do_class_using_decl): Elide read-once temps.
1602 Move declarations to initializations.
1604 * class.c (add_method): Move slot search and insertion to ...
1605 * name-lookup.c (get_method_slot): ... this new function.
1606 (lookup_fnfields_slot_nolazy): Cope with NULL slot.
1607 * name-lookup.h (get_method_slot): Declare.
1608 * decl.c (cxx_init_decl_processinng): Give conv_op_marker a more
1610 (grok_special_member_properties): Set
1611 TYPE_HAS_CONVERSION. Expicitly look at DECL_NAME for specialness.
1612 Improve TYPE_HAS_CONSTEXPR_CTOR setting.
1614 * cp-tree.h (lang_decl_base): Rename template_conv_p to
1616 (DECL_CONV_FN_P): Don't check NULL DECL_NAME.
1617 (DECL_CONV_FN_TYPE): FN must be conv op.
1618 (DECL_TEMPLATE_CONV_FN_P): Delete.
1619 (VAR_HAD_UNKNOWN_BOUND, SET_VAR_HAD_UNKNOWN_BOUND): Adjust.
1620 * pt.c (push_template_decl_real): Delete DECL_TEMPLATE_CONV_FN_P
1623 * class.c (unreverse_member_declarations): Remove extraneous if.
1624 * pt.c (push_template_decl_real): Use string concatenation, not
1625 \<newline>. Add %<..%>.
1627 2017-09-05 Paolo Carlini <paolo.carlini@oracle.com>
1630 * cp-tree.h (LABEL_DECL_CDTOR): Add and document.
1631 * decl.c (start_preparsed_function): Set LABEL_DECL_CDTOR when
1632 creating cdtor_label.
1633 * constexpr.c (returns): Add the case of a constructor/destructor
1634 returning via a LABEL_DECL_CDTOR label.
1635 (cxx_eval_constant_expression, case [GOTO_EXPR]): Likewise.
1637 2017-09-01 Nathan Sidwell <nathan@acm.org>
1639 * cp-tree.h (resort_type_method_vec): Move declaration to ...
1640 * name-lookup.h (resort_type_method_vec): ... here.
1641 (set_class_bindings): Lose 2nd arg.
1642 * class.c (finish_struct_1, finish_struct): Adjust
1643 set_class_bindings call. Don't call finish_struct_methods.
1644 (resort_data, method_name_cmp, resort_method_name_cmp,
1645 resort_type_method_vec, finish_struct_methods): Move to ...
1646 * name-lookup.c (resort_data, method_name_cmp,
1647 resort_method_name_cmp, resort_type_method_vec): ... here.
1648 (set_class_bindings): Lose fields arg. Swallow finish_struct_methods.
1650 * class.c (finish_struct): Call set_class_bindings for the
1653 * class.c (finish_struct_methods): Dont clear DECL_IN_AGGR_P here.
1654 Don't call maybe_warn_about_overly_private_class here.
1655 (warn_hidden): Cleanup declarations and comments.
1656 (type_has_user_provided_constructor): No need to check
1657 CLASSTYPE_METHOD_VEC.
1658 (type_has_user_provided_or_explicit_constructor): Likewise.
1659 (classtype_has_move_assign_or_move_ctor_p): Likewise.
1660 (check_bases_and_members): Don't call finish_struct_methods here.
1661 (finish_struct_1): Call finish_struct_methods and
1662 set_class_bindings immediately after layout. Clear DECL_IN_AGGR_P
1664 (finish_struct): For templates process USING_DECLS and clear
1665 DECL_IN_AGGR_P before calling finish_struct_methods. Call
1666 maybe_warn_about_overly_private_class here.
1668 Revert 2017-08-28 Nathan Sidwell <nathan@acm.org>
1669 Restore sorted_fields vector.
1670 * cp-tree.h (lang_type): Restore sorted_fields vector.
1671 (CLASSTYPE_SORTED_FIELDS): Restore.
1672 (CLASSTYPE_BINDINGS): Delete.
1673 * name-lookup.c (lookup_field_1): Restore binary search.
1674 (sorted_fields_type_new, count_fields,
1675 add_fields_to_record_type, add_enum_fields_to_record_type): Restore
1676 (set_class_bindings): Revert.
1677 (insert_late_enum_def_binding): Restore field_vec insertion.
1679 2017-09-01 Jakub Jelinek <jakub@redhat.com>
1682 * parser.c (cp_parser_omp_ordered): Handle -fopenmp-simd.
1684 2017-09-01 Marek Polacek <polacek@redhat.com>
1687 * typeck.c (cp_build_unary_op): Avoid re-entering reporting routines.
1689 2017-08-30 Jason Merrill <jason@redhat.com>
1691 PR c++/82029 - __PRETTY_FUNCTION__ in lambda in template
1692 * pt.c (enclosing_instantiation_of, lambda_fn_in_template_p)
1693 (regenerated_lambda_fn_p): New.
1694 (tsubst_decl) [VAR_DECL]: Use enclosing_instantiation_of.
1695 (tsubst_copy) [VAR_DECL]: Likewise.
1697 PR c++/82030 - ICE inheriting from multiple lambdas
1699 * call.c (compare_ics): Handle null candidate.
1701 2017-08-30 Ville Voutilainen <ville.voutilainen@gmail.com>
1703 Make taking the address of an overloaded function a non-deduced context
1705 * pt.c (unify_overload_resolution_failure): Remove.
1706 (unify_one_argument): Adjust.
1708 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
1709 Alan Hayward <alan.hayward@arm.com>
1710 David Sherwood <david.sherwood@arm.com>
1712 * typeck.c (cp_build_binary_op): Use SCALAR_TYPE_MODE.
1714 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
1715 Alan Hayward <alan.hayward@arm.com>
1716 David Sherwood <david.sherwood@arm.com>
1718 * cvt.c (cp_convert_to_pointer): Use SCALAR_INT_TYPE_MODE.
1720 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
1721 Alan Hayward <alan.hayward@arm.com>
1722 David Sherwood <david.sherwood@arm.com>
1724 * mangle.c (write_real_cst): Use SCALAR_FLOAT_TYPE_MODE
1725 instead of TYPE_MODE.
1727 2017-08-29 Jason Merrill <jason@redhat.com>
1729 PR c++/81236 - ICE with template-id in generic lambda
1730 * semantics.c (finish_id_expression): Remove special dependent case.
1731 Avoid some later pieces when dependent.
1732 (finish_qualified_id_expr): Do normal BASELINK handling in a
1733 template. Always build a SCOPE_REF for a destructor BIT_NOT_EXPR.
1734 (parsing_default_capturing_generic_lambda_in_template): Remove.
1735 * parser.c (cp_parser_postfix_dot_deref_expression): Always give an
1736 error for types that will never be complete.
1737 * mangle.c (write_expression): Add sanity check.
1738 * tree.c (build_qualified_name): Add sanity check.
1739 (cp_walk_subtrees): Walk into the class context of a BASELINK.
1740 * lambda.c (add_capture): Improve diagnostic for generic lambda
1742 * call.c (build_new_method_call_1): Print the right constructor
1745 Reimplement handling of lambdas in templates.
1746 * cp-tree.h (LAMBDA_FUNCTION_P): Check DECL_DECLARES_FUNCTION_P.
1747 * decl.c (start_preparsed_function): Call start_lambda_scope.
1748 (finish_function): Call finish_lambda_scope.
1749 * init.c (get_nsdmi): Call start/finish_lambda_scope.
1750 * lambda.c (start_lambda_scope): Only ignore VAR_DECL in a function.
1751 * parser.c (cp_parser_function_definition_after_declarator): Don't
1752 call start/finish_lambda_scope.
1753 * pt.c (retrieve_specialization): Ignore lambda functions in
1755 (find_parameter_packs_r): Ignore capture proxies. Look into
1757 (check_for_bare_parameter_packs): Allow bare packs in lambdas.
1758 (tsubst_default_argument): Call start/finish_lambda_scope.
1759 (tsubst_function_decl): Handle lambda functions differently.
1760 (tsubst_template_decl): Likewise.
1761 (tsubst_expr) [DECL_EXPR]: Skip closure declarations and capture
1763 (tsubst_lambda_expr): Create a new closure rather than instantiate
1764 the one from the template.
1765 (tsubst_copy_and_build): Don't register a specialization of a pack.
1766 (regenerate_decl_from_template): Call start/finish_lambda_scope.
1767 (instantiate_decl): Remove special lambda function handling.
1768 * semantics.c (process_outer_var_ref): Remove special generic lambda
1769 handling. Don't implicitly capture in a lambda in a template. Look
1770 for an existing proxy.
1771 * class.c (current_nonlambda_class_type): Use decl_type_context.
1773 * cp-tree.h (LAMBDA_EXPR_CLOSURE): Use TREE_TYPE.
1774 (LAMBDA_EXPR_RETURN_TYPE): Remove.
1775 (struct tree_lambda_expr): Remove closure and return_type fields.
1776 * lambda.c (build_lambda_expr): Don't set LAMBDA_EXPR_RETURN_TYPE.
1777 * pt.c (tsubst_copy_and_build): Likewise.
1778 * parser.c (cp_parser_lambda_declarator_opt): Track return type.
1779 (cp_parser_lambda_body): Adjust unspecified return type check.
1780 * ptree.c (cxx_print_lambda_node): Don't print closure or
1783 PR c++/80935 - wrong C++17 error with lambda
1784 * decl.c (check_for_uninitialized_const_var): Check
1785 is_instantiation_of_constexpr.
1786 * constexpr.c (ensure_literal_type_for_constexpr_object): Check
1787 is_instantiation_of_constexpr.
1788 (potential_constant_expression_1): Check var_in_maybe_constexpr_fn.
1790 * lambda.c (build_lambda_object): Check for error_mark_node.
1791 * pt.c (make_pack_expansion): Set PACK_EXPANSION_LOCAL_P on the type
1793 (tsubst_decl) [FUNCTION_DECL]: Set DECL_CONTEXT on the parameters.
1794 (tsubst) [TEMPLATE_PARM_INDEX]: Check for error_mark_node.
1796 PR c++/80767 - unnecessary instantiation of generic lambda
1797 * call.c (convert_like_real): Call build_user_type_conversion_1 if
1799 (add_conv_candidate): Build a ck_user conversion with no candidate.
1801 Fix lambdas in template default argument of inherited ctor.
1802 * method.c (synthesized_method_base_walk): Replace an inherited
1803 template with its specialization.
1804 (synthesized_method_walk): Make inheriting_ctor a pointer.
1805 (maybe_explain_implicit_delete, explain_implicit_non_constexpr)
1806 (deduce_inheriting_ctor, implicitly_declare_fn): Adjust.
1808 * pt.c (build_deduction_guide): Set DECL_ABSTRACT_ORIGIN on the
1809 template, not the function.
1810 (template_guide_p): Adjust.
1812 Support copying local_specializations.
1813 * cp-tree.h (enum lss_policy): New.
1814 (local_specialization_stack): Add policy parameter to default ctor.
1815 * pt.c (local_specialization_stack): Copy local_specializations if
1818 * constexpr.c (potential_constant_expression_1): Add "now" parm.
1819 (is_constant_expression, require_constant_expression): New.
1820 (is_static_init_expression, is_nondependent_constant_expression)
1821 (is_nondependent_static_init_expression): Drop "potential".
1822 * except.c (build_must_not_throw_expr): Do type conversion on
1823 value-dependent argument.
1824 * pt.c, semantics.c, typeck2.c: Use variants without "potential".
1826 Instantiate default arguments/member initializers once.
1827 * init.c (get_nsdmi): Remember NSDMI instantiations.
1828 * parser.c (inject_this_parameter): Be more picky about
1830 * pt.c (tsubst_copy): Simplify 'this' handling.
1831 (tsubst_default_argument): Remember default argument
1832 instantiations. Take parameter number.
1833 (tsubst_default_arguments): Pass it.
1834 * call.c (convert_default_arg): Likewise.
1836 Fix default argument conversion failure and SFINAE.
1837 * call.c (build_over_call): Check convert_default_arg result for
1839 * parser.c (cp_parser_late_parsing_default_args): Remember
1842 2017-08-28 Nathan Sidwell <nathan@acm.org>
1844 * cp-tree.h (lang_type): Replace sorted_fields vector with
1846 (CLASSTYPE_SORTED_FIELDS): Delete.
1847 (CLASSTYPE_BINDINGS): New.
1848 * decl.c (finish_enum_value_list): Swap args of
1849 insert_late_enum_def_bindings.
1850 * name-lookup.c (lookup_field_1): Replace binary search of sorted
1851 fields with map->get.
1852 (sorted_fields_type_new, count_fields,
1853 add_fields_to_record_type, add_enum_fields_to_record_type): Delete.
1854 (add_class_member, add_class_members): New.
1855 (set_class_bindings): Create map and insert.
1856 (insert_late_enum_def_binding): Swap parms. Use add_clasS_member.
1857 * ptree.c (cxx_print_type): Delete sorted fields printing.
1859 * cp-tree.h (insert_late_enum_def_into_classtype_sorted_fields):
1861 * name-lookup.h (set_class_bindings,
1862 insert_late_enum_def_bindings): Declare.
1863 * decl.c (finish_enum_value_list): Adjust for
1864 insert_late_enum_def_bindings name change.
1865 * class.c (finish_struct_1): Call set_class_bindings.
1866 (count_fields, add_fields_to_record_type,
1867 add_enum_fields_to_record_type, sorted_fields_type_new,
1868 insert_into_classtype_sorted_fields,
1869 insert_late_enum_def_into_classtype_sorted_fields): Move to ...
1870 * name-lookup.h (count_fields, add_fields_to_record_type,
1871 add_enum_fields_to_record_type, sorted_fields_type_new,
1872 set_class_bindings, insert_late_enum_def_bindings): ... here.
1874 2017-08-25 Nathan Sidwell <nathan@acm.org>
1876 * class.c (method_name_cmp, resort_method_name_cmp): Methods
1879 Conversion operators have a special name
1880 * cp-tree.h (CPTI_CONV_OP_MARKER, CPTI_CONV_OP_IDENTIFIER): New.
1881 (conv_op_marker, conv_op_identifier): New.
1882 (CLASSTYPE_FIRST_CONVERSION_SLOT): Delete.
1883 * decl.c (initialize_predefined_identifiers): Add
1885 (cxx_init_decl_processing): Create conv_op_marker.
1886 * decl2.c (check_classfn): Lookup conv-ops by name.
1887 * class.c (add_method): Use conv_op_identifier & conv_op_marker.
1888 (resort_type_method_vec): Don't skip conv-ops.
1889 (finish_struct_methods, warn_hidden): Likewise.
1890 * name-lookup.h (lookup_all_conversions): Delete.
1891 * name-lookup.c (lookup_conversion_operator): Replace with ...
1892 (extract_conversion_operator): ... this.
1893 (lookup_fnfields_slot_nolazy): Find conv-ops by name.
1894 (lookup_all_conversions): Delete.
1895 * pt.c (check_explicit_specialization): Find conv-ops by name.
1896 * search.c (lookup_conversions_r): Likewise.
1898 2017-08-24 Nathan Sidwell <nathan@acm.org>
1900 Conversion operators kept on single overload set
1901 * class.c (add_method): Keep all conv-ops on one slot.
1902 * name-lookup.c (lookup_conversion_operator): Pull the desired
1903 conv op out of overload set.
1904 * search.c (lookup_conversions_r): Lose template/non-template
1906 (lookup_conversions): Likewise.
1908 2017-08-23 Nathan Sidwell <nathan@acm.org>
1910 * cp-tree.h (lookup_field_1, lookup_fnfields_slot,
1911 lookup_fnfields_slot_nolazy, lookup_all_conversions): Move
1913 * name-lookup.h (lookup_field_1, lookup_fnfields_slot,
1914 lookup_fnfields_slot_nolazy, lookup_all_conversions): ... here.
1915 * search.c (lookup_conversion_operator,
1916 lookup_fnfields_slot_nolazy, lookup_field_1, lookup_fnfields_slot,
1917 lookup_all_conversions): Move to ...
1918 * name-lookup.c (lookup_conversion_operator,
1919 lookup_fnfields_slot_nolazy, lookup_field_1, lookup_fnfields_slot,
1920 lookup_all_conversions): ... here.
1922 * semantics.c (finish_member_declaration): Move USING_DECL check
1923 earlier. Always set C++ linkage. Commonize TYPE_FIELD and
1924 template decl list insertion.
1926 * cp-tree.h (maybe_version_functions): Declare.
1927 * decl.c (decls_match): Break function versioning check to
1928 separate function. Call it.
1929 (maybe_version_functions): Broken out of decls_match.
1930 * class.c (add_method): Use maybe_version_functions.
1932 * cp-tree.h (print_search_statistics,
1933 reinit_search_statistics): Don't declare.
1934 * search.c (n_fields_searched, n_calls_lookup_field,
1935 n_calls_lookup_field_1, n_calls_lookup_fnfields,
1936 n_calls_lookup_fnfields_1, n_calls_get_base_type,
1937 n_outer_fields_searched, n_contexts_saved): Delete.
1938 (lookup_field_1, lookup_member,
1939 lookup_fnfields_slot_nolazy): Remove stat gathering.
1940 (print_search_statistics, reinit_search_statistics): Delete.
1941 * tree.c (cxx_print_statistics): Don't print search stats.
1943 2017-08-21 Nathan Sidwell <nathan@acm.org>
1945 * search.c (lookup_field_r): Remove obsolete code for type-named
1948 * search.c (lookup_field_1): Assert TYPE is a class and VFIELD
1950 (lookup_field_fuzzy_info::fuzzy_lookup_fnfields): Delete.
1951 (lookup_field_fuzzy_r): Adjust.
1953 2017-08-21 David Malcolm <dmalcolm@redhat.com>
1955 * call.c (build_over_call): Pass NULL for new parameter to
1956 check_function_arguments.
1957 * typeck.c (cp_build_function_call_vec): Likewise.
1959 2017-08-21 Nathan Sidwell <nathan@acm.org>
1962 * pt.c (instantiate_class_template_1):
1963 BOUND_TEMPLATE_TEMPLATE_PARM is never friend-injected.
1965 2017-08-18 David Malcolm <dmalcolm@redhat.com>
1968 * name-lookup.c (maybe_suggest_missing_header): Convert return
1969 type from void to bool; return true iff a suggestion was offered.
1970 (suggest_alternative_in_explicit_scope): Move call to
1971 maybe_suggest_missing_header to before use of best_match, and
1972 return true if the former offers a suggestion.
1974 2017-08-18 H.J. Lu <hongjiu.lu@intel.com>
1977 * decl.c (duplicate_decls): Also merge DECL_WARN_IF_NOT_ALIGN.
1978 * decl2.c (grokbitfield): Don't allow bit-field with
1979 warn_if_not_aligned type.
1981 2017-08-17 Nathan Sidwell <nathan@acm.org>
1983 * cp-tree.def (TEMPLATE_TEMPLATE_PARM): Remove stale comment.
1984 * cp-tree.h (ENUM_TEMPLATE_INFO): Delete.
1985 (TYPE_TEMPLATE_INFO): Simplify.
1986 (SET_TYPE_TEMPLATE_INFO): Simplify.
1988 * lex.c (maybe_add_lang_type_raw): BOUND_TEMPLATE_TEMPLATE_PARMs
1989 don't need lang_type.
1990 (cxx_make_type): Use maybe_add_lang_type_raw return value.
1991 * mangle.c (CLASSTYPE_TEMPLATE_ID_P): Don't rely on
1994 * cp-tree.h (struct lang_type): Remove template_info field.
1995 (CLASSTYPE_TEMPLATE_INFO): Use TYPE_LANG_SLOT_1.
1996 (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO): Likewise.
1998 2017-08-14 Martin Sebor <msebor@redhat.com>
2001 * error.c (cp_printer): Handle 'G'.
2003 2017-08-11 Martin Liska <mliska@suse.cz>
2005 * decl2.c (get_tls_init_fn): Replace ASM_OUTPUT_DEF with
2006 TARGET_SUPPORTS_ALIASES.
2007 (handle_tls_init): Likewise.
2008 (note_mangling_alias): Likewise. Remove ATTRIBUTE_UNUSED for
2010 * optimize.c (can_alias_cdtor): Likewise.
2012 2017-08-11 Jason Merrill <jason@redhat.com>
2014 PR c++/81671 - nullptr_t template parameter
2015 * pt.c (convert_nontype_argument): Fix nullptr_t check.
2017 2017-08-10 Jason Merrill <jason@redhat.com>
2019 PR c++/81359 - Unparsed NSDMI error from SFINAE context.
2020 * method.c (synthesized_method_walk): Don't diagnose lack of
2023 PR c++/80452 - Core 1579, implicit move semantics on return/throw
2024 * cp-tree.h (LOOKUP_PREFER_RVALUE): Now means that we've already
2025 tentatively changed the lvalue to an rvalue.
2026 * call.c (reference_binding): Remove LOOKUP_PREFER_RVALUE handling.
2027 (build_over_call): If LOOKUP_PREFER_RVALUE, check that the first
2028 parameter is an rvalue reference.
2029 * except.c (build_throw): Do maybe-rvalue overload resolution twice.
2030 * typeck.c (check_return_expr): Likewise.
2032 2017-08-10 David Malcolm <dmalcolm@redhat.com>
2034 * parser.c (cp_parser_error): Update for new param to
2036 (class token_pair): New class.
2037 (struct matching_paren_traits): New struct.
2038 (matching_parens): New typedef.
2039 (struct matching_brace_traits): New struct.
2040 (matching_braces): New typedef.
2041 (cp_parser_statement_expr): Convert explicit parsing of
2042 CPP_OPEN_PAREN and CPP_CLOSE_PAREN to use of
2043 class matching_parens, so that the pertinent open parenthesis is
2044 highlighted when there are problems locating the close
2046 (cp_parser_primary_expression): Likewise.
2047 (cp_parser_compound_literal_p): Remove consumption of opening
2049 (cp_parser_postfix_expression): Convert explicit parsing of
2050 CPP_OPEN_PAREN and CPP_CLOSE_PAREN to use matching parens, as
2051 above. Use it to consume the opening paren previously consumed by
2052 cp_parser_compound_literal_p.
2053 (cp_parser_parenthesized_expression_list): Likewise.
2054 (cp_parser_unary_expression): Likewise.
2055 (cp_parser_new_expression): Likewise.
2056 (cp_parser_cast_expression): Likewise.
2057 (cp_parser_builtin_offsetof): Likewise.
2058 (cp_parser_trait_expr): Likewise.
2059 (cp_parser_lambda_declarator_opt): Likewise.
2060 (cp_parser_lambda_body): Likewise, for matching_braces.
2061 (cp_parser_compound_statement): Likewise.
2062 (cp_parser_selection_statement): Likewise, for matching_parens.
2063 (cp_parser_iteration_statement): Likewise.
2064 (cp_parser_already_scoped_statement): Likewise, for
2066 (cp_parser_linkage_specification): Likewise.
2067 (cp_parser_static_assert): Likewise, for matching_parens.
2068 (cp_parser_decltype): Likewise.
2069 (cp_parser_operator): Likewise.
2070 (cp_parser_enum_specifier): Likewise.
2071 (cp_parser_namespace_definition): Likewise.
2072 (cp_parser_direct_declarator): Likewise.
2073 (cp_parser_braced_list): Likewise.
2074 (cp_parser_class_specifier_1): Likewise, for matching_braces.
2075 (cp_parser_constant_initializer): Likewise.
2076 (cp_parser_noexcept_specification_opt): Likewise, for
2078 (cp_parser_exception_specification_opt): Likewise.
2079 (cp_parser_handler): Likewise.
2080 (cp_parser_asm_specification_opt): Likewise.
2081 (cp_parser_asm_operand_list): Likewise.
2082 (cp_parser_gnu_attributes_opt): Likewise.
2083 (cp_parser_std_attribute_spec): Likewise.
2084 (cp_parser_requirement_parameter_list): Likewise.
2085 (cp_parser_requirement_body): Likewise, for matching_braces.
2086 (cp_parser_compound_requirement): Likewise.
2087 (cp_parser_template_introduction): Likewise.
2088 (cp_parser_sizeof_pack): Likewise, for matching_parens.
2089 (cp_parser_sizeof_operand): Likewise; use it to consume the
2090 opening paren previously consumed by cp_parser_compound_literal_p.
2091 (get_matching_symbol): New function.
2092 (cp_parser_required_error): Add param "matching_location". Remove
2093 calls to cp_parser_error, instead setting a non-NULL gmsgid, and
2094 handling it if set by calling c_parse_error, potentially with a
2095 secondary location if matching_location was set.
2096 (cp_parser_require): Add param "matching_location", with a default
2097 value of UNKNOWN_LOCATION.
2098 (cp_parser_require_keyword): Update for new param of
2099 cp_parser_required_error.
2100 (cp_parser_objc_encode_expression): Update to class matching_parens
2102 (cp_parser_objc_defs_expression): Likewise.
2103 (cp_parser_objc_protocol_expression): Likewise.
2104 (cp_parser_objc_selector_expression): Likewise.
2105 (cp_parser_objc_typename): Likewise.
2106 (cp_parser_objc_superclass_or_category): Likewise.
2107 (cp_parser_objc_try_catch_finally_statement): Likewise.
2108 (cp_parser_objc_synchronized_statement): Likewise.
2109 (cp_parser_objc_at_property_declaration): Likewise.
2110 (cp_parser_oacc_single_int_clause): Likewise.
2111 (cp_parser_oacc_shape_clause): Likewise.
2112 (cp_parser_omp_clause_collapse): Likewise.
2113 (cp_parser_omp_clause_default): Likewise.
2114 (cp_parser_omp_clause_final): Likewise.
2115 (cp_parser_omp_clause_if): Likewise.
2116 (cp_parser_omp_clause_num_threads): Likewise.
2117 (cp_parser_omp_clause_num_tasks): Likewise.
2118 (cp_parser_omp_clause_grainsize): Likewise.
2119 (cp_parser_omp_clause_priority): Likewise.
2120 (cp_parser_omp_clause_hint): Likewise.
2121 (cp_parser_omp_clause_defaultmap): Likewise.
2122 (cp_parser_omp_clause_ordered): Likewise.
2123 (cp_parser_omp_clause_schedule): Likewise.
2124 (cp_parser_omp_clause_num_teams): Likewise.
2125 (cp_parser_omp_clause_thread_limit): Likewise.
2126 (cp_parser_omp_clause_aligned): Likewise.
2127 (cp_parser_omp_clause_linear): Likewise.
2128 (cp_parser_omp_clause_safelen): Likewise.
2129 (cp_parser_omp_clause_simdlen): Likewise.
2130 (cp_parser_omp_clause_depend): Likewise.
2131 (cp_parser_omp_clause_device): Likewise.
2132 (cp_parser_omp_clause_dist_schedule): Likewise.
2133 (cp_parser_oacc_clause_async): Likewise.
2134 (cp_parser_omp_critical): Likewise.
2135 (cp_parser_omp_for_loop): Likewise.
2136 (cp_parser_omp_sections_scope): Likewise.
2137 (cp_parser_omp_declare_reduction_exprs): Likewise.
2138 Update for new param to cp_parser_required_error.
2139 (cp_parser_oacc_routine): Likewise.
2140 (cp_parser_transaction_expression): Likewise.
2141 (cp_parser_cilk_simd_vectorlength): Likewise.
2143 2017-08-09 Jason Merrill <jason@redhat.com>
2145 PR c++/81525 - wrong constant value with generic lambda
2146 * pt.c (tsubst_decl) [VAR_DECL]: Avoid clobbering auto.
2147 (tsubst_copy) [VAR_DECL]: Handle auto.
2149 PR c++/81359 - Unparsed NSDMI error from SFINAE context.
2150 * init.c (get_nsdmi): Add complain parm.
2151 * typeck2.c (digest_nsdmi_init): Add complain parm.
2152 (process_init_constructor_record): Pass complain to get_nsdmi.
2153 * pt.c (maybe_instantiate_noexcept): Add complain parm, return bool.
2154 * method.c (get_defaulted_eh_spec): Add complain parm. Pass it into
2155 synthesized_method_walk.
2156 (synthesized_method_walk): Adjust.
2157 (walk_field_subobs): Pass complain to get_nsdmi.
2158 (defaulted_late_check): Skip other checks if deleted.
2159 * decl2.c (mark_used): Pass complain to maybe_instantiate_noexcept.
2160 * call.c (build_aggr_conv): Pass complain to get_nsdmi.
2161 * parser.c (defarg_location): New.
2162 * error.c (location_of): Use it.
2164 2017-08-09 Marek Polacek <polacek@redhat.com>
2166 * parser.c (cp_parser_perform_range_for_lookup): Use false instead of 0.
2167 * typeck.c (build_binary_op): Change the type of a parameter to bool.
2168 (cp_truthvalue_conversion): Use true instead of 1.
2170 2017-08-08 Marek Polacek <polacek@redhat.com>
2173 * cp-gimplify.c (cp_fold): If folding exposed a branch of
2174 a COND_EXPR, convert it to the original type of the COND_EXPR, if
2177 2017-08-08 Martin Liska <mliska@suse.cz>
2179 * call.c: Include header files.
2180 * cp-gimplify.c: Likewise.
2181 * cp-ubsan.c: Likewise.
2184 * search.c: Likewise.
2185 * semantics.c: Likewise.
2186 * typeck.c: Likewise.
2188 2017-08-07 Martin Liska <mliska@suse.cz>
2190 * parser.c (cp_parser_gnu_attribute_list): Canonicalize name of an
2192 (cp_parser_std_attribute): Likewise.
2193 * tree.c: Add new include.
2195 2017-08-04 Paolo Carlini <paolo.carlini@oracle.com>
2198 * pt.c (do_class_deduction): Handle the case of no viable implicit
2199 deduction guides; simplify the code generating implicit deduction
2202 2017-08-03 Paolo Carlini <paolo.carlini@oracle.com>
2205 * typeck.c (build_x_unary_op): Avoid pretty-printing constructor /
2206 destructor as expressions.
2208 2017-08-02 Jakub Jelinek <jakub@redhat.com>
2211 * call.c (build_user_type_conversion_1): Only call
2212 lookup_fnfields_slot if totype is CLASS_TYPE_P.
2214 2017-07-31 Jason Merrill <jason@redhat.com>
2216 * decl.c (declare_global_var): Set DECL_CONTEXT.
2218 2017-07-31 Jan Hubicka <hubicka@ucw.cz>
2219 Martin Liska <mliska@suse.cz>
2221 * pt.c (tsubst_copy): Copy PREDICT_EXPR.
2222 * semantics.c (finish_goto_stmt): Build gimple predict
2224 * constexpr.c (potential_constant_expression_1): Handle
2227 2017-07-31 Martin Liska <mliska@suse.cz>
2230 * cp-gimplify.c (cp_genericize): Guard condition with flag_sanitize_p
2231 also with current_function_decl non-null equality.
2232 * cp-ubsan.c (cp_ubsan_instrument_vptr_p): Likewise.
2233 * decl.c (compute_array_index_type): Likewise.
2234 * init.c (finish_length_check): Likewise.
2235 * typeck.c (cp_build_binary_op): Likewise.
2237 2017-07-29 Jakub Jelinek <jakub@redhat.com>
2239 * cp-objcp-common.c (cp_decl_dwarf_attribute): Handle
2240 DW_AT_export_symbols.
2241 * name-lookup.c (emit_debug_info_using_namespace): Add IMPLICIT
2242 argument, pass it through to the debug hook.
2243 (finish_namespace_using_directive): Adjust
2244 emit_debug_info_using_namespace caller.
2245 (push_namespace): Likewise. Call it after setting
2246 DECL_NAMESPACE_INLINE_P.
2247 (cp_emit_debug_info_for_using): Pass false as new argument to
2248 the imported_module_or_decl debug hook.
2250 2017-07-28 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
2252 * lex.c (copy_decl): Adjust.
2253 (copy_type): Likewise.
2255 2017-07-26 Paolo Carlini <paolo.carlini@oracle.com>
2258 * lambda.c (add_capture): Early return if we cannot capture by
2261 2017-07-26 Jason Merrill <jason@redhat.com>
2263 P0702R1 - List deduction of vector.
2264 * pt.c (do_class_deduction): Special-case deduction from a single
2265 element of related type.
2267 2017-07-26 Leonid Koppel <lkoppel@uwaterloo.ca>
2269 PR c++/67054 - Inherited ctor with non-default-constructible members
2270 * method.c (walk_field_subobs) Consider member initializers (NSDMIs)
2271 when deducing an inheriting constructor.
2273 2017-07-21 Nathan Sidwell <nathan@acm.org>
2275 * search.c (lookup_conversion_operator): Return overloads.
2276 (lookup_fnfields_idx_nolazy): Absorb into ...
2277 (lookup_fnfields_slot_nolaxy): ... here.
2278 (lookup_fnfields_1): Absorb into ...
2279 (lookup_fnfields_slot): ... here.
2281 Remove special CDtor METHOD_VEC slots.
2282 * cp-tree.h (CLASSTYPE_CONSTRUCTOR_SLOT,
2283 CLASSTYPE_DESTRUCTOR_SLOT): Delete.
2284 (CLASSTYPE_CONSTRUCTORS): Use lookup_fnfields_slot_nolazy.
2285 (CLASSTYPE_DESTRUCTOR): Likewise.
2286 * class (add_method): Don't use special cdtor slots.
2287 * search.c (lookup_fnfields_idx_nolazy): Likewise.
2288 (look_for_overrides_here): Use lookup_fnfields_slot.
2289 * semantics (classtype_has_nothrow_assign_or_copy_p): Likewise.
2291 * call.c (add_candidates): Move decls to initialization. Don't
2294 2017-07-20 Nathan Sidwell <nathan@acm.org>
2296 Remove TYPE_METHODS.
2297 * class.c (maybe_warn_about_overly_private_class,
2298 finish_struct_methods, one_inheriting_sig, count_fields,
2299 add_fields_to_record_type, check_field_decls, check_methods,
2300 clone_function_decl, set_method_tm_attributes,
2301 finalize_literal_type_property, check_bases_and_members,
2302 create_vtable_ptr, determine_key_method,
2303 unreverse_member_declarations, finish_struct,
2304 add_vcall_offset_vtbl_entries_1): Member fns are on TYPE_FIELDS.
2305 * decl.c (fixup_anonymous_aggr): Likewise.
2306 * decl2.c (reset_type_linkage_2): Likewise.
2307 * method.c (after_nsdmi_defaulted_late_checks,
2308 lazily_declare_fn): Likewise.
2309 * optimize.c (maybe_thunk_body, maybe_clone_body): Likewise.
2310 * pt.c (instantiate_class_template_1, tsubst_expr,
2311 do_type_instantiation, instantiate_pending_templates): Likewise.
2312 * search.c (lookup_field_1): Likewise.
2313 * semantics.c (finish_member_declaration,
2314 finish_omp_declare_simd_methods): Likewise.
2316 2017-07-19 Nathan Sidwell <nathan@acm.org>
2318 * class.c (add_implicitly_declared_members): Use
2319 classtype_has_move_assign_or_move_ctor_p.
2320 (classtype_has_move_assign_or_move_ctor,
2321 classtype_has_user_move_assign_or_move_ctor_p): Merge into ...
2322 (classtype_has_move_assign_or_move_ctor_p): ... this new function.
2323 * cp-tree.h (classtype_has_user_move_assign_or_move_ctor_p):
2325 (classtype_has_move_assign_or_move_ctor_p): ... this.
2326 * method.c (maybe_explain_implicit_delete, lazily_declare_fn): Adjust.
2327 * tree.c (type_has_nontrivial_copy_init): Adjust.
2329 * cp-tree.h (PACK_EXPANSION_PARAMETER_PACKS,
2330 PACK_EXPANSION_EXTRA_ARGS): Use TYPE_{MIN,MAX}_VALUE_RAW.
2332 2017-07-18 Nathan Sidwell <nathan@acm.org>
2334 * cp-array-notation.c (build_array_notation_ref): Use
2335 TYPE_{MIN,MAX}_VALUE.
2337 * class.c (classtype_has_move_assign_or_move_ctor): Declare.
2338 (add_implicitly_declared_members): Use it.
2339 (type_has_move_constructor, type_has_move_assign): Merge into ...
2340 (classtype_has_move_assign_or_move_ctor): ... this new function.
2341 * cp-tree.h (type_has_move_constructor, type_has_move_assign): Delete.
2343 2017-07-17 Volker Reichelt <v.reichelt@netcologne.de>
2345 * parser.c (cp_parser_decl_specifier_seq): Add fix-it hints for
2346 friend outside class and obsolete auto as storage-class-specifier.
2348 2017-07-17 Nathan Sidwell <nathan@acm.org>
2350 * class.c (maybe_warn_about_overly_private_class): Ignore public
2353 * class.c (type_has_user_declared_move_constructor,
2354 type_has_user_declared_move_assign): Combine into ...
2355 (classtype_has_user_move_assign_or_move_ctor_p): ... this new function.
2356 * cp-tree.h (type_has_user_declared_move_constructor,
2357 type_has_user_declared_move_assign): Combine into ...
2358 (classtype_has_user_move_assign_or_move_ctor_p): ... this. Declare.
2359 * method.c (maybe_explain_implicit_delete): Use it.
2360 (lazily_declare_fn): Use it.
2361 * tree.c (type_has_nontrivial_copy_init): Use it.
2363 * semantics.c (classtype_has_nothrow_assign_or_copy_p): Clarify
2364 semantics, simplify implementation.
2366 2017-07-16 Volker Reichelt <v.reichelt@netcologne.de>
2368 * parser.c (cp_parser_cast_expression): Use %q#T instead of %qT
2369 in old-style cast diagnostic.
2370 * typeck.c (maybe_warn_about_useless_cast): Use %q#T instead of %qT
2371 in useless cast diagnostic.
2372 * error.c (type_to_string): Remove enum special handling.
2374 2017-07-14 David Malcolm <dmalcolm@redhat.com>
2376 * name-lookup.c (get_std_name_hint): Add '<' and '>' around
2378 (maybe_suggest_missing_header): Update for addition of '<' and '>'
2379 to above. Provide a fix-it hint.
2380 * pt.c: Include "gcc-rich-location.h"
2381 (listify): Attempt to add fix-it hint for missing
2382 #include <initializer_list>.
2383 * rtti.c: Include "gcc-rich-location.h".
2384 (typeid_ok_p): Attempt to add fix-it hint for missing
2385 #include <typeinfo>.
2387 2017-07-12 Jason Merrill <jason@redhat.com>
2389 P0512R0 - Deduction from an initializer list.
2390 * pt.c (do_class_deduction): Do list deduction in two phases.
2392 2017-07-12 Nathan Sidwell <nathan@acm.org>
2394 * cp-tree.h (DECL_CONSTRUCTOR_P, DECL_MAYBE_IN_CHARGE_CONSTRUCTOR,
2395 DECL_DESTRUCTOR_P, DECL_MAYBE_IN_CHARGE_DESTRCTOR): Look at
2397 * decl.c (grokfndecl): Set DECL_CXX_CONSTRUCTOR and
2398 DECL_CXX_DESTRUCTOR explicitly.
2399 * decl2.c (grokclassfn): Likewise.
2400 * friend.c (do_friend): Likewise.
2401 * method.c (make_thunk, make_alias_for,
2402 implicitly_declare_fn): Likewise.
2404 2017-07-11 Jason Merrill <jason@redhat.com>
2407 * decl.c (grokparms): Downgrade error about array of unknown bound
2408 to pedwarn and disable it for C++17.
2410 2017-07-11 Nathan Sidwell <nathan@acm.org>
2412 * decl2.c (reset_type_linkage_2): Dont't change ctor name.
2414 2017-07-10 Martin Sebor <msebor@redhat.com>
2416 * cp-tree.h (cp_operator_id, cp_assignment_operator_id): Document.
2418 2017-07-06 Jason Merrill <jason@redhat.com>
2420 PR c++/81204 - parse error with dependent template-name
2421 * parser.c (cp_parser_lookup_name): Revert previous change.
2423 2017-07-06 David Malcolm <dmalcolm@redhat.com>
2425 * cp-lang.c (LANG_HOOKS_RUN_LANG_SELFTESTS): Define as
2426 selftest::run_cp_tests.
2427 (selftest::run_cp_tests): New function.
2428 * cp-tree.h (selftest::run_cp_tests): New decl.
2430 2017-07-04 Jakub Jelinek <jakub@redhat.com>
2432 * parser.c (cp_parser_decomposition_declaration): Replace
2433 decomposition declaration with structured binding in diagnostics.
2434 * decl.c (cp_finish_decomp): Likewise.
2435 (grokdeclarator): Likewise.
2438 * parser.c (cp_parser_decomposition_declaration): Diagnose invalid
2439 forms of structured binding initializers.
2441 2017-07-03 Paolo Carlini <paolo.carlini@oracle.com>
2444 * decl.c (grokdeclarator): Move checks on function return type after
2445 the splice_late_return_type call; if declspecs->locations[ds_type_spec]
2446 is UNKNOWN_LOCATION fall back to input_location.
2448 2017-07-03 David Malcolm <dmalcolm@redhat.com>
2450 * parser.c (enum required_token): Fix spelling of
2451 RT_INTERATION to RT_ITERATION.
2452 (cp_parser_iteration_statement): Likewise.
2453 (cp_parser_required_error): Likewise.
2455 2017-06-30 Jason Merrill <jason@redhat.com>
2457 PR c++/81257 - ICE with invalid ::template.
2458 PR c++/54769 - wrong lookup of dependent template-name.
2459 * parser.c (cp_parser_template_name): Revert part of last change.
2461 2017-06-30 Nathan Sidwell <nathan@acm.org>
2463 * config-lang.in (gtfiles): Add cp/lex.c.
2464 * cp-tree.h (mangle_convop_name_for_type): Rename ...
2465 (make_conv_op_name): ... here. Move to lex.
2466 * lambda.c (maybe_add_lambda_conv_op): Update.
2467 * parser.c (cp_parser_conversion_function_id): Update.
2468 * pt.c (tsubst_decl, tsubst_baselink, tsubst_copy,
2469 tsubst_copy_and_build): Update.
2470 * semantics.c (apply_deduced_return_type): Update.
2471 * mangle.c (conv_type_hasher, conv_type_names,
2472 mangle_conv_op_name_for_type): Move to ...
2473 * lex.c (conv_type_hasher, conv_type_names, make_convop_name):
2476 2017-06-30 David Malcolm <dmalcolm@redhat.com>
2479 * parser.c (cp_parser_postfix_expression): Construct a location
2480 for typeid expressions.
2482 2017-06-30 Nathan Sidwell <nathan@acm.org>
2484 * cp-tree.h (lookup_fnfields_1, class_method_index_for_fn): Don't
2486 (lookup_all_conversions): Declare.
2487 * class.c (get_basefndecls): Use lookup_fnfields_slot.
2488 * decl.c (register_dtor_fn): Use lookup_fnfields_slot.
2489 * decl2.c (check_class_fn): Use lookup_fnfields_slot. Rework
2491 * pt.c (retrieve_specialization): Use lookup_fnfields_slot.
2492 (check_explicit_specialization): Use lookup_fnfields_slot_nolazy,
2493 lookup_all_conversions.
2494 * search.c (lookup_fnfields_1): Make static.
2495 (lookup_all_conversions): New.
2496 (class_method_index_for_fn): Delete.
2497 * semantics.c (classtype_has_nothrow_assign_or_copy_p): Use
2498 lookup_fnfields_slot.
2500 * call.c (build_new_method_call_1): Use constructo_name to get
2501 ctor name. Move argument processing earlier to merge cdtor
2503 * decl.c (grokfndecl): Cdtors have special names.
2504 * method.c (implicitly_declare_fn): Likewise. Simplify flag setting.
2505 * pt.c (check_explicit_specialization): Cdtor name is already
2507 * search.c (class_method_index_for_fn): Likewise.
2510 * name-lookup.c (do_pushdecl): Reset IDENTIFIER_TYPE when finding
2511 a matching TYPE_DECL.
2513 2017-06-29 Paolo Carlini <paolo.carlini@oracle.com>
2515 * class.c (add_method): Change pair of errors to error + inform.
2516 (handle_using_decl): Likewise.
2518 2017-06-29 Jason Merrill <jason@redhat.com>
2520 * constexpr.c, error.c, tree.c: Remove WITH_CLEANUP_EXPR handling.
2522 PR c++/81180 - ICE with C++17 deduction of member class template.
2523 * pt.c (build_deduction_guide): Correct member template handling.
2525 PR c++/81188 - matching decltype of member function call.
2526 * tree.c (cp_tree_equal): Remove COMPONENT_REF special case.
2528 2017-06-29 Nathan Sidwell <nathan@acm.org>
2531 * parser.c (cp_parser_namespace_definition): Immediately close the
2532 namespace if there's no open-brace.
2533 * name-lookup.c (do_pushdecl): Reset OLD when pushing into new
2536 2017-06-29 Jason Merrill <jason@redhat.com>
2538 PR c++/81164 - ICE with invalid inherited constructor.
2539 * search.c (binfo_direct_p): New.
2540 * name-lookup.c (do_class_using_decl): Use it.
2542 2017-06-29 Nathan Sidwell <nathan@acm.org>
2544 * cp-tree.h (THIS_NAME, IN_CHARGE_NAME, VTBL_PTR_TYPE,
2545 VTABLE_DELTA_NAME, VTABLE_PFN_NAME): Delete.
2546 * decl.c (initialize_predefined_identifiers): Name cdtor special
2547 names consistently. Use literals for above deleted defines.
2548 (cxx_init_decl_processing): Use literal for vtbl_ptr_type name,
2550 * lex.c (maybe_add_lang_type_raw): Exit early, rather than use a
2553 * call.c (check_dtor_name): Use constructor_name for enums too.
2554 (build_new_method_call_1): Use constructor_name for cdtors and
2556 * class.c (build_self_reference): Use TYPE_NAME to get name of
2558 * name-lookup (constructor_name): Use DECL_NAME directly.
2559 (constructor_name_p): Reimplement.
2560 (push_class_level_binding_1): Use TYPE_NAME directly.
2562 * class.c (finish_struct): Use OVL_P.
2563 (get_vfield_name): Measure constructor_name length.
2564 * cp-tree.h (SET_CLASS_TYPE_P): Add RECORD_OR_UNION_CHECK.
2565 (NON_UNION_CLASS_TYPE_P): Check RECORD_TYPE up front.
2566 * cxx-pretty-print.c (is_destructor_name): Delete.
2567 (pp_cxx_unqualified_id): Remove bogus destructor name checking.
2568 * decl.c (grokfndecl): Move cheap checks first when looking for
2569 implicit extern cness.
2571 * parser.c (cp_parser_direct_declarator): Reorder if to avoid
2572 indentation. Remove unnecessary assignment of constructor name.
2574 Whitespace cleanups.
2575 * call.c (name_as_c_string): Move CONST_CAST to return.
2576 (build_new_method_call_1): Remove unneeded bracing.
2577 * class.c (include_empty_classes): Unbreak line.
2578 * constraint.cc (tsubst_check_constraint): Add space.
2579 * cp-tree.h (lang_decl_ns): Add comment.
2580 (PTRMEM_CST_MEMBER): Break line.
2581 * decl.c (grokfndecl): Add blank lines. Unbreak some others.
2582 (grokdeclarator): Remove lines, move declaration to first use.
2583 * decl2.c (decl_needed_p): Fix indentation.
2584 (c_parse_final_cleanups): Remove blank line.
2585 * method.c (implicitly_declare_fn): Move declaration to first use.
2586 * search.c (current_scope): Add blank lines.
2588 2017-06-28 Jason Merrill <jason@redhat.com>
2590 PR c++/72764 - ICE with invalid template typename.
2591 * decl.c (build_typename_type): No longer static.
2592 * tree.c (strip_typedefs): Use it instead of make_typename_type.
2594 PR c++/69300 - ICE with self-referential noexcept
2595 * pt.c (maybe_instantiate_noexcept): Check for recursion.
2597 PR c++/61022 - error with variadic template template parm
2598 * pt.c (convert_template_argument): Keep the TYPE_PACK_EXPANSION.
2600 PR c++/72801 - ICE with variadic partial specialization
2601 * pt.c (unify_pack_expansion): Use PACK_EXPANSION_EXTRA_ARGS.
2603 PR c++/55639 - partial specialization with ::template
2604 * parser.c (cp_parser_class_head): Handle ::template.
2606 PR c++/45976 - error with ::template in declarator.
2607 * pt.c (resolve_typename_type): Fix TEMPLATE_ID_EXPR handling.
2609 PR c++/54769 - wrong lookup of dependent template-name.
2610 * parser.c (cp_parser_template_name): Handle dependent object type.
2611 (cp_parser_nested_name_specifier_opt): Make template_keyword_p a
2613 (cp_parser_id_expression): Pass it.
2614 (cp_parser_diagnose_invalid_type_name): Handle TEMPLATE_ID_EXPR.
2616 * parser.c (cp_parser_template_id): Use the range location on the
2619 PR c++/81204 - parse error with dependent template-name
2620 * parser.c (cp_parser_lookup_name): Disqualify function templates
2623 2017-06-27 Nathan Sidwell <nathan@acm.org>
2625 * pt.c (tsubst_decl <FUNCTION_DECL>): Move var decls to
2626 initialization point. Don't unnecessarily check for ctor name.
2628 * cp-tree.h (CLASSTYPE_DESTRUCTORS): Rename to ...
2629 (CLASSTYPE_DESTRUCTOR): ... this.
2630 * class.c (accessible_nvdtor_p,
2631 maybe_warn_about_overly_private_class,
2632 add_implicitly_declared_members,
2633 clone_constructors_and_destructors, type_has_virtual_destructor):
2634 Adjust for CLASSTYPE_DESTRUCTOR.
2635 (deduce_noexcept_on_destructors): Absorb into ...
2636 (check_bases_and_members): ... here.
2637 * except.c (dtor_nothrow): Adjust for CLASSTYPE_DESTRUCTOR.
2638 * init.c (build_delete): Likewise.
2639 * parser.c (cp_parser_lookup_name): Likewise.
2640 * pt.c (check_explicit_specialization): Likewise.
2641 * rtti.c (emit_support_tinfos): Likewise.
2642 * search.c (lookup_fnfields_idx_nolazy): Likewise.
2644 Kill IDENTIFIER_TEMPLATE.
2645 * cp-tree.h (lang_identifier): Remove class_template_info field.
2646 (IDENTIFIER_TEMPLATE): Delete.
2647 * name-lookup.c (constructor_name_full): Subsume into ...
2648 (constructor_name): ... here. Don't check IDENTIFIER_TEMPLATE.
2649 (constructor_name_p): Likewise.
2650 * mangle.c (write_source_name): Likewise.
2651 * ptree.c (cxx_print_identifier): Likewise.
2653 2017-06-27 Marek Polacek <polacek@redhat.com>
2656 * parser.c (cp_parser_already_scoped_statement): Initialize
2659 2017-06-26 Jason Merrill <jason@redhat.com>
2661 PR c++/81215 - deduction failure with variadic TTP.
2662 * pt.c (unify_bound_ttp_args): Restore old logic for C++14 and down.
2664 2017-06-26 Martin Sebor <msebor@redhat.com>
2667 * call.c (maybe_warn_class_memaccess): Preserve explicit conversions
2668 to detect casting away cv-qualifiers.
2670 2017-06-26 Nathan Sidwell <nathan@acm.org>
2672 * cp-tree.h (lang_decl_fn): Remove assignment_operator_p field.
2673 (DECL_COMPLETE_CONSTRUCTOR_P): Directly compare
2675 (DECL_BASE_CONSTRUCTOR_P, DECL_COMPLETE_DESTRUCTOR_P,
2676 DECL_BASE_DESTRUCTOR_P, DECL_DELETING_DESTRUCTOR_P): Likewise.
2677 (DECL_ASSIGNMENT_OPERATOR_P): Use IDENTIFIER_ASSIGN_OP_P.
2678 * decl.c (grok_op_properties): Adjust identifier checking.
2679 * init.c (expand_default_init): Adjust identifier descision.
2680 * method.c (implicitly_declare_fn): Don't use
2681 DECL_ASSIGNMENT_OPERATOR_P.
2682 * search.c (lookup_fnfields_1): Use IDENTIFIER_CTOR_P,
2684 * call.c (in_charge_arg_for_name): Reimplement.
2685 (build_special_member_call): Use IDENTIFIER_CDTOR_P,
2688 2017-06-26 Marek Polacek <polacek@redhat.com>
2691 * parser.c (cp_parser_statement): Add a default argument. Save the
2692 location of the expression-statement after labels have been parsed.
2693 (cp_parser_implicitly_scoped_statement): Set the location of the
2694 body of the conditional after parsing all the labels. Call
2695 warn_for_multistatement_macros.
2696 (cp_parser_already_scoped_statement): Likewise.
2698 2017-06-24 Paolo Carlini <paolo.carlini@oracle.com>
2701 * parser.c (cp_parser_diagnose_invalid_type_name): Don't print
2702 'typename' in error messages about missing 'typename'.
2704 2017-06-23 Jason Merrill <jason@redhat.com>
2706 PR c++/79056 - C++17 ICE with invalid template syntax.
2707 * parser.c (cp_parser_simple_type_specifier): Don't assume that type
2709 (cp_parser_check_for_invalid_template_id): Handle TYPE_DECL.
2710 * pt.c (template_placeholder_p): New.
2711 * cp-tree.h: Declare it.
2713 2017-06-23 Marc Glisse <marc.glisse@inria.fr>
2715 * decl.c (duplicate_decls): Use builtin_structptr_types.
2717 2017-06-22 Nathan Sidwell <nathan@acm.org>
2719 Reorder IDENTIFIER flags
2721 * cp-tree.h (enum cp_identifier_kind): New.
2722 (IDENTIFIER_KIND_BIT_0, IDENTIFIER_KIND_BIT_1,
2723 IDENTIFIER_KIND_BIT_2): New.
2724 (IDENTIFIER_MARKED): Move to TREE_LANG_FLAG_4.
2725 (IDENTIFIER_VIRTUAL_P, IDENTIFIER_REPO_CHOSEN): Add IDENTIFIER_CHECK.
2726 (C_IS_RESERVED_WORD): Replace with ...
2727 (IDENTIFIER_KEYWORD_P): ... this.
2728 (IDENTIFIER_CTOR_OR_DTOR_P): Replace with ...
2729 (IDENTIFIER_CDTOR_P): ... this.
2730 (IDENTIFIER_CTOR_P, IDENTIFIER_DTOR_P): New.
2731 (IDENTIFIER_OPNAME_P): Replace with ...
2732 (IDENTIFIER_ANY_OP_P): ... this.
2733 (IDENTIFIER_ASSIGN_OP_P): New.
2734 (IDENTIFIER_TYPENAME_P): Replace with ...
2735 (IDENTIFIER_CONV_OP_P): ... this.
2736 (NEW_DELETE_OPNAME_P): Replace with ...
2737 (IDENTIFIER_NEWDEL_OP_P): ... this.
2738 (DECL_CONV_FN_P, DECL_OVERLOADED_OPERATOR_P): Adjust.
2739 (get_identifier_kind_name, set_identifier_kind): Declare.
2740 * lex.c (get_identifier_kind_name, set_identifier_kind): New.
2741 (init_operators): Adjust to avoid keywords, use
2742 set_identifier_kind. Copy TYPE_EXPR slot.
2743 (init_reswords): Call set_identifier_kind.
2744 (unqualified_name_lookup_error): Adjust.
2745 * operators.def (TYPE_EXPR): Remove.
2746 * decl.c (struct predefined_identifier): Move into ...
2747 (initialize_predefined_identifiers): ... here. Call
2748 set_identifier_kind.
2749 (grokfndecl, check_var_type, grokdeclarator): Adjust.
2750 (grok_op_properties): Use IDENTIFIER_ANY_ASSIGN_OP to halve search
2752 * call.c (name_as_c_string): Adjust.
2753 (build_new_method_call_1): Likewise.
2754 * cp-cilkplus.c (is_conversion_operator_function_decl_p): Likewise.
2755 * cxx-pretty-print.c (pp_cxx_unqualified_id): Adjust.
2756 * dump.c (cp_dump_tree): Adjust.
2757 * error.c (dump_decl_name): Adjust.
2758 * mangle.c (write_unqualified_id, write_member_name,
2759 write_expression): Adjust.
2760 (mangle_conv_op_name_for_type): Use set_identifier_kind.
2761 * name-lookup.c (do_class_using_decl): Adjust.
2762 (lookup_name_fuzzy, lookup_name_real_1): Likewise.
2763 * parser.c (cp_lexer_get_preprocessor_token,
2764 cp_parser_direct_declarator): Likewise.
2765 * pt.c (push_template_decl_real, tsubst_decl, tsubst_baselink,
2766 tsubst_copy, tsubst_copy_and_build): Adjust.
2767 * ptree.c (cxx_print_identifier): Print identifier kind.
2768 * search.c (lookup_field_r, lookup_member,
2769 lookup_fnfields_idx_nolazy): Adjust.
2770 * semantics.c (finish_id_expression): Adjust..
2771 * typeck.c (cp_build_addr_expr_1): Adjust.
2773 2017-06-21 Jakub Jelinek <jakub@redhat.com>
2776 * semantics.c (handle_omp_array_sections_1, finish_omp_clauses):
2777 Complain about t not being a variable if t is OVERLOAD even
2778 when processing_template_decl.
2780 2017-06-21 David Malcolm <dmalcolm@redhat.com>
2782 * parser.c (get_cast_suggestion): New function.
2783 (maybe_add_cast_fixit): New function.
2784 (cp_parser_cast_expression): Capture the location of the closing
2785 parenthesis. Call maybe_add_cast_fixit when emitting warnings
2786 about old-style casts.
2788 2017-06-20 Jason Merrill <jason@redhat.com>
2790 PR c++/80972 - C++17 ICE with attribute packed.
2791 * call.c (build_over_call): Allow a TARGET_EXPR from reference
2794 2017-06-20 Nathan Sidwell <nathan@acm.org>
2796 * cp-tree.h (CPTI_NELTS_IDENTIFIER): Delete.
2797 (nelts_identifier): Delete.
2798 * decl.c (initialize_predefined_identifiers): Remove nelts.
2800 PR c++/67074 - namespace aliases
2801 * decl.c (duplicate_decls): Don't error here on mismatched
2803 * name-lookup.c (name_lookup::add_value): Matching namespaces are
2805 (diagnose_name_conflict): Namespaces are never redeclarations.
2806 (update_binding): An alias can match a real namespace.
2808 2017-06-19 Jason Merrill <jason@redhat.com>
2810 PR c++/80562 - ICE with constexpr if.
2811 * semantics.c (finish_if_stmt_cond): Call
2812 instantiate_non_dependent_expr.
2814 PR c++/80829 - ICE with constexpr copy of base subobject.
2815 * constexpr.c (clear_no_implicit_zero): New.
2816 (cxx_eval_call_expression): Call it.
2818 2017-06-19 Nathan Sidwell <nathan@acm.org>
2822 * name-lookup.c (set_decl_namespace): Don't follow using
2823 directives and ignore using decls. Only check overly-explicit
2824 scope after discovering decl.
2826 2017-06-19 Jason Merrill <jason@redhat.com>
2828 PR c++/81073 - constexpr and static var in statement-expression.
2829 * typeck2.c (store_init_value): Always call
2830 require_potential_constant_expression.
2831 * pt.c (convert_nontype_argument): Likewise.
2832 * constexpr.c (potential_constant_expression_1): Adjust message.
2833 Use decl_maybe_constant_var_p instead of decl_constant_var_p.
2834 * decl2.c (decl_maybe_constant_var_p): Consider initializer.
2836 2017-06-19 Nathan Sidwell <nathan@acm.org>
2838 * pt.c (coerce_template_parms): Fix indentation.
2839 (tsubst_decl): Remove repeated SET_DECL_RTL. Move VAR_P handling
2843 * name-lookup.c (update_binding): Only warn about constructors
2844 hidden by functions.
2846 2017-06-17 Jason Merrill <jason@redhat.com>
2848 PR c++/60063 - -Wunused-local-typedefs and templates.
2849 * decl2.c (is_late_template_attribute): Return false for "used".
2851 PR c++/70844 - -Wuseless-cast and inheriting constructor.
2852 * method.c (forward_parm): Suppress warn_useless_cast.
2854 2017-06-16 Jason Merrill <jason@redhat.com>
2856 PR c++/81045 - Wrong type-dependence with auto return type.
2857 * pt.c (type_dependent_expression_p): An undeduced auto outside the
2858 template isn't dependent.
2859 * call.c (build_over_call): Instantiate undeduced auto even in a
2862 PR c++/80465 - ICE with generic lambda with noexcept-specifier.
2863 * lambda.c (maybe_add_lambda_conv_op): Keep processing_template_decl
2864 set longer for a generic lambda.
2866 PR c++/80614 - Wrong mangling for C++17 noexcept type
2867 * mangle.c (write_type): Put the eh spec back on the function type.
2869 PR c++/81102 - Wrong error with partial specialization.
2870 * pt.c (unify) [TEMPLATE_PARM_INDEX]: Strip reference when comparing
2871 types. Do type deduction later.
2873 PR c++/81074 - ICE with partial specialization of member template.
2875 * pt.c (get_partial_spec_bindings): Only coerce innermost args.
2877 PR c++/80831 - ICE with -fsyntax-only.
2878 * decl2.c (c_parse_final_cleanups): Use cgraph_node::get_create.
2880 PR c++/80639 - ICE with invalid PMF initialization.
2881 PR c++/80043 - ICE with -fpermissive
2882 * typeck.c (convert_for_assignment): Recurse when instantiate_type
2883 returns without an error.
2885 2017-06-16 Nathan Sidwell <nathan@acm.org>
2887 * pt.c (tsubst_baselink): Fix & clarify formatting.
2889 * cp-tree.h (build_this_parm, cp_build_parm_decl,
2890 build_artificial_parm): Add FN parm.
2891 * decl.c (start_cleanup_fn): Adjust.
2892 (build_this_parm): Add FN parm, pass it through.
2893 (grokfndecl): Adjust parm building.
2894 * decl2.c (cp_build_parm_decl): Add FN parm, set context.
2895 (build_artificial_parm): Add FN parm, pass through.
2896 (maybe_retrofit_in_chrg): Adjust parm building.
2897 (start_static_storage_duration_function): Likwise.
2898 * lambda.c (maybe_aadd_lambda_conv_op): Likewise.
2899 * method.c (implicitly_declare_fn): Likewise.
2900 * parser.c (inject_this_parameter): Likewise.
2902 Symbol tables are insert only.
2903 * cp-tree.h (default_hash_traits <lang_identifier *>): Don't
2904 derive from pointer_hash. Make undeletable.
2906 * class.c (resort_type_method_vec): Avoid potential unsigned
2909 Don't defer noexcept_deferred_spec.
2910 * cp-tree.h (unevaluated_noexcept_spec): Don't declare.
2911 * decl.c (cxx_init_decl_processing): Initialize
2912 noexcept_deferred_spec.
2913 * except.c (unevaluated_noexcept_spec): Delete.
2914 * class.c (deduce_noexcept_on_destructor): Use
2915 noexcept_deferred_spec directly.
2916 * method.c (implicitly_declare_fn): Likewise.
2918 Make keyed_classes a vector.
2919 * cp-tree.h (CPTI_KEYED_CLASSES, keyed_classes): Delete.
2920 (keyed_classes): Declare as vector.
2921 * decl.c (keyed_classes): Define.
2922 (cxx_init_decl_processing): Allocate it.
2923 (record_key_method_defined): Use vec_safe_push.
2924 * class.c (finish_struct_1): Likewise.
2925 * pt.c (instantiate_class_template_1): Likewise.
2926 * decl2.c (c_parse_final_cleanups): Reverse iterate keyed_classes.
2929 * rtti.c (enum tinfo_kind): Add TK_DERIVED_TYPES,
2930 TK_VMI_CLASS_TYPES, TK_MAX. Delete TK_FIXED.
2932 (typeid_ok_p): Add quotes to error messages. Use get_tinfo_desc.
2933 (get_tinfo_decl): Use get_tinfo_desc.
2934 (get_pseudo_ti_init): Likewise. Adjust VMI construction.
2935 (create_pseudo_type_info): Delete.
2936 (get_pseudo_ti_index): Just determine the index.
2937 (get_tinfo_desc): New. Create all types lazily.
2938 (create_tinfo_types): Just allocate the descriptor array.
2939 (emit_support_tinfos): Use non-inserting type lookup. Set builtin
2942 2017-06-15 Martin Sebor <msebor@redhat.com>
2945 * call.c (first_non_public_field, maybe_warn_class_memaccess): New
2947 (has_trivial_copy_assign_p, has_trivial_copy_p): Ditto.
2948 (build_cxx_call): Call maybe_warn_class_memaccess.
2950 2017-06-14 Jakub Jelinek <jakub@redhat.com>
2952 * cp-gimplify.c (cp_genericize_r): Turn most of the function
2953 into a switch (TREE_CODE (stmt)) statement from long else if
2956 2017-06-13 Jakub Jelinek <jakub@redhat.com>
2959 * cp-gimplify.c (cp_genericize_r): Don't instrument MEM_REF second
2960 argument even if it has REFERENCE_TYPE.
2963 * cp-gimplify.c (cp_genericize): Only look for VAR_DECLs in
2964 BLOCK_VARS (outer) chain.
2965 (cxx_omp_const_qual_no_mutable): Likewise.
2967 2017-06-13 Martin Liska <mliska@suse.cz>
2970 * class.c (build_base_path): Use sanitize_flags_p.
2971 * cp-gimplify.c (cp_genericize_r): Likewise.
2972 (cp_genericize_tree): Likewise.
2973 (cp_genericize): Likewise.
2974 * cp-ubsan.c (cp_ubsan_instrument_vptr_p): Likewise.
2975 * decl.c (compute_array_index_type): Likewise.
2976 (start_preparsed_function): Likewise.
2977 * decl2.c (one_static_initialization_or_destruction): Likewise.
2978 * init.c (finish_length_check): Likewise.
2979 * lambda.c (maybe_add_lambda_conv_op): Likewise.
2980 * typeck.c (cp_build_binary_op): Likewise.
2981 (build_static_cast_1): Likewise.
2983 2017-06-11 Jason Merrill <jason@redhat.com>
2985 * error.c (dump_expr): Use is_this_parameter.
2987 * cp-tree.h, decl2.c, mangle.c, parser.c, pt.c, semantics.c: Use
2990 2017-06-09 Jason Merrill <jason@redhat.com>
2992 Missing bits from N4268, constant evaluation for all non-type args.
2993 * call.c (build_converted_constant_expr): Rename from
2994 build_integral_nontype_arg_conv, handle all types.
2995 * pt.c (convert_nontype_argument): In C++17 call it for all types.
2996 Move NOP stripping inside pointer case, don't strip ADDR_EXPR.
2997 * cvt.c (strip_fnptr_conv): Also strip conversions to the same type.
2999 Overhaul pointer-to-member conversion and template argument handling.
3000 * call.c (standard_conversion): Avoid creating ck_pmem when the
3001 class type is the same.
3002 * cvt.c (can_convert_qual): Split from
3003 perform_qualification_conversions.
3004 * constexpr.c (cxx_eval_constant_expression): Check it.
3005 * typeck.c (convert_ptrmem): Only cplus_expand_constant if
3006 adjustment is necessary.
3007 * pt.c (check_valid_ptrmem_cst_expr): Compare class types.
3008 (convert_nontype_argument): Avoid redundant error.
3010 * call.c (convert_like_real): Remove "inner" parameter.
3011 Don't replace a constant with its value.
3012 * cp-gimplify.c (cp_fully_fold): Use cp_fold_rvalue.
3014 * pt.c (convert_nontype_argument): Check NULLPTR_TYPE_P rather than
3017 * parser.c (cp_parser_constant_expression): Check
3018 potential_rvalue_constant_expression after decay_conversion.
3019 * pt.c (convert_nontype_argument): Don't require linkage in C++17.
3021 PR c++/80384 - ICE with dependent noexcept-specifier
3022 * pt.c (dependent_type_p_r) [FUNCTION_TYPE]: Check for dependent
3025 * constexpr.c (potential_constant_expression_1): Allow 'this' capture.
3027 2017-06-09 Jan Hubicka <hubicka@ucw.cz>
3029 * class.c (build_vtbl_initializer): Mark dvirt_fn as cold.
3030 * decl.c (cxx_init_decl_processing, push_throw_library_fn): Likewise.
3031 (excpet.c): Mark terminate as cold.
3033 2017-06-08 Jakub Jelinek <jakub@redhat.com>
3036 * semantics.c (handle_omp_array_sections_1): Convert TYPE_MAX_VALUE
3037 to sizetype before size_binop.
3040 * cp-gimplify.c (cxx_omp_finish_clause): When changing clause
3041 to OMP_CLAUSE_SHARED, also clear OMP_CLAUSE_SHARED_FIRSTPRIVATE
3042 and OMP_CLAUSE_SHARED_READONLY flags.
3044 2017-06-08 Jan Hubicka <hubicka@ucw.cz>
3046 * cp-tree.h (lang_check_failed): Annotate by ATTRIBUTE_COLD.
3048 2017-06-07 Nathan Sidwell <nathan@acm.org>
3050 * class.c (layout_class_type): Restructure overlong-bitfield tpe
3053 2017-06-07 Jonathan Wakely <jwakely@redhat.com>
3056 * pt.c (do_class_deduction): Build qualified type.
3058 2017-06-06 Nathan Sidwell <nathan@acm.org>
3060 * name-lookup.c (suggest_alternatives_for): Use qualified lookup
3061 sans using directives. Don't walk into inline namespaces.
3064 * name-lookup.c (adl_class_only): Don't add visible friends.
3066 2017-06-05 Volker Reichelt <v.reichelt@netcologne.de>
3068 * parser.c (cp_parser_base_specifier): Fix typos in error messages.
3070 2017-06-02 Nathan Sidwell <nathan@acm.org>
3072 Remove lang_type_ptrmem.
3073 * cp-tree.h (lang_type_header): Remove is_lang_type_class. Move
3075 (lang_type_class): ... this. Reorder bitfields. Rename to ...
3076 (lang_type): ... this. Delete old definition.
3077 (lang_type_ptrmem): Delete.
3078 (LANG_TYPE_CLASS_CHECK): Simply get TYPE_LANG_SPECIFIC. Adjust uses.
3079 (LANG_TYPE_PTRMEM_CHECK): Delete.
3080 (TYPE_GET_PTRMEMFUNC_TYPE, TYPE_SET_PTRMEMFUNC_TYPE): Delete.
3081 (TYPE_PTRMEMFUNC_TYPE): New. Use TYPE_LANG_SLOT_1.
3082 * decl.c (build_ptrmemfunc_type): Adjust.
3083 * lex.c (copy_lang_type): Remove lang_type_ptrmem handling.
3084 (maybe_add_lang_type_raw): Don't set u.c.h.is_lang_type_class.
3086 * class.c (check_bases_and_members): Adjust vec_new_uses_cookie
3089 Remove cp_binding_level::namespaces
3090 * name-lookup.h (cp_binding_level): Lose namespaces field.
3091 * name-lookup.c (add_decl_to_level): Chain namespaces on the names
3093 (suggest_alternatives_for): Adjust for namespace list. Do
3094 breadth-first search.
3095 * decl2.c (collect_source_refs): Namespaces are on the regulr
3097 (collect_ada_namespace): Likewise.
3099 2017-06-02 Bernd Edlinger <bernd.edlinger@hotmail.de>
3101 * typeck.c (cp_build_binary_op): Implement the -Wsizeof_pointer_div
3104 2017-06-01 Ville Voutilainen <ville.voutilainen@gmail.com>
3107 * method.c (constructible_expr): Strip array types before calling
3110 2017-06-01 Paolo Carlini <paolo.carlini@oracle.com>
3113 * cvt.c (convert_to_void): Possibly call maybe_warn_nodiscard
3114 for case INDIRECT_REF too in the main switch.
3116 2017-05-31 Jason Merrill <jason@redhat.com>
3118 PR c++/80840 - ICE with constexpr and reference
3119 * pt.c (convert_nontype_argument): Don't test whether a decl is
3120 value-dependent when binding to a reference.
3122 2017-05-31 Nathan Sidwell <nathan@acm.org>
3124 * cp-tree.h (lang_decl_slector): New enum.
3125 (lang_decl_base): Make selector an enum. Drop decomposition_p
3127 (lang_decl): Use enum for discrimination.
3128 (LANG_DECL_FN_CHECK, LANG_DECL_NS_CHECK, LANG_DECL_PARM_CHECK,
3129 LANG_DECL_DEOMP_CHECK): Use enum.
3130 (DECL_DECOMPOSITION_P): Use selector value.
3131 (SET_DECL_DECOMPOSITION_P): Delete.
3132 (retrofit_lang_decl): Lose SEL parm.
3133 (fit_decomposition_lang_decl): Declare.
3134 * decl.c (cp_finish_decomp, grokdeclarator): Use
3135 fit_decomposition_lang_decl.
3136 * lex.c (maybe_add_lang_decl_raw): New. Broken out of
3138 (set_decl_linkage): New. Broken out of retrofit_lang_decl. Use enum.
3139 (fit_decomposition_lang_decl): Likewise.
3140 (retrofit_lang_decl): Use worker functions.
3141 (cxx_dup_lang_specific_decl): Use selector enum.
3142 (maybe_add_lang_type_raw): New. Broken out of ...
3143 (cxx_make_type_name): ... here. Call it.
3145 2017-05-30 Jason Merrill <jason@redhat.com>
3147 PR c++/80856 - ICE with local extern in template
3148 * semantics.c (finish_call_expr): Replace a local extern overload
3149 set in a template with the IDENTIFIER_NODE.
3151 2017-05-30 David Malcolm <dmalcolm@redhat.com>
3153 * call.c (perform_implicit_conversion_flags): Convert
3154 "from %qT to %qT" to "from %qH to %qI" in diagnostic.
3155 (print_conversion_rejection): Replace pairs of %qT with
3156 %qH and %qI in various places.
3157 (build_user_type_conversion_1): Likewise.
3158 (build_integral_nontype_arg_conv): Likewise.
3159 (build_conditional_expr_1): Likewise.
3160 (convert_like_real): Likewise.
3161 (convert_arg_to_ellipsis): Likewise.
3163 (initialize_reference): Likewise.
3164 * cvt.c (cp_convert_to_pointer): Likewise.
3165 (cp_convert_to_pointer): Likewise.
3166 (convert_to_reference): Likewise.
3167 (ocp_convert): Likewise.
3168 * error.c (cp_printer): Gain bool and const char ** parameters.
3169 (struct deferred_printed_type): New struct.
3170 (class cxx_format_postprocessor): New class.
3171 (cxx_initialize_diagnostics): Wire up a cxx_format_postprocessor
3172 to pp->m_format_postprocessor.
3173 (comparable_template_types_p): New function.
3174 (newline_and_indent): New function.
3175 (arg_to_string): New function.
3176 (print_nonequal_arg): New function.
3177 (print_template_differences): New function.
3178 (type_to_string_with_compare): New function.
3179 (print_template_tree_comparison): New function.
3180 (append_formatted_chunk): New function.
3181 (add_quotes): New function.
3182 (cxx_format_postprocessor::handle): New function.
3183 (defer_phase_2_of_type_diff): New function.
3184 (cp_printer): Add "quoted" and "buffer_ptr" params. Implement
3186 * typeck.c (cp_build_binary_op): Replace pairs of %qT with
3187 %qH and %qI in various places.
3188 (convert_member_func_to_ptr): Likewise.
3189 (build_reinterpret_cast_1): Likewise.
3190 (convert_for_assignment): Likewise.
3191 * typeck2.c (check_narrowing): Likewise.
3193 2017-05-30 Nathan Sidwell <nathan@acm.org>
3195 Kill IDENTIFIER_NAMESPACE_BINDINGS
3196 * cp-tree.h (lang_identifier): Delete namespace_bindings.
3197 (IDENTIFIER_NAMESPACE_BINDINGS): Delete.
3198 (lang_decl_ns): Add bindings.
3199 (DECL_NAMESPACE_BINDINGS): New.
3200 * lex.c (retrofit_lang_decl): Create namespace hash table.
3201 * name-lookup.c (find_namespace_slot): Change to use hash-map.
3202 * ptree.c (cxx_print_binding): Delete.
3203 (cxx_print_identifier): Remove NAMESPACE_BINDING printing.
3205 * cp-tree.def (OVERLOAD): Fix comment.
3206 * cp-tree.h: Fix comments and whitespace.
3207 * error.c (dump_decl): Use pp_cxx_colon_colon, ovl_scope.
3208 * name-lookup.c (add_decl_to_level): Assert not class.
3209 (check_local_shadow): Use OVL_P.
3210 (pushdecl_with_scope_1): Rename to ...
3211 (do_pushdecl_with_Scope): ... here.
3212 (do_nonmember_using_decl): Use qualified_namespace_lookup return
3214 (push_class_level_binding_1): Use OVL_P.
3215 (pushdecl_namespace_level): Use do_pushdecl_with_scope.
3216 (pushtag_1): Rename to ...
3217 (do_pushtag): ... here. Adjust do_pushdecl_with_scope call.
3219 (store_class_bindings): Do not time here.
3220 * name-lookup.h (pushdecl_outermost_localscope): Reorder.
3221 * pt.c (listify): Declare argvec at point of initialization.
3224 * name-lookup.c (add_decl_to_level): Assert not making a circular
3226 (update_binding): Don't prematurely slide artificial decl.
3228 2017-05-29 Alexandre Oliva <aoliva@redhat.com>
3230 * cp-tree.h (lang_identifier): Drop oracle_looked_up, unused.
3232 2017-05-29 Nathan Sidwell <nathan@acm.org>
3234 PR c++/80891 (#1,#5)
3235 * cp-tree.h (lookup_maybe_add): Add DEDUPING argument.
3236 * name-lookup.c (name_lookup): Add deduping field.
3237 (name_lookup::preserve_state, name_lookup::restore_state): Deal
3239 (name_lookup::add_overload): New.
3240 (name_lookup::add_value, name_lookup::add_fns): Call add_overload.
3241 (name_lookup::search_adl): Set deduping. Don't unmark here.
3242 * pt.c (most_specialized_instantiation): Revert previous change,
3243 Assert not given duplicates.
3244 * tree.c (lookup_mark): Just mark the underlying decls.
3245 (lookup_maybe_add): Dedup using marked decls.
3248 * ptree.c (cxx_print_xnode): Show internal OVERLOAD structure.
3249 * tree.c (ovl_insert, ovl_iterator_remove_node): Fix copying assert.
3251 Stat hack representation
3252 * name-lookup.c (STAT_HACK_P, STAT_TYPE, STAT_DECL,
3253 MAYBE_STAT_DECL, MAYBE_STAT_TYPE): New.
3255 (find_namespace_binding): Replace with ...
3256 (find_namespace_slot): ... this.
3257 (find_namespace_value): New.
3258 (name_lookup::search_namespace_only,
3259 name_lookup::adl_namespace_only): Adjust.
3260 (update_binding): Add SLOT parameter, adjust.
3261 (check_local_shadow): Use find_namespace_value.
3262 (set_local_extern_decl_linkage): Likewise.
3263 (do_pushdecl): Adjust for namespace slot.
3264 (push_local_binding): Assert not a namespace binding.
3265 (check_for_out_of_scope_variable): Use find_namespace_value.
3266 (set_identifier_type_value_with_scope): Likewise.
3267 (get_namespace_binding): Likewise.
3268 (set_namespace_binding): Delete.
3269 (set_global_binding): Directly update the binding.
3270 (finish_namespace_using_decl): Likewise.
3271 (lookup_type_scope_1): Use find_namespace_slot and update.
3272 (do_push_nested_namespace): Use find_namespace_value.
3275 * pt.c (most_specialized_instantiation): Cope with duplicate
3279 * cp-tree.h (build_min_nt_call_vec): Declare.
3280 * decl.c (build_offset_ref_call_from_tree): Call it.
3281 * parser.c (cp_parser_postfix_expression): Likewise.
3282 * pt.c (tsubst_copy_and_build): Likewise.
3283 * semantics.c (finish_call_expr): Likewise.
3284 * tree.c (build_min_nt_loc): Keep unresolved lookups.
3285 (build_min): Likewise.
3286 (build_min_non_dep): Likewise.
3287 (build_min_non_dep_call_vec): Likewise.
3288 (build_min_nt_call_vec): New.
3291 * tree.c (ovl_copy): Adjust assert, copy OVL_LOOKUP.
3293 (lookup_keep): Call it.
3295 2017-05-26 Nathan Sidwell <nathan@acm.org>
3298 * name-lookup.c (push_inline_namespaces): New.
3299 (push_namespace): Look inside inline namespaces.
3301 Inline and using namespace representation change.
3302 * cp-tree.h (struct lang_decl_ns): Delete ns_using. Add usings,
3304 (DECL_NAMESPACE_USING): Adjust.
3305 (DECL_NAMESPACE_INLINEES): New.
3306 * name-lookup.h (struct cp_binding_level): Change usings
3308 * name-lookup.c (name_lookup::do_queue_usings,
3309 name_lookup::queue_usings): Adjust.
3310 (name_lookup::search_namespace, name_lookup::search_usings,
3311 name_lookup::queue_namespace): Adjust.
3312 (name_lookup::adl_namespace_only): Adjust.
3313 (add_using_namespace, push_namespace): Push onto vector.
3314 (pop_namespace): Add timing logic.
3316 * call.c (build_operator_new_call): Do namelookup and ADL here.
3317 (build_new_op_1): Likewise.
3318 * name-lookup.h (lookup_function_nonclass): Delete declaration.
3319 (do_using_directive): Likewise.
3320 * name-lookup.c (set_namespace_binding, push_local_binding): Don't
3322 (struct scope_binding): Delete.
3323 (EMPTY_SCOPE_BINDING): Delete.
3324 (set_decl_namespace): Use OVL_P.
3325 (finish_local_using_decl): Lose unnecesary checks.
3326 (lookup_function_nonclass): Delete.
3327 (cp_emit_debug_info_for_using): Use MAYBE_BASELINK_P.
3329 * cp-tree.h (OVL_CHAIN): Check looking at OVERLOAD.
3330 (ovl_iterator): Add allow_inner field. Adjust ctor. Make
3332 (ovl_iterator::maybe_push, ovl_iterator::pop): New.
3333 (lkp_iterator): Add outer field. Adjust ctor.
3334 (lkp_iterator::operator++): New.
3335 (lookup_mark, lookup_maybe_add): Declare.
3336 * name-lookup.c (name_lookup): Delete fn_set member.
3337 (name_lookup::preserve_state, name_lookup::restore_state): Unmark
3339 (name_lookup::add_value): Use lookup_add directly.
3340 (name_lookup::add_fns: Use lookup_maybe_add.
3341 (name_lookup::search_adl): Mark and unmark fns.
3343 * pt.c (check_explicit_specialization): Use lookup_add directly.
3344 * ptree.c (cxx_print_xnode): Show complete overload structure.
3345 * tree.c (lookup_mark, lookup_maybe_add): New.
3347 * name-lookup.c (name_lookup::search_adl): ADL OMP UDR type args.
3349 2017-05-26 Jakub Jelinek <jakub@redhat.com>
3351 * cp-tree.h (struct lang_decl_decomp): New type.
3352 (struct lang_decl): Add u.decomp.
3353 (LANG_DECL_DECOMP_CHECK): Define.
3354 (DECL_DECOMPOSITION_P): Note it is set also on the vars
3355 for user identifiers.
3356 (DECL_DECOMP_BASE): Define.
3357 (retrofit_lang_decl): Add extra int = 0 argument.
3358 * lex.c (retrofit_lang_decl): Add SEL argument, if non-zero
3359 use it to influence the selector choices and for selector
3360 0 to non-zero transition copy old content.
3361 (cxx_dup_lang_specific_decl): Handle DECL_DECOMPOSITION_P.
3362 * decl.c (poplevel): For DECL_DECOMPOSITION_P, check
3363 !DECL_DECOMP_BASE instead of !DECL_VALUE_EXPR. Adjust warning
3364 wording if decl is a structured binding.
3365 (cp_finish_decomp): Pass 4 as the new argument to retrofit_lang_decl.
3366 Set DECL_DECOMP_BASE. Ignore DECL_READ_P sets from initialization
3367 of individual variables for tuple structured bindings.
3368 (grokdeclarator): Pass 4 as the new argument to retrofit_lang_decl.
3369 Clear DECL_DECOMP_BASE.
3370 * decl2.c (mark_used): Mark DECL_DECOMP_BASE TREE_USED as well.
3371 * pt.c (tsubst_decomp_names): Assert DECL_DECOMP_BASE matches what
3373 * expr.c (mark_exp_read): Recurse on DECL_DECOMP_BASE instead of
3376 2017-05-25 Jason Merrill <jason@redhat.com>
3378 PR c++/80605 - __is_standard_layout and zero-length array
3379 * class.c (check_bases): Use DECL_FIELD_IS_BASE.
3381 2017-05-25 Nathan Sidwell <nathan@acm.org>
3383 Kill OVL_CURRENT, OVL_NEXT.
3384 * cp-tree.h (OVL_CURRENT, OVL_NEXT): Delete.
3385 * name-lookup.c (set_decl_namespace): Use ovl_iterator.
3386 (consider_binding_level): Use OVL_FIRST.
3387 (cp_emit_debug_info_for_using): Use lkp_iterator.
3388 * pt.c (check_explicit_specialization): Use ovl_iterator.
3390 Kill DECL_NAMESPACE_USERS, DECL_NAMESPACE_ASSOCIATIONS.
3391 * cp-tree.h (lang_decl_ns): Remove ns_users field.
3392 (DECL_NAMESPACE_USERS, DECL_NAMESPACE_ASSOCIATIONS): Delete.
3393 (TREE_INDIRECT_USING): Delete.
3394 * name-lookup.h (is_associated_namespace): Delete.
3395 * name-lookup.c (name_lookup::search_usings,
3396 name_lookup::do_queue_usings): Usings are always direct.
3397 (is_associated_namespace): Delete.
3398 (handle_namespace_attrs): Use DECL_NAMESPACE_INLINE_P.
3399 (namespace_ancestor_1, namespace_ancestor): Delete.
3400 (push_using_directive_1, push_using_directive): Delete.
3401 (add_using_namespace_1): Delete.
3402 (add_using_namespace): Reimplement.
3403 (emit_debug_info_using_namespace): New.
3404 (finish_namespace_using_directive, finish_local_using_directive,
3405 push_namespace): Adjust.
3406 * tree.c (cp_free_lang_data): Remove DECL_NAMESPACE_USERS handling.
3408 2017-05-25 Volker Reichelt <v.reichelt@netcologne.de>
3410 * semantics.c (finish_handler_parms): Warn about non-reference type
3413 2017-05-25 Nathan Sidwell <nathan@acm.org>
3415 Reimplement unqualified namespace lookup.
3416 * name-lookup.c (name_lookup::using_pair,
3417 name_lookup::using_queue): New typedefs.
3418 (name_lookup::queue_namespace, name_lookup::do_queue_usings,
3419 name_lookup::queue_usings): New.
3420 (name_lookup::search_unqualified): New.
3421 (merge_functions, same_entity_p, ambiguous_decl,
3422 unqualified_namespace_lookup_1, unqualified_namespace_lookup,
3423 lookup_using_namespace): Delete.
3424 (lookup_name_real_1): Adjust.
3426 Reimplement qualified namespace lookup.
3427 * name-lookup.c (name_lookup::flags): New member. Adjust ctor.
3428 (name_lookup::ambiguous, name_lookup::add_value,
3429 name_lookup::add_type, name_lookup::process_binding): New.
3430 (name_lookup::search_namespace_only,
3431 name_lookup::search_namespace, name_lookup::search_usings): New.
3432 (name_lookup::search_qualified): New.
3433 (do_nonmember_using_decl, suggest_alternatives_for,
3434 lookup_qualified_name): Adjust.
3435 (tree_vec_contains): Delete.
3436 (qualified_lookup_using_namespace): Rename to ...
3437 (qualified_namespace_lookup): ... here. Reimplement.
3440 * cp-tree.h (LOOKUP_SEEN_P, LOOKUP_FOUND_P): New.
3441 * name-lookup.h (lookup_arg_dependent): Return plain tree.
3442 * name-lookup.c (arg_lookup, arg_assoc, arg_assoc_args,
3443 arg_assoc_args_vec, arg_assoc_type, add_function,
3444 arg_assoc_namespace, arg_assoc_class_only, arg_assoc_bases,
3445 arg_assoc_class, arg_assoc_template_arg, arg_assoc,
3446 lookup_arg_dependent_1): Delete.
3447 (name_lookup): New lookup object.
3448 (name_lookup::preserve_state, name_lookup::restore_state,
3449 name_lookup::mark_seen, name_lookup::find_and_mark,
3450 name_lookup::add_fns, name_lookup::adl_namespace_only,
3451 name_lookup::adl_namespace, name_lookup::adl_class_only,
3452 name_lookup::adl_bases, name_lookup::adl_class,
3453 name_lookup::adl_expr, name_lookup::adl_type,
3454 name_lookup::adl_template_arg, name_lookup::search_adl): New.
3455 (lookup_arg_dependent): Return a plain tree. Adjust.
3456 (is_associated_namespace): Move later.
3458 2017-05-24 Nathan Sidwell <nathan@acm.org>
3460 * friend.c (do_friend): Remove check for existing decl.
3461 * name-lookup.h (lookup_name_innermost_nonclass_level): Delete.
3462 * name-lookup.c (push_local_binding): Directly look for binding.
3463 (lookup_name_innermost_nonclass_level_1): Delete.
3464 (lookup_name_innermost_nonclass_level): Delete.
3466 * Make-lang.in (CXX_AND_OBJCXX_OBJS): Alphabetize.
3468 * cp-tree.h (cp_free_lang_data): Add extern.
3469 (ovl_skip_hidden, is_overloaded_fn, really_overloaded_fn): Add
3471 (type_unknown_p): Return bool, make inline, lose TREE_LIST check.
3472 * typeck.c (type_unknown_p): Delete.
3473 * tree.c (is_overloaded_fn): Use MAYBE_BASELINE_FUNCTIONS, adjust
3474 overload management.
3475 (dependent_name): Likewise.
3476 (decl_anon_ns_mem_p): Simplify.
3478 2017-05-24 Jonathan Wakely <jwakely@redhat.com>
3481 * tree.c (reshape_init): Use unqualified type for direct enum init.
3482 * typeck.c (maybe_warn_about_cast_ignoring_quals): New.
3483 (build_static_cast_1, build_reinterpret_cast_1): Strip cv-quals from
3484 non-class destination types.
3485 (build_const_cast_1): Strip cv-quals from destination types.
3486 (build_static_cast, build_reinterpret_cast, build_const_cast)
3487 (cp_build_c_cast): Add calls to maybe_warn_about_cast_ignoring_quals.
3489 2017-05-24 Martin Sebor <msebor@redhat.com>
3492 * call.c (fully_fold_internal): Adjust.
3494 2017-05-24 Nathan Sidwell <nathan@acm.org>
3496 * cp-tree.h (ovl_skip_hidden): Declare.
3497 * tree.c (ovl_skip_hidden): New.
3498 * name-lookup.c (arg_assoc_namespace): Call ovl_skip_hidden.
3499 (lookup_arg_dependent_1): Likewise.
3500 (ambiguous_decl): Use DECL_HIDDEN_P, ovl_skip_hidden.
3501 (hidden_name_p, remove_hidden_names): Delete.
3502 (lookup_name_real_1): Do not strip hidden names.
3503 * name-lookup.h (hidden_name_p, remove_hidden_names): Delete.
3505 * cp-tree.h (OVL_HIDDEN_P): New.
3506 (ovl_iterator::hidden_p, ovl_iterator::reveal_node): New.
3507 (ovl_iterator::reveal_node): Declare.
3508 * tree.c (ovl_copy): Copy OVL_HIDDEN_P.
3509 (ovl_insert): Order on hiddenness.
3510 (ovl_iterator::reveal_node): New.
3511 * name-lookup.c (anticipated_builtin_p): New.
3512 (supplement_binding_1): Use it.
3513 (set_local_extern_decl_linkage): Use hidden_p.
3514 (do_pushdecl): Deal with unhiding a hidden decl, use
3515 anticipated_builtin_p.
3516 (do_nonmember_using_decl): Use anticipated_decl_p.
3517 (lookup_name_real_1): Use DECL_HIDDEN_P.
3519 2017-05-23 Jason Merrill <jason@redhat.com>
3521 -Wunused and C++17 structured bindings
3522 * decl.c (poplevel): Don't warn about unused structured bindings,
3523 only real variables.
3524 * error.c (dump_simple_decl): Handle structured bindings.
3525 * expr.c (mark_exp_read): Look through DECL_VALUE_EXPR.
3527 2017-05-23 Nathan Sidwell <nathan@acm.org>
3529 * cp-tree.h (PUSH_GLOBAL, PUSH_LOCAL, PUSH_USING): Delete.
3530 * name-lookup.c (create_local_binding): New.
3531 (update_binding): New.
3532 (pushdecl_maybe_friend_1): Rename to ...
3533 (do_pushdecl): ... this. Reimplement.
3535 (push_overloaded_decl_1, push_overloaded_decl): Delete.
3537 2017-05-23 Jason Merrill <jason@redhat.com>
3539 PR c++/80396 - built-in for make_integer_sequence.
3540 * pt.c (builtin_pack_fn_p, builtin_pack_call_p)
3541 (expand_integer_pack, expand_builtin_pack_call): New.
3542 (find_parameter_packs_r): Check builtin_pack_call_p.
3543 (check_for_bare_parameter_packs): Handle it.
3544 (tsubst_pack_expansion): Call expand_builtin_pack_call.
3545 (declare_integer_pack): New.
3546 (init_template_processing): Call it.
3547 * decl2.c (mark_used): Check builtin_pack_fn_p.
3549 2017-05-23 Nathan Sidwell <nathan@acm.org>
3551 * name-lookup.c (find_namespace_binding): New.
3552 (pushdecl_maybe_friend_1): Use CP_DECL_CONTEXT.
3553 (set_identifier_type_value_with_scope): Use find_namespace_binding.
3554 (find_binding, cp_binding_level_find_binding_for_name,
3555 binding_for_name, namespace_binding_1): Delete.
3556 (push_overloaded_decl_1): Use CP_DECL_CONTEXT.
3557 (get_namespace_binding, set_namespace_binding,
3558 finish_namespace_using_decl, unqualified_namespace_lookup_1,
3559 qualified_lookup_using_namespace, lookup_type_scope_1,
3560 lookup_name_innermost_nonclass_level_1): Use find_namespace_binding.
3563 * parser.c (cp_parser_template_id): Keep the lookup when stashing
3566 * cp-tree.h (DECL_HIDDEN_P): New.
3567 * name-lookup.c (set_decl_context,
3568 set_local_extern_decl_linkage): New, broken out of ...
3569 (pushdecl_maybe_friend_1): ... here. Call them.
3571 2017-05-23 Thomas Schwinge <thomas@codesourcery.com>
3573 * parser.c (OACC_KERNELS_CLAUSE_MASK): Add
3574 "PRAGMA_OACC_CLAUSE_NUM_GANGS", "PRAGMA_OACC_CLAUSE_NUM_WORKERS",
3577 2017-05-23 Nathan Sidwell <nathan@acm.org>
3579 * cp-tree.h (OVL_P): New.
3580 * name-lookup.h (push_local_binding): Delete.
3581 (do_toplevel_using_decl, do_local_using_decl): Rename to ...
3582 (finish_namespace_using_decl, finish_local_using_decl): ... here
3583 * name-lookup.c (add_decl_to_level): Swap args.
3584 (pop_bindings_and_leave_scope): Look inside TREE_LIST.
3585 (diagnose_name_conflict): Check contexts are same for redecl.
3586 (update_local_overload): New.
3587 (compparms_for_decl_and_using): Rename to ...
3588 (matching_fn_p): ... here.
3589 (pushdecl_maybe_friend_1): Adjust add_decl_to_level,
3590 push_local_bindings call.
3591 (push_local_binding): Make static, replace FLAGS arg with
3593 (validate_nonmember_using_decl): Use OVL_FIRST.
3594 (do_nonmember_using_decl): Use in/out parameters. Use
3595 lkp_iterator and simplify.
3596 (do_toplevel_using_decl, do_local_using_decl): Rename to ...
3597 (finish_namespace_using_decl, finish_local_using_decl): ... here.
3599 (lookup_type_current_level): Delete.
3600 * parser.c (cp_parser_using_declaration): Adjust.
3601 * pt.c (tsubst_expr): Adjust.
3603 2017-05-22 Nathan Sidwell <nathan@acm.org>
3605 * name-lookup.h (parse_using_directive): Replace with ...
3606 (finish_namespace_using_directive): ... this and ...
3607 (finish_local_using_directive): ... this.
3608 * name-lookup.c (add_using_namespace_1): Move later.
3609 (add_using_namespace): Move later, add namespace_p arg, remove
3611 (push_using_directive_1): Directly recurse.
3612 (do_using_directive, parse_using_directive): Delete, split into ...
3613 (finish_namespace_using_directive): ... this and ...
3614 (finish_local_using_directive): ... this.
3615 (push_namespace): Use add_using_namespace.
3616 * parser.c (cp_parser_using_directive): Call
3617 finish_namespace_using_directive or finish_local_using_directive.
3618 * pt.c (tsubst_expr): Call finish_local_using_directive.
3620 * cp-objcp-common.c (cp_register_dumps): Register raw dumper.
3621 * cp-tree.h (raw_dump_id): Declare.
3622 * decl2.c (raw_dump_id): Define.
3623 (dump_tu): Use raw_dump_id.
3625 * config-lang.in (gtfiles): Sort list, break lines.
3627 * cp-tree.h (CPTI_TERMINATE, CPTI_CALL_UNEXPECTED): Rename to ...
3628 (CPTI_TERMINATE_FN, CPTI_CALL_UNEXPECTED_FN): ... here.
3629 ( CPTI_GET_EXCEPTION_PTR_FN, CPTI_BEGIN_CATCH_FN, CPTI_END_CATCH_FN,
3630 CPTI_ALLOCATE_EXCEPTION_FN, CPTI_FREE_EXCEPTION_FN, CPTI_THROW_FN,
3631 CPTI_RETHROW_FN): New.
3632 (noexcept_deferred_spec): New.
3633 (terminate_node, call_unexpected_node): Rename to ...
3634 (terminate_fn, call_unexpected_fn): ... here.
3635 (get_exception_ptr_fn, begin_catch_fn, end_catch_fn,
3636 allocate_exception_fn, free_exception_fn, throw_fn, rethrow_fn): New.
3637 * except.c (fn1..fn5, throw_fn, rethrow_rn, spec): Delete.
3638 (init_exception_processing): Adjust.
3639 (declare_library_fn): Create and push the fns here.
3640 (do_get_exception_ptr, do_begin_catch, do_end_catch,
3641 do_allocate_exception_ptr, do_free_exception_ptr): Adjust
3642 declare_library_fn use.
3643 (unevaluated_noexcept_spec): Adjust.
3644 * cp-gimplify.c (genericize_eh_spec_block,
3645 gimplify_most_not_throw_expr): Adjust.
3647 * name-lookup.c (pushdecl_top_level,
3648 pushdecl_top_level_and_finish): Move after namespace pushing and
3650 (push_to_top_level): Rename to ...
3651 (do_push_to_top_level): ... here. Remove timing code.
3652 (pop_from_top_level_1): Rename to ...
3653 (do_pop_from_top_level): ... here.
3654 (do_push_nested_namespace, do_pop_nested_namespace)
3655 (push_to_top_level): New wrapper for do_push_to_top_level.
3656 (pop_from_top_level): Adjust.
3657 (push_nested_namepace, pop_nested_namespace): Wrappers for workers.
3659 2017-05-19 Bernd Edlinger <bernd.edlinger@hotmail.de>
3661 * config-lang.in (gtfiles): Add c-family/c-format.c,
3662 except.c, init.c, lambda.c and friend.c.
3663 * class.c (dvirt_fn): Move out of function scope,
3665 * except.c (fn1-5, throw_fn, rethrow_fn, spec): Likewise.
3666 * init.c (fn): Likewise.
3667 * lambda.c (ptr_id, max_id): Likewise.
3668 * friend.c (global_friend): Add GTY attribute.
3670 2017-05-19 Nathan Sidwell <nathan@acm.org>
3672 * call.c (add_list_candidates): Use OVL_FIRST.
3673 (build_new_method_call_1): Likewise.
3674 * cp-tree.h (OVL_SINGLE_P): New.
3675 (TYPE_HIDDEN_P): New.
3676 * decl.c (xref_tag_1): Use TYPE_HIDDEN_P.
3677 * dump.c (cp_tump_tree): Adjust overload dumping.
3678 * error.c (dump_decl): Use OVL_SINGLE_P, simplify context
3680 * method.c (lazily_declare_fn): Assert we added it.
3681 * parser.c (cp_parser_nested_name_specifier): Use OVL_SINGLE_P,
3683 (cp_parser_template_name): Use lkp_iterator.
3684 * pt.c (begin_template_parm_list): Fixup comment.
3685 (instantiate_class_template_1): Use TYPE_HIDDEN_P.
3686 * tree.c (ovl_iterator::remove_node): Cope with inherited ctors.
3687 (ovl_scope): Use lkp_iterator.
3689 2017-05-19 Thomas Schwinge <thomas@codesourcery.com>
3691 * parser.c (cp_parser_omp_clause_default): Handle
3692 "OMP_CLAUSE_DEFAULT_PRESENT".
3694 * parser.c (cp_parser_omp_clause_default): Avoid printing more
3695 than one syntax error message.
3697 2017-05-19 Nathan Sidwell <nathan@acm.org>
3699 * class.c (class_dump_id): Define.
3700 (dump_class_hierarchy, dump_vtable, dump_vtt): Use it.
3701 * cp-objcp-common.c (cp_register_dumps): New.
3702 * cp-objcp-common.h (cp_register_dumps): Declare.
3703 (LANG_HOOKS_REGISTER_DUMPS): Override.
3704 * cp-tree.h (class_dump_id): Declare.
3706 2017-05-18 Nathan Sidwell <nathan@acm.org>
3708 * cp-tree.h (OVL_ARG_DEPENDENT): Delete.
3710 (lookup_keep): Declare.
3711 * name-lookup.c (add_function): Don't set OVL_ARG_DEPENDENT.
3712 * pt.c (tsubst_copy): Assert lookup is persistent.
3713 * semantics.c (finish_call_expr): Use lkp_iterator, call
3715 * tree.c (ovl_copy): New.
3716 (ovl_insert, ovl_iterator::remove_node): Copy immutable nodes.
3719 * cp-tree.h (OVL_USED): Replace with ...
3720 (OVL_USING_P): ... this.
3721 (ovl_iterator::using_p): Adjust.
3722 * name-lookup.c (push_overloaded_decl_1,
3723 do_nonmember_using_decl): Adjust.
3724 * search.c (lookup_field_r): Adjust.
3725 * tree.c (ovl_insert, ovl_scope): Adjust.
3727 * cp-tree.h (lookup_add): Swap args.
3728 (ovl_cons, build_overload): Delete.
3729 * name-lookup.c (add_function, push_overloaded_decl_1,
3730 do_nonmember_using_decl, merge_functions, remove_hidden_names):
3731 Use lookup_add, ovl_insert.
3732 * pt.c (check_explicit_specialization): Use lookup_add.
3733 (do_class_deduction): Likewise. Refactor if.
3734 * tree.c (lookup_add): Swap args.
3735 (ovl_cons, build_overload): Delete.
3737 * name-lookup.c (find_local_binding): New, broken out of ...
3738 (lookup_name_innermost_nonclass_level_1): ... here. Call it.
3739 (set_namespace_binding): Swap scope & name args.
3740 (namespace_binding_1): Likewise.
3741 (pushdecl_maybe_friend_1): Adjust set_namespace_binding call.
3742 (push_overloaded_decl_1): Likewise.
3743 (set_global_binding): Likewise.
3744 (get_namespace_binding): Adjust namespace_binding_1 call.
3746 2017-05-17 Nathan Sidwell <nathan@acm.org>
3748 * cp-tree.h (default_hash_traits <lang_identifier *>): New
3750 * name-lookup.c (lookup_extern_c_fun_in_all_ns): Delete.
3751 (extern_c_fns): New hash table.
3752 (check_extern_c_conflict): New, broken out of ...
3753 (pushdecl_maybe_friend_1): ... here. Call it.
3754 (c_linkage_bindings): Just look in hash table.
3756 2017-05-17 Ville Voutilainen <ville.voutilainen@gmail.com>
3760 Implement new C++ intrinsics __is_assignable and __is_constructible.
3761 * cp-tree.h (CPTK_IS_ASSIGNABLE, CPTK_IS_CONSTRUCTIBLE): New.
3763 * cxx-pretty-print.c (pp_cxx_trait_expression): Handle
3764 CPTK_IS_ASSIGNABLE and CPTK_IS_CONSTRUCTIBLE.
3765 * method.c (constructible_expr): Set cp_unevaluated.
3766 (is_xible_helper): New.
3767 (is_trivially_xible): Adjust.
3769 * parser.c (cp_parser_primary_expression): Handle
3770 RID_IS_ASSIGNABLE and RID_IS_CONSTRUCTIBLE.
3771 (cp_parser_trait_expr): Likewise.
3772 * semantics.c (trait_expr_value): Handle
3773 CPTK_IS_ASSIGNABLE and CPTK_IS_CONSTRUCTIBLE.
3775 2017-05-17 Nathan Sidwell <nathan@acm.org>
3777 * cp-tree.h (ovl_iterator::using_p): New predicate.
3778 (ovl_iterator::remove_node): New worker.
3779 (ovl_insert): Declare.
3780 * tree.c (ovl_insert): New.
3781 (ovl_iterator::remove_node): New.
3782 * class.c (add_method): Use ovl_iterator, ovl_insert.
3783 (clone_function_decl): Fix description.
3784 (clone_constructors_and_destructors): Use ovl_iterator.
3786 * class.c (handle_using_decl): Use OVL_FIRST, ovl_iterator.
3787 (maybe_warn_about_overly_private_class): Use ovl_iterator.
3788 (method_name_cmp, resort_method_name_cmp): Use OVL_NAME.
3789 (resort_type_method_vec, finish_struct_methods): Use OVL_FIRST.
3790 (get_base_fndecls): Use ovl_iterator.
3791 (warn_hidden): Use OVL_NAME, ovl_iterator.
3792 (add_implicitly_declared_members): Use ovl_iterator.
3793 * constraint.cc (normalize_template_id_expression): Use OVL_FIRST,
3795 (finish_shorthand_constraint): Simplify, use ovl_make.
3796 * pt.c (make_constrained_auto): Simplify. Use ovl_make.
3797 * search.c (shared_member_p): Use ovl_iterator.
3798 (lookup_field_fuzzy_info::fuzzy_lookup_fn): Use OVL_NAME.
3799 (lookup_conversion_operator): Use OVL_FIRST.
3800 (lookup_fnfiels_idx_nolazy): Use OVL_FIRST, OVL_NAME.
3801 (look_for_overrides_here): Use ovl_iterator.
3802 (lookup_conversions_r): Use OVL_FIRST, OVL_NAME, ovl_iterator.
3803 * typeck.c (build_x_unary_op): Use ovl_make.
3805 2017-05-17 Martin Liska <mliska@suse.cz>
3807 * class.c (dump_class_hierarchy): Introduce dump_flags_t type and
3808 use it instead of int type.
3809 (dump_vtable): Likewise.
3810 (dump_vtt): Likewise.
3811 * decl2.c (dump_tu): Likewise.
3813 2017-05-16 David Malcolm <dmalcolm@redhat.com>
3815 * call.c (enforce_access): Add access_failure_info * param and use
3816 it to record access failures.
3817 * cp-tree.h (class access_failure_info): New class.
3818 (enforce_access): Add access_failure_info * param, defaulting to
3820 (lookup_member): Likewise.
3821 (locate_field_accessor): New function decl.
3822 (perform_or_defer_access_check): Add access_failure_info * param,
3824 * search.c (lookup_member): Add access_failure_info * param and
3825 pass it on to call to perform_or_defer_access_check.
3826 (matches_code_and_type_p): New function.
3827 (field_access_p): New function.
3828 (direct_accessor_p): New function.
3829 (reference_accessor_p): New function.
3830 (field_accessor_p): New function.
3831 (struct locate_field_data): New struct.
3832 (dfs_locate_field_accessor_pre): New function.
3833 (locate_field_accessor): New function.
3834 * semantics.c (perform_or_defer_access_check): Add
3835 access_failure_info * param, and pass it on to call to
3837 * typeck.c (access_failure_info::record_access_failure): New method.
3838 (access_failure_info::maybe_suggest_accessor): New method.
3839 (finish_class_member_access_expr): Pass an access_failure_info
3840 instance to the lookup_member call, and call its
3841 maybe_suggest_accessor method afterwards.
3843 2017-05-16 Marek Polacek <polacek@redhat.com>
3847 * cp-gimplify.c (cp_fold): Handle SAVE_EXPR.
3849 2017-05-16 Nathan Sidwell <nathan@acm.org>
3851 * name-lookup.c (check_local_shadow): New, broke out of ...
3852 (pushdecl_maybe_friend_1): ... here. Call it.
3854 * cp-tree.h (OVL_NESTED_P, OVL_LOOKUP_P): New.
3855 (ovl_first): Move inline definition to end of file.
3856 (ovl_make, lookup_add): Declare.
3857 (get_fns, get_first_fn): Make pure.
3858 * tree.c (ovl_cache): New.
3859 (ovl_make, lookup_add): New.
3860 * pt.c (do_class_deduction): Don't add candidates that will be
3863 * call.c (build_user_type_conversion_1): Use OVL_FIRST.
3864 (print_error_for_call_failure): Use OVL_NAME.
3865 (build_op_call_1): Use ovl_iterator.
3866 (add_candidates): Use OVL_FIRST & lkp_iterator.
3867 (build_op_delete_call): Use MAYBE_BASELINK_FUNCTIONS &
3869 * class.c (deduce_noexcept_on_destructors): Use ovl_iterator.
3870 (type_has_user_nondefault_constructor,
3871 in_class_defaulted_default_constructor,
3872 type_has_user_provided_constructor,
3873 type_has_user_provided_or_explicit_constructor,
3874 type_has_non_user_provided_default_constructor,
3875 vbase_has_user_provided_move_assign,
3876 type_has_move_constructor, type_has_move_assign,
3877 type_has_user_declared_move_constructor,
3878 type_has_user_declared_move_assign,
3879 type_build_ctor_call, type_build_dtor_call,
3880 type_requires_array_cookie, explain_non_literal_class): Likewise.
3881 (finish_struct): Use lkp_iterator.
3882 (resolve_address_of_overloaded_function): Use OVL_NAME, lkp_iterator.
3883 (note_name_declared_in_class): Use OVL_NAME.
3884 * cxx-pretty-print.c (pp_cxx_unqualified_id): Use OVL_FIRST.
3885 (pp_cxx_qualified_id, cxx_pretty_printer::id_expression,
3886 cxx_pretty_printer::expression): Likewise.
3887 * decl2.c (check_classfn): Use ovl_iterator.
3888 * pt.c (retrieve_specialization): Use ovl_iterator.
3889 * tree.c (cp_tree_equal): Use lkp_iterator.
3890 (type_has_nontrivial_copy_init): Use ovl_iterator.
3892 * typeck2.c (cxx_incomplete_type_diagnostic): Revert change and
3893 check is_overloaded_fn.
3895 2017-05-16 Martin Liska <mliska@suse.cz>
3897 * parser.c (cp_lexer_print_token): Add default value for flags
3898 argument of print_gimple_stmt, print_gimple_expr,
3899 print_generic_stmt and print_generic_expr.
3901 2017-05-16 Nathan Sidwell <nathan@acm.org>
3903 * cp-tree.h (class ovl_iterator, class lkp_iterator): New OVERLOAD
3905 (MAYBE_BASELINK_FUNCTIONS): New.
3906 * constraint.cc (resolve_constraint_check): Use lkp_iterator.
3907 * decl2.c (maybe_warn_sized_delete): Use ovl_iterator.
3908 * lambda.c (maybe_generic_this_capture): Use lkp_iterator.
3909 * method.c (inherited_ctor_binfo): Use ovl_iterator.
3910 (binfo_inherited_from): Likewise.
3911 * parser.c (lookup_literal_operator): Use lkp_iterator.
3912 * pt.c (iterative_hash_template_arg): Use lkp_iterator.
3913 (print_candidates_1): Likewise.
3914 (determine_specialization): Likewise.
3915 (resolve_overloaded_unification): Likewise.
3916 (resolve_nondeduced_context): Likewise.
3917 (type_dependent_expression_p): Likewise.
3918 (dependent_template_p): Likewise.
3919 * ptree.c (cxx_print_xnode): Likewise.
3920 * semantics.c (omp_reduction_lookup): Use lkp_iterator.
3921 (classtype_has_nothrow_assign_or_copy_p): Use ovl_iterator.
3922 * typeck.c (check_template_keyword): Use lkp_iterator.
3924 * cp-tree.h (OVL_FIRST, OVL_NAME): New.
3926 * constexpr.c (function_concept_check): Use OVL_FIRST.
3927 * cvt.c (build_expr_type_conversion): Likewise.
3928 * decl.c (poplevel, grokdeclarator): Use OVL_NAME.
3929 * decl2.c (mark_used): Use OVL_FIRST.
3930 * error.c (dump_decl): Use OVL_FIRST, OVL_NAME.
3931 (dump_expr, location_of): Use OVL_FIRST.
3932 * friend.c (do_friend): Use OVL_NAME.
3933 * init.c (build_offset_ref): Use OVL_FIRST.
3934 * mangle.c (write_member_name): Likewise.
3935 (write_expression): Use OVL_NAME.
3936 * method.c (strip_inheriting_ctors): Use OVL_FIRST.
3937 * name-lookup.c (pushdecl_class_level): Use OVL_NAME.
3938 * pt.c (check_explicit_specialization): Use OVL_FIRST.
3939 (check_template_shadow): Likewise.
3940 (tsubst_template_args): Use OVL_NAME.
3941 (tsubst_baselink): Use OVL_FIRST.
3942 * semantics.c (perform_koenig_lookup): Use OVL_NAME.
3943 * tree.c (get_first_fn): Use OVL_FIRST.
3944 * typeck.c (finish_class_member_access_expr): Use OVL_NAME.
3945 (cp_build_addr_expr_1): Use OVL_FIRST.
3947 * pt.c (tsubst_copy_and_build): Remove unnecessary COMPONENT_REF
3949 * semantics.c (finish_id_expression): Directly init local var.
3950 (finish_omp_reduction_clause): Use really_overloaded_fn.
3951 * tree.c (get_fns): Document. Assert we got an overload.
3952 (get_first_fn) Document.
3953 * typeck.c (cp_build_addr_expr_1): Pass arg directly to
3954 really_overloaded_fn.
3955 * typeck2.c (cxx_incomplete_type_diagnostic): Use get_first_fn directly.
3957 * cp-tree.h (SCOPE_DEPTH): New.
3958 * name-lookup.h (is_nested_namespace): Declare.
3959 * name-lookup.c (is_nested_namespace): New.
3960 (is_ancestor): Use it.
3961 (set_decl_namespace): Likewise.
3962 (push_namespace): Set SCOPE_DEPTH.
3963 * pt.c (check_specialization_namespace): Use is_nested_namespace.
3964 (check_unqualigied_spec_or_inst): Likewise.
3966 2017-05-15 Nathan Sidwell <nathan@acm.org>
3969 * cp-tree.h (DECL_NAMESPACE_INLINE_P): New.
3970 * name-lookup.h (push_namespace): Return int, add make_inline arg.
3971 * name-lookup.c (push_namespace): Deal with inline directly.
3972 Return pushed count.
3973 * parser.c (cp_parser_namespace_definition): Adjust for
3974 push_namespace change.
3976 2017-05-11 Nathan Sidwell <nathan@acm.org>
3978 * cp-lang.c (get_global_decls, cxx_pushdecl, LANG_HOOK_GETDECLS,
3979 LANG_HOOKS_PUSHDECL): Move to ...
3980 * cp-objcp-common.c (cp_get_global_decls, cp_pushdec,
3981 LANG_HOOK_DECLS, LANG_HOOKS_PUSHDECL): ... here.
3982 * cp-objcp-common.h (cp_get_global_decls, cp_pushdecl): Declare.
3984 * name-lookup.h (pushdecl): Add default friend parm.
3985 (pushdecl_maybe_friend): Delete.
3986 (pushdecl_top_level): Add default friend parm.
3987 (pushdecl_top_level_maybe_friend): Delete.
3988 * name-lookup.c (pushdecl_maybe_friend): Delete.
3989 (pushdecl): Add is_friend parm.
3990 (pushdecl_top_level): Add is friend_parm.
3991 (pushdecl_top_level_maybe_friend, pushdecl_top_level_1): Delete.
3992 (pushdecl_top_level_and_finish): Do pushing and finishing directly.
3993 * friend.c (do_friend): Adjust.
3994 * pt.c (tsubst_friend_class): Adjust.
3996 Revert pushdecl_top_level_and_finish name change.
3997 * name-lookup.h (pushdecl_top_level_and_finish): Resurrect old name.
3998 * name-lookup.c (pushdecl_top_level_and_finish): Likewise.
3999 * decl.c (cp_make_fname_decl): Adjust.
4000 * decl2.c (get_guard, handle_tls_init): Adjust.
4001 * rtti.c (get_tinfo_decl, tinfo_base_init): Adjust.
4003 * name-lookup.c (pushdecl_outermost_localscope): Always
4004 conditionally stop timer.
4006 * decl.c (xref_tag_1): Don't frob ts_lambda scope here.
4007 * name-lookup.c (pushtag_1): Deal with ts_lambda scope.
4009 * cp-tree.h (pushdecl, pushdecl_maybe_friend, pushtag,
4010 pushtag_top_level_maybe_friend,
4011 pushdecl_top_level_and_finish): Move declarations to ...
4012 * name-lookup.h: ... here. Group pushdecl variants.
4013 (pushdecl_top_level_and_finish): Rename to ...
4014 (pushdecl_top_level_with_init): ... here.
4015 * decl.c (cp_make_fname_decl): Use pushdecl_top_level_with_init.
4016 * decl2.c (get_guard, handle_tls_init): Likewise.
4017 * rtti.c (get_tinfo_decl, tinfo_base_init): Likewise.
4018 * lambda.c (maybe_add_lambda_conv_op): Use namespace_bindings_p.
4019 * method.c (implicitly_declare_fn): Likewise.
4020 * searchc (node_debug_info_needed): Likewise.
4021 * name-lookup.c (pushdecl_top_level_and_finish): Rename to ...
4022 (pushdecl_top_level_with_init): ... here.
4023 (pop_everything): Use namespace_bindings_p.
4025 * name-lookup.h (pop_binding): Rename to pop_local_binding.
4026 (getdecls): Rename to get_local_decls.
4027 * name-lookup.c (pop_binding): Rename to ...
4028 (pop_local_binding): ... here.
4029 (pop_bindings_and_leave_scope): Adjust.
4030 (getdecls): Rename to ...
4031 (get_local_decls): ... here. Assert local scope.
4032 * decl.c (poplevel): Assert not namespace. Adjust and simplify
4034 (store_parm_decls): Adjust get_local_decls call.
4035 (parser.c (synthesize_implicit_template_parm): Likewise.
4037 2017-05-11 Ville Voutilainen <ville.voutilainen@gmail.com>
4040 * method.c (is_trivially_xible): Reject void types.
4042 2017-05-10 Nathan Sidwell <nathan@acm.org>
4044 * class.c (handle_using_decl): Always use OVL_CURRENT.
4045 (resolve_address_of_overloaded_function): Move iterator decl into
4046 for scope. Don't strip anticipated decls here.
4048 * pt.c (print_candidates_1): Separate TREE_LIST and OVERLOAD
4050 (print_candidates): Adjust.
4052 * cp-tree.h (build_new_function_call): Lose koenig_p arg. Fix
4054 * call.c (build_new_function_call): Lose koenig_p arg. Remove
4055 koenig_p handling here.
4056 * pt.c (push_template_decl_real): Unconditionally retrofit_lang_decl.
4057 (tsubst_omp_clauses): Likewise.
4058 (do_class_deduction): Adjust buld_new_function_call calls.
4059 * semantics.c (finish_call_expr): Likewise.
4061 2017-05-10 Jason Merrill <jason@redhat.com>
4063 * pt.c (unify_parameter_deduction_failure, unify_cv_qual_mismatch)
4064 (unify_type_mismatch, unify_parameter_pack_mismatch)
4065 (unify_ptrmem_cst_mismatch, unify_expression_unequal)
4066 (unify_parameter_pack_inconsistent, unify_inconsistency)
4067 (unify_vla_arg, unify_method_type_error, unify_arity)
4068 (unify_arg_conversion, unify_no_common_base)
4069 (unify_inconsistent_template_template_parameters)
4070 (unify_template_deduction_failure)
4071 (unify_template_argument_mismatch)
4072 (unify_overload_resolution_failure): Call unify_invalid.
4074 CWG 1847 - Clarifying compatibility during partial ordering
4075 * pt.c (more_specialized_fn): No order between two non-deducible
4078 * pt.c (dependent_type_p): Make sure we aren't called with
4081 PR c++/79549 - C++17 ICE with non-type auto template parameter pack
4082 * pt.c (convert_template_argument): Just return an argument pack.
4083 (coerce_template_parameter_pack, template_parm_to_arg)
4084 (extract_fnparm_pack, make_argument_pack, tsubst_template_args)
4085 (tsubst_decl, tsubst, type_unification_real, unify_pack_expansion):
4086 Don't set the type of a NONTYPE_ARGUMENT_PACK.
4087 * parser.c (make_char_string_pack, make_string_pack): Likewise.
4089 2017-05-10 Nathan Sidwell <nathan@acm.org>
4091 * cp-tree.h (add_method, clone_function_decl): Change last arg to
4093 * class.c (add_method): Change third arg to bool. Adjust.
4094 (one_inheriting_sig, one_inherited_ctor): Adjust.
4095 (clone_function_decl): Change 2nd arg to bool. Adjust.
4096 (clone_constructors_and_destructors): Adjust.
4097 * lambda.c (maybe_add_lambda_conv_op): Adjust.
4098 * method.c (lazily_declare_fn): Adjust.
4099 * pt.c (tsubst_decl, instantiate_template_1): Adjust.
4100 * semantics.c (finish_member_declaration): Adjust.
4102 2017-05-10 Paolo Carlini <paolo.carlini@oracle.com>
4105 * decl.c (finish_function): To improve error recovery, change the
4106 logic for calling apply_deduced_return_type.
4108 2017-05-09 Jason Merrill <jason@redhat.com>
4110 PR c++/80605 - __is_standard_layout and empty base
4111 * class.c (check_bases): Ignore empty bases.
4113 PR c++/70979 - literal class and closure types
4114 * class.c (finalize_literal_type_property): Handle closures
4116 (explain_non_literal_class): Likewise.
4118 PR c++/66297, DR 1684 - literal class and constexpr member fns
4119 * constexpr.c (is_valid_constexpr_fn): Only complain about
4120 non-literal enclosing class in C++11.
4121 * class.c (finalize_literal_type_property): Likewise.
4123 2017-05-09 Paolo Carlini <paolo.carlini@oracle.com>
4126 * pt.c (tsubst_decl): Early return error_mark_node if
4127 grok_ctor_properties returns false.
4129 2017-05-09 Jason Merrill <jason@redhat.com>
4131 PR c++/70167 - array prvalue treated as lvalue
4132 * cp-tree.h (CONSTRUCTOR_C99_COMPOUND_LITERAL): New.
4134 * semantics.c (finish_compound_literal): Add fcl_context parameter.
4135 Only make a static variable for C99 syntax.
4136 * parser.c (cp_parser_postfix_expression): Pass it.
4137 * pt.c (tsubst_copy_and_build): Likewise.
4138 * call.c (extend_ref_init_temps): Set
4139 DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P.
4141 2017-05-09 Nathan Sidwell <nathan@acm.org>
4143 * cp-lang.c (get_global_decls, cxx_pushdecl): New.
4144 (LANG_HOOKS_GETDECLS, LANG_HOOKS_PUSHDECL): Override.
4145 * name-lookup.h (pushdecl_top_level): Declare.
4147 2017-05-08 Jason Merrill <jason@redhat.com>
4149 PR c++/80178 - parameter passing for uncopyable classes
4150 * tree.c (type_has_nontrivial_copy_init): True for classes with only
4151 deleted copy/move ctors.
4152 (remember_deleted_copy, maybe_warn_parm_abi): New.
4153 * decl.c (require_complete_types_for_parms, check_function_type):
4154 Call maybe_warn_parm_abi.
4155 * call.c (convert_for_arg_passing, build_cxx_call): Likewise.
4157 2017-05-08 Nathan Sidwell <nathan@acm.org>
4159 * decl.c (builtin_function_1): Set DECL_ANTICIPATED before pushing.
4160 (start_preparsed_function): Do decl pushing before setting
4161 current_funciton_decl and announcing it.
4163 * name-lookup.h (pushdecl_with_scope): Replace with ...
4164 (pushdecl_outermost_localscope): ... this.
4165 * name-lookup.c (pushdecl_with_scope): Replace with ...
4166 (pushdecl_outermost_localscope): ... this.
4167 (pushdecl_namespace_level): Adjust.
4168 * decl.c (cp_make_fname_decl): Use pushdecl_outermost_localscope.
4169 * lambda.c (insert_capture_proxy): Likewise.
4171 * class.c (build_vtbl_initializer): Don't shadow outer variable
4174 Revert _binding -> _value change.
4175 * name-lookup.h (get_namespace_value, set_global_value): Rename to ...
4176 (get_namespace_binding, set_global_binding): ... these.
4177 * name-lookup.c (get_namespace_value, set_global_value): Rename to ...
4178 (get_namespace_binding, set_global_binding): ... these.
4179 (arg_assoc_namespace, pushdecl_maybe_friend_1,
4180 check_for_out_of_scope_variable, push_overloaded_decl_1,
4181 lookup_name_innermost_nonclass_level, push_namespace): Adjust.
4182 * cp-tree.h (IDENTIFIER_GLOBAL_VALUE,
4183 SET_IDENTIFIER_GLOBAL_VALUE): Adjust.
4184 * decl.c (poplevel): Adjust.
4185 * pt.c (make_constrained_auto): Likewise.
4187 2017-05-07 Volker Reichelt <v.reichelt@netcologne.de>
4189 PR translation/80280
4190 * call.c (print_z_candidate): Fix quoting.
4192 2017-05-05 David Malcolm <dmalcolm@redhat.com>
4194 * error.c (pedwarn_cxx98): Replace report_diagnostic
4195 with diagnostic_report_diagnostic.
4197 2017-05-05 Nathan Sidwell <nathan@acm.org>
4199 * cp-tree.h (IDENTIFIER_GLOBAL_VALUE): Use get_namespace_value.
4200 (SET_IDENTIFIER_GLOBAL_VALUE): Use set_global_value.
4201 (IDENTIFIER_NAMESPACE_VALUE): Delete.
4202 * name-lookup.h (namespace_binding, set_namespace_binding): Replace
4204 (get_namespace_value, set_global_value): ... these.
4205 (get_global_value_if_present, is_typename_at_global_scope): Delete.
4206 * decl.c (poplevel): Use get_namespace_value.
4207 (grokdeclarator): Use IDENTIFIER_GLOBAL_VALUE.
4208 * class.c (build_vtbl_initializer): Stash library decl in
4209 static var. Use IDENTIFIER_GLOBAL_VALUE.
4210 * except.c (do_get_exception_ptr, do_begin_catch, do_end_catch,
4211 do_allocate_exception, do_free_exception, build_throw): Likewise.
4212 * init.c (throw_bad_array_new_length): Likewise.
4213 * rtti.c (throw_bad_cast, throw_bad_typeid): Likewise.
4214 * name-lookup.c (arg_assoc_namespace, pushdecl_maybe_friend_1,
4215 check_for_our_of_scope_variable, push_overloaded_decl_1): Use
4216 get_namespace_value.
4217 (set_namespace_binding_1): Rename to
4218 (set_namespace_binding): ... here.
4219 (set_global_value): New.
4220 (lookup_name_innermost_nonclass_level_1, push_namespace): Use
4221 get_namespace_value.
4222 * pt.c (listify): Use get_namespace_value.
4224 * call.c (make_temporary_var_for_ref_to_temp): Push decl into
4226 * lex.c (unqualified_name_lookup_error): Likewise.
4228 * class.c (alter_class): Use retrofit_lang_decl directly.
4229 * decl.c (push_local_name, dupliate_decls): Likewise.
4230 * semantics.c (omp_privatize_field): Likewise.
4232 Kill walk_namespaces.
4233 * cp-tree.h (walk_namespaces_fn, walk_namespaces): Delete.
4234 * decl.c (walk_namespaces_r, walk_namespaces): Delete.
4236 Kill per-namespace static_decls.
4237 * cp-tree.h (static_decls): Declare.
4238 (wrapup_globals_for_namespace,
4239 diagnose_inline_vars_for_namespace): Replace with ...
4240 (wrapup_namespace_globals): ... this.
4241 * decl.c (static_decls): Define.
4242 (wrapup_globals_for_namespace,
4243 diagnose_inline_vars_for_namespace): Replace with ...
4244 (wrapup_namespace_globals): ... this.
4245 (cxx_init_decl_processing): Initialize static_decls.
4246 * decl2.c (c_parse_final_cleanups): Adjust.
4247 * name-lookup.h (cp_binding_level): Remove static_decls member.
4248 * name-lookup.c (add_decl_to_level): Adjust.
4249 (begin_scope): Adjust.
4251 2017-05-05 Paolo Carlini <paolo.carlini@oracle.com>
4254 * decl.c (reshape_init): Unconditionally return error_mark_node
4255 upon error about too many initializers.
4257 2017-05-04 Nathan Sidwell <nathan@acm.org>
4259 * constraint.cc (diagnose_check_constraint): Fix %E thinko.
4261 2017-05-04 Martin Sebor <msebor@redhat.com>
4263 PR translation/80280
4264 * call.c (print_z_candidate): Add missing quoting to %D and other
4266 (build_op_call_1): Same.
4267 * constraint.cc (diagnose_check_constraint): Same.
4268 * mangle.c (mangle_decl): Same.
4269 * name-lookup.c (cp_binding_level_debug): Same.
4270 (set_decl_namespace): Same.
4271 * parser.c (cp_parser_tx_qualifier_opt): Same.
4272 * pt.c (print_candidates_1): Same.
4273 (check_template_variable): Same.
4274 (tsubst_default_argument): Same.
4275 (most_specialized_partial_spec): Same.
4276 * semantics.c (omp_reduction_lookup): Same.
4277 * tree.c (check_abi_tag_redeclaration): Same.
4278 * typeck.c (comptypes): Same.
4279 * typeck2.c (abstract_virtuals_error_sfinae): Same.
4281 2017-05-04 Nathan Sidwell <nathan@acm.org>
4284 * cp-tree.h (enum cp_tree_index): Add CPTI_GLOBAL,
4285 CPTI_GLOBAL_TYPE, CPTI_GLOBAL_IDENTIFIER, CPTI_ANON_IDENTIFIER,
4286 CPTI_INIT_LIST_IDENTIFIER.
4287 (global_namespace, global_type_node, global_identifier,
4288 anon_identifier, init_list_identifier): New.
4289 * decl.c (global_type_node, global_scope_name): Delete.
4290 (initialize_predefined_identifiers): Add new identifiers.
4291 (cxx_init_decl_processing): Adjust.
4292 * name-lookup.h (global_namespace, global_type_node): Delete.
4293 * name-lookup.c (global_namespace, anonymous_namespace_name,
4294 get_anonymous_namespace_name): Delete.
4295 (namespace_scope_ht_size, begin_scope, pushtag_1,
4296 push_namespace): Adjust,
4297 * call.c (type_has_extended_temps): Use init_list_identifier.
4298 * pt.c (listify): Likewise.
4300 * name-lookup.c: Reorder functions to make merging from modules
4303 2017-05-03 Jason Merrill <jason@redhat.com>
4305 * constexpr.c (cxx_eval_outermost_constant_expr): Use TV_CONSTEXPR.
4307 2017-05-03 Nathan Sidwell <nathan@acm.org>
4309 * cp-tree.h (enum cp_tree_index, cp_global_trees): Move earlier,
4310 along with #defines, to before name-lookup include.
4312 2017-05-02 Paolo Carlini <paolo.carlini@oracle.com>
4314 * pt.c (is_auto_or_concept): Remove.
4315 (type_uses_auto_or_concept): Remove, unused.
4316 (find_parameter_packs_r, extract_autos_r, is_auto_r): Adjust.
4317 * parser.c (tree_type_is_auto_or_concept): Remove, unused.
4318 * cp-tree.h (is_auto_or_concept): Remove.
4320 2017-05-01 Xi Ruoyao <ryxi@stu.xidian.edu.cn>
4323 * cp-cilkplus.c (cilk_install_body_with_frame_cleanup): Don't
4324 add pedigree operation and detach call here.
4325 * cp-gimplify.c (cp_gimplify_expr): Remove the calls to
4326 cilk_cp_gimplify_call_params_in_spawned_fn.
4327 (cilk_cp_gimplify_call_params_in_spawned_fn): Remove function.
4328 * semantics.c (simplify_aggr_init_expr): Copy EXPR_CILK_SPAWN.
4330 2017-04-29 Volker Reichelt <v.reichelt@netcologne.de>
4332 * parser.c (cp_parser_member_declaration): Add fix-it hints for
4333 stray comma and missing semicolon at end of member declaration.
4335 2017-04-27 Volker Reichelt <v.reichelt@netcologne.de>
4337 * parser.c (cp_parser_cast_expression): Add target type of cast to
4339 * error.c (type_to_string): Add '{enum}' suffix to enumeration types.
4341 2017-04-26 Paolo Carlini <paolo.carlini@oracle.com>
4343 * decl.c (grok_ctor_properties, ambi_op_p, unary_op_p): Change
4344 return type to bool.
4345 * cp-tree.h (grok_ctor_properties): Update.
4347 2017-04-26 Volker Reichelt <v.reichelt@netcologne.de>
4349 * parser.c (cp_parser_nested_name_specifier_opt): Add fix-it
4350 information to diagnostic of invalid colon in nested-name-specifier.
4352 2017-04-25 Volker Reichelt <v.reichelt@netcologne.de>
4354 * parser.c (cp_parser_elaborated_type_specifier): Add fix-it to
4355 diagnostic of invalid class/struct keyword after enum.
4357 2017-04-25 David Malcolm <dmalcolm@redhat.com>
4359 * parser.c (cp_parser_member_declaration): Add fix-it hint
4360 for removing stray semicolons.
4362 2017-04-25 David Malcolm <dmalcolm@redhat.com>
4364 * name-lookup.c (get_std_name_hint): New function.
4365 (maybe_suggest_missing_header): New function.
4366 (suggest_alternative_in_explicit_scope): Call
4367 maybe_suggest_missing_header.
4369 2017-04-25 David Malcolm <dmalcolm@redhat.com>
4372 * name-lookup.c (suggest_alternative_in_explicit_scope): Convert
4373 candidate type of bm from tree to const char *.
4374 (consider_binding_level): Likewise.
4375 (lookup_name_fuzzy): Likewise, using this to merge the best
4376 result from the preprocessor into bm, rather than immediately
4377 returning, so that better matches from reserved words can "win".
4378 Guard the rejection of keywords that don't start decl-specifiers
4379 so it only happens for FUZZY_LOOKUP_TYPENAME.
4381 2017-04-24 Volker Reichelt <v.reichelt@netcologne.de>
4383 * decl.c (grokdeclarator): Use %qT instead of %<%T%> in diagnostics.
4384 (start_enum): Likewise.
4385 (build_enumerator): Likewise. Use %qE instead of plain %E.
4386 * parser.c (cp_parser_mem_initializer_list): Use %qD instead of
4387 %<%D%> in diagnostics.
4388 (cp_parser_elaborated_type_specifier): Likewise.
4389 * pt.c (make_pack_expansion): Use %qT and %qE instead of
4390 %<%T%> and %<%E%> in diagnostics.
4391 (tsubst_pack_expansion): Likewise.
4393 2017-04-24 David Malcolm <dmalcolm@redhat.com>
4396 * parser.c (cp_parser_unary_expression): Generate a location
4397 range for alignof and sizeof expressions.
4399 2017-04-24 Volker Reichelt <v.reichelt@netcologne.de>
4401 * parser.c (cp_parser_cv_qualifier_seq_opt): Add fix-it info to
4403 (cp_parser_virt_specifier_seq_opt): Likewise.
4404 (set_and_check_decl_spec_loc): Likewise twice.
4406 2017-04-21 Jason Merrill <jason@redhat.com>
4408 PR c++/80179 - ICE with initialized flexible array member.
4409 * constexpr.c (verify_ctor_sanity): Handle flexible array members.
4411 2017-04-21 Richard Biener <rguenther@suse.de>
4413 * cp-tree.h (copy_decl): Annotate with CXX_MEM_STAT_INFO.
4414 (copy_type): Likewise.
4415 * lex.c (copy_decl): Pass down mem-stat info.
4416 (copy_type): Likewise.
4418 2017-04-20 Jonathan Wakely <jwakely@redhat.com>
4421 * init.c (build_new_1): Suppress notes about over-aligned new when
4422 the warning is suppressed.
4424 2017-04-20 Volker Reichelt <v.reichelt@netcologne.de>
4426 * parser.c (cp_parser_member_declaration): Add warning with fixit
4427 information for extra semicolon after in-class function definition.
4429 2017-04-20 Jakub Jelinek <jakub@redhat.com>
4432 * tree.c (build_cplus_array_type): Call build_array_type
4433 with the intended TYPE_TYPELESS_STORAGE flag value, instead
4434 of calling build_array_type and modifying later TYPE_TYPELESS_STORAGE
4437 2017-04-18 Marek Polacek <polacek@redhat.com>
4439 PR c++/80244 - ICE with attribute in template alias.
4440 * tree.c (strip_typedefs): Handle UNDERLYING_TYPE.
4442 PR c++/80241 - ICE with alignas pack expansion.
4443 * error.c (dump_expr): Handle TREE_LIST.
4444 * parser.c (cp_parser_std_attribute_list): Return error_mark if
4445 make_pack_expansion returns an error.
4447 2017-04-17 Bernd Edlinger <bernd.edlinger@hotmail.de>
4450 * class.c (fixup_may_alias): Fix all type variants.
4452 2017-04-17 Jason Merrill <jason@redhat.com>
4454 PR c++/80415 - wrong error with default arg and array reference.
4455 * tree.c (lvalue_kind): Return clk_class for an array prvalue.
4457 * pt.c (tsubst_init): Set TARGET_EXPR_DIRECT_INIT_P.
4459 2017-04-15 Alexandre Oliva <aoliva@redhat.com>
4461 * decl.c (name_unnamed_type): Split out of...
4462 (grokdeclarator): ... this.
4463 * decl.h (name_unnamed_type): Declare.
4465 2017-04-12 Richard Biener <rguenther@suse.de>
4466 Bernd Edlinger <bernd.edlinger@hotmail.de>
4469 * tree.c (build_cplus_array_type): Set TYPE_TYPELESS_STORAGE
4470 for arrays of character or std::byte type.
4472 2017-04-11 Jason Merrill <jason@redhat.com>
4474 PR c++/80294 - ICE with constexpr and inheritance.
4475 * constexpr.c (reduced_constant_expression_p):
4476 A null constructor element is non-constant.
4477 (cxx_eval_indirect_ref): Don't VERIFY_CONSTANT before
4478 returning an empty base.
4480 2017-04-11 Jakub Jelinek <jakub@redhat.com>
4483 * decl.c (cp_finish_decomp): If processing_template_decl on
4484 non-dependent decl, only set TREE_TYPE on the v[i] decls, but don't
4485 change their DECL_VALUE_EXPR nor cp_finish_decl them. Instead make
4486 sure DECL_VALUE_EXPR is the canonical NULL type ARRAY_REF for tsubst
4488 * pt.c (value_dependent_expression_p) <case VAR_DECL>: For variables
4489 with DECL_VALUE_EXPR, return true if DECL_VALUE_EXPR is type
4492 2017-04-11 Jakub Jelinek <jakub@redhat.com>
4495 * error.c (dump_expr): Handle VEC_COND_EXPR like COND_EXPR.
4497 2017-04-10 Jakub Jelinek <jakub@redhat.com>
4500 * tree.c (lvalue_kind): For COMPONENT_REF with BASELINK second
4501 operand, if it is a static member function, recurse on the
4504 2017-04-10 Marek Polacek <polacek@redhat.com>
4507 * typeck.c (cp_build_binary_op): Use NULL_TREE instead of NULL. Set
4508 ORIG_TYPE earlier and not only when shortening.
4510 2017-04-07 Jason Merrill <jason@redhat.com>
4512 PR c++/80356 - ICE with reference to function template argument.
4514 * pt.c (convert_nontype_argument_function): Adjust type even with a
4515 value-dependent argument.
4517 PR c++/80267 - ICE with nested capture of reference
4519 * pt.c (tsubst_copy): Handle lookup finding a capture proxy.
4521 2017-04-07 Marek Polacek <polacek@redhat.com>
4524 * typeck.c (cp_build_binary_op): Convert COP[01] to ORIG_TYPE.
4527 * call.c (build_over_call): Don't check cxx_dialect.
4528 * cp-gimplify.c (cp_gimplify_init_expr): Don't check cxx_dialect nor
4529 whether SUB is a CONSTRUCTOR.
4530 * init.c (build_new_1): Don't check cxx_dialect.
4531 * tree.c (replace_placeholders): Add a function comment. Return if
4532 not in C++14, or if the object isn't a (member of a) class.
4533 * typeck2.c (store_init_value): Don't check cxx_dialect nor whether
4534 TYPE is CLASS_TYPE_P.
4536 2017-04-05 Jakub Jelinek <jakub@redhat.com>
4539 * pt.c (canonical_type_parameter): Use vec_safe_grow_cleared instead
4540 of a loop doing vec_safe_push of NULL. Formatting fixes.
4541 (rewrite_template_parm): Copy TEMPLATE_PARM_PARAMETER_PACK from oldidx
4542 to newidx before calling canonical_type_parameter on newtype.
4544 2017-04-04 Volker Reichelt <v.reichelt@netcologne.de>
4547 * cxx-pretty-print.c (cxx_pretty_printer::expression): Add
4548 UNARY_PLUS_EXPR case.
4550 2017-04-03 Jason Merrill <jason@redhat.com>
4552 * semantics.c (finish_template_type): Check CLASSTYPE_TEMPLATE_INFO.
4554 2017-04-03 Jonathan Wakely <jwakely@redhat.com>
4556 * class.c (update_vtable_entry_for_fn): Fix typo in comment.
4557 * decl2.c (one_static_initialization_or_destruction): Likewise.
4558 * name-lookup.c (store_bindings): Likewise.
4559 * parser.c (make_call_declarator): Likewise.
4560 * pt.c (check_explicit_specialization): Likewise.
4562 2017-04-03 Jason Merrill <jason@redhat.com>
4564 PR sanitizer/79993 - ICE with VLA initialization from string
4565 PR c++/69487 - wrong VLA initialization from string
4566 * init.c (finish_length_check): Split out from build_vec_init.
4567 (build_vec_init): Handle STRING_CST.
4568 * typeck2.c (split_nonconstant_init): Handle STRING_CST.
4569 (digest_init_r): Don't give a STRING_CST VLA type.
4571 2017-03-31 Jakub Jelinek <jakub@redhat.com>
4574 * cp-gimplify.c (cp_genericize_r): Sanitize INTEGER_CSTs with
4575 REFERENCE_TYPE. Adjust ubsan_maybe_instrument_reference caller
4576 for NOP_EXPR to REFERENCE_TYPE.
4579 * cp-tree.h (enum cp_trait_kind): Add CPTK_IS_AGGREGATE.
4580 * cxx-pretty-print.c (pp_cxx_trait_expression): Handle
4582 * semantics.c (trait_expr_value): Handle CPTK_IS_AGGREGATE.
4583 Remove extraneous parens.
4584 (finish_trait_expr): Handle CPTK_IS_AGGREGATE.
4585 * parser.c (cp_parser_primary_expression): Handle RID_IS_AGGREGATE.
4586 (cp_parser_trait_expr): Likewise.
4588 2017-03-27 Jakub Jelinek <jakub@redhat.com>
4591 * cp-tree.h (cxx_mark_addressable): Add array_ref_p argument.
4592 * typeck.c (cxx_mark_addressable): Likewise. Look through
4593 VIEW_CONVERT_EXPR unless array_ref_p and VCE is from VECTOR_TYPE
4595 (cp_build_array_ref): Pass true as array_ref_p to cxx_mark_addressable.
4597 2017-03-24 Jason Merrill <jason@redhat.com>
4599 PR c++/77339 - ICE with invalid use of alias template.
4600 * pt.c (lookup_template_class_1): Don't try to enter the scope of an
4603 2017-03-24 Marek Polacek <polacek@redhat.com>
4606 * cp-gimplify.c (cp_fold): Strip CLEANUP_POINT_EXPR if the expression
4607 doesn't have side effects.
4609 2017-03-23 Jason Merrill <jason@redhat.com>
4611 PR c++/80150 - ICE with overloaded variadic deduction.
4612 * pt.c (try_one_overload): Remove asserts.
4614 PR c++/77563 - missing ambiguous conversion error.
4615 * call.c (convert_like_real): Use LOOKUP_IMPLICIT.
4617 2017-03-23 Marek Polacek <polacek@redhat.com>
4619 * cp-tree.h: Remove a C_RID_YYCODE reference.
4621 2017-03-22 Jakub Jelinek <jakub@redhat.com>
4624 * semantics.c (finish_omp_clause) <case OMP_CLAUSE_SIMDLEN,
4625 case OMP_CLAUSE_ALIGNED>: Call maybe_constant_value only when not
4626 processing_template_decl.
4628 2017-03-21 Paolo Carlini <paolo.carlini@oracle.com>
4631 * name-lookup.c (pushtag_1): Add check for bogus, non template,
4632 std::initializer_list.
4634 2017-03-21 Jakub Jelinek <jakub@redhat.com>
4637 * init.c (std_placement_new_fn_p, build_new_1): Formatting fixes.
4639 2017-03-21 Ville Voutilainen <ville.voutilainen@gmail.com>
4642 * init.c (std_placement_new_fn_p): New.
4643 (build_new_1): Call it.
4645 2017-03-20 Jason Merrill <jason@redhat.com>
4647 PR c++/80096 - ICE with C++17 non-type auto.
4648 * pt.c (tsubst): Delay tsubst of type of template non-type
4651 PR c++/79519 - ICE with deleted template friend.
4652 * decl.c (grokdeclarator): Complain about misplaced function
4653 definition using =, as well.
4655 PR c++/79640 - infinite recursion with generic lambda.
4656 * pt.c (tsubst_copy) [VAR_DECL]: Register the dummy instantiation
4657 before substituting its initializer.
4659 2017-03-20 Marek Polacek <polacek@redhat.com>
4660 Paolo Carlini <paolo.carlini@oracle.com>
4662 PR c++/80059 - ICE with noexcept and __transaction_atomic
4663 * except.c (build_must_not_throw_expr): Call
4664 instantiate_non_dependent_expr.
4666 2017-03-19 Jason Merrill <jason@redhat.com>
4668 PR c++/80084 - wrong C++17 decomposition by reference of parameter.
4669 * decl.c (cp_finish_decomp): Don't pull out the DECL_INITIAL of a
4670 reference decomposition.
4672 PR c++/80077 - error with constexpr and -fno-elide-constructors.
4673 * constexpr.c (cxx_eval_call_expression): Set ctx->call while
4674 expanding trivial constructor.
4676 2017-03-17 Jason Merrill <jason@redhat.com>
4678 PR c++/78345 - ICE initializing array from lambda.
4679 * init.c (build_aggr_init): Check array initializer.
4680 (build_vec_init): Check the type of a CONSTRUCTOR.
4682 PR c++/80073 - C++17 ICE with virtual base.
4683 * decl.c (xref_basetypes): Also check for indirect vbases.
4685 2017-03-16 Jason Merrill <jason@redhat.com>
4687 * decl.c (start_enum): std::byte aliases anything.
4690 * constexpr.c (lookup_placeholder): Tweak.
4692 2017-03-15 Jason Merrill <jason@redhat.com>
4694 PR c++/80043 - ICE with -fpermissive
4695 * typeck.c (convert_for_assignment): Handle instantiate_type
4696 not giving an error.
4698 2017-03-14 Nathan Sidwell <nathan@acm.org>
4700 PR c++/79393 DR 1658 workaround
4701 * method.c (synthesized_method_base_walk): Inihibit abstract class
4702 virtual base access check here.
4703 (synthesized_method_walk): Not here.
4705 2017-03-13 Nathan Sidwell <nathan@acm.org>
4707 PR c++/79393 DR 1658 workaround
4708 * method.c (synthesized_method_walk): Check vbases of abstract
4709 classes for dtor walk.
4711 2017-03-10 David Malcolm <dmalcolm@redhat.com>
4713 PR translation/79848
4714 * decl.c (grokfndecl): Simplify uses of "%<%s%>" to "%qs".
4716 2017-03-10 Jason Merrill <jason@redhat.com>
4718 PR c++/79960 - alias templates and partial ordering
4719 * pt.c (comp_template_args): Add partial_order parm.
4720 (template_args_equal): Likewise.
4721 (comp_template_args_porder): New.
4722 (get_partial_spec_bindings): Use it.
4724 2017-03-10 Marek Polacek <polacek@redhat.com>
4727 * decl.c (grokdeclarator): Check ATTRLIST before dereferencing it.
4729 2017-03-10 Jakub Jelinek <jakub@redhat.com>
4732 * optimize.c (maybe_thunk_body): Don't ICE if fns[0] is NULL.
4733 Use XALLOCAVEC macro.
4736 * decl.c (finish_enum_value_list): If value is error_mark_node,
4737 don't copy it and change its type.
4738 * init.c (constant_value_1): Return error_mark_node if DECL_INITIAL
4739 of CONST_DECL is error_mark_node.
4741 2017-03-09 Marek Polacek <polacek@redhat.com>
4743 PR c++/79900 - ICE in strip_typedefs
4744 * tree.c (strip_typedefs): Skip the attribute handling if T is
4745 a variant type which hasn't been updated yet.
4747 PR c++/79687 - wrong code with pointer-to-member
4748 * init.c (constant_value_1): Break if the variable has a dynamic
4751 2017-03-08 Jason Merrill <jason@redhat.com>
4753 PR c++/79797 - ICE with self-reference in array DMI.
4754 * constexpr.c (lookup_placeholder): Split out...
4755 (cxx_eval_constant_expression): ...from here.
4757 2017-03-07 Jakub Jelinek <jakub@redhat.com>
4760 * parser.c (cp_parser_omp_cancellation_point,
4761 cp_parser_omp_target_enter_data, cp_parser_omp_target_exit_data,
4762 cp_parser_omp_target_update): Change "may only be used in compound
4763 statements" diagnostics, such that the same translatable string is
4764 used for all pragmas.
4765 (cp_parser_pragma): Likewise. Use error_at instead of
4766 cp_parser_error for that diagnostics.
4768 2017-03-06 Marek Polacek <polacek@redhat.com>
4770 PR c++/79796 - ICE with NSDMI and this pointer
4771 * call.c (build_over_call): Handle NSDMI with a 'this' by calling
4772 replace_placeholders.
4774 2017-03-06 Jakub Jelinek <jakub@redhat.com>
4777 * constexpr.c (cxx_eval_statement_list): Treat empty ({ }) like
4780 2017-03-06 Jason Merrill <jason@redhat.com>
4782 Revert "Allow deduction guides to look into primary template."
4783 * cp-tree.h, parser.c, pt.c, search.c: Revert.
4785 2017-03-05 Paolo Carlini <paolo.carlini@oracle.com>
4788 * except.c (build_must_not_throw_expr): Perform the implicit
4789 conversions on the condition.
4791 2017-03-03 Jason Merrill <jason@redhat.com>
4793 * mangle.c (mangle_decl): Check -Wnoexcept-type instead of
4796 Core issues 2273 and 2277
4797 * call.c (joust): Adjust using-declaration tiebreaker to handle
4798 the intermediate base case.
4799 * method.c (strip_inheriting_ctors): Just return the argument if
4800 !flag_new_inheriting_ctors.
4802 2017-03-03 Richard Biener <rguenther@suse.de>
4805 * cp-gimplify.c (simple_empty_class_p): Handle EMPTY_CLASS_EXPR.
4807 2017-03-03 Marek Polacek <polacek@redhat.com>
4810 * typeck.c (string_conv_p): In C++11, always call pedwarn with
4813 2017-03-02 Jason Merrill <jason@redhat.com>
4815 Update overload resolution with deduction guides.
4816 * pt.c (do_class_deduction): Always build the copy guide.
4817 (copy_guide_p, template_guide_p): New.
4818 (build_deduction_guide): Remember the original constructor.
4819 * call.c (joust): Prefer the copy guide and non-template guides.
4821 Allow deduction guides to look into primary template.
4822 * cp-tree.h (struct saved_scope): Add deduction_guide_type.
4823 (struct cp_decl_specifier_seq): Add constructor_p.
4824 * parser.c (cp_parser_decl_specifier_seq): Set constructor_p.
4825 (cp_parser_init_declarator): Check it. Set ctor_dtor_or_conv_p.
4826 Clear deduction_guide_type. Don't handle deduction guide names.
4827 (cp_parser_declarator): Don't clear ctor_dtor_or_conv_p.
4828 (cp_parser_direct_declarator): Likewise. Handle deduction guides.
4829 (cp_parser_member_declaration, cp_parser_cache_defarg)
4830 (cp_parser_objc_class_ivars): Set ctor_dtor_or_conv_p.
4831 * pt.c (tsubst_copy, tsubst_copy_and_build): Revert last change.
4832 (build_deduction_guide): Set deduction_guide_type.
4833 (dependent_scope_p): Check deduction_guide_type.
4834 * search.c (lookup_member): Likewise.
4836 2017-03-02 Jakub Jelinek <jakub@redhat.com>
4839 * init.c (mark_exp_read_r): New function.
4840 (emit_mem_initializers): Use cp_walk_tree with mark_exp_read_r on
4841 whole arguments instead of plain mark_exp_read on TREE_LIST values.
4843 2017-03-01 Jason Merrill <jason@redhat.com>
4845 Class template argument deduction in new-expression
4846 * init.c (build_new): Handle deduction from no initializer.
4847 * parser.c (cp_parser_new_expression): Don't require a single
4848 expression for class template deduction.
4849 * typeck2.c (cxx_incomplete_type_diagnostic): Fix diagnostic for
4850 class template placeholder.
4851 * pt.c (tsubst_copy) [TEMPLATE_DECL]: Handle dependent context.
4852 (tsubst_copy_and_build) [TEMPLATE_ID_EXPR]: Handle SCOPE_REF.
4853 (redeclare_class_template): Set TEMPLATE_TYPE_PARM_FOR_CLASS.
4855 2017-03-01 Jakub Jelinek <jakub@redhat.com>
4858 * init.c (emit_mem_initializers): When not constructing vbases of
4859 abstract classes, mark arguments as read for
4860 -Wunused-but-set-parameter.
4862 2017-02-28 Jason Merrill <jason@redhat.com>
4864 Class template argument deduction refinements
4865 * call.c (joust): Move deduction guide tiebreaker down.
4866 * decl.c (start_decl_1, cp_finish_decl, grokdeclarator): Allow class
4867 deduction with no initializer.
4868 * pt.c (build_deduction_guide): Handle implicit default/copy ctor.
4869 (do_class_deduction): Use that rather than special case.
4870 (do_auto_deduction): Handle null initializer.
4872 2017-02-28 Jakub Jelinek <jakub@redhat.com>
4874 * decl.c (find_decomp_class_base): Use cond ? G_("...") : G_("...")
4875 instead of just cond ? "..." : "...".
4876 (grokdeclarator): Likewise.
4877 (build_enumerator): Likewise.
4878 * init.c (build_new_1): Likewise.
4879 * call.c (build_new_method_call_1): Likewise.
4880 * parser.c: Include intl.h.
4881 (cp_parser_oacc_enter_exit_data): Use %s and ternary operator only for
4882 "enter"/"exit" keyword.
4883 (cp_finalize_oacc_routine): Don't use %s to supply portions of the
4886 2017-02-27 Jason Merrill <jason@redhat.com>
4888 PR c++/71568 - SFINAE forming pointer to member function
4889 * init.c (build_offset_ref): Check the return value of
4890 perform_or_defer_access_check.
4892 2017-02-27 Marek Polacek <polacek@redhat.com>
4894 * decl.c (expand_static_init): Add missing } in a comment.
4896 2017-02-27 Volker Reichelt <v.reichelt@netcologne.de>
4898 * init.c: Include intl.h.
4899 (build_new_1): Move message strings into pedwarn to make them
4900 -Wformat-security friendly. Mark string for translation.
4901 * pt.c (tsubst_copy_and_build): Mark string for translation.
4902 Make the pointer const.
4903 * semantics.c (finish_id_expression): Mark strings for translation.
4905 2017-02-25 Jakub Jelinek <jakub@redhat.com>
4907 * call.c (build_op_delete_call): Make msg1 and msg2 const.
4909 2017-02-24 Jakub Jelinek <jakub@redhat.com>
4912 * call.c (build_over_call): Call check_function_arguments even for
4913 -Wrestrict, adjust check_function_arguments caller.
4914 * parser.c (cp_parser_postfix_expression): Don't handle -Wrestrict
4916 * typeck.c (cp_build_function_call_vec): Adjust
4917 check_function_arguments caller.
4919 2017-02-24 Marek Polacek <polacek@redhat.com>
4921 PR translation/79705
4922 * decl.c (check_redeclaration_exception_specification): Mark a string
4923 for translation. Make the pointer const.
4925 2017-02-23 Paolo Carlini <paolo.carlini@oracle.com>
4928 * pt.c (register_specialization): Check duplicate_decls return value
4929 for error_mark_node and pass it back.
4931 2017-02-22 Jason Merrill <jason@redhat.com>
4933 PR c++/79679 - missing destructor for argument
4934 * call.c (build_over_call): Don't pass tf_no_cleanup to argument
4937 * pt.c (do_class_deduction): Handle 0 argument case.
4939 2017-02-22 Jakub Jelinek <jakub@redhat.com>
4942 * parser.c (cp_parser_omp_teams, cp_parser_omp_target): Use
4943 SET_EXPR_LOCATION on OMP_TARGET/OMP_TEAMS tree.
4944 * constexpr.c (potential_constant_expression_1): Handle
4945 OMP_*, OACC_* and CILK_* trees. Use error_at with
4946 EXPR_LOC_OR_LOC (t, input_location) computed early
4947 instead of error, or error_at with location_of (t).
4949 2017-02-22 Marek Polacek <polacek@redhat.com>
4952 * parser.c (cp_parser_std_attribute_spec): Don't build the attribute
4953 if the alignas expression is erroneous.
4954 * pt.c (tsubst_attribute): If tsubst_pack_expansion fails, return
4958 * semantics.c (finish_underlying_type): Bail out for incomplete enums.
4960 2017-02-21 Jason Merrill <jason@redhat.com>
4962 PR c++/50308 - wrong deprecated warning with ADL
4963 PR c++/17729 - duplicate deprecated warning
4964 * semantics.c (finish_id_expression): Only call mark_used on a
4965 function if we aren't building a call.
4967 PR c++/41727 - ICE with partial spec of partial instantiation
4968 * pt.c (process_partial_specialization): For now, don't check more
4969 specialized if there is more than one level of args.
4971 2017-02-21 Marek Polacek <polacek@redhat.com>
4974 * cp-tree.h (maybe_reject_flexarray_init): Declare.
4975 * init.c (maybe_reject_flexarray_init): No longer static.
4976 Add check for current_function_decl.
4977 * parser.c (cp_parser_late_parse_one_default_arg): Reject
4978 a default mem-initializer for a flexible array.
4980 2017-02-21 Jakub Jelinek <jakub@redhat.com>
4981 Paolo Carlini <paolo.carlini@oracle.com>
4984 * decl.c (cp_finish_decomp): Don't set decl's type to error_mark_node
4986 * pt.c (tsubst_decomp_names): Return error_mark_node if the first
4987 decl after the decomposition artificial decl has error_mark_node.
4988 * decl2.c (prune_vars_needing_no_initialization): Use error_operand_p
4989 instead of just == error_mark_node comparison.
4991 2017-02-21 Jakub Jelinek <jakub@redhat.com>
4994 * decl.c: Include gimplify.h.
4995 (cp_finish_decomp): Make sure there is no sharing of trees
4996 in between DECL_VALUE_EXPR of decomposition decls.
4999 * constexpr.c (cxx_eval_array_reference): Diagnose negative subscript.
5002 * constexpr.c (cxx_eval_store_expression): If *valp is a PTRMEM_CST,
5003 call cplus_expand_constant on it first.
5005 2017-02-19 Jason Merrill <jason@redhat.com>
5007 PR c++/78139 - destructor needed by new-expression
5008 * call.c (build_special_member_call): Use tf_no_cleanup.
5010 PR c++/78282 - auto template and pack expansion
5011 * pt.c (find_parameter_packs_r): Don't walk into the type of
5012 templates other than template template-parameters.
5014 PR c++/79606 - ICE with this->base_member in NSDMI
5015 * class.c (build_base_path): Check processing_template_decl.
5017 PR c++/79607 - ICE with T{} initializer
5018 * decl.c (type_dependent_init_p): Check the type of a CONSTRUCTOR.
5020 PR c++/79566 - elaborated-type-specifier in range for
5021 * parser.c (cp_parser_simple_declaration): Fix check for type
5024 PR c++/79400 - confusing suggestion of 'noexcept'
5025 * parser.c (cp_parser_exception_specification_opt): Remove
5026 suggestion for deprecated dynamic exception-specification.
5028 PR c++/79470 - partial ordering with reference parameters
5029 * pt.c (unify) [INDIRECT_REF]: Handle pack expansions.
5031 PR c++/79500 - ICE with non-template deduction guide
5032 * pt.c (do_class_deduction): Use STRIP_TEMPLATE rather than
5033 DECL_TEMPLATE_RESULT.
5035 PR c++/79580 - ICE with compound literal
5036 * parser.c (cp_parser_class_head): If we're in the middle of an
5037 expression, use ts_within_enclosing_non_class.
5039 PR c++/79503 - inherited ctor taking base class
5040 * call.c (add_function_candidate): Also check that
5041 DECL_INHERITED_CTOR_BASE is reference-related to the parameter type.
5043 2017-02-19 Paolo Carlini <paolo.carlini@oracle.com>
5046 * typeck.c (cxx_alignas_expr): Reject a non-integral alignas
5049 2017-02-19 Eric Fiselier <eric@efcs.ca>
5050 Jonathan Wakely <jwakely@redhat.com>
5053 * parser.c (cp_parser_unqualified_id): Use OPT_Wliteral_suffix to
5054 control warning about literal suffix identifiers without a leading
5057 2017-02-17 Jason Merrill <jason@redhat.com>
5059 PR c++/79508 - lookup error with member template
5060 * parser.c (cp_parser_template_name): Clear
5061 parser->context->object_type if we aren't doing lookup.
5063 PR c++/78690 - ICE with using and global type with same name
5064 * pt.c (type_dependent_object_expression_p): True for
5067 PR c++/79549 - C++17 ICE with non-type auto template parameter pack
5068 * pt.c (convert_template_argument): Just return an auto arg pack.
5069 (tsubst_template_args): Don't tsubst an auto pack type.
5071 PR c++/79556 - C++17 ICE with non-type auto
5072 * pt.c (do_auto_deduction): Don't try to deduce from null type.
5074 PR c++/79533 - C++17 ICE with temporary cast to reference
5075 * call.c (build_over_call): Conversion to a reference prevents copy
5078 2017-02-16 Jakub Jelinek <jakub@redhat.com>
5079 Jason Merrill <jason@redhat.com>
5081 PR c++/79502 - lost nodiscard attribute
5082 * pt.c (apply_late_template_attributes): Do apply non-dependent
5083 attributes to types.
5085 2017-02-16 Jason Merrill <jason@redhat.com>
5087 PR c++/78572 - ICE with self-modifying array initializer
5088 * constexpr.c (cxx_eval_store_expression): The object we're
5089 initializing is outside the constant-expression.
5090 (cxx_eval_call_expression): Set ctx->call.
5092 PR c++/79050 - ICE with undeduced auto and LTO
5093 * decl.c (poplevel): Remove undeduced auto decls.
5095 2017-02-16 Jakub Jelinek <jakub@redhat.com>
5098 * parser.c (cp_parser_omp_target): For -fopenmp-simd
5099 ignore #pragma omp target even when not followed by identifier.
5101 2017-02-15 Jason Merrill <jason@redhat.com>
5102 Jakub Jelinek <jakub@redhat.com>
5104 PR c++/79464 - ICE in IPA with omitted constructor parms
5105 * class.c (build_clone): Also omit parms from TYPE_ARG_TYPES.
5106 (adjust_clone_args): Adjust.
5107 (add_method): Remember omitted parms.
5108 * call.c (add_function_candidate): Likewise.
5109 * mangle.c (write_method_parms): Likewise.
5110 * method.c (ctor_omit_inherited_parms): Return false if there are no
5113 2017-02-15 Martin Sebor <msebor@redhat.com>
5116 * init.c (maybe_reject_flexarray_init): New function.
5117 (perform_member_init): Call it.
5119 2017-02-15 Jakub Jelinek <jakub@redhat.com>
5122 * parser.c (cp_parser_std_attribute): Don't pedwarn about
5123 [[deprecated]] with -std=c++11 and [[fallthrough]] with
5124 -std=c++11 and -std=c++14.
5127 * decl.c (grokdeclarator): For static data members, handle thread_p
5128 only after handling inline.
5130 2017-02-14 Marek Polacek <polacek@redhat.com>
5134 * parser.c (cp_parser_postfix_dot_deref_expression): Avoid
5135 clobbering if the postfix expression isn't an EXPR_P.
5137 2017-02-13 Jason Merrill <jason@redhat.com>
5139 PR c++/79461 - ICE with lambda in constexpr constructor
5140 * constexpr.c (build_data_member_initialization): Ignore
5141 initialization of a local variable.
5143 2017-02-13 Jakub Jelinek <jakub@redhat.com>
5145 * init.c (warn_placement_new_too_small): Add missing space in
5147 * parser.c (cp_parser_oacc_declare): Likewise.
5148 * mangle.c (maybe_check_abi_tags): Likewise.
5151 * typeck.c (cp_build_modify_expr): Handle properly COMPOUND_EXPRs
5152 on lhs that have {PRE{DEC,INC}REMENT,MODIFY,MIN,MAX,COND}_EXPR
5153 in the rightmost operand.
5155 2017-02-13 Nathan Sidwell <nathan@acm.org>
5157 PR c++/79296 - ICE mangling localized template instantiation
5158 * decl2.c (determine_visibility): Use template fn context for
5159 local class instantiations.
5161 2017-02-11 Jason Merrill <jason@redhat.com>
5163 PR c++/77659 - ICE with new and C++14 aggregate NSDMI
5164 * init.c (build_new): Make backups of any CONSTRUCTORs in init.
5165 (build_new_1): Use replace_placeholders.
5166 * tree.c (replace_placeholders_t): Also track whether we've seen a
5168 (replace_placeholders, replace_placeholders_r): Adjust.
5169 * cp-tree.h: Adjust.
5171 PR c++/77790 - ICE with auto function in C++11 mode
5172 * decl.c (undeduced_auto_decl): Remove C++14 limitation.
5173 (require_deduced_type): Add complain parm, return bool.
5174 * cp-tree.h: Adjust.
5175 * decl2.c (mark_used): Use require_deduced_type.
5177 2017-02-10 Jason Merrill <jason@redhat.com>
5179 PR c++/78908 - template ops and bitfields
5180 * tree.c (build_min_non_dep): Use unlowered_expr_type.
5182 PR c++/78897 - constexpr union
5183 * constexpr.c (cxx_eval_store_expression): A store to a union member
5184 erases a previous store to another member.
5186 PR c++/71285 - member of fold-expression
5187 * semantics.c (finish_unary_fold_expr)
5188 (finish_binary_fold_expr): Use null type for fold-expressions.
5190 PR c++/79401 - protected inherited constructor
5191 * call.c (enforce_access): For inheriting constructor, find a base
5192 binfo in the path we already have.
5194 2017-02-10 Marek Polacek <polacek@redhat.com>
5197 * pt.c (type_dependent_expression_p): Check if the expression type
5201 * cvt.c (ocp_convert): Add a sentinel against -Wint-in-bool-context
5202 if warnings shouldn't be given.
5204 2017-02-10 Paolo Carlini <paolo.carlini@oracle.com>
5207 * pt.c (tsubst_decl): Don't try to preserve a typedef that names
5208 an error_mark_node as type.
5210 2017-02-09 Jakub Jelinek <jakub@redhat.com>
5211 Jason Merrill <jason@redhat.com>
5214 * pt.c (instantiate_class_template_1): Copy CLASSTYPE_NON_AGGREGATE
5215 from pattern to type.
5217 2017-02-09 Jason Merrill <jason@redhat.com>
5219 PR c++/79316 - default argument in deduction guide
5220 PR c++/79350 - explicit deduction guide
5221 * parser.c (cp_parser_constructor_declarator_p)
5222 (cp_parser_direct_declarator): Parse deduction guides more like
5224 * cp-tree.h (enum special_function_kind): Add sfk_deduction_guide.
5225 * tree.c (special_function_p): Return it.
5226 * decl.c (check_special_function_return_type): Handle it.
5227 (grokdeclarator, grokfndecl): Adjust.
5228 (cp_finish_decl): Pass flags to do_auto_deduction.
5229 * error.c (dump_decl_name): Use TFF_UNQUALIFIED_NAME.
5230 * pt.c (dguide_name_p): Take a const_tree.
5231 (do_class_deduction): Handle explicit.
5232 (do_auto_deduction): Pass flags through.
5233 (build_deduction_guide): Copy explicit flag.
5235 2017-02-09 Jakub Jelinek <jakub@redhat.com>
5238 * parser.c (cp_parser_omp_ordered): Don't check for non-pragma_stmt
5239 non-pragma_compound context here.
5240 (cp_parser_omp_target): Likewise.
5241 (cp_parser_pragma): Don't call push_omp_privatization_clauses and
5242 parsing for ordered and target omp pragmas in non-pragma_stmt
5243 non-pragma_compound contexts.
5246 * parser.c (cp_parser_oacc_declare): Formatting fix.
5247 (cp_parser_omp_declare_target): Don't invoke symtab_node::get on
5248 automatic variables.
5250 2016-02-09 Nathan Sidwell <nathan@codesourcery.com>
5251 Chung-Lin Tang <cltang@codesourcery.com>
5253 * parser.c (cp_parser_oacc_clause_tile): Disallow collapse. Fix
5254 parsing. Parse constant expression. Remove semantic checking.
5255 (cp_parser_omp_clause_collapse): Disallow tile.
5256 (cp_parser_omp_for_loop): Deal with tile clause. Don't emit a parse
5257 error about missing for after already emitting one. Use more
5258 conventional for idiom for unbounded loop.
5259 * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_TILE.
5260 * semantics.c (finish_omp_clauses): Correct TILE semantic check.
5261 (finish_omp_for): Deal with tile clause.
5263 2017-02-07 Nathan Sidwell <nathan@acm.org>
5265 * method.c (synthesized_method_base_walk): New. Broken out of ...
5266 (synthesized_method_walk): ... here. Call it. Cleanup
5269 2017-02-07 Patrick Palka <ppalka@gcc.gnu.org>
5272 * typeck2.c (process_init_constructor_union): Consider only
5273 FIELD_DECLs when looking for an NSDMI.
5275 2017-02-06 Jason Merrill <jason@redhat.com>
5277 PR c++/71193 - incomplete types in templates
5278 * parser.c (cp_parser_postfix_dot_deref_expression): In a template
5279 handle incomplete type by pedwarning and then treating as dependent.
5281 2017-02-06 Jakub Jelinek <jakub@redhat.com>
5284 * constexpr.c (cxx_eval_constant_expression): Handle ANNOTATE_EXPR.
5285 (potential_constant_expression_1): Likewise.
5288 * tree.c (build_min_non_dep_op_overload): For POST{INC,DEC}REMENT_EXPR
5289 allow one fewer than expected arguments if flag_permissive.
5292 * decl.c (cp_finish_decomp): On error set decl type to error_mark_node.
5293 * pt.c (tsubst_expr): Don't call tsubst_decomp_names on decompositions
5294 with error_mark_node type.
5296 2017-02-03 Jason Merrill <jason@redhat.com>
5298 PR c++/78689 - ICE on constructor with label
5299 * optimize.c (maybe_clone_body): Replace omitted parameters with
5301 * class.c (build_clone): Fix logic for omitting inherited parms.
5303 PR c++/12245 - excessive memory use
5304 * constexpr.c (maybe_constant_value): Fold maybe_constant_value_1
5305 back in. Don't cache constants.
5306 (maybe_constant_init): Don't cache constants.
5308 PR c++/79294 - ICE with invalid template argument
5309 * pt.c (convert_nontype_argument_function): Check value-dependence.
5310 (convert_nontype_argument): Don't check it here for function ptrs.
5312 2017-02-02 Richard Biener <rguenther@suse.de>
5315 * cp-gimplify.c (cp_fold): When folding a CONSTRUCTOR copy
5316 it lazily on the first changed element only and copy it
5317 fully upfront, only storing changed elements.
5319 2017-02-02 Paolo Carlini <paolo.carlini@oracle.com>
5322 * decl2.c (grokbitfield): In case of error don't set-up DECL_INITIAL
5325 2017-01-31 Jakub Jelinek <jakub@redhat.com>
5328 * error.c (dump_expr) <case COMPONENT_REF>: Don't print .
5331 2017-01-31 David Malcolm <dmalcolm@redhat.com>
5334 * name-lookup.c (suggest_alternative_in_explicit_scope): Resolve
5335 any namespace aliases.
5337 2017-01-31 Nathan Sidwell <nathan@acm.org>
5340 * typeck.c (build_ptrmemfunc_access_expr): Set TREE_NO_WARNING.
5344 * pt.c: (instantiate_decl): Push to top level when current
5345 function scope doesn't match. Only push lmabda scope stack when
5348 * cp-tree.h (instantiate_decl): Make defer_ok bool.
5349 * pt.c: Fix instantiate_decl calls to pass true/false not 0/1
5350 (instantiate_decl): Simplify and reorder state saving and restoration.
5353 * lambda.c (maybe_generic_this_capture): Deal with template-id-exprs.
5354 * semantics.c (finish_member_declaration): Assert class is being
5357 2017-01-30 Alexandre Oliva <aoliva@redhat.com>
5359 Introduce C++ support in libcc1.
5360 * cp-tree.h (struct lang_identifier): Add oracle_looked_up.
5361 (ansi_opname): Rename to...
5362 (cp_operator_id): ... this. Adjust all callers.
5363 (ansi_assopname): Rename to...
5364 (cp_assignment_operator_id): ... this. Adjust all callers.
5365 (cp_literal_operator_id): Declare.
5366 (set_global_friend): Declare.
5367 (is_global_friend): Declare.
5368 (enum cp_oracle_request): New type.
5369 (cp_binding_oracle_function): New type.
5370 (cp_binding_oracle): Declare.
5371 (cp_finish_injected_record_type): Declare.
5372 * friend.c (global_friend): New var.
5373 (set_global_friend): New fn.
5374 (is_global_friend): New fn.
5375 (is_friend): Call is_global_friend.
5376 * name-lookup.c (cp_binding_oracle): New var.
5377 (query_oracle): New fn.
5378 (qualified_lookup_using_namespace): Call query_oracle.
5379 (lookup_name_real_1): Likewise.
5380 * parser.c (cp_literal_operator_id): Drop static.
5381 * search.c (friend_accessible_p): Call is_global_friend.
5382 * semantics.c (is_this_parameter): Accept a variable if the
5383 binding oracle is enabled.
5385 2017-01-27 Jason Merrill <jason@redhat.com>
5387 PR c++/78771 - ICE with inherited constructor.
5388 * call.c (build_over_call): Call deduce_inheriting_ctor here.
5389 * pt.c (tsubst_decl): Not here.
5390 * class.c (add_method): Or here.
5391 * method.c (deduce_inheriting_ctor): Handle clones.
5392 (implicitly_declare_fn): Don't deduce inheriting ctors yet.
5394 2017-01-27 Adam Butcher <adam@jessamine.co.uk>
5397 * cp/parser.c (parsing_default_capturing_generic_lambda_in_template):
5399 * cp/cp-tree.h: Declare it.
5400 * cp/semantics.c (finish_id_expression): Resolve names within a default
5401 capturing generic lambda defined within a template prior to
5402 instantiation to allow for captures to be added to the closure type.
5404 2017-01-26 Jakub Jelinek <jakub@redhat.com>
5407 * cp-tree.def (OFFSETOF_EXPR): Bump number of operands to 2.
5408 * cp-tree.h (finish_offsetof): Add OBJECT_PTR argument.
5409 * parser.c (cp_parser_builtin_offsetof): Pass result of
5410 build_static_cast of null_pointer_node to finish_offsetof.
5411 * semantics.c (finish_offsetof): Add OBJECT_PTR argument, use
5412 it for -Winvalid-offsetof pedwarn instead of trying to guess
5413 original offsetof type from EXPR. Save OBJECT_PTR as a new
5414 second operand to OFFSETOF_EXPR.
5415 * pt.c (tsubst_copy_and_build) <case OFFSETOF_EXPR>: Adjust
5416 finish_offsetof caller, pass the second operand of OFFSETOF_EXPR
5419 2017-01-26 Jason Merrill <jason@redhat.com>
5421 * name-lookup.c (parse_using_directive): Deprecate strong using.
5423 PR c++/79176 - lambda ICE with -flto -Os
5424 * decl2.c (vague_linkage_p): Handle decloned 'tors.
5425 * tree.c (decl_linkage): Likewise.
5427 2017-01-25 Martin Sebor <msebor@redhat.com>
5429 * decl.c (grokdeclarator): Fix a typo in a comment.
5431 2017-01-25 Jakub Jelinek <jakub@redhat.com>
5434 * decl.c (cp_finish_decomp): Disallow memberwise decomposition of
5438 * parser.c (cp_parser_lambda_declarator_opt): Pedwarn with
5439 OPT_Wpedantic on lambda templates for -std=c++14 and higher.
5441 2017-01-25 Maxim Ostapenko <m.ostapenko@samsung.com>
5444 * decl.c (cxx_init_decl_processing): Pass main_input_filename
5445 to build_translation_unit_decl.
5447 2017-01-24 Jakub Jelinek <jakub@redhat.com>
5450 * cp-gimplify.c (cp_genericize_r): Add result of
5451 convert_from_reference on invisiref parm to p_set.
5453 2017-01-24 Nathan Sidwell <nathan@acm.org>
5455 PR c++/78469 - defaulted ctor and inaccessible dtor
5456 * cp-tree.h (tsubst_flags): Add tf_no_cleanup.
5457 * init.c (build_new_1): Pass tf_no_cleanup to build_value_init.
5458 * tree.c (build_target_expr): Check tf_no_cleanup.
5460 PR c++/79118 - anon-members and constexpr
5461 * constexpr.c (cx_check_missing_mem_inits): Caller passes type not
5462 ctor decl. Recursively check anonymous members.
5463 (register_constexpr_fundef): Adjust cx_check_missing_mem_inits
5465 (explain_invalid_constexpr_fn): Likewise.
5467 2017-01-23 Nathan Sidwell <nathan@acm.org>
5469 PR c++/71710 - template using directive of field
5470 * pt.c (tsubst_copy_and_build [COMPONENT_REF]): Move FIELD_DECL
5473 PR c++/71406 - ICE with scope-ref'd template id exprs
5475 * typeck.c (finish_class_member_access_expr): Break up SCOPE_REF
5476 before breaking up TEMPLATE_ID_EXPR.
5478 2017-01-20 Nathan Sidwell <nathan@acm.org>
5480 PR c++/78495 - wrong code inherited ctor and invisi-ref parm
5481 * cp-gimplify.c (cp_generize_r): Don't skip thunks.
5483 2017-01-20 David Malcolm <dmalcolm@redhat.com>
5487 * cp-tree.h (suggest_alternatives_for): Add bool param.
5488 (suggest_alternative_in_explicit_scope): New decl.
5489 * error.c (qualified_name_lookup_error): When SCOPE is a namespace
5490 that isn't the global one, call new function
5491 suggest_alternative_in_explicit_scope, only calling
5492 suggest_alternatives_for if it fails, and disabling near match
5493 searches fort that case. When SCOPE is the global namespace,
5494 pass true for new param to suggest_alternatives_for to allow for
5496 * lex.c (unqualified_name_lookup_error): Pass true for new param
5497 to suggest_alternatives_for.
5498 * name-lookup.c (consider_binding_level): Add forward decl.
5499 (suggest_alternatives_for): Add "suggest_misspellings" param,
5500 using it to conditionalize the fuzzy name-lookup code.
5501 (suggest_alternative_in_explicit_scope): New function.
5502 * parser.c (cp_parser_primary_expression): When calling
5503 finish_id_expression, pass location of id_expression rather
5504 than that of id_expr_token.
5505 (cp_parser_id_expression): Convert local "unqualified_id" from
5506 tree to cp_expr to avoid implicitly dropping location information.
5508 2017-01-20 Marek Polacek <polacek@redhat.com>
5511 * call.c (build_conditional_expr_1): Warn about duplicated branches.
5512 * semantics.c (finish_expr_stmt): Build statement using the proper
5515 2017-01-19 Jason Merrill <jason@redhat.com>
5517 US 20 - forwarding references and class template argument deduction
5518 * cp-tree.h (TEMPLATE_TYPE_PARM_FOR_CLASS): New.
5519 * pt.c (push_template_decl_real): Set it.
5520 (maybe_adjust_types_for_deduction): Check it.
5521 (rewrite_template_parm): Copy it.
5523 US 19 - deduction guides and constructors
5524 * call.c (joust): Prefer deduction guides to constructors.
5525 * pt.c (build_deduction_guide): Set DECL_ARTIFICIAL.
5526 (deduction_guide_p): Check DECL_P.
5528 * decl.c (check_initializer): Always use build_aggr_init for array
5531 PR c++/79130 - decomposition and direct-initialization
5532 * init.c (build_aggr_init): Communicate direct-initialization to
5534 (build_vec_init): Check for array copy sooner.
5535 * parser.c (cp_parser_decomposition_declaration): Remove call to
5536 build_x_compound_expr_from_list.
5538 2017-01-18 Jason Merrill <jason@redhat.com>
5540 PR c++/68666 - member variable template-id
5541 * typeck.c (finish_class_member_access_expr): Handle variable
5543 * pt.c (lookup_and_finish_template_variable): No longer static.
5544 * cp-tree.h: Declare it.
5546 2017-01-18 Nathan Sidwell <nathan@acm.org>
5549 * call.c (build_over_call): When checking ellipsis conversions for
5550 an inherited ctor, make sure there is at least one conversion.
5552 2017-01-18 Jason Merrill <jason@redhat.com>
5554 PR c++/78894 - ICE with class deduction and default arg
5555 * pt.c (build_deduction_guide): Set DECL_PRIMARY_TEMPLATE.
5557 2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de>
5560 * mangle.c (write_discriminator): Reorganize abi warning check.
5562 2017-01-18 Nathan Sidwell <nathan@acm.org>
5564 * cp-tree.h: Clarify exception spec node comment.
5565 * except.c (nothrow_spec_p): Simplify by checking node-equality.
5568 * mangle.c (write_exception_spec): Check nothrow explicitly.
5569 (write_encoding): Don't increment processing_template_decl around
5572 2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de>
5575 * mangle.c (write_template_args): Add "on" for operator names.
5577 2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de>
5580 * mangle.c (write_discriminator): Handle discriminator >= 10.
5582 2017-01-17 Nathan Sidwell <nathan@acm.org>
5585 * cp-tree.h (maybe_generic_this_capture): Declare.
5586 * lambda.c (resolvable_dummy_lambda): New, broken out of ...
5587 (maybe_resolve_dummy): ... here. Call it.
5588 (maybe_generic_this_capture): New.
5589 * parser.c (cp_parser_postfix_expression): Speculatively capture
5590 this in generic lambda in unresolved member function call.
5591 * pt.c (tsubst_copy_and_build): Force hard error from failed
5592 member function lookup in generic lambda.
5594 2017-01-17 Aldy Hernandez <aldyh@redhat.com>
5597 * cp-array-notation.c (expand_array_notation_exprs): Handle
5600 2017-01-11 Jason Merrill <jason@redhat.com>
5602 PR c++/78337 - ICE on invalid with generic lambda
5603 * semantics.c (process_outer_var_ref): Check if containing_function
5604 is null. Move inform call under complain test.
5606 2017-01-11 Nathan Sidwell <nathan@acm.org>
5609 * name-lookup.c (set_namespace_binding_1): An overload of 1 decl
5612 2017-01-11 Nathan Sidwell <nathan@acm.org>
5614 * name-lookup.c (push_overloaded_decl_1): Refactor OVERLOAD creation.
5616 2017-01-11 Jakub Jelinek <jakub@redhat.com>
5619 * parser.c (cp_parser_std_attribute_spec): Remove over-eager
5620 assertion. Formatting fix.
5623 * decl2.c (c_parse_final_cleanups): Set flag_syntax_only to 1 after
5626 2017-01-10 David Malcolm <dmalcolm@redhat.com>
5629 * parser.c (cp_parser_class_specifier_1): Only suggest inserting
5630 a missing semicolon if we have a valid insertion location for
5633 2017-01-10 Jason Merrill <jason@redhat.com>
5635 FI 20, decomposition declaration with parenthesized initializer.
5636 * parser.c (cp_parser_decomposition_declaration): Use
5637 cp_parser_initializer.
5639 2017-01-09 Jason Merrill <jason@redhat.com>
5641 Implement P0195R2, C++17 variadic using.
5642 * parser.c (cp_parser_using_declaration): Handle ellipsis and comma.
5643 * pt.c (tsubst_decl): Handle pack expansion in USING_DECL_SCOPE.
5644 * error.c (dump_decl): Likewise.
5646 2017-01-09 Jakub Jelinek <jakub@redhat.com>
5648 PR translation/79019
5649 PR translation/79020
5650 * semantics.c (finish_omp_clauses): Add missing whitespace to
5651 translatable strings.
5652 * cp-cilkplus.c (cpp_validate_cilk_plus_loop_aux): Fix comment typo.
5654 2017-01-07 Jason Merrill <jason@redhat.com>
5656 PR c++/78948 - instantiation from discarded statement
5657 * parser.h (struct cp_parser): Remove in_discarded_stmt field.
5658 * cp-tree.h (in_discarded_stmt): Declare it.
5659 (struct saved_scope): Add discarded_stmt bitfield.
5660 (in_discarded_stmt): New macro.
5661 * decl2.c (mark_used): Check it.
5662 * parser.c (cp_parser_selection_statement): Adjust.
5663 (cp_parser_jump_statement): Adjust.
5665 2017-01-05 Jakub Jelinek <jakub@redhat.com>
5668 * decl.c (cp_finish_decomp): Remove probe variable, if tt is
5669 REFERENCE_REF_P, set tt to its operand.
5672 * class.c (check_field_decls): Diagnose REFERENCE_TYPE fields in
5673 unions even for C++11 and later.
5675 2017-01-05 Nathan Sidwell <nathan@acm.org>
5678 * pt.c (convert_nontype_argument): Don't try and see if integral
5679 or enum expressions are constants prematurely.
5681 2017-01-04 Marek Polacek <polacek@redhat.com>
5684 * typeck.c (cp_build_binary_op): Warn when a pointer is compared with
5685 a zero character literal.
5687 2017-01-04 Jakub Jelinek <jakub@redhat.com>
5690 * typeck.c (cp_build_unary_op): Call mark_rvalue_use on arg if it has
5694 * parser.c (cp_parser_simple_declaration): Only complain about
5695 inconsistent auto deduction if auto_result doesn't use auto.
5697 * parser.c (cp_parser_simple_declaration): Diagnose function
5698 declaration among more than one init-declarators with auto
5702 * parser.c (cp_lexer_previous_token): Use vec_safe_address in the
5703 assertion, as lexer->buffer may be NULL.
5705 2017-01-04 Marek Polacek <polacek@redhat.com>
5709 * constexpr.c (potential_constant_expression_1): Handle CLEANUP_STMT.
5711 2017-01-04 Nathan Sidwell <nathan@acm.org>
5714 * cp-tree.h (DECLTYPE_FOR_REF_CAPTURE): New.
5715 (lambda_capture_field_type): Update prototype.
5716 * lambda.c (lambda_capture_field_type): Add is_reference parm.
5717 Add referenceness here.
5718 (add_capture): Adjust lambda_capture_field_type call, refactor
5720 * pt.c (tsubst): Adjust lambda_capture_field_type call.
5722 2017-01-01 Jakub Jelinek <jakub@redhat.com>
5724 Update copyright years.
5726 Copyright (C) 2017 Free Software Foundation, Inc.
5728 Copying and distribution of this file, with or without modification,
5729 are permitted in any medium without royalty provided the copyright
5730 notice and this notice are preserved.