// into a separate namespace
namespace internal
{
- // The variables within this struct will be referenced in the next functions.
- // It is a workaround that allows returning a reference to a static variable
- // while allowing constexpr evaluation of the function.
- // It has to be defined outside the function because constexpr functions
- // cannot define static variables.
- // A similar struct has also been defined in tensor.h
- template <typename Type>
- struct Uninitialized
- {
- static Type value;
- };
-
- template <typename Type>
- Type Uninitialized<Type>::value;
-
template <int dim, typename Number>
constexpr inline DEAL_II_ALWAYS_INLINE Number &
symmetric_tensor_access(const TableIndices<2> &indices,
}
}
- // The code should never reach there.
- // Returns a dummy reference to a dummy variable just to make the
- // compiler happy.
- return Uninitialized<Number>::value;
+ // The code should never reach here.
+ // We cannot return a static variable, as this class must support number
+ // types that require no instances of the number type to be in scope during
+ // a reinitialization procedure (e.g. ADOL-C adtl::adouble).
+ Assert(false, ExcInternalError());
+ return data[0];
}
}
}
- // The code should never reach there.
- // Returns a dummy reference to a dummy variable just to make the
- // compiler happy.
- return Uninitialized<Number>::value;
+ // The code should never reach here.
+ // We cannot return a static variable, as this class must support number
+ // types that require no instances of the number type to be in scope during
+ // a reinitialization procedure (e.g. ADOL-C adtl::adouble).
+ Assert(false, ExcInternalError());
+ return data[0];
}
Assert(false, ExcNotImplemented());
}
- // The code should never reach there.
- // Returns a dummy reference to a dummy variable just to make the
- // compiler happy.
- return Uninitialized<Number>::value;
+ // The code should never reach here.
+ // We cannot return a static variable, as this class must support number
+ // types that require no instances of the number type to be in scope during
+ // a reinitialization procedure (e.g. ADOL-C adtl::adouble).
+ Assert(false, ExcInternalError());
+ return data[0][0];
}
Assert(false, ExcNotImplemented());
}
- // The code should never reach there.
- // Returns a dummy reference to a dummy variable just to make the
- // compiler happy.
- return Uninitialized<Number>::value;
+ // The code should never reach here.
+ // We cannot return a static variable, as this class must support number
+ // types that require no instances of the number type to be in scope during
+ // a reinitialization procedure (e.g. ADOL-C adtl::adouble).
+ Assert(false, ExcInternalError());
+ return data[0][0];
}
} // end of namespace internal