diff --git a/src/func.d b/src/func.d index 1a737e99e8ad..4e2897b64078 100644 --- a/src/func.d +++ b/src/func.d @@ -2220,6 +2220,8 @@ public: if (!f.deco && ident != Id.xopEquals && ident != Id.xopCmp) { sc = sc.push(); + if (isCtorDeclaration()) // Bugzilla #15665 + sc.flags |= SCOPEctor; sc.stc = 0; sc.linkage = linkage; // Bugzilla 8496 type = f.semantic(loc, sc); diff --git a/test/runnable/sctor.d b/test/runnable/sctor.d index a4bc5532a105..d9367dc03646 100644 --- a/test/runnable/sctor.d +++ b/test/runnable/sctor.d @@ -336,6 +336,19 @@ void test14944() assert(tbl14944[0] == 1); } +/***************************************************/ +// 15665 + +scope class C15665 (V) +{ + this () {} +} + +void test15665() +{ + scope foo = new C15665!int; +} + /***************************************************/ int main() @@ -345,6 +358,7 @@ int main() test11246(); test13515(); test14944(); + test15665(); printf("Success\n"); return 0;