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