This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/71442] New: [5/6/7 Regression] r232569 breaks -Wunused-*
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 07 Jun 2016 12:35:24 +0000
- Subject: [Bug c++/71442] New: [5/6/7 Regression] r232569 breaks -Wunused-*
- Auto-submitted: auto-generated
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.