blob: 81f22a796a0e64c6a8daf27df8766934f0be3602 [file] [log] [blame]
Argyrios Kyrtzidis1b2ad2f2010-09-19 23:03:35 +00001// RUN: %clang_cc1 -fsyntax-only -Wunused-variable -verify %s
Douglas Gregorb5352cf2009-10-08 21:35:42 +00002template<typename T> void f() {
Douglas Gregor4dffad62010-02-11 22:55:30 +00003 T t;
4 t = 17;
Douglas Gregorb5352cf2009-10-08 21:35:42 +00005}
Anders Carlssonf7613d52009-11-07 07:26:56 +00006
Anders Carlsson6a8b7f32009-11-07 08:24:59 +00007// PR5407
Anders Carlssonf7613d52009-11-07 07:26:56 +00008struct A { A(); };
9struct B { ~B(); };
Anders Carlssonf7613d52009-11-07 07:26:56 +000010void f() {
11 A a;
12 B b;
Anders Carlsson6a8b7f32009-11-07 08:24:59 +000013}
Anders Carlsson58beed92009-11-17 17:11:23 +000014
15// PR5531
16namespace PR5531 {
17 struct A {
18 };
19
20 struct B {
21 B(int);
22 };
23
24 struct C {
25 ~C();
26 };
27
28 void test() {
Douglas Gregored8abf12010-07-08 06:14:04 +000029 A();
Anders Carlsson58beed92009-11-17 17:11:23 +000030 B(17);
31 C();
32 }
33}
Nuno Lopescb1c77f2009-12-24 00:28:18 +000034
Douglas Gregor4dffad62010-02-11 22:55:30 +000035template<typename T>
36struct X0 { };
37
38template<typename T>
39void test_dependent_init(T *p) {
40 X0<int> i(p);
41 (void)i;
42}
Douglas Gregora6a292b2010-04-27 16:20:13 +000043
44namespace PR6948 {
45 template<typename T> class X;
46
47 void f() {
48 X<char> str (read_from_file()); // expected-error{{use of undeclared identifier 'read_from_file'}}
49 }
50}
Douglas Gregor268f89e2010-11-09 14:57:47 +000051
52void unused_local_static() {
53 static int x = 0;
54 static int y = 0; // expected-warning{{unused variable 'y'}}
55#pragma unused(x)
56}