brintos

brintos / llvm-project-archived public Read only

0
0
Text · 607 B · a859ce7 Raw
34 lines · plain
1// RUN: rm -rf %t2// RUN: mkdir -p %t3// RUN: split-file %s %t4//5// RUN: %clang_cc1 -std=c++20 %t/foo.cppm -verify -fsyntax-only6 7//--- bar.h8template <typename T>9struct Singleton {10    static T* instance_;11    static T* get() {12        static bool init = false;13        if (!init) {14            init = true;15            instance_ = ::new T();16        }17        return instance_;18    }19};20 21template <typename T>22T* Singleton<T>::instance_ = nullptr;23 24struct s{};25inline void* foo() {26    return Singleton<s>::get();27}28 29//--- foo.cppm30// expected-no-diagnostics31module;32#include "bar.h"33export module foo;34