https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83806
Bug ID: 83806 Summary: Spurious unused-but-set-parameter with nullptr Product: gcc Version: 7.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- This program: template <class X, class Y> bool equals(X x, Y y) { return (x == y); } int main() { const char* p = nullptr; equals(p, nullptr); } When compiled as: $ g++ -std=c++1z -Wunused-but-set-parameter bad.cxx bad.cxx: In instantiation of ‘bool equals(X, Y) [with X = const char*; Y = std::nullptr_t]’: bad.cxx:8:22: required from here bad.cxx:2:20: warning: parameter ‘y’ set but not used [-Wunused-but-set-parameter] bool equals(X x, Y y) { ^ But y is used, in a meaningful sense.