This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Compiling GCC With a C++ Compiler (g++)
Gabriel Dos Reis <gdr@cs.tamu.edu> writes:
> If you're making the assumption that nonmodifiability necessarily
> implies that the whole thing is const-qualified, then you're wrong and
> I'm not surprised you're not satisfied with what the standard says.
You mean that the following (which does not contain any casts) is invoking
undefined behaviour?
struct A { int a; const int b; } X;
void f (int *x) { *x = 1; }
int main (void) { f (&X.a); return 0; }
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."