36 lines · cpp
1// RUN: rm -rf %t2// RUN: mkdir -p %t3// RUN: split-file %s %t4 5// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/std10-3-ex2-tu1.cpp \6// RUN: -o %t/M.pcm7 8// RUN: %clang_cc1 -std=c++20 -S %t/std10-3-ex2-tu2.cpp \9// RUN: -fmodule-file=M=%t/M.pcm -o %t/tu_8.s -verify10 11// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/std10-3-ex2-tu3.cpp \12// RUN: -o %t/M.pcm -verify13 14// Test again with reduced BMI.15// RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/std10-3-ex2-tu1.cpp \16// RUN: -o %t/M.pcm17 18// RUN: %clang_cc1 -std=c++20 -S %t/std10-3-ex2-tu2.cpp \19// RUN: -fmodule-file=M=%t/M.pcm -o %t/tu_8.s -verify20 21// RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/std10-3-ex2-tu3.cpp \22// RUN: -o %t/M.pcm -verify23 24//--- std10-3-ex2-tu1.cpp25export module M;26 27//--- std10-3-ex2-tu2.cpp28module M;29 // error: cannot import M in its own unit30import M; // expected-error {{import of module 'M' appears within its own implementation}}31 32//--- std10-3-ex2-tu3.cpp33export module M;34 // error: cannot import M in its own unit35import M; // expected-error {{import of module 'M' appears within its own interface}}36