Skip to content

Commit c192538

Browse files
authored
Merge pull request #4734 from Rageking8/add-example-for-c2024
Add example for C2024
2 parents 95e9e35 + 243fe3b commit c192538

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,22 @@ helpviewer_keywords: ["C2024"]
1212
The compiler found an **`alignas`** specifier applied to a function or other type that can't be aligned.
1313

1414
To resolve this error, remove the **`alignas`** specifier.
15+
16+
The following sample generates C2024:
17+
18+
```cpp
19+
// C2024.cpp
20+
namespace alignas(2) ns { // C2024
21+
void func(alignas(8) int x) {} // C2024
22+
}
23+
```
24+
25+
Possible resolution:
26+
27+
```cpp
28+
// C2024b.cpp
29+
// compile with: /c
30+
namespace ns {
31+
void func(int x) {}
32+
}
33+
```

0 commit comments

Comments
 (0)