From: Matthias Braun Date: Fri, 15 Feb 2008 10:57:36 +0000 (+0000) Subject: more parsetests X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=10ddb641ca4f0624dbeb3f300479e29c3ccedefb;p=cparser more parsetests [r18861] --- diff --git a/parsetest/init3.c b/parsetest/init3.c new file mode 100644 index 0000000..3cfe6ea --- /dev/null +++ b/parsetest/init3.c @@ -0,0 +1,12 @@ +typedef struct { + int a, b; +} Stru1; + +typedef struct { + double d; + Stru1 stru; + float c; +} Stru2; + +static const Stru1 k = { 4, 2 }; +static const Stru2 a = { 2.4, k, 0.4f }; diff --git a/parsetest/init5.c b/parsetest/init5.c new file mode 100644 index 0000000..5dc54a7 --- /dev/null +++ b/parsetest/init5.c @@ -0,0 +1,17 @@ +static const int l = 5; + +struct k { + int c, d; +}; + +struct S { + int a; + struct k k; +}; + +struct S arr[] = { 1, (struct k) { 4, 5 } }; + +int main(void) +{ + return 0; +} diff --git a/parsetest/shouldfail/init2.c b/parsetest/shouldfail/init2.c index 9e2b90a..dbaaaab 100644 --- a/parsetest/shouldfail/init2.c +++ b/parsetest/shouldfail/init2.c @@ -3,3 +3,8 @@ struct S { }; struct S arr[] = { { 1, 2, { 3, 4 } } }; + +int main(void) +{ + return 0; +} diff --git a/parsetest/shouldfail/init3.c b/parsetest/shouldfail/init3.c new file mode 100644 index 0000000..1d910bb --- /dev/null +++ b/parsetest/shouldfail/init3.c @@ -0,0 +1,12 @@ +static const int l = 5; + +struct S { + int a, b; +}; + +struct S arr[] = { 1, l }; + +int main(void) +{ + return 0; +} diff --git a/parsetest/shouldfail/init4.c b/parsetest/shouldfail/init4.c new file mode 100644 index 0000000..97be0ef --- /dev/null +++ b/parsetest/shouldfail/init4.c @@ -0,0 +1,17 @@ +static const int l = 5; + +struct k { + int c, d; +}; + +struct S { + int a; + struct k k; +}; + +struct S arr[] = { 1, (struct k) { 4, l } }; + +int main(void) +{ + return 0; +}