xref: /llvm-project/clang/test/Modules/instantiation-argdep-lookup.cppm (revision da00c60dae0040185dc45039c4397f6e746548e9)
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 -I%t -emit-module-interface -o %t/A.pcm
6// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/Use.cpp -verify -fsyntax-only
7//
8// RUN: %clang_cc1 -std=c++20 %t/A.cppm -I%t -emit-reduced-module-interface -o %t/A.pcm
9// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/Use.cpp -verify -fsyntax-only
10//
11//--- foo.h
12
13namespace ns {
14struct A {};
15
16template<typename Func>
17constexpr bool __call_is_nt(A)
18{
19    return true;
20}
21ns::A make();
22
23template <typename T>
24bool foo(T t) {
25    auto func = [](){};
26    return __call_is_nt<decltype(func)>(t);
27}
28}
29
30//--- A.cppm
31module;
32#include "foo.h"
33export module A;
34export namespace ns {
35    using ns::foo;
36    using ns::make;
37}
38
39//--- Use.cpp
40// expected-no-diagnostics
41import A;
42void test() {
43    auto a = ns::make();
44    ns::foo(a);
45}
46