D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6995 - [CTFE] can't interpret static template method
Summary: [CTFE] can't interpret static template method
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other All
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-23 04:48 UTC by Martin Nowak
Modified: 2011-12-17 20:50 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Martin Nowak 2011-11-23 04:48:56 UTC
struct Foo
{
    static size_t index(size_t v)()
    {
        return v;
    }
}

enum s = Foo.index!(0)();

----
CTFE internal error: cannot evaluate (Foo , index)() at compile time
----

In CallExp::semantic around line 7513:

        if (!f->needThis())
        {
            VarExp *ve = new VarExp(loc, f);
            e1 = new CommaExp(loc, ue->e1, ve);
            e1->type = f->type;
        }

a comma expression is created with ue->e1 being a TypeExp.
The CTFE interpretation can't handle this case in CallExp::interpret.