From: Alexandre Oliva Date: Sat, 3 Oct 1998 02:51:23 +0000 (+0000) Subject: friend34.C: New test... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5e95b7c76d58d77028b0cf5fd016da5a05d4bd66;p=gcc.git friend34.C: New test... * g++.old-deja/g++.pt/friend34.C: New test; name injection of friend template declared within template class conflicts with nested class of the same name * g++.old-deja/g++.other/badopt1.C: New test; post-increment is ignored * g++.old-deja/g++.other/decl1.C: New test; incorrect parsing of object with direct initializer as function declaration * g++.old-deja/g++.other/decl2.C: New test; duplicate initializers * g++.old-deja/g++.other/null2.C: New test; conditional operator involving const pointer and NULL produces incorrect result * g++.old-deja/g++.other/typename1.C: New test; template-dependent type name without `typename' should be rejected with -pedantic From-SVN: r22770 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 48e914e2d6b..eea6d0c466d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,23 @@ +1998-10-03 Alexandre Oliva + + * g++.old-deja/g++.pt/friend34.C: New test; name injection of + friend template declared within template class conflicts with + nested class of the same name + + * g++.old-deja/g++.other/badopt1.C: New test; post-increment + is ignored + + * g++.old-deja/g++.other/decl1.C: New test; incorrect parsing of + object with direct initializer as function declaration + + * g++.old-deja/g++.other/decl2.C: New test; duplicate initializers + + * g++.old-deja/g++.other/null2.C: New test; conditional operator + involving const pointer and NULL produces incorrect result + + * g++.old-deja/g++.other/typename1.C: New test; template-dependent + type name without `typename' should be rejected with -pedantic + Fri Oct 2 21:55:58 1998 Richard Henderson * g++.old-deja/g++.other/addrof1.C: New test. diff --git a/gcc/testsuite/g++.old-deja/g++.other/badopt1.C b/gcc/testsuite/g++.old-deja/g++.other/badopt1.C new file mode 100644 index 00000000000..ea8b6844b68 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/badopt1.C @@ -0,0 +1,17 @@ +// Based on a testcase by Bryan Weston +// egcs 1.1 fails to increment count + +// execution test - XFAIL *-*-* + +#include + +struct Base { Base() {} }; // removing the constructor fixes the problem +struct Derived : Base {}; // so does removing the base class + +int main() { + int count = 0; + Derived* array[1]; // making this Base*[1] does not fix the problem + array[count++] = new Derived (); // but then new Base() does + if (count!=1) + std::abort(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/decl1.C b/gcc/testsuite/g++.old-deja/g++.other/decl1.C new file mode 100644 index 00000000000..7a55ce0cdeb --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/decl1.C @@ -0,0 +1,10 @@ +// Build don't link: +// Based on a test case by Phil Blecker + +// excess errors test - XFAIL *-*-* + +int foo(int); +int bar() { + int baz(int(foo(0))); + int foo = baz; +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/decl2.C b/gcc/testsuite/g++.old-deja/g++.other/decl2.C new file mode 100644 index 00000000000..e50a7e75278 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/decl2.C @@ -0,0 +1,7 @@ +// Build don't link: +// Based on a test-case by Maciej Radziejewski + +int i(0)(1); // ERROR - multiple initialization - XCRASH *-*-* +int j(2) = 3; // ERROR - multiple initialization +int k(4)(5)(6); // ERROR - multiple initialization +int m, n(7)(8); // ERROR - multiple initialization diff --git a/gcc/testsuite/g++.old-deja/g++.other/null2.C b/gcc/testsuite/g++.old-deja/g++.other/null2.C new file mode 100644 index 00000000000..4659655ba9a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/null2.C @@ -0,0 +1,14 @@ +// Based on a testcase by Eric Dumazet + +// execution test - XFAIL *-*-* + +#include + +const char * const foo = ""; // foo is not NULL + +int main() { + if ((foo == 0) ? 0 : foo) // so this should evaluate to `foo' + return 0; + else + std::abort(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/typename1.C b/gcc/testsuite/g++.old-deja/g++.other/typename1.C new file mode 100644 index 00000000000..2921b3d3c02 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/typename1.C @@ -0,0 +1,17 @@ +// This code snippet should be rejected with -pedantic +// Based on a test case by Louidor Erez + +// Build don't link: +// Special g++ Options: -pedantic + +template +class Vector { +public: + typedef T* iterator; +}; + +template +void f() +{ + Vector::iterator i = 0; // ERROR - missing typename - XFAIL *-*-* +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/friend34.C b/gcc/testsuite/g++.old-deja/g++.pt/friend34.C new file mode 100644 index 00000000000..8ba2c739d30 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/friend34.C @@ -0,0 +1,15 @@ +// Build don't link: +// excess errors test - XFAIL *-*-* + +// This testcase won't fail if class ::foo is forward-declared in the +// global namespace, nor if class bar is not a template class. + +template +class bar { +public: + friend class foo; // this is not bar::foo, it forward-declares ::foo + class foo {}; + bar() { foo(); } // but this should refer to bar::foo +}; + +bar<> baz;