Debian Codegraph @

clang/test/Modules/derived_class.cpp

raw
1 // RUN: rm -rf %t
2 // RUN: mkdir -p %t
3 // RUN: split-file %s %t
4 //
5 // RUN: %clang_cc1 -std=c++20 %t/foo.cppm -emit-module-interface -o %t/foo.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 %t/foo.cppm -emit-reduced-module-interface -o %t/foo.pcm
9 // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/Use.cpp -fsyntax-only -verify
10 //
11 //--- bar.h
12 struct bar_base {
13 enum A {
14 a,
15 b,
16 c,
17 d
18 };
19 constexpr static bool value = false;
20 static bool get() { return false; }
21 bool member_value = false;
22 bool get_func() { return false; }
23 };
24
25 template <typename T>
26 struct bar : public bar_base {
27 };
28
29 //--- foo.cppm
30 module;
31 #include "bar.h"
32 export module foo;
33 export template <typename T>
34 int foo() {
35 bool a = bar<T>::value;
36 bar<T>::get();
37 bar<T> b;
38 b.member_value = a;
39 bool c = b.get_func();
40 return bar<T>::a;
41 }
42
43 //--- Use.cpp
44 // expected-no-diagnostics
45 import foo;
46 void test() {
47 foo<int>();
48 }