>Submitter-Id: net >Originator: Claudius Link >Organization: IAM University Freiburg >Confidential: no >Synopsis: templates calling static member functions won't compile >Severity: non-critical >Priority: low >Category: c++ >Class: rejects-legal >Release: 3.0.3 (Debian testing/unstable) >Environment: System: Linux zaphod 2.4.18 #4 SMP Sun Mar 10 00:00:34 CET 2002 i686 unknown Architecture: i686
host: i386-pc-linux-gnu build: i386-pc-linux-gnu target: i386-pc-linux-gnu configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux >Description: When trying to compile the converion detection example from the article Mappings between Types and Values by Andrei Alexandrescu at http://www.cuj.com/experts/1810/alexandr.htm?topic=experts it simply didn't compile with the error message (2.95.2 and 2.95.4 neither): ------------------------------------------------ $ g++-3.0 -v -save-temps -o s s.cc Reading specs from /usr/lib/gcc-lib/i386-linux/3.0.3/specs Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux Thread model: posix gcc version 3.0.3 /usr/lib/gcc-lib/i386-linux/3.0.3/cpp0 -lang-c++ -D__GNUG__=3 -D__GXX_DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -v -D__GNUC__=3 -D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=3 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D_GNU_SOURCE -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i386__ s.cc s.ii GNU CPP version 3.0.3 (cpplib) (i386 Linux/ELF) ignoring nonexistent directory "/usr/i386-linux/include" #include "..." search starts here: #include <...> search starts here: /usr/include/g++-v3 /usr/include/g++-v3/i386-linux /usr/include/g++-v3/backward /usr/local/include /usr/lib/gcc-lib/i386-linux/3.0.3/include /usr/include End of search list. /usr/lib/gcc-lib/i386-linux/3.0.3/cc1plus -fpreprocessed s.ii -quiet -dumpbase s.cc -version -o s.s GNU CPP version 3.0.3 (cpplib) (i386 Linux/ELF) GNU C++ version 3.0.3 (i386-linux) compiled by GNU C version 3.0.3. s.cc: In instantiation of `Conversion<double>': s.cc:11: instantiated from here s.cc:11: invalid use of undefined type `class Conversion<double>' s.cc:3: forward declaration of `class Conversion<double>' ------------------------------------------------ The SGI 7.3 and the Sun C++ 5.1 work all right and I can't see any illigal stuff done there. I just include the source. >How-To-Repeat: # 1 "s.cc" template <class T> class Conversion { public: static T MakeT(); enum { exists = sizeof(MakeT()) }; }; int main() { int i = Conversion<double>::exists; } >Fix: -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]