2010-06-30 00:52:24 +08:00
|
|
|
// RUN: %clang_cc1 %s -fsyntax-only -verify -fblocks -Wunreachable-code -Wno-unused-value
|
2010-01-21 23:20:48 +08:00
|
|
|
|
2010-01-22 01:21:23 +08:00
|
|
|
int &halt() __attribute__((noreturn));
|
|
|
|
int &live();
|
2010-01-21 23:20:48 +08:00
|
|
|
int dead();
|
|
|
|
int liveti() throw(int);
|
|
|
|
int (*livetip)() throw(int);
|
|
|
|
|
|
|
|
int test1() {
|
|
|
|
try {
|
|
|
|
live();
|
|
|
|
} catch (int i) {
|
|
|
|
live();
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void test2() {
|
|
|
|
try {
|
|
|
|
live();
|
|
|
|
} catch (int i) {
|
|
|
|
live();
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
liveti();
|
|
|
|
} catch (int i) {
|
|
|
|
live();
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
livetip();
|
|
|
|
} catch (int i) {
|
|
|
|
live();
|
|
|
|
}
|
|
|
|
throw 1;
|
|
|
|
dead(); // expected-warning {{will never be executed}}
|
|
|
|
}
|
2010-01-22 01:21:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
void test3() {
|
|
|
|
halt()
|
|
|
|
--; // expected-warning {{will never be executed}}
|
2010-01-22 03:44:04 +08:00
|
|
|
halt()
|
2010-01-22 06:12:18 +08:00
|
|
|
? // expected-warning {{will never be executed}}
|
2010-01-22 03:44:04 +08:00
|
|
|
dead() : dead();
|
2010-01-22 06:12:18 +08:00
|
|
|
live(),
|
|
|
|
float // expected-warning {{will never be executed}}
|
|
|
|
(halt());
|
2010-01-22 01:21:23 +08:00
|
|
|
}
|
2010-01-22 07:15:53 +08:00
|
|
|
|
|
|
|
void test4() {
|
|
|
|
struct S {
|
|
|
|
int mem;
|
|
|
|
} s;
|
|
|
|
S &foor();
|
2010-02-24 10:19:28 +08:00
|
|
|
halt(), foor()// expected-warning {{will never be executed}}
|
|
|
|
.mem;
|
2010-01-22 07:15:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void test5() {
|
|
|
|
struct S {
|
|
|
|
int mem;
|
|
|
|
} s;
|
|
|
|
S &foor() __attribute__((noreturn));
|
|
|
|
foor()
|
|
|
|
.mem; // expected-warning {{will never be executed}}
|
|
|
|
}
|
|
|
|
|
|
|
|
void test6() {
|
|
|
|
struct S {
|
|
|
|
~S() { }
|
|
|
|
S(int i) { }
|
|
|
|
};
|
|
|
|
live(),
|
|
|
|
S // expected-warning {{will never be executed}}
|
|
|
|
(halt());
|
|
|
|
}
|