aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.8.1/gcc/testsuite/g++.dg/cpp0x/auto10.C
blob: 9b89291d6404ac40055cd2af3c081843d4af78c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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;
    }
}