The previous fix wasn't.

Found this via build-system tests of static asserts through MSVC.
This commit is contained in:
rbock
2016-09-02 22:35:12 +02:00
parent d841a7d8a5
commit 827c8dbf61
20 changed files with 34 additions and 37 deletions

View File

@@ -93,7 +93,7 @@ namespace sqlpp
}
template <typename Check, typename Else>
auto _else_impl(Check, Else else_) -> Check;
auto _else_impl(Check, Else else_) -> inconsistent<Check>;
public:
case_then_t(When when, Then then) : _when(when), _then(then)
@@ -127,7 +127,7 @@ namespace sqlpp
}
template <typename Check, typename Then>
auto _then_impl(Check, Then t) -> Check;
auto _then_impl(Check, Then t) -> inconsistent<Check>;
public:
case_when_t(When when) : _when(when)
@@ -178,7 +178,7 @@ namespace sqlpp
}
template <typename Check, typename When>
auto case_when_impl(Check, When when) -> Check;
auto case_when_impl(Check, When when) -> inconsistent<Check>;
}
template <typename When>

View File

@@ -205,7 +205,7 @@ namespace sqlpp
private:
template <typename Flag, typename Check, typename Rhs>
auto _union_impl(Check, Rhs rhs) const -> Check;
auto _union_impl(Check, Rhs rhs) const -> inconsistent<Check>;
template <typename Flag, typename Rhs>
auto _union_impl(consistent_t, Rhs rhs) const

View File

@@ -131,7 +131,7 @@ namespace sqlpp
}
template <typename Check, typename DynamicJoin>
auto _add_impl(DynamicJoin dynamicJoin, Check) -> Check;
auto _add_impl(DynamicJoin dynamicJoin, Check) -> inconsistent<Check>;
public:
_data_t _data;
@@ -276,7 +276,7 @@ namespace sqlpp
private:
template <typename Database, typename Check, typename Table>
auto _from_impl(Check, Table table) const -> Check;
auto _from_impl(Check, Table table) const -> inconsistent<Check>;
template <typename Database, typename Table>
auto _from_impl(consistent_t, Table table) const

View File

@@ -235,7 +235,7 @@ namespace sqlpp
private:
template <typename Database, typename Check, typename... Expressions>
auto _group_by_impl(inconsistent<Check>, Expressions... expressions) const -> Check;
auto _group_by_impl(Check, Expressions... expressions) const -> inconsistent<Check>;
template <typename Database, typename... Expressions>
auto _group_by_impl(consistent_t, Expressions... expressions) const

View File

@@ -272,7 +272,7 @@ namespace sqlpp
private:
template <typename Database, typename Check, typename Expression>
auto _having_impl(Check, Expression expression) const -> Check;
auto _having_impl(Check, Expression expression) const -> inconsistent<Check>;
template <typename Database, typename Expression>
auto _having_impl(consistent_t, Expression expression) const

View File

@@ -27,22 +27,19 @@
#ifndef SQLPP_INCONSISTENT_H
#define SQLPP_INCONSISTENT_H
#include <utility>
namespace sqlpp
{
#if defined(__clang__) || defined(_MSC_VER)
template <typename Check>
struct inconsistent
{
inconsistent(Check)
{
}
};
// This specialization circumvents an ambiguity problem with gcc
using inconsistent = Check;
#else
// This version circumvents an ambiguity problem with gcc
// See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77449
template <>
struct inconsistent<consistent_t>
{
};
template <typename Check>
using inconsistent = typename std::enable_if<not std::is_same<consistent_t, Check>::value, Check>::type;
#endif
}
#endif

View File

@@ -526,7 +526,7 @@ namespace sqlpp
private:
template <typename Check, typename... Columns>
auto _columns_impl(inconsistent<Check>, Columns... cols) const -> Check;
auto _columns_impl(Check, Columns... cols) const -> inconsistent<Check>;
template <typename... Columns>
auto _columns_impl(consistent_t, Columns... cols) const
@@ -546,7 +546,7 @@ namespace sqlpp
}
template <typename Database, typename Check, typename... Assignments>
auto _set_impl(inconsistent<Check>, Assignments... assignments) const -> Check;
auto _set_impl(Check, Assignments... assignments) const -> inconsistent<Check>;
template <typename Database, typename... Assignments>
auto _set_impl(consistent_t, Assignments... assignments) const

View File

@@ -176,7 +176,7 @@ namespace sqlpp
private:
template <typename Database, typename Check, typename Table>
auto _into_impl(Check, Table table) const -> Check;
auto _into_impl(Check, Table table) const -> inconsistent<Check>;
template <typename Database, typename Table>
auto _into_impl(consistent_t, Table table) const -> _new_statement_t<consistent_t, into_t<Database, Table>>

View File

@@ -272,7 +272,7 @@ namespace sqlpp
private:
template <typename Check, typename Arg>
auto _limit_impl(Check, Arg arg) const -> Check;
auto _limit_impl(Check, Arg arg) const -> inconsistent<Check>;
template <typename Arg>
auto _limit_impl(consistent_t, Arg arg) const -> _new_statement_t<consistent_t, limit_t<Arg>>

View File

@@ -288,7 +288,7 @@ namespace sqlpp
private:
template <typename Check, typename Arg>
auto _offset_impl(Check, Arg arg) const -> Check;
auto _offset_impl(Check, Arg arg) const -> inconsistent<Check>;
template <typename Arg>
auto _offset_impl(consistent_t, Arg arg) const -> _new_statement_t<consistent_t, offset_t<Arg>>

View File

@@ -233,7 +233,7 @@ namespace sqlpp
private:
template <typename Database, typename Check, typename... Expressions>
auto _order_by_impl(inconsistent<Check>, Expressions... expressions) const -> Check;
auto _order_by_impl(Check, Expressions... expressions) const -> inconsistent<Check>;
template <typename Database, typename... Expressions>
auto _order_by_impl(consistent_t, Expressions... expressions) const

View File

@@ -114,7 +114,7 @@ namespace sqlpp
private:
template <typename Check, typename Expr>
auto on_impl(Check, const Expr&) const -> Check;
auto on_impl(Check, const Expr&) const -> inconsistent<Check>;
template <typename Expr>
auto on_impl(consistent_t, const Expr& expr) const -> join_t<pre_join_t, on_t<Expr>>
@@ -146,7 +146,7 @@ namespace sqlpp
namespace detail
{
template <typename JoinType, typename Check, typename Lhs, typename Rhs>
auto join_impl(Check, Lhs lhs, Rhs rhs) -> Check;
auto join_impl(Check, Lhs lhs, Rhs rhs) -> inconsistent<Check>;
template <typename JoinType, typename Lhs, typename Rhs>
auto join_impl(consistent_t, Lhs lhs, Rhs rhs) -> pre_join_t<JoinType, Lhs, Rhs>;
@@ -190,7 +190,7 @@ namespace sqlpp
namespace detail
{
template <typename Check, typename Lhs, typename Rhs>
auto cross_join_impl(Check, Lhs lhs, Rhs rhs) -> Check;
auto cross_join_impl(Check, Lhs lhs, Rhs rhs) -> inconsistent<Check>;
template <typename Lhs, typename Rhs>
auto cross_join_impl(consistent_t, Lhs lhs, Rhs rhs)

View File

@@ -409,7 +409,7 @@ namespace sqlpp
private:
template <typename Database, typename Check, typename... Args>
auto _columns_impl(Check, std::tuple<Args...> args) const -> Check;
auto _columns_impl(Check, std::tuple<Args...> args) const -> inconsistent<Check>;
template <typename Database, typename... Args>
auto _columns_impl(consistent_t, std::tuple<Args...> args) const

View File

@@ -223,7 +223,7 @@ namespace sqlpp
private:
template <typename Database, typename Check, typename... Flags>
auto _flags_impl(inconsistent<Check>, Flags... flgs) const -> Check;
auto _flags_impl(Check, Flags... flgs) const -> inconsistent<Check>;
template <typename Database, typename... Flags>
auto _flags_impl(consistent_t, Flags... flgs) const

View File

@@ -176,7 +176,7 @@ namespace sqlpp
private:
template <typename Database, typename Check, typename Table>
auto _single_table_impl(Check, Table table) const -> Check;
auto _single_table_impl(Check, Table table) const -> inconsistent<Check>;
template <typename Database, typename Table>
auto _single_table_impl(consistent_t, Table table) const

View File

@@ -241,7 +241,7 @@ namespace sqlpp
private:
template <typename Database, typename Flag, typename Check, typename Rhs>
auto _union_impl(Check, Rhs rhs) const -> Check;
auto _union_impl(Check, Rhs rhs) const -> inconsistent<Check>;
template <typename Database, typename Flag, typename Rhs>
auto _union_impl(consistent_t, Rhs rhs) const

View File

@@ -273,7 +273,7 @@ namespace sqlpp
private:
template <typename Database, typename Check, typename... Assignments>
auto _set_impl(inconsistent<Check>, Assignments... assignments) const -> Check;
auto _set_impl(Check, Assignments... assignments) const -> inconsistent<Check>;
template <typename Database, typename... Assignments>
auto _set_impl(consistent_t, Assignments... assignments) const

View File

@@ -224,7 +224,7 @@ namespace sqlpp
private:
template <typename Database, typename Check, typename... Tables>
auto _using_impl(inconsistent<Check>, Tables... tables) const -> Check;
auto _using_impl(Check, Tables... tables) const -> inconsistent<Check>;
template <typename Database, typename... Tables>
auto _using_impl(consistent_t, Tables... tables) const

View File

@@ -343,7 +343,7 @@ namespace sqlpp
private:
template <typename Database, typename Check, typename Expression>
auto _where_impl(Check, Expression expression) const -> Check;
auto _where_impl(Check, Expression expression) const -> inconsistent<Check>;
template <typename Database, typename Expression>
auto _where_impl(consistent_t, Expression expression) const

View File

@@ -29,7 +29,7 @@
#include <iostream>
SQLPP_ALIAS_PROVIDER(pragma);
SQLPP_ALIAS_PROVIDER(pragma)
int CustomQuery(int, char* [])
{