From 6c63fca23fdf0072f7455cb42157cc3cb6187466 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Mon, 19 Dec 2022 13:17:52 +0100 Subject: Avoid -Werror,-Wdeprecated-declarations ...when building against recent Clang 16 trunk, > In file included from compilerplugins/clang/sharedvisitor/sharedvisitor.cxx:30: > In file included from compilerplugins/clang/cppunitassertequals.cxx:13: > compilerplugins/clang/compat.hxx:40:14: error: 'value' is deprecated: std::optional::value is throwing. Use *X instead [-Werror,-Wdeprecated-declarations] > return o.value(); > ^~~~~ > *X > compilerplugins/clang/pointerbool.cxx:118:52: note: in instantiation of function template specialization 'compat::value' requested here > if (compat::has_value(ret) && (compat::value(ret) == 1 || compat::value(ret) == 0)) > ^ > ~/llvm/inst/include/llvm/ADT/Optional.h:273:3: note: 'value' has been explicitly marked deprecated here > LLVM_DEPRECATED("std::optional::value is throwing. Use *X instead", "*X") > ^ > ~/llvm/inst/include/llvm/Support/Compiler.h:143:50: note: expanded from macro 'LLVM_DEPRECATED' > #define LLVM_DEPRECATED(MSG, FIX) __attribute__((deprecated(MSG, FIX))) > ^ Change-Id: I4320c279a464e52ad608df2a340f62795558a7b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144472 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- compilerplugins/clang/compat.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'compilerplugins/clang/compat.hxx') diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx index 60888c15b1c9..5ad8ac9e98eb 100644 --- a/compilerplugins/clang/compat.hxx +++ b/compilerplugins/clang/compat.hxx @@ -37,7 +37,7 @@ constexpr bool has_value(llvm::Optional const & o) { template constexpr T const & value(llvm::Optional const & o) { #if CLANG_VERSION >= 150000 - return o.value(); + return *o; #else return o.getValue(); #endif -- cgit