]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/21514 ([DR 488] templates and anonymous enum)
authorMark Mitchell <mark@codesourcery.com>
Fri, 16 Sep 2005 15:41:45 +0000 (15:41 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Fri, 16 Sep 2005 15:41:45 +0000 (15:41 +0000)
PR c++/21514
* pt.c (check_instantiated_args): Treat uses of anonymous types as
causing type-deduction failure.

PR c++/21514
* g++.dg/template/crash19.C: Remove dg-error marker.
* g++.dg/template/local4.C: New test.

From-SVN: r104344

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/crash19.C
gcc/testsuite/g++.dg/template/local4.C

index 683af879ca95e3a011fe78776e0474537e15e2f7..91dc40597f2b88cdcc16de8213e596a3adfb6207 100644 (file)
@@ -1,3 +1,9 @@
+2005-09-16  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/21514
+       * pt.c (check_instantiated_args): Treat uses of anonymous types as
+       causing type-deduction failure.
+
 2005-09-15  Jason Merrill  <jason@redhat.com>
 
        PR c++/23357
index ece96146c2e7cae99e3c83e83c73033d403040ea..be2f0312bdf9d7deab7f64f6b88cf3c57ce0427b 100644 (file)
@@ -8967,7 +8967,6 @@ check_instantiated_args (tree tmpl, tree args, tsubst_flags_t complain)
 {
   int ix, len = DECL_NTPARMS (tmpl);
   bool result = false;
-  bool error_p = complain & tf_error;
 
   for (ix = 0; ix != len; ix++)
     {
@@ -8984,12 +8983,16 @@ check_instantiated_args (tree tmpl, tree args, tsubst_flags_t complain)
 
          if (nt)
            {
-             if (TYPE_ANONYMOUS_P (nt))
-               error ("%qT is/uses anonymous type", t);
-             else
-               error ("%qT uses local type %qT", t, nt);
+             /* DR 488 makes use of a type with no linkage causes
+                type deduction to fail.  */ 
+             if (complain & tf_error)
+               {
+                 if (TYPE_ANONYMOUS_P (nt))
+                   error ("%qT is/uses anonymous type", t);
+                 else
+                   error ("%qT uses local type %qT", t, nt);
+               }
              result = true;
-             error_p = true;
            }
          /* In order to avoid all sorts of complications, we do not
             allow variably-modified types as template arguments.  */
@@ -9011,7 +9014,7 @@ check_instantiated_args (tree tmpl, tree args, tsubst_flags_t complain)
          result = true;
        }
     }
-  if (result && error_p)
+  if (result && (complain & tf_error))
     error ("  trying to instantiate %qD", tmpl);
   return result;
 }
index c0a37445298a0902646f8280357dee337a44999f..6103389ca2be1c61fe3497a17e74fac6613d69f6 100644 (file)
@@ -1,3 +1,9 @@
+2005-09-16  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/21514
+       * g++.dg/template/crash19.C: Remove dg-error marker.
+       * g++.dg/template/local4.C: New test.
+
 2005-09-16  Paul Brook  <paul@codesourcery.com>
 
        PR fortran/23906
index 59b4140c578b20b6031d5753b9dccdeae353e0d9..a28827f31ac80ced0e4cffb3bdaef2c98719ee3f 100644 (file)
@@ -9,7 +9,7 @@ template <class T>
 struct X { 
     enum { SIXTY_FOUR=64 }; 
     struct node {
-      unsigned char *ptr[sizeof(T)*SIXTY_FOUR]; // { dg-error "" }
+      unsigned char *ptr[sizeof(T)*SIXTY_FOUR];
         void d() {}
     };
     node *head; 
index 20f8bf294417456543ef325976c5ae380373a425..cfa37364975b27430ef47271e71d67aee7b3b33c 100644 (file)
@@ -4,8 +4,5 @@ template <typename T> void foo() {}
 
 int main () {
   struct S {};
-  // We do not simply use "local|match" on line 10 because we want to
-  // make sure that "local" appears.
-  // { dg-error "local" "local" { target *-*-* } 10 }
-  foo<S> (); // { dg-error "trying|match" } 
+  foo<S> (); // { dg-error "match" } 
 }