2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
2012-05-24 08:47:05 +08:00
|
|
|
|
2009-04-30 00:35:53 +08:00
|
|
|
// PR4103 : Make sure we don't get a bogus unused expression warning
|
2012-05-24 08:47:05 +08:00
|
|
|
namespace PR4103 {
|
|
|
|
class APInt {
|
|
|
|
char foo;
|
|
|
|
};
|
|
|
|
class APSInt : public APInt {
|
|
|
|
char bar;
|
|
|
|
public:
|
|
|
|
APSInt &operator=(const APSInt &RHS);
|
|
|
|
};
|
2009-04-30 00:35:53 +08:00
|
|
|
|
2012-05-24 08:47:05 +08:00
|
|
|
APSInt& APSInt::operator=(const APSInt &RHS) {
|
|
|
|
APInt::operator=(RHS);
|
|
|
|
return *this;
|
|
|
|
}
|
2010-01-17 02:17:21 +08:00
|
|
|
|
2012-05-24 08:47:05 +08:00
|
|
|
template<typename T>
|
|
|
|
struct X {
|
|
|
|
X();
|
|
|
|
};
|
|
|
|
|
|
|
|
void test() {
|
|
|
|
X<int>();
|
|
|
|
}
|
|
|
|
}
|
2010-01-17 02:17:21 +08:00
|
|
|
|
2012-05-24 08:47:05 +08:00
|
|
|
namespace derefvolatile {
|
|
|
|
void f(volatile char* x) {
|
|
|
|
*x; // expected-warning {{expression result unused; assign into a variable to force a volatile load}}
|
|
|
|
(void)*x; // expected-warning {{expression result unused; assign into a variable to force a volatile load}}
|
2012-05-25 05:05:41 +08:00
|
|
|
volatile char y = 10;
|
|
|
|
(void)y; // don't warn here, because it's a common pattern.
|
2012-05-24 08:47:05 +08:00
|
|
|
}
|
2010-01-17 02:17:21 +08:00
|
|
|
}
|