www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1463] New: __traits: indexed template parsed as type, not value

reply d-bugmail puremagic.com writes:
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;


-- 
Aug 31 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1463






writing GetMembers!()[(i)] seems to fix it too. I currently use that as a
work-around.


-- 
Feb 20 2008
prev sibling parent d-bugmail puremagic.com writes:
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



Fixed between DMD2.012 and 2.020.

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