Re: Template friends

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ooops. The error is being thrown on the friends line. I am compiling
a.cc whose first line is #include "a.h" which is the snippet I gave.
Instantiation then follows some number of lines later with A<double>.

So, the whole error is:
In file included from a.cc:1,
a.h:29: error: `foobar' is neither function nor member function; cannot
be declared friend


On Wed, 2005-02-09 at 13:01 -0600, corey taylor wrote:
> Al,
> 
>   What line is this error thrown on and where are you instantiating?
> 
> corey
> 
> 
> On Wed, 09 Feb 2005 10:10:31 -0800, Al Niessner
> <Al.Niessner@xxxxxxxxxxxx> wrote:
> > In the previous post I mistakenly referenced my declaration as looking
> > like h<>() in 14.5.3.2 when I should have said preempt<>() in 14.5.3.1's
> > example. I can also change the friend the statement to be 'friend int
> > foobar<T>(A<T> &);' and it fails with the same error.
> > 
> > On Wed, 2005-02-09 at 09:55 -0800, Al Niessner wrote:
> > > I figure my parser is wrong and g++ is correct, but I have no idea as to
> > > why.
> > >
> > > g++ --version == 3.4.1
> > >
> > > Code fragment:
> > >
> > > template<class T> class A;
> > > template<class T> int foobar(const A<T> &x);
> > >
> > > template<class T> class A
> > > {
> > >   ...
> > >   friend int foobar<>(const A<T> &);
> > >   ...
> > > }
> > >
> > > gives me this:
> > > error: `dim' is neither function nor member function; cannot be declared
> > > friend
> > >
> > > So, I opened my copy of ISO 14882;2003 and read 14.5.3 and cannot find
> > > what is wrong with my syntax. In fact, it looks similar to h<>() in the
> > > 14.5.3.2 example. So, what is wrong with the above syntax?
> > >
> > --
> > Al Niessner
> > 818.354.0859
> > 
> > All opinions stated above are mine and do not necessarily reflect those
> > of JPL or NASA.
> > 
> > --------
> > |  dS  | >= 0
> > --------
> > 
> >
-- 
Al Niessner
818.354.0859

All opinions stated above are mine and do not necessarily reflect those
of JPL or NASA.

--------
|  dS  | >= 0
--------


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux