comparison gcc/testsuite/g++.dg/cpp0x/auto3.C @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 1830386684a0
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 // Negative test for auto
2 // { dg-do compile { target c++11 } }
3
4 #include <initializer_list>
5
6 auto x; // { dg-error "auto" }
7
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" }
11
12 // New CWG issue
13 auto a[2] = { 1, 2 }; // { dg-error "auto|initializer_list" }
14
15 template<class T>
16 struct A { };
17
18 A<int> A1;
19 // CWG issue 625
20 A<auto> A2 = A1; // { dg-error "" "" { target { ! concepts } } }
21
22 auto foo() { } // { dg-error "auto" "" { target { ! c++14 } } }
23
24 void bar(auto i) // { dg-error "incomplete|auto" "" { target { ! concepts } } }
25 {
26 (void)i;
27 }