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

Changeset 1709

Show
Ignore:
Timestamp:
07/02/10 18:54:51 (14 years ago)
Author:
sean
Message:

Bug 2627: std.traits.hasAliasing reports true for static arrays.

Applied the same change to std.traits.hasLocalAliasing.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/phobos/std/traits.d

    r1705 r1709  
    859859private template HasRawLocalPointerImpl(T...) 
    860860{ 
    861861    static if (T.length == 0) 
    862862    { 
    863863        enum result = false; 
    864864    } 
    865865    else 
    866866    { 
    867867        static if (is(T[0] foo : U*, U)) 
    868868            enum hasRawLocalAliasing = !is(U == immutable) && !is(U == shared); 
    869         else static if (is(T[0] foo : U[], U)
     869        else static if (is(T[0] foo : U[], U) && !isStaticArray!(T[0])
    870870            enum hasRawLocalAliasing = !is(U == immutable) && !is(U == shared); 
    871871        else 
    872872            enum hasRawLocalAliasing = false; 
    873873        enum result = hasRawLocalAliasing || HasRawLocalPointerImpl!(T[1 .. $]).result; 
    874874    } 
    875875} 
    876876 
    877877/* 
    878878Statically evaluates to $(D true) if and only if $(D T)'s 
    879879representation contains at least one field of pointer or array type. 
     
    11301130    static assert(!hasLocalAliasing!(S2)); 
    11311131    struct S3 { int a; immutable Object b; } 
    11321132    static assert(!hasLocalAliasing!(S3)); 
    11331133 
    11341134    struct S4 { int a; shared Object b; } 
    11351135    static assert(!hasLocalAliasing!(S4)); 
    11361136    struct S5 { char[] a; } 
    11371137    static assert(hasLocalAliasing!(S5)); 
    11381138    struct S6 { shared char[] b; } 
    11391139    static assert(!hasLocalAliasing!(S6)); 
     1140    struct S7 { float[3] vals; } 
     1141    static assert(!hasLocalAliasing!(S7)); 
    11401142} 
    11411143 
    11421144//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::// 
    11431145// Classes and Interfaces 
    11441146//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::// 
    11451147 
    11461148/*** 
    11471149 * Get a $(D_PARAM TypeTuple) of the base class and base interfaces of 
    11481150 * this class or interface. $(D_PARAM BaseTypeTuple!(Object)) returns 
    11491151 * the empty type tuple.