Commit 048688fd authored by Louis Dionne's avatar Louis Dionne
Browse files

[libc++] Fix incorrect main() signatures in the tests

Those creep up from time to time. We need to use `int main(int, char**)`
because in freestanding mode, `main` doesn't get special treatment and
special mangling, so we setup a symbol alias from the mangled version of
`main(int, char**)` to `extern "C" main`. That only works if all the tests
are consistent about how they define their main function.
parent b92412fb
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -15,8 +15,7 @@

#include <functional>

int main()
{
int main(int, char**) {
    int i = 0;
    std::reference_wrapper ri(i);
    static_assert(std::is_same_v<decltype(ri), std::reference_wrapper<int>>);
@@ -27,4 +26,6 @@ int main()
    static_assert(std::is_same_v<decltype(rj), std::reference_wrapper<const int>>);
    std::reference_wrapper rj2(rj);
    static_assert(std::is_same_v<decltype(rj2), std::reference_wrapper<const int>>);

    return 0;
}
+3 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ test(T& t)

void f() {}

int main()
int main(int, char**)
{
    convertible_to_int_ref convi;
    test(convi);
@@ -80,4 +80,6 @@ int main()
    static_assert((std::is_same<decltype(rj), std::reference_wrapper<const int>>::value), "" );
    }
#endif

    return 0;
}
+3 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ struct A2 {
    operator B& () const noexcept { return b; }
};

int main()
int main(int, char**)
{
    {
    std::reference_wrapper<B> b1 = A1();
@@ -60,4 +60,6 @@ int main()
    static_assert(std::is_assignable<std::reference_wrapper<B>, A2>::value, "");
    static_assert(std::is_nothrow_assignable<std::reference_wrapper<B>, A2>::value, "");
    }

    return 0;
}
+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ struct Derived : Base {
    int x_;
};

int main() {
int main(int, char**) {
    Derived d(1, 2, 3);
    Base b = static_cast<Base>(d);
    assert(std::get<0>(b) == 2);
+1 −1
Original line number Diff line number Diff line
@@ -99,7 +99,7 @@ constexpr bool test() {
  return true;
}

int main() {
int main(int, char**) {
  ASSERT_NOEXCEPT(std::cmp_equal(0, 0));
  test();
  static_assert(test());
Loading