summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/inherit/operator2.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/inherit/operator2.C')
-rw-r--r--gcc/testsuite/g++.dg/inherit/operator2.C22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/inherit/operator2.C b/gcc/testsuite/g++.dg/inherit/operator2.C
new file mode 100644
index 000000000..09407e1b4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/inherit/operator2.C
@@ -0,0 +1,22 @@
+typedef int INT_TYPEDEF;
+
+template<class T>
+class TypedIfc
+{
+public:
+ virtual ~TypedIfc() { }
+ virtual operator const T&() const = 0;
+ virtual const T& operator= (const T& t) = 0;
+};
+
+template<class Tnative>
+class NullIfc : public TypedIfc<Tnative>
+{
+public:
+ const Tnative& operator= (const Tnative& t) { return t; }
+ operator const Tnative&() const { return *(Tnative *)0; }
+};
+
+typedef TypedIfc<INT_TYPEDEF> INT_TYPEDEFIfc;
+
+NullIfc<int> i32;