Non-templated iostreams fix in optional_io

Better "illegal conversion" fail test


[SVN r32972]
This commit is contained in:
Fernando Cacciola
2006-02-16 20:52:55 +00:00
parent 0e10374194
commit 91bdde095d
2 changed files with 27 additions and 5 deletions

View File

@ -13,14 +13,16 @@
#include "boost/optional.hpp"
struct A {} ;
struct B {} ;
//
// THIS TEST SHOULD FAIL TO COMPILE
//
void test_no_unsupported_conversion()
{
boost::optional<int> opt1(1) ;
boost::optional< std::string > opt2 ;
opt2 = opt1 ; // Cannot convert from "int" to "std::string"
boost::optional<A> opt1;
boost::optional<B> opt2;
opt2 = opt1 ; // Cannot convert from "A" to "B"
}