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]
Other format: [Raw text]

[Bug c++/14778] New: Rejects valid code with using typename from a base class in a template


I think this is valid code, I found it while looking to workarounds for PR 14777.
template <typename T>
struct B
{
protected:
  typedef int M;
};

template <typename T>
struct A : B<T> {
  using typename B<T>::M;
  typedef M N;
  A (int = N ());
};

A<int> a = A<int> ();

In 3.3 (without the typename before B<T>::M as with gives a parse error), it gives a warning:
pr14777.cc:11: warning: `A<T>::M' is implicitly a typename
pr14777.cc:11: warning: implicit typename is deprecated, please see the 
   documentation for details

Note without templates this works:
struct B
{
protected:
  typedef int M;
};

struct A : B {
  using B::M;
  typedef M N;
  A (int = N ());
};

A a = A ();

-- 
           Summary: Rejects valid code with using typename from a base class
                    in a template
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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