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++/53551] New: -Wunused-local-typedefs misses uses


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

             Bug #: 53551
           Summary: -Wunused-local-typedefs misses uses
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: akim.demaille@gmail.com


Hi!

In the following example, the "context" struct provides types to a template
class, "structure".  The provided type is used to define a member variable. 
Yet G++ 4.8 claims:

g++-mp-4.8 -std=c++11 -Wall bar.cc
bar.cc: In function 'int main()':
bar.cc:12:21: warning: typedef 'using type = int' locally defined but not used
[-Wunused-local-typedefs]
     using type = int;
                     ^

This is:

g++-mp-4.8 (MacPorts gcc48 4.8-20120527_1) 4.8.0 20120527 (experimental)
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The program is:


template <typename C>
struct structure
{
  typename C::type val;
};

int
main()
{
  struct context
  {
    using type = int;
  };

  return structure<context>{42}.val;
}

Thanks!


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