Why do you think this code would result in an ICE only when -O2 or -O3 is enabled:

#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())

    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 ===|
template<typename _From, typename _To>
struct __is_convertible_helper<_From, _To, false>
: public __sfinae_types
static __one __test(_To);
static __two __test(...);

static const bool __value = sizeof(__test(declval<_From>())) == 1; // here
Can't decide whether to find a different alternative, or sacrifice the O2/O3 performance for the moment.