-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved
guessCastExpressions
in C++ frontend (#1357)
There were more ambiguities when guesssing cast expressions, so I added them. Fixes #1347
- Loading branch information
Showing
3 changed files
with
67 additions
and
13 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
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 |
---|---|---|
@@ -1,4 +1,18 @@ | ||
// These headers are just here so that we could compile it, if we want it, | ||
// to check for errors with clang. We will not parse them. | ||
#include <cstddef> | ||
#include <cstdint> | ||
|
||
int main() { | ||
// this cast could be mistaken for a call expression | ||
size_t count = (size_t)(42); | ||
|
||
// this cast could be mistaken for a binary operation | ||
int64_t addr = (int64_t) &count; | ||
|
||
// finally, a more complex example of unary operators and casts | ||
char* outptr, key; | ||
*(int64_t *)outptr = *(int64_t *)&key; | ||
|
||
return 0; | ||
} |