The following program fails to compile:

template <typename T> struct A {};
template <typename T> struct B
{
        typedef T type;
        operator A<T>() const;
};
template <typename T> void F(const A<typename B<T>::type> &) {}
template <typename T> B<T>::operator A<T>() const {}

test.cpp:8: error: no 'B<T>::operator A<typename B<T>::type>() const' member
fun
ction declared in class 'B<T>'
test.cpp:8: error: template definition of non-template 'B<T>::operator
A<typenam
e B<T>::type>() const'

If you define the cast operator before F, the error goes away.  A similar issue
was previously filed under bug #8578 and marked as fixed in gcc 3.3.


-- 
           Summary: Cast typename operator
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: spam at david dot osborn dot name
 GCC build triplet: i686-pc-mingw32
  GCC host triplet: i686-pc-mingw32
GCC target triplet: i686-pc-mingw32


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

Reply via email to