I use Borland C++ Builder 6, update 4, STLPort 4.5.1 (provided by Borland)
and Boost is 1.30.0beta1.

Following snippet of code fails:

-----------------
#include <boost/optional.hpp>
#include <utility>

void foo(const boost::optional<std::pair<unsigned, unsigned> >& aux =
    boost::optional<std::pair<unsigned, unsigned> >())
{}

int main() {}
-----------------

with error message:
[C++ Error] Unit1.cpp(12): E2188 Expression syntax
[C++ Error] Unit1.cpp(12): E2299 Cannot generate template specialization
from '_STLD::pair<_T1,_T2>'
[C++ Error] Unit1.cpp(12): E2299 Cannot generate template specialization
from 'boost::optional<T>'
[C++ Error] Unit1.cpp(13): E2257 , expected
[C++ Error] Unit1.cpp(33): E2151 Type mismatch in default value for
parameter 'aux'
[C++ Error] Unit1.cpp(12): E2293 ) expected


The same code compiles OK with Intel C++ 7.0.

If I use typedef it works OK with both BC++B and Intel C++:
-----------------
#include <boost/optional.hpp>
#include <utility>

typedef boost::optional<std::pair<unsigned, unsigned> > AType;

void foo(AType  aux = AType())
{}

int main() {}
-----------------


Borland also fails with this construct:
-----------------
#include <boost/optional.hpp>

int main()
{
  boost::optional<int> aux(0);
  if (aux && *aux == 0) {
    aux.reset(1);
  }
}
-----------------

with this error message:
[C++ Error] Unit1.cpp(24): E2094 'operator&&' not implemented in type
'boost::optional<int>' for arguments of type 'bool'

Intel C++ 7.0 compiles and executes this snippet OK.

This works in BC++B:
-----------------
#include <boost/optional.hpp>

int main()
{
  boost::optional<int> aux(0);
  if ((!!aux) && *aux == 0) {
    aux.reset(1);
  }
}
-----------------



These problems may be caused by bugs in BC++B compiler. Sorry if this
problem was already spotted.

/Pavel



_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to