diff options
author | Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> | 2003-10-18 17:35:47 +0000 |
---|---|---|
committer | Kriang Lerdsuwanakij <lerdsuwa@gcc.gnu.org> | 2003-10-18 17:35:47 +0000 |
commit | 5f04800c283cf84eb51c7f641b5a57aee35a21e5 (patch) | |
tree | e0d0d5427e19b9b6f74ebbf6a9d080c7173eebcb /gcc/cp/pt.c | |
parent | 3a198a72d26f430283d2906181315eb9ed622f8a (diff) | |
download | gcc-5f04800c283cf84eb51c7f641b5a57aee35a21e5.zip gcc-5f04800c283cf84eb51c7f641b5a57aee35a21e5.tar.gz gcc-5f04800c283cf84eb51c7f641b5a57aee35a21e5.tar.bz2 |
re PR c++/12495 (ICE in cp/typeck.c:907)
PR c++/12495
* pt.c (lookup_template_class): Handle when current_class_type
is a local class.
* g++.dg/template/crash21.C: New test.
From-SVN: r72643
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r-- | gcc/cp/pt.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index ffc347c..32b146f 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -4163,14 +4163,12 @@ lookup_template_class (tree d1, tree ctx; for (ctx = current_class_type; - ctx; - ctx = TYPE_CONTEXT (ctx)) - { - if (TREE_CODE (ctx) == NAMESPACE_DECL) - break; - if (same_type_p (ctx, template_type)) - goto found_ctx; - } + ctx && TREE_CODE (ctx) != NAMESPACE_DECL; + ctx = (TYPE_P (ctx) + ? TYPE_CONTEXT (ctx) + : DECL_CONTEXT (ctx))) + if (TYPE_P (ctx) && same_type_p (ctx, template_type)) + goto found_ctx; /* We're not in the scope of the class, so the TEMPLATE_TYPE is not the type we want after all. */ |