From dee98ee3b18755d9c5d7cf5c7acf92d9f37f8e55 Mon Sep 17 00:00:00 2001 From: Przemo Date: Thu, 28 Jun 2018 12:58:57 +0200 Subject: [PATCH] fix --- CMakeLists.txt | 2 +- inc/owned_pointer.hpp | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 294e978..818578e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.2.2) project("owned_pointer" CXX) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall") set(GMOCK_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/google-test/googlemock/include") set(GTEST_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/google-test/googletest/include") diff --git a/inc/owned_pointer.hpp b/inc/owned_pointer.hpp index a757c1a..9009f5c 100644 --- a/inc/owned_pointer.hpp +++ b/inc/owned_pointer.hpp @@ -322,7 +322,7 @@ inline auto owned_pointer::compare(const owned_pointer& p) const noexcept template auto owned_pointer::stored_address() const noexcept -> element_type* { - return base_type::operator bool() ? + return base_type::operator bool() ? static_cast(_priv::ptr(base_type::operator*())) : nullptr; } @@ -385,10 +385,11 @@ constexpr bool is_expired_enabled_v{is_expired_enabled::value}; template::value, void>::type> inline bool is_expired_enabled_f(const owned_pointer& p) noexcept { - return p.expired() || dynamic_cast<_priv::shared_secret*>(p.operator->()) != nullptr; + return p.expired() || nullptr != dynamic_cast<_priv::shared_secret*>(p.operator->()); } -inline bool is_expired_enabled_f(...) noexcept +template +inline bool is_expired_enabled_f(const T&) noexcept { return false; }