www.digitalmars.com         C & C++   DMDScript  

D - Bug: Overloading, overriding and out parameters.

reply Andy Friesen <andy ikagames.com> writes:
class A
{
     void foo(out int x)
     {
         x = -3;
     }

     void foo(out char c)
     {
         c = 13;
     }
}

class B : A
{
     override void foo(out int x)
     {
     }

     this()
     {
         char c;
         foo(c);
     }
}

A.foo(out char) isn't found in the B constructor.

The compiler errors out with the message 'cast(int)(c) is not an 
lvalue'.  It works fine if the out keyword isn't there.

  -- andy
Nov 08 2003
parent "Lars Ivar Igesund" <larsivi stud.ntnu.no> writes:
Look at Walter's answer to my message
"BUG?: opIndex in opApply" from the
6th of November. It probably isn't a bug, but
something to do with the reference nature of 'out'.

Lars Ivar Igesund

"Andy Friesen" <andy ikagames.com> wrote in message
news:bojt9e$b16$1 digitaldaemon.com...
 class A
 {
      void foo(out int x)
      {
          x = -3;
      }

      void foo(out char c)
      {
          c = 13;
      }
 }

 class B : A
 {
      override void foo(out int x)
      {
      }

      this()
      {
          char c;
          foo(c);
      }
 }

 A.foo(out char) isn't found in the B constructor.

 The compiler errors out with the message 'cast(int)(c) is not an
 lvalue'.  It works fine if the out keyword isn't there.

   -- andy
Nov 09 2003