Avoid using 0 size arrays in variant_test.

0 size arrays are not allowed in MSVC.

PiperOrigin-RevId: 289935956
Change-Id: I6a219d24b61bcea4b22ef14b7f7f3549974c90fc
This commit is contained in:
Gunhan Gulsoy 2020-01-15 14:19:43 -08:00 committed by TensorFlower Gardener
parent bc996ac058
commit 1971d418d5

View File

@ -37,7 +37,7 @@ namespace {
template <typename T, bool BIG>
struct Wrapper {
T value;
char big[BIG ? 256 : 0];
char big[BIG ? 256 : 1];
string TypeName() const { return "POD"; }
};
@ -93,7 +93,7 @@ class MaybeAlive {
private:
bool alive_;
char big_[BIG ? 256 : 0];
char big_[BIG ? 256 : 1];
static int live_counter_;
};
@ -124,7 +124,7 @@ class DeleteCounter {
rhs.counter_ = nullptr;
}
DeleteCounter(const DeleteCounter& rhs) = default;
char big_[BIG ? 256 : 0];
char big_[BIG ? 256 : 1];
int* counter_;
string TypeName() const { return "DeleteCounter"; }
@ -244,7 +244,7 @@ class MoveAndCopyCounter {
copy_counter_ = rhs.copy_counter_;
if (copy_counter_) ++*copy_counter_;
}
char big_[BIG ? 256 : 0];
char big_[BIG ? 256 : 1];
int* move_counter_;
int* copy_counter_;
@ -614,7 +614,7 @@ void PodUpdateTest() {
struct Pod {
int x;
float y;
char big[BIG ? 256 : 0];
char big[BIG ? 256 : 1];
string TypeName() const { return "POD"; }
};
@ -637,7 +637,7 @@ void TestEncodeDecodePod() {
struct Pod {
int x;
float y;
char big[BIG ? 256 : 0];
char big[BIG ? 256 : 1];
string TypeName() const { return "POD"; }
};