summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-09-09 14:17:37 +0200
committerStephan Bergmann <sbergman@redhat.com>2020-09-09 16:47:29 +0200
commitad6ef813e9d745d44719dae381d64cdcc2f82719 (patch)
tree9011ec2b3d1f20a4e97e53ec8eae38c3f27b4d61 /configure.ac
parent20d06c7c3e25e486d013049ed817d66be1bcb4af (diff)
Guard against some GCC consteval bug
...that caused CustomTarget_idlc/parser_test to fail with recent GCC and --with-latest-c++ with > workdir/CustomTarget/idlc/parser_test/in.idl:2 [26:26] : illegal redefinition in scope 'comsunstaruno', 'comsunstarunoXInterface' > instdir/sdk/bin/idlc: detected 1 errors > instdir/sdk/bin/idlc Version 1.1 > > Compiling: workdir/CustomTarget/idlc/parser_test/in.idl > "constructor.tests 20" expected SUCCESS, got 1 (256): FAILED! because > const OStringLiteral sGlobal("::"); in idlc/source/astdeclaration.cxx is apparently not initialized properly when the OStringLiteral ctor is marked as consteval. (See the linked GCC bug report for further details.) Change-Id: I44c547fb990c9b13d86b990199ae93e9fbe9d156 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102318 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac14
1 files changed, 11 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index d97b10fff15b..bfa0d28e5969 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6802,12 +6802,20 @@ if test "$GCC" = yes; then
fi
AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
-AC_MSG_CHECKING([whether $CXX_BASE supports C++20 consteval])
+AC_MSG_CHECKING([whether $CXX_BASE supports a working C++20 consteval])
+dnl ...that does not suffer from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96994> "Missing code
+dnl from consteval constructor initializing const variable":
AC_LANG_PUSH([C++])
save_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([
- consteval int f() { return 0; }
+AC_RUN_IFELSE([AC_LANG_PROGRAM([
+ struct S {
+ consteval S() { i = 1; }
+ int i = 0;
+ };
+ S const s;
+ ], [
+ return (s.i == 1) ? 0 : 1;
])], [
AC_DEFINE([HAVE_CPP_CONSTEVAL],[1])
AC_MSG_RESULT([yes])