6325 – ICE(glue.c) forward reference error in template constraint

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6325 - ICE(glue.c) forward reference error in template constraint
Summary: ICE(glue.c) forward reference error in template constraint
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: ice
Depends on:
Blocks:
Reported: 2011年07月15日 10:20 UTC by Denis Shelomovskii
Modified: 2013年10月05日 16:43 UTC (History)
4 users (show)

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 Denis Shelomovskii 2011年07月15日 10:20:29 UTC
Original test-case was posted as comment for Issue6296. IMHO, it isn't a duplicate of those issue. DustMite-d testcase:
template Rebindable(T) if( is(T) )
{
}
template hasUnsharedAliasing(R : Rebindable!R)
{
}
struct S
{
 static Z f() { assert(0); }
 alias typeof(this) Z;
}
void main()
{
 S.f();
}
Comment 1 Vladimir Panteleev 2011年07月15日 10:50:43 UTC
One note: the main() is unnecessary for me.
Comment 2 Denis Shelomovskii 2011年07月15日 10:54:26 UTC
(In reply to comment #1)
> One note: the main() is unnecessary for me.
For me it isn't unnecessary to call it "main". It can be "g", but it must contain this body.
Comment 3 Vladimir Panteleev 2011年07月15日 10:55:43 UTC
Sorry, main() is unnecessary if I compile with -g.
Comment 4 Denis Shelomovskii 2011年07月15日 10:57:57 UTC
Corrected version of my previous comment:
For me it isn't necessary to call it "main" (if compiling without -g). It can be "f" or "g", but it must contain "S.f();" in it's body.
Comment 5 Trass3r 2011年07月15日 15:35:27 UTC
$ dmd -c bug6325.d 
DMD v2.054 DEBUG
ty = 36, '_error_'
access violation
and after removing the templates:
$ dmd -c bug6325.d 
DMD v2.054 DEBUG
ty = 38, 'typeof(this)'
Error: forward reference of typeof(this)
ty = 38, 'typeof(this)'
Error: forward reference of typeof(this)
Linux x64
Comment 6 Don 2011年10月22日 22:38:23 UTC
Probably the same issue as bug 6774.
Comment 7 Walter Bright 2013年10月05日 16:43:16 UTC
This compiles without error on dmd 2.064 head.


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