59 lines · cpp
1// RUN: rm -rf %t2// RUN: mkdir %t3// RUN: split-file %s %t4//5// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/same_as.cppm -o %t/same_as.pcm6// RUN: %clang_cc1 -std=c++20 -emit-module-interface -fprebuilt-module-path=%t %t/concepts.cppm -o %t/concepts.pcm7// RUN: %clang_cc1 -std=c++20 -emit-module-interface -fprebuilt-module-path=%t %t/format.cppm -o %t/format.pcm8// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/conflicting.cppm -o %t/conflicting.pcm9// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/Use.cppm -fsyntax-only -verify10 11// Test again with reduced BMI.12// RUN: rm -rf %t13// RUN: mkdir %t14// RUN: split-file %s %t15//16// RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/same_as.cppm -o %t/same_as.pcm17// RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface -fprebuilt-module-path=%t %t/concepts.cppm -o %t/concepts.pcm18// RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface -fprebuilt-module-path=%t %t/format.cppm -o %t/format.pcm19// RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/conflicting.cppm -o %t/conflicting.pcm20// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/Use.cppm -fsyntax-only -verify21 22 23//--- same_as.cppm24export module same_as;25export template <class T, class U>26concept same_as = __is_same(T, U);27 28//--- concepts.cppm29export module concepts;30export import same_as;31 32export template <class T>33concept ConflictingConcept = true;34 35//--- format.cppm36 37export module format;38export import concepts;39export import same_as;40 41export template <class T> void foo()42 requires same_as<T, int>43{}44 45//--- conflicting.cppm46export module conflicting;47export template <class T, class U = int>48concept ConflictingConcept = true;49 50//--- Use.cppm51import format;52import conflicting;53 54template <class T> void foo()55 requires same_as<T, T>56{}57ConflictingConcept auto x = 10; // expected-error {{reference to 'ConflictingConcept' is ambiguous}}58 // expected-note@* 2 {{candidate}}59