brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · b52ebba Raw
43 lines · cpp
1// RUN: rm -rf %t2// RUN: split-file %s %t3// RUN: cd %t4 5// RUN: %clang_cc1 -std=c++23 mod1.cppm -emit-module-interface -o mod1.pcm -fallow-pcm-with-compiler-errors -verify6// RUN: %clang_cc1 -std=c++23 mod2.cppm -emit-module-interface -o mod2.pcm -fmodule-file=mod1=mod1.pcm -verify -fallow-pcm-with-compiler-errors7// 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-errors8// 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-all9 10//--- mod1.cppm11export module mod1;12 13export template <unsigned N, unsigned M>14class A {15public:16  constexpr A(const char[], const char[]) {17    auto x = BrokenExpr; // expected-error {{use of undeclared identifier 'BrokenExpr'}}18  }19};20 21export template<A<1,1> NTTP>22struct B {};23 24template < unsigned N, unsigned M >25A(const char (&)[N], const char (&)[M]) -> A< 1, 1 >;26 27//--- mod2.cppm28export module mod2;29import mod1;30 31struct 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.cppm36// expected-no-diagnostics37export module mod3;38export import mod2;39 40//--- main.cpp41// expected-no-diagnostics42import mod3; // no crash43