[Bug c++/87503] New: Spurious -Wunused-but-set-variable warning in template function
chtz at informatik dot uni-bremen.de
gcc-bugzilla@gcc.gnu.org
Wed Oct 3 14:49:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87503
Bug ID: 87503
Summary: Spurious -Wunused-but-set-variable warning in template
function
Product: gcc
Version: 8.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: chtz at informatik dot uni-bremen.de
Target Milestone: ---
Using g++ 8.1.0 and compiling the following minimal example with -Wall
template<class Index, bool flag>
Index bar(Index rows, Index cols) {
const bool left = flag;
Index x = left ? rows : cols;
return x;
}
int main() {
return bar<int, true>(1,2);
}
I'm getting this:
warning: variable ‘left’ set but not used [-Wunused-but-set-variable]
This works fine with g++-7.3 (or earlier) and seems to be fixed in 8.2.0 (I
don't have easy access to 8.1.1. If it has been fixed there already, apologies
for the noise)
Maybe related issue: Bug 85827
More information about the Gcc-bugs
mailing list