Warn when using PROXY_TO_PTHREAD without a main()
diff --git a/emscripten.py b/emscripten.py
index 6b6eb7d..23d3a5c 100644
--- a/emscripten.py
+++ b/emscripten.py
@@ -200,6 +200,9 @@
     # In this mode we never expect _main in the export list.
     return
 
+  if shared.Settings.PROXY_TO_PTHREAD and '_main' not in all_implemented:
+    diagnostics.warning('emcc', 'PROXY_TO_PTHREAD proxies main(), and has no effect when main() does not exist')
+
   if shared.Settings.IGNORE_MISSING_MAIN:
     # The default mode for emscripten is to ignore the missing main function allowing
     # maximum compatibility.
diff --git a/tests/test_other.py b/tests/test_other.py
index c529c70..90f9f11 100644
--- a/tests/test_other.py
+++ b/tests/test_other.py
@@ -10256,3 +10256,12 @@
     self.assertExists('hello.wasm')
     self.assertExists('hello_.wasm')
     self.assertContained('hello, world!', self.run_js('hello.wasm'))
+
+  def test_no_main_with_PROXY_TO_PTHREAD(self):
+    create_file('lib.cpp', r'''
+#include <emscripten.h>
+EMSCRIPTEN_KEEPALIVE
+void foo() {}
+''')
+    err = self.run_process([EMCC, 'lib.cpp', '-pthread', '-sPROXY_TO_PTHREAD'], stderr=PIPE).stderr
+    self.assertContained('emcc: warning: PROXY_TO_PTHREAD proxies main(), and has no effect when main() does not exist', err)