This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/34219] gcc doesn't accept const members of variadic templates as const (regression)
- From: "rbuergel at web dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Jan 2008 10:17:33 -0000
- Subject: [Bug c++/34219] gcc doesn't accept const members of variadic templates as const (regression)
- References: <bug-34219-15404@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #5 from rbuergel at web dot de 2008-01-29 10:17 -------
for #3, using static_assert( Comp<T...>::value > 0, "" ); makes it work.
using max<T, Params...> for #1 leads gcc to an error: "cannot expand 'Params
...' into a fixed-length argument list"
updated testcase:
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;
If there are no more errors in thats code, this is a rejects-valid, not an
error-recovery
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34219