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]

Bug with pointers to members


COMMAND LINE:

/home/alex/local/bin/g++ -v --save-temps bug.cpp -o bug

OUTPUT:

Reading specs from /home/alex/local/lib/gcc-lib/sparc-sun-solaris2.5.1/2.95.2/specs
gcc version 2.95.2 19991024 (release)
 /home/alex/local/lib/gcc-lib/sparc-sun-solaris2.5.1/2.95.2/cpp -lang-c++ -v -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 -D__sparc__ -D__sun__ -D__unix__ -D__svr4__ -D__SVR4 -D__sparc -D__sun -D__unix -Asystem(unix) -Asystem(svr4) -D__EXCEPTIONS -D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc) bug.cpp bug.ii
GNU CPP version 2.95.2 19991024 (release) (sparc)
#include "..." search starts here:
#include <...> search starts here:
 /home/alex/local/lib/gcc-lib/sparc-sun-solaris2.5.1/2.95.2/../../../../include/g++-3
 /usr/local/include
 /home/alex/local/lib/gcc-lib/sparc-sun-solaris2.5.1/2.95.2/../../../../sparc-sun-solaris2.5.1/include
 /home/alex/local/lib/gcc-lib/sparc-sun-solaris2.5.1/2.95.2/include
 /usr/include
End of search list.
The following default directories have been omitted from the search path:
End of omitted list.
 /home/alex/local/lib/gcc-lib/sparc-sun-solaris2.5.1/2.95.2/cc1plus bug.ii -quiet -dumpbase bug.cc -version -o bug.s
GNU C++ version 2.95.2 19991024 (release) (sparc-sun-solaris2.5.1) compiled by GNU C version 2.95.2 19991024 (release).
bug.cpp:16: common_type called with uncommon member types (compiler error)

PREPROCESSED INPUT:

# 1 "bug.cpp"
struct Foo {
  Foo *p;
};
 
template<class T>
class Bar {
public:
  Bar(T *T:: *a);
  ~Bar() { }
private:
  T *T:: *_a;
};
 
template<class T>
Bar<T>::Bar(T *T:: *a)
  : _a(a)
{
}
 
int main() {
  Bar<Foo> x(&Foo::p);
  return 0;
}

COMMENT:

It seems to work if I put the Bar constructor inline (i.e.: inside the
declaration of class Bar).


[ Alex Meyer       voice-650-653-2840 ] [ Inktomi Corporation    ]
[ alex@inktomi.com   fax-650-653-5485 ] [ 4100 East Third Avenue ]
[ http://personal.inktomi.com/~alex/  ] [ Foster City, CA 94404  ]


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