Fix PR3766, a really nasty silent miscompilation case where we emitted
a warning and then threw away the AST.  While I'm in there, tighten up the
code to actually reject completely bogus cases (sending a message to a 
struct).  We still allow sending a message to an int, which doesn't make
sense but GCC allows it and is easy to support.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66468 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaObjC/message.m b/test/SemaObjC/message.m
index f961e35..a232f5c 100644
--- a/test/SemaObjC/message.m
+++ b/test/SemaObjC/message.m
@@ -75,3 +75,16 @@
     return 0;
 }
 
+
+// PR3766
+struct S { int X; } S;
+
+int test5(int X) {
+  int a = [X somemsg];  // expected-warning {{bad receiver type 'int'}} \
+                           expected-warning {{method '-somemsg' not found}} \
+                           expected-warning {{incompatible pointer to integer conversion initializing 'id', expected 'int'}}
+  int b = [S somemsg];  // expected-error {{bad receiver type 'struct S'}}
+}
+
+
+