2011-03-24 22:35:16 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify -Wall -fblocks %s
|
2011-03-17 01:05:57 +08:00
|
|
|
|
2011-03-15 05:19:51 +08:00
|
|
|
// PR9463
|
|
|
|
double *end;
|
2011-03-24 05:19:43 +08:00
|
|
|
void f(bool b1, bool b2) {
|
2011-03-15 05:19:51 +08:00
|
|
|
{
|
2011-03-24 05:19:43 +08:00
|
|
|
do {
|
|
|
|
int end = 0;
|
|
|
|
if (b2) {
|
|
|
|
do {
|
|
|
|
goto end;
|
|
|
|
} while (b2);
|
|
|
|
}
|
|
|
|
end = 1;
|
|
|
|
} while (b1);
|
2011-03-15 05:19:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
end:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-03-24 18:35:39 +08:00
|
|
|
namespace N {
|
|
|
|
float* end;
|
|
|
|
void f(bool b1, bool b2) {
|
|
|
|
{
|
|
|
|
do {
|
|
|
|
int end = 0;
|
|
|
|
if (b2) {
|
|
|
|
do {
|
|
|
|
goto end;
|
|
|
|
} while (b2);
|
|
|
|
}
|
|
|
|
end = 1;
|
|
|
|
} while (b1);
|
|
|
|
}
|
|
|
|
|
|
|
|
end:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-15 05:19:51 +08:00
|
|
|
void g() {
|
|
|
|
end = 1; // expected-error{{assigning to 'double *' from incompatible type 'int'}}
|
|
|
|
}
|
2011-03-17 00:39:03 +08:00
|
|
|
|
|
|
|
void h(int end) {
|
|
|
|
{
|
|
|
|
goto end; // expected-error{{use of undeclared label 'end'}}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void h2(int end) {
|
|
|
|
{
|
|
|
|
__label__ end;
|
|
|
|
goto end;
|
|
|
|
|
|
|
|
end:
|
|
|
|
::end = 0;
|
|
|
|
}
|
2011-03-24 22:35:16 +08:00
|
|
|
end: // expected-warning{{unused label 'end'}}
|
2011-03-17 00:39:03 +08:00
|
|
|
end = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
class X {
|
|
|
|
public:
|
|
|
|
X();
|
|
|
|
};
|
|
|
|
|
|
|
|
void rdar9135994()
|
|
|
|
{
|
|
|
|
X:
|
|
|
|
goto X;
|
|
|
|
}
|
2011-03-17 01:05:57 +08:00
|
|
|
|
|
|
|
namespace PR9495 {
|
|
|
|
struct NonPOD { NonPOD(); ~NonPOD(); };
|
|
|
|
|
|
|
|
void f(bool b) {
|
|
|
|
NonPOD np;
|
|
|
|
if (b) {
|
|
|
|
goto undeclared; // expected-error{{use of undeclared label 'undeclared'}}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void g() {
|
|
|
|
(void)^(bool b){
|
|
|
|
NonPOD np;
|
|
|
|
if (b) {
|
|
|
|
goto undeclared; // expected-error{{use of undeclared label 'undeclared'}}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-24 22:35:16 +08:00
|
|
|
extern "C" {
|
|
|
|
void exit(int);
|
|
|
|
}
|
2011-03-17 01:05:57 +08:00
|
|
|
|
2011-03-24 22:35:16 +08:00
|
|
|
void f() {
|
|
|
|
{
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
exit:
|
|
|
|
return;
|
|
|
|
}
|