diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2013-11-16 09:54:42 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2013-11-16 09:54:42 +0000 |
commit | 53677b17cb887acaa488fe9b011424a657f1697c (patch) | |
tree | 13df367c7951a1103b2c26b935e9f0dfa0b211ee /gcc | |
parent | 5edc02ac2219491b8db8b460ae5e0afdb7ff2c3b (diff) | |
download | gcc-53677b17cb887acaa488fe9b011424a657f1697c.zip gcc-53677b17cb887acaa488fe9b011424a657f1697c.tar.gz gcc-53677b17cb887acaa488fe9b011424a657f1697c.tar.bz2 |
re PR c++/29143 (address-of overloaded function does not work in function call)
/cp
2013-11-16 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/29143
* semantics.c (finish_call_expr): Ensure that for OVERLOADs too
'(&f)(...)' is the same as '(f)(...)', per 13.3.1.1.
/testsuite
2013-11-16 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/29143
* g++.dg/overload/addr2.C: New.
* g++.old-deja/g++.other/overload11.C: Adjust.
From-SVN: r204899
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2a16220..5f52d90 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2013-11-16 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/29143 + * semantics.c (finish_call_expr): Ensure that for OVERLOADs too + '(&f)(...)' is the same as '(f)(...)', per 13.3.1.1. + 2013-11-15 Aldy Hernandez <aldyh@redhat.com> * Make-lang.in (CXX_AND_OBJCXX_OBJS): Depend on cp/cp-cilkplus.o. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 81394fa..f5506d0 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2184,6 +2184,11 @@ finish_call_expr (tree fn, vec<tree, va_gc> **args, bool disallow_virtual, } } + /* Per 13.3.1.1, '(&f)(...)' is the same as '(f)(...)'. */ + if (TREE_CODE (fn) == ADDR_EXPR + && TREE_CODE (TREE_OPERAND (fn, 0)) == OVERLOAD) + fn = TREE_OPERAND (fn, 0); + if (is_overloaded_fn (fn)) fn = baselink_for_fns (fn); |