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

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-07-15T10:20:00Z
Last change time
2013-10-05T16:43:36Z
Keywords
ice
Assigned to
nobody
Creator
verylonglogin.reg

Comments

Comment #0 by verylonglogin.reg — 2011-07-15T10:20:29Z
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 by dlang-bugzilla — 2011-07-15T10:50:43Z
One note: the main() is unnecessary for me.
Comment #2 by verylonglogin.reg — 2011-07-15T10:54:26Z
(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 by dlang-bugzilla — 2011-07-15T10:55:43Z
Sorry, main() is unnecessary if I compile with -g.
Comment #4 by verylonglogin.reg — 2011-07-15T10:57:57Z
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 by hoganmeier — 2011-07-15T15:35:27Z
$ 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 by clugdbug — 2011-10-22T22:38:23Z
Probably the same issue as bug 6774.
Comment #7 by bugzilla — 2013-10-05T16:43:16Z
This compiles without error on dmd 2.064 head.