public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: bangerth@dealii.org
To: gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org,
	vil@rccp.tsukuba.ac.jp
Subject: Re: c++/9602: [3.2/3.3/3.4 regression] Total confusion about template/friend/virtual/abstract
Date: Fri, 07 Feb 2003 15:55:00 -0000	[thread overview]
Message-ID: <20030207155505.17175.qmail@sources.redhat.com> (raw)

Old Synopsis: falsely concludes that function defined within class body is virtual and abstract, therefore compiler fails to allow class instantiation with pure virtual function error.
New Synopsis: [3.2/3.3/3.4 regression] Total confusion about template/friend/virtual/abstract

State-Changed-From-To: feedback->analyzed
State-Changed-By: bangerth
State-Changed-When: Fri Feb  7 15:55:05 2003
State-Changed-Why:
    Confirmed. This is a smaller testcase:
    ---------------------------
    template <typename T> struct X {
        void foo (X);
        friend void bar () {}
    };
    
    template <typename T>
    void X<T>::foo (X x) {}
    
    template struct X<int>;
    -----------------------------
    There seems to be profound confusion within the compiler
    about something, since it says
    tmp/g> /home/bangerth/bin/gcc-3.2/bin/gcc -c x.cc
    x.cc:7: cannot declare parameter `x' to be of type `X<T>'
    x.cc:7:   because the following virtual functions are abstract:
    x.cc:3:         void bar()
    
    This is, of course, entirely bogus.
    
    It worked with 3.0, but is broken with present 3.2.2, 3.3
    and 3.4 branches, so it's a regression. The testcase is
    so simple that I can't believe that this is something
    that hasn't come up yet. Hopefully it's simple to fix.
    From playing around, it seems to have to do with the fact
    that the friend function is not only declared, but also
    defined inside the class; it is instantiated at the place
    of first use, which is where the error is displayed.
    
    W.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9602


             reply	other threads:[~2003-02-07 15:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-07 15:55 bangerth [this message]
2003-02-19 16:15 lerdsuwa
2003-02-21 14:56 Kriang Lerdsuwanakij
2003-02-24 15:37 lerdsuwa

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=20030207155505.17175.qmail@sources.redhat.com \
    --to=bangerth@dealii.org \
    --cc=gcc-bugs@gcc.gnu.org \
    --cc=gcc-gnats@gcc.gnu.org \
    --cc=gcc-prs@gcc.gnu.org \
    --cc=nobody@gcc.gnu.org \
    --cc=vil@rccp.tsukuba.ac.jp \
    /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).