Skip to content

Commit e1359db

Browse files
authored
Add example for C2526
1 parent 61d8ea5 commit e1359db

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed
Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
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+
```cpp
15+
// C2526.cpp
16+
// compile with: /c
17+
template <typename T>
18+
class A {};
19+
20+
extern "C" A<int> func() // C2526
21+
{
22+
return {};
23+
}
24+
```

0 commit comments

Comments
 (0)