aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg
diff options
context:
space:
mode:
authorno-author <no-author@gcc.gnu.org>2004-01-03 23:05:47 +0000
committerno-author <no-author@gcc.gnu.org>2004-01-03 23:05:47 +0000
commit97a27604616ab18e514bad680435fb93de2900eb (patch)
treebf66430a7444050d8b06c8c9e6c40247fca12af3 /gcc/testsuite/g++.dg
parentb690f109b5d43ea7f7f047e6988ed11287740b4c (diff)
This commit was manufactured by cvs2svn to create branch
'tree-ssa-20020619-branch'. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/tree-ssa-20020619-branch@75374 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/g++.dg')
-rw-r--r--gcc/testsuite/g++.dg/abi/covariant2.C32
-rw-r--r--gcc/testsuite/g++.dg/abi/covariant3.C85
-rw-r--r--gcc/testsuite/g++.dg/abi/macro0.C5
-rw-r--r--gcc/testsuite/g++.dg/abi/macro1.C5
-rw-r--r--gcc/testsuite/g++.dg/abi/macro2.C5
-rw-r--r--gcc/testsuite/g++.dg/abi/mangle18-1.C23
-rw-r--r--gcc/testsuite/g++.dg/abi/mangle18-2.C23
-rw-r--r--gcc/testsuite/g++.dg/abi/mangle19-1.C13
-rw-r--r--gcc/testsuite/g++.dg/abi/mangle19-2.C13
-rw-r--r--gcc/testsuite/g++.dg/abi/mangle20-1.C19
-rw-r--r--gcc/testsuite/g++.dg/abi/mangle20-2.C16
-rw-r--r--gcc/testsuite/g++.dg/eh/ia64-1.C50
-rw-r--r--gcc/testsuite/g++.dg/expr/assign1.C34
-rw-r--r--gcc/testsuite/g++.dg/expr/sizeof1.C7
-rw-r--r--gcc/testsuite/g++.dg/ext/attrib10.C7
-rw-r--r--gcc/testsuite/g++.dg/ext/attrib11.C17
-rw-r--r--gcc/testsuite/g++.dg/ext/attrib9.C5
-rw-r--r--gcc/testsuite/g++.dg/ext/visibility-1.C8
-rw-r--r--gcc/testsuite/g++.dg/ext/visibility-2.C7
-rw-r--r--gcc/testsuite/g++.dg/ext/visibility-3.C7
-rw-r--r--gcc/testsuite/g++.dg/ext/visibility-4.C8
-rw-r--r--gcc/testsuite/g++.dg/ext/visibility-5.C11
-rw-r--r--gcc/testsuite/g++.dg/ext/visibility-6.C10
-rw-r--r--gcc/testsuite/g++.dg/ext/visibility-7.C11
-rw-r--r--gcc/testsuite/g++.dg/inherit/operator2.C22
-rw-r--r--gcc/testsuite/g++.dg/init/array12.C28
-rw-r--r--gcc/testsuite/g++.dg/init/assign1.C30
-rw-r--r--gcc/testsuite/g++.dg/init/bitfield2.C33
-rw-r--r--gcc/testsuite/g++.dg/init/error1.C7
-rw-r--r--gcc/testsuite/g++.dg/init/pm3.C10
-rw-r--r--gcc/testsuite/g++.dg/lookup/java1.C68
-rw-r--r--gcc/testsuite/g++.dg/lookup/java2.C47
-rw-r--r--gcc/testsuite/g++.dg/lookup/ns1.C22
-rw-r--r--gcc/testsuite/g++.dg/opt/expect1.C17
-rw-r--r--gcc/testsuite/g++.dg/opt/inline6.C14
-rw-r--r--gcc/testsuite/g++.dg/opt/noreturn-1.C87
-rw-r--r--gcc/testsuite/g++.dg/other/java1.C22
-rw-r--r--gcc/testsuite/g++.dg/other/stdarg2.C12
-rw-r--r--gcc/testsuite/g++.dg/other/struct-va_list.C8
-rw-r--r--gcc/testsuite/g++.dg/parse/defarg6.C11
-rw-r--r--gcc/testsuite/g++.dg/parse/error3.C6
-rw-r--r--gcc/testsuite/g++.dg/parse/error4.C7
-rw-r--r--gcc/testsuite/g++.dg/parse/error5.C4
-rw-r--r--gcc/testsuite/g++.dg/parse/error6.C6
-rw-r--r--gcc/testsuite/g++.dg/parse/error7.C4
-rw-r--r--gcc/testsuite/g++.dg/parse/error8.C4
-rw-r--r--gcc/testsuite/g++.dg/parse/error9.C5
-rw-r--r--gcc/testsuite/g++.dg/parse/explicit1.C11
-rw-r--r--gcc/testsuite/g++.dg/parse/nontype1.C9
-rw-r--r--gcc/testsuite/g++.dg/parse/offsetof1.C11
-rw-r--r--gcc/testsuite/g++.dg/parse/offsetof2.C12
-rw-r--r--gcc/testsuite/g++.dg/parse/semicolon1.C4
-rw-r--r--gcc/testsuite/g++.dg/parse/semicolon1.h2
-rw-r--r--gcc/testsuite/g++.dg/template/access13.C16
-rw-r--r--gcc/testsuite/g++.dg/template/array1-1.C32
-rw-r--r--gcc/testsuite/g++.dg/template/array1-2.C32
-rw-r--r--gcc/testsuite/g++.dg/template/array2-1.C14
-rw-r--r--gcc/testsuite/g++.dg/template/array2-2.C14
-rw-r--r--gcc/testsuite/g++.dg/template/crash14.C3
-rw-r--r--gcc/testsuite/g++.dg/template/crash15.C9
-rw-r--r--gcc/testsuite/g++.dg/template/crash16.C21
-rw-r--r--gcc/testsuite/g++.dg/template/dependent-expr3.C14
-rw-r--r--gcc/testsuite/g++.dg/template/eh1.C6
-rw-r--r--gcc/testsuite/g++.dg/template/error10.C70
-rw-r--r--gcc/testsuite/g++.dg/template/error5.C6
-rw-r--r--gcc/testsuite/g++.dg/template/error6.C13
-rw-r--r--gcc/testsuite/g++.dg/template/error7.C6
-rw-r--r--gcc/testsuite/g++.dg/template/error8.C7
-rw-r--r--gcc/testsuite/g++.dg/template/error9.C7
-rw-r--r--gcc/testsuite/g++.dg/template/lookup3.C16
-rw-r--r--gcc/testsuite/g++.dg/template/nontype3.C37
-rw-r--r--gcc/testsuite/g++.dg/template/ptrmem8.C20
-rw-r--r--gcc/testsuite/g++.dg/template/qualttp22.C28
-rw-r--r--gcc/testsuite/g++.dg/template/recurse1.C16
-rw-r--r--gcc/testsuite/g++.dg/warn/ctor-init-1.C9
-rw-r--r--gcc/testsuite/g++.dg/warn/format3.C12
-rw-r--r--gcc/testsuite/g++.dg/warn/noreturn-3.C13
77 files changed, 1365 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/abi/covariant2.C b/gcc/testsuite/g++.dg/abi/covariant2.C
new file mode 100644
index 00000000000..87eb2a2708c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/covariant2.C
@@ -0,0 +1,32 @@
+// { dg-do compile }
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 12 Dec 2003 <nathan@codesourcery.com>
+// Origin: grigory@stl.sarov.ru
+
+// PR c++/12881. ICE in thunk generation
+
+struct c1 {};
+
+struct c3 : virtual c1
+{
+ virtual c1* f6() {};
+ int i;
+};
+
+struct c6 : virtual c3 { };
+
+struct c7 : c3
+{
+ virtual c3* f6() {};
+};
+
+struct c24 : virtual c7
+{
+ virtual c6* f6();
+};
+
+c6* c24::f6() { return 0; }
+
+struct c31 : c24 {};
+
diff --git a/gcc/testsuite/g++.dg/abi/covariant3.C b/gcc/testsuite/g++.dg/abi/covariant3.C
new file mode 100644
index 00000000000..178157c58b2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/covariant3.C
@@ -0,0 +1,85 @@
+// { dg-do run }
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 12 Dec 2003 <nathan@codesourcery.com>
+// Origin: grigory@stl.sarov.ru
+
+// PR c++/13118. Missing covariant thunk.
+
+struct c0 {};
+struct c1 : virtual c0 {
+ virtual c0* f6();
+};
+
+struct c5 {
+ virtual void foo();
+};
+
+struct c10 : virtual c1 {
+ virtual void foo();
+};
+
+struct c1a : c1 {}; // disambiguation
+
+struct c11 : virtual c10, c1a {
+ int i;
+ virtual c1* f6 () = 0;
+};
+
+struct c18 : c5, virtual c1 {
+ virtual void bar();
+};
+
+struct c28 : virtual c0, virtual c11 {
+ virtual c18* f6();
+};
+
+c0 *c1::f6 () {}
+void c5::foo () {}
+void c10::foo () {}
+void c18::bar () {}
+
+c18 ret;
+
+c18 *c28::f6 ()
+{
+ return &ret;
+}
+
+bool check_c1 (c1 *ptr)
+{
+ c0 *r = ptr->f6 ();
+ return r != &ret;
+}
+bool check_c10 (c10 *ptr)
+{
+ c0 *r = ptr->f6 ();
+ return r != &ret;
+}
+bool check_c11 (c11 *ptr)
+{
+ c1 *r = ptr->f6 ();
+ return r != &ret;
+}
+bool check_c28 (c28 *ptr)
+{
+ c18 *r = ptr->f6 ();
+ return r != &ret;
+}
+
+int main ()
+{
+ c28 obj;
+
+ if (check_c1 (static_cast<c1a *> (&obj)))
+ return 1;
+ if (check_c1 (static_cast<c10 *> (&obj)))
+ return 2;
+ if (check_c10 (&obj))
+ return 3;
+ if (check_c11 (&obj))
+ return 4;
+ if (check_c28 (&obj))
+ return 5;
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/abi/macro0.C b/gcc/testsuite/g++.dg/abi/macro0.C
new file mode 100644
index 00000000000..6c391e6891b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/macro0.C
@@ -0,0 +1,5 @@
+// { dg-options "-fabi-version=0" }
+
+#if __GXX_ABI_VERSION != 999999
+#error "Incorrect value of __GXX_ABI_VERSION"
+#endif
diff --git a/gcc/testsuite/g++.dg/abi/macro1.C b/gcc/testsuite/g++.dg/abi/macro1.C
new file mode 100644
index 00000000000..871208da3ad
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/macro1.C
@@ -0,0 +1,5 @@
+// { dg-options "-fabi-version=1" }
+
+#if __GXX_ABI_VERSION != 102
+#error "Incorrect value of __GXX_ABI_VERSION"
+#endif
diff --git a/gcc/testsuite/g++.dg/abi/macro2.C b/gcc/testsuite/g++.dg/abi/macro2.C
new file mode 100644
index 00000000000..9f0af9cff34
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/macro2.C
@@ -0,0 +1,5 @@
+// { dg-options "-fabi-version=2" }
+
+#if __GXX_ABI_VERSION != 1002
+#error "Incorrect value of __GXX_ABI_VERSION"
+#endif
diff --git a/gcc/testsuite/g++.dg/abi/mangle18-1.C b/gcc/testsuite/g++.dg/abi/mangle18-1.C
new file mode 100644
index 00000000000..a1be5e48c33
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/mangle18-1.C
@@ -0,0 +1,23 @@
+// { dg-do compile }
+// { dg-options "-fabi-version=2" }
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 30 Nov 2003 <nathan@codesourcery.com>
+
+// PR 13241
+// mangled template arguments that are external objects incorrectly
+
+extern "C" void Foo ();
+namespace NMS
+{
+ extern "C" int V;
+}
+
+template <void (*)()> struct S {};
+template <int *> struct T {};
+
+void f (S<Foo>){}
+// { dg-final { scan-assembler "\n_?_Z1f1SIXadL_Z3FooEEE\[: \t\n\]" } }
+
+void g (T<&NMS::V>){}
+// { dg-final { scan-assembler "\n_?_Z1g1TIXadL_Z1VEEE\[: \t\n\]" } }
diff --git a/gcc/testsuite/g++.dg/abi/mangle18-2.C b/gcc/testsuite/g++.dg/abi/mangle18-2.C
new file mode 100644
index 00000000000..a231d495fef
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/mangle18-2.C
@@ -0,0 +1,23 @@
+// { dg-do compile }
+// { dg-options "-fabi-version=1 -Wabi" }
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 30 Nov 2003 <nathan@codesourcery.com>
+
+// PR 13241
+// mangled template arguments that are external objects incorrectly
+
+extern "C" void Foo ();
+namespace NMS
+{
+ extern "C" int V;
+}
+
+template <void (*)()> struct S {};
+template <int *> struct T {};
+
+void f (S<Foo>){} // { dg-warning "mangled name" }
+// { dg-final { scan-assembler "\n_?_Z1f1SIXadL3FooEEE\[: \t\n\]" } }
+
+void g (T<&NMS::V>){} // { dg-warning "mangled name" }
+// { dg-final { scan-assembler "\n_?_Z1g1TIXadL_ZN3NMS1VEEEE\[: \t\n\]" } }
diff --git a/gcc/testsuite/g++.dg/abi/mangle19-1.C b/gcc/testsuite/g++.dg/abi/mangle19-1.C
new file mode 100644
index 00000000000..c7ab2cbb9b4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/mangle19-1.C
@@ -0,0 +1,13 @@
+// { dg-do compile }
+// { dg-options "-fabi-version=2" }
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 15 Dec 2003 <nathan@codesourcery.com>
+
+// PR 13242
+// mangled template arguments that are external objects incorrectly
+
+extern int N;
+template <int &> struct S {};
+void n (S<N>) {}
+// { dg-final { scan-assembler "\n_?_Z1n1SILZ1NEE\[: \t\n\]" } }
diff --git a/gcc/testsuite/g++.dg/abi/mangle19-2.C b/gcc/testsuite/g++.dg/abi/mangle19-2.C
new file mode 100644
index 00000000000..f0855e69d34
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/mangle19-2.C
@@ -0,0 +1,13 @@
+// { dg-do compile }
+// { dg-options "-fabi-version=1 -Wabi" }
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 15 Dec 2003 <nathan@codesourcery.com>
+
+// PR 13242
+// mangled template arguments that are external objects incorrectly
+
+extern int N;
+template <int &> struct S {};
+void n (S<N>) {} // { dg-warning "mangled name" }
+// { dg-final { scan-assembler "\n_?_Z1n1SIXadL_Z1NEEE\[: \t\n\]" } }
diff --git a/gcc/testsuite/g++.dg/abi/mangle20-1.C b/gcc/testsuite/g++.dg/abi/mangle20-1.C
new file mode 100644
index 00000000000..1985fe3c941
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/mangle20-1.C
@@ -0,0 +1,19 @@
+// { dg-do compile }
+// { dg-options "-fabi-version=2" }
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 15 Dec 2003 <nathan@codesourcery.com>
+
+// PR 9043
+// mangled array types in templates
+
+template <int I> void f(int (*)[2]) {}
+template <int I> void g(int (*)[I+2]) {}
+
+static const int I=1;
+static const int J=2;
+
+template void f<1>(int (*)[2]);
+// { dg-final { scan-assembler "\n_?_Z1fILi1EEvPA2_i\[: \t\n\]" } }
+template void g<1>(int (*)[3]);
+// { dg-final { scan-assembler "\n_?_Z1gILi1EEvPAplT_Li2E_i\[: \t\n\]" } }
diff --git a/gcc/testsuite/g++.dg/abi/mangle20-2.C b/gcc/testsuite/g++.dg/abi/mangle20-2.C
new file mode 100644
index 00000000000..bf3d189bf0c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/mangle20-2.C
@@ -0,0 +1,16 @@
+// { dg-do compile }
+// { dg-options "-fabi-version=1 -Wabi" }
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 15 Dec 2003 <nathan@codesourcery.com>
+
+// PR 9043
+// mangled array types in templates
+
+template <int I> void f(int (*)[2]) {}
+template <int I> void g(int (*)[I+2]) {}
+
+template void f<1>(int (*)[2]); // { dg-warning "mangled name" }
+// { dg-final { scan-assembler "\n_?_Z1fILi1EEvPALi2E_i\[: \t\n\]" } }
+template void g<1>(int (*)[3]);
+// { dg-final { scan-assembler "\n_?_Z1gILi1EEvPAplT_Li2E_i\[: \t\n\]" } }
diff --git a/gcc/testsuite/g++.dg/eh/ia64-1.C b/gcc/testsuite/g++.dg/eh/ia64-1.C
new file mode 100644
index 00000000000..a1b731c8d80
--- /dev/null
+++ b/gcc/testsuite/g++.dg/eh/ia64-1.C
@@ -0,0 +1,50 @@
+// Test whether call saved float and branch regs are restored properly
+// { dg-do run { target ia64-*-* } }
+// { dg-options "-O2" }
+
+extern "C" void abort (void);
+
+char buf[128];
+
+void __attribute__((noinline))
+bar (void)
+{
+ throw 1;
+}
+
+void __attribute__((noinline))
+foo (void)
+{
+ bar ();
+ bar ();
+}
+
+int
+main (void)
+{
+ register double f2 __asm ("f2");
+ register double f3 __asm ("f3");
+ register double f4 __asm ("f4");
+ register double f5 __asm ("f5");
+ register double f16 __asm ("f16");
+ register double f17 __asm ("f17");
+ register void *b1 __asm ("b1");
+ register void *b2 __asm ("b2");
+ register void *b3 __asm ("b3");
+ register void *b4 __asm ("b4");
+ register void *b5 __asm ("b5");
+ f2 = 12.0; f3 = 13.0; f4 = 14.0; f5 = 15.0; f16 = 16.0; f17 = 17.0;
+ b1 = &buf[1]; b2 = &buf[2]; b3 = &buf[3]; b4 = &buf[4]; b5 = &buf[5];
+ try
+ {
+ foo ();
+ }
+ catch (...) {}
+ if (f2 != 12.0 || f3 != 13.0 || f4 != 14.0
+ || f5 != 15.0 || f16 != 16.0 || f17 != 17.0)
+ abort ();
+ if (b1 != &buf[1] || b2 != &buf[2] || b3 != &buf[3]
+ || b4 != &buf[4] || b5 != &buf[5])
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/expr/assign1.C b/gcc/testsuite/g++.dg/expr/assign1.C
new file mode 100644
index 00000000000..7eb37e523ac
--- /dev/null
+++ b/gcc/testsuite/g++.dg/expr/assign1.C
@@ -0,0 +1,34 @@
+// { dg-do run }
+
+// Contributed by Nathan Sidwell 15 Dec 2003 <nathan@codesourcery.com>
+// Origin: Tasso Karkanis <Tasso.Karkanis@rogers.com>
+// PR c++/13387. Clobbered tail padding of base
+
+inline void *operator new (__SIZE_TYPE__, void *ptr)
+{
+ return ptr;
+}
+
+struct Base {
+ Base() : i(0), c(0) {}
+ int i;
+ char c;
+};
+
+struct Sub : Base {
+ Sub () : d(0) {}
+ char d;
+};
+
+int main() {
+ Sub sub;
+ char base_alias[sizeof (Base)];
+ Base *base;
+
+ for (unsigned ix = sizeof base_alias; ix--;)
+ base_alias[ix] = 0x55;
+ base = new (&base_alias) Base ();
+
+ static_cast <Base &> (sub) = *base;
+ return sub.d;
+}
diff --git a/gcc/testsuite/g++.dg/expr/sizeof1.C b/gcc/testsuite/g++.dg/expr/sizeof1.C
new file mode 100644
index 00000000000..fa84481fabf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/expr/sizeof1.C
@@ -0,0 +1,7 @@
+// PR c++/12989
+
+struct A
+{
+ int foo() { return sizeof(bar); } // { dg-error "" }
+ int bar();
+};
diff --git a/gcc/testsuite/g++.dg/ext/attrib10.C b/gcc/testsuite/g++.dg/ext/attrib10.C
new file mode 100644
index 00000000000..6d04cb855b7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/attrib10.C
@@ -0,0 +1,7 @@
+// PR c++/12795
+
+void foo()
+{
+ extern void bar () __attribute__ ((__alias__ ("BAR")));
+ bar ();
+}
diff --git a/gcc/testsuite/g++.dg/ext/attrib11.C b/gcc/testsuite/g++.dg/ext/attrib11.C
new file mode 100644
index 00000000000..26bc7907c2e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/attrib11.C
@@ -0,0 +1,17 @@
+// { dg-do compile }
+// { dg-options "-Wall" }
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 30 Dec 2003 <nathan@codesourcery.com>
+
+
+// PR c++/13507, spurious warning due to attribute clobbering
+extern "C" {
+ extern int printf (__const char *__restrict __format, ...) throw ();
+ extern int scanf (__const char *__restrict __format, ...) throw ();
+}
+
+void foo(unsigned int x)
+{
+ printf ("%d\n", x);
+}
diff --git a/gcc/testsuite/g++.dg/ext/attrib9.C b/gcc/testsuite/g++.dg/ext/attrib9.C
new file mode 100644
index 00000000000..ee6fdb1d375
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/attrib9.C
@@ -0,0 +1,5 @@
+class __attribute__((unused)) C;
+struct __attribute__((unused)) S;
+union __attribute__((unused)) U;
+enum e {};
+enum __attribute__((unused)) e;
diff --git a/gcc/testsuite/g++.dg/ext/visibility-1.C b/gcc/testsuite/g++.dg/ext/visibility-1.C
new file mode 100644
index 00000000000..d579eb27206
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/visibility-1.C
@@ -0,0 +1,8 @@
+/* Test visibility attribute on function definition. */
+/* { dg-do compile { target *86-*-linux* } } */
+/* { dg-final { scan-assembler "\\.hidden.*_Z3foov" } } */
+
+void
+__attribute__((visibility ("hidden")))
+foo()
+{ }
diff --git a/gcc/testsuite/g++.dg/ext/visibility-2.C b/gcc/testsuite/g++.dg/ext/visibility-2.C
new file mode 100644
index 00000000000..89e853c4dc5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/visibility-2.C
@@ -0,0 +1,7 @@
+/* Test that visibility attribute on declaration extends to definition. */
+/* { dg-do compile { target *86-*-linux* } } */
+/* { dg-final { scan-assembler "\\.hidden.*_Z3foov" } } */
+
+void __attribute__((visibility ("hidden"))) foo();
+
+void foo() { }
diff --git a/gcc/testsuite/g++.dg/ext/visibility-3.C b/gcc/testsuite/g++.dg/ext/visibility-3.C
new file mode 100644
index 00000000000..d0cc8912efb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/visibility-3.C
@@ -0,0 +1,7 @@
+/* Test visibility attribute on forward declaration of global variable */
+/* { dg-do compile { target *86-*-linux* } } */
+/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */
+
+int
+__attribute__((visibility ("hidden")))
+xyzzy = 5;
diff --git a/gcc/testsuite/g++.dg/ext/visibility-4.C b/gcc/testsuite/g++.dg/ext/visibility-4.C
new file mode 100644
index 00000000000..d217bc9ec5d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/visibility-4.C
@@ -0,0 +1,8 @@
+/* Test visibility attribute on forward declaration of global variable */
+/* { dg-do compile { target *86-*-linux* } } */
+/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */
+
+extern int __attribute__ ((visibility ("hidden")))
+xyzzy;
+
+int xyzzy = 5;
diff --git a/gcc/testsuite/g++.dg/ext/visibility-5.C b/gcc/testsuite/g++.dg/ext/visibility-5.C
new file mode 100644
index 00000000000..9cdc8021e47
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/visibility-5.C
@@ -0,0 +1,11 @@
+/* Test visibility attribute on definition of a function that has
+ already had a forward declaration. */
+/* { dg-do compile { target *86-*-linux* } } */
+/* { dg-final { scan-assembler "\\.hidden.*_Z3foov" } } */
+
+void foo();
+
+void
+ __attribute__((visibility ("hidden")))
+foo()
+{ }
diff --git a/gcc/testsuite/g++.dg/ext/visibility-6.C b/gcc/testsuite/g++.dg/ext/visibility-6.C
new file mode 100644
index 00000000000..6e8f0ce1135
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/visibility-6.C
@@ -0,0 +1,10 @@
+/* Test visibility attribute on definition of global variable that has
+ already had a forward declaration. */
+/* { dg-do compile { target *86-*-linux* } } */
+/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */
+
+extern int xyzzy;
+
+int
+__attribute__((visibility ("hidden")))
+xyzzy = 5;
diff --git a/gcc/testsuite/g++.dg/ext/visibility-7.C b/gcc/testsuite/g++.dg/ext/visibility-7.C
new file mode 100644
index 00000000000..40acb72463f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/visibility-7.C
@@ -0,0 +1,11 @@
+/* Test warning from conflicting visibility specifications. */
+/* { dg-do compile { target *86-*-linux* } } */
+/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */
+
+extern int
+__attribute__((visibility ("hidden")))
+xyzzy; /* { dg-warning "previous declaration here" "" } */
+
+int
+__attribute__((visibility ("protected")))
+xyzzy = 5; /* { dg-warning "visibility attribute ignored" "" } */
diff --git a/gcc/testsuite/g++.dg/inherit/operator2.C b/gcc/testsuite/g++.dg/inherit/operator2.C
new file mode 100644
index 00000000000..09407e1b489
--- /dev/null
+++ b/gcc/testsuite/g++.dg/inherit/operator2.C
@@ -0,0 +1,22 @@
+typedef int INT_TYPEDEF;
+
+template<class T>
+class TypedIfc
+{
+public:
+ virtual ~TypedIfc() { }
+ virtual operator const T&() const = 0;
+ virtual const T& operator= (const T& t) = 0;
+};
+
+template<class Tnative>
+class NullIfc : public TypedIfc<Tnative>
+{
+public:
+ const Tnative& operator= (const Tnative& t) { return t; }
+ operator const Tnative&() const { return *(Tnative *)0; }
+};
+
+typedef TypedIfc<INT_TYPEDEF> INT_TYPEDEFIfc;
+
+NullIfc<int> i32;
diff --git a/gcc/testsuite/g++.dg/init/array12.C b/gcc/testsuite/g++.dg/init/array12.C
new file mode 100644
index 00000000000..3bb48002967
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/array12.C
@@ -0,0 +1,28 @@
+// PR c++/12253
+// Bug: We were failing to destroy the temporary A passed to the
+// constructor for b[0] before going on to construct b[1].
+
+// { dg-do run }
+
+extern "C" int printf (const char *, ...);
+
+int c;
+int r;
+
+struct A
+{
+ A() { printf ("A()\n"); if (c++) r = 1; }
+ A(const A&) { printf ("A(const A&)\n"); ++c; }
+ ~A() { printf ("~A()\n"); --c; }
+};
+
+struct B
+{
+ B(int, const A& = A()) { printf ("B()\n"); }
+};
+
+int main()
+{
+ B b[] = { 0, 0 };
+ return r;
+}
diff --git a/gcc/testsuite/g++.dg/init/assign1.C b/gcc/testsuite/g++.dg/init/assign1.C
new file mode 100644
index 00000000000..690a481910a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/assign1.C
@@ -0,0 +1,30 @@
+// PR c++/13009
+// { dg-do run }
+
+struct A {
+ char a;
+};
+
+struct B: public virtual A {
+ #if 0 // this piece of code works around the problem
+ B& operator= (const B& other)
+ {
+ A::operator= (other);
+ }
+ #endif
+};
+
+struct C: public B {
+ char c;
+};
+
+int main() {
+ B b;
+ b.a = 'b';
+ C c;
+ c.a = c.c = 'c';
+
+ c.B::operator= (b);
+ if (c.a != 'b' || c.c != 'c')
+ return 1;
+}
diff --git a/gcc/testsuite/g++.dg/init/bitfield2.C b/gcc/testsuite/g++.dg/init/bitfield2.C
new file mode 100644
index 00000000000..e54b2e423fb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/bitfield2.C
@@ -0,0 +1,33 @@
+// PR c++/13371
+// Bug: We were failing to properly protect the lhs on the line marked
+// "here" from multiple evaluation.
+
+// { dg-do run }
+
+extern "C" int printf (const char *, ...);
+
+enum E { E1, E2 };
+
+struct A
+{
+ E e : 8;
+ unsigned char c;
+};
+
+A ar[2];
+
+int c;
+
+int f()
+{
+ ++c;
+ printf ("f()\n");
+ return 0;
+}
+
+int main()
+{
+ ar[0].c = 0xff;
+ ar[f()].e = E1; // here
+ return (c != 1 || ar[0].c != 0xff);
+}
diff --git a/gcc/testsuite/g++.dg/init/error1.C b/gcc/testsuite/g++.dg/init/error1.C
new file mode 100644
index 00000000000..e930fc75c5e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/error1.C
@@ -0,0 +1,7 @@
+// PR c++/12696
+
+struct A {
+ static float b[10]; // { dg-error "" }
+}
+
+float A::b[] = {1,2,3}; // { dg-error "" }
diff --git a/gcc/testsuite/g++.dg/init/pm3.C b/gcc/testsuite/g++.dg/init/pm3.C
new file mode 100644
index 00000000000..980790db346
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/pm3.C
@@ -0,0 +1,10 @@
+// PR c++/12218
+// { dg-do run }
+
+struct C { int i, j; };
+typedef int C::*mPtr;
+extern const mPtr should_be_0 = &C::i;
+extern const mPtr should_be_4 = &C::j;
+
+int main () {
+}
diff --git a/gcc/testsuite/g++.dg/lookup/java1.C b/gcc/testsuite/g++.dg/lookup/java1.C
new file mode 100644
index 00000000000..4b740085afb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lookup/java1.C
@@ -0,0 +1,68 @@
+// { dg-do compile }
+// { dg-options "-fdollars-in-identifiers" }
+// Origin: Giovanni Bajo <giovannibajo at libero dot it>
+// Make sure that Java special functions can be called correctly.
+
+extern "Java"
+{
+ typedef __java_int jint;
+ namespace java
+ {
+ namespace lang
+ {
+ class Class;
+ class Object;
+ class Throwable {};
+ class Foo;
+ }
+ }
+}
+
+typedef struct java::lang::Object* jobject;
+typedef struct java::lang::Throwable* jthrowable;
+typedef class java::lang::Class* jclass;
+using java::lang::Foo;
+
+class Foo : public java::lang::Throwable
+{
+public:
+ static ::java::lang::Class class$;
+};
+
+
+/*
+ * Step 1: no declarations. A declaration for _Jv_Throw is created.
+ */
+
+void Bar1(void)
+{
+ Foo* f = new java::lang::Foo; // { dg-error "call to Java constructor" }
+ throw (f);
+}
+
+
+/*
+ * Step 2: constructor declaration
+ */
+
+extern "C" jobject _Jv_AllocObject (jclass, jint) __attribute__((__malloc__));
+
+void Bar2(void)
+{
+ Foo* f = new java::lang::Foo;
+ throw (f);
+}
+
+
+/*
+ * Step 3: overloads
+ */
+
+jobject _Jv_AllocObject (jclass, jint, float) __attribute__((__malloc__));
+void _Jv_Throw (int, float) __attribute__ ((__noreturn__));
+
+void Bar3(void)
+{
+ Foo* f = new java::lang::Foo; // { dg-error "should never be overloaded" }
+ throw (f); // { dg-error "should never be overloaded" }
+}
diff --git a/gcc/testsuite/g++.dg/lookup/java2.C b/gcc/testsuite/g++.dg/lookup/java2.C
new file mode 100644
index 00000000000..a779bf64dd9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lookup/java2.C
@@ -0,0 +1,47 @@
+// { dg-do compile }
+// { dg-options "-fdollars-in-identifiers" }
+// Origin: Giovanni Bajo <giovannibajo at libero dot it>
+// Make sure that Java special functions can be called correctly.
+// (continue from java1.C)
+
+extern "Java"
+{
+ typedef __java_int jint;
+ namespace java
+ {
+ namespace lang
+ {
+ class Class;
+ class Object;
+ class Throwable {};
+ class Foo;
+ }
+ }
+}
+
+typedef struct java::lang::Object* jobject;
+typedef struct java::lang::Throwable* jthrowable;
+typedef class java::lang::Class* jclass;
+using java::lang::Foo;
+
+class Foo : public java::lang::Throwable
+{
+public:
+ static ::java::lang::Class class$;
+};
+
+/*
+ * Step 4: Manual declaration of _Jv_Throw
+ * This is the last case we need to test. In the other file we're testing
+ * the compiler is able to generate an artifical declaration for this
+ * function, so we need to test here if it works with a normal declaration.
+ */
+
+extern "C" jobject _Jv_AllocObject (jclass, jint) __attribute__((__malloc__));
+extern "C" void _Jv_Throw (jthrowable) __attribute__ ((__noreturn__));
+
+void Bar4(void)
+{
+ Foo* f = new java::lang::Foo;
+ throw (f);
+}
diff --git a/gcc/testsuite/g++.dg/lookup/ns1.C b/gcc/testsuite/g++.dg/lookup/ns1.C
new file mode 100644
index 00000000000..feeaf751cad
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lookup/ns1.C
@@ -0,0 +1,22 @@
+// PR c++/12862
+
+typedef int Thingo;
+
+namespace A
+{
+ void
+ Thingo();
+}
+
+void
+A::Thingo()
+{
+ ;
+}
+
+int
+main()
+{
+ A::Thingo();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/opt/expect1.C b/gcc/testsuite/g++.dg/opt/expect1.C
new file mode 100644
index 00000000000..90a871f377a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/expect1.C
@@ -0,0 +1,17 @@
+// PR c++/13239
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C" void abort (void);
+
+struct Y {
+ int i;
+};
+
+bool foo () { return true; }
+Y bar () { Y y = {0}; return y; }
+
+int main ()
+{
+ __builtin_expect (foo () && (bar ().i) == 0, 0) ? 0 : (abort (), 1);
+}
diff --git a/gcc/testsuite/g++.dg/opt/inline6.C b/gcc/testsuite/g++.dg/opt/inline6.C
new file mode 100644
index 00000000000..21872210558
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/inline6.C
@@ -0,0 +1,14 @@
+// PR c++/13081
+// { dg-options "-O2" }
+// { dg-final { scan-assembler-not "foo" } }
+
+template<typename T> T foo(T);
+
+template<typename T> inline T foo(T t)
+{
+ return t;
+}
+
+void bar (long& l) {
+ l = foo(l);
+}
diff --git a/gcc/testsuite/g++.dg/opt/noreturn-1.C b/gcc/testsuite/g++.dg/opt/noreturn-1.C
new file mode 100644
index 00000000000..9b2fc0cf16a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/noreturn-1.C
@@ -0,0 +1,87 @@
+// PR optimization/12965
+// Origin: <qboosh@pld-linux.org>
+// Reduced testcase: Falk Hueffner <falk@debian.org>
+
+// This ICEd on Alpha because the reload pass emitted save/restore
+// insns around a no-return call.
+
+// { dg-do compile }
+// { dg-options "-O2" }
+
+template <typename _Alloc> class allocator;
+template <class _CharT> struct char_traits;
+template <typename _CharT,
+ typename _Traits = char_traits<_CharT>,
+ typename _Alloc = allocator<_CharT> >
+class basic_string;
+typedef basic_string<char> string;
+
+static inline int __exchange_and_add(volatile int * __mem, int __val) {
+ int __result;
+ asm("" : "=&r"(__result));
+ return __result;
+}
+
+template<typename _Tp> struct allocator {
+ allocator() throw() { }
+ allocator(const allocator &) throw() {}
+};
+
+template<typename _CharT, typename _Traits, typename _Alloc>
+struct basic_string {
+ typedef _Alloc allocator_type;
+ struct _Rep {
+ int _M_references;
+ void _M_dispose(const _Alloc & __a) {
+ if (__exchange_and_add(&_M_references, -1) <= 0)
+ _M_destroy(__a);
+ } void _M_destroy(const _Alloc &) throw();
+ };
+ struct _Alloc_hider : _Alloc {
+ _CharT *_M_p;
+ };
+ mutable _Alloc_hider _M_dataplus;
+ _CharT *_M_data() const { return _M_dataplus._M_p; }
+ _Rep *_M_rep() const {
+ return &((reinterpret_cast<_Rep *>(_M_data()))[-1]);
+ }
+ basic_string();
+ basic_string(const _CharT * __s, const _Alloc & __a = _Alloc());
+ ~basic_string() {
+ _M_rep()->_M_dispose(this->get_allocator());
+ }
+ allocator_type get_allocator() const { return _M_dataplus; }
+};
+
+struct Egeneric {
+ void stack(const string & passage, const string & message = "") { }
+};
+
+struct infinint {
+ void detruit() throw(Egeneric);
+ template<class T> void infinint_from(T a) throw(Egeneric);
+ infinint(long a = 0) throw(Egeneric) {
+ try {
+ infinint_from(a);
+ } catch(Egeneric& e) {
+ e.stack("infinint::infinint", "long");
+ }
+ }
+ ~infinint() throw(Egeneric) {
+ try {
+ detruit();
+ } catch(Egeneric& e) { }
+ }
+};
+
+struct inode {
+ string x;
+ infinint a, c;
+ infinint ea_offset;
+ inode();
+};
+
+inode::inode()
+{
+ ea_offset = 0;
+}
diff --git a/gcc/testsuite/g++.dg/other/java1.C b/gcc/testsuite/g++.dg/other/java1.C
new file mode 100644
index 00000000000..38b5e0c3070
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/java1.C
@@ -0,0 +1,22 @@
+// { dg-options "-w -ansi -pedantic" }
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 23 Oct 2003 <nathan@codesourcery.com>
+
+extern "Java" {
+ class One
+ {
+ ~One (); // { dg-error "cannot have a destructor" "" }
+ One ();
+ };
+
+ class Two {};
+
+ class Three : One {}; // { dg-error "cannot have an implicit" "" }
+
+ class Four : Two {};
+
+ class Five : Two, Four {}; // { dg-error "cannot have multiple bases" "" }
+
+ class Six : virtual Two {}; // { dg-error "cannot have virtual base" "" }
+}
diff --git a/gcc/testsuite/g++.dg/other/stdarg2.C b/gcc/testsuite/g++.dg/other/stdarg2.C
new file mode 100644
index 00000000000..99e904013f1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/stdarg2.C
@@ -0,0 +1,12 @@
+// PR c++/11929
+// Bug: We were complaining about the call to va_start because o is of
+// non-POD type.
+
+struct s {
+ s(int);
+};
+
+void test(s o, ...) {
+ __builtin_va_list varg;
+ __builtin_va_start(varg, o);
+}
diff --git a/gcc/testsuite/g++.dg/other/struct-va_list.C b/gcc/testsuite/g++.dg/other/struct-va_list.C
new file mode 100644
index 00000000000..769b909ff46
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/struct-va_list.C
@@ -0,0 +1,8 @@
+// { dg-do compile }
+// PR target/13302
+
+#include <stdarg.h>
+
+struct NumArgState{
+ va_list ap;
+};
diff --git a/gcc/testsuite/g++.dg/parse/defarg6.C b/gcc/testsuite/g++.dg/parse/defarg6.C
new file mode 100644
index 00000000000..827b605b77e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/defarg6.C
@@ -0,0 +1,11 @@
+// { dg-do compile }
+
+// Origin: Falk Hueffner <falk@debian.org>
+
+// PR c++/13166: ICE default function argument for friend declaration.
+
+namespace sc_dt {
+ class sc_length_param {
+ friend int compare_unsigned(int if_v_signed = 0) {}
+ };
+}
diff --git a/gcc/testsuite/g++.dg/parse/error3.C b/gcc/testsuite/g++.dg/parse/error3.C
new file mode 100644
index 00000000000..a052346d8ca
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/error3.C
@@ -0,0 +1,6 @@
+// PR c++/10779
+
+static void InstantiateConstraint(const float&, unsigned,
+ void(*AddFunction)(const TYPE&,bool&, // { dg-error "" }
+ char*, char*,
+ unsigned*)); // { dg-error "" }
diff --git a/gcc/testsuite/g++.dg/parse/error4.C b/gcc/testsuite/g++.dg/parse/error4.C
new file mode 100644
index 00000000000..511209d9ab9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/error4.C
@@ -0,0 +1,7 @@
+// PR c++/12160
+
+struct X {
+ virtual void f(int,
+ itn, // { dg-error "declared" }
+ int); // { dg-error "" }
+};
diff --git a/gcc/testsuite/g++.dg/parse/error5.C b/gcc/testsuite/g++.dg/parse/error5.C
new file mode 100644
index 00000000000..81356ced1b0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/error5.C
@@ -0,0 +1,4 @@
+// PR c++/13269
+
+class Foo { int foo() return 0; } }; // { dg-error "" }
+
diff --git a/gcc/testsuite/g++.dg/parse/error6.C b/gcc/testsuite/g++.dg/parse/error6.C
new file mode 100644
index 00000000000..3a1666995eb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/error6.C
@@ -0,0 +1,6 @@
+// PR c++/10603
+
+int f(int not) { // { dg-error "!" }
+ return 1-not; // { dg-error "" }
+}
+
diff --git a/gcc/testsuite/g++.dg/parse/error7.C b/gcc/testsuite/g++.dg/parse/error7.C
new file mode 100644
index 00000000000..50e7f84dca5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/error7.C
@@ -0,0 +1,4 @@
+// PR c++/12827
+
+void f(int x
+ int y); // { dg-error "," }
diff --git a/gcc/testsuite/g++.dg/parse/error8.C b/gcc/testsuite/g++.dg/parse/error8.C
new file mode 100644
index 00000000000..125f2e42c6b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/error8.C
@@ -0,0 +1,4 @@
+// PR c++/13438
+
+struct A { friend typename struct B; }; // { dg-error "" }
+
diff --git a/gcc/testsuite/g++.dg/parse/error9.C b/gcc/testsuite/g++.dg/parse/error9.C
new file mode 100644
index 00000000000..aa9109fd22b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/error9.C
@@ -0,0 +1,5 @@
+// PR c++/12613
+// { dg-options "" }
+
+enum { FOO = 1, BAR = 2 };
+int a[] = { FOO: 1, BAR: 2 }; // { dg-error "" }
diff --git a/gcc/testsuite/g++.dg/parse/explicit1.C b/gcc/testsuite/g++.dg/parse/explicit1.C
new file mode 100644
index 00000000000..ced2adc3dc0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/explicit1.C
@@ -0,0 +1,11 @@
+// { dg-do compile }
+
+// Origin: stefaandr@hotmail.com
+
+// PR c++/12403: ICE when explicit specialization is not in
+// namespace scope.
+
+struct foo {
+ template<typename T> void bar (T &t) {}
+ template<> void bar<double>(double &t) {} // { dg-error "explicit|non-namespace|member" }
+};
diff --git a/gcc/testsuite/g++.dg/parse/nontype1.C b/gcc/testsuite/g++.dg/parse/nontype1.C
new file mode 100644
index 00000000000..e721700af50
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/nontype1.C
@@ -0,0 +1,9 @@
+// Copyright (C) 2003 Free Software Foundation
+// Contributed by Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+// { dg-do compile }
+
+// PR c++/13289: Incorrectly reject non-type template argument that has
+// dependent type
+
+template <class T, T t> class C {};
+template <class T, T t> class D { C<T, t-1> c; };
diff --git a/gcc/testsuite/g++.dg/parse/offsetof1.C b/gcc/testsuite/g++.dg/parse/offsetof1.C
new file mode 100644
index 00000000000..ae9d3110aba
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/offsetof1.C
@@ -0,0 +1,11 @@
+#include <stddef.h>
+
+template <bool> struct StaticAssert;
+template <> struct StaticAssert<true> {};
+
+struct MyPOD
+{
+ int a; int b; int c;
+};
+
+StaticAssert<(offsetof(MyPOD, a) == 0)> s;
diff --git a/gcc/testsuite/g++.dg/parse/offsetof2.C b/gcc/testsuite/g++.dg/parse/offsetof2.C
new file mode 100644
index 00000000000..4552d39fea2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/offsetof2.C
@@ -0,0 +1,12 @@
+#include <cstddef>
+
+struct choke_me
+{
+ int size;
+ char storage[1];
+};
+
+struct offset_is_broken
+{
+ static const int offset = offsetof(choke_me, storage);
+};
diff --git a/gcc/testsuite/g++.dg/parse/semicolon1.C b/gcc/testsuite/g++.dg/parse/semicolon1.C
new file mode 100644
index 00000000000..22c1e86e2cf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/semicolon1.C
@@ -0,0 +1,4 @@
+// PR c++/12479
+// { dg-options "-pedantic" }
+
+#include "semicolon1.h"
diff --git a/gcc/testsuite/g++.dg/parse/semicolon1.h b/gcc/testsuite/g++.dg/parse/semicolon1.h
new file mode 100644
index 00000000000..0487fc7838c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/semicolon1.h
@@ -0,0 +1,2 @@
+#pragma GCC system_header
+;
diff --git a/gcc/testsuite/g++.dg/template/access13.C b/gcc/testsuite/g++.dg/template/access13.C
new file mode 100644
index 00000000000..3a1442bb0e2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/access13.C
@@ -0,0 +1,16 @@
+// { dg-do compile }
+
+// Origin: Francesco Monica <fmonica@ce.unipr.it>
+
+// PR c++/13262: Access checking during instantiation of static data
+// member.
+
+template <typename T> class Aclass {
+ private:
+ Aclass() {}
+ static Aclass instance;
+};
+
+template <typename T> Aclass<T> Aclass<T>::instance;
+
+template class Aclass<int>;
diff --git a/gcc/testsuite/g++.dg/template/array1-1.C b/gcc/testsuite/g++.dg/template/array1-1.C
new file mode 100644
index 00000000000..97fe7cde25d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/array1-1.C
@@ -0,0 +1,32 @@
+// { dg-do compile }
+// { dg-options "-fabi-version=1" }
+
+// Contributed by Nathan Sidwell 22 Dec 2003 <nathan@codesourcery.com>
+// Origin: Roger Sayle <roger@eyesopen.com>
+
+// PR c++/12774 Array domains compared unequal
+
+void Foo(double r[3][3])
+{
+}
+
+void Baz()
+{
+ double m[3][3];
+ Foo(m);
+}
+
+template <class T>
+void Bar()
+{
+ double m[3][3];
+ Foo(m);
+}
+
+int main()
+{
+ Baz();
+ Bar<int>();
+ return 0;
+}
+
diff --git a/gcc/testsuite/g++.dg/template/array1-2.C b/gcc/testsuite/g++.dg/template/array1-2.C
new file mode 100644
index 00000000000..7214517b3c6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/array1-2.C
@@ -0,0 +1,32 @@
+// { dg-do compile }
+// { dg-options "-fabi-version=2" }
+
+// Contributed by Nathan Sidwell 22 Dec 2003 <nathan@codesourcery.com>
+// Origin: Roger Sayle <roger@eyesopen.com>
+
+// PR c++/12774 Array domains compared unequal
+
+void Foo(double r[3][3])
+{
+}
+
+void Baz()
+{
+ double m[3][3];
+ Foo(m);
+}
+
+template <class T>
+void Bar()
+{
+ double m[3][3];
+ Foo(m);
+}
+
+int main()
+{
+ Baz();
+ Bar<int>();
+ return 0;
+}
+
diff --git a/gcc/testsuite/g++.dg/template/array2-1.C b/gcc/testsuite/g++.dg/template/array2-1.C
new file mode 100644
index 00000000000..2980a1fd186
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/array2-1.C
@@ -0,0 +1,14 @@
+// { dg-do compile }
+// { dg-options "-fabi-version=1" }
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 29 Dec 2003 <nathan@codesourcery.com>
+
+// PR c++/13494. ICE
+
+template<typename T>
+int foo(int d[][4])
+{
+ return d[0][0];
+}
+
diff --git a/gcc/testsuite/g++.dg/template/array2-2.C b/gcc/testsuite/g++.dg/template/array2-2.C
new file mode 100644
index 00000000000..dd3e7f0e265
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/array2-2.C
@@ -0,0 +1,14 @@
+// { dg-do compile }
+// { dg-options "-fabi-version=2" }
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 29 Dec 2003 <nathan@codesourcery.com>
+
+// PR c++/13494. ICE
+
+template<typename T>
+int foo(int d[][4])
+{
+ return d[0][0];
+}
+
diff --git a/gcc/testsuite/g++.dg/template/crash14.C b/gcc/testsuite/g++.dg/template/crash14.C
new file mode 100644
index 00000000000..7b3af045fa9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/crash14.C
@@ -0,0 +1,3 @@
+template <int T> class foo { public: foo() { } class Z { };};
+template <int I[2]> void dep7(foo<I[0]> *) { } // { dg-error "" }
+
diff --git a/gcc/testsuite/g++.dg/template/crash15.C b/gcc/testsuite/g++.dg/template/crash15.C
new file mode 100644
index 00000000000..e0aad73c73e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/crash15.C
@@ -0,0 +1,9 @@
+// PR c++/13310
+
+struct A {};
+
+template <typename> void foo()
+{
+ A a;
+ a.foo<int>(); // { dg-error "" }
+}
diff --git a/gcc/testsuite/g++.dg/template/crash16.C b/gcc/testsuite/g++.dg/template/crash16.C
new file mode 100644
index 00000000000..f80dd10644c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/crash16.C
@@ -0,0 +1,21 @@
+// { dg-do compile }
+
+// Origin: Alexander Stippler <stip@mathematik.uni-ulm.de>
+// PR c++/10079
+
+template <bool> struct A {};
+
+template <typename> struct B
+{
+ enum { e };
+};
+
+template <typename T> A<(B<T>::e && 0)> foo(T) {}
+
+template <typename T> void foo(B<T>) {}
+
+void bar()
+{
+ B<int> b;
+ foo(b);
+}
diff --git a/gcc/testsuite/g++.dg/template/dependent-expr3.C b/gcc/testsuite/g++.dg/template/dependent-expr3.C
new file mode 100644
index 00000000000..2e8b805ead8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/dependent-expr3.C
@@ -0,0 +1,14 @@
+// { dg-do compile }
+// Origin: jbrandmeyer at users dot sourceforge dot net
+// PR c++/12573: COMPONENT_REFs must be inspected for dependness.
+
+template <bool> struct S;
+
+template <typename K> struct Y : K {
+ int x;
+};
+
+template <class T> struct Z {
+ S< (bool)(&static_cast<Y<T> *>(0)->x == 0) > // { dg-error "" }
+ s; // { dg-error "" }
+};
diff --git a/gcc/testsuite/g++.dg/template/eh1.C b/gcc/testsuite/g++.dg/template/eh1.C
new file mode 100644
index 00000000000..134a0e7a665
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/eh1.C
@@ -0,0 +1,6 @@
+template <class T>
+void foo()
+{
+ try {}
+ catch(T e) {}
+}
diff --git a/gcc/testsuite/g++.dg/template/error10.C b/gcc/testsuite/g++.dg/template/error10.C
new file mode 100644
index 00000000000..a25c4bbddb9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/error10.C
@@ -0,0 +1,70 @@
+// { dg-do compile }
+// Origin: <tilps at hotmail dot com>
+// c++/9154: poor error message for ">>" vs "> >" in template argument list
+
+
+/*
+ * Test that the error message is issued properly
+ */
+template <class T>
+class A {};
+
+A<A<int>> blah; // { dg-error "should be `> >' within" }
+A<int>> blah2; // { dg-error "spurious `>>'" }
+
+
+/*
+ * Test that a few valid constructs containing a ">>" token in a
+ * template argument list are handled correctly.
+ */
+template <int N>
+void B(void) {}
+
+int Btest()
+{
+ B<256 >> 4>();
+}
+
+template <int N = 123>>4>
+struct C {};
+
+template <int> struct D {};
+template <typename> struct E {};
+
+E<D< 1>>2 > > E1;
+
+const int x = 0;
+E<D< 1>>x > > E2;
+
+template <int> struct F {
+ typedef int I;
+};
+
+template <typename T = F< 1>>2 >::I>
+struct G {};
+
+/*
+ * In this special case, a valid type-id (H() is a function type) is followed
+ * by '>>', but the argument should still be parsed as an expression, which
+ * will then be rejected as non-constant expression.
+ */
+struct H
+{
+ int operator >>(int);
+};
+
+template <int V> struct L {};
+L<H() >> 5> l; // { dg-error "" "non-constant" }
+
+
+/*
+ * This case used to not emit the nice error message because of a typo
+ * in the code.
+ */
+template <void (*)(void)>
+struct K {};
+
+void KFunc(void);
+
+A<K<&KFunc>> k1; // { dg-error "should be `> >' within" }
+K<&KFunc>> k2; // { dg-error "spurious `>>'" }
diff --git a/gcc/testsuite/g++.dg/template/error5.C b/gcc/testsuite/g++.dg/template/error5.C
new file mode 100644
index 00000000000..0c793509da4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/error5.C
@@ -0,0 +1,6 @@
+template <typename T>
+struct X<T*> { // { dg-error "not a template" }
+ typedef int Y;
+};
+
+extern struct Z<int> s; // { dg-error "not a template" }
diff --git a/gcc/testsuite/g++.dg/template/error6.C b/gcc/testsuite/g++.dg/template/error6.C
new file mode 100644
index 00000000000..7560dcfb51f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/error6.C
@@ -0,0 +1,13 @@
+template<int n>
+struct tento {
+ enum {value = 10*tento<n-1>::value};
+};
+
+struct tento<0> { // { dg-error "" }
+ enum {value=1};
+};
+
+int main() {
+ if (tento<4>::value != 10000) return -1;
+}
+
diff --git a/gcc/testsuite/g++.dg/template/error7.C b/gcc/testsuite/g++.dg/template/error7.C
new file mode 100644
index 00000000000..3c1a0e1f21b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/error7.C
@@ -0,0 +1,6 @@
+// PR c++/13314
+// { dg-options "-O2" }
+
+struct A { template <int> struct B; };
+struct A::B {}; // { dg-error "" }
+A::B<0> b; // { dg-error "" }
diff --git a/gcc/testsuite/g++.dg/template/error8.C b/gcc/testsuite/g++.dg/template/error8.C
new file mode 100644
index 00000000000..30872a2e953
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/error8.C
@@ -0,0 +1,7 @@
+// PR c++/11116
+
+template <typename T> struct S {};
+
+void f() {
+ throw S (); // { dg-error "template" }
+}
diff --git a/gcc/testsuite/g++.dg/template/error9.C b/gcc/testsuite/g++.dg/template/error9.C
new file mode 100644
index 00000000000..60f550a7ca6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/error9.C
@@ -0,0 +1,7 @@
+// PR c++/10926
+
+struct Foo
+{
+ template <int i>
+ ~Foo(); // { dg-error "" }
+};
diff --git a/gcc/testsuite/g++.dg/template/lookup3.C b/gcc/testsuite/g++.dg/template/lookup3.C
new file mode 100644
index 00000000000..c96a0b0b981
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/lookup3.C
@@ -0,0 +1,16 @@
+// PR c++/12397
+
+struct foo { };
+
+template <typename T> struct bar
+{
+ bar(){}
+ int i;
+ bar (const bar<T>& foo) : i (foo.i) {}
+};
+
+int main()
+{
+ bar<int> b1;
+ bar<int> b2(b1);
+}
diff --git a/gcc/testsuite/g++.dg/template/nontype3.C b/gcc/testsuite/g++.dg/template/nontype3.C
new file mode 100644
index 00000000000..15a204fa6e4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/nontype3.C
@@ -0,0 +1,37 @@
+// { dg-do compile }
+// Origin: <drow at gcc dot gnu dot org>,
+// <giovannibajo at gcc dot gnu dot org>
+// c++/13243: Template parameters of non integral or enumeration type can't be
+// used for integral constant expressions. ADDR_EXPR and INDIRECT_REF are
+// invalid too.
+
+template <int T> class foo {};
+template <int *T> class bar {};
+
+template <int *PI>
+void dep5(bar<PI> *);
+
+template <int *PI>
+void dep6(bar<PI+1> *); // { dg-error "" "integral or enumeration" }
+
+template <int I>
+void dep7(bar<I+1> *);
+
+template <int *PI>
+void dep8(foo< *PI > *); // { dg-error "" "integral or enumeration" }
+
+template <int PI[1]>
+void dep9(foo< *PI > *); // { dg-error "" "integral or enumeration" }
+
+template <int PI[1]>
+void dep9a(foo< sizeof(*PI) > *);
+
+template <int PI[1]>
+void dep10(foo< PI[0] > *); // { dg-error "" "integral or enumeration" }
+
+template <int I>
+void dep11(foo< *&I > *); // { dg-error "" "constant-expression" }
+
+template <int I>
+void dep12(foo< (&I)[4] > *); // { dg-error "" "constant-expression" }
+
diff --git a/gcc/testsuite/g++.dg/template/ptrmem8.C b/gcc/testsuite/g++.dg/template/ptrmem8.C
new file mode 100644
index 00000000000..c0a1fa3a1ca
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/ptrmem8.C
@@ -0,0 +1,20 @@
+// { dg-do compile }
+// Origin: <marco dot franzen at bigfoot dot com>
+// PR c++/10126: Handle ptmf default conversions while matching a template
+// argument
+
+struct B
+{
+ int I () const;
+ int I ();
+};
+
+struct D : B {};
+
+template <int (D::*fun)() const> int Get();
+
+int main ()
+{
+ Get<&B::I>(); // { dg-error "no matching function" }
+ Get<&D::I>(); // { dg-error "no matching function" }
+}
diff --git a/gcc/testsuite/g++.dg/template/qualttp22.C b/gcc/testsuite/g++.dg/template/qualttp22.C
new file mode 100644
index 00000000000..21aa7568d90
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/qualttp22.C
@@ -0,0 +1,28 @@
+// { dg-do compile }
+
+// Origin: Philippe Van Deyck <hetadres@email.com>
+
+// PR c++/13520: Default template template argument that is a qualified id
+// with dependent scope.
+
+template<typename regular_type> class Policy {};
+
+template <typename regular_type, template<typename> class OriginalPolicy>
+class ChangedPolicy_impl {};
+
+template <template<typename> class OriginalPolicy > class ChangedPolicy {
+public:
+ template<typename regular_type> class Type : public
+ ChangedPolicy_impl<regular_type,OriginalPolicy> { };
+};
+
+template <typename regular_type, template<typename> class Policy1,
+ template<typename> class Policy2
+ = ChangedPolicy<Policy1>::template Type>
+class Host : public Policy1<regular_type>, public Policy2<regular_type> { };
+
+int main()
+{
+ Host<void, Policy> h;
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/template/recurse1.C b/gcc/testsuite/g++.dg/template/recurse1.C
new file mode 100644
index 00000000000..4789983affe
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/recurse1.C
@@ -0,0 +1,16 @@
+// PR c++/5050
+// Origin: georg.wild@gmx.de
+// Reduced by: tbagot@bluearc.com and Nathanael C. Nerode <neroden@twcny.rr.com>
+// Test for that excessive template recursion does not occur
+// because of optimization.
+// { dg-options "-ftemplate-depth-1 -O" }
+
+ struct ostream {
+ template<class T> ostream& foo( const T & )
+ { return *this; }
+ };
+
+ void foo() {
+ ostream os;
+ (os.foo(1)).foo(2);
+ }
diff --git a/gcc/testsuite/g++.dg/warn/ctor-init-1.C b/gcc/testsuite/g++.dg/warn/ctor-init-1.C
new file mode 100644
index 00000000000..0796972fcb5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/ctor-init-1.C
@@ -0,0 +1,9 @@
+// PR c++/11554
+// { dg-options "-Wall" }
+
+struct Y {
+ Y ();
+ int i1, i2; // { dg-warning "" }
+};
+
+Y::Y () : i2(0), i1(0) {} // { dg-warning "" }
diff --git a/gcc/testsuite/g++.dg/warn/format3.C b/gcc/testsuite/g++.dg/warn/format3.C
new file mode 100644
index 00000000000..0bdaaee1772
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/format3.C
@@ -0,0 +1,12 @@
+// PR c++/13070
+// { dg-do compile }
+// { dg-options "-Wformat" }
+
+extern "C" int printf (const char*, ...);
+
+int main()
+{
+ printf("%d\n", 1, 1); // { dg-warning "too many" "printf warning" }
+ return 0;
+}
+
diff --git a/gcc/testsuite/g++.dg/warn/noreturn-3.C b/gcc/testsuite/g++.dg/warn/noreturn-3.C
new file mode 100644
index 00000000000..828935c12ee
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/noreturn-3.C
@@ -0,0 +1,13 @@
+// { dg-do compile }
+// { dg-options "-Wall" }
+
+// Origin: stip@mathematik.uni-ulm.de
+// Andrew Pinski <pinskia@gcc.gnu.org>
+
+// PR c++/13106: No return warning when return type is a dependent type.
+
+template <typename T> T dummy() { }
+
+int main() {
+ dummy<void>();
+}