| 1 |
// From https://github.com/llvm/llvm-project/issues/61317 |
| 2 |
// RUN: rm -rf %t |
| 3 |
// RUN: mkdir -p %t |
| 4 |
// RUN: split-file %s %t |
| 5 |
// |
| 6 |
// RUN: %clang_cc1 -std=c++20 %t/A.cppm -emit-module-interface -o %t/A.pcm |
| 7 |
// RUN: %clang_cc1 -std=c++20 %t/B.cppm -emit-module-interface -o %t/B.pcm \ |
| 8 |
// RUN: -fprebuilt-module-path=%t |
| 9 |
// RUN: %clang_cc1 -std=c++20 %t/Use.cpp -fprebuilt-module-path=%t -fsyntax-only -verify |
| 10 |
|
| 11 |
// RUN: rm -rf %t |
| 12 |
// RUN: mkdir -p %t |
| 13 |
// RUN: split-file %s %t |
| 14 |
// |
| 15 |
// RUN: %clang_cc1 -std=c++20 %t/A.cppm -emit-reduced-module-interface -o %t/A.pcm |
| 16 |
// RUN: %clang_cc1 -std=c++20 %t/B.cppm -emit-reduced-module-interface -o %t/B.pcm \ |
| 17 |
// RUN: -fprebuilt-module-path=%t |
| 18 |
// RUN: %clang_cc1 -std=c++20 %t/Use.cpp -fprebuilt-module-path=%t -fsyntax-only -verify |
| 19 |
|
| 20 |
//--- foo.h |
| 21 |
#ifndef _FOO |
| 22 |
#define _FOO |
| 23 |
|
| 24 |
template <typename T> struct Foo { |
| 25 |
Foo(T f) {} |
| 26 |
}; |
| 27 |
|
| 28 |
template <typename T> Foo(T&) -> Foo<T>; |
| 29 |
|
| 30 |
struct Bar { |
| 31 |
template <typename T> |
| 32 |
requires requires { Foo{T()}; } |
| 33 |
void baz() const {} |
| 34 |
}; |
| 35 |
|
| 36 |
template <typename T> struct Foo2 { |
| 37 |
Foo2(T f) {} |
| 38 |
}; |
| 39 |
|
| 40 |
struct Bar2 { |
| 41 |
template <typename T> |
| 42 |
requires requires { Foo2{T()}; } |
| 43 |
void baz2() const {} |
| 44 |
}; |
| 45 |
|
| 46 |
#endif |
| 47 |
|
| 48 |
//--- A.cppm |
| 49 |
module; |
| 50 |
#include "foo.h" |
| 51 |
export module A; |
| 52 |
export using ::Foo; |
| 53 |
export using ::Bar; |
| 54 |
export using ::Bar2; |
| 55 |
|
| 56 |
//--- B.cppm |
| 57 |
module; |
| 58 |
#include "foo.h" |
| 59 |
export module B; |
| 60 |
export import A; |
| 61 |
|
| 62 |
//--- Use.cpp |
| 63 |
// expected-no-diagnostics |
| 64 |
import A; |
| 65 |
import B; |
| 66 |
void use() { |
| 67 |
Bar _; |
| 68 |
_.baz<int>(); |
| 69 |
|
| 70 |
Bar2 __; |
| 71 |
__.baz2<int>(); |
| 72 |
} |