Added value_initialized<T> 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]
This commit is contained in:
Niels Dekker 2007-10-16 17:06:39 +00:00
parent cd8f85afee
commit 42e0001370

View File

@ -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<class T>
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<NonPOD *>( 0, &NonPOD_object ) ;
AggregatePODStruct zeroInitializedAggregatePODStruct = { 0.0f, '\0', 0 };
AggregatePODStruct nonZeroInitializedAggregatePODStruct = { 1.25f, 'a', -1 };
test(zeroInitializedAggregatePODStruct, nonZeroInitializedAggregatePODStruct);
return 0;
}