Skip to content

Commit 5f29a81

Browse files
authored
Add example for C2058
1 parent c192538 commit 5f29a81

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

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+
Possible resolutions include removing the construct or modifying the operand to an appropriate integer constant expression.

0 commit comments

Comments
 (0)