PR c++/80119
[official-gcc.git] / gcc / cp / ChangeLog
blobf8e711b160a47cefc53f6713ee70f782c27925f1
1 2017-03-24  Marek Polacek  <polacek@redhat.com>
3         PR c++/80119
4         * cp-gimplify.c (cp_fold): Strip CLEANUP_POINT_EXPR if the expression
5         doesn't have side effects.
7 2017-03-23  Jason Merrill  <jason@redhat.com>
9         PR c++/80150 - ICE with overloaded variadic deduction.
10         * pt.c (try_one_overload): Remove asserts.
12         PR c++/77563 - missing ambiguous conversion error.
13         * call.c (convert_like_real): Use LOOKUP_IMPLICIT.
15 2017-03-23  Marek Polacek  <polacek@redhat.com>
17         * cp-tree.h: Remove a C_RID_YYCODE reference.
19 2017-03-22  Jakub Jelinek  <jakub@redhat.com>
21         PR c++/80141
22         * semantics.c (finish_omp_clause) <case OMP_CLAUSE_SIMDLEN,
23         case OMP_CLAUSE_ALIGNED>: Call maybe_constant_value only when not
24         processing_template_decl.
26 2017-03-21  Paolo Carlini  <paolo.carlini@oracle.com>
28         PR c++/77752
29         * name-lookup.c (pushtag_1): Add check for bogus, non template,
30         std::initializer_list.
32 2017-03-21  Jakub Jelinek  <jakub@redhat.com>
34         PR c++/35878
35         * init.c (std_placement_new_fn_p, build_new_1): Formatting fixes.
37 2017-03-21  Ville Voutilainen  <ville.voutilainen@gmail.com>
39         PR c++/35878
40         * init.c (std_placement_new_fn_p): New.
41         (build_new_1): Call it.
43 2017-03-20  Jason Merrill  <jason@redhat.com>
45         PR c++/80096 - ICE with C++17 non-type auto.
46         * pt.c (tsubst): Delay tsubst of type of template non-type
47         parameter.
49         PR c++/79519 - ICE with deleted template friend.
50         * decl.c (grokdeclarator): Complain about misplaced function
51         definition using =, as well.
53         PR c++/79640 - infinite recursion with generic lambda.
54         * pt.c (tsubst_copy) [VAR_DECL]: Register the dummy instantiation
55         before substituting its initializer.
57 2017-03-20  Marek Polacek  <polacek@redhat.com>
58             Paolo Carlini  <paolo.carlini@oracle.com>
60         PR c++/80059 - ICE with noexcept and __transaction_atomic
61         * except.c (build_must_not_throw_expr): Call
62         instantiate_non_dependent_expr.
64 2017-03-19  Jason Merrill  <jason@redhat.com>
66         PR c++/80084 - wrong C++17 decomposition by reference of parameter.
67         * decl.c (cp_finish_decomp): Don't pull out the DECL_INITIAL of a
68         reference decomposition.
70         PR c++/80077 - error with constexpr and -fno-elide-constructors.
71         * constexpr.c (cxx_eval_call_expression): Set ctx->call while
72         expanding trivial constructor.
74 2017-03-17  Jason Merrill  <jason@redhat.com>
76         PR c++/78345 - ICE initializing array from lambda.
77         * init.c (build_aggr_init): Check array initializer.
78         (build_vec_init): Check the type of a CONSTRUCTOR.
80         PR c++/80073 - C++17 ICE with virtual base.
81         * decl.c (xref_basetypes): Also check for indirect vbases.
83 2017-03-16  Jason Merrill  <jason@redhat.com>
85         * decl.c (start_enum): std::byte aliases anything.
87         PR c++/79797
88         * constexpr.c (lookup_placeholder): Tweak.
90 2017-03-15  Jason Merrill  <jason@redhat.com>
92         PR c++/80043 - ICE with -fpermissive
93         * typeck.c (convert_for_assignment): Handle instantiate_type
94         not giving an error.
96 2017-03-14  Nathan Sidwell  <nathan@acm.org>
98         PR c++/79393 DR 1658 workaround
99         * method.c (synthesized_method_base_walk): Inihibit abstract class
100         virtual base access check here.
101         (synthesized_method_walk): Not here.
103 2017-03-13  Nathan Sidwell  <nathan@acm.org>
105         PR c++/79393 DR 1658 workaround
106         * method.c (synthesized_method_walk): Check vbases of abstract
107         classes for dtor walk.
109 2017-03-10  David Malcolm  <dmalcolm@redhat.com>
111         PR translation/79848
112         * decl.c (grokfndecl): Simplify uses of "%<%s%>" to "%qs".
114 2017-03-10  Jason Merrill  <jason@redhat.com>
116         PR c++/79960 - alias templates and partial ordering
117         * pt.c (comp_template_args): Add partial_order parm.
118         (template_args_equal): Likewise.
119         (comp_template_args_porder): New.
120         (get_partial_spec_bindings): Use it.
122 2017-03-10  Marek Polacek  <polacek@redhat.com>
124         PR c++/79967
125         * decl.c (grokdeclarator): Check ATTRLIST before dereferencing it.
127 2017-03-10  Jakub Jelinek  <jakub@redhat.com>
129         PR c++/79899
130         * optimize.c (maybe_thunk_body): Don't ICE if fns[0] is NULL.
131         Use XALLOCAVEC macro.
133         PR c++/79896
134         * decl.c (finish_enum_value_list): If value is error_mark_node,
135         don't copy it and change its type.
136         * init.c (constant_value_1): Return error_mark_node if DECL_INITIAL
137         of CONST_DECL is error_mark_node.
139 2017-03-09  Marek Polacek  <polacek@redhat.com>
141         PR c++/79900 - ICE in strip_typedefs
142         * tree.c (strip_typedefs): Skip the attribute handling if T is
143         a variant type which hasn't been updated yet.
145         PR c++/79687 - wrong code with pointer-to-member
146         * init.c (constant_value_1): Break if the variable has a dynamic
147         initializer.
149 2017-03-08  Jason Merrill  <jason@redhat.com>
151         PR c++/79797 - ICE with self-reference in array DMI.
152         * constexpr.c (lookup_placeholder): Split out...
153         (cxx_eval_constant_expression): ...from here.
155 2017-03-07  Jakub Jelinek  <jakub@redhat.com>
157         PR c/79834
158         * parser.c (cp_parser_omp_cancellation_point,
159         cp_parser_omp_target_enter_data, cp_parser_omp_target_exit_data,
160         cp_parser_omp_target_update): Change "may only be used in compound
161         statements" diagnostics, such that the same translatable string is
162         used for all pragmas.
163         (cp_parser_pragma): Likewise.  Use error_at instead of
164         cp_parser_error for that diagnostics.
166 2017-03-06  Marek Polacek  <polacek@redhat.com>
168         PR c++/79796 - ICE with NSDMI and this pointer
169         * call.c (build_over_call): Handle NSDMI with a 'this' by calling
170         replace_placeholders.
172 2017-03-06  Jakub Jelinek  <jakub@redhat.com>
174         PR c++/79822
175         * constexpr.c (cxx_eval_statement_list): Treat empty ({ }) like
176         ({ (void) 0; }).
178 2017-03-06  Jason Merrill  <jason@redhat.com>
180         Revert "Allow deduction guides to look into primary template."
181         * cp-tree.h, parser.c, pt.c, search.c: Revert.
183 2017-03-05  Paolo Carlini  <paolo.carlini@oracle.com>
185         PR c++/70266
186         * except.c (build_must_not_throw_expr): Perform the implicit
187         conversions on the condition.
189 2017-03-03  Jason Merrill  <jason@redhat.com>
191         * mangle.c (mangle_decl): Check -Wnoexcept-type instead of
192         -Wc++1z-compat.
194         Core issues 2273 and 2277
195         * call.c (joust): Adjust using-declaration tiebreaker to handle
196         the intermediate base case.
197         * method.c (strip_inheriting_ctors): Just return the argument if
198         !flag_new_inheriting_ctors.
200 2017-03-03  Richard Biener  <rguenther@suse.de>
202         PR c++/79825
203         * cp-gimplify.c (simple_empty_class_p): Handle EMPTY_CLASS_EXPR.
205 2017-03-03  Marek Polacek  <polacek@redhat.com>
207         PR c++/79791
208         * typeck.c (string_conv_p): In C++11, always call pedwarn with
209         OPT_Wwrite_strings.
211 2017-03-02  Jason Merrill  <jason@redhat.com>
213         Update overload resolution with deduction guides.
214         * pt.c (do_class_deduction): Always build the copy guide.
215         (copy_guide_p, template_guide_p): New.
216         (build_deduction_guide): Remember the original constructor.
217         * call.c (joust): Prefer the copy guide and non-template guides.
219         Allow deduction guides to look into primary template.
220         * cp-tree.h (struct saved_scope): Add deduction_guide_type.
221         (struct cp_decl_specifier_seq): Add constructor_p.
222         * parser.c (cp_parser_decl_specifier_seq): Set constructor_p.
223         (cp_parser_init_declarator): Check it.  Set ctor_dtor_or_conv_p.
224         Clear deduction_guide_type.  Don't handle deduction guide names.
225         (cp_parser_declarator): Don't clear ctor_dtor_or_conv_p.
226         (cp_parser_direct_declarator): Likewise.  Handle deduction guides.
227         (cp_parser_member_declaration, cp_parser_cache_defarg)
228         (cp_parser_objc_class_ivars): Set ctor_dtor_or_conv_p.
229         * pt.c (tsubst_copy, tsubst_copy_and_build): Revert last change.
230         (build_deduction_guide): Set deduction_guide_type.
231         (dependent_scope_p): Check deduction_guide_type.
232         * search.c (lookup_member): Likewise.
234 2017-03-02  Jakub Jelinek  <jakub@redhat.com>
236         PR c++/79782
237         * init.c (mark_exp_read_r): New function.
238         (emit_mem_initializers): Use cp_walk_tree with mark_exp_read_r on
239         whole arguments instead of plain mark_exp_read on TREE_LIST values.
241 2017-03-01  Jason Merrill  <jason@redhat.com>
243         Class template argument deduction in new-expression
244         * init.c (build_new): Handle deduction from no initializer.
245         * parser.c (cp_parser_new_expression): Don't require a single
246         expression for class template deduction.
247         * typeck2.c (cxx_incomplete_type_diagnostic): Fix diagnostic for
248         class template placeholder.
249         * pt.c (tsubst_copy) [TEMPLATE_DECL]: Handle dependent context.
250         (tsubst_copy_and_build) [TEMPLATE_ID_EXPR]: Handle SCOPE_REF.
251         (redeclare_class_template): Set TEMPLATE_TYPE_PARM_FOR_CLASS.
253 2017-03-01  Jakub Jelinek  <jakub@redhat.com>
255         PR c++/79746
256         * init.c (emit_mem_initializers): When not constructing vbases of
257         abstract classes, mark arguments as read for
258         -Wunused-but-set-parameter.
260 2017-02-28  Jason Merrill  <jason@redhat.com>
262         Class template argument deduction refinements
263         * call.c (joust): Move deduction guide tiebreaker down.
264         * decl.c (start_decl_1, cp_finish_decl, grokdeclarator): Allow class
265         deduction with no initializer.
266         * pt.c (build_deduction_guide): Handle implicit default/copy ctor.
267         (do_class_deduction): Use that rather than special case.
268         (do_auto_deduction): Handle null initializer.
270 2017-02-28  Jakub Jelinek  <jakub@redhat.com>
272         * decl.c (find_decomp_class_base): Use cond ? G_("...") : G_("...")
273         instead of just cond ? "..." : "...".
274         (grokdeclarator): Likewise.
275         (build_enumerator): Likewise.
276         * init.c (build_new_1): Likewise.
277         * call.c (build_new_method_call_1): Likewise.
278         * parser.c: Include intl.h.
279         (cp_parser_oacc_enter_exit_data): Use %s and ternary operator only for
280         "enter"/"exit" keyword.
281         (cp_finalize_oacc_routine): Don't use %s to supply portions of the
282         message.
284 2017-02-27  Jason Merrill  <jason@redhat.com>
286         PR c++/71568 - SFINAE forming pointer to member function
287         * init.c (build_offset_ref): Check the return value of
288         perform_or_defer_access_check.
290 2017-02-27  Marek Polacek  <polacek@redhat.com>
292         * decl.c (expand_static_init): Add missing } in a comment.
294 2017-02-27  Volker Reichelt  <v.reichelt@netcologne.de>
296         * init.c: Include intl.h.
297         (build_new_1): Move message strings into pedwarn to make them
298         -Wformat-security friendly. Mark string for translation.
299         * pt.c (tsubst_copy_and_build): Mark string for translation.
300         Make the pointer const.
301         * semantics.c (finish_id_expression): Mark strings for translation.
303 2017-02-25  Jakub Jelinek  <jakub@redhat.com>
305         * call.c (build_op_delete_call): Make msg1 and msg2 const.
307 2017-02-24  Jakub Jelinek  <jakub@redhat.com>
309         PR c++/79588
310         * call.c (build_over_call): Call check_function_arguments even for
311         -Wrestrict, adjust check_function_arguments caller.
312         * parser.c (cp_parser_postfix_expression): Don't handle -Wrestrict
313         here.
314         * typeck.c (cp_build_function_call_vec): Adjust
315         check_function_arguments caller.
317 2017-02-24  Marek Polacek  <polacek@redhat.com>
319         PR translation/79705
320         * decl.c (check_redeclaration_exception_specification): Mark a string
321         for translation.  Make the pointer const.
323 2017-02-23  Paolo Carlini  <paolo.carlini@oracle.com>
325         PR c++/79361
326         * pt.c (register_specialization): Check duplicate_decls return value
327         for error_mark_node and pass it back.
329 2017-02-22  Jason Merrill  <jason@redhat.com>
331         PR c++/79679 - missing destructor for argument
332         * call.c (build_over_call): Don't pass tf_no_cleanup to argument
333         conversions.
335         * pt.c (do_class_deduction): Handle 0 argument case.
337 2017-02-22  Jakub Jelinek  <jakub@redhat.com>
339         PR c++/79664
340         * parser.c (cp_parser_omp_teams, cp_parser_omp_target): Use
341         SET_EXPR_LOCATION on OMP_TARGET/OMP_TEAMS tree.
342         * constexpr.c (potential_constant_expression_1): Handle
343         OMP_*, OACC_* and CILK_* trees.  Use error_at with
344         EXPR_LOC_OR_LOC (t, input_location) computed early
345         instead of error, or error_at with location_of (t).
347 2017-02-22  Marek Polacek  <polacek@redhat.com>
349         PR c++/79653
350         * parser.c (cp_parser_std_attribute_spec): Don't build the attribute
351         if the alignas expression is erroneous.
352         * pt.c (tsubst_attribute): If tsubst_pack_expansion fails, return
353         error_mark_node.
355         PR c++/79657
356         * semantics.c (finish_underlying_type): Bail out for incomplete enums.
358 2017-02-21  Jason Merrill  <jason@redhat.com>
360         PR c++/50308 - wrong deprecated warning with ADL
361         PR c++/17729 - duplicate deprecated warning
362         * semantics.c (finish_id_expression): Only call mark_used on a
363         function if we aren't building a call.
365         PR c++/41727 - ICE with partial spec of partial instantiation
366         * pt.c (process_partial_specialization): For now, don't check more
367         specialized if there is more than one level of args.
369 2017-02-21  Marek Polacek  <polacek@redhat.com>
371         PR c++/79535
372         * cp-tree.h (maybe_reject_flexarray_init): Declare.
373         * init.c (maybe_reject_flexarray_init): No longer static.
374         Add check for current_function_decl.
375         * parser.c (cp_parser_late_parse_one_default_arg): Reject
376         a default mem-initializer for a flexible array.
378 2017-02-21  Jakub Jelinek  <jakub@redhat.com>
379             Paolo Carlini  <paolo.carlini@oracle.com>
381         PR c++/79654
382         * decl.c (cp_finish_decomp): Don't set decl's type to error_mark_node
383         on error.
384         * pt.c (tsubst_decomp_names): Return error_mark_node if the first
385         decl after the decomposition artificial decl has error_mark_node.
386         * decl2.c (prune_vars_needing_no_initialization): Use error_operand_p
387         instead of just == error_mark_node comparison.
389 2017-02-21  Jakub Jelinek  <jakub@redhat.com>
391         PR sanitizer/79589
392         * decl.c: Include gimplify.h.
393         (cp_finish_decomp): Make sure there is no sharing of trees
394         in between DECL_VALUE_EXPR of decomposition decls.
396         PR c++/79655
397         * constexpr.c (cxx_eval_array_reference): Diagnose negative subscript.
399         PR c++/79639
400         * constexpr.c (cxx_eval_store_expression): If *valp is a PTRMEM_CST,
401         call cplus_expand_constant on it first.
403 2017-02-19  Jason Merrill  <jason@redhat.com>
405         PR c++/78139 - destructor needed by new-expression
406         * call.c (build_special_member_call): Use tf_no_cleanup.
408         PR c++/78282 - auto template and pack expansion
409         * pt.c (find_parameter_packs_r): Don't walk into the type of
410         templates other than template template-parameters.
412         PR c++/79606 - ICE with this->base_member in NSDMI
413         * class.c (build_base_path): Check processing_template_decl.
415         PR c++/79607 - ICE with T{} initializer
416         * decl.c (type_dependent_init_p): Check the type of a CONSTRUCTOR.
418         PR c++/79566 - elaborated-type-specifier in range for
419         * parser.c (cp_parser_simple_declaration): Fix check for type
420         definition.
422         PR c++/79400 - confusing suggestion of 'noexcept'
423         * parser.c (cp_parser_exception_specification_opt): Remove
424         suggestion for deprecated dynamic exception-specification.
426         PR c++/79470 - partial ordering with reference parameters
427         * pt.c (unify) [INDIRECT_REF]: Handle pack expansions.
429         PR c++/79500 - ICE with non-template deduction guide
430         * pt.c (do_class_deduction): Use STRIP_TEMPLATE rather than
431         DECL_TEMPLATE_RESULT.
433         PR c++/79580 - ICE with compound literal
434         * parser.c (cp_parser_class_head): If we're in the middle of an
435         expression, use ts_within_enclosing_non_class.
437         PR c++/79503 - inherited ctor taking base class
438         * call.c (add_function_candidate): Also check that
439         DECL_INHERITED_CTOR_BASE is reference-related to the parameter type.
441 2017-02-19  Paolo Carlini  <paolo.carlini@oracle.com>
443         PR c++/79380
444         * typeck.c (cxx_alignas_expr): Reject a non-integral alignas
445         argument.
447 2017-02-19  Eric Fiselier  <eric@efcs.ca>
448             Jonathan Wakely  <jwakely@redhat.com>
450         PR c++/69523
451         * parser.c (cp_parser_unqualified_id): Use OPT_Wliteral_suffix to
452         control warning about literal suffix identifiers without a leading
453         underscore.
455 2017-02-17  Jason Merrill  <jason@redhat.com>
457         PR c++/79508 - lookup error with member template
458         * parser.c (cp_parser_template_name): Clear
459         parser->context->object_type if we aren't doing lookup.
461         PR c++/78690 - ICE with using and global type with same name
462         * pt.c (type_dependent_object_expression_p): True for
463         IDENTIFIER_NODE.
465         PR c++/79549 - C++17 ICE with non-type auto template parameter pack
466         * pt.c (convert_template_argument): Just return an auto arg pack.
467         (tsubst_template_args): Don't tsubst an auto pack type.
469         PR c++/79556 - C++17 ICE with non-type auto
470         * pt.c (do_auto_deduction): Don't try to deduce from null type.
472         PR c++/79533 - C++17 ICE with temporary cast to reference
473         * call.c (build_over_call): Conversion to a reference prevents copy
474         elision.
476 2017-02-16  Jakub Jelinek  <jakub@redhat.com>
477             Jason Merrill  <jason@redhat.com>
479         PR c++/79502 - lost nodiscard attribute
480         * pt.c (apply_late_template_attributes): Do apply non-dependent
481         attributes to types.
483 2017-02-16  Jason Merrill  <jason@redhat.com>
485         PR c++/78572 - ICE with self-modifying array initializer
486         * constexpr.c (cxx_eval_store_expression): The object we're
487         initializing is outside the constant-expression.
488         (cxx_eval_call_expression): Set ctx->call.
490         PR c++/79050 - ICE with undeduced auto and LTO
491         * decl.c (poplevel): Remove undeduced auto decls.
493 2017-02-16  Jakub Jelinek  <jakub@redhat.com>
495         PR c++/79512
496         * parser.c (cp_parser_omp_target): For -fopenmp-simd
497         ignore #pragma omp target even when not followed by identifier.
499 2017-02-15  Jason Merrill  <jason@redhat.com>
500             Jakub Jelinek  <jakub@redhat.com>
502         PR c++/79464 - ICE in IPA with omitted constructor parms
503         * class.c (build_clone): Also omit parms from TYPE_ARG_TYPES.
504         (adjust_clone_args): Adjust.
505         (add_method): Remember omitted parms.
506         * call.c (add_function_candidate): Likewise.
507         * mangle.c (write_method_parms): Likewise.
508         * method.c (ctor_omit_inherited_parms): Return false if there are no
509         parms to omit.
511 2017-02-15  Martin Sebor  <msebor@redhat.com>
513         PR c++/79363
514         * init.c (maybe_reject_flexarray_init): New function.
515         (perform_member_init): Call it.
517 2017-02-15  Jakub Jelinek  <jakub@redhat.com>
519         PR c++/79301
520         * parser.c (cp_parser_std_attribute): Don't pedwarn about
521         [[deprecated]] with -std=c++11 and [[fallthrough]] with
522         -std=c++11 and -std=c++14.
524         PR c++/79288
525         * decl.c (grokdeclarator): For static data members, handle thread_p
526         only after handling inline.
528 2017-02-14  Marek Polacek  <polacek@redhat.com>
530         PR c++/79420
531         PR c++/79463
532         * parser.c (cp_parser_postfix_dot_deref_expression): Avoid
533         clobbering if the postfix expression isn't an EXPR_P.
535 2017-02-13  Jason Merrill  <jason@redhat.com>
537         PR c++/79461 - ICE with lambda in constexpr constructor
538         * constexpr.c (build_data_member_initialization): Ignore
539         initialization of a local variable.
541 2017-02-13  Jakub Jelinek  <jakub@redhat.com>
543         * init.c (warn_placement_new_too_small): Add missing space in
544         diagnostics.
545         * parser.c (cp_parser_oacc_declare): Likewise.
546         * mangle.c (maybe_check_abi_tags): Likewise.
548         PR c++/79232
549         * typeck.c (cp_build_modify_expr): Handle properly COMPOUND_EXPRs
550         on lhs that have {PRE{DEC,INC}REMENT,MODIFY,MIN,MAX,COND}_EXPR
551         in the rightmost operand.
553 2017-02-13  Nathan Sidwell  <nathan@acm.org>
555         PR c++/79296 - ICE mangling localized template instantiation
556         * decl2.c (determine_visibility): Use template fn context for
557         local class instantiations.
559 2017-02-11  Jason Merrill  <jason@redhat.com>
561         PR c++/77659 - ICE with new and C++14 aggregate NSDMI
562         * init.c (build_new): Make backups of any CONSTRUCTORs in init.
563         (build_new_1): Use replace_placeholders.
564         * tree.c (replace_placeholders_t): Also track whether we've seen a
565         placeholder.
566         (replace_placeholders, replace_placeholders_r): Adjust.
567         * cp-tree.h: Adjust.
569         PR c++/77790 - ICE with auto function in C++11 mode
570         * decl.c (undeduced_auto_decl): Remove C++14 limitation.
571         (require_deduced_type): Add complain parm, return bool.
572         * cp-tree.h: Adjust.
573         * decl2.c (mark_used): Use require_deduced_type.
575 2017-02-10  Jason Merrill  <jason@redhat.com>
577         PR c++/78908 - template ops and bitfields
578         * tree.c (build_min_non_dep): Use unlowered_expr_type.
580         PR c++/78897 - constexpr union
581         * constexpr.c (cxx_eval_store_expression): A store to a union member
582         erases a previous store to another member.
584         PR c++/71285 - member of fold-expression
585         * semantics.c (finish_unary_fold_expr)
586         (finish_binary_fold_expr): Use null type for fold-expressions.
588         PR c++/79401 - protected inherited constructor
589         * call.c (enforce_access): For inheriting constructor, find a base
590         binfo in the path we already have.
592 2017-02-10  Marek Polacek  <polacek@redhat.com>
594         PR c++/79435
595         * pt.c (type_dependent_expression_p): Check if the expression type
596         is null.
598         PR c++/79184
599         * cvt.c (ocp_convert): Add a sentinel against -Wint-in-bool-context
600         if warnings shouldn't be given.
602 2017-02-10  Paolo Carlini  <paolo.carlini@oracle.com>
604         PR c++/71737
605         * pt.c (tsubst_decl): Don't try to preserve a typedef that names
606         an error_mark_node as type.
608 2017-02-09  Jakub Jelinek  <jakub@redhat.com>
609             Jason Merrill  <jason@redhat.com>
611         PR c++/79143
612         * pt.c (instantiate_class_template_1): Copy CLASSTYPE_NON_AGGREGATE
613         from pattern to type.
615 2017-02-09  Jason Merrill  <jason@redhat.com>
617         PR c++/79316 - default argument in deduction guide
618         PR c++/79350 - explicit deduction guide
619         * parser.c (cp_parser_constructor_declarator_p)
620         (cp_parser_direct_declarator): Parse deduction guides more like
621         constructors.
622         * cp-tree.h (enum special_function_kind): Add sfk_deduction_guide.
623         * tree.c (special_function_p): Return it.
624         * decl.c (check_special_function_return_type): Handle it.
625         (grokdeclarator, grokfndecl): Adjust.
626         (cp_finish_decl): Pass flags to do_auto_deduction.
627         * error.c (dump_decl_name): Use TFF_UNQUALIFIED_NAME.
628         * pt.c (dguide_name_p): Take a const_tree.
629         (do_class_deduction): Handle explicit.
630         (do_auto_deduction): Pass flags through.
631         (build_deduction_guide): Copy explicit flag.
633 2017-02-09  Jakub Jelinek  <jakub@redhat.com>
635         PR c++/79429
636         * parser.c (cp_parser_omp_ordered): Don't check for non-pragma_stmt
637         non-pragma_compound context here.
638         (cp_parser_omp_target): Likewise.
639         (cp_parser_pragma): Don't call push_omp_privatization_clauses and
640         parsing for ordered and target omp pragmas in non-pragma_stmt
641         non-pragma_compound contexts.
643         PR c/79431
644         * parser.c (cp_parser_oacc_declare): Formatting fix.
645         (cp_parser_omp_declare_target): Don't invoke symtab_node::get on
646         automatic variables.
648 2016-02-09  Nathan Sidwell  <nathan@codesourcery.com>
649             Chung-Lin Tang  <cltang@codesourcery.com>
651         * parser.c (cp_parser_oacc_clause_tile): Disallow collapse.  Fix
652         parsing.  Parse constant expression. Remove semantic checking.
653         (cp_parser_omp_clause_collapse): Disallow tile.
654         (cp_parser_omp_for_loop): Deal with tile clause.  Don't emit a parse
655         error about missing for after already emitting one.  Use more
656         conventional for idiom for unbounded loop.
657         * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_TILE.
658         * semantics.c (finish_omp_clauses): Correct TILE semantic check.
659         (finish_omp_for): Deal with tile clause.
661 2017-02-07  Nathan Sidwell  <nathan@acm.org>
663         * method.c (synthesized_method_base_walk): New.  Broken out of ...
664         (synthesized_method_walk): ... here.  Call it.  Cleanup
665         initializations.
667 2017-02-07  Patrick Palka  <ppalka@gcc.gnu.org>
669         PR c++/79360
670         * typeck2.c (process_init_constructor_union): Consider only
671         FIELD_DECLs when looking for an NSDMI.
673 2017-02-06  Jason Merrill  <jason@redhat.com>
675         PR c++/71193 - incomplete types in templates
676         * parser.c (cp_parser_postfix_dot_deref_expression): In a template
677         handle incomplete type by pedwarning and then treating as dependent.
679 2017-02-06  Jakub Jelinek  <jakub@redhat.com>
681         PR c++/79379
682         * constexpr.c (cxx_eval_constant_expression): Handle ANNOTATE_EXPR.
683         (potential_constant_expression_1): Likewise.
685         PR c++/79377
686         * tree.c (build_min_non_dep_op_overload): For POST{INC,DEC}REMENT_EXPR
687         allow one fewer than expected arguments if flag_permissive.
689         PR c++/79372
690         * decl.c (cp_finish_decomp): On error set decl type to error_mark_node.
691         * pt.c (tsubst_expr): Don't call tsubst_decomp_names on decompositions
692         with error_mark_node type.
694 2017-02-03  Jason Merrill  <jason@redhat.com>
696         PR c++/78689 - ICE on constructor with label
697         * optimize.c (maybe_clone_body): Replace omitted parameters with
698         null lvalues.
699         * class.c (build_clone): Fix logic for omitting inherited parms.
701         PR c++/12245 - excessive memory use
702         * constexpr.c (maybe_constant_value): Fold maybe_constant_value_1
703         back in.  Don't cache constants.
704         (maybe_constant_init): Don't cache constants.
706         PR c++/79294 - ICE with invalid template argument
707         * pt.c (convert_nontype_argument_function): Check value-dependence.
708         (convert_nontype_argument): Don't check it here for function ptrs.
710 2017-02-02  Richard Biener  <rguenther@suse.de>
712         PR cp/14179
713         * cp-gimplify.c (cp_fold): When folding a CONSTRUCTOR copy
714         it lazily on the first changed element only and copy it
715         fully upfront, only storing changed elements.
717 2017-02-02  Paolo Carlini  <paolo.carlini@oracle.com>
719         PR c++/69637
720         * decl2.c (grokbitfield): In case of error don't set-up DECL_INITIAL
721         to the width.
723 2017-01-31  Jakub Jelinek  <jakub@redhat.com>
725         PR c++/79304
726         * error.c (dump_expr) <case COMPONENT_REF>: Don't print .
727         after ARROW_EXPR.
729 2017-01-31  David Malcolm  <dmalcolm@redhat.com>
731         PR c++/79298
732         * name-lookup.c (suggest_alternative_in_explicit_scope): Resolve
733         any namespace aliases.
735 2017-01-31  Nathan Sidwell  <nathan@acm.org>
737         PR c++/79290
738         * typeck.c (build_ptrmemfunc_access_expr): Set TREE_NO_WARNING.
740         PR c++/67273
741         PR c++/79253
742         * pt.c: (instantiate_decl): Push to top level when current
743         function scope doesn't match.  Only push lmabda scope stack when
744         pushing to top.
746         * cp-tree.h (instantiate_decl): Make defer_ok bool.
747         * pt.c: Fix instantiate_decl calls to pass true/false not 0/1
748         (instantiate_decl): Simplify and reorder state saving and restoration.
750         PR c++/79264
751         * lambda.c (maybe_generic_this_capture): Deal with template-id-exprs.
752         * semantics.c (finish_member_declaration): Assert class is being
753         defined.
755 2017-01-30  Alexandre Oliva <aoliva@redhat.com>
757         Introduce C++ support in libcc1.
758         * cp-tree.h (struct lang_identifier): Add oracle_looked_up.
759         (ansi_opname): Rename to...
760         (cp_operator_id): ... this.  Adjust all callers.
761         (ansi_assopname): Rename to...
762         (cp_assignment_operator_id): ... this.  Adjust all callers.
763         (cp_literal_operator_id): Declare.
764         (set_global_friend): Declare.
765         (is_global_friend): Declare.
766         (enum cp_oracle_request): New type.
767         (cp_binding_oracle_function): New type.
768         (cp_binding_oracle): Declare.
769         (cp_finish_injected_record_type): Declare.
770         * friend.c (global_friend): New var.
771         (set_global_friend): New fn.
772         (is_global_friend): New fn.
773         (is_friend): Call is_global_friend.
774         * name-lookup.c (cp_binding_oracle): New var.
775         (query_oracle): New fn.
776         (qualified_lookup_using_namespace): Call query_oracle.
777         (lookup_name_real_1): Likewise.
778         * parser.c (cp_literal_operator_id): Drop static.
779         * search.c (friend_accessible_p): Call is_global_friend.
780         * semantics.c (is_this_parameter): Accept a variable if the
781         binding oracle is enabled.
783 2017-01-27  Jason Merrill  <jason@redhat.com>
785         PR c++/78771 - ICE with inherited constructor.
786         * call.c (build_over_call): Call deduce_inheriting_ctor here.
787         * pt.c (tsubst_decl): Not here.
788         * class.c (add_method): Or here.
789         * method.c (deduce_inheriting_ctor): Handle clones.
790         (implicitly_declare_fn): Don't deduce inheriting ctors yet.
792 2017-01-27  Adam Butcher  <adam@jessamine.co.uk>
794         PR c++/64382
795         * cp/parser.c (parsing_default_capturing_generic_lambda_in_template):
796         New function.
797         * cp/cp-tree.h: Declare it.
798         * cp/semantics.c (finish_id_expression): Resolve names within a default
799         capturing generic lambda defined within a template prior to
800         instantiation to allow for captures to be added to the closure type.
802 2017-01-26  Jakub Jelinek  <jakub@redhat.com>
804         PR c++/68727
805         * cp-tree.def (OFFSETOF_EXPR): Bump number of operands to 2.
806         * cp-tree.h (finish_offsetof): Add OBJECT_PTR argument.
807         * parser.c (cp_parser_builtin_offsetof): Pass result of
808         build_static_cast of null_pointer_node to finish_offsetof.
809         * semantics.c (finish_offsetof): Add OBJECT_PTR argument, use
810         it for -Winvalid-offsetof pedwarn instead of trying to guess
811         original offsetof type from EXPR.  Save OBJECT_PTR as a new
812         second operand to OFFSETOF_EXPR.
813         * pt.c (tsubst_copy_and_build) <case OFFSETOF_EXPR>: Adjust
814         finish_offsetof caller, pass the second operand of OFFSETOF_EXPR
815         as OBJECT_PTR.
817 2017-01-26  Jason Merrill  <jason@redhat.com>
819         * name-lookup.c (parse_using_directive): Deprecate strong using.
821         PR c++/79176 - lambda ICE with -flto -Os
822         * decl2.c (vague_linkage_p): Handle decloned 'tors.
823         * tree.c (decl_linkage): Likewise.
825 2017-01-25  Martin Sebor  <msebor@redhat.com>
827         * decl.c (grokdeclarator): Fix a typo in a comment.
829 2017-01-25  Jakub Jelinek  <jakub@redhat.com>
831         PR c++/78896
832         * decl.c (cp_finish_decomp): Disallow memberwise decomposition of
833         lambda expressions.
835         PR c++/77914
836         * parser.c (cp_parser_lambda_declarator_opt): Pedwarn with
837         OPT_Wpedantic on lambda templates for -std=c++14 and higher.
839 2017-01-25  Maxim Ostapenko  <m.ostapenko@samsung.com>
841         PR lto/79061
842         * decl.c (cxx_init_decl_processing): Pass main_input_filename
843         to build_translation_unit_decl.
845 2017-01-24  Jakub Jelinek  <jakub@redhat.com>
847         PR c++/79205
848         * cp-gimplify.c (cp_genericize_r): Add result of
849         convert_from_reference on invisiref parm to p_set.
851 2017-01-24  Nathan Sidwell  <nathan@acm.org>
853         PR c++/78469 - defaulted ctor and inaccessible dtor
854         * cp-tree.h (tsubst_flags): Add tf_no_cleanup.
855         * init.c (build_new_1): Pass tf_no_cleanup to build_value_init.
856         * tree.c (build_target_expr): Check tf_no_cleanup.
858         PR c++/79118 - anon-members and constexpr
859         * constexpr.c (cx_check_missing_mem_inits): Caller passes type not
860         ctor decl.  Recursively check anonymous members.
861         (register_constexpr_fundef): Adjust cx_check_missing_mem_inits
862         call.
863         (explain_invalid_constexpr_fn): Likewise.
865 2017-01-23  Nathan Sidwell  <nathan@acm.org>
867         PR c++/71710 - template using directive of field
868         * pt.c (tsubst_copy_and_build [COMPONENT_REF]): Move FIELD_DECL
869         check earlier.
871         PR c++/71406 - ICE with scope-ref'd template id exprs
872         PR c++/77508
873         * typeck.c (finish_class_member_access_expr): Break up SCOPE_REF
874         before breaking up TEMPLATE_ID_EXPR.
876 2017-01-20  Nathan Sidwell  <nathan@acm.org>
878         PR c++/78495 - wrong code inherited ctor and invisi-ref parm
879         * cp-gimplify.c (cp_generize_r): Don't skip thunks.
881 2017-01-20  David Malcolm  <dmalcolm@redhat.com>
883         PR c++/77829
884         PR c++/78656
885         * cp-tree.h (suggest_alternatives_for): Add bool param.
886         (suggest_alternative_in_explicit_scope): New decl.
887         * error.c (qualified_name_lookup_error): When SCOPE is a namespace
888         that isn't the global one, call new function
889         suggest_alternative_in_explicit_scope, only calling
890         suggest_alternatives_for if it fails, and disabling near match
891         searches fort that case.  When SCOPE is the global namespace,
892         pass true for new param to suggest_alternatives_for to allow for
893         fuzzy name lookups.
894         * lex.c (unqualified_name_lookup_error): Pass true for new param
895         to suggest_alternatives_for.
896         * name-lookup.c (consider_binding_level): Add forward decl.
897         (suggest_alternatives_for): Add "suggest_misspellings" param,
898         using it to conditionalize the fuzzy name-lookup code.
899         (suggest_alternative_in_explicit_scope): New function.
900         * parser.c (cp_parser_primary_expression): When calling
901         finish_id_expression, pass location of id_expression rather
902         than that of id_expr_token.
903         (cp_parser_id_expression): Convert local "unqualified_id" from
904         tree to cp_expr to avoid implicitly dropping location information.
906 2017-01-20  Marek Polacek  <polacek@redhat.com>
908         PR c/64279
909         * call.c (build_conditional_expr_1): Warn about duplicated branches.
910         * semantics.c (finish_expr_stmt): Build statement using the proper
911         location.
913 2017-01-19  Jason Merrill  <jason@redhat.com>
915         US 20 - forwarding references and class template argument deduction
916         * cp-tree.h (TEMPLATE_TYPE_PARM_FOR_CLASS): New.
917         * pt.c (push_template_decl_real): Set it.
918         (maybe_adjust_types_for_deduction): Check it.
919         (rewrite_template_parm): Copy it.
921         US 19 - deduction guides and constructors
922         * call.c (joust): Prefer deduction guides to constructors.
923         * pt.c (build_deduction_guide): Set DECL_ARTIFICIAL.
924         (deduction_guide_p): Check DECL_P.
926         * decl.c (check_initializer): Always use build_aggr_init for array
927         decomposition.
929         PR c++/79130 - decomposition and direct-initialization
930         * init.c (build_aggr_init): Communicate direct-initialization to
931         build_vec_init.
932         (build_vec_init): Check for array copy sooner.
933         * parser.c (cp_parser_decomposition_declaration): Remove call to
934         build_x_compound_expr_from_list.
936 2017-01-18  Jason Merrill  <jason@redhat.com>
938         PR c++/68666 - member variable template-id
939         * typeck.c (finish_class_member_access_expr): Handle variable
940         template-id.
941         * pt.c (lookup_and_finish_template_variable): No longer static.
942         * cp-tree.h: Declare it.
944 2017-01-18  Nathan Sidwell  <nathan@acm.org>
946         PR c++/78488
947         * call.c (build_over_call): When checking ellipsis conversions for
948         an inherited ctor, make sure there is at least one conversion.
950 2017-01-18  Jason Merrill  <jason@redhat.com>
952         PR c++/78894 - ICE with class deduction and default arg
953         * pt.c (build_deduction_guide): Set DECL_PRIMARY_TEMPLATE.
955 2017-01-18  Markus Trippelsdorf  <markus@trippelsdorf.de>
957         PR c++/77489
958         * mangle.c (write_discriminator): Reorganize abi warning check.
960 2017-01-18  Nathan Sidwell  <nathan@acm.org>
962         * cp-tree.h: Clarify exception spec node comment.
963         * except.c (nothrow_spec_p): Simplify by checking node-equality.
965         PR c++/79091
966         * mangle.c (write_exception_spec): Check nothrow explicitly.
967         (write_encoding): Don't increment processing_template_decl around
968         encoding.
970 2017-01-18  Markus Trippelsdorf  <markus@trippelsdorf.de>
972         PR c++/70182
973         * mangle.c (write_template_args): Add "on" for operator names.
975 2017-01-18  Markus Trippelsdorf  <markus@trippelsdorf.de>
977         PR c++/77489
978         * mangle.c (write_discriminator): Handle discriminator >= 10.
980 2017-01-17  Nathan Sidwell  <nathan@acm.org>
982         PR c++/61636
983         * cp-tree.h (maybe_generic_this_capture): Declare.
984         * lambda.c (resolvable_dummy_lambda): New, broken out of ...
985         (maybe_resolve_dummy): ... here.  Call it.
986         (maybe_generic_this_capture): New.
987         * parser.c (cp_parser_postfix_expression): Speculatively capture
988         this in generic lambda in unresolved member function call.
989         * pt.c (tsubst_copy_and_build): Force hard error from failed
990         member function lookup in generic lambda.
992 2017-01-17  Aldy Hernandez  <aldyh@redhat.com>
994         PR c++/70565
995         * cp-array-notation.c (expand_array_notation_exprs): Handle
996         OMP_PARALLEL.
998 2017-01-11  Jason Merrill  <jason@redhat.com>
1000         PR c++/78337 - ICE on invalid with generic lambda
1001         * semantics.c (process_outer_var_ref): Check if containing_function
1002         is null.  Move inform call under complain test.
1004 2017-01-11  Nathan Sidwell  <nathan@acm.org>
1006         PR c++/77812
1007         * name-lookup.c (set_namespace_binding_1): An overload of 1 decl
1008         is a new overload.
1010 2017-01-11  Nathan Sidwell  <nathan@acm.org>
1012         * name-lookup.c (push_overloaded_decl_1): Refactor OVERLOAD creation.
1014 2017-01-11  Jakub Jelinek  <jakub@redhat.com>
1016         PR c++/78341
1017         * parser.c (cp_parser_std_attribute_spec): Remove over-eager
1018         assertion.  Formatting fix.
1020         PR c++/72813
1021         * decl2.c (c_parse_final_cleanups): Set flag_syntax_only to 1 after
1022         writing PCH file.
1024 2017-01-10  David Malcolm  <dmalcolm@redhat.com>
1026         PR c++/77949
1027         * parser.c (cp_parser_class_specifier_1): Only suggest inserting
1028         a missing semicolon if we have a valid insertion location for
1029         the fix-it hint.
1031 2017-01-10  Jason Merrill  <jason@redhat.com>
1033         FI 20, decomposition declaration with parenthesized initializer.
1034         * parser.c (cp_parser_decomposition_declaration): Use
1035         cp_parser_initializer.
1037 2017-01-09  Jason Merrill  <jason@redhat.com>
1039         Implement P0195R2, C++17 variadic using.
1040         * parser.c (cp_parser_using_declaration): Handle ellipsis and comma.
1041         * pt.c (tsubst_decl): Handle pack expansion in USING_DECL_SCOPE.
1042         * error.c (dump_decl): Likewise.
1044 2017-01-09  Jakub Jelinek  <jakub@redhat.com>
1046         PR translation/79019
1047         PR translation/79020
1048         * semantics.c (finish_omp_clauses): Add missing whitespace to
1049         translatable strings.
1050         * cp-cilkplus.c (cpp_validate_cilk_plus_loop_aux): Fix comment typo.
1052 2017-01-07  Jason Merrill  <jason@redhat.com>
1054         PR c++/78948 - instantiation from discarded statement
1055         * parser.h (struct cp_parser): Remove in_discarded_stmt field.
1056         * cp-tree.h (in_discarded_stmt): Declare it.
1057         (struct saved_scope): Add discarded_stmt bitfield.
1058         (in_discarded_stmt): New macro.
1059         * decl2.c (mark_used): Check it.
1060         * parser.c (cp_parser_selection_statement): Adjust.
1061         (cp_parser_jump_statement): Adjust.
1063 2017-01-05  Jakub Jelinek  <jakub@redhat.com>
1065         PR c++/78931
1066         * decl.c (cp_finish_decomp): Remove probe variable, if tt is
1067         REFERENCE_REF_P, set tt to its operand.
1069         PR c++/78890
1070         * class.c (check_field_decls): Diagnose REFERENCE_TYPE fields in
1071         unions even for C++11 and later.
1073 2017-01-05  Nathan Sidwell  <nathan@acm.org>
1075         PR c++/78765
1076         * pt.c (convert_nontype_argument): Don't try and see if integral
1077         or enum expressions are constants prematurely.
1079 2017-01-04  Marek Polacek  <polacek@redhat.com>
1081         PR c++/64767
1082         * typeck.c (cp_build_binary_op): Warn when a pointer is compared with
1083         a zero character literal.
1085 2017-01-04  Jakub Jelinek  <jakub@redhat.com>
1087         PR c++/78949
1088         * typeck.c (cp_build_unary_op): Call mark_rvalue_use on arg if it has
1089         vector type.
1091         PR c++/78693
1092         * parser.c (cp_parser_simple_declaration): Only complain about
1093         inconsistent auto deduction if auto_result doesn't use auto.
1095         * parser.c (cp_parser_simple_declaration): Diagnose function
1096         declaration among more than one init-declarators with auto
1097         specifier.
1099         PR c++/71182
1100         * parser.c (cp_lexer_previous_token): Use vec_safe_address in the
1101         assertion, as lexer->buffer may be NULL.
1103 2017-01-04  Marek Polacek  <polacek@redhat.com>
1105         PR c++/77545
1106         PR c++/77284
1107         * constexpr.c (potential_constant_expression_1): Handle CLEANUP_STMT.
1109 2017-01-04  Nathan Sidwell  <nathan@acm.org>
1111         PR c++/66735
1112         * cp-tree.h (DECLTYPE_FOR_REF_CAPTURE): New.
1113         (lambda_capture_field_type): Update prototype.
1114         * lambda.c (lambda_capture_field_type): Add is_reference parm.
1115         Add referenceness here.
1116         (add_capture): Adjust lambda_capture_field_type call, refactor
1117         error checking.
1118         * pt.c (tsubst): Adjust lambda_capture_field_type call.
1120 2017-01-01  Jakub Jelinek  <jakub@redhat.com>
1122         Update copyright years.
1124 Copyright (C) 2017 Free Software Foundation, Inc.
1126 Copying and distribution of this file, with or without modification,
1127 are permitted in any medium without royalty provided the copyright
1128 notice and this notice are preserved.