blob: 6992cdcd0902a73299de5f4f005d3c4d152eef44 [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
35
36struct X {
37 int foo() __attribute__((warn_unused_result));
38};
39
40void bah() {
41 X x, *x2;
42 x.foo(); // expected-warning {{ignoring return value of function declared with warn_unused_result attribute}}
43 x2->foo(); // expected-warning {{ignoring return value of function declared with warn_unused_result attribute}}
44}
Douglas Gregor4dffad62010-02-11 22:55:30 +000045
46template<typename T>
47struct X0 { };
48
49template<typename T>
50void test_dependent_init(T *p) {
51 X0<int> i(p);
52 (void)i;
53}
Douglas Gregora6a292b2010-04-27 16:20:13 +000054
55namespace PR6948 {
56 template<typename T> class X;
57
58 void f() {
59 X<char> str (read_from_file()); // expected-error{{use of undeclared identifier 'read_from_file'}}
60 }
61}