diff options
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this14.C')
-rw-r--r-- | gcc-4.9/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this14.C | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this14.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this14.C new file mode 100644 index 0000000..9834bfd --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this14.C @@ -0,0 +1,49 @@ +// PR c++/52014 +// { dg-require-effective-target c++11 } + +template <class Iterator, class Func> +void for_each(const Iterator first, const Iterator last, Func func) +{ + for (Iterator it = first; it != last; ++it) { + func(*it); + } +} + +template <class T> +struct helper +{ + typedef typename T::size_type type; +}; + +template <class T> +struct helper<T&> +{ + typedef typename T::size_type type; +}; + +template <class T> +struct helper<T*> +{ + typedef typename T::size_type type; +}; + +struct bar +{ + struct foo + { + typedef int size_type; + } foo_; + + void test() + { + int arr[] = { 1, 2, 3 }; + for_each(arr, arr + 3, [&](helper<foo>::type i) { + for_each(arr, arr + 3, [&](helper<decltype(foo_)>::type j) { }); + }); + } +}; + +int main() +{ + return 0; +} |