diff gen/toir.cpp @ 1595:628433c343b4

Fixed DStress tests nocompile/c/{const_32_B.d,const_32_C.d}. Updated the runtest script to build libtangobos-partial.a if it hasn't already been built. Added in signbit() and va_arg!()() to libtangobos-partial.a so more of the phobos dependent DStress tests pass.
author Robert Clipsham <robert@octarineparrot.com>
date Sun, 08 Nov 2009 16:16:17 +0000
parents b4616536dc04
children 5c0cebff9be8
line wrap: on
line diff
--- a/gen/toir.cpp	Sat Nov 07 14:21:56 2009 +0000
+++ b/gen/toir.cpp	Sun Nov 08 16:16:17 2009 +0000
@@ -266,8 +266,16 @@
     VarDeclaration* vd = var->isVarDeclaration();
     if (vd && vd->isConst() && vd->init)
     {
+        if (vd->inuse)
+        {
+            error("recursive reference %s", toChars());
+            return llvm::UndefValue::get(DtoType(type));
+        }
+        vd->inuse++;
+        LLConstant* ret = DtoConstInitializer(loc, type, vd->init);
+        vd->inuse--;
         // return the initializer
-        return DtoConstInitializer(loc, type, vd->init);
+        return ret;
     }
 
     // fail