Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 63519ed

Browse files
committed
[C++20][Modules] Add tests related to anonymous members in class templates.
1 parent ffbd616 commit 63519ed

File tree

2 files changed

+92
-0
lines changed

2 files changed

+92
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// RUN: rm -rf %t
2+
// RUN: mkdir -p %t
3+
// RUN: split-file %s %t
4+
5+
// RUN: %clang_cc1 -std=c++20 -fmodule-name=hu-01 -emit-header-unit -xc++-user-header %t/hu-01.h \
6+
// RUN: -o %t/hu-01.pcm
7+
8+
// RUN: %clang_cc1 -std=c++20 -fmodule-name=hu-02 -emit-header-unit -xc++-user-header %t/hu-02.h \
9+
// RUN: -Wno-experimental-header-units \
10+
// RUN: -fmodule-map-file=%t/hu-01.map -fmodule-file=hu-01=%t/hu-01.pcm \
11+
// RUN: -o %t/hu-02.pcm
12+
13+
// RUN: %clang_cc1 -std=c++20 -emit-obj %t/main.cpp \
14+
// RUN: -Wno-experimental-header-units \
15+
// RUN: -fmodule-map-file=%t/hu-01.map -fmodule-file=hu-01=%t/hu-01.pcm \
16+
// RUN: -fmodule-map-file=%t/hu-02.map -fmodule-file=hu-02=%t/hu-02.pcm
17+
18+
//--- hu-01.map
19+
module "hu-01" {
20+
header "hu-01.h"
21+
export *
22+
}
23+
24+
//--- hu-02.map
25+
module "hu-02" {
26+
header "hu-02.h"
27+
export *
28+
}
29+
30+
//--- hu-01.h
31+
template <typename T>
32+
struct S { union { T x; }; };
33+
34+
using SI = S<int>;
35+
36+
//--- hu-02.h
37+
template <typename T>
38+
struct S { union { T x; }; };
39+
40+
inline void f(S<int> s = {}) { s.x; }
41+
42+
//--- main.cpp
43+
import "hu-01.h";
44+
void g(S<int>) {}
45+
46+
import "hu-02.h";
47+
void h() { f(); }
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// RUN: rm -rf %t
2+
// RUN: mkdir -p %t
3+
// RUN: split-file %s %t
4+
5+
// RUN: %clang_cc1 -std=c++20 -fmodule-name=hu-01 -emit-header-unit -xc++-user-header %t/hu-01.h \
6+
// RUN: -o %t/hu-01.pcm
7+
8+
// RUN: %clang_cc1 -std=c++20 -fmodule-name=hu-02 -emit-header-unit -xc++-user-header %t/hu-02.h \
9+
// RUN: -Wno-experimental-header-units \
10+
// RUN: -fmodule-map-file=%t/hu-01.map -fmodule-file=hu-01=%t/hu-01.pcm \
11+
// RUN: -o %t/hu-02.pcm
12+
13+
// RUN: %clang_cc1 -std=c++20 -emit-obj %t/main.cpp \
14+
// RUN: -Wno-experimental-header-units \
15+
// RUN: -fmodule-map-file=%t/hu-01.map -fmodule-file=hu-01=%t/hu-01.pcm \
16+
// RUN: -fmodule-map-file=%t/hu-02.map -fmodule-file=hu-02=%t/hu-02.pcm
17+
18+
//--- hu-01.map
19+
module "hu-01" {
20+
header "hu-01.h"
21+
export *
22+
}
23+
24+
//--- hu-02.map
25+
module "hu-02" {
26+
header "hu-02.h"
27+
export *
28+
}
29+
30+
//--- hu-01.h
31+
template <typename T>
32+
struct S { union { T x; }; };
33+
34+
using SI = S<int>;
35+
36+
//--- hu-02.h
37+
import "hu-01.h";
38+
inline void f(S<int> s = {}) { s.x; }
39+
40+
//--- main.cpp
41+
import "hu-01.h";
42+
void g(S<int>) {}
43+
44+
import "hu-02.h";
45+
void h() { f(); }

0 commit comments

Comments
 (0)