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