1// PR c++/17132
2
3template <typename T>
4struct has_deref
5{
6    struct impl
7    {
8        template <
9            typename Type,
10            typename Type::reference (Type::*Func)(void) const>
11        struct func_tag;
12
13        template <typename Type>
14        static char (& test(
15            Type *,
16            func_tag<Type, &Type::operator*> * = 0
17        ))[2];
18        static char test(void *);
19    };
20
21    static const bool value = (sizeof(impl::test((T *) 0)) == 2);
22};
23
24template <typename T>
25struct container
26{
27    struct iterator
28    {
29        typedef T & reference;
30        reference operator*() const;
31    };
32};
33
34int main()
35{
36    typedef container<int>::iterator iter;
37    int result = has_deref<iter>::value;
38    return result;
39}
40