Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Changeset 784

Show
Ignore:
Timestamp:
12/06/10 06:59:57 (14 years ago)
Author:
walter
Message:

bugzilla 3276 Recursion broken by alias template parameter

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/dmd-1.x/src/template.c

    r768 r784  
    38163816            if (s) 
    38173817                error("template '%s' is not defined, did you mean %s?", id->toChars(), s->toChars()); 
    38183818            else 
    38193819                error("template '%s' is not defined", id->toChars()); 
    38203820            return NULL; 
    38213821        } 
    38223822#if LOG 
    38233823        printf("It's an instance of '%s' kind '%s'\n", s->toChars(), s->kind()); 
    38243824        if (s->parent) 
    38253825            printf("s->parent = '%s'\n", s->parent->toChars()); 
    38263826#endif 
    38273827        withsym = scopesym->isWithScopeSymbol(); 
    38283828 
    38293829        /* We might have found an alias within a template when 
    38303830         * we really want the template. 
    38313831         */ 
    38323832        TemplateInstance *ti; 
    38333833        if (s->parent && 
    38343834            (ti = s->parent->isTemplateInstance()) != NULL) 
    38353835        { 
    3836             if ( 
    3837                 (ti->name == id || 
    3838                  ti->toAlias()->ident == id) 
    3839                 && 
    3840                 ti->tempdecl) 
     3836            if (ti->tempdecl && ti->tempdecl->ident == id) 
    38413837            { 
    38423838                /* This is so that one can refer to the enclosing 
    38433839                 * template, even if it has the same name as a member 
    38443840                 * of the template, if it has a !(arguments) 
    38453841                 */ 
    38463842                tempdecl = ti->tempdecl; 
    38473843                if (tempdecl->overroot)         // if not start of overloaded list of TemplateDeclaration's 
    38483844                    tempdecl = tempdecl->overroot; // then get the start 
    38493845                s = tempdecl; 
    38503846            } 
    38513847        } 
    38523848 
    38533849        s = s->toAlias(); 
    38543850 
    38553851        /* It should be a TemplateDeclaration, not some other symbol 
    38563852         */ 
    38573853        tempdecl = s->isTemplateDeclaration(); 
    38583854        if (!tempdecl) 
    38593855        { 
    38603856            if (!s->parent && global.errors) 
  • trunk/src/template.c

    r768 r784  
    42914291            if (!s) 
    42924292            {   error("template '%s' is not defined", id->toChars()); 
    42934293                return NULL; 
    42944294            } 
    42954295        } 
    42964296 
    42974297#if LOG 
    42984298        printf("It's an instance of '%s' kind '%s'\n", s->toChars(), s->kind()); 
    42994299        if (s->parent) 
    43004300            printf("s->parent = '%s'\n", s->parent->toChars()); 
    43014301#endif 
    43024302        withsym = scopesym->isWithScopeSymbol(); 
    43034303 
    43044304        /* We might have found an alias within a template when 
    43054305         * we really want the template. 
    43064306         */ 
    43074307        TemplateInstance *ti; 
    43084308        if (s->parent && 
    43094309            (ti = s->parent->isTemplateInstance()) != NULL) 
    43104310        { 
    4311             if ( 
    4312                 (ti->name == id || 
    4313                  ti->toAlias()->ident == id) 
    4314                 && 
    4315                 ti->tempdecl) 
     4311            if (ti->tempdecl && ti->tempdecl->ident == id) 
    43164312            { 
    43174313                /* This is so that one can refer to the enclosing 
    43184314                 * template, even if it has the same name as a member 
    43194315                 * of the template, if it has a !(arguments) 
    43204316                 */ 
    43214317                tempdecl = ti->tempdecl; 
    43224318                if (tempdecl->overroot)         // if not start of overloaded list of TemplateDeclaration's 
    43234319                    tempdecl = tempdecl->overroot; // then get the start 
    43244320                s = tempdecl; 
    43254321            } 
    43264322        } 
    43274323 
    43284324        s = s->toAlias(); 
    43294325 
    43304326        /* It should be a TemplateDeclaration, not some other symbol 
    43314327         */ 
    43324328        tempdecl = s->isTemplateDeclaration(); 
    43334329        if (!tempdecl) 
    43344330        { 
    43354331            if (!s->parent && global.errors)