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: unassig...@gcc.gnu.org
        ReportedBy: schaub.johan...@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.

Reply via email to