diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-08-19 17:24:19 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-08-19 17:24:19 +0000 |
commit | 4a41f2a15c746ddc1db8303c6bbfce061a1458ff (patch) | |
tree | 24bdaba937cbecb19a81055302bee50d7670cad1 | |
parent | d55772dfc1889d787aa5261ba216f5e8cf5e8cc4 (diff) | |
download | gcc-4a41f2a15c746ddc1db8303c6bbfce061a1458ff.tar.gz |
* call.c (reference_related_p): Check for error_mark_node.
(add_function_candidate): Check it instead of
same_type_ignoring_top_level_qualifiers_p.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163382 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/call.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/init/synth3.C | 21 |
4 files changed, 36 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index bac1182cb76..82c8299990b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2010-08-19 Jason Merrill <jason@redhat.com> + * call.c (reference_related_p): Check for error_mark_node. + (add_function_candidate): Check it instead of + same_type_ignoring_top_level_qualifiers_p. + PR c++/45315 * init.c (build_new_1): Don't use build_value_init in a template. (build_value_init): Make sure we don't. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 71297ec630a..adcf9847587 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -999,6 +999,9 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p, bool reference_related_p (tree t1, tree t2) { + if (t1 == error_mark_node || t2 == error_mark_node) + return false; + t1 = TYPE_MAIN_VARIANT (t1); t2 = TYPE_MAIN_VARIANT (t2); @@ -1598,8 +1601,10 @@ add_function_candidate (struct z_candidate **candidates, /* Kludge: When looking for a function from a subobject while generating an implicit copy/move constructor/operator=, don't consider anything - that takes (a reference to) a different type. See c++/44909. */ - else if (flags & LOOKUP_SPECULATIVE) + that takes (a reference to) an unrelated type. See c++/44909. */ + else if ((flags & LOOKUP_SPECULATIVE) + || (current_function_decl + && DECL_DEFAULTED_FN (current_function_decl))) { if (DECL_CONSTRUCTOR_P (fn)) i = 1; @@ -1611,8 +1616,8 @@ add_function_candidate (struct z_candidate **candidates, if (i && len == i) { parmnode = chain_index (i-1, parmlist); - if (!(same_type_ignoring_top_level_qualifiers_p - (non_reference (TREE_VALUE (parmnode)), ctype))) + if (!reference_related_p (non_reference (TREE_VALUE (parmnode)), + ctype)) viable = 0; } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 805cd7a8f83..e8bbfc1e3b5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,7 @@ 2010-08-19 Jason Merrill <jason@redhat.com> + * g++.dg/init/synth3.C: New. + * g++.dg/init/value8.C: New. * g++.dg/tree-ssa/empty-2.C: New. diff --git a/gcc/testsuite/g++.dg/init/synth3.C b/gcc/testsuite/g++.dg/init/synth3.C new file mode 100644 index 00000000000..d656ddb2e05 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/synth3.C @@ -0,0 +1,21 @@ +// Test that synthesizing the C copy constructor doesn't require B<int> to +// be complete. + +template <class T> +struct B +{ + typename T::NT nt; +}; + +struct A +{ + A (); + A (const A&); + A (const B<int>&); +}; + +struct C: A { }; + +C c; +C c2(c); + |