public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/34219]  New: [4.3] gcc doesn't accept const members of variadic templates as const
@ 2007-11-25  0:11 rbuergel at web dot de
  2007-11-25  1:01 ` [Bug c++/34219] " pcarlini at suse dot de
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: rbuergel at web dot de @ 2007-11-25  0:11 UTC (permalink / raw)
  To: gcc-bugs

template<typename T, T a, T... Params>
struct max
{
        static const T value = a > max<T, Params>::value ? a : max<T,
Params>::value;
};

template<typename T, T a, T b>
struct max<T, a, b>
{
        static const T value = a > b ? a : b;
};

static const int value1 = max< int, 1, 2>::value;
static const int value2 = max< int, 1, 3, 5>::value;



As the initialization for value1 is accepted as valid, that should be also the
case for value2. But g++ fails with the following error:

g++-4.3.0 -std=c++0x    -c -o test.o test.cpp
test.cpp: In instantiation of 'const int max<int, 1, 3, 5>::value':
test.cpp:14:   instantiated from here
test.cpp:4: error: 'max<int, 1, 3, 5>::value' cannot be initialized by a
non-constant expression when being declared


g++ Version is "gcc version 4.3.0 20071123 (experimental) (GCC)"


-- 
           Summary: [4.3] gcc doesn't accept const members of variadic
                    templates as const
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rbuergel at web dot de


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


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

end of thread, other threads:[~2009-10-07 19:50 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-25  0:11 [Bug c++/34219] New: [4.3] gcc doesn't accept const members of variadic templates as const rbuergel at web dot de
2007-11-25  1:01 ` [Bug c++/34219] " pcarlini at suse dot de
2007-11-25  3:15 ` pinskia at gcc dot gnu dot org
2007-12-20 21:07 ` dgregor at gcc dot gnu dot org
2008-01-19 22:52 ` rbuergel at web dot de
2008-01-29  0:11 ` [Bug c++/34219] gcc doesn't accept const members of variadic templates as const (regression) dgregor at gcc dot gnu dot org
2008-01-29 10:27 ` rbuergel at web dot de
2008-01-29 14:23 ` dgregor at gcc dot gnu dot org
2008-01-29 14:26 ` dgregor at gcc dot gnu dot org
2008-01-29 14:26 ` dgregor at gcc dot gnu dot org
2008-12-02 17:59 ` jason at gcc dot gnu dot org
2009-10-07 19:50 ` [Bug c++/34219] [C++0x] " jason at gcc dot gnu dot 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).