-Wunused-parameter: Don't fire on defaulted or deleted functions
Patch by Dinesh Dwivedi! Differential Revision: http://reviews.llvm.org/D3376 llvm-svn: 207672
This commit is contained in:
parent
b7be52343d
commit
121b1a1fa5
|
@ -9921,7 +9921,9 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body,
|
|||
Diag(FD->getLocation(), diag::warn_pure_function_definition);
|
||||
|
||||
if (!FD->isInvalidDecl()) {
|
||||
DiagnoseUnusedParameters(FD->param_begin(), FD->param_end());
|
||||
// Don't diagnose unused parameters of defaulted or deleted functions.
|
||||
if (Body)
|
||||
DiagnoseUnusedParameters(FD->param_begin(), FD->param_end());
|
||||
DiagnoseSizeOfParametersAndReturnValue(FD->param_begin(), FD->param_end(),
|
||||
FD->getReturnType(), FD);
|
||||
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
// RUN: %clang_cc1 -std=c++11 -verify %s -Wunused-parameter
|
||||
|
||||
// PR19303 : Make sure we don't get a unused expression warning for deleted and
|
||||
// defaulted functions
|
||||
|
||||
// expected-no-diagnostics
|
||||
|
||||
class A {
|
||||
public:
|
||||
int x;
|
||||
A() = default;
|
||||
~A() = default;
|
||||
A(const A &other) = delete;
|
||||
|
||||
template <typename T>
|
||||
void SetX(T x) {
|
||||
this->x = x;
|
||||
};
|
||||
|
||||
void SetX1(int x);
|
||||
};
|
||||
|
||||
template <>
|
||||
void A::SetX(A x) = delete;
|
||||
|
||||
class B {
|
||||
public:
|
||||
B() = default;
|
||||
~B() = default;
|
||||
B(const B &other);
|
||||
};
|
||||
|
||||
B::B(const B &other) = default;
|
Loading…
Reference in New Issue