public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/47897] New: [C++0x] static const member variable is not constant expression
@ 2011-02-25 21:23 flast at flast dot jp
  2011-02-26  0:18 ` [Bug c++/47897] [4.6 Regression][C++0x] " paolo.carlini at oracle dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: flast at flast dot jp @ 2011-02-25 21:23 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47897

           Summary: [C++0x] static const member variable is not constant
                    expression
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: flast@flast.jp


GCC4.6.0(with C++0x mode) reject static const member variable depending
template parameter type.

---- testcase.C ----
template < typename T, T N >
struct S
{
    static const T value = N;
    typedef S< T, value + 1 > next;
};
--------------------

It seems caused by r170488 (git: cfa61f8435164f3205d70c7e1c5038b2d881aa1d).

In other case, GCC accepts codes.
For example:
---- testcase.C (accepted) ----
template < int N >
struct S
{
    static const int value = N;
    typedef S< value + 1 > next;
};
-------------------------------

Another case:
---- testcase.C (accepted) ----
template < typename T, T N >
struct S
{
    static constexpr T value = N;
    typedef S< T, value + 1 > next;
};
-------------------------------


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-02-27 16:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-25 21:23 [Bug c++/47897] New: [C++0x] static const member variable is not constant expression flast at flast dot jp
2011-02-26  0:18 ` [Bug c++/47897] [4.6 Regression][C++0x] " paolo.carlini at oracle dot com
2011-02-26 18:36 ` jason at gcc dot gnu.org
2011-02-27  8:16 ` jason at gcc dot gnu.org
2011-02-27 16:30 ` jakub 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).