blob: 5620248f5005f9fe82b18cac0e0a560141f8aed3 [file] [log] [blame]
Daniel Dunbar80737ad2009-12-15 22:01:24 +00001// RUN: %clang -fsyntax-only -Wunused-variable -verify %s
Douglas Gregorb5352cf2009-10-08 21:35:42 +00002
3template<typename T> void f() {
4 T t;
5 t = 17;
6}
Anders Carlssonf7613d52009-11-07 07:26:56 +00007
Anders Carlsson6a8b7f32009-11-07 08:24:59 +00008// PR5407
Anders Carlssonf7613d52009-11-07 07:26:56 +00009struct A { A(); };
10struct B { ~B(); };
Anders Carlssonf7613d52009-11-07 07:26:56 +000011void f() {
12 A a;
13 B b;
Anders Carlsson6a8b7f32009-11-07 08:24:59 +000014}
Anders Carlsson58beed92009-11-17 17:11:23 +000015
16// PR5531
17namespace PR5531 {
18 struct A {
19 };
20
21 struct B {
22 B(int);
23 };
24
25 struct C {
26 ~C();
27 };
28
29 void test() {
30 A();
31 B(17);
32 C();
33 }
34}
Nuno Lopescb1c77f2009-12-24 00:28:18 +000035
36
37struct X {
38 int foo() __attribute__((warn_unused_result));
39};
40
41void bah() {
42 X x, *x2;
43 x.foo(); // expected-warning {{ignoring return value of function declared with warn_unused_result attribute}}
44 x2->foo(); // expected-warning {{ignoring return value of function declared with warn_unused_result attribute}}
45}