www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Method overloading bug

reply "dickl" <dick221z yahoo.com> writes:
The compiler complains that the method (void test(bool i) )  is not
accessable even though it is supposed to be public:
M:\dmd>dmd test.d testclass.d
test.d(7): class TestClass member test is not accessible

file1: testclass.d
module testclass;

class TestClass
{
private:
     bool k=false;
     bool test(){return k;}
public:
     this(){}
     void test(bool b){k=b;}
}
-----------------------
file2: test.d
private import testclass;

int main()
{
     TestClass K=new TestClass

     K.test(true);        //<== method should be accessable !
     return 0;
}
Jun 09 2004
parent reply Ant <Ant_member pathlink.com> writes:
In article <ca7oiv$eeo$1 digitaldaemon.com>, dickl says...
The compiler complains that the method (void test(bool i) )  is not
accessable even though it is supposed to be public:
M:\dmd>dmd test.d testclass.d
test.d(7): class TestClass member test is not accessible
look at mine also: http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.bugs/420 looks like the overloading match is a mess. this might not be a new bug. Ant
Jun 09 2004
parent Stewart Gordon <smjg_1998 yahoo.com> writes:
Ant wrote:

<snip>
 look at mine also:
 http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.bugs/420
 
 looks like the overloading match is a mess.
 this might not be a new bug.
Yes, there seems to be a root cause to the lot: DMD is attaching attributes to names instead of individual members, and so the attributes of the first one are the attributes of the lot. A while back I reported it among various problems with deprecation: http://www.digitalmars.com/drn-bin/wwwnews?D/26128 Stewart. -- My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment. Please keep replies on the 'group where everyone may benefit.
Jun 14 2004