public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/40497] [C++0x] troubles with std::next / std::prev declarations
Date: Fri, 18 Dec 2009 00:15:00 -0000	[thread overview]
Message-ID: <20091218001543.27413.qmail@sourceware.org> (raw)
In-Reply-To: <bug-40497-17859@http.gcc.gnu.org/bugzilla/>



------- Comment #29 from redi at gcc dot gnu dot org  2009-12-18 00:15 -------
I think it might be worth opening an issue about these functions, it's far too
easy for them to cause problems and make the names "next" and "prev" unusable
for user functions:

// simplified version of <iterator> and <string>
namespace std {
template<class Iterator> struct iterator_traits {
typedef typename Iterator::difference_type difference_type;
typedef typename Iterator::value_type value_type;
typedef typename Iterator::pointer pointer;
typedef typename Iterator::reference reference;
typedef typename Iterator::iterator_category iterator_category;
};

template <class InputIterator>
InputIterator next(InputIterator x,
typename std::iterator_traits<InputIterator>::difference_type n = 1);

struct string { };
}


// user code

struct C { };
void next(C, std::string) { }

int main()
{
  C c;
  next(c, std::string());
}

For a user-declared function with an argument of type from namespace std, ADL
finds std::next and we get the same error due to instantiating
iterator_traits<C>


-- 


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


  parent reply	other threads:[~2009-12-18  0:15 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-20  1:05 [Bug c++/40497] New: invalid std::next / std::prev declaration e28773 at bsnow dot net
2009-06-20 10:14 ` [Bug libstdc++/40497] " rguenth at gcc dot gnu dot org
2009-06-20 12:30 ` e28773 at bsnow dot net
2009-06-20 12:31 ` e28773 at bsnow dot net
2009-06-20 12:32 ` e28773 at bsnow dot net
2009-06-20 12:33 ` e28773 at bsnow dot net
2009-06-20 13:04 ` rguenth at gcc dot gnu dot org
2009-06-20 21:36 ` paolo dot carlini at oracle dot com
2009-06-20 22:27 ` paolo at gcc dot gnu dot org
2009-06-20 22:27 ` paolo at gcc dot gnu dot org
2009-06-20 22:29 ` paolo dot carlini at oracle dot com
2009-06-20 23:21 ` e28773 at bsnow dot net
2009-06-21  1:04 ` [Bug c++/40497] " paolo dot carlini at oracle dot com
2009-06-21  1:05 ` paolo dot carlini at oracle dot com
2009-06-21 10:38 ` rguenth at gcc dot gnu dot org
2009-06-21 10:41 ` rguenth at gcc dot gnu dot org
2009-06-21 11:08 ` paolo dot carlini at oracle dot com
2009-07-22 10:33 ` jakub at gcc dot gnu dot org
2009-07-26 14:46 ` paolo dot carlini at oracle dot com
2009-07-26 15:45 ` paolo dot carlini at oracle dot com
2009-07-27  1:08 ` jason at gcc dot gnu dot org
2009-07-27  5:47 ` jason at gcc dot gnu dot org
2009-07-27  9:34 ` [Bug libstdc++/40497] " paolo dot carlini at oracle dot com
2009-10-15 12:53 ` [Bug libstdc++/40497] [C++0x] troubles with std::next / std::prev declarations jakub at gcc dot gnu dot org
2009-12-16 16:15 ` paolo dot carlini at oracle dot com
2009-12-17 11:55 ` jwakely dot gcc at gmail dot com
2009-12-17 12:01 ` jwakely dot gcc at gmail dot com
2009-12-17 12:07 ` paolo dot carlini at oracle dot com
2009-12-17 12:11 ` paolo dot carlini at oracle dot com
2009-12-17 12:23 ` jwakely dot gcc at gmail dot com
2009-12-17 12:25 ` paolo dot carlini at oracle dot com
2009-12-18  0:15 ` redi at gcc dot gnu dot org [this message]
2009-12-18  0:59 ` paolo dot carlini at oracle dot com
2010-01-21 13:19 ` jakub at gcc dot gnu dot org
2010-04-30  8:57 ` jakub at gcc dot gnu dot org
2010-05-27 10:21 ` redi at gcc dot gnu dot org
2010-05-27 10:51 ` paolo dot carlini at oracle dot com
2010-05-27 11:57 ` redi at gcc dot gnu dot org
2010-05-27 11:59 ` paolo dot carlini at oracle dot com
2010-05-27 16:25 ` paolo dot carlini at oracle dot com
2010-05-27 17:37 ` paolo at gcc dot gnu dot org
2010-05-27 17:45 ` paolo at gcc dot gnu dot org
2010-05-27 17:46 ` paolo dot carlini at oracle dot com

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=20091218001543.27413.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).