[Bug c/53091] Const assignment fails in GCC 4.2, 4.4, 4.6, 4.7 - works fine in clang

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Apr 23 20:50:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53091

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-04-23 20:50:21 UTC ---
(In reply to comment #3)
> Hey. I attached it as well. I didn't just provide a URL.

Yeah, sorry, I wrote my comment before you attached it.

(In reply to comment #6)
> Can rewrite both const int and enum, so I don't really see why enum is
> permitted but const int isn't, they both offer
> about the same amount of safety.

http://c-faq.com/ansi/constasconst.html

Take it up with the C committee, not GCC.


(In reply to comment #8)
> Not that you are likely to care, but the Standard states that enumeration types
> are of a type that is compatible with an implementation-defined one of the
> integral types.

Enumeration TYPES are compatible with integral TYPES.  But enumerators are
constant, const-qualified variables are not constants.

> So. you can rewrite enum values just as easily as you can a const int by taking
> a pointer to it.  And that site claims it behaves like a const int.

The site's wrong.



More information about the Gcc-bugs mailing list