46 lines · cpp
1// Tests complex explicit constructor across modules.2//3// RUN: rm -rf %t4// RUN: mkdir -p %t5// RUN: split-file %s %t6 7// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/Foo.cppm \8// RUN: -o %t/Foo.pcm9 10// RUN: %clang_cc1 -std=c++20 -emit-module-interface \11// RUN: -fmodule-file=Foo=%t/Foo.pcm \12// RUN: %t/Bar.cppm \13// RUN: -o %t/Bar.pcm14 15// RUN: %clang_cc1 -std=c++20 -emit-obj \16// RUN: -main-file-name Bar.cppm \17// RUN: -fmodule-file=Foo=%t/Foo.pcm \18// RUN: -x pcm %t/Bar.pcm \19// RUN: -o %t/Bar.o20 21//--- Foo.cppm22export module Foo;23 24export {25template<class T>26class Foo {27 public:28 template<class... Args>29 explicit (sizeof...(Args) == 1) Foo(Args&&... args);30};31}32 33template<class T>34template<class... Args>35inline Foo<T>::Foo(Args&&... args) {}36 37//--- Bar.cppm38export module Bar;39import Foo;40 41struct Bar {};42 43void a() {44 auto foo = Foo<Bar>{};45}46