diff options
author | Douglas Gregor <dgregor@apple.com> | 2013-04-16 16:01:32 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2013-04-16 16:01:32 +0000 |
commit | b004a8e5aa700108de2acc8f81b0dd2ec7518899 (patch) | |
tree | aaec608b02ad0fa061ea3ee7d570a432d71a3ad5 /test/Sema/function.c | |
parent | cb4d09c3160240397032b3d6de6a223cabc76977 (diff) |
Fix PR4296: Add parser detection/error recovery for nested functions, from Serve Pavlov!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179603 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/function.c')
-rw-r--r-- | test/Sema/function.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/Sema/function.c b/test/Sema/function.c index 1b0dc2adeb..bbf81a56cb 100644 --- a/test/Sema/function.c +++ b/test/Sema/function.c @@ -92,3 +92,14 @@ void t20(int i...) { } // expected-error {{requires a comma}} int n; void t21(int n, int (*array)[n]); + +int func_e(int x) { + int func_n(int y) { // expected-error {{function definition is not allowed here}} + if (y > 22) { + return y+2; + } else { + return y-2; + } + } + return x + 3; +} |