Skip to content

Compiling pcg_extra v0.98 with extra warnings produces complaints about an unused parameter #104

@JinVoid

Description

@JinVoid

The output of gcc (15.2.1 20251006):
In file included from pcg_random.hpp:102,
from test.cpp:4:
pcg_extras.hpp: In instantiation of ‘std::basic_istream<_CharT, _Traits>& pcg_extras::operator>>(std::basic_istream<_CharT, _Traits>&, uint8_t) [with CharT = char; Traits = std::char_traits; uint8_t = unsigned char]’:
pcg_extras.hpp:249:41: required from here
249 | return pcg_extras::operator>> (in, value);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
pcg_extras.hpp:223:58: warning: parameter ‘target’ set but not used [-Wunused-but-set-parameter]
223 | operator>>(std::basic_istream<CharT,Traits>& in, uint8_t target)
| ~~~~~~~~^~~~~~

It's unhappy about the parameter target in the following:
template <typename CharT, typename Traits>
std::basic_istream<CharT,Traits>&
operator>>(std::basic_istream<CharT,Traits>& in, uint8_t target)

If we change it to be a ref, things compile nicely:
operator>>(std::basic_istream<CharT,Traits>& in, uint8_t& target)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions