This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Wont instantiate template class with static member initialised by sizeof(some non-implemented static function())
- To: gcc-bugs at gcc dot gnu dot org
- Subject: Wont instantiate template class with static member initialised by sizeof(some non-implemented static function())
- From: Stewart dot Hall at scisys dot co dot uk
- Date: Mon, 30 Jul 2001 14:38:34 +0100
Description: The source code is similar to section 2.7 Modern C++ Design by
Andrei Alexandrescu. Tries to statically
check for implicit conversion between 2 types. It seems entirely legal, and Sun
Workshop CC 6.0 is OK with it. GCC seems
to fail to instantiate the ImplConv class for unknown reason.
Clue/Red Herring?: Try it without the ... sizeof(Test (T())) ... bit, it's OK?
sizeof should not evaluate the value of the expression so no function
implementation is legally required (or desirable).
1) GCC version
gcc -v
Reading specs from /opt/gnu/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/specs
gcc version 2.95.2 19991024 (release)
2) Command Line
g++ t2.c
3) Compiler output
t2.c: In instantiation of `ImplConv<Derived, Base>':
t2.c:25: instantiated from here
t2.c:17: invalid use of undefined type `struct ImplConv<Derived, Base>'
t2.c:9: forward declaration of `struct ImplConv<Derived, Base>'
t2.c: In instantiation of `ImplConv<UnDerived, Base>':
t2.c:34: instantiated from here
t2.c:17: invalid use of undefined type `struct ImplConv<UnDerived, Base>'
t2.c:9: forward declaration of `struct ImplConv<UnDerived, Base>'
4) Preprocessed source file
(See attached file: t2.ii)
5) Configuration settings, dunno and no idea how to find out
good luck
Stewart
t2.ii