www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - access control bug

reply "Andrew Fedoniouk" <news terrainformatica.com> writes:
three files:
/main.d
/test/test.d
/test/sub/subtest.d

---- main.d -----
import test.test;
import test.sub.subtest;

int main(char[][] args)
{
  return(test.sub.subtest.bar()) ;
}

----/test/test.d -----
module test.test;
import test.sub.subtest;

class Foo
{
  package int foo() { return 5; }
  static package int foos() { return 5; }
}

----/test/sub/subtest.d ------
module test.sub.subtest;
import test.test;

int bar()
{
  int i = Foo.foos(); // compiles fine
  Foo f = new Foo();
  int j = f.foo();      // BUG: DMD compiler reports an error: [1]
  return 4;
}
-----------------

[1] .\test\sub\subtest.d(9): class test.test.Foo member foo is not 
accessible

It is strange as both Foo.foos() and Foo.foo() are methods
of the same class. One is static and other is not.
Correlation of static attribute with access control attribute?
May 01 2005
next sibling parent Derek Parnell <derek psych.ward> writes:
On Sun, 1 May 2005 23:36:02 -0700, Andrew Fedoniouk wrote:

 three files:
 /main.d
 /test/test.d
 /test/sub/subtest.d
 
 ---- main.d -----
 import test.test;
 import test.sub.subtest;
 
 int main(char[][] args)
 {
   return(test.sub.subtest.bar()) ;
 }
 
 ----/test/test.d -----
 module test.test;
 import test.sub.subtest;
 
 class Foo
 {
   package int foo() { return 5; }
   static package int foos() { return 5; }
 }
 
 ----/test/sub/subtest.d ------
 module test.sub.subtest;
 import test.test;
 
 int bar()
 {
   int i = Foo.foos(); // compiles fine
   Foo f = new Foo();
   int j = f.foo();      // BUG: DMD compiler reports an error: [1]
   return 4;
 }
 -----------------
 
 [1] .\test\sub\subtest.d(9): class test.test.Foo member foo is not 
 accessible
 
 It is strange as both Foo.foos() and Foo.foo() are methods
 of the same class. One is static and other is not.
 Correlation of static attribute with access control attribute?
int i = Foo.foos(); // compiles fine int k = f.foos(); // Fails. "class test.test.Foo member foos is not accessible" -- Derek Melbourne, Australia 2/05/2005 4:52:27 PM
May 01 2005
prev sibling parent reply Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andrew Fedoniouk schrieb am Sun, 1 May 2005 23:36:02 -0700:
 three files:
 /main.d
 /test/test.d
 /test/sub/subtest.d

 ---- main.d -----
 import test.test;
 import test.sub.subtest;

 int main(char[][] args)
 {
   return(test.sub.subtest.bar()) ;
 }

 ----/test/test.d -----
 module test.test;
 import test.sub.subtest;

 class Foo
 {
   package int foo() { return 5; }
   static package int foos() { return 5; }
 }

 ----/test/sub/subtest.d ------
 module test.sub.subtest;
 import test.test;

 int bar()
 {
   int i = Foo.foos(); // compiles fine
   Foo f = new Foo();
   int j = f.foo();      // BUG: DMD compiler reports an error: [1]
   return 4;
 }
 -----------------

 [1] .\test\sub\subtest.d(9): class test.test.Foo member foo is not 
 accessible

 It is strange as both Foo.foos() and Foo.foo() are methods
 of the same class. One is static and other is not.
 Correlation of static attribute with access control attribute?
Known problem: http://dstress.kuehne.cn/nocompile/package_01.d http://dstress.kuehne.cn/nocompile/package_02.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCd81S3w+/yD4P9tIRAomuAJ9LVObpLB8x++yviP5WN+8KXM8f8gCgyGLO SvTOZ4Ll1tyM9xxeka51bEE= =U9Cd -----END PGP SIGNATURE-----
May 03 2005
parent "Andrew Fedoniouk" <news terrainformatica.com> writes:
Thanks, Thomas,
and sorry for increasing entropy.

Andrew.

"Thomas Kuehne" <thomas-dloop kuehne.thisisspam.cn> wrote in message 
news:i3vkk2-jm3.ln1 lnews.kuehne.cn...
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1

 Andrew Fedoniouk schrieb am Sun, 1 May 2005 23:36:02 -0700:
 three files:
 /main.d
 /test/test.d
 /test/sub/subtest.d

 ---- main.d -----
 import test.test;
 import test.sub.subtest;

 int main(char[][] args)
 {
   return(test.sub.subtest.bar()) ;
 }

 ----/test/test.d -----
 module test.test;
 import test.sub.subtest;

 class Foo
 {
   package int foo() { return 5; }
   static package int foos() { return 5; }
 }

 ----/test/sub/subtest.d ------
 module test.sub.subtest;
 import test.test;

 int bar()
 {
   int i = Foo.foos(); // compiles fine
   Foo f = new Foo();
   int j = f.foo();      // BUG: DMD compiler reports an error: [1]
   return 4;
 }
 -----------------

 [1] .\test\sub\subtest.d(9): class test.test.Foo member foo is not
 accessible

 It is strange as both Foo.foos() and Foo.foo() are methods
 of the same class. One is static and other is not.
 Correlation of static attribute with access control attribute?
Known problem: http://dstress.kuehne.cn/nocompile/package_01.d http://dstress.kuehne.cn/nocompile/package_02.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCd81S3w+/yD4P9tIRAomuAJ9LVObpLB8x++yviP5WN+8KXM8f8gCgyGLO SvTOZ4Ll1tyM9xxeka51bEE= =U9Cd -----END PGP SIGNATURE-----
May 03 2005