[Bug c++/11467] New: using doesn't help with two-stage lookup of members in template base

benko at sztaki dot hu gcc-bugzilla@gcc.gnu.org
Tue Jul 8 14:17:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: using doesn't help with two-stage lookup of members in
                    template base
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: benko at sztaki dot hu
                CC: gcc-bugs at gcc dot gnu dot org

Using the hint in

http://gcc.gnu.org/onlinedocs/gcc/Name-lookup.html

("Alternatively, Base<T>::i might be
brought into scope by a using-declaration.")

I modified the example given there as

arta:~/c/proba$ cat templ_base.cc
template <typename T> struct Base {
  int i;
};

template <typename T> struct Derived : public Base<T> {
  using Base<T>::i;
  
  int get_i() { return i; }
};
arta:~/c/proba$ g++-cvs -v
Reading specs from /gml/shared/gcc-cvs/lib/gcc-lib/i686-pc-linux-gnu/3.4/specs
Configured with: ../gcc/configure --prefix=/gml/shared/gcc-cvs
--enable-languages=c++
Thread model: posix
gcc version 3.4 20030708 (experimental)
arta:~/c/proba$ g++-cvs templ_base.cc
templ_base.cc: In member function `int Derived<T>::get_i()':
templ_base.cc:8: error: `i' has not been declared
zsh: exit 1     g++-cvs templ_base.cc
arta:~/c/proba$ 

(Putting the using into get_i is even worse.)



More information about the Gcc-bugs mailing list