From a77f26ffe36eb20392ff7f7ba7ece3a35f082d3e Mon Sep 17 00:00:00 2001 From: rbock Date: Thu, 7 Apr 2016 21:47:17 +0200 Subject: [PATCH] Prevent self-comparison, added more tests, fixed some expression checks --- include/sqlpp11/basic_expression_operators.h | 78 ++++++++------------ include/sqlpp11/expression.h | 4 +- include/sqlpp11/expression_return_types.h | 14 ++-- include/sqlpp11/operand_check.h | 2 +- test_static_asserts/AssertTables.h | 23 ++++++ test_static_asserts/CMakeLists.txt | 2 +- test_static_asserts/no_self_compare.cpp | 19 ++++- test_static_asserts/text.cpp | 28 ++++++- 8 files changed, 105 insertions(+), 65 deletions(-) diff --git a/include/sqlpp11/basic_expression_operators.h b/include/sqlpp11/basic_expression_operators.h index 665de9fb..8c4ae0dd 100644 --- a/include/sqlpp11/basic_expression_operators.h +++ b/include/sqlpp11/basic_expression_operators.h @@ -44,38 +44,20 @@ namespace sqlpp SQLPP_PORTABLE_STATIC_ASSERT(assert_comparison_valid_rhs_operand_t, "invalid rhs operand in comparison"); SQLPP_PORTABLE_STATIC_ASSERT(assert_comparison_lhs_rhs_differ_t, "identical lhs and rhs operand types in comparison"); - template + template using check_rhs_comparison_operand_t = static_combined_check_t< static_check_t<(is_expression_t>::value // expressions are OK or is_multi_expression_t>::value) // multi-expressions like ANY are // OK for comparisons, too and - LhsValueType::template _is_valid_operand< + value_type_of::template _is_valid_operand< sqlpp::wrap_operand_t>::value, // the correct value type is required, of course assert_comparison_valid_rhs_operand_t>, static_check_t::value, assert_comparison_lhs_rhs_differ_t>>; - template - using check_rhs_in_arguments_t = - static_combined_check_t...>; - - namespace detail - { - template class Expr, typename Lhs> - struct new_unary_expression_impl - { - using type = bad_statement; - }; - - template