Thread overview
[Issue 1463] New: __traits: indexed template parsed as type, not value
Aug 31, 2007
d-bugmail
Feb 20, 2008
d-bugmail
Apr 14, 2011
Don
August 31, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1463

           Summary: __traits: indexed template parsed as type, not value
           Product: D
           Version: 2.003
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: reiner.pope@gmail.com


The following code fails to compile, with error "GetMembers!() is used as a type". Replacing the instance of i with 0 fixes it.

template GetMembers()
{
    const string[] GetMembers = ["hello", "bye"];
}

const i = 0;

class Foo
{
    void hello() {}
}

const f = __traits( getVirtualFunctions, Foo, GetMembers!()[i] ).length;


-- 

February 20, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1463





------- Comment #1 from htvennik@zonnet.nl  2008-02-20 15:46 -------
writing GetMembers!()[(i)] seems to fix it too. I currently use that as a
work-around.


-- 

April 14, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=1463


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug@yahoo.com.au
         Resolution|                            |FIXED


--- Comment #2 from Don <clugdbug@yahoo.com.au> 2011-04-14 15:21:20 PDT ---
Fixed between DMD2.012 and 2.020.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------