public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/53091] Const assignment fails in GCC 4.2, 4.4, 4.6, 4.7 - works fine in clang
Date: Mon, 23 Apr 2012 20:50:00 -0000	[thread overview]
Message-ID: <bug-53091-4-ChcBcTs1vT@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-53091-4@http.gcc.gnu.org/bugzilla/>

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.


  parent reply	other threads:[~2012-04-23 20:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-23 18:24 [Bug c/53091] New: " bugs at m8y dot org
2012-04-23 18:25 ` [Bug c/53091] " bugs at m8y dot org
2012-04-23 18:39 ` redi at gcc dot gnu.org
2012-04-23 19:00 ` bugs at m8y dot org
2012-04-23 19:20 ` schwab@linux-m68k.org
2012-04-23 19:25 ` manu at gcc dot gnu.org
2012-04-23 19:35 ` bugs at m8y dot org
2012-04-23 19:43 ` pinskia at gcc dot gnu.org
2012-04-23 19:57 ` bugs at m8y dot org
2012-04-23 20:37 ` schwab@linux-m68k.org
2012-04-23 20:50 ` redi at gcc dot gnu.org [this message]
2012-04-23 21:01 ` bugs at m8y dot org
2012-04-24 14:25 ` joseph at codesourcery dot com
2012-04-24 14:38 ` [Bug c/53091] static initializer accepted by clang but not by gcc manu at gcc dot gnu.org
2012-04-24 15:01 ` bugs at m8y dot org
2012-05-30 16:23 ` schwab@linux-m68k.org
2021-09-12 21:28 ` pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-53091-4-ChcBcTs1vT@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).