YY_MOVE defined as std:: move instead of std::forward for C++14 and later
Ben Griffin <[email protected]> Tue, 30 Nov 2021 12:27:28 +0000
| Newsgroups | gmane.comp.parsers.bison.bugs |
|---|---|
| Message-ID | <[email protected]> |
Static analysis reports
/// Construct and fill.
template <typename T>
value_type (YY_RVREF (T) t)
: yytypeid_ (&typeid (T))
{
YY_ASSERT (sizeof (T) <= size);
new (yyas_<T> ()) T (YY_MOVE (t)); // <<--- HERE
}
"Forwarding reference passed to std::move(), which may unexpectedly cause lvalues to be moved; use std::forward() instead”
On y.tab.h line 75, I see:
#if 201103L <= YY_CPLUSPLUS
# define YY_MOVE std::move
Maybe this could be
#if 201103L <= YY_CPLUSPLUS
#if 201402L <= YY_CPLUSPLUS
# define YY_MOVE std::forward
#else
# define YY_MOVE std:: move
I realise that these are well controlled private implementations, but for naive programmers like myself, it causes a mild concern to see a static analysis report.
Best regards
Ben.
smime.p7s
(application/pkcs7-signature, 3.8 KB) - not displayed