+2002-10-29 Mark Mitchell <mark@codesourcery.com>
+
+ * semantics.c (finish_alignof): Call complete_type before calling
+ c_alignof.
+ * decl2.c (build_expr_from_tree): Use
+ finish_sizeof/finish_alignof.
+
2002-10-10 Jim Wilson <wilson@redhat.com>
* decl.c (duplicate_decls): Don't call decl_attributes.
case ALIGNOF_EXPR:
{
tree r = build_expr_from_tree (TREE_OPERAND (t, 0));
- if (!TYPE_P (r))
- return TREE_CODE (t) == SIZEOF_EXPR ? expr_sizeof (r) : c_alignof_expr (r);
- else
- return TREE_CODE (t) == SIZEOF_EXPR ? c_sizeof (r) : c_alignof (r);
+ return (TREE_CODE (t) == SIZEOF_EXPR
+ ? finish_sizeof (r) : finish_alignof (r));
}
case MODOP_EXPR:
if (processing_template_decl)
return build_min_nt (ALIGNOF_EXPR, t);
- return TYPE_P (t) ? c_alignof (t) : c_alignof_expr (t);
+ return TYPE_P (t) ? c_alignof (complete_type (t)) : c_alignof_expr (t);
}
/* Generate RTL for the statement T, and its substatements, and any
+2002-10-29 Mark Mitchell <mark@codesourcery.com>
+
+ * g++.dg/template/alignof1.C: New test.
+
2002-10-28 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* gcc.dg/20021014-1.c: Bypass errors on solaris2 and irix6.
--- /dev/null
+template<typename T>
+int my_alignof()
+{
+ return __alignof__(T);
+}
+
+template<typename>
+struct X { };
+
+int main()
+{
+ return my_alignof<X<void> >();
+}