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]

EGCS 1.1b: bug in template class conversion operator


Hi,

Here is a bug report distilled from an earlier report of mine.  It has
been composed by Dennis Handly at HP (dhandly@hpcllmx.cup.hp.com), for a
related report of mine.

$ c++ -v -c bug.cxx
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.57/specs
gcc version egcs-2.91.57 19980901 (egcs-1.1 release)
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.57/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=91 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -Asystem
(unix) -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -Di686 -Dpentiumpro -D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__ bug.cxx /tmp/ccM1gAy9.ii
GNU CPP version egcs-2.91.57 19980901 (egcs-1.1 release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include/g++
 /usr/local/include
 /usr/local/i686-pc-linux-gnu/include
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.57/include
 /usr/include
End of search list.
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.57/cc1plus /tmp/ccM1gAy9.ii -quiet -dumpbase bug.cc -version -o /tmp/ccE3S5pe.s
GNU C++ version egcs-2.91.57 19980901 (egcs-1.1 release) (i686-pc-linux-gnu) compiled by GNU C version egcs-2.91.57 19980901 (egcs-1.1 release).
bug.cxx:18: no `AssocEnd<T>::operator Ref<typename T::types>() const' member function declared in class `AssocEnd<T>'
bug.cxx: In method `AssocEnd<T>::operator Ref<typename T::types>() const':
bug.cxx:18: template definition of non-template `AssocEnd<T>::operator Ref<typename T::types>() const'
  
---- bug.cxx
class DataTree {};
template <class T> class Ref {};

template <class T1, class T2>
class Association {
public:
typedef T1 types;
Ref<T1> *p1;
};
template <class T>
class AssocEnd {
public:
T *p;
typedef typename T::types TT;
operator Ref<TT>() const;
};
template <class T>
inline AssocEnd<T>::operator Ref<typename AssocEnd<T>::TT>() const {
   return *p->p1;
}

int main() {
   AssocEnd<Association<DataTree,DataTree> > A1;
   Ref<DataTree> R1 = (Ref<DataTree>)A1;
}
----

//lat
--
With sufficient thrust, pigs fly just fine.  However, this is not
necessarily a good idea.  It is hard to be sure where they are going
to land, and it could be dangerous sitting under them as they fly
overhead.  --RFC1925, "The Twelve Networking Truths"






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