61 lines · plain
1// https://github.com/llvm/llvm-project/issues/597802//3// RUN: rm -rf %t4// RUN: mkdir %t5// RUN: split-file %s %t6//7// RUN: %clang_cc1 -std=c++20 %t/data.cppm -emit-module-interface -o %t/data.pcm8// RUN: %clang_cc1 -std=c++20 %t/main.cpp -fprebuilt-module-path=%t -fsyntax-only -verify9 10// RUN: %clang_cc1 -std=c++20 %t/data.cppm -emit-reduced-module-interface -o %t/data.pcm11// RUN: %clang_cc1 -std=c++20 %t/main.cpp -fprebuilt-module-path=%t -fsyntax-only -verify12 13//--- foo.h14namespace std {15 16template <class _Tp>17class expected {18public:19 expected(_Tp&& __u)20 {}21 22 constexpr ~expected()23 requires(__is_trivially_destructible(_Tp))24 = default;25 26 constexpr ~expected()27 requires(!__is_trivially_destructible(_Tp))28 {29 }30};31 32template <class _Tp>33class unique_ptr {34public:35 unique_ptr(void* __p) {}36 ~unique_ptr() {}37};38 39}40 41//--- data.cppm42module;43#include "foo.h"44export module data;45export namespace std {46 using std::unique_ptr;47 using std::expected; 48}49 50export std::expected<std::unique_ptr<int>> parse() {51 return std::unique_ptr<int>(nullptr); 52}53 54//--- main.cpp55// expected-no-diagnostics56import data;57 58int main(int argc, const char *argv[]) { 59 std::expected<std::unique_ptr<int>> result = parse(); 60}61