763 – Segfault compiling template code on Linux

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 763 - Segfault compiling template code on Linux
Summary: Segfault compiling template code on Linux
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 Windows
: P2 normal
Assignee: Walter Bright
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
Reported: 2006年12月28日 15:28 UTC by Sean Kelly
Modified: 2014年02月15日 13:19 UTC (History)
0 users

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Sean Kelly 2006年12月28日 15:28:56 UTC
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.
Comment 1 Sean Kelly 2006年12月28日 15:40:23 UTC
Correction, this crashes on Win32 as well.
Comment 2 Walter Bright 2007年01月03日 22:15:45 UTC
Fixed DMD 1.00


AltStyle によって変換されたページ (->オリジナル) /