VSO_0000000_instantiate_iterators_misc: Suppress deprecated volatile operation warnings#5656
Conversation
|
Interesting - why is this passing with our current compilers? Are newer versions of Clang noticing this? Regardless, change looks like a slam dunk. ⛹️ |
VSO_0000000_instantiate_iterators_misc: Suppress deprecated volatile operation warnings
I believe there is a bug in MSVC where using a static member of a deprecated struct does not generate a warning, see Godbolt. |
|
I reported this issue on DevCom-10946291. Before MSVC fixes it, the |
|
Bad news: MSVC can generate warnings, but enabling /w14996 or /W3 manually is required. By default, MSVC does not respect |
|
Oh, I expect /W3 as an absolute minimum of effort from users (I also believe it's the IDE default). /W1 and /W2 are jokes. |
|
I found that even with /W3, MSVC doesn't respect the template <typename T>
struct foo_trait
{
static inline constexpr bool value = false;
};
template <typename T>
struct [[deprecated]] foo_trait<const T>
{
static inline constexpr bool value = true;
};
int main()
{
static_assert(foo_trait<const int>::value);
}
I re-reported it as DevCom-10948908. |
|
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
|
At line 1596 of this file, a
volatile tuple<int, int, int>is used, bututilityL217 marks it as deprecated, causing the test to fail. This PR uses#define _SILENCE_CXX20_VOLATILE_DEPRECATION_WARNINGto suppress the warning and allow the test to pass.STL/tests/std/tests/VSO_0000000_instantiate_iterators_misc/test.compile.pass.cpp
Line 1596 in f015db5
STL/stl/inc/utility
Lines 616 to 617 in f015db5