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]

Re: Is the result of offsetof an integral constant expression?


> | I don't follow the argument in bugzilla that says the wording in the
> | C standard doesn't apply.  Why doesn't it apply?  The C++ standard
> | just lists restrictions on applying offsetof to C++ features that
> | don't exist in C.
> 
> I think the argument in the bugzilla is just wrong.  The compiler is
> indeed defectuous and the PR is a valid one.
> 
> Wolfgang, there is no dispute that offsetof should yield a constant
> integral expression.  That GCC fails to provide a correct definition
> is a bug. 

Much the better. My observation simply was that the C standard explicitly
says that the result is an integer constant expression, while the C++
standard fails to do so. If this implies that the result in C++ is _not_
an integral constant, I would consider this a defect, if it does not then
my understanding of the word "changes" at the end of 18.1/3 is just flawed
(you read it as "restrictions"). I'm not a native English speaker, though,
so bear with me.

Thanks for clarifying this
  Wolfgang

-------------------------------------------------------------------------
Wolfgang Bangerth              email:            bangerth@ices.utexas.edu
                               www: http://www.ices.utexas.edu/~bangerth/




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