This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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();
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]