Debian Codegraph @

gcc/testsuite/g++.dg/cpp0x/initlist92.C

raw
1 // PR c++/64665, DR 1467
2 // { dg-do compile { target c++11 } }
3 // { dg-skip-if "requires hosted libstdc++ for string" { ! hostedlib } }
4
5 #include <string>
6
7 bool Test1(bool);
8 bool Test1(std::string) = delete;
9
10 bool Test2(int) = delete;
11 bool Test2(std::initializer_list<int>);
12
13 struct S
14 {
15 S(int _a) : a(_a) {}
16 private:
17 int a;
18 };
19 bool Test3(int);
20 bool Test3(S) = delete;
21
22 bool Test4(bool) = delete;
23 bool Test4(std::initializer_list<std::string>);
24
25 int main ()
26 {
27 ( Test1({"false"}) ); // { dg-error "narrowing" }
28 ( Test2({123}) );
29 ( Test3({456}) );
30 ( Test4({"false"}) );
31 }