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++/17225] New: Trsolver picks universal template over user-defined conversion


I'm not sure this is a bug or just my ignorance of the rules.
#include <iostream>
struct R{};
struct S{};
struct T{
    operator R() {return e;}
    operator S() {return f;}
    R e;
    S f;
    };

void Bar(R r) { std::cerr << "Bar\n"; }
void Foo(S s) { std::cerr << "Foo direct\n";}
template<typename U>
void Foo(U u) { std::cerr << "Foo template\n"; }
int main() {
    T t;
    S s;
    Bar(t);
    Foo(s);
    Foo(t);
    }

gets you:

~/ootbc/common/test/src$ a.out
Bar
Foo direct
Foo template

That is, it takes exact match over universal template, and universal template over user-defined conversion. Is this right>

Ivan

-- 
           Summary: Trsolver picks universal template over user-defined
                    conversion
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: igodard at pacbell dot net
                CC: gcc-bugs at gcc dot gnu dot org


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


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