diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2011-10-24 17:03:18 -0700 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2011-10-24 17:03:18 -0700 |
| commit | c78b1639b445e31274858d0801d30a2f9cd3d7e6 (patch) | |
| tree | a69e306c5c37ec0bb6c71ad867cb39c0b9c08118 /src/test | |
| parent | d41385a69be7ef002c71bfe3ad1bac796517370d (diff) | |
fix c-stack-cdecl when used w/ i64
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/run-pass/c-stack-returning-int64.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/run-pass/c-stack-returning-int64.rs b/src/test/run-pass/c-stack-returning-int64.rs new file mode 100644 index 00000000000..33e8b73a495 --- /dev/null +++ b/src/test/run-pass/c-stack-returning-int64.rs @@ -0,0 +1,20 @@ +use std; +import std::str; + +native "c-stack-cdecl" mod libc = "" { + fn atol(x: str::sbuf) -> int; + fn atoll(x: str::sbuf) -> i64; +} + +fn atol(s: str) -> int { + ret str::as_buf(s, { |x| libc::atol(x) }); +} + +fn atoll(s: str) -> i64 { + ret str::as_buf(s, { |x| libc::atoll(x) }); +} + +fn main() { + assert atol("1024") * 10 == atol("10240"); + assert (atoll("11111111111111111") * 10i64) == atoll("111111111111111110"); +} |
