The following code compiles on gcc-4.2/4.3/4.4 but doesn't on gcc-4.5, with
error: aggregate ‘foo<identity<int>, 0> bar’ has incomplete type and cannot be
defined

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
}

g++ somehow is messed up because foo is defined, and it should pick the partial
specialization. If we comment the latter, it compiles, picking the main foo
definition.


-- 
           Summary: [4.5 Regression] class partial specialization error
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rodolfo at rodsoft dot org
 GCC build triplet: x86_64-pc-linux-gnu
  GCC host triplet: x86_64-pc-linux-gnu
GCC target triplet: x86_64-pc-linux-gnu


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

Reply via email to