From 710b1b1e26a39e574d60eb5ee6fabd9fc72f9df7 Mon Sep 17 00:00:00 2001 From: Stephane Del Pino <stephane.delpino44@gmail.com> Date: Mon, 12 Oct 2020 20:33:30 +0200 Subject: [PATCH] Change construction of a 0 singleton as an R^d list This is a work around a clang-10 bug --- src/language/node_processor/AffectationProcessor.hpp | 11 +++++++---- tests/test_AffectationToTupleProcessor.cpp | 5 +++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/language/node_processor/AffectationProcessor.hpp b/src/language/node_processor/AffectationProcessor.hpp index c58ea1670..f3f8af44f 100644 --- a/src/language/node_processor/AffectationProcessor.hpp +++ b/src/language/node_processor/AffectationProcessor.hpp @@ -419,13 +419,16 @@ class AffectationToTupleProcessor final : public INodeProcessor } else { std::ostringstream os; os << v << std::ends; - *m_lhs = std::vector{os.str()}; + *m_lhs = std::vector<std::string>{os.str()}; } } else if constexpr (std::is_same_v<ValueT, TinyVector<1>> and std::is_arithmetic_v<T>) { - *m_lhs = std::vector{TinyVector<1>{static_cast<double>(v)}}; - } else if constexpr (is_tiny_vector_v<ValueT> and std::is_same_v<T, int64_t>) { + *m_lhs = std::vector<TinyVector<1>>{TinyVector<1>{static_cast<double>(v)}}; + } else if constexpr (std::is_same_v<ValueT, TinyVector<2>> and std::is_same_v<T, int64_t>) { Assert(v == 0); - *m_lhs = std::vector<ValueT>{zero}; + *m_lhs = std::vector<TinyVector<2>>{TinyVector<2>{zero}}; + } else if constexpr (std::is_same_v<ValueT, TinyVector<3>> and std::is_same_v<T, int64_t>) { + Assert(v == 0); + *m_lhs = std::vector<TinyVector<3>>{TinyVector<3>{zero}}; } else { // LCOV_EXCL_START throw ParseError("unexpected error: unexpected right hand side type in affectation", m_node.begin()); diff --git a/tests/test_AffectationToTupleProcessor.cpp b/tests/test_AffectationToTupleProcessor.cpp index bb7f8a299..3720bc856 100644 --- a/tests/test_AffectationToTupleProcessor.cpp +++ b/tests/test_AffectationToTupleProcessor.cpp @@ -127,6 +127,11 @@ let t :(R^2); t = (0); )", "t", (std::vector<TinyVector<2>>{TinyVector<2>{0, 0}})); + CHECK_AFFECTATION_RESULT(R"( +let t :(R^3); t = (0); +)", + "t", (std::vector<TinyVector<3>>{TinyVector<3>{0, 0, 0}})); + CHECK_AFFECTATION_RESULT(R"( let x : R^1, x = 1; let t :(R^1); t = (x,2); -- GitLab