From 1b83352ef7515f3468d296de64f28037f114627e Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Sat, 2 Dec 2000 15:28:08 +0000 Subject: * g++.old-deja/g++.other/instan2.C * g++.old-deja/g++.other/instan3.C: New test. From-SVN: r37952 --- gcc/testsuite/ChangeLog | 5 ++ gcc/testsuite/g++.old-deja/g++.other/instan2.C | 15 ++++++ gcc/testsuite/g++.old-deja/g++.other/instan3.C | 65 ++++++++++++++++++++++++++ 3 files changed, 85 insertions(+) create mode 100644 gcc/testsuite/g++.old-deja/g++.other/instan2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.other/instan3.C (limited to 'gcc') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a77c2ef..716abf4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2000-12-02 Neil Booth + * g++.old-deja/g++.other/instan2.C + * g++.old-deja/g++.other/instan3.C: New test. + +2000-12-02 Neil Booth + * gcc.dg/cpp/c++98.c,c++98-pedantic.c,c89.c,c89-pedantic.c, c94.c,c94-pedantic.c,c99.c,c99-pedantic.c,gnuc89.c,gnuc89-pedantic.c, gnuc99.c,gnuc99-pedantic.c: New tests. diff --git a/gcc/testsuite/g++.old-deja/g++.other/instan2.C b/gcc/testsuite/g++.old-deja/g++.other/instan2.C new file mode 100644 index 0000000..822de9e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/instan2.C @@ -0,0 +1,15 @@ +// Build don't link: +// Origin: Neil Booth, from bug report #44 + +#include + +template +struct X +{ +}; + +template +X operator+(const X&, const X&); + +template<> +X operator+(const X&, const X&); diff --git a/gcc/testsuite/g++.old-deja/g++.other/instan3.C b/gcc/testsuite/g++.old-deja/g++.other/instan3.C new file mode 100644 index 0000000..ae53224 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/instan3.C @@ -0,0 +1,65 @@ +// Build don't link: +// Origin: Neil Booth, from bug report #36 + +template class vect; +template vect operator-( const vect&, const vect& ); + +template +class vect +{ +public: + vect( t a ); + + vect( const vect& v ); + ~vect(); + + vect& operator=( const vect& v ); + vect operator-( void ) const; + friend vect operator- <>( const vect&, const vect& ); + +private: + t a_; +}; + +template inline +vect::vect( t a ) +: a_(a) +{ +} + +template inline +vect::vect( const vect& v ) +: a_(v.a_) +{ +} + +template inline +vect::~vect() +{ +} + +template inline vect& +vect::operator=( const vect& v ) +{ + a_ = v.a_; + return *this; +} + +template inline vect +vect::operator-( void ) const +{ + return vect( -a_ ); +} + +template inline vect +operator-( const vect& u, const vect& v ) +{ + return vect( u.a_ - v.a_ ); +} + +int +main( void ) +{ + vect a( 1.0 ), b( 0.0 ); + b = -a; +} -- cgit v1.1