1 // Negative test for auto
2 // { dg-do compile { target c++11 } }
4 #include <initializer_list>
6 auto x; // { dg-error "auto" }
8 // If the type deduced for the template parameter U is not the same in each
9 // deduction, the program is ill-formed.
10 auto i = 42, j = 42.0; // { dg-error "auto" }
12 // CWG issue 2397: [dcl.type.auto.deduct]/2: "T shall not be an array type".
13 auto a[2] = { 1, 2 }; // { dg-error "20:unable to deduce" }
20 A<auto> A2 = A1; // { dg-error "" }
22 auto foo() { } // { dg-error "auto" "" { target { ! c++14 } } }
24 void bar(auto i) // { dg-error "incomplete|auto" "" { target { ! concepts } } }