Skip to content

Commit

Permalink
Add a feature test to test for CXX11 override
Browse files Browse the repository at this point in the history
  • Loading branch information
Naios committed Oct 10, 2017
1 parent d0fb5d3 commit 875b024
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmake/HPX_AddConfigTest.cmake
Expand Up @@ -555,6 +555,14 @@ macro(hpx_check_for_cxx11_noreturn_attribute)
FILE ${ARGN})
endmacro()

###############################################################################
macro(hpx_check_for_cxx11_override)
add_hpx_config_test(HPX_WITH_CXX11_OVERRIDE
SOURCE cmake/tests/cxx11_override.cpp
FILE ${ARGN}
CMAKECXXFEATURE cxx_override)
endmacro()

###############################################################################
macro(hpx_check_for_cxx14_constexpr)
add_hpx_config_test(HPX_WITH_CXX14_CONSTEXPR
Expand Down
3 changes: 3 additions & 0 deletions cmake/HPX_PerformCxxFeatureTests.cmake
Expand Up @@ -79,6 +79,9 @@ macro(hpx_perform_cxx_feature_tests)
hpx_check_for_cxx11_variadic_templates(
REQUIRED "HPX needs support for C++11 variadic templates")

hpx_check_for_cxx11_override(
REQUIRED "HPX needs support for C++11 override")

# Check the availability of certain C++11 library features
hpx_check_for_cxx11_std_array(
REQUIRED "HPX needs support for C++11 std::array")
Expand Down
29 changes: 29 additions & 0 deletions cmake/tests/cxx11_override.cpp
@@ -0,0 +1,29 @@
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2017 Denis Blank
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
////////////////////////////////////////////////////////////////////////////////

class my_base
{
public:
my_base() { }
virtual ~my_base() { }

virtual void do_sth() { }
};

class my_inh : public my_base
{
public:
my_inh() { }

void do_sth() override { }
};

int main()
{
my_base* obj = new my_inh();
delete obj;
}

0 comments on commit 875b024

Please sign in to comment.