aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Modules/no-implicit-std-cxx-module.cppm
blob: 2df8b5cf5d84844dc2cf51080826219804af87ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// RUN: rm -rf %t
// RUN: split-file %s %t
// RUN: cd %t
//
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/b.cppm -o %t/b.pcm
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/a.cppm -fmodule-file=b=%t/b.pcm \
// RUN:     -o %t/a.pcm
// RUN: %clang_cc1 -std=c++20 %t/user.cpp -fmodule-file=a=%t/a.pcm -verify -fsyntax-only

//--- b.cppm
export module b;
export int b() {
    return 43;
}

//--- a.cppm
export module a;
import b;
export int a() {
    return b() + 43;
}

//--- user.cpp
import a; // expected-error {{failed to find module file for module 'b'}}
int use() {
    return a(); // expected-error {{use of undeclared identifier 'a'}}
}