lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi] PATCH: simple clang -Wuninitialized-const-reference fix


From: Vadim Zeitlin
Subject: [lmi] PATCH: simple clang -Wuninitialized-const-reference fix
Date: Sun, 25 Apr 2021 01:18:00 +0200

 Hello,

 The following simple patch:

---------------------------------- >8 --------------------------------------
diff --git a/miscellany.hpp b/miscellany.hpp
index b72439f17..65485574a 100644
--- a/miscellany.hpp
+++ b/miscellany.hpp
@@ -243,7 +243,7 @@ inline void stifle_warning_for_unused_variable(T const&)
 /// for volatile types.

 template<typename T>
-inline void stifle_warning_for_unused_value(T const& t)
+inline void stifle_warning_for_unused_value(T& t)
 {
     (void)&t;
 }
---------------------------------- >8 --------------------------------------

also available as the only commit in the branch "clang-12-uninit-const-ref"
of vadz/lmi on GitHub or at https://github.com/let-me-illustrate/lmi/pull/181
fixes the following error

---------------------------------- >8 --------------------------------------
math_functions_test.cpp:203:37: error: variable 'x' is uninitialized when 
passed as a const reference argument here 
[-Werror,-Wuninitialized-const-reference]
    stifle_warning_for_unused_value(x);
                                    ^
---------------------------------- >8 --------------------------------------

(and 5 more identical warnings for the other occurrences of the same
function in this file) when building lmi with clang 12 under Linux.

 It's a bit annoying to have to fix a warning which only happens in the
result of trying to fix another warning, but I don't see any better
solution and this one doesn't seem that bad.

 Could you please apply it or let me know if you have any better ideas?

 Thanks in advance!
VZ

Attachment: pgpnNVmCfPDLA.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]