[Bug c++/38064] [c++0x] operator== doesn't work for enum classes

2014-02-16 Thread jackie.rosen at hushmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38064

Jackie Rosen jackie.rosen at hushmail dot com changed:

   What|Removed |Added

 CC||jackie.rosen at hushmail dot 
com

--- Comment #17 from Jackie Rosen jackie.rosen at hushmail dot com ---
*** Bug 260998 has been marked as a duplicate of this bug. ***
Seen from the domain http://volichat.com
Marked for reference. Resolved as fixed @bugzilla.


[Bug c++/38064] [c++0x] operator== doesn't work for enum classes

2010-05-04 Thread jason at gcc dot gnu dot org


--- Comment #14 from jason at gcc dot gnu dot org  2010-05-04 19:01 ---
Subject: Bug 38064

Author: jason
Date: Tue May  4 19:01:13 2010
New Revision: 159042

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=159042
Log:
PR c++/38064
* typeck.c (cp_build_binary_op): Allow enums for  as well.

Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/typeck.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/g++.dg/cpp0x/enum3.C


-- 


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



[Bug c++/38064] [c++0x] operator== doesn't work for enum classes

2010-05-04 Thread jason at gcc dot gnu dot org


--- Comment #15 from jason at gcc dot gnu dot org  2010-05-04 19:03 ---
Subject: Bug 38064

Author: jason
Date: Tue May  4 19:03:00 2010
New Revision: 159043

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=159043
Log:
PR c++/38064
* typeck.c (cp_build_binary_op): Allow enums for  as well.

Modified:
branches/gcc-4_5-branch/gcc/cp/ChangeLog
branches/gcc-4_5-branch/gcc/cp/typeck.c
branches/gcc-4_5-branch/gcc/testsuite/ChangeLog
branches/gcc-4_5-branch/gcc/testsuite/g++.dg/cpp0x/enum3.C


-- 


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



[Bug c++/38064] [c++0x] operator== doesn't work for enum classes

2010-05-04 Thread jason at gcc dot gnu dot org


--- Comment #16 from jason at gcc dot gnu dot org  2010-05-04 19:04 ---
Other comparisons fixed for 4.5.1.


-- 

jason at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution||FIXED
   Target Milestone|4.4.1   |4.5.1


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



[Bug c++/38064] [c++0x] operator== doesn't work for enum classes

2010-04-26 Thread redi at gcc dot gnu dot org


--- Comment #11 from redi at gcc dot gnu dot org  2010-04-26 11:23 ---
This is fixed for equality operators but not relational operators

enum class E { Foo, Bar };
bool b2 = E::Foo  E::Bar;


-- 

redi at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |


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



[Bug c++/38064] [c++0x] operator== doesn't work for enum classes

2010-04-26 Thread pinskia at gcc dot gnu dot org


--- Comment #12 from pinskia at gcc dot gnu dot org  2010-04-26 17:50 
---
(In reply to comment #11)
 This is fixed for equality operators but not relational operators
 
 enum class E { Foo, Bar };
 bool b2 = E::Foo  E::Bar;

Is that even allowed for normal enums?


-- 


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



[Bug c++/38064] [c++0x] operator== doesn't work for enum classes

2010-04-26 Thread redi at gcc dot gnu dot org


--- Comment #13 from redi at gcc dot gnu dot org  2010-04-26 23:07 ---
(In reply to comment #12)
 Is that even allowed for normal enums?

yes, unscoped enums will be promoted to int


-- 


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



[Bug c++/38064] [c++0x] operator== doesn't work for enum classes

2009-08-10 Thread pinskia at gcc dot gnu dot org


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

   Target Milestone|--- |4.4.1


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



[Bug c++/38064] [c++0x] operator== doesn't work for enum classes

2009-08-10 Thread pinskia at gcc dot gnu dot org


--- Comment #10 from pinskia at gcc dot gnu dot org  2009-08-10 21:37 
---
*** Bug 41030 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||msclrhd at gmail dot com


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



[Bug c++/38064] [c++0x] operator== doesn't work for enum classes

2009-05-25 Thread paolo dot carlini at oracle dot com


--- Comment #5 from paolo dot carlini at oracle dot com  2009-05-25 16:11 
---
CC-ing Jason...


-- 

paolo dot carlini at oracle dot com changed:

   What|Removed |Added

 CC||jason at gcc dot gnu dot org


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



[Bug c++/38064] [c++0x] operator== doesn't work for enum classes

2009-05-25 Thread jason at gcc dot gnu dot org


-- 

jason at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |jason at gcc dot gnu dot org
   |dot org |
 Status|NEW |ASSIGNED
   Last reconfirmed|2009-05-25 15:15:07 |2009-05-25 16:45:17
   date||


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



[Bug c++/38064] [c++0x] operator== doesn't work for enum classes

2009-05-25 Thread ian at airs dot com


--- Comment #6 from ian at airs dot com  2009-05-25 18:32 ---
With unscoped enums the similar code works because cp_build_binary_op applies
the default integral promotions to the enums, and winds up comparing two int
values.  The promotions are not applied to scoped enums because
default_conversion checks INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P.  I would
guess that this would work if several checks in cp_build_binary_op also checked
for ENUMERAL_TYPE in cases where they currently check for INTEGER_TYPE.  But I
haven't tried to read the standard to understand where the right fix is.


-- 


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



[Bug c++/38064] [c++0x] operator== doesn't work for enum classes

2009-05-25 Thread jason at gcc dot gnu dot org


--- Comment #7 from jason at gcc dot gnu dot org  2009-05-25 23:01 ---
Subject: Bug 38064

Author: jason
Date: Mon May 25 23:01:02 2009
New Revision: 147854

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=147854
Log:
PR c++/38064
* typeck.c (cp_build_binary_op): Allow ENUMERAL_TYPE in
arithmetic comparisons.
(cp_common_type): Handle scoped enums.

* call.c (promoted_arithmetic_type_p): Don't use INTEGRAL_TYPE_P.
(add_builtin_candidate, add_builtin_candidates): Likewise.
(convert_like_real): Likewise.
* class.c (check_bitfield_decl): Likewise.
* decl.c (check_static_variable_definition): Likewise.
(compute_array_index_type): Likewise.
* decl2.c (grokbitfield): Likewise.
* init.c (build_new_1): Likewise.
* pt.c (convert_nontype_argument): Likewise.
(current_instantiation): Likewise.
* tree.c (pod_type_p): Likewise.
* typeck.c (build_static_cast_1): Likewise.
(build_reinterpret_cast_1): Likewise.

Added:
trunk/gcc/testsuite/g++.dg/cpp0x/enum3.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/call.c
trunk/gcc/cp/class.c
trunk/gcc/cp/decl.c
trunk/gcc/cp/decl2.c
trunk/gcc/cp/init.c
trunk/gcc/cp/pt.c
trunk/gcc/cp/tree.c
trunk/gcc/cp/typeck.c
trunk/gcc/testsuite/ChangeLog


-- 


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



[Bug c++/38064] [c++0x] operator== doesn't work for enum classes

2009-05-25 Thread jason at gcc dot gnu dot org


--- Comment #8 from jason at gcc dot gnu dot org  2009-05-25 23:07 ---
Subject: Bug 38064

Author: jason
Date: Mon May 25 23:07:05 2009
New Revision: 147855

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=147855
Log:
PR c++/38064
* typeck.c (cp_build_binary_op): Allow ENUMERAL_TYPE in
arithmetic comparisons.
(cp_common_type): Handle scoped enums.

Added:
branches/gcc-4_4-branch/gcc/testsuite/g++.dg/cpp0x/enum3.C
  - copied unchanged from r147854, trunk/gcc/testsuite/g++.dg/cpp0x/enum3.C
Modified:
branches/gcc-4_4-branch/gcc/cp/ChangeLog
branches/gcc-4_4-branch/gcc/cp/typeck.c
branches/gcc-4_4-branch/gcc/testsuite/ChangeLog


-- 


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



[Bug c++/38064] [c++0x] operator== doesn't work for enum classes

2009-05-25 Thread jason at gcc dot gnu dot org


--- Comment #9 from jason at gcc dot gnu dot org  2009-05-25 23:12 ---
Fixed for 4.4.1.


-- 

jason at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


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



[Bug c++/38064] [c++0x] operator== doesn't work for enum classes

2009-05-18 Thread paolo dot carlini at oracle dot com


--- Comment #4 from paolo dot carlini at oracle dot com  2009-05-18 22:12 
---
*** Bug 40193 has been marked as a duplicate of this bug. ***


-- 

paolo dot carlini at oracle dot com changed:

   What|Removed |Added

 CC||frabar666 at gmail dot com


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



[Bug c++/38064] [c++0x] operator== doesn't work for enum classes

2009-01-26 Thread piotr dot wyderski at gmail dot com


--- Comment #3 from piotr dot wyderski at gmail dot com  2009-01-26 10:48 
---
The bug is definitely confirmed and it still happens on GCC-4.4.0 trunk
(revision 143673).


-- 

piotr dot wyderski at gmail dot com changed:

   What|Removed |Added

 CC||piotr dot wyderski at gmail
   ||dot com


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



[Bug c++/38064] [c++0x] operator== doesn't work for enum classes

2008-11-08 Thread rbuergel at web dot de


--- Comment #2 from rbuergel at web dot de  2008-11-09 04:22 ---
ok, even for the case i misunderstood the proposal: there are still some
problems with it, making it unuseable.

enum class E { elem };
inline bool operator== (E c1, E c2)
{
return (int) c1 == (int) c2;
}

int main()
{
E::elem == E::elem; //works now
static_assert(E::elem == E::elem, ); //fails
return 1;
}

tc2.cpp: In function 'int main()':
tc2.cpp:10: error: calls to overloaded operators cannot appear in a
constant-expression

... which leads to the conclusion, that strongly-typed enums can't be used in
constant-expression. That's definitely not intended by the proposal.


-- 


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



[Bug c++/38064] [c++0x] operator== doesn't work for enum classes

2008-11-08 Thread rbuergel at web dot de


--- Comment #1 from rbuergel at web dot de  2008-11-09 04:11 ---
extended testcase, this fails for other operators, too

enum class E { elem };

int main()
{
E::elem == E::elem;
E::elem != E::elem;
E::elem   E::elem;
E::elem = E::elem;
E::elem   E::elem;
E::elem = E::elem;
return 1;
}

Or am i missing something from the proposal? Maybe i have to define every
operator i want to use for every enum?


-- 


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