egcs-2.91.55 19980824 error on const references

Todd Vierling tv@pobox.com
Tue Aug 25 14:21:00 GMT 1998


On Tue, 25 Aug 1998, Hyman Rosen wrote:

: The following test program fails. It also fails in all earlier versions
: of gcc. Would someone please add it to the test suite?

You mean it "fails to keep c constant"?  Without the `const's, that code
_should_ assign 0 to `c'.  If the const should be errored about, then the
failure is not reporting the const error.

What is the defined behavior with "volatile const"?  Is it defined as the
same as "volatile"--that is, no const behavior at all?

FWIW, the SunPro C++ for Solaris is the same as gcc/egcs.

: extern "C" int printf(const char *, ...);
: int main(int, char **)
: {
: 	volatile const int c = 42;
: 	volatile int *p;
: 	volatile const int *&r = p;
: 	r = &c;
: 	*p = 0;
: 	if (c != 42)
: 		printf("FAILED!\n");
: }

-- 
-- Todd Vierling (Personal tv@pobox.com; Bus. todd_vierling@xn.xerox.com)




More information about the Gcc-bugs mailing list