re PR c++/17413 (local classes as template argument)
authorGeoffrey Keating <geoffk@apple.com>
Fri, 17 Jun 2005 22:13:33 +0000 (22:13 +0000)
committerGeoffrey Keating <geoffk@gcc.gnu.org>
Fri, 17 Jun 2005 22:13:33 +0000 (22:13 +0000)
2005-06-17  Geoffrey Keating  <geoffk@apple.com>

PR c++/17413
* pt.c (type_unification_real): Apply template type deduction even
to procedure parameters that are not dependent on a template
parameter.

Index: testsuite/ChangeLog
2005-06-17  Geoffrey Keating  <geoffk@apple.com>

PR c++/17413
* g++.dg/template/local5.C: New.

From-SVN: r101141

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/local5.C [new file with mode: 0644]

index af04741fc44ce41d2f802cdb9a7998770f1f3fb3..3f795aa41f39d54cce5209a8a483f7bd55ee983f 100644 (file)
@@ -1,3 +1,10 @@
+2005-06-17  Geoffrey Keating  <geoffk@apple.com>
+
+       PR c++/17413
+       * pt.c (type_unification_real): Apply template type deduction even
+       to procedure parameters that are not dependent on a template
+       parameter.
+
 2005-06-16  Nathan Sidwell  <nathan@codesourcery.com>
 
        * rtti.c (get_tinfo_decl): Avoid caching tinfo_descs when it might
index f130859d3c5892c2f795b7da9e84990bd92eb441..e8112018723f6864a7cba15a79af6e96aa735721 100644 (file)
@@ -9366,17 +9366,12 @@ type_unification_real (tree tparms,
          else
            type = arg;
 
-         if (strict == DEDUCE_EXACT)
-           {
-             if (same_type_p (parm, type))
-               continue;
-           }
-         else
-           /* It might work; we shouldn't check now, because we might
-              get into infinite recursion.  Overload resolution will
-              handle it.  */
+         if (same_type_p (parm, type))
            continue;
-
+         if (strict != DEDUCE_EXACT
+             && can_convert_arg (parm, type, TYPE_P (arg) ? NULL_TREE : arg))
+           continue;
+         
          return 1;
        }
 
index 68b98ff9e342753b8830fd0d3b761c485ce7e540..321c87a734832b013ce7feb07e6025e7c1786832 100644 (file)
@@ -1,3 +1,8 @@
+2005-06-17  Geoffrey Keating  <geoffk@apple.com>
+
+       PR c++/17413
+       * g++.dg/template/local5.C: New.
+
 2005-06-17  Richard Henderson  <rth@redhat.com>
 
        * gcc.dg/sync-2.c (do_qi): Cast negative results to char.
diff --git a/gcc/testsuite/g++.dg/template/local5.C b/gcc/testsuite/g++.dg/template/local5.C
new file mode 100644 (file)
index 0000000..705dca3
--- /dev/null
@@ -0,0 +1,12 @@
+struct Attribute { };
+
+template <class T> bool operator == (const Attribute &attr, const T &value);
+
+enum {
+  anon = 123
+};
+
+void test(int foo)
+{
+  if (foo == anon) ;  /* { dg-bogus "anonymous type" } */
+}