From 7aef0b791cc9e747ebb31f7fa9f7dd9573990ef0 Mon Sep 17 00:00:00 2001 From: Volker Reichelt Date: Sat, 17 Sep 2005 20:48:46 +0000 Subject: [PATCH] re PR c++/18803 (rejects access to operator() in template) PR c++/18803 Revert: 2005-09-02 Volker Reichelt PR c++/18445 * class.c (instantiate_type): Treat NON_DEPENDENT_EXPRs with unknown_type as non matching. * pt.c (build_non_dependent_expr): Do not build a NON_DEPENDENT_EXPR for a VAR_DECL. PR c++/18803 g++.dg/template/operator5.C: New test. PR c++/18445 g++.dg/template/crash28.C: Remove. From-SVN: r104374 --- gcc/cp/ChangeLog | 12 ++++++++++++ gcc/cp/class.c | 9 --------- gcc/cp/pt.c | 3 --- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/g++.dg/template/crash28.C | 13 ------------- 5 files changed, 20 insertions(+), 25 deletions(-) delete mode 100644 gcc/testsuite/g++.dg/template/crash28.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index dcbd0f7cd0af..d6b2b593da72 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,15 @@ +2005-09-17 Volker Reichelt + + PR c++/18803 + Revert: + + 2005-09-02 Volker Reichelt + PR c++/18445 + * class.c (instantiate_type): Treat NON_DEPENDENT_EXPRs with + unknown_type as non matching. + * pt.c (build_non_dependent_expr): Do not build a + NON_DEPENDENT_EXPR for a VAR_DECL. + 2005-09-06 Volker Reichelt Backport: diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 8be36a04dcf9..09daf118a80f 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -6030,15 +6030,6 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags) if (TREE_CODE (rhs) == BASELINK) rhs = BASELINK_FUNCTIONS (rhs); - /* If we are in a template, and have a NON_DEPENDENT_EXPR, we cannot - deduce any type information. */ - if (TREE_CODE (rhs) == NON_DEPENDENT_EXPR) - { - if (flags & tf_error) - error ("not enough type information"); - return error_mark_node; - } - /* We don't overwrite rhs if it is an overloaded function. Copying it would destroy the tree link. */ if (TREE_CODE (rhs) != OVERLOAD) diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 5fcbf300f51c..b877fbbe5eef 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -12245,9 +12245,6 @@ build_non_dependent_expr (tree expr) || TREE_CODE (inner_expr) == TEMPLATE_ID_EXPR || TREE_CODE (inner_expr) == OFFSET_REF) return expr; - /* There is no need to return a proxy for a variable. */ - if (TREE_CODE (expr) == VAR_DECL) - return expr; /* Preserve string constants; conversions from string constants to "char *" are allowed, even though normally a "const char *" cannot be used to initialize a "char *". */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6bbc73d33277..e7173433cdb8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2005-09-17 Volker Reichelt + + PR c++/18803 + g++.dg/template/operator5.C: New test. + + PR c++/18445 + g++.dg/template/crash28.C: Remove. + 2005-09-08 Craig Rodrigues Backport from mainline: diff --git a/gcc/testsuite/g++.dg/template/crash28.C b/gcc/testsuite/g++.dg/template/crash28.C deleted file mode 100644 index 1ffa66fc7b9a..000000000000 --- a/gcc/testsuite/g++.dg/template/crash28.C +++ /dev/null @@ -1,13 +0,0 @@ -// PR c++/18445 - -struct a -{ - int what(); -}; -void g(void*); -template -void f() -{ - a ex; - g(ex.what); // { dg-error "not enough type information" } -} -- 2.47.2