Argyrios Kyrtzidis | 1b2ad2f | 2010-09-19 23:03:35 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -Wunused-variable -verify %s |
Douglas Gregor | b5352cf | 2009-10-08 21:35:42 +0000 | [diff] [blame] | 2 | template<typename T> void f() { |
Douglas Gregor | 4dffad6 | 2010-02-11 22:55:30 +0000 | [diff] [blame] | 3 | T t; |
4 | t = 17; | ||||
Douglas Gregor | b5352cf | 2009-10-08 21:35:42 +0000 | [diff] [blame] | 5 | } |
Anders Carlsson | f7613d5 | 2009-11-07 07:26:56 +0000 | [diff] [blame] | 6 | |
Anders Carlsson | 6a8b7f3 | 2009-11-07 08:24:59 +0000 | [diff] [blame] | 7 | // PR5407 |
Anders Carlsson | f7613d5 | 2009-11-07 07:26:56 +0000 | [diff] [blame] | 8 | struct A { A(); }; |
9 | struct B { ~B(); }; | ||||
Anders Carlsson | f7613d5 | 2009-11-07 07:26:56 +0000 | [diff] [blame] | 10 | void f() { |
11 | A a; | ||||
12 | B b; | ||||
Anders Carlsson | 6a8b7f3 | 2009-11-07 08:24:59 +0000 | [diff] [blame] | 13 | } |
Anders Carlsson | 58beed9 | 2009-11-17 17:11:23 +0000 | [diff] [blame] | 14 | |
15 | // PR5531 | ||||
16 | namespace 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 Gregor | ed8abf1 | 2010-07-08 06:14:04 +0000 | [diff] [blame] | 29 | A(); |
Anders Carlsson | 58beed9 | 2009-11-17 17:11:23 +0000 | [diff] [blame] | 30 | B(17); |
31 | C(); | ||||
32 | } | ||||
33 | } | ||||
Nuno Lopes | cb1c77f | 2009-12-24 00:28:18 +0000 | [diff] [blame] | 34 | |
Douglas Gregor | 4dffad6 | 2010-02-11 22:55:30 +0000 | [diff] [blame] | 35 | template<typename T> |
36 | struct X0 { }; | ||||
37 | |||||
38 | template<typename T> | ||||
39 | void test_dependent_init(T *p) { | ||||
40 | X0<int> i(p); | ||||
41 | (void)i; | ||||
42 | } | ||||
Douglas Gregor | a6a292b | 2010-04-27 16:20:13 +0000 | [diff] [blame] | 43 | |
44 | namespace 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 Gregor | 268f89e | 2010-11-09 14:57:47 +0000 | [diff] [blame] | 51 | |
52 | void unused_local_static() { | ||||
53 | static int x = 0; | ||||
54 | static int y = 0; // expected-warning{{unused variable 'y'}} | ||||
55 | #pragma unused(x) | ||||
56 | } |