This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

class partial specialization error (might be g++'s)


Hi, I'm trying to compile the following code with no sucess (using
gcc-4.5.0):

// -----------------------------------

template <class T>
struct identity
{
    typedef T type;
};

template <class T, typename T::type A>
struct foo {};

template <class T, T A>
struct foo<identity<T>, A> {};

int main()
{
    foo<identity<int>,0> bar; // error here
}

// ----------------------------------

gcc fails with:
teste.cpp:18:23: error: aggregate ‘foo<identity<int>, 0> bar’ has
incomplete type and cannot be defined

If I comment out the partial specialization, it compiles.

Since foo is nowhere incomplete, why does the error say so?
Who's to blame, me or g++?

Thanks in advance and best regards,
Rodolfo Lima


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]