Fixes a symbol resolver bug where a private alias becomes public if used
before its declaration.
Reviewed-on: https://github.com/dlang/dmd/pull/11831
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd
70aabfb51
-3a979052509fff8170ba80e48817377a60e78eb3
+70aabfb511d55f2bfbdccbac7868519d9d4b63da
The first line of this file holds the git revision number of the last
merge done from the dlang/dmd repository.
void AliasDeclaration::aliasSemantic(Scope *sc)
{
//printf("AliasDeclaration::semantic() %s\n", toChars());
+
+ // as AliasDeclaration::semantic, in case we're called first.
+ // see https://issues.dlang.org/show_bug.cgi?id=21001
+ storage_class |= sc->stc & STCdeprecated;
+ protection = sc->protection;
+ userAttribDecl = sc->userAttribDecl;
+
// TypeTraits needs to know if it's located in an AliasDeclaration
sc->flags |= SCOPEalias;
--- /dev/null
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail21001.d(12): Error: undefined identifier `Alias`
+---
+*/
+
+module fail21001;
+
+import imports.fail21001b;
+
+void main() { Alias var; }
--- /dev/null
+module imports.fail21001b;
+
+private struct S { Alias member; }
+
+private alias Alias = int;
--- /dev/null
+module imports.issue21295ast_node;
+import imports.issue21295visitor : Visitor;
+class ASTNode {
+ void accept(Visitor);
+}
--- /dev/null
+module imports.issue21295astcodegen;
+struct ASTCodegen {
+ import imports.issue21295dtemplate;
+}
--- /dev/null
+module imports.issue21295dtemplate;
+import imports.issue21295ast_node;
+class TemplateParameter : ASTNode { }
--- /dev/null
+module imports.issue21295visitor;
+import imports.issue21295astcodegen;
+class Visitor { }
--- /dev/null
+/*
+REQUIRED_ARGS: -de
+TEST_OUTPUT:
+---
+fail_compilation/issue21295.d(9): Deprecation: imports.issue21295ast_node.Visitor is not visible from module issue21295
+---
+*/
+import imports.issue21295ast_node;
+Visitor should_fail;