Fix warnings in tests.

llvm-svn: 272629
This commit is contained in:
Eric Fiselier 2016-06-14 03:21:49 +00:00
parent 15b311c752
commit 3245e1f34b
12 changed files with 52 additions and 42 deletions

View File

@ -25,30 +25,27 @@ template <int N> struct index {};
void f(index<0>) {}
int f(index<1>) { return 0; }
int const f(index<2>) { return 0; }
int volatile f(index<3>) { return 0; }
int const volatile f(index<4>) { return 0; }
int & f(index<5>) { return static_cast<int &>(my_int); }
int const & f(index<6>) { return static_cast<int const &>(my_int); }
int volatile & f(index<7>) { return static_cast<int volatile &>(my_int); }
int const volatile & f(index<8>) { return static_cast<int const volatile &>(my_int); }
int & f(index<2>) { return static_cast<int &>(my_int); }
int const & f(index<3>) { return static_cast<int const &>(my_int); }
int volatile & f(index<4>) { return static_cast<int volatile &>(my_int); }
int const volatile & f(index<5>) { return static_cast<int const volatile &>(my_int); }
int && f(index<9>) { return static_cast<int &&>(my_int); }
int const && f(index<10>) { return static_cast<int const &&>(my_int); }
int volatile && f(index<11>) { return static_cast<int volatile &&>(my_int); }
int const volatile && f(index<12>) { return static_cast<int const volatile &&>(my_int); }
int && f(index<6>) { return static_cast<int &&>(my_int); }
int const && f(index<7>) { return static_cast<int const &&>(my_int); }
int volatile && f(index<8>) { return static_cast<int volatile &&>(my_int); }
int const volatile && f(index<9>) { return static_cast<int const volatile &&>(my_int); }
int * f(index<13>) { return static_cast<int *>(&my_int); }
int const * f(index<14>) { return static_cast<int const *>(&my_int); }
int volatile * f(index<15>) { return static_cast<int volatile *>(&my_int); }
int const volatile * f(index<16>) { return static_cast<int const volatile *>(&my_int); }
int * f(index<10>) { return static_cast<int *>(&my_int); }
int const * f(index<11>) { return static_cast<int const *>(&my_int); }
int volatile * f(index<12>) { return static_cast<int volatile *>(&my_int); }
int const volatile * f(index<13>) { return static_cast<int const volatile *>(&my_int); }
template <int Func, class Expect>
void test()
{
using F = decltype((f(index<Func>{})));
using F = decltype(f(index<Func>{}));
static_assert(std::is_same<F, Expect>::value, "");
}
@ -58,19 +55,16 @@ int main()
{
test<0, void>();
test<1, int>();
//test<2, int const>();
//test<3, int volatile>();
//test<4, int const volatile>();
test<5, int &>();
test<6, int const &>();
test<7, int volatile &>();
test<8, int const volatile &>();
test<9, int &&>();
test<10, int const &&>();
test<11, int volatile &&>();
test<12, int const volatile &&>();
test<13, int *>();
test<14, int const *>();
test<15, int volatile *>();
test<16, int const volatile *>();
test<2, int &>();
test<3, int const &>();
test<4, int volatile &>();
test<5, int const volatile &>();
test<6, int &&>();
test<7, int const &&>();
test<8, int volatile &&>();
test<9, int const volatile &&>();
test<10, int *>();
test<11, int const *>();
test<12, int volatile *>();
test<13, int const volatile *>();
}

View File

@ -917,7 +917,7 @@ int main()
std::uintmax_t i4 = 0;
}
{
std::imaxdiv_t i1 = {0};
std::imaxdiv_t i1 = {};
}
std::intmax_t i = 0;
static_assert((std::is_same<decltype(std::imaxabs(i)), std::intmax_t>::value), "");

View File

@ -87,7 +87,7 @@
int main()
{
std::FILE* fp = 0;
std::fpos_t fpos = {0};
std::fpos_t fpos = {};
std::size_t s = 0;
char* cp = 0;
std::va_list va;

View File

@ -44,7 +44,7 @@ int main()
testbuf<char> sb(" Sat Dec 31 23:55:59 2061");
std::istream is(&sb);
is.imbue(std::locale(LOCALE_en_US_UTF_8));
std::tm t = {0};
std::tm t = {};
is >> std::get_time(&t, "%a %b %d %H:%M:%S %Y");
assert(t.tm_sec == 59);
assert(t.tm_min == 55);
@ -60,7 +60,7 @@ int main()
testbuf<wchar_t> sb(L" Sat Dec 31 23:55:59 2061");
std::wistream is(&sb);
is.imbue(std::locale(LOCALE_en_US_UTF_8));
std::tm t = {0};
std::tm t = {};
is >> std::get_time(&t, L"%a %b %d %H:%M:%S %Y");
assert(t.tm_sec == 59);
assert(t.tm_min == 55);

View File

@ -56,7 +56,7 @@ int main()
testbuf<char> sb;
std::ostream os(&sb);
os.imbue(std::locale(LOCALE_en_US_UTF_8));
std::tm t = {0};
std::tm t = {};
t.tm_sec = 59;
t.tm_min = 55;
t.tm_hour = 23;
@ -72,7 +72,7 @@ int main()
testbuf<wchar_t> sb;
std::wostream os(&sb);
os.imbue(std::locale(LOCALE_en_US_UTF_8));
std::tm t = {0};
std::tm t = {};
t.tm_sec = 59;
t.tm_min = 55;
t.tm_hour = 23;

View File

@ -25,7 +25,7 @@ int main()
std::clock_t c = 0;
std::size_t s = 0;
std::time_t t = 0;
std::tm tm = {0};
std::tm tm = {};
((void)c); // Prevent unused warning
((void)s); // Prevent unused warning
((void)t); // Prevent unused warning

View File

@ -11,9 +11,15 @@
// is_destructible
// Prevent warning when testing the Abstract test type.
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wdelete-non-virtual-dtor"
#endif
#include <type_traits>
#include "test_macros.h"
template <class T>
void test_is_destructible()
{

View File

@ -11,6 +11,11 @@
// is_nothrow_destructible
// Prevent warning when testing the Abstract test type.
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wdelete-non-virtual-dtor"
#endif
#include <type_traits>
#include "test_macros.h"

View File

@ -42,7 +42,7 @@ void swap(M&&, M&&) noexcept {}
struct ThrowingMove {
ThrowingMove(ThrowingMove&&) {}
ThrowingMove& operator=(ThrowingMove&&) {}
ThrowingMove& operator=(ThrowingMove&&) { return *this; }
};
} // namespace MyNS

View File

@ -11,6 +11,11 @@
// is_trivially_destructible
// Prevent warning when testing the Abstract test type.
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wdelete-non-virtual-dtor"
#endif
#include <type_traits>
#include "test_macros.h"

View File

@ -23,7 +23,7 @@ int main()
std::clock_t c = 0;
std::size_t s = 0;
std::time_t t = 0;
std::tm tm = {0};
std::tm tm = {};
char str[3];
((void)c); // Prevent unused warning
((void)s); // Prevent unused warning

View File

@ -30,7 +30,7 @@ inline Checkpoint& globalCheckpoint() {
}
inline void clearCheckpoint() {
globalCheckpoint() = Checkpoint{0};
globalCheckpoint() = {};
}
#if defined(__GNUC__)