2010-02-12 06:55:30 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -Wunused-variable -verify %s
|
2009-10-09 05:35:42 +08:00
|
|
|
template<typename T> void f() {
|
2010-02-12 06:55:30 +08:00
|
|
|
T t;
|
|
|
|
t = 17;
|
2009-10-09 05:35:42 +08:00
|
|
|
}
|
2009-11-07 15:26:56 +08:00
|
|
|
|
2009-11-07 16:24:59 +08:00
|
|
|
// PR5407
|
2009-11-07 15:26:56 +08:00
|
|
|
struct A { A(); };
|
|
|
|
struct B { ~B(); };
|
|
|
|
void f() {
|
|
|
|
A a;
|
|
|
|
B b;
|
2009-11-07 16:24:59 +08:00
|
|
|
}
|
2009-11-18 01:11:23 +08:00
|
|
|
|
|
|
|
// PR5531
|
|
|
|
namespace PR5531 {
|
|
|
|
struct A {
|
|
|
|
};
|
|
|
|
|
|
|
|
struct B {
|
|
|
|
B(int);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct C {
|
|
|
|
~C();
|
|
|
|
};
|
|
|
|
|
|
|
|
void test() {
|
2010-02-12 06:55:30 +08:00
|
|
|
A(); // expected-warning{{expression result unused}}
|
2009-11-18 01:11:23 +08:00
|
|
|
B(17);
|
|
|
|
C();
|
|
|
|
}
|
|
|
|
}
|
2009-12-24 08:28:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
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}}
|
|
|
|
}
|
2010-02-12 06:55:30 +08:00
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
struct X0 { };
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
void test_dependent_init(T *p) {
|
|
|
|
X0<int> i(p);
|
|
|
|
(void)i;
|
|
|
|
}
|