From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- gcc/testsuite/g++.dg/ext/java-2.C | 79 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 gcc/testsuite/g++.dg/ext/java-2.C (limited to 'gcc/testsuite/g++.dg/ext/java-2.C') diff --git a/gcc/testsuite/g++.dg/ext/java-2.C b/gcc/testsuite/g++.dg/ext/java-2.C new file mode 100644 index 000000000..8114517b9 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/java-2.C @@ -0,0 +1,79 @@ +// PR c++/30293 +// PR c++/30294 +// { dg-do compile { target { ! { powerpc-ibm-aix* } } } } +// { dg-options "" } + +extern "Java" { +typedef __java_byte jbyte; +namespace java { +namespace lang { + class Object {}; + class Class {}; +} +} +typedef struct java::lang::Object* jobject; +typedef java::lang::Class *jclass; +} +extern "C" jobject _Jv_AllocObject (jclass); + +extern "Java" { + struct A { static java::lang::Class class$; }; +} + +struct B { + A a; // { dg-error "has Java class type" } +}; + +void* operator new (__SIZE_TYPE__, void*) throw(); +char buf[1024]; + +A a; // { dg-error "not allocated with" } +A b = A (); // { dg-error "not allocated with" } +A *c = new ((void *) buf) A (); // { dg-error "using placement new" } +A *d = new A (); +jbyte e = 6; + +const A fn1 () // { dg-error "return type has Java class type" } +{ + A a; // { dg-error "not allocated with" } + return a; +} + +A fn2 () // { dg-error "return type has Java class type" } +{ + A a; // { dg-error "not allocated with" } + return a; +} + +A *fn3 () +{ + return new A (); +} + +A &fn4 () +{ + return *c; +} + +jbyte fn5 () +{ + return 7; +} + +void fn6 (A x) // { dg-error "has Java class type" } +{ +} + +void fn7 (const A x) // { dg-error "has Java class type" } +{ +} + +void fn8 (A *x) +{ + (void) x; +} + +void fn9 (jbyte x) +{ + (void) x; +} -- cgit v1.2.3