[Issue 13224] New: Error: first argument is not a symbol

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Jul 29 07:39:45 PDT 2014


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

          Issue ID: 13224
           Summary: Error: first argument is not a symbol
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: dragoscarp at gmail.com

Following code minimized from an application unitest using dunit doesn't
compile with 2.066.0-b6 (2.065 was ok):

FooTest.d(30): Error: first argument is not a symbol
FooTest.d(36): Error: template instance
FooTest.FooTest.UnitTest!()._annotations!(FooTest, Ignore, "Node", "toString",
"toHash", "opCmp", "opEquals", "Monitor", "factory") error instantiating
FooTest.d(32):        instantiated from here: _annotations!(FooTest, Ignore,
"_annotations", "Node", "toString", "toHash", "opCmp", "opEquals", "Monitor",
"factory")
FooTest.d(16):        instantiated from here: _annotations!(FooTest, Ignore,
"__ctor", "_annotations", "Node", "toString", "toHash", "opCmp", "opEquals",
"Monitor", "factory")

===================================

import std.typetuple;

class Document {
    alias NodeImpl*  Node;

    struct NodeImpl
    {
    }
}

template UnitTest()
{
    this()
    {
        alias TypeTuple!(__traits(allMembers, typeof(this))) allMembers;
        _annotations!(typeof(this), Ignore, allMembers).dup;
    }

    template _annotations(T, attribute, names...)
    {
        static if (names.length == 0)
        {
            immutable(string[]) _annotations = [];
        }
        else
        {
            static if (__traits(compiles, mixin("(new " ~ T.stringof ~ "())." ~
names[0] ~ "()")))
            {
                alias TypeTuple!(__traits(getMember, T, names[0])) member;
                TypeTuple!(__traits(getAttributes, member)) attributes;

                immutable(string[]) _annotations = _annotations!(T, attribute,
names[1 .. $]);
            }
            else
            {
                immutable(string[]) _annotations = _annotations!(T, attribute,
names[1 .. $]);
            }
        }
    }
}

struct Ignore
{
}

class FooTest
{

    mixin UnitTest;

    alias Node = Document.Node;
}

====================================================================

--


More information about the Digitalmars-d-bugs mailing list