aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg
diff options
context:
space:
mode:
authorno-author <no-author@gcc.gnu.org>2003-09-28 06:11:05 +0000
committerno-author <no-author@gcc.gnu.org>2003-09-28 06:11:05 +0000
commitcd542c0881773f9784cc089f34dbaa0a9b5c29a2 (patch)
tree7bf5e0647ea90dc3d2714f5d8017896193fd20a2 /gcc/testsuite/g++.dg
parent5c20f3a5103831d9cddb0c5e07cd53eb7781e6aa (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@71874 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/g++.dg')
-rw-r--r--gcc/testsuite/g++.dg/abi/bitfield11.C14
-rw-r--r--gcc/testsuite/g++.dg/abi/bitfield12.C5
-rw-r--r--gcc/testsuite/g++.dg/abi/layout4.C18
-rw-r--r--gcc/testsuite/g++.dg/conversion/cond6.C18
-rw-r--r--gcc/testsuite/g++.dg/eh/delayslot1.C47
-rw-r--r--gcc/testsuite/g++.dg/expr/call1.C16
-rw-r--r--gcc/testsuite/g++.dg/expr/call2.C14
-rw-r--r--gcc/testsuite/g++.dg/expr/comma1.C21
-rw-r--r--gcc/testsuite/g++.dg/expr/cond3.C6
-rw-r--r--gcc/testsuite/g++.dg/expr/lval1.C7
-rw-r--r--gcc/testsuite/g++.dg/expr/static_cast4.C11
-rw-r--r--gcc/testsuite/g++.dg/expr/static_cast5.C17
-rw-r--r--gcc/testsuite/g++.dg/ext/altivec-1.C15
-rw-r--r--gcc/testsuite/g++.dg/ext/fnname1.C26
-rw-r--r--gcc/testsuite/g++.dg/ext/fnname2.C31
-rw-r--r--gcc/testsuite/g++.dg/ext/fnname3.C65
-rw-r--r--gcc/testsuite/g++.dg/ext/label1.C8
-rw-r--r--gcc/testsuite/g++.dg/ext/label2.C11
-rw-r--r--gcc/testsuite/g++.dg/inherit/conv1.C23
-rw-r--r--gcc/testsuite/g++.dg/init/array11.C28
-rw-r--r--gcc/testsuite/g++.dg/init/ref9.C36
-rw-r--r--gcc/testsuite/g++.dg/init/struct1.C6
-rw-r--r--gcc/testsuite/g++.dg/lookup/crash1.C31
-rw-r--r--gcc/testsuite/g++.dg/lookup/koenig2.C15
-rw-r--r--gcc/testsuite/g++.dg/lookup/scoped7.C20
-rw-r--r--gcc/testsuite/g++.dg/opt/cfg3.C61
-rw-r--r--gcc/testsuite/g++.dg/opt/enum1.C30
-rw-r--r--gcc/testsuite/g++.dg/opt/longbranch2.C62
-rw-r--r--gcc/testsuite/g++.dg/opt/ptrmem3.C23
-rw-r--r--gcc/testsuite/g++.dg/opt/reg-stack2.C34
-rw-r--r--gcc/testsuite/g++.dg/opt/static3.C35
-rw-r--r--gcc/testsuite/g++.dg/other/gc2.C38
-rw-r--r--gcc/testsuite/g++.dg/other/static1.C17
-rw-r--r--gcc/testsuite/g++.dg/overload/VLA.C16
-rw-r--r--gcc/testsuite/g++.dg/overload/addr1.C50
-rw-r--r--gcc/testsuite/g++.dg/overload/builtin3.C10
-rw-r--r--gcc/testsuite/g++.dg/overload/prom1.C9
-rw-r--r--gcc/testsuite/g++.dg/overload/template1.C12
-rw-r--r--gcc/testsuite/g++.dg/parse/access6.C24
-rw-r--r--gcc/testsuite/g++.dg/parse/access7.C13
-rw-r--r--gcc/testsuite/g++.dg/parse/crash12.C24
-rw-r--r--gcc/testsuite/g++.dg/parse/defarg5.C15
-rw-r--r--gcc/testsuite/g++.dg/parse/dtor2.C4
-rw-r--r--gcc/testsuite/g++.dg/parse/friend3.C10
-rw-r--r--gcc/testsuite/g++.dg/parse/template12.C10
-rw-r--r--gcc/testsuite/g++.dg/parse/using2.C8
-rw-r--r--gcc/testsuite/g++.dg/parse/using3.C22
-rw-r--r--gcc/testsuite/g++.dg/rtti/typeid2.C15
-rw-r--r--gcc/testsuite/g++.dg/rtti/typeid3.C11
-rw-r--r--gcc/testsuite/g++.dg/template/call1.C17
-rw-r--r--gcc/testsuite/g++.dg/template/class1.C9
-rw-r--r--gcc/testsuite/g++.dg/template/crash10.C27
-rw-r--r--gcc/testsuite/g++.dg/template/crash11.C9
-rw-r--r--gcc/testsuite/g++.dg/template/crash9.C12
-rw-r--r--gcc/testsuite/g++.dg/template/deduce2.C30
-rw-r--r--gcc/testsuite/g++.dg/template/friend22.C15
-rw-r--r--gcc/testsuite/g++.dg/template/friend23.C38
-rw-r--r--gcc/testsuite/g++.dg/template/friend24.C27
-rw-r--r--gcc/testsuite/g++.dg/template/memtmpl2.C15
-rw-r--r--gcc/testsuite/g++.dg/template/nested4.C10
-rw-r--r--gcc/testsuite/g++.dg/template/non-dependent4.C4
-rw-r--r--gcc/testsuite/g++.dg/template/qualified-id1.C26
-rw-r--r--gcc/testsuite/g++.dg/warn/Wunused-4.C30
-rw-r--r--gcc/testsuite/g++.dg/warn/noeffect4.C88
-rw-r--r--gcc/testsuite/g++.dg/warn/template-1.C15
65 files changed, 1434 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/abi/bitfield11.C b/gcc/testsuite/g++.dg/abi/bitfield11.C
new file mode 100644
index 00000000000..e78ea121d61
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/bitfield11.C
@@ -0,0 +1,14 @@
+// { dg-do run }
+// { dg-options "-w -fabi-version=0" }
+
+struct S {
+ char c : 1024;
+};
+
+S s;
+
+int main () {
+ s.c = 1;
+ if (*(char *)&s != 1)
+ return 1;
+}
diff --git a/gcc/testsuite/g++.dg/abi/bitfield12.C b/gcc/testsuite/g++.dg/abi/bitfield12.C
new file mode 100644
index 00000000000..6cfda5d47df
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/bitfield12.C
@@ -0,0 +1,5 @@
+// { dg-options "-Wabi -fabi-version=1" }
+
+struct S { // { dg-warning "ABI" }
+ char c : 1024; // { dg-warning "width" }
+};
diff --git a/gcc/testsuite/g++.dg/abi/layout4.C b/gcc/testsuite/g++.dg/abi/layout4.C
new file mode 100644
index 00000000000..a1d27ee7f43
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/layout4.C
@@ -0,0 +1,18 @@
+// { dg-do run { target i?86-*-* } }
+// { dg-options "-fabi-version=1" }
+
+struct C4
+{
+ int b:30;
+ C4(){};
+};
+
+struct C1: virtual C4
+{
+ int i;
+};
+
+int main() {
+ if (sizeof (C1) != 12)
+ return 1;
+}
diff --git a/gcc/testsuite/g++.dg/conversion/cond6.C b/gcc/testsuite/g++.dg/conversion/cond6.C
new file mode 100644
index 00000000000..8c05e1b143c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/conversion/cond6.C
@@ -0,0 +1,18 @@
+// PR c++/11283
+// Converting "a" to the type of "i" produces "int" rather than "const
+// int", which was causing build_conditional_expr to abort. But we don't
+// care about cv-quals on non-class rvalues.
+
+struct A
+{
+ operator int ();
+};
+
+extern A a;
+extern const int i;
+extern bool b;
+
+int f ()
+{
+ return b ? a : i;
+}
diff --git a/gcc/testsuite/g++.dg/eh/delayslot1.C b/gcc/testsuite/g++.dg/eh/delayslot1.C
new file mode 100644
index 00000000000..ddc960e6d8b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/eh/delayslot1.C
@@ -0,0 +1,47 @@
+// PR target/12301
+// Origin: Colin Hirsch <gcc@cohi.at>
+// Testcase by Christian Ehrhardt <ehrhardt@mathematik.uni-ulm.de>
+
+// This used to fail on SPARC because the reorg pass moved an insn
+// across a function call that can throw internally, in order to put
+// it in a delay slot.
+
+// { dg-do run }
+// { dg-options "-O" }
+
+struct S{
+ char *c;
+ char data[100];
+ S () : c (data) {};
+ S (const S& s) {
+ c = data;
+ data[0] = s.c[0];
+ }
+};
+
+S real_cast ()
+{
+ throw 3;
+}
+
+S cast_helper(S& debug)
+{
+ try {
+ return real_cast();
+ }
+ catch (int e) {
+ throw debug;
+ }
+}
+
+int main()
+{
+ S tmp;
+
+ try {
+ cast_helper (tmp);
+ }
+ catch (S& e) {}
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/expr/call1.C b/gcc/testsuite/g++.dg/expr/call1.C
new file mode 100644
index 00000000000..42d18db563e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/expr/call1.C
@@ -0,0 +1,16 @@
+namespace NS_1 {
+ struct A {};
+ struct foo {};
+}
+
+namespace NS_2 {
+ template <typename T> void foo(T);
+
+ template <typename T>
+ void bar() {
+ NS_1::A a;
+ NS_2::foo(a);
+ }
+
+ template void bar<int>();
+}
diff --git a/gcc/testsuite/g++.dg/expr/call2.C b/gcc/testsuite/g++.dg/expr/call2.C
new file mode 100644
index 00000000000..3b7398a8bf7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/expr/call2.C
@@ -0,0 +1,14 @@
+// { dg-do compile }
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 11 Sep 2003 <nathan@codesourcery.com>
+// Origin: Wolfgang Bangerth <bangerth@dealii.org>
+// PR c++/12184. ICE
+
+class C;
+class D;
+bool mm(D);
+
+void g(C& f) {
+ mm(f); // { dg-error "parameter" "" }
+}
diff --git a/gcc/testsuite/g++.dg/expr/comma1.C b/gcc/testsuite/g++.dg/expr/comma1.C
new file mode 100644
index 00000000000..5424ce1a84e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/expr/comma1.C
@@ -0,0 +1,21 @@
+// { dg-do run }
+
+extern "C" void abort ();
+
+struct gtst
+{
+ unsigned char data[2];
+};
+
+static struct gtst s;
+
+int main(int argc, char *argv[])
+{
+ unsigned char * pc;
+ struct gtst * ps;
+ ps = &s;
+ pc = (ps->data[0]='A', ps->data);
+ if (&s.data[0] != pc)
+ abort();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/expr/cond3.C b/gcc/testsuite/g++.dg/expr/cond3.C
new file mode 100644
index 00000000000..50a4d9a1300
--- /dev/null
+++ b/gcc/testsuite/g++.dg/expr/cond3.C
@@ -0,0 +1,6 @@
+const int i = 7;
+const int j = 3;
+
+void f(bool b) {
+ &(b ? i : j);
+}
diff --git a/gcc/testsuite/g++.dg/expr/lval1.C b/gcc/testsuite/g++.dg/expr/lval1.C
new file mode 100644
index 00000000000..bed47d8e4ec
--- /dev/null
+++ b/gcc/testsuite/g++.dg/expr/lval1.C
@@ -0,0 +1,7 @@
+// Contributed by Matt Austern <austern@apple.com>
+
+void f ()
+{
+ int n;
+ (char) n = 1; // { dg-error "" }
+}
diff --git a/gcc/testsuite/g++.dg/expr/static_cast4.C b/gcc/testsuite/g++.dg/expr/static_cast4.C
new file mode 100644
index 00000000000..cea7f487393
--- /dev/null
+++ b/gcc/testsuite/g++.dg/expr/static_cast4.C
@@ -0,0 +1,11 @@
+class C {
+public:
+ explicit C(int) {}
+};
+
+int main()
+{
+ int i = 0;
+ static_cast<C>(i);
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/expr/static_cast5.C b/gcc/testsuite/g++.dg/expr/static_cast5.C
new file mode 100644
index 00000000000..1a51f151677
--- /dev/null
+++ b/gcc/testsuite/g++.dg/expr/static_cast5.C
@@ -0,0 +1,17 @@
+void ambig()
+{
+ struct A {};
+ struct B : A {};
+ struct C : A {};
+ struct D : B, C {};
+
+ D d;
+ A* ap = static_cast<B*> (&d);
+ D* db = static_cast<D*> (ap); // { dg-error "" }
+
+ D& dr1 = static_cast<D&> (*ap); // { dg-error "" }
+
+ A& ar = static_cast<C&> (d);
+ D& dr = static_cast<D&> (ar); // { dg-error "" }
+}
+
diff --git a/gcc/testsuite/g++.dg/ext/altivec-1.C b/gcc/testsuite/g++.dg/ext/altivec-1.C
new file mode 100644
index 00000000000..b7e3af30009
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/altivec-1.C
@@ -0,0 +1,15 @@
+// { dg-do compile { target powerpc-*-* } } */
+/* { dg-options "-maltivec" } */
+
+#include <altivec.h>
+
+int main()
+{
+ return 0;
+}
+
+class F32vec4 {
+public:
+ vector float val;
+ vector float operator++(void) { return val;}
+};
diff --git a/gcc/testsuite/g++.dg/ext/fnname1.C b/gcc/testsuite/g++.dg/ext/fnname1.C
new file mode 100644
index 00000000000..521d5a7367f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/fnname1.C
@@ -0,0 +1,26 @@
+// Test whether __func__ works for namespace-scope C++ functions.
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Matt Austern <austern@apple.com>, 3 Aug 2003
+// { dg-do run }
+
+namespace xyzzy
+{
+ const char* ab6(double, void*)
+ {
+ return __func__;
+ }
+}
+
+int main()
+{
+ const char* s = xyzzy::ab6(2.3, (void*) 0);
+ bool ok = true;
+
+ ok = ok && s[0] == 'a';
+ ok = ok && s[1] == 'b';
+ ok = ok && s[2] == '6';
+ ok = ok && s[3] == '\0';
+
+ return ok ? 0 : 1;
+}
diff --git a/gcc/testsuite/g++.dg/ext/fnname2.C b/gcc/testsuite/g++.dg/ext/fnname2.C
new file mode 100644
index 00000000000..ea0c1826f45
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/fnname2.C
@@ -0,0 +1,31 @@
+// Test whether __func__ works for ordinary member functions.
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Matt Austern <austern@apple.com>, 3 Aug 2003
+// { dg-do run }
+
+struct y8a
+{
+ const char* zqjx(int, char);
+};
+
+const char* y8a::zqjx(int, char)
+{
+ return __func__;
+}
+
+
+int main()
+{
+ y8a tmp;
+ const char* s = tmp.zqjx(16, 'x');
+ bool ok = true;
+
+ ok = ok && s[0] == 'z';
+ ok = ok && s[1] == 'q';
+ ok = ok && s[2] == 'j';
+ ok = ok && s[3] == 'x';
+ ok = ok && s[4] == '\0';
+
+ return ok ? 0 : 1;
+}
diff --git a/gcc/testsuite/g++.dg/ext/fnname3.C b/gcc/testsuite/g++.dg/ext/fnname3.C
new file mode 100644
index 00000000000..c29170a9a39
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/fnname3.C
@@ -0,0 +1,65 @@
+// Test whether __func__ works for constructors and destructors.
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Matt Austern <austern@apple.com>, 3 Aug 2003
+// { dg-do run }
+
+struct uk9i
+{
+ uk9i();
+ ~uk9i();
+
+ static const char* fname;
+ static bool obj_exists;
+};
+
+uk9i::uk9i()
+{
+ obj_exists = true;
+ fname = __func__;
+}
+
+uk9i::~uk9i()
+{
+ obj_exists = false;
+ fname = __func__;
+}
+
+const char* uk9i::fname = 0;
+bool uk9i::obj_exists = false;
+
+int main()
+{
+ bool ok = true;
+
+ ok = ok && uk9i::fname == 0;
+ ok = ok && !uk9i::obj_exists;
+
+ {
+ uk9i tmp;
+ ok = ok && uk9i::obj_exists;
+ ok = ok && uk9i::fname != 0;
+ if (ok)
+ {
+ ok = ok && uk9i::fname[0] == 'u';
+ ok = ok && uk9i::fname[1] == 'k';
+ ok = ok && uk9i::fname[2] == '9';
+ ok = ok && uk9i::fname[3] == 'i';
+ ok = ok && uk9i::fname[4] == '\0';
+ }
+ }
+
+ ok = ok && !uk9i::obj_exists;
+ ok = ok && uk9i::fname != 0;
+ if (ok)
+ {
+ ok = ok && uk9i::fname[0] == '~';
+ ok = ok && uk9i::fname[1] == 'u';
+ ok = ok && uk9i::fname[2] == 'k';
+ ok = ok && uk9i::fname[3] == '9';
+ ok = ok && uk9i::fname[4] == 'i';
+ ok = ok && uk9i::fname[5] == '\0';
+ }
+
+ return ok ? 0 : 1;
+}
diff --git a/gcc/testsuite/g++.dg/ext/label1.C b/gcc/testsuite/g++.dg/ext/label1.C
new file mode 100644
index 00000000000..8c6684dce0e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/label1.C
@@ -0,0 +1,8 @@
+// { dg-options "" }
+
+int main(void) {
+ static const void* lbls[2][2] = {{&&lbl0, &&lbl0}, {&&lbl0, &&lbl0}};
+ goto *lbls[0];
+ lbl0:
+ ;
+}
diff --git a/gcc/testsuite/g++.dg/ext/label2.C b/gcc/testsuite/g++.dg/ext/label2.C
new file mode 100644
index 00000000000..1b66f603fe4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/label2.C
@@ -0,0 +1,11 @@
+// { dg-options "" }
+
+template <typename T>
+void f() {
+ l:
+ void *p[] = { &&l };
+
+ goto *p;
+}
+
+template void f<int>();
diff --git a/gcc/testsuite/g++.dg/inherit/conv1.C b/gcc/testsuite/g++.dg/inherit/conv1.C
new file mode 100644
index 00000000000..e16c489a235
--- /dev/null
+++ b/gcc/testsuite/g++.dg/inherit/conv1.C
@@ -0,0 +1,23 @@
+typedef struct _A A;
+typedef struct _A B;
+
+void some_function(B *b);
+
+class AClass {
+
+public:
+ operator A*() { return 0;}
+
+};
+
+class BClass :public AClass {
+
+public:
+ operator B*() { return 0;}
+
+};
+
+int main(int argc, char **argv) {
+ BClass b;
+ some_function(b);
+}
diff --git a/gcc/testsuite/g++.dg/init/array11.C b/gcc/testsuite/g++.dg/init/array11.C
new file mode 100644
index 00000000000..e52effe9ff7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/array11.C
@@ -0,0 +1,28 @@
+/* PR 11665
+ Orgin: jwhite@cse.unl.edu
+ The problem was in initializer_constant_valid_p,
+ "for a CONSTRUCTOR, only the last element
+ of the CONSTRUCTOR was being checked"
+ (from the email of the patch which fixed this).
+ This used to ICE because GCC thought gdt_table was a
+ constant value when it is not. */
+
+int x;
+
+typedef __SIZE_TYPE__ size_t;
+
+struct gdt
+{
+size_t a,b,c,d,e,f;
+};
+void f()
+{
+struct gdt gdt_table[2]=
+{
+ {
+ 0,
+ ( (((size_t)(&x))<<(24))&(-1<<(8)) ),
+ },
+};
+}
+
diff --git a/gcc/testsuite/g++.dg/init/ref9.C b/gcc/testsuite/g++.dg/init/ref9.C
new file mode 100644
index 00000000000..127b7d8e1fd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/ref9.C
@@ -0,0 +1,36 @@
+// { dg-do run }
+
+struct ex;
+struct basic {
+ int refcount;
+ ex eval() const;
+ basic() : refcount(0) {}
+};
+
+struct ex {
+ basic *bp;
+ ex() : bp(0) { }
+ ex(const basic &);
+ virtual ~ex();
+ void construct_from_basic(const basic &);
+};
+
+ex basic::eval() const {
+ throw 1;
+}
+
+inline ex::ex(const basic &b) { construct_from_basic (b); }
+inline ex::~ex() { if (--bp->refcount == 0) delete bp; }
+void ex::construct_from_basic(const basic &b) {
+ const ex & tmpex = b.eval();
+ bp = tmpex.bp;
+ bp->refcount++;
+}
+
+ex pow() { return basic(); }
+
+int main()
+{
+ try { pow (); } catch (int) {}
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/init/struct1.C b/gcc/testsuite/g++.dg/init/struct1.C
new file mode 100644
index 00000000000..4cabc99e0e2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/struct1.C
@@ -0,0 +1,6 @@
+struct bug {
+ const char *name;
+ unsigned long type;
+};
+
+struct bug s = { 0, (unsigned long) &s | 1 };
diff --git a/gcc/testsuite/g++.dg/lookup/crash1.C b/gcc/testsuite/g++.dg/lookup/crash1.C
new file mode 100644
index 00000000000..cd90685c70d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lookup/crash1.C
@@ -0,0 +1,31 @@
+// { dg-do compile }
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 25 Aug 2003 <nathan@codesourcery.com>
+// Origin pr 11871 Dirk Mueller <mueller@kde.org>
+
+// PR c++/11871 Regression
+
+namespace std
+{
+ class A
+ {
+ public:
+ enum result
+ {
+ ok
+ };
+ };
+
+ template<typename T> class B : public A
+ {
+ public:
+ typedef A::result result;
+ };
+}
+
+int main()
+{
+ for(float result = 1.0;;);
+}
+
diff --git a/gcc/testsuite/g++.dg/lookup/koenig2.C b/gcc/testsuite/g++.dg/lookup/koenig2.C
new file mode 100644
index 00000000000..04f95258999
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lookup/koenig2.C
@@ -0,0 +1,15 @@
+struct S
+{
+ template <typename T> void operator() (T) {}
+};
+
+namespace N
+{
+ S s;
+ struct A {} a;
+}
+
+using N::s;
+
+void f () { s(N::a); }
+
diff --git a/gcc/testsuite/g++.dg/lookup/scoped7.C b/gcc/testsuite/g++.dg/lookup/scoped7.C
new file mode 100644
index 00000000000..a9d70d06e3b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lookup/scoped7.C
@@ -0,0 +1,20 @@
+//PR c++/11507
+// Origin: kai-gcc-bugs@khms.westfalen.de and bangerth@dealii.org
+//The new parser used to fail on this.
+
+// { dg-do compile }
+
+namespace NS
+{
+ void foo(bool arg1);
+}
+
+namespace M {
+ namespace K {
+ bool Bc(bool x);
+ }
+
+ void bar() {
+ NS::foo (K::Bc(true)); // GCC could not find K or Bc.
+ }
+}
diff --git a/gcc/testsuite/g++.dg/opt/cfg3.C b/gcc/testsuite/g++.dg/opt/cfg3.C
new file mode 100644
index 00000000000..123c2f5157b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/cfg3.C
@@ -0,0 +1,61 @@
+// PR optimization/11646
+// Origin: <nick@ilm.com>
+
+// This used to fail because the compiler inadvertently cleared
+// the EDGE_ABNORMAL flag on a EDGE_EH edge and didn't delete
+// unreachable blocks after CSE.
+
+// { dg-do compile }
+// { dg-options "-O -fgcse -fnon-call-exceptions" }
+
+struct C
+{
+ int i;
+};
+
+struct allocator
+{
+ ~allocator() throw() {}
+};
+
+struct _Vector_alloc_base
+{
+ _Vector_alloc_base(const allocator& __a) {}
+ allocator _M_data_allocator;
+ struct C *_M_start, *_M_end_of_storage;
+ void _M_deallocate(struct C* __p, unsigned int __n) {}
+};
+
+struct _Vector_base : _Vector_alloc_base
+{
+ _Vector_base(const allocator& __a) : _Vector_alloc_base(__a) { }
+ ~_Vector_base() { _M_deallocate(0, _M_end_of_storage - _M_start); }
+};
+
+struct vector : _Vector_base
+{
+ vector(const allocator& __a = allocator()) : _Vector_base(__a) {}
+ struct C& operator[](unsigned int __n) { return *_M_start; }
+};
+
+struct A
+{
+ float l() const;
+ A operator-(const A &) const;
+ const A& operator=(float) const;
+};
+
+struct B
+{
+ float d();
+};
+
+float f(const A& a, B& b)
+{
+ vector vc;
+ int index = vc[0].i;
+ A aa;
+ float d = (aa - a).l();
+ if (d > b.d()) aa = 0;
+ return b.d();
+}
diff --git a/gcc/testsuite/g++.dg/opt/enum1.C b/gcc/testsuite/g++.dg/opt/enum1.C
new file mode 100644
index 00000000000..6416b3f1b86
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/enum1.C
@@ -0,0 +1,30 @@
+// Verify that we don't confuse precision and mode for enums.
+// { dg-do run }
+// { dg-options "-O" }
+
+extern "C" void abort();
+
+enum E {
+ zero = 0,
+ test = 0xbb
+};
+
+static bool foo(unsigned char *x)
+{
+ E e = static_cast<E>(*x);
+ switch (e)
+ {
+ case test:
+ return true;
+ default:
+ return false;
+ }
+}
+
+int main()
+{
+ unsigned char dummy = test;
+ if (! foo(&dummy))
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/opt/longbranch2.C b/gcc/testsuite/g++.dg/opt/longbranch2.C
new file mode 100644
index 00000000000..b74ceddf085
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/longbranch2.C
@@ -0,0 +1,62 @@
+// PR target/11689
+// Originator: thor@math.tu-berlin.de
+
+// { dg-do compile }
+// { dg-options "-O3 -funroll-loops -mtune=k6 -fomit-frame-pointer" { target i?86-*-* } }
+
+// This used to fail to assemble because of an out-of-range 'loop' instructions.
+
+
+class JKeeper {
+public:
+ unsigned long a0;
+};
+
+class EBCOTLut : public JKeeper {
+ unsigned char a1[1<<8];
+ unsigned char a2[1<<8];
+ unsigned char a3[1<<8];
+ long a4[1<<9];
+public:
+ EBCOTLut(void);
+};
+
+EBCOTLut::EBCOTLut(void)
+{
+ unsigned char inter[36]; // intermediate lookup table;
+ unsigned long i;
+ for(i=0;i<36;i++) {
+ inter[i] = 0;
+ }
+ for(i=1;i<16;i++) {
+ a1[i | (1<<7)] = 8<<1;
+ a1[i | (1<<6)] = 8<<1;
+ }
+ for(i=0;i < ((1<<9)-1);i++) {
+ int ds = (i>>0) & 0x01; // significance of DOWN
+ int us = (i>>1) & 0x01; // significance of UP
+ int rs = (i>>2) & 0x01; // significance of RIGHT
+ int ls = (i>>3) & 0x01; // significance of LEFT
+ int dn = (i>>5) & 0x01; // sign of DOWN
+ int un = (i>>6) & 0x01; // sign of UP
+ int rn = (i>>7) & 0x01; // sign of RIGHT
+ int ln = (i>>8) & 0x01; // sign of LEFT
+ int h,v; // h and v as in the VM description
+
+ h = ls*(1-ln*2) + rs*(1-2*rn);
+ v = us*(1-un*2) + ds*(1-2*dn);
+ h = (h >= -1)?(h):(-1);
+ v = (v >= -1)?(v):(-1);
+ h = (h <= 1)?(h):(1);
+ v = (v <= 1)?(v):(1);
+ a2[i] = inter[((h+1)<<3) | (v+1)];
+ a3[i] = inter[((h+1)<<3) | (v+1)] & (unsigned char)(~1);
+ }
+ for(i=0;i< 1<<9; i++) {
+ a4[i] = 2*(i-(1<<(9-1)))*(i-(1<<(9-1))) -
+ ((i< (1<<(9-1)))?
+ (2*(i-(1<<(9-2)))*(i-(1<<(9-2)))):
+ (2*(i-(3<<(9-2)))*(i-(3<<(9-2)))));
+
+ }
+}
diff --git a/gcc/testsuite/g++.dg/opt/ptrmem3.C b/gcc/testsuite/g++.dg/opt/ptrmem3.C
new file mode 100644
index 00000000000..552a92c9c1a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/ptrmem3.C
@@ -0,0 +1,23 @@
+// { dg-options "-O1" }
+
+#include <stdio.h>
+struct A {
+ A(int arg) : ia(arg) {}
+ int x,y,z,ia;
+ int mf(int arg) { return arg + ia; }
+};
+int func(int A::*pdm, int (A::*pmf)(int)) // 2. regular function
+{
+ A oa(2);
+ return ((&oa)->*pdm) + (oa.*pmf)(2);
+}
+int main()
+{
+ int val;
+
+ int A::*pda = &A::ia;
+ int (A::*pmfa)(int) = &A::mf;
+ val = func( pda, pmfa );
+ if(val != 6)
+ printf("val=%d, expect 6 \n", val);
+}
diff --git a/gcc/testsuite/g++.dg/opt/reg-stack2.C b/gcc/testsuite/g++.dg/opt/reg-stack2.C
new file mode 100644
index 00000000000..08cd590b471
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/reg-stack2.C
@@ -0,0 +1,34 @@
+// PR target/9786
+// Origin: <nick@ilm.com>
+
+// This used to fail on x86 because the reg-stack pass deleted
+// an insn that could seemingly trap (but actually doesn't)
+// without updating the CFG.
+
+// { dg-do compile }
+// { dg-options "-O2 -fnon-call-exceptions" }
+
+struct D1 {
+ float l;
+ D1 GS() const {D1 d;float f=.299*l;d.l=f;return d;}
+ static D1 G() {return D1();}
+};
+
+struct D2 {
+ D1 g;
+ D2(const D1& gi) : g(gi) {}
+ D2 GS() const {return D2(g.GS());}
+};
+
+class A {
+ public:
+ virtual ~A() {}
+};
+
+class B : public A {
+ public:
+ B(const D2& mi);
+ D2 fm;
+};
+
+B::B(const D2 &mi) : fm(mi.GS()) {}
diff --git a/gcc/testsuite/g++.dg/opt/static3.C b/gcc/testsuite/g++.dg/opt/static3.C
new file mode 100644
index 00000000000..00c72651be3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/static3.C
@@ -0,0 +1,35 @@
+// { dg-do link }
+
+class Foo {
+public:
+ // No out-of-class definition is provided for these class members.
+ // That's technically a violation of the standard, but no diagnostic
+ // is required, and, as a QOI issue, we should optimize away all
+ // references.
+ static const int erf = 0;
+ static const int foo = 1;
+};
+
+int one()
+{
+ return Foo::foo;
+}
+
+int two()
+{
+ return Foo::foo + Foo::erf;
+}
+
+int three(int x)
+{
+ return x ? Foo::erf : Foo::foo;
+}
+
+int i;
+
+int main ()
+{
+ one ();
+ two ();
+ three (i);
+}
diff --git a/gcc/testsuite/g++.dg/other/gc2.C b/gcc/testsuite/g++.dg/other/gc2.C
new file mode 100644
index 00000000000..142229475cf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/gc2.C
@@ -0,0 +1,38 @@
+// PR c++/12316
+// Origin: Volker Reichelt <reichelt@igpm.rwth-aachen.de>
+
+// { dg-do compile }
+// { dg-options "--param ggc-min-expand=0 --param ggc-min-heapsize=0" }
+
+inline void FOO() {}
+
+template<typename> struct A
+{
+ A() {}
+ ~A() throw() {}
+};
+
+template<typename> struct B
+{
+ static void foo();
+ static void bar() { foo(); }
+};
+
+struct C {};
+
+template<typename> struct D : C
+{
+ D() {}
+ ~D() { B<void>::bar(); }
+};
+
+template<typename> struct E : D<void>
+{
+ static void baz() {}
+ E(A<void>) { baz(); }
+};
+
+void BAR()
+{
+ new E<void>(A<void>());
+}
diff --git a/gcc/testsuite/g++.dg/other/static1.C b/gcc/testsuite/g++.dg/other/static1.C
new file mode 100644
index 00000000000..09e17d4b5ba
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/static1.C
@@ -0,0 +1,17 @@
+// PR c++/9574
+// Origin: fche@redhat.com and bangerth@dealii.org
+// The new parser ICE on this test and then it could
+// not find z in bar::bar().
+
+// { dg-do compile }
+
+struct X {
+ void operator[](const int& __k);
+};
+struct foo {
+ static X x;
+};
+struct bar {
+ int z;
+ bar () { foo::x[z]; };
+};
diff --git a/gcc/testsuite/g++.dg/overload/VLA.C b/gcc/testsuite/g++.dg/overload/VLA.C
new file mode 100644
index 00000000000..850e19a0054
--- /dev/null
+++ b/gcc/testsuite/g++.dg/overload/VLA.C
@@ -0,0 +1,16 @@
+//Origin: kengole@us.ibm.com
+
+//PR c++/2478
+// G++ was rejecting this as it could not convert `int (*)[]' to `int (*)[0]'.
+// Using the C99 VLA style arrays in a struct.
+
+// { dg-do compile }
+
+struct {
+ int (*p)[];
+} B;
+
+void foo() {
+ int (*p)[];
+ B.p=p; // { dg-bogus "cannot convert" }
+}
diff --git a/gcc/testsuite/g++.dg/overload/addr1.C b/gcc/testsuite/g++.dg/overload/addr1.C
new file mode 100644
index 00000000000..25856a20fc6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/overload/addr1.C
@@ -0,0 +1,50 @@
+// { dg-do run }
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 6 Sep 2003 <nathan@codesourcery.com>
+// Origin: Volker Reichelt <reichelt@igpm.rwth-aachen.de>
+
+// PR c++/11788 we failed to instantiate a decl, and we lost some side
+// effects
+
+static int flag = 0;
+
+template <typename> struct A
+{
+ A &active () { flag++;}
+
+ static void foo() {}
+
+ static void bar () {}
+ static void bar (int) {}
+
+ int m;
+};
+
+void (*baz ()) ()
+{
+ A<int> a;
+ return &a.active ().foo;
+}
+
+void (*boz ()) ()
+{
+ A<int> a;
+ return &a.active ().bar;
+}
+
+int *buz ()
+{
+ A<int> a;
+
+ return &a.active ().m;
+}
+
+int main ()
+{
+ baz ();
+ boz ();
+ buz ();
+
+ return flag != 3;
+}
diff --git a/gcc/testsuite/g++.dg/overload/builtin3.C b/gcc/testsuite/g++.dg/overload/builtin3.C
new file mode 100644
index 00000000000..dcd9fd02e38
--- /dev/null
+++ b/gcc/testsuite/g++.dg/overload/builtin3.C
@@ -0,0 +1,10 @@
+// PR c++/11409
+// { dg-do compile }
+
+namespace std {
+ double fabs (double);
+}
+using std::fabs;
+
+double (*p) (double) = &fabs; // { dg-bogus "is ambiguous" "" }
+
diff --git a/gcc/testsuite/g++.dg/overload/prom1.C b/gcc/testsuite/g++.dg/overload/prom1.C
new file mode 100644
index 00000000000..9eb387dc43a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/overload/prom1.C
@@ -0,0 +1,9 @@
+void foo(signed char) {}
+typedef int bar;
+void foo(bar) {}
+
+int main (int, char **) {
+ char c;
+ foo(c);
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/overload/template1.C b/gcc/testsuite/g++.dg/overload/template1.C
new file mode 100644
index 00000000000..5bfad8464f7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/overload/template1.C
@@ -0,0 +1,12 @@
+template<typename T> T Foo (int) {T d;}
+
+void Baz (void (*)(int), int);
+
+int Foo ();
+int Baz (int (*)(), float);
+
+void Bar ()
+{
+ Baz (Foo, 1.0f);
+
+}
diff --git a/gcc/testsuite/g++.dg/parse/access6.C b/gcc/testsuite/g++.dg/parse/access6.C
new file mode 100644
index 00000000000..33d50905854
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/access6.C
@@ -0,0 +1,24 @@
+// { dg-do compile }
+
+// Origin: David Baron <dbaron@fas.harvard.edu>
+
+// PR c++/3765: Changing access from public to private by member
+// using declaration.
+
+class A
+{
+ public:
+ int foo() { return 1; } // { dg-error "inaccessible" }
+};
+
+class B : public A
+{
+ private:
+ using A::foo;
+};
+
+int main()
+{
+ B b;
+ return b.foo(); // { dg-error "this context" }
+}
diff --git a/gcc/testsuite/g++.dg/parse/access7.C b/gcc/testsuite/g++.dg/parse/access7.C
new file mode 100644
index 00000000000..2a7ca3c42ac
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/access7.C
@@ -0,0 +1,13 @@
+// { dg-do compile }
+
+// Origin: Paolo Carlini <pcarlini@unitus.it>
+
+// PR c++/5655: Access of member redeclaration.
+
+struct S {
+ class A;
+ template <class T> class B;
+private:
+ class A {}; // { dg-error "different access" }
+ template <class T> class B {}; // { dg-error "different access" }
+};
diff --git a/gcc/testsuite/g++.dg/parse/crash12.C b/gcc/testsuite/g++.dg/parse/crash12.C
new file mode 100644
index 00000000000..cf947b27787
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/crash12.C
@@ -0,0 +1,24 @@
+// { dg-do compile }
+
+// Origin: Martin von Loewis <martin@v.loewis.de>
+
+// PR c++/157: Incorrect type/template decision in function parameter.
+
+template <class _Tp> class auto_ptr {};
+template <class _Tp>
+class counted_ptr
+{
+public:
+ counted_ptr(auto_ptr<_Tp>& __a); // { dg-error "candidate" }
+ auto_ptr<_Tp> auto_ptr();
+};
+
+template <class _Tp>
+inline counted_ptr<_Tp>::counted_ptr(class auto_ptr& __a) // { dg-error "required" }
+{ // { dg-error "no type|not match|template" }
+}
+
+template <class _Tp>
+inline class auto_ptr<_Tp> counted_ptr<_Tp>::auto_ptr()
+{
+}
diff --git a/gcc/testsuite/g++.dg/parse/defarg5.C b/gcc/testsuite/g++.dg/parse/defarg5.C
new file mode 100644
index 00000000000..01a67ed5915
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/defarg5.C
@@ -0,0 +1,15 @@
+// { dg-do compile }
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 5 Sep 2003 <nathan@codesourcery.com>
+// Origin:Wolfgang Bangerth bangerth@dealii.org
+
+// PR c++/12167 - infinite recursion
+
+class A {
+ void report(int d
+ // the default arg is what NAN etc can expand to, but
+ // with the floatiness removed.
+ = (__extension__ ((union { unsigned l; int d; })
+ { l: 0x7fc00000U }).d));
+};
diff --git a/gcc/testsuite/g++.dg/parse/dtor2.C b/gcc/testsuite/g++.dg/parse/dtor2.C
new file mode 100644
index 00000000000..60e132b4a9b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/dtor2.C
@@ -0,0 +1,4 @@
+struct A {
+ typedef A A2;
+ ~A2(); // { dg-error "" }
+};
diff --git a/gcc/testsuite/g++.dg/parse/friend3.C b/gcc/testsuite/g++.dg/parse/friend3.C
new file mode 100644
index 00000000000..39322021efc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/friend3.C
@@ -0,0 +1,10 @@
+// { dg-do compile }
+//
+// PR 11553 catch duplicate friend specifiers
+
+struct S
+{
+ friend friend class C; // { dg-error "duplicate" }
+};
+
+
diff --git a/gcc/testsuite/g++.dg/parse/template12.C b/gcc/testsuite/g++.dg/parse/template12.C
new file mode 100644
index 00000000000..ba375bc437a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/template12.C
@@ -0,0 +1,10 @@
+template <int J>
+struct A {
+};
+
+struct B {
+ template <int I>
+ struct C : public A<I> {};
+
+ typedef double I;
+};
diff --git a/gcc/testsuite/g++.dg/parse/using2.C b/gcc/testsuite/g++.dg/parse/using2.C
new file mode 100644
index 00000000000..bfdb09f8833
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/using2.C
@@ -0,0 +1,8 @@
+namespace N {
+ template <typename T>
+ struct foo {};
+}
+
+int main() {
+ using N::foo<double>; // { dg-error "" }
+}
diff --git a/gcc/testsuite/g++.dg/parse/using3.C b/gcc/testsuite/g++.dg/parse/using3.C
new file mode 100644
index 00000000000..c266b68eaf7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/using3.C
@@ -0,0 +1,22 @@
+// { dg-do compile }
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 6 Sep 2003 <nathan@codesourcery.com>
+// Origin: stefaandr@hotmail.com
+
+// PR c++/11794. Using decl in nested classes of a template class
+
+template <typename T> struct a
+{
+ struct a1: T
+ {
+ using T::aa;
+
+ a1() { aa = 5; }
+ };
+};
+struct b { int aa; };
+template <> struct a<int>::a1 { a1 () {} };
+
+a<b>::a1 a_b;
+a<int>::a1 a_i;
diff --git a/gcc/testsuite/g++.dg/rtti/typeid2.C b/gcc/testsuite/g++.dg/rtti/typeid2.C
new file mode 100644
index 00000000000..0dbcc598b9d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/rtti/typeid2.C
@@ -0,0 +1,15 @@
+// { dg-do run }
+
+#include <typeinfo>
+
+template <typename T> const char *print_type (const T &) {
+ return typeid(T).name();
+}
+
+/* no template */ void pp1 (int) {}
+template <typename X> void pp2 (X) {}
+
+int main () {
+ if (print_type (&pp1) != print_type (&pp2<int>))
+ return 1;
+}
diff --git a/gcc/testsuite/g++.dg/rtti/typeid3.C b/gcc/testsuite/g++.dg/rtti/typeid3.C
new file mode 100644
index 00000000000..a07b399249c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/rtti/typeid3.C
@@ -0,0 +1,11 @@
+#include <typeinfo>
+
+template <template <class> class T> struct A {
+ void error() {
+ typeid(T).name(); // { dg-error "missing" }
+ }
+};
+
+template <class T> struct B {};
+
+template void A<B>::error();
diff --git a/gcc/testsuite/g++.dg/template/call1.C b/gcc/testsuite/g++.dg/template/call1.C
new file mode 100644
index 00000000000..3b6e367af22
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/call1.C
@@ -0,0 +1,17 @@
+//Origin: harinath@cs.umn.edu
+//PR c++/10804
+// G++ was not emiting the function foo.
+
+// { dg-do run }
+
+
+template<class T>
+struct A
+{
+ A() { const void (*a)() = foo; }
+ static const void foo() {}
+};
+int main(int argc, char *argv[])
+{
+ A<int> a;
+}
diff --git a/gcc/testsuite/g++.dg/template/class1.C b/gcc/testsuite/g++.dg/template/class1.C
new file mode 100644
index 00000000000..96415fbc225
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/class1.C
@@ -0,0 +1,9 @@
+extern const int a;
+
+template <const int&> class X {};
+
+template <typename> struct Y {
+ X<a> x;
+};
+
+template struct Y<int>;
diff --git a/gcc/testsuite/g++.dg/template/crash10.C b/gcc/testsuite/g++.dg/template/crash10.C
new file mode 100644
index 00000000000..62647ca723a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/crash10.C
@@ -0,0 +1,27 @@
+//Origin: benko@sztaki.hu
+//PR c++/11432
+// The mainline ICE on this one between 2003-01-16 and 2003-07-29.
+
+// { dg-do compile }
+
+ extern "C" void abort();
+
+
+template <int A>
+struct a
+{
+ static int const value = A - 1;
+};
+
+
+template <int B>
+struct b
+{
+ static int foo()
+ {
+ return a<L>::value;
+ }
+
+
+ static int const L = a<B + 1>::value;
+};
diff --git a/gcc/testsuite/g++.dg/template/crash11.C b/gcc/testsuite/g++.dg/template/crash11.C
new file mode 100644
index 00000000000..3c69514e243
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/crash11.C
@@ -0,0 +1,9 @@
+// { dg-do compile }
+
+// Origin: kparz@iastate.edu
+
+// PR c++/7939: ICE for invalid function parameter after template
+// substitution.
+
+template <class T, class U> void foo(T, U) {}
+template <class T> void foo<T,void>(T, void) {} // { dg-error "incomplete|invalid|partial" }
diff --git a/gcc/testsuite/g++.dg/template/crash9.C b/gcc/testsuite/g++.dg/template/crash9.C
new file mode 100644
index 00000000000..7a568fe054a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/crash9.C
@@ -0,0 +1,12 @@
+struct A { };
+struct B { };
+
+A f(const B & b) {
+ return A();
+}
+
+template<>
+B f(const A & a) { // { dg-error "" }
+ return B();
+}
+
diff --git a/gcc/testsuite/g++.dg/template/deduce2.C b/gcc/testsuite/g++.dg/template/deduce2.C
new file mode 100644
index 00000000000..bcf77b30b78
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/deduce2.C
@@ -0,0 +1,30 @@
+template <typename T0> struct tuple {
+ typedef tuple<int> tail;
+};
+
+template <> struct tuple<int> {
+};
+
+template <typename L>
+struct length {
+ static const int i = length<typename tuple<L>::tail>::i;
+};
+
+template<>
+struct length<tuple<int> > {
+ static const int i = 1;
+};
+
+template <int> struct M {};
+
+template <typename A>
+M<length<tuple<A> >::i > foo (A*);
+
+template <typename A>
+M<length<tuple<A> >::i> foo (const A*);
+
+const int i1 = 3;
+
+void bar() {
+ foo (&i1);
+}
diff --git a/gcc/testsuite/g++.dg/template/friend22.C b/gcc/testsuite/g++.dg/template/friend22.C
new file mode 100644
index 00000000000..41a73bbb4ae
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/friend22.C
@@ -0,0 +1,15 @@
+// { dg-do compile }
+
+// Origin: Benoit Hudson <bh@techhouse.brown.edu>
+
+// PR c++/641: Duplicate friend diagnostics
+
+template <class T> class iterator { };
+template <class T> class item {
+ friend class iterator<T>;
+ friend class iterator<const T>;
+};
+
+class A { };
+
+item<const A> i;
diff --git a/gcc/testsuite/g++.dg/template/friend23.C b/gcc/testsuite/g++.dg/template/friend23.C
new file mode 100644
index 00000000000..96f8125b68a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/friend23.C
@@ -0,0 +1,38 @@
+// { dg-do compile }
+
+// Origin: Alexandre Tolmos <ktulu@free.fr>
+
+// PR c++/11876: Friend of its own class diagnostics
+
+template <typename T>
+class A
+{
+ friend class A<int>;
+ friend class A<float>;
+protected:
+ T _data;
+ inline A() : _data(0) {}
+ template <typename U>
+ inline A(const A<U>& r) : _data(r._data) {}
+};
+
+class B : public A<int>
+{
+public:
+ inline B() {}
+ inline B(const B& r) : A<int>(r) {}
+};
+
+class C : public A<float>
+{
+public:
+ inline C() {}
+ inline C(const B& r) : A<float>(r) {}
+};
+
+int main(int, char*[])
+{
+ B b1, b2(b1);
+ C c(b1);
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/template/friend24.C b/gcc/testsuite/g++.dg/template/friend24.C
new file mode 100644
index 00000000000..5db4d31e721
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/friend24.C
@@ -0,0 +1,27 @@
+// { dg-do compile }
+
+// Origin: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
+
+// PR c++/495: Fail to locate primary class template that is
+// injected by friend declaration.
+
+template <int N> struct X
+{
+ template <int dim> friend struct Y;
+};
+
+X<2> x;
+
+template <int dim> struct Y
+{
+ void f (Y);
+ void g (Y);
+};
+
+template <int dim> void Y<dim>::f (Y)
+{
+}
+
+template <int dim> void Y<dim>::g (Y<dim>)
+{
+}
diff --git a/gcc/testsuite/g++.dg/template/memtmpl2.C b/gcc/testsuite/g++.dg/template/memtmpl2.C
new file mode 100644
index 00000000000..0c9dad647d2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/memtmpl2.C
@@ -0,0 +1,15 @@
+// { dg-do compile }
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 18 Sep 2003 <nathan@codesourcery.com>
+
+// PR c++/12332. ICE
+
+template <unsigned D> class TPL;
+
+template <typename T> struct X {
+ template <template <typename> class V>
+ V<TPL<V<int>::d> > operator () ();
+};
+
+void Foo (X<int> x) {}
diff --git a/gcc/testsuite/g++.dg/template/nested4.C b/gcc/testsuite/g++.dg/template/nested4.C
new file mode 100644
index 00000000000..6e5b99b46c2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/nested4.C
@@ -0,0 +1,10 @@
+template <typename T> struct A {
+ template<typename S> struct B { typedef A<S> X; };
+
+};
+
+template<typename> void f() {
+ typedef A<int>::B<double>::X X;
+}
+
+template void f<int> ();
diff --git a/gcc/testsuite/g++.dg/template/non-dependent4.C b/gcc/testsuite/g++.dg/template/non-dependent4.C
new file mode 100644
index 00000000000..637aabae409
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/non-dependent4.C
@@ -0,0 +1,4 @@
+int temp(char *temp);
+
+template <int> int g() { return temp("Hi"); }
+int g1() { return temp("Hi"); }
diff --git a/gcc/testsuite/g++.dg/template/qualified-id1.C b/gcc/testsuite/g++.dg/template/qualified-id1.C
new file mode 100644
index 00000000000..bbe23c2743b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/qualified-id1.C
@@ -0,0 +1,26 @@
+// { dg-do compile }
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 4 Sep 2003 <nathan@codesourcery.com>
+// Origin Volker Reichelt reichelt@igpm.rwth-aachen.de
+
+// PR 11922
+
+struct A
+{
+ template <bool> struct B;
+ struct C;
+};
+
+template <> struct A::B<false> {};
+
+template <typename T> void foo()
+{
+ T::C (); // { dg-error "names a type" "" }
+ T::template B<false>(); // { dg-error "names a type" "" }
+}
+
+void bar()
+{
+ foo<A>(); // { dg-error "instantiated" "" }
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wunused-4.C b/gcc/testsuite/g++.dg/warn/Wunused-4.C
new file mode 100644
index 00000000000..9018e92ef94
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wunused-4.C
@@ -0,0 +1,30 @@
+// { dg-do compile }
+// { dg-options "-Wunused-parameter" }
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 15 Sep 2003 <nathan@codesourcery.com>
+// Origin: yotamm@mellanox.co.il
+
+
+// PR c++/9848. Missing warning
+
+struct C1 {
+ // Only use in-charge ctor
+ C1(int bi) {} // { dg-warning "unused parameter" "" }
+};
+struct C2 {
+ // Only use base ctor
+ C2(int bi) {} // { dg-warning "unused parameter" "" }
+};
+
+struct D : C2
+{
+ D (int) : C2 (1) {}
+};
+
+void show_compile_warning ()
+{
+ C1 c1 (1);
+
+ D d (1);
+}
diff --git a/gcc/testsuite/g++.dg/warn/noeffect4.C b/gcc/testsuite/g++.dg/warn/noeffect4.C
new file mode 100644
index 00000000000..a4c46dafbcc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/noeffect4.C
@@ -0,0 +1,88 @@
+// { dg-do compile }
+// { dg-options "-Wall" }
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 2 Sep 2003 <nathan@codesourcery.com>
+
+// PR 12037.
+
+struct X
+{
+ int operator+(int);
+ int operator-(int);
+ int operator*(int);
+ int operator/(int);
+ int operator%(int);
+ int operator>>(int);
+ int operator<<(int);
+ int operator&(int);
+ int operator|(int);
+ int operator^(int);
+ int operator&&(int);
+ int operator||(int);
+ int operator==(int);
+ int operator!=(int);
+ int operator<(int);
+ int operator<=(int);
+ int operator>(int);
+ int operator>=(int);
+ int operator*();
+ int operator!();
+ int operator~();
+ int operator++();
+ int operator--();
+ int operator++(int);
+ int operator--(int);
+ int operator()();
+ int operator,(int);
+ X *operator->();
+ operator int () const;
+ int m;
+ virtual ~X ();
+ X &Foo ();
+};
+struct Y : X
+{
+};
+
+template<int I> void Foo (X &x)
+{
+ x + I;
+ x - I;
+ x * I;
+ x / I;
+ x % I;
+ x >> I;
+ x << I;
+ x & I;
+ x | I;
+ x && I;
+ x || I;
+ x == I;
+ x != I;
+ x < I;
+ x <= I;
+ x > I;
+ x >= I;
+ *x;
+ !x;
+ ~x;
+ x++;
+ x--;
+ ++x;
+ --x;
+ x ();
+ x, I;
+ x->m;
+ static_cast<int> (x);
+ dynamic_cast<Y &> (x);
+ reinterpret_cast<int> (x.Foo ());
+ const_cast<X &> (x.Foo ());
+
+ reinterpret_cast<int *> (&x);// { dg-warning "no effect" "" }
+ const_cast<X &> (x); // { dg-warning "no effect" "" }
+ sizeof (x++); // { dg-warning "no effect" "" }
+ __alignof__ (x++); // { dg-warning "no effect" "" }
+}
+
+
diff --git a/gcc/testsuite/g++.dg/warn/template-1.C b/gcc/testsuite/g++.dg/warn/template-1.C
new file mode 100644
index 00000000000..04ea5ae323b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/template-1.C
@@ -0,0 +1,15 @@
+//Origin: bangerth@dealii.org
+//PR c++/11490
+//Since N is know at instantiation time, there
+// should be no warning about comparision between
+// unsinged and signed interegers.
+
+// { dg-do compile }
+// { dg-options "-W" }
+
+template <int N> bool f() {
+ unsigned int i=0;
+ return i!=N; // { dg-bogus "signed and unsigned" }
+}
+
+template bool f<2> ();