brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 8ad9e29 Raw
43 lines · plain
1// RUN: rm -rf %t2// RUN: mkdir %t3// RUN: split-file %s %t4//5// RUN: %clang_cc1 -std=c++20 %t/mod1.cppm -emit-module-interface -o %t/mod1.pcm6// RUN: %clang_cc1 -std=c++20 %t/mod2.cppm -emit-module-interface -o %t/mod2.pcm7// RUN: %clang_cc1 -std=c++20 %t/test.cc -fprebuilt-module-path=%t -fsyntax-only -verify8 9//--- mod1.cppm10export module mod1;11export int v;12export void func();13export class A {};14export template <class C>15struct S {};16 17//--- mod2.cppm18export module mod2;19export int v;20export void func();21export class A;22export template <class C>23struct S {};24 25//--- test.cc26import mod1;27import mod2;28void test() {29    int value = v;30    func();31    A a;32    S<int> s;33}34 35// expected-error@mod1.cppm:* {{declaration 'v' attached to named module 'mod1' cannot be attached to other modules}}36// expected-note@mod2.cppm:* {{}}37// expected-error@mod1.cppm:* {{declaration 'func' attached to named module 'mod1' cannot be attached to other modules}}38// expected-note@mod2.cppm:* {{}}39// expected-error@mod1.cppm:* {{declaration 'A' attached to named module 'mod1' cannot be attached to other modules}}40// expected-note@mod2.cppm:* {{}}41// expected-error@mod1.cppm:* 1+{{declaration 'S' attached to named module 'mod1' cannot be attached to other modules}}42// expected-note@mod2.cppm:* 1+{{}}43