46 lines · cpp
1// RUN: rm -rf %t2// RUN: mkdir %t3// RUN: split-file %s %t4// RUN: echo 'export module foo;' > %t.cppm5// RUN: echo 'export int n;' >> %t.cppm6// RUN: %clang_cc1 -std=c++2a %t.cppm -emit-module-interface -o %t.pcm7// RUN: %clang_cc1 -std=c++2a -fmodule-file=foo=%t.pcm -verify -DMODE=0 %t/A.cppm8// RUN: %clang_cc1 -std=c++2a -fmodule-file=foo=%t.pcm -verify -DMODE=1 %t/B.cppm9// RUN: %clang_cc1 -std=c++2a -fmodule-file=foo=%t.pcm -verify -DMODE=2 %t/C.cppm10// RUN: %clang_cc1 -std=c++2a -fmodule-file=foo=%t.pcm -verify -DMODE=3 %t/D.cppm11// RUN: %clang_cc1 -std=c++2a -fmodule-file=foo=%t.pcm -verify -DMODE=4 %t/E.cppm12// RUN: %clang_cc1 -std=c++2a -fmodule-file=foo=%t.pcm -verify -DMODE=5 %t/F.cppm13 14//--- A.cppm15// no module declaration16// expected-no-diagnostics17 18//--- B.cppm19// expected-no-diagnostics20module foo; // Implementation, implicitly imports foo.21#define IMPORTED22 23int k = n;24 25//--- C.cppm26export module foo;27 28int k = n; // expected-error {{use of undeclared identifier 'n'}}29 30//--- D.cppm31export module bar; // A different module32 33int k = n; // expected-error {{use of undeclared identifier 'n'}}34 35//--- E.cppm36module foo:bar; // Partition implementation37//#define IMPORTED (we don't import foo here)38 39int k = n; // expected-error {{use of undeclared identifier 'n'}}40 41//--- F.cppm42export module foo:bar; // Partition interface43//#define IMPORTED (we don't import foo here)44 45int k = n; // expected-error {{use of undeclared identifier 'n'}}46