This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: bug in g++ for egcs-1.1.1 gives "invalid reference to NULL ptr"
- To: Brian Beuning <BBeuning at paysys dot com>
- Subject: Re: bug in g++ for egcs-1.1.1 gives "invalid reference to NULL ptr"
- From: Nathan Sidwell <nathan at acm dot org>
- Date: Mon, 18 Jan 1999 08:55:28 +0000
- CC: "'egcs-bugs at cygnus dot com'" <egcs-bugs at cygnus dot com>
- Organization: University of Bristol
- References: <C12B8345196DD21195F200A0C9C85EA00A94AA@mailman.atl.paysys.com>
- Reply-To: nathan at cs dot bris dot ac dot uk
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