Comment #0 by john.loughran.colvin — 2014-03-21T05:43:27Z
template MakeVecType(Base, ubyte length)
{
mixin(`alias MakeVecType = ` ~ Base.stringof ~ length.to!string() ~ `;`);
}
alias BaseT = float;
static if(is(MakeVecType!(BaseT, 8)))
{
enum vecLength = 8;
}
else static if(is(MakeVecType!(BaseT, 4)))
{
enum vecLength = 4;
}
else static if(is(MakeVecType!(BaseT, 2)))
{
enum vecLength = 2;
}
else
{
static assert(false, "Insufficient SIMD support");
}
fails to compile with the error
Error: AVX vector types not supported
If my understanding is correct, this shouldn't be an error. The first is(...) should just evaluate to false.
Comment #1 by clugdbug — 2014-04-09T08:34:47Z
I think you meant is(typeof(MakeVecType!(BaseT, 8)))
is() on its own doesn't suppress error messages.
Comment #2 by dlang-bugzilla — 2014-04-09T08:55:11Z
(In reply to Don from comment #1)
> I think you meant is(typeof(MakeVecType!(BaseT, 8)))
>
> is() on its own doesn't suppress error messages.
Huh? That's not right.
alias DerefOf(X) = typeof(*X.init);
static if (is(DerefOf!int))
{
pragma(msg, "int is dereferenceable");
}
else
{
pragma(msg, "int is not dereferenceable");
}
Comment #3 by dlang-bugzilla — 2014-04-09T09:01:28Z
The error is emitted from the glue layer, so as I understand it is impossible to "catch" using is().
Comment #4 by yebblies — 2014-04-12T15:02:37Z
Like issue 8425 ?
Comment #5 by bugzilla — 2016-11-22T04:00:23Z
The trouble is that float8 is supported by front ends other than DMD, so putting the error into the front end makes it less generic. DMD not supporting float8 is listed in other bugzilla issues. I've currently begun work on supporting float8 in DMD, so fixing this is not worth the effort.
Comment #6 by yebblies — 2016-11-22T10:16:02Z
Actually this has worked just fine (with the necessary imports added) since 8425 was fixed, as this was part of the point of 8425.
Putting the error in the frontend does not make it less generic, and it also allows correct behavior on systems with no dmd vector support at all, like win32.
*** This issue has been marked as a duplicate of issue 8425 ***