From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12140 invoked by alias); 15 Jan 2013 19:39:05 -0000 Received: (qmail 12031 invoked by uid 48); 15 Jan 2013 19:38:47 -0000 From: "glisse at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/55993] [C++11] derived-to-base conversion fails in constant expression Date: Tue, 15 Jan 2013 19:39:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: glisse at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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: 2013-01/txt/msg01419.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55993 --- Comment #8 from Marc Glisse 2013-01-15 19:38:46 UTC --- (In reply to comment #7) > e.cc:9:41: error: the value of 'd' is not usable in a constant expression > constexpr auto g=static_cast(d); // FAIL different > ^ > e.cc:6:13: note: 'd' used in its own initializer > constexpr D d; > ^ Those are just because of the missing {} after the declaration of d, the messages are not optimal, but forget my last comment. It's just that the error is not exactly in the derived to base conversion but trying to use that value afterwards.