36 lines · plain
1// RUN: rm -rf %t2// RUN: mkdir -p %t3// RUN: split-file %s %t4//5// DEFINE: %{common-flags}= -std=c++20 -I %t -fprebuilt-module-path=%t6//7// RUN: %clang_cc1 %{common-flags} %t/other.cppm -emit-module-interface -o %t/other.pcm8// RUN: %clang_analyze_cc1 -analyzer-checker=core %{common-flags} %t/entry.cppm -verify9 10 11//--- MyStruct.h12template <typename T> struct MyStruct {13 T data = 0;14};15template struct MyStruct<int>; // Explicit template instantiation.16 17//--- other.cppm18module;19#include "MyStruct.h"20export module other;21static void implicit_instantiate_MyStruct() {22 MyStruct<int> var;23 (void)var;24}25 26//--- entry.cppm27// expected-no-diagnostics28module;29#include "MyStruct.h"30module other;31 32void entry_point() {33 MyStruct<int> var; // no-crash34 (void)var;35}36