From: Nathan Sidwell Date: Tue, 23 Jan 2001 10:44:18 +0000 (+0000) Subject: decl.c (grokdeclarator): Don't presume DECL_LANG_SPECIFIC indicates anything special... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=92ecdfb74c6b4c1e1812afcc9a7aa79217da11ad;p=gcc.git decl.c (grokdeclarator): Don't presume DECL_LANG_SPECIFIC indicates anything special about template depth. cp: * decl.c (grokdeclarator): Don't presume DECL_LANG_SPECIFIC indicates anything special about template depth. Make sure we only count the user visible template classes. testsuite: * g++.old-deja/g++.pt/spec37.C: New test. From-SVN: r39198 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f5b46ff6400..166d0c1c573 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2001-01-23 Nathan Sidwell + + * decl.c (grokdeclarator): Don't presume DECL_LANG_SPECIFIC + indicates anything special about template depth. Make sure we + only count the user visible template classes. + 2001-01-23 Nathan Sidwell * call.c (build_conv): Typo in comment. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 158407ccf3a..6fcf9c4d2c2 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -10807,14 +10807,12 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) the definition of `S::f'. */ if (CLASSTYPE_TEMPLATE_INFO (t) && (CLASSTYPE_TEMPLATE_INSTANTIATION (t) - || uses_template_parms (CLASSTYPE_TI_ARGS (t)))) + || uses_template_parms (CLASSTYPE_TI_ARGS (t))) + && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (t))) template_count += 1; t = TYPE_MAIN_DECL (t); - if (DECL_LANG_SPECIFIC (t)) - t = DECL_CONTEXT (t); - else - t = NULL_TREE; + t = DECL_CONTEXT (t); } if (sname == NULL_TREE) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 31f25fb58c5..649f327a497 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2001-01-23 Nathan Sidwell + + * g++.old-deja/g++.pt/spec37.C: New test. + 2001-01-23 Nathan Sidwell * g++.old-deja/g++.pt/overload14.C: New test. diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec37.C b/gcc/testsuite/g++.old-deja/g++.pt/spec37.C new file mode 100644 index 00000000000..5578c30ef0c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/spec37.C @@ -0,0 +1,25 @@ +// Build don't link: +// +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 21 Jan 2001 + +// Bug 1728. We started sorting things when there were 7 fields. Our +// template_count algorithm was rather fragile ... + +template struct X +{ + struct Y + { + int x1; + int x2; + int x3; + int x4; + int x5; + int x6; + int x7; + + void Foo (); + }; +}; + +template <> void X<1>::Y::Foo () {}