OpenFOAM does not compile with GCC and cpp20
Some class e.g. DiagonalMatrix, Compound ... raise the following compilation error:
OpenFOAM-v2312/src/OpenFOAM/lnInclude/token.H:336:21: error: expected unqualified-id before ‘const’
336 | Compound<T>(const Compound<T>&) = delete;
| ^~~~~
OpenFOAM-v2312/src/OpenFOAM/lnInclude/token.H:336:21: error: expected ‘)’ before ‘const’
336 | Compound<T>(const Compound<T>&) = delete;
| ~^~~~~
| )
A fix was proposed by Mohammed Elwardi Fadeli and he created a Godbolt example:
https://godbolt.org/z/rcMG39Gaj
template<class T, class U>
class DiagMatrix
{
// Clang compiles this (with all versions)
// But Gcc does not
//DiagMatrix<T, T>();
// But this is probably not intended
// This compiles with Gcc c++17
// but not with Gcc c++20 or c++23
DiagMatrix<T, U>();
// All compilers will compile this though
//DiagMatrix();
};
More details can be found here:
https://github.com/exasim-project/FoamAdapter/issues/2
To summarize the template arguments of the constructors/destructors needs to be removed:
Would it be possible to include the fix in upcoming release.
What is the workflow to merge these changes? Should we create a patch or will you create a branch for us where we can push the required changes?
Edited by Henning Scheufler