[patch] PR libstdc++/9561, take 2
Benjamin Kosnik
bkoz@redhat.com
Sat Mar 8 17:23:00 GMT 2003
>
>2003-03-08 Jerry Quinn <jlquinn@optonline.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*);
More information about the Libstdc++
mailing list