digitalmars.D.bugs - [Issue 11169] New: cannot create instance of abstract class
- d-bugmail puremagic.com (76/76) Oct 03 2013 http://d.puremagic.com/issues/show_bug.cgi?id=11169
- d-bugmail puremagic.com (15/15) Oct 03 2013 http://d.puremagic.com/issues/show_bug.cgi?id=11169
- d-bugmail puremagic.com (7/17) Oct 03 2013 http://d.puremagic.com/issues/show_bug.cgi?id=11169
- d-bugmail puremagic.com (16/20) Oct 04 2013 http://d.puremagic.com/issues/show_bug.cgi?id=11169
http://d.puremagic.com/issues/show_bug.cgi?id=11169 Summary: cannot create instance of abstract class Product: D Version: D2 Platform: x86_64 OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: pycerl qq.com //////////////////////////////////////////////////////////// //case 1 class A { abstract void foo(); } class B : A { static if( __traits(isAbstractClass, typeof(this) )) { } override void foo() { } } void main() { B b = new B(); } //Error: cannot create instance of abstract class B //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// //case 2 abstract class A { void foo(); } class B : A { static if( __traits(isAbstractClass, typeof(this) )) { } override void foo() { } } void main() { B b = new B(); } //Okay //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// //case 3 class A { abstract void foo(); } class B : A { override void foo() { } } void main() { B b = new B(); } //Okay //////////////////////////////////////////////////////////// -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 03 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11169 Ali Cehreli <acehreli yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |acehreli yahoo.com If others agree, please change the summary to something like __traits(isAbstractClass) uses the definition that it knows so far, not the whole definition of the class In any case, it would be a chicken and egg problem if static if tried to complete the definition of the class. Ali -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 03 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11169If others agree, please change the summary to something like __traits(isAbstractClass) uses the definition that it knows so far, not the whole definition of the class In any case, it would be a chicken and egg problem if static if tried to complete the definition of the class. AliHow about follow the rules of checking recursive alias? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 03 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11169 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrej.mitrovich gmail.com 04:32:31 PDT ---If others agree, please change the summary to something like __traits(isAbstractClass) uses the definition that it knows so far, not the whole definition of the classInternal note: The issue is that __traits(isAbstractClass) has side-effects. It will call `ClassDeclaration::isAbstract`, but this will not only return the result but also set the internal `isabstract` field for the class (damn getter functions with side-effects..). I guess semantic() wasn't called on the class at that point. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 04 2013