summaryrefslogtreecommitdiff
path: root/gcc/cp/pt.c
diff options
context:
space:
mode:
authorgiovannibajo <giovannibajo@138bc75d-0d04-0410-961f-82ee72b054a4>2004-03-09 15:35:03 +0000
committergiovannibajo <giovannibajo@138bc75d-0d04-0410-961f-82ee72b054a4>2004-03-09 15:35:03 +0000
commitf352cc1da39e5753bfe0c3c3321e282f3c8a3a3c (patch)
tree44c983fcb452077bd96647141c4db6421d164077 /gcc/cp/pt.c
parent9537bbab3623334604a36cd3b333e7c1a65a9bee (diff)
downloadgcc-f352cc1da39e5753bfe0c3c3321e282f3c8a3a3c.tar.gz
PR c++/14409
* pt.c (determine_specialization): For member templates, match also constness. PR c++/14448 * parser.c (cp_parser_initializer_clause): Fold initializer if it is non-dependent. * pt.c (tsubst_copy_and_build): Handle NOP_EXPRs. PR c++/14409 * g++.dg/template/spec12.C: New test. PR c++/14448 * g++.dg/parse/crash14.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@79172 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r--gcc/cp/pt.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 7dbbdc082d7..015f72a833f 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -1249,6 +1249,7 @@ determine_specialization (tree template_id,
if (TREE_CODE (fn) == TEMPLATE_DECL)
{
tree decl_arg_types;
+ tree fn_arg_types;
/* DECL might be a specialization of FN. */
@@ -1265,8 +1266,16 @@ determine_specialization (tree template_id,
The specialization f<int> is invalid but is not caught
by get_bindings below. */
- if (list_length (TYPE_ARG_TYPES (TREE_TYPE (fn)))
- != list_length (decl_arg_types))
+ fn_arg_types = TYPE_ARG_TYPES (TREE_TYPE (fn));
+ if (list_length (fn_arg_types) != list_length (decl_arg_types))
+ continue;
+
+ /* For a non-static member function, we need to make sure that
+ the const qualification is the same. This can be done by
+ checking the 'this' in the argument list. */
+ if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)
+ && !same_type_p (TREE_VALUE (fn_arg_types),
+ TREE_VALUE (decl_arg_types)))
continue;
/* See whether this function might be a specialization of this
@@ -8169,6 +8178,11 @@ tsubst_copy_and_build (tree t,
case INDIRECT_REF:
return build_x_indirect_ref (RECUR (TREE_OPERAND (t, 0)), "unary *");
+ case NOP_EXPR:
+ return build_nop
+ (tsubst (TREE_TYPE (t), args, complain, in_decl),
+ RECUR (TREE_OPERAND (t, 0)));
+
case CAST_EXPR:
return build_functional_cast
(tsubst (TREE_TYPE (t), args, complain, in_decl),