Skip to content

Compilation issues with code templates #255

@DanielMazurkiewicz

Description

@DanielMazurkiewicz

Was getting bunch of errors like this:

micmac/include/general/ptxd.h:192:16: error: template-id not allowed for constructor in C++20 [-Werror=template-id-cdtor]
  192 |      Pt2d<Type>()  : x (0), y (0) {}
      |                ^

Here is changes I applied to get rid of these in order to compile:

diff --git a/include/general/garb_coll_pub.h b/include/general/garb_coll_pub.h
index c77308c69..051097ecd 100755
--- a/include/general/garb_coll_pub.h
+++ b/include/general/garb_coll_pub.h
@@ -56,7 +56,7 @@ template <class Type>  class ElList :  public  PRC0
 {
    public :
 
-       ElList<Type>();
+       ElList();
 
        Type        car() const;  // Fatal error when empty
        ElList<Type>  cdr() const;  // Fatal error when empty
@@ -71,7 +71,7 @@ template <class Type>  class ElList :  public  PRC0
        INT                  card() const;
        void                 clear() {while(!empty()) pop();}
 
-      ElList<Type>(RC_Object*);
+      ElList(RC_Object*);
 };
 
 template <class Type>  class liste_phys : public RC_Object
diff --git a/include/general/ptxd.h b/include/general/ptxd.h
index c9ade41e5..c69792e98 100755
--- a/include/general/ptxd.h
+++ b/include/general/ptxd.h
@@ -189,11 +189,11 @@ template <class Type> class Pt2d : public  ElStdTypeScal<Type>
 
   // Constructeur
 
-     Pt2d<Type>()  : x (0), y (0) {}
-     Pt2d<Type>(Type X,Type Y) : x (X), y (Y) {}
+     Pt2d()  : x (0), y (0) {}
+     Pt2d(Type X,Type Y) : x (X), y (Y) {}
 
-     Pt2d<Type>(const Pt2d<Type>& p) : x (p.x), y (p.y) {}
-     explicit Pt2d<Type>(const Pt2d<tCompl>& p) :
+     Pt2d(const Pt2d<Type>& p) : x (p.x), y (p.y) {}
+     explicit Pt2d(const Pt2d<tCompl>& p) :
               x( TCompl<Type>::FromC( p.x)),
               y( TCompl<Type>::FromC( p.y))
      {
@@ -846,15 +846,15 @@ template <class Type> class Pt3d : public  ElStdTypeScal<Type>
 
      Pt3d();
 
-     Pt3d<Type>(const Pt3d<Type>& ); // to please visual
-     explicit Pt3d<Type>(const Pt3d<tCompl>& p);
+     Pt3d(const Pt3d<Type>& ); // to please visual
+     explicit Pt3d(const Pt3d<tCompl>& p);
 
      static  Pt3d<Type> P3ToThisT(const Pt3d<int> & aP){return Pt3d<Type>(Type(aP.x),Type(aP.y),Type(aP.z));}
      static  Pt3d<Type> P3ToThisT(const Pt3d<double> & aP){return Pt3d<Type>(Type(aP.x),Type(aP.y),Type(aP.z));}
      static  Pt3d<Type> P3ToThisT(const Pt3d<float> & aP){return Pt3d<Type>(Type(aP.x),Type(aP.y),Type(aP.z));}
 
 
-     Pt3d<Type>(const Pt2d<Type>&,Type z); // to please visual
+     Pt3d(const Pt2d<Type>&,Type z); // to please visual
 
      Pt3d<Type> mcbyc(const Pt3d<Type> & p2) const
                 {return Pt3d(x*p2.x,y*p2.y,z*p2.z);}
diff --git a/include/private/flux_pts_tpl.h b/include/private/flux_pts_tpl.h
index c295f4901..9d2ad0578 100755
--- a/include/private/flux_pts_tpl.h
+++ b/include/private/flux_pts_tpl.h
@@ -125,7 +125,7 @@ template <class Type> class Std_Pack_Of_Pts : public Std_Pack_Of_Pts_Gen
       virtual void rgb_bgr(const Std_Pack_Of_Pts_Gen *);
 
     private :
-       Std_Pack_Of_Pts<Type> (INT dim,INT sz_buf);
+       Std_Pack_Of_Pts (INT dim,INT sz_buf);
 
        // _pts[d][i] == coordinate of the ith Pts in the dth dimension
        Tab_Prov<Tab_Prov<Type> *>   * _tprov_tprov;
diff --git a/src/op_buf/opb_general.cpp b/src/op_buf/opb_general.cpp
index 75b1e9d27..d6d755ece 100755
--- a/src/op_buf/opb_general.cpp
+++ b/src/op_buf/opb_general.cpp
@@ -212,7 +212,7 @@ template <class TyData,class TyBase> class Buf_Fonc_OB_TPL
                                            : public Buf_Fonc_Op_buf
 {
       public :
-         Buf_Fonc_OB_TPL<TyData,TyBase>
+         Buf_Fonc_OB_TPL
          (
             Flux_Pts_Computed  * flx,
             Fonc_Num_Computed *,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions