]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Backport:
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>
Fri, 2 Sep 2005 09:15:10 +0000 (09:15 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Fri, 2 Sep 2005 09:15:10 +0000 (09:15 +0000)
2004-11-25  Mark Mitchell  <mark@codesourcery.com>
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.

* g++.dg/template/crash28.C: New test.

From-SVN: r103767

gcc/cp/ChangeLog
gcc/cp/class.c
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/crash28.C

index 20484b9b84e6fb8fc694c9f4f491c49717a70b04..211c9db75cc03aff9a02c47d341002827b703f00 100644 (file)
@@ -1,3 +1,14 @@
+2005-09-02  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       Backport:
+
+       2004-11-25  Mark Mitchell  <mark@codesourcery.com>
+       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-01  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
        Backport:
index 09daf118a80f9e50b090185f851ff7b34761182d..8be36a04dcf981ed175c484f58a205c64b335527 100644 (file)
@@ -6030,6 +6030,15 @@ 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)
index 25e512e0608899c01b49ac3ab2a6f9a75cef03d9..c3c9824853932cf4e1c66893eecb5bdbef2b9ea7 100644 (file)
@@ -12242,6 +12242,9 @@ 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 *".  */
index b533b210b332ccdd952a155fc1a3cf010fbd856f..764e589c2ea0a4031f10c3ef0fbb9f0608a690dd 100644 (file)
@@ -1,3 +1,11 @@
+2005-09-02  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       Backport:
+
+       2004-11-25  Mark Mitchell  <mark@codesourcery.com>
+       PR c++/18445
+       * g++.dg/template/crash28.C: New test.
+
 2005-09-01  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/23478
index e8b2bbb298530a2b0bd8273bdd44944282bf0033..1ffa66fc7b9a7fd50d2391d22bf92889d43cdb18 100644 (file)
@@ -9,5 +9,5 @@ template<class T>
 void f()
 {
   a ex;
-  g(ex.what); // { dg-error "" }
+  g(ex.what); // { dg-error "not enough type information" }
 }