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]

Wont instantiate template class with static member initialised by sizeof(some non-implemented static function())



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


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