re PR c++/71737 (ICE following 2x pack expansion in non-pack with template alias)
[official-gcc.git] / gcc / cp / ChangeLog
blob0c5d1654bad9fae2a58f4ec3325e650bf8952562
1 2017-02-10  Paolo Carlini  <paolo.carlini@oracle.com>
3         PR c++/71737
4         * pt.c (tsubst_decl): Don't try to preserve a typedef that names
5         an error_mark_node as type.
7 2017-02-09  Jakub Jelinek  <jakub@redhat.com>
8             Jason Merrill  <jason@redhat.com>
10         PR c++/79143
11         * pt.c (instantiate_class_template_1): Copy CLASSTYPE_NON_AGGREGATE
12         from pattern to type.
14 2017-02-09  Jason Merrill  <jason@redhat.com>
16         PR c++/79316 - default argument in deduction guide
17         PR c++/79350 - explicit deduction guide
18         * parser.c (cp_parser_constructor_declarator_p)
19         (cp_parser_direct_declarator): Parse deduction guides more like
20         constructors.
21         * cp-tree.h (enum special_function_kind): Add sfk_deduction_guide.
22         * tree.c (special_function_p): Return it.
23         * decl.c (check_special_function_return_type): Handle it.
24         (grokdeclarator, grokfndecl): Adjust.
25         (cp_finish_decl): Pass flags to do_auto_deduction.
26         * error.c (dump_decl_name): Use TFF_UNQUALIFIED_NAME.
27         * pt.c (dguide_name_p): Take a const_tree.
28         (do_class_deduction): Handle explicit.
29         (do_auto_deduction): Pass flags through.
30         (build_deduction_guide): Copy explicit flag.
32 2017-02-09  Jakub Jelinek  <jakub@redhat.com>
34         PR c++/79429
35         * parser.c (cp_parser_omp_ordered): Don't check for non-pragma_stmt
36         non-pragma_compound context here.
37         (cp_parser_omp_target): Likewise.
38         (cp_parser_pragma): Don't call push_omp_privatization_clauses and
39         parsing for ordered and target omp pragmas in non-pragma_stmt
40         non-pragma_compound contexts.
42         PR c/79431
43         * parser.c (cp_parser_oacc_declare): Formatting fix.
44         (cp_parser_omp_declare_target): Don't invoke symtab_node::get on
45         automatic variables.
47 2016-02-09  Nathan Sidwell  <nathan@codesourcery.com>
48             Chung-Lin Tang  <cltang@codesourcery.com>
50         * parser.c (cp_parser_oacc_clause_tile): Disallow collapse.  Fix
51         parsing.  Parse constant expression. Remove semantic checking.
52         (cp_parser_omp_clause_collapse): Disallow tile.
53         (cp_parser_omp_for_loop): Deal with tile clause.  Don't emit a parse
54         error about missing for after already emitting one.  Use more
55         conventional for idiom for unbounded loop.
56         * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_TILE.
57         * semantics.c (finish_omp_clauses): Correct TILE semantic check.
58         (finish_omp_for): Deal with tile clause.
60 2017-02-07  Nathan Sidwell  <nathan@acm.org>
62         * method.c (synthesized_method_base_walk): New.  Broken out of ...
63         (synthesized_method_walk): ... here.  Call it.  Cleanup
64         initializations.
66 2017-02-07  Patrick Palka  <ppalka@gcc.gnu.org>
68         PR c++/79360
69         * typeck2.c (process_init_constructor_union): Consider only
70         FIELD_DECLs when looking for an NSDMI.
72 2017-02-06  Jason Merrill  <jason@redhat.com>
74         PR c++/71193 - incomplete types in templates
75         * parser.c (cp_parser_postfix_dot_deref_expression): In a template
76         handle incomplete type by pedwarning and then treating as dependent.
78 2017-02-06  Jakub Jelinek  <jakub@redhat.com>
80         PR c++/79379
81         * constexpr.c (cxx_eval_constant_expression): Handle ANNOTATE_EXPR.
82         (potential_constant_expression_1): Likewise.
84         PR c++/79377
85         * tree.c (build_min_non_dep_op_overload): For POST{INC,DEC}REMENT_EXPR
86         allow one fewer than expected arguments if flag_permissive.
88         PR c++/79372
89         * decl.c (cp_finish_decomp): On error set decl type to error_mark_node.
90         * pt.c (tsubst_expr): Don't call tsubst_decomp_names on decompositions
91         with error_mark_node type.
93 2017-02-03  Jason Merrill  <jason@redhat.com>
95         PR c++/78689 - ICE on constructor with label
96         * optimize.c (maybe_clone_body): Replace omitted parameters with
97         null lvalues.
98         * class.c (build_clone): Fix logic for omitting inherited parms.
100         PR c++/12245 - excessive memory use
101         * constexpr.c (maybe_constant_value): Fold maybe_constant_value_1
102         back in.  Don't cache constants.
103         (maybe_constant_init): Don't cache constants.
105         PR c++/79294 - ICE with invalid template argument
106         * pt.c (convert_nontype_argument_function): Check value-dependence.
107         (convert_nontype_argument): Don't check it here for function ptrs.
109 2017-02-02  Richard Biener  <rguenther@suse.de>
111         PR cp/14179
112         * cp-gimplify.c (cp_fold): When folding a CONSTRUCTOR copy
113         it lazily on the first changed element only and copy it
114         fully upfront, only storing changed elements.
116 2017-02-02  Paolo Carlini  <paolo.carlini@oracle.com>
118         PR c++/69637
119         * decl2.c (grokbitfield): In case of error don't set-up DECL_INITIAL
120         to the width.
122 2017-01-31  Jakub Jelinek  <jakub@redhat.com>
124         PR c++/79304
125         * error.c (dump_expr) <case COMPONENT_REF>: Don't print .
126         after ARROW_EXPR.
128 2017-01-31  David Malcolm  <dmalcolm@redhat.com>
130         PR c++/79298
131         * name-lookup.c (suggest_alternative_in_explicit_scope): Resolve
132         any namespace aliases.
134 2017-01-31  Nathan Sidwell  <nathan@acm.org>
136         PR c++/79290
137         * typeck.c (build_ptrmemfunc_access_expr): Set TREE_NO_WARNING.
139         PR c++/67273
140         PR c++/79253
141         * pt.c: (instantiate_decl): Push to top level when current
142         function scope doesn't match.  Only push lmabda scope stack when
143         pushing to top.
145         * cp-tree.h (instantiate_decl): Make defer_ok bool.
146         * pt.c: Fix instantiate_decl calls to pass true/false not 0/1
147         (instantiate_decl): Simplify and reorder state saving and restoration.
149         PR c++/79264
150         * lambda.c (maybe_generic_this_capture): Deal with template-id-exprs.
151         * semantics.c (finish_member_declaration): Assert class is being
152         defined.
154 2017-01-30  Alexandre Oliva <aoliva@redhat.com>
156         Introduce C++ support in libcc1.
157         * cp-tree.h (struct lang_identifier): Add oracle_looked_up.
158         (ansi_opname): Rename to...
159         (cp_operator_id): ... this.  Adjust all callers.
160         (ansi_assopname): Rename to...
161         (cp_assignment_operator_id): ... this.  Adjust all callers.
162         (cp_literal_operator_id): Declare.
163         (set_global_friend): Declare.
164         (is_global_friend): Declare.
165         (enum cp_oracle_request): New type.
166         (cp_binding_oracle_function): New type.
167         (cp_binding_oracle): Declare.
168         (cp_finish_injected_record_type): Declare.
169         * friend.c (global_friend): New var.
170         (set_global_friend): New fn.
171         (is_global_friend): New fn.
172         (is_friend): Call is_global_friend.
173         * name-lookup.c (cp_binding_oracle): New var.
174         (query_oracle): New fn.
175         (qualified_lookup_using_namespace): Call query_oracle.
176         (lookup_name_real_1): Likewise.
177         * parser.c (cp_literal_operator_id): Drop static.
178         * search.c (friend_accessible_p): Call is_global_friend.
179         * semantics.c (is_this_parameter): Accept a variable if the
180         binding oracle is enabled.
182 2017-01-27  Jason Merrill  <jason@redhat.com>
184         PR c++/78771 - ICE with inherited constructor.
185         * call.c (build_over_call): Call deduce_inheriting_ctor here.
186         * pt.c (tsubst_decl): Not here.
187         * class.c (add_method): Or here.
188         * method.c (deduce_inheriting_ctor): Handle clones.
189         (implicitly_declare_fn): Don't deduce inheriting ctors yet.
191 2017-01-27  Adam Butcher  <adam@jessamine.co.uk>
193         PR c++/64382
194         * cp/parser.c (parsing_default_capturing_generic_lambda_in_template):
195         New function.
196         * cp/cp-tree.h: Declare it.
197         * cp/semantics.c (finish_id_expression): Resolve names within a default
198         capturing generic lambda defined within a template prior to
199         instantiation to allow for captures to be added to the closure type.
201 2017-01-26  Jakub Jelinek  <jakub@redhat.com>
203         PR c++/68727
204         * cp-tree.def (OFFSETOF_EXPR): Bump number of operands to 2.
205         * cp-tree.h (finish_offsetof): Add OBJECT_PTR argument.
206         * parser.c (cp_parser_builtin_offsetof): Pass result of
207         build_static_cast of null_pointer_node to finish_offsetof.
208         * semantics.c (finish_offsetof): Add OBJECT_PTR argument, use
209         it for -Winvalid-offsetof pedwarn instead of trying to guess
210         original offsetof type from EXPR.  Save OBJECT_PTR as a new
211         second operand to OFFSETOF_EXPR.
212         * pt.c (tsubst_copy_and_build) <case OFFSETOF_EXPR>: Adjust
213         finish_offsetof caller, pass the second operand of OFFSETOF_EXPR
214         as OBJECT_PTR.
216 2017-01-26  Jason Merrill  <jason@redhat.com>
218         * name-lookup.c (parse_using_directive): Deprecate strong using.
220         PR c++/79176 - lambda ICE with -flto -Os
221         * decl2.c (vague_linkage_p): Handle decloned 'tors.
222         * tree.c (decl_linkage): Likewise.
224 2017-01-25  Martin Sebor  <msebor@redhat.com>
226         * decl.c (grokdeclarator): Fix a typo in a comment.
228 2017-01-25  Jakub Jelinek  <jakub@redhat.com>
230         PR c++/78896
231         * decl.c (cp_finish_decomp): Disallow memberwise decomposition of
232         lambda expressions.
234         PR c++/77914
235         * parser.c (cp_parser_lambda_declarator_opt): Pedwarn with
236         OPT_Wpedantic on lambda templates for -std=c++14 and higher.
238 2017-01-25  Maxim Ostapenko  <m.ostapenko@samsung.com>
240         PR lto/79061
241         * decl.c (cxx_init_decl_processing): Pass main_input_filename
242         to build_translation_unit_decl.
244 2017-01-24  Jakub Jelinek  <jakub@redhat.com>
246         PR c++/79205
247         * cp-gimplify.c (cp_genericize_r): Add result of
248         convert_from_reference on invisiref parm to p_set.
250 2017-01-24  Nathan Sidwell  <nathan@acm.org>
252         PR c++/78469 - defaulted ctor and inaccessible dtor
253         * cp-tree.h (tsubst_flags): Add tf_no_cleanup.
254         * init.c (build_new_1): Pass tf_no_cleanup to build_value_init.
255         * tree.c (build_target_expr): Check tf_no_cleanup.
257         PR c++/79118 - anon-members and constexpr
258         * constexpr.c (cx_check_missing_mem_inits): Caller passes type not
259         ctor decl.  Recursively check anonymous members.
260         (register_constexpr_fundef): Adjust cx_check_missing_mem_inits
261         call.
262         (explain_invalid_constexpr_fn): Likewise.
264 2017-01-23  Nathan Sidwell  <nathan@acm.org>
266         PR c++/71710 - template using directive of field
267         * pt.c (tsubst_copy_and_build [COMPONENT_REF]): Move FIELD_DECL
268         check earlier.
270         PR c++/71406 - ICE with scope-ref'd template id exprs
271         PR c++/77508
272         * typeck.c (finish_class_member_access_expr): Break up SCOPE_REF
273         before breaking up TEMPLATE_ID_EXPR.
275 2017-01-20  Nathan Sidwell  <nathan@acm.org>
277         PR c++/78495 - wrong code inherited ctor and invisi-ref parm
278         * cp-gimplify.c (cp_generize_r): Don't skip thunks.
280 2017-01-20  David Malcolm  <dmalcolm@redhat.com>
282         PR c++/77829
283         PR c++/78656
284         * cp-tree.h (suggest_alternatives_for): Add bool param.
285         (suggest_alternative_in_explicit_scope): New decl.
286         * error.c (qualified_name_lookup_error): When SCOPE is a namespace
287         that isn't the global one, call new function
288         suggest_alternative_in_explicit_scope, only calling
289         suggest_alternatives_for if it fails, and disabling near match
290         searches fort that case.  When SCOPE is the global namespace,
291         pass true for new param to suggest_alternatives_for to allow for
292         fuzzy name lookups.
293         * lex.c (unqualified_name_lookup_error): Pass true for new param
294         to suggest_alternatives_for.
295         * name-lookup.c (consider_binding_level): Add forward decl.
296         (suggest_alternatives_for): Add "suggest_misspellings" param,
297         using it to conditionalize the fuzzy name-lookup code.
298         (suggest_alternative_in_explicit_scope): New function.
299         * parser.c (cp_parser_primary_expression): When calling
300         finish_id_expression, pass location of id_expression rather
301         than that of id_expr_token.
302         (cp_parser_id_expression): Convert local "unqualified_id" from
303         tree to cp_expr to avoid implicitly dropping location information.
305 2017-01-20  Marek Polacek  <polacek@redhat.com>
307         PR c/64279
308         * call.c (build_conditional_expr_1): Warn about duplicated branches.
309         * semantics.c (finish_expr_stmt): Build statement using the proper
310         location.
312 2017-01-19  Jason Merrill  <jason@redhat.com>
314         US 20 - forwarding references and class template argument deduction
315         * cp-tree.h (TEMPLATE_TYPE_PARM_FOR_CLASS): New.
316         * pt.c (push_template_decl_real): Set it.
317         (maybe_adjust_types_for_deduction): Check it.
318         (rewrite_template_parm): Copy it.
320         US 19 - deduction guides and constructors
321         * call.c (joust): Prefer deduction guides to constructors.
322         * pt.c (build_deduction_guide): Set DECL_ARTIFICIAL.
323         (deduction_guide_p): Check DECL_P.
325         * decl.c (check_initializer): Always use build_aggr_init for array
326         decomposition.
328         PR c++/79130 - decomposition and direct-initialization
329         * init.c (build_aggr_init): Communicate direct-initialization to
330         build_vec_init.
331         (build_vec_init): Check for array copy sooner.
332         * parser.c (cp_parser_decomposition_declaration): Remove call to
333         build_x_compound_expr_from_list.
335 2017-01-18  Jason Merrill  <jason@redhat.com>
337         PR c++/68666 - member variable template-id
338         * typeck.c (finish_class_member_access_expr): Handle variable
339         template-id.
340         * pt.c (lookup_and_finish_template_variable): No longer static.
341         * cp-tree.h: Declare it.
343 2017-01-18  Nathan Sidwell  <nathan@acm.org>
345         PR c++/78488
346         * call.c (build_over_call): When checking ellipsis conversions for
347         an inherited ctor, make sure there is at least one conversion.
349 2017-01-18  Jason Merrill  <jason@redhat.com>
351         PR c++/78894 - ICE with class deduction and default arg
352         * pt.c (build_deduction_guide): Set DECL_PRIMARY_TEMPLATE.
354 2017-01-18  Markus Trippelsdorf  <markus@trippelsdorf.de>
356         PR c++/77489
357         * mangle.c (write_discriminator): Reorganize abi warning check.
359 2017-01-18  Nathan Sidwell  <nathan@acm.org>
361         * cp-tree.h: Clarify exception spec node comment.
362         * except.c (nothrow_spec_p): Simplify by checking node-equality.
364         PR c++/79091
365         * mangle.c (write_exception_spec): Check nothrow explicitly.
366         (write_encoding): Don't increment processing_template_decl around
367         encoding.
369 2017-01-18  Markus Trippelsdorf  <markus@trippelsdorf.de>
371         PR c++/70182
372         * mangle.c (write_template_args): Add "on" for operator names.
374 2017-01-18  Markus Trippelsdorf  <markus@trippelsdorf.de>
376         PR c++/77489
377         * mangle.c (write_discriminator): Handle discriminator >= 10.
379 2017-01-17  Nathan Sidwell  <nathan@acm.org>
381         PR c++/61636
382         * cp-tree.h (maybe_generic_this_capture): Declare.
383         * lambda.c (resolvable_dummy_lambda): New, broken out of ...
384         (maybe_resolve_dummy): ... here.  Call it.
385         (maybe_generic_this_capture): New.
386         * parser.c (cp_parser_postfix_expression): Speculatively capture
387         this in generic lambda in unresolved member function call.
388         * pt.c (tsubst_copy_and_build): Force hard error from failed
389         member function lookup in generic lambda.
391 2017-01-17  Aldy Hernandez  <aldyh@redhat.com>
393         PR c++/70565
394         * cp-array-notation.c (expand_array_notation_exprs): Handle
395         OMP_PARALLEL.
397 2017-01-11  Jason Merrill  <jason@redhat.com>
399         PR c++/78337 - ICE on invalid with generic lambda
400         * semantics.c (process_outer_var_ref): Check if containing_function
401         is null.  Move inform call under complain test.
403 2017-01-11  Nathan Sidwell  <nathan@acm.org>
405         PR c++/77812
406         * name-lookup.c (set_namespace_binding_1): An overload of 1 decl
407         is a new overload.
409 2017-01-11  Nathan Sidwell  <nathan@acm.org>
411         * name-lookup.c (push_overloaded_decl_1): Refactor OVERLOAD creation.
413 2017-01-11  Jakub Jelinek  <jakub@redhat.com>
415         PR c++/78341
416         * parser.c (cp_parser_std_attribute_spec): Remove over-eager
417         assertion.  Formatting fix.
419         PR c++/72813
420         * decl2.c (c_parse_final_cleanups): Set flag_syntax_only to 1 after
421         writing PCH file.
423 2017-01-10  David Malcolm  <dmalcolm@redhat.com>
425         PR c++/77949
426         * parser.c (cp_parser_class_specifier_1): Only suggest inserting
427         a missing semicolon if we have a valid insertion location for
428         the fix-it hint.
430 2017-01-10  Jason Merrill  <jason@redhat.com>
432         FI 20, decomposition declaration with parenthesized initializer.
433         * parser.c (cp_parser_decomposition_declaration): Use
434         cp_parser_initializer.
436 2017-01-09  Jason Merrill  <jason@redhat.com>
438         Implement P0195R2, C++17 variadic using.
439         * parser.c (cp_parser_using_declaration): Handle ellipsis and comma.
440         * pt.c (tsubst_decl): Handle pack expansion in USING_DECL_SCOPE.
441         * error.c (dump_decl): Likewise.
443 2017-01-09  Jakub Jelinek  <jakub@redhat.com>
445         PR translation/79019
446         PR translation/79020
447         * semantics.c (finish_omp_clauses): Add missing whitespace to
448         translatable strings.
449         * cp-cilkplus.c (cpp_validate_cilk_plus_loop_aux): Fix comment typo.
451 2017-01-07  Jason Merrill  <jason@redhat.com>
453         PR c++/78948 - instantiation from discarded statement
454         * parser.h (struct cp_parser): Remove in_discarded_stmt field.
455         * cp-tree.h (in_discarded_stmt): Declare it.
456         (struct saved_scope): Add discarded_stmt bitfield.
457         (in_discarded_stmt): New macro.
458         * decl2.c (mark_used): Check it.
459         * parser.c (cp_parser_selection_statement): Adjust.
460         (cp_parser_jump_statement): Adjust.
462 2017-01-05  Jakub Jelinek  <jakub@redhat.com>
464         PR c++/78931
465         * decl.c (cp_finish_decomp): Remove probe variable, if tt is
466         REFERENCE_REF_P, set tt to its operand.
468         PR c++/78890
469         * class.c (check_field_decls): Diagnose REFERENCE_TYPE fields in
470         unions even for C++11 and later.
472 2017-01-05  Nathan Sidwell  <nathan@acm.org>
474         PR c++/78765
475         * pt.c (convert_nontype_argument): Don't try and see if integral
476         or enum expressions are constants prematurely.
478 2017-01-04  Marek Polacek  <polacek@redhat.com>
480         PR c++/64767
481         * typeck.c (cp_build_binary_op): Warn when a pointer is compared with
482         a zero character literal.
484 2017-01-04  Jakub Jelinek  <jakub@redhat.com>
486         PR c++/78949
487         * typeck.c (cp_build_unary_op): Call mark_rvalue_use on arg if it has
488         vector type.
490         PR c++/78693
491         * parser.c (cp_parser_simple_declaration): Only complain about
492         inconsistent auto deduction if auto_result doesn't use auto.
494         * parser.c (cp_parser_simple_declaration): Diagnose function
495         declaration among more than one init-declarators with auto
496         specifier.
498         PR c++/71182
499         * parser.c (cp_lexer_previous_token): Use vec_safe_address in the
500         assertion, as lexer->buffer may be NULL.
502 2017-01-04  Marek Polacek  <polacek@redhat.com>
504         PR c++/77545
505         PR c++/77284
506         * constexpr.c (potential_constant_expression_1): Handle CLEANUP_STMT.
508 2017-01-04  Nathan Sidwell  <nathan@acm.org>
510         PR c++/66735
511         * cp-tree.h (DECLTYPE_FOR_REF_CAPTURE): New.
512         (lambda_capture_field_type): Update prototype.
513         * lambda.c (lambda_capture_field_type): Add is_reference parm.
514         Add referenceness here.
515         (add_capture): Adjust lambda_capture_field_type call, refactor
516         error checking.
517         * pt.c (tsubst): Adjust lambda_capture_field_type call.
519 2017-01-01  Jakub Jelinek  <jakub@redhat.com>
521         Update copyright years.
523 Copyright (C) 2017 Free Software Foundation, Inc.
525 Copying and distribution of this file, with or without modification,
526 are permitted in any medium without royalty provided the copyright
527 notice and this notice are preserved.