------- Comment #5 from rodolfo at rodsoft dot org  2010-08-09 14:38 -------
And I think that the original intent of the attached code (as I wrote in the
summary) was lost when I tried to reduce it. Here's the original version:

//------------------------------------
template <class T, class S> class foo;

template<template<int...> class C, int... II, class S>
struct foo<C<II...>,S>
{
    template <class U>
    struct bar { typedef int type; };
};

template <int... I>
struct A {};

foo<A<3>, float>::bar<int> x;
//-------------------------------

g++ output:
g++ -std=c++0x    teste.cpp   -o teste
teste.cpp: In instantiation of ‘foo<A<3>, float>’:
teste.cpp:13:17:   instantiated from here
teste.cpp:7:9: error: type/value mismatch at argument 2 in template parameter
list for ‘template<template<int ...<anonymous> > class C, int ...II, class S>
template<class U> struct foo<C<II ...>, S>::bar’
teste.cpp:7:9: error:   expected a constant of type ‘int’, got ‘float’
teste.cpp:7:9: error: type/value mismatch at argument 2 in template parameter
list for ‘template<template<int ...<anonymous> > class C, int ...II, class S>
template<class U> struct foo<C<II ...>, S>::bar’
teste.cpp:7:9: error:   expected a constant of type ‘int’, got ‘float’
teste.cpp:13:1: error: ‘bar’ in class ‘foo<A<3>, float>’ does not name a type
make: ** [teste] Erro 1

That is, it is selecting the correct partial specialization. But if make
int...II the last template parameter, it'll compile.


-- 


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

Reply via email to