This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

c++/6874: deriving from zero-sized objects causes extraneous padding



>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:


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