diff options
author | Mark Mitchell <mark@codesourcery.com> | 2005-05-29 00:16:05 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2005-05-29 00:16:05 +0000 |
commit | 64b2bdb353f2c0550f7deeec7abff967b18fa6d2 (patch) | |
tree | 33ff78e64cfd8923493efdc5cccd2b88af4a72ed | |
parent | fd44f634fde1fee21b4ff2a77173d44184afe33b (diff) | |
download | gcc-64b2bdb353f2c0550f7deeec7abff967b18fa6d2.zip gcc-64b2bdb353f2c0550f7deeec7abff967b18fa6d2.tar.gz gcc-64b2bdb353f2c0550f7deeec7abff967b18fa6d2.tar.bz2 |
re PR c++/21340 (error in constructor lookup (can't find constructor with "const void**" argument))
PR c++/21340
* method.c (implicitly_declare_fn): Clear processing_template_decl
when generating implicit declaration.
PR c++/21340
* g++.dg/init/ctor6.C: New test.
From-SVN: r100306
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/method.c | 16 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/init/ctor6.C | 20 |
4 files changed, 47 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 24dc958..59af6b1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2005-05-28 Mark Mitchell <mark@codesourcery.com> + + PR c++/21340 + * method.c (implicitly_declare_fn): Clear processing_template_decl + when generating implicit declaration. + 2005-05-27 Mark Mitchell <mark@codesourcery.com> PR c++/21614 diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 37822be..843f414 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -968,6 +968,19 @@ implicitly_declare_fn (special_function_kind kind, tree type, bool const_p) tree raises = empty_except_spec; tree rhs_parm_type = NULL_TREE; tree name; + HOST_WIDE_INT saved_processing_template_decl; + + /* Because we create declarations for implictly declared functions + lazily, we may be creating the declaration for a member of TYPE + while in some completely different context. However, TYPE will + never be a dependent class (because we never want to do lookups + for implicitly defined functions in a dependent class). + Furthermore, we must set PROCESSING_TEMPLATE_DECL to zero here + because we only create clones for constructors and destructors + when not in a template. */ + gcc_assert (!dependent_type_p (type)); + saved_processing_template_decl = processing_template_decl; + processing_template_decl = 0; type = TYPE_MAIN_VARIANT (type); @@ -1066,6 +1079,9 @@ implicitly_declare_fn (special_function_kind kind, tree type, bool const_p) DECL_INLINE (fn) = 1; gcc_assert (!TREE_USED (fn)); + /* Restore PROCESSING_TEMPLATE_DECL. */ + processing_template_decl = saved_processing_template_decl; + return fn; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f9a5e6a..a85e6b5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-05-28 Mark Mitchell <mark@codesourcery.com> + + PR c++/21340 + * g++.dg/init/ctor6.C: New test. + 2005-05-29 Jan Hubicka <jh@suse.cz> * gcc.c-torture/compile/pr21562.c: New. diff --git a/gcc/testsuite/g++.dg/init/ctor6.C b/gcc/testsuite/g++.dg/init/ctor6.C new file mode 100644 index 0000000..a25ecab --- /dev/null +++ b/gcc/testsuite/g++.dg/init/ctor6.C @@ -0,0 +1,20 @@ +// PR c++/21340 + +struct Base{}; +struct Iterator : virtual Base {}; +bool operator==(const Iterator&, const Iterator&); +struct IteratorI : Iterator {}; +struct Obj +{ + bool operator==(const Obj&) const; +}; +template <int>bool dummy() +{ + Obj lhs, rhs; + return lhs == rhs; +} +int +main(int argc, char** argv) +{ + IteratorI* it2 = new IteratorI(); +} |