D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 11480 - `alias` template argument accepts `struct`, `class`, and `union` types and also loses all qualifiers
Summary: `alias` template argument accepts `struct`, `class`, and `union` types and al...
Status: RESOLVED WONTFIX
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 major
Assignee: No Owner
URL:
Keywords: accepts-invalid, wrong-code
Depends on:
Blocks:
 
Reported: 2013-11-09 02:05 UTC by Denis Shelomovskii
Modified: 2020-07-08 10:35 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Denis Shelomovskii 2013-11-09 02:05:54 UTC
---
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.
Comment 1 Nick Treleaven 2020-07-08 10:35:07 UTC
Passing int is now ok. Thanks for filing this about lost qualifiers though. For the qualifiers, I'm closing this in favour of Issue 20899.