EGCS 1.1b: bug in template/initialising a pointer to a member

Lassi A. Tuura lat@iki.fi
Wed Nov 25 01:36:00 GMT 1998


Hi,

EGCS 1.1b fails to initialise the member variable with the error message
given below.  No errors occur if the constructor is inlined in the
class.  Templates seem to be required to trigger this bug.

--- bug2.cxx
template <class T, class U> struct X { X (U T::*member); U T::*m; };
template <class T, class U> inline X<T,U>::X (U T::*member) : m (member) {}
---

$ c++ -c -v bug2.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__ bug2.cxx /tmp/ccIpfnfn.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/ccIpfnfn.ii -quiet -dumpbase bug2.cc -version -o /tmp/ccGA5mPI.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).
bug2.cxx:2: common_type called with uncommon member types (compiler error)

//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"




More information about the Gcc-bugs mailing list