49 lines · plain
1// RUN: rm -rf %t2// RUN: split-file %s %t3// RUN: cd %t4//5// RUN: %clang_cc1 -std=c++20 %t/A.cppm -I%t -emit-module-interface -o %t/A.pcm6// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/Use.cpp -verify -fsyntax-only7//8// RUN: rm %t/A.pcm9// RUN: %clang_cc1 -std=c++20 %t/A.cppm -I%t -emit-reduced-module-interface -o %t/A.pcm10// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/Use.cpp -verify -fsyntax-only11//12//--- foo.h13 14namespace ns {15 16struct T {17 T(void*);18};19 20struct A {21 template <typename F>22 A(F f) : t(&f) {}23 24 T t;25};26 27template <typename T>28void foo(T) {29 auto f = [](){};30 ns::A a(f);31}32}33 34//--- A.cppm35module;36#include "foo.h"37export module A;38export namespace ns {39 using ns::A;40 using ns::foo;41}42 43//--- Use.cpp44// expected-no-diagnostics45import A;46void test() {47 ns::foo(5);48}49