compilerplugins/clang/compat.hxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 6c63fca23fdf0072f7455cb42157cc3cb6187466
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Mon Dec 19 13:17:52 2022 +0100
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Mon Dec 19 19:27:56 2022 +0000

    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 <sberg...@redhat.com>

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

Reply via email to