diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 1cceeb84435..72c0f5f9bc2 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2003-12-29 Kriang Lerdsuwanakij + + 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 PR c++/12403 diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index c9a4a68a40a..4cf0261aff2 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 14faa0dc215..2cccfddf358 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2003-12-29 Kriang Lerdsuwanakij + + PR c++/13289 + * g++.dg/parse/nontype1.C: New test. + 2003-12-29 Kriang Lerdsuwanakij PR c++/12403 diff --git a/gcc/testsuite/g++.dg/parse/nontype1.C b/gcc/testsuite/g++.dg/parse/nontype1.C new file mode 100644 index 00000000000..e721700af50 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/nontype1.C @@ -0,0 +1,9 @@ +// Copyright (C) 2003 Free Software Foundation +// Contributed by Kriang Lerdsuwanakij +// { dg-do compile } + +// PR c++/13289: Incorrectly reject non-type template argument that has +// dependent type + +template class C {}; +template class D { C c; };