This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Is the result of offsetof an integral constant expression?
- From: Wolfgang Bangerth <bangerth at ices dot utexas dot edu>
- To: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- Cc: c++std-core at research dot att dot com, <gcc-bugs at gcc dot gnu dot org>
- Date: Tue, 3 Jun 2003 11:53:46 -0500 (CDT)
- Subject: 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/