Remove definition of ExpressionRef::ExpressionRef(double&); Due to the removed definition, calling this method will result in a compile-time error instead of a run-time error. Change-Id: Iac2514c05d79a66fcbad124587d08eb9309aa6a5
diff --git a/include/ceres/internal/expression_ref.h b/include/ceres/internal/expression_ref.h index 3d376ee..a1afd14 100644 --- a/include/ceres/internal/expression_ref.h +++ b/include/ceres/internal/expression_ref.h
@@ -56,10 +56,14 @@ // must work for T = Jet<ExpressionRef>. ExpressionRef(double compile_time_constant); - // By adding this constructor (which always throws an error) we can detect - // invalid usage of ExpressionRef. ExpressionRef can only be created from - // constexpr doubles. - ExpressionRef(double& test); + // By adding this deleted constructor we can detect invalid usage of + // ExpressionRef. ExpressionRef must only be created from constexpr doubles. + // + // If you get a compile error here, you have probably written something like: + // T x = local_variable_; + // Change this into: + // T x = CERES_LOCAL_VARIABLE(local_variable_); + ExpressionRef(double&) = delete; // Create an ASSIGNMENT expression from other to this. //
diff --git a/internal/ceres/expression_ref.cc b/internal/ceres/expression_ref.cc index 9aa25d4..e9cda42 100644 --- a/internal/ceres/expression_ref.cc +++ b/internal/ceres/expression_ref.cc
@@ -44,11 +44,6 @@ id = Expression::CreateCompileTimeConstant(compile_time_constant); } -ExpressionRef::ExpressionRef(double& test) { - CHECK(false) - << "ExpressionRefs can only be created from compile-time constants."; -} - ExpressionRef::ExpressionRef(const ExpressionRef& other) { *this = other; } ExpressionRef& ExpressionRef::operator=(const ExpressionRef& other) {