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

Changeset 647

Show
Ignore:
Timestamp:
08/28/10 22:09:17 (14 years ago)
Author:
walter
Message:

Issue 3046 - Segfault with C++ static variable (Linux only)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/cppmangle.c

    r594 r647  
    9292{ 
    9393    if (!cms->substitute(buf, s)) 
    9494    { 
    9595        Dsymbol *p = s->toParent(); 
    9696        if (p && !p->isModule()) 
    9797        { 
    9898            prefix_name(buf, cms, p); 
    9999        } 
    100100        source_name(buf, s); 
    101101    } 
    102102} 
    103103 
    104104void cpp_mangle_name(OutBuffer *buf, CppMangleState *cms, Dsymbol *s) 
    105105{ 
    106106    Dsymbol *p = s->toParent(); 
    107107    if (p && !p->isModule()) 
    108108    { 
    109109        buf->writeByte('N'); 
    110110 
    111111        FuncDeclaration *fd = s->isFuncDeclaration(); 
     112        if (!fd) 
     113        { 
     114            s->error("C++ static variables not supported"); 
     115        } 
     116        else 
    112117        if (fd->isConst()) 
    113118            buf->writeByte('K'); 
    114119 
    115120        prefix_name(buf, cms, p); 
    116121        source_name(buf, s); 
    117122 
    118123        buf->writeByte('E'); 
    119124    } 
    120125    else 
    121126        source_name(buf, s); 
    122127} 
    123128 
    124129 
    125130char *cpp_mangle(Dsymbol *s) 
    126131{ 
    127132    /* 
    128133     * <mangled-name> ::= _Z <encoding> 
    129134     * <encoding> ::= <function name> <bare-function-type> 
    130135     *         ::= <data name> 
    131136     *         ::= <special-name>