Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[libc++] Use addressof in forward_list.
This addresses the usage of `operator&` in `<forward_list>`. (Note there are still more headers with the same issue.) Reviewed By: #libc, Quuxplusone, ldionne Differential Revision: https://reviews.llvm.org/D112660
- Loading branch information
Showing
5 changed files
with
101 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
.../containers/sequences/forwardlist/forwardlist.ops/merge_lvalue.addressof.compile.pass.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// <forward_list> | ||
|
||
// template <class Compare> void merge(forward_list& x); | ||
|
||
// Validate whether the operation properly guards against ADL-hijacking operator& | ||
|
||
#include <forward_list> | ||
|
||
#include "test_macros.h" | ||
#include "operator_hijacker.h" | ||
|
||
void test() { | ||
std::forward_list<operator_hijacker> lo; | ||
std::forward_list<operator_hijacker> l; | ||
lo.merge(l); | ||
} |
24 changes: 24 additions & 0 deletions
24
...ainers/sequences/forwardlist/forwardlist.ops/merge_lvalue_pred.addressof.compile.pass.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// <forward_list> | ||
|
||
// template <class Compare> void merge(forward_list& x, Compare comp); | ||
|
||
// Validate whether the operation properly guards against ADL-hijacking operator& | ||
|
||
#include <forward_list> | ||
|
||
#include "test_macros.h" | ||
#include "operator_hijacker.h" | ||
|
||
void test() { | ||
std::forward_list<operator_hijacker> lo; | ||
std::forward_list<operator_hijacker> l; | ||
lo.merge(l, std::less<operator_hijacker>()); | ||
} |
26 changes: 26 additions & 0 deletions
26
.../containers/sequences/forwardlist/forwardlist.ops/merge_rvalue.addressof.compile.pass.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// UNSUPPORTED: c++03 | ||
|
||
// <forward_list> | ||
|
||
// template <class Compare> void merge(forward_list&& x); | ||
|
||
// Validate whether the operation properly guards against ADL-hijacking operator& | ||
|
||
#include <forward_list> | ||
|
||
#include "test_macros.h" | ||
#include "operator_hijacker.h" | ||
|
||
void test() { | ||
std::forward_list<operator_hijacker> lo; | ||
std::forward_list<operator_hijacker> l; | ||
lo.merge(std::move(l)); | ||
} |
26 changes: 26 additions & 0 deletions
26
...ainers/sequences/forwardlist/forwardlist.ops/merge_rvalue_pred.addressof.compile.pass.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// UNSUPPORTED: c++03 | ||
|
||
// <forward_list> | ||
|
||
// template <class Compare> void merge(forward_list&& x, Compare comp); | ||
|
||
// Validate whether the operation properly guards against ADL-hijacking operator& | ||
|
||
#include <forward_list> | ||
|
||
#include "test_macros.h" | ||
#include "operator_hijacker.h" | ||
|
||
void test() { | ||
std::forward_list<operator_hijacker> lo; | ||
std::forward_list<operator_hijacker> l; | ||
lo.merge(std::move(l), std::less<operator_hijacker>()); | ||
} |