www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11480] New: `alias` template argument accepts `struct`, `class`, and `union` types and also loses all qualifiers

https://d.puremagic.com/issues/show_bug.cgi?id=11480

           Summary: `alias` template argument accepts `struct`, `class`,
                    and `union` types and also loses all qualifiers
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid, wrong-code
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: verylonglogin.reg gmail.com


--- Comment #0 from Denis Shelomovskij <verylonglogin.reg gmail.com> 2013-11-09
13:05:54 MSK ---
---
template t(alias T) { }

static assert(!__traits(compiles, t!int)); // ok
static assert(!__traits(compiles, t!Object)); // fails
---

It also loses all qualifiers, e.g. this passes:
---
template X(alias T) { alias X = T; }
static assert(is(X!(const Object) == Object));
---

As a result e.g. `std.typetuple` module is broken for qualified types.

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