[LLVMdev] regression? Or did I do something wrong again?

Matthijs Kooijman matthijs at stdin.nl
Mon Jun 9 12:25:42 PDT 2008


Hi Hendrik,

> hendrik at lovesong:~/dv/llvm/tut$ g++ -g toy.cpp `llvm-config --cppflags --ldflags --libs core jit native` -O3 -o toy
> toy.cpp: In member function ‘virtual llvm::Value* NumberExprAST::Codegen()’:
> toy.cpp:359: error: no matching function for call to ‘llvm::ConstantFP::get(const llvm::Type*&, llvm::APFloat)’
> /usr/local/llvm/include/llvm/Constants.h:237: note: candidates are: static llvm::ConstantFP* llvm::ConstantFP::get(const llvm::APFloat&)
> /usr/local/llvm/include/llvm/Constants.h:242: note:                 static llvm::ConstantFP* llvm::ConstantFP::get(const llvm::Type*, double)
> hendrik at lovesong:~/dv/llvm/tut$
It seems the ConstantFP method get might have been modified to take a
reference-to-APFloat, meaning you can't pass in APFloat(Value) anonymously.
You should either put it in a local variable, like
	APFloat F(Val);
	return ConstantFP::get(Type::DoubleTy, F);
which I _think_ is the right way to use the first get() function. Easier is to
use the alternative get() function, which simply takes a double directly.
i.e.,
	return ConstantFP::get(Type::DoubleTy, Val);

Could you please test both and report the results?

Gr.

Matthijs
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080609/8579b3d7/attachment.sig>


More information about the llvm-dev mailing list