Fixed #2376 (simplifyTypedef: upx-ucl)

This commit is contained in:
Daniel Marjamäki 2011-01-23 09:04:34 +01:00
parent 2a3cce5001
commit b10f0aabd6
2 changed files with 16 additions and 0 deletions

View File

@ -2408,6 +2408,12 @@ bool Tokenizer::tokenize(std::istream &code,
// typedef..
simplifyTypedef();
// Fix internal error by updating links (#2376)
// TODO: Remove this "createLinks". Make sure that the testcase
// TestSimplifyTokens::simplifyTypedefFunction8
// doesn't fail.
createLinks();
// enum..
simplifyEnum();

View File

@ -242,6 +242,7 @@ private:
TEST_CASE(simplifyTypedefFunction5);
TEST_CASE(simplifyTypedefFunction6);
TEST_CASE(simplifyTypedefFunction7);
TEST_CASE(simplifyTypedefFunction8);
TEST_CASE(reverseArraySyntax)
TEST_CASE(simplify_numeric_condition)
@ -5407,6 +5408,15 @@ private:
ASSERT_EQUALS("", errout.str());
}
void simplifyTypedefFunction8()
{
// #2376 - internal error
const char code[] = "typedef int f_expand(const nrv_byte *);\n"
"void f(f_expand *(*get_fexp(int))){}\n";
checkSimplifyTypedef(code);
ASSERT_EQUALS("", errout.str()); // make sure that there is no internal error
}
void reverseArraySyntax()
{
ASSERT_EQUALS("a [ 13 ]", tok("13[a]"));