https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68411

--- Comment #1 from Keepa Mihail <msnkipa at mail dot ru> ---
Correct piece of code that generate described error must be:
std::exception_ptr safe(std::function<void()>);
template<typename F, typename... Args>
        inline auto safe(
                                typename std::enable_if<!std::is_void<typename
std::result_of<F(Args...)>::type>::value, void*>::type,
                                                                               
        F func, Args... args) -> std::pair<decltype(func(args...)),
std::exception_ptr>
{
        decltype(func(args...)) result{};
        std::exception_ptr exp{ safe([&]{ result = func(args...); }) };
        return { result, exp };
}
template<typename F, typename... Args>
        inline auto safe(
                                typename std::enable_if<std::is_void<typename
std::result_of<F(Args...)>::type>::value, void*>::type,
                                                                               
                                                                               
                        F func, Args... args) -> std::exception_ptr
{
        return safe([&]{ func(args...); });
}
template<typename F, typename... Args>
        inline
                auto safe(F func, Args... args) -> typename
std::conditional<std::is_void<decltype(func(args...))>::value,
                                                                               
        std::exception_ptr, std::pair<decltype(func(args...)),
std::exception_ptr>>::type
{
        return safe(nullptr, func, args...);
}

int main()
{
        safe([&] { std::cout << "Hello" << std::end; });
}

at the end of the error message I now have:
internal compiler error: Segmentation fault

Reply via email to