Compiler bug?
Gabriel Dos Reis
gdr@integrable-solutions.net
Tue Apr 8 18:49:00 GMT 2003
[ first of all, there seems to be no connectivity here, so I won't
participe to this debate enough until 11 Avril ]
Nathan Myers <ncm-nospam@cantrip.org> writes:
| Is this a compiler bug? I have
|
| template<typename T>
| struct Outer
| {
| struct Inner
| {
| int c;
| static int s[];
| };
| };
|
| template<typename T>
| int Outer<T>::Inner::s[sizeof(Inner)];
|
| extern template class Outer<char>;
Because the "extern template" does instruct the compiler to pretend
that Outer<char> should be defined somewhere else, it logically
follows that Outer<char> is an incomplete type, therefore trying to
poke into it to see what Outer<char>::Inner looks like should be a
hard error.
So, therefore, the program is ill-formed andthe bug is in the wording
of the diagnostic.
For what it worths, I made (this evening) a formal proposal to include
the "extern template" constructs. We're currently having a technical
session on "export" (the "extern template" construct is moot for
exported templates). I believe that "extern template" construct will
be discussed tomorrow.
-- Gaby
More information about the Libstdc++
mailing list