+2004-08-31 Richard Henderson <rth@redhat.com>
+
+ PR c++/17221
+ * pt.c (tsubst_expr): Move OFFSETOF_EXPR handling ...
+ (tsubst_copy_and_build): ... here.
+
2004-08-30 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (initialize_artificial_var): Declare.
tsubst (TREE_TYPE (t), args, complain, NULL_TREE);
break;
- case OFFSETOF_EXPR:
- t = tsubst_copy_and_build (TREE_OPERAND (t, 0), args, complain,
- in_decl, false);
- return fold_offsetof (t);
-
default:
gcc_assert (!STATEMENT_CODE_P (TREE_CODE (t)));
tsubst_copy (TREE_TYPE (t), args, complain,
in_decl));
+ case OFFSETOF_EXPR:
+ return fold_offsetof (RECUR (TREE_OPERAND (t, 0)));
+
default:
return tsubst_copy (t, args, complain, in_decl);
}
--- /dev/null
+// { dg-do compile }
+// PR c++/17221
+
+#include <cstddef>
+
+template <int N> struct Bar;
+template <> struct Bar<3> {};
+
+template <class T>
+struct Foo {
+ Bar<offsetof(T, a) + 3> k;
+};
+
+struct A { int a; };
+
+template struct Foo<A>;