diff --git a/src/func.c b/src/func.c index 95fe18b65a47..350e08e97964 100644 --- a/src/func.c +++ b/src/func.c @@ -1863,7 +1863,7 @@ void FuncDeclaration::semantic3(Scope *sc) exp->checkEscape(); } - exp = checkGC(sc, exp); + exp = checkGC(sc2, exp); if (vresult) { diff --git a/test/compilable/nogc.d b/test/compilable/nogc.d index 0c54e4c7bb94..4b29372668fa 100644 --- a/test/compilable/nogc.d +++ b/test/compilable/nogc.d @@ -97,3 +97,15 @@ static if (is(__vector(ulong[2]))) return [0, 0]; } } + +/******************************************/ +// 13550 + +auto foo13550() @nogc +{ + static int[] bar() + { + return new int[2]; + } + return &bar; +}