[Bug c++/71442] New: [5/6/7 Regression] r232569 breaks -Wunused-*
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jun 7 12:35:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71442
Bug ID: 71442
Summary: [5/6/7 Regression] r232569 breaks -Wunused-*
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jakub at gcc dot gnu.org
Target Milestone: ---
// { dg-do compile { target c++11 } }
// { dg-options "-Wunused-variable" }
struct C
{
template<typename... Ts>
int operator()(Ts &&...)
{
return sizeof...(Ts);
}
};
int
main ()
{
C {} (1, 1L, 1LL, 1.0);
char a; // { dg-warning "unused variable" }
short b; // { dg-warning "unused variable" }
int c; // { dg-warning "unused variable" }
long d; // { dg-warning "unused variable" }
long long e; // { dg-warning "unused variable" }
float f; // { dg-warning "unused variable" }
double g; // { dg-warning "unused variable" }
}
FAILs to diagnose c, d, e and g vars as unused, starting with r323569, because
it marks not just decls as TREE_USED, but also types, and when e.g. int type is
TREE_USED, then all vars/parameters with that type are also considered
TREE_USED.
More information about the Gcc-bugs
mailing list