diff --git a/src/d3d9/d3d9_mem.h b/src/d3d9/d3d9_mem.h index 1da862653de..7af79da418a 100644 --- a/src/d3d9/d3d9_mem.h +++ b/src/d3d9/d3d9_mem.h @@ -81,7 +81,7 @@ namespace dxvk { D3D9Memory (D3D9Memory&& other); D3D9Memory& operator = (D3D9Memory&& other); - operator bool() const { return m_chunk != nullptr; } + explicit operator bool() const { return m_chunk != nullptr; } void Map(); void Unmap(); @@ -139,7 +139,7 @@ namespace dxvk { D3D9Memory (D3D9Memory&& other); D3D9Memory& operator = (D3D9Memory&& other); - operator bool() const { return m_ptr != nullptr; } + explicit operator bool() const { return m_ptr != nullptr; } void Map() {} void Unmap() {} diff --git a/src/d3d9/d3d9_state.h b/src/d3d9/d3d9_state.h index ad113d130ae..8aeb23e3051 100644 --- a/src/d3d9/d3d9_state.h +++ b/src/d3d9/d3d9_state.h @@ -195,7 +195,7 @@ namespace dxvk { const T* operator & () const { ensure(); return m_data.get(); } T* operator & () { ensure(); return m_data.get(); } - operator bool() { return m_data != nullptr; } + explicit operator bool() const { return m_data != nullptr; } operator T() { ensure(); return *m_data; } void ensure() const { if (!m_data) m_data = std::make_unique(); } @@ -213,7 +213,7 @@ namespace dxvk { T& operator=(const T& x) { m_data = x; return m_data; } - operator bool() { return true; } + explicit operator bool() const { return true; } operator T() { return m_data; } const T* operator -> () const { return &m_data; } diff --git a/src/dxbc/dxbc_decoder.h b/src/dxbc/dxbc_decoder.h index 326e1aaf76c..3fa4c377999 100644 --- a/src/dxbc/dxbc_decoder.h +++ b/src/dxbc/dxbc_decoder.h @@ -196,7 +196,7 @@ namespace dxvk { return out; } - operator bool () const { + explicit operator bool () const { return m_mask != 0; } diff --git a/src/dxvk/dxvk_cs.h b/src/dxvk/dxvk_cs.h index 589e5a8d7a8..ae20746a21a 100644 --- a/src/dxvk/dxvk_cs.h +++ b/src/dxvk/dxvk_cs.h @@ -350,7 +350,7 @@ namespace dxvk { return m_chunk; } - operator bool () const { + explicit operator bool () const { return m_chunk != nullptr; } diff --git a/src/dxvk/dxvk_extensions.h b/src/dxvk/dxvk_extensions.h index 8164ccf6ad6..ae4c8a74f0a 100644 --- a/src/dxvk/dxvk_extensions.h +++ b/src/dxvk/dxvk_extensions.h @@ -61,7 +61,7 @@ namespace dxvk { * provided by the extension can be used. * \returns \c true if the extension is enabled */ - operator bool () const { + explicit operator bool () const { return m_revision != 0; } diff --git a/src/dxvk/dxvk_memory.h b/src/dxvk/dxvk_memory.h index 1dfb535ad59..14dadd5f302 100644 --- a/src/dxvk/dxvk_memory.h +++ b/src/dxvk/dxvk_memory.h @@ -158,7 +158,7 @@ namespace dxvk { * \returns \c true if this slice points to actual device * memory, and \c false if it is undefined. */ - operator bool () const { + explicit operator bool () const { return m_memory != VK_NULL_HANDLE; } diff --git a/src/dxvk/dxvk_sparse.h b/src/dxvk/dxvk_sparse.h index 14d40827931..86231d3e207 100644 --- a/src/dxvk/dxvk_sparse.h +++ b/src/dxvk/dxvk_sparse.h @@ -239,7 +239,7 @@ namespace dxvk { return m_page != other.m_page; } - operator bool () const { + explicit operator bool () const { return m_page != nullptr; } @@ -341,7 +341,7 @@ namespace dxvk { * \brief Checks whether page table is defined * \returns \c true if the page table is defined */ - operator bool () const { + explicit operator bool () const { return m_buffer || m_image; }