www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1251] New: Final template class w/ constructor and invariant causes compile error

reply d-bugmail puremagic.com writes:
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.


-- 
May 30 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1251






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


-- 
Aug 25 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1251






I also hit this problem with v2.011 (with const).

.... __result cannot modify const

We should fix this.


-- 
Feb 24 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
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





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.


-- 
Mar 10 2008
prev sibling parent d-bugmail puremagic.com writes:
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



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: -------
Jan 27 2012