COMP: Ambiguous type conversion when using Clang 15.0
Problem
As illustrated in Test-one.zip and for Clang 15.0.7
, the operations of division, minimum and maximum between a geometricOneField
and volScalarField
throw an ambiguous-conversion error, e.g.:
develop/src/OpenFOAM/lnInclude/oneI.H:131:12: error: conversion from 'tmp<GeometricField<double, Foam::fvPatchField, Foam::volMesh>>' to 'Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>' is ambiguous
This typically means that the Clang compiler has found more than one possible way to perform the conversion between tmp<GeometricField<...>> to GeometricField<...>, but it cannot decide which one is the correct or intended conversion path without more explicit instructions.
Note that Gcc 7.5.0
does not throw this error.
Solution
In oneI.H
, wrapping the return type with Type
should resolve the issue - as indicated by @mark.
Environment
api = 2401
patch = 240220
HEAD = d578d48a4f
version = v2312
compiler = Clang (system) = clang version 15.0.7
mpi = SYSTEMOPENMPI = mpirun (Open MPI) 1.10.7.0.5e373bf1fd
OS = Description: openSUSE Leap 15.5
opts = linux64ClangDPInt32Opt