Wont instantiate template class with static member initialised by sizeof(some non-implemented static function())
Stewart.Hall@scisys.co.uk
Stewart.Hall@scisys.co.uk
Mon Jul 30 06:39:00 GMT 2001
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t2.ii
Type: text/x-c++
Size: 6035 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-bugs/attachments/20010730/b2828222/attachment.bin>
More information about the Gcc-bugs
mailing list