|
| 1 | +extern crate libcc2rs; |
| 2 | +use libcc2rs::*; |
| 3 | +use std::cell::RefCell; |
| 4 | +use std::collections::BTreeMap; |
| 5 | +use std::io::prelude::*; |
| 6 | +use std::io::{Read, Seek, Write}; |
| 7 | +use std::os::fd::AsFd; |
| 8 | +use std::rc::{Rc, Weak}; |
| 9 | +#[derive(Default)] |
| 10 | +pub struct iter { |
| 11 | + pub p: Value<Ptr<i32>>, |
| 12 | +} |
| 13 | +impl Clone for iter { |
| 14 | + fn clone(&self) -> Self { |
| 15 | + let mut this = Self { |
| 16 | + p: Rc::new(RefCell::new((*self.p.borrow()).clone())), |
| 17 | + }; |
| 18 | + this |
| 19 | + } |
| 20 | +} |
| 21 | +impl ByteRepr for iter {} |
| 22 | +#[derive(Default)] |
| 23 | +pub struct const_iter { |
| 24 | + pub p: Value<Ptr<i32>>, |
| 25 | +} |
| 26 | +impl const_iter { |
| 27 | + pub fn const_iter(o: Ptr<iter>) -> Self { |
| 28 | + let mut this = Self { |
| 29 | + p: Rc::new(RefCell::new((*(*o.upgrade().deref()).p.borrow()).clone())), |
| 30 | + }; |
| 31 | + this |
| 32 | + } |
| 33 | +} |
| 34 | +impl Clone for const_iter { |
| 35 | + fn clone(&self) -> Self { |
| 36 | + let mut this = Self { |
| 37 | + p: Rc::new(RefCell::new(Ptr::<i32>::null())), |
| 38 | + }; |
| 39 | + this |
| 40 | + } |
| 41 | +} |
| 42 | +impl ByteRepr for const_iter {} |
| 43 | +pub fn sink_0(i: const_iter) { |
| 44 | + let i: Value<const_iter> = Rc::new(RefCell::new(i)); |
| 45 | +} |
| 46 | +pub fn main() { |
| 47 | + std::process::exit(main_0()); |
| 48 | +} |
| 49 | +fn main_0() -> i32 { |
| 50 | + let buf: Value<Box<[i32]>> = Rc::new(RefCell::new(Box::new([0, 0]))); |
| 51 | + let it: Value<iter> = Rc::new(RefCell::new(iter { |
| 52 | + p: Rc::new(RefCell::new((buf.as_pointer() as Ptr<i32>))), |
| 53 | + })); |
| 54 | + ({ |
| 55 | + let _i: const_iter = const_iter::const_iter(it.as_pointer()); |
| 56 | + sink_0(_i) |
| 57 | + }); |
| 58 | + return 0; |
| 59 | +} |
0 commit comments