summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/compat.hxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-12-19 13:17:52 +0100
committerStephan Bergmann <sbergman@redhat.com>2022-12-19 19:27:56 +0000
commit6c63fca23fdf0072f7455cb42157cc3cb6187466 (patch)
tree493452c59e0bce3e39fc629baa0362fa974aaf61 /compilerplugins/clang/compat.hxx
parentb5023fa9abea248831271df99df0810351bd8c21 (diff)
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<llvm::APSInt>' 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 <sbergman@redhat.com>
Diffstat (limited to 'compilerplugins/clang/compat.hxx')
-rw-r--r--compilerplugins/clang/compat.hxx2
1 files changed, 1 insertions, 1 deletions
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<T> const & o) {
template<typename T>
constexpr T const & value(llvm::Optional<T> const & o) {
#if CLANG_VERSION >= 150000
- return o.value();
+ return *o;
#else
return o.getValue();
#endif