Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/InstantiateGeneric.cc

    re58dfb9 r87c3bef  
    226226
    227227                        if ( (*baseParam)->isComplete() ) {
    228                                 // substitute parameter for complete (otype or sized dtype) type; makes the struct concrete or dynamic depending on the parameter
    229                                 out.push_back( paramType->clone() );
     228                                // substitute parameter for complete (otype or sized dtype) type
     229                                int pointerLevels = 0;
     230                                if ( hasPolyBase( paramType->get_type(), &pointerLevels ) && pointerLevels > 0 ) {
     231                                        // Make a void* with equivalent nesting
     232                                        Type* voidPtr = new VoidType( Type::Qualifiers() );
     233                                        while ( pointerLevels > 0 ) {
     234                                                // Just about data layout, so qualifiers *shouldn't* matter
     235                                                voidPtr = new PointerType( Type::Qualifiers(), voidPtr );
     236                                                --pointerLevels;
     237                                        }
     238                                        out.push_back( new TypeExpr( voidPtr ) );
     239                                } else {
     240                                        // Just clone parameter type
     241                                        out.push_back( paramType->clone() );
     242                                }
     243                                // make the struct concrete or dynamic depending on the parameter
    230244                                gt |= isPolyType( paramType->get_type() ) ? genericType::dynamic : genericType::concrete;
    231245                        } else switch ( (*baseParam)->get_kind() ) {
Note: See TracChangeset for help on using the changeset viewer.