From 630211ac7d20011acf111eda24887a3047eba7d8 Mon Sep 17 00:00:00 2001 From: PKEuS Date: Tue, 26 Aug 2014 15:30:12 +0200 Subject: [PATCH] Added unit test for #4777 --- test/testsimplifytokens.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/testsimplifytokens.cpp b/test/testsimplifytokens.cpp index 979826f37..6eef6f062 100644 --- a/test/testsimplifytokens.cpp +++ b/test/testsimplifytokens.cpp @@ -303,6 +303,7 @@ private: TEST_CASE(simplifyTypedef105); // ticket #3616 TEST_CASE(simplifyTypedef106); // ticket #3619 TEST_CASE(simplifyTypedef107); // ticket #3963 - bad code => segmentation fault + TEST_CASE(simplifyTypedef108); // ticket #4777 TEST_CASE(simplifyTypedefFunction1); TEST_CASE(simplifyTypedefFunction2); // ticket #1685 @@ -5709,6 +5710,21 @@ private: ASSERT_THROW(tok(code), InternalError); } + void simplifyTypedef108() { // ticket #4777 + const char code[] = "typedef long* GEN;\n" + "void sort_factor(GEN *y, long n) {\n" + " GEN a, b;\n" + " foo(a, b);\n" + "}\n"; + const char expected[] = "void sort_factor ( long * * y , long n ) { " + "long * a ; long * b ; " + "foo ( a , b ) ; " + "}"; + + checkSimplifyTypedef(code); + ASSERT_EQUALS(expected, tok(code)); + } + void simplifyTypedefFunction1() { { const char code[] = "typedef void (*my_func)();\n"