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

           Summary: Wrong template deduction
           Product: gcc
           Version: 4.5.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: dk_m...@mail.ru


The following code fails to compile neither with g++ version 4.4.5
(Ubuntu/Linaro 4.4.4-14ubuntu5) nor with 4.5.1:


template<typename ItT>
struct traits {
        typedef typename ItT::value_type value_t;
};

template<typename ItT>
struct A {
        typedef typename traits<ItT>::value_t value_t;
};

template<typename T>
struct B {
        typedef T type_t;
};

struct C {

        template<typename T, typename T2>
        void foo(const A<T>& r) {}

        template<typename T>
        void foo(const B<T>& r) {}
};

void foo()
{
        B<char> b;
        C c;
        c.foo(b);
        c.foo<char>(b); // fails to compile
}

Reply via email to