digitalmars.D.bugs - [Issue 2171] New: bizzare toCBuffer result when emit error message for bad source code
- d-bugmail puremagic.com (53/53) Jun 25 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2171
- d-bugmail puremagic.com (47/47) Sep 27 2012 http://d.puremagic.com/issues/show_bug.cgi?id=2171
http://d.puremagic.com/issues/show_bug.cgi?id=2171 Summary: bizzare toCBuffer result when emit error message for bad source code Product: D Version: 1.030 Platform: PC OS/Version: Windows Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: davidl 126.com // $HeadURL: svn://svn.berlios.de/dstress/trunk/run/t/this_13_C.d $ // $Date: 2007-01-01 03:59:08 +0800 (Mon, 01 Jan 2007) $ // $Author: thomask $ // author Frank Benoit <benoit tionex.de> // date 2006-10-09 // uri http://d.puremagic.com/issues/show_bug.cgi?id=419 // desc [Issue 419] New: Anonymous classes are not working. module dstress.run.t.this_13_C; interface I { void get( char[] s ); } class C{ void init(){ I i = new class(){ void get( char[] s ){ func(); } }; } void func( ){ } } int main(){ C c = new C(); c.init(); return 0; } compile result with: bug.d(18): Error: cannot implicitly convert expression ((class __anonclass1 : Object { void get(char[] s) { assert(this,"null this"); // this line is quite unreadable this.this.func(); // also this.this.func is dummy } C this; } ) , new __anonclass1) of type dstress.run.t.this_13_C.C.init.__anonclass1 to dstress.run.t.this_13_C.I --
Jun 25 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2171 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|D1 |D1 & D2 Summary|bizzare toCBuffer result |errors involving anonymous |when emit error message for |class literals expose |bad source code |compiler internals Original title: bizzare toCBuffer result when emit error message for bad source code Applies to both D1 and D2. Reduced test case: void f() { int k = new class(){}; } ----- bug.d(3): Error: cannot implicitly convert expression (class __anonclass1 : Object { void* this; } , new __anonclass1) of type bug.f.__anonclass1 to int ----- Another example, not involving an error: void f() { pragma(msg, (new class(){ void get(char[] s){} }).stringof); } which prints invalid D code: ---------------------------------- class __anonclass1 : Object { void get(char[] s) { assert(this,"null this"); } void* this; } , new __anonclass1 ---------------------------------- When printing the expression I don't think it should be printing the class contents. Would be enough to display: bug.d(3): Error: cannot implicitly convert expression `new __anonclass1` of type bug.f.__anonclass1 to int -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 27 2012