Bug 29143 - address-of overloaded function does not work in function call
Summary: address-of overloaded function does not work in function call
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.1.1
: P3 normal
Target Milestone: 4.9.0
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
: 36975 (view as bug list)
Depends on:
Blocks: 77474
  Show dependency treegraph
 
Reported: 2006-09-19 14:59 UTC by Andrew Stubbs
Modified: 2024-03-19 22:27 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-09-20 06:58:28


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Stubbs 2006-09-19 14:59:56 UTC
void f(int,int);
void f(int,int,int);

void
g ()
{
  (&f)(1,2,3);
}

gives:
t.cpp: In function ‘void g()’:
t.cpp:7: error: address of overloaded function with no contextual type information

The C++ standard clause 13.3.1.1 says that '(&f)(...)' is the same as '(f)(...)',
but the latter works and the former does not.
Comment 1 Andrew Pinski 2006-09-20 06:58:28 UTC
Confirmed.
Comment 2 Andrew Pinski 2008-08-10 23:15:15 UTC
*** Bug 36975 has been marked as a duplicate of this bug. ***
Comment 3 Paolo Carlini 2013-05-05 00:58:59 UTC
Looking into it, seems doable.
Comment 4 Paolo Carlini 2013-08-21 09:55:41 UTC
Not actively working on this.
Comment 5 Paolo Carlini 2013-11-12 11:19:03 UTC
Mine.
Comment 6 paolo@gcc.gnu.org 2013-11-16 09:54:26 UTC
Author: paolo
Date: Sat Nov 16 09:54:23 2013
New Revision: 204898

URL: http://gcc.gnu.org/viewcvs?rev=204898&root=gcc&view=rev
Log:
/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.

Added:
    trunk/gcc/testsuite/g++.dg/overload/addr2.C
Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.old-deja/g++.other/overload11.C
Comment 7 paolo@gcc.gnu.org 2013-11-16 09:54:44 UTC
Author: paolo
Date: Sat Nov 16 09:54:42 2013
New Revision: 204899

URL: http://gcc.gnu.org/viewcvs?rev=204899&root=gcc&view=rev
Log:
/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.

Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/semantics.c
Comment 8 Paolo Carlini 2013-11-16 09:55:33 UTC
Fixed for 4.9.0.