This would appear to be a recent regression:
----------------------------
template <int> struct X { static const int s = 2; };

template <typename T> int f() {
  const unsigned int dim = 2;
  return X<dim>::s;
}

template int f<int>();
-----------------------------

deal.II> c++ -c -W -Wunused x.cc
x.cc: In function 'int f() [with T = int]':
x.cc:8:21:   instantiated from here
x.cc:4:22: warning: unused variable 'dim'

'dim' is used here, it just is never read from or written to.

W.


-- 
           Summary: [4.5 regression] Wrong "unused variable" warning
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bangerth at gmail dot com


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

Reply via email to