Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Modules / merge-concepts-cxx-modules.cpp
blob3d4f8435531a88cfed9cc58c06195e303f7073cd
1 // RUN: rm -rf %t
2 // RUN: mkdir %t
3 // RUN: split-file %s %t
4 //
5 // RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/same_as.cppm -o %t/same_as.pcm
6 // RUN: %clang_cc1 -std=c++20 -emit-module-interface -fprebuilt-module-path=%t %t/concepts.cppm -o %t/concepts.pcm
7 // RUN: %clang_cc1 -std=c++20 -emit-module-interface -fprebuilt-module-path=%t %t/format.cppm -o %t/format.pcm
8 // RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/conflicting.cppm -o %t/conflicting.pcm
9 // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/Use.cppm -fsyntax-only -verify
11 //--- same_as.cppm
12 export module same_as;
13 export template <class T, class U>
14 concept same_as = __is_same(T, U);
16 //--- concepts.cppm
17 export module concepts;
18 export import same_as;
20 export template <class T>
21 concept ConflictingConcept = true;
23 //--- format.cppm
25 export module format;
26 export import concepts;
27 export import same_as;
29 export template <class T> void foo()
30 requires same_as<T, int>
33 //--- conflicting.cppm
34 export module conflicting;
35 export template <class T, class U = int>
36 concept ConflictingConcept = true;
38 //--- Use.cppm
39 import format;
40 import conflicting;
42 template <class T> void foo()
43 requires same_as<T, T>
45 ConflictingConcept auto x = 10; // expected-error {{reference to 'ConflictingConcept' is ambiguous}}
46 // expected-note@* 2 {{candidate}}