Why do you think this code would result in an ICE only when -O2 or -O3 is enabled:
Code:#include <iostream> #include <string> #include <utility> #include <boost/utility.hpp> #include <boost/unordered_map.hpp> int main () { boost::unordered_map<std::string, std::function<void(std::string)>> handler_list; std::string a("abcd"); std::function<void(std::string)> b = [=](std::string content) { std::cout << content << std::endl; }; handler_list[a] = b; // here if(handler_list.find("abcd") != handler_list.end()) handler_list[a]("abc"); return 0; }/usr/include/c++/4.5/type_traits:273|5|instantiated from ‘std::is_convertible<const std::basic_string<char>, std::function<void(std::basic_string<char>)> >’|
/usr/include/boost/unordered/detail/hash_table_impl.hpp:277|21|instantiated from here|
/usr/include/c++/4.5/type_traits|263|internal compiler error: in copy_fn_p, at cp/decl.c:9962|
||=== Build finished: 1 errors, 0 warnings ===|Can't decide whether to find a different alternative, or sacrifice the O2/O3 performance for the moment.template<typename _From, typename _To>
struct __is_convertible_helper<_From, _To, false>
: public __sfinae_types
{
private:
static __one __test(_To);
static __two __test(...);
public:
static const bool __value = sizeof(__test(declval<_From>())) == 1; // here
};



LinkBack URL
About LinkBacks


