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]

typedef scoping within templates


References to typedef'ed class names from within a template don't
compile, although this does work _outside_ of templates.  This appears to 
be the case in both the official-release egcs and 2.95 as well.  Example 
below--the first "::" definitely compiles;  the second, I haven't tried 
yet;  the third does not compile (doesn't recognize T::DataType).

=====
struct A { typedef int DataType; };

A::DataType d;                       // Compiles

class Boo { A::DataType d; };        // Compiles (I presume--should, anyway)

template<class T> class Bleah {
  T::DataType d;                     // Does not compile
};

Bleah<A> b;                          // (Just to instantiate template)
=====


If you could let me know whether this is some sort of known behaviour or
simply a bug, I'd greatly appreciate it--thanks! 

Frank Swenton
fswenton@math.princeton.edu


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