public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: gbeauchesne@mandrakesoft.com
To: gcc-gnats@gcc.gnu.org
Subject: c++/10265: Template failure wrt. 14.5.2 [#2]
Date: Sat, 29 Mar 2003 11:50:00 -0000	[thread overview]
Message-ID: <20030329114155.8443.qmail@sources.redhat.com> (raw)


>Number:         10265
>Category:       c++
>Synopsis:       Template failure wrt. 14.5.2 [#2]
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Sat Mar 29 11:46:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Gwenole Beauchesne
>Release:        GNU C++ version 3.2.3 20030329 (prerelease)
>Organization:
>Environment:
i686-pc-linux-gnu
>Description:
GCC rejects code similar to 14.5.2 [#2] as follows:

[gbeauchesne@thalys vrac]$ g++ member2.C
member2.C:8: template definition of non-template `void A::f()'
member2.C:9: redefinition of `void A::f()'
member2.C:8: `void A::f()' previously defined here
member2.C:9: no `void A::f()' member function declared in class `A'

Reproduced on at least GCC 3.2.X and GCC 3.3 CVS snapshot from 2003/02/05.
>How-To-Repeat:
/* { dg-do compile } */

struct A {
  template<class T> void f();
  void f();
};

template<class T> void A::f() { }
void A::f() { }

struct B {
  template<class T> void f() { }
  void f() { }
};

int main()
{
  A a;
  a.f();
  a.f<int>();
  B b;
  b.f();
  b.f<int>();
}
>Fix:
Workaround: define A::f<T>() and A::f() both inline, as exercised in class B.

Both ICC and Comeau C++ compile this correctly. But this is not a fix. ;-)
>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2003-03-29 11:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-29 11:50 gbeauchesne [this message]
2003-03-31 15:41 bangerth

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=20030329114155.8443.qmail@sources.redhat.com \
    --to=gbeauchesne@mandrakesoft.com \
    --cc=gcc-gnats@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).