1 // Test case from https://github.com/llvm/llvm-project/issues/59999
5 // RUN: split-file %s %t
7 // RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/Module.cppm \
8 // RUN: -emit-module-interface -o %t/Module.pcm
9 // RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/Object.cppm \
10 // RUN: -fmodule-file=Module=%t/Module.pcm -emit-module-interface -o %t/Object.pcm
11 // RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/Object.pcm \
12 // RUN: -fmodule-file=Module=%t/Module.pcm -S -emit-llvm -o - | FileCheck %t/Object.cppm
17 export template <class ObjectType> bool ModuleRegister() { return true; };
19 export struct ModuleEntry {
20 static const bool bRegistered;
23 const bool ModuleEntry::bRegistered = ModuleRegister<ModuleEntry>();
30 export template <class ObjectType> bool ObjectRegister() { return true; }
31 export struct NObject {
32 static const bool bRegistered;
34 export struct ObjectModuleEntry {
35 static const bool bRegistered;
38 // This function is also required for crash
39 const bool NObject::bRegistered = ObjectRegister<NObject>();
40 // One another function, that helps clang crash
41 const bool ObjectModuleEntry::bRegistered = ModuleRegister<ObjectModuleEntry>();
43 // Check that the LLVM IR is generated correctly instead of crashing.
44 // CHECK: define{{.*}}@_ZGIW6Object