This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Compiler bug?


[ 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 at cantrip dot 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


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