xref: /llvm-project/clang/test/Modules/concept_differ.cpp (revision a171d248ca34b8b6f8de11d42a83ad981285963a)
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 -fmodules -fmodules-cache-path=%t -fmodule-map-file=%t/module.modulemap %t/foo.cpp -verify
6 
7 //--- module.modulemap
8 module "foo" {
9   export *
10   header "foo.h"
11 }
12 module "bar" {
13   export *
14   header "bar.h"
15 }
16 
17 //--- foo.h
18 template <class T>
19 concept A = true;
20 
21 //--- bar.h
22 template <class T>
23 concept A = false;
24 
25 //--- foo.cpp
26 #include "bar.h"
27 #include "foo.h"
28 
foo()29 template <class T> void foo() requires A<T> {}  // expected-error 1+{{reference to 'A' is ambiguous}}
30                                                 // expected-note@* 1+{{candidate found by name lookup}}
31 
main()32 int main() {
33   foo<int>();
34   return 0;
35 }
36