http://d.puremagic.com/issues/show_bug.cgi?id=3990



--- Comment #5 from bearophile_h...@eml.cc 2011-10-31 05:36:43 PDT ---
(In reply to comment #3)

> >    assert(*a1 == 5);
> >    alias typeof(a1) T1;
> >    assert(is(typeof(*T1)));
> 
> Dereferencing dynamic or static array without -d option is deprecated.
> I think this is 'accepts-invalid'.

Don agrees:

http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=148054


> 2.
> >    int* p1 = cast(int*)a1;
> >    assert(p1 == a1.ptr);
> 
> Explicit casting is still valid.
> 
>   cast(int*)a1
> 
> means
> 
>   cast(int*)a1.ptr

I don't see the need to accept this cast. There is the ".ptr" so this cast is
not useful in practice. And generally this cast is refused by DMD 2.056 as you
see in the following program, so you are introducing/leaving an useless special
case:


struct Foo {
    int* p;
    size_t n;
}
void main() {
    Foo f;
    auto x = cast(int*)f;
}


So I think cast(int*)a1 should be forbidden.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to