* pt.c (tsubst_copy): Call tsubst for TYPEOF_EXPR.
authorKriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
Sun, 4 Nov 2001 09:50:44 +0000 (09:50 +0000)
committerKriang Lerdsuwanakij <lerdsuwa@gcc.gnu.org>
Sun, 4 Nov 2001 09:50:44 +0000 (09:50 +0000)
From-SVN: r46772

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

index 1cc0cf6c7b702195ea72a66be43de7e0ada6d2fe..e566e3034447f683a4184843cac54426282780a5 100644 (file)
@@ -1,3 +1,7 @@
+2001-11-04  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
+
+       * pt.c (tsubst_copy): Call tsubst for TYPEOF_EXPR.
+
 2001-11-03  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * lex.c (copy_lang_type): Add static prototype.
index a2971f9ba2677064d211d0b78a1375bcb02d8d8c..f1a41f2d7a80c2ac2cc18fa150cacd9895b12a6e 100644 (file)
@@ -7174,6 +7174,7 @@ tsubst_copy (t, args, complain, in_decl)
     case ARRAY_TYPE:
     case TYPENAME_TYPE:
     case UNBOUND_CLASS_TEMPLATE:
+    case TYPEOF_TYPE:
     case TYPE_DECL:
       return tsubst (t, args, complain, in_decl);
 
diff --git a/gcc/testsuite/g++.dg/ext/typeof1.C b/gcc/testsuite/g++.dg/ext/typeof1.C
new file mode 100644 (file)
index 0000000..a3c13c8
--- /dev/null
@@ -0,0 +1,21 @@
+// Test typeof template argument substitution
+
+// Copyright (C) 2001 Free Software Foundation
+// Contributed by Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+// { dg-do compile }
+// { dg-options "" }
+
+template <class T> struct A {
+       void f() {}
+       void g(T* t) {
+               A<typeof(t)> a;
+               a.f();
+       }
+};
+
+int main()
+{
+       A<int> a;
+       int b;
+       a.g(&b);
+}