compiler: better arg type checking for selected builtins

Tighten up the argument type checking for Builtin_call_expression to
catch erroneous cases such as

   panic(panic("bad")))

where an argument void type is being passed to panic/alignof/sizeof.

Fixes golang/go#56071.

Change-Id: I25e28fad724c959e738103141fdf9885e0dd4dd5
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/439815
Reviewed-by: Cherry Mui <cherryyz@google.com>
diff --git a/go/expressions.cc b/go/expressions.cc
index 2492d9f..247ae1b 100644
--- a/go/expressions.cc
+++ b/go/expressions.cc
@@ -10316,7 +10316,12 @@
     case BUILTIN_PANIC:
     case BUILTIN_SIZEOF:
     case BUILTIN_ALIGNOF:
-      this->check_one_arg();
+      if (this->check_one_arg())
+        {
+	  Expression* arg = this->one_arg();
+	  if (arg->type()->is_void_type())
+	    this->report_error(_("argument to builtin has void type"));
+        }
       break;
 
     case BUILTIN_RECOVER: