Skip to content

Commit

Permalink
fix Issue 22780 - [REG 2.090] variable reference to scope class must …
Browse files Browse the repository at this point in the history
…be scope
  • Loading branch information
ibuclaw committed Feb 16, 2022
1 parent 2cf49c9 commit 68553d1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/dmd/dsymbolsem.d
Expand Up @@ -832,10 +832,9 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
}

// @@@DEPRECATED@@@ https://dlang.org/deprecate.html#scope%20as%20a%20type%20constraint
// Deprecated in 2.087
// Remove this when the feature is removed from the language
if (0 && // deprecation disabled for now to accommodate existing extensive use
!(dsym.storage_class & STC.scope_))
// Scope as a type constraint will soon be deprecated.
// Remove this when the feature is removed from the language.
if (!(dsym.storage_class & STC.scope_))
{
if (!(dsym.storage_class & STC.parameter) && dsym.ident != Id.withSym)
dsym.error("reference to `scope class` must be `scope`");
Expand Down
12 changes: 12 additions & 0 deletions test/fail_compilation/fail22780.d
@@ -0,0 +1,12 @@
// https://issues.dlang.org/show_bug.cgi?id=22780
/* TEST_OUTPUT:
---
fail_compilation/fail22780.d(11): Error: variable `fail22780.test10717.c` reference to `scope class` must be `scope`
---
*/
scope class C10717 { }

void test10717()
{
C10717 c;
}

0 comments on commit 68553d1

Please sign in to comment.