| 1 |
// RUN: rm -rf %t |
| 2 |
// RUN: split-file %s %t |
| 3 |
|
| 4 |
|
| 5 |
// RUN: %clang_cc1 -std=c++20 -verify -emit-module-interface %t/A.cpp -o %t/A.pcm |
| 6 |
// RUN: %clang_cc1 -std=c++20 -verify -emit-module-interface %t/myV.cpp -o %t/myV.pcm |
| 7 |
// RUN: %clang_cc1 -std=c++20 -verify -emit-module-interface -fmodule-file=V=%t/myV.pcm %t/partition.cpp -o %t/partition.pcm |
| 8 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify -fmodule-file=V=%t/myV.pcm -fmodule-file=A=%t/A.pcm -fmodule-file=A:partition=%t/partition.pcm %t/interface.cpp |
| 9 |
|
| 10 |
//--- A.cpp |
| 11 |
// expected-no-diagnostics |
| 12 |
export module A; |
| 13 |
|
| 14 |
//--- myV.cpp |
| 15 |
// expected-no-diagnostics |
| 16 |
export module V; |
| 17 |
|
| 18 |
export struct myV{}; |
| 19 |
|
| 20 |
//--- uses_vector.h |
| 21 |
// expected-no-diagnostics |
| 22 |
#ifndef x |
| 23 |
#define x |
| 24 |
|
| 25 |
import V; |
| 26 |
#endif |
| 27 |
|
| 28 |
//--- partition.cpp |
| 29 |
// expected-no-diagnostics |
| 30 |
module; |
| 31 |
#include "uses_vector.h" // textually expands to import V; |
| 32 |
module A:partition; |
| 33 |
|
| 34 |
//--- interface.cpp |
| 35 |
module A; |
| 36 |
import :partition; |
| 37 |
myV V; // expected-error {{declaration of 'myV' must be imported from module 'V' before it is required}} |
| 38 |
// [email protected]:4 {{declaration here is not visible}} |