re PR c++/56130 (__attribute__((deprecated)) does not affect C++ reference)
2013-08-21 Paolo Carlini <paolo.carlini@oracle.com> * call.c (build_new_method_call_1): Use INDIRECT_REF_P. * cp-tree.h (REFERENCE_REF_P): Likewise. * semantics.c (finish_offsetof): Likewise. /cp 2013-08-21 Paolo Carlini <paolo.carlini@oracle.com> PR c++/56130 * semantics.c (finish_id_expression): Handle deprecated references. /testsuite 2013-08-21 Paolo Carlini <paolo.carlini@oracle.com> PR c++/56130 * g++.dg/warn/deprecated-7.C: New. From-SVN: r201906
This commit is contained in:
parent
dd5e84232f
commit
98cf9ac919
@ -1,3 +1,14 @@
|
||||
2013-08-21 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
* call.c (build_new_method_call_1): Use INDIRECT_REF_P.
|
||||
* cp-tree.h (REFERENCE_REF_P): Likewise.
|
||||
* semantics.c (finish_offsetof): Likewise.
|
||||
|
||||
2013-08-21 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/56130
|
||||
* semantics.c (finish_id_expression): Handle deprecated references.
|
||||
|
||||
2013-08-20 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/58119
|
||||
|
@ -7668,7 +7668,7 @@ build_new_method_call_1 (tree instance, tree fns, vec<tree, va_gc> **args,
|
||||
|
||||
if (init)
|
||||
{
|
||||
if (TREE_CODE (instance) == INDIRECT_REF
|
||||
if (INDIRECT_REF_P (instance)
|
||||
&& integer_zerop (TREE_OPERAND (instance, 0)))
|
||||
return get_target_expr_sfinae (init, complain);
|
||||
init = build2 (INIT_EXPR, TREE_TYPE (instance), instance, init);
|
||||
|
@ -2975,7 +2975,7 @@ extern void decl_shadowed_for_var_insert (tree, tree);
|
||||
|
||||
/* True if NODE is an implicit INDIRECT_EXPR from convert_from_reference. */
|
||||
#define REFERENCE_REF_P(NODE) \
|
||||
(TREE_CODE (NODE) == INDIRECT_REF \
|
||||
(INDIRECT_REF_P (NODE) \
|
||||
&& TREE_TYPE (TREE_OPERAND (NODE, 0)) \
|
||||
&& (TREE_CODE (TREE_TYPE (TREE_OPERAND ((NODE), 0))) \
|
||||
== REFERENCE_TYPE))
|
||||
|
@ -3457,8 +3457,10 @@ finish_id_expression (tree id_expression,
|
||||
}
|
||||
}
|
||||
|
||||
if (TREE_DEPRECATED (decl))
|
||||
warn_deprecated_use (decl, NULL_TREE);
|
||||
/* Handle references (c++/56130). */
|
||||
tree t = REFERENCE_REF_P (decl) ? TREE_OPERAND (decl, 0) : decl;
|
||||
if (TREE_DEPRECATED (t))
|
||||
warn_deprecated_use (t, NULL_TREE);
|
||||
|
||||
return decl;
|
||||
}
|
||||
@ -3691,7 +3693,7 @@ finish_offsetof (tree expr)
|
||||
|| TREE_CODE (TREE_TYPE (expr)) == METHOD_TYPE
|
||||
|| TREE_TYPE (expr) == unknown_type_node)
|
||||
{
|
||||
if (TREE_CODE (expr) == INDIRECT_REF)
|
||||
if (INDIRECT_REF_P (expr))
|
||||
error ("second operand of %<offsetof%> is neither a single "
|
||||
"identifier nor a sequence of member accesses and "
|
||||
"array references");
|
||||
|
@ -1,3 +1,8 @@
|
||||
2013-08-21 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/56130
|
||||
* g++.dg/warn/deprecated-7.C: New.
|
||||
|
||||
2013-08-21 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
* g++.dg/tree-prof/pr57451.C: Remove spurious dg-do directive.
|
||||
|
17
gcc/testsuite/g++.dg/warn/deprecated-7.C
Normal file
17
gcc/testsuite/g++.dg/warn/deprecated-7.C
Normal file
@ -0,0 +1,17 @@
|
||||
// PR c++/56130
|
||||
|
||||
int g_nn;
|
||||
int& g_n __attribute__((deprecated)) = g_nn;
|
||||
|
||||
void f()
|
||||
{
|
||||
int f_nn;
|
||||
int& f_n __attribute__((deprecated)) = f_nn;
|
||||
f_n = 1; // { dg-warning "'f_n' is deprecated" }
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
g_n = 1; // { dg-warning "'g_n' is deprecated" }
|
||||
f();
|
||||
}
|
Loading…
Reference in New Issue
Block a user