public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: comer@mailru.com To: gcc-gnats@gcc.gnu.org Subject: c++/6351: GCC dosn't compile a correct code. Date: Thu, 18 Apr 2002 04:06:00 -0000 [thread overview] Message-ID: <20020418110247.26072.qmail@sources.redhat.com> (raw) >Number: 6351 >Category: c++ >Synopsis: GCC dosn't compile a correct code. >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: rejects-legal >Submitter-Id: net >Arrival-Date: Thu Apr 18 04:06:11 PDT 2002 >Closed-Date: >Last-Modified: >Originator: comer@mailru.com >Release: 2.95.3-5 (cygwin-version) >Organization: >Environment: Windows 2000 >Description: enum_plus.cpp:9: enumerator value for `MY_MAX' not integer constant enum_plus.cpp: In function `enum {anonymous} operator +<{anonymous enum}, int>(c onst {anonymous enum} &, const int &)': enum_plus.cpp:9: instantiated from here enum_plus.cpp:4: assignment of read-only reference `a' >How-To-Repeat: template<class TypeA, class TypeB> TypeA operator+(const TypeA& a, const TypeB& b) { return TypeA(a)+=b; } enum { MY_MIN = 0 }; enum { MY_MAX = MY_MIN+10 }; int main(void) { } >Fix: Change enum { MY_MAX = MY_MIN+10 }; to enum { MY_TMP = MY_MIN, MY_MAX = MY_TMP+10 }; >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: application/octet-stream; name="enum_plus.cpp" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="enum_plus.cpp" dGVtcGxhdGU8Y2xhc3MgVHlwZUEsIGNsYXNzIFR5cGVCPg0KVHlwZUEgb3BlcmF0b3IrKGNvbnN0 IFR5cGVBJiBhLCBjb25zdCBUeXBlQiYgYikNCnsNCglyZXR1cm4gVHlwZUEoYSkrPWI7DQp9DQoN CmVudW0geyBNWV9NSU4gPSAwIH07DQoNCmVudW0geyBNWV9UTVAgPSBNWV9NSU4sIE1ZX01BWCA9 IE1ZX1RNUCsxMCB9Ow0KDQppbnQgbWFpbih2b2lkKQ0Kew0KfQ0KDQo=
next reply other threads:[~2002-04-18 11:06 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-04-18 4:06 comer [this message] 2002-04-26 7:49 nathan
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=20020418110247.26072.qmail@sources.redhat.com \ --to=comer@mailru.com \ --cc=gcc-gnats@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: linkBe 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).