Skip to content

Commit

Permalink
Bugfix for ReferenceActiveType.
Browse files Browse the repository at this point in the history
The definition of the base classes was wrong and the definition of the
class in a selfreference.
  • Loading branch information
MaxSagebaum committed Dec 18, 2024
1 parent a3f1333 commit 92500dc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions include/codi/expressions/referenceActiveType.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ namespace codi {
template<typename T_Type>
struct ReferenceActiveType : public LhsExpressionInterface<typename T_Type::Real, typename T_Type::Gradient,
typename T_Type::Tape, ReferenceActiveType<T_Type>>,
public AssignmentOperators<T_Type, ReferenceActiveType<T_Type>>,
public IncrementOperators<T_Type, ReferenceActiveType<T_Type>> {
public AssignmentOperators<typename T_Type::Tape, ReferenceActiveType<T_Type>>,
public IncrementOperators<typename T_Type::Tape, ReferenceActiveType<T_Type>> {
public:

/// See ReferenceActiveType.
Expand All @@ -68,7 +68,7 @@ namespace codi {
using Identifier = typename Tape::Identifier; ///< See LhsExpressionInterface.
using Gradient = typename Tape::Gradient; ///< See LhsExpressionInterface.

private:
protected:

Type& reference;

Expand All @@ -82,8 +82,10 @@ namespace codi {
/// Constructor
CODI_INLINE ReferenceActiveType(Type& v) : reference(v), jacobian() {}

CODI_INLINE ReferenceActiveType(ReferenceActiveType const& o) : reference(o.reference), jacobian() {}

/// See LhsExpressionInterface::operator=(ExpressionInterface const&).
CODI_INLINE ReferenceActiveType<Tape>& operator=(ReferenceActiveType<Tape> const& v) {
CODI_INLINE ReferenceActiveType& operator=(ReferenceActiveType const& v) {
static_cast<LhsExpressionInterface<Real, Gradient, Tape, ReferenceActiveType>&>(*this) = v;
return *this;
}
Expand Down

0 comments on commit 92500dc

Please sign in to comment.