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
This commit is contained in:
Alexandre Oliva 1998-10-03 02:51:23 +00:00 committed by Alexandre Oliva
parent c30cc19e56
commit 5e95b7c76d
7 changed files with 100 additions and 0 deletions

View File

@ -1,3 +1,23 @@
1998-10-03 Alexandre Oliva <oliva@dcc.unicamp.br>
* 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 <rth@cygnus.com> Fri Oct 2 21:55:58 1998 Richard Henderson <rth@cygnus.com>
* g++.old-deja/g++.other/addrof1.C: New test. * g++.old-deja/g++.other/addrof1.C: New test.

View File

@ -0,0 +1,17 @@
// Based on a testcase by Bryan Weston <bryanw@bluemoon.sps.mot.com>
// egcs 1.1 fails to increment count
// execution test - XFAIL *-*-*
#include <cstdlib>
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();
}

View File

@ -0,0 +1,10 @@
// Build don't link:
// Based on a test case by Phil Blecker <tmwg@inxservices.com>
// excess errors test - XFAIL *-*-*
int foo(int);
int bar() {
int baz(int(foo(0)));
int foo = baz;
}

View File

@ -0,0 +1,7 @@
// Build don't link:
// Based on a test-case by Maciej Radziejewski <maciejr@iws.uni-stuttgart.de>
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

View File

@ -0,0 +1,14 @@
// Based on a testcase by Eric Dumazet <Eric.Dumazet@COSMOSBAY.COM>
// execution test - XFAIL *-*-*
#include <cstdlib>
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();
}

View File

@ -0,0 +1,17 @@
// This code snippet should be rejected with -pedantic
// Based on a test case by Louidor Erez <s3824888@techst02.technion.ac.il>
// Build don't link:
// Special g++ Options: -pedantic
template<class T>
class Vector {
public:
typedef T* iterator;
};
template<class T>
void f()
{
Vector<T>::iterator i = 0; // ERROR - missing typename - XFAIL *-*-*
}

View File

@ -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 <typename T = void>
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;