Skip to content

Commit 9282c9d

Browse files
committed
[libc++] Avoid name conflict with declaration in <unistd.h>
It appears that ::link is also declared as another kind of symbol in <unistd.h>, which we seem to get transitively when we start using a single top-level module. Instead of declaring these names as global extern variables, use function parameters to achieve the same thing.
1 parent 471360b commit 9282c9d

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

libcxx/test/libcxx/diagnostics/chrono.nodiscard.verify.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@
2121
#include "test_macros.h"
2222

2323
// These types have "private" constructors.
24-
extern std::chrono::time_zone tz;
25-
extern std::chrono::time_zone_link link;
26-
extern std::chrono::leap_second leap;
27-
28-
void test() {
24+
void test(std::chrono::time_zone tz, std::chrono::time_zone_link link, std::chrono::leap_second leap) {
2925
std::chrono::tzdb_list& list = std::chrono::get_tzdb_list();
3026
list.front(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
3127
list.begin(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}

0 commit comments

Comments
 (0)