public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/38501] typedef confuses the name of the template and the name of result
Date: Fri, 12 Dec 2008 01:49:00 -0000	[thread overview]
Message-ID: <20081212014646.22851.qmail@sourceware.org> (raw)
In-Reply-To: <bug-38501-17068@http.gcc.gnu.org/bugzilla/>



------- Comment #2 from pinskia at gcc dot gnu dot org  2008-12-12 01:46 -------
No GCC 4.3 and above is doing the correct thing.  This code is invalid but no
diagnostic is required by the C++ standard.

See <http://gcc.gnu.org/gcc-4.3/porting_to.html>:
Name lookup changes

GCC by default no longer accepts code such as

template <class _Tp> class auto_ptr {};
template <class _Tp>
struct counted_ptr
{
  auto_ptr<_Tp> auto_ptr();
};
but will issue the diagnostic

error: declaration of 'auto_ptr<_Tp> counted_ptr<_Tp>::auto_ptr()'
error: changes meaning of 'auto_ptr' from 'class auto_ptr<_Tp>'
The reference to struct auto_ptr needs to be qualified here, or the name of the
member function changed to be unambiguous.

template <class _Tp> class auto_ptr {};
template <class _Tp>
struct counted_ptr
{
  ::auto_ptr<_Tp> auto_ptr();
};
In addition, -fpermissive can be used as a temporary workaround to convert the
error into a warning until the code is fixed. Note that then in some case name
lookup will not be standard conforming.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


      parent reply	other threads:[~2008-12-12  1:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-12  1:42 [Bug c++/38501] New: " resume755 at mail dot ru
2008-12-12  1:43 ` [Bug c++/38501] " resume755 at mail dot ru
2008-12-12  1:49 ` pinskia at gcc dot gnu dot org [this message]

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