형식 인수 'number'가 잘못되었습니다. 형식이 필요합니다.
제네릭 또는 템플릿 인수가 제네릭 또는 템플릿 선언과 일치하지 않습니다. 형식은 꺾쇠 괄호 안에 나타나야 합니다. 제네릭 또는 템플릿 정의를 확인하여 올바른 형식을 찾습니다.
다음 샘플에서는 C2974를 생성합니다.
// C2974.cpp
// C2974 expected
template <class T>
struct TC {};
template <typename T>
void tf(T){}
int main() {
// Delete the following 2 lines to resolve
TC<1>* tc;
tf<"abc">("abc");
TC<int>* tc;
tf<const char *>("abc");
}
C2974는 제네릭을 사용하는 경우에도 발생할 수 있습니다.
// C2974b.cpp
// compile with: /clr
// C2974 expected
using namespace System;
generic <class T>
ref struct GCtype {};
generic <typename T>
void gf(T){}
int main() {
// Delete the following 2 lines to resolve
GCtype<"a">^ gc;
gf<"a">("abc");
// OK
GCtype<int>^ gc;
gf<String ^>("abc");
}