Fixes warnings like this:

PolyRing.C: In function 'CoCoA::RingElem CoCoA::FixedDivisor(ConstRefRingElem)':
PolyRing.C:306:17: warning: possibly dangling reference to a temporary [-Wdangling-reference]
  306 |     const ring& k = CoeffRing(P);
      |                 ^
PolyRing.C:306:30: note: the temporary was destroyed at the end of the full expression 'CoCoA::CoeffRing(CoCoA::PolyRing((* & P)))'
  306 |     const ring& k = CoeffRing(P);
      |                     ~~~~~~~~~^~~

Instead of creating a temporary, taking a reference to it, and letting it be
destroyed, we instead store the actual value in each case.

--- src/AlgebraicCore/FreeModule.C.orig	2022-03-22 08:26:01.000000000 -0600
+++ src/AlgebraicCore/FreeModule.C	2023-03-08 11:54:07.518484847 -0700
@@ -929,7 +929,7 @@ namespace CoCoA
     CoCoA_ASSERT( IsIndet(h) );
     CoCoA_ASSERT( IsOne(wdeg(h)[0]) );
     const BigInt d = wdeg(v)[0];
-    const vector<ModuleElem>& e(gens(owner(v)));
+    const vector<ModuleElem> e(gens(owner(v)));
     ModuleElem resv(owner(v));
     for (long i=0; i<NumCompts(v); ++i)
       resv += e[i]*(homog(v[i],h)*power(h,d-wdeg(v)[0])); // and shifts ???
--- src/AlgebraicCore/PolyRing.C.orig	2022-03-22 08:26:06.000000000 -0600
+++ src/AlgebraicCore/PolyRing.C	2023-03-08 11:49:52.713964463 -0700
@@ -303,7 +303,7 @@ namespace CoCoA
     if (deg(f) == 0) return abs(LC(f));
     const long x_ind = UnivariateIndetIndex(f);
     if (x_ind < 0) CoCoA_THROW_ERROR(ERR::BadArg, "FixedDivisor: expected univariate poly");
-    const ring& k = CoeffRing(P);
+    const ring k = CoeffRing(P);
     const BigInt cont = ConvertTo<BigInt>(content(f)); // requires coeffs to be integers!
     vector<RingElem> EvalPt(NumIndets(P), zero(k)); // initially all zeroes
     long x_lo = 0;
--- src/AlgebraicCore/SparsePolyOps-hilbert.C.orig	2022-03-22 08:26:11.000000000 -0600
+++ src/AlgebraicCore/SparsePolyOps-hilbert.C	2023-03-08 11:55:12.644610530 -0700
@@ -144,7 +144,7 @@ namespace CoCoA
   RingElem HilbertNumQuot(const ideal& I)
   {
     if (!IsHomog(I))  CoCoA_THROW_ERROR("not homogeneous", "HilbertNumQuot");
-    const PolyRing& QQt = RingQQt(1);
+    const PolyRing QQt = RingQQt(1);
     if (IsZero(I)) return one(QQt);
     DenseUPolyRing HSRing = StartPoincareQQt((int)NumIndets(RingOf(I)));
     TermList TL = NewLPPTList(GBasis(I));
--- src/AlgebraicCore/SparsePolyOps-ideal-ZeroDim.C.orig	2022-03-22 11:31:37.348200939 -0600
+++ src/AlgebraicCore/SparsePolyOps-ideal-ZeroDim.C	2023-03-08 11:51:30.001633163 -0700
@@ -209,7 +209,7 @@ namespace CoCoA
     bool IsPrimary_0dimFin(const ideal& I)
     {
       VerboseLog VERBOSE("IsPrimary_0dimFin");
-      const ring& K = CoeffRing(RingOf(I));
+      const ring K = CoeffRing(RingOf(I));
       if (!IsFiniteField(K))
         CoCoA_THROW_ERROR("CoeffRing must be finite field", "IsPrimary_0dimFin");
       if (!IsZeroDim(I))
--- src/AlgebraicCore/SparsePolyOps-MinPoly.C.orig	2022-03-22 08:26:11.000000000 -0600
+++ src/AlgebraicCore/SparsePolyOps-MinPoly.C	2023-03-08 11:53:35.222925314 -0700
@@ -151,8 +151,8 @@ namespace CoCoA
         CoCoA_THROW_ERROR("arguments must be in the same ring", "MultiplicationMat");
       if (!IsZeroDim(I))
         CoCoA_THROW_ERROR("ideal must be 0-dimensional", "MultiplicationMat");
-      const vector<PPMonoidElem>& x_PPM = indets(PPM(P));
-      const vector<RingElem>& x_P = indets(P);
+      const vector<PPMonoidElem> x_PPM = indets(PPM(P));
+      const vector<RingElem> x_P = indets(P);
       vector<PPMonoidElem> QB = QuotientBasisSorted(I);
       //      std::map<PPMonoidElem, long> QBPosn = QBPositions(QB);
       RingElem f = NF(f_orig, I);
@@ -288,7 +288,7 @@ namespace CoCoA
     if (RM==Rx)
       // TODO: convert M into matrix of coefficients (if possible)
       CoCoA_THROW_ERROR(ERR::NYI, "MinPoly");
-    const ring& K = CoeffRing(Rx);
+    const ring K = CoeffRing(Rx);
     //   If (IsZZ(R) or IsQQ(R)) Then
     //     M := CanonicalHom(R, K)( M );
     //     R := K;
@@ -347,7 +347,7 @@ namespace CoCoA
 
     //if R = RingOf(X) then return MinPolyInKx(M, X); endif;
 
-    const ring& K = CoeffRing(owner(x));
+    const ring K = CoeffRing(owner(x));
     //    const vector<PPMonoidElem> QB = QuotientBasisSorted(I);
     const long LenQB = len(QuotientBasis(I)); // multiplicity
     LinDepMill ILD(K, LenQB);
@@ -419,7 +419,7 @@ namespace CoCoA
     //  const double T = CpuTime();
     const ring& P = owner(f_orig);
     const ring& P_x = owner(x);
-    const ring& K = CoeffRing(P);
+    const ring K = CoeffRing(P);
     // fare tutti i controlli sugli anelli
     if (K != CoeffRing(P_x))
       CoCoA_THROW_ERROR("incompatible coeff rings", "MinPolyQuotDef");
@@ -476,7 +476,7 @@ namespace CoCoA
     //  const double T = CpuTime();
     const ring& P = owner(f_orig);
     const ring& P_x = owner(x);
-    const ring& K = CoeffRing(P);
+    const ring K = CoeffRing(P);
     RingHom psi = CoeffEmbeddingHom(P);
     // fare tutti i controlli sugli anelli
     if (K != CoeffRing(P_x))
@@ -491,8 +491,8 @@ namespace CoCoA
     //VERBOSE(99) << f_orig << std::flush;
     //---- "MultiplicationMat"  fxQB
     double U = CpuTime();
-    const vector<RingElem>& x_P = indets(P);
-    const vector<PPMonoidElem>& x_PPM = indets(PPM(P));
+    const vector<RingElem> x_P = indets(P);
+    const vector<PPMonoidElem> x_PPM = indets(PPM(P));
     vector<RingElem> fxQB(len(QB));
     for (long j=0; j<len(QB); ++j)
     {
--- src/AlgebraicCore/SparsePolyOps-RealRadical.C.orig	2022-03-22 08:26:11.000000000 -0600
+++ src/AlgebraicCore/SparsePolyOps-RealRadical.C	2023-03-08 11:50:32.642415464 -0700
@@ -70,7 +70,7 @@ namespace CoCoA
 
       const RingHom coeff = CoeffEmbeddingHom(P);
       RingElem g = f;
-      const RingElem& x = indet(P,var);
+      const RingElem x = indet(P,var);
       const int s = sign(LC(g));
       while (true)
       {
--- src/AlgebraicCore/SparsePolyOps-RingElem.C.orig	2022-03-22 08:26:11.000000000 -0600
+++ src/AlgebraicCore/SparsePolyOps-RingElem.C	2023-03-08 11:52:17.335987587 -0700
@@ -1312,7 +1312,7 @@ namespace // anonymous for file local de
       else
         PushBack(OddPart, coeff(it), power(pp,d/2)); // integer division!
     }
-    const RingElem& x = indet(P, IndetIndex);
+    const RingElem x = indet(P, IndetIndex);
     // Fiddle answer so that LC is positive.
     RingElem ans = power(EvenPart,2) - x*power(OddPart,2);
     if (sign(LC(ans)) < 0) ans *= -1;
@@ -1339,7 +1339,7 @@ namespace // anonymous for file local de
       const int d = deg(PP(it));
       PushBack(part[d%3], coeff(it), power(pp, d/3)); // integer division!
     }
-    const RingElem& x = indet(P, IndetIndex);
+    const RingElem x = indet(P, IndetIndex);
     const RingElem part012 = part[0]*part[1]*part[2];
     // Fiddle answer so that LC is positive.
     RingElem ans = power(part[0],3) + x*(power(part[1],3)-3*part012 + x*power(part[2],3));
--- src/AlgebraicCore/SparsePolyOps-SturmSeq.C.orig	2022-03-22 08:26:11.000000000 -0600
+++ src/AlgebraicCore/SparsePolyOps-SturmSeq.C	2023-03-08 11:51:05.216971191 -0700
@@ -80,7 +80,7 @@ namespace CoCoA
     if (IsZero(f)) CoCoA_THROW_ERROR(ERR::NotNonZero, FnName);
     const int var = UnivariateIndetIndex(f);
     if (var < 0) CoCoA_THROW_ERROR(ERR::NotUnivariate, FnName);
-    const RingElem& x = indet(P,var);
+    const RingElem x = indet(P,var);
     vector<RingElem> seq;  seq.reserve(1+deg(f));
     RingElem prev = f*ConvertTo<BigInt>(CommonDenom(f));
     // ??? SLUG:  remove content from prev???
--- src/AlgebraicCore/submodule.C.orig	2022-03-22 08:26:18.000000000 -0600
+++ src/AlgebraicCore/submodule.C	2023-03-08 11:54:35.950097079 -0700
@@ -501,7 +501,7 @@ namespace CoCoA
   {
     if (!IsSparsePolyRing(RingOf(M)))
       CoCoA_THROW_ERROR(ERR::NYI, "SubmoduleImpl::IsContained");
-    const vector<ModuleElem>& g = gens(M);
+    const vector<ModuleElem> g = gens(M);
     for (long i=0; i < len(g); ++i)
       if (!IsElem(g[i], N)) return false;
     return true;
@@ -516,7 +516,7 @@ namespace CoCoA
       CoCoA_THROW_ERROR(ERR::ZeroGradingDim, "IsHomog(submodule)");
     if (IsZero(M)) return true;
     // Now we know I is non-trivial.
-    const vector<ModuleElem>& GB = TidyGens(M);
+    const vector<ModuleElem> GB = TidyGens(M);
     const long GBsize = len(GB); // MUST BE A REDUCED GBASIS !!!
     for (long i=0; i < GBsize; ++i)
       if (!IsHomog(GB[i]))  return false;
@@ -535,7 +535,7 @@ namespace CoCoA
     if (GradingDim(P)==0)
       CoCoA_THROW_ERROR(ERR::ZeroGradingDim, "LT(submodule)");
     const vector<ModuleElem>& e = gens(AmbientFreeModule(M));
-    const vector<ModuleElem>& GB = TidyGens(M);
+    const vector<ModuleElem> GB = TidyGens(M);
     vector<ModuleElem> LTs;
     const long GBsize = len(GB);
     for (long i=0; i < GBsize; ++i)
--- src/AlgebraicCore/TmpF5.C.orig	2022-03-22 08:26:13.000000000 -0600
+++ src/AlgebraicCore/TmpF5.C	2023-03-08 11:56:12.101835237 -0700
@@ -38,7 +38,7 @@ namespace CoCoA
   {
   public: // data members
     int m;
-    const PPMonoid& myPPM;
+    const PPMonoid myPPM;
     SparsePolyRing env;
   public:
     cF5_t(const vector<RingElem> &I);
--- src/AlgebraicCore/TmpF5Mat.C.orig	2022-03-22 08:26:13.000000000 -0600
+++ src/AlgebraicCore/TmpF5Mat.C	2023-03-08 11:57:39.116700618 -0700
@@ -438,11 +438,11 @@ namespace F5ns{
 
   class matrF5_t{
   private:
-    const PPMonoid& myPPM;
+    const PPMonoid myPPM;
     SparsePolyRing env;
   public:
     unsigned int curr_deg,curr_poly,red2zero,n_indets,max_gen_deg;
-    const vector<PPMonoidElem> &PPMindets;
+    const vector<PPMonoidElem> PPMindets;
     vector<PPMonoidElem> mtPPMindets;
     vector<RingElem> gens;
     GB_t GB;
--- src/tests/test-FreeModule1.C.orig	2022-03-22 08:26:43.000000000 -0600
+++ src/tests/test-FreeModule1.C	2023-03-08 11:58:15.228229733 -0700
@@ -49,7 +49,7 @@ namespace CoCoA
     const long dim = 4;
     const FreeModule F = NewFreeModule(R, dim);
     const vector<ModuleElem>& e = gens(F);
-    const vector<RingElem>& x = indets(R);
+    const vector<RingElem> x = indets(R);
     CoCoA_ASSERT_ALWAYS(len(e) == dim);
 // This does not yet compile
 //   for (long i=0; i < dim; ++i)
--- src/tests/test-hilbert1.C.orig	2022-03-22 08:26:43.000000000 -0600
+++ src/tests/test-hilbert1.C	2023-03-08 12:00:10.242929948 -0700
@@ -50,7 +50,7 @@ namespace CoCoA
 
   ideal NewQueenMovesFrom(SparsePolyRing P, long Csb, long sq1, long sq2)
   {
-    ConstRefRingElem x = CsbSquareIndet(P, Csb, sq1, sq2);
+    const RingElemAlias x = CsbSquareIndet(P, Csb, sq1, sq2);
     vector<RingElem> g;
     for ( long i=sq2+1 ; i<=Csb ; ++i )
       g.push_back(x * CsbSquareIndet(P, Csb, sq1, i));
--- src/tests/test-RootBound1.C.orig	2022-03-22 08:26:43.000000000 -0600
+++ src/tests/test-RootBound1.C	2023-03-08 12:00:55.026486230 -0700
@@ -78,7 +78,7 @@ namespace CoCoA
     CoCoA_ASSERT_ALWAYS(IsMonomial(f) || B > 0);
 
     const ring& P = owner(f);
-    const ring& k = CoeffRing(P);
+    const ring k = CoeffRing(P);
     const long index = UnivariateIndetIndex(f);
 
     const RingElem g = Fstar(f);
@@ -109,7 +109,7 @@ namespace CoCoA
     // Check that bound is invariant if poly is multiplied by a power of x
     const ring& P = owner(f);
     const long index = UnivariateIndetIndex(f);
-    const RingElem& x = indet(P,index);
+    const RingElem x = indet(P,index);
     
     for (int k=1; k < 20; ++k)
       CoCoA_ASSERT_ALWAYS(RootBound2(f*power(x,k)) == B);
@@ -145,7 +145,7 @@ namespace CoCoA
     GlobalManager CoCoAFoundations;
 
     ring P = NewPolyRing(RingQQ(), symbols("x,y"));
-    const RingElem& x = indet(P,0);
+    const RingElem x = indet(P,0);
 
     // Linear polynomials
     CheckUPB(x);
--- src/tests/test-RootBound2.C.orig	2022-03-22 08:26:43.000000000 -0600
+++ src/tests/test-RootBound2.C	2023-03-08 12:01:19.089247820 -0700
@@ -66,7 +66,7 @@ namespace CoCoA
     CoCoA_ASSERT_ALWAYS(IsMonomial(f) || B > 0);
 
     const ring& P = owner(f);
-    const ring& k = CoeffRing(P);
+    const ring k = CoeffRing(P);
     const long index = UnivariateIndetIndex(f);
 
     const RingElem radf = radical(f);
@@ -98,7 +98,7 @@ namespace CoCoA
     // Check that bound is invariant if poly is multiplied by a power of x
     const ring& P = owner(f);
     const long index = UnivariateIndetIndex(f);
-    const RingElem& x = indet(P,index);
+    const RingElem x = indet(P,index);
     
     for (int k=1; k < 20; ++k)
       CoCoA_ASSERT_ALWAYS(RootBound2(f*power(x,k)) == B);
