blob: a859ce759260435f5ff94e3ee917debc364653a0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
// RUN: rm -rf %t
// RUN: mkdir -p %t
// RUN: split-file %s %t
//
// RUN: %clang_cc1 -std=c++20 %t/foo.cppm -verify -fsyntax-only
//--- bar.h
template <typename T>
struct Singleton {
static T* instance_;
static T* get() {
static bool init = false;
if (!init) {
init = true;
instance_ = ::new T();
}
return instance_;
}
};
template <typename T>
T* Singleton<T>::instance_ = nullptr;
struct s{};
inline void* foo() {
return Singleton<s>::get();
}
//--- foo.cppm
// expected-no-diagnostics
module;
#include "bar.h"
export module foo;
|