Adding typename causes program to fail compilation

Viewed 40

So I have this code:

#include "type_traits"

struct A{
    int member;
};

struct B{
    typedef A object;
    typedef int member;
};

typedef std::integral_constant<B::member, B::object::*, &A::member> type;

But if I change the final line to:

typedef std::integral_constant<typename B::member, typename B::object::*, &A::member> type;

The program will not compile....

Why does adding the typename specifier cause the program to not compile? This is especially surprising to me because I thought I needed it in this case.

Note: Using gcc 5.1.0

1 Answers
Related