[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Variadic templates and CRTP
From: |
Alban Linard |
Subject: |
Variadic templates and CRTP |
Date: |
Mon, 19 Oct 2009 01:31:21 -0700 (PDT) |
User-agent: |
G2/1.0 |
Hi,
either i do not understand some parts of variadic templates, or g++
has an erronous handling of types canonization when using variadic
templates and CRTP. Exemple code below.
/* g++-mp-4.5 (GCC) 4.5.0 20091001 (experimental)
* g++-mp-4.5 -std=c++0x bug.cc
* In function 'int main()':
* 25:41: error: invalid initialization of reference of type 'base<a,
derived<a> >&' from expression of type 'derived<a>'
* (hint: internal compiler error on some other uses, canonical types
differ for identical types, for 'base<a, derived<a> >')
*/
struct a {};
template < typename T, typename ENCLOSING >
struct base;
template < typename ENCLOSING >
struct base< a, ENCLOSING >
{};
template < typename... T >
struct derived
: public base< T, derived< T... > >...
{};
int main()
{
derived< a > instance;
base< a, derived< a > >& a_instance = instance;
}
What have i done wrong or is it a bug ?
Thanks,
Alban Linard
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Variadic templates and CRTP,
Alban Linard <=