От: | kov_serg | ||
Дата: | 24.11.24 10:55 | ||
Оценка: |
PD>The following solution:
PD>class C {
PD>public:
PD> static constexpr const void* noop = reinterpret_cast<const void*>(0x1);
PD>};
PD>Although, it compiles and works fine in GCC isn't valid C++ (e.g., it doesn't compile with either clang or VC++2013) because according to the standard § 5.19/2 Constant Expressions [expr.const] the result of a reinterpret_cast can't be a constant expression.