Opened 19 years ago

Closed 18 years ago

#155 closed Bugs (Fixed)

Bug in edge.hpp:99 std::ostream is NOT a template

Reported by: nobody Owned by: jsiek
Milestone: Component: graph
Version: None Severity:
Keywords: Cc:

Description

Compiling boost with Intel compiler I’ve got such an error:
g++  -c -Wall -ftemplate-depth-100  -
DBOOST_PYTHON_DYNAMIC_LIB -
DBOOST_PYTHON_SOURCE  -g -O0 -fno-inline -fPIC   -
I"libs/python/build"  -I "/usr/include/python2.2" -
I "/home/users/vsysoltx/boost_loki/boost_1_30_0"  -
o "libs/python/build/bin/libboost_python.so/gcc/debug/run
time-link-dynamic/shared-linkable-
true/inheritance.o"  "libs/python/build/../src/object/inherit
ance.cpp"
…
/home/users/vsysoltx/boost_loki/boost_1_30_0/boost/gra
ph/detail/edge.hpp(99): error: type "std::ostream" may 
not have a template argument list
    std::ostream<Char, Traits>&
         ^
…

The problem is in graph/detail/edge.hpp:99:
  template <class Char, class Traits, class D, class V>
  std::ostream<Char, Traits>&
  operator<<(std::ostream<Char, Traits>& os,
             const boost::detail::edge_desc_impl<D,V>& e)

You should have known that std::stream is not a 
template - it is simply an end-user type defined as:
typedef basic_ostream<char, char_traits<char> > 
ostream;

So template arguments are not suitable for it. Gcc 3.2 
accepts the code because of an ugly bug in compiler, 
gcc 3.4 has this bug fixed, so it emits the same error as 
Intel compiler emits. The code in boost must be 
changed, I suppose you meant basic_ostream instead 
of ostream, with this assumption I’ve done the patch:

*** boost/graph/detail/edge.hpp.orig    2003-06-02 
17:05:49.000000000 +0400
--- boost/graph/detail/edge.hpp 2003-06-02 
17:20:34.000000000 +0400
***************
*** 96,103 ****
    }
  #else
    template <class Char, class Traits, class D, class V>
!   std::ostream<Char, Traits>&
!   operator<<(std::ostream<Char, Traits>& os,
               const boost::detail::edge_desc_impl<D,V>& 
e)
    {
      return os << "(" << e.m_source << "," << 
e.m_target << ")";
--- 96,103 ----
    }
  #else
    template <class Char, class Traits, class D, class V>
!   std::basic_ostream<Char, Traits>&
!   operator<<(std::basic_ostream<Char, Traits>& os,
               const boost::detail::edge_desc_impl<D,V>& 
e)
    {
      return os << "(" << e.m_source << "," << 
e.m_target << ")";

You may contact me via 
Vyatcheslav.Sysoltsev@intel.com

Change History (1)

comment:1 by Douglas Gregor, 18 years ago

Status: assignedclosed
Note: See TracTickets for help on using tickets.