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

Changeset 1551

Show
Ignore:
Timestamp:
05/24/10 04:27:16 (15 years ago)
Author:
rsinfu
Message:

Fixed bugzilla 4219: hasAliasing does not care about immutable.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/docsrc/changelog.dd

    r1550 r1551  
    1313    $(BUGSFIXED 
    1414    $(LI $(BUGZILLA 2738): Rebindable should work for interfaces.) 
    1515    $(LI $(BUGZILLA 2835): std.socket.TcpSocket doesn't actually connect) 
    1616    $(LI $(BUGZILLA 3088): std.xml.check() fails on xml comments) 
    1717    $(LI $(BUGZILLA 3200): std.xml doesn't follow spec for Tag.text) 
    1818    $(LI $(BUGZILLA 3873): std.range.repeat should have popBack defined) 
    1919    $(LI $(BUGZILLA 3880): std.regex functions with const/immutable Regex object) 
    2020    $(LI $(BUGZILLA 4109): writeln doesn't work with empty static array) 
    2121    $(LI $(BUGZILLA 4202): Changset 1517 doesn't compile) 
    2222    $(LI $(BUGZILLA 4228): std.array.replace contains 2 bugs) 
     23    $(LI $(BUGZILLA 4219): hasAliasing does not care about immutable) 
    2324    ) 
    2425) 
    2526 
    2627<div id=version> 
    2728$(UL 
    2829    $(NEW 047) 
    2930    $(NEW 046) 
    3031    $(NEW 045) 
    3132    $(NEW 044) 
    3233    $(NEW 043) 
  • trunk/phobos/std/traits.d

    r1541 r1551  
    894894    { 
    895895        enum hasObjects = hasObjects!(U, T[1 .. $]); 
    896896    } 
    897897    else static if (is(T[0] == struct)) 
    898898    { 
    899899        enum hasObjects = hasObjects!( 
    900900            RepresentationTypeTuple!(T[0]), T[1 .. $]); 
    901901    } 
    902902    else 
    903903    { 
    904         enum hasObjects = is(T[0] == class) || hasObjects!(T[1 .. $]); 
     904        enum hasObjects = (is(T[0] == class) && !is(T[0] == immutable)) || 
     905            hasObjects!(T[1 .. $]); 
    905906    } 
    906907} 
    907908 
    908909/** 
    909910Returns $(D true) if and only if $(D T)'s representation includes at 
    910911least one of the following: $(OL $(LI a raw pointer $(D U*) and $(D U) 
    911912is not immutable;) $(LI an array $(D U[]) and $(D U) is not 
    912913immutable;) $(LI a reference to a class type $(D C) and $(D C) is not 
    913914immutable.)) 
    914915*/ 
     
    917918{ 
    918919    enum hasAliasing = hasRawAliasing!(T) || hasObjects!(T); 
    919920} 
    920921 
    921922unittest 
    922923{ 
    923924    struct S1 { int a; Object b; } 
    924925    static assert(hasAliasing!(S1)); 
    925926    struct S2 { string a; } 
    926927    static assert(!hasAliasing!(S2)); 
     928    struct S3 { int a; immutable Object b; } 
     929    static assert(!hasAliasing!(S3)); 
    927930} 
    928931 
    929932//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::// 
    930933// Classes and Interfaces 
    931934//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::// 
    932935 
    933936/*** 
    934937 * Get a $(D_PARAM TypeTuple) of the base class and base interfaces of 
    935938 * this class or interface. $(D_PARAM BaseTypeTuple!(Object)) returns 
    936939 * the empty type tuple.