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