| 1 |
// Tests referencing variable with initializer containing side effect across module boundary |
| 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 -emit-module-interface %t/Foo.cppm \ |
| 8 |
// RUN: -o %t/Foo.pcm |
| 9 |
|
| 10 |
// RUN: %clang_cc1 -std=c++20 -emit-module-interface \ |
| 11 |
// RUN: -fmodule-file=Foo=%t/Foo.pcm \ |
| 12 |
// RUN: %t/Bar.cppm \ |
| 13 |
// RUN: -o %t/Bar.pcm |
| 14 |
|
| 15 |
// RUN: %clang_cc1 -std=c++20 -emit-obj \ |
| 16 |
// RUN: -main-file-name Bar.cppm \ |
| 17 |
// RUN: -fmodule-file=Foo=%t/Foo.pcm \ |
| 18 |
// RUN: -x pcm %t/Bar.pcm \ |
| 19 |
// RUN: -o %t/Bar.o |
| 20 |
|
| 21 |
//--- Foo.cppm |
| 22 |
export module Foo; |
| 23 |
|
| 24 |
export { |
| 25 |
class S {}; |
| 26 |
|
| 27 |
inline S s = S{}; |
| 28 |
} |
| 29 |
|
| 30 |
//--- Bar.cppm |
| 31 |
export module Bar; |
| 32 |
import Foo; |
| 33 |
|
| 34 |
S bar() { |
| 35 |
return s; |
| 36 |
} |
| 37 |
|