c++/6874: deriving from zero-sized objects causes extraneous padding
gnubug@skilbeck.com
gnubug@skilbeck.com
Thu May 30 13:36:00 GMT 2002
>Number: 6874
>Category: c++
>Synopsis: deriving from zero-sized objects causes extraneous padding
>Confidential: no
>Severity: critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Thu May 30 13:36:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: gnubug@skilbeck.com
>Release: 2.95.??
>Organization:
>Environment:
mips
>Description:
when deriving from a zero-sized struct, can we get the dummy single byte overlaid by the data members of the derived struct?
>How-To-Repeat:
struct Bob
{
void *operator new(size_t s);
void operator delete(void *p);
};
struct Bill : Bob
{
int Jack;
};
...
sizeof(Bob) == 1 (Fine)
sizeof(Bill) == 8 (sizeof(int) would be nice, like other compilers)
>Fix:
er... hack the gcc!?
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list