xref: /llvm-project/clang/test/Modules/named-modules-adl.cppm (revision f21ead06750b670cf8ce72d6666e3550b04056a2)
1// RUN: rm -rf %t
2// RUN: split-file %s %t
3// RUN: cd %t
4//
5// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-module-interface -o %t/a.pcm
6// RUN: %clang_cc1 -std=c++20 %t/b.cppm -fmodule-file=a=%t/a.pcm -fsyntax-only -verify
7
8// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-reduced-module-interface -o %t/a.pcm -DREDUCED
9// RUN: %clang_cc1 -std=c++20 %t/b.cppm -fmodule-file=a=%t/a.pcm -fsyntax-only -verify
10
11//--- a.h
12namespace n {
13
14struct s { };
15
16void operator+(s, int) {
17}
18
19} // namespace n
20
21//--- a.cppm
22module;
23#include "a.h"
24export module a;
25
26export template<typename T>
27void a(T x) {
28	n::s() + x;
29}
30
31#ifdef REDUCED
32// Use it to make sure it is not optimized out in reduced BMI.
33using n::operator+;
34#endif
35
36//--- b.cppm
37// expected-no-diagnostics
38export module b;
39import a;
40
41void b() {
42	a(0);
43}
44