Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / g++.dg / lookup / java1.C
blob0d9b22ee1d55811361a56bd67fb93e6b35b353cd
1 // { dg-do compile }
2 // { dg-options "-fdollars-in-identifiers" }
3 // Origin: Giovanni Bajo <giovannibajo at libero dot it>
4 // Make sure that Java special functions can be called correctly.
6 extern "Java"
8   typedef __java_int jint;
9   namespace java
10   {
11     namespace lang
12     {
13       class Class;
14       class Object;
15       class Throwable {};
16       class Foo;
17     }
18   }
21 typedef struct java::lang::Object* jobject;
22 typedef struct java::lang::Throwable* jthrowable;
23 typedef class java::lang::Class* jclass;
24 using java::lang::Foo;
26 class Foo : public java::lang::Throwable
28 public:
29   static ::java::lang::Class class$;
34  * Step 1: no declarations. A declaration for _Jv_Throw is created.
35  */
37 void Bar1(void)
39   Foo* f = new java::lang::Foo;   // { dg-error "call to Java constructor" }
40   throw (f);
45  * Step 2: constructor declaration
46  */
48 extern "C" jobject _Jv_AllocObject (jclass) __attribute__((__malloc__));
50 void Bar2(void)
52   Foo* f = new java::lang::Foo; 
53   throw (f);  
58  * Step 3: overloads
59  */
61 jobject _Jv_AllocObject (jclass, jint, float) __attribute__((__malloc__));
62 void _Jv_Throw (int, float) __attribute__ ((__noreturn__));
64 void Bar3(void)
66   Foo* f = new java::lang::Foo;   // { dg-error "should never be overloaded" }
67   throw (f);                      // { dg-error "should never be overloaded" }