This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/83806] New: Spurious unused-but-set-parameter with nullptr
- From: "barry.revzin at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 11 Jan 2018 18:36:56 +0000
- Subject: [Bug c++/83806] New: Spurious unused-but-set-parameter with nullptr
- Auto-submitted: auto-generated
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.