[TestCases] New C++ testcases.

Andrew Pinski pinskia@physics.uc.edu
Thu Jul 17 21:03:00 GMT 2003


Here are new testcases for PR c++/10476, 11027, 11070, 11071, 11490, 
8222, and 9907.
These were all fixed on the mainline, almost all were regressions from 
3.3
(8222 and maybe 11070 and 11071, which did not ICE were not 
regressions).
Ok?


ChangeLog:

	PR c++/10476
	* g++.dg/expr/crash-1.C: New test.

	PR c++/11027
	* g++.dg/template/init3.C : New test.

	PR c++/8222
	* g++.dg/template/non-dependent1.C: New test.

	PR c++/11070
	* g++.dg/template/non-dependent2.C: New test.

	PR c++/11071
	* g++.dg/template/non-dependent3.C: New test.

	PR c++/9907
	* g++.dg/template/sizeof5.C: New test.

g++.dg/expr/crash-1.C:
// C++ PR/10476
// Origin: larsbj@gullik.net and bangerth@dealii.org


struct X {
   X();
   X(const X& __str);
};
X const bar();
void foo()
{
   X y;
   (true ? y : bar());
}

g++.dg/template/init3.C:
// PR c++/11027

template <class T>
struct X {
    typedef void (X::*pfun)();
    static pfun p[];
};

template <class T>
typename X<T>::pfun X<T>::p[] = {};

g++.dg/template/non-dependent1.C:
//PR c++/8222
// Origin: giovannibajo@libero.it and setzersn@gmx.de

// { dg-do run }

struct Foo
{
     template <class>
     void func() {}
};
template <class>
void Bar(Foo* p)
{
     p->func<int>();
}

int main()
{
     Foo c;
     Bar<int>(&c);
}

g++.dg/template/non-dependent2.C:
//PR c++/11070
// Used to ICE
// Origin: bangerth@dealii.org and rwgk@yahoo.com

template <bool b> struct X {
     template <typename T>
     static int* execute(int* x) { return x; }
};

template <typename T> void foo() {
   static bool const same = true;
   X<same>::execute<int> (0);
}

template void foo<int> ();

g++.dg/template/non-dependent3.C:
//PR c++/11071
// Used to ICE
// Origin: bangerth@dealii.org and rwgk@yahoo.com

template <bool b> struct X {
     template <typename T>
     static int* execute(T* x) { return x; }
};

template <typename T> void foo() {
   static bool const same = true;
   X<same>::execute ((int*)0);
}

template void foo<int> ();

g++.dg/template/sizeof5.C:
// PR c++/9907
// Origin: nes@lrde.epita.fr
// sizeof(foo()) was not considered constant.


template <unsigned n> struct bar {};

int foo();

template <class T>
void baz()
{
   bar<sizeof(foo())> b;
}



More information about the Gcc-patches mailing list