This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch,committed] Revert fix for PR 18445 to fix PR 18803 on 3.4 branch
- From: Volker Reichelt <reichelt at igpm dot rwth-aachen dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 17 Sep 2005 22:52:13 +0200 (CEST)
- Subject: [patch,committed] Revert fix for PR 18445 to fix PR 18803 on 3.4 branch
The backport of the fix for PR 18445 (ice-on-invalid-code) to the
3.4 branch also backported the bug in PR 18803 (ice-on-valid-code)
to the 3.4 branch. Since the latter is worse than the former and not
trivial to fix, reverting the backport seems like the best option.
The following patch reverts the fix for PR 18445 and adds the testcase
for PR 18803 to the 3.4 branch.
Bootstrapped and regtested on i686-pc-linux-gnu.
Preapproved in PR 18803 by Gaby.
Applied to the 3.4 branch.
Regards,
Volker
2005-09-17 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/18803
Revert:
2005-09-02 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
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.
===================================================================
--- gcc/gcc/cp/class.c 2 Sep 2005 09:14:48 -0000 1.595.4.12
+++ gcc/gcc/cp/class.c 16 Sep 2005 21:30:12 -0000
@@ -6030,15 +6030,6 @@ instantiate_type (tree lhstype, tree rhs
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)
===================================================================
--- gcc/gcc/cp/pt.c 3 Sep 2005 19:52:56 -0000 1.816.2.60
+++ gcc/gcc/cp/pt.c 16 Sep 2005 21:30:21 -0000
@@ -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 *". */
===================================================================
2005-09-17 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/18803
g++.dg/template/operator5.C: New test.
PR c++/18445
g++.dg/template/crash28.C: Remove.
===================================================================
--- gcc/gcc/testsuite/g++.dg/template/operator5.C
+++ gcc/gcc/testsuite/g++.dg/template/operator5.C 2005-09-16 21:28:51 +0000
@@ -0,0 +1,14 @@
+// Copyright (C) 2004 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 7 Dec 2004 <nathan@codesourcery.com>
+
+// PR 18803: reject legal
+// Origin: Wolfgang Bangerth <bangerth@dealii.org>
+
+struct A {
+ int operator() ();
+};
+
+template <int> void foo () {
+ A &a = *new A();
+ const int i = a();
+}
===================================================================
--- gcc/gcc/testsuite/g++.dg/template/crash28.C 2 Sep 2005 09:15:10 -0000 1.1.46.1
+++ gcc/gcc/testsuite/g++.dg/template/crash28.C 16 Sep 2005 21:30:51 -0000
@@ -1,13 +0,0 @@
-// PR c++/18445
-
-struct a
-{
- int what();
-};
-void g(void*);
-template<class T>
-void f()
-{
- a ex;
- g(ex.what); // { dg-error "not enough type information" }
-}
===================================================================