1// RUN: rm -rf %t
2// RUN: mkdir %t
3// RUN: split-file %s %t
4//
5// RUN: %clang_cc1 -x c++ -std=c++20 %t/A.cppm -I%t -emit-module-interface -o %t/A.pcm
6// RUN: %clang_cc1 -x c++ -std=c++20 %t/B.cppm -I%t -emit-module-interface -o %t/B.pcm
7// RUN: %clang_cc1 -x c++ -std=c++20 -fprebuilt-module-path=%t %t/foo.cpp -verify
8
9//--- foo.h
10template <class T>
11concept A = true;
12
13//--- bar.h
14template <class T>
15concept A = false;
16
17//--- A.cppm
18module;
19#include "foo.h"
20export module A;
21export using ::A;
22
23//--- B.cppm
24module;
25#include "bar.h"
26export module B;
27export using ::A;
28
29//--- foo.cpp
30import A;
31import B;
32
33template <class T> void foo() requires A<T> {}  // expected-error 1+{{reference to 'A' is ambiguous}}
34                                                // expected-note@* 1+{{candidate found by name lookup}}
35
36int main() {
37  foo<int>();
38  return 0;
39}
40