[Bug libstdc++/65927] cppcheck: bits/locale_facets_nonio.h (_M_am_pm_format): Assignment of function parameter has no effect outside the function

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Apr 29 12:18:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65927

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-04-29
     Ever confirmed|0                           |1
           Severity|normal                      |minor

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Most of the member functions in __timepunct are not used anywhere.

The fix for this would be:

--- a/libstdc++-v3/include/bits/locale_facets_nonio.h
+++ b/libstdc++-v3/include/bits/locale_facets_nonio.h
@@ -237,8 +237,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       }

       void
-      _M_am_pm_format(const _CharT* __ampm) const
-      { __ampm = _M_data->_M_am_pm_format; }
+      _M_am_pm_format(const _CharT** __ampm) const
+      { *__ampm = _M_data->_M_am_pm_format; }

       void
       _M_am_pm(const _CharT** __ampm) const

But we could just as well remove the function entirely.



More information about the Gcc-bugs mailing list