2018-08-30 14:18:55 +02:00
|
|
|
// run-pass
|
2014-06-11 18:01:48 -04: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 13:13:15 -07:00
|
|
|
// pretty-expanded FIXME #23616
|
|
|
|
|
|
2014-12-31 17:32:49 +13:00
|
|
|
#[derive(Clone)]
|
2014-06-11 18:01:48 -04:00
|
|
|
struct B1;
|
|
|
|
|
|
2015-02-18 15:58:07 -08:00
|
|
|
trait A { fn foo(&self) {} }
|
2014-06-11 18:01:48 -04:00
|
|
|
impl A for B1 {}
|
|
|
|
|
|
|
|
|
|
fn main() {
|
2022-07-07 04:36:10 +02:00
|
|
|
let v: Box<_> = Box::new(B1);
|
2019-05-28 14:47:21 -04:00
|
|
|
let _c: Box<dyn A> = v.clone();
|
2014-06-11 18:01:48 -04:00
|
|
|
}
|