This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/61596] -Wunused-local-typedefs warns incorrectly on a typedef that's referenced indirectly


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61596

--- Comment #2 from thakis at chromium dot org ---
Here's a similar example that doesn't need C++1y, regular C++11 is sufficient:

thakis@ubu:~$ cat test.cc
template <class T>
void template_fun(T t) {
  typename T::Foo s3foo;  // YYY
  (void)s3foo;
}
void template_fun_user() {
  struct Local {
    typedef int Foo;  // XXX
  } p;
  template_fun(p);
}
thakis@ubu:~$ g++ -c test.cc -std=c++11 -Wall
test.cc: In function âvoid template_fun_user()â:
test.cc:8:17: warning: typedef âtemplate_fun_user()::Local::Fooâ locally
defined but not used [-Wunused-local-typedefs]
     typedef int Foo;
                 ^


Maybe a possible fix is to store all typedefs that get this warning as
candidates, and then emit warnings at the end of the translation unit for all
candidates that are still unreferenced at that point.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]