From: Iain Buclaw Date: Sun, 11 Oct 2020 20:20:43 +0000 (+0200) Subject: d: Merge upstream dmd 70aabfb51 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=893f9543bff19aa3be07fff05bf1abf6a0b8dd56;p=gcc.git d: Merge upstream dmd 70aabfb51 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 --- diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE index 8a59cbde78e..5f6193f76b7 100644 --- a/gcc/d/dmd/MERGE +++ b/gcc/d/dmd/MERGE @@ -1,4 +1,4 @@ -3a979052509fff8170ba80e48817377a60e78eb3 +70aabfb511d55f2bfbdccbac7868519d9d4b63da The first line of this file holds the git revision number of the last merge done from the dlang/dmd repository. diff --git a/gcc/d/dmd/declaration.c b/gcc/d/dmd/declaration.c index 08b295070b2..f490cc5a413 100644 --- a/gcc/d/dmd/declaration.c +++ b/gcc/d/dmd/declaration.c @@ -340,6 +340,13 @@ void AliasDeclaration::semantic(Scope *sc) 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; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail21001.d b/gcc/testsuite/gdc.test/fail_compilation/fail21001.d new file mode 100644 index 00000000000..0faeb4038ef --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fail21001.d @@ -0,0 +1,12 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail21001.d(12): Error: undefined identifier `Alias` +--- +*/ + +module fail21001; + +import imports.fail21001b; + +void main() { Alias var; } diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/fail21001b.d b/gcc/testsuite/gdc.test/fail_compilation/imports/fail21001b.d new file mode 100644 index 00000000000..69c1c20a356 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/imports/fail21001b.d @@ -0,0 +1,5 @@ +module imports.fail21001b; + +private struct S { Alias member; } + +private alias Alias = int; diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/issue21295ast_node.d b/gcc/testsuite/gdc.test/fail_compilation/imports/issue21295ast_node.d new file mode 100644 index 00000000000..d9298bf972d --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/imports/issue21295ast_node.d @@ -0,0 +1,5 @@ +module imports.issue21295ast_node; +import imports.issue21295visitor : Visitor; +class ASTNode { + void accept(Visitor); +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/issue21295astcodegen.d b/gcc/testsuite/gdc.test/fail_compilation/imports/issue21295astcodegen.d new file mode 100644 index 00000000000..5eccf6ac028 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/imports/issue21295astcodegen.d @@ -0,0 +1,4 @@ +module imports.issue21295astcodegen; +struct ASTCodegen { + import imports.issue21295dtemplate; +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/issue21295dtemplate.d b/gcc/testsuite/gdc.test/fail_compilation/imports/issue21295dtemplate.d new file mode 100644 index 00000000000..8864f9ea27e --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/imports/issue21295dtemplate.d @@ -0,0 +1,3 @@ +module imports.issue21295dtemplate; +import imports.issue21295ast_node; +class TemplateParameter : ASTNode { } diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/issue21295visitor.d b/gcc/testsuite/gdc.test/fail_compilation/imports/issue21295visitor.d new file mode 100644 index 00000000000..3665a7fe8c2 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/imports/issue21295visitor.d @@ -0,0 +1,3 @@ +module imports.issue21295visitor; +import imports.issue21295astcodegen; +class Visitor { } diff --git a/gcc/testsuite/gdc.test/fail_compilation/issue21295.d b/gcc/testsuite/gdc.test/fail_compilation/issue21295.d new file mode 100644 index 00000000000..9916e9ba2a7 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/issue21295.d @@ -0,0 +1,9 @@ +/* +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;