gcc/testsuite/g++.dg/cpp0x/auto10.C
raw| 1 | // Positive test for auto |
| 2 | // { dg-do run { target c++11 } } |
| 3 | |
| 4 | #include <typeinfo> |
| 5 | extern "C" void abort(); |
| 6 | |
| 7 | int main() |
| 8 | { |
| 9 | if (auto i = 42L) |
| 10 | { |
| 11 | if (typeid (i) != typeid (long int)) |
| 12 | abort (); |
| 13 | } |
| 14 | |
| 15 | while (auto i = 1) |
| 16 | { |
| 17 | if (typeid (i) != typeid (int)) |
| 18 | abort (); |
| 19 | break; |
| 20 | } |
| 21 | } |