decl.c (grokfndecl): Set DECL_CONTEXT on parms.
[platform/upstream/gcc.git] / gcc / cp / ChangeLog
1 2009-03-17  Jason Merrill  <jason@redhat.com>
2
3         * decl.c (grokfndecl): Set DECL_CONTEXT on parms.
4         (duplicate_decls): Adjust DECL_CONTEXT of newdecl's parms.
5         * pt.c (check_explicit_specialization): Likewise.
6         (tsubst_copy) [PARM_DECL]: Return a dummy parm if we don't have a
7         local specialization.
8         * tree.c (cp_tree_equal) [PARM_DECL]: Check type and index, not name.
9         * decl2.c (parm_index): New fn.
10         * semantics.c (finish_decltype_type): Don't use describable_type.
11         * mangle.c (write_expression): Likewise.  Mangle ALIGNOF_EXPR.
12         Give a sorry for unsupported codes rather than crash.  Mangle
13         conversions with other than 1 operand.  New mangling for PARM_DECL.
14         * operators.def (ALIGNOF_EXPR): Mangle as "az".
15
16 2009-03-17  Jing Yu  <jingyu@google.com>
17
18         PR middle-end/39378
19         * method.c (use_thunk): Change is_thunk from crtl to cfun.
20
21 2009-03-17  Paolo Carlini  <paolo.carlini@oracle.com>
22
23         PR c++/39475
24         * semantics.c (check_trait_type): New.
25         (finish_trait_expr): Use it.
26
27 2009-03-17  Jakub Jelinek  <jakub@redhat.com>
28
29         * name-lookup.c (cp_emit_debug_info_for_using): Emit USING_STMTs
30         instead of calling imported_module_or_decl debug hook if
31         building_stmt_tree ().
32         * cp-gimplify.c (cp_gimplify_expr): Don't assert the first operand
33         is a NAMESPACE_DECL.
34
35         PR debug/37890
36         * name-lookup.c (do_namespace_alias): Don't call global_decl debug
37         hook at function scope.
38
39         PR debug/39471
40         * cp-gimplify.c (cp_gimplify_expr): Don't set DECL_NAME
41         on IMPORTED_DECL.
42
43 2009-03-09  Jakub Jelinek  <jakub@redhat.com>
44
45         PR c++/39371
46         * semantics.c (finish_switch_cond): Don't call get_unwidened.
47         * decl.c (finish_case_label): Pass SWITCH_STMT_TYPE as 3rd argument
48         instead of TREE_TYPE (cond).
49
50 2009-03-08  H.J. Lu  <hongjiu.lu@intel.com>
51
52         PR c++/39060
53         * parser.c (cp_parser_late_parsing_default_args): Continue
54         the loop when cp_parser_assignment_expression returns
55         error_mark_node.
56
57 2009-03-07  Jason Merrill  <jason@redhat.com>
58
59         PR c++/39367
60         * init.c (build_new_1): Don't use a VLA type.
61         (build_vec_init): Handle getting a pointer for BASE.
62
63 2009-03-06  H.J. Lu  <hongjiu.lu@intel.com>
64
65         PR c++/37520
66         * cp-tree.h: Check NO_DOT_IN_LABEL before NO_DOLLAR_IN_LABEL
67         when mangling symbols.
68
69 2009-03-06  Paolo Carlini  <paolo.carlini@oracle.com>
70
71         PR c++/33492
72         * error.c (dump_expr): Don't try to print THROW_EXPRs in full.
73
74 2009-03-06  Alexandre Oliva  <aoliva@redhat.com>
75
76         * decl.c (record_builtin_java_type): Use canonicalized integer
77         types.
78
79 2009-03-04  Jason Merrill  <jason@redhat.com>
80
81         PR c++/38908
82         * class.c (is_really_empty_class): New fn.
83         * cp-tree.h: Declare it.
84         * cp-objcp-common.c (cp_expr_size): Use it.
85
86         PR c++/13549
87         * semantics.c (perform_koenig_lookup): Handle TEMPLATE_ID_EXPR.
88         * parser.c (cp_parser_postfix_expression): Call it for 
89         TEMPLATE_ID_EXPR.
90         * tree.c (is_overloaded_fn): Look through TEMPLATE_ID_EXPR.
91         (get_first_fn): Likewise.
92
93         PR c++/9634
94         PR c++/29469
95         PR c++/29607
96         Implement DR 224.
97         * decl.c (make_typename_type): Do look inside currently open classes.
98         * parser.c (cp_parser_lookup_name): Likewise.
99         (cp_parser_template_name): Likewise.
100         * pt.c (dependent_scope_p): New function.
101         * cp-tree.h: Declare it.
102         * class.c (currently_open_class): Return fast if T isn't a class.
103
104 2009-02-26  H.J. Lu  <hongjiu.lu@intel.com>
105
106         PR c++/37789
107         * parser.c (cp_parser_mem_initializer): Return error_mark_node
108         if cp_parser_mem_initializer_id returns error_mark_node.
109
110 2009-02-24  Richard Guenther  <rguenther@suse.de>
111
112         PR c++/39242
113         * pt.c (instantiate_decl): Do not instantiate extern, non-inline
114         declared functions.
115
116 2009-02-23  H.J. Lu  <hongjiu.lu@intel.com>
117
118         PR c++/36411
119         * pt.c (coerce_template_template_parms): Return 0 if parameter
120         is error_mark_node.
121
122 2009-02-23  Jason Merrill  <jason@redhat.com>
123
124         * pt.c (unify): Call maybe_adjust_types_for_deduction when
125         deducing from an initializer list.
126
127 2009-02-20  Jason Merrill  <jason@redhat.com>
128
129         PR c++/39225
130         * decl.c (grokdeclarator): Handle ~identifier.
131
132 2009-02-19  Jakub Jelinek  <jakub@redhat.com>
133
134         PR target/39175
135         * decl2.c (determine_visibility): If visibility changed and
136         DECL_RTL has been already set, call make_decl_rtl to update symbol
137         flags.
138
139 2009-02-19  H.J. Lu  <hongjiu.lu@intel.com>
140
141         PR c++/39188
142         * cp-tree.h (maybe_commonize_var): New.
143
144         * decl.c (maybe_commonize_var): Make it extern.
145
146         * decl2.c (finish_anon_union): Call maybe_commonize_var.
147
148 2009-02-18  H.J. Lu  <hongjiu.lu@intel.com>
149
150         PR c++/39219
151         * parser.c (cp_parser_enum_specifier): Apply all attributes.
152
153 2009-02-18  Jason Merrill  <jason@redhat.com>
154
155         * cfns.h: Tweak pathname for cfns.gperf.
156
157 2009-02-13  Jason Merrill  <jason@redhat.com>
158
159         PR c++/39070
160         * semantics.c (finish_call_expr): Change koenig_p parm to int.
161         If -1, don't set KOENIG_LOOKUP_P but do keep hidden candidates.
162         * cp-tree.h: Adjust prototype.
163         * pt.c (tsubst_copy_and_build) [CALL_EXPR]: Pass -1.
164
165 2009-02-12  Jason Merrill  <jason@redhat.com>
166
167         PR c++/38950
168         * pt.c (unify)[TEMPLATE_PARM_INDEX]: Convert to the tsubsted type.
169
170 2009-02-11  Jason Merrill  <jason@redhat.com>
171
172         PR c++/39153
173         * decl2.c (cp_write_global_declarations): 
174         Check DECL_DEFAULTED_FN, not DECL_ARTIFICIAL.
175
176         PR c++/30111
177         * init.c (build_value_init_noctor): Split out from...
178         (build_value_init): ...here.
179         (expand_aggr_init_1): Handle value-initialization.
180         * cp-tree.h: Add declaration.
181         * class.c (type_has_user_provided_constructor): 
182         Handle non-class arguments.
183
184 2009-02-10  Jason Merrill  <jason@redhat.com>
185
186         PR c++/38649
187         * class.c (defaultable_fn_p): Handle ... properly.
188
189         PR c++/36744
190         * tree.c (lvalue_p_1): Condition rvalue ref handling on
191         treat_class_rvalues_as_lvalues, too.
192
193 2009-02-10  Paolo Carlini  <paolo.carlini@oracle.com>
194
195         PR c++/34397
196         * typeck.c (build_x_array_ref): New.
197         * cp-tree.h: Declare it.
198         * pt.c (tsubst_copy_and_build): Use it for case ARRAY_REF.
199
200 2009-02-09  Jason Merrill  <jason@redhat.com>
201
202         PR c++/39109
203         * semantics.c (simplify_aggr_init_expr): Do zero-initialization here.
204         * init.c (build_value_init): Not here. Don't build a TARGET_EXPR.
205         * tree.c (get_target_expr): Handle AGGR_INIT_EXPR.
206         * cp-gimplify.c (cp_gimplify_init_expr): Remove special handling
207         for build_value_init TARGET_EXPR.
208         * cp-tree.h (AGGR_INIT_ZERO_FIRST): New macro.
209
210 2009-02-06  Paolo Carlini  <paolo.carlini@oracle.com>
211
212         PR c++/35147
213         PR c++/37737
214         * cp-tree.h (TMPL_ARGS_HAVE_MULTIPLE_LEVELS): Check TREE_VEC_LENGTH.
215
216 2009-02-04  Jakub Jelinek  <jakub@redhat.com>
217
218         PR c++/39095
219         * operators.def: Use COMPONENT_REF code for ->/pt operator again,
220         remove ./dt operator.
221         * mangle.c (write_expression): Handle COMPONENT_REF after handling
222         ADDR_EXPR, for COMPONENT_REF without ARROW_EXPR inside of it
223         write_string ("dt") instead of using operators.def.
224
225 2009-02-03  Jason Merrill  <jason@redhat.com>
226
227         * typeck.c (cp_build_unary_op): Only complain about taking address
228         of main if pedantic.
229
230 2009-02-03  Jakub Jelinek  <jakub@redhat.com>
231
232         PR inline-asm/39059
233         * parser.c (cp_parser_primary_expression): Reject FIXED_CSTs.
234
235         PR c++/39056
236         * typeck2.c (digest_init_r): Don't call process_init_constructor
237         for COMPLEX_TYPE.
238
239 2009-02-03  Paolo Bonzini  <bonzini@gnu.org>
240
241         PR c++/36897
242         * pt.c (convert_nontype_argument_function): Expect expr to be an
243         ADDR_EXPR.
244
245         PR c++/37314
246         * typeck.c (merge_types): Call resolve_typename_type if only
247         one type is a typename.
248
249 2009-02-02  Jason Merrill  <jason@redhat.com>
250
251         PR c++/39054
252         * parser.c (cp_parser_unqualified_id): Don't wrap error_mark_node 
253         in BIT_NOT_EXPR.
254
255 2009-02-01  Paolo Carlini  <paolo.carlini@oracle.com>
256
257         PR c++/39053
258         * parser.c (cp_parser_pure_specifier): If there are no tokens left
259         do not call cp_lexer_consume_token.
260
261 2009-01-30  Jakub Jelinek  <jakub@redhat.com>
262
263         PR c++/39028
264         * parser.c (cp_parser_already_scoped_statement): Handle __label__
265         declarations.
266
267 2009-01-30  Paolo Carlini  <paolo.carlini@oracle.com>
268
269         PR c++/33465
270         * error.c (dump_expr): Handle FIX_TRUNC_EXPR and FLOAT_EXPR.
271
272 2009-01-30  Paolo Carlini  <paolo.carlini@oracle.com>
273
274         PR c++/38655
275         * error.c (dump_type_prefix, dump_type_suffix): Handle FIXED_POINT_TYPE.
276
277 2009-01-29  Paolo Carlini  <paolo.carlini@oracle.com>
278
279         * typeck.c (invalid_nonstatic_memfn_p): Use
280         DECL_NONSTATIC_MEMBER_FUNCTION_P.
281
282 2009-01-27  Paolo Carlini  <paolo.carlini@oracle.com>
283
284         PR c++/37554
285         * call.c (build_over_call): If convert_for_arg_passing returns
286         error_mark_node unconditionally return it.
287
288 2009-01-22  Adam Nemet  <anemet@caviumnetworks.com>
289
290         * class.c (check_field_decls): Also inherit packed for bitfields
291         regardless of their type.
292
293 2009-01-22  Dodji Seketeli  <dodji@redhat.com>
294
295         PR c++/38930
296         * decl2.c (grokfield): Reverting changes of PR c++/26693
297         (save_template_attributes): Likewise.
298         * decl.c (grokdeclarator): Likewise.
299         * name-lookup.c (pushdecl_maybe_friend): Likewise.
300         * cp-tree.h (MEMBER_TYPES_NEEDING_ACCESS_CHECK): Likewise.
301         (append_type_to_template_for_access_check): Likewise.
302         * semantics.c (check_accessibility_of_qualified_id): Likewise.
303         * pt.c (instantiate_class_template, instantiate_template ): Likewise.
304         (tsubst): Likewise.
305         (resolve_type_name_type): Likewise.
306         (append_type_to_template_for_access_check): Likewise.
307
308 2009-01-21  Dodji Seketeli  <dodji@redhat.com>
309
310         PR c++/26693
311         * decl2.c (grokfield): when a typedef appears in a
312         class, create the typedef variant type node for it.
313         (save_template_attributes): Creating typedef variant type node
314          here is now useless.
315         * decl.c (grokdeclarator): If the typedef'ed struct/class was
316         anonymous, set the proper type name to all its type variants.
317         * name-lookup.c (pushdecl_maybe_friend): Reuse the
318         set_underlying_type function to install typedef variant types.
319         * cp-tree.h (MEMBER_TYPES_NEEDING_ACCESS_CHECK): New template accessor
320         macro.
321         (append_type_to_template_for_access_check): New entry points.
322         * semantics.c (check_accessibility_of_qualified_id):
323         When a typedef that is a member of a class appears in a template,
324         add it to the template. It will be ...
325         * pt.c (instantiate_class_template, instantiate_template ): ... access
326         checked at template instantiation time.
327         (tsubst): Handle the case of being called with NULL args.
328         (resolve_type_name_type): The type name should be the name of the
329         main type variant.
330         (append_type_to_template_for_access_check): New entry point.
331
332 2009-01-19  Jason Merrill  <jason@redhat.com>
333
334         PR c++/23287
335         * parser.c (cp_parser_unqualified_id): In a template,
336         accept ~identifier.
337         * typeck.c (lookup_destructor): Handle IDENTIFIER_NODE.
338
339 2009-01-16  Jason Merrill  <jason@redhat.com>
340
341         PR c++/38877
342         * tree.c (lvalue_p_1): Allow non-fields in COMPONENT_REF.
343         * init.c (build_new): Don't call describable_type unless we
344         have an auto.
345
346         PR c++/29470
347         * pt.c (tsubst_decl) [USING_DECL]: Propagate access flags.
348
349         PR c++/38579
350         * search.c (protected_accessible_p): N doesn't vary.
351
352 2009-01-15  Jason Merrill  <jason@redhat.com>
353
354         PR c++/38850
355         * pt.c (tsubst_copy_and_build): Tell finish_call_expr to
356         accept hidden friends.
357
358 2009-01-15  Andrew Pinski  <andrew_pinski@playstation.sony.com>
359
360         PR C++/29388
361         * decl.c (grokdeclarator): Check for a non namespace/class context.
362
363 2009-01-15  Jason Merrill  <jason@redhat.com>
364
365         PR c++/36334
366         PR c++/37646
367         * tree.c (lvalue_p_1): Handle BASELINK.  A COMPONENT_REF to
368         a function isn't necessarily an lvalue. Take tree, not const_tree.
369         (lvalue_p, real_lvalue_p): Take tree, not const_tree.
370         * typeck.c (lvalue_or_else): Likewise.
371         * cp-tree.h: Adjust prototypes.
372
373 2009-01-15  Steve Ellcey  <sje@cup.hp.com>
374
375         PR c++/38357
376         * pt.c (tsubst): Check for NULL args.
377
378 2009-01-15  Dodji Seketeli  <dodji@redhat.com>
379
380         PR c++/38636
381         * name-lookup.c (pushtag): Don't create members to types that are not
382         being created.
383
384 2009-01-14  Nick Clifton  <nickc@redhat.com>
385
386         PR c++/37862
387         * parser.c: Pass cp_id_kind computed in
388         cp_parser_postfix_dot_deref_expression to
389         cp_parser_primary_expression.
390
391 2009-01-13  Jakub Jelinek  <jakub@redhat.com>
392
393         PR c++/38795
394         * tree.c (cp_walk_subtrees): Handle REINTERPRET_CAST_EXPR,
395         STATIC_CAST_EXPR, CONST_CAST_EXPR and DYNAMIC_CAST_EXPR the same
396         as CAST_EXPR.
397
398 2009-01-12  Jason Merrill  <jason@redhat.com>
399             Steve Ellcey  <sje@cup.hp.com>
400
401         PR c++/35109
402         * name-lookup.c (lookup_name_real): Keep looking past a hidden 
403         binding.
404
405 2009-01-12  Dodji Seketeli  <dodji@redhat.com>
406
407         PR c++/36019
408         * pt.c (parameter_of_template_p): New function.
409         * cp-tree.h: Declare it.
410         * name-lookup.c (binding_to_template_parms_of_scope_p): New
411         function.
412         (outer_binding): Take template parameters in account when looking for
413         a name binding.
414
415 2009-01-12  Jason Merrill  <jason@redhat.com>
416
417         PR c++/31488
418         * tree.c (pod_type_p): Return 1 for structs created by the back end.
419
420 2009-01-12  Jakub Jelinek  <jakub@redhat.com>
421
422         PR c/32041
423         * parser.c (cp_parser_builtin_offsetof): Allow `->' in
424         offsetof member-designator, handle it as `[0].'.
425
426         PR c++/38794
427         * decl.c (start_function): If grokdeclarator hasn't returned
428         FUNCTION_DECL nor error_mark_node, issue diagnostics.
429
430 2009-01-11  Jakub Jelinek  <jakub@redhat.com>
431
432         PR c++/36254
433         * cp-gimplify.c (genericize_if_stmt): Renamed from ...
434         (gimplify_if_stmt): ... this.
435         (cp_gimplify_expr): Don't handle IF_STMT here.
436         (cp_genericize_r): Call genericize_if_stmt for IF_STMT.
437
438 2009-01-10  Andrew Pinski  <pinskia@gmail.com>
439
440         PR c++/38648
441         * typeck.c (cp_build_modify_expr): Check for NULL current_function_decl.
442
443         PR c++/36695
444         * typeck2.c (build_functional_cast): Check for reference type and NULL
445         PARMS.
446
447 2009-01-09  Steve Ellcey  <sje@cup.hp.com>
448
449         * typeck.c (cp_build_unary_op): Check for ERROR_MARK.
450
451 2009-01-09  Jakub Jelinek  <jakub@redhat.com>
452
453         PR c++/35335
454         * error.c (dump_expr): Handle EXPR_STMT like BIND_EXPR.
455
456 2009-01-09  John F. Carr  <jfc@mit.edu>
457
458         PR c++/37877
459         * parser.c (cp_parser_class_specifier): Clear
460         parser->in_unbraced_linkage_specification_p while parsing class
461         specifiers.
462
463 2009-01-07  Jakub Jelinek  <jakub@redhat.com>
464
465         PR c++/38725
466         * semantics.c (finish_goto_stmt): Convert destination to
467         void *.
468
469 2009-01-06  Jason Merrill  <jason@redhat.com>
470
471         PR c++/35297
472         PR c++/35477
473         PR c++/35784
474         PR c++/36846
475         PR c++/38276
476         * pt.c (check_default_tmpl_args): Don't complain about
477         out-of-order parameter packs in the enclosing class
478         or parameter packs after default args.
479         (coerce_template_parms): If we have more than one
480         parameter pack, don't flatten argument packs.
481         (template_args_equal): Handle argument packs.
482         (comp_template_args): Don't flatten argument packs.
483         (check_instantiated_arg): Split out from...
484         (check_instantiated_args): Here.  Handle arg packs.
485         (convert_template_argument): Just check that nontype argument
486         packs have the right type.
487
488 2009-01-05  Dodji Seketeli  <dodji@redhat.com>
489
490         PR c++/38472
491         * typeck.c (type_after_usual_arithmetic_conversions): Fix a typo.
492
493 2009-01-05  Jason Merrill  <jason@redhat.com>
494
495         PR c++/38698
496         * typeck2.c (process_init_constructor_union): Handle union with
497         no fields.
498
499         * mangle.c (write_expression): Remove mangling for zero-operand
500         casts.
501
502         PR c++/38701
503         * decl.c (cp_finish_decl): Clear DECL_INITIAL for invalid
504         defaulting.
505
506         PR c++/38702
507         * class.c (defaultable_fn_p): Only operator== can be a copy
508         assignment operator.
509
510 2009-01-02  Jason Merrill  <jason@redhat.com>
511
512         PR c++/38698
513         * typeck2.c (process_init_constructor_union): Handle excess
514         initializers.
515         (process_init_constructor_record): Likewise.
516
517         PR c++/38684
518         * typeck2.c (digest_init_r): Don't use process_init_constructor
519         for non-aggregate classes.