D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3691 - compiler 1.055 crashes with some invalid code in is(typeof())
Summary: compiler 1.055 crashes with some invalid code in is(typeof())
Status: RESOLVED DUPLICATE of issue 3685
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: Other Mac OS X
: P2 regression
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-08 08:23 UTC by Fawzi Mohamed
Modified: 2014-04-18 09:12 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Fawzi Mohamed 2010-01-08 08:23:36 UTC
{{{
template RefType(T) {
    static if (is(T == class)) {
        alias T RefType;
    } else {
        alias T* RefType;
    }
}


template UnrefType(T) {
    static if (is(T == class)) {
        alias T UnrefType;
    } else {
        alias typeof(*T) UnrefType;
    }
}

struct P{
    int i;
}


void f(T)(){
    static if(is(typeof(function RefType!(P)(){ return new UnrefType!(P); }))){
        pragma(msg,"pippo");
    }
}

void g(){
    f!(P)();
}
}}}

crashes the compiler (1.055) it seems that unreferencing the structure (which cannot be done) really upsets the compiler.
This used to work, and basically anything syntactically parseable should be accepted in is(typeof()) without crashing the compiler (it should just return false).
Comment 1 Matti Niemenmaa 2010-01-08 08:27:28 UTC

*** This issue has been marked as a duplicate of issue 3685 ***