Is this a bug? `static if` fails silently.
John Colvin via Digitalmars-d
digitalmars-d at puremagic.com
Tue Nov 4 01:54:42 PST 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:
>> 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.
a std.traits.TypeOf that errors out on non-types would be nice.
More information about the Digitalmars-d
mailing list