]> www.ginac.de Git - ginac.git/blobdiff - ginac/symbol.cpp
Avoid infinite loop when unarchiving realsymbol and possymbol.
[ginac.git] / ginac / symbol.cpp
index 9897bb4c3b5de35d2344ae90d13bd08d134d247b..c9db110fdc43a1cfb581128d48f592553644cfae 100644 (file)
@@ -109,6 +109,15 @@ void symbol::read_archive(const archive_node &n, lst &sym_lst)
        for (lst::const_iterator it = sym_lst.begin(); it != sym_lst.end(); ++it) {
                if (is_a<symbol>(*it) && (ex_to<symbol>(*it).name == tmp_name)) {
                        *this = ex_to<symbol>(*it);
+                       // XXX: This method is responsible for reading realsymbol
+                       // and possymbol objects too. But
+                       // basic::operator=(const basic& other)
+                       // resets status_flags::evaluated if other and *this are
+                       // of different types. Usually this is a good idea, but
+                       // doing this for symbols is wrong (for one, nothing is
+                       // going to set status_flags::evaluated, evaluation will
+                       // loop forever). Therefore we need to restore flags.
+                       setflag(status_flags::evaluated | status_flags::expanded);
                        return;
                }
        }