diff options
author | Jason Merrill <jason@redhat.com> | 2008-01-22 10:59:57 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2008-01-22 10:59:57 -0500 |
commit | d4175b9f4b99726ca4e218d99debcc0ba25a4233 (patch) | |
tree | 386029ee929072b8b380aa94f5c8e282c722fcc8 | |
parent | dab3cc758a1319c64736da0a04fdf4bd74f2498e (diff) | |
download | gcc-d4175b9f4b99726ca4e218d99debcc0ba25a4233.tar.gz |
re PR c++/33959 (ICE in instantiate_class_template, at cp/pt.c:6649)
PR c++/33959
* pt.c (tsubst_aggr_type): Make sure our context is complete.
From-SVN: r131725
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/pt.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/nested5.C | 19 |
3 files changed, 31 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 675aca54e27..7d02bb5b1e6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2008-01-21 Jason Merrill <jason@redhat.com> + + PR c++/33959 + * pt.c (tsubst_aggr_type): Make sure our context is complete. + 2008-01-02 Volker Reichelt <reichelt@netcologne.de> Backport: diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index a837ba2076d..9a6f2fc9cc6 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -6325,8 +6325,13 @@ tsubst_aggr_type (tree t, up. */ context = TYPE_CONTEXT (t); if (context) - context = tsubst_aggr_type (context, args, complain, - in_decl, /*entering_scope=*/1); + { + context = tsubst_aggr_type (context, args, complain, + in_decl, /*entering_scope=*/1); + /* If context is a nested class inside a class template, + it may still need to be instantiated (c++/33959). */ + complete_type (context); + } /* Then, figure out what arguments are appropriate for the type we are trying to find. For example, given: diff --git a/gcc/testsuite/g++.dg/template/nested5.C b/gcc/testsuite/g++.dg/template/nested5.C new file mode 100644 index 00000000000..3850fdace3a --- /dev/null +++ b/gcc/testsuite/g++.dg/template/nested5.C @@ -0,0 +1,19 @@ +// PR c++/33959 + +template <typename T> struct A +{ + struct C + { + template <typename U> struct D {}; + }; + template <typename S> static C::D<S> bar (S const &); +}; + +struct E {}; + +int +main () +{ + E e; + A<E>::bar (e); +} |