1// PR middle-end/51647
2// { dg-do compile }
3// { dg-options "-Wall" }
4
5enum PropertyAttributes { NONE = 1 };
6enum PropertyType { NORMAL = 0, FIELD = 1 };
7class LookupResult;
8
9template <typename T>
10struct Handle
11{
12  inline explicit Handle (T *obj) __attribute__ ((always_inline)) {}
13  inline T *operator-> () const __attribute__ ((always_inline)) { return 0; }
14};
15
16struct JSObject
17{
18  bool IsGlobalObject () { return false; }
19};
20
21struct Isolate
22{
23  LookupResult *top_lookup_result () { return 0; }
24};
25
26struct LookupResult
27{
28  explicit LookupResult (Isolate *isolate) {}
29  JSObject *holder () { return 0; }
30  PropertyType type () { return NORMAL; }
31};
32
33int
34test (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" }
49