| 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 |
| 40 |
template <class _Tp> |
| 41 |
concept A = requires(const _Tp& __t) { []<class __Up>(const __Up&) {}(__t); }; |
| 42 |
|
| 43 |
//--- A1.h |
| 44 |
template <class _Tp> |
| 45 |
concept A = requires(const _Tp& __t) { []<class __Up>(__Up) {}(__t); }; |
| 46 |
|
| 47 |
//--- A2.h |
| 48 |
template <class _Tp> |
| 49 |
concept A = requires(const _Tp& __t) { []<class __Up>(const __Up& __u) { |
| 50 |
(int)__u; |
| 51 |
}(__t); }; |
| 52 |
|
| 53 |
//--- A3.h |
| 54 |
template <class _Tp> |
| 55 |
concept A = requires(const _Tp& __t) { [t = '?']<class __Up>(const __Up&) { |
| 56 |
(int)t; |
| 57 |
}(__t); }; |
| 58 |
|
| 59 |
//--- A.cppm |
| 60 |
module; |
| 61 |
#include "A.h" |
| 62 |
export module A; |
| 63 |
export using ::A; |
| 64 |
|
| 65 |
//--- A0.cppm |
| 66 |
module; |
| 67 |
#include "A.h" |
| 68 |
export module A0; |
| 69 |
export using ::A; |
| 70 |
|
| 71 |
//--- TestA.cpp |
| 72 |
// expected-no-diagnostics |
| 73 |
import A; |
| 74 |
import A0; |
| 75 |
|
| 76 |
template <class C> |
| 77 |
void f(C) requires(A<C>) {} |
| 78 |
|
| 79 |
//--- A1.cppm |
| 80 |
module; |
| 81 |
#include "A1.h" |
| 82 |
export module A1; |
| 83 |
export using ::A; |
| 84 |
|
| 85 |
//--- TestA1.cpp |
| 86 |
import A; |
| 87 |
import A1; |
| 88 |
|
| 89 |
template <class C> |
| 90 |
void 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 |
| 94 |
module; |
| 95 |
#include "A2.h" |
| 96 |
export module A2; |
| 97 |
export using ::A; |
| 98 |
|
| 99 |
//--- TestA2.cpp |
| 100 |
import A; |
| 101 |
import A2; |
| 102 |
|
| 103 |
template <class C> |
| 104 |
void 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 |
| 108 |
module; |
| 109 |
#include "A3.h" |
| 110 |
export module A3; |
| 111 |
export using ::A; |
| 112 |
|
| 113 |
//--- TestA3.cpp |
| 114 |
import A; |
| 115 |
import A3; |
| 116 |
|
| 117 |
template <class C> |
| 118 |
void f(C) requires(A<C>) {} // expected-error 1+{{reference to 'A' is ambiguous}} |
| 119 |
// expected-note@* 1+{{candidate found by name lookup is 'A'}} |