aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@gcc.gnu.org>1999-05-20 08:21:15 -0400
committerJason Merrill <jason@gcc.gnu.org>1999-05-20 08:21:15 -0400
commit75153fba81d4bb413428631ff087e430a604a667 (patch)
tree5dda928f0732faece693b076b793bde4e9867391 /gcc
parent06126ca285bb5ec114d8a1c2db4de6c6d8e96d1d (diff)
downloadgcc-75153fba81d4bb413428631ff087e430a604a667.zip
gcc-75153fba81d4bb413428631ff087e430a604a667.tar.gz
gcc-75153fba81d4bb413428631ff087e430a604a667.tar.bz2
new
From-SVN: r27064
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/g++.old-deja/g++.ext/com1.C24
-rw-r--r--gcc/testsuite/g++.old-deja/g++.ext/initp1.C90
2 files changed, 114 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.ext/com1.C b/gcc/testsuite/g++.old-deja/g++.ext/com1.C
new file mode 100644
index 0000000..78d99e6
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.ext/com1.C
@@ -0,0 +1,24 @@
+// Test that we can use mixins with COM classes.
+
+struct A
+{
+ virtual int foo () = 0;
+ virtual int bar () = 0;
+} __attribute__((__com_interface__));
+
+struct B
+{
+ virtual int baz () { return 5; }
+};
+
+struct C : public A, public B
+{
+ int foo () { return 0; }
+ int bar () { return 1; }
+};
+
+int main ()
+{
+ C c;
+ return c.foo ();
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.ext/initp1.C b/gcc/testsuite/g++.old-deja/g++.ext/initp1.C
new file mode 100644
index 0000000..f22290d
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.ext/initp1.C
@@ -0,0 +1,90 @@
+// Test for proper handling of the init_priority attribute.
+// Contributed by Hugo Tyson <hmt@cygnus.co.uk>
+
+class Two {
+private:
+ int i, j, k;
+public:
+ static int count;
+ Two( int ii, int jj ) { i = ii; j = jj; k = count++; };
+ Two( void ) { i = 0; j = 0; k = count++; };
+ int eye( void ) { return i; };
+ int jay( void ) { return j; };
+ int kay( void ) { return k; };
+};
+
+extern Two foo;
+extern Two goo;
+extern Two coo[];
+extern Two koo[];
+
+Two foo( 5, 6 ) __attribute__((init_priority(1005)));
+
+Two goo __attribute__((init_priority(1007))) = Two( 7, 8 );
+
+Two doo[ 3 ];
+
+Two hoo[ 3 ] = {
+ Two( 11, 12 ),
+ Two( 13, 14 ),
+ Two( 15, 16 )
+};
+
+Two coo[ 3 ] __attribute__((init_priority(1000)));
+
+Two koo[ 3 ] __attribute__((init_priority(1000))) = {
+ Two( 21, 22 ),
+ Two( 23, 24 ),
+ Two( 25, 26 )
+};
+
+Two xoo[ 3 ] __attribute__((init_priority(1100)));
+
+Two zoo[ 3 ] __attribute__((init_priority(1100))) = {
+ Two( 31, 32 ),
+ Two( 33, 34 ),
+ Two( 35, 36 )
+};
+
+int Two::count;
+
+int x = 0;
+
+#define X( n ) \
+ do { if ( x & (1 << (n)) ) return 1; else x |= (1 << (n)); } while (0)
+
+int main()
+{
+
+ X( coo[0].kay() );
+ X( coo[1].kay() );
+ X( coo[2].kay() );
+ X( koo[0].kay() );
+ X( koo[1].kay() );
+ X( koo[2].kay() );
+ if ( 0x3f != x ) return 1;
+
+ X( foo.kay() );
+ if ( 0x7f != x ) return 1;
+
+ X( goo.kay() );
+ if ( 0xff != x ) return 1;
+
+ X( xoo[0].kay() );
+ X( xoo[1].kay() );
+ X( xoo[2].kay() );
+ X( zoo[0].kay() );
+ X( zoo[1].kay() );
+ X( zoo[2].kay() );
+ if ( 0x3fff != x ) return 1;
+
+ X( doo[0].kay() );
+ X( doo[1].kay() );
+ X( doo[2].kay() );
+ X( hoo[0].kay() );
+ X( hoo[1].kay() );
+ X( hoo[2].kay() );
+ if ( 0xfffff != x ) return 1;
+
+ return 0;
+}