clang/test/Modules/var-init-side-effects-modulemap.cpp
raw| 1 | // RUN: rm -rf %t |
| 2 | // RUN: mkdir -p %t |
| 3 | // RUN: split-file %s %t |
| 4 | |
| 5 | // RUN: %clang_cc1 -fsyntax-only -fmodules -fmodules-cache-path=%t -fmodule-map-file=%t/module.modulemap %t/test.cppm -I%t |
| 6 | // |
| 7 | |
| 8 | //--- test.cppm |
| 9 | #pragma clang module import Baz |
| 10 | |
| 11 | //--- Foo.h |
| 12 | #pragma once |
| 13 | class foo { |
| 14 | char dummy = 1; |
| 15 | |
| 16 | public: |
| 17 | static foo var; |
| 18 | |
| 19 | }; |
| 20 | |
| 21 | inline foo foo::var; |
| 22 | |
| 23 | //--- Bar.h |
| 24 | #pragma once |
| 25 | #include <Foo.h> |
| 26 | |
| 27 | void bar() { |
| 28 | (void) foo::var; |
| 29 | } |
| 30 | |
| 31 | //--- Baz.h |
| 32 | #pragma once |
| 33 | #include <Foo.h> |
| 34 | |
| 35 | void baz() { |
| 36 | (void) foo::var; |
| 37 | } |
| 38 | |
| 39 | #include <Bar.h> |
| 40 | |
| 41 | //--- module.modulemap |
| 42 | module Foo { |
| 43 | header "Foo.h" |
| 44 | } |
| 45 | module Bar { |
| 46 | header "Bar.h" |
| 47 | } |
| 48 | module Baz { |
| 49 | header "Baz.h" |
| 50 | } |
| 51 |