diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x/range-for36.C')
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/range-for36.C | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/range-for36.C b/gcc/testsuite/g++.dg/cpp0x/range-for36.C new file mode 100644 index 00000000000..fdf7f7b27ae --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/range-for36.C @@ -0,0 +1,32 @@ +// PR c++/85515 +// { dg-do compile { target c++11 } } + +int a[10]; + +void +foo () +{ + for (auto &i : a) + if (i != *__for_begin // { dg-error "was not declared in this scope" } + || &i == __for_end // { dg-error "was not declared in this scope" } + || &__for_range[0] != &a[0]) // { dg-error "was not declared in this scope" } + __builtin_abort (); +} + +template <int N> +void +bar () +{ + for (auto &i : a) + if (i != *__for_begin // { dg-error "was not declared in this scope" } + || &i == __for_end // { dg-error "was not declared in this scope" } + || &__for_range[0] != &a[0]) // { dg-error "was not declared in this scope" } + __builtin_abort (); +} + +void +baz () +{ + foo (); + bar <0> (); +} |