re PR c++/7363 (bogus __alignof__ implementation)
PR c++/7363 * semantics.c (finish_alignof): Call complete_type before calling c_alignof. * decl2.c (build_expr_from_tree): Use finish_sizeof/finish_alignof. * g++.dg/template/alignof1.C: New test. From-SVN: r58634
This commit is contained in:
parent
71f9914855
commit
cd35cc87a5
|
@ -1,3 +1,10 @@
|
|||
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.
|
||||
|
|
|
@ -3795,10 +3795,8 @@ build_expr_from_tree (t)
|
|||
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:
|
||||
|
|
|
@ -2117,7 +2117,7 @@ finish_alignof (t)
|
|||
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
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
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.
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
template<typename T>
|
||||
int my_alignof()
|
||||
{
|
||||
return __alignof__(T);
|
||||
}
|
||||
|
||||
template<typename>
|
||||
struct X { };
|
||||
|
||||
int main()
|
||||
{
|
||||
return my_alignof<X<void> >();
|
||||
}
|
Loading…
Reference in New Issue