www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1714] New: Type specialization in IsExpression should work for templated types

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1714

           Summary: Type specialization in IsExpression should work for
                    templated types
           Product: D
           Version: 2.008
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: spec
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: dhasenan gmail.com


class Bar (T) {}
static if (is (Bar!(int) T == T!(U), U)) // should evaluate to true, U == int,
T == ? probably Bar!(int)
{}

class Foo : Bar!(int) {}
static if (is (Foo T == T!(U), U)) // should evaluate to false
{}
static if (is (Foo T : T!(U), U)) // should evaluate to true, U == int
{}


Currently, you can do similar stuff in template specializations, but it should
be extended to IsExpressions, according to the documentation. So it's implied,
anyway.


-- 
Dec 04 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1714


Don <clugdbug yahoo.com.au> changed:

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



The syntax was slightly wrong. Using correct syntax, as shown below, it failed
on all versions of DMD up to and including 2.048. It was fixed in 2.049.

class Bar (T) {}
static if (is (Bar!(int) T == W!(U), alias W, U))
{
    pragma(msg, W.stringof);
    pragma(msg, U.stringof);
} else static assert(0);

class Foo : Bar!(int) {}
static if (is (Foo T == W!(U), alias W, U))
{
    static assert(0);
}

static if (is (Foo T2 : W2!(U2), alias W2, U2))
{
    pragma(msg, W2.stringof);
    pragma(msg, U2.stringof);
} else static assert(0);

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 08 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1714


Simen Kjaeraas <simen.kjaras gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simen.kjaras gmail.com



PST ---
See also bug 3608, which is definitely related, but concerns variadic template
lists.

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