This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++] sanity check PATCH to instantiate_class_template
- From: Jason Merrill <jason at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 09 Oct 2003 01:23:27 -0400
- Subject: [C++] sanity check PATCH to instantiate_class_template
This has been sitting in my tree for months; on the 3.3 branch we were
trying to instantiate a nested class before its enclosing class, which
broke. For 3.3 it was easier to make that case DTRT, but it should never
happen with the more correct handling of typename on the trunk. So I added
this assert to make sure it doesn't happen.
Tested x86_64-pc-linux-gnu, applied to trunk.
2003-10-09 Jason Merrill <jason@redhat.com>
* pt.c (instantiate_class_template): Sanity check that our
enclosing class has been instantiated.
*** pt.c.~1~ 2003-09-25 17:21:53.000000000 -0400
--- pt.c 2003-10-02 13:46:50.000000000 -0400
*************** instantiate_class_template (tree type)
*** 5182,5188 ****
SET_ANON_AGGR_TYPE_P (type);
pbinfo = TYPE_BINFO (pattern);
!
if (BINFO_BASETYPES (pbinfo))
{
tree base_list = NULL_TREE;
--- 5182,5199 ----
SET_ANON_AGGR_TYPE_P (type);
pbinfo = TYPE_BINFO (pattern);
!
! #ifdef ENABLE_CHECKING
! if (DECL_CLASS_SCOPE_P (TYPE_MAIN_DECL (pattern))
! && ! COMPLETE_TYPE_P (TYPE_CONTEXT (type))
! && ! TYPE_BEING_DEFINED (TYPE_CONTEXT (type)))
! /* We should never instantiate a nested class before its enclosing
! class; we need to look up the nested class by name before we can
! instantiate it, and that lookup should instantiate the enclosing
! class. */
! abort ();
! #endif
!
if (BINFO_BASETYPES (pbinfo))
{
tree base_list = NULL_TREE;