Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/ValidateType.cc

    r1df492a r9939dc3  
    222222        // visit enum members first so that the types of self-referencing members are updated properly
    223223        // Replace the enum base; right now it works only for StructEnum
    224         if ( enumDecl->base ) {
    225                 if ( const TypeInstType * base = dynamic_cast< TypeInstType * >(enumDecl->base) ) {
    226                         if ( const StructDecl * decl = local_indexer->lookupStruct( base->name ) ) {
    227                                 enumDecl->base = new StructInstType( Type::Qualifiers(), const_cast< StructDecl * >( decl ) ); // Just linking in the node
    228                         }
    229                 } else if ( const PointerType * ptr = dynamic_cast< PointerType * >(enumDecl->base) ) {
    230                         if ( const TypeInstType * ptrBase = dynamic_cast< TypeInstType * >( ptr->base ) ) {
    231                                 if ( const StructDecl * decl = local_indexer->lookupStruct( ptrBase->name ) ) {
    232                                         enumDecl->base = new PointerType( Type::Qualifiers(),
    233                                                 new StructInstType( Type::Qualifiers(), const_cast< StructDecl * >( decl ) ) );
    234                                 }
    235                         }
     224        if ( enumDecl->base && dynamic_cast<TypeInstType*>(enumDecl->base) ) {
     225                std::string baseName = static_cast<TypeInstType*>(enumDecl->base)->name;
     226                const StructDecl * st = local_indexer->lookupStruct( baseName );
     227                if ( st ) {
     228                        enumDecl->base = new StructInstType(Type::Qualifiers(),const_cast<StructDecl *>(st)); // Just linking in the node
    236229                }
    237230        }
    238        
    239231        if ( enumDecl->body ) {
    240232                ForwardEnumsType::iterator fwds = forwardEnums.find( enumDecl->name );
Note: See TracChangeset for help on using the changeset viewer.