Skip to content

Commit 8f56486

Browse files
authored
Merge pull request #4977 from Rageking8/add-example-for-c2526
Add example for C2526
2 parents c994155 + 4ef7eb2 commit 8f56486

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed
Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
11
---
22
description: "Learn more about: Compiler Error C2526"
33
title: "Compiler Error C2526"
4-
ms.date: "11/04/2016"
4+
ms.date: "03/08/2024"
55
f1_keywords: ["C2526"]
66
helpviewer_keywords: ["C2526"]
7-
ms.assetid: 0f8c554c-f990-457e-bcae-b6f273481825
87
---
98
# Compiler Error C2526
109

1110
'identifier1' : C linkage function cannot return C++ class 'identifier2'
1211

1312
A function defined with C linkage cannot return a user-defined type.
13+
14+
The following sample generates C2526:
15+
16+
```cpp
17+
// C2526.cpp
18+
// compile with: /c
19+
template <typename T>
20+
class A {};
21+
22+
extern "C" A<int> func() // C2526
23+
{
24+
return A<int>();
25+
}
26+
```

0 commit comments

Comments
 (0)