http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57078

             Bug #: 57078
           Summary: Unhelpful -Wunused-variable warning
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: ppluzhni...@google.com


Test:

namespace Foo {
  extern const char Name[];  // line 2
}

int main()
{
  using Foo::Name;  // trigger, line 7
  return 0;
}

Using g++ (GCC) 4.9.0 20130412 (experimental):


g++ -c t.cc -Wall
t.cc: In function ‘int main()’:
t.cc:2:21: warning: unused variable ‘Foo::Name’ [-Wunused-variable]
   extern const char Name[];
                     ^

This is quite poor: line 2 that is reported is in some header file, and there
is *nothing* wrong there.

Line 7 may be in a different header file, or in a .cc file, and it is line 7
that triggers the warning; but it is not mentioned in the warning itself.

Reply via email to