This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/49531] New: Doesn't resolve to conversion function template specialization in expressions
- From: "schaub.johannes at googlemail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 26 Jun 2011 00:35:42 +0000
- Subject: [Bug c++/49531] New: Doesn't resolve to conversion function template specialization in expressions
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49531
Summary: Doesn't resolve to conversion function template
specialization in expressions
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: schaub.johannes@googlemail.com
GCC rejects this code, which I think is valid in both C++03 and C++0x
// snip
struct A {
template<typename T> operator T();
};
void f() { &A::operator int; }
main1.cpp:5:28: error: statement cannot resolve address of overloaded function
// snap
There is no overloaded function. The provisions of 13.4 apply when we are faced
with a function template name. We are not, in this case.
"A specialization of a conversion function template is not found by name
lookup. Instead, any conversion function templates visible in the context of
the use are considered. For each such operator, if argument deduction succeeds
(14.8.2.3), the resulting specialization is used as if found by name lookup."
Before we even enter 13.4, we will do argument deduction and resolve to a
single function template specialization. After we resolved to that function *as
if by name lookup*, we will just skip 13.4 because we have a single function
name, rather than an overload set.