[Bug c++/57449] New: name lookup of conversions-function-id differs from clang

vanyacpp at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed May 29 11:27:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57449

            Bug ID: 57449
           Summary: name lookup of conversions-function-id differs from
                    clang
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vanyacpp at gmail dot com

On the code below the behavior of clang and gcc differ. Clang accepts this
code, while gcc reject it:

13.cpp: In function 'int main()':
13.cpp:19:21: error: no matching function for call to 'b::operator int()'
13.cpp:19:21: note: candidate is:
13.cpp:13:5: note: template<class T> b::operator templ<T>()
13.cpp:13:5: note:   template argument deduction/substitution failed:
13.cpp:19:21: note:   mismatched types 'templ<T>' and 'int'

I don't know which behavior is correct, but the one of clang seems reasonable
to me.

template <typename T>
struct templ
{};

struct a
{
    operator int();
};

struct b : a
{
    template <typename T>
    operator templ<T>();
};

int main()
{
    b bb;
    bb.operator int();
}



More information about the Gcc-bugs mailing list