www.digitalmars.com         C & C++   DMDScript  

D - Missing line number with incorrect constructor call

import c.stdio;

class AP { }

class A {
 this( AP p ) { }
}

class B : A {
 AP foo;
 this( AP f ) {
//  super( f ); // error created by this line being missing thus it is an
implicit this()
  foo = f;
 }
}

int main( char[][] args ) {
 B b = new B();
 return 0;
}

// reported error
// constructor this (AP p) does not match argument types ()
//

---------------------
I do think the error is back to front (or is that just me?)
"<file> line <line> argument(s) `()` do not match with any constructor:
options ... (AP p) ... " would seem more logical. in this case a warning
that it is an implicit super call may also aid the person makeing the
mistake. (took me a while to track this one A due to the missing line no and
B 'cos even when I worked out it was a super() and not super( x ) I forgot
that implicit super() had been added [not complaining about that I like that
behaviour] )
Aug 13 2003