This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
g++ 2.95.2/AIX 4.3 fails to implicitly instantiate explicitly initialized static POD data of a class template
- To: gcc bug reports <gcc-bugs at gcc dot gnu dot org>
- Subject: g++ 2.95.2/AIX 4.3 fails to implicitly instantiate explicitly initialized static POD data of a class template
- From: Martin Sebor <sebor at roguewave dot com>
- Date: Tue, 15 Aug 2000 16:47:16 -0600
- Organization: Rogue Wave Software, Inc.
Hi,
g++ 2.95.2 doesn't implicitly instantiate S<char>::b below on IBM AIX
4.3 and DEC OSF1 5.0. Removing the explicit initializer or explicitly
instantiating the template works. I have reported this issue separately
for g++ on DEC OSF (Tru64) but I don't think it ever made it into GNATS,
nor did I receive a response, but I guess that's because g++ is not
supported on Tru64.
Thanks
Martin
$ cat test.cpp
template <class T>
struct S
{
static T a;
static T b;
};
template <class T>
T S<T>::a; // <-- NOT initialized
template <class T>
T S<T>::b = 0; // <-- explicitly initialized
int main ()
{
return S<char>::a + S<char>::b;
}
$ g++ foo.cpp
ld: 0711-317 ERROR: Undefined symbol: S<char>::b
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more
information.
collect2: ld returned 8 exit status
$ uname -a
AIX elway 3 4 000677664C00