Thread overview
[Issue 5145] New: override error with forward ref of superclass
Oct 31, 2010
Fawzi Mohamed
Oct 31, 2010
Fawzi Mohamed
[Issue 5145] Regression(2.050, 1.065) override error with forward ref of superclass
Nov 01, 2010
Don
Nov 01, 2010
Don
Nov 22, 2010
Don
Dec 05, 2010
Walter Bright
Dec 06, 2010
Walter Bright
October 31, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5145

           Summary: override error with forward ref of superclass
           Product: D
           Version: D1
          Platform: x86
        OS/Version: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: fawzi@gmx.ch


--- Comment #0 from Fawzi Mohamed <fawzi@gmx.ch> 2010-10-31 12:46:39 PDT ---
The following code fails with
{{{
t.d(24): Error: variable t.B.sync.this override cannot be applied to variable
t.d(25): Error: function t.B.sync.__require override only applies to class
member functions
}}}
then class B is declared after class A
{{{
module t;

interface I1{
    void bla();
}

interface I2
{
    I1 sync ();
}

class A : B
{
    final override I1 sync()
    in { assert( valid ); }
    body
    {
        return null;
    }
}

class B : I2
{
    override I1 sync()
    in { assert( valid ); }
    body
    {
        return null;
    }

    final bool valid()
    {
        return true;
    }
}
}}}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 31, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5145


Fawzi Mohamed <fawzi@gmx.ch> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |regression


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 01, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5145


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch, rejects-valid
                 CC|                            |clugdbug@yahoo.com.au
            Version|D1                          |D1 & D2
            Summary|override error with forward |Regression(2.050, 1.065)
                   |ref of superclass           |override error with forward
                   |                            |ref of superclass
         OS/Version|Mac OS X                    |All


--- Comment #1 from Don <clugdbug@yahoo.com.au> 2010-11-01 01:01:43 PDT ---
Applies to both D1 and D2.

This was caused by svn683, which fixed bug 3602 "ICE(tocsym.c) compiling a class, if its super class has preconditions"

And the problem is that it's using the scope from the parent function, which isn't quite right: some of the attributes should be dropped. I don't know if anything other than STCoverride can cause problems.


func.c, FuncDeclaration::mergeFrequire, line 1688.

        FuncDeclaration *fdv = (FuncDeclaration *)foverrides.data[i];

        /* The semantic pass on the contracts of the overridden functions must
         * be completed before code generation occurs (bug 3602).
         */
        if (fdv->fdrequire && fdv->fdrequire->semanticRun != PASSsemantic3done)
        {
            assert(fdv->scope);
+            StorageClass oldstc = fdv->scope->stc;
+            fdv->scope->stc &= ~ STCoverride;
            fdv->semantic3(fdv->scope);
+            fdv->scope->stc = fdv->scope->stc;
        }

        sf = fdv->mergeFrequire(sf);
        if (fdv->fdrequire)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 01, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5145



--- Comment #2 from Don <clugdbug@yahoo.com.au> 2010-11-01 01:51:34 PDT ---
This seems very similar to bug 5110, which is more general. Need to check if the patch for 5110 fixes this bug as well.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 22, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5145


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |baryluk@smp.if.uj.edu.pl


--- Comment #3 from Don <clugdbug@yahoo.com.au> 2010-11-22 07:01:01 PST ---
*** Issue 5253 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 05, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5145


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com


--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> 2010-12-05 12:58:27 PST ---
(In reply to comment #2)
> This seems very similar to bug 5110, which is more general. Need to check if the patch for 5110 fixes this bug as well.

Nope, different problem.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 06, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5145


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


--- Comment #5 from Walter Bright <bugzilla@digitalmars.com> 2010-12-05 16:31:14 PST ---
http://www.dsource.org/projects/dmd/changeset/782

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