xref: /llvm-project/clang/test/Modules/template-pack.cppm (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 -emit-module-interface %t/a.cppm -o %t/a.pcm
6// RUN: %clang_cc1 -std=c++20 %t/b.cppm -fprebuilt-module-path=%t -fsyntax-only -verify
7
8// RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/a.cppm -o %t/a.pcm
9// RUN: %clang_cc1 -std=c++20 %t/b.cppm -fprebuilt-module-path=%t -fsyntax-only -verify
10
11//--- foo.h
12
13namespace std
14{
15    template<class _Dom1>
16    void operator &&(_Dom1 __v, _Dom1 __w)
17    {
18        return;
19    }
20}
21
22//--- bar.h
23namespace std
24{
25  template<typename... _Types>
26    struct _Traits
27    {
28      static constexpr bool _S_copy_ctor =
29   (__is_trivial(_Types) && ...);
30    };
31
32  template<typename... _Types>
33    struct variant
34    {
35      void
36      swap(variant& __rhs)
37      noexcept((__is_trivial(_Types) && ...))
38      {
39      }
40    };
41}
42
43//--- a.cppm
44module;
45#include "foo.h"
46#include "bar.h"
47export module a;
48
49//--- b.cppm
50// expected-no-diagnostics
51module;
52#include "bar.h"
53export module b;
54import a;
55