public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/4265 is not a gcc bug
@ 2001-09-08 17:46 Philip Martin
  0 siblings, 0 replies; only message in thread
From: Philip Martin @ 2001-09-08 17:46 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

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

From: Philip Martin <philip_martin@ntlworld.com>
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: c++/4265 is not a gcc bug
Date: 09 Sep 2001 01:41:08 +0100

 Whoops, got the email address wrong, first time
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=4265&database=gcc
 
 Ugh! Your code boils down to something like
 
    #include <map>
    using namespace std;
 
    class X { };
    class Y { };
    typedef map<X, Y> M;
 
    template<template<typename X, typename R, typename P> class iterator, class T>
    iterator<T, T&, T*>& map_iterator_const_cast (iterator<T, T const&, T const*> const&)
    {
       static iterator<T, T&, T*> foo;
       return foo;
    }
 
    int main()
    {
       M::const_iterator const& i(0);
       map_iterator_const_cast<M::iterator&>( i ); // this line is wrong
    }
 
 To get that line to compile you need to specify a template, not a
 type. Something like:
 
      map_iterator_const_cast<_Rb_tree_iterator>( i );
 
 where _Rb_tree_iterator is the template type used for the std::map
 iterator, buried inside stl_tree.h.
 
 This is not a gcc bug.
 
 Philip


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-09-08 17:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-08 17:46 c++/4265 is not a gcc bug Philip Martin

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