Compiler bug?
Alexandre Oliva
aoliva@redhat.com
Tue Apr 8 12:23:00 GMT 2003
On Apr 8, 2003, Nathan Myers <ncm-nospam@cantrip.org> wrote:
> bug.cc: In instantiation of `Outer<char>::Inner':
> bug.cc:14: instantiated from here
> bug.cc:12: `sizeof' applied to incomplete type `Outer<char>::Inner'
> Outer<>::Inner doesn't look incomplete to me.
There's no such thing as flexible array members in C++. An earlier
draft of the C99 Standard said:
A structure type containing a flexible array member is an
incomplete type that cannot be completed. [6.2.5]/23
but this statement is gone from the final version. This was probably
done to address the incompatibility that would arise between sizeof
being well-defined for structs with flexible array members
[6.7.2.1]/17, and the requirement that the expression given to sizeof
doesn't have an incomplete type [6.5.3.4]/1 (hmm... how about to the
incomplete type itself?)
For short: looks like a bug to me. Compliance with (parts of) the
draft but not the final standard.
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist Professional serial bug killer
More information about the Libstdc++
mailing list