Allow member function address as constant initializer

This is allowed since D v2.105. Fixes dmd-testsuite's
runnable/test20687.d. Kindly got a heads-up early:
https://github.com/dlang/dmd/pull/10958#issuecomment-1471147790
This commit is contained in:
Martin Kinkelin 2023-08-26 22:34:59 +02:00
parent fda89c1c63
commit 12286284cd

View file

@ -1609,14 +1609,6 @@ DValue *DtoSymbolAddress(const Loc &loc, Type *type, Declaration *decl) {
}
llvm::Constant *DtoConstSymbolAddress(const Loc &loc, Declaration *decl) {
// Make sure 'this' isn't needed.
// TODO: This check really does not belong here, should be moved to
// semantic analysis in the frontend.
if (decl->needThis()) {
error(loc, "need `this` to access `%s`", decl->toChars());
fatal();
}
// global variable
if (VarDeclaration *vd = decl->isVarDeclaration()) {
if (!vd->isDataseg()) {