Skip to content

Remove outdated example and update C2998 error reference #5474

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
17 changes: 5 additions & 12 deletions docs/error-messages/compiler-errors-2/compiler-error-c2998.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
---
description: "Learn more about: Compiler Error C2998"
title: "Compiler Error C2998"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2998"
ms.date: 06/29/2025
f1_keywords: ["C2998"]
helpviewer_keywords: ["C2998"]
ms.assetid: 8193d491-b5d9-4477-acb1-cf166889c070
---
# Compiler Error C2998

'identifier' : cannot be a template definition
> '*identifier*': cannot be a template definition

The compiler could not process the syntax used in the template definition.
## Remarks

The following sample generates C2998:

```cpp
// C2998.cpp
// compile with: /c
template <class T> int x = 1018; // C2998
```
The compiler could not process the syntax used in the template definition.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ The articles in this section of the documentation explain a subset of the error
| [Compiler error C2995](compiler-error-c2995.md) | '*declaration*': function template has already been defined |
| [Compiler error C2996](compiler-error-c2996.md) | '*function*': recursive function template definition |
| Compiler error C2997 | '*function*': array bound cannot be deduced from a default member initializer |
| [Compiler error C2998](compiler-error-c2998.md) | '*declarator*': cannot be a template definition |
| [Compiler error C2998](compiler-error-c2998.md) | '*identifier*': cannot be a template definition |

## See also

Expand Down