Commit 8942206b authored by SND\ussrhero_cp's avatar SND\ussrhero_cp Committed by Mikhail I. Izmestev

add test for bug #14139

git-svn-id: https://kdlibcpp.svn.codeplex.com/svn@91263 9b283d60-5439-405e-af05-b73fd8c4d996
parent dd6e011c
......@@ -415,5 +415,15 @@ extern testClass1 g_testClass;
////////////////////////////////////////////////////////////////////////////////
struct testStructZeroArray {
unsigned long intFixField;
unsigned long zeroLenArray[0];
};
extern testStructZeroArray *g_testStructZeroArray;
////////////////////////////////////////////////////////////////////////////////
#pragma pack ( pop )
......@@ -195,3 +195,17 @@ namespace testspace {
testClass1 g_testClass;
}
testStructZeroArray *g_testStructZeroArray;
class testStructZeroArrayInter {
public:
testStructZeroArrayInter() {
g_testStructZeroArray = reinterpret_cast<testStructZeroArray*>(new char [ sizeof(testStructZeroArray) + sizeof(unsigned long) ] );
g_testStructZeroArray->intFixField = 100555;
g_testStructZeroArray->zeroLenArray[0] = 200300;
}
};
testStructZeroArrayInter g_testStructZeroArrayInter;
......@@ -660,3 +660,11 @@ TEST_F(TypedVarTest, CallRaw)
EXPECT_EQ( 0x100000000ULL + 5, callRaw( getSymbolOffset(L"CdeclFuncLong" ), kdlib::CallConv_NearC, { 0x100000000ULL } ) );
EXPECT_EQ( 500000/20, callRaw( getSymbolOffset(L"StdcallFuncRet" ), kdlib::CallConv_NearStd, { 20, 500000 } ) );
}
TEST_F(TypedVarTest, FieldZeroLenArray)
{
EXPECT_EQ( g_testStructZeroArray->intFixField, *loadTypedVar(L"g_testStructZeroArray")->deref()->getElement(L"intFixField") );
EXPECT_EQ( g_testStructZeroArray->zeroLenArray[0], *loadTypedVar(L"g_testStructZeroArray")->deref()->getElement(L"zeroLenArray")->getElement(0) );
std::wstring desc;
EXPECT_NO_THROW( desc = loadTypedVar(L"g_testStructZeroArray")->deref()->str() );
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment