Errore del compilatore C2782
'declaration': il parametro del modello 'identifier' è ambiguo
Il compilatore non può determinare il tipo di un argomento modello.
L'esempio seguente genera l'errore C2782:
// C2782.cpp
template<typename T>
void f(T, T) {}
int main() {
f(1, 'c'); // C2782
// try the following line instead
// f<int>(1, 'c');
}
C2782 può verificarsi anche quando si usano generics:
// C2782b.cpp
// compile with: /clr
generic<typename T> void gf(T, T) { }
int main() {
gf(1, 'c'); // C2782
// try the following line instead
// gf<int>(1, 'c');
}