public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: "Artem Khodush" <artem@duma.gov.ru>
To: nobody@gcc.gnu.org
Cc: gcc-prs@gcc.gnu.org
Subject: Re: c++/3423: "iterator" name lookup trouble
Date: Tue, 26 Jun 2001 06:06:00 -0000	[thread overview]
Message-ID: <20010626130600.12235.qmail@sourceware.cygnus.com> (raw)

The following reply was made to PR c++/3423; it has been noted by GNATS.

From: "Artem Khodush" <artem@duma.gov.ru>
To: <ak@ixion.net>
Cc: <gcc-gnats@gcc.gnu.org>, <gcc-bugs@gcc.gnu.org>
Subject: Re: c++/3423: "iterator" name lookup trouble
Date: Tue, 26 Jun 2001 16:51:23 +0400

 > #include <vector>
 > -------------------------------------------------------------------------------
 > using namespace std;
 > 
 > template <class T>
 > struct coord_vector {
 >   };
 > 
 > template<class T>
 > struct polygon_segment : public vector<coord_vector<T> > {
 >     void insert_c(iterator it);
 >   };
 > 
 > -------------------------------------------------------------------------------
 > This file results in a parse error in the "insert_c" line, though
 > it should probably find the superclass's iterator. 
 
 No it shouldn't, since the unqualified name 'iterator' does not
 depend on the template parameter, and according to the
 c++ standard, is looked up elsewhere but the base class.
 
 14.6 - Name resolution 
 
 -9- If a name does not depend on a template-parameter (as 
 defined in temp.dep), a declaration (or set of declarations) 
 for that name shall be in scope at the point where the name 
 appears in the template definition; the name is bound to the 
 declaration (or declarations) found at that point and this 
 binding is not affected by declarations that are visible at the 
 point of instantiation. 
 
 14.6.2 - Dependent names 
 
 -3- In the definition of a class template, ...  if a base class 
 of this template depends on a template-parameter, the base 
 class scope is not examined during name lookup until the 
 class template is instantiated. 
 
 
 So the only solution is to fix the code to make iterator
 dependent on the template parameter, as you've 
 mentioned:
 
 > >Fix:
 > qualify "iterator" with superclass name
 
 
 


             reply	other threads:[~2001-06-26  6:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-26  6:06 Artem Khodush [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-06-26  5:24 lerdsuwa
2001-06-26  4:36 ak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010626130600.12235.qmail@sourceware.cygnus.com \
    --to=artem@duma.gov.ru \
    --cc=gcc-prs@gcc.gnu.org \
    --cc=nobody@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).