public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rhalbersma at gmail dot com" <gcc-bugzilla@gcc.gnu.org> 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 [thread overview] Message-ID: <bug-54903-4@http.gcc.gnu.org/bugzilla/> (raw) 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<int N, int D> struct Modulus { static auto const value = N % D; }; template<int N> struct Angle { static auto const value = Modulus<N, 360>::value; // ERROR //static int const value = Modulus<N, 360>::value; // OK //static auto const value = N % 360; // OK typedef Angle<value> type; }; I cannot do static auto const = Modulus<N, 360>::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<N, 360>::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
next reply other threads:[~2012-10-11 18:54 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-10-11 18:54 rhalbersma at gmail dot com [this message] 2012-10-11 22:53 ` [Bug c++/54903] [4.8 Regression] " paolo.carlini at oracle dot com 2012-10-12 8:12 ` mpolacek at gcc dot gnu.org 2012-11-15 16:12 ` [Bug c++/54903] [4.8 Regression] Auto + static in-class constant initialization " jason at gcc dot gnu.org 2012-11-15 16:48 ` jason at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-54903-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).