public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "reichelt at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/35641] [4.1 regression] ICE on overload of friend function definition inside a class
Date: Sat, 29 Mar 2008 17:11:00 -0000	[thread overview]
Message-ID: <20080329171111.16991.qmail@sourceware.org> (raw)
In-Reply-To: <bug-35641-8054@http.gcc.gnu.org/bugzilla/>



------- Comment #2 from reichelt at gcc dot gnu dot org  2008-03-29 17:11 -------
Here's a reduced testcase:

=====================================
template<int> struct A
{
  friend void foo(const A&)
  {
    __FUNCTION__;
  }
};

inline void foo(const A<0>&)
{
  __FUNCTION__;
}

void bar()
{
  foo(A<0>());
}
=====================================

The bug is fixed since GCC 4.2.0, as the code is correctly rejected:

bug.cc: In instantiation of 'A<0>':
bug.cc:17:   instantiated from here
bug.cc:4: error: redefinition of 'void foo(const A<0>&)'
bug.cc:10: error: 'void foo(const A<0>&)' previously defined here

On the 4.1 branch I still get an ICE, but after the above error message:

bug.cc: In instantiation of 'A<0>':
bug.cc:17:   instantiated from here
bug.cc:4: error: redefinition of 'void foo(const A<0>&)'
bug.cc:10: error: 'void foo(const A<0>&)' previously defined here
bug.cc:4: internal compiler error: tree check: expected var_decl or
function_decl or type_decl or template_decl, have error_mark in
tsubst_friend_function, at cp/pt.c:5352
Please submit a full bug report, [etc.]

Since we already rejected the code with GCC 3.1 - 3.3.6 this is a regression.
I don't think anybody will fix this minor problem on the 4.1 branch, though.

Btw, the code was wrongly accepted by GCC 4.0.0 - 4.1.1.


-- 

reichelt at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |reichelt at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |error-recovery, ice-on-
                   |                            |invalid-code
      Known to fail|                            |3.4.0 3.4.6 4.0.0 4.1.2
      Known to work|                            |3.1 3.3.6
   Last reconfirmed|0000-00-00 00:00:00         |2008-03-29 17:11:11
               date|                            |
            Summary|ICE on overload of friend   |[4.1 regression] ICE on
                   |function definition inside a|overload of friend function
                   |class                       |definition inside a class
   Target Milestone|---                         |4.1.3


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


  parent reply	other threads:[~2008-03-29 17:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-19 18:26 [Bug c++/35641] New: " philippe at fornux dot com
2008-03-22 23:52 ` [Bug c++/35641] " fang at csl dot cornell dot edu
2008-03-29 17:11 ` reichelt at gcc dot gnu dot org [this message]
2008-07-04 16:19 ` [Bug c++/35641] [4.1 regression] " jsm28 at gcc dot gnu dot org

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