1// Tests that we can merge the concept declarations with lambda well. 2// 3// RUN: rm -rf %t 4// RUN: mkdir -p %t 5// RUN: split-file %s %t 6// 7// RUN: %clang_cc1 -std=c++20 %t/A.cppm -emit-module-interface -o %t/A.pcm 8// RUN: %clang_cc1 -std=c++20 %t/A0.cppm -emit-module-interface -o %t/A0.pcm 9// RUN: %clang_cc1 -std=c++20 %t/TestA.cpp -fprebuilt-module-path=%t -fsyntax-only -verify 10// 11// RUN: %clang_cc1 -std=c++20 %t/A1.cppm -emit-module-interface -o %t/A1.pcm 12// RUN: %clang_cc1 -std=c++20 %t/TestA1.cpp -fprebuilt-module-path=%t -fsyntax-only -verify 13// 14// RUN: %clang_cc1 -std=c++20 %t/A2.cppm -emit-module-interface -o %t/A2.pcm 15// RUN: %clang_cc1 -std=c++20 %t/TestA2.cpp -fprebuilt-module-path=%t -fsyntax-only -verify 16// 17// RUN: %clang_cc1 -std=c++20 %t/A3.cppm -emit-module-interface -o %t/A3.pcm 18// RUN: %clang_cc1 -std=c++20 %t/TestA3.cpp -fprebuilt-module-path=%t -fsyntax-only -verify 19 20// Test again with reduced BMI. 21// RUN: rm -rf %t 22// RUN: mkdir -p %t 23// RUN: split-file %s %t 24// 25// RUN: %clang_cc1 -std=c++20 %t/A.cppm -emit-reduced-module-interface -o %t/A.pcm 26// RUN: %clang_cc1 -std=c++20 %t/A0.cppm -emit-reduced-module-interface -o %t/A0.pcm 27// RUN: %clang_cc1 -std=c++20 %t/TestA.cpp -fprebuilt-module-path=%t -fsyntax-only -verify 28// 29// RUN: %clang_cc1 -std=c++20 %t/A1.cppm -emit-reduced-module-interface -o %t/A1.pcm 30// RUN: %clang_cc1 -std=c++20 %t/TestA1.cpp -fprebuilt-module-path=%t -fsyntax-only -verify 31// 32// RUN: %clang_cc1 -std=c++20 %t/A2.cppm -emit-reduced-module-interface -o %t/A2.pcm 33// RUN: %clang_cc1 -std=c++20 %t/TestA2.cpp -fprebuilt-module-path=%t -fsyntax-only -verify 34// 35// RUN: %clang_cc1 -std=c++20 %t/A3.cppm -emit-reduced-module-interface -o %t/A3.pcm 36// RUN: %clang_cc1 -std=c++20 %t/TestA3.cpp -fprebuilt-module-path=%t -fsyntax-only -verify 37 38 39//--- A.h 40template <class _Tp> 41concept A = requires(const _Tp& __t) { []<class __Up>(const __Up&) {}(__t); }; 42 43//--- A1.h 44template <class _Tp> 45concept A = requires(const _Tp& __t) { []<class __Up>(__Up) {}(__t); }; 46 47//--- A2.h 48template <class _Tp> 49concept A = requires(const _Tp& __t) { []<class __Up>(const __Up& __u) { 50 (int)__u; 51}(__t); }; 52 53//--- A3.h 54template <class _Tp> 55concept A = requires(const _Tp& __t) { [t = '?']<class __Up>(const __Up&) { 56 (int)t; 57}(__t); }; 58 59//--- A.cppm 60module; 61#include "A.h" 62export module A; 63export using ::A; 64 65//--- A0.cppm 66module; 67#include "A.h" 68export module A0; 69export using ::A; 70 71//--- TestA.cpp 72// expected-no-diagnostics 73import A; 74import A0; 75 76template <class C> 77void f(C) requires(A<C>) {} 78 79//--- A1.cppm 80module; 81#include "A1.h" 82export module A1; 83export using ::A; 84 85//--- TestA1.cpp 86import A; 87import A1; 88 89template <class C> 90void f(C) requires(A<C>) {} // expected-error 1+{{reference to 'A' is ambiguous}} 91 // expected-note@* 1+{{candidate found by name lookup is 'A'}} 92 93//--- A2.cppm 94module; 95#include "A2.h" 96export module A2; 97export using ::A; 98 99//--- TestA2.cpp 100import A; 101import A2; 102 103template <class C> 104void f(C) requires(A<C>) {} // expected-error 1+{{reference to 'A' is ambiguous}} 105 // expected-note@* 1+{{candidate found by name lookup is 'A'}} 106 107//--- A3.cppm 108module; 109#include "A3.h" 110export module A3; 111export using ::A; 112 113//--- TestA3.cpp 114import A; 115import A3; 116 117template <class C> 118void f(C) requires(A<C>) {} // expected-error 1+{{reference to 'A' is ambiguous}} 119 // expected-note@* 1+{{candidate found by name lookup is 'A'}} 120