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