Comments
Patch
@@ -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);
new file mode 100644
@@ -0,0 +1,6 @@
+// PR c++/48569
+
+int main()
+{
+ void();
+}
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. 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.