diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/template/memclass3.C')
-rw-r--r-- | gcc/testsuite/g++.dg/template/memclass3.C | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/template/memclass3.C b/gcc/testsuite/g++.dg/template/memclass3.C new file mode 100644 index 000000000..8230b94e5 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/memclass3.C @@ -0,0 +1,39 @@ +// PR c++/17132 + +template <typename T> +struct has_deref +{ + struct impl + { + template < + typename Type, + typename Type::reference (Type::*Func)(void) const> + struct func_tag; + + template <typename Type> + static char (& test( + Type *, + func_tag<Type, &Type::operator*> * = 0 + ))[2]; + static char test(void *); + }; + + static const bool value = (sizeof(impl::test((T *) 0)) == 2); +}; + +template <typename T> +struct container +{ + struct iterator + { + typedef T & reference; + reference operator*() const; + }; +}; + +int main() +{ + typedef container<int>::iterator iter; + int result = has_deref<iter>::value; + return result; +} |