summaryrefslogtreecommitdiff
path: root/test/SemaCXX
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2017-11-01 04:52:12 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2017-11-01 04:52:12 +0000
commit2276925224353681293a6a8ff6758a984d9c2e1c (patch)
treedade4e02dad72e3561fd4bc63c472956f6d4ede9 /test/SemaCXX
parent23966147d547ba36deb4726e5c09d680fedb8909 (diff)
Fix -Wunused-private-field to fire regardless of which implicit special members have been implicitly declared.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@317076 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX')
-rw-r--r--test/SemaCXX/unused.cpp2
-rw-r--r--test/SemaCXX/warn-unused-private-field.cpp17
2 files changed, 18 insertions, 1 deletions
diff --git a/test/SemaCXX/unused.cpp b/test/SemaCXX/unused.cpp
index ba9ab2363b..abaf611b0d 100644
--- a/test/SemaCXX/unused.cpp
+++ b/test/SemaCXX/unused.cpp
@@ -6,7 +6,7 @@
// PR4103 : Make sure we don't get a bogus unused expression warning
namespace PR4103 {
class APInt {
- char foo;
+ char foo; // expected-warning {{private field 'foo' is not used}}
};
class APSInt : public APInt {
char bar; // expected-warning {{private field 'bar' is not used}}
diff --git a/test/SemaCXX/warn-unused-private-field.cpp b/test/SemaCXX/warn-unused-private-field.cpp
index fb34fa98ea..fe44122a1d 100644
--- a/test/SemaCXX/warn-unused-private-field.cpp
+++ b/test/SemaCXX/warn-unused-private-field.cpp
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -Wunused-private-field -Wused-but-marked-unused -Wno-uninitialized -verify -std=c++11 %s
+// RUN: %clang_cc1 -fsyntax-only -Wunused-private-field -Wused-but-marked-unused -Wno-uninitialized -verify -std=c++17 %s
class NotFullyDefined {
public:
@@ -246,3 +247,19 @@ namespace pr13543 {
X x[4]; // no-warning
};
}
+
+class implicit_special_member {
+public:
+ static implicit_special_member make() { return implicit_special_member(); }
+
+private:
+ int n; // expected-warning{{private field 'n' is not used}}
+};
+
+class defaulted_special_member {
+public:
+ defaulted_special_member(const defaulted_special_member&) = default;
+
+private:
+ int n; // expected-warning{{private field 'n' is not used}}
+};