PR c++/50308 - wrong deprecated warning with ADL
PR c++/17729 - duplicate deprecated warning * semantics.c (finish_id_expression): Only call mark_used on a function if we aren't building a call. From-SVN: r245643
This commit is contained in:
parent
46b48ef565
commit
626aeaa7ac
|
@ -1,5 +1,10 @@
|
|||
2017-02-21 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/50308 - wrong deprecated warning with ADL
|
||||
PR c++/17729 - duplicate deprecated warning
|
||||
* semantics.c (finish_id_expression): Only call mark_used on a
|
||||
function if we aren't building a call.
|
||||
|
||||
PR c++/41727 - ICE with partial spec of partial instantiation
|
||||
* pt.c (process_partial_specialization): For now, don't check more
|
||||
specialized if there is more than one level of args.
|
||||
|
|
|
@ -3743,7 +3743,15 @@ finish_id_expression (tree id_expression,
|
|||
if (TREE_CODE (first_fn) == TEMPLATE_DECL)
|
||||
first_fn = DECL_TEMPLATE_RESULT (first_fn);
|
||||
|
||||
if (!really_overloaded_fn (decl)
|
||||
/* [basic.def.odr]: "A function whose name appears as a
|
||||
potentially-evaluated expression is odr-used if it is the unique
|
||||
lookup result".
|
||||
|
||||
But only mark it if it's a complete postfix-expression; in a call,
|
||||
ADL might select a different function, and we'll call mark_used in
|
||||
build_over_call. */
|
||||
if (done
|
||||
&& !really_overloaded_fn (decl)
|
||||
&& !mark_used (first_fn))
|
||||
return error_mark_node;
|
||||
|
||||
|
|
|
@ -16,4 +16,4 @@
|
|||
|
||||
__attribute__((deprecated)) void foo (void); /* { dg-bogus "declared here" "" { xfail { c++ } } } */
|
||||
|
||||
C (foo) /* { dg-bogus "is deprecated" "" { xfail { c++ } } } */
|
||||
C (foo) /* { dg-bogus "is deprecated" } */
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
// PR c++/50308
|
||||
|
||||
void A( int ) __attribute__((deprecated));
|
||||
|
||||
namespace B {
|
||||
|
||||
struct C {};
|
||||
|
||||
void A(C) {}
|
||||
|
||||
}
|
||||
|
||||
int main ()
|
||||
{
|
||||
B::C x;
|
||||
|
||||
// ADL correctly identifies the non-deprecated B::A, but a warning about the
|
||||
// global A is generated anyway
|
||||
A( x ); // { dg-bogus "deprecated" }
|
||||
}
|
Loading…
Reference in New Issue