diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8a4082941d9..336c22e808c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2011-03-16 Jason Merrill + + PR c++/48115 + * call.c (convert_arg_to_ellipsis): Handle incomplete type. + 2011-03-16 Jason Merrill * parser.c (cp_parser_abort_tentative_parse): Make sure we haven't diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 388f46cdf49..f75c2485e31 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -5671,6 +5671,10 @@ convert_arg_to_ellipsis (tree arg) arg_type = TREE_TYPE (arg); if (arg != error_mark_node + /* In a template (or ill-formed code), we can have an incomplete type + even after require_complete_type, in which case we don't know + whether it has trivial copy or not. */ + && COMPLETE_TYPE_P (arg_type) && (type_has_nontrivial_copy_init (arg_type) || TYPE_HAS_NONTRIVIAL_DESTRUCTOR (arg_type))) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 72f30d8215a..ca82c7409c7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2011-03-16 Jason Merrill + + * g++.dg/template/incomplete6.C: New. + 2011-03-16 Jeff Law * gcc.dg/tree-ssa/vrp55.c: New test. diff --git a/gcc/testsuite/g++.dg/template/incomplete6.C b/gcc/testsuite/g++.dg/template/incomplete6.C new file mode 100644 index 00000000000..7138b6a3b41 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/incomplete6.C @@ -0,0 +1,22 @@ +// PR c++/48115 + +template struct templ { }; + +template T declval(); + +typedef int (*F2)(...); + +template struct Int { }; + +template +struct S +{ + template + Int()(T()) )> + f(A); +}; + +int main() +{ + S >().f(0); +}