[Issue 206] attributes private, package, etc appear to be ignored
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Jun 18 17:45:57 PDT 2006
http://d.puremagic.com/issues/show_bug.cgi?id=206
------- Comment #1 from ddparnell at bigpond.com 2006-06-18 19:45 -------
The original bug report uses the word 'visibility' when in fact 'accessibility'
was meant.
Here is a code example that compiles okay but it should not...
//----- file qwerty.d ----------
module qwerty;
private void foo() {}
// ---EOF---
//----- file mod.d -------------
module mod;
private import qwerty;
private void bar(){}
// ---EOF---
//----- file test.d -------------
import mod;
void main()
{
mod.bar(); // 'bar' is supposed to be private to mod.
qwerty.foo(); // 'qwerty' is supposed to be private to mod.
// 'foo' is supposed to be private to qwerty.
}
// ---EOF---
Compile this with ...
dmd test.d mod.d qwerty.d
If you change the test.d file to remove the module qualifiers, it fails to
compile, which is correct.
//----- file test2.d -------------
import mod;
void main()
{
bar();
foo();
}
// ---EOF---
Now when compiled we get ....
test2.d: module test2 mod.bar is private
test2.d(5): undefined identifier foo
test2.d(5): function expected before (), not foo of type int
--
More information about the Digitalmars-d-bugs
mailing list