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]

Re: bug in g++ for egcs-1.1.1 gives "invalid reference to NULL ptr"


Brian Beuning wrote:

> > // I am getting an error when using offsetof() on
> > // class dbbActionDef when the member is defined in the base
> > // class dbbAction.  For what it is worth, this works fine
> > // under Microsoft Developer Studio versions 5.0 and 6.0.
> > // This code is distilled from a 400,000 bytes cpp output

The offsetof macro only accepts POD struct or union,
 CD2 18.1 [lib.support.types] 5
	"The macro offsetof accepts a restricted set of type arguments ... type shall
be a POD structure or POD union."

A class with a base class is not a POD struct.

This is probably not the answer you'd like. In the general case only a
ptr-to-member can contain sufficient information.

Does MSVC[56].0 state it accepts this as an extension, or does it just happen
to `work' by accident?

nathan

-- 
Dr Nathan Sidwell :: Computer Science Department :: Bristol University
      You can up the bandwidth, but you can't up the speed of light      
nathan@acm.org  http://www.cs.bris.ac.uk/~nathan/  nathan@cs.bris.ac.uk


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