public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/10265: Template failure wrt. 14.5.2 [#2]
@ 2003-03-29 11:50 gbeauchesne
  0 siblings, 0 replies; 2+ messages in thread
From: gbeauchesne @ 2003-03-29 11:50 UTC (permalink / raw)
  To: gcc-gnats


>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:


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: c++/10265: Template failure wrt. 14.5.2 [#2]
@ 2003-03-31 15:41 bangerth
  0 siblings, 0 replies; 2+ messages in thread
From: bangerth @ 2003-03-31 15:41 UTC (permalink / raw)
  To: gbeauchesne, gcc-bugs, gcc-prs, nobody

Synopsis: Template failure wrt. 14.5.2 [#2]

State-Changed-From-To: open->closed
State-Changed-By: bangerth
State-Changed-When: Mon Mar 31 15:29:09 2003
State-Changed-Why:
    Already fixed in 3.3 and 3.4. Since no regression, it will
    not be fixed in 3.2.

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-03-31 15:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-29 11:50 c++/10265: Template failure wrt. 14.5.2 [#2] gbeauchesne
2003-03-31 15:41 bangerth

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