3 // RUN: split-file %s %t
5 // RUN: %clang_cc1 -std=c++20 %t/A.cppm -emit-module-interface -o %t/A.pcm
6 // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t -I%t -DDIFFERENT %t/B.cppm -verify
7 // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t -I%t %t/B.cppm -verify
14 concept Range = requires(T &t) { t.begin(); };
17 concept __integer_like = true;
20 concept __member_size = requires(_Tp &&t) { t.size(); };
22 template <class First, class Second>
23 concept C = requires(First x, Second y) { x + y; };
32 template <__member_size _Tp>
33 constexpr __integer_like auto operator()(_Tp&& __t) const {
37 template <__integer_like _Tp, C<_Tp> Sentinel>
38 constexpr _Tp operator()(_Tp &&__t, Sentinel &&last) const {
42 template <template <class> class H, class S, C<H<S>> Sentinel>
43 constexpr H<S> operator()(H<S> &&__s, Sentinel &&last) const {
47 // Tests that we could find different concept definition indeed.
49 template <__integer_like _Tp, __integer_like _Up, C<_Tp> Sentinel>
50 constexpr _Tp operator()(_Tp &&__t, _Up _u, Sentinel &&last) const {
54 template <__integer_like _Tp, __integer_like _Up, C<_Up> Sentinel>
55 constexpr _Tp operator()(_Tp &&__t, _Up _u, Sentinel &&last) const {
74 // expected-error@foo.h:41 {{'__fn::operator()' from module 'A.<global>' is not present in definition of '__fn' provided earlier}}
75 // expected-note@* 1+{{declaration of 'operator()' does not match}}
77 // expected-no-diagnostics
82 auto operator+(U) { return 0; }
88 int size() { return 0; }
89 auto operator+(S s) { return 0; }
93 __fn{}(S(), S(), S());
95 __fn{}(U<int>(), U<int>());