This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/35815] New: partial specialization of variadic templates with different order of parameter results in different semantics
- From: "sultansharem at gmx dot ch" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Apr 2008 14:48:35 -0000
- Subject: [Bug c++/35815] New: partial specialization of variadic templates with different order of parameter results in different semantics
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
the static 2nd static assertion in x() fails. if the other partial
specialization of template d is used, the code works as expected. As you can
see the only difference between these d's is, that the T parameter is at a
different position which shouldn't make a difference to the outcome of typedef
T t;
<code>
template <class...>
struct p;
template <class A, class B> struct i { typedef i t; };
template <class I> struct d;
template <class I> struct n;
template <class... L, class T, class... R> struct n<i<p<L...>, p<T, R...> > > :
i<p<L..., T>, p<R...> > {};
#if 1
template <class... L, class T, class... R>
struct d<i<p<L...>, p<T, R...> > >
{
typedef T t;
};
#else
template <class T, class... L, class... R>
struct d<i<p<L...>, p<T, R...> > >
{
typedef T t;
};
#endif
template <class A, class B> struct is_same { static const bool v=false; };
template <class A> struct is_same<A, A> { static const bool v=true; };
void x()
{
typedef i<p<>, p<short, int, bool> > i0;
static_assert(is_same<d<i0>::t, short>::v,"");
typedef n<i0>::t i1;
static_assert(is_same<d<i1>::t, int>::v,"");
}
--
Summary: partial specialization of variadic templates with
different order of parameter results in different
semantics
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: sultansharem at gmx dot ch
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35815