Implement conversion from a switch condition with class type to an
integral or enumeration type (vi user-defined conversions). Fixes PR5518.

llvm-svn: 89655
diff --git a/clang/test/SemaCXX/switch.cpp b/clang/test/SemaCXX/switch.cpp
index b22adb7..2f2f2a9 100644
--- a/clang/test/SemaCXX/switch.cpp
+++ b/clang/test/SemaCXX/switch.cpp
@@ -13,3 +13,23 @@
       break;
   }
 }
+
+// PR5518
+struct A { 
+  operator int(); // expected-note{{conversion to integral type}}
+};
+
+void x() { 
+  switch(A()) {
+  }
+}
+
+enum E { e1, e2 };
+struct B : A {
+  operator E() const; // expected-note{{conversion to enumeration type}}
+};
+
+void x2() {
+  switch (B()) { // expected-error{{multiple conversions}}
+  }
+}