Debian Codegraph @

clang/test/Modules/diag-undefined-template.cpp

raw
1 // RUN: rm -rf %t
2 // RUN: split-file %s %t
3 // RUN: %clang_cc1 -std=c++20 -fmodules -fmodules-cache-path=%t -I%t \
4 // RUN: -Wundefined-func-template \
5 // RUN: -fimplicit-module-maps %t/main.cpp 2>&1 | grep "unreachable declaration of template entity is here"
6
7 // Note that the diagnostics are triggered when building the 'hoge' module, which is imported from the main file.
8 // The "-verify" flag doesn't work in this case. Instead, we grep the expected text to verify the test.
9
10 //--- shared_ptr2.h
11 #pragma once
12
13 template<class T>
14 void x() { }
15
16 //--- hoge.h
17 #pragma once
18
19 #include "shared_ptr2.h"
20
21 inline void f() {
22 x<int>();
23 }
24
25 //--- module.modulemap
26 module hoge {
27 header "hoge.h"
28 }
29
30 module shared_ptr2 {
31 header "shared_ptr2.h"
32 }
33
34 //--- main.cpp
35 #include "hoge.h"
36
37 int main() {
38 f();
39 }