www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 642] New: error: mixin "static this" into where it cannot be

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=642

           Summary: error: mixin "static this" into where it cannot be
           Product: D
           Version: 0.176
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: kinaba is.s.u-tokyo.ac.jp


// credit goes to http://f17.aaa.livedoor.jp/~labamba/?BugTrack%2F27
template Foo()
{
  static this(){}
}

void main()
{
  mixin Foo;
}
----------------
Assertion failure: 'ad' on line 877 in file 'func.c'

abnormal program termination


-- 
Dec 04 2006
next sibling parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

d-bugmail puremagic.com schrieb am 2006-12-04:
 http://d.puremagic.com/issues/show_bug.cgi?id=642

 // credit goes to http://f17.aaa.livedoor.jp/~labamba/?BugTrack%2F27
 template Foo()
 {
   static this(){}
 }

 void main()
 {
   mixin Foo;
 }
 ----------------
 Assertion failure: 'ad' on line 877 in file 'func.c'

 abnormal program termination

Added to DStress as http://dstress.kuehne.cn/nocompile/t/this_14_A.d http://dstress.kuehne.cn/nocompile/t/this_14_B.d http://dstress.kuehne.cn/nocompile/t/this_14_C.d http://dstress.kuehne.cn/nocompile/t/this_14_D.d http://dstress.kuehne.cn/nocompile/t/this_14_E.d http://dstress.kuehne.cn/nocompile/t/this_14_F.d http://dstress.kuehne.cn/nocompile/t/this_14_G.d http://dstress.kuehne.cn/nocompile/t/this_14_H.d http://dstress.kuehne.cn/nocompile/t/this_14_I.d http://dstress.kuehne.cn/nocompile/t/this_14_J.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFd//uLK5blCcjpWoRAvZCAKCTGJoNDgTVbtzDoOqWe2tGCkOpwACeJ8X9 AlznwJrxg03qHRyLa7S6foc= =kFUs -----END PGP SIGNATURE-----
Dec 07 2006
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=642





------- Comment #2 from kamm-removethis incasoftware.de  2008-07-12 02:33
-------
In LLVMDC we fixed this_14_G/H by making the "constructors/destructors are only
for class definitions" error fatal. Otherwise you get a segfault around func.c
line 908 trying to access the InvariantDeclaration of the AggregateDeclatation*
ad that is zero.


-- 
Jul 12 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=642





------- Comment #3 from unknown simplemachines.org  2009-03-30 00:28 -------
Created an attachment (id=305)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=305&action=view)
Verify isThis() in addPostInvariant() and addPreInvariant().

This patch fixes G/H while handling errors normally.  All of the other
is*Invariant() methods check for ad, but static contructors and desctrutors
assume it's there, seemingly.

-[Unknown]


-- 
Mar 29 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=642





------- Comment #4 from unknown simplemachines.org  2009-03-30 00:31 -------
Created an attachment (id=306)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=306&action=view)
Validate that a static destructor has a parent.

This fixes this_14_I.  It just adds a clause, similar to the one for static
constructors, for static destructors.  This throws a very similar error and
doesn't crash.

-[Unknown]


-- 
Mar 29 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=642


clugdbug yahoo.com.au changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |regan netmail.co.nz




------- Comment #5 from clugdbug yahoo.com.au  2009-04-20 04:09 -------
*** Bug 1533 has been marked as a duplicate of this bug. ***


-- 
Apr 20 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=642


clugdbug yahoo.com.au changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic




------- Comment #6 from clugdbug yahoo.com.au  2009-04-20 04:15 -------
Another example of 14G/14H, from bug 1533. [Unknown]'s patch fixes this, but
does result in one of the error messages having no line number.
---
template T(){
   this(int i){}  // causes 14G segfault
  ~this() {}     // causes 14H segfault
}

struct C{
   void foo(){
        bar();
        this.t(7);
   }
   mixin T!() t;
}


-- 
Apr 20 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=642


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug yahoo.com.au
         Resolution|                            |FIXED




--- Comment #7 from Don <clugdbug yahoo.com.au>  2009-05-14 04:54:41 PDT ---
Fixed DMD2.030 and 1.045.
The segfault bug in 14G and 14H is fixed, as are all of the ICE bugs. 14G has
one error without line number ("Error: 'this' is only defined in non-static
member functions, not this") but since it comes after errors with line numbers,
it's trivial.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 14 2009