c++: Fix decltype-bitfield1.C on i?86

This test was failing on i?86 because of:

warning: width of 'A::l' exceeds its type

so change the type to 'long long' and make the test run only on arches
where sizeof(long long) == 8 to avoid failing like this again.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/decltype-bitfield1.C: Change a type to unsigned
	long long.  Only run on longlong64 targets.
This commit is contained in:
Marek Polacek 2021-12-07 16:06:19 -05:00
parent 4394fd6726
commit cf2cd61dce

View File

@ -1,5 +1,5 @@
// PR c++/95009
// { dg-do compile { target c++11 } }
// { dg-do compile { target { c++11 && longlong64 } } }
struct false_type { static constexpr bool value = false; };
struct true_type { static constexpr bool value = true; };
@ -10,7 +10,7 @@ struct is_same<T, T> : true_type {};
struct A {
int i : 31;
unsigned long l : 37;
unsigned long long l : 37;
} a;
void
@ -40,26 +40,26 @@ g ()
static_assert (is_same<decltype(~a.i), int>::value, "");
static_assert (is_same<decltype((~a.i)), int>::value, "");
static_assert (is_same<decltype(a.l), unsigned long>::value, "");
static_assert (is_same<decltype((a.l)), unsigned long&>::value, "");
static_assert (is_same<decltype(++a.l), unsigned long&>::value, "");
static_assert (is_same<decltype((++a.l)), unsigned long&>::value, "");
static_assert (is_same<decltype(a.l++), unsigned long>::value, "");
static_assert (is_same<decltype((a.l++)), unsigned long>::value, "");
static_assert (is_same<decltype(--a.l), unsigned long&>::value, "");
static_assert (is_same<decltype((--a.l)), unsigned long&>::value, "");
static_assert (is_same<decltype(a.l--), unsigned long>::value, "");
static_assert (is_same<decltype((a.l--)), unsigned long>::value, "");
static_assert (is_same<decltype(a.l += 1), unsigned long&>::value, "");
static_assert (is_same<decltype((a.l += 1)), unsigned long&>::value, "");
static_assert (is_same<decltype(a.l -= 1), unsigned long&>::value, "");
static_assert (is_same<decltype((a.l -= 1)), unsigned long&>::value, "");
static_assert (is_same<decltype(a.l *= 1), unsigned long&>::value, "");
static_assert (is_same<decltype((a.l *= 1)), unsigned long&>::value, "");
static_assert (is_same<decltype(+a.l), unsigned long>::value, "");
static_assert (is_same<decltype((+a.l)), unsigned long>::value, "");
static_assert (is_same<decltype(-a.l), unsigned long>::value, "");
static_assert (is_same<decltype((-a.l)), unsigned long>::value, "");
static_assert (is_same<decltype(~a.l), unsigned long>::value, "");
static_assert (is_same<decltype((~a.l)), unsigned long>::value, "");
static_assert (is_same<decltype(a.l), unsigned long long>::value, "");
static_assert (is_same<decltype((a.l)), unsigned long long&>::value, "");
static_assert (is_same<decltype(++a.l), unsigned long long&>::value, "");
static_assert (is_same<decltype((++a.l)), unsigned long long&>::value, "");
static_assert (is_same<decltype(a.l++), unsigned long long>::value, "");
static_assert (is_same<decltype((a.l++)), unsigned long long>::value, "");
static_assert (is_same<decltype(--a.l), unsigned long long&>::value, "");
static_assert (is_same<decltype((--a.l)), unsigned long long&>::value, "");
static_assert (is_same<decltype(a.l--), unsigned long long>::value, "");
static_assert (is_same<decltype((a.l--)), unsigned long long>::value, "");
static_assert (is_same<decltype(a.l += 1), unsigned long long&>::value, "");
static_assert (is_same<decltype((a.l += 1)), unsigned long long&>::value, "");
static_assert (is_same<decltype(a.l -= 1), unsigned long long&>::value, "");
static_assert (is_same<decltype((a.l -= 1)), unsigned long long&>::value, "");
static_assert (is_same<decltype(a.l *= 1), unsigned long long&>::value, "");
static_assert (is_same<decltype((a.l *= 1)), unsigned long long&>::value, "");
static_assert (is_same<decltype(+a.l), unsigned long long>::value, "");
static_assert (is_same<decltype((+a.l)), unsigned long long>::value, "");
static_assert (is_same<decltype(-a.l), unsigned long long>::value, "");
static_assert (is_same<decltype((-a.l)), unsigned long long>::value, "");
static_assert (is_same<decltype(~a.l), unsigned long long>::value, "");
static_assert (is_same<decltype((~a.l)), unsigned long long>::value, "");
}