Skip to content

Commit 159c7cd

Browse files
authored
Fix C2470 example
1 parent fe00e93 commit 159c7cd

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed
Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,34 @@
11
---
2-
description: "Learn more about: Compiler Error C2470"
32
title: "Compiler Error C2470"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C2470"
4+
ms.date: "03/29/2025"
55
f1_keywords: ["C2470"]
66
helpviewer_keywords: ["C2470"]
7-
ms.assetid: e17d2cb8-b84c-447c-976a-625f0c96f3fe
87
---
98
# Compiler Error C2470
109

11-
'function' : looks like a function definition, but there is no parameter list; skipping apparent body
10+
> '*function*': looks like a function definition, but there is no parameter list; skipping apparent body
1211
1312
A function definition is missing its argument list.
1413

15-
The following sample generates C2470:
14+
## Example
15+
16+
The following example generates C2470:
1617

1718
```cpp
1819
// C2470.cpp
19-
int MyFunc {}; // C2470
20-
void MyFunc2() {}; //OK
20+
// compile with: /c
21+
template <typename T>
22+
class C
23+
{
24+
int func();
25+
};
2126

22-
int main(){
23-
MyFunc();
24-
MyFunc2();
27+
template <typename T>
28+
int C<T>::func // C2470
29+
// Use the following line to resolve the error:
30+
// int C<T>::func()
31+
{
32+
return 0;
2533
}
2634
```

docs/error-messages/compiler-errors-1/compiler-errors-c2400-through-c2499.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
description: "Learn more about: Compiler errors C2400 Through C2499"
32
title: "Compiler errors C2400 Through C2499"
3+
description: "Learn more about: Compiler errors C2400 Through C2499"
44
ms.date: "04/21/2019"
55
f1_keywords: ["C2416", "C2442", "C2453", "C2454", "C2455", "C2456", "C2468", "C2475", "C2478", "C2481", "C2497"]
66
helpviewer_keywords: ["C2416", "C2442", "C2453", "C2454", "C2455", "C2456", "C2468", "C2475", "C2478", "C2481", "C2497"]

0 commit comments

Comments
 (0)