public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/6351: GCC dosn't compile a correct code.
@ 2002-04-18 4:06 comer
0 siblings, 0 replies; 2+ messages in thread
From: comer @ 2002-04-18 4:06 UTC (permalink / raw)
To: gcc-gnats
>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=
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: c++/6351: GCC dosn't compile a correct code.
@ 2002-04-26 7:49 nathan
0 siblings, 0 replies; 2+ messages in thread
From: nathan @ 2002-04-26 7:49 UTC (permalink / raw)
To: comer, gcc-bugs, gcc-prs, nobody
Synopsis: GCC dosn't compile a correct code.
State-Changed-From-To: open->closed
State-Changed-By: nathan
State-Changed-When: Fri Apr 26 07:49:39 2002
State-Changed-Why:
the code is illformed, but the error wrong. g++ 3.0
reports
nathan@manao:162>g++ -c 6351.ii
6351.ii:9: enumerator value for `MY_MAX' not integer constant
6351.ii: In function `TypeA operator+(const TypeA&, const TypeB&) [with TypeA =
<anonymous enum>, TypeB = int]':
6351.ii:9: instantiated from here
6351.ii:4: no match for `<anonymous enum>& += const int&' operator
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6351
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-04-26 14:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-18 4:06 c++/6351: GCC dosn't compile a correct code comer
2002-04-26 7:49 nathan
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).