<type_traits> add declval failure assertion for instantiation (#2087)#2101
Conversation
…oft#2087) The static assertion will prevent the instantiation of ::std::declval at compile-time, preventing its' usage in an evaluated context.
b8a25ef to
aa26192
Compare
fsb4000
left a comment
There was a problem hiding this comment.
Looks good. We can't test failed tests but I tested here: https://gcc.godbolt.org/z/hjodd5ndn
|
Not sure if it would produce a warning about missing return statement even thought unevaluated. If no such warning, that's fine. If there is... maybe call to Edit: actually I think if is unlikely to have a warning/error here, and if there is, it would be compiler bug. |
|
Yes, I thought about that as well. I looked it up at gcc, and they need a return statement. However, in this codebase, other usages of |
|
It's a shame we don't need a return statement; I was going to suggest |
|
I'm mirroring this to an MSVC-internal PR. Please notify me if any further changes are pushed. |
|
Thanks for enforcing this Standard-mandated requirement, and congratulations on your first microsoft/STL commit! 🎉 😸 🚀 This will ship in VS 2022 17.1 Preview 1. |
The static assertion will prevent the instantiation of ::std::declval at compile-time, preventing its' usage in an evaluated context.
Fixes #2087 .