summaryrefslogtreecommitdiffstats
path: root/Source/Checks
diff options
context:
space:
mode:
authorDaniel Pfeifer <daniel@pfeifer-mail.de>2016-06-22 22:37:10 (GMT)
committerBrad King <brad.king@kitware.com>2016-06-27 14:37:41 (GMT)
commit5286110d6f106e03ee6c5bdeea48d62674656c9f (patch)
tree06ff5fe903c116e5c4f6dbe384c4e3f01e2ddc17 /Source/Checks
parent09aa2c94186081267753dedb50acb102717a6577 (diff)
downloadCMake-5286110d6f106e03ee6c5bdeea48d62674656c9f.zip
CMake-5286110d6f106e03ee6c5bdeea48d62674656c9f.tar.gz
CMake-5286110d6f106e03ee6c5bdeea48d62674656c9f.tar.bz2
cxx features: add check for override
Diffstat (limited to 'Source/Checks')
-rw-r--r--Source/Checks/cm_cxx_features.cmake1
-rw-r--r--Source/Checks/cm_cxx_override.cxx20
2 files changed, 21 insertions, 0 deletions
diff --git a/Source/Checks/cm_cxx_features.cmake b/Source/Checks/cm_cxx_features.cmake
index e550e64..18dbaf8 100644
--- a/Source/Checks/cm_cxx_features.cmake
+++ b/Source/Checks/cm_cxx_features.cmake
@@ -32,6 +32,7 @@ function(cm_check_cxx_feature name)
endfunction()
if(CMAKE_CXX_STANDARD)
+ cm_check_cxx_feature(override)
cm_check_cxx_feature(unordered_map)
cm_check_cxx_feature(unordered_set)
endif()
diff --git a/Source/Checks/cm_cxx_override.cxx b/Source/Checks/cm_cxx_override.cxx
new file mode 100644
index 0000000..9395a0a
--- /dev/null
+++ b/Source/Checks/cm_cxx_override.cxx
@@ -0,0 +1,20 @@
+struct Foo
+{
+ virtual int test() const = 0;
+};
+
+struct Bar : Foo
+{
+ int test() const override { return 0; }
+};
+
+int test(Foo const& foo)
+{
+ return foo.test();
+}
+
+int main()
+{
+ Bar const bar;
+ return test(bar);
+}