www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13218] New: [ICE] s2ir.c 142: Must fully qualify call to

https://issues.dlang.org/show_bug.cgi?id=13218

          Issue ID: 13218
           Summary: [ICE] s2ir.c 142: Must fully qualify call to
                    ParameterTypeTuple
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: regression
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: zshazz gmail.com

The following code compiles on 2.065, but fails with "__error__\n\nInternal
error: s2ir.c 142" on 2.066 b4 and b6

````
void main()
{
    Reduced r;
}

struct Reduced
{
    private static string mangleFuncPtr(ArgTypes...)()
    {
        string result = "fnp_";
        foreach(T; ArgTypes) result ~= T.mangleof;
        return result;
    }
    void function(int) fnp_i;
    double delegate(double) fnp_d;

    void opAssign(FnT)(FnT func)
    {
        import std.traits: ParameterTypeTuple;
        // Here's the problem line:
        mixin(mangleFuncPtr!(ParameterTypeTuple!FnT) ~ " = func;");
        // Works:
        //mixin(mangleFuncPtr!(std.traits.ParameterTypeTuple!FnT) ~ " =
func;");
    }
}
````

Note, as the comments say if you fully qualify std.traits.ParameterTypeTuple,
it compiles and works just fine. (This is probably not reduced as much as
possible, but it's a pretty small subset of the code in question. My
apologies.)

Interestingly, I have code elsewhere that does essentially the same call, but
it doesn't need to be fully qualified to not crash the compiler.

--
Jul 27 2014