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

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).