Commit 255ef034 by Tom Tromey Committed by Tom Tromey

re PR c++/34829 (placement new with primitive Java types rejected)

gcc/testsuite
	PR c++/34829:
	* g++.dg/ext/pr34829.C: New file.
gcc/cp
	PR c++/34829:
	* init.c (build_new_1): Only disallow Java aggregates.

From-SVN: r131732
parent c316155b
2008-01-22 Tom Tromey <tromey@redhat.com>
PR c++/34829:
* init.c (build_new_1): Only disallow Java aggregates.
2008-01-22 Jakub Jelinek <jakub@redhat.com>
PR c++/34607
......
/* Handle initialization things in C++.
Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
......@@ -1786,7 +1786,7 @@ build_new_1 (tree placement, tree type, tree nelts, tree init,
(alloc_fn,
build_tree_list (NULL_TREE, class_addr)));
}
else if (TYPE_FOR_JAVA (elt_type))
else if (TYPE_FOR_JAVA (elt_type) && IS_AGGR_TYPE (elt_type))
{
error ("Java class %q#T object allocated using placement new", elt_type);
return error_mark_node;
......
2008-01-22 Tom Tromey <tromey@redhat.com>
PR c++/34829:
* g++.dg/ext/pr34829.C: New file.
2008-01-22 Jakub Jelinek <jakub@redhat.com>
PR c++/34607
// Test for PR c++/34829
// Placement new should be ok for non-aggregate Java types.
// { dg-do compile }
// { dg-options "" }
extern "Java"
{
typedef __java_byte jbyte;
}
void *operator new (unsigned int s, void *m)
{
return m;
}
jbyte *f(void *memory)
{
return new (memory) jbyte;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment