brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · 0ad3bc8 Raw
73 lines · cpp
1// RUN: rm -rf %t2// RUN: mkdir -p %t3// RUN: split-file %s %t4// RUN: %clang_cc1 -std=c++20 %t/impl.cppm -emit-module-interface -o %t/M-impl.pcm5// RUN: %clang_cc1 -std=c++20 %t/M.cppm -emit-module-interface -fprebuilt-module-path=%t -o %t/M.pcm6// RUN: %clang_cc1 -std=c++20 %t/Use.cpp -fprebuilt-module-path=%t -verify -fsyntax-only7// RUN: %clang_cc1 -std=c++20 %t/UseInPartA.cppm -fprebuilt-module-path=%t -verify -fsyntax-only8// RUN: %clang_cc1 -std=c++20 %t/UseInAnotherModule.cppm -fprebuilt-module-path=%t -verify -fsyntax-only9// RUN: %clang_cc1 -std=c++20 %t/Private.cppm -emit-module-interface -fprebuilt-module-path=%t -o %t/A.pcm10// RUN: %clang_cc1 -std=c++20 %t/TryUseFromPrivate.cpp -fprebuilt-module-path=%t -verify -fsyntax-only11// RUN: %clang_cc1 -std=c++20 %t/Global.cppm -emit-module-interface -fprebuilt-module-path=%t -o %t/C.pcm12// RUN: %clang_cc1 -std=c++20 %t/UseGlobal.cpp -fprebuilt-module-path=%t -verify -fsyntax-only13 14//--- impl.cppm15module M:impl;16class A {};17 18//--- M.cppm19export module M;20import :impl;21export A f();22 23//--- Use.cpp24import M;25void test() {26  A a; // expected-error {{unknown type name 'A'}}27}28 29//--- UseInPartA.cppm30export module M:partA;31import :impl; // expected-warning {{importing an implementation partition unit in a module interface is not recommended.}}32void test() {33  A a;34}35 36//--- UseInAnotherModule.cppm37export module B;38import M;39void test() {40  A a; // expected-error {{unknown type name 'A'}}41}42 43//--- Private.cppm44export module A;45module :private;46 47class A {};48void test() {49  A a;50}51 52//--- TryUseFromPrivate.cpp53 54import A;55void test() {56  A a; // expected-error {{unknown type name 'A'}}57}58 59//--- Global.cppm60module;61class A{};62export module C;63void test() {64  A a;65}66 67//--- UseGlobal.cpp68import C;69void test() {70  A a; // expected-error {{'A' must be declared before it is used}}71       // expected-note@Global.cppm:2 {{declaration here is not visible}}72}73