-
-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #545 from andreasfertig/fixIssue543
Fixed #543: Include variable name of an array with a typdef or using.
- Loading branch information
Showing
5 changed files
with
81 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace test { | ||
typedef int jmp_buf[30]; | ||
|
||
jmp_buf a; | ||
} | ||
|
||
|
||
test::jmp_buf x; | ||
|
||
|
||
using test::jmp_buf; | ||
|
||
jmp_buf t; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace test | ||
{ | ||
using jmp_buf = int[30]; | ||
jmp_buf a; | ||
|
||
} | ||
|
||
|
||
test::jmp_buf x; | ||
|
||
|
||
|
||
using test::jmp_buf; | ||
|
||
test::jmp_buf t; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include <cstdio> | ||
#include <csetjmp> | ||
std::jmp_buf jump_buffer; | ||
|
||
void foo() { | ||
printf("foo: Entered\n"); | ||
longjmp(jump_buffer, 1); // Jump back to where setjmp was called | ||
printf("foo: This won't be executed\n"); | ||
} | ||
|
||
int main() { | ||
if (setjmp(jump_buffer) == 0) { | ||
printf("main: Calling foo\n"); | ||
foo(); | ||
} else { | ||
printf("main: Jumped back from foo\n"); | ||
} | ||
|
||
printf("main: Exiting\n"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include <cstdio> | ||
#include <csetjmp> | ||
std::jmp_buf jump_buffer; | ||
|
||
|
||
void foo() | ||
{ | ||
printf("foo: Entered\n"); | ||
longjmp(jump_buffer, 1); | ||
printf("foo: This won't be executed\n"); | ||
} | ||
|
||
|
||
int main() | ||
{ | ||
if(setjmp(jump_buffer) == 0) { | ||
printf("main: Calling foo\n"); | ||
foo(); | ||
} else { | ||
printf("main: Jumped back from foo\n"); | ||
} | ||
|
||
printf("main: Exiting\n"); | ||
return 0; | ||
} | ||
|