[Bug c++/16901] New: Broken warning about names from dependent bases after out-of-scope typedef

timb at bluearc dot com gcc-bugzilla@gcc.gnu.org
Fri Aug 6 16:00:00 GMT 2004


Try compiling this:
-----
template<class T> void f() { typedef typename T::X Y; }
class A { friend class Y; };
-----

The friend declaration generates two warnings:
test.cpp:2: warning: `class Y' declares a new type at namespace scope
test.cpp:2: warning:   names from dependent base classes are not visible to 
   unqualified name lookup - to refer to the inherited type, say `class A::X'

The first is at least factually correct and potentially useful. The second is
strictly correct, but utterly irrelevant: there is no base class anywhere, and X
has absoutely nothing to do with A.

Furthermore, both warnings disappear if the typedef in f() is removed or
renamed. It should not be affecting things beyond its scope.

-- 
           Summary: Broken warning about names from dependent bases after
                    out-of-scope typedef
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: minor
          Priority: P1
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: timb at bluearc dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i486-linux
  GCC host triplet: i486-linux
GCC target triplet: i486-linux


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



More information about the Gcc-bugs mailing list