60 lines · cpp
1// RUN: rm -rf %t2// RUN: mkdir %t3// RUN: split-file %s %t4//5// RUN: %clang_cc1 -std=c++20 %t/foo.cppm -I%t -emit-module-interface -o %t/foo.pcm6// RUN: %clang_cc1 -fprebuilt-module-path=%t -std=c++20 %t/use.cpp -I%t -fsyntax-only -verify7 8// RUN: %clang_cc1 -std=c++20 %t/foo.cppm -I%t -emit-reduced-module-interface -o %t/foo.pcm9// RUN: %clang_cc1 -fprebuilt-module-path=%t -std=c++20 %t/use.cpp -I%t -fsyntax-only -verify10 11//--- foo.h12template <typename T>13T u;14 15template <typename T = int>16T v;17 18template <int T = 8>19int v2;20 21template <typename T>22class my_array {};23 24template <template <typename> typename C = my_array>25int v3;26 27template <typename T, int *i = nullptr>28T v4;29 30template <typename T, T *i = nullptr>31T v5;32 33inline int a = 43;34template <typename T, int *i = &a>35T v6;36 37inline int b = 43;38template <typename T, T *i = &b>39T v7;40 41template <int T = (3 > 2)>42int v8;43 44consteval int getInt() {45 return 55;46}47template <int T = getInt()>48int v9;49 50//--- foo.cppm51module;52#include "foo.h"53export module foo;54 55 56//--- use.cpp57// expected-no-diagnostics58import foo;59#include "foo.h"60