commit f415d192e2b16069344b5b9bea9c48dc2a217f99
Author: Jason Merrill <jason@redhat.com>
Date: Fri Dec 14 16:10:39 2012 -0500
PR c++/55685
* pt.c (tsubst_copy_and_build): Don't use SIZEOF_EXPR_TYPE_P in
templates.
@@ -13563,7 +13563,7 @@ tsubst_copy_and_build (tree t,
{
if (TREE_CODE (r) != SIZEOF_EXPR || TYPE_P (op1))
{
- if (TYPE_P (op1))
+ if (!processing_template_decl && TYPE_P (op1))
{
r = build_min (SIZEOF_EXPR, size_type_node,
build1 (NOP_EXPR, op1, error_mark_node));
new file mode 100644
@@ -0,0 +1,13 @@
+// PR c++/55685
+
+typedef __SIZE_TYPE__ size_t;
+template <size_t T, size_t U>
+struct A;
+
+template <typename T> struct B
+{
+ static A <sizeof (T), 0> x;
+};
+
+template <typename T>
+A <sizeof (T), 0> B <T>::x;