- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hellow my friends!
In MSVC2013 perfectly works for me this macro (which allow use enum class as flag enum and disallow convert to int):
#pragma once #define EnumClass(Enum, Type) \ enum class Enum : Type; \ inline Enum operator & (Enum x, Enum y) {return static_cast<Enum> (static_cast<Type>(x) & static_cast<Type>(y));}; \ inline Enum operator | (Enum x, Enum y) {return static_cast<Enum> (static_cast<Type>(x) | static_cast<Type>(y));}; \ inline Enum operator ^ (Enum x, Enum y) {return static_cast<Enum> (static_cast<Type>(x) ^ static_cast<Type>(y));}; \ inline Enum operator ~ (Enum x) {return static_cast<Enum> (~static_cast<Type>(x));}; \ inline Enum& operator &= (Enum& x, Enum y) {x = x & y; return x;}; \ inline Enum& operator |= (Enum& x, Enum y) {x = x | y; return x;}; \ inline Enum& operator ^= (Enum& x, Enum y) {x = x ^ y; return x;}; \ enum class Enum : Type
But in Intel C++ 14.0 fails on:
EnumClass(ToolhelpSnapshotFlag, unsigned __int32) { List = 0x00000001, Process = 0x00000002, Thread = 0x00000004, Module = 0x00000008, Module32 = 0x00000010, All = List | Process | Thread | Module, //error : expression must have a constant value Inherit = 0x80000000 };
How to enable works this on Intel C++ 14.0 without converting result of all operators to underlying type?
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I can reproduce the problem and created a ticket for engineering: DPD200515852
On our compiler for Linux this case passes. So, it seems to be some compatibility setting for VS that's in the way. I'll let you know once we've fixed that or whether there's some workaround.
Thank you for reporting & best regards,
Georg Zitzlsberger
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
this should be fixed with Intel(R) Composer XE 2013 SP1 Update 3, available soon.
Best regards,
Georg Zitzlsberger


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