public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Gcc template problems
@ 2002-01-15  4:45 lglastre
  2002-01-15 10:05 ` Claudio Bley
  0 siblings, 1 reply; 2+ messages in thread
From: lglastre @ 2002-01-15  4:45 UTC (permalink / raw)
  To: help-gcc

subscribe
___________________________________

Hello,

I've some probleme with my gcc since the 2.96 version with operator
template.
You could find down here the listing a the result of the compilation
which
give me problem.

N.B : the souce get gut with the other compilers I use :
Egcs.1.1.2 (linux) Hp compiler(hpux) and whatcom compiler (Qnx)
Could you help me ?

Thank's in advance
L.Glastre
======================================================
//-------------- test bug template gcc 2.96 - 3.01 ------------------
template < class T> class foo;
template < class T>  foo <T> operator - ( foo <T> f1, foo <T> f2 );

template < class T> class foo {
public :
  friend foo <T> operator - <> ( foo <T> f1, foo <T> f2);
  foo <T> operator - (void);
};

template <class T>
foo <T> operator - (foo <T> f1, foo <T> f2)
{
  foo<T> f;
  return(f);
}

template <class T>
foo <T> foo<T>::operator - (void)
{
  foo<T> f;
  return(f);
}


main()
{
  foo <int> f1;
  foo <int> f2;

  f1 = f1 - f2;
  return (0);
}

//-------------------------------------------------------------------------

//  resultat de la compilation result :
//  /opt/experimental/bin/g++
--version
3.0.1
//  3.0.1
//-------------------------------------------------------------------------

$/opt/experimental/bin/g++ ~/TestTemplate.cpp


/home/lg/TestTemplate.cpp:8: declaration of `foo<T> foo<T>::operator-()'

/home/lg/TestTemplate.cpp:3: changes meaning of `operator-' from `foo<T>

   operator-(foo<T>, foo<T>)'

==================================================================================


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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

* Re: Gcc template problems
  2002-01-15  4:45 Gcc template problems lglastre
@ 2002-01-15 10:05 ` Claudio Bley
  0 siblings, 0 replies; 2+ messages in thread
From: Claudio Bley @ 2002-01-15 10:05 UTC (permalink / raw)
  To: lglastre; +Cc: help-gcc

>>>>> "lglastre" == lglastre  <l_glastre@yahoo.de> writes:

    lglastre> subscribe ___________________________________

    lglastre> Hello,

    lglastre> I've some probleme with my gcc since the 2.96 version
    lglastre> with operator template.  You could find down here the
    lglastre> listing a the result of the compilation which give me
    lglastre> problem.

    lglastre> N.B : the souce get gut with the other compilers I use :
    lglastre> Egcs.1.1.2 (linux) Hp compiler(hpux) and whatcom
    lglastre> compiler (Qnx) 

Whereby it might be interesting that it compiles just fine here (gcc
3.0.3) if I swap these two lines:

  friend foo <T> operator - <> ( foo <T> f1, foo <T> f2);
  foo <T> operator - (void);

Claudio

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

end of thread, other threads:[~2002-01-15 18:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-15  4:45 Gcc template problems lglastre
2002-01-15 10:05 ` Claudio Bley

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