public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/54903] New: Auto + static in-class constant initalization not working @ 2012-10-11 18:54 rhalbersma at gmail dot com 2012-10-11 22:53 ` [Bug c++/54903] [4.8 Regression] " paolo.carlini at oracle dot com ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: rhalbersma at gmail dot com @ 2012-10-11 18:54 UTC (permalink / raw) To: gcc-bugs 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/54903] [4.8 Regression] Auto + static in-class constant initalization not working 2012-10-11 18:54 [Bug c++/54903] New: Auto + static in-class constant initalization not working rhalbersma at gmail dot com @ 2012-10-11 22:53 ` paolo.carlini at oracle dot com 2012-10-12 8:12 ` mpolacek at gcc dot gnu.org ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: paolo.carlini at oracle dot com @ 2012-10-11 22:53 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54903 Paolo Carlini <paolo.carlini at oracle dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2012-10-11 CC| |jason at gcc dot gnu.org Target Milestone|--- |4.8.0 Summary|Auto + static in-class |[4.8 Regression] Auto + |constant initalization not |static in-class constant |working |initalization not working Ever Confirmed|0 |1 --- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-10-11 22:53:25 UTC --- In terms of FSF releases, this is accepted by all the 4.7.x releases up to current 4_7-branch. It's not accepted by current mainline with: 54903.C:14:23: error: use of ‘Angle<N>::value’ before deduction of ‘auto’ typedef Angle<value> type; ^ 54903.C:14:23: error: use of ‘Angle<N>::value’ before deduction of ‘auto’ Thus it seems a Regression (if anything ;) ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/54903] [4.8 Regression] Auto + static in-class constant initalization not working 2012-10-11 18:54 [Bug c++/54903] New: Auto + static in-class constant initalization not working rhalbersma at gmail dot com 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 3 siblings, 0 replies; 5+ messages in thread From: mpolacek at gcc dot gnu.org @ 2012-10-12 8:12 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54903 Marek Polacek <mpolacek at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mpolacek at gcc dot gnu.org --- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> 2012-10-12 08:12:23 UTC --- Started with http://gcc.gnu.org/viewcvs?view=revision&revision=185768 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/54903] [4.8 Regression] Auto + static in-class constant initialization not working 2012-10-11 18:54 [Bug c++/54903] New: Auto + static in-class constant initalization not working rhalbersma at gmail dot com 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 ` jason at gcc dot gnu.org 2012-11-15 16:48 ` jason at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: jason at gcc dot gnu.org @ 2012-11-15 16:12 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54903 --- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2012-11-15 16:12:03 UTC --- Author: jason Date: Thu Nov 15 16:11:56 2012 New Revision: 193535 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=193535 Log: PR c++/54903 * decl2.c (mark_used): Don't complain about auto in templates. Added: trunk/gcc/testsuite/g++.dg/cpp0x/auto36.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/decl2.c ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/54903] [4.8 Regression] Auto + static in-class constant initialization not working 2012-10-11 18:54 [Bug c++/54903] New: Auto + static in-class constant initalization not working rhalbersma at gmail dot com ` (2 preceding siblings ...) 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 3 siblings, 0 replies; 5+ messages in thread From: jason at gcc dot gnu.org @ 2012-11-15 16:48 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54903 Jason Merrill <jason at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> 2012-11-15 16:47:45 UTC --- Fixed. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-11-15 16:48 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2012-10-11 18:54 [Bug c++/54903] New: Auto + static in-class constant initalization not working rhalbersma at gmail dot com 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
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).