- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This C++ code (Windows) will erroneously produce this error:
enum { ALIGN=16 }; __declspec(align(ALIGN)) float arr[4];
Enums are constexprs, so "ALIGN" is definitely a constant.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
After some playing, it seems that this code works:
enum { ALIGN=16 }; __declspec(align((int)ALIGN)) float arr[4];
According to the standard: "values of unscoped enumeration type are implicitly-convertible to integral types" (i.e., that cast shouldn't be necessary). So this seems to be the underlying issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, I tried the above case as well and what you mention is correct. Thanks for the confirmation.
_Kittur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is still broken in 16 update 2. Also broken for `alignas(...)`.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That's correct Ian, it's broken in update 2. I'll check and see if this is fixed in the main branch or will be in the upcoming update when it's scheduled. Anyways, I'll go ahead and file an issue on this with the developers. Appreciate your patience through this and will keep you updated accordingly.
Regards,
Kittur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ian, I've filed issue (DPD200410436) and will keep you updated, thx.
Kittur

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page