Skip to content

Commit

Permalink
Addressing @CaseyCarter's lawyerism
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexGuteniev committed Nov 2, 2021
1 parent 1a882ba commit 60630ee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion stl/inc/mutex
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public:
_Mutex_base(int _Flags = 0) noexcept {
#if _HAS_CXX20
if (_STD is_constant_evaluated()) {
::new (static_cast<void*>(&_Mtx_storage)) _Stl_critical_section_constexpr{};
new (static_cast<void*>(&_Mtx_storage), _Constexpr_mutex_new_tag_t{}) _Stl_critical_section_constexpr{};
} else
#endif // _HAS_CXX20
{
Expand Down
6 changes: 6 additions & 0 deletions stl/inc/xthreads.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ inline int _Check_C_return(int _Res) { // throw exception on failure
}
_STD_END

struct _Constexpr_mutex_new_tag_t {};

class __declspec(novtable) _Stl_critical_section_interface {
public:
virtual void __thiscall _Lock() = 0;
Expand Down Expand Up @@ -165,6 +167,10 @@ class __declspec(novtable) _Stl_critical_section_constexpr final : public _Stl_c

void __thiscall _Destroy() override {}

constexpr void* operator new(size_t, void* p, _Constexpr_mutex_new_tag_t) noexcept {
return p;
}

private:
_Smtx_t _Mtx;
};
Expand Down

0 comments on commit 60630ee

Please sign in to comment.