| 1 |
// PR middle-end/51647 |
| 2 |
// { dg-do compile } |
| 3 |
// { dg-options "-Wall" } |
| 4 |
|
| 5 |
enum PropertyAttributes { NONE = 1 }; |
| 6 |
enum PropertyType { NORMAL = 0, FIELD = 1 }; |
| 7 |
class LookupResult; |
| 8 |
|
| 9 |
template <typename T> |
| 10 |
struct Handle |
| 11 |
{ |
| 12 |
inline explicit Handle (T *obj) __attribute__ ((always_inline)) {} |
| 13 |
inline T *operator-> () const __attribute__ ((always_inline)) { return 0; } |
| 14 |
}; |
| 15 |
|
| 16 |
struct JSObject |
| 17 |
{ |
| 18 |
bool IsGlobalObject () { return false; } |
| 19 |
}; |
| 20 |
|
| 21 |
struct Isolate |
| 22 |
{ |
| 23 |
LookupResult *top_lookup_result () { return 0; } |
| 24 |
}; |
| 25 |
|
| 26 |
struct LookupResult |
| 27 |
{ |
| 28 |
explicit LookupResult (Isolate *isolate) {} |
| 29 |
JSObject *holder () { return 0; } |
| 30 |
PropertyType type () { return NORMAL; } |
| 31 |
}; |
| 32 |
|
| 33 |
int |
| 34 |
test (LookupResult *lookup) |
| 35 |
{ |
| 36 |
Handle <JSObject> holder (lookup->holder ()); |
| 37 |
switch (lookup->type ()) |
| 38 |
{ |
| 39 |
case NORMAL: |
| 40 |
if (holder->IsGlobalObject ()) |
| 41 |
return 2; |
| 42 |
else |
| 43 |
return 3; |
| 44 |
break; |
| 45 |
default: |
| 46 |
return 4; |
| 47 |
} |
| 48 |
} // { dg-bogus "control reaches end of non-void function" } |