Boost logo

Boost :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-12-05 12:09:14


"Eric Niebler" <eric_at_[hidden]> wrote in message
news:41B2BE9E.7000106_at_boost-consulting.com...

> If anybody is interested, grab the code and try it with your favorite
> compiler and let me know how it works out. If it doesn't compile, try
> #defining BOOST_FOREACH_NO_CONST_RVALUE_DETECTION and see if that fixes
> the problem.

Here are some results (the line numbers don't match your source because I pasted
the code into a test file, but the output should still be clear)

- VC8.0 (beta) crashes without BOOST_FOREACH_NO_CONST_RVALUE_DETECTION defined
- Comeau 4.3.3 gives two warning and an internal error regardless of whether the
defect macro is defined (see end off message)
- Intel 8.0 gives lots of warnings and an internal error without the defect
macro, but works fine with the defect macro defined (see end off message)

Jonathan
----------------------------------------------------------------

Comeau 4.3.3 compiler output with or without defect macro

"C:\DOCUME~1\turkanis\Home\C++\overloadvc71\example.cpp", line 544: warning:
          use of "=" where "==" may have been intended
      BOOST_FOREACH( T const &t, list_of_T )
      ^

"C:\DOCUME~1\turkanis\Home\C++\overloadvc71\example.cpp", line 559: warning:
          use of "=" where "==" may have been intended
      BOOST_FOREACH( int &i, int_list )
      ^

"C:\DOCUME~1\turkanis\Home\C++\overloadvc71\example.cpp", line 569: internal err
or:
          assertion failed: add_to_destructions_list: object lifetime and
          dynamic init in different memory regions (il.c, line 12018)

      BOOST_FOREACH( int const &i, list<int>(5,5) )
      ^
----------------------------------------------

Intel 8.0 compiler output without defect macro:

C:\DOCUME~1\turkanis\Home\C++\overloadvc71\example.cpp(559): warning #187: use o
f "=" where "==" may have been intended
      BOOST_FOREACH( int &i, int_list )
      ^

C:\DOCUME~1\turkanis\Home\C++\overloadvc71\example.cpp(569): warning #187: use o
f "=" where "==" may have been intended
      BOOST_FOREACH( int const &i, list<int>(5,5) )
      ^

C:\DOCUME~1\turkanis\Home\C++\overloadvc71\example.cpp(142): error: function ret
urning array is not allowed
      operator U ()
      ^
          detected during instantiation of "boost::for_each::rvalue_probe::opera
tor T" based on template argument <int [3]> at line 577

C:\DOCUME~1\turkanis\Home\C++\overloadvc71\example.cpp(577): internal error: ass
ertion failed at: "shared/edgcpfe/exprutil.c", line 8947

      BOOST_FOREACH( int &i, int_array )
      ^

compilation aborted for C:\DOCUME~1\turkanis\Home\C++\overloadvc71\example.cpp (
code 4)
----------------------------------------------

Intel 8.0 compiler output with defect macro:

C:\DOCUME~1\turkanis\Home\C++\overloadvc71\example.cpp(559): warning #187: use o
f "=" where "==" may have been intended
      BOOST_FOREACH( int &i, int_list )
      ^

C:\DOCUME~1\turkanis\Home\C++\overloadvc71\example.cpp(569): warning #187: use o
f "=" where "==" may have been intended
      BOOST_FOREACH( int const &i, list<int>(5,5) )
      ^

C:\DOCUME~1\turkanis\Home\C++\overloadvc71\example.cpp(577): warning #187: use o
f "=" where "==" may have been intended
      BOOST_FOREACH( int &i, int_array )
      ^

C:\DOCUME~1\turkanis\Home\C++\overloadvc71\example.cpp(583): warning #187: use o
f "=" where "==" may have been intended
      BOOST_FOREACH( int i, int_array )
      ^

C:\DOCUME~1\turkanis\Home\C++\overloadvc71\example.cpp(592): warning #187: use o
f "=" where "==" may have been intended
      BOOST_FOREACH( char &ch, str )
      ^

C:\DOCUME~1\turkanis\Home\C++\overloadvc71\example.cpp(599): warning #187: use o
f "=" where "==" may have been intended
      BOOST_FOREACH( char ch, str )
      ^

C:\DOCUME~1\turkanis\Home\C++\overloadvc71\example.cpp(610): warning #187: use o
f "=" where "==" may have been intended
      BOOST_FOREACH( char const &ch, sz )
      ^

C:\DOCUME~1\turkanis\Home\C++\overloadvc71\example.cpp(621): warning #187: use o
f "=" where "==" may have been intended
      BOOST_FOREACH( int &i, ::boost::for_each::in_range( begin, end ) )
      ^

C:\DOCUME~1\turkanis\Home\C++\overloadvc71\example.cpp(629): warning #187: use o
f "=" where "==" may have been intended
      BOOST_FOREACH( int i, iter_pair )
      ^

C:\DOCUME~1\turkanis\Home\C++\overloadvc71\example.cpp(636): warning #187: use o
f "=" where "==" may have been intended
      BOOST_FOREACH( int i, rvalue_list() )
      ^

C:\DOCUME~1\turkanis\Home\C++\overloadvc71\example.cpp(644): warning #187: use o
f "=" where "==" may have been intended
      BOOST_FOREACH( int i, const_rvalue_list() )
      ^

C:\DOCUME~1\turkanis\Home\C++\overloadvc71\example.cpp(544): warning #187: use o
f "=" where "==" may have been intended
      BOOST_FOREACH( T const &t, list_of_T )
      ^
          detected during instantiation of "void baz(const std::list<T, std::all
ocator<_Elem>> &) [with T=int]"


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk