annotate gcc/testsuite/g++.dg/cpp0x/auto3.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 // Negative test for auto
kono
parents:
diff changeset
2 // { dg-do compile { target c++11 } }
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 #include <initializer_list>
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 auto x; // { dg-error "auto" }
kono
parents:
diff changeset
7
kono
parents:
diff changeset
8 // If the type deduced for the template parameter U is not the same in each
kono
parents:
diff changeset
9 // deduction, the program is ill-formed.
kono
parents:
diff changeset
10 auto i = 42, j = 42.0; // { dg-error "auto" }
kono
parents:
diff changeset
11
kono
parents:
diff changeset
12 // New CWG issue
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
13 auto a[2] = { 1, 2 }; // { dg-error "6:.a. declared as array of .auto" }
111
kono
parents:
diff changeset
14
kono
parents:
diff changeset
15 template<class T>
kono
parents:
diff changeset
16 struct A { };
kono
parents:
diff changeset
17
kono
parents:
diff changeset
18 A<int> A1;
kono
parents:
diff changeset
19 // CWG issue 625
kono
parents:
diff changeset
20 A<auto> A2 = A1; // { dg-error "" "" { target { ! concepts } } }
kono
parents:
diff changeset
21
kono
parents:
diff changeset
22 auto foo() { } // { dg-error "auto" "" { target { ! c++14 } } }
kono
parents:
diff changeset
23
kono
parents:
diff changeset
24 void bar(auto i) // { dg-error "incomplete|auto" "" { target { ! concepts } } }
kono
parents:
diff changeset
25 {
kono
parents:
diff changeset
26 (void)i;
kono
parents:
diff changeset
27 }