OSDN Git Service

Add NIOS2 support. Code from SourceyG++.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / ext / java-2.C
1 // PR c++/30293
2 // PR c++/30294
3 // { dg-do compile { target { ! { powerpc-ibm-aix* } } } }
4 // { dg-options "" }
5
6 extern "Java" {
7 typedef __java_byte jbyte;
8 namespace java {
9 namespace lang {
10   class Object {};
11   class Class {};
12 }
13 }
14 typedef struct java::lang::Object* jobject;
15 typedef java::lang::Class *jclass;
16 }
17 extern "C" jobject _Jv_AllocObject (jclass);
18
19 extern "Java" {
20   struct A { static java::lang::Class class$; };
21 }
22
23 struct B {
24   A a;          // { dg-error "has Java class type" }
25 };
26
27 void* operator new (__SIZE_TYPE__, void*) throw();
28 char buf[1024];
29
30 A a;            // { dg-error "not allocated with" }
31 A b = A ();     // { dg-error "not allocated with" }
32 A *c = new ((void *) buf) A (); // { dg-error "using placement new" }
33 A *d = new A ();
34 jbyte e = 6;
35
36 const A fn1 ()  // { dg-error "return type has Java class type" }
37 {
38   A a;          // { dg-error "not allocated with" }
39   return a;
40 }
41
42 A fn2 ()        // { dg-error "return type has Java class type" }
43 {
44   A a;          // { dg-error "not allocated with" }
45   return a;
46 }
47
48 A *fn3 ()
49 {
50   return new A ();
51 }
52
53 A &fn4 ()
54 {
55   return *c;
56 }
57
58 jbyte fn5 ()
59 {
60   return 7;
61 }
62
63 void fn6 (A x)  // { dg-error "has Java class type" }
64 {
65 }
66
67 void fn7 (const A x)    // { dg-error "has Java class type" }
68 {
69 }
70
71 void fn8 (A *x)
72 {
73   (void) x;
74 }
75
76 void fn9 (jbyte x)
77 {
78   (void) x;
79 }