Hi folks,

I'm having a problem with using a "using" directive to use a type in a
base class in a derived class.  A typedef of the same thing does work
however:

class other
{
public:
  typedef int foo;
};

template <typename T>
class base
{
public:
  T something;
  typedef other::foo bar;
};

template <typename T>
class derived : public base<T>
{
  using base<T>::bar;         // This does not work.
  //typedef other::foo bar;   // This does work.

  void breaks()
  {
    bar baz;
    baz = 4;
  }
};

int main()
{
  derived<int> var;
}


% g++ -Wall -pedantic -o test test.cc
test.cc: In member function ‘void derived<T>::breaks()’:
test.cc:23: error: expected `;' before ‘baz’
test.cc:24: error: ‘baz’ was not declared in this scope
test.cc: In function ‘int main()’:
test.cc:30: warning: unused variable ‘var’


Is this an issue with GCC, or am I using incorect syntax here?


Many thanks,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.

Attachment: pgpzrEVttiWgw.pgp
Description: PGP signature

_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to