2017-03-14 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / cp / ChangeLog
blob00fb3651959b8b43ea0c4b92432f0a972ef9b7da
1 2017-03-13  Nathan Sidwell  <nathan@acm.org>
3         PR c++/79393 DR 1658 workaround
4         * method.c (synthesized_method_walk): Check vbases of abstract
5         classes for dtor walk.
7 2017-03-10  David Malcolm  <dmalcolm@redhat.com>
9         PR translation/79848
10         * decl.c (grokfndecl): Simplify uses of "%<%s%>" to "%qs".
12 2017-03-10  Jason Merrill  <jason@redhat.com>
14         PR c++/79960 - alias templates and partial ordering
15         * pt.c (comp_template_args): Add partial_order parm.
16         (template_args_equal): Likewise.
17         (comp_template_args_porder): New.
18         (get_partial_spec_bindings): Use it.
20 2017-03-10  Marek Polacek  <polacek@redhat.com>
22         PR c++/79967
23         * decl.c (grokdeclarator): Check ATTRLIST before dereferencing it.
25 2017-03-10  Jakub Jelinek  <jakub@redhat.com>
27         PR c++/79899
28         * optimize.c (maybe_thunk_body): Don't ICE if fns[0] is NULL.
29         Use XALLOCAVEC macro.
31         PR c++/79896
32         * decl.c (finish_enum_value_list): If value is error_mark_node,
33         don't copy it and change its type.
34         * init.c (constant_value_1): Return error_mark_node if DECL_INITIAL
35         of CONST_DECL is error_mark_node.
37 2017-03-09  Marek Polacek  <polacek@redhat.com>
39         PR c++/79900 - ICE in strip_typedefs
40         * tree.c (strip_typedefs): Skip the attribute handling if T is
41         a variant type which hasn't been updated yet.
43         PR c++/79687 - wrong code with pointer-to-member
44         * init.c (constant_value_1): Break if the variable has a dynamic
45         initializer.
47 2017-03-08  Jason Merrill  <jason@redhat.com>
49         PR c++/79797 - ICE with self-reference in array DMI.
50         * constexpr.c (lookup_placeholder): Split out...
51         (cxx_eval_constant_expression): ...from here.
53 2017-03-07  Jakub Jelinek  <jakub@redhat.com>
55         PR c/79834
56         * parser.c (cp_parser_omp_cancellation_point,
57         cp_parser_omp_target_enter_data, cp_parser_omp_target_exit_data,
58         cp_parser_omp_target_update): Change "may only be used in compound
59         statements" diagnostics, such that the same translatable string is
60         used for all pragmas.
61         (cp_parser_pragma): Likewise.  Use error_at instead of
62         cp_parser_error for that diagnostics.
64 2017-03-06  Marek Polacek  <polacek@redhat.com>
66         PR c++/79796 - ICE with NSDMI and this pointer
67         * call.c (build_over_call): Handle NSDMI with a 'this' by calling
68         replace_placeholders.
70 2017-03-06  Jakub Jelinek  <jakub@redhat.com>
72         PR c++/79822
73         * constexpr.c (cxx_eval_statement_list): Treat empty ({ }) like
74         ({ (void) 0; }).
76 2017-03-06  Jason Merrill  <jason@redhat.com>
78         Revert "Allow deduction guides to look into primary template."
79         * cp-tree.h, parser.c, pt.c, search.c: Revert.
81 2017-03-05  Paolo Carlini  <paolo.carlini@oracle.com>
83         PR c++/70266
84         * except.c (build_must_not_throw_expr): Perform the implicit
85         conversions on the condition.
87 2017-03-03  Jason Merrill  <jason@redhat.com>
89         * mangle.c (mangle_decl): Check -Wnoexcept-type instead of
90         -Wc++1z-compat.
92         Core issues 2273 and 2277
93         * call.c (joust): Adjust using-declaration tiebreaker to handle
94         the intermediate base case.
95         * method.c (strip_inheriting_ctors): Just return the argument if
96         !flag_new_inheriting_ctors.
98 2017-03-03  Richard Biener  <rguenther@suse.de>
100         PR c++/79825
101         * cp-gimplify.c (simple_empty_class_p): Handle EMPTY_CLASS_EXPR.
103 2017-03-03  Marek Polacek  <polacek@redhat.com>
105         PR c++/79791
106         * typeck.c (string_conv_p): In C++11, always call pedwarn with
107         OPT_Wwrite_strings.
109 2017-03-02  Jason Merrill  <jason@redhat.com>
111         Update overload resolution with deduction guides.
112         * pt.c (do_class_deduction): Always build the copy guide.
113         (copy_guide_p, template_guide_p): New.
114         (build_deduction_guide): Remember the original constructor.
115         * call.c (joust): Prefer the copy guide and non-template guides.
117         Allow deduction guides to look into primary template.
118         * cp-tree.h (struct saved_scope): Add deduction_guide_type.
119         (struct cp_decl_specifier_seq): Add constructor_p.
120         * parser.c (cp_parser_decl_specifier_seq): Set constructor_p.
121         (cp_parser_init_declarator): Check it.  Set ctor_dtor_or_conv_p.
122         Clear deduction_guide_type.  Don't handle deduction guide names.
123         (cp_parser_declarator): Don't clear ctor_dtor_or_conv_p.
124         (cp_parser_direct_declarator): Likewise.  Handle deduction guides.
125         (cp_parser_member_declaration, cp_parser_cache_defarg)
126         (cp_parser_objc_class_ivars): Set ctor_dtor_or_conv_p.
127         * pt.c (tsubst_copy, tsubst_copy_and_build): Revert last change.
128         (build_deduction_guide): Set deduction_guide_type.
129         (dependent_scope_p): Check deduction_guide_type.
130         * search.c (lookup_member): Likewise.
132 2017-03-02  Jakub Jelinek  <jakub@redhat.com>
134         PR c++/79782
135         * init.c (mark_exp_read_r): New function.
136         (emit_mem_initializers): Use cp_walk_tree with mark_exp_read_r on
137         whole arguments instead of plain mark_exp_read on TREE_LIST values.
139 2017-03-01  Jason Merrill  <jason@redhat.com>
141         Class template argument deduction in new-expression
142         * init.c (build_new): Handle deduction from no initializer.
143         * parser.c (cp_parser_new_expression): Don't require a single
144         expression for class template deduction.
145         * typeck2.c (cxx_incomplete_type_diagnostic): Fix diagnostic for
146         class template placeholder.
147         * pt.c (tsubst_copy) [TEMPLATE_DECL]: Handle dependent context.
148         (tsubst_copy_and_build) [TEMPLATE_ID_EXPR]: Handle SCOPE_REF.
149         (redeclare_class_template): Set TEMPLATE_TYPE_PARM_FOR_CLASS.
151 2017-03-01  Jakub Jelinek  <jakub@redhat.com>
153         PR c++/79746
154         * init.c (emit_mem_initializers): When not constructing vbases of
155         abstract classes, mark arguments as read for
156         -Wunused-but-set-parameter.
158 2017-02-28  Jason Merrill  <jason@redhat.com>
160         Class template argument deduction refinements
161         * call.c (joust): Move deduction guide tiebreaker down.
162         * decl.c (start_decl_1, cp_finish_decl, grokdeclarator): Allow class
163         deduction with no initializer.
164         * pt.c (build_deduction_guide): Handle implicit default/copy ctor.
165         (do_class_deduction): Use that rather than special case.
166         (do_auto_deduction): Handle null initializer.
168 2017-02-28  Jakub Jelinek  <jakub@redhat.com>
170         * decl.c (find_decomp_class_base): Use cond ? G_("...") : G_("...")
171         instead of just cond ? "..." : "...".
172         (grokdeclarator): Likewise.
173         (build_enumerator): Likewise.
174         * init.c (build_new_1): Likewise.
175         * call.c (build_new_method_call_1): Likewise.
176         * parser.c: Include intl.h.
177         (cp_parser_oacc_enter_exit_data): Use %s and ternary operator only for
178         "enter"/"exit" keyword.
179         (cp_finalize_oacc_routine): Don't use %s to supply portions of the
180         message.
182 2017-02-27  Jason Merrill  <jason@redhat.com>
184         PR c++/71568 - SFINAE forming pointer to member function
185         * init.c (build_offset_ref): Check the return value of
186         perform_or_defer_access_check.
188 2017-02-27  Marek Polacek  <polacek@redhat.com>
190         * decl.c (expand_static_init): Add missing } in a comment.
192 2017-02-27  Volker Reichelt  <v.reichelt@netcologne.de>
194         * init.c: Include intl.h.
195         (build_new_1): Move message strings into pedwarn to make them
196         -Wformat-security friendly. Mark string for translation.
197         * pt.c (tsubst_copy_and_build): Mark string for translation.
198         Make the pointer const.
199         * semantics.c (finish_id_expression): Mark strings for translation.
201 2017-02-25  Jakub Jelinek  <jakub@redhat.com>
203         * call.c (build_op_delete_call): Make msg1 and msg2 const.
205 2017-02-24  Jakub Jelinek  <jakub@redhat.com>
207         PR c++/79588
208         * call.c (build_over_call): Call check_function_arguments even for
209         -Wrestrict, adjust check_function_arguments caller.
210         * parser.c (cp_parser_postfix_expression): Don't handle -Wrestrict
211         here.
212         * typeck.c (cp_build_function_call_vec): Adjust
213         check_function_arguments caller.
215 2017-02-24  Marek Polacek  <polacek@redhat.com>
217         PR translation/79705
218         * decl.c (check_redeclaration_exception_specification): Mark a string
219         for translation.  Make the pointer const.
221 2017-02-23  Paolo Carlini  <paolo.carlini@oracle.com>
223         PR c++/79361
224         * pt.c (register_specialization): Check duplicate_decls return value
225         for error_mark_node and pass it back.
227 2017-02-22  Jason Merrill  <jason@redhat.com>
229         PR c++/79679 - missing destructor for argument
230         * call.c (build_over_call): Don't pass tf_no_cleanup to argument
231         conversions.
233         * pt.c (do_class_deduction): Handle 0 argument case.
235 2017-02-22  Jakub Jelinek  <jakub@redhat.com>
237         PR c++/79664
238         * parser.c (cp_parser_omp_teams, cp_parser_omp_target): Use
239         SET_EXPR_LOCATION on OMP_TARGET/OMP_TEAMS tree.
240         * constexpr.c (potential_constant_expression_1): Handle
241         OMP_*, OACC_* and CILK_* trees.  Use error_at with
242         EXPR_LOC_OR_LOC (t, input_location) computed early
243         instead of error, or error_at with location_of (t).
245 2017-02-22  Marek Polacek  <polacek@redhat.com>
247         PR c++/79653
248         * parser.c (cp_parser_std_attribute_spec): Don't build the attribute
249         if the alignas expression is erroneous.
250         * pt.c (tsubst_attribute): If tsubst_pack_expansion fails, return
251         error_mark_node.
253         PR c++/79657
254         * semantics.c (finish_underlying_type): Bail out for incomplete enums.
256 2017-02-21  Jason Merrill  <jason@redhat.com>
258         PR c++/50308 - wrong deprecated warning with ADL
259         PR c++/17729 - duplicate deprecated warning
260         * semantics.c (finish_id_expression): Only call mark_used on a
261         function if we aren't building a call.
263         PR c++/41727 - ICE with partial spec of partial instantiation
264         * pt.c (process_partial_specialization): For now, don't check more
265         specialized if there is more than one level of args.
267 2017-02-21  Marek Polacek  <polacek@redhat.com>
269         PR c++/79535
270         * cp-tree.h (maybe_reject_flexarray_init): Declare.
271         * init.c (maybe_reject_flexarray_init): No longer static.
272         Add check for current_function_decl.
273         * parser.c (cp_parser_late_parse_one_default_arg): Reject
274         a default mem-initializer for a flexible array.
276 2017-02-21  Jakub Jelinek  <jakub@redhat.com>
277             Paolo Carlini  <paolo.carlini@oracle.com>
279         PR c++/79654
280         * decl.c (cp_finish_decomp): Don't set decl's type to error_mark_node
281         on error.
282         * pt.c (tsubst_decomp_names): Return error_mark_node if the first
283         decl after the decomposition artificial decl has error_mark_node.
284         * decl2.c (prune_vars_needing_no_initialization): Use error_operand_p
285         instead of just == error_mark_node comparison.
287 2017-02-21  Jakub Jelinek  <jakub@redhat.com>
289         PR sanitizer/79589
290         * decl.c: Include gimplify.h.
291         (cp_finish_decomp): Make sure there is no sharing of trees
292         in between DECL_VALUE_EXPR of decomposition decls.
294         PR c++/79655
295         * constexpr.c (cxx_eval_array_reference): Diagnose negative subscript.
297         PR c++/79639
298         * constexpr.c (cxx_eval_store_expression): If *valp is a PTRMEM_CST,
299         call cplus_expand_constant on it first.
301 2017-02-19  Jason Merrill  <jason@redhat.com>
303         PR c++/78139 - destructor needed by new-expression
304         * call.c (build_special_member_call): Use tf_no_cleanup.
306         PR c++/78282 - auto template and pack expansion
307         * pt.c (find_parameter_packs_r): Don't walk into the type of
308         templates other than template template-parameters.
310         PR c++/79606 - ICE with this->base_member in NSDMI
311         * class.c (build_base_path): Check processing_template_decl.
313         PR c++/79607 - ICE with T{} initializer
314         * decl.c (type_dependent_init_p): Check the type of a CONSTRUCTOR.
316         PR c++/79566 - elaborated-type-specifier in range for
317         * parser.c (cp_parser_simple_declaration): Fix check for type
318         definition.
320         PR c++/79400 - confusing suggestion of 'noexcept'
321         * parser.c (cp_parser_exception_specification_opt): Remove
322         suggestion for deprecated dynamic exception-specification.
324         PR c++/79470 - partial ordering with reference parameters
325         * pt.c (unify) [INDIRECT_REF]: Handle pack expansions.
327         PR c++/79500 - ICE with non-template deduction guide
328         * pt.c (do_class_deduction): Use STRIP_TEMPLATE rather than
329         DECL_TEMPLATE_RESULT.
331         PR c++/79580 - ICE with compound literal
332         * parser.c (cp_parser_class_head): If we're in the middle of an
333         expression, use ts_within_enclosing_non_class.
335         PR c++/79503 - inherited ctor taking base class
336         * call.c (add_function_candidate): Also check that
337         DECL_INHERITED_CTOR_BASE is reference-related to the parameter type.
339 2017-02-19  Paolo Carlini  <paolo.carlini@oracle.com>
341         PR c++/79380
342         * typeck.c (cxx_alignas_expr): Reject a non-integral alignas
343         argument.
345 2017-02-19  Eric Fiselier  <eric@efcs.ca>
346             Jonathan Wakely  <jwakely@redhat.com>
348         PR c++/69523
349         * parser.c (cp_parser_unqualified_id): Use OPT_Wliteral_suffix to
350         control warning about literal suffix identifiers without a leading
351         underscore.
353 2017-02-17  Jason Merrill  <jason@redhat.com>
355         PR c++/79508 - lookup error with member template
356         * parser.c (cp_parser_template_name): Clear
357         parser->context->object_type if we aren't doing lookup.
359         PR c++/78690 - ICE with using and global type with same name
360         * pt.c (type_dependent_object_expression_p): True for
361         IDENTIFIER_NODE.
363         PR c++/79549 - C++17 ICE with non-type auto template parameter pack
364         * pt.c (convert_template_argument): Just return an auto arg pack.
365         (tsubst_template_args): Don't tsubst an auto pack type.
367         PR c++/79556 - C++17 ICE with non-type auto
368         * pt.c (do_auto_deduction): Don't try to deduce from null type.
370         PR c++/79533 - C++17 ICE with temporary cast to reference
371         * call.c (build_over_call): Conversion to a reference prevents copy
372         elision.
374 2017-02-16  Jakub Jelinek  <jakub@redhat.com>
375             Jason Merrill  <jason@redhat.com>
377         PR c++/79502 - lost nodiscard attribute
378         * pt.c (apply_late_template_attributes): Do apply non-dependent
379         attributes to types.
381 2017-02-16  Jason Merrill  <jason@redhat.com>
383         PR c++/78572 - ICE with self-modifying array initializer
384         * constexpr.c (cxx_eval_store_expression): The object we're
385         initializing is outside the constant-expression.
386         (cxx_eval_call_expression): Set ctx->call.
388         PR c++/79050 - ICE with undeduced auto and LTO
389         * decl.c (poplevel): Remove undeduced auto decls.
391 2017-02-16  Jakub Jelinek  <jakub@redhat.com>
393         PR c++/79512
394         * parser.c (cp_parser_omp_target): For -fopenmp-simd
395         ignore #pragma omp target even when not followed by identifier.
397 2017-02-15  Jason Merrill  <jason@redhat.com>
398             Jakub Jelinek  <jakub@redhat.com>
400         PR c++/79464 - ICE in IPA with omitted constructor parms
401         * class.c (build_clone): Also omit parms from TYPE_ARG_TYPES.
402         (adjust_clone_args): Adjust.
403         (add_method): Remember omitted parms.
404         * call.c (add_function_candidate): Likewise.
405         * mangle.c (write_method_parms): Likewise.
406         * method.c (ctor_omit_inherited_parms): Return false if there are no
407         parms to omit.
409 2017-02-15  Martin Sebor  <msebor@redhat.com>
411         PR c++/79363
412         * init.c (maybe_reject_flexarray_init): New function.
413         (perform_member_init): Call it.
415 2017-02-15  Jakub Jelinek  <jakub@redhat.com>
417         PR c++/79301
418         * parser.c (cp_parser_std_attribute): Don't pedwarn about
419         [[deprecated]] with -std=c++11 and [[fallthrough]] with
420         -std=c++11 and -std=c++14.
422         PR c++/79288
423         * decl.c (grokdeclarator): For static data members, handle thread_p
424         only after handling inline.
426 2017-02-14  Marek Polacek  <polacek@redhat.com>
428         PR c++/79420
429         PR c++/79463
430         * parser.c (cp_parser_postfix_dot_deref_expression): Avoid
431         clobbering if the postfix expression isn't an EXPR_P.
433 2017-02-13  Jason Merrill  <jason@redhat.com>
435         PR c++/79461 - ICE with lambda in constexpr constructor
436         * constexpr.c (build_data_member_initialization): Ignore
437         initialization of a local variable.
439 2017-02-13  Jakub Jelinek  <jakub@redhat.com>
441         * init.c (warn_placement_new_too_small): Add missing space in
442         diagnostics.
443         * parser.c (cp_parser_oacc_declare): Likewise.
444         * mangle.c (maybe_check_abi_tags): Likewise.
446         PR c++/79232
447         * typeck.c (cp_build_modify_expr): Handle properly COMPOUND_EXPRs
448         on lhs that have {PRE{DEC,INC}REMENT,MODIFY,MIN,MAX,COND}_EXPR
449         in the rightmost operand.
451 2017-02-13  Nathan Sidwell  <nathan@acm.org>
453         PR c++/79296 - ICE mangling localized template instantiation
454         * decl2.c (determine_visibility): Use template fn context for
455         local class instantiations.
457 2017-02-11  Jason Merrill  <jason@redhat.com>
459         PR c++/77659 - ICE with new and C++14 aggregate NSDMI
460         * init.c (build_new): Make backups of any CONSTRUCTORs in init.
461         (build_new_1): Use replace_placeholders.
462         * tree.c (replace_placeholders_t): Also track whether we've seen a
463         placeholder.
464         (replace_placeholders, replace_placeholders_r): Adjust.
465         * cp-tree.h: Adjust.
467         PR c++/77790 - ICE with auto function in C++11 mode
468         * decl.c (undeduced_auto_decl): Remove C++14 limitation.
469         (require_deduced_type): Add complain parm, return bool.
470         * cp-tree.h: Adjust.
471         * decl2.c (mark_used): Use require_deduced_type.
473 2017-02-10  Jason Merrill  <jason@redhat.com>
475         PR c++/78908 - template ops and bitfields
476         * tree.c (build_min_non_dep): Use unlowered_expr_type.
478         PR c++/78897 - constexpr union
479         * constexpr.c (cxx_eval_store_expression): A store to a union member
480         erases a previous store to another member.
482         PR c++/71285 - member of fold-expression
483         * semantics.c (finish_unary_fold_expr)
484         (finish_binary_fold_expr): Use null type for fold-expressions.
486         PR c++/79401 - protected inherited constructor
487         * call.c (enforce_access): For inheriting constructor, find a base
488         binfo in the path we already have.
490 2017-02-10  Marek Polacek  <polacek@redhat.com>
492         PR c++/79435
493         * pt.c (type_dependent_expression_p): Check if the expression type
494         is null.
496         PR c++/79184
497         * cvt.c (ocp_convert): Add a sentinel against -Wint-in-bool-context
498         if warnings shouldn't be given.
500 2017-02-10  Paolo Carlini  <paolo.carlini@oracle.com>
502         PR c++/71737
503         * pt.c (tsubst_decl): Don't try to preserve a typedef that names
504         an error_mark_node as type.
506 2017-02-09  Jakub Jelinek  <jakub@redhat.com>
507             Jason Merrill  <jason@redhat.com>
509         PR c++/79143
510         * pt.c (instantiate_class_template_1): Copy CLASSTYPE_NON_AGGREGATE
511         from pattern to type.
513 2017-02-09  Jason Merrill  <jason@redhat.com>
515         PR c++/79316 - default argument in deduction guide
516         PR c++/79350 - explicit deduction guide
517         * parser.c (cp_parser_constructor_declarator_p)
518         (cp_parser_direct_declarator): Parse deduction guides more like
519         constructors.
520         * cp-tree.h (enum special_function_kind): Add sfk_deduction_guide.
521         * tree.c (special_function_p): Return it.
522         * decl.c (check_special_function_return_type): Handle it.
523         (grokdeclarator, grokfndecl): Adjust.
524         (cp_finish_decl): Pass flags to do_auto_deduction.
525         * error.c (dump_decl_name): Use TFF_UNQUALIFIED_NAME.
526         * pt.c (dguide_name_p): Take a const_tree.
527         (do_class_deduction): Handle explicit.
528         (do_auto_deduction): Pass flags through.
529         (build_deduction_guide): Copy explicit flag.
531 2017-02-09  Jakub Jelinek  <jakub@redhat.com>
533         PR c++/79429
534         * parser.c (cp_parser_omp_ordered): Don't check for non-pragma_stmt
535         non-pragma_compound context here.
536         (cp_parser_omp_target): Likewise.
537         (cp_parser_pragma): Don't call push_omp_privatization_clauses and
538         parsing for ordered and target omp pragmas in non-pragma_stmt
539         non-pragma_compound contexts.
541         PR c/79431
542         * parser.c (cp_parser_oacc_declare): Formatting fix.
543         (cp_parser_omp_declare_target): Don't invoke symtab_node::get on
544         automatic variables.
546 2016-02-09  Nathan Sidwell  <nathan@codesourcery.com>
547             Chung-Lin Tang  <cltang@codesourcery.com>
549         * parser.c (cp_parser_oacc_clause_tile): Disallow collapse.  Fix
550         parsing.  Parse constant expression. Remove semantic checking.
551         (cp_parser_omp_clause_collapse): Disallow tile.
552         (cp_parser_omp_for_loop): Deal with tile clause.  Don't emit a parse
553         error about missing for after already emitting one.  Use more
554         conventional for idiom for unbounded loop.
555         * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_TILE.
556         * semantics.c (finish_omp_clauses): Correct TILE semantic check.
557         (finish_omp_for): Deal with tile clause.
559 2017-02-07  Nathan Sidwell  <nathan@acm.org>
561         * method.c (synthesized_method_base_walk): New.  Broken out of ...
562         (synthesized_method_walk): ... here.  Call it.  Cleanup
563         initializations.
565 2017-02-07  Patrick Palka  <ppalka@gcc.gnu.org>
567         PR c++/79360
568         * typeck2.c (process_init_constructor_union): Consider only
569         FIELD_DECLs when looking for an NSDMI.
571 2017-02-06  Jason Merrill  <jason@redhat.com>
573         PR c++/71193 - incomplete types in templates
574         * parser.c (cp_parser_postfix_dot_deref_expression): In a template
575         handle incomplete type by pedwarning and then treating as dependent.
577 2017-02-06  Jakub Jelinek  <jakub@redhat.com>
579         PR c++/79379
580         * constexpr.c (cxx_eval_constant_expression): Handle ANNOTATE_EXPR.
581         (potential_constant_expression_1): Likewise.
583         PR c++/79377
584         * tree.c (build_min_non_dep_op_overload): For POST{INC,DEC}REMENT_EXPR
585         allow one fewer than expected arguments if flag_permissive.
587         PR c++/79372
588         * decl.c (cp_finish_decomp): On error set decl type to error_mark_node.
589         * pt.c (tsubst_expr): Don't call tsubst_decomp_names on decompositions
590         with error_mark_node type.
592 2017-02-03  Jason Merrill  <jason@redhat.com>
594         PR c++/78689 - ICE on constructor with label
595         * optimize.c (maybe_clone_body): Replace omitted parameters with
596         null lvalues.
597         * class.c (build_clone): Fix logic for omitting inherited parms.
599         PR c++/12245 - excessive memory use
600         * constexpr.c (maybe_constant_value): Fold maybe_constant_value_1
601         back in.  Don't cache constants.
602         (maybe_constant_init): Don't cache constants.
604         PR c++/79294 - ICE with invalid template argument
605         * pt.c (convert_nontype_argument_function): Check value-dependence.
606         (convert_nontype_argument): Don't check it here for function ptrs.
608 2017-02-02  Richard Biener  <rguenther@suse.de>
610         PR cp/14179
611         * cp-gimplify.c (cp_fold): When folding a CONSTRUCTOR copy
612         it lazily on the first changed element only and copy it
613         fully upfront, only storing changed elements.
615 2017-02-02  Paolo Carlini  <paolo.carlini@oracle.com>
617         PR c++/69637
618         * decl2.c (grokbitfield): In case of error don't set-up DECL_INITIAL
619         to the width.
621 2017-01-31  Jakub Jelinek  <jakub@redhat.com>
623         PR c++/79304
624         * error.c (dump_expr) <case COMPONENT_REF>: Don't print .
625         after ARROW_EXPR.
627 2017-01-31  David Malcolm  <dmalcolm@redhat.com>
629         PR c++/79298
630         * name-lookup.c (suggest_alternative_in_explicit_scope): Resolve
631         any namespace aliases.
633 2017-01-31  Nathan Sidwell  <nathan@acm.org>
635         PR c++/79290
636         * typeck.c (build_ptrmemfunc_access_expr): Set TREE_NO_WARNING.
638         PR c++/67273
639         PR c++/79253
640         * pt.c: (instantiate_decl): Push to top level when current
641         function scope doesn't match.  Only push lmabda scope stack when
642         pushing to top.
644         * cp-tree.h (instantiate_decl): Make defer_ok bool.
645         * pt.c: Fix instantiate_decl calls to pass true/false not 0/1
646         (instantiate_decl): Simplify and reorder state saving and restoration.
648         PR c++/79264
649         * lambda.c (maybe_generic_this_capture): Deal with template-id-exprs.
650         * semantics.c (finish_member_declaration): Assert class is being
651         defined.
653 2017-01-30  Alexandre Oliva <aoliva@redhat.com>
655         Introduce C++ support in libcc1.
656         * cp-tree.h (struct lang_identifier): Add oracle_looked_up.
657         (ansi_opname): Rename to...
658         (cp_operator_id): ... this.  Adjust all callers.
659         (ansi_assopname): Rename to...
660         (cp_assignment_operator_id): ... this.  Adjust all callers.
661         (cp_literal_operator_id): Declare.
662         (set_global_friend): Declare.
663         (is_global_friend): Declare.
664         (enum cp_oracle_request): New type.
665         (cp_binding_oracle_function): New type.
666         (cp_binding_oracle): Declare.
667         (cp_finish_injected_record_type): Declare.
668         * friend.c (global_friend): New var.
669         (set_global_friend): New fn.
670         (is_global_friend): New fn.
671         (is_friend): Call is_global_friend.
672         * name-lookup.c (cp_binding_oracle): New var.
673         (query_oracle): New fn.
674         (qualified_lookup_using_namespace): Call query_oracle.
675         (lookup_name_real_1): Likewise.
676         * parser.c (cp_literal_operator_id): Drop static.
677         * search.c (friend_accessible_p): Call is_global_friend.
678         * semantics.c (is_this_parameter): Accept a variable if the
679         binding oracle is enabled.
681 2017-01-27  Jason Merrill  <jason@redhat.com>
683         PR c++/78771 - ICE with inherited constructor.
684         * call.c (build_over_call): Call deduce_inheriting_ctor here.
685         * pt.c (tsubst_decl): Not here.
686         * class.c (add_method): Or here.
687         * method.c (deduce_inheriting_ctor): Handle clones.
688         (implicitly_declare_fn): Don't deduce inheriting ctors yet.
690 2017-01-27  Adam Butcher  <adam@jessamine.co.uk>
692         PR c++/64382
693         * cp/parser.c (parsing_default_capturing_generic_lambda_in_template):
694         New function.
695         * cp/cp-tree.h: Declare it.
696         * cp/semantics.c (finish_id_expression): Resolve names within a default
697         capturing generic lambda defined within a template prior to
698         instantiation to allow for captures to be added to the closure type.
700 2017-01-26  Jakub Jelinek  <jakub@redhat.com>
702         PR c++/68727
703         * cp-tree.def (OFFSETOF_EXPR): Bump number of operands to 2.
704         * cp-tree.h (finish_offsetof): Add OBJECT_PTR argument.
705         * parser.c (cp_parser_builtin_offsetof): Pass result of
706         build_static_cast of null_pointer_node to finish_offsetof.
707         * semantics.c (finish_offsetof): Add OBJECT_PTR argument, use
708         it for -Winvalid-offsetof pedwarn instead of trying to guess
709         original offsetof type from EXPR.  Save OBJECT_PTR as a new
710         second operand to OFFSETOF_EXPR.
711         * pt.c (tsubst_copy_and_build) <case OFFSETOF_EXPR>: Adjust
712         finish_offsetof caller, pass the second operand of OFFSETOF_EXPR
713         as OBJECT_PTR.
715 2017-01-26  Jason Merrill  <jason@redhat.com>
717         * name-lookup.c (parse_using_directive): Deprecate strong using.
719         PR c++/79176 - lambda ICE with -flto -Os
720         * decl2.c (vague_linkage_p): Handle decloned 'tors.
721         * tree.c (decl_linkage): Likewise.
723 2017-01-25  Martin Sebor  <msebor@redhat.com>
725         * decl.c (grokdeclarator): Fix a typo in a comment.
727 2017-01-25  Jakub Jelinek  <jakub@redhat.com>
729         PR c++/78896
730         * decl.c (cp_finish_decomp): Disallow memberwise decomposition of
731         lambda expressions.
733         PR c++/77914
734         * parser.c (cp_parser_lambda_declarator_opt): Pedwarn with
735         OPT_Wpedantic on lambda templates for -std=c++14 and higher.
737 2017-01-25  Maxim Ostapenko  <m.ostapenko@samsung.com>
739         PR lto/79061
740         * decl.c (cxx_init_decl_processing): Pass main_input_filename
741         to build_translation_unit_decl.
743 2017-01-24  Jakub Jelinek  <jakub@redhat.com>
745         PR c++/79205
746         * cp-gimplify.c (cp_genericize_r): Add result of
747         convert_from_reference on invisiref parm to p_set.
749 2017-01-24  Nathan Sidwell  <nathan@acm.org>
751         PR c++/78469 - defaulted ctor and inaccessible dtor
752         * cp-tree.h (tsubst_flags): Add tf_no_cleanup.
753         * init.c (build_new_1): Pass tf_no_cleanup to build_value_init.
754         * tree.c (build_target_expr): Check tf_no_cleanup.
756         PR c++/79118 - anon-members and constexpr
757         * constexpr.c (cx_check_missing_mem_inits): Caller passes type not
758         ctor decl.  Recursively check anonymous members.
759         (register_constexpr_fundef): Adjust cx_check_missing_mem_inits
760         call.
761         (explain_invalid_constexpr_fn): Likewise.
763 2017-01-23  Nathan Sidwell  <nathan@acm.org>
765         PR c++/71710 - template using directive of field
766         * pt.c (tsubst_copy_and_build [COMPONENT_REF]): Move FIELD_DECL
767         check earlier.
769         PR c++/71406 - ICE with scope-ref'd template id exprs
770         PR c++/77508
771         * typeck.c (finish_class_member_access_expr): Break up SCOPE_REF
772         before breaking up TEMPLATE_ID_EXPR.
774 2017-01-20  Nathan Sidwell  <nathan@acm.org>
776         PR c++/78495 - wrong code inherited ctor and invisi-ref parm
777         * cp-gimplify.c (cp_generize_r): Don't skip thunks.
779 2017-01-20  David Malcolm  <dmalcolm@redhat.com>
781         PR c++/77829
782         PR c++/78656
783         * cp-tree.h (suggest_alternatives_for): Add bool param.
784         (suggest_alternative_in_explicit_scope): New decl.
785         * error.c (qualified_name_lookup_error): When SCOPE is a namespace
786         that isn't the global one, call new function
787         suggest_alternative_in_explicit_scope, only calling
788         suggest_alternatives_for if it fails, and disabling near match
789         searches fort that case.  When SCOPE is the global namespace,
790         pass true for new param to suggest_alternatives_for to allow for
791         fuzzy name lookups.
792         * lex.c (unqualified_name_lookup_error): Pass true for new param
793         to suggest_alternatives_for.
794         * name-lookup.c (consider_binding_level): Add forward decl.
795         (suggest_alternatives_for): Add "suggest_misspellings" param,
796         using it to conditionalize the fuzzy name-lookup code.
797         (suggest_alternative_in_explicit_scope): New function.
798         * parser.c (cp_parser_primary_expression): When calling
799         finish_id_expression, pass location of id_expression rather
800         than that of id_expr_token.
801         (cp_parser_id_expression): Convert local "unqualified_id" from
802         tree to cp_expr to avoid implicitly dropping location information.
804 2017-01-20  Marek Polacek  <polacek@redhat.com>
806         PR c/64279
807         * call.c (build_conditional_expr_1): Warn about duplicated branches.
808         * semantics.c (finish_expr_stmt): Build statement using the proper
809         location.
811 2017-01-19  Jason Merrill  <jason@redhat.com>
813         US 20 - forwarding references and class template argument deduction
814         * cp-tree.h (TEMPLATE_TYPE_PARM_FOR_CLASS): New.
815         * pt.c (push_template_decl_real): Set it.
816         (maybe_adjust_types_for_deduction): Check it.
817         (rewrite_template_parm): Copy it.
819         US 19 - deduction guides and constructors
820         * call.c (joust): Prefer deduction guides to constructors.
821         * pt.c (build_deduction_guide): Set DECL_ARTIFICIAL.
822         (deduction_guide_p): Check DECL_P.
824         * decl.c (check_initializer): Always use build_aggr_init for array
825         decomposition.
827         PR c++/79130 - decomposition and direct-initialization
828         * init.c (build_aggr_init): Communicate direct-initialization to
829         build_vec_init.
830         (build_vec_init): Check for array copy sooner.
831         * parser.c (cp_parser_decomposition_declaration): Remove call to
832         build_x_compound_expr_from_list.
834 2017-01-18  Jason Merrill  <jason@redhat.com>
836         PR c++/68666 - member variable template-id
837         * typeck.c (finish_class_member_access_expr): Handle variable
838         template-id.
839         * pt.c (lookup_and_finish_template_variable): No longer static.
840         * cp-tree.h: Declare it.
842 2017-01-18  Nathan Sidwell  <nathan@acm.org>
844         PR c++/78488
845         * call.c (build_over_call): When checking ellipsis conversions for
846         an inherited ctor, make sure there is at least one conversion.
848 2017-01-18  Jason Merrill  <jason@redhat.com>
850         PR c++/78894 - ICE with class deduction and default arg
851         * pt.c (build_deduction_guide): Set DECL_PRIMARY_TEMPLATE.
853 2017-01-18  Markus Trippelsdorf  <markus@trippelsdorf.de>
855         PR c++/77489
856         * mangle.c (write_discriminator): Reorganize abi warning check.
858 2017-01-18  Nathan Sidwell  <nathan@acm.org>
860         * cp-tree.h: Clarify exception spec node comment.
861         * except.c (nothrow_spec_p): Simplify by checking node-equality.
863         PR c++/79091
864         * mangle.c (write_exception_spec): Check nothrow explicitly.
865         (write_encoding): Don't increment processing_template_decl around
866         encoding.
868 2017-01-18  Markus Trippelsdorf  <markus@trippelsdorf.de>
870         PR c++/70182
871         * mangle.c (write_template_args): Add "on" for operator names.
873 2017-01-18  Markus Trippelsdorf  <markus@trippelsdorf.de>
875         PR c++/77489
876         * mangle.c (write_discriminator): Handle discriminator >= 10.
878 2017-01-17  Nathan Sidwell  <nathan@acm.org>
880         PR c++/61636
881         * cp-tree.h (maybe_generic_this_capture): Declare.
882         * lambda.c (resolvable_dummy_lambda): New, broken out of ...
883         (maybe_resolve_dummy): ... here.  Call it.
884         (maybe_generic_this_capture): New.
885         * parser.c (cp_parser_postfix_expression): Speculatively capture
886         this in generic lambda in unresolved member function call.
887         * pt.c (tsubst_copy_and_build): Force hard error from failed
888         member function lookup in generic lambda.
890 2017-01-17  Aldy Hernandez  <aldyh@redhat.com>
892         PR c++/70565
893         * cp-array-notation.c (expand_array_notation_exprs): Handle
894         OMP_PARALLEL.
896 2017-01-11  Jason Merrill  <jason@redhat.com>
898         PR c++/78337 - ICE on invalid with generic lambda
899         * semantics.c (process_outer_var_ref): Check if containing_function
900         is null.  Move inform call under complain test.
902 2017-01-11  Nathan Sidwell  <nathan@acm.org>
904         PR c++/77812
905         * name-lookup.c (set_namespace_binding_1): An overload of 1 decl
906         is a new overload.
908 2017-01-11  Nathan Sidwell  <nathan@acm.org>
910         * name-lookup.c (push_overloaded_decl_1): Refactor OVERLOAD creation.
912 2017-01-11  Jakub Jelinek  <jakub@redhat.com>
914         PR c++/78341
915         * parser.c (cp_parser_std_attribute_spec): Remove over-eager
916         assertion.  Formatting fix.
918         PR c++/72813
919         * decl2.c (c_parse_final_cleanups): Set flag_syntax_only to 1 after
920         writing PCH file.
922 2017-01-10  David Malcolm  <dmalcolm@redhat.com>
924         PR c++/77949
925         * parser.c (cp_parser_class_specifier_1): Only suggest inserting
926         a missing semicolon if we have a valid insertion location for
927         the fix-it hint.
929 2017-01-10  Jason Merrill  <jason@redhat.com>
931         FI 20, decomposition declaration with parenthesized initializer.
932         * parser.c (cp_parser_decomposition_declaration): Use
933         cp_parser_initializer.
935 2017-01-09  Jason Merrill  <jason@redhat.com>
937         Implement P0195R2, C++17 variadic using.
938         * parser.c (cp_parser_using_declaration): Handle ellipsis and comma.
939         * pt.c (tsubst_decl): Handle pack expansion in USING_DECL_SCOPE.
940         * error.c (dump_decl): Likewise.
942 2017-01-09  Jakub Jelinek  <jakub@redhat.com>
944         PR translation/79019
945         PR translation/79020
946         * semantics.c (finish_omp_clauses): Add missing whitespace to
947         translatable strings.
948         * cp-cilkplus.c (cpp_validate_cilk_plus_loop_aux): Fix comment typo.
950 2017-01-07  Jason Merrill  <jason@redhat.com>
952         PR c++/78948 - instantiation from discarded statement
953         * parser.h (struct cp_parser): Remove in_discarded_stmt field.
954         * cp-tree.h (in_discarded_stmt): Declare it.
955         (struct saved_scope): Add discarded_stmt bitfield.
956         (in_discarded_stmt): New macro.
957         * decl2.c (mark_used): Check it.
958         * parser.c (cp_parser_selection_statement): Adjust.
959         (cp_parser_jump_statement): Adjust.
961 2017-01-05  Jakub Jelinek  <jakub@redhat.com>
963         PR c++/78931
964         * decl.c (cp_finish_decomp): Remove probe variable, if tt is
965         REFERENCE_REF_P, set tt to its operand.
967         PR c++/78890
968         * class.c (check_field_decls): Diagnose REFERENCE_TYPE fields in
969         unions even for C++11 and later.
971 2017-01-05  Nathan Sidwell  <nathan@acm.org>
973         PR c++/78765
974         * pt.c (convert_nontype_argument): Don't try and see if integral
975         or enum expressions are constants prematurely.
977 2017-01-04  Marek Polacek  <polacek@redhat.com>
979         PR c++/64767
980         * typeck.c (cp_build_binary_op): Warn when a pointer is compared with
981         a zero character literal.
983 2017-01-04  Jakub Jelinek  <jakub@redhat.com>
985         PR c++/78949
986         * typeck.c (cp_build_unary_op): Call mark_rvalue_use on arg if it has
987         vector type.
989         PR c++/78693
990         * parser.c (cp_parser_simple_declaration): Only complain about
991         inconsistent auto deduction if auto_result doesn't use auto.
993         * parser.c (cp_parser_simple_declaration): Diagnose function
994         declaration among more than one init-declarators with auto
995         specifier.
997         PR c++/71182
998         * parser.c (cp_lexer_previous_token): Use vec_safe_address in the
999         assertion, as lexer->buffer may be NULL.
1001 2017-01-04  Marek Polacek  <polacek@redhat.com>
1003         PR c++/77545
1004         PR c++/77284
1005         * constexpr.c (potential_constant_expression_1): Handle CLEANUP_STMT.
1007 2017-01-04  Nathan Sidwell  <nathan@acm.org>
1009         PR c++/66735
1010         * cp-tree.h (DECLTYPE_FOR_REF_CAPTURE): New.
1011         (lambda_capture_field_type): Update prototype.
1012         * lambda.c (lambda_capture_field_type): Add is_reference parm.
1013         Add referenceness here.
1014         (add_capture): Adjust lambda_capture_field_type call, refactor
1015         error checking.
1016         * pt.c (tsubst): Adjust lambda_capture_field_type call.
1018 2017-01-01  Jakub Jelinek  <jakub@redhat.com>
1020         Update copyright years.
1022 Copyright (C) 2017 Free Software Foundation, Inc.
1024 Copying and distribution of this file, with or without modification,
1025 are permitted in any medium without royalty provided the copyright
1026 notice and this notice are preserved.