OSDN Git Service

* g++.dg/lookup/java1.C: Update for chage of
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / lookup / java2.C
1 // { dg-do compile }\r
2 // { dg-options "-fdollars-in-identifiers" }\r
3 // Origin: Giovanni Bajo <giovannibajo at libero dot it>\r
4 // Make sure that Java special functions can be called correctly.\r
5 // (continue from java1.C)\r
6 \r
7 extern "Java"\r
8 {\r
9   typedef __java_int jint;\r
10   namespace java\r
11   {\r
12     namespace lang\r
13     {\r
14       class Class;\r
15       class Object;\r
16       class Throwable {};\r
17       class Foo;\r
18     }\r
19   }\r
20 }\r
21 \r
22 typedef struct java::lang::Object* jobject;\r
23 typedef struct java::lang::Throwable* jthrowable;\r
24 typedef class java::lang::Class* jclass;\r
25 using java::lang::Foo;\r
26 \r
27 class Foo : public java::lang::Throwable\r
28 {\r
29 public:\r
30   static ::java::lang::Class class$;\r
31 };\r
32 \r
33 /*\r
34  * Step 4: Manual declaration of _Jv_Throw\r
35  *  This is the last case we need to test. In the other file we're testing\r
36  *  the compiler is able to generate an artifical declaration for this \r
37  *  function, so we need to test here if it works with a normal declaration.\r
38  */\r
39 \r
40 extern "C" jobject _Jv_AllocObject (jclass) __attribute__((__malloc__));\r
41 extern "C" void _Jv_Throw (jthrowable) __attribute__ ((__noreturn__));\r
42 \r
43 void Bar4(void)\r
44 {\r
45   Foo* f = new java::lang::Foo;\r
46   throw (f);\r
47 }\r