Debian Codegraph @

clang/test/Analysis/modules/explicit-templ-inst-crash-in-modules.cppm

raw
1 // RUN: rm -rf %t
2 // RUN: mkdir -p %t
3 // RUN: split-file %s %t
4 //
5 // DEFINE: %{common-flags}= -std=c++20 -I %t -fprebuilt-module-path=%t
6 //
7 // RUN: %clang_cc1 %{common-flags} %t/other.cppm -emit-module-interface -o %t/other.pcm
8 // RUN: %clang_analyze_cc1 -analyzer-checker=core %{common-flags} %t/entry.cppm -verify
9
10
11 //--- MyStruct.h
12 template <typename T> struct MyStruct {
13 T data = 0;
14 };
15 template struct MyStruct<int>; // Explicit template instantiation.
16
17 //--- other.cppm
18 module;
19 #include "MyStruct.h"
20 export module other;
21 static void implicit_instantiate_MyStruct() {
22 MyStruct<int> var;
23 (void)var;
24 }
25
26 //--- entry.cppm
27 // expected-no-diagnostics
28 module;
29 #include "MyStruct.h"
30 module other;
31
32 void entry_point() {
33 MyStruct<int> var; // no-crash
34 (void)var;
35 }