Skip to content

Commit 8e923d2

Browse files
Merge pull request MicrosoftDocs#4740 from Rageking8/add-example-for-c2058
Add example for C2058
2 parents dd152ad + 5d89a39 commit 8e923d2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

docs/error-messages/compiler-errors-1/compiler-error-c2058.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,16 @@ ms.assetid: 81e08e6b-15f7-41b4-980a-53763e19990c
1111
constant expression is not integral
1212

1313
The context requires an integer constant expression.
14+
15+
The following sample generates C2058:
16+
17+
```cpp
18+
// C2058.cpp
19+
struct alignas(1.5) S {}; // C2058
20+
21+
int main() {
22+
int arr[1.5]; // C2058
23+
}
24+
```
25+
26+
To resolve the issue, use an integer constant expression. For example, `int arr[2];`

0 commit comments

Comments
 (0)