| 1 |
// Checks that Clang modules can be imported from within the global module |
| 2 |
// fragment of a named module interface unit. |
| 3 |
// Fixes #159768. |
| 4 |
|
| 5 |
// RUN: rm -rf %t |
| 6 |
// RUN: mkdir -p %t |
| 7 |
// RUN: split-file %s %t |
| 8 |
|
| 9 |
// RUN: %clang -std=c++23 -fmodules -fmodule-map-file=%t/module.modulemap \ |
| 10 |
// RUN: -fmodules-cache-path=%t --precompile %t/A.cppm -o %t/A.pcm |
| 11 |
|
| 12 |
//--- module.modulemap |
| 13 |
module foo { header "foo.h" } |
| 14 |
|
| 15 |
//--- foo.h |
| 16 |
// empty |
| 17 |
|
| 18 |
//--- A.cppm |
| 19 |
module; |
| 20 |
#include "foo.h" |
| 21 |
export module A; |
| 22 |
|
| 23 |
export auto A() -> int { return 42; } |
| 24 |
|