View Issue Details

IDProjectCategoryView StatusLast Update
0004093OpenFOAMPatchpublic2024-06-10 10:59
Reporterbonnymei Assigned Tohenry  
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionfixed 
Product Versiondev 
Fixed in Versiondev 
Summary0004093: verbose warning about template-id not allowed for ctor/dtor with gcc 14.1
Descriptionrecently my linux box was updated and it had gcc 14.1.
After that, I got warning messages related to template-id-cdtor when OpenFOAM was compiled as follows:

virtual ~fvPatchField<Type>()
warning: template-id not allowed for destructor in C++20

After googling what it is about, it turned out that before c++20, there were two ways of writing the ctor/dtor declaration but after c++20, the classname<T> is invalid as only injected-class-name is allowed in writing the declarations for ctor/dtor. It seems that from gcc 14.1, the compiler checks it as a warning.

So the warnings were from the declaration of ctor/dtor that reads as classname followed by template argument like "classname<T>" and affected files are
  GeometricFieldSources.H
  pointPatchField.H
  DiagonalMatrix.H
  fvPatchField.H
  fvsPatchField.H
  slicedFvPatchField.H
  slicedFvsPatchField.H

cleaning the warning is just removing the template ids in ctor/dtor and I made a patch file for your reference.
Steps To ReproduceJust compile the OpenFOAM source code with gcc 14.1 and above.
TagsNo tags attached.

Activities

bonnymei

2024-06-10 05:52

reporter  

patch.diff (4,014 bytes)   
diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldSources.H b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldSources.H
index ca649931b0..7c3f995a82 100644
--- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldSources.H
+++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldSources.H
@@ -165,7 +165,7 @@ public:
     // Constructors
 
         //- Construct from internal field
-        NoFieldSource<Type, GeoMesh>
+        NoFieldSource
         (
             const DimensionedField<Type, GeoMesh>& iF
         )
diff --git a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H
index 404bccdea5..1660af37be 100644
--- a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H
+++ b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H
@@ -263,7 +263,7 @@ public:
 
 
     //- Destructor
-    virtual ~pointPatchField<Type>()
+    virtual ~pointPatchField()
     {}
 
 
diff --git a/src/OpenFOAM/matrices/DiagonalMatrix/DiagonalMatrix.H b/src/OpenFOAM/matrices/DiagonalMatrix/DiagonalMatrix.H
index 7b420bb0e9..00868950b8 100644
--- a/src/OpenFOAM/matrices/DiagonalMatrix/DiagonalMatrix.H
+++ b/src/OpenFOAM/matrices/DiagonalMatrix/DiagonalMatrix.H
@@ -61,17 +61,17 @@ public:
     // Constructors
 
         //- Null constructor.
-        DiagonalMatrix<Type>();
+        DiagonalMatrix();
 
         //- Construct from diagonal component of a Matrix
         template<class Form>
-        DiagonalMatrix<Type>(const Matrix<Form, Type>&);
+        DiagonalMatrix(const Matrix<Form, Type>&);
 
         //- Construct empty from size
-        DiagonalMatrix<Type>(const label size);
+        DiagonalMatrix(const label size);
 
         //- Construct from size and a value
-        DiagonalMatrix<Type>(const label, const Type&);
+        DiagonalMatrix(const label, const Type&);
 
         //- Construct from Istream.
         DiagonalMatrix(Istream&);
diff --git a/src/finiteVolume/fields/fvPatchFields/basic/sliced/slicedFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/basic/sliced/slicedFvPatchField.H
index eda023dd16..cd46151d47 100644
--- a/src/finiteVolume/fields/fvPatchFields/basic/sliced/slicedFvPatchField.H
+++ b/src/finiteVolume/fields/fvPatchFields/basic/sliced/slicedFvPatchField.H
@@ -109,7 +109,7 @@ public:
 
 
     //- Destructor
-    virtual ~slicedFvPatchField<Type>();
+    virtual ~slicedFvPatchField();
 
 
     // Member Functions
diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H
index c2281ccaa8..822e0ecd68 100644
--- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H
+++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H
@@ -299,7 +299,7 @@ public:
 
 
     //- Destructor
-    virtual ~fvPatchField<Type>()
+    virtual ~fvPatchField()
     {}
 
 
diff --git a/src/finiteVolume/fields/fvsPatchFields/basic/sliced/slicedFvsPatchField.H b/src/finiteVolume/fields/fvsPatchFields/basic/sliced/slicedFvsPatchField.H
index 15093217b8..a544df6008 100644
--- a/src/finiteVolume/fields/fvsPatchFields/basic/sliced/slicedFvsPatchField.H
+++ b/src/finiteVolume/fields/fvsPatchFields/basic/sliced/slicedFvsPatchField.H
@@ -100,7 +100,7 @@ public:
 
 
     //- Destructor
-    virtual ~slicedFvsPatchField<Type>();
+    virtual ~slicedFvsPatchField();
 
 
     // Member Functions
diff --git a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H
index 5b62518ee6..81065a6ee5 100644
--- a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H
+++ b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H
@@ -293,7 +293,7 @@ public:
 
 
     //- Destructor
-    virtual ~fvsPatchField<Type>()
+    virtual ~fvsPatchField()
     {}
 
 
patch.diff (4,014 bytes)   

henry

2024-06-10 10:59

manager   ~0013257

Resolved by commit b986611242ef33b5717278fad8a8166ff6fc5df8

Issue History

Date Modified Username Field Change
2024-06-10 05:52 bonnymei New Issue
2024-06-10 05:52 bonnymei File Added: patch.diff
2024-06-10 10:59 henry Assigned To => henry
2024-06-10 10:59 henry Status new => resolved
2024-06-10 10:59 henry Resolution open => fixed
2024-06-10 10:59 henry Fixed in Version => dev
2024-06-10 10:59 henry Note Added: 0013257