xref: /llvm-project/clang/test/Modules/expose-static-inline-from-gmf-4.cppm (revision e50ec3e46bea819a1d7aea1cee2d7e11197bbdd2)
1// RUN: rm -rf %t
2// RUN: mkdir -p %t
3// RUN: split-file %s %t
4//
5// RUN: %clang -std=c++20 %t/a.cppm --precompile -o %t/a.pcm \
6// RUN:   -DTEST_INLINE
7// RUN: %clang -std=c++20 %t/test.cc -fprebuilt-module-path=%t -fsyntax-only -Xclang -verify \
8// RUN:   -DTEST_INLINE
9//
10// RUN: %clang -std=c++20 %t/a.cppm --precompile -o %t/a.pcm
11// RUN: %clang -std=c++20 %t/test.cc -fprebuilt-module-path=%t -fsyntax-only -Xclang -verify
12
13//--- a.h
14#ifdef TEST_INLINE
15#define INLINE inline
16#else
17#define INLINE
18#endif
19namespace ns {
20template <typename G> static void func() {}
21template <> INLINE void func<long>() {}
22template <typename T = long> void a() { func<T>(); }
23}
24
25//--- a.cppm
26module;
27#include "a.h"
28export module a;
29export using ns::a;
30
31//--- test.cc
32import a;
33auto m = (a(), 0);
34
35#ifdef TEST_INLINE
36// expected-no-diagnostics
37#else
38// expected-error@a.h:9 {{no matching function for call to 'func'}}
39// expected-note@test.cc:2 {{in instantiation of function template specialization 'ns::a<long>' requested here}}
40#endif
41