RAD Studio |  |

E2295: Too many candidate template specializations from 'specifier' (C++)

When reference a class template specialization, it is possible that more than one possible candidate might result from a single reference. This can only really happen among class partial specializations, when more than one partial specialization is contending for a possible match:

Copy Code

    template<class T, class U>
    class foo;
    template<class T>
    class foo<T, T *>;
    template<class T>
    class foo<T *, T>;
    foo<int *, int *> x;  // error: which partial specialization to use?

In this example, both partial specializations are equally valid, and neither is more specialized than the other, so an error would result.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!