Message ID | 4DACCF87.6060107@redhat.com |
---|---|
State | New |
Headers | show |
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(); +}