Skip to content

Structure error references in range [C3081, C3130] #5662

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3084.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
---
description: "Learn more about: Compiler Error C3084"
title: "Compiler Error C3084"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3084"
ms.date: 11/04/2016
f1_keywords: ["C3084"]
helpviewer_keywords: ["C3084"]
ms.assetid: 0362cb70-e24e-476f-a24d-8f5bb97c3afd
---
# Compiler Error C3084

'function': a finalizer/destructor cannot be 'keyword'
> 'function': a finalizer/destructor cannot be 'keyword'

## Remarks

A finalizer or destructor was declared incorrectly.

For example, a destructor should not be marked as sealed. The destructor will be inaccessible to derived types. For more information, see [Explicit Overrides](../../extensions/explicit-overrides-cpp-component-extensions.md) and [Destructors and finalizers in How to: Define and consume classes and structs (C++/CLI)](../../dotnet/how-to-define-and-consume-classes-and-structs-cpp-cli.md#BKMK_Destructors_and_finalizers).

## Example

The following sample generates C3084.
The following example generates C3084.

```cpp
// C3084.cpp
Expand Down
11 changes: 6 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3085.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
---
description: "Learn more about: Compiler Error C3085"
title: "Compiler Error C3085"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3085"
ms.date: 11/04/2016
f1_keywords: ["C3085"]
helpviewer_keywords: ["C3085"]
ms.assetid: 1ac40bf2-f63e-439e-8921-47e6dadc8354
---
# Compiler Error C3085

'constructor': a constructor cannot be 'keyword'
> 'constructor': a constructor cannot be 'keyword'

## Remarks

A constructor was declared incorrectly. See [Override Specifiers](../../extensions/override-specifiers-cpp-component-extensions.md) for more information.

## Example

The following sample generates C3085.
The following example generates C3085.

```cpp
// C3085.cpp
Expand Down
11 changes: 6 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3087.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
---
description: "Learn more about: Compiler Error C3087"
title: "Compiler Error C3087"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3087"
ms.date: 11/04/2016
f1_keywords: ["C3087"]
helpviewer_keywords: ["C3087"]
ms.assetid: 4f5bdd52-a853-4f02-b160-6868e9190b9d
---
# Compiler Error C3087

'named_argument': call of 'attribute' already initializes this member
> 'named_argument': call of 'attribute' already initializes this member

## Remarks

A named argument was specified in the same attribute block as an unnamed argument for the same value. Specify only a named or unnamed argument.

## Example

The following sample generates C3087.
The following example generates C3087.

```cpp
// C3087.cpp
Expand Down
11 changes: 6 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3094.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
---
description: "Learn more about: Compiler Error C3094"
title: "Compiler Error C3094"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3094"
ms.date: 11/04/2016
f1_keywords: ["C3094"]
helpviewer_keywords: ["C3094"]
ms.assetid: 10da9b7c-e72d-4013-9925-c83e1bb142db
---
# Compiler Error C3094

'attribute': anonymous usage not allowed
> 'attribute': anonymous usage not allowed

## Remarks

An attribute was not scoped correctly. For more information, see [User-Defined Attributes](../../extensions/user-defined-attributes-cpp-component-extensions.md).

## Example

The following sample generates C3094.
The following example generates C3094.

```cpp
// C3094.cpp
Expand Down
11 changes: 6 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3095.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
---
description: "Learn more about: Compiler Error C3095"
title: "Compiler Error C3095"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3095"
ms.date: 11/04/2016
f1_keywords: ["C3095"]
helpviewer_keywords: ["C3095"]
ms.assetid: cde725be-0936-40f6-9e57-e1d7d0710f83
---
# Compiler Error C3095

'attribute': attribute cannot be repeated
> 'attribute': attribute cannot be repeated

## Remarks

Some attributes are declared such that, multiple occurrences of the attribute cannot be applied to a target.

For more information, see [User-Defined Attributes](../../extensions/user-defined-attributes-cpp-component-extensions.md).

## Example

The following sample generates C3095.
The following example generates C3095.

```cpp
// C3095.cpp
Expand Down
9 changes: 5 additions & 4 deletions docs/error-messages/compiler-errors-2/compiler-error-c3096.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
description: "Learn more about: Compiler Error C3096"
title: "Compiler Error C3096"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3096"
ms.date: 11/04/2016
f1_keywords: ["C3096"]
helpviewer_keywords: ["C3096"]
ms.assetid: 56353c9a-800c-474f-b428-3e5d2a7afc9a
---
# Compiler Error C3096

'attribute': attribute is allowed on data members of attribute classes only
> 'attribute': attribute is allowed on data members of attribute classes only

## Remarks

An attribute was applied incorrectly.

Expand Down
11 changes: 6 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3097.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
---
description: "Learn more about: Compiler Error C3097"
title: "Compiler Error C3097"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3097"
ms.date: 11/04/2016
f1_keywords: ["C3097"]
helpviewer_keywords: ["C3097"]
ms.assetid: b24bd8f8-e04f-4fbb-be57-4feb9165572e
---
# Compiler Error C3097

'attribute': attribute must be scoped with 'assembly:' or 'module:'
> 'attribute': attribute must be scoped with 'assembly:' or 'module:'

## Remarks

A global attribute was used incorrectly.

For more information, see [User-Defined Attributes](../../extensions/user-defined-attributes-cpp-component-extensions.md).

## Example

The following sample generates C3097.
The following example generates C3097.

```cpp
// C3097.cpp
Expand Down
11 changes: 6 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3099.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
---
description: "Learn more about: Compiler Error C3099"
title: "Compiler Error C3099"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3099"
ms.date: 11/04/2016
f1_keywords: ["C3099"]
helpviewer_keywords: ["C3099"]
ms.assetid: b3dded0f-76c9-42c1-991b-532eb8619661
---
# Compiler Error C3099

'keyword': use [System::AttributeUsageAttribute] for managed attributes; use [Windows::Foundation::Metadata::AttributeUsageAttribute] for WinRT attributes
> 'keyword': use [System::AttributeUsageAttribute] for managed attributes; use [Windows::Foundation::Metadata::AttributeUsageAttribute] for WinRT attributes

## Remarks

Use <xref:System.AttributeUsageAttribute> to declare **/clr** attributes. Use `Windows::Foundation::Metadata::AttributeUsageAttribute` to declare Windows Runtime attributes.

For more information about /CLR attributes, see [User-Defined Attributes](../../extensions/user-defined-attributes-cpp-component-extensions.md). For supported attributes in Windows Runtime, see [Windows.Foundation.Metadata namespace](/uwp/api/windows.foundation.metadata)

## Example

The following sample generates C3099 and shows how to fix it.
The following example generates C3099 and shows how to fix it.

```cpp
// C3099.cpp
Expand Down
11 changes: 6 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3100.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
---
description: "Learn more about: Compiler Error C3100"
title: "Compiler Error C3100"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3100"
ms.date: 11/04/2016
f1_keywords: ["C3100"]
helpviewer_keywords: ["C3100"]
ms.assetid: 7a9c9eaf-08ef-442d-94a0-e457beee8549
---
# Compiler Error C3100

'target' : unknown attribute qualifier
> 'target' : unknown attribute qualifier

## Remarks

An invalid attribute target was specified.

For more information, see [User-Defined Attributes](../../extensions/user-defined-attributes-cpp-component-extensions.md).

## Example

The following sample generates C3100.
The following example generates C3100.

```cpp
// C3100.cpp
Expand Down
11 changes: 6 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3101.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
---
description: "Learn more about: Compiler Error C3101"
title: "Compiler Error C3101"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3101"
ms.date: 11/04/2016
f1_keywords: ["C3101"]
helpviewer_keywords: ["C3101"]
ms.assetid: 4f673766-d4f7-4632-94a5-d36a83f7f4b5
---
# Compiler Error C3101

illegal expression for named attribute argument 'field'
> illegal expression for named attribute argument 'field'

## Remarks

When initializing a named attribute argument, the value must be a compile time constant.

For more information on attributes, see [User-Defined Attributes](../../extensions/user-defined-attributes-cpp-component-extensions.md).

## Example

The following sample generates C3101.
The following example generates C3101.

```cpp
// C3101.cpp
Expand Down
11 changes: 6 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3103.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
---
description: "Learn more about: Compiler Error C3103"
title: "Compiler Error C3103"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3103"
ms.date: 11/04/2016
f1_keywords: ["C3103"]
helpviewer_keywords: ["C3103"]
ms.assetid: 7984bd3e-d51d-43e4-b6f4-08c1e9fb9704
---
# Compiler Error C3103

'argument': repeated named argument
> 'argument': repeated named argument

## Remarks

An attribute can not repeat named arguments.

For more information, see [User-Defined Attributes](../../extensions/user-defined-attributes-cpp-component-extensions.md).

## Example

The following sample generates C3103.
The following example generates C3103.

```cpp
// C3103.cpp
Expand Down
13 changes: 7 additions & 6 deletions docs/error-messages/compiler-errors-2/compiler-error-c3104.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
description: "Learn more about: Compiler Error C3104"
title: "Compiler Error C3104"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3104"
ms.date: 11/04/2016
f1_keywords: ["C3104"]
helpviewer_keywords: ["C3104"]
ms.assetid: b5648d47-e5d3-4b45-a3c0-f46e04eae731
---
# Compiler Error C3104

illegal attribute argument
> illegal attribute argument

## Remarks

You specified an invalid argument to an attribute.

Expand All @@ -18,7 +19,7 @@ This error can be generated as a result of compiler conformance work that was do

## Examples

The following sample generates C3104.
The following example generates C3104.

```cpp
// C3104a.cpp
Expand All @@ -37,7 +38,7 @@ public ref struct ABC : public Attribute {
ref struct AStruct{};
```

The following sample generates C3104.
The following example generates C3104.

```cpp
// C3104b.cpp
Expand Down
11 changes: 6 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3106.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
---
description: "Learn more about: Compiler Error C3106"
title: "Compiler Error C3106"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3106"
ms.date: 11/04/2016
f1_keywords: ["C3106"]
helpviewer_keywords: ["C3106"]
ms.assetid: 39d97a32-0905-4702-87d3-7f8ce473fb93
---
# Compiler Error C3106

'attribute': unnamed arguments must precede named arguments
> 'attribute': unnamed arguments must precede named arguments

## Remarks

Unnamed arguments must be passed to an attribute before named arguments.

For more information, see [User-Defined Attributes](../../extensions/user-defined-attributes-cpp-component-extensions.md).

## Example

The following sample generates C3106.
The following example generates C3106.

```cpp
// C3106.cpp
Expand Down
Loading