Commit 4bd56354 by Volker Reichelt Committed by Volker Reichelt

re PR c++/3004 (Accepts illegal code)

	PR c++/3004
	* g++.dg/parse/typedef3.C: New test.

	PR c++/7906
	* g++.dg/parse/operator2.C: New test.

	PR c++/8895
	* g++.dg/parse/def-tmpl-arg1.C: New test.

	PR c++/9282
	* g++.dg/parse/funptr1.C: New test.

	PR c++/9452
	* g++.dg/parse/ambig3.C: New test.

	PR c++/9454
	* g++.dg/parse/operator3.C: New test.

	PR c++/9486
	* g++.dg/parse/template10.C: New test.

	PR c++/9488
	* g++.dg/parse/template11.C: New test.

	PR c++/10150
	* g++.dg/parse/invalid-op1.C: New test.

	PR c++/10247
	* g++.dg/parse/condexpr1.C: New test.

From-SVN: r69670
parent e0d1297c
2003-07-22 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/3004
* g++.dg/parse/typedef3.C: New test.
PR c++/7906
* g++.dg/parse/operator2.C: New test.
PR c++/8895
* g++.dg/parse/def-tmpl-arg1.C: New test.
PR c++/9282
* g++.dg/parse/funptr1.C: New test.
PR c++/9452
* g++.dg/parse/ambig3.C: New test.
PR c++/9454
* g++.dg/parse/operator3.C: New test.
PR c++/9486
* g++.dg/parse/template10.C: New test.
PR c++/9488
* g++.dg/parse/template11.C: New test.
PR c++/10150
* g++.dg/parse/invalid-op1.C: New test.
PR c++/10247
* g++.dg/parse/condexpr1.C: New test.
2003-07-22 Nathan Sidwell <nathan@codesourcery.com> 2003-07-22 Nathan Sidwell <nathan@codesourcery.com>
* g++.dg/ext/packed3.C: New test. * g++.dg/ext/packed3.C: New test.
......
// PR c++/9452
// Origin: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
// { dg-do compile }
template <int> struct A { static const int i = 1; };
template <int> struct B {};
template <typename> void foo(B<0>) {} // { dg-error "" }
template <typename, int j> B<A<j>::i-1> foo(B<j>) { return B<0>(); } // { dg-error "" }
void bar() { foo<int>(B<0>()); } // { dg-error "ambiguous" }
// PR c++/10247
// Origin: Lars Gullik Bjønes <larsbj@lyx.org>
// { dg-do compile }
struct A {};
A const foo();
void bar()
{
A a = foo();
A b = true ? a : foo();
}
// PR c++/8895
// Origin: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
// { dg-do compile }
template <typename X, typename Y = B<X> > struct A // { dg-error "" }
{
A();
A(const A&);
}; // { dg-error "" }
// PR c++/9282
// Origin: Thomas Richter <thor@math.tu-berlin.de>
// { dg-do compile }
typedef void (*fptr)();
struct A
{
template<int> static void foo() {}
template<fptr f> static void bar() { (*f)(); }
};
fptr f = A::bar< A::foo<0> >;
// PR c++/10150
// Origin: Tom Evans <te200@eng.cam.ac.uk>
// { dg-do compile }
template <int I> struct A
{
template <int> struct B
{
enum { e = I * A<I-1>::B }; // { dg-error "" }
};
};
A<0>::B<0> a; // { dg-error "instantiated" }
// PR c++/7906
// Origin: Marcel Loose <loose@astron.nl>
// { dg-do compile }
template <typename> struct A { typedef int X; };
template <typename T> struct B
{
typedef A<T> Y;
struct C { operator typename Y::X() const; };
};
template <typename T> B<T>::C::operator typename B<T>::Y::X() const { return 0; }
B<int> b;
// PR c++/9454
// Origin: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
// { dg-do compile }
template <int> struct A
{
struct B { operator int (); };
struct C : B { operator int (); };
};
A<0> a;
// PR c++/9486
// Origin: John Levon <levon@movementarian.org>
// { dg-do compile }
template <typename> struct A
{
template <typename T> void foo(T);
};
template <typename T> void bar()
{
A<void>().template foo<T>(0);
}
template void bar<int>();
// PR c++/9488
// Origin: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
// { dg-do compile }
struct A
{
template <typename> void foo() {}
};
template <typename T> struct B
{
void bar() { A().foo<T>(); }
};
template struct B<int>;
// PR c++/3004
// Origin: Travis J.I. Corcoran <tjic@permabit.com>
// { dg-do compile }
struct A { typedef A* Ptr; };
struct A::Ptr; // { dg-error "" }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment