- The status_flags::expanded is now used on some occasions.
[ginac.git] / ginac / add.cpp
index aa8ff64f2785d40ff64e739f2562b98367d44837..717279b57ef65803e76debd4d54be80f7fe4e02a 100644 (file)
@@ -528,12 +528,16 @@ ex add::recombine_pair_to_ex(const expair & p) const
 
 ex add::expand(unsigned options) const
 {
+    if (flags & status_flags::expanded)
+        return *this;
+    
     epvector * vp = expandchildren(options);
     if (vp==0) {
         return *this;
     }
-    return (new add(vp,overall_coeff))->setflag(status_flags::expanded    |
-                                                status_flags::dynallocated );
+    return (new add(vp,overall_coeff))->
+        setflag(status_flags::expanded |
+                status_flags::dynallocated);
 }
 
 //////////