D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6968 - Segmantation fault, if exclamation mark absent
Summary: Segmantation fault, if exclamation mark absent
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Linux
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-17 12:58 UTC by Tobias Pankrath
Modified: 2012-01-28 19:34 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 Tobias Pankrath 2011-11-17 12:58:35 UTC
Note the missing exclamation marks in Pred(A, B[0]) || ...
The compiler dies with "Segmantation fault".

import std.typetuple;
import std.stdio;

template Pred(A, B)
{
    static if(is(B == int))
        enum bool Pred = true;
    else
        enum bool Pred = false;
}

template PredAny(A, B...)
{
    static if(B.length == 0)
        enum bool PredAny = false;
    else
        enum bool PredAny = Pred(A, B[0]) || PredAny(A, B[1..$]);
}

void main()
{
    pragma(msg, PredAny!(int, long, ulong, int, size_t, double, float));
};
Comment 1 github-bugzilla 2012-01-28 19:30:46 UTC
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/5783cf136f0cbee2931dfb6b2e8fa47009364090
fix Issue 6968 - Segmantation fault, if exclamation mark absent
Comment 2 github-bugzilla 2012-01-28 19:31:44 UTC
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/d1b420de149494519ab6936c5387e3f326b2265a
fix Issue 6968 - Segmantation fault, if exclamation mark absent