Debian Codegraph @

clang/test/Modules/partial_specialization.cppm

raw
1 // RUN: rm -rf %t
2 // RUN: split-file %s %t
3 // RUN: cd %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 -fprebuilt-module-path=%t %t/Use.cpp -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 -fprebuilt-module-path=%t %t/Use.cpp -fsyntax-only -verify
10 //
11 //--- foo.h
12 template<typename T, typename U>
13 inline constexpr bool IsSame = false;
14
15 template<typename T>
16 inline constexpr bool IsSame<T, T> = true;
17
18 template <typename T>
19 class A {
20 public:
21 A();
22 ~A() noexcept(IsSame<T, T>);
23 };
24
25 //--- A.cppm
26 module;
27 #include "foo.h"
28 export module A;
29 export using ::A;
30
31 //--- Use.cpp
32 import A;
33 void bool_consume(bool b);
34 void use() {
35 A<int> a{};
36 bool_consume(IsSame); // expected-error {{use of undeclared identifier 'IsSame'}}
37 }