Debian Codegraph @

clang/test/Modules/ComplexExplicitSpecifier.cpp

raw
1 // Tests complex explicit constructor across modules.
2 //
3 // RUN: rm -rf %t
4 // RUN: mkdir -p %t
5 // RUN: split-file %s %t
6
7 // RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/Foo.cppm \
8 // RUN: -o %t/Foo.pcm
9
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.pcm
14
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.o
20
21 //--- Foo.cppm
22 export module Foo;
23
24 export {
25 template<class T>
26 class Foo {
27 public:
28 template<class... Args>
29 explicit (sizeof...(Args) == 1) Foo(Args&&... args);
30 };
31 }
32
33 template<class T>
34 template<class... Args>
35 inline Foo<T>::Foo(Args&&... args) {}
36
37 //--- Bar.cppm
38 export module Bar;
39 import Foo;
40
41 struct Bar {};
42
43 void a() {
44 auto foo = Foo<Bar>{};
45 }