diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index ef4577ef87b09cdc5edbeb3d3343eca814f72d7a..b9c2cdb26e56b1a06ea5f7e56e366d246eb15c49 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,13 @@
+2006-01-24  Paolo Carlini  <pcarlini@suse.de>
+
+	PR libstdc++/25649
+	* include/std/std_istream.h (operator>>(short&), operator>>(int&)):
+	Move out of line...
+	* include/bits/istream.tcc: ... here.
+	* include/std/std_ostream.h (operator<<(short), operator<<(int)):
+	Move out of line...
+	* include/bits/ostream.tcc: ... here.
+
 2006-01-24  Ed Smith-Rowland  <3dw4rd@verizon.net>
 
 	* docs/html/faq/index.html ([5.2]): Mention TR1 and point to
diff --git a/libstdc++-v3/include/bits/istream.tcc b/libstdc++-v3/include/bits/istream.tcc
index 184c2bd613fc6a2ed7071032973d1c91b2063209..5b5da65aaf5e01ac3695f5e1b0b62bd2e7a0ae9c 100644
--- a/libstdc++-v3/include/bits/istream.tcc
+++ b/libstdc++-v3/include/bits/istream.tcc
@@ -1,6 +1,6 @@
 // istream classes -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -132,6 +132,46 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 	return *this;
       }
 
+  template<typename _CharT, typename _Traits>
+    basic_istream<_CharT, _Traits>&
+    basic_istream<_CharT, _Traits>::
+    operator>>(short& __n)
+    {
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // 118. basic_istream uses nonexistent num_get member functions.
+      long __l;
+      _M_extract(__l);
+      if (!this->fail())
+	{
+	  if (numeric_limits<short>::min() <= __l
+	      && __l <= numeric_limits<short>::max())
+	    __n = __l;
+	  else
+	    this->setstate(ios_base::failbit);
+	}
+      return *this;
+    }
+    
+  template<typename _CharT, typename _Traits>
+    basic_istream<_CharT, _Traits>&
+    basic_istream<_CharT, _Traits>::
+    operator>>(int& __n)
+    {
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // 118. basic_istream uses nonexistent num_get member functions.
+      long __l;
+      _M_extract(__l);
+      if (!this->fail())
+	{
+	  if (numeric_limits<int>::min() <= __l
+	      && __l <= numeric_limits<int>::max())
+	    __n = __l;
+	  else
+	    this->setstate(ios_base::failbit);
+	}
+      return *this;
+    }
+
   template<typename _CharT, typename _Traits>
     basic_istream<_CharT, _Traits>&
     basic_istream<_CharT, _Traits>::
diff --git a/libstdc++-v3/include/bits/ostream.tcc b/libstdc++-v3/include/bits/ostream.tcc
index 7b80495c7e86f6d31f825546f01eaddbe1335542..7f9fbcfb077459e4f5219e72125bba8cc657c6a6 100644
--- a/libstdc++-v3/include/bits/ostream.tcc
+++ b/libstdc++-v3/include/bits/ostream.tcc
@@ -1,6 +1,6 @@
 // ostream classes -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -119,6 +119,34 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 	  }
 	return *this;
       }
+
+  template<typename _CharT, typename _Traits>
+    basic_ostream<_CharT, _Traits>&
+    basic_ostream<_CharT, _Traits>::
+    operator<<(short __n)
+    {
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // 117. basic_ostream uses nonexistent num_put member functions.
+      const ios_base::fmtflags __fmt = this->flags() & ios_base::basefield;
+      if (__fmt == ios_base::oct || __fmt == ios_base::hex)
+	return _M_insert(static_cast<long>(static_cast<unsigned short>(__n)));
+      else
+	return _M_insert(static_cast<long>(__n));
+    }
+
+  template<typename _CharT, typename _Traits>
+    basic_ostream<_CharT, _Traits>&
+    basic_ostream<_CharT, _Traits>::
+    operator<<(int __n)
+    {
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // 117. basic_ostream uses nonexistent num_put member functions.
+      const ios_base::fmtflags __fmt = this->flags() & ios_base::basefield;
+      if (__fmt == ios_base::oct || __fmt == ios_base::hex)
+	return _M_insert(static_cast<long>(static_cast<unsigned int>(__n)));
+      else
+	return _M_insert(static_cast<long>(__n));
+    }
   
   template<typename _CharT, typename _Traits>
     basic_ostream<_CharT, _Traits>&
diff --git a/libstdc++-v3/include/std/std_istream.h b/libstdc++-v3/include/std/std_istream.h
index 659d3e2a2d702ba9571253164926f2f961a68662..862793e9ffed83a11d810c1e7ff586564842e0ac 100644
--- a/libstdc++-v3/include/std/std_istream.h
+++ b/libstdc++-v3/include/std/std_istream.h
@@ -1,6 +1,6 @@
 // Input streams -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -170,45 +170,15 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
       { return _M_extract(__n); }
       
       __istream_type& 
-      operator>>(short& __n)
-      {
-	// _GLIBCXX_RESOLVE_LIB_DEFECTS
-	// 118. basic_istream uses nonexistent num_get member functions.
-	long __l;
-	_M_extract(__l);
-	if (!this->fail())
-	  {
-	    if (numeric_limits<short>::min() <= __l
-		&& __l <= numeric_limits<short>::max())
-	      __n = __l;
-	    else
-	      this->setstate(ios_base::failbit);
-	  }
-	return *this;
-      }
+      operator>>(short& __n);
       
       __istream_type& 
       operator>>(unsigned short& __n)
       { return _M_extract(__n); }
 
       __istream_type& 
-      operator>>(int& __n)
-      {
-	// _GLIBCXX_RESOLVE_LIB_DEFECTS
-	// 118. basic_istream uses nonexistent num_get member functions.
-	long __l;
-	_M_extract(__l);
-	if (!this->fail())
-	  {
-	    if (numeric_limits<int>::min() <= __l
-		&& __l <= numeric_limits<int>::max())
-	      __n = __l;
-	    else
-	      this->setstate(ios_base::failbit);
-	  }
-	return *this;
-      }
-     
+      operator>>(int& __n);
+    
       __istream_type& 
       operator>>(unsigned int& __n)
       { return _M_extract(__n); }
diff --git a/libstdc++-v3/include/std/std_ostream.h b/libstdc++-v3/include/std/std_ostream.h
index 8dc398ed0ef3c93e66e9236031026de5d564c755..23a19c98d32b8b788291fdc51201f28d0d6813a6 100644
--- a/libstdc++-v3/include/std/std_ostream.h
+++ b/libstdc++-v3/include/std/std_ostream.h
@@ -1,6 +1,6 @@
 // Output streams -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -176,16 +176,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
       { return _M_insert(__n); }
 
       __ostream_type& 
-      operator<<(short __n)
-      {
-	// _GLIBCXX_RESOLVE_LIB_DEFECTS
-	// 117. basic_ostream uses nonexistent num_put member functions.
-	const ios_base::fmtflags __fmt = this->flags() & ios_base::basefield;
-	if (__fmt == ios_base::oct || __fmt == ios_base::hex)
-	  return _M_insert(static_cast<long>(static_cast<unsigned short>(__n)));
-	else
-	  return _M_insert(static_cast<long>(__n));
-      }
+      operator<<(short __n);
 
       __ostream_type& 
       operator<<(unsigned short __n)
@@ -196,16 +187,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
       }
 
       __ostream_type& 
-      operator<<(int __n)
-      {
-	// _GLIBCXX_RESOLVE_LIB_DEFECTS
-	// 117. basic_ostream uses nonexistent num_put member functions.
-	const ios_base::fmtflags __fmt = this->flags() & ios_base::basefield;
-	if (__fmt == ios_base::oct || __fmt == ios_base::hex)
-	  return _M_insert(static_cast<long>(static_cast<unsigned int>(__n)));
-	else
-	  return _M_insert(static_cast<long>(__n));
-      }
+      operator<<(int __n);
 
       __ostream_type& 
       operator<<(unsigned int __n)