Closed lgeretti closed 1 year ago
I think this may be a bug in g++. Here's some minimal code which generates the error:
template<class T> class DeclareOp { friend bool op(T const&); };
template<class T> class DefineOp {friend bool op(T const&) { return true; } };
class AClass : public DefineOp<AClass> { friend bool op(AClass const&); };
class AnotherClass : public DeclareOp<AClass> { };
int main() {
op(AClass());
}
Note that any of the following changes cause the code to work:
a) Removing friend bool op(AClass const&);
from AClass
.
b) Removing the base of AnotherClass
.
c) Changing the base of AnotherClass
to DefineOp<AClass>
.
d) Changing DefineOp
to be non-templated, with a declaration friend bool op(AClass const&);
Adding friend bool op(AClass const&);
to AnotherClass
results in failure even in cases a) and b) above, but cases c) and d) are still ok.
I will try to submit a defect report to GCC.
I think changing Declare
to Define
for the Approximation
fallbacks in the LowerBound
and UpperBound
classes should fix the problem for now.
Simplified DefineXXX templates. Made declarations in FloatXxx classes DOXYGEN only.
Using gcc12, there are several warnings of the following kind: