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

Changeset 777

Show
Ignore:
Timestamp:
12/05/10 05:23:42 (14 years ago)
Author:
walter
Message:

bugzilla 2206 unnamed template mixin of class inside function or class has incorrect classinfo and mangleof

Files:

Legend:

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

    r428 r777  
    205205        parent = NULL; 
    206206 
    207207    char *id = Dsymbol::mangle(); 
    208208    parent = parentsave; 
    209209    return id; 
    210210} 
    211211 
    212212 
    213213char *TemplateInstance::mangle() 
    214214{ 
    215215    OutBuffer buf; 
    216216    char *id; 
    217217 
    218218#if 0 
    219219    printf("TemplateInstance::mangle() %s", toChars()); 
    220220    if (parent) 
    221221        printf("  parent = %s %s", parent->kind(), parent->toChars()); 
    222222    printf("\n"); 
    223223#endif 
    224224    id = ident ? ident->toChars() : toChars(); 
     225    Dsymbol *par = isnested || isTemplateMixin() ? parent : tempdecl->parent; 
    225226    if (!tempdecl) 
    226227        error("is not defined"); 
    227     else if (tempdecl->parent
    228     { 
    229         char *p = tempdecl->parent->mangle(); 
     228    else if (par
     229    { 
     230        char *p = par->mangle(); 
    230231        if (p[0] == '_' && p[1] == 'D') 
    231232            p += 2; 
    232233        buf.writestring(p); 
    233234    } 
    234235    buf.printf("%zu%s", strlen(id), id); 
    235236    id = buf.toChars(); 
    236237    buf.data = NULL; 
    237238    //printf("TemplateInstance::mangle() %s = %s\n", toChars(), id); 
    238239    return id; 
    239240} 
    240241 
    241242 
    242243 
    243244char *Dsymbol::mangle() 
    244245{ 
    245246    OutBuffer buf; 
    246247    char *id; 
    247248 
    248249#if 0 
    249250    printf("Dsymbol::mangle() '%s'", toChars()); 
  • trunk/src/mangle.c

    r428 r777  
    199199        ident == Id::TypeInfo_Tuple || 
    200200        this == object     || 
    201201        this == classinfo  || 
    202202        this == Module::moduleinfo || 
    203203        memcmp(ident->toChars(), "TypeInfo_", 9) == 0 
    204204       ) 
    205205        parent = NULL; 
    206206 
    207207    char *id = Dsymbol::mangle(); 
    208208    parent = parentsave; 
    209209    return id; 
    210210} 
    211211 
    212212 
    213213char *TemplateInstance::mangle() 
    214214{ 
    215215    OutBuffer buf; 
    216216    char *id; 
    217217 
    218218#if 0 
    219     printf("TemplateInstance::mangle() %s", toChars()); 
     219    printf("TemplateInstance::mangle() %p %s", this, toChars()); 
    220220    if (parent) 
    221221        printf("  parent = %s %s", parent->kind(), parent->toChars()); 
    222222    printf("\n"); 
    223223#endif 
    224224    id = ident ? ident->toChars() : toChars(); 
     225    Dsymbol *par = isnested || isTemplateMixin() ? parent : tempdecl->parent; 
    225226    if (!tempdecl) 
    226227        error("is not defined"); 
    227     else if (tempdecl->parent
    228     { 
    229         char *p = tempdecl->parent->mangle(); 
     228    else if (par
     229    { 
     230        char *p = par->mangle(); 
    230231        if (p[0] == '_' && p[1] == 'D') 
    231232            p += 2; 
    232233        buf.writestring(p); 
    233234    } 
    234235    buf.printf("%zu%s", strlen(id), id); 
    235236    id = buf.toChars(); 
    236237    buf.data = NULL; 
    237238    //printf("TemplateInstance::mangle() %s = %s\n", toChars(), id); 
    238239    return id; 
    239240} 
    240241 
    241242 
    242243 
    243244char *Dsymbol::mangle() 
    244245{ 
    245246    OutBuffer buf; 
    246247    char *id; 
    247248 
    248249#if 0 
    249250    printf("Dsymbol::mangle() '%s'", toChars());