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

            Bug ID: 60063
           Summary: -Wunused-local-typedefs warning despite attribute used
                    in a template
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gmail dot com

GCC 4.8.2 issues the following bogus warning on the defintion of Y in bar
despite attribute used. The same definition in an ordinary function emits no
warning.

$ cat t.cpp && g++ -Wunused-local-typedefs -c -o/dev/null t.cpp
template <class> struct S;

void foo (int i) {
    typedef __attribute__ ((used)) S<int> X;
}

template <class T>
void bar (T i) {
    typedef __attribute__ ((used)) S<T> Y;
}

t.cpp: In function ‘void bar(T)’:
t.cpp:9:41: warning: typedef ‘Y’ locally defined but not used
[-Wunused-local-typedefs]
     typedef __attribute__ ((used)) S<T> Y;
                                         ^

Reply via email to