2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2014-06-11 17:01:48 -05:00
|
|
|
// #14399
|
|
|
|
// We'd previously ICE if we had a method call whose return
|
|
|
|
// value was coerced to a trait object. (v.clone() returns Box<B1>
|
|
|
|
// which is coerced to Box<A>).
|
|
|
|
|
2015-03-22 15:13:15 -05:00
|
|
|
// pretty-expanded FIXME #23616
|
|
|
|
|
2014-12-30 22:32:49 -06:00
|
|
|
#[derive(Clone)]
|
2014-06-11 17:01:48 -05:00
|
|
|
struct B1;
|
|
|
|
|
2015-02-18 17:58:07 -06:00
|
|
|
trait A { fn foo(&self) {} }
|
2014-06-11 17:01:48 -05:00
|
|
|
impl A for B1 {}
|
|
|
|
|
|
|
|
fn main() {
|
2022-07-06 21:36:10 -05:00
|
|
|
let v: Box<_> = Box::new(B1);
|
2019-05-28 13:47:21 -05:00
|
|
|
let _c: Box<dyn A> = v.clone();
|
2014-06-11 17:01:48 -05:00
|
|
|
}
|