digitalmars.D - Is this a bug? `static if` fails silently.
- Meta (19/19) Nov 04 2014 struct Test(T)
- deadalnix (3/22) Nov 04 2014 It is not static if, it is is. Is is defined as false for invalid
- Meta (3/5) Nov 04 2014 Ah, right. That's annoyingly hard to spot, but it is not a bug I
- John Colvin (2/26) Nov 04 2014 a std.traits.TypeOf that errors out on non-types would be nice.
- John Colvin (2/29) Nov 04 2014 woops, ignore me.
- Tofu Ninja (2/3) Nov 04 2014 What is the type of a type?
- Meta (2/5) Nov 04 2014 A kind, of course. =)
struct Test(T) { static if (is(typeof(T) == int)) { pragma(msg, "test"); this(T t) { this.t = t; } } } void main() { //Nothing is printed Test!int t; } Didn't this code used to failed at the point of `typeof(T)`? Has this changed since previous releases?
Nov 04 2014
On Tuesday, 4 November 2014 at 09:00:12 UTC, Meta wrote:struct Test(T) { static if (is(typeof(T) == int)) { pragma(msg, "test"); this(T t) { this.t = t; } } } void main() { //Nothing is printed Test!int t; } Didn't this code used to failed at the point of `typeof(T)`? Has this changed since previous releases?It is not static if, it is is. Is is defined as false for invalid types.
Nov 04 2014
On Tuesday, 4 November 2014 at 09:07:10 UTC, deadalnix wrote:It is not static if, it is is. Is is defined as false for invalid types.Ah, right. That's annoyingly hard to spot, but it is not a bug I suppose.
Nov 04 2014
On Tuesday, 4 November 2014 at 09:07:10 UTC, deadalnix wrote:On Tuesday, 4 November 2014 at 09:00:12 UTC, Meta wrote:a std.traits.TypeOf that errors out on non-types would be nice.struct Test(T) { static if (is(typeof(T) == int)) { pragma(msg, "test"); this(T t) { this.t = t; } } } void main() { //Nothing is printed Test!int t; } Didn't this code used to failed at the point of `typeof(T)`? Has this changed since previous releases?It is not static if, it is is. Is is defined as false for invalid types.
Nov 04 2014
On Tuesday, 4 November 2014 at 09:54:44 UTC, John Colvin wrote:On Tuesday, 4 November 2014 at 09:07:10 UTC, deadalnix wrote:woops, ignore me.On Tuesday, 4 November 2014 at 09:00:12 UTC, Meta wrote:a std.traits.TypeOf that errors out on non-types would be nice.struct Test(T) { static if (is(typeof(T) == int)) { pragma(msg, "test"); this(T t) { this.t = t; } } } void main() { //Nothing is printed Test!int t; } Didn't this code used to failed at the point of `typeof(T)`? Has this changed since previous releases?It is not static if, it is is. Is is defined as false for invalid types.
Nov 04 2014
On Tuesday, 4 November 2014 at 09:00:12 UTC, Meta wrote:typeof(T)What is the type of a type?
Nov 04 2014
On Tuesday, 4 November 2014 at 21:20:59 UTC, Tofu Ninja wrote:On Tuesday, 4 November 2014 at 09:00:12 UTC, Meta wrote:A kind, of course. =)typeof(T)What is the type of a type?
Nov 04 2014