Bug 55063
Summary: | g++ 3.0.1 fails to allow access to member field address | ||
---|---|---|---|
Product: | [Retired] Red Hat Linux | Reporter: | Calvin Austin <calvin.austin> |
Component: | gcc3 | Assignee: | Jakub Jelinek <jakub> |
Status: | CLOSED CURRENTRELEASE | QA Contact: | |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 7.2 | ||
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | i686 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2002-12-15 17:59:43 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Calvin Austin
2001-10-25 00:36:46 UTC
The C++ standard specifies that offsetof may only be used for non-POD classes. Now, since your testcase doesn't actually use the offsetof macro, just its common implementation, it's merely dubious, rather than clearly ill-formed. I'll change g++ 3.1 to accept this code with a warning, rather than an error. In any case, you shouldn't be writing code like this. If you really need the offset, you can use ((char *)&x2 - (char *)this), but for most uses you should be using a pointer-to-member instead. Jason Confirmed ok in 3.2 x1.C: In member function `int JavaThread::calc()': x1.C:44: warning: invalid offsetof from non-POD type `class Thread'; use pointer to member instead |