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
9 // Testing the behavior of `-fskip-odr-check-in-gmf`
10 // RUN: %clang_cc1 -std=c++20 -fskip-odr-check-in-gmf %t/A.cppm -emit-module-interface -o %t/A.pcm
11 // RUN: %clang_cc1 -std=c++20 -fskip-odr-check-in-gmf -fprebuilt-module-path=%t -I%t \
12 // RUN: -DDIFFERENT -DSKIP_ODR_CHECK_IN_GMF %t/B.cppm -verify
19 concept Range = requires(T &t) { t.begin(); };
22 concept __integer_like = true;
25 concept __member_size = requires(_Tp &&t) { t.size(); };
27 template <class First, class Second>
28 concept C = requires(First x, Second y) { x + y; };
37 template <__member_size _Tp>
38 constexpr __integer_like auto operator()(_Tp&& __t) const {
42 template <__integer_like _Tp, C<_Tp> Sentinel>
43 constexpr _Tp operator()(_Tp &&__t, Sentinel &&last) const {
47 template <template <class> class H, class S, C<H<S>> Sentinel>
48 constexpr H<S> operator()(H<S> &&__s, Sentinel &&last) const {
52 // Tests that we could find different concept definition indeed.
54 template <__integer_like _Tp, __integer_like _Up, C<_Tp> Sentinel>
55 constexpr _Tp operator()(_Tp &&__t, _Up _u, Sentinel &&last) const {
59 template <__integer_like _Tp, __integer_like _Up, C<_Up> Sentinel>
60 constexpr _Tp operator()(_Tp &&__t, _Up _u, Sentinel &&last) const {
78 #ifdef SKIP_ODR_CHECK_IN_GMF
79 // expected-error@B.cppm:* {{call to object of type '__fn' is ambiguous}}
80 // expected-note@* 1+{{candidate function}}
81 #elif defined(DIFFERENT)
82 // expected-error@foo.h:41 {{'__fn::operator()' from module 'A.<global>' is not present in definition of '__fn' provided earlier}}
83 // expected-note@* 1+{{declaration of 'operator()' does not match}}
85 // expected-no-diagnostics
90 auto operator+(U) { return 0; }
96 int size() { return 0; }
97 auto operator+(S s) { return 0; }
101 __fn{}(S(), S(), S());
103 __fn{}(U<int>(), U<int>());