Bug 17950 – cannot declare package internal symbol in package module
Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-10-29T15:02:26Z
Last change time
2022-09-29T13:57:38Z
Assigned to
No Owner
Creator
Martin Nowak
Comments
Comment #0 by code — 2017-10-29T15:02:26Z
mkdir -p pkg
cat > pkg/package.d << CODE
module pkg;
package(pkg) int sym;
CODE
dmd -c -o- pkg/package.d
----
pkg/package.d(2): Error: protection attribute 'package(pkg)' does not bind to one of ancestor packages of module pkg
----
The ancestor test should be made aware of package modules.
We could consider to change the default meaning of `package` (w/o qualified name) in a package module, to mean exactly the current package, but could also keep the current implementation to mean the ancestor package and only allow to use the current package with a qualified name.
Comment #1 by code — 2017-10-29T15:04:07Z
The latter question was already solved in issue 10421, so it's really only a question of allowing the qualified package name.
Comment #2 by dkorpel — 2022-09-29T13:57:38Z
*** This issue has been marked as a duplicate of issue 20796 ***