PR c++/67273
[official-gcc.git] / gcc / cp / ChangeLog
blob78a5725dc6d0f6c84428f736b4dccc72f35b23d7
1 2017-01-31  Nathan Sidwell  <nathan@acm.org>
3         PR c++/67273
4         PR c++/79253
5         * pt.c: (instantiate_decl): Push to top level when current
6         function scope doesn't match.  Only push lmabda scope stack when
7         pushing to top.
9         * cp-tree.h (instantiate_decl): Make defer_ok bool.
10         * pt.c: Fix instantiate_decl calls to pass true/false not 0/1
11         (instantiate_decl): Simplify and reorder state saving and restoration.
13         PR c++/79264
14         * lambda.c (maybe_generic_this_capture): Deal with template-id-exprs.
15         * semantics.c (finish_member_declaration): Assert class is being
16         defined.
18 2017-01-30  Alexandre Oliva <aoliva@redhat.com>
20         Introduce C++ support in libcc1.
21         * cp-tree.h (struct lang_identifier): Add oracle_looked_up.
22         (ansi_opname): Rename to...
23         (cp_operator_id): ... this.  Adjust all callers.
24         (ansi_assopname): Rename to...
25         (cp_assignment_operator_id): ... this.  Adjust all callers.
26         (cp_literal_operator_id): Declare.
27         (set_global_friend): Declare.
28         (is_global_friend): Declare.
29         (enum cp_oracle_request): New type.
30         (cp_binding_oracle_function): New type.
31         (cp_binding_oracle): Declare.
32         (cp_finish_injected_record_type): Declare.
33         * friend.c (global_friend): New var.
34         (set_global_friend): New fn.
35         (is_global_friend): New fn.
36         (is_friend): Call is_global_friend.
37         * name-lookup.c (cp_binding_oracle): New var.
38         (query_oracle): New fn.
39         (qualified_lookup_using_namespace): Call query_oracle.
40         (lookup_name_real_1): Likewise.
41         * parser.c (cp_literal_operator_id): Drop static.
42         * search.c (friend_accessible_p): Call is_global_friend.
43         * semantics.c (is_this_parameter): Accept a variable if the
44         binding oracle is enabled.
46 2017-01-27  Jason Merrill  <jason@redhat.com>
48         PR c++/78771 - ICE with inherited constructor.
49         * call.c (build_over_call): Call deduce_inheriting_ctor here.
50         * pt.c (tsubst_decl): Not here.
51         * class.c (add_method): Or here.
52         * method.c (deduce_inheriting_ctor): Handle clones.
53         (implicitly_declare_fn): Don't deduce inheriting ctors yet.
55 2017-01-27  Adam Butcher  <adam@jessamine.co.uk>
57         PR c++/64382
58         * cp/parser.c (parsing_default_capturing_generic_lambda_in_template):
59         New function.
60         * cp/cp-tree.h: Declare it.
61         * cp/semantics.c (finish_id_expression): Resolve names within a default
62         capturing generic lambda defined within a template prior to
63         instantiation to allow for captures to be added to the closure type.
65 2017-01-26  Jakub Jelinek  <jakub@redhat.com>
67         PR c++/68727
68         * cp-tree.def (OFFSETOF_EXPR): Bump number of operands to 2.
69         * cp-tree.h (finish_offsetof): Add OBJECT_PTR argument.
70         * parser.c (cp_parser_builtin_offsetof): Pass result of
71         build_static_cast of null_pointer_node to finish_offsetof.
72         * semantics.c (finish_offsetof): Add OBJECT_PTR argument, use
73         it for -Winvalid-offsetof pedwarn instead of trying to guess
74         original offsetof type from EXPR.  Save OBJECT_PTR as a new
75         second operand to OFFSETOF_EXPR.
76         * pt.c (tsubst_copy_and_build) <case OFFSETOF_EXPR>: Adjust
77         finish_offsetof caller, pass the second operand of OFFSETOF_EXPR
78         as OBJECT_PTR.
80 2017-01-26  Jason Merrill  <jason@redhat.com>
82         * name-lookup.c (parse_using_directive): Deprecate strong using.
84         PR c++/79176 - lambda ICE with -flto -Os
85         * decl2.c (vague_linkage_p): Handle decloned 'tors.
86         * tree.c (decl_linkage): Likewise.
88 2017-01-25  Martin Sebor  <msebor@redhat.com>
90         * decl.c (grokdeclarator): Fix a typo in a comment.
92 2017-01-25  Jakub Jelinek  <jakub@redhat.com>
94         PR c++/78896
95         * decl.c (cp_finish_decomp): Disallow memberwise decomposition of
96         lambda expressions.
98         PR c++/77914
99         * parser.c (cp_parser_lambda_declarator_opt): Pedwarn with
100         OPT_Wpedantic on lambda templates for -std=c++14 and higher.
102 2017-01-25  Maxim Ostapenko  <m.ostapenko@samsung.com>
104         PR lto/79061
105         * decl.c (cxx_init_decl_processing): Pass main_input_filename
106         to build_translation_unit_decl.
108 2017-01-24  Jakub Jelinek  <jakub@redhat.com>
110         PR c++/79205
111         * cp-gimplify.c (cp_genericize_r): Add result of
112         convert_from_reference on invisiref parm to p_set.
114 2017-01-24  Nathan Sidwell  <nathan@acm.org>
116         PR c++/78469 - defaulted ctor and inaccessible dtor
117         * cp-tree.h (tsubst_flags): Add tf_no_cleanup.
118         * init.c (build_new_1): Pass tf_no_cleanup to build_value_init.
119         * tree.c (build_target_expr): Check tf_no_cleanup.
121         PR c++/79118 - anon-members and constexpr
122         * constexpr.c (cx_check_missing_mem_inits): Caller passes type not
123         ctor decl.  Recursively check anonymous members.
124         (register_constexpr_fundef): Adjust cx_check_missing_mem_inits
125         call.
126         (explain_invalid_constexpr_fn): Likewise.
128 2017-01-23  Nathan Sidwell  <nathan@acm.org>
130         PR c++/71710 - template using directive of field
131         * pt.c (tsubst_copy_and_build [COMPONENT_REF]): Move FIELD_DECL
132         check earlier.
134         PR c++/71406 - ICE with scope-ref'd template id exprs
135         PR c++/77508
136         * typeck.c (finish_class_member_access_expr): Break up SCOPE_REF
137         before breaking up TEMPLATE_ID_EXPR.
139 2017-01-20  Nathan Sidwell  <nathan@acm.org>
141         PR c++/78495 - wrong code inherited ctor and invisi-ref parm
142         * cp-gimplify.c (cp_generize_r): Don't skip thunks.
144 2017-01-20  David Malcolm  <dmalcolm@redhat.com>
146         PR c++/77829
147         PR c++/78656
148         * cp-tree.h (suggest_alternatives_for): Add bool param.
149         (suggest_alternative_in_explicit_scope): New decl.
150         * error.c (qualified_name_lookup_error): When SCOPE is a namespace
151         that isn't the global one, call new function
152         suggest_alternative_in_explicit_scope, only calling
153         suggest_alternatives_for if it fails, and disabling near match
154         searches fort that case.  When SCOPE is the global namespace,
155         pass true for new param to suggest_alternatives_for to allow for
156         fuzzy name lookups.
157         * lex.c (unqualified_name_lookup_error): Pass true for new param
158         to suggest_alternatives_for.
159         * name-lookup.c (consider_binding_level): Add forward decl.
160         (suggest_alternatives_for): Add "suggest_misspellings" param,
161         using it to conditionalize the fuzzy name-lookup code.
162         (suggest_alternative_in_explicit_scope): New function.
163         * parser.c (cp_parser_primary_expression): When calling
164         finish_id_expression, pass location of id_expression rather
165         than that of id_expr_token.
166         (cp_parser_id_expression): Convert local "unqualified_id" from
167         tree to cp_expr to avoid implicitly dropping location information.
169 2017-01-20  Marek Polacek  <polacek@redhat.com>
171         PR c/64279
172         * call.c (build_conditional_expr_1): Warn about duplicated branches.
173         * semantics.c (finish_expr_stmt): Build statement using the proper
174         location.
176 2017-01-19  Jason Merrill  <jason@redhat.com>
178         US 20 - forwarding references and class template argument deduction
179         * cp-tree.h (TEMPLATE_TYPE_PARM_FOR_CLASS): New.
180         * pt.c (push_template_decl_real): Set it.
181         (maybe_adjust_types_for_deduction): Check it.
182         (rewrite_template_parm): Copy it.
184         US 19 - deduction guides and constructors
185         * call.c (joust): Prefer deduction guides to constructors.
186         * pt.c (build_deduction_guide): Set DECL_ARTIFICIAL.
187         (deduction_guide_p): Check DECL_P.
189         * decl.c (check_initializer): Always use build_aggr_init for array
190         decomposition.
192         PR c++/79130 - decomposition and direct-initialization
193         * init.c (build_aggr_init): Communicate direct-initialization to
194         build_vec_init.
195         (build_vec_init): Check for array copy sooner.
196         * parser.c (cp_parser_decomposition_declaration): Remove call to
197         build_x_compound_expr_from_list.
199 2017-01-18  Jason Merrill  <jason@redhat.com>
201         PR c++/68666 - member variable template-id
202         * typeck.c (finish_class_member_access_expr): Handle variable
203         template-id.
204         * pt.c (lookup_and_finish_template_variable): No longer static.
205         * cp-tree.h: Declare it.
207 2017-01-18  Nathan Sidwell  <nathan@acm.org>
209         PR c++/78488
210         * call.c (build_over_call): When checking ellipsis conversions for
211         an inherited ctor, make sure there is at least one conversion.
213 2017-01-18  Jason Merrill  <jason@redhat.com>
215         PR c++/78894 - ICE with class deduction and default arg
216         * pt.c (build_deduction_guide): Set DECL_PRIMARY_TEMPLATE.
218 2017-01-18  Markus Trippelsdorf  <markus@trippelsdorf.de>
220         PR c++/77489
221         * mangle.c (write_discriminator): Reorganize abi warning check.
223 2017-01-18  Nathan Sidwell  <nathan@acm.org>
225         * cp-tree.h: Clarify exception spec node comment.
226         * except.c (nothrow_spec_p): Simplify by checking node-equality.
228         PR c++/79091
229         * mangle.c (write_exception_spec): Check nothrow explicitly.
230         (write_encoding): Don't increment processing_template_decl around
231         encoding.
233 2017-01-18  Markus Trippelsdorf  <markus@trippelsdorf.de>
235         PR c++/70182
236         * mangle.c (write_template_args): Add "on" for operator names.
238 2017-01-18  Markus Trippelsdorf  <markus@trippelsdorf.de>
240         PR c++/77489
241         * mangle.c (write_discriminator): Handle discriminator >= 10.
243 2017-01-17  Nathan Sidwell  <nathan@acm.org>
245         PR c++/61636
246         * cp-tree.h (maybe_generic_this_capture): Declare.
247         * lambda.c (resolvable_dummy_lambda): New, broken out of ...
248         (maybe_resolve_dummy): ... here.  Call it.
249         (maybe_generic_this_capture): New.
250         * parser.c (cp_parser_postfix_expression): Speculatively capture
251         this in generic lambda in unresolved member function call.
252         * pt.c (tsubst_copy_and_build): Force hard error from failed
253         member function lookup in generic lambda.
255 2017-01-17  Aldy Hernandez  <aldyh@redhat.com>
257         PR c++/70565
258         * cp-array-notation.c (expand_array_notation_exprs): Handle
259         OMP_PARALLEL.
261 2017-01-11  Jason Merrill  <jason@redhat.com>
263         PR c++/78337 - ICE on invalid with generic lambda
264         * semantics.c (process_outer_var_ref): Check if containing_function
265         is null.  Move inform call under complain test.
267 2017-01-11  Nathan Sidwell  <nathan@acm.org>
269         PR c++/77812
270         * name-lookup.c (set_namespace_binding_1): An overload of 1 decl
271         is a new overload.
273 2017-01-11  Nathan Sidwell  <nathan@acm.org>
275         * name-lookup.c (push_overloaded_decl_1): Refactor OVERLOAD creation.
277 2017-01-11  Jakub Jelinek  <jakub@redhat.com>
279         PR c++/78341
280         * parser.c (cp_parser_std_attribute_spec): Remove over-eager
281         assertion.  Formatting fix.
283         PR c++/72813
284         * decl2.c (c_parse_final_cleanups): Set flag_syntax_only to 1 after
285         writing PCH file.
287 2017-01-10  David Malcolm  <dmalcolm@redhat.com>
289         PR c++/77949
290         * parser.c (cp_parser_class_specifier_1): Only suggest inserting
291         a missing semicolon if we have a valid insertion location for
292         the fix-it hint.
294 2017-01-10  Jason Merrill  <jason@redhat.com>
296         FI 20, decomposition declaration with parenthesized initializer.
297         * parser.c (cp_parser_decomposition_declaration): Use
298         cp_parser_initializer.
300 2017-01-09  Jason Merrill  <jason@redhat.com>
302         Implement P0195R2, C++17 variadic using.
303         * parser.c (cp_parser_using_declaration): Handle ellipsis and comma.
304         * pt.c (tsubst_decl): Handle pack expansion in USING_DECL_SCOPE.
305         * error.c (dump_decl): Likewise.
307 2017-01-09  Jakub Jelinek  <jakub@redhat.com>
309         PR translation/79019
310         PR translation/79020
311         * semantics.c (finish_omp_clauses): Add missing whitespace to
312         translatable strings.
313         * cp-cilkplus.c (cpp_validate_cilk_plus_loop_aux): Fix comment typo.
315 2017-01-07  Jason Merrill  <jason@redhat.com>
317         PR c++/78948 - instantiation from discarded statement
318         * parser.h (struct cp_parser): Remove in_discarded_stmt field.
319         * cp-tree.h (in_discarded_stmt): Declare it.
320         (struct saved_scope): Add discarded_stmt bitfield.
321         (in_discarded_stmt): New macro.
322         * decl2.c (mark_used): Check it.
323         * parser.c (cp_parser_selection_statement): Adjust.
324         (cp_parser_jump_statement): Adjust.
326 2017-01-05  Jakub Jelinek  <jakub@redhat.com>
328         PR c++/78931
329         * decl.c (cp_finish_decomp): Remove probe variable, if tt is
330         REFERENCE_REF_P, set tt to its operand.
332         PR c++/78890
333         * class.c (check_field_decls): Diagnose REFERENCE_TYPE fields in
334         unions even for C++11 and later.
336 2017-01-05  Nathan Sidwell  <nathan@acm.org>
338         PR c++/78765
339         * pt.c (convert_nontype_argument): Don't try and see if integral
340         or enum expressions are constants prematurely.
342 2017-01-04  Marek Polacek  <polacek@redhat.com>
344         PR c++/64767
345         * typeck.c (cp_build_binary_op): Warn when a pointer is compared with
346         a zero character literal.
348 2017-01-04  Jakub Jelinek  <jakub@redhat.com>
350         PR c++/78949
351         * typeck.c (cp_build_unary_op): Call mark_rvalue_use on arg if it has
352         vector type.
354         PR c++/78693
355         * parser.c (cp_parser_simple_declaration): Only complain about
356         inconsistent auto deduction if auto_result doesn't use auto.
358         * parser.c (cp_parser_simple_declaration): Diagnose function
359         declaration among more than one init-declarators with auto
360         specifier.
362         PR c++/71182
363         * parser.c (cp_lexer_previous_token): Use vec_safe_address in the
364         assertion, as lexer->buffer may be NULL.
366 2017-01-04  Marek Polacek  <polacek@redhat.com>
368         PR c++/77545
369         PR c++/77284
370         * constexpr.c (potential_constant_expression_1): Handle CLEANUP_STMT.
372 2017-01-04  Nathan Sidwell  <nathan@acm.org>
374         PR c++/66735
375         * cp-tree.h (DECLTYPE_FOR_REF_CAPTURE): New.
376         (lambda_capture_field_type): Update prototype.
377         * lambda.c (lambda_capture_field_type): Add is_reference parm.
378         Add referenceness here.
379         (add_capture): Adjust lambda_capture_field_type call, refactor
380         error checking.
381         * pt.c (tsubst): Adjust lambda_capture_field_type call.
383 2017-01-01  Jakub Jelinek  <jakub@redhat.com>
385         Update copyright years.
387 Copyright (C) 2017 Free Software Foundation, Inc.
389 Copying and distribution of this file, with or without modification,
390 are permitted in any medium without royalty provided the copyright
391 notice and this notice are preserved.