diff options
author | Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> | 2003-12-29 11:00:36 +0000 |
---|---|---|
committer | Kriang Lerdsuwanakij <lerdsuwa@gcc.gnu.org> | 2003-12-29 11:00:36 +0000 |
commit | 68deab91f26e8a5266a8bd9086bbf5129c619c03 (patch) | |
tree | cb8949882a5240d28c6cf2f770ade30360c02fd5 /gcc | |
parent | 2f9afd51aab933f9a70393023a98282698485209 (diff) | |
download | gcc-68deab91f26e8a5266a8bd9086bbf5129c619c03.zip gcc-68deab91f26e8a5266a8bd9086bbf5129c619c03.tar.gz gcc-68deab91f26e8a5266a8bd9086bbf5129c619c03.tar.bz2 |
re PR c++/13289 (ICE in regenerate_decl_from_template on recursive template)
PR c++/13289
* semantics.c (finish_id_expression): Only check if the type of
a template argument is integral or enumeration when it is not
dependent.
* g++.dg/parse/nontype1.C: New test.
From-SVN: r75200
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/parse/nontype1.C | 9 |
4 files changed, 22 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 1cceeb8..72c0f5f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,12 @@ 2003-12-29 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> + PR c++/13289 + * semantics.c (finish_id_expression): Only check if the type of + a template argument is integral or enumeration when it is not + dependent. + +2003-12-29 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> + PR c++/12403 * parser.c (cp_parser_template_declaration_after_export): Set up template specialization scope in case of explicit specialization. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index c9a4a68..4cf0261 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2400,6 +2400,7 @@ finish_id_expression (tree id_expression, if (TREE_CODE (decl) == TEMPLATE_PARM_INDEX) decl = TEMPLATE_PARM_DECL (decl); if (integral_constant_expression_p + && !dependent_type_p (TREE_TYPE (decl)) && !INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (decl))) { if (!allow_non_integral_constant_expression_p) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 14faa0d..2cccfdd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2003-12-29 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> + PR c++/13289 + * g++.dg/parse/nontype1.C: New test. + +2003-12-29 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> + PR c++/12403 * g++.dg/parse/explicit1.C: New test. * g++.old-deja/g++.pt/explicit71.C: Adjust expected error. diff --git a/gcc/testsuite/g++.dg/parse/nontype1.C b/gcc/testsuite/g++.dg/parse/nontype1.C new file mode 100644 index 0000000..e721700 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/nontype1.C @@ -0,0 +1,9 @@ +// Copyright (C) 2003 Free Software Foundation +// Contributed by Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> +// { dg-do compile } + +// PR c++/13289: Incorrectly reject non-type template argument that has +// dependent type + +template <class T, T t> class C {}; +template <class T, T t> class D { C<T, t-1> c; }; |