comparison gen/toir.cpp @ 1419:a6dfd3cb5b99 0.9.1

Error instead of assert on delegate literals as constant expressions. Make function literal linkage internal inside functions and external otherwise.
author Christian Kamm <kamm incasoftware de>
date Wed, 27 May 2009 19:20:18 +0200
parents e2cf1f67ca33
children 5d0c043ff131
comparison
equal deleted inserted replaced
1418:f5f8c21ce6ef 1419:a6dfd3cb5b99
2295 { 2295 {
2296 Logger::print("FuncExp::toConstElem: %s @ %s\n", toChars(), type->toChars()); 2296 Logger::print("FuncExp::toConstElem: %s @ %s\n", toChars(), type->toChars());
2297 LOG_SCOPE; 2297 LOG_SCOPE;
2298 2298
2299 assert(fd); 2299 assert(fd);
2300 assert(fd->tok == TOKfunction); 2300 if (fd->tok != TOKfunction)
2301 {
2302 assert(fd->tok == TOKdelegate);
2303 error("delegate literals as constant expressions are not yet allowed");
2304 }
2301 2305
2302 fd->codegen(Type::sir); 2306 fd->codegen(Type::sir);
2303 assert(fd->ir.irFunc->func); 2307 assert(fd->ir.irFunc->func);
2304 2308
2305 return fd->ir.irFunc->func; 2309 return fd->ir.irFunc->func;