xref: /llvm-project/clang/test/Modules/InheritDefaultArguments.cppm (revision da00c60dae0040185dc45039c4397f6e746548e9)
1// RUN: rm -rf %t
2// RUN: split-file %s %t
3// RUN: cd %t
4//
5// RUN: %clang_cc1 -std=c++20 %t/A.cppm -emit-module-interface -o %t/A.pcm
6// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t -I%t %t/Use.cppm -verify -fsyntax-only
7
8// RUN: %clang_cc1 -std=c++20 %t/A.cppm -emit-reduced-module-interface -o %t/A.pcm
9// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t -I%t %t/Use.cppm -verify -fsyntax-only
10
11//--- foo.h
12template <typename T, typename U = int>
13class Templ;
14
15template <typename T, typename U>
16class Templ {
17public:
18    Templ(T t) {}
19};
20
21template <typename T>
22Templ(T t) -> Templ<T, int>;
23
24//--- A.cppm
25module;
26#include "foo.h"
27export module A;
28
29//--- Use.cppm
30// expected-no-diagnostics
31module;
32#include "foo.h"
33export module X;
34import A;
35void foo() {
36    Templ t(0);
37}
38