diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x/auto10.C')
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/auto10.C | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/auto10.C b/gcc/testsuite/g++.dg/cpp0x/auto10.C new file mode 100644 index 000000000..9b89291d6 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/auto10.C @@ -0,0 +1,22 @@ +// Positive test for auto +// { dg-do run } +// { dg-options "-std=c++0x" } + +#include <typeinfo> +extern "C" void abort(); + +int main() +{ + if (auto i = 42L) + { + if (typeid (i) != typeid (long int)) + abort (); + } + + while (auto i = 1) + { + if (typeid (i) != typeid (int)) + abort (); + break; + } +} |