From: Jason Merrill Date: Thu, 17 Nov 2016 21:40:48 +0000 (-0500) Subject: PR c++/78369 - {} as default argument X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=07a67f7b09745a86d8890f09b7d1260da6f41103;p=gcc.git PR c++/78369 - {} as default argument * call.c (build_special_member_call): Handle CONSTRUCTOR. From-SVN: r242562 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5775ba64ac4..50d0ae21aad 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2016-11-17 Jason Merrill + PR c++/78369 - {} as default argument + * call.c (build_special_member_call): Handle CONSTRUCTOR. + PR c++/68377 * parser.c (cp_parser_fold_expression): Check TREE_NO_WARNING. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index f6f45905162..d25e2e79f0b 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -8317,7 +8317,8 @@ build_special_member_call (tree instance, tree name, vec **args, if (!reference_related_p (class_type, TREE_TYPE (arg))) arg = perform_implicit_conversion_flags (class_type, arg, tf_warning, flags); - if (TREE_CODE (arg) == TARGET_EXPR + if ((TREE_CODE (arg) == TARGET_EXPR + || TREE_CODE (arg) == CONSTRUCTOR) && (same_type_ignoring_top_level_qualifiers_p (class_type, TREE_TYPE (arg)))) { diff --git a/gcc/testsuite/g++.dg/overload/defarg11.C b/gcc/testsuite/g++.dg/overload/defarg11.C new file mode 100644 index 00000000000..26fac6ebe12 --- /dev/null +++ b/gcc/testsuite/g++.dg/overload/defarg11.C @@ -0,0 +1,11 @@ +// PR c++/78369 +// { dg-do compile { target c++11 } } + +struct A { }; +inline void f(struct A a = {}) {} + +int main() +{ + f(); + return 0; +}