[XLC++ 8.0/AIX] unsats on extern template and virtual inheritance
-----------------------------------------------------------------

                 Key: STDCXX-381
                 URL: https://issues.apache.org/jira/browse/STDCXX-381
             Project: C++ Standard Library
          Issue Type: Bug
          Components: External
         Environment: XLC++/AIX
            Reporter: Martin Sebor


PMR 02342,K78,000

The following script is expected to run successfully to completion and end with 
the line "Success." Instead, it fails with an error, producing the line 
"Failure." on stdout. The test case reproduces a bug in the XLC++ 
implementation of the extern template language extension that causes XLC++ to 
fail to emit symbols required for the program to link. The test case shows that 
the problem is caused by the use of virtual inheritance in the class hierarchy, 
and that without it the program links successfully. This bug prevents the 
extern template feature from being used, for example, in C++ Standard Library 
Iostreams.

$ cat t.cpp && xlC -qversion && xlC -c -DINSTANTIATE_B t.cpp -o b.o && xlC -c 
-DINSTANTIATE_C t.cpp -o c.o && xlC -c t.cpp && xlC t.o b.o c.o && xlC -c 
-DUSE_A -DINSTANTIATE_B t.cpp -o b.o && xlC -c -DUSE_A -DINSTANTIATE_C t.cpp -o 
c.o && xlC -c -DUSE_A t.cpp && xlC t.o b.o c.o && echo Success. || echo 
Failure. 
struct A { virtual ~A (); };
#ifdef USE_A
template <class T> struct B: A { ~B (); };
#else
template <class T> struct B { ~B (); };
#endif
template <class T> B<T>::~B () { }
template <class T> struct C: B<T> { };
#ifdef INSTANTIATE_B
A::~A () { }
template struct B<char>;
#elif defined INSTANTIATE_C
template struct C<char>;
#else
extern template struct B<char>;
extern template struct C<char>;
int main () { C<char> c; }
#endif
IBM XL C/C++ Enterprise Edition V8.0 for AIX   
Version: 08.00.0000.0012  
ld: 0711-317 ERROR: Undefined symbol: Virtual table for class "C<char>": first 
non-inline virtual function in
"C<char>" is not defined.
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
Failure.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to