From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21396 invoked by alias); 11 Oct 2012 18:54:15 -0000 Received: (qmail 21310 invoked by uid 48); 11 Oct 2012 18:53:47 -0000 From: "rhalbersma at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/54903] New: Auto + static in-class constant initalization not working Date: Thu, 11 Oct 2012 18:54: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-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rhalbersma 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-Changed-Fields: Message-ID: 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: 2012-10/txt/msg01112.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54903 Bug #: 54903 Summary: Auto + static in-class constant initalization not working Classification: Unclassified Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: rhalbersma@gmail.com template struct Modulus { static auto const value = N % D; }; template struct Angle { static auto const value = Modulus::value; // ERROR //static int const value = Modulus::value; // OK //static auto const value = N % 360; // OK typedef Angle type; }; I cannot do static auto const = Modulus::value, with either MinGW gcc 4.7.2 (Nuwen distro) or Ideone (gcc 4.5.1). Instead, I have to either explicitly denote the type as static int const value = Modulus::value or I have to use auto with the full modular expression as static auto const value = N % 360;. The code appears to be Standard compliant and works on both Visual C++ 2010 Express and Clang 3.1 Link to Stackoverflow: http://stackoverflow.com/q/12834874/819272