1// https://github.com/llvm/llvm-project/issues/59780 2// 3// RUN: rm -rf %t 4// RUN: mkdir %t 5// RUN: split-file %s %t 6// 7// RUN: %clang_cc1 -std=c++20 %t/data.cppm -emit-module-interface -o %t/data.pcm 8// RUN: %clang_cc1 -std=c++20 %t/main.cpp -fprebuilt-module-path=%t -fsyntax-only -verify 9 10// RUN: %clang_cc1 -std=c++20 %t/data.cppm -emit-reduced-module-interface -o %t/data.pcm 11// RUN: %clang_cc1 -std=c++20 %t/main.cpp -fprebuilt-module-path=%t -fsyntax-only -verify 12 13//--- foo.h 14namespace 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.cppm 42module; 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.cpp 55// expected-no-diagnostics 56import data; 57 58int main(int argc, const char *argv[]) { 59 std::expected<std::unique_ptr<int>> result = parse(); 60} 61