diff options
Diffstat (limited to 'test/Analysis/casts.cpp')
-rw-r--r-- | test/Analysis/casts.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/Analysis/casts.cpp b/test/Analysis/casts.cpp index f96f19b0ac33..757eb6da6623 100644 --- a/test/Analysis/casts.cpp +++ b/test/Analysis/casts.cpp @@ -21,3 +21,23 @@ void intAsBoolAsSwitchCondition(int c) { break; } } + +int *&castToIntPtrLValueRef(char *p) { + return (int *&)*(int *)p; +} +bool testCastToIntPtrLValueRef(char *p, int *s) { + return castToIntPtrLValueRef(p) != s; // no-crash +} + +int *&&castToIntPtrRValueRef(char *p) { + return (int *&&)*(int *)p; +} +bool testCastToIntPtrRValueRef(char *p, int *s) { + return castToIntPtrRValueRef(p) != s; // no-crash +} + +bool retrievePointerFromBoolean(int *p) { + bool q; + *reinterpret_cast<int **>(&q) = p; + return q; +} |