blob: 8ae7d6ace4daa737154d9098b8f9d533376b94e5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
// RUN: %clang_cc1 -fsyntax-only -Wunused-variable -verify %s
template<typename T> void f() {
T t;
t = 17;
}
// PR5407
struct A { A(); };
struct B { ~B(); };
void f() {
A a;
B b;
}
// PR5531
namespace PR5531 {
struct A {
};
struct B {
B(int);
};
struct C {
~C();
};
void test() {
A();
B(17);
C();
}
}
struct X {
int foo() __attribute__((warn_unused_result));
};
void bah() {
X x, *x2;
x.foo(); // expected-warning {{ignoring return value of function declared with warn_unused_result attribute}}
x2->foo(); // expected-warning {{ignoring return value of function declared with warn_unused_result attribute}}
}
template<typename T>
struct X0 { };
template<typename T>
void test_dependent_init(T *p) {
X0<int> i(p);
(void)i;
}
namespace PR6948 {
template<typename T> class X;
void f() {
X<char> str (read_from_file()); // expected-error{{use of undeclared identifier 'read_from_file'}}
}
}
void unused_local_static() {
static int x = 0;
static int y = 0; // expected-warning{{unused variable 'y'}}
#pragma unused(x)
}
|