Skip to content

Commit 7fc1cc3

Browse files
authored
Merge pull request #5678 from Rageking8/structure-error-references-in-range-c3381-c3420
Structure error references in range [C3381, C3420]
2 parents 8c74e6d + 3b8a3e7 commit 7fc1cc3

29 files changed

+179
-142
lines changed

docs/error-messages/compiler-errors-2/compiler-error-c3381.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,22 @@ description: "Microsoft C++ compiler error C3381, its causes and how to resolve
44
ms.date: 09/28/2020
55
f1_keywords: ["C3381"]
66
helpviewer_keywords: ["C3381"]
7-
ms.assetid: d276c89f-8377-4cb6-a8d4-7770885f06c4
87
---
98
# Compiler Error C3381
109

1110
> '*identifier*' : assembly access specifiers are only available in code compiled with a /clr option
1211
13-
A type was declared or defined by using an access specifier, which is only permitted in code compiled by using **`/clr`**.
14-
1512
## Remarks
1613

14+
A type was declared or defined by using an access specifier, which is only permitted in code compiled by using **`/clr`**.
15+
1716
This error may result from a misplaced **`public`**, **`protected`**, or **`private`** keyword, or a missing colon (**`:`**) after an access specifier within a **`class`** or **`struct`**.
1817

1918
In C++/CLI, native types can be visible outside an assembly, but you can only specify assembly access for native types in a **`/clr`** compilation. For more information, see [Type visibility](../../dotnet/how-to-define-and-consume-classes-and-structs-cpp-cli.md#BKMK_Type_visibility) and [`/clr` (Common Language Runtime Compilation)](../../build/reference/clr-common-language-runtime-compilation.md).
2019

2120
## Example
2221

23-
The following sample generates C3381. To fix it, first either remove the **`public`** specifier from the `class A` definition, or compile by using the **`/clr`** option. Next, add a colon after **`private`** to specify access for `class B {} b;`. That's because a nested class can't have an assembly access specifier as part of its declaration.
22+
The following example generates C3381. To fix it, first either remove the **`public`** specifier from the `class A` definition, or compile by using the **`/clr`** option. Next, add a colon after **`private`** to specify access for `class B {} b;`. That's because a nested class can't have an assembly access specifier as part of its declaration.
2423

2524
```cpp
2625
// C3381.cpp

docs/error-messages/compiler-errors-2/compiler-error-c3382.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
---
2-
description: "Learn more about: Compiler Error C3382"
32
title: "Compiler Error C3382"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C3382"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C3382"]
66
helpviewer_keywords: ["C3382"]
7-
ms.assetid: a7603abd-ac4e-4ae6-a02b-3bdc6d1908a6
87
---
98
# Compiler Error C3382
109

11-
'sizeof' is not supported with /clr:safe
10+
> 'sizeof' is not supported with /clr:safe
11+
12+
## Remarks
1213

1314
The output file of a **/clr:safe** compilation is a file that is verifiably type safe, and sizeof is not supported because the return value of the sizeof operator is size_t, whose size varies depending on the operating system.
1415

@@ -22,7 +23,7 @@ For more information, see,
2223

2324
## Example
2425

25-
The following sample generates C3382.
26+
The following example generates C3382.
2627

2728
```cpp
2829
// C3382.cpp

docs/error-messages/compiler-errors-2/compiler-error-c3383.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
---
2-
description: "Learn more about: Compiler Error C3383"
32
title: "Compiler Error C3383"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C3383"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C3383"]
66
helpviewer_keywords: ["C3383"]
7-
ms.assetid: ceb7f725-f417-4dc3-8496-0f413bb76687
87
---
98
# Compiler Error C3383
109

11-
'operator new' is not supported with /clr:safe
10+
> 'operator new' is not supported with /clr:safe
11+
12+
## Remarks
1213

1314
The output file of a **/clr:safe** compilation is a file that is verifiably type safe, and pointers are not supported.
1415

@@ -20,7 +21,7 @@ For more information, see,
2021

2122
## Example
2223

23-
The following sample generates C3383.
24+
The following example generates C3383.
2425

2526
```cpp
2627
// C3383.cpp

docs/error-messages/compiler-errors-2/compiler-error-c3384.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
---
2-
description: "Learn more about: Compiler Error C3384"
32
title: "Compiler Error C3384"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C3384"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C3384"]
66
helpviewer_keywords: ["C3384"]
7-
ms.assetid: c9f92c6a-62a9-4333-b2b1-bc55c7f288b6
87
---
98
# Compiler Error C3384
109

11-
'type_parameter' : the value constraint and the ref constraint are mutually exclusive
10+
> 'type_parameter' : the value constraint and the ref constraint are mutually exclusive
11+
12+
## Remarks
1213

1314
You cannot constrain a generic type to both **`value class`** and **`ref class`**.
1415

1516
See [Constraints on Generic Type Parameters (C++/CLI)](../../extensions/constraints-on-generic-type-parameters-cpp-cli.md) for more information.
1617

1718
## Example
1819

19-
The following sample generates C3384.
20+
The following example generates C3384.
2021

2122
```cpp
2223
// C3384.cpp

docs/error-messages/compiler-errors-2/compiler-error-c3385.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
---
2-
description: "Learn more about: Compiler Error C3385"
32
title: "Compiler Error C3385"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C3385"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C3385"]
66
helpviewer_keywords: ["C3385"]
7-
ms.assetid: 5f1838c1-986e-47db-8dbc-e06976b83cf3
87
---
98
# Compiler Error C3385
109

11-
'class::function' : a function that has a DllImport Custom attribute cannot return an instance of a class
10+
> 'class::function' : a function that has a DllImport Custom attribute cannot return an instance of a class
11+
12+
## Remarks
1213

1314
A function defined as being in a .dll file specified with the `DllImport` attribute cannot return an instance of a class.
1415

15-
The following sample generates C3385:
16+
## Example
17+
18+
The following example generates C3385:
1619

1720
```cpp
1821
// C3385.cpp

docs/error-messages/compiler-errors-2/compiler-error-c3386.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
---
2-
description: "Learn more about: Compiler Error C3386"
32
title: "Compiler Error C3386"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C3386"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C3386"]
66
helpviewer_keywords: ["C3386"]
7-
ms.assetid: 93fa8c33-0f10-402b-8eec-b0a217a1f8dc
87
---
98
# Compiler Error C3386
109

1110
> '*type-name*' : `__declspec(dllexport)`/`__declspec(dllimport)` cannot be applied to a managed or WinRT type
1211
12+
## Remarks
13+
1314
The [`dllimport`](../../cpp/dllexport-dllimport.md) and [`dllexport`](../../cpp/dllexport-dllimport.md) **`__declspec`** modifiers aren't valid on a managed or Windows Runtime type.
1415

15-
The following sample generates C3386 and shows how to fix it:
16+
## Example
17+
18+
The following example generates C3386 and shows how to fix it:
1619

1720
```cpp
1821
// C3386.cpp

docs/error-messages/compiler-errors-2/compiler-error-c3387.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
---
2-
description: "Learn more about: Compiler Error C3387"
32
title: "Compiler Error C3387"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C3387"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C3387"]
66
helpviewer_keywords: ["C3387"]
7-
ms.assetid: c54d9925-ed14-4976-b8db-e8d4dc84e536
87
---
98
# Compiler Error C3387
109

11-
'member' : __declspec(dllexport)/\__declspec(dllimport) cannot be applied to a member of a managed or WinRT type
10+
> 'member' : __declspec(dllexport)/\__declspec(dllimport) cannot be applied to a member of a managed or WinRT type
11+
12+
## Remarks
1213

1314
The `dllimport` and [dllexport](../../cpp/dllexport-dllimport.md) **`__declspec`** modifiers are not valid on members of a managed or Windows Runtime type.
1415

15-
The following sample generates C3387 and shows how to fix it:
16+
## Example
17+
18+
The following example generates C3387 and shows how to fix it:
1619

1720
```cpp
1821
// C3387a.cpp

docs/error-messages/compiler-errors-2/compiler-error-c3388.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
---
2-
description: "Learn more about: Compiler Error C3388"
32
title: "Compiler Error C3388"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C3388"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C3388"]
66
helpviewer_keywords: ["C3388"]
7-
ms.assetid: 34336545-ed13-4d81-ab5f-f869799fe4c2
87
---
98
# Compiler Error C3388
109

11-
'type' : not allowed as a constraint, assuming 'ref class' to continue parsing
10+
> 'type' : not allowed as a constraint, assuming 'ref class' to continue parsing
11+
12+
## Remarks
1213

1314
A constraint was specified on a generic type, but the constraint was not specified correctly. See [Constraints on Generic Type Parameters (C++/CLI)](../../extensions/constraints-on-generic-type-parameters-cpp-cli.md) for more information.
1415

1516
## Example
1617

17-
The following sample generates C3388.
18+
The following example generates C3388.
1819

1920
```cpp
2021
// C3388.cpp

docs/error-messages/compiler-errors-2/compiler-error-c3389.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
2-
description: "Learn more about: Compiler Error C3389"
32
title: "Compiler Error C3389"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C3389"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C3389"]
66
helpviewer_keywords: ["C3389"]
7-
ms.assetid: eaaffe17-23f2-413c-b1ad-f7220cfa1334
87
---
98
# Compiler Error C3389
109

@@ -18,7 +17,7 @@ A [`__declspec`](../../cpp/declspec.md) modifier used implies a per-process stat
1817

1918
## Example
2019

21-
The following sample generates C3389:
20+
The following example generates C3389:
2221

2322
```cpp
2423
// C3389.cpp

docs/error-messages/compiler-errors-2/compiler-error-c3390.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,20 @@ description: "Microsoft C++ compiler error C3390, its causes and how to resolve
44
ms.date: 09/26/2020
55
f1_keywords: ["C3390"]
66
helpviewer_keywords: ["C3390"]
7-
ms.assetid: 84800a87-c8e6-45aa-82ae-02f816dc8d97
87
---
98
# Compiler Error C3390
109

1110
> '*type_arg*' : invalid type argument for generic parameter '*param*' of generic '*generic_type*', must be a reference type
1211
13-
A generic type was instantiated incorrectly. Check the type definition.
14-
1512
## Remarks
1613

14+
A generic type was instantiated incorrectly. Check the type definition.
15+
1716
For more information, see [Generics](../../extensions/generics-cpp-component-extensions.md).
1817

1918
## Example
2019

21-
The first sample uses C# to create a component that contains a generic type. This type has certain constraints that aren't supported when authoring generic types in C++/CLI. For more information, see [Constraints on Type Parameters](/dotnet/csharp/programming-guide/generics/constraints-on-type-parameters).
20+
The first example uses C# to create a component that contains a generic type. This type has certain constraints that aren't supported when authoring generic types in C++/CLI. For more information, see [Constraints on Type Parameters](/dotnet/csharp/programming-guide/generics/constraints-on-type-parameters).
2221

2322
```csharp
2423
// C3390.cs
@@ -30,7 +29,7 @@ where V : struct
3029
where N : new() {}
3130
```
3231

33-
When the C3390.dll component is available, the following sample generates C3390.
32+
When the C3390.dll component is available, the following example generates C3390.
3433

3534
```cpp
3635
// C3390_b.cpp

0 commit comments

Comments
 (0)