xref: /llvm-project/clang/test/Modules/expose-static-inline-from-gmf-1.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
19static INLINE void func(long) {}
20template <typename T = long> void a() { func(T{}); }
21
22//--- a.cppm
23module;
24#include "a.h"
25export module a;
26export using ::a;
27
28//--- test.cc
29import a;
30auto m = (a(), 0);
31
32#ifdef TEST_INLINE
33// expected-no-diagnostics
34#else
35// expected-error@a.h:7 {{no matching function for call to 'func'}}
36// expected-note@test.cc:2 {{in instantiation of function template specialization 'a<long>' requested here}}
37#endif
38