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
//T compiles:yes | |
//T has-passed:yes | |
//T retval:42 | |
//? Tests TernaryOperator | |
import std.stdio; | |
int main() { | |
auto s = 0; | |
ubyte right = cast(ubyte) 42; |
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
module d.semantic.valuerange; | |
import d.semantic.semantic; | |
import d.ir.type; | |
import d.ast.expression; | |
import d.ir.expression; | |
struct ValueRange { | |
double _min; |
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
import std.stdio; | |
import std.string; | |
void main() { | |
getLibString().writeLibs(); | |
} | |
string getLibString(string p_llvmConfig="llvm-config") { | |
import std.process; |
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
module combtest; | |
import std.string; | |
import std.stdio; | |
import std.file; | |
import std.conv; | |
struct Test { | |
public: | |
uint number; | |
bool compiles; |
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
static struct Test0 { | |
static: | |
// Tests the simplest of programs. | |
int main() { | |
return 42; | |
} | |
bool run() { return main() == 42; } |
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
module d.convenience.traits; | |
import d.ir.expression; | |
import d.ir.type; | |
QualType elementType(Expression e) { | |
assert(isSliceOrArray(e) || isPointer(e), typeid(e.type.type).toString() ~ " has no elementType"); | |
return elementType(e.type); | |
} |
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
module rot13_leetify; | |
import std.stdio; | |
import std.algorithm:map,filter; | |
char rot13(char c) pure { | |
switch(c) { | |
case 'a': .. case 'm': |
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
// returns where the pattern matched | |
uint[] match(T)(T[] elems, T[] pattern) { | |
uint[] positionsMatched; | |
uint posInPattern; | |
uint posInElems; | |
while (elems.length - posInElems >= pattern.length - posInPattern) { | |
if (pattern[posInPattern] == elems[posInElems]) { | |
if (posInPattern == pattern.length-1) { |
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
struct V3 { | |
int x; | |
int y; | |
int z; | |
int w = 30; | |
} | |
int fn(V3 v3) { | |
return v3.y; | |
} | |
int fn2(V3 v3) { |
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
diff --git a/src/dtemplate.d b/src/dtemplate.d | |
index d90d25c..d3c1587 100644 | |
--- a/src/dtemplate.d | |
+++ b/src/dtemplate.d | |
@@ -7943,8 +7943,8 @@ extern (C++) class TemplateInstance : ScopeDsymbol | |
Declaration d = sa.isDeclaration(); | |
if ((td && td.literal) || (ti && ti.enclosing) || (d && !d.isDataseg() && !(d.storage_class & STCmanifest) && (!d.isFuncDeclaration() || d.isFuncDeclaration().isNested()) && !isTemplateMixin())) | |
{ | |
- // if module level template | |
- if (isstatic) |
OlderNewer