1// RUN: rm -rf %t
2// RUN: mkdir %t
3// RUN: split-file %s %t
4//
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 %t/B.cppm -verify
7
8//--- foo.h
9#ifndef FOO_H
10#define FOO_H
11
12template <class T>
13concept Range = requires(T &t) { t.begin(); };
14
15template<class _Tp>
16concept __integer_like = true;
17
18template <class _Tp>
19concept __member_size = requires(_Tp &&t) { t.size(); };
20
21struct A {
22public:
23  template <Range T>
24  using range_type = T;
25};
26
27struct __fn {
28  template <__member_size _Tp>
29  constexpr __integer_like auto operator()(_Tp&& __t) const {
30    return __t.size();
31  }
32};
33#endif
34
35//--- A.cppm
36module;
37#include "foo.h"
38export module A;
39
40//--- B.cppm
41// expected-no-diagnostics
42module;
43#include "foo.h"
44export module B;
45import A;
46
47void foo() {
48    A a;
49    struct S {
50        int size() { return 0; }
51        auto operator+(S s) { return 0; }
52    };
53    __fn{}(S());
54}
55