diff options
Diffstat (limited to 'gcc/testsuite/g++.old-deja')
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.other/cleanup2.C | 26 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.other/overcnv2.C | 18 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.robertl/eb42.C | 19 |
3 files changed, 44 insertions, 19 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.other/cleanup2.C b/gcc/testsuite/g++.old-deja/g++.other/cleanup2.C new file mode 100644 index 00000000000..4cd0b55e43d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/cleanup2.C @@ -0,0 +1,26 @@ +// Origin: Bryan Scattergood <bryan@fsel.com> +// Special g++ Options: -O -fno-exceptions + +extern "C" void abort(); + +class A +{ +public: + A(); + ~A(); + int foo(); +}; + +A::A() {} +A::~A() { abort (); } +int A::foo() {} + +extern int f() +{ + return 0; +} + +int main() +{ + return ((f() != 0) ? A().foo() : 0); +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/overcnv2.C b/gcc/testsuite/g++.old-deja/g++.other/overcnv2.C new file mode 100644 index 00000000000..725ce0991ce --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/overcnv2.C @@ -0,0 +1,18 @@ +// Test that we resolve this case as mandated by the standard, but also +// warn about it. We choose op char* not because it is a member of B -- +// the standard says that all conversion ops are treated as coming from +// the type of the argument -- but because it is non-const. + +struct A { + operator const char *() const; +}; + +struct B : public A { + operator char *() { return 0; } +}; + +int main() +{ + B b; + (const char *)b; // WARNING - surprising overload resolution +} diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb42.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb42.C deleted file mode 100644 index 8850f9fa639..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb42.C +++ /dev/null @@ -1,19 +0,0 @@ -//Build don't link: -#include <vector.h> -#include <algo.h> - -template <class T> class Expr -{ -public : -Expr(){}; -Expr(const T&){}; -}; - -template <class T > -inline bool compare(const Expr<T> a, const Expr<T> b){ return true; }; - -int main() -{ -vector<int> a(3); -sort( a.begin(), a.end(), compare ); // ERROR - no matching function -} |