Compiling the attached program with g++ -Wall (3.3, 3.4, 4.0 and 4.1)
produces :

demo.C: In function `void generate_warning() [with U = 
P<unrelated_function()::K>]':
demo.C:19:   instantiated from here
demo.C:14: warning: unused variable 'u'

The problem here is that the warning names the type P<S> as
P<unrelated_function()::K>, because it was first instantiated there,
and it gives the typedef name.
But the warning is generated in the function generate_warning(),
which is completely unrelated to unrelated_function().

-- 
           Summary: Misleading names in diagnostics for typedefs in
                    functions
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sylvain dot pion at sophia dot inria dot fr
                CC: gcc-bugs at gcc dot gnu dot org,sylvain dot pion at
                    sophia dot inria dot fr
  GCC host triplet: i686-pc-linux-gnu


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

Reply via email to