mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-04 09:00:33 +03:00
parent
6c76a695f3
commit
649d19e2ab
2 changed files with 16 additions and 4 deletions
|
@ -1822,11 +1822,12 @@ FuncDeclaration *getParentFunc(Dsymbol *sym) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Static/non-extern(D) functions and function (not delegate) literals don't
|
// Static functions, non-extern(D) non-member functions and function (not
|
||||||
// allow access to a parent context, even if they are nested.
|
// delegate) literals don't allow access to a parent context, even if they are
|
||||||
|
// nested.
|
||||||
if (FuncDeclaration *fd = sym->isFuncDeclaration()) {
|
if (FuncDeclaration *fd = sym->isFuncDeclaration()) {
|
||||||
bool certainlyNewRoot =
|
bool certainlyNewRoot =
|
||||||
fd->isStatic() || fd->linkage != LINKd ||
|
fd->isStatic() || (!fd->isThis() && fd->linkage != LINKd) ||
|
||||||
(fd->isFuncLiteralDeclaration() &&
|
(fd->isFuncLiteralDeclaration() &&
|
||||||
static_cast<FuncLiteralDeclaration *>(fd)->tok == TOKfunction);
|
static_cast<FuncLiteralDeclaration *>(fd)->tok == TOKfunction);
|
||||||
if (certainlyNewRoot) {
|
if (certainlyNewRoot) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// RUN: %ldc -c %s
|
// RUN: %ldc -c %s
|
||||||
|
|
||||||
void foo()
|
void gh2808()
|
||||||
{
|
{
|
||||||
extern(C) void DoubleArrayToAnyArray(void* arg0)
|
extern(C) void DoubleArrayToAnyArray(void* arg0)
|
||||||
{
|
{
|
||||||
|
@ -10,3 +10,14 @@ void foo()
|
||||||
auto arg = () { return local; }();
|
auto arg = () { return local; }();
|
||||||
DoubleArrayToAnyArray(null);
|
DoubleArrayToAnyArray(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gh3234()
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
void nested() { ++i; }
|
||||||
|
|
||||||
|
extern (C++) class Visitor
|
||||||
|
{
|
||||||
|
void visit() { nested(); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue