xref: /llvm-project/clang/test/Modules/Reachability-func-ret.cpp (revision da00c60dae0040185dc45039c4397f6e746548e9)
1 // RUN: rm -rf %t
2 // RUN: mkdir -p %t
3 // RUN: split-file %s %t
4 //
5 // RUN: %clang_cc1 -std=c++20 %t/func_ret.cppm -emit-module-interface -o %t/func_ret.pcm
6 // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/Use.cpp -verify -fsyntax-only
7 
8 // RUN: %clang_cc1 -std=c++20 %t/func_ret.cppm -emit-reduced-module-interface -o %t/func_ret.pcm
9 // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/Use.cpp -verify -fsyntax-only
10 //
11 //--- func_ret.cppm
12 export module func_ret;
13 struct t {};
foo()14 export t foo() {
15   return t{};
16 }
17 
18 //--- Use.cpp
19 // expected-no-diagnostics
20 import func_ret;
bar()21 void bar() {
22   auto ret = foo();
23 }
24