[Issue 763] New: Segfault compiling template code on Linux
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Dec 28 13:28:59 PST 2006
http://d.puremagic.com/issues/show_bug.cgi?id=763
Summary: Segfault compiling template code on Linux
Product: D
Version: 0.177
Platform: PC
OS/Version: Windows
Status: NEW
Keywords: ice-on-valid-code
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: sean at f4.ca
This doesn't appear to be a problem on Win32.
----------
module a;
private
{
struct IsEqual( T )
{
bool opCall( T p1, T p2 )
{
return p1 == p2;
}
}
template ElemTypeOf( T )
{
alias typeof(T[0]) ElemTypeOf;
}
}
template find_( Elem, Pred = IsEqual!(Elem) )
{
size_t fn( Elem[] buf, Elem pat, Pred pred = Pred.init )
{
return buf.length;
}
}
template find( Buf, Pat )
{
size_t find( Buf buf, Pat pat )
{
return find_!(ElemTypeOf!(Buf)).fn( buf, pat );
}
}
----------
module b;
private import a;
int fn()
{
return find( "123", '2' );
}
----------
Simply run "dmd a.d b.d" and watch the fireworks. This appears to be related
to the default final parameter, Pred.
--
More information about the Digitalmars-d-bugs
mailing list