From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2540 invoked by alias); 14 Aug 2004 05:23:06 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 2533 invoked by uid 48); 14 Aug 2004 05:23:05 -0000 Date: Sat, 14 Aug 2004 05:23:00 -0000 Message-ID: <20040814052305.2532.qmail@sourceware.org> From: "igodard at pacbell dot net" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20040813225931.17022.igodard@pacbell.net> References: <20040813225931.17022.igodard@pacbell.net> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/17022] Behavior of out-of-range enums X-Bugzilla-Reason: CC X-SW-Source: 2004-08/txt/msg01333.txt.bz2 List-Id: ------- Additional Comments From igodard at pacbell dot net 2004-08-14 05:23 ------- Well, the size thinh mentioned by bangaerth was what I had assumed from the behavior, but it doesn't really explain *all* the behavior. Consider: #include enum A{a,b,c}; enum B{d,e,f,g}; int main() { int three = 3; int four = 4; std::cerr << A(three) << ":" << A(3) << "!" << B(four) <<":" << B(4) << "\n" ; return 0; } That gets you: ~/ootbc/members/members/sweetie/test/src$ a.out 3:3!4:0 So I have re-opened this as a bug, in that the constant-expression result is not the same as the run-time result. This seems to call for more than a warning, even if it is implementation-defined. Ivan -- What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |UNCONFIRMED Resolution|DUPLICATE | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17022