mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-22 16:37:40 +08:00
Fix unused parameters and variables
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290459 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -29,7 +29,7 @@ struct DummyUnaryFunction
|
||||
struct BadUnaryFunction
|
||||
{
|
||||
template <typename S>
|
||||
constexpr int operator()(S const & s) const
|
||||
constexpr int operator()(S const &) const
|
||||
{
|
||||
// Trigger a compile error if this function is instantiated.
|
||||
// The constexpr is needed so that it is instantiated while checking
|
||||
|
@@ -56,8 +56,32 @@ constexpr decltype(std::placeholders::_9) cp9 = std::placeholders::_9;
|
||||
constexpr decltype(std::placeholders::_10) cp10 = std::placeholders::_10;
|
||||
#endif // TEST_STD_VER >= 11
|
||||
|
||||
void use_placeholders_to_prevent_unused_warning() {
|
||||
((void)cp1);
|
||||
((void)cp2);
|
||||
((void)cp3);
|
||||
((void)cp4);
|
||||
((void)cp5);
|
||||
((void)cp6);
|
||||
((void)cp7);
|
||||
((void)cp8);
|
||||
((void)cp9);
|
||||
((void)cp10);
|
||||
((void)default1);
|
||||
((void)default2);
|
||||
((void)default3);
|
||||
((void)default4);
|
||||
((void)default5);
|
||||
((void)default6);
|
||||
((void)default7);
|
||||
((void)default8);
|
||||
((void)default9);
|
||||
((void)default10);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
use_placeholders_to_prevent_unused_warning();
|
||||
test(std::placeholders::_1);
|
||||
test(std::placeholders::_2);
|
||||
test(std::placeholders::_3);
|
||||
|
@@ -138,26 +138,26 @@ inline constexpr CallType operator|(CallType LHS, CallType RHS) {
|
||||
struct ForwardingCallObject {
|
||||
|
||||
template <class ...Args>
|
||||
bool operator()(Args&&... args) & {
|
||||
bool operator()(Args&&...) & {
|
||||
set_call<Args&&...>(CT_NonConst | CT_LValue);
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class ...Args>
|
||||
bool operator()(Args&&... args) const & {
|
||||
bool operator()(Args&&...) const & {
|
||||
set_call<Args&&...>(CT_Const | CT_LValue);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Don't allow the call operator to be invoked as an rvalue.
|
||||
template <class ...Args>
|
||||
bool operator()(Args&&... args) && {
|
||||
bool operator()(Args&&...) && {
|
||||
set_call<Args&&...>(CT_NonConst | CT_RValue);
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class ...Args>
|
||||
bool operator()(Args&&... args) const && {
|
||||
bool operator()(Args&&...) const && {
|
||||
set_call<Args&&...>(CT_Const | CT_RValue);
|
||||
return true;
|
||||
}
|
||||
@@ -526,7 +526,6 @@ void call_operator_forwarding_test()
|
||||
assert(Fn::check_call<int&&>(CT_Const | CT_RValue));
|
||||
}
|
||||
{ // test multi arg
|
||||
int x = 42;
|
||||
const double y = 3.14;
|
||||
std::string s = "abc";
|
||||
obj(42, std::move(y), s, std::string{"foo"});
|
||||
|
Reference in New Issue
Block a user