Changes in / [94dea96:5da5a96]


Ignore:
Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/Common/PassVisitor.impl.h

    r94dea96 r5da5a96  
    690690        VISIT_START( node );
    691691
    692         maybeAccept_impl( node->condition, *this );
    693         maybeAccept_impl( node->message  , *this );
     692        node->condition = visitExpression( node->condition );
     693        maybeAccept_impl( node->message, *this );
    694694
    695695        VISIT_END( node );
     
    700700        MUTATE_START( node );
    701701
    702         maybeMutate_impl( node->condition, *this );
    703         maybeMutate_impl( node->message  , *this );
     702        node->condition = mutateExpression( node->condition );
     703        maybeMutate_impl( node->message, *this );
    704704
    705705        MUTATE_END( StaticAssertDecl, node );
  • src/SymTab/Mangler.cc

    r94dea96 r5da5a96  
    178178                                printQualifiers( pointerType );
    179179                                mangleName << "P";
    180                                 maybeAccept( pointerType->get_base(), *visitor );
     180                                maybeAccept( pointerType->base, *visitor );
    181181                        }
    182182
     
    185185                                printQualifiers( arrayType );
    186186                                mangleName << "A0";
    187                                 maybeAccept( arrayType->get_base(), *visitor );
     187                                maybeAccept( arrayType->base, *visitor );
    188188                        }
    189189
     
    191191                                printQualifiers( refType );
    192192                                mangleName << "R";
    193                                 maybeAccept( refType->get_base(), *visitor );
     193                                maybeAccept( refType->base, *visitor );
    194194                        }
    195195
  • src/tests/references.c

    r94dea96 r5da5a96  
    4545}
    4646
     47// --- temporary code needed to make array of references subscript work.
     48extern "C" {
     49  void ** __index(__attribute__ ((unused)) size_t sizeof_T, __attribute__ ((unused)) size_t alignof_T, void **x, ptrdiff_t y) {
     50    return (void **)((char *)x+y*sizeof(void *));
     51  }
     52  void __ctor(void ***dst, void **src) {
     53    *dst = src;
     54  }
     55}
     56__attribute__((alias("__index"))) forall( dtype T | sized(T) ) T && ?[?]( T & * x, ptrdiff_t y );
     57__attribute__((alias("__ctor"))) forall( dtype DT ) void ?{}( DT & * & dst, DT & * src);
     58forall( dtype DT ) void ^?{}( DT & * & ) {}
     59// --- end of temporary code
     60
    4761int main() {
    4862        int x = 123456, x2 = 789, *p1 = &x, **p2 = &p1, ***p3 = &p2,
     
    5266        *p3 = &p1;                          // change p2
    5367        int y = 0, z = 11, & ar[3] = { x, y, z };    // initialize array of references
    54         // &ar[1] = &z;                        // change reference array element
    55         // typeof( ar[1] ) p;                  // is int, i.e., the type of referenced object
    56         // typeof( &ar[1] ) q;                 // is int &, i.e., the type of reference
    57         // sizeof( ar[1] ) == sizeof( int );   // is true, i.e., the size of referenced object
    58         // sizeof( &ar[1] ) == sizeof( int *); // is true, i.e., the size of a reference
     68        &ar[1] = &z;                        // change reference array element
     69        typeof( ar[1] ) p = 3;              // is int, i.e., the type of referenced object
     70        typeof( &ar[1] ) q = &x;            // is int *, i.e., the type of pointer
     71        _Static_assert( sizeof( ar[1] ) == sizeof( int ), "Array type should be int." );   // is true, i.e., the size of referenced object
     72        _Static_assert( sizeof( &ar[1] ) == sizeof( int *), "Address of array should be int *." ); // is true, i.e., the size of a reference
    5973
    6074        ((int*&)&r3) = &x;                  // change r1, (&*)**r3
Note: See TracChangeset for help on using the changeset viewer.