public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* C++ PATCH for c++/48569 (ICE on void())
@ 2011-04-19  0:15 Jason Merrill
  0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2011-04-19  0:15 UTC (permalink / raw)
  To: gcc-patches List

[-- Attachment #1: Type: text/plain, Size: 175 bytes --]

Another problem caused by the switch to using build_value_init in 
build_functional_cast.  We need to handle void specifically.

Tested x86_64-pc-linux-gnu, applied to trunk.

[-- Attachment #2: 48569.patch --]
[-- Type: text/plain, Size: 1023 bytes --]

commit 43c47963012ad752079f8fd368083feea263236e
Author: Jason Merrill <jason@redhat.com>
Date:   Mon Apr 18 16:20:15 2011 -0700

    	PR c++/48569
    	* typeck2.c (build_functional_cast): Handle VOID_TYPE.

diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index f0b67f7..49f4e7e 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -1566,7 +1566,11 @@ build_functional_cast (tree exp, tree parms, tsubst_flags_t complain)
   if (! MAYBE_CLASS_TYPE_P (type))
     {
       if (parms == NULL_TREE)
-	return build_value_init (type, complain);
+	{
+	  if (VOID_TYPE_P (type))
+	    return void_zero_node;
+	  return build_value_init (type, complain);
+	}
 
       /* This must build a C cast.  */
       parms = build_x_compound_expr_from_list (parms, ELK_FUNC_CAST, complain);
diff --git a/gcc/testsuite/g++.dg/init/void1.C b/gcc/testsuite/g++.dg/init/void1.C
new file mode 100644
index 0000000..ed41a90
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/void1.C
@@ -0,0 +1,6 @@
+// PR c++/48569
+
+int main()
+{
+  void();
+}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-04-18 23:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-19  0:15 C++ PATCH for c++/48569 (ICE on void()) Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).