diff options
Diffstat (limited to 'clang/test/SemaTemplate/concepts.cpp')
-rw-r--r-- | clang/test/SemaTemplate/concepts.cpp | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/clang/test/SemaTemplate/concepts.cpp b/clang/test/SemaTemplate/concepts.cpp index 5b0f3d3..becf546 100644 --- a/clang/test/SemaTemplate/concepts.cpp +++ b/clang/test/SemaTemplate/concepts.cpp @@ -1573,3 +1573,62 @@ namespace GH162770 { template<typename... Ts> auto comma = (..., Ts()); auto b = comma<check<e{}>>; } // namespace GH162770 + +namespace GH164750 { + +template <typename> +struct a; +template <typename> +struct b; + +template <template <typename> typename c, typename d, typename> +concept e = !__is_convertible_to(c<d>*, b<d>*); + +template <typename...> +struct f; +template <typename g, typename... h> +struct f<g, h...> { + g i; +}; + +template <typename, typename> +struct u; +template <typename j, template <typename> typename k, typename l> + requires e<k, j, l> +struct u<const k<j>*, l> { + u(const a<j>*); +}; +template <typename j, template <typename> typename k, typename l> +struct u<const k<j>*, l> { + u(const b<j>*); +}; + +template <typename> +struct m; +template <typename n, typename... o> +struct m<n (*)(o...)> { + template <template <typename> typename j> + using p = j<o...>; +}; + +template <typename q, typename r> +struct s { + template <typename... p> + struct D { + using v = f<u<r, p>...>; + }; + template <typename... t> + s(t... p1) : x(p1...) {} + m<q>::template p<D>::v x; +}; +template <typename w, typename... t> +void fn1(w, t... p2) { + s<w, t...>(p2...); +} +int* fn2(int) { return nullptr; } +void fn3() { + fn1(fn2, static_cast<const a<int>*>(nullptr)); + fn1(fn2, static_cast<const b<int>*>(nullptr)); +} + +} |