[Bug c++/54309] [C++11] type alias accessing class template typename

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Aug 18 06:05:00 GMT 2012


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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[C++11] type alias          |[C++11] type alias
                   |accessing class template    |accessing class template
                   |enum type member fails      |typename

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-08-18 06:05:37 UTC ---
Also enum is not the only issue, it is an issue with any subnames of the type
alias.
template <typename T>
struct Foo
{
    typedef int Stuff;
};

template <typename T>
void func()
{
  typename Foo<T>::Stuff a = 1;
  a = a;

  using test = Foo<T>;
  typename test::Stuff b;
  b = b;

  typedef Foo<T> test2;
  typename test2::Stuff c = 2;
  c = c;
}

int main()
{
  func<int>();

  {
    Foo<int>::Stuff a = 1;
    a = a;

    using test = Foo<int>;
    typename test::Stuff b = 2;
    b = b;

    typedef Foo<int> test2;
    typename test2::Stuff c = 3;
    c = c;
  }
}



More information about the Gcc-bugs mailing list