summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-08-30 18:39:04 +0200
committerStephan Bergmann <sbergman@redhat.com>2018-09-05 14:36:33 +0200
commit62bfe29f9045127d479c42376f599ddfb0fbb2ca (patch)
tree9f2dc4c4988fb1ee348d2c3467ea623dc8c5f64b /configure.ac
parentede27cf598ed2aef41b9552b2c787ef8331400fc (diff)
Already set MSVC's -std:c++17 during the configure.ac feature checks
For cl version 19.15.26726 (VS 2017 15.8.1) that would detect HAVE_CPP_GUARANTEED_COPY_ELISION, but wrongly so as it turns out. :( The compiler has C++20's __cpp_guaranteed_copy_elision feature-test macro defined (and <https://en.cppreference.com/w/cpp/compiler_support> claims that C++17 "Guaranteed copy elision" is supported in "MSVC 19.13", aka VS 2017 15.6). But the build then failed at > [build CXX] sw/source/uibase/app/docsh2.cxx [...] > C:/lo/core/sw/source/uibase/app/docsh2.cxx(427): error C2248: 'editeng::SortedAutoCompleteStrings::SortedAutoCompleteStrings': cannot access private member declared in class 'editeng::SortedAutoCompleteStrings' > C:\lo\core\include\editeng/swafopt.hxx(66): note: see declaration of 'editeng::SortedAutoCompleteStrings::SortedAutoCompleteStrings' > C:\lo\core\include\editeng/swafopt.hxx(55): note: see declaration of 'editeng::SortedAutoCompleteStrings' due to enabling the HAVE_CPP_GUARANTEED_COPY_ELISION-conditional code in include/editeng/swafopt.hxx. (And while my VS 15.8.1 stopped detecting HAVE_CPP_GUARANTEED_COPY_ELISION then, <https://ci.libreoffice.org/job/gerrit_windows/14774/>, reportedly done with 15.7.4 aka 15.7.27703.2035, still mis-detected it and then failed at sw/source/uibase/app/docsh2.cxx(427) as above, so needed a tweak to the check in configure.ac.) Change-Id: Ie14d74f3f795d819047deaafdb1e644ed00ee406 Reviewed-on: https://gerrit.libreoffice.org/59835 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac12
1 files changed, 8 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac
index 0e9d452ca591..ebf8b01ac657 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6181,7 +6181,7 @@ CXXFLAGS_CXX11=
if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
AC_MSG_CHECKING([whether $CXX supports C++11])
AC_MSG_RESULT(yes)
- # MSVC supports (a subset of) CXX11 without any switch
+ CXXFLAGS_CXX11=-std:c++17
elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
HAVE_CXX11=
AC_MSG_CHECKING([whether $CXX supports C++17, C++14, or C++11])
@@ -6413,14 +6413,18 @@ AC_LANG_PUSH([C++])
save_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
- #if !defined __cpp_guaranteed_copy_elision
+ // At least VS 2017 15.8.1 defines __cpp_guaranteed_copy_elision as 201606L without actually
+ // supporting it:
+ #if !defined __cpp_guaranteed_copy_elision || (defined _MSC_VER && !defined __clang__)
struct S {
private:
S(S const &);
public:
- S copy() const { return *this; }
+ S();
+ ~S();
};
- void f(S & s) { S c(s.copy()); }
+ S copy();
+ void f() { S c(copy()); }
#endif
])], [
AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])