Debian Codegraph @

clang/test/Modules/missing-body-in-import.cpp

raw
1 // RUN: rm -rf %t
2 // RUN: split-file %s %t
3 // RUN: cd %t
4
5 // RUN: %clang_cc1 -std=c++23 mod1.cppm -emit-module-interface -o mod1.pcm -fallow-pcm-with-compiler-errors -verify
6 // RUN: %clang_cc1 -std=c++23 mod2.cppm -emit-module-interface -o mod2.pcm -fmodule-file=mod1=mod1.pcm -verify -fallow-pcm-with-compiler-errors
7 // RUN: %clang_cc1 -std=c++23 mod3.cppm -emit-module-interface -o mod3.pcm -fmodule-file=mod1=mod1.pcm -fmodule-file=mod2=mod2.pcm -verify -fallow-pcm-with-compiler-errors
8 // RUN: %clang_cc1 -std=c++23 main.cpp -fmodule-file=mod1=mod1.pcm -fmodule-file=mod2=mod2.pcm -fmodule-file=mod3=mod3.pcm -verify -fallow-pcm-with-compiler-errors -ast-dump-all
9
10 //--- mod1.cppm
11 export module mod1;
12
13 export template <unsigned N, unsigned M>
14 class A {
15 public:
16 constexpr A(const char[], const char[]) {
17 auto x = BrokenExpr; // expected-error {{use of undeclared identifier 'BrokenExpr'}}
18 }
19 };
20
21 export template<A<1,1> NTTP>
22 struct B {};
23
24 template < unsigned N, unsigned M >
25 A(const char (&)[N], const char (&)[M]) -> A< 1, 1 >;
26
27 //--- mod2.cppm
28 export module mod2;
29 import mod1;
30
31 struct C: B <A{"a", "b"}> { // expected-error {{non-type template argument is not a constant expression}}
32 constexpr C(int a) { }
33 };
34
35 //--- mod3.cppm
36 // expected-no-diagnostics
37 export module mod3;
38 export import mod2;
39
40 //--- main.cpp
41 // expected-no-diagnostics
42 import mod3; // no crash