This is the mail archive of the gcc-help@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]

Re: implicit typename is deprecated


"erwan ancel" <erwan.ancel@free.fr> writes:

> Hi,
> Does anyone know what this mean ?
> "Implicit typename is deprecated"

Dependent names which are type names are required to be qualified by
    the keyword 'typename'.

A dependent name is a name which is dependent on a template parameter.

struct A
{
    struct nest{};
};

template<class T>
struct contain
{
    typedef typename T::nest;
};

In the example above, 'T::nest' is a dependent name. Other common
    dependent names are things like 'vector<T>::value_type' . Since
    the parameters with which a template will be instantiated cannot
    be known in general, and a given type may delcare 'nest' as a
    static member, a data member, or a type member, or not at all, it
    was felt the user should indicate when a dependent name is
    intended/expected to be a type name. This allows better error
    reporting, and potentially simpler implementation.

> I got this message when compiling my template instanciations with gcc 3.2,
> and the compilation fails, but I managed to compile this without any
> warning/error with gcc 2.95.
[snip]

3.2 is much closer to conformance than 2.95


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