mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-01 07:30:43 +03:00
[svn r350] Fixed incorrect function types for lazy arguments. looks like lazy arguments have never even worked :o well.. now they should.
This commit is contained in:
parent
521de1a47e
commit
8c48f86f0a
2 changed files with 24 additions and 0 deletions
|
@ -141,6 +141,17 @@ const llvm::FunctionType* DtoFunctionType(Type* type, const LLType* thistype, bo
|
||||||
paramvec.push_back(at);
|
paramvec.push_back(at);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// handle lazy args
|
||||||
|
if (arg->storageClass & STClazy)
|
||||||
|
{
|
||||||
|
Logger::cout() << "for lazy got: " << *paramvec.back() << '\n';
|
||||||
|
TypeFunction *ltf = new TypeFunction(NULL, arg->type, 0, LINKd);
|
||||||
|
TypeDelegate *ltd = new TypeDelegate(ltf);
|
||||||
|
at = getPtrToType(DtoType(ltd));
|
||||||
|
Logger::cout() << "lazy updated to: " << *at << '\n';
|
||||||
|
paramvec.back() = at;
|
||||||
|
}
|
||||||
|
|
||||||
if (arg->llvmByVal)
|
if (arg->llvmByVal)
|
||||||
nbyval++;
|
nbyval++;
|
||||||
}
|
}
|
||||||
|
|
13
tangotests/lazy1.d
Normal file
13
tangotests/lazy1.d
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
module tangotests.lazy1;
|
||||||
|
|
||||||
|
extern(C) int printf(char*, ...);
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
lazystr("whee\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void lazystr(lazy char[] msg)
|
||||||
|
{
|
||||||
|
printf("%.*s", msg.length, msg.ptr);
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue