<commit_before>//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: c++98, c++03
//
// <functional>
//
// result_of<Fn(ArgTypes...)>

#include <type_traits>
#include <memory>
#include <utility>
#include "test_macros.h"

struct wat
{
    wat& operator*() { return *this; }
    void foo();
};

struct F {};
struct FD : public F {};

#if TEST_STD_VER > 14
template <typename T, typename U>
struct test_invoke_result;

template <typename Fn, typename ...Args, typename Ret>
struct test_invoke_result<Fn(Args...), Ret>
{
    static void call()
    {
        static_assert(std::is_invocable<Fn, Args...>::value, "");
        static_assert(std::is_invocable_r<Ret, Fn, Args...>::value, "");
        static_assert((std::is_same<typename std::invoke_result<Fn, Args...>::type, Ret>::value), "");
        static_assert((std::is_same<std::invoke_result_t<Fn, Args...>, Ret>::value), "");
    }
};
#endif

template <class T, class U>
void test_result_of_imp()
{
    static_assert((std::is_same<typename std::result_of<T>::type, U>::value), "");
#if TEST_STD_VER > 11
    static_assert((std::is_same<std::result_of_t<T>, U>::value), "");
#endif
#if TEST_STD_VER > 14
    test_invoke_result<T, U>::call();
#endif
}

int main()
{
    { // Function types with noexcept
    typedef bool (&RF0)(int) noexcept;
    typedef bool (&RF1)(int, ...) noexcept;
    typedef bool (*PF0)(int) noexcept;
    typedef bool (*PF1)(int, ...) noexcept;
    typedef bool (*&PRF0)(int) noexcept;
    typedef bool (*&PRF1)(int, ...) noexcept;
    test_result_of_imp<RF0(int), bool>();
    test_result_of_imp<PF0(int), bool>();
    test_result_of_imp<PRF0(int), bool>();
    test_result_of_imp<RF1(int, int), bool>();
    test_result_of_imp<PF1(int, int), bool>();
    test_result_of_imp<PRF1(int, int), bool>();
    }
    {
    typedef char F::*PMD;
    test_result_of_imp<PMD(F                &), char                &>();
    test_result_of_imp<PMD(F const          &), char const          &>();
    test_result_of_imp<PMD(F volatile       &), char volatile       &>();
    test_result_of_imp<PMD(F const volatile &), char const volatile &>();

    test_result_of_imp<PMD(F                &&), char                &&>();
    test_result_of_imp<PMD(F const          &&), char const          &&>();
    test_result_of_imp<PMD(F volatile       &&), char volatile       &&>();
    test_result_of_imp<PMD(F const volatile &&), char const volatile &&>();

    test_result_of_imp<PMD(F                ), char &&>();
    test_result_of_imp<PMD(F const          ), char &&>();<commit_msg>Fix failing test due to incorrect use of noexcept<commit_after>//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: c++98, c++03
//
// <functional>
//
// result_of<Fn(ArgTypes...)>

#include <type_traits>
#include <memory>
#include <utility>
#include "test_macros.h"

struct wat
{
    wat& operator*() { return *this; }
    void foo();
};

struct F {};
struct FD : public F {};

#if TEST_STD_VER > 14
template <typename T, typename U>
struct test_invoke_result;

template <typename Fn, typename ...Args, typename Ret>
struct test_invoke_result<Fn(Args...), Ret>
{
    static void call()
    {
        static_assert(std::is_invocable<Fn, Args...>::value, "");
        static_assert(std::is_invocable_r<Ret, Fn, Args...>::value, "");
        static_assert((std::is_same<typename std::invoke_result<Fn, Args...>::type, Ret>::value), "");
        static_assert((std::is_same<std::invoke_result_t<Fn, Args...>, Ret>::value), "");
    }
};
#endif

template <class T, class U>
void test_result_of_imp()
{
    static_assert((std::is_same<typename std::result_of<T>::type, U>::value), "");
#if TEST_STD_VER > 11
    static_assert((std::is_same<std::result_of_t<T>, U>::value), "");
#endif
#if TEST_STD_VER > 14
    test_invoke_result<T, U>::call();
#endif
}

int main()
{
    {
    typedef char F::*PMD;
    test_result_of_imp<PMD(F                &), char                &>();
    test_result_of_imp<PMD(F const          &), char const          &>();
    test_result_of_imp<PMD(F volatile       &), char volatile       &>();
    test_result_of_imp<PMD(F const volatile &), char const volatile &>();

    test_result_of_imp<PMD(F                &&), char                &&>();
    test_result_of_imp<PMD(F const          &&), char const          &&>();
    test_result_of_imp<PMD(F volatile       &&), char volatile       &&>();
    test_result_of_imp<PMD(F const volatile &&), char const volatile &&>();

    test_result_of_imp<PMD(F                ), char &&>();
    test_result_of_imp<PMD(F const          ), char &&>();
{'fraction_non_alphanumeric': 0.22241445597846982, 'fraction_numerical': 0.006151480199923107, 'mean_word_length': 2.4571428571428573, 'pattern_counts': {'":': 0, '<': 69, '<?xml version=': 0, '>': 75, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4443332', 'n_tokens_mistral': 1708, 'n_tokens_neox': 1672, 'n_words': 355}