From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10474 invoked by alias); 9 Nov 2008 04:23:46 -0000 Received: (qmail 11081 invoked by uid 48); 9 Nov 2008 04:22:19 -0000 Date: Sun, 09 Nov 2008 04:23:00 -0000 Message-ID: <20081109042219.11080.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/38064] [c++0x] operator== doesn't work for enum classes In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "rbuergel at web dot de" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-11/txt/msg00664.txt.bz2 ------- 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