From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16956 invoked by alias); 9 Aug 2013 12:37:26 -0000 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 Received: (qmail 16518 invoked by uid 48); 9 Aug 2013 12:37:21 -0000 From: "janezz55 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/58109] New: alignas() fails to compile with constant expression Date: Fri, 09 Aug 2013 12:37:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: janezz55 at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-08/txt/msg00531.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58109 Bug ID: 58109 Summary: alignas() fails to compile with constant expression Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: janezz55 at gmail dot com Created attachment 30626 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30626&action=edit file demonstrating bug The following example compiles without issue with clang++ 3.3: #include #include #include #include #include namespace detail { template struct max_align : std::integral_constant max_align{}) ? alignof(A) : max_align{}> { }; template struct max_align : std::integral_constant alignof(B)) ? alignof(A) : alignof(B)> { }; template struct max_align : std::integral_constant { }; }; template struct test { alignas(::detail::max_align::value) char store_[10]; }; int main() { test a; return 0; } But even with g++-4.9, it fails with: t.cpp:39:59: error: requested alignment is not an integer constant alignas(::detail::max_align::value) char store_[10];