Sync
This commit is contained in:
parent
6f050a029e
commit
776bba907c
3887 changed files with 59894 additions and 7280 deletions
22
Task/Introspection/D/introspection.d
Normal file
22
Task/Introspection/D/introspection.d
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import std.compiler, std.math;
|
||||
|
||||
void main() {
|
||||
// Compile-time constants of the compiler version:
|
||||
static if (version_major < 2 && version_minor > 50) {
|
||||
// this prevents further compilation
|
||||
static assert(false, "I can't cope with this compiler version");
|
||||
} else {
|
||||
pragma(msg, "The compiler version is acceptable.");
|
||||
}
|
||||
|
||||
immutable bloop = 10;
|
||||
|
||||
// To check if something compiles:
|
||||
//static if (__traits(compiles, bloop.abs)) {
|
||||
static if (__traits(compiles, abs(bloop))) {
|
||||
pragma(msg, "The expression is compilable.");
|
||||
auto x = bloop.abs;
|
||||
} else {
|
||||
pragma(msg, "The expression can't be compiled.");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue