Skip to content

Assertion failed: "Ptr must be a pointer to Val type!" #17257

Closed
@rozaliev

Description

@rozaliev

rust version: rustc 0.12.0-pre-nightly (09abbbd 2014-09-11 00:05:41 +0000)

Assertion failed: (getOperand(0)->getType() == cast<PointerType>(getOperand(1)->getType())->getElementType() && "Ptr must be a pointer to Val type!"), function AssertOK, file /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/llvm/lib/IR/Instructions.cpp, line 1085.

code to reproduce:

trait Tr: Clone {
  fn clone_to_tobj(&self) -> Box<Tr> {
    return box self.clone()
  }
}

#[deriving(Clone)]
struct A;
impl Tr for A {
}


fn main() {
   let a: Box<Tr> = box A;
}

but this compiles fine

trait Tr: Clone {
  fn clone_to_tobj(&self) -> Box<Tr> {
    box self.clone()
  }
}

#[deriving(Clone)]
struct A;
impl Tr for A {
}


fn main() {
   let a: Box<Tr> = box A;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-codegenArea: Code generationI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions