forked from ldc-developers/ldc
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Dcompute] don't crash on
VarDelaration
s with no type
- Loading branch information
1 parent
5a15884
commit de345b6
Showing
2 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// RUN: %ldc -o- -mdcompute-targets=cuda-430 %s | ||
|
||
@compute(CompileFor.deviceOnly) module dcompute_enum; | ||
pragma(LDC_no_moduleinfo); | ||
import ldc.dcompute; | ||
template isUnsigned(T) | ||
{ | ||
static if (!__traits(isUnsigned, T)) | ||
enum isUnsigned = false; | ||
else static if (is(T U == enum)) | ||
enum isUnsigned = isUnsigned!U; | ||
else | ||
enum isUnsigned = __traits(isZeroInit, T) // Not char, wchar, or dchar. | ||
&& !is(immutable T == immutable bool) && !is(T == __vector); | ||
} | ||
@kernel void tst (uint* dst) | ||
{ | ||
dst[0] = isUnsigned!(typeof(dst[0])); | ||
} |