Thread overview
[Issue 1251] New: Final template class w/ constructor and invariant causes compile error
May 31, 2007
d-bugmail
Aug 25, 2007
d-bugmail
Feb 25, 2008
d-bugmail
Mar 10, 2008
d-bugmail
Jan 28, 2012
yebblies
May 31, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1251

           Summary: Final template class w/ constructor and invariant causes
                    compile error
           Product: D
           Version: 1.014
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: minor
          Priority: P3
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: dhaffey@gmail.com


The following code:
final class Foo()
{
    this() {}
    invariant {}
}
alias Foo!() Bar;

Provokes this error message:
Error: cannot modify final variable '__result'

It compiles without issue if I remove the final attribute, the constructor, the invariant, make Foo a non-template class, or use the full template syntax instead of the class template shortcut.


-- 

August 25, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1251





------- Comment #1 from thomas-dloop@kuehne.cn  2007-08-25 16:41 -------
Added to DStress as http://dstress.kuehne.cn/run/f/final_13_A.d http://dstress.kuehne.cn/run/f/final_13_B.d http://dstress.kuehne.cn/run/f/final_13_C.d http://dstress.kuehne.cn/run/f/final_13_D.d


-- 

February 25, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1251





------- Comment #2 from someanon@yahoo.com  2008-02-24 23:53 -------
I also hit this problem with v2.011 (with const).

.... __result cannot modify const

We should fix this.


-- 

March 10, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1251


someanon@yahoo.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |someanon@yahoo.com
           Severity|minor                       |normal
           Priority|P3                          |P2
            Version|1.014                       |2.012




------- Comment #3 from someanon@yahoo.com  2008-03-10 16:31 -------
I hit this bug again, so I raise the priority.

I spent hours debugging a problem which should have been caught by an invariant vilation, but it's commentted out because of this bug.

Class invariant is a hallmark of DbC, we should fix this asap.


-- 

January 28, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=1251


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies@gmail.com
           Platform|x86                         |All
         Resolution|                            |WORKSFORME
         OS/Version|Linux                       |All


--- Comment #4 from yebblies <yebblies@gmail.com> 2012-01-28 16:46:09 EST ---
I can't get this to fail.  It's most likely been fixed sometime in the last four years.  Probably in the fixes for similar problems with out contracts.

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