]> www.ginac.de Git - ginac.git/blobdiff - ginac/parser/parser.cpp
Fix the compliation error *for real*
[ginac.git] / ginac / parser / parser.cpp
index 42a7ae2b8c529583586f0c32784f7de5c4175b6b..78a03f81df0401f9f220f4955c276f0c036e5240 100644 (file)
@@ -25,6 +25,7 @@
 #include "debug.h"
 #include "mul.h"
 #include "constant.h"
+#include "function.h"
 
 #include <sstream>
 #include <stdexcept>
@@ -65,8 +66,19 @@ ex parser::parse_identifier_expr()
                Parse_error_("no function \"" << name << "\" with " <<
                             args.size() << " arguments");
        }
-       ex ret = reader->second(args);
-       return ret;
+       // dirty hack to distinguish between serial numbers of functions and real
+       // pointers.
+       GiNaC::function* f = NULL;
+       try {
+               unsigned serial = (unsigned)(unsigned long)(void *)(reader->second);
+               f = new GiNaC::function(serial, args);
+       }
+       catch ( std::runtime_error ) {
+               if ( f ) delete f;
+               ex ret = reader->second(args);
+               return ret;
+       }
+       return f->setflag(status_flags::dynallocated);
 }
 
 /// paren_expr:  '(' expression ')'