File tree 2 files changed +1
-35
lines changed
2 files changed +1
-35
lines changed Original file line number Diff line number Diff line change @@ -1723,8 +1723,7 @@ static bool ShouldDiagnoseUnusedDecl(const NamedDecl *D) {
1723
1723
dyn_cast<CXXConstructExpr>(Init);
1724
1724
if (Construct && !Construct->isElidable()) {
1725
1725
CXXConstructorDecl *CD = Construct->getConstructor();
1726
- if (!CD->isTrivial() && !RD->hasAttr<WarnUnusedAttr>() &&
1727
- !VD->evaluateValue())
1726
+ if (!CD->isTrivial() && !RD->hasAttr<WarnUnusedAttr>())
1728
1727
return false;
1729
1728
}
1730
1729
}
Original file line number Diff line number Diff line change 1
1
// RUN: %clang_cc1 -fsyntax-only -Wunused-variable -Wunused-label -Wno-c++1y-extensions -verify %s
2
- // RUN: %clang_cc1 -fsyntax-only -Wunused-variable -Wunused-label -Wno-c++1y-extensions -verify -std=c++11 %s
3
2
template <typename T> void f () {
4
3
T t;
5
4
t = 17 ;
@@ -195,35 +194,3 @@ void test() {
195
194
}
196
195
197
196
}
198
-
199
- #if __cplusplus >= 201103L
200
- namespace with_constexpr {
201
- template <typename T>
202
- struct Literal {
203
- T i;
204
- Literal () = default ;
205
- constexpr Literal (T i) : i(i) {}
206
- };
207
-
208
- struct NoLiteral {
209
- int i;
210
- NoLiteral () = default ;
211
- constexpr NoLiteral (int i) : i(i) {}
212
- ~NoLiteral () {}
213
- };
214
-
215
- static Literal<int > gl1; // expected-warning {{unused variable 'gl1'}}
216
- static Literal<int > gl2 (1 ); // expected-warning {{unused variable 'gl2'}}
217
- static const Literal<int > gl3 (0 ); // expected-warning {{unused variable 'gl3'}}
218
-
219
- template <typename T>
220
- void test (int i) {
221
- Literal<int > l1; // expected-warning {{unused variable 'l1'}}
222
- Literal<int > l2 (42 ); // expected-warning {{unused variable 'l2'}}
223
- Literal<int > l3 (i); // no-warning
224
- Literal<T> l4 (0 ); // no-warning
225
- NoLiteral nl1; // no-warning
226
- NoLiteral nl2 (42 ); // no-warning
227
- }
228
- }
229
- #endif
You can’t perform that action at this time.
0 commit comments