This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [patch] PR libstdc++/9561, take 2
- From: Benjamin Kosnik <bkoz at redhat dot com>
- To: libstdc++ at gcc dot gnu dot org
- Cc: jlquinn at optonline dot net
- Date: Sat, 8 Mar 2003 11:23:32 -0600
- Subject: Re: [patch] PR libstdc++/9561, take 2
- References: <E18rhVy-00036u-00@tiamat>
>
>2003-03-08 Jerry Quinn <jlquinn at optonline dot net>
>
> PR libstdc++/9561
> * include/bits/basic_ios.h (_M_setstate): New.
> * include/bits/ostream.tcc (operator<<): Use it.
> * include/bits/istream.tcc (operator>>): Use it.
> * include/std/std_ostream.h (operator<<): Make friends.
> * include/std/std_istream.h (operator>>): Make friends.
> * testsuite/27_io/ostream_exception.cc,
> testsuite/27_io/istream_exception.cc: New tests.
Jerry, this looks great, thanks. Please check it in.
FYI I appended Mark Mitchell's answer to the template question below.
best,
benjamin
> in the patch below, are the things within the #if 1 / #endif really
> necessary? I would think that the friend declaration above it would also
> include the specialization right below it, within the #if/#endif block
Yes, they are.
Remember that there is no such thing as a partial specialization of a
function template; there is only overloading.
Here is a small example. There are two overloaded templates named f; the
friend declaration refers to the first, but not the second, which causes
the instatiation at the end to fail.
template <typename T>
void f (T);
template <typename T>
void f (T*);
class C {
template <typename T>
friend void f (T);
int i;
};
template <typename T>
void f (T*) {
C c;
c.i = 3;
}
template void f (int*);