diff dmd/expression.c @ 130:a7dfa0ed966c trunk

[svn r134] Merged the DMD 1.024 frontend. Added std.base64.
author lindquist
date Fri, 28 Dec 2007 23:52:40 +0100
parents 288fe1029e1f
children 5825d48b27d1
line wrap: on
line diff
--- a/dmd/expression.c	Fri Dec 28 22:55:24 2007 +0100
+++ b/dmd/expression.c	Fri Dec 28 23:52:40 2007 +0100
@@ -1270,7 +1270,7 @@
 
 char *RealExp::toChars()
 {
-    static char buffer[sizeof(value) * 3 + 8 + 1 + 1];
+    char buffer[sizeof(value) * 3 + 8 + 1 + 1];
 
 #ifdef IN_GCC
     value.format(buffer, sizeof(buffer));
@@ -1280,7 +1280,7 @@
     sprintf(buffer, type->isimaginary() ? "%Lgi" : "%Lg", value);
 #endif
     assert(strlen(buffer) < sizeof(buffer));
-    return buffer;
+    return mem.strdup(buffer);
 }
 
 integer_t RealExp::toInteger()
@@ -1484,7 +1484,7 @@
 
 char *ComplexExp::toChars()
 {
-    static char buffer[sizeof(value) * 3 + 8 + 1];
+    char buffer[sizeof(value) * 3 + 8 + 1];
 
 #ifdef IN_GCC
     char buf1[sizeof(value) * 3 + 8 + 1];
@@ -1496,7 +1496,7 @@
     sprintf(buffer, "(%Lg+%Lgi)", creall(value), cimagl(value));
     assert(strlen(buffer) < sizeof(buffer));
 #endif
-    return buffer;
+    return mem.strdup(buffer);
 }
 
 integer_t ComplexExp::toInteger()
@@ -3140,7 +3140,13 @@
 	if (cd->isInterfaceDeclaration())
 	    error("cannot create instance of interface %s", cd->toChars());
 	else if (cd->isAbstract())
-	    error("cannot create instance of abstract class %s", cd->toChars());
+	{   error("cannot create instance of abstract class %s", cd->toChars());
+	    for (int i = 0; i < cd->vtbl.dim; i++)
+	    {	FuncDeclaration *fd = ((Dsymbol *)cd->vtbl.data[i])->isFuncDeclaration();
+		if (fd && fd->isAbstract())
+		    error("function %s is abstract", fd->toChars());
+	    }
+	}
 	checkDeprecated(sc, cd);
 	if (cd->isNested())
 	{   /* We need a 'this' pointer for the nested class.
@@ -5528,9 +5534,9 @@
 	    TemplateDeclaration *td = dte->td;
 	    assert(td);
 	    if (!arguments)
-		// Should fix deduce() so it works on NULL argument
+		// Should fix deduceFunctionTemplate() so it works on NULL argument
 		arguments = new Expressions();
-	    f = td->deduce(sc, loc, NULL, arguments);
+	    f = td->deduceFunctionTemplate(sc, loc, NULL, arguments);
 	    if (!f)
 	    {	type = Type::terror;
 		return this;
@@ -5705,7 +5711,7 @@
 	else if (e1->op == TOKtemplate)
 	{
 	    TemplateExp *te = (TemplateExp *)e1;
-	    f = te->td->deduce(sc, loc, NULL, arguments);
+	    f = te->td->deduceFunctionTemplate(sc, loc, NULL, arguments);
 	    if (!f)
 	    {	type = Type::terror;
 		return this;