Changes in / [9a1e509:3d4b23fa]


Ignore:
Location:
src
Files:
1 deleted
45 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    r9a1e509 r3d4b23fa  
    336336                        if ( varExpr->get_var()->get_linkage() == LinkageSpec::Intrinsic && operatorLookup( varExpr->get_var()->get_name(), opInfo ) ) {
    337337                                std::list< Expression* >::iterator arg = applicationExpr->get_args().begin();
     338                                switch ( opInfo.type ) {
     339                                  case OT_PREFIXASSIGN:
     340                                  case OT_POSTFIXASSIGN:
     341                                  case OT_INFIXASSIGN:
     342                                  case OT_CTOR:
     343                                  case OT_DTOR:
     344                                        {
     345                                                assert( arg != applicationExpr->get_args().end() );
     346                                                if ( AddressExpr * addrExpr = dynamic_cast< AddressExpr * >( *arg ) ) {
     347                                                        // remove & from first assignment/ctor argument
     348                                                        *arg = addrExpr->get_arg();
     349                                                } else {
     350                                                        // no address-of operator, so must be a pointer - add dereference
     351                                                        // NOTE: if the assertion starts to trigger, check that the application expr isn't being shared.
     352                                                        // Since its arguments are modified here, this assertion most commonly triggers when the application
     353                                                        // is visited multiple times.
     354                                                        UntypedExpr * newExpr = new UntypedExpr( new NameExpr( "*?" ) );
     355                                                        newExpr->get_args().push_back( *arg );
     356                                                        Type * type = InitTweak::getPointerBase( (*arg)->get_result() );
     357                                                        assertf( type, "First argument to a derefence must be a pointer. Ensure that expressions are not being shared." );
     358                                                        newExpr->set_result( type->clone() );
     359                                                        *arg = newExpr;
     360                                                } // if
     361                                                break;
     362                                        }
     363
     364                                  default:
     365                                        // do nothing
     366                                        ;
     367                                } // switch
     368
    338369                                switch ( opInfo.type ) {
    339370                                  case OT_INDEX:
  • src/CodeGen/GenType.cc

    r9a1e509 r3d4b23fa  
    3737                virtual void visit( PointerType *pointerType );
    3838                virtual void visit( ArrayType *arrayType );
    39                 virtual void visit( ReferenceType *refType );
    4039                virtual void visit( StructInstType *structInst );
    4140                virtual void visit( UnionInstType *unionInst );
     
    148147        }
    149148
    150         void GenType::visit( ReferenceType *refType ) {
    151                 assert( refType->get_base() != 0);
    152                 assertf( ! genC, "Reference types should not reach code generation." );
    153                 handleQualifiers( refType );
    154                 typeString = "&" + typeString;
    155                 refType->get_base()->accept( *this );
    156         }
    157 
    158149        void GenType::visit( FunctionType *funcType ) {
    159150                std::ostringstream os;
  • src/Common/PassVisitor.h

    r9a1e509 r3d4b23fa  
    113113        virtual void visit( PointerType *pointerType ) override final;
    114114        virtual void visit( ArrayType *arrayType ) override final;
    115         virtual void visit( ReferenceType *referenceType ) override final;
    116115        virtual void visit( FunctionType *functionType ) override final;
    117116        virtual void visit( StructInstType *aggregateUseType ) override final;
     
    199198        virtual Type* mutate( PointerType *pointerType ) override final;
    200199        virtual Type* mutate( ArrayType *arrayType ) override final;
    201         virtual Type* mutate( ReferenceType *referenceType ) override final;
    202200        virtual Type* mutate( FunctionType *functionType ) override final;
    203201        virtual Type* mutate( StructInstType *aggregateUseType ) override final;
  • src/Common/PassVisitor.impl.h

    r9a1e509 r3d4b23fa  
    786786
    787787template< typename pass_type >
    788 void PassVisitor< pass_type >::visit( ReferenceType * node ) {
    789         VISIT_BODY( node );
    790 }
    791 
    792 template< typename pass_type >
    793788void PassVisitor< pass_type >::visit( FunctionType * node ) {
    794789        VISIT_BODY( node );
     
    11231118
    11241119template< typename pass_type >
    1125 Type * PassVisitor< pass_type >::mutate( ReferenceType * node ) {
    1126         MUTATE_BODY( Type, node );
    1127 }
    1128 
    1129 template< typename pass_type >
    11301120Type * PassVisitor< pass_type >::mutate( FunctionType * node ) {
    11311121        MUTATE_BODY( Type, node );
  • src/Concurrency/Keywords.cc

    r9a1e509 r3d4b23fa  
    524524
    525525                DeclarationWithType * param = decl->get_functionType()->get_parameters().front();
    526                 auto type  = dynamic_cast< StructInstType * >( InitTweak::getPointerBase( param->get_type() ) );
     526                auto ptr = dynamic_cast< PointerType * >( param->get_type() );
     527                // if( ptr ) std::cerr << "FRED1" << std::endl;
     528                auto type  = dynamic_cast< StructInstType * >( ptr->get_base() );
    527529                // if( type ) std::cerr << "FRED2" << std::endl;
    528530                if( type && type->get_baseStruct()->is_thread() ) {
  • src/GenPoly/Box.cc

    r9a1e509 r3d4b23fa  
    758758                                        // if the argument's type is polymorphic, we don't need to box again!
    759759                                        return;
    760                                 } else if ( arg->get_result()->get_lvalue() ) {  // xxx - is this still right??
    761                                 // xxx - dynamic_cast<ReferenceType *>( arg->get_result() )??
     760                                } else if ( arg->get_result()->get_lvalue() ) {
    762761                                        // VariableExpr and MemberExpr are lvalues; need to check this isn't coming from the second arg of a comma expression though (not an lvalue)
    763762                                        // xxx - need to test that this code is still reachable
     
    10371036                                                assert( appExpr->has_result() );
    10381037                                                assert( ! appExpr->get_args().empty() );
    1039                                                 if ( isPolyPtr( appExpr->get_result(), scopeTyVars, env ) ) { // dereference returns a reference type
    1040                                                         // remove dereference from polymorphic types since they are boxed.
     1038                                                if ( isPolyType( appExpr->get_result(), scopeTyVars, env ) ) {
    10411039                                                        Expression *ret = appExpr->get_args().front();
    10421040                                                        delete ret->get_result();
  • src/GenPoly/Lvalue.cc

    r9a1e509 r3d4b23fa  
    3232#include "Common/UniqueName.h"
    3333#include "Common/utility.h"
    34 #include "InitTweak/InitTweak.h"
    35 
    36 #include "Common/PassVisitor.h"
    37 
    38 // need to be careful about polymorphic references... e.g. in *? (___operator_deref__A0_1_0_0__Fd0_Pd0_intrinsic___1)
    39 // the variable is automatically dereferenced and this causes errors dereferencing void*.
    4034
    4135namespace GenPoly {
    4236        namespace {
    43                 struct ReferenceConversions final {
    44                         Expression * postmutate( CastExpr * castExpr );
     37                /// Replace uses of lvalue returns with appropriate pointers
     38                class Pass1 : public Mutator {
     39                  public:
     40                        Pass1();
     41
     42                        virtual Expression *mutate( ApplicationExpr *appExpr );
     43                        virtual Statement *mutate( ReturnStmt *appExpr );
     44                        virtual DeclarationWithType *mutate( FunctionDecl *funDecl );
     45                  private:
     46                        DeclarationWithType* retval;
    4547                };
    4648
    47                 /// Intrinsic functions that take reference parameters don't REALLY take reference parameters -- their reference arguments must always be implicitly dereferenced.
    48                 struct FixIntrinsicArgs final {
    49                         Expression * postmutate( ApplicationExpr *appExpr );
    50                 };
    51 
    52 
    53                 /// Replace reference types with pointer types
    54                 struct ReferenceTypeElimination final {
    55                         Type * postmutate( ReferenceType * refType );
     49                /// Replace declarations of lvalue returns with appropriate pointers
     50                class Pass2 : public Visitor {
     51                  public:
     52                        virtual void visit( FunctionType *funType );
     53                  private:
    5654                };
    5755
     
    5957                /// https://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/Lvalues.html#Lvalues
    6058                /// Replaces &(a,b) with (a, &b), &(a ? b : c) with (a ? &b : &c)
    61                 struct GeneralizedLvalue final {
    62                         Expression * postmutate( AddressExpr * addressExpr );
     59                class GeneralizedLvalue : public Mutator {
     60                        typedef Mutator Parent;
     61
     62                        virtual Expression * mutate( AddressExpr * addressExpr );
    6363                };
    6464        } // namespace
    6565
    6666        void convertLvalue( std::list< Declaration* >& translationUnit ) {
    67                 std::cerr << "convertLvalue" << std::endl;
    68                 PassVisitor<ReferenceConversions> refCvt;
    69                 PassVisitor<ReferenceTypeElimination> elim;
    70                 PassVisitor<GeneralizedLvalue> genLval;
    71                 PassVisitor<FixIntrinsicArgs> fixer;
    72                 mutateAll( translationUnit, refCvt );
    73                 mutateAll( translationUnit, fixer );
    74                 mutateAll( translationUnit, elim );
     67                Pass1 p1;
     68                Pass2 p2;
     69                GeneralizedLvalue genLval;
     70                mutateAll( translationUnit, p1 );
     71                acceptAll( translationUnit, p2 );
    7572                mutateAll( translationUnit, genLval );
    7673        }
     
    8077                        if ( function->get_returnVals().empty() ) return 0;
    8178                        Type *ty = function->get_returnVals().front()->get_type();
    82                         return dynamic_cast< ReferenceType * >( ty ) ;
     79                        return ty->get_lvalue() ? ty : 0;
    8380                }
    8481
     
    9188                }
    9289
    93                 bool isDeref( Expression * expr ) {
    94                         if ( UntypedExpr * untyped = dynamic_cast< UntypedExpr * >( expr ) ) {
    95                                 return InitTweak::getFunctionName( untyped ) == "*?";
    96                         } else if ( ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * > ( expr ) ) {
    97                                 if ( DeclarationWithType * func = InitTweak::getFunction( appExpr ) ) {
    98                                         return func->get_linkage() == LinkageSpec::Intrinsic && InitTweak::getFunctionName( appExpr ) == "*?";
    99                                 }
    100                         }
    101                         return false;
     90                Pass1::Pass1() {
    10291                }
    10392
    104                 bool isIntrinsicReference( Expression * expr ) {
    105                         if ( isDeref( expr ) ) return true;
    106                         else if ( UntypedExpr * untyped = dynamic_cast< UntypedExpr * >( expr ) ) {
    107                                 return InitTweak::getFunctionName( untyped ) == "?[?]";
    108                         } else if ( ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * > ( expr ) ) {
    109                                 if ( DeclarationWithType * func = InitTweak::getFunction( appExpr ) ) {
    110                                         return func->get_linkage() == LinkageSpec::Intrinsic && InitTweak::getFunctionName( appExpr ) == "?[?]";
     93                DeclarationWithType * Pass1::mutate( FunctionDecl *funcDecl ) {
     94                        if ( funcDecl->get_statements() ) {
     95                                DeclarationWithType* oldRetval = retval;
     96                                retval = 0;
     97                                if ( ! LinkageSpec::isBuiltin( funcDecl->get_linkage() ) && isLvalueRet( funcDecl->get_functionType() ) ) {
     98                                        retval = funcDecl->get_functionType()->get_returnVals().front();
    11199                                }
    112                         }
    113                         return false;
     100                                // fix expressions and return statements in this function
     101                                funcDecl->set_statements( funcDecl->get_statements()->acceptMutator( *this ) );
     102                                retval = oldRetval;
     103                        } // if
     104                        return funcDecl;
    114105                }
    115106
    116                 void fixArg( Expression *& arg, Type * formal ) {
    117                         // if ( CastExpr * castExpr = dynamic_cast< CastExpr * >( arg ) ) {
    118                                 if ( dynamic_cast<ReferenceType*>( formal ) ) { // xxx - but might be deref, in which case result isn't REALLY a reference, at least not in the sense that we need to add another deref...
    119                                         // doesn't work, for some reason left arg is skipped in assign
    120                                         ReferenceType * refType = safe_dynamic_cast< ReferenceType * >( arg->get_result() ) ;
    121                                         std::cerr << "appexpr arg is non-deref/index intrinsic call" << std::endl;
    122                                         std::cerr << arg << std::endl;
    123                                         PointerType * ptrType = new PointerType( Type::Qualifiers(), refType->get_base()->clone() );
    124                                         delete refType;
    125                                         arg->set_result( ptrType );
    126                                         arg = UntypedExpr::createDeref( arg );
     107                Expression * Pass1::mutate( ApplicationExpr *appExpr ) {
     108                        appExpr->get_function()->acceptMutator( *this );
     109                        mutateAll( appExpr->get_args(), *this );
     110
     111                        PointerType *pointer = safe_dynamic_cast< PointerType* >( appExpr->get_function()->get_result() );
     112                        FunctionType *function = safe_dynamic_cast< FunctionType* >( pointer->get_base() );
     113
     114                        Type *funType = isLvalueRet( function );
     115                        if ( funType && ! isIntrinsicApp( appExpr ) ) {
     116                                Expression *expr = appExpr;
     117                                Type *appType = appExpr->get_result();
     118                                if ( isPolyType( funType ) && ! isPolyType( appType ) ) {
     119                                        // make sure cast for polymorphic type is inside dereference
     120                                        expr = new CastExpr( appExpr, new PointerType( Type::Qualifiers(), appType->clone() ) );
    127121                                }
    128 
    129                         // }
     122                                UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) );
     123                                deref->set_result( appType->clone() );
     124                                appExpr->set_result( new PointerType( Type::Qualifiers(), appType ) );
     125                                deref->get_args().push_back( expr );
     126                                return deref;
     127                        } else {
     128                                return appExpr;
     129                        } // if
    130130                }
    131131
    132                 Expression * FixIntrinsicArgs::postmutate( ApplicationExpr * appExpr ) {
    133                         if ( DeclarationWithType * function = InitTweak::getFunction( appExpr ) ) {
    134                                 if ( function->get_linkage() == LinkageSpec::Intrinsic ) { // intrinsic functions that turn pointers into references
    135                                         FunctionType * ftype = GenPoly::getFunctionType( function->get_type() );
    136                                         assertf( ftype, "Function declaration does not have function type." );
    137                                         for ( auto p : group_iterate( appExpr->get_args(), ftype->get_parameters() ) ) {
    138                                                 Expression *& arg = std::get<0>( p );
    139                                                 DeclarationWithType * formal = std::get<1>( p );
    140                                                 std::cerr << "pair<0>: " << arg << std::endl;
    141                                                 std::cerr << "pair<1>: " << formal->get_type() << std::endl;
    142                                                 if ( isIntrinsicReference( arg ) ) {
    143                                                         std::cerr << "skipping intrinsic reference" << std::endl;
    144                                                         continue;
    145                                                 } else {
    146                                                         fixArg( arg, formal->get_type() );
    147                                                 }
    148                                         }
    149                                 }
    150                         }
    151                         return appExpr;
     132                Statement * Pass1::mutate(ReturnStmt *retStmt) {
     133                        if ( retval && retStmt->get_expr() ) {
     134                                if ( retStmt->get_expr()->get_result()->get_lvalue() ) {
     135                                        // ***** Code Removal ***** because casts may be stripped already
     136
     137                                        // strip casts because not allowed to take address of cast
     138                                        // while ( CastExpr *castExpr = dynamic_cast< CastExpr* >( retStmt->get_expr() ) ) {
     139                                        //      retStmt->set_expr( castExpr->get_arg() );
     140                                        //      retStmt->get_expr()->set_env( castExpr->get_env() );
     141                                        //      castExpr->set_env( 0 );
     142                                        //      castExpr->set_arg( 0 );
     143                                        //      delete castExpr;
     144                                        // } // while
     145                                        retStmt->set_expr( new AddressExpr( retStmt->get_expr()->acceptMutator( *this ) ) );
     146                                } else {
     147                                        throw SemanticError( "Attempt to return non-lvalue from an lvalue-qualified function" );
     148                                } // if
     149                        } // if
     150                        return retStmt;
    152151                }
    153152
    154                 Expression * ReferenceConversions::postmutate( CastExpr * castExpr ) {
    155                         // conversion to reference type
    156                         if ( ReferenceType * refType = dynamic_cast< ReferenceType * >( castExpr->get_result() ) ) {
    157                                 (void)refType;
    158                                 if ( ReferenceType * otherRef = dynamic_cast< ReferenceType * >( castExpr->get_arg()->get_result() ) ) {
    159                                         // nothing to do if casting from reference to reference.
    160                                         (void)otherRef;
    161                                         std::cerr << "convert reference to reference -- nop" << std::endl;
    162                                         if ( isIntrinsicReference( castExpr->get_arg() ) ) {
    163                                                 Expression * callExpr = castExpr->get_arg();
    164                                                 Expression ** arg = nullptr;
    165                                                 Expression *& arg0 = InitTweak::getCallArg( callExpr, 0 );
    166                                                 if ( dynamic_cast<PointerType *>( arg0->get_result() ) ) {
    167                                                         arg = &arg0;
    168                                                 } else {
    169                                                         arg = &InitTweak::getCallArg( callExpr, 1 );
    170                                                 }
     153                void Pass2::visit( FunctionType *funType ) {
     154                        std::string typeName;
     155                        if ( isLvalueRet( funType ) ) {
     156                                DeclarationWithType *retParm = funType->get_returnVals().front();
    171157
    172                                                 castExpr->set_arg( *arg );
    173                                                 *arg = castExpr;
    174                                                 std::cerr << "but arg is deref -- &" << std::endl;
    175                                                 std::cerr << callExpr << std::endl;
    176                                                 // castExpr->set_arg( new AddressExpr( castExpr->get_arg() ) );
     158                                // make a new parameter that is a pointer to the type of the old return value
     159                                retParm->set_type( new PointerType( Type::Qualifiers(), retParm->get_type() ) );
     160                        } // if
    177161
    178                                                 // move environment out to new top-level
    179                                                 callExpr->set_env( castExpr->get_env() );
    180                                                 castExpr->set_env( nullptr );
    181                                                 return callExpr;
    182                                         }
    183                                         std::cerr << castExpr << std::endl;
    184                                         return castExpr;
    185                                 } else if ( castExpr->get_arg()->get_result()->get_lvalue() ) {
    186                                         // conversion from lvalue to reference
    187                                         // xxx - keep cast, but turn into pointer cast??
    188                                         // xxx - memory
    189                                         std::cerr << "convert lvalue to reference -- &" << std::endl;
    190                                         std::cerr << castExpr->get_arg() << std::endl;
    191                                         castExpr->set_arg( new AddressExpr( castExpr->get_arg() ) );
    192                                         // return new AddressExpr( castExpr->get_arg() );
    193                                         return castExpr;
    194                                 } else {
    195                                         // rvalue to reference conversion -- introduce temporary
    196                                 }
    197                                 assertf( false, "Only conversions to reference from lvalue are currently supported: %s", toString( castExpr ).c_str() );
    198                         } else if ( ReferenceType * refType = dynamic_cast< ReferenceType * >( castExpr->get_arg()->get_result() ) ) {
    199                                 // should be easy, just need to move deref code up here?
    200                                 std::cerr << "convert reference to rvalue -- *" << std::endl;
    201                                 if ( isIntrinsicReference( castExpr->get_arg() ) ) {
    202                                         std::cerr << "but arg is intrinsic reference -- nop" << std::endl;
    203                                         return castExpr;
    204                                 }
    205                                 std::cerr << castExpr << std::endl;
    206 
    207                                 PointerType * ptrType = new PointerType( refType->get_qualifiers(), refType->get_base()->clone() );
    208                                 delete castExpr->get_result();
    209                                 castExpr->set_result( ptrType );
    210                                 Expression * deref = UntypedExpr::createDeref( castExpr );
    211                                 deref->set_env( castExpr->get_env() );
    212                                 castExpr->set_env( nullptr );
    213                                 return deref;
    214                                 // assertf( false, "Conversions from reference types are not currently supported." );
    215                         }
    216                         return castExpr;
     162                        Visitor::visit( funType );
    217163                }
    218164
    219                 Type * ReferenceTypeElimination::postmutate( ReferenceType * refType ) {
    220                         Type * base = refType->get_base();
    221                         refType->set_base( nullptr );
    222                         delete refType;
    223                         return new PointerType( Type::Qualifiers(), base );
    224                 }
    225 
    226                 Expression * GeneralizedLvalue::postmutate( AddressExpr * addrExpr ) {
     165                Expression * GeneralizedLvalue::mutate( AddressExpr * addrExpr ) {
     166                        addrExpr = safe_dynamic_cast< AddressExpr * >( Parent::mutate( addrExpr ) );
    227167                        if ( CommaExpr * commaExpr = dynamic_cast< CommaExpr * >( addrExpr->get_arg() ) ) {
    228168                                Expression * arg1 = commaExpr->get_arg1()->clone();
  • src/InitTweak/FixInit.cc

    r9a1e509 r3d4b23fa  
    364364                                        assert( ftype );
    365365                                        if ( isConstructor( funcDecl->get_name() ) && ftype->get_parameters().size() == 2 ) {
    366                                                 Type * t1 = getPointerBase( ftype->get_parameters().front()->get_type() );
     366                                                Type * t1 = ftype->get_parameters().front()->get_type();
    367367                                                Type * t2 = ftype->get_parameters().back()->get_type();
    368                                                 assert( t1 );
    369 
    370                                                 if ( ResolvExpr::typesCompatible( t1, t2, SymTab::Indexer() ) ) {
     368                                                PointerType * ptrType = safe_dynamic_cast< PointerType * > ( t1 );
     369
     370                                                if ( ResolvExpr::typesCompatible( ptrType->get_base(), t2, SymTab::Indexer() ) ) {
    371371                                                        // optimization: don't need to copy construct in order to call a copy constructor
    372372                                                        return appExpr;
     
    401401
    402402                bool ResolveCopyCtors::skipCopyConstruct( Type * type ) {
    403                         return dynamic_cast< VarArgsType * >( type ) || dynamic_cast< ReferenceType * >( type ) || GenPoly::getFunctionType( type ) || Tuples::isTtype( type );
     403                        return dynamic_cast< VarArgsType * >( type ) || GenPoly::getFunctionType( type ) || Tuples::isTtype( type );
    404404                }
    405405
     
    489489                                impCpCtorExpr->get_returnDecls().push_back( ret );
    490490                                CP_CTOR_PRINT( std::cerr << "makeCtorDtor for a return" << std::endl; )
    491                                 if ( ! dynamic_cast< ReferenceType * >( result ) ) {
     491                                if ( ! result->get_lvalue() ) {
    492492                                        // destructing lvalue returns is bad because it can cause multiple destructor calls to the same object - the returned object is not a temporary
    493493                                        destructRet( ret, impCpCtorExpr );
     
    997997                                assert( ! type->get_parameters().empty() );
    998998                                thisParam = safe_dynamic_cast< ObjectDecl * >( type->get_parameters().front() );
    999                                 Type * thisType = getPointerBase( thisParam->get_type() );
    1000                                 StructInstType * structType = dynamic_cast< StructInstType * >( thisType );
     999                                PointerType * ptrType = safe_dynamic_cast< PointerType * > ( thisParam->get_type() );
     1000                                StructInstType * structType = dynamic_cast< StructInstType * >( ptrType->get_base() );
    10011001                                if ( structType ) {
    10021002                                        structDecl = structType->get_baseStruct();
     
    10461046                                        // insert and resolve default/copy constructor call for each field that's unhandled
    10471047                                        std::list< Statement * > stmt;
     1048                                        UntypedExpr * deref = UntypedExpr::createDeref( new VariableExpr( thisParam ) );
     1049
    10481050                                        Expression * arg2 = 0;
    10491051                                        if ( isCopyConstructor( function ) ) {
     
    10541056                                        }
    10551057                                        InitExpander srcParam( arg2 );
    1056                                         SymTab::genImplicitCall( srcParam, new MemberExpr( field, new VariableExpr( thisParam ) ), function->get_name(), back_inserter( stmt ), field, isCtor );
     1058                                        SymTab::genImplicitCall( srcParam, new MemberExpr( field, deref ), function->get_name(), back_inserter( stmt ), field, isCtor );
    10571059
    10581060                                        assert( stmt.size() <= 1 );
  • src/InitTweak/GenInit.cc

    r9a1e509 r3d4b23fa  
    5454
    5555          protected:
    56                 FunctionType * ftype = nullptr;
     56                FunctionType * ftype;
    5757                std::string funcName;
    5858        };
     
    137137                std::list< DeclarationWithType * > & returnVals = ftype->get_returnVals();
    138138                assert( returnVals.size() == 0 || returnVals.size() == 1 );
    139                 // hands off if the function returns a reference - we don't want to allocate a temporary if a variable's address
     139                // hands off if the function returns an lvalue - we don't want to allocate a temporary if a variable's address
    140140                // is being returned
    141                 if ( returnStmt->get_expr() && returnVals.size() == 1 && ! dynamic_cast< ReferenceType * >( returnVals.front()->get_type() ) ) {
     141                if ( returnStmt->get_expr() && returnVals.size() == 1 && ! returnVals.front()->get_type()->get_lvalue() ) {
    142142                        // explicitly construct the return value using the return expression and the retVal object
    143143                        assertf( returnVals.front()->get_name() != "", "Function %s has unnamed return value\n", funcName.c_str() );
    144 
    145                         stmtsToAddBefore.push_back( genCtorDtor( "?{}", dynamic_cast< ObjectDecl *>( returnVals.front() ), returnStmt->get_expr() ) );
     144                        UntypedExpr *construct = new UntypedExpr( new NameExpr( "?{}" ) );
     145                        construct->get_args().push_back( new AddressExpr( new VariableExpr( returnVals.front() ) ) );
     146                        construct->get_args().push_back( returnStmt->get_expr() );
     147                        stmtsToAddBefore.push_back(new ExprStmt(noLabels, construct));
    146148
    147149                        // return the retVal object
     
    210212
    211213        bool CtorDtor::isManaged( Type * type ) const {
    212                 // at least for now, references are never constructed
    213                 if ( dynamic_cast< ReferenceType * >( type ) ) return false;
    214214                // need to clear and reset qualifiers when determining if a type is managed
    215215                ValueGuard< Type::Qualifiers > qualifiers( type->get_qualifiers() );
     
    238238                        std::list< DeclarationWithType * > & params = GenPoly::getFunctionType( dwt->get_type() )->get_parameters();
    239239                        assert( ! params.empty() );
    240                         Type * type = InitTweak::getPointerBase( params.front()->get_type() );
    241                         assert( type );
    242                         managedTypes.insert( SymTab::Mangler::mangle( type ) );
     240                        PointerType * type = safe_dynamic_cast< PointerType * >( params.front()->get_type() );
     241                        managedTypes.insert( SymTab::Mangler::mangle( type->get_base() ) );
    243242                }
    244243        }
  • src/InitTweak/InitTweak.cc

    r9a1e509 r3d4b23fa  
    380380                template<typename CallExpr>
    381381                Expression *& callArg( CallExpr * callExpr, unsigned int pos ) {
    382                         if ( pos >= callExpr->get_args().size() ) assertf( false, "getCallArg for argument that doesn't exist: (%u); %s.", pos, toString( callExpr ).c_str() );
     382                        if ( pos >= callExpr->get_args().size() ) assertf( false, "asking for argument that doesn't exist. Return NULL/throw exception?" );
    383383                        for ( Expression *& arg : callExpr->get_args() ) {
    384384                                if ( pos == 0 ) return arg;
     
    458458                } else if ( ArrayType * arrayType = dynamic_cast< ArrayType * >( type ) ) {
    459459                        return arrayType->get_base();
    460                 } else if ( ReferenceType * refType = dynamic_cast< ReferenceType * >( type ) ) {
    461                         return refType->get_base();
    462460                } else {
    463461                        return NULL;
     
    545543                if ( ftype->get_parameters().size() != 2 ) return 0;
    546544
    547                 Type * t1 = getPointerBase( ftype->get_parameters().front()->get_type() );
     545                Type * t1 = ftype->get_parameters().front()->get_type();
    548546                Type * t2 = ftype->get_parameters().back()->get_type();
    549                 assert( t1 );
    550 
    551                 if ( ResolvExpr::typesCompatibleIgnoreQualifiers( t1, t2, SymTab::Indexer() ) ) {
     547                PointerType * ptrType = dynamic_cast< PointerType * > ( t1 );
     548                assert( ptrType );
     549
     550                if ( ResolvExpr::typesCompatibleIgnoreQualifiers( ptrType->get_base(), t2, SymTab::Indexer() ) ) {
    552551                        return function;
    553552                } else {
  • src/Makefile.in

    r9a1e509 r3d4b23fa  
    221221        SynTree/driver_cfa_cpp-PointerType.$(OBJEXT) \
    222222        SynTree/driver_cfa_cpp-ArrayType.$(OBJEXT) \
    223         SynTree/driver_cfa_cpp-ReferenceType.$(OBJEXT) \
    224223        SynTree/driver_cfa_cpp-FunctionType.$(OBJEXT) \
    225224        SynTree/driver_cfa_cpp-ReferenceToType.$(OBJEXT) \
     
    518517        SynTree/VoidType.cc SynTree/BasicType.cc \
    519518        SynTree/PointerType.cc SynTree/ArrayType.cc \
    520         SynTree/ReferenceType.cc SynTree/FunctionType.cc \
    521         SynTree/ReferenceToType.cc SynTree/TupleType.cc \
    522         SynTree/TypeofType.cc SynTree/AttrType.cc \
     519        SynTree/FunctionType.cc SynTree/ReferenceToType.cc \
     520        SynTree/TupleType.cc SynTree/TypeofType.cc SynTree/AttrType.cc \
    523521        SynTree/VarArgsType.cc SynTree/ZeroOneType.cc \
    524522        SynTree/Constant.cc SynTree/Expression.cc SynTree/TupleExpr.cc \
     
    866864SynTree/driver_cfa_cpp-ArrayType.$(OBJEXT): SynTree/$(am__dirstamp) \
    867865        SynTree/$(DEPDIR)/$(am__dirstamp)
    868 SynTree/driver_cfa_cpp-ReferenceType.$(OBJEXT):  \
    869         SynTree/$(am__dirstamp) SynTree/$(DEPDIR)/$(am__dirstamp)
    870866SynTree/driver_cfa_cpp-FunctionType.$(OBJEXT):  \
    871867        SynTree/$(am__dirstamp) SynTree/$(DEPDIR)/$(am__dirstamp)
     
    10621058@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-PointerType.Po@am__quote@
    10631059@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-ReferenceToType.Po@am__quote@
    1064 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-ReferenceType.Po@am__quote@
    10651060@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-Statement.Po@am__quote@
    10661061@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-TupleExpr.Po@am__quote@
     
    21592154@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    21602155@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-ArrayType.obj `if test -f 'SynTree/ArrayType.cc'; then $(CYGPATH_W) 'SynTree/ArrayType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/ArrayType.cc'; fi`
    2161 
    2162 SynTree/driver_cfa_cpp-ReferenceType.o: SynTree/ReferenceType.cc
    2163 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-ReferenceType.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-ReferenceType.Tpo -c -o SynTree/driver_cfa_cpp-ReferenceType.o `test -f 'SynTree/ReferenceType.cc' || echo '$(srcdir)/'`SynTree/ReferenceType.cc
    2164 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-ReferenceType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-ReferenceType.Po
    2165 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/ReferenceType.cc' object='SynTree/driver_cfa_cpp-ReferenceType.o' libtool=no @AMDEPBACKSLASH@
    2166 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2167 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-ReferenceType.o `test -f 'SynTree/ReferenceType.cc' || echo '$(srcdir)/'`SynTree/ReferenceType.cc
    2168 
    2169 SynTree/driver_cfa_cpp-ReferenceType.obj: SynTree/ReferenceType.cc
    2170 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-ReferenceType.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-ReferenceType.Tpo -c -o SynTree/driver_cfa_cpp-ReferenceType.obj `if test -f 'SynTree/ReferenceType.cc'; then $(CYGPATH_W) 'SynTree/ReferenceType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/ReferenceType.cc'; fi`
    2171 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-ReferenceType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-ReferenceType.Po
    2172 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/ReferenceType.cc' object='SynTree/driver_cfa_cpp-ReferenceType.obj' libtool=no @AMDEPBACKSLASH@
    2173 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2174 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-ReferenceType.obj `if test -f 'SynTree/ReferenceType.cc'; then $(CYGPATH_W) 'SynTree/ReferenceType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/ReferenceType.cc'; fi`
    21752156
    21762157SynTree/driver_cfa_cpp-FunctionType.o: SynTree/FunctionType.cc
  • src/Parser/DeclarationNode.cc

    r9a1e509 r3d4b23fa  
    329329} // DeclarationNode::newTypeDecl
    330330
    331 DeclarationNode * DeclarationNode::newPointer( DeclarationNode * qualifiers, OperKinds kind ) {
    332         DeclarationNode * newnode = new DeclarationNode;
    333         newnode->type = new TypeData( kind == OperKinds::PointTo ? TypeData::Pointer : TypeData::Reference );
     331DeclarationNode * DeclarationNode::newPointer( DeclarationNode * qualifiers ) {
     332        DeclarationNode * newnode = new DeclarationNode;
     333        newnode->type = new TypeData( TypeData::Pointer );
    334334        if ( qualifiers ) {
    335335                return newnode->addQualifiers( qualifiers );
     
    748748DeclarationNode * DeclarationNode::addPointer( DeclarationNode * p ) {
    749749        if ( p ) {
    750                 assert( p->type->kind == TypeData::Pointer || TypeData::Reference );
     750                assert( p->type->kind == TypeData::Pointer );
    751751                setBase( p->type );
    752752                p->type = nullptr;
  • src/Parser/ExpressionNode.cc

    r9a1e509 r3d4b23fa  
    296296Expression *build_unary_ptr( OperKinds op, ExpressionNode *expr_node ) {
    297297        std::list< Expression * > args;
    298         args.push_back(  maybeMoveBuild< Expression >(expr_node) ); // xxx
     298        args.push_back( new AddressExpr( maybeMoveBuild< Expression >(expr_node) ) );
    299299        return new UntypedExpr( new NameExpr( OperName[ (int)op ] ), args );
    300300}
     
    307307Expression *build_binary_ptr( OperKinds op, ExpressionNode *expr_node1, ExpressionNode *expr_node2 ) {
    308308        std::list< Expression * > args;
    309         args.push_back( maybeMoveBuild< Expression >(expr_node1) );
     309        args.push_back( new AddressExpr( maybeMoveBuild< Expression >(expr_node1) ) );
    310310        args.push_back( maybeMoveBuild< Expression >(expr_node2) );
    311311        return new UntypedExpr( new NameExpr( OperName[ (int)op ] ), args );
  • src/Parser/ParseNode.h

    r9a1e509 r3d4b23fa  
    237237        static DeclarationNode * newTraitUse( const std::string * name, ExpressionNode * params );
    238238        static DeclarationNode * newTypeDecl( std::string * name, DeclarationNode * typeParams );
    239         static DeclarationNode * newPointer( DeclarationNode * qualifiers, OperKinds kind );
     239        static DeclarationNode * newPointer( DeclarationNode * qualifiers );
    240240        static DeclarationNode * newArray( ExpressionNode * size, DeclarationNode * qualifiers, bool isStatic );
    241241        static DeclarationNode * newVarArray( DeclarationNode * qualifiers );
  • src/Parser/TypeData.cc

    r9a1e509 r3d4b23fa  
    3030          case Unknown:
    3131          case Pointer:
    32           case Reference:
    3332          case EnumConstant:
    3433                // nothing else to initialize
     
    10099          case Unknown:
    101100          case Pointer:
    102           case Reference:
    103101          case EnumConstant:
    104102                // nothing to destroy
     
    167165          case EnumConstant:
    168166          case Pointer:
    169           case Reference:
    170167                // nothing else to copy
    171168                break;
     
    401398                        // add dtor:  void ^?{}(T *)
    402399                        FunctionType * dtorType = new FunctionType( Type::Qualifiers(), false );
    403                         dtorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new ReferenceType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
     400                        dtorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
    404401                        td->get_assertions().push_front( new FunctionDecl( "^?{}", Type::StorageClasses(), LinkageSpec::Cforall, dtorType, nullptr ) );
    405402
    406403                        // add copy ctor:  void ?{}(T *, T)
    407404                        FunctionType * copyCtorType = new FunctionType( Type::Qualifiers(), false );
    408                         copyCtorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new ReferenceType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
     405                        copyCtorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
    409406                        copyCtorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) );
    410407                        td->get_assertions().push_front( new FunctionDecl( "?{}", Type::StorageClasses(), LinkageSpec::Cforall, copyCtorType, nullptr ) );
     
    412409                        // add default ctor:  void ?{}(T *)
    413410                        FunctionType * ctorType = new FunctionType( Type::Qualifiers(), false );
    414                         ctorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new ReferenceType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
     411                        ctorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
    415412                        td->get_assertions().push_front( new FunctionDecl( "?{}", Type::StorageClasses(), LinkageSpec::Cforall, ctorType, nullptr ) );
    416413
    417414                        // add assignment operator:  T * ?=?(T *, T)
    418415                        FunctionType * assignType = new FunctionType( Type::Qualifiers(), false );
    419                         assignType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new ReferenceType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
     416                        assignType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
    420417                        assignType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) );
    421418                        assignType->get_returnVals().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) );
     
    437434          case TypeData::Array:
    438435                return buildArray( td );
    439           case TypeData::Reference:
    440                 return buildReference( td );
    441436          case TypeData::Function:
    442437                return buildFunction( td );
     
    617612        buildForall( td->forall, at->get_forall() );
    618613        return at;
    619 } // buildArray
    620 
    621 ReferenceType * buildReference( const TypeData * td ) {
    622         ReferenceType * rt;
    623         if ( td->base ) {
    624                 rt = new ReferenceType( buildQualifiers( td ), typebuild( td->base ) );
    625         } else {
    626                 rt = new ReferenceType( buildQualifiers( td ), new BasicType( Type::Qualifiers(), BasicType::SignedInt ) );
    627         } // if
    628         buildForall( td->forall, rt->get_forall() );
    629         return rt;
    630 } // buildReference
     614} // buildPointer
    631615
    632616AggregateDecl * buildAggregate( const TypeData * td, std::list< Attribute * > attributes, LinkageSpec::Spec linkage ) {
  • src/Parser/TypeData.h

    r9a1e509 r3d4b23fa  
    2121
    2222struct TypeData {
    23         enum Kind { Basic, Pointer, Array, Reference, Function, Aggregate, AggregateInst, Enum, EnumConstant, Symbolic,
     23        enum Kind { Basic, Pointer, Array, Function, Aggregate, AggregateInst, Enum, EnumConstant, Symbolic,
    2424                                SymbolicInst, Tuple, Typeof, Builtin, Unknown };
    2525
     
    101101PointerType * buildPointer( const TypeData * );
    102102ArrayType * buildArray( const TypeData * );
    103 ReferenceType * buildReference( const TypeData * );
    104103AggregateDecl * buildAggregate( const TypeData *, std::list< Attribute * > );
    105104ReferenceToType * buildComAggInst( const TypeData *, std::list< Attribute * > attributes, LinkageSpec::Spec linkage );
  • src/Parser/parser.yy

    r9a1e509 r3d4b23fa  
    666666        conditional_expression
    667667        | unary_expression assignment_operator assignment_expression
    668                 { $$ = new ExpressionNode( build_binary_val( $2, $1, $3 ) ); }
     668                { $$ = new ExpressionNode( build_binary_ptr( $2, $1, $3 ) ); }
    669669        ;
    670670
     
    24012401variable_ptr:
    24022402        ptrref_operator variable_declarator
    2403                 { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); }
     2403                { $$ = $2->addPointer( DeclarationNode::newPointer( 0 ) ); }
    24042404        | ptrref_operator type_qualifier_list variable_declarator
    2405                 { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); }
     2405                { $$ = $3->addPointer( DeclarationNode::newPointer( $2 ) ); }
    24062406        | '(' variable_ptr ')' attribute_list_opt
    24072407                { $$ = $2->addQualifiers( $4 ); }                               // redundant parenthesis
     
    24492449function_ptr:
    24502450        ptrref_operator function_declarator
    2451                 { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); }
     2451                { $$ = $2->addPointer( DeclarationNode::newPointer( 0 ) ); }
    24522452        | ptrref_operator type_qualifier_list function_declarator
    2453                 { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); }
     2453                { $$ = $3->addPointer( DeclarationNode::newPointer( $2 ) ); }
    24542454        | '(' function_ptr ')'
    24552455                { $$ = $2; }
     
    24892489KR_function_ptr:
    24902490        ptrref_operator KR_function_declarator
    2491                 { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); }
     2491                { $$ = $2->addPointer( DeclarationNode::newPointer( 0 ) ); }
    24922492        | ptrref_operator type_qualifier_list KR_function_declarator
    2493                 { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); }
     2493                { $$ = $3->addPointer( DeclarationNode::newPointer( $2 ) ); }
    24942494        | '(' KR_function_ptr ')'
    24952495                { $$ = $2; }
     
    25332533type_ptr:
    25342534        ptrref_operator variable_type_redeclarator
    2535                 { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); }
     2535                { $$ = $2->addPointer( DeclarationNode::newPointer( 0 ) ); }
    25362536        | ptrref_operator type_qualifier_list variable_type_redeclarator
    2537                 { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); }
     2537                { $$ = $3->addPointer( DeclarationNode::newPointer( $2 ) ); }
    25382538        | '(' type_ptr ')' attribute_list_opt
    25392539                { $$ = $2->addQualifiers( $4 ); }
     
    25772577identifier_parameter_ptr:
    25782578        ptrref_operator identifier_parameter_declarator
    2579                 { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); }
     2579                { $$ = $2->addPointer( DeclarationNode::newPointer( 0 ) ); }
    25802580        | ptrref_operator type_qualifier_list identifier_parameter_declarator
    2581                 { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); }
     2581                { $$ = $3->addPointer( DeclarationNode::newPointer( $2 ) ); }
    25822582        | '(' identifier_parameter_ptr ')' attribute_list_opt
    25832583                { $$ = $2->addQualifiers( $4 ); }
     
    26372637type_parameter_ptr:
    26382638        ptrref_operator type_parameter_redeclarator
    2639                 { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); }
     2639                { $$ = $2->addPointer( DeclarationNode::newPointer( 0 ) ); }
    26402640        | ptrref_operator type_qualifier_list type_parameter_redeclarator
    2641                 { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); }
     2641                { $$ = $3->addPointer( DeclarationNode::newPointer( $2 ) ); }
    26422642        | '(' type_parameter_ptr ')' attribute_list_opt
    26432643                { $$ = $2->addQualifiers( $4 ); }
     
    26802680abstract_ptr:
    26812681        ptrref_operator
    2682                 { $$ = DeclarationNode::newPointer( 0, $1 ); }
     2682                { $$ = DeclarationNode::newPointer( 0 ); }
    26832683        | ptrref_operator type_qualifier_list
    2684                 { $$ = DeclarationNode::newPointer( $2, $1 ); }
     2684                { $$ = DeclarationNode::newPointer( $2 ); }
    26852685        | ptrref_operator abstract_declarator
    2686                 { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); }
     2686                { $$ = $2->addPointer( DeclarationNode::newPointer( 0 ) ); }
    26872687        | ptrref_operator type_qualifier_list abstract_declarator
    2688                 { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); }
     2688                { $$ = $3->addPointer( DeclarationNode::newPointer( $2 ) ); }
    26892689        | '(' abstract_ptr ')' attribute_list_opt
    26902690                { $$ = $2->addQualifiers( $4 ); }
     
    27692769abstract_parameter_ptr:
    27702770        ptrref_operator
    2771                 { $$ = DeclarationNode::newPointer( nullptr, $1 ); }
     2771                { $$ = DeclarationNode::newPointer( nullptr ); }
    27722772        | ptrref_operator type_qualifier_list
    2773                 { $$ = DeclarationNode::newPointer( $2, $1 ); }
     2773                { $$ = DeclarationNode::newPointer( $2 ); }
    27742774        | ptrref_operator abstract_parameter_declarator
    2775                 { $$ = $2->addPointer( DeclarationNode::newPointer( nullptr, $1 ) ); }
     2775                { $$ = $2->addPointer( DeclarationNode::newPointer( nullptr ) ); }
    27762776        | ptrref_operator type_qualifier_list abstract_parameter_declarator
    2777                 { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); }
     2777                { $$ = $3->addPointer( DeclarationNode::newPointer( $2 ) ); }
    27782778        | '(' abstract_parameter_ptr ')' attribute_list_opt
    27792779                { $$ = $2->addQualifiers( $4 ); }
     
    28482848variable_abstract_ptr:
    28492849        ptrref_operator
    2850                 { $$ = DeclarationNode::newPointer( 0, $1 ); }
     2850                { $$ = DeclarationNode::newPointer( 0 ); }
    28512851        | ptrref_operator type_qualifier_list
    2852                 { $$ = DeclarationNode::newPointer( $2, $1 ); }
     2852                { $$ = DeclarationNode::newPointer( $2 ); }
    28532853        | ptrref_operator variable_abstract_declarator
    2854                 { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); }
     2854                { $$ = $2->addPointer( DeclarationNode::newPointer( 0 ) ); }
    28552855        | ptrref_operator type_qualifier_list variable_abstract_declarator
    2856                 { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); }
     2856                { $$ = $3->addPointer( DeclarationNode::newPointer( $2 ) ); }
    28572857        | '(' variable_abstract_ptr ')' attribute_list_opt
    28582858                { $$ = $2->addQualifiers( $4 ); }
     
    28942894                // No SUE declaration in parameter list.
    28952895        ptrref_operator type_specifier_nobody
    2896                 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0, $1 ) ); }
     2896                { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
    28972897        | type_qualifier_list ptrref_operator type_specifier_nobody
    2898                 { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1, $2 ) ); }
     2898                { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1 ) ); }
    28992899        | ptrref_operator cfa_abstract_function
    2900                 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0, $1 ) ); }
     2900                { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
    29012901        | type_qualifier_list ptrref_operator cfa_abstract_function
    2902                 { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1, $2 ) ); }
     2902                { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1 ) ); }
    29032903        | ptrref_operator cfa_identifier_parameter_declarator_tuple
    2904                 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0, $1 ) ); }
     2904                { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
    29052905        | type_qualifier_list ptrref_operator cfa_identifier_parameter_declarator_tuple
    2906                 { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1, $2 ) ); }
     2906                { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1 ) ); }
    29072907        ;
    29082908
     
    29822982cfa_abstract_ptr:                                                                               // CFA
    29832983        ptrref_operator type_specifier
    2984                 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0, $1 ) ); }
     2984                { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
    29852985        | type_qualifier_list ptrref_operator type_specifier
    2986                 { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1, $2 ) ); }
     2986                { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1 ) ); }
    29872987        | ptrref_operator cfa_abstract_function
    2988                 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0, $1 ) ); }
     2988                { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
    29892989        | type_qualifier_list ptrref_operator cfa_abstract_function
    2990                 { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1, $2 ) ); }
     2990                { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1 ) ); }
    29912991        | ptrref_operator cfa_abstract_declarator_tuple
    2992                 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0, $1 ) ); }
     2992                { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
    29932993        | type_qualifier_list ptrref_operator cfa_abstract_declarator_tuple
    2994                 { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1, $2 ) ); }
     2994                { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1 ) ); }
    29952995        ;
    29962996
  • src/ResolvExpr/AlternativeFinder.cc

    r9a1e509 r3d4b23fa  
    305305                                std::cerr << std::endl << " to ";
    306306                                formalType->print( std::cerr, 8 );
    307                                 std::cerr << std::endl << "environment is: ";
    308                                 alt.env.print( std::cerr, 8 );
    309                                 std::cerr << std::endl;
    310307                        )
    311308                        Cost newCost = conversionCost( actualType, formalType, indexer, alt.env );
     
    403400                        Expression * actual = actualIt->expr;
    404401                        Type * actualType = actual->get_result();
    405 
    406402                        PRINT(
    407403                                std::cerr << "formal type is ";
     
    647643                        makeExprList( instantiatedActuals, appExpr->get_args() );
    648644                        PRINT(
    649                                 std::cerr << "instantiate function success: " << appExpr << std::endl;
    650645                                std::cerr << "need assertions:" << std::endl;
    651646                                printAssertionSet( resultNeed, std::cerr, 8 );
     
    758753                                PointerType *pointer = safe_dynamic_cast< PointerType* >( appExpr->get_function()->get_result() );
    759754                                FunctionType *function = safe_dynamic_cast< FunctionType* >( pointer->get_base() );
    760                                 std::cerr << "Case +++++++++++++ " << appExpr->get_function() << std::endl;
     755                                std::cerr << "Case +++++++++++++" << std::endl;
    761756                                std::cerr << "formals are:" << std::endl;
    762757                                printAll( function->get_parameters(), std::cerr, 8 );
     
    801796        bool isLvalue( Expression *expr ) {
    802797                // xxx - recurse into tuples?
    803                 return expr->has_result() && ( expr->get_result()->get_lvalue() || dynamic_cast< ReferenceType * >( expr->get_result() ) );
     798                return expr->has_result() && expr->get_result()->get_lvalue();
    804799        }
    805800
     
    887882                funcFinder.findWithAdjustment( memberExpr->get_aggregate() );
    888883                for ( AltList::const_iterator agg = funcFinder.alternatives.begin(); agg != funcFinder.alternatives.end(); ++agg ) {
    889                         // it's okay for the aggregate expression to have reference type -- cast it to the base type to treat the aggregate as the referenced value
    890                         std::unique_ptr<Expression> aggrExpr( agg->expr->clone() );
    891                         Type * aggrType = aggrExpr->get_result();
    892                         if ( dynamic_cast< ReferenceType * >( aggrType ) ) {
    893                                 aggrType = aggrType->stripReferences();
    894                                 aggrExpr.reset( new CastExpr( aggrExpr.release(), aggrType->clone() ) );
    895                         }
    896 
    897                         // find member of the given type
    898                         if ( StructInstType *structInst = dynamic_cast< StructInstType* >( aggrExpr->get_result() ) ) {
    899                                 addAggMembers( structInst, aggrExpr.get(), agg->cost, agg->env, memberExpr->get_member() );
    900                         } else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( aggrExpr->get_result() ) ) {
    901                                 addAggMembers( unionInst, aggrExpr.get(), agg->cost, agg->env, memberExpr->get_member() );
    902                         } else if ( TupleType * tupleType = dynamic_cast< TupleType * >( aggrExpr->get_result() ) ) {
    903                                 addTupleMembers( tupleType, aggrExpr.get(), agg->cost, agg->env, memberExpr->get_member() );
     884                        if ( StructInstType *structInst = dynamic_cast< StructInstType* >( agg->expr->get_result() ) ) {
     885                                addAggMembers( structInst, agg->expr, agg->cost, agg->env, memberExpr->get_member() );
     886                        } else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( agg->expr->get_result() ) ) {
     887                                addAggMembers( unionInst, agg->expr, agg->cost, agg->env, memberExpr->get_member() );
     888                        } else if ( TupleType * tupleType = dynamic_cast< TupleType * >( agg->expr->get_result() ) ) {
     889                                addTupleMembers( tupleType, agg->expr, agg->cost, agg->env, memberExpr->get_member() );
    904890                        } // if
    905891                } // for
  • src/ResolvExpr/CastCost.cc

    r9a1e509 r3d4b23fa  
    5454                } else if ( dynamic_cast< VoidType* >( dest ) ) {
    5555                        return Cost( 0, 0, 1 );
    56                 } else if ( ReferenceType * refType = dynamic_cast< ReferenceType * > ( dest ) ) {
    57                         return convertToReferenceCost( src, refType, indexer, env );
    5856                } else {
    5957                        CastCost converter( dest, indexer, env );
     
    7876                        cost = Cost( 1, 0, 0 );
    7977                } else {
    80                         cost = conversionCost( basicType, dest, indexer, env );
     78                        ConversionCost::visit( basicType );
    8179                } // if
    8280        }
  • src/ResolvExpr/CommonType.cc

    r9a1e509 r3d4b23fa  
    1717#include "SynTree/Type.h"
    1818#include "Unify.h"
     19
    1920
    2021/// #define DEBUG
     
    3031                virtual void visit( PointerType *pointerType );
    3132                virtual void visit( ArrayType *arrayType );
    32                 virtual void visit( ReferenceType *refType );
    3333                virtual void visit( FunctionType *functionType );
    3434                virtual void visit( StructInstType *aggregateUseType );
     
    4242                virtual void visit( OneType *oneType );
    4343
    44                 template< typename Pointer > void getCommonWithVoidPointer( Pointer* voidPointer, Pointer* otherPointer );
    45                 template< typename RefType > void handleRefType( RefType *inst, Type *other );
     44                void getCommonWithVoidPointer( PointerType* voidPointer, PointerType* otherPointer );
    4645
    4746                Type *result;
     
    5352        };
    5453
    55         Type * handleReference( ReferenceType * refType, Type * other, bool widenFirst, bool widenSecond, const SymTab::Indexer &indexer, TypeEnvironment & env, const OpenVarSet &openVars ) {
    56                 Type * result = nullptr, * common = nullptr;
    57                 AssertionSet have, need;
    58                 OpenVarSet newOpen( openVars );
    59                 // need unify to bind type variables
    60                 if ( unify( refType->get_base(), other, env, have, need, newOpen, indexer, common ) ) {
    61                         // std::cerr << "unify success" << std::endl;
    62                         if ( widenSecond ) {
    63                                 if ( widenFirst || other->get_qualifiers() <= refType->get_qualifiers() ) {
    64                                         result = new ReferenceType( refType->get_qualifiers(), common ); // refType->clone();
    65                                         result->get_qualifiers() |= other->get_qualifiers();
    66                                 }
    67                         } else if ( widenFirst ) {
    68                                 if ( widenSecond || refType->get_qualifiers() <= other->get_qualifiers() ) {
    69                                         result = common;
    70                                         result->get_qualifiers() |= refType->get_qualifiers();
    71                                 }
    72                         }
    73                 } else {
    74                         // std::cerr << "exact unify failed: " << refType << " " << other << std::endl;
    75                 }
    76                 // std::cerr << "common type of reference [" << refType << "] and non-reference [" << other << "] is [" << result << "]" << std::endl;
    77                 return result;
    78         }
    79 
    8054        Type *commonType( Type *type1, Type *type2, bool widenFirst, bool widenSecond, const SymTab::Indexer &indexer, TypeEnvironment &env, const OpenVarSet &openVars ) {
    8155                CommonType visitor( type2, widenFirst, widenSecond, indexer, env, openVars );
    82 
    83                 ReferenceType * refType1 = dynamic_cast< ReferenceType * >( type1 );
    84                 ReferenceType * refType2 = dynamic_cast< ReferenceType * >( type2 );
    85                 if ( (refType1 || refType2) && (! refType1 || ! refType2) ) {
    86                         // handle the case where exactly one of the types is a reference type specially
    87                         if ( refType1 ) {
    88                                 return handleReference( refType1, type2, widenFirst, widenSecond, indexer, env, openVars );
    89                         } else if ( refType2 ) {
    90                                 return handleReference( refType2, type1, widenSecond, widenFirst, indexer, env, openVars );
    91                         }
    92                 }
    93 
    9456                type1->accept( visitor );
    9557                Type *result = visitor.get_result();
     
    180142        }
    181143
    182         template< typename Pointer >
    183         void CommonType::getCommonWithVoidPointer( Pointer* voidPointer, Pointer* otherPointer ) {
     144        void CommonType::getCommonWithVoidPointer( PointerType* voidPointer, PointerType* otherPointer ) {
    184145                if ( TypeInstType* var = dynamic_cast< TypeInstType* >( otherPointer->get_base() ) ) {
    185146                        OpenVarSet::const_iterator entry = openVars.find( var->get_name() );
     
    227188
    228189        void CommonType::visit( __attribute((unused)) ArrayType *arrayType ) {}
    229 
    230         void CommonType::visit( ReferenceType *refType ) {
    231                 if ( ReferenceType *otherRef = dynamic_cast< ReferenceType* >( type2 ) ) {
    232                         if ( widenFirst && dynamic_cast< VoidType* >( otherRef->get_base() ) && ! isFtype(refType->get_base()) ) {
    233                                 getCommonWithVoidPointer( otherRef, refType );
    234                         } else if ( widenSecond && dynamic_cast< VoidType* >( refType->get_base() ) && ! isFtype(otherRef->get_base()) ) {
    235                                 getCommonWithVoidPointer( refType, otherRef );
    236                         } else if ( ( refType->get_base()->get_qualifiers() >= otherRef->get_base()->get_qualifiers() || widenFirst )
    237                                            && ( refType->get_base()->get_qualifiers() <= otherRef->get_base()->get_qualifiers() || widenSecond ) ) {
    238                                 Type::Qualifiers tq1 = refType->get_base()->get_qualifiers(), tq2 = otherRef->get_base()->get_qualifiers();
    239                                 refType->get_base()->get_qualifiers() = Type::Qualifiers();
    240                                 otherRef->get_base()->get_qualifiers() = Type::Qualifiers();
    241                                 AssertionSet have, need;
    242                                 OpenVarSet newOpen( openVars );
    243                                 if ( unifyExact( refType->get_base(), otherRef->get_base(), env, have, need, newOpen, indexer ) ) {
    244                                         if ( tq1 < tq2 ) {
    245                                                 result = refType->clone();
    246                                         } else {
    247                                                 result = otherRef->clone();
    248                                         } // if
    249                                         result->get_qualifiers() = tq1 | tq2;
    250                                 } else {
    251                                         /// std::cout << "place for ptr-to-type" << std::endl;
    252                                 } // if
    253                                 refType->get_base()->get_qualifiers() = tq1;
    254                                 otherRef->get_base()->get_qualifiers() = tq2;
    255                         } // if
    256                 } else if ( widenSecond && dynamic_cast< ZeroType* >( type2 ) ) {
    257                         result = refType->clone();
    258                         result->get_qualifiers() |= type2->get_qualifiers();
    259                 } // if
    260         }
    261 
    262190        void CommonType::visit( __attribute((unused)) FunctionType *functionType ) {}
    263191        void CommonType::visit( __attribute((unused)) StructInstType *aggregateUseType ) {}
     
    267195                if ( dynamic_cast< BasicType * >( type2 ) || dynamic_cast< ZeroType* >( type2 ) || dynamic_cast< OneType* >( type2 ) ) {
    268196                        // reuse BasicType, EnumInstType code by swapping type2 with enumInstType
    269                         ValueGuard< Type * > temp( type2 );
     197                        Type * temp = type2;
    270198                        type2 = enumInstType;
    271                         temp.old->accept( *this );
     199                        temp->accept( *this );
     200                        type2 = temp;
    272201                } // if
    273202        }
  • src/ResolvExpr/ConversionCost.cc

    r9a1e509 r3d4b23fa  
    5757                } else if ( dynamic_cast< VoidType* >( dest ) ) {
    5858                        return Cost( 0, 0, 1 );
    59                 } else if ( ReferenceType * refType = dynamic_cast< ReferenceType * > ( dest ) ) {
    60                         // std::cerr << "conversionCost: dest is reference" << std::endl;
    61                         return convertToReferenceCost( src, refType, indexer, env );
    6259                } else {
    6360                        ConversionCost converter( dest, indexer, env );
     
    6966                        } // if
    7067                } // if
    71         }
    72 
    73         Cost convertToReferenceCost( Type * src, ReferenceType * dest, const SymTab::Indexer & indexer, const TypeEnvironment & env ) {
    74                 // std::cerr << "convert to reference cost..." << std::endl;
    75                 if ( ReferenceType *srcAsRef = dynamic_cast< ReferenceType * >( src ) ) { // pointer-like conversions between references
    76                         // std::cerr << "converting between references" << std::endl;
    77                         if ( srcAsRef->get_base()->get_qualifiers() <= dest->get_base()->get_qualifiers() && typesCompatibleIgnoreQualifiers( srcAsRef->get_base(), dest->get_base(), indexer, env ) ) {
    78                                 return Cost( 0, 0, 1 );
    79                         } else {  // xxx - this discards reference qualifiers from consideration -- reducing qualifiers is a safe conversion; is this right?
    80                                 int assignResult = ptrsAssignable( srcAsRef->get_base(), dest->get_base(), env );
    81                                 if ( assignResult < 0 ) {
    82                                         return Cost( 0, 0, 1 );
    83                                 } else if ( assignResult > 0 ) {
    84                                         return Cost( 1, 0, 0 );
    85                                 } // if
    86                         } // if
    87                 } else if ( typesCompatibleIgnoreQualifiers( src, dest->get_base(), indexer, env ) ) {
    88                         // std::cerr << "converting compatible base type" << std::endl;
    89                         if ( src->get_lvalue() ) {
    90                                 // std::cerr << "lvalue to reference conversion" << std::endl;
    91                                 // lvalue-to-reference conversion:  cv lvalue T => cv T &
    92                                 if ( src->get_qualifiers() == dest->get_base()->get_qualifiers() ) {
    93                                         return Cost( 0, 0, 1 ); // cost needs to be non-zero to add cast
    94                                 } if ( src->get_qualifiers() < dest->get_base()->get_qualifiers() ) {
    95                                         return Cost( 0, 0, 2 ); // cost needs to be higher than previous cast to differentiate adding qualifiers vs. keeping same
    96                                 } else {
    97                                         return Cost( 1, 0, 0 );
    98                                 }
    99                         } else if ( dest->get_base()->get_const() ) {
    100                                 // std::cerr << "rvalue to const ref conversion" << std::endl;
    101                                 // rvalue-to-const-reference conversion: T => const T &
    102                                 return Cost( 0, 0, 1 );
    103                         } else {
    104                                 // std::cerr << "rvalue to non-const reference conversion" << std::endl;
    105                                 // rvalue-to-reference conversion: T => T &
    106                                 return Cost( 1, 0, 0 );
    107                         }
    108                 } else {
    109                         // std::cerr << "attempting to convert from incompatible base type -- fail" << std::endl;
    110                 }
    111                 return Cost::infinity;
    11268        }
    11369
     
    217173                        if ( pointerType->get_base()->get_qualifiers() <= destAsPtr->get_base()->get_qualifiers() && typesCompatibleIgnoreQualifiers( pointerType->get_base(), destAsPtr->get_base(), indexer, env ) ) {
    218174                                cost = Cost( 0, 0, 1 );
    219                         } else {  // xxx - this discards pointer qualifiers from consideration -- reducing qualifiers is a safe conversion; is this right?
     175                        } else {
    220176                                int assignResult = ptrsAssignable( pointerType->get_base(), destAsPtr->get_base(), env );
    221177                                if ( assignResult < 0 ) {
     
    231187
    232188        void ConversionCost::visit(__attribute((unused)) ArrayType *arrayType) {}
    233 
    234         void ConversionCost::visit(ReferenceType *refType) {
    235                 // Note: dest can never be a reference, since it would have been caught in an earlier check
    236                 assert( ! dynamic_cast< ReferenceType * >( dest ) );
    237                 // convert reference to rvalue: cv T1 & => T2
    238                 // recursively compute conversion cost from T1 to T2.
    239                 // cv can be safely dropped because of 'implicit dereference' behavior.
    240                 refType->get_base()->accept( *this );
    241         }
    242 
    243189        void ConversionCost::visit(__attribute((unused)) FunctionType *functionType) {}
    244190
     
    262208                static Type::Qualifiers q;
    263209                static BasicType integer( q, BasicType::SignedInt );
    264                 integer.accept( *this );  // safe if dest >= int
     210                integer.accept( *this );
    265211                if ( cost < Cost( 1, 0, 0 ) ) {
    266212                        cost.incSafe();
  • src/ResolvExpr/ConversionCost.h

    r9a1e509 r3d4b23fa  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // ConversionCost.h --
     7// ConversionCost.h -- 
    88//
    99// Author           : Richard C. Bilson
     
    2626          public:
    2727                ConversionCost( Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env );
    28 
     28 
    2929                Cost get_cost() const { return cost; }
    3030
     
    3333                virtual void visit(PointerType *pointerType);
    3434                virtual void visit(ArrayType *arrayType);
    35                 virtual void visit(ReferenceType *refType);
    3635                virtual void visit(FunctionType *functionType);
    3736                virtual void visit(StructInstType *aggregateUseType);
     
    5049                const TypeEnvironment &env;
    5150        };
    52 
    53         Cost convertToReferenceCost( Type * src, ReferenceType * dest, const SymTab::Indexer & indexer, const TypeEnvironment & env );
    5451} // namespace ResolvExpr
    5552
  • src/ResolvExpr/Unify.cc

    r9a1e509 r3d4b23fa  
    4242                virtual void visit(PointerType *pointerType);
    4343                virtual void visit(ArrayType *arrayType);
    44                 virtual void visit(ReferenceType *refType);
    4544                virtual void visit(FunctionType *functionType);
    4645                virtual void visit(StructInstType *aggregateUseType);
     
    429428        }
    430429
    431         void Unify::visit(ReferenceType *refType) {
    432                 if ( ReferenceType *otherRef = dynamic_cast< ReferenceType* >( type2 ) ) {
    433                         result = unifyExact( refType->get_base(), otherRef->get_base(), env, needAssertions, haveAssertions, openVars, WidenMode( false, false ), indexer );
    434                         markAssertions( haveAssertions, needAssertions, refType );
    435                         markAssertions( haveAssertions, needAssertions, otherRef );
    436                 } // if
    437         }
    438 
    439430        void Unify::visit(ArrayType *arrayType) {
    440431                ArrayType *otherArray = dynamic_cast< ArrayType* >( type2 );
  • src/SymTab/Autogen.cc

    r9a1e509 r3d4b23fa  
    125125        FunctionType * genDefaultType( Type * paramType ) {
    126126                FunctionType *ftype = new FunctionType( Type::Qualifiers(), false );
    127                 ObjectDecl *dstParam = new ObjectDecl( "_dst", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new ReferenceType( Type::Qualifiers(), paramType->clone() ), nullptr );
     127                ObjectDecl *dstParam = new ObjectDecl( "_dst", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), paramType->clone() ), nullptr );
    128128                ftype->get_parameters().push_back( dstParam );
    129129
     
    176176                        FunctionType * ftype = funcDecl->get_functionType();
    177177                        assert( ! ftype->get_parameters().empty() );
    178                         Type * t = InitTweak::getPointerBase( ftype->get_parameters().front()->get_type() );
    179                         assert( t );
     178                        Type * t = safe_dynamic_cast< PointerType * >( ftype->get_parameters().front()->get_type() )->get_base();
    180179                        map.insert( Mangler::mangleType( t ), true );
    181180                }
     
    298297        /// generates a single struct member operation (constructor call, destructor call, assignment call)
    299298        void makeStructMemberOp( ObjectDecl * dstParam, Expression * src, DeclarationWithType * field, FunctionDecl * func, bool isDynamicLayout, bool forward = true ) {
     299                ObjectDecl * returnVal = NULL;
     300                if ( ! func->get_functionType()->get_returnVals().empty() ) {
     301                        returnVal = dynamic_cast<ObjectDecl*>( func->get_functionType()->get_returnVals().front() );
     302                }
     303
    300304                InitTweak::InitExpander srcParam( src );
    301305
    302                 // assign to destination
    303                 Expression *dstselect = new MemberExpr( field, new CastExpr( new VariableExpr( dstParam ), safe_dynamic_cast< ReferenceType* >( dstParam->get_type() )->get_base()->clone() ) );
     306                // assign to destination (and return value if generic)
     307                UntypedExpr *derefExpr = UntypedExpr::createDeref( new VariableExpr( dstParam ) );
     308                Expression *dstselect = new MemberExpr( field, derefExpr );
    304309                genImplicitCall( srcParam, dstselect, func->get_name(), back_inserter( func->get_statements()->get_kids() ), field, forward );
     310
     311                if ( isDynamicLayout && returnVal ) {
     312                        // xxx - there used to be a dereference on returnVal, but this seems to have been wrong?
     313                        Expression *retselect = new MemberExpr( field, new VariableExpr( returnVal ) );
     314                        genImplicitCall( srcParam, retselect, func->get_name(), back_inserter( func->get_statements()->get_kids() ), field, forward );
     315                } // if
    305316        }
    306317
     
    456467                                        // our inheritance model. I think the correct way to handle this is to
    457468                                        // cast the structure to the type of the member and let the resolver
    458                                         // figure out whether it's valid/choose the correct unnamed member
     469                                        // figure out whether it's valid and have a pass afterwards that fixes
     470                                        // the assignment to use pointer arithmetic with the offset of the
     471                                        // member, much like how generic type members are handled.
    459472                                        continue;
    460473                                }
     
    472485        void makeUnionFieldsAssignment( ObjectDecl * srcParam, ObjectDecl * dstParam, OutputIterator out ) {
    473486                UntypedExpr *copy = new UntypedExpr( new NameExpr( "__builtin_memcpy" ) );
    474                 copy->get_args().push_back( new AddressExpr( new VariableExpr( dstParam ) ) );
     487                copy->get_args().push_back( new VariableExpr( dstParam ) );
    475488                copy->get_args().push_back( new AddressExpr( new VariableExpr( srcParam ) ) );
    476489                copy->get_args().push_back( new SizeofExpr( srcParam->get_type()->clone() ) );
     
    484497                ObjectDecl * dstParam = safe_dynamic_cast< ObjectDecl * >( ftype->get_parameters().front() );
    485498                ObjectDecl * srcParam = safe_dynamic_cast< ObjectDecl * >( ftype->get_parameters().back() );
     499                ObjectDecl * returnVal = nullptr;
     500                if ( ! ftype->get_returnVals().empty() ) {
     501                        returnVal = safe_dynamic_cast< ObjectDecl * >( ftype->get_returnVals().front() );
     502                }
    486503
    487504                makeUnionFieldsAssignment( srcParam, dstParam, back_inserter( funcDecl->get_statements()->get_kids() ) );
    488                 if ( InitTweak::isAssignment( funcDecl->get_name() ) ) {
    489                         // also generate return statement in assignment
     505                if ( returnVal ) {
    490506                        funcDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new VariableExpr( srcParam ) ) );
    491507                }
     
    496512                // Make function polymorphic in same parameters as generic union, if applicable
    497513                const std::list< TypeDecl* > & typeParams = aggregateDecl->get_parameters(); // List of type variables to be placed on the generated functions
    498 
     514               
    499515                // default ctor/dtor need only first parameter
    500516                // void ?{}(T *); void ^?{}(T *);
  • src/SymTab/Autogen.h

    r9a1e509 r3d4b23fa  
    4343        template< typename OutputIterator >
    4444        Statement * genScalarCall( InitTweak::InitExpander & srcParam, Expression *dstParam, const std::string & fname, OutputIterator out, Type * type, bool addCast = false ) {
    45                 // want to be able to generate assignment, ctor, and dtor generically,
    46                 // so fname is either ?=?, ?{}, or ^?{}
    47                 UntypedExpr *fExpr = new UntypedExpr( new NameExpr( fname ) );
     45        // want to be able to generate assignment, ctor, and dtor generically,
     46        // so fname is either ?=?, ?{}, or ^?{}
     47        UntypedExpr *fExpr = new UntypedExpr( new NameExpr( fname ) );
    4848
    49                 if ( addCast ) {
    50                         // cast to T& with qualifiers removed, so that qualified objects can be constructed
    51                         // and destructed with the same functions as non-qualified objects.
    52                         // unfortunately, lvalue is considered a qualifier. For AddressExpr to resolve, its argument
    53                         // must have an lvalue qualified type, so remove all qualifiers except lvalue. If we ever
    54                         // remove lvalue as a qualifier, this can change to
    55                         //   type->get_qualifiers() = Type::Qualifiers();
    56                         assert( type );
    57                         Type * castType = type->clone();
    58                         castType->get_qualifiers() -= Type::Qualifiers( Type::Lvalue | Type::Const | Type::Volatile | Type::Restrict | Type::Atomic );
    59                         // castType->set_lvalue( true ); // xxx - might not need this
    60                         dstParam = new CastExpr( dstParam, new ReferenceType( Type::Qualifiers(), castType ) );
    61                 }
    62                 fExpr->get_args().push_back( dstParam );
     49        // do something special for unnamed members
     50        dstParam = new AddressExpr( dstParam );
     51        if ( addCast ) {
     52                // cast to T* with qualifiers removed, so that qualified objects can be constructed
     53                // and destructed with the same functions as non-qualified objects.
     54                // unfortunately, lvalue is considered a qualifier. For AddressExpr to resolve, its argument
     55                // must have an lvalue qualified type, so remove all qualifiers except lvalue. If we ever
     56                // remove lvalue as a qualifier, this can change to
     57                //   type->get_qualifiers() = Type::Qualifiers();
     58                assert( type );
     59                Type * castType = type->clone();
     60                castType->get_qualifiers() -= Type::Qualifiers( Type::Const | Type::Volatile | Type::Restrict | Type::Atomic );
     61                castType->set_lvalue( true ); // xxx - might not need this
     62                dstParam = new CastExpr( dstParam, new PointerType( Type::Qualifiers(), castType ) );
     63        }
     64        fExpr->get_args().push_back( dstParam );
    6365
    64                 Statement * listInit = srcParam.buildListInit( fExpr );
     66        Statement * listInit = srcParam.buildListInit( fExpr );
    6567
    66                 std::list< Expression * > args = *++srcParam;
    67                 fExpr->get_args().splice( fExpr->get_args().end(), args );
     68        std::list< Expression * > args = *++srcParam;
     69        fExpr->get_args().splice( fExpr->get_args().end(), args );
    6870
    69                 *out++ = new ExprStmt( noLabels, fExpr );
     71        *out++ = new ExprStmt( noLabels, fExpr );
    7072
    71                 srcParam.clearArrayIndices();
     73        srcParam.clearArrayIndices();
    7274
    73                 return listInit;
     75        return listInit;
    7476        }
    7577
     
    107109
    108110                UntypedExpr *inc = new UntypedExpr( update );
    109                 inc->get_args().push_back( new VariableExpr( index ) );
     111                inc->get_args().push_back( new AddressExpr( new VariableExpr( index ) ) );
    110112
    111113                UntypedExpr *dstIndex = new UntypedExpr( new NameExpr( "?[?]" ) );
  • src/SymTab/Indexer.cc

    r9a1e509 r3d4b23fa  
    158158                                assert( ! params.empty() );
    159159                                // use base type of pointer, so that qualifiers on the pointer type aren't considered.
    160                                 Type * base = InitTweak::getPointerBase( params.front()->get_type() );
    161                                 assert( base );
     160                                Type * base = safe_dynamic_cast< PointerType * >( params.front()->get_type() )->get_base();
    162161                                funcMap[ Mangler::mangle( base ) ] += function;
    163162                        } else {
  • src/SymTab/Validate.cc

    r9a1e509 r3d4b23fa  
    823823                                throw SemanticError( "Constructors, destructors, and assignment functions require at least one parameter ", funcDecl );
    824824                        }
    825                         ReferenceType * refType = dynamic_cast< ReferenceType * >( params.front()->get_type() );
    826                         if ( ! refType ) {
    827                                 throw SemanticError( "First parameter of a constructor, destructor, or assignment function must be a reference ", funcDecl );
     825                        PointerType * ptrType = dynamic_cast< PointerType * >( params.front()->get_type() );
     826                        if ( ! ptrType || ptrType->is_array() ) {
     827                                throw SemanticError( "First parameter of a constructor, destructor, or assignment function must be a pointer ", funcDecl );
    828828                        }
    829829                        if ( InitTweak::isCtorDtor( funcDecl->get_name() ) && returnVals.size() != 0 ) {
  • src/SynTree/AddressExpr.cc

    r9a1e509 r3d4b23fa  
    1818#include "Common/utility.h"
    1919
    20 // Address expressions are typed based on the following inference rules:
    21 //    E : lvalue T  &..& (n references)
    22 //   &E :        T *&..& (n references)
    23 //
    24 //    E : T  &..&        (m references)
    25 //   &E : T *&..&        (m-1 references)
    26 //
    27 // That is, lvalues becomes
    28 
    29 namespace {
    30         Type * addrType( Type * type ) {
    31                 if ( ReferenceType * refType = dynamic_cast< ReferenceType * >( type ) ) {
    32                         return new ReferenceType( refType->get_qualifiers(), addrType( refType->get_base() ) );
    33                 } else {
    34                         return new PointerType( Type::Qualifiers(), type->clone() );
    35                 }
    36         }
    37 }
    38 
    3920AddressExpr::AddressExpr( Expression *arg, Expression *_aname ) : Expression( _aname ), arg( arg ) {
    4021        if ( arg->has_result() ) {
    41                 if ( arg->get_result()->get_lvalue() ) {
    42                         // lvalue, retains all layers of reference and gains a pointer inside the references
    43                         set_result( addrType( arg->get_result() ) );
    44                 } else {
    45                         // taking address of non-lvalue -- must be a reference, loses one layer of reference
    46                         ReferenceType * refType = safe_dynamic_cast< ReferenceType * >( arg->get_result() );
    47                         set_result( addrType( refType->get_base() ) );
    48                 }
    49                 // result of & is never an lvalue
    50                 get_result()->set_lvalue( false );
     22                set_result( new PointerType( Type::Qualifiers(), arg->get_result()->clone() ) );
    5123        }
    5224}
  • src/SynTree/Expression.cc

    r9a1e509 r3d4b23fa  
    335335namespace {
    336336        TypeSubstitution makeSub( Type * t ) {
    337                 if ( ReferenceType * refType = dynamic_cast< ReferenceType * >( t ) ) {
    338                         return makeSub( refType->get_base() );
    339                 } else if ( StructInstType * aggInst = dynamic_cast< StructInstType * >( t ) ) {
     337                if ( StructInstType * aggInst = dynamic_cast< StructInstType * >( t ) ) {
    340338                        return TypeSubstitution( aggInst->get_baseParameters()->begin(), aggInst->get_baseParameters()->end(), aggInst->get_parameters().begin() );
    341339                } else if ( UnionInstType * aggInst = dynamic_cast< UnionInstType * >( t ) ) {
     
    402400        if ( Type * type = expr->get_result() ) {
    403401                Type * base = InitTweak::getPointerBase( type );
    404                 assertf( base, "expected pointer type in dereference (type was %s)", toString( type ).c_str() );
    405                 ret->set_result( new ReferenceType( Type::Qualifiers(), base->clone() ) );
     402                if ( ! base ) {
     403                        std::cerr << type << std::endl;
     404                }
     405                assertf( base, "expected pointer type in dereference\n" );
     406                ret->set_result( maybeClone( base ) );
    406407        }
    407408        return ret;
  • src/SynTree/Mutator.cc

    r9a1e509 r3d4b23fa  
    473473}
    474474
    475 Type *Mutator::mutate( ReferenceType *refType ) {
    476         mutateAll( refType->get_forall(), *this );
    477         refType->set_base( maybeMutate( refType->get_base(), *this ) );
    478         return refType;
    479 }
    480 
    481475Type *Mutator::mutate( FunctionType *functionType ) {
    482476        mutateAll( functionType->get_forall(), *this );
  • src/SynTree/Mutator.h

    r9a1e509 r3d4b23fa  
    9292        virtual Type* mutate( PointerType *pointerType );
    9393        virtual Type* mutate( ArrayType *arrayType );
    94         virtual Type* mutate( ReferenceType *refType );
    9594        virtual Type* mutate( FunctionType *functionType );
    9695        virtual Type* mutate( StructInstType *aggregateUseType );
  • src/SynTree/SynTree.h

    r9a1e509 r3d4b23fa  
    101101class PointerType;
    102102class ArrayType;
    103 class ReferenceType;
    104103class FunctionType;
    105104class ReferenceToType;
  • src/SynTree/Type.cc

    r9a1e509 r3d4b23fa  
    6565const char * Type::QualifiersNames[] = { "const", "restrict", "volatile", "lvalue", "mutex", "_Atomic" };
    6666
    67 Type * Type::stripDeclarator() {
     67Type *Type::stripDeclarator() {
    6868        Type * type = this;
    6969        while ( Type * at = InitTweak::getPointerBase( type ) ) {
    7070                type = at;
    71         }
    72         return type;
    73 }
    74 
    75 Type * Type::stripReferences() {
    76         Type * type = this;
    77         while ( ReferenceType * ref = dynamic_cast<ReferenceType *>( type ) ) {
    78                 type = ref->get_base();
    7971        }
    8072        return type;
  • src/SynTree/Type.h

    r9a1e509 r3d4b23fa  
    158158
    159159        /// return type without outer pointers and arrays
    160         Type * stripDeclarator();
    161 
    162         /// return type without outer references
    163         Type * stripReferences();
     160        Type *stripDeclarator();
    164161
    165162        virtual bool isComplete() const { return true; }
     
    252249        bool is_array() const { return isStatic || isVarLen || dimension; }
    253250
    254         virtual bool isComplete() const { return ! isVarLen; }
    255 
    256251        virtual PointerType *clone() const { return new PointerType( *this ); }
    257252        virtual void accept( Visitor & v ) { v.visit( this ); }
     
    295290};
    296291
    297 class ReferenceType : public Type {
    298 public:
    299         ReferenceType( const Type::Qualifiers & tq, Type *base, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
    300         ReferenceType( const ReferenceType & );
    301         virtual ~ReferenceType();
    302 
    303         Type *get_base() { return base; }
    304         void set_base( Type *newValue ) { base = newValue; }
    305 
    306         virtual ReferenceType *clone() const { return new ReferenceType( *this ); }
    307         virtual void accept( Visitor & v ) { v.visit( this ); }
    308         virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
    309         virtual void print( std::ostream & os, int indent = 0 ) const;
    310 private:
    311         Type *base;
    312 };
    313 
    314292class FunctionType : public Type {
    315293  public:
  • src/SynTree/Visitor.cc

    r9a1e509 r3d4b23fa  
    363363void Visitor::visit( PointerType *pointerType ) {
    364364        acceptAll( pointerType->get_forall(), *this );
    365         // xxx - should PointerType visit/mutate dimension?
    366365        maybeAccept( pointerType->get_base(), *this );
    367366}
     
    371370        maybeAccept( arrayType->get_dimension(), *this );
    372371        maybeAccept( arrayType->get_base(), *this );
    373 }
    374 
    375 void Visitor::visit( ReferenceType *refType ) {
    376         acceptAll( refType->get_forall(), *this );
    377         maybeAccept( refType->get_base(), *this );
    378372}
    379373
  • src/SynTree/Visitor.h

    r9a1e509 r3d4b23fa  
    9595        virtual void visit( PointerType *pointerType );
    9696        virtual void visit( ArrayType *arrayType );
    97         virtual void visit( ReferenceType *refType );
    9897        virtual void visit( FunctionType *functionType );
    9998        virtual void visit( StructInstType *aggregateUseType );
  • src/SynTree/module.mk

    r9a1e509 r3d4b23fa  
    2020       SynTree/PointerType.cc \
    2121       SynTree/ArrayType.cc \
    22        SynTree/ReferenceType.cc \
    2322       SynTree/FunctionType.cc \
    2423       SynTree/ReferenceToType.cc \
  • src/libcfa/containers/maybe

    r9a1e509 r3d4b23fa  
    2929
    3030forall(otype T)
    31 void ?{}(maybe(T) & this);
     31void ?{}(maybe(T) * this);
    3232
    3333forall(otype T)
    34 void ?{}(maybe(T) & this, T value);
     34void ?{}(maybe(T) * this, T value);
    3535
    3636forall(otype T)
    37 void ?{}(maybe(T) & this, maybe(T) other);
     37void ?{}(maybe(T) * this, maybe(T) other);
    3838
    3939forall(otype T)
    40 void ^?{}(maybe(T) & this);
     40void ^?{}(maybe(T) * this);
    4141
    4242forall(otype T)
    43 maybe(T) ?=?(maybe(T) & this, maybe(T) other);
     43maybe(T) ?=?(maybe(T) * this, maybe(T) other);
    4444
    4545forall(otype T)
  • src/libcfa/containers/maybe.c

    r9a1e509 r3d4b23fa  
    1919
    2020forall(otype T)
    21 void ?{}(maybe(T) & this) {
    22         this.has_value = false;
     21void ?{}(maybe(T) * this) {
     22        this->has_value = false;
    2323}
    2424
    2525forall(otype T)
    26 void ?{}(maybe(T) & this, T value) {
    27         this.has_value = true;
    28         (this.value){value};
     26void ?{}(maybe(T) * this, T value) {
     27        this->has_value = true;
     28        (&this->value){value};
    2929}
    3030
    3131forall(otype T)
    32 void ?{}(maybe(T) & this, maybe(T) other) {
    33         this.has_value = other.has_value;
     32void ?{}(maybe(T) * this, maybe(T) other) {
     33        this->has_value = other.has_value;
    3434        if (other.has_value) {
    35                 (this.value){other.value};
     35                (&this->value){other.value};
    3636        }
    3737}
    3838
    3939forall(otype T)
    40 maybe(T) ?=?(maybe(T) & this, maybe(T) that) {
    41         if (this.has_value & that.has_value) {
    42                 this.value = that.value;
    43         } else if (this.has_value) {
    44                 ^(this.value){};
    45                 this.has_value = false;
     40maybe(T) ?=?(maybe(T) * this, maybe(T) that) {
     41        if (this->has_value & that.has_value) {
     42                this->value = that.value;
     43        } else if (this->has_value) {
     44                ^(&this->value){};
     45                this->has_value = false;
    4646        } else if (that.has_value) {
    47                 this.has_value = true;
    48                 (this.value){that.value};
     47                this->has_value = true;
     48                (&this->value){that.value};
    4949        }
    50         return this;
    5150}
    5251
    5352forall(otype T)
    54 void ^?{}(maybe(T) & this) {
    55         if (this.has_value) {
    56                 ^(this.value){};
     53void ^?{}(maybe(T) * this) {
     54        if (this->has_value) {
     55                ^(&this->value){};
    5756        }
    5857}
     
    9089        } else {
    9190                this->has_value = true;
    92                 (this->value){value};
     91                (&this->value){value};
    9392        }
    9493}
     
    9897        if (this->has_value) {
    9998                this->has_value = false;
    100                 ^(this->value){};
     99                ^(&this->value){};
    101100        }
    102101}
  • src/libcfa/containers/vector

    r9a1e509 r3d4b23fa  
    3131
    3232forall(otype T)
    33 void ?{}(heap_allocator(T)& this);
     33void ?{}(heap_allocator(T)* this);
    3434
    3535forall(otype T)
    36 void ?{}(heap_allocator(T)& this, heap_allocator(T) rhs);
     36void ?{}(heap_allocator(T)* this, heap_allocator(T) rhs);
    3737
    3838forall(otype T)
    39 heap_allocator(T) ?=?(heap_allocator(T)& this, heap_allocator(T) rhs);
     39heap_allocator(T) ?=?(heap_allocator(T)* this, heap_allocator(T) rhs);
    4040
    4141forall(otype T)
    42 void ^?{}(heap_allocator(T)& this);
     42void ^?{}(heap_allocator(T)* this);
    4343
    4444forall(otype T)
     
    6565//Initialization
    6666forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    67 void ?{}(vector(T, allocator_t)& this);
     67void ?{}(vector(T, allocator_t)* this);
    6868
    6969forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    70 void ?{}(vector(T, allocator_t)& this, vector(T, allocator_t) rhs);
     70void ?{}(vector(T, allocator_t)* this, vector(T, allocator_t) rhs);
    7171
    7272forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    73 vector(T, allocator_t) ?=?(vector(T, allocator_t)& this, vector(T, allocator_t) rhs);
     73vector(T, allocator_t) ?=?(vector(T, allocator_t)* this, vector(T, allocator_t) rhs);
    7474
    7575forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    76 void ^?{}(vector(T, allocator_t)& this);
     76void ^?{}(vector(T, allocator_t)* this);
    7777
    7878forall(otype T, otype allocator_t = heap_allocator(T) | allocator_c(T, allocator_t))
  • src/libcfa/containers/vector.c

    r9a1e509 r3d4b23fa  
    2424//Initialization
    2525forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    26 void ?{}(vector(T, allocator_t)& this)
     26void ?{}(vector(T, allocator_t)* this)
    2727{
    28         (this.storage){};
    29         this.size = 0;
     28        (&this->storage){};
     29        this->size = 0;
    3030}
    3131
    3232forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    33 void ?{}(vector(T, allocator_t)& this, vector(T, allocator_t) rhs)
     33void ?{}(vector(T, allocator_t)* this, vector(T, allocator_t) rhs)
    3434{
    35         (this.storage){ rhs.storage };
    36         copy_internal(&this, &rhs);
     35        (&this->storage){ rhs.storage };
     36        copy_internal(this, &rhs);
    3737}
    3838
     
    4646
    4747forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
    48 void ^?{}(vector(T, allocator_t)& this)
     48void ^?{}(vector(T, allocator_t)* this)
    4949{
    50         clear(&this);
    51         ^(this.storage){};
     50        clear(this);
     51        ^(&this->storage){};
    5252}
    5353
     
    6666{
    6767        this->size--;
    68         ^(data(&this->storage)[this->size]){};
     68        ^(&data(&this->storage)[this->size]){};
    6969}
    7070
     
    7474        for(size_t i = 0; i < this->size; i++)
    7575        {
    76                 ^(data(&this->storage)[this->size]){};
     76                ^(&data(&this->storage)[this->size]){};
    7777        }
    7878        this->size = 0;
     
    8787        this->size = other->size;
    8888        for(size_t i = 0; i < this->size; i++) {
    89                 (data(&this->storage)[this->size]){ data(&other->storage)[other->size] };
     89                (&data(&this->storage)[this->size]){ data(&other->storage)[other->size] };
    9090        }
    9191}
     
    9494//Allocator
    9595forall(otype T)
    96 void ?{}(heap_allocator(T)& this)
     96void ?{}(heap_allocator(T)* this)
    9797{
    98         this.storage = 0;
    99         this.capacity = 0;
     98        this->storage = 0;
     99        this->capacity = 0;
    100100}
    101101
    102102forall(otype T)
    103 void ?{}(heap_allocator(T)& this, heap_allocator(T) rhs)
     103void ?{}(heap_allocator(T)* this, heap_allocator(T) rhs)
    104104{
    105         this.capacity = rhs.capacity;
    106         this.storage = (T*)realloc((void*)this.storage, this.capacity * sizeof(T));
     105        this->capacity = rhs.capacity;
     106        this->storage = (T*)realloc((void*)this->storage, this->capacity * sizeof(T));
    107107}
    108108
    109109forall(otype T)
    110 heap_allocator(T) ?=?(heap_allocator(T)& this, heap_allocator(T) rhs)
     110heap_allocator(T) ?=?(heap_allocator(T)* this, heap_allocator(T) rhs)
    111111{
    112         this.capacity = rhs.capacity;
    113         this.storage = (T*)realloc((void*)this.storage, this.capacity * sizeof(T));
    114         return this;
     112        this->capacity = rhs.capacity;
     113        this->storage = (T*)realloc((void*)this->storage, this->capacity * sizeof(T));
     114        return *this;
    115115}
    116116
    117117forall(otype T)
    118 void ^?{}(heap_allocator(T)& this)
     118void ^?{}(heap_allocator(T)* this)
    119119{
    120         free(this.storage);
     120        free(this->storage);
    121121}
    122122
  • src/libcfa/interpose.c

    r9a1e509 r3d4b23fa  
    1010// Author           : Thierry Delisle
    1111// Created On       : Wed Mar 29 16:10:31 2017
    12 // Last Modified By :
    13 // Last Modified On :
     12// Last Modified By : 
     13// Last Modified On : 
    1414// Update Count     : 0
    1515//
     
    5050
    5151        union { generic_fptr_t fptr; void* ptr; } originalFunc;
    52 
     52       
    5353        #if defined( _GNU_SOURCE )
    5454                if ( version ) {
     
    6060                originalFunc.ptr = dlsym( library, symbol );
    6161        #endif // _GNU_SOURCE
    62 
     62       
    6363        error = dlerror();
    64         if ( error ) abortf( "interpose_symbol : internal error, %s\n", error );
     64        if ( error ) abortf( "interpose_symbol : internal error, %s\n", error ); 
    6565
    6666        return originalFunc.fptr;
     
    7575forall(dtype T)
    7676static inline void assign_ptr( T** symbol_ptr, const char * symbol_name, const char * version) {
    77         union {
     77        union { 
    7878                generic_fptr_t gp;
    79                 T* tp;
     79                T* tp; 
    8080        } u;
    8181
  • src/libcfa/stdlib

    r9a1e509 r3d4b23fa  
    134134
    135135// allocation/deallocation and constructor/destructor, non-array types
    136 forall( dtype T | sized(T), ttype Params | { void ?{}( T &, Params ); } ) T * new( Params p );
    137 forall( dtype T | { void ^?{}( T & ); } ) void delete( T * ptr );
    138 forall( dtype T, ttype Params | { void ^?{}( T & ); void delete( Params ); } ) void delete( T * ptr, Params rest );
     136forall( dtype T | sized(T), ttype Params | { void ?{}( T *, Params ); } ) T * new( Params p );
     137forall( dtype T | { void ^?{}( T * ); } ) void delete( T * ptr );
     138forall( dtype T, ttype Params | { void ^?{}( T * ); void delete( Params ); } ) void delete( T * ptr, Params rest );
    139139
    140140// allocation/deallocation and constructor/destructor, array types
    141 forall( dtype T | sized(T), ttype Params | { void ?{}( T &, Params ); } ) T * anew( size_t dim, Params p );
    142 forall( dtype T | sized(T) | { void ^?{}( T & ); } ) void adelete( size_t dim, T arr[] );
    143 forall( dtype T | sized(T) | { void ^?{}( T & ); }, ttype Params | { void adelete( Params ); } ) void adelete( size_t dim, T arr[], Params rest );
     141forall( dtype T | sized(T), ttype Params | { void ?{}( T *, Params ); } ) T * anew( size_t dim, Params p );
     142forall( dtype T | sized(T) | { void ^?{}( T * ); } ) void adelete( size_t dim, T arr[] );
     143forall( dtype T | sized(T) | { void ^?{}( T * ); }, ttype Params | { void adelete( Params ); } ) void adelete( size_t dim, T arr[], Params rest );
    144144
    145145//---------------------------------------
     
    200200double abs( double _Complex );
    201201long double abs( long double _Complex );
    202 forall( otype T | { void ?{}( T &, zero_t ); int ?<?( T, T ); T -?( T ); } )
     202forall( otype T | { void ?{}( T *, zero_t ); int ?<?( T, T ); T -?( T ); } )
    203203T abs( T );
    204204
  • src/libcfa/stdlib.c

    r9a1e509 r3d4b23fa  
    3434        if ( nlen > olen ) {                                                            // larger ?
    3535                memset( nptr + olen, (int)fill, nlen - olen );  // initialize added storage
    36         } //
     36        } // 
    3737    return (T *)nptr;
    3838} // alloc
    3939
    4040// allocation/deallocation and constructor/destructor, non-array types
    41 forall( dtype T | sized(T), ttype Params | { void ?{}( T &, Params ); } )
     41forall( dtype T | sized(T), ttype Params | { void ?{}( T *, Params ); } )
    4242T * new( Params p ) {
    4343        return (malloc()){ p };                                                         // run constructor
    4444} // new
    4545
    46 forall( dtype T | { void ^?{}( T & ); } )
     46forall( dtype T | { void ^?{}( T * ); } )
    4747void delete( T * ptr ) {
    4848        if ( ptr ) {                                                                            // ignore null
     
    5252} // delete
    5353
    54 forall( dtype T, ttype Params | { void ^?{}( T & ); void delete( Params ); } )
     54forall( dtype T, ttype Params | { void ^?{}( T * ); void delete( Params ); } )
    5555void delete( T * ptr, Params rest ) {
    5656        if ( ptr ) {                                                                            // ignore null
     
    6363
    6464// allocation/deallocation and constructor/destructor, array types
    65 forall( dtype T | sized(T), ttype Params | { void ?{}( T &, Params ); } )
     65forall( dtype T | sized(T), ttype Params | { void ?{}( T *, Params ); } )
    6666T * anew( size_t dim, Params p ) {
    6767        T *arr = alloc( dim );
     
    7272} // anew
    7373
    74 forall( dtype T | sized(T) | { void ^?{}( T & ); } )
     74forall( dtype T | sized(T) | { void ^?{}( T * ); } )
    7575void adelete( size_t dim, T arr[] ) {
    7676        if ( arr ) {                                                                            // ignore null
     
    8282} // adelete
    8383
    84 forall( dtype T | sized(T) | { void ^?{}( T & ); }, ttype Params | { void adelete( Params ); } )
     84forall( dtype T | sized(T) | { void ^?{}( T * ); }, ttype Params | { void adelete( Params ); } )
    8585void adelete( size_t dim, T arr[], Params rest ) {
    8686        if ( arr ) {                                                                            // ignore null
  • src/prelude/prelude.cf

    r9a1e509 r3d4b23fa  
    3030// ------------------------------------------------------------
    3131
    32 _Bool                   ?++( _Bool & ),                         ?++( volatile _Bool & );
    33 _Bool                   ?--( _Bool & ),                         ?--( volatile _Bool & );
    34 unsigned char           ?++( unsigned char & ),                 ?++( volatile unsigned char & );
    35 signed int              ?++( signed int & ),                    ?++( volatile signed int & );
    36 signed int              ?--( signed int & ),                    ?--( volatile signed int & );
    37 unsigned int            ?++( unsigned int & ),                  ?++( volatile unsigned int & );
    38 unsigned int            ?--( unsigned int & ),                  ?--( volatile unsigned int & );
    39 signed long int         ?++( signed long int & ),               ?++( volatile signed long int & );
    40 signed long int         ?--( signed long int & ),               ?--( volatile signed long int & );
    41 unsigned long int       ?++( unsigned long int & ),             ?++( volatile unsigned long int & );
    42 unsigned long int       ?--( unsigned long int & ),             ?--( volatile unsigned long int & );
    43 signed long long int    ?++( signed long long int & ),          ?++( volatile signed long long int & );
    44 signed long long int    ?--( signed long long int & ),          ?--( volatile signed long long int & );
    45 unsigned long long int  ?++( unsigned long long int & ),        ?++( volatile unsigned long long int & );
    46 unsigned long long int  ?--( unsigned long long int & ),        ?--( volatile unsigned long long int & );
    47 float                   ?++( float & ),                         ?++( volatile float & );
    48 float                   ?--( float & ),                         ?--( volatile float & );
    49 double                  ?++( double & ),                        ?++( volatile double & );
    50 double                  ?--( double & ),                        ?--( volatile double & );
    51 long double             ?++( long double & ),                   ?++( volatile long double & );
    52 long double             ?--( long double & ),                   ?--( volatile long double & );
    53 float _Complex          ?++( float _Complex & ),                ?++( volatile float _Complex & );
    54 float _Complex          ?--( float _Complex & ),                ?--( volatile float _Complex & );
    55 double _Complex         ?++( double _Complex & ),               ?++( volatile double _Complex & );
    56 double _Complex         ?--( double _Complex & ),               ?--( volatile double _Complex & );
    57 long double _Complex    ?++( long double _Complex & ),          ?++( volatile long double _Complex & );
    58 long double _Complex    ?--( long double _Complex & ),          ?--( volatile long double _Complex & );
    59 
    60 forall( dtype T | sized(T) ) T *                         ?++(                T *& );
    61 forall( dtype T | sized(T) ) const T *           ?++( const          T *& );
    62 forall( dtype T | sized(T) ) volatile T *                ?++(       volatile T *& );
    63 forall( dtype T | sized(T) ) const volatile T *  ?++( const volatile T *& );
    64 forall( dtype T | sized(T) ) T *                         ?--(                T *& );
    65 forall( dtype T | sized(T) ) const T *           ?--( const          T *& );
    66 forall( dtype T | sized(T) ) volatile T *                ?--(       volatile T *& );
    67 forall( dtype T | sized(T) ) const volatile T *  ?--( const volatile T *& );
    68 
    69 forall( dtype T | sized(T) ) T &                 ?[?](                T *,          ptrdiff_t );
    70 forall( dtype T | sized(T) ) const T &   ?[?]( const          T *,          ptrdiff_t );
    71 forall( dtype T | sized(T) ) volatile T &        ?[?](       volatile T *,          ptrdiff_t );
    72 forall( dtype T | sized(T) ) const volatile T & ?[?]( const volatile T *,           ptrdiff_t );
    73 forall( dtype T | sized(T) ) T &                 ?[?](          ptrdiff_t,                T * );
    74 forall( dtype T | sized(T) ) const T &   ?[?](          ptrdiff_t, const          T * );
    75 forall( dtype T | sized(T) ) volatile T &        ?[?](          ptrdiff_t,       volatile T * );
    76 forall( dtype T | sized(T) ) const volatile T & ?[?](           ptrdiff_t, const volatile T * );
     32_Bool                   ?++( _Bool * ),                         ?++( volatile _Bool * );
     33_Bool                   ?--( _Bool * ),                         ?--( volatile _Bool * );
     34unsigned char           ?++( unsigned char * ),                 ?++( volatile unsigned char * );
     35signed int              ?++( signed int * ),                    ?++( volatile signed int * );
     36signed int              ?--( signed int * ),                    ?--( volatile signed int * );
     37unsigned int            ?++( unsigned int * ),                  ?++( volatile unsigned int * );
     38unsigned int            ?--( unsigned int * ),                  ?--( volatile unsigned int * );
     39signed long int         ?++( signed long int * ),               ?++( volatile signed long int * );
     40signed long int         ?--( signed long int * ),               ?--( volatile signed long int * );
     41unsigned long int       ?++( unsigned long int * ),             ?++( volatile unsigned long int * );
     42unsigned long int       ?--( unsigned long int * ),             ?--( volatile unsigned long int * );
     43signed long long int    ?++( signed long long int * ),          ?++( volatile signed long long int * );
     44signed long long int    ?--( signed long long int * ),          ?--( volatile signed long long int * );
     45unsigned long long int  ?++( unsigned long long int * ),        ?++( volatile unsigned long long int * );
     46unsigned long long int  ?--( unsigned long long int * ),        ?--( volatile unsigned long long int * );
     47float                   ?++( float * ),                         ?++( volatile float * );
     48float                   ?--( float * ),                         ?--( volatile float * );
     49double                  ?++( double * ),                        ?++( volatile double * );
     50double                  ?--( double * ),                        ?--( volatile double * );
     51long double             ?++( long double * ),                   ?++( volatile long double * );
     52long double             ?--( long double * ),                   ?--( volatile long double * );
     53float _Complex          ?++( float _Complex * ),                ?++( volatile float _Complex * );
     54float _Complex          ?--( float _Complex * ),                ?--( volatile float _Complex * );
     55double _Complex         ?++( double _Complex * ),               ?++( volatile double _Complex * );
     56double _Complex         ?--( double _Complex * ),               ?--( volatile double _Complex * );
     57long double _Complex    ?++( long double _Complex * ),          ?++( volatile long double _Complex * );
     58long double _Complex    ?--( long double _Complex * ),          ?--( volatile long double _Complex * );
     59
     60forall( dtype T | sized(T) ) T *                         ?++(                T ** );
     61forall( dtype T | sized(T) ) const T *           ?++( const          T ** );
     62forall( dtype T | sized(T) ) volatile T *                ?++(       volatile T ** );
     63forall( dtype T | sized(T) ) const volatile T *  ?++( const volatile T ** );
     64forall( dtype T | sized(T) ) T *                         ?--(                T ** );
     65forall( dtype T | sized(T) ) const T *           ?--( const          T ** );
     66forall( dtype T | sized(T) ) volatile T *                ?--(       volatile T ** );
     67forall( dtype T | sized(T) ) const volatile T *  ?--( const volatile T ** );
     68
     69forall( dtype T | sized(T) ) lvalue T            ?[?](                T *,          ptrdiff_t );
     70forall( dtype T | sized(T) ) const lvalue T      ?[?]( const          T *,          ptrdiff_t );
     71forall( dtype T | sized(T) ) volatile lvalue T   ?[?](       volatile T *,          ptrdiff_t );
     72forall( dtype T | sized(T) ) const volatile lvalue T ?[?]( const volatile T *,      ptrdiff_t );
     73forall( dtype T | sized(T) ) lvalue T            ?[?](          ptrdiff_t,                T * );
     74forall( dtype T | sized(T) ) const lvalue T      ?[?](          ptrdiff_t, const          T * );
     75forall( dtype T | sized(T) ) volatile lvalue T   ?[?](          ptrdiff_t,       volatile T * );
     76forall( dtype T | sized(T) ) const volatile lvalue T ?[?](              ptrdiff_t, const volatile T * );
    7777
    7878// ------------------------------------------------------------
     
    8282// ------------------------------------------------------------
    8383
    84 _Bool                   ++?( _Bool & ),                         --?( _Bool & );
    85 signed int              ++?( signed int & ),                    --?( signed int & );
    86 unsigned int            ++?( unsigned int & ),                  --?( unsigned int & );
    87 signed long int         ++?( signed long int & ),               --?( signed long int & );
    88 unsigned long int       ++?( unsigned long int & ),             --?( unsigned long int & );
    89 signed long long int    ++?( signed long long int & ),          --?( signed long long int & );
    90 unsigned long long int  ++?( unsigned long long int & ),        --?( unsigned long long int & );
    91 float                   ++?( float & ),                         --?( float & );
    92 double                  ++?( double & ),                        --?( double & );
    93 long double             ++?( long double & ),                   --?( long double & );
    94 float _Complex          ++?( float _Complex & ),                --?( float _Complex & );
    95 double _Complex         ++?( double _Complex & ),               --?( double _Complex & );
    96 long double _Complex    ++?( long double _Complex & ),          --?( long double _Complex & );
    97 
    98 forall( dtype T | sized(T) ) T *                         ++?(                T *& );
    99 forall( dtype T | sized(T) ) const T *           ++?( const          T *& );
    100 forall( dtype T | sized(T) ) volatile T *                ++?(       volatile T *& );
    101 forall( dtype T | sized(T) ) const volatile T *  ++?( const volatile T *& );
    102 forall( dtype T | sized(T) ) T *                         --?(                T *& );
    103 forall( dtype T | sized(T) ) const T *           --?( const          T *& );
    104 forall( dtype T | sized(T) ) volatile T *                --?(       volatile T *& );
    105 forall( dtype T | sized(T) ) const volatile T *  --?( const volatile T *& );
    106 
    107 forall( dtype T | sized(T) ) T &                 *?(                 T * );
    108 forall( dtype T | sized(T) ) const T &           *?( const           T * );
    109 forall( dtype T | sized(T) ) volatile T &        *?(       volatile  T * );
    110 forall( dtype T | sized(T) ) const volatile T & *?( const volatile  T * );
    111 forall( ftype FT ) FT &          *?( FT * );
     84_Bool                   ++?( _Bool * ),                         --?( _Bool * );
     85signed int              ++?( signed int * ),                    --?( signed int * );
     86unsigned int            ++?( unsigned int * ),                  --?( unsigned int * );
     87signed long int         ++?( signed long int * ),               --?( signed long int * );
     88unsigned long int       ++?( unsigned long int * ),             --?( unsigned long int * );
     89signed long long int    ++?( signed long long int * ),          --?( signed long long int * );
     90unsigned long long int  ++?( unsigned long long int * ),        --?( unsigned long long int * );
     91float                   ++?( float * ),                         --?( float * );
     92double                  ++?( double * ),                        --?( double * );
     93long double             ++?( long double * ),                   --?( long double * );
     94float _Complex          ++?( float _Complex * ),                --?( float _Complex * );
     95double _Complex         ++?( double _Complex * ),               --?( double _Complex * );
     96long double _Complex    ++?( long double _Complex * ),          --?( long double _Complex * );
     97
     98forall( dtype T | sized(T) ) T *                         ++?(                T ** );
     99forall( dtype T | sized(T) ) const T *           ++?( const          T ** );
     100forall( dtype T | sized(T) ) volatile T *                ++?(       volatile T ** );
     101forall( dtype T | sized(T) ) const volatile T *  ++?( const volatile T ** );
     102forall( dtype T | sized(T) ) T *                         --?(                T ** );
     103forall( dtype T | sized(T) ) const T *           --?( const          T ** );
     104forall( dtype T | sized(T) ) volatile T *                --?(       volatile T ** );
     105forall( dtype T | sized(T) ) const volatile T *  --?( const volatile T ** );
     106
     107forall( dtype T | sized(T) ) lvalue T            *?(                 T * );
     108forall( dtype T | sized(T) ) const lvalue T              *?( const           T * );
     109forall( dtype T | sized(T) ) volatile lvalue T   *?(       volatile  T * );
     110forall( dtype T | sized(T) ) const volatile lvalue T *?( const volatile  T * );
     111forall( ftype FT ) lvalue FT             *?( FT * );
    112112
    113113_Bool                   +?( _Bool ),                    -?( _Bool ),                    ~?( _Bool );
     
    366366// ------------------------------------------------------------
    367367
    368 forall( ftype FT ) FT *                 ?=?( FT *&, FT * );
    369 forall( ftype FT ) FT *                 ?=?( FT * volatile &, FT * );
    370 
    371 forall( dtype DT ) DT *                 ?=?(                 DT *          &,                   DT * );
    372 forall( dtype DT ) DT *                 ?=?(                 DT * volatile &,                   DT * );
    373 forall( dtype DT ) const DT *           ?=?( const           DT *          &,                   DT * );
    374 forall( dtype DT ) const DT *           ?=?( const           DT * volatile &,                   DT * );
    375 forall( dtype DT ) const DT *           ?=?( const           DT *          &, const             DT * );
    376 forall( dtype DT ) const DT *           ?=?( const           DT * volatile &, const             DT * );
    377 forall( dtype DT ) volatile DT *        ?=?(       volatile  DT *          &,                   DT * );
    378 forall( dtype DT ) volatile DT *        ?=?(       volatile  DT * volatile &,                   DT * );
    379 forall( dtype DT ) volatile DT *        ?=?(       volatile  DT *          &,       volatile    DT * );
    380 forall( dtype DT ) volatile DT *        ?=?(       volatile  DT * volatile &,       volatile    DT * );
    381 
    382 forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT *          &,                   DT * );
    383 forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT * volatile &,                   DT * );
    384 forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT *          &, const             DT * );
    385 forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT * volatile &, const             DT * );
    386 forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT *          &,       volatile    DT * );
    387 forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT * volatile &,       volatile    DT * );
    388 forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT *          &, const volatile    DT * );
    389 forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT * volatile &, const volatile    DT * );
    390 
    391 forall( dtype DT ) DT *                 ?=?(                 DT *          &,                   void * );
    392 forall( dtype DT ) DT *                 ?=?(                 DT * volatile &,                   void * );
    393 forall( dtype DT ) const DT *           ?=?( const           DT *          &,                   void * );
    394 forall( dtype DT ) const DT *           ?=?( const           DT * volatile &,                   void * );
    395 forall( dtype DT ) const DT *           ?=?( const           DT *          &, const             void * );
    396 forall( dtype DT ) const DT *           ?=?( const           DT * volatile &, const             void * );
    397 forall( dtype DT ) volatile DT *        ?=?(       volatile  DT *          &,                   void * );
    398 forall( dtype DT ) volatile DT *        ?=?(       volatile  DT * volatile &,                   void * );
    399 forall( dtype DT ) volatile DT *        ?=?(       volatile  DT *          &,       volatile    void * );
    400 forall( dtype DT ) volatile DT *        ?=?(       volatile  DT * volatile &,       volatile    void * );
    401 
    402 forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT *          &,                   void * );
    403 forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT * volatile &,                   void * );
    404 forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT *          &, const             void * );
    405 forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT * volatile &, const             void * );
    406 forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT *          &,       volatile    void * );
    407 forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT * volatile &,       volatile    void * );
    408 forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT *          &, const volatile    void * );
    409 forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT * volatile &, const volatile    void * );
    410 
    411 forall( dtype DT ) void *                ?=?(                void *          &,                 DT * );
    412 forall( dtype DT ) void *                ?=?(                void * volatile &,                 DT * );
    413 forall( dtype DT ) const void *          ?=?( const          void *          &,                 DT * );
    414 forall( dtype DT ) const void *          ?=?( const          void * volatile &,                 DT * );
    415 forall( dtype DT ) const void *          ?=?( const          void *          &, const           DT * );
    416 forall( dtype DT ) const void *          ?=?( const          void * volatile &, const           DT * );
    417 forall( dtype DT ) volatile void *       ?=?(       volatile void *          &,                 DT * );
    418 forall( dtype DT ) volatile void *       ?=?(       volatile void * volatile &,                 DT * );
    419 forall( dtype DT ) volatile void *       ?=?(       volatile void *          &,       volatile  DT * );
    420 forall( dtype DT ) volatile void *       ?=?(       volatile void * volatile &,       volatile  DT * );
    421 forall( dtype DT ) const volatile void * ?=?( const volatile void *          &,                 DT * );
    422 forall( dtype DT ) const volatile void * ?=?( const volatile void * volatile &,                 DT * );
    423 forall( dtype DT ) const volatile void * ?=?( const volatile void *          &, const           DT * );
    424 forall( dtype DT ) const volatile void * ?=?( const volatile void * volatile &, const           DT * );
    425 forall( dtype DT ) const volatile void * ?=?( const volatile void *          &,       volatile  DT * );
    426 forall( dtype DT ) const volatile void * ?=?( const volatile void * volatile &,       volatile  DT * );
    427 forall( dtype DT ) const volatile void * ?=?( const volatile void *          &, const volatile  DT * );
    428 forall( dtype DT ) const volatile void * ?=?( const volatile void * volatile &, const volatile  DT * );
    429 
    430 void *                  ?=?(                void *          &,                void * );
    431 void *                  ?=?(                void * volatile &,                void * );
    432 const void *            ?=?( const          void *          &,                void * );
    433 const void *            ?=?( const          void * volatile &,                void * );
    434 const void *            ?=?( const          void *          &, const          void * );
    435 const void *            ?=?( const          void * volatile &, const          void * );
    436 volatile void *         ?=?(       volatile void *          &,                void * );
    437 volatile void *         ?=?(       volatile void * volatile &,                void * );
    438 volatile void *         ?=?(       volatile void *          &,       volatile void * );
    439 volatile void *         ?=?(       volatile void * volatile &,       volatile void * );
    440 const volatile void *   ?=?( const volatile void *          &,                void * );
    441 const volatile void *   ?=?( const volatile void * volatile &,                void * );
    442 const volatile void *   ?=?( const volatile void *          &, const          void * );
    443 const volatile void *   ?=?( const volatile void * volatile &, const          void * );
    444 const volatile void *   ?=?( const volatile void *          &,       volatile void * );
    445 const volatile void *   ?=?( const volatile void * volatile &,       volatile void * );
    446 const volatile void *   ?=?( const volatile void *          &, const volatile void * );
    447 const volatile void *   ?=?( const volatile void * volatile &, const volatile void * );
    448 
    449 //forall( dtype DT ) DT *                       ?=?(                DT *          &, forall( dtype DT2 ) const DT2 * );
    450 //forall( dtype DT ) DT *                       ?=?(                DT * volatile &, forall( dtype DT2 ) const DT2 * );
    451 forall( dtype DT ) const DT *           ?=?( const          DT *          &, forall( dtype DT2 ) const DT2 * );
    452 forall( dtype DT ) const DT *           ?=?( const          DT * volatile &, forall( dtype DT2 ) const DT2 * );
    453 //forall( dtype DT ) volatile DT *      ?=?( volatile       DT *          &, forall( dtype DT2 ) const DT2 * );
    454 //forall( dtype DT ) volatile DT *      ?=?( volatile       DT * volatile &, forall( dtype DT2 ) const DT2 * );
    455 forall( dtype DT ) const volatile DT *  ?=?( const volatile DT *          &, forall( dtype DT2 ) const DT2 * );
    456 forall( dtype DT ) const volatile DT *  ?=?( const volatile DT * volatile &, forall( dtype DT2 ) const DT2 * );
    457 
    458 forall( ftype FT ) FT *                 ?=?( FT *          &, forall( ftype FT2 ) FT2 * );
    459 forall( ftype FT ) FT *                 ?=?( FT * volatile &, forall( ftype FT2 ) FT2 * );
    460 
    461 forall( dtype T | sized(T) ) T *                        ?+=?(                T *          &, ptrdiff_t );
    462 forall( dtype T | sized(T) ) T *                        ?+=?(                T * volatile &, ptrdiff_t );
    463 forall( dtype T | sized(T) ) const T *          ?+=?( const          T *          &, ptrdiff_t );
    464 forall( dtype T | sized(T) ) const T *          ?+=?( const          T * volatile &, ptrdiff_t );
    465 forall( dtype T | sized(T) ) volatile T *               ?+=?(       volatile T *          &, ptrdiff_t );
    466 forall( dtype T | sized(T) ) volatile T *               ?+=?(       volatile T * volatile &, ptrdiff_t );
    467 forall( dtype T | sized(T) ) const volatile T * ?+=?( const volatile T *          &, ptrdiff_t );
    468 forall( dtype T | sized(T) ) const volatile T * ?+=?( const volatile T * volatile &, ptrdiff_t );
    469 forall( dtype T | sized(T) ) T *                        ?-=?(                T *          &, ptrdiff_t );
    470 forall( dtype T | sized(T) ) T *                        ?-=?(                T * volatile &, ptrdiff_t );
    471 forall( dtype T | sized(T) ) const T *          ?-=?( const          T *          &, ptrdiff_t );
    472 forall( dtype T | sized(T) ) const T *          ?-=?( const          T * volatile &, ptrdiff_t );
    473 forall( dtype T | sized(T) ) volatile T *               ?-=?(       volatile T *          &, ptrdiff_t );
    474 forall( dtype T | sized(T) ) volatile T *               ?-=?(       volatile T * volatile &, ptrdiff_t );
    475 forall( dtype T | sized(T) ) const volatile T * ?-=?( const volatile T *          &, ptrdiff_t );
    476 forall( dtype T | sized(T) ) const volatile T * ?-=?( const volatile T * volatile &, ptrdiff_t );
    477 
    478 _Bool                   ?=?( _Bool &, _Bool ),                                  ?=?( volatile _Bool &, _Bool );
    479 char                    ?=?( char &, char ),                                    ?=?( volatile char &, char );
    480 char signed             ?=?( char signed &, char signed ),                      ?=?( volatile char signed &, char signed );
    481 char unsigned           ?=?( char unsigned &, char unsigned ),                  ?=?( volatile char unsigned &, char unsigned );
    482 int short               ?=?( int short &, int short ),                          ?=?( volatile int short &, int short );
    483 int short unsigned      ?=?( int short unsigned &, int short unsigned ),        ?=?( volatile int short unsigned &, int short unsigned );
    484 signed int              ?=?( signed int &, signed int ),                        ?=?( volatile signed int &, signed int );
    485 unsigned int            ?=?( unsigned &, unsigned ),                            ?=?( volatile unsigned &, unsigned );
    486 signed long int         ?=?( signed long int &, signed long int ),              ?=?( volatile signed long int &, signed long int );
    487 unsigned long int       ?=?( unsigned long int &, unsigned long int ),          ?=?( volatile unsigned long int &, unsigned long int );
    488 signed long long int    ?=?( signed long long int &, signed long long int ),    ?=?( volatile signed long long int &, signed long long int );
    489 unsigned long long int  ?=?( unsigned long long int &, unsigned long long int ), ?=?( volatile unsigned long long int &, unsigned long long int );
    490 zero_t          ?=?( zero_t &, zero_t );
    491 one_t                   ?=?( one_t &, one_t );
    492 
    493 
    494 _Bool                   ?*=?( _Bool &, _Bool ),                                 ?*=?( volatile _Bool &, _Bool );
    495 char                    ?*=?( char &, char ),                                   ?*=?( volatile char &, char );
    496 char signed             ?*=?( char signed &, char signed ),                     ?*=?( volatile char signed &, char signed );
    497 char unsigned           ?*=?( char unsigned &, char unsigned ),                 ?*=?( volatile char unsigned &, char unsigned );
    498 int short               ?*=?( int short &, int short ),                         ?*=?( volatile int short &, int short );
    499 int short unsigned      ?*=?( int short unsigned &, int short unsigned ),       ?*=?( volatile int short unsigned &, int short unsigned );
    500 signed int              ?*=?( signed int &, signed int ),                       ?*=?( volatile signed int &, signed int );
    501 unsigned int            ?*=?( unsigned &, unsigned ),                           ?*=?( volatile unsigned &, unsigned );
    502 signed long int         ?*=?( signed long int &, signed long int ),             ?*=?( volatile signed long int &, signed long int );
    503 unsigned long int       ?*=?( unsigned long int &, unsigned long int ),         ?*=?( volatile unsigned long int &, unsigned long int );
    504 signed long long int    ?*=?( signed long long int &, signed long long int ),   ?*=?( volatile signed long long int &, signed long long int );
    505 unsigned long long int  ?*=?( unsigned long long int &, unsigned long long int ), ?*=?( volatile unsigned long long int &, unsigned long long int );
    506 
    507 _Bool                   ?/=?( _Bool &, _Bool ),                                 ?/=?( volatile _Bool &, _Bool );
    508 char                    ?/=?( char &, char ),                                   ?/=?( volatile char &, char );
    509 char signed             ?/=?( char signed &, char signed ),                     ?/=?( volatile char signed &, char signed );
    510 char unsigned           ?/=?( char unsigned &, char unsigned ),                 ?/=?( volatile char unsigned &, char unsigned );
    511 int short               ?/=?( int short &, int short ),                         ?/=?( volatile int short &, int short );
    512 int short unsigned      ?/=?( int short unsigned &, int short unsigned ),       ?/=?( volatile int short unsigned &, int short unsigned );
    513 signed int              ?/=?( signed int &, signed int ),                       ?/=?( volatile signed int &, signed int );
    514 unsigned int            ?/=?( unsigned &, unsigned ),                           ?/=?( volatile unsigned &, unsigned );
    515 signed long int         ?/=?( signed long int &, signed long int ),             ?/=?( volatile signed long int &, signed long int );
    516 unsigned long int       ?/=?( unsigned long int &, unsigned long int ),         ?/=?( volatile unsigned long int &, unsigned long int );
    517 signed long long int    ?/=?( signed long long int &, signed long long int ),   ?/=?( volatile signed long long int &, signed long long int );
    518 unsigned long long int  ?/=?( unsigned long long int &, unsigned long long int ), ?/=?( volatile unsigned long long int &, unsigned long long int );
    519 
    520 _Bool                   ?%=?( _Bool &, _Bool ),                                 ?%=?( volatile _Bool &, _Bool );
    521 char                    ?%=?( char &, char ),                                   ?%=?( volatile char &, char );
    522 char signed             ?%=?( char signed &, char signed ),                     ?%=?( volatile char signed &, char signed );
    523 char unsigned           ?%=?( char unsigned &, char unsigned ),                 ?%=?( volatile char unsigned &, char unsigned );
    524 int short               ?%=?( int short &, int short ),                         ?%=?( volatile int short &, int short );
    525 int short unsigned      ?%=?( int short unsigned &, int short unsigned ),       ?%=?( volatile int short unsigned &, int short unsigned );
    526 signed int              ?%=?( signed int &, signed int ),                       ?%=?( volatile signed int &, signed int );
    527 unsigned int            ?%=?( unsigned &, unsigned ),                           ?%=?( volatile unsigned &, unsigned );
    528 signed long int         ?%=?( signed long int &, signed long int ),             ?%=?( volatile signed long int &, signed long int );
    529 unsigned long int       ?%=?( unsigned long int &, unsigned long int ),         ?%=?( volatile unsigned long int &, unsigned long int );
    530 signed long long int    ?%=?( signed long long int &, signed long long int ),   ?%=?( volatile signed long long int &, signed long long int );
    531 unsigned long long int  ?%=?( unsigned long long int &, unsigned long long int ), ?%=?( volatile unsigned long long int &, unsigned long long int );
    532 
    533 _Bool                   ?+=?( _Bool &, _Bool ),                                 ?+=?( volatile _Bool &, _Bool );
    534 char                    ?+=?( char &, char ),                                   ?+=?( volatile char &, char );
    535 char signed             ?+=?( char signed &, char signed ),                     ?+=?( volatile char signed &, char signed );
    536 char unsigned           ?+=?( char unsigned &, char unsigned ),                 ?+=?( volatile char unsigned &, char unsigned );
    537 int short               ?+=?( int short &, int short ),                         ?+=?( volatile int short &, int short );
    538 int short unsigned      ?+=?( int short unsigned &, int short unsigned ),       ?+=?( volatile int short unsigned &, int short unsigned );
    539 signed int              ?+=?( signed int &, signed int ),                       ?+=?( volatile signed int &, signed int );
    540 unsigned int            ?+=?( unsigned &, unsigned ),                           ?+=?( volatile unsigned &, unsigned );
    541 signed long int         ?+=?( signed long int &, signed long int ),             ?+=?( volatile signed long int &, signed long int );
    542 unsigned long int       ?+=?( unsigned long int &, unsigned long int ),         ?+=?( volatile unsigned long int &, unsigned long int );
    543 signed long long int    ?+=?( signed long long int &, signed long long int ),   ?+=?( volatile signed long long int &, signed long long int );
    544 unsigned long long int  ?+=?( unsigned long long int &, unsigned long long int ), ?+=?( volatile unsigned long long int &, unsigned long long int );
    545 
    546 _Bool                   ?-=?( _Bool &, _Bool ),                                 ?-=?( volatile _Bool &, _Bool );
    547 char                    ?-=?( char &, char ),                                   ?-=?( volatile char &, char );
    548 char signed             ?-=?( char signed &, char signed ),                     ?-=?( volatile char signed &, char signed );
    549 char unsigned           ?-=?( char unsigned &, char unsigned ),                 ?-=?( volatile char unsigned &, char unsigned );
    550 int short               ?-=?( int short &, int short ),                         ?-=?( volatile int short &, int short );
    551 int short unsigned      ?-=?( int short unsigned &, int short unsigned ),       ?-=?( volatile int short unsigned &, int short unsigned );
    552 signed int              ?-=?( signed int &, signed int ),                       ?-=?( volatile signed int &, signed int );
    553 unsigned int            ?-=?( unsigned &, unsigned ),                           ?-=?( volatile unsigned &, unsigned );
    554 signed long int         ?-=?( signed long int &, signed long int ),             ?-=?( volatile signed long int &, signed long int );
    555 unsigned long int       ?-=?( unsigned long int &, unsigned long int ),         ?-=?( volatile unsigned long int &, unsigned long int );
    556 signed long long int    ?-=?( signed long long int &, signed long long int ),   ?-=?( volatile signed long long int &, signed long long int );
    557 unsigned long long int  ?-=?( unsigned long long int &, unsigned long long int ), ?-=?( volatile unsigned long long int &, unsigned long long int );
    558 
    559 _Bool                   ?<<=?( _Bool &, _Bool ),                                ?<<=?( volatile _Bool &, _Bool );
    560 char                    ?<<=?( char &, char ),                                  ?<<=?( volatile char &, char );
    561 char signed             ?<<=?( char signed &, char signed ),                    ?<<=?( volatile char signed &, char signed );
    562 char unsigned           ?<<=?( char unsigned &, char unsigned ),                ?<<=?( volatile char unsigned &, char unsigned );
    563 int short               ?<<=?( int short &, int short ),                        ?<<=?( volatile int short &, int short );
    564 int short unsigned      ?<<=?( int short unsigned &, int short unsigned ),      ?<<=?( volatile int short unsigned &, int short unsigned );
    565 signed int              ?<<=?( signed int &, signed int ),                      ?<<=?( volatile signed int &, signed int );
    566 unsigned int            ?<<=?( unsigned &, unsigned ),                          ?<<=?( volatile unsigned &, unsigned );
    567 signed long int         ?<<=?( signed long int &, signed long int ),            ?<<=?( volatile signed long int &, signed long int );
    568 unsigned long int       ?<<=?( unsigned long int &, unsigned long int ),        ?<<=?( volatile unsigned long int &, unsigned long int );
    569 signed long long int    ?<<=?( signed long long int &, signed long long int ),  ?<<=?( volatile signed long long int &, signed long long int );
    570 unsigned long long int  ?<<=?( unsigned long long int &, unsigned long long int ), ?<<=?( volatile unsigned long long int &, unsigned long long int );
    571 
    572 _Bool                   ?>>=?( _Bool &, _Bool ),                                ?>>=?( volatile _Bool &, _Bool );
    573 char                    ?>>=?( char &, char ),                                  ?>>=?( volatile char &, char );
    574 char signed             ?>>=?( char signed &, char signed ),                    ?>>=?( volatile char signed &, char signed );
    575 char unsigned           ?>>=?( char unsigned &, char unsigned ),                ?>>=?( volatile char unsigned &, char unsigned );
    576 int short               ?>>=?( int short &, int short ),                        ?>>=?( volatile int short &, int short );
    577 int short unsigned      ?>>=?( int short unsigned &, int short unsigned ),      ?>>=?( volatile int short unsigned &, int short unsigned );
    578 signed int              ?>>=?( signed int &, signed int ),                      ?>>=?( volatile signed int &, signed int );
    579 unsigned int            ?>>=?( unsigned &, unsigned ),                          ?>>=?( volatile unsigned &, unsigned );
    580 signed long int         ?>>=?( signed long int &, signed long int ),            ?>>=?( volatile signed long int &, signed long int );
    581 unsigned long int       ?>>=?( unsigned long int &, unsigned long int ),        ?>>=?( volatile unsigned long int &, unsigned long int );
    582 signed long long int    ?>>=?( signed long long int &, signed long long int ),  ?>>=?( volatile signed long long int &, signed long long int );
    583 unsigned long long int  ?>>=?( unsigned long long int &, unsigned long long int ), ?>>=?( volatile unsigned long long int &, unsigned long long int );
    584 
    585 _Bool                   ?&=?( _Bool &, _Bool ),                                 ?&=?( volatile _Bool &, _Bool );
    586 char                    ?&=?( char &, char ),                                   ?&=?( volatile char &, char );
    587 char signed             ?&=?( char signed &, char signed ),                     ?&=?( volatile char signed &, char signed );
    588 char unsigned           ?&=?( char unsigned &, char unsigned ),                 ?&=?( volatile char unsigned &, char unsigned );
    589 int short               ?&=?( int short &, int short ),                         ?&=?( volatile int short &, int short );
    590 int short unsigned      ?&=?( int short unsigned &, int short unsigned ),       ?&=?( volatile int short unsigned &, int short unsigned );
    591 signed int              ?&=?( signed int &, signed int ),                       ?&=?( volatile signed int &, signed int );
    592 unsigned int            ?&=?( unsigned &, unsigned ),                           ?&=?( volatile unsigned &, unsigned );
    593 signed long int         ?&=?( signed long int &, signed long int ),             ?&=?( volatile signed long int &, signed long int );
    594 unsigned long int       ?&=?( unsigned long int &, unsigned long int ),         ?&=?( volatile unsigned long int &, unsigned long int );
    595 signed long long int    ?&=?( signed long long int &, signed long long int ),   ?&=?( volatile signed long long int &, signed long long int );
    596 unsigned long long int  ?&=?( unsigned long long int &, unsigned long long int ), ?&=?( volatile unsigned long long int &, unsigned long long int );
    597 
    598 _Bool                   ?|=?( _Bool &, _Bool ),                                 ?|=?( volatile _Bool &, _Bool );
    599 char                    ?|=?( char &, char ),                                   ?|=?( volatile char &, char );
    600 char signed             ?|=?( char signed &, char signed ),                     ?|=?( volatile char signed &, char signed );
    601 char unsigned           ?|=?( char unsigned &, char unsigned ),                 ?|=?( volatile char unsigned &, char unsigned );
    602 int short               ?|=?( int short &, int short ),                         ?|=?( volatile int short &, int short );
    603 int short unsigned      ?|=?( int short unsigned &, int short unsigned ),       ?|=?( volatile int short unsigned &, int short unsigned );
    604 signed int              ?|=?( signed int &, signed int ),                       ?|=?( volatile signed int &, signed int );
    605 unsigned int            ?|=?( unsigned &, unsigned ),                           ?|=?( volatile unsigned &, unsigned );
    606 signed long int         ?|=?( signed long int &, signed long int ),             ?|=?( volatile signed long int &, signed long int );
    607 unsigned long int       ?|=?( unsigned long int &, unsigned long int ),         ?|=?( volatile unsigned long int &, unsigned long int );
    608 signed long long int    ?|=?( signed long long int &, signed long long int ),   ?|=?( volatile signed long long int &, signed long long int );
    609 unsigned long long int  ?|=?( unsigned long long int &, unsigned long long int ), ?|=?( volatile unsigned long long int &, unsigned long long int );
    610 
    611 _Bool                   ?^=?( _Bool &, _Bool ),                                 ?^=?( volatile _Bool &, _Bool );
    612 char                    ?^=?( char &, char ),                                   ?^=?( volatile char &, char );
    613 char signed             ?^=?( char signed &, char signed ),                     ?^=?( volatile char signed &, char signed );
    614 char unsigned           ?^=?( char unsigned &, char unsigned ),                 ?^=?( volatile char unsigned &, char unsigned );
    615 int short               ?^=?( int short &, int short ),                         ?^=?( volatile int short &, int short );
    616 int short unsigned      ?^=?( int short unsigned &, int short unsigned ),       ?^=?( volatile int short unsigned &, int short unsigned );
    617 signed int              ?^=?( signed int &, signed int ),                       ?^=?( volatile signed int &, signed int );
    618 unsigned int            ?^=?( unsigned &, unsigned ),                           ?^=?( volatile unsigned &, unsigned );
    619 signed long int         ?^=?( signed long int &, signed long int ),             ?^=?( volatile signed long int &, signed long int );
    620 unsigned long int       ?^=?( unsigned long int &, unsigned long int ),         ?^=?( volatile unsigned long int &, unsigned long int );
    621 signed long long int    ?^=?( signed long long int &, signed long long int ),   ?^=?( volatile signed long long int &, signed long long int );
    622 unsigned long long int  ?^=?( unsigned long long int &, unsigned long long int ), ?^=?( volatile unsigned long long int &, unsigned long long int );
    623 
    624 float                   ?=?(  float &, float ), ?=?(  volatile float &, float ),
    625                         ?*=?( float &, float ), ?*=?( volatile float &, float ),
    626                         ?/=?( float &, float ), ?/=?( volatile float &, float ),
    627                         ?+=?( float &, float ), ?+=?( volatile float &, float ),
    628                         ?-=?( float &, float ), ?-=?( volatile float &, float );
    629 
    630 double                  ?=?(  double &, double ), ?=?(  volatile double &, double ),
    631                         ?*=?( double &, double ), ?*=?( volatile double &, double ),
    632                         ?/=?( double &, double ), ?/=?( volatile double &, double ),
    633                         ?+=?( double &, double ), ?+=?( volatile double &, double ),
    634                         ?-=?( double &, double ), ?-=?( volatile double &, double );
    635 
    636 long double             ?=?(  long double &, long double ), ?=?(  volatile long double &, long double ),
    637                         ?*=?( long double &, long double ), ?*=?( volatile long double &, long double ),
    638                         ?/=?( long double &, long double ), ?/=?( volatile long double &, long double ),
    639                         ?+=?( long double &, long double ), ?+=?( volatile long double &, long double ),
    640                         ?-=?( long double &, long double ), ?-=?( volatile long double &, long double );
    641 
    642 float _Complex          ?=?(  float _Complex &, float _Complex ), ?=?(  volatile float _Complex &, float _Complex ),
    643                         ?*=?( float _Complex &, float _Complex ), ?*=?( volatile float _Complex &, float _Complex ),
    644                         ?/=?( float _Complex &, float _Complex ), ?/=?( volatile float _Complex &, float _Complex ),
    645                         ?+=?( float _Complex &, float _Complex ), ?+=?( volatile float _Complex &, float _Complex ),
    646                         ?-=?( float _Complex &, float _Complex ), ?-=?( volatile float _Complex &, float _Complex );
    647 
    648 double _Complex         ?=?(  double _Complex &, double _Complex ), ?=?(  volatile double _Complex &, double _Complex ),
    649                         ?*=?( double _Complex &, double _Complex ), ?*=?( volatile double _Complex &, double _Complex ),
    650                         ?/=?( double _Complex &, double _Complex ), ?/=?( volatile double _Complex &, double _Complex ),
    651                         ?+=?( double _Complex &, double _Complex ), ?+=?( volatile double _Complex &, double _Complex ),
    652                         ?-=?( double _Complex &, double _Complex ), ?-=?( volatile double _Complex &, double _Complex );
    653 
    654 long double _Complex    ?=?(  long double _Complex &, long double _Complex ), ?=?(  volatile long double _Complex &, long double _Complex ),
    655                         ?*=?( long double _Complex &, long double _Complex ), ?*=?( volatile long double _Complex &, long double _Complex ),
    656                         ?/=?( long double _Complex &, long double _Complex ), ?/=?( volatile long double _Complex &, long double _Complex ),
    657                         ?+=?( long double _Complex &, long double _Complex ), ?+=?( volatile long double _Complex &, long double _Complex ),
    658                         ?-=?( long double _Complex &, long double _Complex ), ?-=?( volatile long double _Complex &, long double _Complex );
     368forall( ftype FT ) FT *                 ?=?( FT **, FT * );
     369forall( ftype FT ) FT *                 ?=?( FT * volatile *, FT * );
     370
     371forall( dtype DT ) DT *                 ?=?(                 DT *          *,                   DT * );
     372forall( dtype DT ) DT *                 ?=?(                 DT * volatile *,                   DT * );
     373forall( dtype DT ) const DT *           ?=?( const           DT *          *,                   DT * );
     374forall( dtype DT ) const DT *           ?=?( const           DT * volatile *,                   DT * );
     375forall( dtype DT ) const DT *           ?=?( const           DT *          *, const             DT * );
     376forall( dtype DT ) const DT *           ?=?( const           DT * volatile *, const             DT * );
     377forall( dtype DT ) volatile DT *        ?=?(       volatile  DT *          *,                   DT * );
     378forall( dtype DT ) volatile DT *        ?=?(       volatile  DT * volatile *,                   DT * );
     379forall( dtype DT ) volatile DT *        ?=?(       volatile  DT *          *,       volatile    DT * );
     380forall( dtype DT ) volatile DT *        ?=?(       volatile  DT * volatile *,       volatile    DT * );
     381
     382forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT *          *,                   DT * );
     383forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT * volatile *,                   DT * );
     384forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT *          *, const             DT * );
     385forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT * volatile *, const             DT * );
     386forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT *          *,       volatile    DT * );
     387forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT * volatile *,       volatile    DT * );
     388forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT *          *, const volatile    DT * );
     389forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT * volatile *, const volatile    DT * );
     390
     391forall( dtype DT ) DT *                 ?=?(                 DT *          *,                   void * );
     392forall( dtype DT ) DT *                 ?=?(                 DT * volatile *,                   void * );
     393forall( dtype DT ) const DT *           ?=?( const           DT *          *,                   void * );
     394forall( dtype DT ) const DT *           ?=?( const           DT * volatile *,                   void * );
     395forall( dtype DT ) const DT *           ?=?( const           DT *          *, const             void * );
     396forall( dtype DT ) const DT *           ?=?( const           DT * volatile *, const             void * );
     397forall( dtype DT ) volatile DT *        ?=?(       volatile  DT *          *,                   void * );
     398forall( dtype DT ) volatile DT *        ?=?(       volatile  DT * volatile *,                   void * );
     399forall( dtype DT ) volatile DT *        ?=?(       volatile  DT *          *,       volatile    void * );
     400forall( dtype DT ) volatile DT *        ?=?(       volatile  DT * volatile *,       volatile    void * );
     401
     402forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT *          *,                   void * );
     403forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT * volatile *,                   void * );
     404forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT *          *, const             void * );
     405forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT * volatile *, const             void * );
     406forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT *          *,       volatile    void * );
     407forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT * volatile *,       volatile    void * );
     408forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT *          *, const volatile    void * );
     409forall( dtype DT ) const volatile DT *  ?=?( const volatile  DT * volatile *, const volatile    void * );
     410
     411forall( dtype DT ) void *                ?=?(                void *          *,                 DT * );
     412forall( dtype DT ) void *                ?=?(                void * volatile *,                 DT * );
     413forall( dtype DT ) const void *          ?=?( const          void *          *,                 DT * );
     414forall( dtype DT ) const void *          ?=?( const          void * volatile *,                 DT * );
     415forall( dtype DT ) const void *          ?=?( const          void *          *, const           DT * );
     416forall( dtype DT ) const void *          ?=?( const          void * volatile *, const           DT * );
     417forall( dtype DT ) volatile void *       ?=?(       volatile void *          *,                 DT * );
     418forall( dtype DT ) volatile void *       ?=?(       volatile void * volatile *,                 DT * );
     419forall( dtype DT ) volatile void *       ?=?(       volatile void *          *,       volatile  DT * );
     420forall( dtype DT ) volatile void *       ?=?(       volatile void * volatile *,       volatile  DT * );
     421forall( dtype DT ) const volatile void * ?=?( const volatile void *          *,                 DT * );
     422forall( dtype DT ) const volatile void * ?=?( const volatile void * volatile *,                 DT * );
     423forall( dtype DT ) const volatile void * ?=?( const volatile void *          *, const           DT * );
     424forall( dtype DT ) const volatile void * ?=?( const volatile void * volatile *, const           DT * );
     425forall( dtype DT ) const volatile void * ?=?( const volatile void *          *,       volatile  DT * );
     426forall( dtype DT ) const volatile void * ?=?( const volatile void * volatile *,       volatile  DT * );
     427forall( dtype DT ) const volatile void * ?=?( const volatile void *          *, const volatile  DT * );
     428forall( dtype DT ) const volatile void * ?=?( const volatile void * volatile *, const volatile  DT * );
     429
     430void *                  ?=?(                void *          *,                void * );
     431void *                  ?=?(                void * volatile *,                void * );
     432const void *            ?=?( const          void *          *,                void * );
     433const void *            ?=?( const          void * volatile *,                void * );
     434const void *            ?=?( const          void *          *, const          void * );
     435const void *            ?=?( const          void * volatile *, const          void * );
     436volatile void *         ?=?(       volatile void *          *,                void * );
     437volatile void *         ?=?(       volatile void * volatile *,                void * );
     438volatile void *         ?=?(       volatile void *          *,       volatile void * );
     439volatile void *         ?=?(       volatile void * volatile *,       volatile void * );
     440const volatile void *   ?=?( const volatile void *          *,                void * );
     441const volatile void *   ?=?( const volatile void * volatile *,                void * );
     442const volatile void *   ?=?( const volatile void *          *, const          void * );
     443const volatile void *   ?=?( const volatile void * volatile *, const          void * );
     444const volatile void *   ?=?( const volatile void *          *,       volatile void * );
     445const volatile void *   ?=?( const volatile void * volatile *,       volatile void * );
     446const volatile void *   ?=?( const volatile void *          *, const volatile void * );
     447const volatile void *   ?=?( const volatile void * volatile *, const volatile void * );
     448
     449// //forall( dtype DT ) DT *                    ?=?(                DT *          *, zero_t );
     450// //forall( dtype DT ) DT *                    ?=?(                DT * volatile *, zero_t );
     451// forall( dtype DT ) const DT *                ?=?( const          DT *          *, zero_t );
     452// forall( dtype DT ) const DT *                ?=?( const          DT * volatile *, zero_t );
     453// //forall( dtype DT ) volatile DT *   ?=?( volatile       DT *          *, zero_t );
     454// //forall( dtype DT ) volatile DT *   ?=?( volatile       DT * volatile *, );
     455// forall( dtype DT ) const volatile DT *       ?=?( const volatile DT *          *, zero_t );
     456// forall( dtype DT ) const volatile DT *       ?=?( const volatile DT * volatile *, zero_t );
     457
     458// forall( ftype FT ) FT *                      ?=?( FT *          *, zero_t );
     459// forall( ftype FT ) FT *                      ?=?( FT * volatile *, zero_t );
     460
     461forall( dtype T | sized(T) ) T *                        ?+=?(                T *          *, ptrdiff_t );
     462forall( dtype T | sized(T) ) T *                        ?+=?(                T * volatile *, ptrdiff_t );
     463forall( dtype T | sized(T) ) const T *          ?+=?( const          T *          *, ptrdiff_t );
     464forall( dtype T | sized(T) ) const T *          ?+=?( const          T * volatile *, ptrdiff_t );
     465forall( dtype T | sized(T) ) volatile T *               ?+=?(       volatile T *          *, ptrdiff_t );
     466forall( dtype T | sized(T) ) volatile T *               ?+=?(       volatile T * volatile *, ptrdiff_t );
     467forall( dtype T | sized(T) ) const volatile T * ?+=?( const volatile T *          *, ptrdiff_t );
     468forall( dtype T | sized(T) ) const volatile T * ?+=?( const volatile T * volatile *, ptrdiff_t );
     469forall( dtype T | sized(T) ) T *                        ?-=?(                T *          *, ptrdiff_t );
     470forall( dtype T | sized(T) ) T *                        ?-=?(                T * volatile *, ptrdiff_t );
     471forall( dtype T | sized(T) ) const T *          ?-=?( const          T *          *, ptrdiff_t );
     472forall( dtype T | sized(T) ) const T *          ?-=?( const          T * volatile *, ptrdiff_t );
     473forall( dtype T | sized(T) ) volatile T *               ?-=?(       volatile T *          *, ptrdiff_t );
     474forall( dtype T | sized(T) ) volatile T *               ?-=?(       volatile T * volatile *, ptrdiff_t );
     475forall( dtype T | sized(T) ) const volatile T * ?-=?( const volatile T *          *, ptrdiff_t );
     476forall( dtype T | sized(T) ) const volatile T * ?-=?( const volatile T * volatile *, ptrdiff_t );
     477
     478_Bool                   ?=?( _Bool *, _Bool ),                                  ?=?( volatile _Bool *, _Bool );
     479char                    ?=?( char *, char ),                                    ?=?( volatile char *, char );
     480char signed             ?=?( char signed *, char signed ),                      ?=?( volatile char signed *, char signed );
     481char unsigned           ?=?( char unsigned *, char unsigned ),                  ?=?( volatile char unsigned *, char unsigned );
     482int short               ?=?( int short *, int short ),                          ?=?( volatile int short *, int short );
     483int short unsigned      ?=?( int short unsigned *, int short unsigned ),        ?=?( volatile int short unsigned *, int short unsigned );
     484signed int              ?=?( signed int *, signed int ),                        ?=?( volatile signed int *, signed int );
     485unsigned int            ?=?( unsigned *, unsigned ),                            ?=?( volatile unsigned *, unsigned );
     486signed long int         ?=?( signed long int *, signed long int ),              ?=?( volatile signed long int *, signed long int );
     487unsigned long int       ?=?( unsigned long int *, unsigned long int ),          ?=?( volatile unsigned long int *, unsigned long int );
     488signed long long int    ?=?( signed long long int *, signed long long int ),    ?=?( volatile signed long long int *, signed long long int );
     489unsigned long long int  ?=?( unsigned long long int *, unsigned long long int ), ?=?( volatile unsigned long long int *, unsigned long long int );
     490zero_t          ?=?( zero_t *, zero_t );
     491one_t                   ?=?( one_t *, one_t );
     492
     493
     494_Bool                   ?*=?( _Bool *, _Bool ),                                 ?*=?( volatile _Bool *, _Bool );
     495char                    ?*=?( char *, char ),                                   ?*=?( volatile char *, char );
     496char signed             ?*=?( char signed *, char signed ),                     ?*=?( volatile char signed *, char signed );
     497char unsigned           ?*=?( char unsigned *, char unsigned ),                 ?*=?( volatile char unsigned *, char unsigned );
     498int short               ?*=?( int short *, int short ),                         ?*=?( volatile int short *, int short );
     499int short unsigned      ?*=?( int short unsigned *, int short unsigned ),       ?*=?( volatile int short unsigned *, int short unsigned );
     500signed int              ?*=?( signed int *, signed int ),                       ?*=?( volatile signed int *, signed int );
     501unsigned int            ?*=?( unsigned *, unsigned ),                           ?*=?( volatile unsigned *, unsigned );
     502signed long int         ?*=?( signed long int *, signed long int ),             ?*=?( volatile signed long int *, signed long int );
     503unsigned long int       ?*=?( unsigned long int *, unsigned long int ),         ?*=?( volatile unsigned long int *, unsigned long int );
     504signed long long int    ?*=?( signed long long int *, signed long long int ),   ?*=?( volatile signed long long int *, signed long long int );
     505unsigned long long int  ?*=?( unsigned long long int *, unsigned long long int ), ?*=?( volatile unsigned long long int *, unsigned long long int );
     506
     507_Bool                   ?/=?( _Bool *, _Bool ),                                 ?/=?( volatile _Bool *, _Bool );
     508char                    ?/=?( char *, char ),                                   ?/=?( volatile char *, char );
     509char signed             ?/=?( char signed *, char signed ),                     ?/=?( volatile char signed *, char signed );
     510char unsigned           ?/=?( char unsigned *, char unsigned ),                 ?/=?( volatile char unsigned *, char unsigned );
     511int short               ?/=?( int short *, int short ),                         ?/=?( volatile int short *, int short );
     512int short unsigned      ?/=?( int short unsigned *, int short unsigned ),       ?/=?( volatile int short unsigned *, int short unsigned );
     513signed int              ?/=?( signed int *, signed int ),                       ?/=?( volatile signed int *, signed int );
     514unsigned int            ?/=?( unsigned *, unsigned ),                           ?/=?( volatile unsigned *, unsigned );
     515signed long int         ?/=?( signed long int *, signed long int ),             ?/=?( volatile signed long int *, signed long int );
     516unsigned long int       ?/=?( unsigned long int *, unsigned long int ),         ?/=?( volatile unsigned long int *, unsigned long int );
     517signed long long int    ?/=?( signed long long int *, signed long long int ),   ?/=?( volatile signed long long int *, signed long long int );
     518unsigned long long int  ?/=?( unsigned long long int *, unsigned long long int ), ?/=?( volatile unsigned long long int *, unsigned long long int );
     519
     520_Bool                   ?%=?( _Bool *, _Bool ),                                 ?%=?( volatile _Bool *, _Bool );
     521char                    ?%=?( char *, char ),                                   ?%=?( volatile char *, char );
     522char signed             ?%=?( char signed *, char signed ),                     ?%=?( volatile char signed *, char signed );
     523char unsigned           ?%=?( char unsigned *, char unsigned ),                 ?%=?( volatile char unsigned *, char unsigned );
     524int short               ?%=?( int short *, int short ),                         ?%=?( volatile int short *, int short );
     525int short unsigned      ?%=?( int short unsigned *, int short unsigned ),       ?%=?( volatile int short unsigned *, int short unsigned );
     526signed int              ?%=?( signed int *, signed int ),                       ?%=?( volatile signed int *, signed int );
     527unsigned int            ?%=?( unsigned *, unsigned ),                           ?%=?( volatile unsigned *, unsigned );
     528signed long int         ?%=?( signed long int *, signed long int ),             ?%=?( volatile signed long int *, signed long int );
     529unsigned long int       ?%=?( unsigned long int *, unsigned long int ),         ?%=?( volatile unsigned long int *, unsigned long int );
     530signed long long int    ?%=?( signed long long int *, signed long long int ),   ?%=?( volatile signed long long int *, signed long long int );
     531unsigned long long int  ?%=?( unsigned long long int *, unsigned long long int ), ?%=?( volatile unsigned long long int *, unsigned long long int );
     532
     533_Bool                   ?+=?( _Bool *, _Bool ),                                 ?+=?( volatile _Bool *, _Bool );
     534char                    ?+=?( char *, char ),                                   ?+=?( volatile char *, char );
     535char signed             ?+=?( char signed *, char signed ),                     ?+=?( volatile char signed *, char signed );
     536char unsigned           ?+=?( char unsigned *, char unsigned ),                 ?+=?( volatile char unsigned *, char unsigned );
     537int short               ?+=?( int short *, int short ),                         ?+=?( volatile int short *, int short );
     538int short unsigned      ?+=?( int short unsigned *, int short unsigned ),       ?+=?( volatile int short unsigned *, int short unsigned );
     539signed int              ?+=?( signed int *, signed int ),                       ?+=?( volatile signed int *, signed int );
     540unsigned int            ?+=?( unsigned *, unsigned ),                           ?+=?( volatile unsigned *, unsigned );
     541signed long int         ?+=?( signed long int *, signed long int ),             ?+=?( volatile signed long int *, signed long int );
     542unsigned long int       ?+=?( unsigned long int *, unsigned long int ),         ?+=?( volatile unsigned long int *, unsigned long int );
     543signed long long int    ?+=?( signed long long int *, signed long long int ),   ?+=?( volatile signed long long int *, signed long long int );
     544unsigned long long int  ?+=?( unsigned long long int *, unsigned long long int ), ?+=?( volatile unsigned long long int *, unsigned long long int );
     545
     546_Bool                   ?-=?( _Bool *, _Bool ),                                 ?-=?( volatile _Bool *, _Bool );
     547char                    ?-=?( char *, char ),                                   ?-=?( volatile char *, char );
     548char signed             ?-=?( char signed *, char signed ),                     ?-=?( volatile char signed *, char signed );
     549char unsigned           ?-=?( char unsigned *, char unsigned ),                 ?-=?( volatile char unsigned *, char unsigned );
     550int short               ?-=?( int short *, int short ),                         ?-=?( volatile int short *, int short );
     551int short unsigned      ?-=?( int short unsigned *, int short unsigned ),       ?-=?( volatile int short unsigned *, int short unsigned );
     552signed int              ?-=?( signed int *, signed int ),                       ?-=?( volatile signed int *, signed int );
     553unsigned int            ?-=?( unsigned *, unsigned ),                           ?-=?( volatile unsigned *, unsigned );
     554signed long int         ?-=?( signed long int *, signed long int ),             ?-=?( volatile signed long int *, signed long int );
     555unsigned long int       ?-=?( unsigned long int *, unsigned long int ),         ?-=?( volatile unsigned long int *, unsigned long int );
     556signed long long int    ?-=?( signed long long int *, signed long long int ),   ?-=?( volatile signed long long int *, signed long long int );
     557unsigned long long int  ?-=?( unsigned long long int *, unsigned long long int ), ?-=?( volatile unsigned long long int *, unsigned long long int );
     558
     559_Bool                   ?<<=?( _Bool *, _Bool ),                                ?<<=?( volatile _Bool *, _Bool );
     560char                    ?<<=?( char *, char ),                                  ?<<=?( volatile char *, char );
     561char signed             ?<<=?( char signed *, char signed ),                    ?<<=?( volatile char signed *, char signed );
     562char unsigned           ?<<=?( char unsigned *, char unsigned ),                ?<<=?( volatile char unsigned *, char unsigned );
     563int short               ?<<=?( int short *, int short ),                        ?<<=?( volatile int short *, int short );
     564int short unsigned      ?<<=?( int short unsigned *, int short unsigned ),      ?<<=?( volatile int short unsigned *, int short unsigned );
     565signed int              ?<<=?( signed int *, signed int ),                      ?<<=?( volatile signed int *, signed int );
     566unsigned int            ?<<=?( unsigned *, unsigned ),                          ?<<=?( volatile unsigned *, unsigned );
     567signed long int         ?<<=?( signed long int *, signed long int ),            ?<<=?( volatile signed long int *, signed long int );
     568unsigned long int       ?<<=?( unsigned long int *, unsigned long int ),        ?<<=?( volatile unsigned long int *, unsigned long int );
     569signed long long int    ?<<=?( signed long long int *, signed long long int ),  ?<<=?( volatile signed long long int *, signed long long int );
     570unsigned long long int  ?<<=?( unsigned long long int *, unsigned long long int ), ?<<=?( volatile unsigned long long int *, unsigned long long int );
     571
     572_Bool                   ?>>=?( _Bool *, _Bool ),                                ?>>=?( volatile _Bool *, _Bool );
     573char                    ?>>=?( char *, char ),                                  ?>>=?( volatile char *, char );
     574char signed             ?>>=?( char signed *, char signed ),                    ?>>=?( volatile char signed *, char signed );
     575char unsigned           ?>>=?( char unsigned *, char unsigned ),                ?>>=?( volatile char unsigned *, char unsigned );
     576int short               ?>>=?( int short *, int short ),                        ?>>=?( volatile int short *, int short );
     577int short unsigned      ?>>=?( int short unsigned *, int short unsigned ),      ?>>=?( volatile int short unsigned *, int short unsigned );
     578signed int              ?>>=?( signed int *, signed int ),                      ?>>=?( volatile signed int *, signed int );
     579unsigned int            ?>>=?( unsigned *, unsigned ),                          ?>>=?( volatile unsigned *, unsigned );
     580signed long int         ?>>=?( signed long int *, signed long int ),            ?>>=?( volatile signed long int *, signed long int );
     581unsigned long int       ?>>=?( unsigned long int *, unsigned long int ),        ?>>=?( volatile unsigned long int *, unsigned long int );
     582signed long long int    ?>>=?( signed long long int *, signed long long int ),  ?>>=?( volatile signed long long int *, signed long long int );
     583unsigned long long int  ?>>=?( unsigned long long int *, unsigned long long int ), ?>>=?( volatile unsigned long long int *, unsigned long long int );
     584
     585_Bool                   ?&=?( _Bool *, _Bool ),                                 ?&=?( volatile _Bool *, _Bool );
     586char                    ?&=?( char *, char ),                                   ?&=?( volatile char *, char );
     587char signed             ?&=?( char signed *, char signed ),                     ?&=?( volatile char signed *, char signed );
     588char unsigned           ?&=?( char unsigned *, char unsigned ),                 ?&=?( volatile char unsigned *, char unsigned );
     589int short               ?&=?( int short *, int short ),                         ?&=?( volatile int short *, int short );
     590int short unsigned      ?&=?( int short unsigned *, int short unsigned ),       ?&=?( volatile int short unsigned *, int short unsigned );
     591signed int              ?&=?( signed int *, signed int ),                       ?&=?( volatile signed int *, signed int );
     592unsigned int            ?&=?( unsigned *, unsigned ),                           ?&=?( volatile unsigned *, unsigned );
     593signed long int         ?&=?( signed long int *, signed long int ),             ?&=?( volatile signed long int *, signed long int );
     594unsigned long int       ?&=?( unsigned long int *, unsigned long int ),         ?&=?( volatile unsigned long int *, unsigned long int );
     595signed long long int    ?&=?( signed long long int *, signed long long int ),   ?&=?( volatile signed long long int *, signed long long int );
     596unsigned long long int  ?&=?( unsigned long long int *, unsigned long long int ), ?&=?( volatile unsigned long long int *, unsigned long long int );
     597
     598_Bool                   ?|=?( _Bool *, _Bool ),                                 ?|=?( volatile _Bool *, _Bool );
     599char                    ?|=?( char *, char ),                                   ?|=?( volatile char *, char );
     600char signed             ?|=?( char signed *, char signed ),                     ?|=?( volatile char signed *, char signed );
     601char unsigned           ?|=?( char unsigned *, char unsigned ),                 ?|=?( volatile char unsigned *, char unsigned );
     602int short               ?|=?( int short *, int short ),                         ?|=?( volatile int short *, int short );
     603int short unsigned      ?|=?( int short unsigned *, int short unsigned ),       ?|=?( volatile int short unsigned *, int short unsigned );
     604signed int              ?|=?( signed int *, signed int ),                       ?|=?( volatile signed int *, signed int );
     605unsigned int            ?|=?( unsigned *, unsigned ),                           ?|=?( volatile unsigned *, unsigned );
     606signed long int         ?|=?( signed long int *, signed long int ),             ?|=?( volatile signed long int *, signed long int );
     607unsigned long int       ?|=?( unsigned long int *, unsigned long int ),         ?|=?( volatile unsigned long int *, unsigned long int );
     608signed long long int    ?|=?( signed long long int *, signed long long int ),   ?|=?( volatile signed long long int *, signed long long int );
     609unsigned long long int  ?|=?( unsigned long long int *, unsigned long long int ), ?|=?( volatile unsigned long long int *, unsigned long long int );
     610
     611_Bool                   ?^=?( _Bool *, _Bool ),                                 ?^=?( volatile _Bool *, _Bool );
     612char                    ?^=?( char *, char ),                                   ?^=?( volatile char *, char );
     613char signed             ?^=?( char signed *, char signed ),                     ?^=?( volatile char signed *, char signed );
     614char unsigned           ?^=?( char unsigned *, char unsigned ),                 ?^=?( volatile char unsigned *, char unsigned );
     615int short               ?^=?( int short *, int short ),                         ?^=?( volatile int short *, int short );
     616int short unsigned      ?^=?( int short unsigned *, int short unsigned ),       ?^=?( volatile int short unsigned *, int short unsigned );
     617signed int              ?^=?( signed int *, signed int ),                       ?^=?( volatile signed int *, signed int );
     618unsigned int            ?^=?( unsigned *, unsigned ),                           ?^=?( volatile unsigned *, unsigned );
     619signed long int         ?^=?( signed long int *, signed long int ),             ?^=?( volatile signed long int *, signed long int );
     620unsigned long int       ?^=?( unsigned long int *, unsigned long int ),         ?^=?( volatile unsigned long int *, unsigned long int );
     621signed long long int    ?^=?( signed long long int *, signed long long int ),   ?^=?( volatile signed long long int *, signed long long int );
     622unsigned long long int  ?^=?( unsigned long long int *, unsigned long long int ), ?^=?( volatile unsigned long long int *, unsigned long long int );
     623
     624float                   ?=?(  float *, float ), ?=?(  volatile float *, float ),
     625                        ?*=?( float *, float ), ?*=?( volatile float *, float ),
     626                        ?/=?( float *, float ), ?/=?( volatile float *, float ),
     627                        ?+=?( float *, float ), ?+=?( volatile float *, float ),
     628                        ?-=?( float *, float ), ?-=?( volatile float *, float );
     629
     630double                  ?=?(  double *, double ), ?=?(  volatile double *, double ),
     631                        ?*=?( double *, double ), ?*=?( volatile double *, double ),
     632                        ?/=?( double *, double ), ?/=?( volatile double *, double ),
     633                        ?+=?( double *, double ), ?+=?( volatile double *, double ),
     634                        ?-=?( double *, double ), ?-=?( volatile double *, double );
     635
     636long double             ?=?(  long double *, long double ), ?=?(  volatile long double *, long double ),
     637                        ?*=?( long double *, long double ), ?*=?( volatile long double *, long double ),
     638                        ?/=?( long double *, long double ), ?/=?( volatile long double *, long double ),
     639                        ?+=?( long double *, long double ), ?+=?( volatile long double *, long double ),
     640                        ?-=?( long double *, long double ), ?-=?( volatile long double *, long double );
     641
     642float _Complex          ?=?(  float _Complex *, float _Complex ), ?=?(  volatile float _Complex *, float _Complex ),
     643                        ?*=?( float _Complex *, float _Complex ), ?*=?( volatile float _Complex *, float _Complex ),
     644                        ?/=?( float _Complex *, float _Complex ), ?/=?( volatile float _Complex *, float _Complex ),
     645                        ?+=?( float _Complex *, float _Complex ), ?+=?( volatile float _Complex *, float _Complex ),
     646                        ?-=?( float _Complex *, float _Complex ), ?-=?( volatile float _Complex *, float _Complex );
     647
     648double _Complex         ?=?(  double _Complex *, double _Complex ), ?=?(  volatile double _Complex *, double _Complex ),
     649                        ?*=?( double _Complex *, double _Complex ), ?*=?( volatile double _Complex *, double _Complex ),
     650                        ?/=?( double _Complex *, double _Complex ), ?/=?( volatile double _Complex *, double _Complex ),
     651                        ?+=?( double _Complex *, double _Complex ), ?+=?( volatile double _Complex *, double _Complex ),
     652                        ?-=?( double _Complex *, double _Complex ), ?-=?( volatile double _Complex *, double _Complex );
     653
     654long double _Complex    ?=?(  long double _Complex *, long double _Complex ), ?=?(  volatile long double _Complex *, long double _Complex ),
     655                        ?*=?( long double _Complex *, long double _Complex ), ?*=?( volatile long double _Complex *, long double _Complex ),
     656                        ?/=?( long double _Complex *, long double _Complex ), ?/=?( volatile long double _Complex *, long double _Complex ),
     657                        ?+=?( long double _Complex *, long double _Complex ), ?+=?( volatile long double _Complex *, long double _Complex ),
     658                        ?-=?( long double _Complex *, long double _Complex ), ?-=?( volatile long double _Complex *, long double _Complex );
    659659
    660660
     
    669669
    670670// default ctor
    671 void    ?{}( _Bool & );
    672 void    ?{}( char & );
    673 void    ?{}( unsigned char & );
    674 void    ?{}( char signed & );
    675 void    ?{}( int short & );
    676 void    ?{}( int short unsigned & );
    677 void    ?{}( signed int & );
    678 void    ?{}( unsigned int & );
    679 void    ?{}( signed long int & );
    680 void    ?{}( unsigned long int & );
    681 void    ?{}( signed long long int & );
    682 void    ?{}( unsigned long long int & );
    683 void    ?{}( float & );
    684 void    ?{}( double & );
    685 void    ?{}( long double & );
    686 void    ?{}( float _Complex & );
    687 void    ?{}( double _Complex & );
    688 void    ?{}( long double _Complex & );
    689 void    ?{}( zero_t & );
    690 void    ?{}( one_t & );
     671void    ?{}( _Bool * );
     672void    ?{}( char * );
     673void    ?{}( unsigned char * );
     674void    ?{}( char signed * );
     675void    ?{}( int short * );
     676void    ?{}( int short unsigned * );
     677void    ?{}( signed int * );
     678void    ?{}( unsigned int * );
     679void    ?{}( signed long int * );
     680void    ?{}( unsigned long int * );
     681void    ?{}( signed long long int * );
     682void    ?{}( unsigned long long int * );
     683void    ?{}( float * );
     684void    ?{}( double * );
     685void    ?{}( long double * );
     686void    ?{}( float _Complex * );
     687void    ?{}( double _Complex * );
     688void    ?{}( long double _Complex * );
     689void    ?{}( zero_t * );
     690void    ?{}( one_t * );
    691691
    692692// copy ctor
    693 void    ?{}( _Bool &, _Bool );
    694 void    ?{}( char &, char );
    695 void    ?{}( unsigned char &, unsigned char );
    696 void    ?{}( char signed &, char signed );
    697 void    ?{}( int short &, int short );
    698 void    ?{}( int short unsigned &, int short unsigned );
    699 void    ?{}( signed int &, signed int);
    700 void    ?{}( unsigned int &, unsigned int);
    701 void    ?{}( signed long int &, signed long int);
    702 void    ?{}( unsigned long int &, unsigned long int);
    703 void    ?{}( signed long long int &, signed long long int);
    704 void    ?{}( unsigned long long int &, unsigned long long int);
    705 void    ?{}( float &, float);
    706 void    ?{}( double &, double);
    707 void    ?{}( long double &, long double);
    708 void    ?{}( float _Complex &, float _Complex);
    709 void    ?{}( double _Complex &, double _Complex);
    710 void    ?{}( long double _Complex &, long double _Complex);
    711 void    ?{}( zero_t &, zero_t );
    712 void    ?{}( one_t &, one_t );
     693void    ?{}( _Bool *, _Bool );
     694void    ?{}( char *, char );
     695void    ?{}( unsigned char *, unsigned char );
     696void    ?{}( char signed *, char signed );
     697void    ?{}( int short *, int short );
     698void    ?{}( int short unsigned *, int short unsigned );
     699void    ?{}( signed int *, signed int);
     700void    ?{}( unsigned int *, unsigned int);
     701void    ?{}( signed long int *, signed long int);
     702void    ?{}( unsigned long int *, unsigned long int);
     703void    ?{}( signed long long int *, signed long long int);
     704void    ?{}( unsigned long long int *, unsigned long long int);
     705void    ?{}( float *, float);
     706void    ?{}( double *, double);
     707void    ?{}( long double *, long double);
     708void    ?{}( float _Complex *, float _Complex);
     709void    ?{}( double _Complex *, double _Complex);
     710void    ?{}( long double _Complex *, long double _Complex);
     711void    ?{}( zero_t *, zero_t );
     712void    ?{}( one_t *, one_t );
    713713
    714714// dtor
    715 void    ^?{}( _Bool & );
    716 void    ^?{}( char & );
    717 void    ^?{}( char unsigned & );
    718 void    ^?{}( char signed & );
    719 void    ^?{}( int short & );
    720 void    ^?{}( int short unsigned & );
    721 void    ^?{}( signed int & );
    722 void    ^?{}( unsigned int & );
    723 void    ^?{}( signed long int & );
    724 void    ^?{}( unsigned long int & );
    725 void    ^?{}( signed long long int & );
    726 void    ^?{}( unsigned long long int & );
    727 void    ^?{}( float & );
    728 void    ^?{}( double & );
    729 void    ^?{}( long double & );
    730 void    ^?{}( float _Complex & );
    731 void    ^?{}( double _Complex & );
    732 void    ^?{}( long double _Complex & );
    733 void    ^?{}( zero_t & );
    734 void    ^?{}( one_t & );
     715void    ^?{}( _Bool * );
     716void    ^?{}( char * );
     717void    ^?{}( char unsigned * );
     718void    ^?{}( char signed * );
     719void    ^?{}( int short * );
     720void    ^?{}( int short unsigned * );
     721void    ^?{}( signed int * );
     722void    ^?{}( unsigned int * );
     723void    ^?{}( signed long int * );
     724void    ^?{}( unsigned long int * );
     725void    ^?{}( signed long long int * );
     726void    ^?{}( unsigned long long int * );
     727void    ^?{}( float * );
     728void    ^?{}( double * );
     729void    ^?{}( long double * );
     730void    ^?{}( float _Complex * );
     731void    ^?{}( double _Complex * );
     732void    ^?{}( long double _Complex * );
     733void    ^?{}( zero_t * );
     734void    ^?{}( one_t * );
    735735
    736736// // default ctor
     
    754754// copied from assignment section
    755755// copy constructors
    756 forall( ftype FT ) void ?{}( FT *&, FT * );
    757 forall( ftype FT ) void ?{}( FT * volatile &, FT * );
    758 
    759 forall( dtype DT ) void ?{}(                 DT *          &,                   DT * );
    760 forall( dtype DT ) void ?{}( const           DT *          &,                   DT * );
    761 forall( dtype DT ) void ?{}( const           DT *          &, const             DT * );
    762 forall( dtype DT ) void ?{}(       volatile  DT *          &,                   DT * );
    763 forall( dtype DT ) void ?{}(       volatile  DT *          &,       volatile    DT * );
    764 
    765 forall( dtype DT ) void ?{}( const volatile  DT *          &,                   DT * );
    766 forall( dtype DT ) void ?{}( const volatile  DT *          &, const             DT * );
    767 forall( dtype DT ) void ?{}( const volatile  DT *          &,       volatile    DT * );
    768 forall( dtype DT ) void ?{}( const volatile  DT *          &, const volatile    DT * );
    769 
    770 forall( dtype DT ) void ?{}(                 DT *          &,                   void * );
    771 forall( dtype DT ) void ?{}( const           DT *          &,                   void * );
    772 forall( dtype DT ) void ?{}( const           DT *          &, const             void * );
    773 forall( dtype DT ) void ?{}(       volatile  DT *          &,                   void * );
    774 forall( dtype DT ) void ?{}(       volatile  DT *          &,       volatile    void * );
    775 
    776 forall( dtype DT ) void ?{}( const volatile  DT *          &,                   void * );
    777 forall( dtype DT ) void ?{}( const volatile  DT *          &, const             void * );
    778 forall( dtype DT ) void ?{}( const volatile  DT *          &,       volatile    void * );
    779 forall( dtype DT ) void ?{}( const volatile  DT *          &, const volatile    void * );
    780 
    781 forall( dtype DT ) void ?{}(                 void *          &,                 DT * );
    782 forall( dtype DT ) void ?{}( const           void *          &,                 DT * );
    783 forall( dtype DT ) void ?{}( const           void *          &, const           DT * );
    784 forall( dtype DT ) void ?{}(        volatile void *          &,                 DT * );
    785 forall( dtype DT ) void ?{}(        volatile void *          &,       volatile  DT * );
    786 forall( dtype DT ) void ?{}( const volatile void *           &,                 DT * );
    787 forall( dtype DT ) void ?{}( const volatile void *           &, const           DT * );
    788 forall( dtype DT ) void ?{}( const volatile void *           &,       volatile  DT * );
    789 forall( dtype DT ) void ?{}( const volatile void *           &, const volatile  DT * );
    790 
    791 void    ?{}(                void *          &,                void * );
    792 void    ?{}( const          void *          &,                void * );
    793 void    ?{}( const          void *          &, const          void * );
    794 void    ?{}(       volatile void *          &,                void * );
    795 void    ?{}(       volatile void *          &,       volatile void * );
    796 void    ?{}( const volatile void *          &,                void * );
    797 void    ?{}( const volatile void *          &, const          void * );
    798 void    ?{}( const volatile void *          &,       volatile void * );
    799 void    ?{}( const volatile void *          &, const volatile void * );
    800 
    801 //forall( dtype DT ) void ?{}(              DT *          &, forall( dtype DT2 ) const DT2 * );
    802 //forall( dtype DT ) void ?{}(              DT * volatile &, forall( dtype DT2 ) const DT2 * );
    803 forall( dtype DT ) void ?{}( const          DT *          &, forall( dtype DT2 ) const DT2 * );
    804 //forall( dtype DT ) void ?{}( volatile     DT *          &, forall( dtype DT2 ) const DT2 * );
    805 //forall( dtype DT ) void ?{}( volatile     DT * volatile &, forall( dtype DT2 ) const DT2 * );
    806 forall( dtype DT ) void ?{}( const volatile DT *          &, forall( dtype DT2 ) const DT2 * );
    807 
    808 forall( ftype FT ) void ?{}( FT *          &, forall( ftype FT2 ) FT2 * );
     756forall( ftype FT ) void ?{}( FT **, FT * );
     757forall( ftype FT ) void ?{}( FT * volatile *, FT * );
     758
     759forall( dtype DT ) void ?{}(                 DT *          *,                   DT * );
     760forall( dtype DT ) void ?{}( const           DT *          *,                   DT * );
     761forall( dtype DT ) void ?{}( const           DT *          *, const             DT * );
     762forall( dtype DT ) void ?{}(       volatile  DT *          *,                   DT * );
     763forall( dtype DT ) void ?{}(       volatile  DT *          *,       volatile    DT * );
     764
     765forall( dtype DT ) void ?{}( const volatile  DT *          *,                   DT * );
     766forall( dtype DT ) void ?{}( const volatile  DT *          *, const             DT * );
     767forall( dtype DT ) void ?{}( const volatile  DT *          *,       volatile    DT * );
     768forall( dtype DT ) void ?{}( const volatile  DT *          *, const volatile    DT * );
     769
     770forall( dtype DT ) void ?{}(                 DT *          *,                   void * );
     771forall( dtype DT ) void ?{}( const           DT *          *,                   void * );
     772forall( dtype DT ) void ?{}( const           DT *          *, const             void * );
     773forall( dtype DT ) void ?{}(       volatile  DT *          *,                   void * );
     774forall( dtype DT ) void ?{}(       volatile  DT *          *,       volatile    void * );
     775
     776forall( dtype DT ) void ?{}( const volatile  DT *          *,                   void * );
     777forall( dtype DT ) void ?{}( const volatile  DT *          *, const             void * );
     778forall( dtype DT ) void ?{}( const volatile  DT *          *,       volatile    void * );
     779forall( dtype DT ) void ?{}( const volatile  DT *          *, const volatile    void * );
     780
     781forall( dtype DT ) void ?{}(                 void *          *,                 DT * );
     782forall( dtype DT ) void ?{}( const           void *          *,                 DT * );
     783forall( dtype DT ) void ?{}( const           void *          *, const           DT * );
     784forall( dtype DT ) void ?{}(        volatile void *          *,                 DT * );
     785forall( dtype DT ) void ?{}(        volatile void *          *,       volatile  DT * );
     786forall( dtype DT ) void ?{}( const volatile void *           *,                 DT * );
     787forall( dtype DT ) void ?{}( const volatile void *           *, const           DT * );
     788forall( dtype DT ) void ?{}( const volatile void *           *,       volatile  DT * );
     789forall( dtype DT ) void ?{}( const volatile void *           *, const volatile  DT * );
     790
     791void    ?{}(                void *          *,                void * );
     792void    ?{}( const          void *          *,                void * );
     793void    ?{}( const          void *          *, const          void * );
     794void    ?{}(       volatile void *          *,                void * );
     795void    ?{}(       volatile void *          *,       volatile void * );
     796void    ?{}( const volatile void *          *,                void * );
     797void    ?{}( const volatile void *          *, const          void * );
     798void    ?{}( const volatile void *          *,       volatile void * );
     799void    ?{}( const volatile void *          *, const volatile void * );
     800
     801// //forall( dtype DT ) void ?{}(                   DT *          *, zero_t );
     802// //forall( dtype DT ) void ?{}(                   DT * volatile *, zero_t );
     803// forall( dtype DT ) void ?{}( const       DT *          *, zero_t );
     804// //forall( dtype DT ) void ?{}( volatile          DT *          *, zero_t );
     805// //forall( dtype DT ) void ?{}( volatile          DT * volatile *, zero_t );
     806// forall( dtype DT ) void ?{}( const volatile DT *       *, zero_t );
     807
     808// forall( ftype FT ) void      ?{}( FT *          *, zero_t );
    809809
    810810// default ctors
    811 forall( ftype FT ) void ?{}( FT *          & );
    812 
    813 forall( dtype DT ) void ?{}(                 DT *          &);
    814 forall( dtype DT ) void ?{}( const           DT *          &);
    815 forall( dtype DT ) void ?{}(       volatile  DT *          &);
    816 forall( dtype DT ) void ?{}( const volatile  DT *          &);
    817 
    818 void    ?{}(                void *          &);
    819 void    ?{}( const          void *          &);
    820 void    ?{}(       volatile void *          &);
    821 void    ?{}( const volatile void *          &);
     811forall( ftype FT ) void ?{}( FT *          * );
     812
     813forall( dtype DT ) void ?{}(                 DT *          *);
     814forall( dtype DT ) void ?{}( const           DT *          *);
     815forall( dtype DT ) void ?{}(       volatile  DT *          *);
     816forall( dtype DT ) void ?{}( const volatile  DT *          *);
     817
     818void    ?{}(                void *          *);
     819void    ?{}( const          void *          *);
     820void    ?{}(       volatile void *          *);
     821void    ?{}( const volatile void *          *);
    822822
    823823// dtors
    824 forall( ftype FT ) void ^?{}( FT *         & );
    825 
    826 forall( dtype DT ) void ^?{}(                DT *          &);
    827 forall( dtype DT ) void ^?{}( const          DT *          &);
    828 forall( dtype DT ) void ^?{}(      volatile  DT *          &);
    829 forall( dtype DT ) void ^?{}( const volatile  DT *         &);
    830 
    831 void    ^?{}(               void *          &);
    832 void    ^?{}( const         void *          &);
    833 void    ^?{}(      volatile void *          &);
    834 void    ^?{}( const volatile void *         &);
     824forall( ftype FT ) void ^?{}( FT *         * );
     825
     826forall( dtype DT ) void ^?{}(                DT *          *);
     827forall( dtype DT ) void ^?{}( const          DT *          *);
     828forall( dtype DT ) void ^?{}(      volatile  DT *          *);
     829forall( dtype DT ) void ^?{}( const volatile  DT *         *);
     830
     831void    ^?{}(               void *          *);
     832void    ^?{}( const         void *          *);
     833void    ^?{}(      volatile void *          *);
     834void    ^?{}( const volatile void *         *);
    835835
    836836// Local Variables: //
Note: See TracChangeset for help on using the changeset viewer.