This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/11094] New: incomplete static member breaks sizeof containing template class
- From: "ncm at cantrip dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Jun 2003 20:35:52 -0000
- Subject: [Bug c++/11094] New: incomplete static member breaks sizeof containing template class
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11094
Summary: incomplete static member breaks sizeof containing
template class
Product: gcc
Version: 3.2.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: ncm@cantrip.org
CC: gcc-bugs@gcc.gnu.org
GCC build triplet: *-*-*
GCC host triplet: x86-*-linux
GCC target triplet: *-*-*
For
template<typename T>
struct Foo
{
int c;
static int s[];
};
template<typename T>
int Foo<T>::s[sizeof(Foo<T>)];
int* p = Foo<char>::s;
I get
$ gcc -c t.cc
t.cc: In instantiation of `Foo<char>':
t.cc:11: instantiated from here
t.cc:9: `sizeof' applied to incomplete type `Foo<char>'
t.cc:9: creating array with size zero (`0')
t.cc:11: `s' is not a member of type `Foo<char>'
See also http://gcc.gnu.org/ml/libstdc++/2003-04/msg00045.html
and related discussion.
If this gets fixed, note that this bug may have been worked
around in the libstdc++ implementation, probably in 3.4; grep for
_Rep_base in include/bits/basic_string.h.
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.