]> www.ginac.de Git - ginac.git/blobdiff - ginac/parser/parser.cpp
Fixed dirty hack in parser to distinguish between serial numbers and pointers.
[ginac.git] / ginac / parser / parser.cpp
index a3f3f0520c8c6bbff90330f76303af69361e1b05..d639bfe1465f1f693c627c3ec03c7ddf610f7403 100644 (file)
@@ -66,8 +66,16 @@ ex parser::parse_identifier_expr()
                Parse_error_("no function \"" << name << "\" with " <<
                             args.size() << " arguments");
        }
-       ex ret = GiNaC::function(reinterpret_cast<unsigned>(reader->second), args);
-       return ret;
+       // dirty hack to distinguish between serial numbers of functions and real
+       // pointers.
+       try {
+               GiNaC::function f(reinterpret_cast<unsigned>(reader->second), args);
+               return f;
+       }
+       catch ( std::runtime_error ) {
+               ex ret = reader->second(args);
+               return ret;
+       }
 }
 
 /// paren_expr:  '(' expression ')'