From 42e0001370418c45c250bebb4f8c44623b25da47 Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Tue, 16 Oct 2007 17:06:39 +0000 Subject: [PATCH] Added value_initialized test, having T as aggregate POD struct. In the past, this would have triggered MSVC warning C4345; this warning is now disabled within value_init.hpp, changeset [40088] [SVN r40089] --- value_init_test.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/value_init_test.cpp b/value_init_test.cpp index 08f9b87..6bca270 100644 --- a/value_init_test.cpp +++ b/value_init_test.cpp @@ -60,6 +60,20 @@ struct NonPOD : NonPODBase std::string id ; } ; +// +// Sample aggregate POD struct type +// +struct AggregatePODStruct +{ + float f; + char c; + int i; +}; + +bool operator == ( AggregatePODStruct const& lhs, AggregatePODStruct const& rhs ) +{ return lhs.f == rhs.f && lhs.c == rhs.c && lhs.i == rhs.i ; } + + template void test ( T const& y, T const& z ) { @@ -98,6 +112,10 @@ int test_main(int, char **) NonPOD NonPOD_object( std::string("NonPOD_object") ); test( 0, &NonPOD_object ) ; + AggregatePODStruct zeroInitializedAggregatePODStruct = { 0.0f, '\0', 0 }; + AggregatePODStruct nonZeroInitializedAggregatePODStruct = { 1.25f, 'a', -1 }; + test(zeroInitializedAggregatePODStruct, nonZeroInitializedAggregatePODStruct); + return 0; }