Skip to content

Commit d099e60

Browse files
committed
Addressed Clang 10 choking on concepts using non-template parameters
1 parent ed7d1a6 commit d099e60

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

dev/functional/cxx_compiler_quirks.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,10 @@
3939
(defined(__clang__) && (__clang_major__ >= 12) && (__cplusplus >= 202002L))
4040
#define SQLITE_ORM_CLASSTYPE_TEMPLATE_ARGS_SUPPORTED
4141
#endif
42+
43+
// clang 10 chokes on concepts that don't depend on template parameters;
44+
// when it tries to instantiate an expression in a requires expression, which results in an error,
45+
// the compiler reports an error instead of dismissing the templated function.
46+
#if defined(SQLITE_ORM_CONCEPTS_SUPPORTED) && (defined(__clang__) && (__clang_major__ == 10))
47+
#define SQLITE_ORM_BROKEN_NONTEMPLATE_CONCEPTS
48+
#endif

dev/serializing_util.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include <string>
77
#include <ostream>
88
#include <utility> // std::exchange, std::tuple_size
9-
#ifdef SQLITE_ORM_CONCEPTS_SUPPORTED
9+
#if defined(SQLITE_ORM_CONCEPTS_SUPPORTED) && !defined(SQLITE_ORM_BROKEN_NONTEMPLATE_CONCEPTS)
1010
#include <string_view>
1111
#include <algorithm> // std::find
1212
#endif
@@ -29,7 +29,7 @@ namespace sqlite_orm {
2929
template<class T, class Ctx>
3030
std::string serialize_order_by(const T& t, const Ctx& context);
3131

32-
#ifdef SQLITE_ORM_CONCEPTS_SUPPORTED
32+
#if defined(SQLITE_ORM_CONCEPTS_SUPPORTED) && !defined(SQLITE_ORM_BROKEN_NONTEMPLATE_CONCEPTS)
3333
// optimized version when string_view's iterator range constructor is available
3434
template<class SFINAE = void>
3535
void stream_sql_escaped(std::ostream& os, const std::string& str, char char2Escape)

include/sqlite_orm/sqlite_orm.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,13 @@ using std::nullptr_t;
140140
#define SQLITE_ORM_CLASSTYPE_TEMPLATE_ARGS_SUPPORTED
141141
#endif
142142

143+
// clang 10 chokes on concepts that don't depend on template parameters;
144+
// when it tries to instantiate an expression in a requires expression, which results in an error,
145+
// the compiler reports an error instead of dismissing the templated function.
146+
#if defined(SQLITE_ORM_CONCEPTS_SUPPORTED) && (defined(__clang__) && (__clang_major__ == 10))
147+
#define SQLITE_ORM_BROKEN_NONTEMPLATE_CONCEPTS
148+
#endif
149+
143150
#if SQLITE_ORM_HAS_INCLUDE(<version>)
144151
#include <version>
145152
#endif
@@ -13191,7 +13198,7 @@ namespace sqlite_orm {
1319113198
#include <string>
1319213199
#include <ostream>
1319313200
#include <utility> // std::exchange, std::tuple_size
13194-
#ifdef SQLITE_ORM_CONCEPTS_SUPPORTED
13201+
#if defined(SQLITE_ORM_CONCEPTS_SUPPORTED) && !defined(SQLITE_ORM_BROKEN_NONTEMPLATE_CONCEPTS)
1319513202
#include <string_view>
1319613203
#include <algorithm> // std::find
1319713204
#endif
@@ -13219,7 +13226,7 @@ namespace sqlite_orm {
1321913226
template<class T, class Ctx>
1322013227
std::string serialize_order_by(const T& t, const Ctx& context);
1322113228

13222-
#ifdef SQLITE_ORM_CONCEPTS_SUPPORTED
13229+
#if defined(SQLITE_ORM_CONCEPTS_SUPPORTED) && !defined(SQLITE_ORM_BROKEN_NONTEMPLATE_CONCEPTS)
1322313230
// optimized version when string_view's iterator range constructor is available
1322413231
template<class SFINAE = void>
1322513232
void stream_sql_escaped(std::ostream& os, const std::string& str, char char2Escape)

0 commit comments

Comments
 (0)