Skip to content

Commit 325bc6c

Browse files
committed
Add test
1 parent 13ec049 commit 325bc6c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

clang/test/SemaCXX/unique_object_duplication.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ inline void has_thread_local() {
9999
thread_local int disallowedThreadLocal = 0; // hidden-warning {{'disallowedThreadLocal' may be duplicated when built into a shared library: it is mutable, has hidden visibility, and external linkage}}
100100
}
101101

102+
103+
// Functions themselves are always immutable, so referencing them is okay
104+
auto& allowedFunctionReference = has_static_locals_external;
105+
102106
} // namespace StaticLocalTest
103107

104108
/******************************************************************************
@@ -154,6 +158,7 @@ namespace GlobalTest {
154158
};
155159

156160
inline float Test::disallowedStaticMember2 = 2.3; // hidden-warning {{'disallowedStaticMember2' may be duplicated when built into a shared library: it is mutable, has hidden visibility, and external linkage}}
161+
157162
} // namespace GlobalTest
158163

159164
/******************************************************************************

0 commit comments

Comments
 (0)