digitalmars.D.bugs - [Issue 10936] New: unittest in struct body makes crash dmd
- d-bugmail puremagic.com (62/62) Aug 31 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10936
- d-bugmail puremagic.com (6/6) Aug 31 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10936
- d-bugmail puremagic.com (26/26) Sep 01 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10936
- d-bugmail puremagic.com (21/21) Sep 01 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10936
http://d.puremagic.com/issues/show_bug.cgi?id=10936 Summary: unittest in struct body makes crash dmd Product: D Version: D2 Platform: x86_64 OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: code.viator gmail.com [code] struct vec( size_t N, string AS="" ) { float[N] data; this(E)( E[] ext... ) { data[0] = 0; } property auto opDispatch(string v)() const { mixin( "return vec!(v.length,v)( 0 );" ); } unittest { auto pos = vec!(3,"xyz")( 1, 2, 10 ); //auto pxx = pos.xy; //assert( is( typeof( pxy ) == vec!(2,"xy") ) ); assert( is( typeof( pos.xy ) == vec!(2,"xy") ) ); } } unittest { vec!(3,"xyz") a; } [/code] if unittest in struct body I have error: dmd: func.c:1299: virtual void FuncDeclaration::semantic3(Scope*): Assertion `type == f' failed. if uncomment 11,12 lines and comment I have error: dmd: struct.c:741: virtual void StructDeclaration::semantic(Scope*): Assertion `type->ty != Tstruct || ((TypeStruct *)type)->sym == this' failed. if unittest take away from a body I haven't dmd errors [code] struct vec( size_t N, string AS="" ) { float[N] data; this(E)( E[] ext... ) { data[0] = 0; } property auto opDispatch(string v)() const { mixin( "return vec!(v.length,v)( 0 );" ); } } unittest { vec!(3,"xyz") a; } unittest { auto pos = vec!(3,"xyz")( 1, 2, 10 ); auto pxx = pos.xy; assert( is( typeof( pxy ) == vec!(2,"xy") ) ); assert( is( typeof( pos.xy ) == vec!(2,"xy") ) ); } [/code] i use: $ dmd -unittest -main file.d system: $ uname -a x86_64 x86_64 GNU/Linux DMD64 D Compiler v2.063.2 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 31 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10936 I want say UNCOMMENT 11,12 lines -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 31 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10936 Henning Pohl <henning still-hidden.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |henning still-hidden.de PDT --- Reduced: ---- struct Vec(string s) { auto opDispatch(string v)() { return Vec!v.init; } void foo() { auto v = Vec!"".init; auto p = v.something; } } Vec!"" v; ---- Replace Vec!v.init with Vec!v() to second assertion instead. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 01 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10936 PDT --- This shows the errors which have been gagged: --- struct Vec(string s) { auto foo(string v)() { return Vec!(v)(); } static void bar() { Vec!"" v; auto p = v.foo!"sup"; } } Vec!"" v; --- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 01 2013