Thread overview
[Issue 3679] New: template forward reference regression
Jan 06, 2010
Koroskin Denis
Jan 25, 2010
Don
Jan 25, 2010
Don
[Issue 3679] Regression(2.031) template forward reference regression
Jul 27, 2010
Trass3r
Aug 09, 2010
Walter Bright
January 06, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3679

           Summary: template forward reference regression
           Product: D
           Version: 2.032
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: 2korden@gmail.com


--- Comment #0 from Koroskin Denis <2korden@gmail.com> 2010-01-05 20:25:12 PST ---
Test case:

module test;

public class Derived : public Base
{
}

class Template(T)
{
}

alias Template!(bool) TemplateAlias;

class Base
{
    TemplateAlias templateAlias;
}

# dmd test.d
test.d(13): Error: forward reference to 'Template!(bool)'
test.d(13): Error: TemplateAlias is used as a type
test.d(13): Error: variable test.Base.templateAlias voids have no value

Regression since DMD2.031, blocker for me to upgrate to a newer compiler version.

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|2.032                       |1.047


--- Comment #1 from Don <clugdbug@yahoo.com.au> 2010-01-24 23:58:37 PST ---
This is also a D1 regression. It worked on 1.046, fails on 1.047 and later.

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



--- Comment #2 from Don <clugdbug@yahoo.com.au> 2010-01-25 02:07:38 PST ---
The regression was caused by adding a couple of lines to ClassDeclaration::semantic(Scope *sc) in class.c in D1.047. I think this was probably part of the fix for bug 3170.

Currently line 350 in the D1 source, commenting out the two lines marked '-' allows this test case to compile again. I think the bug lies elsewhere, however.

=========


        if (!tc->sym->symtab || tc->sym->scope || tc->sym->sizeok == 0)
        {
            //printf("%s: forward reference of base class %s\n", toChars(),
tc->sym->toChars());
            //error("forward reference of base class %s",
baseClass->toChars());
            // Forward reference of base class, try again later
            //printf("\ttry later, forward reference of base class %s\n",
tc->sym->toChars());
            scope = scx ? scx : new Scope(*sc);
            scope->setNoFree();
-            if (tc->sym->scope)
-                tc->sym->scope->module->addDeferredSemantic(tc->sym);
            scope->module->addDeferredSemantic(this);
            return;
        }

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


Trass3r <mrmocool@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mrmocool@gmx.de
         Depends on|                            |4503


--- Comment #3 from Trass3r <mrmocool@gmx.de> 2010-07-27 10:15:04 PDT ---
The patch for http://d.puremagic.com/issues/show_bug.cgi?id=4503 also seems to fix this one.

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


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> 2010-08-08 21:35:10 PDT ---
Fixed with 4503

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