public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11467] New: using doesn't help with two-stage lookup of members in template base
@ 2003-07-08 14:17 benko at sztaki dot hu
  2003-07-08 14:34 ` [Bug c++/11467] " bangerth at dealii dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: benko at sztaki dot hu @ 2003-07-08 14:17 UTC (permalink / raw)
  To: gcc-bugs

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.)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/11467] using doesn't help with two-stage lookup of members in template base
  2003-07-08 14:17 [Bug c++/11467] New: using doesn't help with two-stage lookup of members in template base benko at sztaki dot hu
@ 2003-07-08 14:34 ` bangerth at dealii dot org
  2003-07-14 17:12 ` benko at sztaki dot hu
  2003-07-16 11:01 ` nathan at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: bangerth at dealii dot org @ 2003-07-08 14:34 UTC (permalink / raw)
  To: gcc-bugs

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


bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-07-08 14:34:48
               date|                            |


------- Additional Comments From bangerth at dealii dot org  2003-07-08 14:34 -------
Confirmed.

Putting the using declaration into the function is not allowed, though.
You can only do that with namespace names.

W.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/11467] using doesn't help with two-stage lookup of members in template base
  2003-07-08 14:17 [Bug c++/11467] New: using doesn't help with two-stage lookup of members in template base benko at sztaki dot hu
  2003-07-08 14:34 ` [Bug c++/11467] " bangerth at dealii dot org
@ 2003-07-14 17:12 ` benko at sztaki dot hu
  2003-07-16 11:01 ` nathan at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: benko at sztaki dot hu @ 2003-07-14 17:12 UTC (permalink / raw)
  To: gcc-bugs

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



------- Additional Comments From benko at sztaki dot hu  2003-07-14 17:12 -------
Now it also fails when i is a function:

arta:~/c/proba$ cat templ_base1.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 20030714 (experimental)
arta:~/c/proba$ g++-cvs templ_base1.cc 
templ_base1.cc: In member function `int Derived<T>::get_i()':
templ_base1.cc:8: error: there are no arguments to `i' that depend on a 
   template parameter, so a declaration of `i' must be available
templ_base1.cc:8: error: (if you use `-fpermissive', G++ will accept your code, 
   but allowing the use of an undeclared name is deprecated)
zsh: exit 1     g++-cvs templ_base1.cc
arta:~/c/proba$


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/11467] using doesn't help with two-stage lookup of members in template base
  2003-07-08 14:17 [Bug c++/11467] New: using doesn't help with two-stage lookup of members in template base benko at sztaki dot hu
  2003-07-08 14:34 ` [Bug c++/11467] " bangerth at dealii dot org
  2003-07-14 17:12 ` benko at sztaki dot hu
@ 2003-07-16 11:01 ` nathan at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: nathan at gcc dot gnu dot org @ 2003-07-16 11:01 UTC (permalink / raw)
  To: gcc-bugs

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


nathan at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


------- Additional Comments From nathan at gcc dot gnu dot org  2003-07-16 11:01 -------


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-07-16 11:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-08 14:17 [Bug c++/11467] New: using doesn't help with two-stage lookup of members in template base benko at sztaki dot hu
2003-07-08 14:34 ` [Bug c++/11467] " bangerth at dealii dot org
2003-07-14 17:12 ` benko at sztaki dot hu
2003-07-16 11:01 ` nathan at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).