diff gen/tollvm.cpp @ 90:16e88334bba7 trunk

[svn r94] started on complex support calling final class methods was being treated as a virtual call failing an assertion.
author lindquist
date Wed, 07 Nov 2007 03:36:07 +0100
parents 058d3925950e
children 3f949c6e2e9d
line wrap: on
line diff
--- a/gen/tollvm.cpp	Wed Nov 07 02:45:47 2007 +0100
+++ b/gen/tollvm.cpp	Wed Nov 07 03:36:07 2007 +0100
@@ -69,9 +69,10 @@
 
     // complex
     case Tcomplex32:
+        return DtoComplexType(llvm::Type::FloatTy);
     case Tcomplex64:
     case Tcomplex80:
-        assert(0 && "complex number types not yet implemented");
+        return DtoComplexType(llvm::Type::DoubleTy);
 
     // pointers
     case Tpointer: {
@@ -376,6 +377,16 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
+const llvm::StructType* DtoComplexType(const llvm::Type* base)
+{
+    std::vector<const llvm::Type*> types;
+    types.push_back(base);
+    types.push_back(base);
+    return llvm::StructType::get(types);
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////
+
 static llvm::Function* LLVM_DeclareMemIntrinsic(const char* name, int bits, bool set=false)
 {
     assert(bits == 32 || bits == 64);