[nem-bug] [Nemerle 0000664]: Usage of 'this' reference should be
controlled before call to base ctor
feedback at nemerle.org
feedback at nemerle.org
Fri Oct 6 18:38:55 CEST 2006
A NOTE has been added to this issue.
======================================================================
<http://nemerle.org/bugs/view.php?id=664>
======================================================================
Reported By: nazgul
Assigned To:
======================================================================
Project: Nemerle
Issue ID: 664
Category: Compiler
Reproducibility: always
Severity: minor
Priority: normal
Status: new
======================================================================
Date Submitted: 05-07-2006 13:53 CEST
Last Modified: 10-06-2006 18:38 CEST
======================================================================
Summary: Usage of 'this' reference should be controlled
before call to base ctor
Description:
class Base {
public this (_ : Base) {
}
}
class Inh : Base {
public this () {
base (this)
}
}
()
causes verification error:
[IL]: Error: [C:\cygwin\home\nazgul\nemerle\ncc\testsuite\out.exe :
Inh::.ctor][offset 0x00000002][found <uninitialized> ref ('this' ptr)
'Inh'][expected ref 'Base'] Unexpected type on the stack.
======================================================================
----------------------------------------------------------------------
akhropov - 10-06-06 18:38
----------------------------------------------------------------------
I believe it should also be prohibited to access base and its members
before its constructor is called because logically speaking base object
doesn't exist before its constructor is called.
However, the following code compiles just fine at the moment:
class A
{
internal x : int;
public this( x : int = 10 )
{
this.x = x;
}
}
class B : A
{
public this()
{
System.Console.WriteLine($"base.x = $(base.x)");
base( 1 );
}
}
def b = B();
System.Console.WriteLine(b);
Issue History
Date Modified Username Field Change
======================================================================
05-07-06 13:53 nazgul New Issue
10-06-06 18:38 akhropov Note Added: 0001468
======================================================================
More information about the bugs
mailing list