]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: Fix test for clang debug compatibility with C++14
authorMatthias Maier <tamiko@43-1.org>
Wed, 19 Aug 2015 21:22:29 +0000 (16:22 -0500)
committerMatthias Maier <tamiko@43-1.org>
Wed, 19 Aug 2015 21:23:26 +0000 (16:23 -0500)
Test for a spurios error emitted by clang in case of "deduced return types"
(a C++14 feature) in combination with debug symbols.

Disable C++14 support in this case because we cannot compile bundled boost.
This affects clang-3.5* and older. Fixed in clang-3.6 and newer.

Relates #1390

cmake/checks/check_01_cxx_features.cmake

index 32d49236ccfddde35c0c4db10bd0730231ea348f..974b2ccb6e6d53c92f68de26d3767b4e39c20e00 100644 (file)
@@ -103,10 +103,6 @@ IF(NOT DEFINED DEAL_II_WITH_CXX14 OR DEAL_II_WITH_CXX14)
     MESSAGE(STATUS "Using C++ version flag \"${DEAL_II_CXX_VERSION_FLAG}\"")
     PUSH_CMAKE_REQUIRED("${DEAL_II_CXX_VERSION_FLAG}")
 
-    # Some versions of clang are feature complete but do not have debug
-    # information.
-    PUSH_CMAKE_REQUIRED("-g")
-
     #
     # This test does not guarantee full C++14 support, but virtually every
     # compiler with some C++14 support implements this.
@@ -122,10 +118,26 @@ IF(NOT DEFINED DEAL_II_WITH_CXX14 OR DEAL_II_WITH_CXX14)
       "
       DEAL_II_HAVE_CXX14_MAKE_UNIQUE)
 
+    #
+    # Clang-3.5* or older, bail out with a spurious error message in case
+    # of an undeduced auto return type.
+    #
+    PUSH_CMAKE_REQUIRED("${DEAL_II_CXX_FLAGS_DEBUG}")
+    CHECK_CXX_SOURCE_COMPILES(
+      "
+      struct foo
+      {
+        auto func();
+      };
+      int main() {}
+      "
+      DEAL_II_HAVE_CXX14_CLANGAUTODEBUG_BUG_OK)
+
     RESET_CMAKE_REQUIRED()
   ENDIF()
 
-  IF(DEAL_II_HAVE_CXX14_MAKE_UNIQUE)
+  IF( DEAL_II_HAVE_CXX14_MAKE_UNIQUE AND
+      DEAL_II_HAVE_CXX14_CLANGAUTODEBUG_BUG_OK )
     SET(DEAL_II_HAVE_CXX14 TRUE)
   ELSE()
     IF(NOT _user_provided_cxx_version_flag)

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.