struct opCall error messages
    Rory Mcguire 
    rjmcguire at gm_no_ail.com
       
    Mon Jul 26 05:27:19 PDT 2010
    
    
  
Hi,
I'm not sure this is in bugzilla, I tried finding something mentioning it 
but coudn't.
Compiling the below code results in the dmd compiler printing:
struct_bad_error.d(8): Error: 'this' is only defined in non-static member 
functions, not inner
====================
struct S {
	S opCall() {S s; return s;}
}
void main() {
	S s;
	//s = S(); // decent error message: "struct_bad_error.d(6):
		// Error: need 'this' to access member opCall"
	void inner() {
		s = S();
	}
}
=====================
What to do? Also found that having an empty () after the struct name is not 
the best error message: "struct_bad_error.d(5): Error: struct 
struct_bad_error.S() is used as a type"
Surely it could tell me I need to put an Identifier in the ()
-Rory
    
    
More information about the Digitalmars-d-learn
mailing list