GCC Bugzilla has been upgraded from version 4.4.9 to 5.0rc3. If you see any problem, please report it to bug 64968.
Bug 14778 - Rejects valid code with using typename from a base class in a template
Summary: Rejects valid code with using typename from a base class in a template
Status: RESOLVED DUPLICATE of bug 14258
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2004-03-29 23:19 UTC by Andrew Pinski
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2004-03-29 23:19:15 UTC
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 ();
Comment 1 Giovanni Bajo 2004-03-30 01:19:36 UTC
A dup of 14258: in GCC, using declarations are implemented just like the old 
style access declarations, so they don't "record" the fact that a name imported 
by them is bound to a type rather than a function or a variable. 

*** This bug has been marked as a duplicate of 14258 ***