120 lines · plain
1// Tests that we can merge the concept declarations with lambda well.2//3// RUN: rm -rf %t4// RUN: mkdir -p %t5// RUN: split-file %s %t6//7// RUN: %clang_cc1 -std=c++20 %t/A.cppm -emit-module-interface -o %t/A.pcm8// RUN: %clang_cc1 -std=c++20 %t/A0.cppm -emit-module-interface -o %t/A0.pcm9// RUN: %clang_cc1 -std=c++20 %t/TestA.cpp -fprebuilt-module-path=%t -fsyntax-only -verify10//11// RUN: %clang_cc1 -std=c++20 %t/A1.cppm -emit-module-interface -o %t/A1.pcm12// RUN: %clang_cc1 -std=c++20 %t/TestA1.cpp -fprebuilt-module-path=%t -fsyntax-only -verify13//14// RUN: %clang_cc1 -std=c++20 %t/A2.cppm -emit-module-interface -o %t/A2.pcm15// RUN: %clang_cc1 -std=c++20 %t/TestA2.cpp -fprebuilt-module-path=%t -fsyntax-only -verify16//17// RUN: %clang_cc1 -std=c++20 %t/A3.cppm -emit-module-interface -o %t/A3.pcm18// RUN: %clang_cc1 -std=c++20 %t/TestA3.cpp -fprebuilt-module-path=%t -fsyntax-only -verify19 20// Test again with reduced BMI.21// RUN: rm -rf %t22// RUN: mkdir -p %t23// RUN: split-file %s %t24//25// RUN: %clang_cc1 -std=c++20 %t/A.cppm -emit-reduced-module-interface -o %t/A.pcm26// RUN: %clang_cc1 -std=c++20 %t/A0.cppm -emit-reduced-module-interface -o %t/A0.pcm27// RUN: %clang_cc1 -std=c++20 %t/TestA.cpp -fprebuilt-module-path=%t -fsyntax-only -verify28//29// RUN: %clang_cc1 -std=c++20 %t/A1.cppm -emit-reduced-module-interface -o %t/A1.pcm30// RUN: %clang_cc1 -std=c++20 %t/TestA1.cpp -fprebuilt-module-path=%t -fsyntax-only -verify31//32// RUN: %clang_cc1 -std=c++20 %t/A2.cppm -emit-reduced-module-interface -o %t/A2.pcm33// RUN: %clang_cc1 -std=c++20 %t/TestA2.cpp -fprebuilt-module-path=%t -fsyntax-only -verify34//35// RUN: %clang_cc1 -std=c++20 %t/A3.cppm -emit-reduced-module-interface -o %t/A3.pcm36// RUN: %clang_cc1 -std=c++20 %t/TestA3.cpp -fprebuilt-module-path=%t -fsyntax-only -verify37 38 39//--- A.h40template <class _Tp>41concept A = requires(const _Tp& __t) { []<class __Up>(const __Up&) {}(__t); };42 43//--- A1.h44template <class _Tp>45concept A = requires(const _Tp& __t) { []<class __Up>(__Up) {}(__t); };46 47//--- A2.h48template <class _Tp>49concept A = requires(const _Tp& __t) { []<class __Up>(const __Up& __u) {50 (int)__u;51}(__t); };52 53//--- A3.h54template <class _Tp>55concept A = requires(const _Tp& __t) { [t = '?']<class __Up>(const __Up&) {56 (int)t;57}(__t); };58 59//--- A.cppm60module;61#include "A.h"62export module A;63export using ::A;64 65//--- A0.cppm66module;67#include "A.h"68export module A0;69export using ::A;70 71//--- TestA.cpp72// expected-no-diagnostics73import A;74import A0;75 76template <class C>77void f(C) requires(A<C>) {}78 79//--- A1.cppm80module;81#include "A1.h"82export module A1;83export using ::A;84 85//--- TestA1.cpp86import 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.cppm94module;95#include "A2.h"96export module A2;97export using ::A;98 99//--- TestA2.cpp100import 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.cppm108module;109#include "A3.h"110export module A3;111export using ::A;112 113//--- TestA3.cpp114import 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