Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assigning a function to a variable causes an assertion failure #333

Closed
catamorphism opened this issue Apr 18, 2011 · 1 comment
Closed

Comments

@catamorphism
Copy link
Contributor

Compiling this program with rustc:

fn quux[T]() -> T {
  auto f = id[T];
 }

fn id[T](&T x) -> T {
    ret x;
}

yields an assertion failure:

"Assertion failed: (getOperand(0)->getType() == cast(getOperand(1)->getType())->getElementType() && "Ptr must be a pointer to Val type!"), function AssertOK, file Instructions.cpp, line 962."

Perhaps one is supposed to use bind or something for assigning id[T] to a variable, but it would be better to have a friendlier error message...

@brson
Copy link
Contributor

brson commented May 24, 2011

This only happens when id has type parameters. Functions without type params can be assigned as expected.

@brson brson closed this as completed in 394b8fc Jul 9, 2011
oli-obk pushed a commit to oli-obk/rust that referenced this issue Sep 19, 2017
Use correct rustc in rust's CI
keeperofdakeys pushed a commit to keeperofdakeys/rust that referenced this issue Dec 12, 2017
Linux: add reboot() and constants
kazcw pushed a commit to kazcw/rust that referenced this issue Oct 23, 2018
Looks like LLVM 6 may have removed the intrinsic, and this implementation is
modeled after clang's.
dlrobertson pushed a commit to dlrobertson/rust that referenced this issue Nov 29, 2018
ZuseZ4 pushed a commit to EnzymeAD/rust that referenced this issue Mar 7, 2023
coastalwhite pushed a commit to coastalwhite/rust that referenced this issue Aug 5, 2023
`_xgetbv` was reimplemented to use inline assembly in rust-lang#333 since LLVM
3.9 didn't export the intrinsic we needed to use.  LLVM 4.0 has since
rectified that issue, and since rust's minimum supported version of LLVM
is 8.0, this change can be reverted.
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
* Use `x.py` to build and run the dashboard.

* Stop looking for copyright notice in markdown files.

Co-authored-by: Adrian Palacios <73246657+adpaco-aws@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants