re PR c++/65046 (-Wabi-tag doesn't warn about variables or function return types)
[platform/upstream/gcc.git] / gcc / cp / ChangeLog
1 2015-03-19  Jason Merrill  <jason@redhat.com>
2
3         PR c++/65046
4         Automatically propagate ABI tags to variables and functions
5         from their (return) type.
6         * class.c (check_tag): Handle variables and functions.
7         (mark_or_check_attr_tags): Split out from find_abi_tags_r.
8         (mark_or_check_tags): Likewise.
9         (mark_abi_tags): Use it.  Rename from mark_type_abi_tags.
10         (check_abi_tags): Add single argument overload for decls.
11         Handle inheriting tags for decls.
12         * mangle.c (write_mangled_name): Call it.
13         (mangle_return_type_p): Split out from write_encoding.
14         (unmangled_name_p): Split out from write_mangled_name.
15         (write_mangled_name): Ignore abi_tag on namespace.
16         * cp-tree.h (NAMESPACE_IS_INLINE): Replace NAMESPACE_ABI_TAG.
17         * parser.c (cp_parser_namespace_definition): Set it.
18         * name-lookup.c (handle_namespace_attrs): Use arguments. Warn
19         about abi_tag attribute on non-inline namespace.
20         * tree.c (check_abi_tag_args): Split out from handle_abi_tag_attribute.
21         (handle_abi_tag_attribute): Allow tags on variables.
22
23 2015-03-19  Jakub Jelinek  <jakub@redhat.com>
24
25         * decl2.c (cplus_decl_attributes): Also add "omp declare target"
26         attribute for DECL_EXTERNAL VAR_DECLs.
27
28 2015-03-18  Paolo Carlini  <paolo.carlini@oracle.com>
29
30         PR c++/65340
31         * call.c (build_over_call): Pass the tsubst_flags_t argument to
32         mark_used.
33         * decl2.c (mark_used): Inline the require_deduced_type call and
34         guard the error call.
35
36 2015-03-16  Jason Merrill  <jason@redhat.com>
37
38         PR c++/65061
39         * parser.c (cp_parser_template_name): Call strip_using_decl.
40
41 2015-03-16  Marek Polacek  <polacek@redhat.com>
42
43         DR 1688
44         PR c++/65327
45         * decl.c (grokdeclarator): Allow volatile and constexpr together.
46
47 2015-03-12  Paolo Carlini  <paolo.carlini@oracle.com>
48
49         PR c++/65323
50         * decl.c (check_default_argument): Don't call
51         maybe_warn_zero_as_null_pointer_constant.
52
53 2015-03-11  Aldy Hernandez  <aldyh@redhat.com>
54
55         * cp-gimplify.c (simple_empty_class_p): New.
56         * cp-gimplify.c (cp_gimplify_expr): Handle RETURN_EXPR.  Abstract
57         the code for empty class copies into simple_empty_class_p, and
58         adapt it to handle COMPOUND_EXPRs.
59
60 2015-03-10  Paolo Carlini  <paolo.carlini@oracle.com>
61
62         PR c++/65370
63         * decl.c (duplicate_decls): Call check_redeclaration_no_default_args
64         only if the location of newdecl doesn't match the location of olddecl.
65
66 2015-03-10  Jakub Jelinek  <jakub@redhat.com>
67
68         PR c++/65127
69         * parser.c (parsing_nsdmi): Don't return true if current_class_ptr
70         is not a PARM_DECL.
71
72 2015-03-10  Jason Merrill  <jason@redhat.com>
73
74         PR c++/65333
75         DR 1558
76         * pt.c (dependent_type_p_r): Check both class and alias template args.
77
78 2015-03-10  Jakub Jelinek  <jakub@redhat.com>
79
80         PR c/65120
81         * parser.c (cp_parser_binary_expression): Check for tcc_comparison
82         before preparing arguments to warn_logical_not_parentheses.
83         Use maybe_constant_value on rhs.
84
85 2015-03-09  Jason Merrill  <jason@redhat.com>
86
87         PR c++/65339
88         * call.c: Don't call maybe_resolve_dummy when calling a constructor.
89
90 2015-03-09  Jakub Jelinek  <jakub@redhat.com>
91
92         PR c/65120
93         * parser.c (cp_parser_binary_expression): Don't warn for
94         !!x == y or !b == y where b is bool.
95
96 2015-03-06  Aldy Hernandez  <aldyh@redhat.com>
97
98         * ptree.c (cxx_print_lambda_node): New.
99         (cxx_print_xnode): Handle LAMBDA_EXPR.
100
101 2015-03-03  Aldy Hernandez  <aldyh@redhat.com>
102
103         PR c++/65295
104         * constexpr.c (cxx_eval_constant_expression): Remove assert in
105         RESULT_DECL handling.
106
107 2015-02-26  Marek Polacek  <polacek@redhat.com>
108
109         PR c++/65202
110         * constexpr.c (cxx_eval_constant_expression): Don't evaluate
111         a RETURN_EXPR if its operand is null.
112
113 2015-02-25  Jason Merrill  <jason@redhat.com>
114
115         PR c++/65209
116         * decl2.c (constrain_visibility) [VISIBILITY_ANON]: Clear
117         DECL_COMDAT.
118         (constrain_visibility_for_template): Handle reference arguments.
119
120         PR debug/58315
121         * decl.c (start_preparsed_function): Use create_artificial_label
122         for cdtor_label.
123
124 2015-02-17  Paolo Carlini  <paolo.carlini@oracle.com>
125             Jakub Jelinek  <jakub@redhat.com>
126
127         PR c++/65075
128         * constexpr.c (check_constexpr_bind_expr_vars): Allow
129         implicit typedefs for lambda types.
130
131 2015-02-13  Paolo Carlini  <paolo.carlini@oracle.com>
132
133         PR c++/60894
134         * decl.c (lookup_and_check_tag): Use strip_using_decl.
135
136 2015-02-13  Jason Merrill  <jason@redhat.com>
137
138         PR c++/65054
139         * pt.c (template_args_equal): Look through conversions here.
140         * tree.c (cp_tree_equal): Not here.
141
142 2015-02-13  Paolo Carlini  <paolo.carlini@oracle.com>
143
144         PR c++/60211
145         * parser.c (cp_parser_pragma): Diagnose PRAGMA_IVDEP at
146         pragma_external context.
147
148 2015-02-13  Jason Merrill  <jason@redhat.com>
149
150         PR c++/65051
151         * call.c (reference_binding): Don't look for bad conversion
152         if TO is incomplete.
153
154 2015-02-13  Paolo Carlini  <paolo.carlini@oracle.com>
155
156         PR c++/64970
157         * decl.c (make_typename_type): Pass tsubst_flags_t argument
158         to lookup_template_class.
159
160 2015-02-13  Jakub Jelinek  <jakub@redhat.com>
161
162         PR ipa/65034
163         * decl.c (start_preparsed_function): Use void_type_node instead
164         of NULL_TREE as LABEL_DECL type.
165
166 2015-02-12  Jason Merrill  <jason@redhat.com>
167
168         PR c++/64898
169         * mangle.c (write_mangled_name): Fix test for variable template
170         instantiation.
171
172         * decl.c (begin_destructor_body): Condition clobber on
173         -flifetime-dse.
174
175 2015-02-12 Andrea Azzarone <azzaronea@gmail.com>
176
177         PR c++/64959
178         * parser.c (lookup_literal_operator): Return all candidates.
179         (cp_parser_userdef_char_literal): Simplify error handling.
180         (cp_parser_userdef_numeric_literal):  Pass tf_warning_or_error.
181         (cp_parser_userdef_string_literal): Pass tf_warning_or_error.
182         Also give higher priority to standard string UDL operator.
183
184 2015-02-12  Jakub Jelinek  <jakub@redhat.com>
185
186         PR debug/55541
187         * cp-tree.h (BLOCK_OUTER_CURLY_BRACE_P): Define.
188         * decl.c (poplevel): If functionbody, try not to create an extra
189         BLOCK for function body and use subblocks as that, if it is non-NULL
190         and doesn't have siblings.  Set BLOCK_OUTER_CURLY_BRACE_P flag.
191         (outer_curly_brace_block): Use BLOCK_OUTER_CURLY_BRACE_P flag.
192
193         PR sanitizer/64984
194         * except.c (check_noexcept_r): Return NULL for internal
195         calls.
196
197 2015-02-10  Jason Merrill  <jason@redhat.com>
198
199         PR c++/64994
200         * constexpr.c (cxx_eval_call_expression): Walk the clone list.
201
202 2015-02-10  Jan Hubicka  <hubicka@ucw.cz>
203
204         PR ipa/64982
205         * method.c (use_thunk): Do not check for stdarg thunks.
206
207 2015-02-06  Jason Merrill  <jason@redhat.com>
208
209         PR c++/64899
210         * init.c (build_vec_init): Handle default-initialized array with
211         constexpr default constructor.
212
213 2015-02-04  Jakub Jelinek  <jakub@redhat.com>
214
215         PR c/64824
216         PR c/64868
217         * parser.c (cp_parser_omp_atomic): Handle RDIV_EXPR.
218
219 2015-02-03  Paolo Carlini  <paolo.carlini@oracle.com>
220
221         PR c++/64877
222         * typeck.c (cp_build_binary_op): Avoid spurious -Waddress warnings
223         for generated expressions.
224
225 2015-02-02  Ville Voutilainen  <ville.voutilainen@gmail.com>
226
227         PR c++/64901
228         * decl.c (duplicate_decls): Also duplicate DECL_FINAL_P and
229         DECL_OVERRIDE_P.
230
231 2015-02-02  Jason Merrill  <jason@redhat.com>
232
233         * tree.c (handle_abi_tag_attribute): Diagnose invalid arguments.
234
235 2015-01-30  Joseph Myers  <joseph@codesourcery.com>
236
237         * class.c, except.c, parser.c, pt.c: All callers of fatal_error
238         changed to pass input_location as first argument.
239
240 2015-01-29  Jakub Jelinek  <jakub@redhat.com>
241
242         PR c++/64717
243         * cp-ubsan.c (cp_ubsan_instrument_vptr): Don't wrap vptr
244         into SAVE_EXPR.
245
246 2015-01-29  Jason Merrill  <jason@redhat.com>
247
248         PR c++/49508
249         * semantics.c (finish_return_stmt): Suppress -Wreturn-type on
250         erroneous return statement.
251
252         PR c++/64521
253         * repo.c (repo_emit_p): It's OK for a clone to be extern at this
254         point.
255
256 2015-01-27  Caroline Tice  <cmtice@google.com>
257
258         Committing VTV Cywin/Ming patch for Patrick Wollgast
259         * vtable-class-hierarchy.cc (vtv_generate_init_routine): Add
260         check for not TARGET_PECOFF at the VTV_PREINIT_PRIORITY checks.
261
262 2015-01-27  Jason Merrill  <jason@redhat.com>
263
264         PR c++/58597
265         * lambda.c (maybe_add_lambda_conv_op): Check cfun rather than
266         current_function_decl.
267
268         PR c++/63889
269         * pt.c (finish_template_variable): Move from semantics.c.
270         Handle multiple template arg levels.  Handle coercion here.
271         (lookup_template_variable): Not here.
272
273 2015-01-23  Jason Merrill  <jason@redhat.com>
274
275         PR c++/64314
276         PR c++/57510
277         * typeck2.c (split_nonconstant_init_1): Remove a sub-CONSTRUCTOR
278         that has been completely split out.
279
280         PR c++/64701
281         * constexpr.c (cxx_eval_constant_expression): Don't crash on C++
282         statement codes.
283
284         PR c++/64727
285         * constexpr.c (cxx_eval_constant_expression): Allow for lvalue use
286         of CONST_DECL.
287
288 2015-01-21  Jason Merrill  <jason@redhat.com>
289
290         PR c++/64603
291         * constexpr.c (cxx_eval_constant_expression): Only shortcut
292         constant CONSTRUCTORs.
293
294         PR c++/64647
295         * constexpr.c (ensure_literal_type_for_constexpr_object): Don't
296         give a hard error in a template instantiation.
297
298 2015-01-21  Richard Biener  <rguenther@suse.de>
299
300         PR middle-end/64313
301         * decl.c (duplicate_decls): Call set_builtin_decl_declared_p
302         for builtins the user declared correctly.
303
304 2015-01-16  Paolo Carlini  <paolo.carlini@oracle.com>
305
306         PR c++/58614
307         * pt.c (unify): When BRACE_ENCLOSED_INITIALIZER_P (arg), handle
308         TREE_TYPE (elt) == error_mark_node.
309
310 2015-01-15  Jan Hubicka  <hubicka@ucw.cz>
311
312         PR tree-optimization/62053
313         * tree.c (build_cplus_array_type): Layout type after variants are set.
314
315 2015-01-15  Jakub Jelinek  <jakub@redhat.com>
316
317         * cp-gimplify.c (cp_genericize_r): Call
318         cp_ubsan_maybe_instrument_member_call for member calls.
319         (cp_ubsan_check_member_access_r): New function.
320         (cp_genericize_tree): Call cp_ubsan_instrument_member_accesses.
321         * cp-tree.h (cp_ubsan_maybe_instrument_member_call,
322         cp_ubsan_instrument_member_accesses,
323         cp_ubsan_maybe_instrument_downcast,
324         cp_ubsan_maybe_instrument_cast_to_vbase): New prototypes.
325         * cp-ubsan.c: New file.
326         * Make-lang.in (CXX_AND_OBJCXX_OBJS): Add cp/cp-ubsan.o.
327         * constexpr.c (cxx_eval_call_expression): Return void_node
328         for IFN_UBSAN_VPTR.
329         (potential_constant_expression_1): Return true for
330         UBSAN_NULL, UBSAN_BOUNDS and UBSAN_VPTR internal calls.
331         * typeck.c (build_class_member_access_expr): Provide locus
332         for COMPONENT_REFs.
333         (build_static_cast_1): Instrument downcasts.
334         * class.c (build_base_path): For -fsanitize=vptr and !fixed_type_p
335         add ubsan instrumentation for virtual_access.
336         * call.c: Include internal-fn.h.
337         (set_flags_from_callee): Handle internal calls.
338
339 2015-01-15  Momchil Velikov  <momchil.velikov@gmail.com>
340
341         PR c++/59366
342         * name-lookup.c (pushdecl_maybe_friend_1): Hide friend functions
343         and function templates, declared only in the class.
344         * decl.c (duplicate_decls): Reveal hidden friend functions or
345         function templates, if they are redeclared outside the class.
346
347 2015-01-15  Jason Merrill  <jason@redhat.com>
348
349         PR c++/64356
350         * constexpr.c (cxx_eval_binary_expression): Fix pasto.
351
352         PR c++/63283
353         * constexpr.c (potential_constant_expression_1): Handle reference
354         args in templates.
355
356 2015-01-15  Thomas Schwinge  <thomas@codesourcery.com>
357             James Norris  <jnorris@codesourcery.com>
358             Cesar Philippidis  <cesar@codesourcery.com>
359             Ilmir Usmanov  <i.usmanov@samsung.com>
360             Jakub Jelinek  <jakub@redhat.com>
361
362         * parser.c: Include "gomp-constants.h".
363         (cp_parser_omp_clause_map): Use enum gomp_map_kind instead of enum
364         omp_clause_map_kind.  Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*.
365         Use OMP_CLAUSE_SET_MAP_KIND.
366         (cp_parser_omp_construct, cp_parser_pragma): Handle
367         PRAGMA_OACC_CACHE, PRAGMA_OACC_DATA, PRAGMA_OACC_ENTER_DATA,
368         PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_PARALLEL,
369         PRAGMA_OACC_LOOP, PRAGMA_OACC_UPDATE, PRAGMA_OACC_WAIT.
370         (cp_parser_omp_clause_name): Handle "async", "copy", "copyout",
371         "create", "delete", "deviceptr", "host", "num_gangs",
372         "num_workers", "present", "present_or_copy", "pcopy",
373         "present_or_copyin", "pcopyin", "present_or_copyout", "pcopyout",
374         "present_or_create", "pcreate", "vector_length", "wait".
375         (OACC_DATA_CLAUSE_MASK, OACC_ENTER_DATA_CLAUSE_MASK)
376         (OACC_EXIT_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK)
377         (OACC_LOOP_CLAUSE_MASK, OACC_PARALLEL_CLAUSE_MASK)
378         (OACC_UPDATE_CLAUSE_MASK, OACC_WAIT_CLAUSE_MASK): New macros.
379         (cp_parser_omp_var_list_no_open): Handle OMP_CLAUSE__CACHE_.
380         (cp_parser_oacc_data_clause, cp_parser_oacc_data_clause_deviceptr)
381         (cp_parser_oacc_clause_vector_length, cp_parser_oacc_wait_list)
382         (cp_parser_oacc_clause_wait, cp_parser_omp_clause_num_gangs)
383         (cp_parser_omp_clause_num_workers, cp_parser_oacc_clause_async)
384         (cp_parser_oacc_all_clauses, cp_parser_oacc_cache)
385         (cp_parser_oacc_data, cp_parser_oacc_enter_exit_data)
386         (cp_parser_oacc_kernels, cp_parser_oacc_loop)
387         (cp_parser_oacc_parallel, cp_parser_oacc_update)
388         (cp_parser_oacc_wait): New functions.
389         * cp-tree.h (finish_oacc_data, finish_oacc_kernels)
390         (finish_oacc_parallel): New prototypes.
391         * semantics.c: Include "gomp-constants.h".
392         (handle_omp_array_sections): Handle GOMP_MAP_FORCE_DEVICEPTR.  Use
393         GOMP_MAP_* instead of OMP_CLAUSE_MAP_*.  Use
394         OMP_CLAUSE_SET_MAP_KIND.
395         (finish_omp_clauses): Handle OMP_CLAUSE_ASYNC,
396         OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_WAIT, OMP_CLAUSE__CACHE_.
397         Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*.
398         (finish_oacc_data, finish_oacc_kernels, finish_oacc_parallel): New
399         functions.
400
401 2015-01-14  Paolo Carlini  <paolo.carlini@oracle.com>
402
403         PR c++/58671
404         * decl2.c (var_defined_without_dynamic_init): Handle gracefully
405         self-initialization.
406
407 2015-01-13  Jason Merrill  <jason@redhat.com>
408
409         PR c++/64356
410         PR libstdc++/58777
411         * constexpr.c (cxx_eval_binary_expression): Don't VERIFY_CONSTANT
412         pointer expressions.
413         (cxx_eval_increment_expression): Likewise.
414
415         PR c++/64514
416         * pt.c (coerce_template_parameter_pack): Return NULL for a
417         zero-length fixed parameter pack with a pack expansion arg.
418
419         PR c++/64520
420         * pt.c (unify): Don't try to deduce to std::initializer_list<T...>.
421
422 2015-01-12  Jason Merrill  <jason@redhat.com>
423
424         PR c++/64547
425         * constexpr.c (cxx_eval_call_expression): A call to a void
426         function doesn't need to return a value.
427
428 2015-01-09  Michael Collison  <michael.collison@linaro.org>
429
430         * call.c: Include hash-set.h, machmode.h, vec.h, double-int.h,
431         input.h, alias.h, symtab.h, options.h, fold-const.h,
432         wide-int.h, and inchash.h due to flattening of tree.h.
433         * class.c: Ditto.
434         * constexpr.c: Ditto.
435         * cp-array-notation.c: Ditto.
436         * cp-gimplify.c: Ditto.
437         * cp-lang.c: Ditto.
438         * cp-objcp-common.c: Ditto.
439         * cvt.c: Ditto.
440         * decl2.c: Ditto.
441         * decl.c: Ditto.
442         * dump.c: Ditto.
443         * error.c: Ditto.
444         * except.c: Ditto.
445         * expr.c: Ditto.
446         * friend.c: Ditto.
447         * init.c: Ditto.
448         * lambda.c: Ditto.
449         * lex.c: Ditto.
450         * mangle.c: Ditto.
451         * name-lookup.c: Ditto.
452         * optimize.c: Ditto.
453         * parser.c: Ditto.
454         * pt.c: Ditto.
455         * ptree.c: Ditto.
456         * repo.c: Ditto.
457         * rtti.c: Ditto.
458         * search.c: Ditto.
459         * semantics.c: Ditto.
460         * tree.c: Ditto.
461         * typeck2.c: Ditto.
462         * typeck.c: Ditto.
463
464 2015-01-08  Jason Merrill  <jason@redhat.com>
465
466         * cp-gimplify.c (cp_genericize): Use do_ubsan_in_current_function.
467         * decl.c (compute_array_index_type): Likewise.
468         * init.c (build_vec_init): Likewise.
469         * typeck.c (cp_build_binary_op): Likewise.
470
471 2015-01-08  Jason Merrill  <jason@redhat.com>
472
473         * init.c (build_vec_init): Call ubsan_instrument_bounds to check
474         whether an initializer-list is too big for a VLA.
475         (throw_bad_array_length): Remove.
476         * cp-tree.h: Remove prototype.
477
478 2015-01-08  Paolo Carlini  <paolo.carlini@oracle.com>
479
480         PR c++/60753
481         * decl.c (grokfndecl): Add bool parameter.
482         (grokdeclarator): Adjust calls.
483         (start_decl): Don't set DECL_DELETED_FN here.
484
485 2015-01-06  Jason Merrill  <jason@redhat.com>
486
487         * parser.c (cp_parser_nested_name_specifier_opt): Diagnose invalid
488         template-ids.
489
490         PR c++/64455
491         * pt.c (type_dependent_expression_p): Handle variable templates.
492         * constexpr.c (potential_constant_expression_1): Use it.
493
494         PR c++/64487
495         * semantics.c (finish_offsetof): Handle templates here.
496         * parser.c (cp_parser_builtin_offsetof): Not here.
497
498         PR c++/64496
499         * semantics.c (process_outer_var_ref): Diagnose lambda in local
500         class NSDMI.
501
502 2015-01-06  Ville Voutilainen  <ville.voutilainen@gmail.com>
503
504         PR c++/64489
505         * class.c (check_field_decls): Make copy assignment operators
506         complex only in c++98 mode.
507
508 2015-01-05  Trevor Saunders  <tsaunders@mozilla.com>
509
510         PR c++/31397
511         * class.c (check_for_override): Warn when a virtual function is an
512         override not marked override.
513
514 2015-01-05  Trevor Saunders  <tsaunders@mozilla.com>
515
516         * class.c (warn_hidden): Use auto_vec<tree> instead of tree_list to
517         hold base_fndecls.
518         (get_basefndecls): Adjust.
519
520 2015-01-05  Jakub Jelinek  <jakub@redhat.com>
521
522         Update copyright years.
523
524 2015-01-05  Marek Polacek  <polacek@redhat.com>
525
526         PR c/64423
527         * typeck.c (cp_build_array_ref): Pass loc down to
528         warn_array_subscript_with_type_char.
529
530 \f
531 Copyright (C) 2015 Free Software Foundation, Inc.
532
533 Copying and distribution of this file, with or without modification,
534 are permitted in any medium without royalty provided the copyright
535 notice and this notice are preserved.