diff options
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/template/conv14.C')
-rw-r--r-- | gcc-4.9/gcc/testsuite/g++.dg/template/conv14.C | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/template/conv14.C b/gcc-4.9/gcc/testsuite/g++.dg/template/conv14.C new file mode 100644 index 000000000..509ae6a65 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/template/conv14.C @@ -0,0 +1,30 @@ +// PR c++/61647 + +class XX; + +template<typename Container, typename Key> +struct Accessor; + +template<typename Container, typename Key, typename KeyStore = Key> +class Variant { +protected: + KeyStore index; + Container state; +public: + Variant(Container st, const Key& i) : index(i), state(st) {} + + template<typename T> + operator T() const { + return Accessor<Container, KeyStore>::template get<T>(state, index); + } +}; + +class AutoCleanVariant : public Variant<XX*, int> { +public: + AutoCleanVariant(XX* st, int i) : Variant<XX*,int>(st,i) {} + + template<typename T> + operator T() const { + return Variant<XX*, int>::operator T(); + } +}; |