This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 119a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-12-20
[Voted into WP at October 2005 meeting.]
As far as I can tell, the standard doesn't say whether "offsetof(...)"is type-dependent. In the abstract, it shouldn't be -- an "offsetof"expression is always of type "size_t". But the standard doesn't say towhat the definition of the macro is, so I don't think one can deducethat it will always be considered non-dependent by a conformingcompiler.
John Spicer:(1) I agree that you can't know if offsetof is dependent because youdon't know what it expands to.(2) In principle, offsetof should be like sizeof -- it is value-dependentif its argument is type-dependent.
Mark Mitchell:I think we should say that:(a) offsetof is not type-dependent, and(b) offsetof is value dependent iff the first argument is type-dependent
Everyone is using slightly different builtins to implement thisfunctionality, and I don't think that there's any guarantee that they're allbehaving the same here.
Notes from the March 2004 meeting:
Note that any such requirement would be in the library section,not core.
Proposed resolution (October, 2004):
At the end of 13.8.3.3 [temp.dep.expr] paragraph4, add after the list that ends withthrowassignment-expression:
[Note: For the standard library macrooffsetof,see 17.2 [support.types]. —end note]
At the end of 13.8.3.4 [temp.dep.constexpr] paragraph2, add after the list that ends withsizeof(type-id):
[Note: For the standard library macrooffsetof,see 17.2 [support.types]. —end note]
In 17.2 [support.types] paragraph 4, replace
The macrooffsetof accepts a restricted set oftype arguments in this International Standard. Iftype is not a POD structure or a POD union the results areundefined. The result of applying theoffsetof macro toa field that is a static data member or a function member isundefined.
with
The macrooffsetof(type,member-designator) accepts a restricted set oftype arguments in this International Standard. Iftype is not a POD structure or a POD union (Clause 11 [class]), the results are undefined. Theexpressionoffsetof(type,member-designator) is never type-dependent(13.8.3.3 [temp.dep.expr]) and it is value-dependent(13.8.3.4 [temp.dep.constexpr]) if and only iftype isdependent. The result of applying theoffsetof macro toa field that is a static data member or a function member isundefined.
[Note: the original wording shown here reflects theresolutions of library issues 306 and 449.]