D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 8255 - [CTFE] ICE when passing 'ref' literal
Summary: [CTFE] ICE when passing 'ref' literal
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 major
Assignee: No Owner
URL:
Keywords: CTFE, ice
Depends on: 7988
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-16 15:47 UTC by dlang+issues
Modified: 2021-02-20 05:57 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description dlang+issues 2012-06-16 15:47:50 UTC
struct G { }
struct F(T) { void f(ref T) { } }
pragma(msg, F!G().f(G.init));
void main() { }
Comment 1 Kenji Hara 2012-06-17 00:10:51 UTC
This is the CTFE problem on out of function scope.

struct G {}
struct F(T) { void f(ref T) {} }

pragma(msg, F!G().f(G.init));   // ICE
enum b = { F!G().f(G.init); return true; }();    // OK

void main()
{
    F!G().f(G.init);    // OK
}
Comment 2 Don 2012-09-26 00:45:55 UTC
Before CTFE begins, the code in comment 1 is translated into:

F().f((G __tmpsl5 = G(); , __tmpsl5))

The problem is that the comma expression is evaluated outside of CTFE.
This would be fixed by bug 7988.
Comment 3 Walter Bright 2013-10-06 23:21:23 UTC
I get the following message from 2.064 head:

test.d(3): Error: function test.F!(G).F.f (ref G _param_0) is not callable using argument types (G)
test.d(3):        while evaluating pragma(msg, F().f(G()))

No ice.
Comment 4 github-bugzilla 2013-11-16 00:59:38 UTC
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/053c0d2ab1cd239714cf1d4078e89a76b2eb6ec0
fix Issue 8255 - [CTFE] ICE when passing 'ref' literal